1. 31 Mar, 2020 3 commits
    • Thomas Hebb's avatar
      ALSA: hda/realtek - Remove now-unnecessary XPS 13 headphone noise fixups · f36938aa
      Thomas Hebb authored
      patch_realtek.c has historically failed to properly configure the PC
      Beep Hidden Register for the ALC256 codec (among others). Depending on
      your kernel version, symptoms of this misconfiguration can range from
      chassis noise, picked up by a poorly-shielded PCBEEP trace, getting
      amplified and played on your internal speaker and/or headphones to loud
      feedback, which responds to the "Headphone Mic Boost" ALSA control,
      getting played through your headphones. For details of the problem, see
      the patch in this series titled "ALSA: hda/realtek - Set principled PC
      Beep configuration for ALC256", which fixes the configuration.
      
      These symptoms have been most noticed on the Dell XPS 13 9350 and 9360,
      popular laptops that use the ALC256. As a result, several model-specific
      fixups have been introduced to try and fix the problem, the most
      egregious of which locks the "Headphone Mic Boost" control as a hack to
      minimize noise from a feedback loop that shouldn't have been there in
      the first place.
      
      Now that the underlying issue has been fixed, remove all these fixups.
      Remaining fixups needed by the XPS 13 are all picked up by existing pin
      quirks.
      
      This change should, for the XPS 13 9350/9360
      
       - Significantly increase volume and audio quality on headphones
       - Eliminate headphone popping on suspend/resume
       - Allow "Headphone Mic Boost" to be set again, making the headphone
         jack fully usable as a microphone jack too.
      
      Fixes: 8c69729b ("ALSA: hda - Fix headphone noise after Dell XPS 13 resume back from S3")
      Fixes: 423cd785 ("ALSA: hda - Fix headphone noise on Dell XPS 13 9360")
      Fixes: e4c9fd10 ("ALSA: hda - Apply headphone noise quirk for another Dell XPS 13 variant")
      Fixes: 1099f484 ("ALSA: hda/realtek: Reduce the Headphone static noise on XPS 9350/9360")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarThomas Hebb <tommyhebb@gmail.com>
      Link: https://lore.kernel.org/r/b649a00edfde150cf6eebbb4390e15e0c2deb39a.1585584498.git.tommyhebb@gmail.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f36938aa
    • Thomas Hebb's avatar
      ALSA: hda/realtek - Set principled PC Beep configuration for ALC256 · c4473744
      Thomas Hebb authored
      The Realtek PC Beep Hidden Register[1] is currently set by
      patch_realtek.c in two different places:
      
      In alc_fill_eapd_coef(), it's set to the value 0x5757, corresponding to
      non-beep input on 1Ah and no 1Ah loopback to either headphones or
      speakers. (Although, curiously, the loopback amp is still enabled.) This
      write was added fairly recently by commit e3743f431143 ("ALSA:
      hda/realtek - Dell headphone has noise on unmute for ALC236") and is a
      safe default. However, it happens in the wrong place:
      alc_fill_eapd_coef() runs on module load and cold boot but not on S3
      resume, meaning the register loses its value after suspend.
      
      Conversely, in alc256_init(), the register is updated to unset bit 13
      (disable speaker loopback) and set bit 5 (set non-beep input on 1Ah).
      Although this write does run on S3 resume, it's not quite enough to fix
      up the register's default value of 0x3717. What's missing is a set of
      bit 14 to disable headphone loopback. Without that, we end up with a
      feedback loop where the headphone jack is being driven by amplified
      samples of itself[2].
      
      This change eliminates the update in alc256_init() and replaces it with
      the 0x5757 write from alc_fill_eapd_coef(). Kailang says that 0x5757 is
      supposed to be the codec's default value, so using it will make
      debugging easier for Realtek.
      
      Affects the ALC255, ALC256, ALC257, ALC235, and ALC236 codecs.
      
      [1] Newly documented in Documentation/sound/hd-audio/realtek-pc-beep.rst
      
      [2] Setting the "Headphone Mic Boost" control from userspace changes
      this feedback loop and has been a widely-shared workaround for headphone
      noise on laptops like the Dell XPS 13 9350. This commit eliminates the
      feedback loop and makes the workaround unnecessary.
      
      Fixes: e1e8c1fd ("ALSA: hda/realtek - Dell headphone has noise on unmute for ALC236")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarThomas Hebb <tommyhebb@gmail.com>
      Link: https://lore.kernel.org/r/bf22b417d1f2474b12011c2a39ed6cf8b06d3bf5.1585584498.git.tommyhebb@gmail.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c4473744
    • Thomas Hebb's avatar
      ALSA: doc: Document PC Beep Hidden Register on Realtek ALC256 · f1280904
      Thomas Hebb authored
      This codec (among others) has a hidden set of audio routes, apparently
      designed to allow PC Beep output without a mixer widget on the output
      path, which are controlled by an undocumented Realtek vendor register.
      The default configuration of these routes means that certain inputs
      aren't accessible, necessitating driver control of the register.
      However, Realtek has provided no documentation of the register, instead
      opting to fix issues by providing magic numbers, most of which have been
      at least somewhat erroneous. These magic numbers then get copied by
      others into model-specific fixups, leading to a fragmented and buggy set
      of configurations.
      
      To get out of this situation, I've reverse engineered the register by
      flipping bits and observing how the codec's behavior changes. This
      commit documents my findings. It does not change any code.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarThomas Hebb <tommyhebb@gmail.com>
      Link: https://lore.kernel.org/r/bd69dfdeaf40ff31c4b7b797c829bb320031739c.1585584498.git.tommyhebb@gmail.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f1280904
  2. 30 Mar, 2020 2 commits
    • Takashi Iwai's avatar
      Merge tag 'asoc-v5.7' of... · 3c22baea
      Takashi Iwai authored
      Merge tag 'asoc-v5.7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: Updates for v5.7
      
      This is a very big update for the core since Morimoto-san has been
      rather busy continuing his refactorings to clean up a lot of the cruft
      that we have accumilated over the years.  We've also gained several new
      drivers, including initial (but still not complete) parts of the Intel
      SoundWire support.
      
       - Lots of refactorings to modernize the code from Morimoto-san.
       - Conversion of SND_SOC_ALL_CODECS to use imply from Geert Uytterhoeven.
       - Continued refactoring and fixing of the Intel support.
       - Soundwire and more advanced clocking support for Realtek RT5682.
       - Support for amlogic GX, Meson 8, Meson 8B and T9015 DAC, Broadcom
         DSL/PON, Ingenic JZ4760 and JZ4770, Realtek RL6231, and TI TAS2563 and
         TLV320ADCX140.
      3c22baea
    • Takashi Iwai's avatar
      Merge branch 'for-next' into for-linus · aa21c3d4
      Takashi Iwai authored
      aa21c3d4
  3. 29 Mar, 2020 2 commits
  4. 27 Mar, 2020 33 commits