提交 167eae5a 编写于 作者: T Takashi Iwai

ALSA: hda - Reset pins of IDT/STAC codecs at free

Some laptops cause annoying clicks or noises at shutdown/reboot since
the speaker pin is set still high.  Apply the same procedure used for
the suspend to avoid such clicks/noises for freeing the codec, too.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 9ad6a46b
...@@ -4327,6 +4327,28 @@ static void stac92xx_free_kctls(struct hda_codec *codec) ...@@ -4327,6 +4327,28 @@ static void stac92xx_free_kctls(struct hda_codec *codec)
snd_array_free(&spec->kctls); snd_array_free(&spec->kctls);
} }
static void stac92xx_shutup(struct hda_codec *codec)
{
struct sigmatel_spec *spec = codec->spec;
int i;
hda_nid_t nid;
/* reset each pin before powering down DAC/ADC to avoid click noise */
nid = codec->start_nid;
for (i = 0; i < codec->num_nodes; i++, nid++) {
unsigned int wcaps = get_wcaps(codec, nid);
unsigned int wid_type = get_wcaps_type(wcaps);
if (wid_type == AC_WID_PIN)
snd_hda_codec_read(codec, nid, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
}
if (spec->eapd_mask)
stac_gpio_set(codec, spec->gpio_mask,
spec->gpio_dir, spec->gpio_data &
~spec->eapd_mask);
}
static void stac92xx_free(struct hda_codec *codec) static void stac92xx_free(struct hda_codec *codec)
{ {
struct sigmatel_spec *spec = codec->spec; struct sigmatel_spec *spec = codec->spec;
...@@ -4334,6 +4356,7 @@ static void stac92xx_free(struct hda_codec *codec) ...@@ -4334,6 +4356,7 @@ static void stac92xx_free(struct hda_codec *codec)
if (! spec) if (! spec)
return; return;
stac92xx_shutup(codec);
stac92xx_free_jacks(codec); stac92xx_free_jacks(codec);
snd_array_free(&spec->events); snd_array_free(&spec->events);
...@@ -4793,24 +4816,7 @@ static int stac92xx_hp_check_power_status(struct hda_codec *codec, ...@@ -4793,24 +4816,7 @@ static int stac92xx_hp_check_power_status(struct hda_codec *codec,
static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
{ {
struct sigmatel_spec *spec = codec->spec; stac92xx_shutup(codec);
int i;
hda_nid_t nid;
/* reset each pin before powering down DAC/ADC to avoid click noise */
nid = codec->start_nid;
for (i = 0; i < codec->num_nodes; i++, nid++) {
unsigned int wcaps = get_wcaps(codec, nid);
unsigned int wid_type = get_wcaps_type(wcaps);
if (wid_type == AC_WID_PIN)
snd_hda_codec_read(codec, nid, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
}
if (spec->eapd_mask)
stac_gpio_set(codec, spec->gpio_mask,
spec->gpio_dir, spec->gpio_data &
~spec->eapd_mask);
return 0; return 0;
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册