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 87DEC1E8B85; Tue, 3 Sep 2024 20:47:35 +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=1725396455; cv=none; b=VAJBNkF2mcdC4Koc2OCSA6W/01NXhh5VaGEz2NsTgBveDLAO5LU4kRb9LxB7zbVhHnkc+a3K/o2AV0sejTvAuigKjNPs1G/4R567G3HiV+qv2Oo1qIXUQXqBBtv6uLD9EQra8nfP4fVZ3f4IYxAqujck8e/TgUKoAYKPIak0OLA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725396455; c=relaxed/simple; bh=rMPB0XG11wMRF1FD0m4hf/Pdqh7q2CxvWfy4s/pZZzE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qdYNkGxf3z26UDqoWkyPPsffaBwdzFZREQHGHcxIw946+WHrjAtLkYj1YV067TjBTnSs15lWCXT0xUywxHBAB4pDtEeflF4gLRJPGIj3+W0LUA3vvoRFH2ZRgjYo/wPhZafGiM424zZV2bPIcHNxONhBvR2a5oSBzkVD5cQlzy8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dh5HZj7W; 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="dh5HZj7W" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B72F3C4CEC4; Tue, 3 Sep 2024 20:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725396455; bh=rMPB0XG11wMRF1FD0m4hf/Pdqh7q2CxvWfy4s/pZZzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dh5HZj7WHPJqmXayQB28t0DdvVLPx0HrtCRE0mTjVrInPyROdIZHNuR+xk1BXmfeR ztw/8X0PaVHCTbynsRiRDUfF+jKeaghFpd/zK9X8tHa1yaTXeTNr40mfl0Uk9zWb+t J/Xu64QFZQEZh6ulk+Z+h1hfQd/DoUUGxy480hty/7ugROkHj54FiKAaVc6yh6ihf0 bw1xfORQO/J/kCMx2iVoES7uagNQwnaCpR5IhHNrxdnPjyiDtMFKC5aOykoLfoijNf 0Na3BKsaJ5ycRxHwUlJxUz2qoVPiIfZvjslHniAgnII7PAhLPRaB5MavRJBPD49BwC L/L76VBHin+8w== 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.10 2/8] ALSA: hda/realtek - Fixed ALC256 headphone no sound Date: Tue, 3 Sep 2024 15:27:52 -0400 Message-ID: <20240903192815.1108754-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903192815.1108754-1-sashal@kernel.org> References: <20240903192815.1108754-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.10.224 Content-Transfer-Encoding: 8bit From: Kailang Yang [ Upstream commit 9b82ff1362f50914c8292902e07be98a9f59d33d ] Dell platform, 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/bb8e2de30d294dc287944efa0667685a@realtek.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/patch_realtek.c | 50 ++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e8e9cfb4a9357..269e973dde3e8 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4847,6 +4847,30 @@ static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, } } +static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay) +{ + if (delay <= 0) + delay = 75; + snd_hda_codec_write(codec, 0x21, 0, + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); + msleep(delay); + snd_hda_codec_write(codec, 0x21, 0, + AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); + msleep(delay); +} + +static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay) +{ + if (delay <= 0) + delay = 75; + snd_hda_codec_write(codec, 0x21, 0, + AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); + msleep(delay); + snd_hda_codec_write(codec, 0x21, 0, + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); + msleep(delay); +} + static const struct coef_fw alc225_pre_hsmode[] = { UPDATE_COEF(0x4a, 1<<8, 0), UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), @@ -4948,6 +4972,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) case 0x10ec0236: case 0x10ec0256: case 0x19e58326: + alc_hp_mute_disable(codec, 75); alc_process_coef_fw(codec, coef0256); break; case 0x10ec0234: @@ -5219,6 +5244,7 @@ static void alc_headset_mode_default(struct hda_codec *codec) alc_write_coef_idx(codec, 0x45, 0xc089); msleep(50); alc_process_coef_fw(codec, coef0256); + alc_hp_enable_unmute(codec, 75); break; case 0x10ec0234: case 0x10ec0274: @@ -5316,6 +5342,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) case 0x10ec0256: case 0x19e58326: alc_process_coef_fw(codec, coef0256); + alc_hp_enable_unmute(codec, 75); break; case 0x10ec0234: case 0x10ec0274: @@ -5431,6 +5458,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) case 0x10ec0256: case 0x19e58326: alc_process_coef_fw(codec, coef0256); + alc_hp_enable_unmute(codec, 75); break; case 0x10ec0234: case 0x10ec0274: @@ -5536,25 +5564,21 @@ static void alc_determine_headset_type(struct hda_codec *codec) alc_write_coef_idx(codec, 0x06, 0x6104); alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); - 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, coef0255); msleep(300); val = alc_read_coef_idx(codec, 0x46); is_ctia = (val & 0x0070) == 0x0070; - + if (!is_ctia) { + alc_write_coef_idx(codec, 0x45, 0xe089); + msleep(100); + val = alc_read_coef_idx(codec, 0x46); + if ((val & 0x0070) == 0x0070) + is_ctia = false; + else + is_ctia = true; + } alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); - - 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 0x10ec0234: case 0x10ec0274: -- 2.43.0