1. 04 Mar, 2024 1 commit
  2. 01 Mar, 2024 2 commits
    • songxiebing's avatar
      ALSA: hda: optimize the probe codec process · 642b02b4
      songxiebing authored
      In azx_probe_codecs function, when bus->codec_mask is becomes to 0(no codecs),
      execute azx_init_chip, bus->codec_mask will be initialized to a value again,
      this causes snd_hda_codec_new function to run, the process is as follows:
      -->snd_hda_codec_new
      -->snd_hda_codec_device_init
      -->snd_hdac_device_init---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
      		       ---snd_hdac_read_parm(...AC_PAR_VENDOR_ID) 2s
      		       ---snd_hdac_read_parm(...AC_PAR_SUBSYSTEM_ID) 2s
      		       ---snd_hdac_read_parm(...AC_PAR_REV_ID) 2s
      		       ---snd_hdac_read_parm(...AC_PAR_NODE_COUNT) 2s
      when no codecs, read communication is error, each command will be polled for
      2 second, a total of 10s, it is easy to some problem.
      like this:
        2 [   14.833404][ 6] [  T164] hda 0006:00: Codec #0 probe error; disabling it...
        3 [   14.844178][ 6] [  T164] hda 0006:00: codec_mask = 0x1
        4 [   14.880532][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0000
        5 [   15.891988][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0000
        6 [   16.978090][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0001
        7 [   18.140895][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0002
        8 [   19.135516][ 6] [  T164] hda 0006:00: too slow response, last cmd=0x0f0004
       10 [   19.900086][ 6] [  T164] hda 0006:00: no codecs initialized
       11 [   45.573398][ 2] [    C2] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [kworker/2:0:25]
      
      Here, when bus->codec_mask is 0, use a direct break to avoid execute snd_hda_codec_new function.
      Signed-off-by: default avatarsongxiebing <songxiebing@kylinos.cn>
      Link: https://lore.kernel.org/r/20240301011841.7247-1-soxiebing@163.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      642b02b4
    • Kailang Yang's avatar
      ALSA: hda/realtek - Fix headset Mic no show at resume back for Lenovo ALC897 platform · d397b6e5
      Kailang Yang authored
      Headset Mic will no show at resume back.
      This patch will fix this issue.
      
      Fixes: d7f32791 ("ALSA: hda/realtek - Add headset Mic support for Lenovo ALC897 platform")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Link: https://lore.kernel.org/r/4713d48a372e47f98bba0c6120fd8254@realtek.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d397b6e5
  3. 29 Feb, 2024 1 commit
    • Takashi Iwai's avatar
      Merge tag 'asoc-fix-v6.8-rc5' of... · 17c6a0c9
      Takashi Iwai authored
      Merge tag 'asoc-fix-v6.8-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: Fixes for v6.8
      
      A few small fixes, some driver specific and one slightly larger one
      from Richard which adds a new core helper and updates a small clutch of
      drivers to deal with the fact that they were using a helper which
      requires that the lock for the list of controls without holding that
      lock.  We also have some quirks for new AMD based Lenovo systems.
      17c6a0c9
  4. 28 Feb, 2024 2 commits
  5. 27 Feb, 2024 1 commit
  6. 26 Feb, 2024 1 commit
  7. 25 Feb, 2024 1 commit
  8. 23 Feb, 2024 3 commits
    • Richard Fitzgerald's avatar
      ASoC: soc-card: Fix missing locking in snd_soc_card_get_kcontrol() · eba2eb24
      Richard Fitzgerald authored
      snd_soc_card_get_kcontrol() must be holding a read lock on
      card->controls_rwsem while walking the controls list.
      
      Compare with snd_ctl_find_numid().
      
      The existing function is renamed snd_soc_card_get_kcontrol_locked()
      so that it can be called from contexts that are already holding
      card->controls_rwsem (for example, control get/put functions).
      
      There are few direct or indirect callers of
      snd_soc_card_get_kcontrol(), and most are safe. Three require
      changes, which have been included in this patch:
      
      codecs/cs35l45.c:
        cs35l45_activate_ctl() is called from a control put() function so
        is changed to call snd_soc_card_get_kcontrol_locked().
      
      codecs/cs35l56.c:
        cs35l56_sync_asp1_mixer_widgets_with_firmware() is called from
        control get()/put() functions so is changed to call
        snd_soc_card_get_kcontrol_locked().
      
      fsl/fsl_xcvr.c:
        fsl_xcvr_activate_ctl() is called from three places, one of which
        already holds card->controls_rwsem:
        1. fsl_xcvr_mode_put(), a control put function, which will
           already be holding card->controls_rwsem.
        2. fsl_xcvr_startup(), a DAI startup function.
        3. fsl_xcvr_shutdown(), a DAI shutdown function.
      
        To fix this, fsl_xcvr_activate_ctl() has been changed to call
        snd_soc_card_get_kcontrol_locked() so that it is safe to call
        directly from fsl_xcvr_mode_put().
        The fsl_xcvr_startup() and fsl_xcvr_shutdown() functions have been
        changed to take a read lock on card->controls_rsem() around calls
        to fsl_xcvr_activate_ctl(). While this is not very elegant, it
        keeps the change small, to avoid this patch creating a large
        collateral churn in fsl/fsl_xcvr.c.
      
      Analysis of other callers of snd_soc_card_get_kcontrol() is that
      they do not need any changes, they are not holding card->controls_rwsem
      when they call snd_soc_card_get_kcontrol().
      
      Direct callers of snd_soc_card_get_kcontrol():
        fsl/fsl_spdif.c: fsl_spdif_dai_probe() - DAI probe function
        fsl/fsl_micfil.c: voice_detected_fn() - IRQ handler
      
      Indirect callers via soc_component_notify_control():
        codecs/cs42l43: cs42l43_mic_shutter() - IRQ handler
        codecs/cs42l43: cs42l43_spk_shutter() - IRQ handler
        codecs/ak4118.c: ak4118_irq_handler() - IRQ handler
        codecs/wm_adsp.c: wm_adsp_write_ctl() - not currently used
      
      Indirect callers via snd_soc_limit_volume():
        qcom/sc8280xp.c: sc8280xp_snd_init() - DAIlink init function
        ti/rx51.c: rx51_aic34_init() - DAI init function
      
      I don't have hardware to test the fsl/*, qcom/sc828xp.c, ti/rx51.c
      and ak4118.c changes.
      
      Backport note:
      The fsl/, qcom/, cs35l45, cs35l56 and cs42l43 callers were added
      since the Fixes commit so won't all be present on older kernels.
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Fixes: 209c6cdf ("ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card")
      Link: https://lore.kernel.org/r/20240221123710.690224-1-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      eba2eb24
    • Gergo Koteles's avatar
      ALSA: hda/realtek: tas2781: enable subwoofer volume control · c1947ce6
      Gergo Koteles authored
      The volume of subwoofer channels is always at maximum with the
      ALC269_FIXUP_THINKPAD_ACPI chain.
      
      Use ALC285_FIXUP_THINKPAD_HEADSET_JACK to align it to the master volume.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=208555#c827
      
      Fixes: 3babae91 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGergo Koteles <soyer@irl.hu>
      Link: https://lore.kernel.org/r/7ffae10ebba58601d25fe2ff8381a6ae3a926e62.1708687813.git.soyer@irl.huSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c1947ce6
    • Jaroslav Kysela's avatar
      ALSA: pcm: clarify and fix default msbits value for all formats · 85df6b5a
      Jaroslav Kysela authored
      Return used most significant bits from sample bit-width rather than the whole
      physical sample word size. The starting bit offset is defined in the format
      itself.
      
      The behaviour is not changed for 32-bit formats like S32_LE. But with this
      change - msbits value 24 instead 32 is returned for 24-bit formats like S24_LE
      etc.
      
      Also, commit 2112aa03 ("ALSA: pcm: Introduce MSBITS subformat interface")
      compares sample bit-width not physical sample bit-width to reset MSBITS_MAX bit
      from the subformat bitmask.
      
      Probably no applications are using msbits value for other than S32_LE/U32_LE
      formats, because no drivers are reducing msbits value for other formats (with
      the msb offset) at the moment.
      
      For sanity, increase PCM protocol version, letting the user space to detect
      the changed behaviour.
      Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20240222173649.1447549-1-perex@perex.czSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      85df6b5a
  9. 21 Feb, 2024 3 commits
  10. 20 Feb, 2024 1 commit
  11. 19 Feb, 2024 4 commits
  12. 15 Feb, 2024 3 commits
  13. 14 Feb, 2024 3 commits
  14. 13 Feb, 2024 8 commits
  15. 12 Feb, 2024 4 commits
  16. 11 Feb, 2024 2 commits
    • Cristian Ciocaltea's avatar
      ASoC: SOF: amd: Fix locking in ACP IRQ handler · c4b603c6
      Cristian Ciocaltea authored
      A recent change in acp_irq_thread() was meant to address a potential race
      condition while trying to acquire the hardware semaphore responsible for
      the synchronization between firmware and host IPC interrupts.
      
      This resulted in an improper use of the IPC spinlock, causing normal
      kernel memory allocations (which may sleep) inside atomic contexts:
      
      1707255557.133976 kernel: BUG: sleeping function called from invalid context at include/linux/sched/mm.h:315
      
      ...
      
      1707255557.134757 kernel:  sof_ipc3_rx_msg+0x70/0x130 [snd_sof]
      1707255557.134793 kernel:  acp_sof_ipc_irq_thread+0x1e0/0x550 [snd_sof_amd_acp]
      1707255557.134855 kernel:  acp_irq_thread+0xa3/0x130 [snd_sof_amd_acp]
      1707255557.134904 kernel:  ? irq_thread+0xb5/0x1e0
      1707255557.134947 kernel:  ? __pfx_irq_thread_fn+0x10/0x10
      1707255557.134985 kernel:  irq_thread_fn+0x23/0x60
      
      Moreover, there are attempts to lock a mutex from the same atomic
      context:
      
      1707255557.136357 kernel: =============================
      1707255557.136393 kernel: [ BUG: Invalid wait context ]
      1707255557.136413 kernel: 6.8.0-rc3-next-20240206-audio-next #9 Tainted: G        W
      1707255557.136432 kernel: -----------------------------
      1707255557.136451 kernel: irq/66-AudioDSP/502 is trying to lock:
      1707255557.136470 kernel: ffff965152f26af8 (&sb->s_type->i_mutex_key#2){+.+.}-{3:3}, at: start_creating.part.0+0x5f/0x180
      
      ...
      
      1707255557.137429 kernel:  start_creating.part.0+0x5f/0x180
      1707255557.137457 kernel:  __debugfs_create_file+0x61/0x210
      1707255557.137475 kernel:  snd_sof_debugfs_io_item+0x75/0xc0 [snd_sof]
      1707255557.137494 kernel:  sof_ipc3_do_rx_work+0x7cf/0x9f0 [snd_sof]
      1707255557.137513 kernel:  sof_ipc3_rx_msg+0xb3/0x130 [snd_sof]
      1707255557.137532 kernel:  acp_sof_ipc_irq_thread+0x1e0/0x550 [snd_sof_amd_acp]
      1707255557.137551 kernel:  acp_irq_thread+0xa3/0x130 [snd_sof_amd_acp]
      
      Fix the issues by reducing the lock scope in acp_irq_thread(), so that
      it guards only the hardware semaphore acquiring attempt.  Additionally,
      restore the initial locking in acp_sof_ipc_irq_thread() to synchronize
      the handling of immediate replies from DSP core.
      
      Fixes: 802134c8 ("ASoC: SOF: amd: Refactor spinlock_irq(&sdev->ipc_lock) sequence in irq_handler")
      Signed-off-by: default avatarCristian Ciocaltea <cristian.ciocaltea@collabora.com>
      Link: https://lore.kernel.org/r/20240208234315.2182048-1-cristian.ciocaltea@collabora.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      c4b603c6
    • Alexey Khoroshilov's avatar
      ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work() · 6ef5d5b9
      Alexey Khoroshilov authored
      There is a path in rt5645_jack_detect_work(), where rt5645->jd_mutex
      is left locked forever. That may lead to deadlock
      when rt5645_jack_detect_work() is called for the second time.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Fixes: cdba4301 ("ASoC: rt5650: add mutex to avoid the jack detection failure")
      Signed-off-by: default avatarAlexey Khoroshilov <khoroshilov@ispras.ru>
      Link: https://lore.kernel.org/r/1707645514-21196-1-git-send-email-khoroshilov@ispras.ruSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      6ef5d5b9