1. 15 Apr, 2024 1 commit
  2. 11 Apr, 2024 1 commit
  3. 09 Apr, 2024 15 commits
  4. 08 Apr, 2024 7 commits
    • Richard Fitzgerald's avatar
      ASoC: cs35l56: Prevent overwriting firmware ASP config · dfd2ffb3
      Richard Fitzgerald authored
      Only populate the ASP1 config registers in the regmap cache if the
      ASP DAI is used. This prevents regcache_sync() from overwriting
      these registers with their defaults when the firmware owns
      control of these registers.
      
      On a SoundWire system the ASP could be owned by the firmware to
      share reference audio with the firmware on other cs35l56. Or it
      can be used as a normal codec-codec interface owned by the driver.
      The driver must not overwrite the registers if the firmware has
      control of them.
      
      The original implementation for this in commit 07f7d6e7
      ("ASoC: cs35l56: Fix for initializing ASP1 mixer registers") was
      to still provide defaults for these registers, assuming that if
      they were never reconfigured from defaults then regcache_sync()
      would not write them out because they are not dirty. Unfortunately
      regcache_sync() is not that smart. If the chip has not reset (so
      the driver has not called regcache_mark_dirty()) a regcache_sync()
      could write out registers that are not dirty.
      
      To avoid accidental overwriting of the ASP registers, they are
      removed from the table of defaults and instead are populated with
      defaults only if one of the ASP DAI configuration functions is
      called. So if the DAI has never been configured, the firmware is
      assumed to have ownership of these registers, and the regmap cache
      will not contain any entries for them.
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Fixes: 07f7d6e7 ("ASoC: cs35l56: Fix for initializing ASP1 mixer registers")
      Link: https://msgid.link/r/20240408101803.43183-5-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      dfd2ffb3
    • Richard Fitzgerald's avatar
      ASoC: cs35l56: Fix unintended bus access while resetting amp · d4884fd4
      Richard Fitzgerald authored
      Use the new regmap_read_bypassed() so that the regmap can be left
      in cache-only mode while it is booting, but the driver can still
      read boot-status and chip-id information during this time.
      
      This fixes race conditions where some writes could be issued to the
      silicon while it is still rebooting, before the driver has determined
      that the boot is complete.
      
      This is typically prevented by putting regmap into cache-only until the
      hardware is ready. But this assumes that the driver does not need to
      access device registers to determine when it is "ready". For cs35l56
      this involves polling a register and the original implementation relied
      on having special handlers to block racing callbacks until dsp_work()
      is complete. However, some cases were missed, most notably the ASP DAI
      functions.
      
      The regmap_read_bypassed() function allows the fix for this to be
      simplified to putting regmap into cache-only during the reset. The
      initial boot stages (poll HALO_STATE and read the chip ID) are all done
      bypassed. Only when the amp is seen to be booted is the cache-only
      revoked.
      
      Changes are:
      - cs35l56_system_reset() now leaves the regmap in cache-only status.
      
      - cs35l56_wait_for_firmware_boot() polls using regmap_read_bypassed().
      
      - cs35l56_init() revokes cache-only either via cs35l56_hw_init() or
        when firmware has rebooted after a soft reset.
      
      - cs35l56_hw_init() exits cache-only after it has determined that the
        amp has booted.
      
      - cs35l56_sdw_init() doesn't disable cache-only, since this must be
        deferred to cs35l56_init().
      
      - cs35l56_runtime_resume_common() waits for firmware boot before exiting
        cache-only.
      
      These changes cover three situations where the registers are not
      accessible:
      
      1) SoundWire first-time enumeration. The regmap is kept in cache-only
         until the chip is fully booted. The original code had to exit
         cache-only to read chip status in cs35l56_init() and cs35l56_hw_init()
         but this is now deferred to after the firmware has rebooted.
      
         In this case cs35l56_sdw_probe() leaves regmap in cache-only
         (unchanged behaviour) and cs35l56_hw_init() exits cache-only after the
         firmware is booted and the chip identified.
      
      2) Soft reset during first-time initialization. cs35l56_init() calls
         cs35l56_system_reset(), which puts regmap into cache-only.
         On I2C/SPI cs35l56_init() then flows through to call
         cs35l56_wait_for_firmware_boot() and exit cache-only. On SoundWire
         the re-enumeration will enter cs35l56_init() again, which then drops
         down to call cs35l56_wait_for_firmware_boot() and exit cache-only.
      
      3) Soft reset after firmware download. dsp_work() calls
         cs35l56_system_reset(), which puts regmap into cache-only. After this
         the flow is the same as (2).
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Fixes: 8a731fd3 ("ASoC: cs35l56: Move utility functions to shared file")
      Link: https://msgid.link/r/20240408101803.43183-4-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      d4884fd4
    • Richard Fitzgerald's avatar
      ALSA: hda: cs35l56: Exit cache-only after cs35l56_wait_for_firmware_boot() · 73580ec6
      Richard Fitzgerald authored
      Adds calls to disable regmap cache-only after a successful return from
      cs35l56_wait_for_firmware_boot().
      
      This is to prepare for a change in the shared ASoC module that will
      leave regmap in cache-only mode after cs35l56_system_reset(). This is
      to prevent register accesses going to the hardware while it is
      rebooting.
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Link: https://msgid.link/r/20240408101803.43183-3-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      73580ec6
    • Richard Fitzgerald's avatar
      regmap: Add regmap_read_bypassed() · 70ee853e
      Richard Fitzgerald authored
      Add a regmap_read_bypassed() to allow reads from the hardware registers
      while the regmap is in cache-only mode.
      
      A typical use for this is to keep the cache in cache-only mode until
      the hardware has reached a valid state, but one or more status registers
      must be polled to determine when this state is reached.
      
      For example, firmware download on the cs35l56 can take several seconds if
      there are multiple amps sharing limited bus bandwidth. This is too long
      to block in probe() so it is done as a background task. The device must
      be soft-reset to reboot the firmware and during this time the registers are
      not accessible, so the cache should be in cache-only. But the driver must
      poll a register to detect when reboot has completed.
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Fixes: 8a731fd3 ("ASoC: cs35l56: Move utility functions to shared file")
      Link: https://msgid.link/r/20240408101803.43183-2-rf@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      70ee853e
    • Hans de Goede's avatar
      ASoC: Intel: bytcr_rt5640: Apply Asus T100TA quirk to Asus T100TAM too · e50729d7
      Hans de Goede authored
      The Asus T100TA quirk has been using an exact match on a product-name of
      "T100TA" but there are also T100TAM variants with a slightly higher
      clocked CPU and a metal backside which need the same quirk.
      
      Sort the existing T100TA (stereo speakers) below the more specific
      T100TAF (mono speaker) quirk and switch from exact matching to
      substring matching so that the T100TA quirk will also match on
      the T100TAM models.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://msgid.link/r/20240407191559.21596-1-hdegoede@redhat.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      e50729d7
    • Sameer Pujar's avatar
      ASoC: tegra: Fix DSPK 16-bit playback · 2e93a29b
      Sameer Pujar authored
      DSPK configuration is wrong for 16-bit playback and this happens because
      the client config is always fixed at 24-bit in hw_params(). Fix this by
      updating the client config to 16-bit for the respective playback.
      
      Fixes: 327ef647 ("ASoC: tegra: Add Tegra186 based DSPK driver")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSameer Pujar <spujar@nvidia.com>
      Acked-by: default avatarThierry Reding <treding@nvidia.com>
      Link: https://msgid.link/r/20240405104306.551036-1-spujar@nvidia.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      2e93a29b
    • Cezary Rojewski's avatar
      ASoC: Intel: avs: Fix debug window description · 7a1625c1
      Cezary Rojewski authored
      Recent changes addressed PAGE_SIZE ambiguity in 2/3 locations for struct
      avs_icl_memwnd2. The unaddressed one causes build errors when
      PAGE_SIZE != SZ_4K.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202404070100.i3t3Jf7d-lkp@intel.com/
      Fixes: 275b583d ("ASoC: Intel: avs: ICL-based platforms support")
      Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
      Link: https://msgid.link/r/20240408081840.1319431-1-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      7a1625c1
  5. 07 Apr, 2024 4 commits
  6. 06 Apr, 2024 12 commits