aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-07-03 11:27:57 -0400
committerTakashi Iwai <tiwai@suse.de>2012-07-03 12:31:36 -0400
commit0401e8548eace5bdb8adfa3e82f56165982cb3ad (patch)
tree62aae408695943586f9fcb208b11a23471aaf8ba /sound/pci
parent0920c9b4c4d896025a560e4510d473dfd41c3dcd (diff)
ALSA: hda - Move beep helper functions to hda_beep.c
Move snd_hda_mixer_amp_switch_put_beep() to hda_beep.c as a clean up to remove one more ifdef. Also add the corresponding get callback to return consistently the digital beep state independently from the mixer amp value. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_beep.c28
-rw-r--r--sound/pci/hda/hda_codec.c19
-rw-r--r--sound/pci/hda/hda_local.h4
3 files changed, 31 insertions, 20 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 662de6e58b6f..336b4b3a80b9 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -231,3 +231,31 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
231 } 231 }
232} 232}
233EXPORT_SYMBOL_HDA(snd_hda_detach_beep_device); 233EXPORT_SYMBOL_HDA(snd_hda_detach_beep_device);
234
235/* get/put callbacks for beep mute mixer switches */
236int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol,
237 struct snd_ctl_elem_value *ucontrol)
238{
239 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
240 struct hda_beep *beep = codec->beep;
241 if (beep) {
242 ucontrol->value.integer.value[0] =
243 ucontrol->value.integer.value[1] =
244 beep->enabled;
245 return 0;
246 }
247 return snd_hda_mixer_amp_switch_get(kcontrol, ucontrol);
248}
249EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_get_beep);
250
251int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol,
252 struct snd_ctl_elem_value *ucontrol)
253{
254 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
255 struct hda_beep *beep = codec->beep;
256 if (beep)
257 snd_hda_enable_beep_device(codec,
258 *ucontrol->value.integer.value);
259 return snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
260}
261EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put_beep);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 51cb2a2e4fce..ddac4288615d 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2676,25 +2676,6 @@ int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
2676} 2676}
2677EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put); 2677EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put);
2678 2678
2679#ifdef CONFIG_SND_HDA_INPUT_BEEP
2680/**
2681 * snd_hda_mixer_amp_switch_put_beep - Put callback for a beep AMP switch
2682 *
2683 * This function calls snd_hda_enable_beep_device(), which behaves differently
2684 * depending on beep_mode option.
2685 */
2686int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol,
2687 struct snd_ctl_elem_value *ucontrol)
2688{
2689 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2690 long *valp = ucontrol->value.integer.value;
2691
2692 snd_hda_enable_beep_device(codec, *valp);
2693 return snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2694}
2695EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put_beep);
2696#endif /* CONFIG_SND_HDA_INPUT_BEEP */
2697
2698/* 2679/*
2699 * bound volume controls 2680 * bound volume controls
2700 * 2681 *
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 9a096a8e0fc5..1b4c12941baa 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -89,7 +89,7 @@
89 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ 89 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
90 .subdevice = HDA_SUBDEV_AMP_FLAG, \ 90 .subdevice = HDA_SUBDEV_AMP_FLAG, \
91 .info = snd_hda_mixer_amp_switch_info, \ 91 .info = snd_hda_mixer_amp_switch_info, \
92 .get = snd_hda_mixer_amp_switch_get, \ 92 .get = snd_hda_mixer_amp_switch_get_beep, \
93 .put = snd_hda_mixer_amp_switch_put_beep, \ 93 .put = snd_hda_mixer_amp_switch_put_beep, \
94 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } 94 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) }
95#else 95#else
@@ -121,6 +121,8 @@ int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol,
121int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, 121int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
122 struct snd_ctl_elem_value *ucontrol); 122 struct snd_ctl_elem_value *ucontrol);
123#ifdef CONFIG_SND_HDA_INPUT_BEEP 123#ifdef CONFIG_SND_HDA_INPUT_BEEP
124int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol,
125 struct snd_ctl_elem_value *ucontrol);
124int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol, 126int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol,
125 struct snd_ctl_elem_value *ucontrol); 127 struct snd_ctl_elem_value *ucontrol);
126#endif 128#endif