diff options
author | David Henningsson <david.henningsson@canonical.com> | 2012-08-13 11:10:46 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-08-14 04:22:31 -0400 |
commit | 265d931a9e9a7e290faa5e2145f4b2ebf38ea84c (patch) | |
tree | 029ea5e6738aa932f352854bba0064708032591b /sound/pci | |
parent | 088c820b732dbfd515fc66d459d5f5777f79b406 (diff) |
ALSA: hda - Fix 'Beep Playback Switch' with no underlying mute switch
Some Conexant devices (e g CX20590) have no mute capability on
their Beep widgets.
This patch makes sure we don't try setting mutes on those widgets.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_beep.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index d26ae65b43b7..0849aac449f2 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -231,15 +231,22 @@ void snd_hda_detach_beep_device(struct hda_codec *codec) | |||
231 | } | 231 | } |
232 | EXPORT_SYMBOL_HDA(snd_hda_detach_beep_device); | 232 | EXPORT_SYMBOL_HDA(snd_hda_detach_beep_device); |
233 | 233 | ||
234 | static bool ctl_has_mute(struct snd_kcontrol *kcontrol) | ||
235 | { | ||
236 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
237 | return query_amp_caps(codec, get_amp_nid(kcontrol), | ||
238 | get_amp_direction(kcontrol)) & AC_AMPCAP_MUTE; | ||
239 | } | ||
240 | |||
234 | /* get/put callbacks for beep mute mixer switches */ | 241 | /* get/put callbacks for beep mute mixer switches */ |
235 | int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol, | 242 | int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol, |
236 | struct snd_ctl_elem_value *ucontrol) | 243 | struct snd_ctl_elem_value *ucontrol) |
237 | { | 244 | { |
238 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 245 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
239 | struct hda_beep *beep = codec->beep; | 246 | struct hda_beep *beep = codec->beep; |
240 | if (beep && !beep->enabled) { | 247 | if (beep && (!beep->enabled || !ctl_has_mute(kcontrol))) { |
241 | ucontrol->value.integer.value[0] = | 248 | ucontrol->value.integer.value[0] = |
242 | ucontrol->value.integer.value[1] = 0; | 249 | ucontrol->value.integer.value[1] = beep->enabled; |
243 | return 0; | 250 | return 0; |
244 | } | 251 | } |
245 | return snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); | 252 | return snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); |
@@ -263,6 +270,8 @@ int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol, | |||
263 | enable |= *valp; | 270 | enable |= *valp; |
264 | snd_hda_enable_beep_device(codec, enable); | 271 | snd_hda_enable_beep_device(codec, enable); |
265 | } | 272 | } |
273 | if (!ctl_has_mute(kcontrol)) | ||
274 | return 0; | ||
266 | return snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); | 275 | return snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); |
267 | } | 276 | } |
268 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put_beep); | 277 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put_beep); |