ALSA: hda - Move beep attach/detach calls in hda_generic.c
Instead of calling snd_hda_attach_beep_device() and snd_hda_detach_beep_device() in each codec driver, move them to the generic parser. The codec driver just needs to set spec->beep_nid for activating the digital beep. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -139,8 +139,12 @@ struct conexant_spec {
|
||||
|
||||
|
||||
#ifdef CONFIG_SND_HDA_INPUT_BEEP
|
||||
#define set_beep_amp(spec, nid, idx, dir) \
|
||||
((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir))
|
||||
static inline void set_beep_amp(struct conexant_spec *spec, hda_nid_t nid,
|
||||
int idx, int dir)
|
||||
{
|
||||
spec->gen.beep_nid = nid;
|
||||
spec->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir);
|
||||
}
|
||||
/* additional beep mixers; the actual parameters are overwritten at build */
|
||||
static const struct snd_kcontrol_new cxt_beep_mixer[] = {
|
||||
HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT),
|
||||
@@ -3191,17 +3195,11 @@ static int cx_auto_build_controls(struct hda_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cx_auto_free(struct hda_codec *codec)
|
||||
{
|
||||
snd_hda_detach_beep_device(codec);
|
||||
snd_hda_gen_free(codec);
|
||||
}
|
||||
|
||||
static const struct hda_codec_ops cx_auto_patch_ops = {
|
||||
.build_controls = cx_auto_build_controls,
|
||||
.build_pcms = snd_hda_gen_build_pcms,
|
||||
.init = snd_hda_gen_init,
|
||||
.free = cx_auto_free,
|
||||
.free = snd_hda_gen_free,
|
||||
.unsol_event = snd_hda_jack_unsol_event,
|
||||
#ifdef CONFIG_PM
|
||||
.check_power_status = snd_hda_gen_check_power_status,
|
||||
@@ -3395,8 +3393,6 @@ static int patch_conexant_auto(struct hda_codec *codec)
|
||||
goto error;
|
||||
|
||||
codec->patch_ops = cx_auto_patch_ops;
|
||||
if (spec->beep_amp)
|
||||
snd_hda_attach_beep_device(codec, get_amp_nid_(spec->beep_amp));
|
||||
|
||||
/* Some laptops with Conexant chips show stalls in S3 resume,
|
||||
* which falls into the single-cmd mode.
|
||||
|
Reference in New Issue
Block a user