summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLaurence Darby <ldarby@tuffmail.com>2012-11-03 17:00:06 +0000
committerTakashi Iwai <tiwai@suse.de>2012-11-04 09:17:28 +0100
commit3bef1c377d1bd8fd879ee5a66cf6f45ba16820cd (patch)
treef0c8f9779c99a569e54285f31d8c303149d83bbb /sound
parenta5d00dc3a4b65ed38249f3225e453944c633747b (diff)
downloadop-kernel-dev-3bef1c377d1bd8fd879ee5a66cf6f45ba16820cd.zip
op-kernel-dev-3bef1c377d1bd8fd879ee5a66cf6f45ba16820cd.tar.gz
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: Laurence Darby <ldarby@tuffmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_codec.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 2da7875..569bc05 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -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,
unsigned int stream_tag, unsigned int format)
{
- struct hda_spdif_out *spdif = snd_hda_spdif_out_of_nid(codec, nid);
-
- /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */
- if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE))
+ 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 if needed; otherwise the IEC958 bits won't be
+ updated */
+ if (reset)
set_dig_out_convert(codec, nid,
spdif->ctls & ~AC_DIG1_ENABLE & 0xff,
-1);
@@ -4831,7 +4841,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
format);
}
/* turn on again (if needed) */
- if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE))
+ if (reset)
set_dig_out_convert(codec, nid,
spdif->ctls & 0xff, -1);
}
OpenPOWER on IntegriCloud