diff options
| -rw-r--r-- | sound/pci/cs5535audio/cs5535audio_olpc.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c index 597395e6e358..6c0c0dbeb218 100644 --- a/sound/pci/cs5535audio/cs5535audio_olpc.c +++ b/sound/pci/cs5535audio/cs5535audio_olpc.c | |||
| @@ -31,8 +31,8 @@ void olpc_analog_input(struct snd_ac97 *ac97, int on) | |||
| 31 | geode_gpio_clear(OLPC_GPIO_MIC_AC, GPIO_OUTPUT_VAL); | 31 | geode_gpio_clear(OLPC_GPIO_MIC_AC, GPIO_OUTPUT_VAL); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | static int snd_cs5535audio_ctl_info(struct snd_kcontrol *kcontrol, | 34 | static int olpc_dc_info(struct snd_kcontrol *kctl, |
| 35 | struct snd_ctl_elem_info *uinfo) | 35 | struct snd_ctl_elem_info *uinfo) |
| 36 | { | 36 | { |
| 37 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 37 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
| 38 | uinfo->count = 1; | 38 | uinfo->count = 1; |
| @@ -41,35 +41,33 @@ static int snd_cs5535audio_ctl_info(struct snd_kcontrol *kcontrol, | |||
| 41 | return 0; | 41 | return 0; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | static int snd_cs5535audio_ctl_get(struct snd_kcontrol *kcontrol, | 44 | static int olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v) |
| 45 | struct snd_ctl_elem_value *ucontrol) | ||
| 46 | { | 45 | { |
| 47 | struct cs5535audio *cs5535au = snd_kcontrol_chip(kcontrol); | 46 | struct cs5535audio *cs5535au = snd_kcontrol_chip(kctl); |
| 48 | u8 val; | 47 | u8 val; |
| 49 | 48 | ||
| 50 | val = snd_ac97_read(cs5535au->ac97, AC97_AD_TEST2); | 49 | val = snd_ac97_read(cs5535au->ac97, AC97_AD_TEST2); |
| 51 | val >>= AC97_AD_HPFD_SHIFT; | 50 | val >>= AC97_AD_HPFD_SHIFT; |
| 52 | ucontrol->value.integer.value[0] = val & 0x1; | 51 | v->value.integer.value[0] = val & 0x1; |
| 53 | 52 | ||
| 54 | return 0; | 53 | return 0; |
| 55 | } | 54 | } |
| 56 | 55 | ||
| 57 | static int snd_cs5535audio_ctl_put(struct snd_kcontrol *kcontrol, | 56 | static int olpc_dc_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v) |
| 58 | struct snd_ctl_elem_value *ucontrol) | ||
| 59 | { | 57 | { |
| 60 | struct cs5535audio *cs5535au = snd_kcontrol_chip(kcontrol); | 58 | struct cs5535audio *cs5535au = snd_kcontrol_chip(kctl); |
| 61 | 59 | ||
| 62 | olpc_analog_input(cs5535au->ac97, ucontrol->value.integer.value[0]); | 60 | olpc_analog_input(cs5535au->ac97, v->value.integer.value[0]); |
| 63 | return 1; | 61 | return 1; |
| 64 | } | 62 | } |
| 65 | 63 | ||
| 66 | static struct snd_kcontrol_new snd_cs5535audio_controls __devinitdata = | 64 | static struct snd_kcontrol_new snd_cs5535audio_controls __devinitdata = |
| 67 | { | 65 | { |
| 68 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 66 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 69 | .name = "Analog Input Switch", | 67 | .name = "DC Mode Enable", |
| 70 | .info = snd_cs5535audio_ctl_info, | 68 | .info = olpc_dc_info, |
| 71 | .get = snd_cs5535audio_ctl_get, | 69 | .get = olpc_dc_get, |
| 72 | .put = snd_cs5535audio_ctl_put, | 70 | .put = olpc_dc_put, |
| 73 | .private_value = 0 | 71 | .private_value = 0 |
| 74 | }; | 72 | }; |
| 75 | 73 | ||
| @@ -86,10 +84,18 @@ void __devinit olpc_prequirks(struct snd_card *card, | |||
| 86 | 84 | ||
| 87 | int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) | 85 | int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) |
| 88 | { | 86 | { |
| 87 | struct snd_ctl_elem_id elem; | ||
| 88 | |||
| 89 | if (!machine_is_olpc()) | 89 | if (!machine_is_olpc()) |
| 90 | return 0; | 90 | return 0; |
| 91 | 91 | ||
| 92 | /* setup callback for mixer control that does analog input mode */ | 92 | /* drop the original AD1888 HPF control */ |
| 93 | memset(&elem, 0, sizeof(elem)); | ||
| 94 | elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | ||
| 95 | strncpy(elem.name, "High Pass Filter Enable", sizeof(elem.name)); | ||
| 96 | snd_ctl_remove_id(card, &elem); | ||
| 97 | |||
| 98 | /* add the override for OLPC's HPF */ | ||
| 93 | return snd_ctl_add(card, snd_ctl_new1(&snd_cs5535audio_controls, | 99 | return snd_ctl_add(card, snd_ctl_new1(&snd_cs5535audio_controls, |
| 94 | ac97->private_data)); | 100 | ac97->private_data)); |
| 95 | } | 101 | } |
