diff options
Diffstat (limited to 'sound/pci/cs5535audio')
-rw-r--r-- | sound/pci/cs5535audio/Makefile | 2 | ||||
-rw-r--r-- | sound/pci/cs5535audio/cs5535audio.c | 1 | ||||
-rw-r--r-- | sound/pci/cs5535audio/cs5535audio.h | 4 | ||||
-rw-r--r-- | sound/pci/cs5535audio/cs5535audio_olpc.c | 26 |
4 files changed, 23 insertions, 10 deletions
diff --git a/sound/pci/cs5535audio/Makefile b/sound/pci/cs5535audio/Makefile index fda7a94c992f..ccc642269b9e 100644 --- a/sound/pci/cs5535audio/Makefile +++ b/sound/pci/cs5535audio/Makefile | |||
@@ -4,9 +4,7 @@ | |||
4 | 4 | ||
5 | snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o | 5 | snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o |
6 | snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o | 6 | snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o |
7 | ifdef CONFIG_MGEODE_LX | ||
8 | snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o | 7 | snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o |
9 | endif | ||
10 | 8 | ||
11 | # Toplevel Module Dependency | 9 | # Toplevel Module Dependency |
12 | obj-$(CONFIG_SND_CS5535AUDIO) += snd-cs5535audio.o | 10 | obj-$(CONFIG_SND_CS5535AUDIO) += snd-cs5535audio.o |
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 05f56e04849b..91e7faf69bbb 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c | |||
@@ -389,6 +389,7 @@ probefail_out: | |||
389 | 389 | ||
390 | static void __devexit snd_cs5535audio_remove(struct pci_dev *pci) | 390 | static void __devexit snd_cs5535audio_remove(struct pci_dev *pci) |
391 | { | 391 | { |
392 | olpc_quirks_cleanup(); | ||
392 | snd_card_free(pci_get_drvdata(pci)); | 393 | snd_card_free(pci_get_drvdata(pci)); |
393 | pci_set_drvdata(pci, NULL); | 394 | pci_set_drvdata(pci, NULL); |
394 | } | 395 | } |
diff --git a/sound/pci/cs5535audio/cs5535audio.h b/sound/pci/cs5535audio/cs5535audio.h index 7a298ac662e3..51966d782a3c 100644 --- a/sound/pci/cs5535audio/cs5535audio.h +++ b/sound/pci/cs5535audio/cs5535audio.h | |||
@@ -99,10 +99,11 @@ int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state); | |||
99 | int snd_cs5535audio_resume(struct pci_dev *pci); | 99 | int snd_cs5535audio_resume(struct pci_dev *pci); |
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | #if defined(CONFIG_OLPC) && defined(CONFIG_MGEODE_LX) | 102 | #ifdef CONFIG_OLPC |
103 | void __devinit olpc_prequirks(struct snd_card *card, | 103 | void __devinit olpc_prequirks(struct snd_card *card, |
104 | struct snd_ac97_template *ac97); | 104 | struct snd_ac97_template *ac97); |
105 | int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97); | 105 | int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97); |
106 | void __devexit olpc_quirks_cleanup(void); | ||
106 | void olpc_analog_input(struct snd_ac97 *ac97, int on); | 107 | void olpc_analog_input(struct snd_ac97 *ac97, int on); |
107 | void olpc_mic_bias(struct snd_ac97 *ac97, int on); | 108 | void olpc_mic_bias(struct snd_ac97 *ac97, int on); |
108 | 109 | ||
@@ -128,6 +129,7 @@ static inline int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) | |||
128 | { | 129 | { |
129 | return 0; | 130 | return 0; |
130 | } | 131 | } |
132 | static inline void olpc_quirks_cleanup(void) { } | ||
131 | static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { } | 133 | static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { } |
132 | static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { } | 134 | static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { } |
133 | static inline void olpc_capture_open(struct snd_ac97 *ac97) { } | 135 | static inline void olpc_capture_open(struct snd_ac97 *ac97) { } |
diff --git a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c index 5c6814335cd7..50da49be9ae5 100644 --- a/sound/pci/cs5535audio/cs5535audio_olpc.c +++ b/sound/pci/cs5535audio/cs5535audio_olpc.c | |||
@@ -13,10 +13,13 @@ | |||
13 | #include <sound/info.h> | 13 | #include <sound/info.h> |
14 | #include <sound/control.h> | 14 | #include <sound/control.h> |
15 | #include <sound/ac97_codec.h> | 15 | #include <sound/ac97_codec.h> |
16 | #include <linux/gpio.h> | ||
16 | 17 | ||
17 | #include <asm/olpc.h> | 18 | #include <asm/olpc.h> |
18 | #include "cs5535audio.h" | 19 | #include "cs5535audio.h" |
19 | 20 | ||
21 | #define DRV_NAME "cs5535audio-olpc" | ||
22 | |||
20 | /* | 23 | /* |
21 | * OLPC has an additional feature on top of the regular AD1888 codec features. | 24 | * OLPC has an additional feature on top of the regular AD1888 codec features. |
22 | * It has an Analog Input mode that is switched into (after disabling the | 25 | * It has an Analog Input mode that is switched into (after disabling the |
@@ -38,10 +41,7 @@ void olpc_analog_input(struct snd_ac97 *ac97, int on) | |||
38 | } | 41 | } |
39 | 42 | ||
40 | /* set Analog Input through GPIO */ | 43 | /* set Analog Input through GPIO */ |
41 | if (on) | 44 | gpio_set_value(OLPC_GPIO_MIC_AC, on); |
42 | geode_gpio_set(OLPC_GPIO_MIC_AC, GPIO_OUTPUT_VAL); | ||
43 | else | ||
44 | geode_gpio_clear(OLPC_GPIO_MIC_AC, GPIO_OUTPUT_VAL); | ||
45 | } | 45 | } |
46 | 46 | ||
47 | /* | 47 | /* |
@@ -73,8 +73,7 @@ static int olpc_dc_info(struct snd_kcontrol *kctl, | |||
73 | 73 | ||
74 | static int olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v) | 74 | static int olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v) |
75 | { | 75 | { |
76 | v->value.integer.value[0] = geode_gpio_isset(OLPC_GPIO_MIC_AC, | 76 | v->value.integer.value[0] = gpio_get_value(OLPC_GPIO_MIC_AC); |
77 | GPIO_OUTPUT_VAL); | ||
78 | return 0; | 77 | return 0; |
79 | } | 78 | } |
80 | 79 | ||
@@ -153,6 +152,12 @@ int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) | |||
153 | if (!machine_is_olpc()) | 152 | if (!machine_is_olpc()) |
154 | return 0; | 153 | return 0; |
155 | 154 | ||
155 | if (gpio_request(OLPC_GPIO_MIC_AC, DRV_NAME)) { | ||
156 | printk(KERN_ERR DRV_NAME ": unable to allocate MIC GPIO\n"); | ||
157 | return -EIO; | ||
158 | } | ||
159 | gpio_direction_output(OLPC_GPIO_MIC_AC, 0); | ||
160 | |||
156 | /* drop the original AD1888 HPF control */ | 161 | /* drop the original AD1888 HPF control */ |
157 | memset(&elem, 0, sizeof(elem)); | 162 | memset(&elem, 0, sizeof(elem)); |
158 | elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 163 | elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
@@ -169,11 +174,18 @@ int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) | |||
169 | for (i = 0; i < ARRAY_SIZE(olpc_cs5535audio_ctls); i++) { | 174 | for (i = 0; i < ARRAY_SIZE(olpc_cs5535audio_ctls); i++) { |
170 | err = snd_ctl_add(card, snd_ctl_new1(&olpc_cs5535audio_ctls[i], | 175 | err = snd_ctl_add(card, snd_ctl_new1(&olpc_cs5535audio_ctls[i], |
171 | ac97->private_data)); | 176 | ac97->private_data)); |
172 | if (err < 0) | 177 | if (err < 0) { |
178 | gpio_free(OLPC_GPIO_MIC_AC); | ||
173 | return err; | 179 | return err; |
180 | } | ||
174 | } | 181 | } |
175 | 182 | ||
176 | /* turn off the mic by default */ | 183 | /* turn off the mic by default */ |
177 | olpc_mic_bias(ac97, 0); | 184 | olpc_mic_bias(ac97, 0); |
178 | return 0; | 185 | return 0; |
179 | } | 186 | } |
187 | |||
188 | void __devexit olpc_quirks_cleanup(void) | ||
189 | { | ||
190 | gpio_free(OLPC_GPIO_MIC_AC); | ||
191 | } | ||