diff mbox series

ALSA: hda/realtek: Fix audio regression on Mi Notebook Pro 2020

Message ID 20220329001845.776776-1-kai.heng.feng@canonical.com
State Accepted
Commit f30741cded62f87bb4b1cc58bc627f076abcaba8
Headers show
Series ALSA: hda/realtek: Fix audio regression on Mi Notebook Pro 2020 | expand

Commit Message

Kai-Heng Feng March 29, 2022, 12:18 a.m. UTC
Commit 5aec98913095 ("ALSA: hda/realtek - ALC236 headset MIC recording
issue") is to solve recording issue met on AL236, by matching codec
variant ALC269_TYPE_ALC257 and ALC269_TYPE_ALC256.

This match can be too broad and Mi Notebook Pro 2020 is broken by the
patch.

Instead, use codec ID to be narrow down the scope, in order to make
ALC256 unaffected.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215484
Fixes: 5aec98913095 ("ALSA: hda/realtek - ALC236 headset MIC recording issue")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

kernel test robot March 29, 2022, 4:39 a.m. UTC | #1
Hi Kai-Heng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on v5.17 next-20220329]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Kai-Heng-Feng/ALSA-hda-realtek-Fix-audio-regression-on-Mi-Notebook-Pro-2020/20220329-082021
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: arm64-randconfig-r036-20220327 (https://download.01.org/0day-ci/archive/20220329/202203291202.DT2WLVoc-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/b86b7ea348ec9ba6c3824d7a0066968ec4fa0ce5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kai-Heng-Feng/ALSA-hda-realtek-Fix-audio-regression-on-Mi-Notebook-Pro-2020/20220329-082021
        git checkout b86b7ea348ec9ba6c3824d7a0066968ec4fa0ce5
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash sound/pci/hda/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> sound/pci/hda/patch_realtek.c:3620:42: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
           if (codec->core.vendor_id != 0x10ec0236 ||
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
   1 warning generated.


vim +3620 sound/pci/hda/patch_realtek.c

  3594	
  3595	static void alc256_shutup(struct hda_codec *codec)
  3596	{
  3597		struct alc_spec *spec = codec->spec;
  3598		hda_nid_t hp_pin = alc_get_hp_pin(spec);
  3599		bool hp_pin_sense;
  3600	
  3601		if (!hp_pin)
  3602			hp_pin = 0x21;
  3603	
  3604		hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
  3605	
  3606		if (hp_pin_sense)
  3607			msleep(2);
  3608	
  3609		snd_hda_codec_write(codec, hp_pin, 0,
  3610				    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
  3611	
  3612		if (hp_pin_sense || spec->ultra_low_power)
  3613			msleep(85);
  3614	
  3615		/* 3k pull low control for Headset jack. */
  3616		/* NOTE: call this before clearing the pin, otherwise codec stalls */
  3617		/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
  3618		 * when booting with headset plugged. So skip setting it for the codec alc257
  3619		 */
> 3620		if (codec->core.vendor_id != 0x10ec0236 ||
  3621		    codec->core.vendor_id != 0x10ec0257)
  3622			alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
  3623	
  3624		if (!spec->no_shutup_pins)
  3625			snd_hda_codec_write(codec, hp_pin, 0,
  3626					    AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
  3627	
  3628		if (hp_pin_sense || spec->ultra_low_power)
  3629			msleep(100);
  3630	
  3631		alc_auto_setup_eapd(codec, false);
  3632		alc_shutup_pins(codec);
  3633		if (spec->ultra_low_power) {
  3634			msleep(50);
  3635			alc_update_coef_idx(codec, 0x03, 1<<1, 0);
  3636			alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
  3637			alc_update_coef_idx(codec, 0x08, 3<<2, 0);
  3638			alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
  3639			alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
  3640			msleep(30);
  3641		}
  3642	}
  3643
diff mbox series

Patch

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 4c33cb57963db..0d5e6cfa44888 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3617,8 +3617,8 @@  static void alc256_shutup(struct hda_codec *codec)
 	/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
 	 * when booting with headset plugged. So skip setting it for the codec alc257
 	 */
-	if (spec->codec_variant != ALC269_TYPE_ALC257 &&
-	    spec->codec_variant != ALC269_TYPE_ALC256)
+	if (codec->core.vendor_id != 0x10ec0236 ||
+	    codec->core.vendor_id != 0x10ec0257)
 		alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
 
 	if (!spec->no_shutup_pins)