diff options
author | Laurence Darby <ldarby@tuffmail.com> | 2012-11-03 13:00:06 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-11-04 03:17:28 -0500 |
commit | 3bef1c377d1bd8fd879ee5a66cf6f45ba16820cd (patch) | |
tree | f0c8f9779c99a569e54285f31d8c303149d83bbb /sound/pci/hda/hda_codec.c | |
parent | a5d00dc3a4b65ed38249f3225e453944c633747b (diff) |
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/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 2da787519513..569bc05aad6c 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); | |||
4816 | static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, | 4816 | static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, |
4817 | unsigned int stream_tag, unsigned int format) | 4817 | unsigned int stream_tag, unsigned int format) |
4818 | { | 4818 | { |
4819 | struct hda_spdif_out *spdif = snd_hda_spdif_out_of_nid(codec, nid); | 4819 | struct hda_spdif_out *spdif; |
4820 | 4820 | unsigned int curr_fmt; | |
4821 | /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ | 4821 | bool reset; |
4822 | if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) | 4822 | |
4823 | spdif = snd_hda_spdif_out_of_nid(codec, nid); | ||
4824 | curr_fmt = snd_hda_codec_read(codec, nid, 0, | ||
4825 | AC_VERB_GET_STREAM_FORMAT, 0); | ||
4826 | reset = codec->spdif_status_reset && | ||
4827 | (spdif->ctls & AC_DIG1_ENABLE) && | ||
4828 | curr_fmt != format; | ||
4829 | |||
4830 | /* turn off SPDIF if needed; otherwise the IEC958 bits won't be | ||
4831 | updated */ | ||
4832 | if (reset) | ||
4823 | set_dig_out_convert(codec, nid, | 4833 | set_dig_out_convert(codec, nid, |
4824 | spdif->ctls & ~AC_DIG1_ENABLE & 0xff, | 4834 | spdif->ctls & ~AC_DIG1_ENABLE & 0xff, |
4825 | -1); | 4835 | -1); |
@@ -4831,7 +4841,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, | |||
4831 | format); | 4841 | format); |
4832 | } | 4842 | } |
4833 | /* turn on again (if needed) */ | 4843 | /* turn on again (if needed) */ |
4834 | if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) | 4844 | if (reset) |
4835 | set_dig_out_convert(codec, nid, | 4845 | set_dig_out_convert(codec, nid, |
4836 | spdif->ctls & 0xff, -1); | 4846 | spdif->ctls & 0xff, -1); |
4837 | } | 4847 | } |