From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA0F11E9DF4; Tue, 3 Sep 2024 20:48:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725396503; cv=none; b=ch6dXohD6TSEipk6Ke3FA29k8RQ8e8bN/hKr4PN9S9rQToCPzs+lCvaBv3DWDJ/mhO+IoGriQYAmQPmyYlgbSjsbGHtjvyszxPeQ+6m7PyD0KOjjsAceaWI6o3bnBCtMg4z7aTQAbPU6tfU0YceS6euZ4CmkCfUab5AJ12LjUtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725396503; c=relaxed/simple; bh=0s76Xt0h9zO9dZFVi0mGwbMtEFgItbl5fXI7RE+KX0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H0MFRvlXyuka5H5dMX9tKsF9rS76uZqQmoFOSHX7OCu4Xh142VCBeP0Ju1Tr2jM64+xD2MiGssso1YcR6aWkFIn+HxjbPH7aU3vpGAe+7YIZiUR0r6pTchZJQw0qzWws9oCDDXdYQ7j20ewoLCgL8+hRWM3GiA3s1V02Rn4BN2g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KI88V2iX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KI88V2iX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ED1FC4CEC5; Tue, 3 Sep 2024 20:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725396502; bh=0s76Xt0h9zO9dZFVi0mGwbMtEFgItbl5fXI7RE+KX0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KI88V2iXm8L2AqoonILNpIqUG68dnGSJN3lZtpEzu8A3HJKy8EEwXA08MxeVncon6 8vWOfKr+WBwFfv6DKk8pTrQJo3BHf391oijszuWJ508mooxZJfMv0ZjhJM65X4jx9l 3GT1zDpDTDSyGCiHlmc+XzpZUgFyoHFIkoQfUHFkYVcLdL89UVpG2NLHgRFpeo9hTM vvUSIwZT6JgQiLP4+Ud3QeqSAwnUQPHu01hpJnhgXstl/PLy5zY2pagDkhbfH6jAfL Eu5cRK1WrhLgRBmAMdg22dvJngzPz4406ou+V3qxAaaol9k97R9nPJQjsx+NOZoTle dZYTNVDjK+ePw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kailang Yang , Takashi Iwai , Sasha Levin , perex@perex.cz, tiwai@suse.com, sbinding@opensource.cirrus.com, simont@opensource.cirrus.com, foss@athaariq.my.id, rf@opensource.cirrus.com, linux-sound@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 3/8] ALSA: hda/realtek - FIxed ALC285 headphone no sound Date: Tue, 3 Sep 2024 15:28:39 -0400 Message-ID: <20240903192859.1108979-3-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903192859.1108979-1-sashal@kernel.org> References: <20240903192859.1108979-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.282 Content-Transfer-Encoding: 8bit From: Kailang Yang [ Upstream commit 1fa7b099d60ad64f559bd3b8e3f0d94b2e015514 ] Dell platform with ALC215 ALC285 ALC289 ALC225 ALC295 ALC299, plug headphone or headset. It had a chance to get no sound from headphone. Replace depop procedure will solve this issue. Signed-off-by: Kailang Yang Link: https://lore.kernel.org/d0de1b03fd174520945dde216d765223@realtek.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_realtek.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 162e76608d330..f32c3c3752417 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4777,6 +4777,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) case 0x10ec0295: case 0x10ec0289: case 0x10ec0299: + alc_hp_mute_disable(codec, 75); alc_process_coef_fw(codec, alc225_pre_hsmode); alc_process_coef_fw(codec, coef0225); break; @@ -5002,6 +5003,7 @@ static void alc_headset_mode_default(struct hda_codec *codec) case 0x10ec0299: alc_process_coef_fw(codec, alc225_pre_hsmode); alc_process_coef_fw(codec, coef0225); + alc_hp_enable_unmute(codec, 75); break; case 0x10ec0255: alc_process_coef_fw(codec, coef0255); @@ -5161,6 +5163,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) alc_process_coef_fw(codec, coef0225_2); else alc_process_coef_fw(codec, coef0225_1); + alc_hp_enable_unmute(codec, 75); break; case 0x10ec0867: alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); @@ -5266,6 +5269,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) case 0x10ec0289: case 0x10ec0299: alc_process_coef_fw(codec, coef0225); + alc_hp_enable_unmute(codec, 75); break; } codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); @@ -5420,12 +5424,6 @@ static void alc_determine_headset_type(struct hda_codec *codec) case 0x10ec0295: case 0x10ec0289: case 0x10ec0299: - snd_hda_codec_write(codec, 0x21, 0, - AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); - msleep(80); - snd_hda_codec_write(codec, 0x21, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); - alc_process_coef_fw(codec, alc225_pre_hsmode); alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); val = alc_read_coef_idx(codec, 0x45); @@ -5442,15 +5440,19 @@ static void alc_determine_headset_type(struct hda_codec *codec) val = alc_read_coef_idx(codec, 0x46); is_ctia = (val & 0x00f0) == 0x00f0; } + if (!is_ctia) { + alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10); + alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); + msleep(100); + val = alc_read_coef_idx(codec, 0x46); + if ((val & 0x00f0) == 0x00f0) + is_ctia = false; + else + is_ctia = true; + } alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); - - snd_hda_codec_write(codec, 0x21, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); - msleep(80); - snd_hda_codec_write(codec, 0x21, 0, - AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); break; case 0x10ec0867: is_ctia = true; -- 2.43.0