linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Connor McAdams <conmanx360@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: conmanx360@gmail.com, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	Alastair Bridgewater <alastair.bridgewater@gmail.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ALSA: hda/ca0132 - Actually fix microphone issue
Date: Sun, 21 Oct 2018 13:53:03 -0400	[thread overview]
Message-ID: <1540144385-27454-1-git-send-email-conmanx360@gmail.com> (raw)

This patch fixes the microphone issue for all cards. The previous fix
worked on the ZxR, but not on the AE-5 or Z. This patch has been tested
to work for all cards.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
---
 sound/pci/hda/patch_ca0132.c | 73 ++++++++++++++++++++++----------------------
 1 file changed, 37 insertions(+), 36 deletions(-)

diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 1a13cea..f0ef52e 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -6983,37 +6983,44 @@ static void sbz_chipio_startup_data(struct hda_codec *codec)
 static void ca0132_alt_dsp_scp_startup(struct hda_codec *codec)
 {
 	struct ca0132_spec *spec = codec->spec;
-	unsigned int tmp;
+	unsigned int tmp, i;
 
-	switch (spec->quirk) {
-	case QUIRK_SBZ:
-	case QUIRK_AE5:
-		tmp = 0x00000003;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
-		tmp = 0x00000000;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0A, tmp);
-		tmp = 0x00000001;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0B, tmp);
-		tmp = 0x00000004;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
-		tmp = 0x00000005;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
-		tmp = 0x00000000;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
-		break;
-	case QUIRK_R3D:
-	case QUIRK_R3DI:
-		tmp = 0x00000000;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0A, tmp);
-		tmp = 0x00000001;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0B, tmp);
-		tmp = 0x00000004;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
-		tmp = 0x00000005;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
-		tmp = 0x00000000;
-		dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
-		break;
+	/*
+	 * Gotta run these twice, or else mic works inconsistently. Not clear
+	 * why this is, but multiple tests have confirmed it.
+	 */
+	for (i = 0; i < 2; i++) {
+		switch (spec->quirk) {
+		case QUIRK_SBZ:
+		case QUIRK_AE5:
+			tmp = 0x00000003;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
+			tmp = 0x00000000;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0A, tmp);
+			tmp = 0x00000001;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0B, tmp);
+			tmp = 0x00000004;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
+			tmp = 0x00000005;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
+			tmp = 0x00000000;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
+			break;
+		case QUIRK_R3D:
+		case QUIRK_R3DI:
+			tmp = 0x00000000;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0A, tmp);
+			tmp = 0x00000001;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0B, tmp);
+			tmp = 0x00000004;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
+			tmp = 0x00000005;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
+			tmp = 0x00000000;
+			dspio_set_uint_param_no_source(codec, 0x80, 0x0C, tmp);
+			break;
+		}
+		msleep(100);
 	}
 }
 
@@ -7246,8 +7253,6 @@ static void r3d_setup_defaults(struct hda_codec *codec)
 	int num_fx;
 	int idx, i;
 
-	msleep(100);
-
 	if (spec->dsp_state != DSP_DOWNLOADED)
 		return;
 
@@ -7292,8 +7297,6 @@ static void sbz_setup_defaults(struct hda_codec *codec)
 	int num_fx;
 	int idx, i;
 
-	msleep(100);
-
 	if (spec->dsp_state != DSP_DOWNLOADED)
 		return;
 
@@ -7351,8 +7354,6 @@ static void ae5_setup_defaults(struct hda_codec *codec)
 	int num_fx;
 	int idx, i;
 
-	msleep(100);
-
 	if (spec->dsp_state != DSP_DOWNLOADED)
 		return;
 
-- 
2.7.4


             reply	other threads:[~2018-10-21 17:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-21 17:53 Connor McAdams [this message]
2018-10-21 22:15 ` [PATCH] ALSA: hda/ca0132 - Actually fix microphone issue Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1540144385-27454-1-git-send-email-conmanx360@gmail.com \
    --to=conmanx360@gmail.com \
    --cc=alastair.bridgewater@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).