linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: Oops in snd-powermac on powerbook 3400
       [not found]   ` <427AE616.1030908@gmail.com>
@ 2005-05-06  5:15     ` Benjamin Herrenschmidt
  2005-05-22 17:12       ` vinai
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2005-05-06  5:15 UTC (permalink / raw)
  To: Keenan Pepper; +Cc: linuxppc-dev list, debian-powerpc@lists.debian.org

On Thu, 2005-05-05 at 23:35 -0400, Keenan Pepper wrote:
> I fixed it!
> 
> I changed it to use the same device node for sound as for chip->node, 
> and it started beeping at me! Apparently sometime between 2.6.8 and 
> 2.6.12-rc3 the KIOCSOUND ioctl was implemented, because it sure didn't 
> beep before.
> 
> BTW, this is the first time I've ever fixed a kernel bug.

Ok, I think your patch was whitespace damaged, so I re-did it by hand ;)

Here's the result. Please test. Also, other people around, please test
if with this patch, snd-powermac works, especially on oldworld machines!

I'll submit upstream tomorrow hopefully.

Ben.

Index: linux-work/sound/ppc/pmac.c
===================================================================
--- linux-work.orig/sound/ppc/pmac.c	2005-05-02 10:51:00.000000000 +1000
+++ linux-work/sound/ppc/pmac.c	2005-05-06 15:13:22.000000000 +1000
@@ -876,7 +876,7 @@
  */
 static int __init snd_pmac_detect(pmac_t *chip)
 {
-	struct device_node *sound;
+	struct device_node *sound = NULL;
 	unsigned int *prop, l;
 	struct macio_chip* macio;
 
@@ -906,20 +906,22 @@
 		chip->is_pbook_G3 = 1;
 	chip->node = find_devices("awacs");
 	if (chip->node)
-		return 0; /* ok */
+		sound = chip->node;
 
 	/*
 	 * powermac G3 models have a node called "davbus"
 	 * with a child called "sound".
 	 */
-	chip->node = find_devices("davbus");
+	if (!chip->node)
+		chip->node = find_devices("davbus");
 	/*
 	 * if we didn't find a davbus device, try 'i2s-a' since
 	 * this seems to be what iBooks have
 	 */
 	if (! chip->node) {
 		chip->node = find_devices("i2s-a");
-		if (chip->node && chip->node->parent && chip->node->parent->parent) {
+		if (chip->node && chip->node->parent &&
+		    chip->node->parent->parent) {
 			if (device_is_compatible(chip->node->parent->parent,
 						 "K2-Keylargo"))
 				chip->is_k2 = 1;
@@ -928,9 +930,11 @@
 	if (! chip->node)
 		return -ENODEV;
 
-	sound = find_devices("sound");
-	while (sound && sound->parent != chip->node)
-		sound = sound->next;
+	if (!sound) {
+		sound = find_devices("sound");
+		while (sound && sound->parent != chip->node)
+			sound = sound->next;
+	}
 	if (! sound)
 		return -ENODEV;
 	prop = (unsigned int *) get_property(sound, "sub-frame", NULL);
@@ -1019,7 +1023,8 @@
 		}
 	}
 	if (chip->pdev == NULL)
-		printk(KERN_WARNING "snd-powermac: can't locate macio PCI device !\n");
+		printk(KERN_WARNING "snd-powermac: can't locate macio PCI"
+		       " device !\n");
 
 	detect_byte_swap(chip);
 
@@ -1027,7 +1032,8 @@
 	   are available */
 	prop = (unsigned int *) get_property(sound, "sample-rates", &l);
 	if (! prop)
-		prop = (unsigned int *) get_property(sound, "output-frame-rates", &l);
+		prop = (unsigned int *) get_property(sound,
+						     "output-frame-rates", &l);
 	if (prop) {
 		int i;
 		chip->freqs_ok = 0;
@@ -1054,7 +1060,8 @@
 /*
  * exported - boolean info callbacks for ease of programming
  */
-int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol,
+				 snd_ctl_elem_info_t *uinfo)
 {
 	uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
 	uinfo->count = 2;
@@ -1063,7 +1070,8 @@
 	return 0;
 }
 
-int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol,
+			       snd_ctl_elem_info_t *uinfo)
 {
 	uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
 	uinfo->count = 1;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Oops in snd-powermac on powerbook 3400
  2005-05-06  5:15     ` Oops in snd-powermac on powerbook 3400 Benjamin Herrenschmidt
@ 2005-05-22 17:12       ` vinai
  0 siblings, 0 replies; 2+ messages in thread
From: vinai @ 2005-05-22 17:12 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, debian-powerpc@lists.debian.org

> On Thu, 2005-05-05 at 23:35 -0400, Keenan Pepper wrote:
>> I fixed it!
>>
>> I changed it to use the same device node for sound as for
>> chip->node, and it started beeping at me! Apparently sometime
>> between 2.6.8 and 2.6.12-rc3 the KIOCSOUND ioctl was implemented,
>> because it sure didn't beep before.
>>
>> BTW, this is the first time I've ever fixed a kernel bug.
>
> Ok, I think your patch was whitespace damaged, so I re-did it by hand
> ;)
>
> Here's the result. Please test. Also, other people around, please test
> if with this patch, snd-powermac works, especially on oldworld
> machines!
>
> I'll submit upstream tomorrow hopefully.
>
> Ben.

My apologies for only now replying to this, but I can confirm the patch
that originally accompanied the above e-mail also worked fine on my
8500, I'm listening to an audio CD as I type this ;-)

I just got back to playing around, and patched 2.6.11 up to 2.6.12-rc4
and did not see this patched included, so I thought I'd try to include
it myself locally.  Nice work all :)

cheers
vinai

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-22 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <42784801.7080105@gmail.com>
     [not found] ` <1115251597.7567.163.camel@gaston>
     [not found]   ` <427AE616.1030908@gmail.com>
2005-05-06  5:15     ` Oops in snd-powermac on powerbook 3400 Benjamin Herrenschmidt
2005-05-22 17:12       ` vinai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).