summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorConnor McAdams <conmanx360@gmail.com>2020-12-10 11:06:53 -0500
committerTakashi Iwai <tiwai@suse.de>2020-12-11 09:52:34 +0100
commit4a6d3b4e7ae77352fa4bd602ff0c44d8450705aa (patch)
treeb8c6efeafd07a327c74031d5c604e49e5158f6a1 /sound
parentb1a5039759cb7bfcb2157f28604dbda0bca58598 (diff)
ALSA: hda/ca0132 - Reset codec upon initialization.
Reset the codec upon initialization to clear out anything that may have been setup on a previous boot into Windows, or in case of an improper shutdown. Signed-off-by: Connor McAdams <conmanx360@gmail.com> Link: https://lore.kernel.org/r/20201210160658.461739-2-conmanx360@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_ca0132.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 793dc5d501a5..5ac3227fb579 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -8642,6 +8642,22 @@ static void ca0132_init_chip(struct hda_codec *codec)
mutex_init(&spec->chipio_mutex);
+ /*
+ * The Windows driver always does this upon startup, which seems to
+ * clear out any previous configuration. This should help issues where
+ * a boot into Windows prior to a boot into Linux breaks things. Also,
+ * Windows always sends the reset twice.
+ */
+ if (ca0132_use_alt_functions(spec)) {
+ chipio_set_control_flag(codec, CONTROL_FLAG_IDLE_ENABLE, 0);
+ chipio_write_no_mutex(codec, 0x18b0a4, 0x000000c2);
+
+ snd_hda_codec_write(codec, codec->core.afg, 0,
+ AC_VERB_SET_CODEC_RESET, 0);
+ snd_hda_codec_write(codec, codec->core.afg, 0,
+ AC_VERB_SET_CODEC_RESET, 0);
+ }
+
spec->cur_out_type = SPEAKER_OUT;
if (!ca0132_use_alt_functions(spec))
spec->cur_mic_type = DIGITAL_MIC;
@@ -9262,11 +9278,6 @@ static void ae5_register_set(struct hda_codec *codec)
if (ca0132_quirk(spec) == QUIRK_AE5)
ca0113_mmio_command_set(codec, 0x48, 0x07, 0x83);
-
- chipio_write(codec, 0x18b0a4, 0x000000c2);
-
- snd_hda_codec_write(codec, 0x01, 0, 0x7ff, 0x00);
- snd_hda_codec_write(codec, 0x01, 0, 0x7ff, 0x00);
}
/*