Skip to contentSkip to conversation

powerpc sound, some more patches

PATCH In review Johannes Berg 3 participants 19 messages Jul 18, 2006 – Aug 5, 2006

Subsystems (3)
lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/5 aoa: feature gpio layer: fix IRQ access

In reply to Johannes Berg

The IRQ rework caused some hiccups here, in some cases we call get_irq without a device node. This patch makes it catch that case and return NO_IRQ when it happens, along with changing the place where the irq is checked to check for NO_IRQ instead of -1.

sound/aoa/core/snd-aoa-gpio-feature.c +5 -2
@@ -112,7 +112,10 @@ static struct device_node *get_gpio(char
 
 static void get_irq(struct device_node * np, int *irqptr)
 {
-	*irqptr = irq_of_parse_and_map(np, 0);
+	if (np)
+		*irqptr = irq_of_parse_and_map(np, 0);
+	else
+		*irqptr = NO_IRQ;
 }
 
 /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */
@@ -322,7 +325,7 @@ static int ftr_set_notify(struct gpio_ru
 		return -EINVAL;
 	}
 
-	if (irq == -1)
+	if (irq == NO_IRQ)
 		return -ENODEV;
 
 	mutex_lock(&notif->mutex);

--

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author maintainer
#4 lore raw

PATCH 2/5 aoa: fix toonie codec

In reply to Johannes Berg

This patch fixes the toonie codec to be actually usable.

sound/aoa/codecs/snd-aoa-codec-toonie.c +13 -4
@@ -51,6 +51,13 @@ static struct transfer_info toonie_trans
 	{}
 };
 
+static int toonie_usable(struct codec_info_item *cii,
+			 struct transfer_info *ti,
+			 struct transfer_info *out)
+{
+	return 1;
+}
+
 #ifdef CONFIG_PM
 static int toonie_suspend(struct codec_info_item *cii, pm_message_t state)
 {
@@ -69,6 +76,7 @@ static struct codec_info toonie_codec_in
 	.sysclock_factor = 256,
 	.bus_factor = 64,
 	.owner = THIS_MODULE,
+	.usable = toonie_usable,
 #ifdef CONFIG_PM
 	.suspend = toonie_suspend,
 	.resume = toonie_resume,
@@ -79,19 +87,20 @@ static int toonie_init_codec(struct aoa_
 {
 	struct toonie *toonie = codec_to_toonie(codec);
 
+	/* nothing connected? what a joke! */
+	if (toonie->codec.connected != 1)
+		return -ENOTCONN;
+
 	if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) {
 		printk(KERN_ERR PFX "failed to create toonie snd device!\n");
 		return -ENODEV;
 	}
 
-	/* nothing connected? what a joke! */
-	if (toonie->codec.connected != 1)
-		return -ENOTCONN;
-
 	if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev,
 						     aoa_get_card(),
 						     &toonie_codec_info, toonie)) {
 		printk(KERN_ERR PFX "error creating toonie pcm\n");
+		snd_device_free(aoa_get_card(), toonie);
 		return -ENODEV;
 	}
 

--

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author maintainer
#6 lore raw

PATCH 3/5 make snd-powermac load even when it cant bind the device

In reply to Johannes Berg

This patch makes snd-powermac load when it can't bind the device right away. That's the expected behaviour for hotplugging, but fixes an important problem I was seeing with doing a modprobe snd-powermac with a version that refuses loading on machines with layout-id: snd-powermac would create a bunch of uevents and then refuse to load, the uevents causing udev to reload it again, ad eternum.

sound/ppc/powermac.c +3 -10
@@ -181,21 +181,14 @@ static int __init alsa_card_pmac_init(vo
 	if ((err = platform_driver_register(&snd_pmac_driver)) < 0)
 		return err;
 	device = platform_device_register_simple(SND_PMAC_DRIVER, -1, NULL, 0);
-	if (!IS_ERR(device)) {
-		if (platform_get_drvdata(device))
-			return 0;
-		platform_device_unregister(device);
-		err = -ENODEV;
-	} else
-		err = PTR_ERR(device);
-	platform_driver_unregister(&snd_pmac_driver);
-	return err;
+	return 0;
 
 }
 
 static void __exit alsa_card_pmac_exit(void)
 {
-	platform_device_unregister(device);
+	if (!IS_ERR(device))
+		platform_device_unregister(device);
 	platform_driver_unregister(&snd_pmac_driver);
 }
 

--

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author maintainer
#10 lore raw

PATCH 5/5 add MAINTAINERS entry for snd-aoa

In reply to Johannes Berg

This adds me into the MAINTAINERS file for the AOA driver.

MAINTAINERS +7 -0
@@ -292,6 +292,13 @@ L:	[email protected]
 W:	http://www.amd.com/us-en/ConnectivitySolutions/TechnicalResources/0,,50_2334_2452_11363,00.html
 S:	Supported
 
+AOA (Apple Onboard Audio) ALSA DRIVER
+P:	Johannes Berg
+M:	[email protected]
+L:	[email protected]
+L:	[email protected]
+S:	Maintained
+
 APM DRIVER
 P:	Stephen Rothwell
 M:	[email protected]

--

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author maintainer
#8 lore raw

PATCH 4/5 aoa: platform function gpio: ignore errors from functions that dont exist

In reply to Johannes Berg

Sometimes we simply want to turn off or on everything, and when recently a warning was added when a certain platform function can't be called, this triggered all the time in those cases. This patch shows the warning only if the error was different from the function not existing.

The alternative would be to not even try calling the function when it doesn't exist by first checking which exist and then only calling those that do, but that adds complexity that isn't necessary.

sound/aoa/core/snd-aoa-gpio-pmf.c +1 -1
@@ -18,7 +18,7 @@ static void pmf_gpio_set_##name(struct g
 							\
 	if (unlikely(!rt)) return;				\
 	rc = pmf_call_function(rt->node, #name "-mute", &args);	\
-	if (rc)							\
+	if (rc && rc != -ENODEV)				\
 		printk(KERN_WARNING "pmf_gpio_set_" #name	\
 		" failed, rc: %d\n", rc);			\
 	rt->implementation_private &= ~(1<<bit);		\

--

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author maintainer
#11 lore raw

PATCH 5/5 add MAINTAINERS entry for snd-aoa

In reply to Johannes Berg

This adds me into the MAINTAINERS file for the AOA driver.

MAINTAINERS +7 -0
@@ -292,6 +292,13 @@ L:	[email protected]
 W:	http://www.amd.com/us-en/ConnectivitySolutions/TechnicalResources/0,,50_2334_2452_11363,00.html
 S:	Supported
 
+AOA (Apple Onboard Audio) ALSA DRIVER
+P:	Johannes Berg
+M:	[email protected]
+L:	[email protected]
+L:	[email protected]
+S:	Maintained
+
 APM DRIVER
 P:	Stephen Rothwell
 M:	[email protected]

--

Johannes Berg

author maintainer
#0 lore raw

cover powerpc sound, some more patches

Here's a new and hopefully final round of patches fixing problems with my new snd-aoa driver. There are fixes for the PPC Mac Mini as well as for a problem with snd-powermac that I had noticed.

author maintainer
#2 lore raw

PATCH 1/5 aoa: feature gpio layer: fix IRQ access

The IRQ rework caused some hiccups here, in some cases we call get_irq without a device node. This patch makes it catch that case and return NO_IRQ when it happens, along with changing the place where the irq is checked to check for NO_IRQ instead of -1.

sound/aoa/core/snd-aoa-gpio-feature.c +5 -2
@@ -112,7 +112,10 @@ static struct device_node *get_gpio(char
 
 static void get_irq(struct device_node * np, int *irqptr)
 {
-	*irqptr = irq_of_parse_and_map(np, 0);
+	if (np)
+		*irqptr = irq_of_parse_and_map(np, 0);
+	else
+		*irqptr = NO_IRQ;
 }
 
 /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */
@@ -322,7 +325,7 @@ static int ftr_set_notify(struct gpio_ru
 		return -EINVAL;
 	}
 
-	if (irq == -1)
+	if (irq == NO_IRQ)
 		return -ENODEV;
 
 	mutex_lock(&notif->mutex);

--

author maintainer
#5 lore raw

PATCH 2/5 aoa: fix toonie codec

In reply to Johannes Berg

This patch fixes the toonie codec to be actually usable.

sound/aoa/codecs/snd-aoa-codec-toonie.c +13 -4
@@ -51,6 +51,13 @@ static struct transfer_info toonie_trans
 	{}
 };
 
+static int toonie_usable(struct codec_info_item *cii,
+			 struct transfer_info *ti,
+			 struct transfer_info *out)
+{
+	return 1;
+}
+
 #ifdef CONFIG_PM
 static int toonie_suspend(struct codec_info_item *cii, pm_message_t state)
 {
@@ -69,6 +76,7 @@ static struct codec_info toonie_codec_in
 	.sysclock_factor = 256,
 	.bus_factor = 64,
 	.owner = THIS_MODULE,
+	.usable = toonie_usable,
 #ifdef CONFIG_PM
 	.suspend = toonie_suspend,
 	.resume = toonie_resume,
@@ -79,19 +87,20 @@ static int toonie_init_codec(struct aoa_
 {
 	struct toonie *toonie = codec_to_toonie(codec);
 
+	/* nothing connected? what a joke! */
+	if (toonie->codec.connected != 1)
+		return -ENOTCONN;
+
 	if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) {
 		printk(KERN_ERR PFX "failed to create toonie snd device!\n");
 		return -ENODEV;
 	}
 
-	/* nothing connected? what a joke! */
-	if (toonie->codec.connected != 1)
-		return -ENOTCONN;
-
 	if (toonie->codec.soundbus_dev->attach_codec(toonie->codec.soundbus_dev,
 						     aoa_get_card(),
 						     &toonie_codec_info, toonie)) {
 		printk(KERN_ERR PFX "error creating toonie pcm\n");
+		snd_device_free(aoa_get_card(), toonie);
 		return -ENODEV;
 	}
 

--

author maintainer
#7 lore raw

PATCH 3/5 make snd-powermac load even when it cant bind the device

In reply to Johannes Berg

This patch makes snd-powermac load when it can't bind the device right away. That's the expected behaviour for hotplugging, but fixes an important problem I was seeing with doing a modprobe snd-powermac with a version that refuses loading on machines with layout-id: snd-powermac would create a bunch of uevents and then refuse to load, the uevents causing udev to reload it again, ad eternum.

sound/ppc/powermac.c +3 -10
@@ -181,21 +181,14 @@ static int __init alsa_card_pmac_init(vo
 	if ((err = platform_driver_register(&snd_pmac_driver)) < 0)
 		return err;
 	device = platform_device_register_simple(SND_PMAC_DRIVER, -1, NULL, 0);
-	if (!IS_ERR(device)) {
-		if (platform_get_drvdata(device))
-			return 0;
-		platform_device_unregister(device);
-		err = -ENODEV;
-	} else
-		err = PTR_ERR(device);
-	platform_driver_unregister(&snd_pmac_driver);
-	return err;
+	return 0;
 
 }
 
 static void __exit alsa_card_pmac_exit(void)
 {
-	platform_device_unregister(device);
+	if (!IS_ERR(device))
+		platform_device_unregister(device);
 	platform_driver_unregister(&snd_pmac_driver);
 }
 

--

author maintainer
#9 lore raw

PATCH 4/5 aoa: platform function gpio: ignore errors from functions that dont exist

In reply to Johannes Berg

Sometimes we simply want to turn off or on everything, and when recently a warning was added when a certain platform function can't be called, this triggered all the time in those cases. This patch shows the warning only if the error was different from the function not existing.

The alternative would be to not even try calling the function when it doesn't exist by first checking which exist and then only calling those that do, but that adds complexity that isn't necessary.

sound/aoa/core/snd-aoa-gpio-pmf.c +1 -1
@@ -18,7 +18,7 @@ static void pmf_gpio_set_##name(struct g
 							\
 	if (unlikely(!rt)) return;				\
 	rc = pmf_call_function(rt->node, #name "-mute", &args);	\
-	if (rc)							\
+	if (rc && rc != -ENODEV)				\
 		printk(KERN_WARNING "pmf_gpio_set_" #name	\
 		" failed, rc: %d\n", rc);			\
 	rt->implementation_private &= ~(1<<bit);		\

--

Acked-by on v1 1/5
#3 lore raw

Re: [PATCH 1/5] aoa: feature gpio layer: fix IRQ access

In reply to Johannes Berg
Quoted 7 lines · Johannes Berg

plain text document attachment (aoa-get-irq-fix.patch) The IRQ rework caused some hiccups here, in some cases we call get_irq without a device node. This patch makes it catch that case and return NO_IRQ when it happens, along with changing the place where the irq is checked to check for NO_IRQ instead of -1.

Quoted 16 lines
sound/aoa/core/snd-aoa-gpio-feature.c +4 -1
@@ -112,7 +112,10 @@ static struct device_node *get_gpio(char
 
 static void get_irq(struct device_node * np, int *irqptr)
 {
-	*irqptr = irq_of_parse_and_map(np, 0);
+	if (np)
+		*irqptr = irq_of_parse_and_map(np, 0);
+	else
+		*irqptr = NO_IRQ;
 }
 
 /* 0x4 is outenable, 0x1 is out, thus 4 or 5 */

sound/aoa/core/snd-aoa-gpio-feature.c static int ftr_set_notify(struct gpio_ru

Quoted 10 lines
sound/aoa/core/snd-aoa-gpio-feature.c +1 -2
@@ -322,7 +325,7 @@ static int ftr_set_notify(struct gpio_ru
 		return -EINVAL;
 	}
 
-	if (irq == -1)
+	if (irq == NO_IRQ)
 		return -ENODEV;
 
 	mutex_lock(&notif->mutex);
 
--

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#12 lore raw
In reply to Johannes Berg

At Tue, 18 Jul 2006 19:28:41 +0200,

Quoted 4 lines · Johannes Berg

Here's a new and hopefully final round of patches fixing problems with my new snd-aoa driver. There are fixes for the PPC Mac Mini as well as for a problem with snd-powermac that I had noticed.

Thanks, now all patches are on ALSA tree.

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author maintainer
#13 lore raw
Quoted 1 line · Takashi Iwai

Thanks, now all patches are on ALSA tree.

Thanks.
These should still go into 2.6.18, will that be possible?

johannes

#14 lore raw

At Tue, 25 Jul 2006 17:13:19 +0200 (CEST),

Quoted 7 lines · Johannes Berg
Quoted 1 line · Takashi Iwai

Thanks, now all patches are on ALSA tree.

Thanks.
These should still go into 2.6.18, will that be possible?

Agreed.

Jaroslav, could you update alsa git tree for pushing? We have ca. 20 pending fixes including these ppc-patches.

Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#16 lore raw
In reply to Johannes Berg
Quoted 6 lines · Johannes Berg
Quoted 1 line · Takashi Iwai

Thanks, now all patches are on ALSA tree.

Thanks.
These should still go into 2.6.18, will that be possible?

They should still, for sure. Johannes, please sync with Paulus since I think you posted previous version of at least some of these that he's about to push to Linus via the powerpc tree.

Ben.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#17 lore raw
In reply to Johannes Berg
Quoted 6 lines · Johannes Berg
Quoted 1 line · Takashi Iwai

Thanks, now all patches are on ALSA tree.

Thanks.
These should still go into 2.6.18, will that be possible?

They should still, for sure. Johannes, please sync with Paulus since I think you posted previous version of at least some of these that he's about to push to Linus via the powerpc tree.

Ben.

author maintainer
#18 lore raw
Quoted 3 lines · Benjamin Herrenschmidt

They should still, for sure. Johannes, please sync with Paulus since I think you posted previous version of at least some of these that he's about to push to Linus via the powerpc tree.

Hm, I don't think I ever posted 'final' versions of these that I signed off, but I'll take a look.

johannes

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

author maintainer
#15 lore raw
In reply to Takashi Iwai
Quoted 3 lines

Jaroslav, could you update alsa git tree for pushing? We have ca. 20 pending fixes including these ppc-patches.

Pretty please? People are hitting these bugs every week and I always get mail about it (and probably more people hitting the bugs who don't manage to mail me...).

johannes