1. 27 Mar, 2024 5 commits
    • Gergo Koteles's avatar
      ALSA: hda/tas2781: remove useless dev_dbg from playback_hook · 1506d961
      Gergo Koteles authored
      The debug message "Playback action not supported: action" is not useful,
      because the action was previously printed, and the list of supported
      actions are intentional.
      
      Remove the debug statement from the default switch case.
      Signed-off-by: default avatarGergo Koteles <soyer@irl.hu>
      Message-ID: <8b9546db6c92dea4476a7247a88d56248c2ba8c2.1711469583.git.soyer@irl.hu>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1506d961
    • Gergo Koteles's avatar
      ALSA: hda/tas2781: add debug statements to kcontrols · 26c04a8a
      Gergo Koteles authored
      Sometimes it is useful to examine the timing of kcontrol events.
      
      Add debug statements to each kcontrol.
      Signed-off-by: default avatarGergo Koteles <soyer@irl.hu>
      Message-ID: <18ff4b0caab90a2dacf907e62346fd5079a9eb1a.1711469583.git.soyer@irl.hu>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      26c04a8a
    • Gergo Koteles's avatar
      ALSA: hda/tas2781: add locks to kcontrols · 15bc3066
      Gergo Koteles authored
      The rcabin.profile_cfg_id, cur_prog, cur_conf, force_fwload_status
      variables are acccessible from multiple threads and therefore require
      locking.
      
      Fixes: 5be27f1e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarGergo Koteles <soyer@irl.hu>
      Message-ID: <e35b867f6fe5fa1f869dd658a0a1f2118b737f57.1711469583.git.soyer@irl.hu>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      15bc3066
    • Gergo Koteles's avatar
      ALSA: hda/tas2781: remove digital gain kcontrol · ae065d0c
      Gergo Koteles authored
      The "Speaker Digital Gain" kcontrol controls the TAS2781_DVC_LVL (0x1A)
      register. Unfortunately the tas2563 does not have DVC_LVL, but has
      INT_MASK0 in 0x1A, which has been misused so far.
      
      Since commit c1947ce6 ("ALSA: hda/realtek: tas2781: enable subwoofer
      volume control") the volume of the tas2781 amplifiers can be controlled
      by the master volume, so this digital gain kcontrol is not needed.
      
      Remove it.
      
      Fixes: 5be27f1e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarGergo Koteles <soyer@irl.hu>
      Message-ID: <741fc21db994efd58f83e7aef38931204961e5b2.1711469583.git.soyer@irl.hu>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      ae065d0c
    • Arnd Bergmann's avatar
      ALSA: aoa: avoid false-positive format truncation warning · 7590ac22
      Arnd Bergmann authored
      clang warns about what it interprets as a truncated snprintf:
      
      sound/aoa/soundbus/i2sbus/core.c:171:6: error: 'snprintf' will always be truncated; specified size is 6, but format string expands to at least 7 [-Werror,-Wformat-truncation-non-kprintf]
      
      The actual problem here is that it does not understand the special
      %pOFn format string and assumes that it is a pointer followed by
      the string "OFn", which would indeed not fit.
      
      Slightly increasing the size of the buffer to its natural alignment
      avoids the warning, as it is now long enough for the correct and
      the incorrect interprations.
      
      Fixes: b917d58d ("ALSA: aoa: Convert to using %pOFn instead of device_node.name")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Message-ID: <20240326223825.4084412-9-arnd@kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7590ac22
  2. 26 Mar, 2024 1 commit
    • Duoming Zhou's avatar
      ALSA: sh: aica: reorder cleanup operations to avoid UAF bugs · 051e0840
      Duoming Zhou authored
      The dreamcastcard->timer could schedule the spu_dma_work and the
      spu_dma_work could also arm the dreamcastcard->timer.
      
      When the snd_pcm_substream is closing, the aica_channel will be
      deallocated. But it could still be dereferenced in the worker
      thread. The reason is that del_timer() will return directly
      regardless of whether the timer handler is running or not and
      the worker could be rescheduled in the timer handler. As a result,
      the UAF bug will happen. The racy situation is shown below:
      
            (Thread 1)                 |      (Thread 2)
      snd_aicapcm_pcm_close()          |
       ...                             |  run_spu_dma() //worker
                                       |    mod_timer()
        flush_work()                   |
        del_timer()                    |  aica_period_elapsed() //timer
        kfree(dreamcastcard->channel)  |    schedule_work()
                                       |  run_spu_dma() //worker
        ...                            |    dreamcastcard->channel-> //USE
      
      In order to mitigate this bug and other possible corner cases,
      call mod_timer() conditionally in run_spu_dma(), then implement
      PCM sync_stop op to cancel both the timer and worker. The sync_stop
      op will be called from PCM core appropriately when needed.
      
      Fixes: 198de43d ("[ALSA] Add ALSA support for the SEGA Dreamcast PCM device")
      Suggested-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Message-ID: <20240326094238.95442-1-duoming@zju.edu.cn>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      051e0840
  3. 25 Mar, 2024 2 commits
  4. 22 Mar, 2024 2 commits
  5. 21 Mar, 2024 1 commit
  6. 20 Mar, 2024 2 commits
  7. 19 Mar, 2024 1 commit
  8. 18 Mar, 2024 2 commits
  9. 17 Mar, 2024 3 commits
    • Takashi Sakamoto's avatar
      ALSA: core: add kunitconfig · 585f5bf9
      Takashi Sakamoto authored
      It is helpful to add .kunitconfig if we work with the tools provided by
      KUnit project. The file describes the series of kernel configurations to
      satisfy the dependency to build the target test.
      
      For example:
      
      $ ./tools/testing/kunit/kunit.py run --arch=arm64 --cross_compile=aarch64-linux-gnu- --kunitconfig=sound/core/
      [11:35:13] Configuring KUnit Kernel ...
      Regenerating .config ...
      Populating config with:
      $ make ARCH=arm64 O=.kunit olddefconfig CROSS_COMPILE=aarch64-linux-gnu-
      [11:35:19] Building KUnit Kernel ...
      Populating config with:
      $ make ARCH=arm64 O=.kunit olddefconfig CROSS_COMPILE=aarch64-linux-gnu-
      Building with:
      $ make ARCH=arm64 O=.kunit --jobs=8 CROSS_COMPILE=aarch64-linux-gnu-
      [11:37:35] Starting KUnit Kernel (1/1)...
      [11:37:35] ============================================================
      Running tests with:
      $ qemu-system-aarch64 -nodefaults -m 1024 -kernel .kunit/arch/arm64/boot/Image.gz -append 'kunit.enable=1 console=ttyAMA0 kunit_shutdown=reboot' -no-reboot -nographic -serial stdio -machine virt -cpu max,pauth-impdef=on
      [11:37:35] ============== sound-core-test (10 subtests) ===============
      [11:37:35] [PASSED] test_phys_format_size
      [11:37:35] [PASSED] test_format_width
      [11:37:35] [PASSED] test_format_endianness
      [11:37:35] [PASSED] test_format_signed
      [11:37:35] [PASSED] test_format_fill_silence
      [11:37:35] [PASSED] test_playback_avail
      [11:37:35] [PASSED] test_capture_avail
      [11:37:35] [PASSED] test_card_set_id
      [11:37:35] [PASSED] test_pcm_format_name
      [11:37:35] [PASSED] test_card_add_component
      [11:37:35] ================= [PASSED] sound-core-test =================
      [11:37:35] ============================================================
      [11:37:35] Testing complete. Ran 10 tests: passed: 10
      [11:37:35] Elapsed time: 142.333s total, 5.617s configuring, 136.047s building, 0.630s running
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Message-ID: <20240317024050.588370-1-o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      585f5bf9
    • Ian Murphy's avatar
      ALSA: hda/realtek: add in quirk for Acer Swift Go 16 - SFG16-71 · bd2d8305
      Ian Murphy authored
      Keyboard has an LED that is ON/OFF when mic is muted/active
       - LED is controlled by GPIO pin
       - Patch enables led to appear in /sys/class/leds/ as hda::micmute
       - Enables LED when mic is MUTED
       - Disables LED when mic is active
      
      [ fixed white spaces by tiwai ]
      Signed-off-by: default avatarIan Murphy <iano200@gmail.com>
      Message-ID: <20240316094157.13890-1-iano200@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      bd2d8305
    • Takashi Iwai's avatar
      Revert "ALSA: usb-audio: Name feature ctl using output if input is PCM" · c53898eb
      Takashi Iwai authored
      This reverts commit 1601cd53.
      
      This fix is applied globally to all devices, and it may change the
      existing control names.  When the devices are managed with the fixed
      configuration like UCM, such control name mismatch may lead to
      significant regressions.
      
      For avoiding that kind of regression, we would need to apply such
      changes conditionally, but it'd take time to settle down.
      While the original fix is a good thing in general, in order to address
      the regression, let's revert the change for now.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=218605Reported-and-tested-by: default avatarNiklāvs Koļesņikovs <pinkflames.linux@gmail.com>
      Message-ID: <20240316083744.28126-1-tiwai@suse.de>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c53898eb
  10. 15 Mar, 2024 5 commits
    • Mark Brown's avatar
      ASoC: SOF: amd: Skip IRAM/DRAM size modification · f107ffca
      Mark Brown authored
      Merge series from Cristian Ciocaltea <cristian.ciocaltea@collabora.com>:
      
      This patch series restores audio support on Valve's Steam Deck OLED model, which
      broke after the recent introduction of ACP/PSP communication for IRAM/DRAM fence
      register programming.
      f107ffca
    • Cristian Ciocaltea's avatar
      ASoC: SOF: amd: Skip IRAM/DRAM size modification for Steam Deck OLED · 094d1176
      Cristian Ciocaltea authored
      The recent introduction of the ACP/PSP communication for IRAM/DRAM fence
      register modification breaks the audio support on Valve's Steam Deck
      OLED device.
      
      It causes IPC timeout errors when trying to load DSP topology during
      probing:
      
      1707255557.688176 kernel: snd_sof_amd_vangogh 0000:04:00.5: ipc tx timed out for 0x30100000 (msg/reply size: 48/0)
      1707255557.689035 kernel: snd_sof_amd_vangogh 0000:04:00.5: ------------[ IPC dump start ]------------
      1707255557.689421 kernel: snd_sof_amd_vangogh 0000:04:00.5: dsp_msg = 0x0 dsp_ack = 0x91d14f6f host_msg = 0x1 host_ack = 0xead0f1a4 irq_stat >
      1707255557.689730 kernel: snd_sof_amd_vangogh 0000:04:00.5: ------------[ IPC dump end ]------------
      1707255557.690074 kernel: snd_sof_amd_vangogh 0000:04:00.5: ------------[ DSP dump start ]------------
      1707255557.690376 kernel: snd_sof_amd_vangogh 0000:04:00.5: IPC timeout
      1707255557.690744 kernel: snd_sof_amd_vangogh 0000:04:00.5: fw_state: SOF_FW_BOOT_COMPLETE (7)
      1707255557.691037 kernel: snd_sof_amd_vangogh 0000:04:00.5: invalid header size 0xdb43fe7. FW oops is bogus
      1707255557.694824 kernel: snd_sof_amd_vangogh 0000:04:00.5: unexpected fault 0x6942d3b3 trace 0x6942d3b3
      1707255557.695392 kernel: snd_sof_amd_vangogh 0000:04:00.5: ------------[ DSP dump end ]------------
      1707255557.695755 kernel: snd_sof_amd_vangogh 0000:04:00.5: Failed to setup widget PIPELINE.6.ACPHS1.IN
      1707255557.696069 kernel: snd_sof_amd_vangogh 0000:04:00.5: error: tplg component load failed -110
      1707255557.696374 kernel: snd_sof_amd_vangogh 0000:04:00.5: error: failed to load DSP topology -22
      1707255557.697904 kernel: snd_sof_amd_vangogh 0000:04:00.5: ASoC: error at snd_soc_component_probe on 0000:04:00.5: -22
      1707255557.698405 kernel: sof_mach nau8821-max: ASoC: failed to instantiate card -22
      1707255557.701061 kernel: sof_mach nau8821-max: error -EINVAL: Failed to register card(sof-nau8821-max)
      1707255557.701624 kernel: sof_mach: probe of nau8821-max failed with error -22
      
      Introduce a new member skip_iram_dram_size_mod to struct acp_quirk_entry and
      use it to skip IRAM/DRAM size modification for Vangogh Galileo device.
      
      Fixes: 55d7bbe4 ("ASoC: SOF: amd: Add acp-psp mailbox interface for iram-dram fence register modification")
      Signed-off-by: default avatarCristian Ciocaltea <cristian.ciocaltea@collabora.com>
      Link: https://msgid.link/r/20240220201623.438944-3-cristian.ciocaltea@collabora.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      094d1176
    • Cristian Ciocaltea's avatar
      ASoC: SOF: amd: Move signed_fw_image to struct acp_quirk_entry · 33c3d813
      Cristian Ciocaltea authored
      The signed_fw_image member of struct sof_amd_acp_desc is used to enable
      signed firmware support in the driver via the acp_sof_quirk_table.
      
      In preparation to support additional use cases of the quirk table (i.e.
      adding new flags), move signed_fw_image to a new struct acp_quirk_entry
      and update all references to it accordingly.
      
      No functional changes intended.
      Signed-off-by: default avatarCristian Ciocaltea <cristian.ciocaltea@collabora.com>
      Link: https://msgid.link/r/20240220201623.438944-2-cristian.ciocaltea@collabora.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      33c3d813
    • Takashi Iwai's avatar
      ALSA: timer: Fix missing irq-disable at closing · 587d67fd
      Takashi Iwai authored
      The conversion to guard macro dropped the irq-disablement at closing
      mistakenly, which may lead to a race.  Fix it.
      
      Fixes: beb45974 ("ALSA: timer: Use guard() for locking")
      Reported-by: syzbot+28c1a5a5b041a754b947@syzkaller.appspotmail.com
      Closes: http://lore.kernel.org/r/0000000000000b9a510613b0145f@google.com
      Message-ID: <20240315101447.18395-1-tiwai@suse.de>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      587d67fd
    • Jichi Zhang's avatar
      ALSA: hda/realtek: Add quirk for Lenovo Yoga 9 14IMH9 · 9b714a59
      Jichi Zhang authored
      The speakers on the Lenovo Yoga 9 14IMH9 are similar to previous generations
      such as the 14IAP7, and the bass speakers can be fixed using similar methods
      with one caveat: 14IMH9 uses CS35L41 amplifiers which need to be activated
      separately.
      Signed-off-by: default avatarJichi Zhang <i@jichi.ca>
      Message-ID: <20240315081954.45470-3-i@jichi.ca>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9b714a59
  11. 14 Mar, 2024 2 commits
  12. 13 Mar, 2024 5 commits
    • Mark Brown's avatar
      Add support for the internal RK3308 audio codec · c7c12024
      Mark Brown authored
      Merge series from Luca Ceresoli <luca.ceresoli@bootlin.com>:
      
      This series adds a driver for the internal audio codec of the Rockchip
      RK3308 SoC, along with some related patches. This codec is internally
      connected to the I2S peripherals on the same chip, and it has some
      peculiarities arising from that interconnection.
      
      For proper bidirectional operation with the internal codec at any possible
      combination of sampling rates, the I2S peripheral needs two clock sources
      (tx and rx), while connection with an external codec commonly needs only
      one.
      
      Since v5.16 there is a driver for the I2S in
      sound/soc/rockchip/rockchip_i2s_tdm.c, but in some cases it does not
      configure correctly the clocks, resulting in an unnecessarily inaccurate
      rate. Patch 1 fixes this.
      
      Patches 2-4 add the codec driver along with the bindings and a new helper
      macro.
      
      Patches 5-7 add to the SoC DT file two I2S controllers (those which are
      internally connected to the internal codec) and the codec itself and enable
      the driver in the ARM64 defconfig.
      
      Luca
      Signed-off-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
      ---
      Changes in v4:
      - several cleanups in the codec probe function
      - Link to v3: https://lore.kernel.org/r/20240221-rk3308-audio-codec-v3-0-dfa34abfcef6@bootlin.com
      
      Changes in v3:
      - Add the I2S clock fix patch and remove a previous fix which is now superseded
      - Codec driver: fix silent playback until a given amplitude of sigital
        value, seen at >= 96 kHz rate
      - various other changes, listed per-patch
      - Link to v2: https://lore.kernel.org/r/20231219-rk3308-audio-codec-v2-0-c70d06021946@bootlin.com
      
      Changes in v2:
      - largely rewrote the codec driver to use DAPM and lots of improvements
        and cleanups
      - removed the RK3308 audio card and related patches
      - various other changes, listed per-patch
      - Link to v1: https://lore.kernel.org/all/20220907142124.2532620-1-luca.ceresoli@bootlin.com/
      
      ---
      Luca Ceresoli (7):
            ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates
            ASoC: dt-bindings: Add Rockchip RK3308 internal audio codec
            ASoC: core: add SOC_DOUBLE_RANGE_TLV() helper macro
            ASoC: codecs: Add RK3308 internal audio codec driver
            arm64: defconfig: enable Rockchip RK3308 internal audio codec driver
            arm64: dts: rockchip: add i2s_8ch_2 and i2s_8ch_3
            arm64: dts: rockchip: add the internal audio codec
      
       .../bindings/sound/rockchip,rk3308-codec.yaml      |  98 +++
       MAINTAINERS                                        |   7 +
       arch/arm64/boot/dts/rockchip/rk3308.dtsi           |  56 ++
       arch/arm64/configs/defconfig                       |   1 +
       include/sound/soc.h                                |  12 +
       sound/soc/codecs/Kconfig                           |  11 +
       sound/soc/codecs/Makefile                          |   2 +
       sound/soc/codecs/rk3308_codec.c                    | 974 +++++++++++++++++++++
       sound/soc/codecs/rk3308_codec.h                    | 579 ++++++++++++
       sound/soc/rockchip/rockchip_i2s_tdm.c              | 352 +-------
       10 files changed, 1746 insertions(+), 346 deletions(-)
      ---
      base-commit: dfda120c512b3edca1436f770924e91b14f93a98
      change-id: 20231219-rk3308-audio-codec-a5558ba8949d
      
      Best regards,
      --
      Luca Ceresoli <luca.ceresoli@bootlin.com>
      c7c12024
    • Mark Brown's avatar
      ASoC: Merge up release · e25293d9
      Mark Brown authored
      In order to apply additional fixes that depend on the fixes merged for
      v6.8 merge up the final release.
      e25293d9
    • Johan Carlsson's avatar
      ALSA: usb-audio: Stop parsing channels bits when all channels are found. · a39d51ff
      Johan Carlsson authored
      If a usb audio device sets more bits than the amount of channels
      it could write outside of the map array.
      Signed-off-by: default avatarJohan Carlsson <johan.carlsson@teenage.engineering>
      Fixes: 04324ccc ("ALSA: usb-audio: add channel map support")
      Message-ID: <20240313081509.9801-1-johan.carlsson@teenage.engineering>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a39d51ff
    • Pierre-Louis Bossart's avatar
      ALSA: hda/tas2781: remove unnecessary runtime_pm calls · 526d0283
      Pierre-Louis Bossart authored
      The runtime_pm handling seems to have been loosely inspired by the
      cs32l41 driver, but in this case the get_noresume/put sequence is not
      required.
      Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Message-ID: <20240312161217.79510-1-pierre-louis.bossart@linux.intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      526d0283
    • Valentine Altair's avatar
      ALSA: hda/realtek - ALC236 fix volume mute & mic mute LED on some HP models · 300ab0df
      Valentine Altair authored
      Some HP laptops have received revisions that altered their board IDs
      and therefore the current patches/quirks do not apply to them.
      Specifically, for my Probook 440 G8, I have a board ID of 8a74.
      It is necessary to add a line for that specific model.
      Signed-off-by: default avatarValentine Altair <faetalize@proton.me>
      Cc: <stable@vger.kernel.org>
      Message-ID: <kOqXRBcxkKt6m5kciSDCkGqMORZi_HB3ZVPTX5sD3W1pKxt83Pf-WiQ1V1pgKKI8pYr4oGvsujt3vk2zsCE-DDtnUADFG6NGBlS5N3U4xgA=@proton.me>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      300ab0df
  13. 12 Mar, 2024 4 commits
    • Chancel Liu's avatar
      ASoC: soc-core.c: Skip dummy codec when adding platforms · 23fb6bc2
      Chancel Liu authored
      When pcm_runtime is adding platform components it will scan all
      registered components. In case of DPCM FE/BE some DAI links will
      configure dummy platform. However both dummy codec and dummy platform
      are using "snd-soc-dummy" as component->name. Dummy codec should be
      skipped when adding platforms otherwise there'll be overflow and UBSAN
      complains.
      Reported-by: default avatarZhipeng Wang <zhipeng.wang_1@nxp.com>
      Signed-off-by: default avatarChancel Liu <chancel.liu@nxp.com>
      Link: https://msgid.link/r/20240305065606.3778642-1-chancel.liu@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      23fb6bc2
    • Luca Ceresoli's avatar
      ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates · 9e2ab4b1
      Luca Ceresoli authored
      The sample rates set by the rockchip_i2s_tdm driver in master mode are
      inaccurate up to 5% in several cases, due to the driver logic to configure
      clocks and a nasty interaction with the Common Clock Framework.
      
      To understand what happens, here is the relevant section of the clock tree
      (slightly simplified), along with the names used in the driver:
      
             vpll0 _OR_ vpll1               "mclk_root"
                clk_i2s2_8ch_tx_src         "mclk_parent"
                   clk_i2s2_8ch_tx_mux
                      clk_i2s2_8ch_tx       "mclk" or "mclk_tx"
      
      This is what happens when playing back e.g. at 192 kHz using
      audio-graph-card (when recording the same applies, only s/tx/rx/):
      
       0. at probe, rockchip_i2s_tdm_set_sysclk() stores the passed frequency in
          i2s_tdm->mclk_tx_freq (*) which is 50176000, and that is never modified
          afterwards
      
       1. when playback is started, rockchip_i2s_tdm_hw_params() is called and
          does the following two calls
      
       2. rockchip_i2s_tdm_calibrate_mclk():
      
          2a. selects mclk_root0 (vpll0) as a parent for mclk_parent
              (mclk_tx_src), which is OK because the vpll0 rate is a good for
              192000 (and sumbultiple) rates
      
          2b. sets the mclk_root frequency based on ppm calibration computations
      
          2c. sets mclk_tx_src to 49152000 (= 256 * 192000), which is also OK as
              it is a multiple of the required bit clock
      
       3. rockchip_i2s_tdm_set_mclk()
      
          3a. calls clk_set_rate() to set the rate of mclk_tx (clk_i2s2_8ch_tx)
              to the value of i2s_tdm->mclk_tx_freq (*), i.e. 50176000 which is
              not a multiple of the sampling frequency -- this is not OK
      
              3a1. clk_set_rate() reacts by reparenting clk_i2s2_8ch_tx_src to
                   vpll1 -- this is not OK because the default vpll1 rate can be
      	     divided to get 44.1 kHz and related rates, not 192 kHz
      
      The result is that the driver does a lot of ad-hoc decisions about clocks
      and ends up in using the wrong parent at an unoptimal rate.
      
      Step 0 is one part of the problem: unless the card driver calls set_sysclk
      at each stream start, whatever rate is set in mclk_tx_freq during boot will
      be taken and used until reboot. Moreover the driver does not care if its
      value is not a multiple of any audio frequency.
      
      Another part of the problem is that the whole reparenting and clock rate
      setting logic is conflicting with the CCF algorithms to achieve largely the
      same goal: selecting the best parent and setting the closest clock
      rate. And it turns out that only calling once clk_set_rate() on
      clk_i2s2_8ch_tx picks the correct vpll and sets the correct rate.
      
      The fix is based on removing the custom logic in the driver to select the
      parent and set the various clocks, and just let the Clock Framework do it
      all. As a side effect, the set_sysclk() op becomes useless because we now
      let the CCF compute the appropriate value for the sampling rate.  It also
      implies that the whole calibration logic is now dead code and so it is
      removed along with the "PCM Clock Compensation in PPM" kcontrol, which has
      always been broken anyway. The handling of the 4 optional clocks also
      becomes dead code and is removed.
      
      The actual rates have been tested playing 30 seconds of audio at various
      sampling rates before and after this change using sox:
      
          time play -r <sample_rate> -n synth 30 sine 950 gain -3
      
      The time reported in the table below is the 'real' value reported by the
      'time' command in the above command line.
      
           rate        before     after
         ---------     ------     ------
           8000 Hz     30.60s     30.63s
          11025 Hz     30.45s     30.51s
          16000 Hz     30.47s     30.50s
          22050 Hz     30.78s     30.41s
          32000 Hz     31.02s     30.43s
          44100 Hz     30.78s     30.41s
          48000 Hz     29.81s     30.45s
          88200 Hz     30.78s     30.41s
          96000 Hz     29.79s     30.42s
         176400 Hz     27.40s     30.41s
         192000 Hz     29.79s     30.42s
      
      While the tests are running the clock tree confirms that:
      
       * without the patch, vpll1 is always used and clk_i2s2_8ch_tx always
         produces 50176000 Hz, which cannot be divided for most audio rates
         except the slowest ones, generating inaccurate rates
       * with the patch:
         - for 192000 Hz vpll0 is used
         - for 176400 Hz vpll1 is used
         - clk_i2s2_8ch_tx always produces (256 * <rate>) Hz
      
      Tested on the RK3308 using the internal audio codec.
      
      Fixes: 081068fd ("ASoC: rockchip: add support for i2s-tdm controller")
      Signed-off-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
      Link: https://msgid.link/r/20240305-rk3308-audio-codec-v4-1-312acdbe628f@bootlin.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      9e2ab4b1
    • Rob Herring's avatar
      ASoC: dt-bindings: cirrus,cs42l43: Fix 'gpio-ranges' schema · 10eb0d33
      Rob Herring authored
      'gpio-ranges' is a phandle-array which is really a matrix. The schema in
      cirrus,cs42l43 is incomplete as it doesn't define there's only a single
      entry. Add the outer array constraints that there is a single entry.
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Link: https://msgid.link/r/20240311222554.1940567-1-robh@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      10eb0d33
    • Thomas Weißschuh's avatar
      ALSA: aaci: Delete unused variable in aaci_do_suspend · 5a94041d
      Thomas Weißschuh authored
      The variable aaci is not used anymore and can be deleted.
      
      Fixes: 792a6c51 ("[ALSA] Fix PM support")
      Signed-off-by: default avatarThomas Weißschuh <thomas.weissschuh@linutronix.de>
      Link: https://lore.kernel.org/r/20240312-aaci-unused-v1-1-09be643f67c2@linutronix.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5a94041d
  14. 11 Mar, 2024 5 commits