summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_beep.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2009-11-13 18:41:52 +0100
committerTakashi Iwai <tiwai@suse.de>2009-11-16 11:35:10 +0100
commit2dca0bba70ce3c233be152e384580c134935332d (patch)
treebd82dd7b15104f8ea2fa682a444099f7eb23443f /sound/pci/hda/hda_beep.c
parent5f81669750504b1e7e00acde5068d972af466f29 (diff)
ALSA: hda - add beep_mode module parameter
The beep_mode parameter for snd-hda-intel module allows to choose among different digital beep device registation to the input layer. 0 = do not register to the input layer 1 = register to the input layer all time 2 = use "Beep Switch" control exported to user space mixer applications Also, introduce CONFIG_SND_HDA_INPUT_BEEP_MODE for default value. Signed-off-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_beep.c')
-rw-r--r--sound/pci/hda/hda_beep.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index c819152de79b..9e48798b415b 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -190,14 +190,19 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
return 0;
if (beep->enabled != enable) {
beep->enabled = enable;
- if (enable) {
- cancel_delayed_work(&beep->unregister_work);
- schedule_work(&beep->register_work);
- } else {
+ if (!enable) {
/* turn off beep */
snd_hda_codec_write_cache(beep->codec, beep->nid, 0,
AC_VERB_SET_BEEP_CONTROL, 0);
- schedule_delayed_work(&beep->unregister_work, HZ);
+ }
+ if (beep->mode == HDA_BEEP_MODE_SWREG) {
+ if (enable) {
+ cancel_delayed_work(&beep->unregister_work);
+ schedule_work(&beep->register_work);
+ } else {
+ schedule_delayed_work(&beep->unregister_work,
+ HZ);
+ }
}
return 1;
}
@@ -223,6 +228,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
beep->nid = nid;
beep->codec = codec;
+ beep->mode = codec->beep_mode;
codec->beep = beep;
INIT_WORK(&beep->register_work, &snd_hda_do_register);
@@ -230,6 +236,11 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
INIT_WORK(&beep->beep_work, &snd_hda_generate_beep);
mutex_init(&beep->mutex);
+ if (beep->mode == HDA_BEEP_MODE_ON) {
+ beep->enabled = 1;
+ snd_hda_do_register(&beep->register_work);
+ }
+
return 0;
}
EXPORT_SYMBOL_HDA(snd_hda_attach_beep_device);