aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-03-18 06:25:51 -0400
committerTakashi Iwai <tiwai@suse.de>2013-03-18 07:58:42 -0400
commit7504b6cd220a3dd8104abe3d0f985c6957dc3e17 (patch)
treecc9375edcd24847cad943c0a5d141874f67e743f /sound/pci/hda/patch_sigmatel.c
parentcf30f46acde1f84fbf603bba6540cbb40cc6c954 (diff)
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>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 356673106788..3be877bd8a92 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -211,7 +211,6 @@ struct sigmatel_spec {
211 211
212 /* beep widgets */ 212 /* beep widgets */
213 hda_nid_t anabeep_nid; 213 hda_nid_t anabeep_nid;
214 hda_nid_t digbeep_nid;
215 214
216 /* SPDIF-out mux */ 215 /* SPDIF-out mux */
217 const char * const *spdif_labels; 216 const char * const *spdif_labels;
@@ -3560,16 +3559,13 @@ static int stac_parse_auto_config(struct hda_codec *codec)
3560 3559
3561 /* setup digital beep controls and input device */ 3560 /* setup digital beep controls and input device */
3562#ifdef CONFIG_SND_HDA_INPUT_BEEP 3561#ifdef CONFIG_SND_HDA_INPUT_BEEP
3563 if (spec->digbeep_nid > 0) { 3562 if (spec->gen.beep_nid) {
3564 hda_nid_t nid = spec->digbeep_nid; 3563 hda_nid_t nid = spec->gen.beep_nid;
3565 unsigned int caps; 3564 unsigned int caps;
3566 3565
3567 err = stac_auto_create_beep_ctls(codec, nid); 3566 err = stac_auto_create_beep_ctls(codec, nid);
3568 if (err < 0) 3567 if (err < 0)
3569 return err; 3568 return err;
3570 err = snd_hda_attach_beep_device(codec, nid);
3571 if (err < 0)
3572 return err;
3573 if (codec->beep) { 3569 if (codec->beep) {
3574 /* IDT/STAC codecs have linear beep tone parameter */ 3570 /* IDT/STAC codecs have linear beep tone parameter */
3575 codec->beep->linear_tone = spec->linear_tone_beep; 3571 codec->beep->linear_tone = spec->linear_tone_beep;
@@ -3657,17 +3653,7 @@ static void stac_shutup(struct hda_codec *codec)
3657 ~spec->eapd_mask); 3653 ~spec->eapd_mask);
3658} 3654}
3659 3655
3660static void stac_free(struct hda_codec *codec) 3656#define stac_free snd_hda_gen_free
3661{
3662 struct sigmatel_spec *spec = codec->spec;
3663
3664 if (!spec)
3665 return;
3666
3667 snd_hda_gen_spec_free(&spec->gen);
3668 kfree(spec);
3669 snd_hda_detach_beep_device(codec);
3670}
3671 3657
3672#ifdef CONFIG_PROC_FS 3658#ifdef CONFIG_PROC_FS
3673static void stac92hd_proc_hook(struct snd_info_buffer *buffer, 3659static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
@@ -3885,7 +3871,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
3885 spec->aloopback_mask = 0x01; 3871 spec->aloopback_mask = 0x01;
3886 spec->aloopback_shift = 8; 3872 spec->aloopback_shift = 8;
3887 3873
3888 spec->digbeep_nid = 0x1c; 3874 spec->gen.beep_nid = 0x1c; /* digital beep */
3889 3875
3890 /* GPIO0 High = Enable EAPD */ 3876 /* GPIO0 High = Enable EAPD */
3891 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; 3877 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
@@ -3969,7 +3955,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
3969 spec->gen.power_down_unused = 1; 3955 spec->gen.power_down_unused = 1;
3970 spec->gen.mixer_nid = 0x1b; 3956 spec->gen.mixer_nid = 0x1b;
3971 3957
3972 spec->digbeep_nid = 0x21; 3958 spec->gen.beep_nid = 0x21; /* digital beep */
3973 spec->pwr_nids = stac92hd83xxx_pwr_nids; 3959 spec->pwr_nids = stac92hd83xxx_pwr_nids;
3974 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); 3960 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
3975 spec->default_polarity = -1; /* no default cfg */ 3961 spec->default_polarity = -1; /* no default cfg */
@@ -4017,7 +4003,7 @@ static int patch_stac92hd95(struct hda_codec *codec)
4017 spec->gen.own_eapd_ctl = 1; 4003 spec->gen.own_eapd_ctl = 1;
4018 spec->gen.power_down_unused = 1; 4004 spec->gen.power_down_unused = 1;
4019 4005
4020 spec->digbeep_nid = 0x19; 4006 spec->gen.beep_nid = 0x19; /* digital beep */
4021 spec->pwr_nids = stac92hd95_pwr_nids; 4007 spec->pwr_nids = stac92hd95_pwr_nids;
4022 spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids); 4008 spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids);
4023 spec->default_polarity = -1; /* no default cfg */ 4009 spec->default_polarity = -1; /* no default cfg */
@@ -4092,7 +4078,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
4092 spec->aloopback_shift = 0; 4078 spec->aloopback_shift = 0;
4093 4079
4094 spec->powerdown_adcs = 1; 4080 spec->powerdown_adcs = 1;
4095 spec->digbeep_nid = 0x26; 4081 spec->gen.beep_nid = 0x26; /* digital beep */
4096 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); 4082 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
4097 spec->pwr_nids = stac92hd71bxx_pwr_nids; 4083 spec->pwr_nids = stac92hd71bxx_pwr_nids;
4098 4084
@@ -4174,7 +4160,7 @@ static int patch_stac927x(struct hda_codec *codec)
4174 spec->have_spdif_mux = 1; 4160 spec->have_spdif_mux = 1;
4175 spec->spdif_labels = stac927x_spdif_labels; 4161 spec->spdif_labels = stac927x_spdif_labels;
4176 4162
4177 spec->digbeep_nid = 0x23; 4163 spec->gen.beep_nid = 0x23; /* digital beep */
4178 4164
4179 /* GPIO0 High = Enable EAPD */ 4165 /* GPIO0 High = Enable EAPD */
4180 spec->eapd_mask = spec->gpio_mask = 0x01; 4166 spec->eapd_mask = spec->gpio_mask = 0x01;
@@ -4233,7 +4219,7 @@ static int patch_stac9205(struct hda_codec *codec)
4233 spec->gen.own_eapd_ctl = 1; 4219 spec->gen.own_eapd_ctl = 1;
4234 spec->have_spdif_mux = 1; 4220 spec->have_spdif_mux = 1;
4235 4221
4236 spec->digbeep_nid = 0x23; 4222 spec->gen.beep_nid = 0x23; /* digital beep */
4237 4223
4238 snd_hda_add_verbs(codec, stac9205_core_init); 4224 snd_hda_add_verbs(codec, stac9205_core_init);
4239 spec->aloopback_ctl = &stac9205_loopback; 4225 spec->aloopback_ctl = &stac9205_loopback;