Commit 3bef1c37 authored by Laurence Darby's avatar Laurence Darby Committed by Takashi Iwai

ALSA: hda - stop setup_dig_out_stream() causing clicks

Starting audio or seeking in various music players causes
setup_dig_out_stream() to be called, which resets the SPDIF stream,
which caused one DAC (but not another) to make a clicking noise every
time.

This patch ensures the reset only happens when it needs to, which is
when the format changes, and makes the code a little more readable.
Signed-off-by: default avatarLaurence Darby <ldarby@tuffmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a5d00dc3
...@@ -4816,10 +4816,20 @@ EXPORT_SYMBOL_HDA(snd_hda_input_mux_put); ...@@ -4816,10 +4816,20 @@ EXPORT_SYMBOL_HDA(snd_hda_input_mux_put);
static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
unsigned int stream_tag, unsigned int format) unsigned int stream_tag, unsigned int format)
{ {
struct hda_spdif_out *spdif = snd_hda_spdif_out_of_nid(codec, nid); struct hda_spdif_out *spdif;
unsigned int curr_fmt;
bool reset;
spdif = snd_hda_spdif_out_of_nid(codec, nid);
curr_fmt = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_STREAM_FORMAT, 0);
reset = codec->spdif_status_reset &&
(spdif->ctls & AC_DIG1_ENABLE) &&
curr_fmt != format;
/* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ /* turn off SPDIF if needed; otherwise the IEC958 bits won't be
if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) updated */
if (reset)
set_dig_out_convert(codec, nid, set_dig_out_convert(codec, nid,
spdif->ctls & ~AC_DIG1_ENABLE & 0xff, spdif->ctls & ~AC_DIG1_ENABLE & 0xff,
-1); -1);
...@@ -4831,7 +4841,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, ...@@ -4831,7 +4841,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
format); format);
} }
/* turn on again (if needed) */ /* turn on again (if needed) */
if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) if (reset)
set_dig_out_convert(codec, nid, set_dig_out_convert(codec, nid,
spdif->ctls & 0xff, -1); spdif->ctls & 0xff, -1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment