diff options
author | Jaroslav Kysela <perex@perex.cz> | 2009-11-13 12:41:52 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-16 05:35:10 -0500 |
commit | 2dca0bba70ce3c233be152e384580c134935332d (patch) | |
tree | bd82dd7b15104f8ea2fa682a444099f7eb23443f /sound/pci/hda/hda_beep.c | |
parent | 5f81669750504b1e7e00acde5068d972af466f29 (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.c | 21 |
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) | |||
190 | return 0; | 190 | return 0; |
191 | if (beep->enabled != enable) { | 191 | if (beep->enabled != enable) { |
192 | beep->enabled = enable; | 192 | beep->enabled = enable; |
193 | if (enable) { | 193 | if (!enable) { |
194 | cancel_delayed_work(&beep->unregister_work); | ||
195 | schedule_work(&beep->register_work); | ||
196 | } else { | ||
197 | /* turn off beep */ | 194 | /* turn off beep */ |
198 | snd_hda_codec_write_cache(beep->codec, beep->nid, 0, | 195 | snd_hda_codec_write_cache(beep->codec, beep->nid, 0, |
199 | AC_VERB_SET_BEEP_CONTROL, 0); | 196 | AC_VERB_SET_BEEP_CONTROL, 0); |
200 | schedule_delayed_work(&beep->unregister_work, HZ); | 197 | } |
198 | if (beep->mode == HDA_BEEP_MODE_SWREG) { | ||
199 | if (enable) { | ||
200 | cancel_delayed_work(&beep->unregister_work); | ||
201 | schedule_work(&beep->register_work); | ||
202 | } else { | ||
203 | schedule_delayed_work(&beep->unregister_work, | ||
204 | HZ); | ||
205 | } | ||
201 | } | 206 | } |
202 | return 1; | 207 | return 1; |
203 | } | 208 | } |
@@ -223,6 +228,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
223 | 228 | ||
224 | beep->nid = nid; | 229 | beep->nid = nid; |
225 | beep->codec = codec; | 230 | beep->codec = codec; |
231 | beep->mode = codec->beep_mode; | ||
226 | codec->beep = beep; | 232 | codec->beep = beep; |
227 | 233 | ||
228 | INIT_WORK(&beep->register_work, &snd_hda_do_register); | 234 | 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) | |||
230 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); | 236 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); |
231 | mutex_init(&beep->mutex); | 237 | mutex_init(&beep->mutex); |
232 | 238 | ||
239 | if (beep->mode == HDA_BEEP_MODE_ON) { | ||
240 | beep->enabled = 1; | ||
241 | snd_hda_do_register(&beep->register_work); | ||
242 | } | ||
243 | |||
233 | return 0; | 244 | return 0; |
234 | } | 245 | } |
235 | EXPORT_SYMBOL_HDA(snd_hda_attach_beep_device); | 246 | EXPORT_SYMBOL_HDA(snd_hda_attach_beep_device); |