aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cs5535audio/cs5535audio_olpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/cs5535audio/cs5535audio_olpc.c')
-rw-r--r--sound/pci/cs5535audio/cs5535audio_olpc.c26
1 files changed, 19 insertions, 7 deletions
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
74static int olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v) 74static 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
188void __devexit olpc_quirks_cleanup(void)
189{
190 gpio_free(OLPC_GPIO_MIC_AC);
191}