snd-powermac: enable headphone detection
PATCH 1/3 snd-powermac: enable headphone detection
From: Risto Suominen <Risto.Suominen at gmail.com>
Enable port change interrupt while initialising AWACS, Screamer, and Burgundy chipsets.
---
Kernel version 2.6.25-rc8 (probably any 2.6)
ppc/pmac.c renamed from ppc/pmac.c.orig +9 -5
@@ -214,7 +214,7 @@ static int snd_pmac_pcm_prepare(struct sint rate_index;long offset;struct pmac_stream *astr; - + rec->dma_size =snd_pcm_lib_buffer_bytes (subs); rec->period_size =snd_pcm_lib_period_bytes (subs); rec->nperiods = rec->dma_size / rec->period_size;
@@ -643,7 +643,7 @@ static int snd_pmac_pcm_close(struct snd/* reset constraints */ astr->cur_freqs = chip->freqs_ok; astr->cur_formats = chip->formats_ok; - +return 0 ; }
@@ -1063,6 +1063,10 @@ static int __init snd_pmac_detect(structelse {struct pci_dev *pdev =NULL ; +#ifndef for_each_pci_dev +#define for_each_pci_dev (d) \ + while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) +#endif for_each_pci_dev (pdev) {struct device_node *np =pci_device_to_OF_node (pdev);if (np && np == macio->of_node) {
@@ -1300,9 +1304,9 @@ int __init snd_pmac_new(struct snd_cardsnd_pmac_sound_feature (chip,1 ); -/* reset */ -if (chip->model ==PMAC_AWACS ) -out_le32 (&chip->awacs->control,0x11 ); +/* reset & enable interrupts */ +if (chip->model <=PMAC_BURGUNDY ) +out_le32 (&chip->awacs->control, chip->control_mask);/* Powerbooks have odd ways of enabling inputs such as an expansion-bay CD or sound from an internal modem
At Mon, 14 Apr 2008 20:12:18 +0300,
Quoted 22 lines · Risto Suominen
From: Risto Suominen <Risto.Suominen at gmail.com>
Enable port change interrupt while initialising AWACS, Screamer, and Burgundy chipsets.
Signed-off-by Risto Suominen <Risto.Suominen at gmail.com>---
Kernel version 2.6.25-rc8 (probably any 2.6)ppc/pmac.c renamed from ppc/pmac.c.orig +1
-1@@ -214,7 +214,7 @@ static int snd_pmac_pcm_prepare(struct sint rate_index;long offset;struct pmac_stream *astr; - + rec->dma_size =snd_pcm_lib_buffer_bytes (subs); rec->period_size =snd_pcm_lib_period_bytes (subs); rec->nperiods = rec->dma_size / rec->period_size;
ppc/pmac.c static int snd_pmac_pcm_close(struct snd · line 649
Quoted 8 lines
ppc/pmac.c renamed from ppc/pmac.c.orig +1
-1@@ -643,7 +643,7 @@ static int snd_pmac_pcm_close(struct snd/* reset constraints */ astr->cur_freqs = chip->freqs_ok; astr->cur_formats = chip->formats_ok; - +return 0 ; }
Please split the patch, one to fix the initialization and one to fix coding styles.
ppc/pmac.c static int __init snd_pmac_detect(struct · line 1069
Quoted 8 lines
ppc/pmac.c renamed from ppc/pmac.c.orig +4
-0@@ -1063,6 +1063,10 @@ static int __init snd_pmac_detect(structelse {struct pci_dev *pdev =NULL ; +#ifndef for_each_pci_dev +#define for_each_pci_dev (d) \ + while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) +#endif
Why is this needed?
thanks,
Takashi
Quoted 17 lines
ppc/pmac.c renamed from ppc/pmac.c.orig +3
-3for_each_pci_dev (pdev) {struct device_node *np =pci_device_to_OF_node (pdev);if (np && np == macio->of_node) {@@ -1300,9 +1304,9 @@ int __init snd_pmac_new(struct snd_cardsnd_pmac_sound_feature (chip,1 ); -/* reset */ -if (chip->model ==PMAC_AWACS ) -out_le32 (&chip->awacs->control,0x11 ); +/* reset & enable interrupts */ +if (chip->model <=PMAC_BURGUNDY ) +out_le32 (&chip->awacs->control, chip->control_mask);/* Powerbooks have odd ways of enabling inputs such as an expansion-bay CD or sound from an internal modem
2008/4/15, Takashi Iwai <[email protected]>:
Quoted 4 lines
Please split the patch, one to fix the initialization and one to fix
coding styles.
Ok, I will. Sorry, I'm still a beginner at this.
Quoted 5 lines
Quoted 5 lines
ppc/pmac.c renamed from ppc/pmac.c.orig +0
-0@@ -1063,6 +1063,10 @@ static int __init snd_pmac_detect(structelse {struct pci_dev *pdev =NULL ;
Quoted 8 lines
ppc/pmac.c static int __init snd_pmac_detect(struct · line 1069
Quoted 4 lines
ppc/pmac.c renamed from ppc/pmac.c.orig +4
-0+#ifndef for_each_pci_dev +#define for_each_pci_dev (d) \ + while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) +#endif Why is this needed?
Good question :) I found it necessary on older kernels, it didn't exist. So maybe it should be there only in alsa-driver tree. I believed that it was the same source.
Risto