1. 17 May, 2023 1 commit
  2. 16 May, 2023 2 commits
  3. 15 May, 2023 20 commits
    • Mark Brown's avatar
      ASoC: SOF: Intel: hda-mlink: fixes and extensions · 9be0b3a0
      Mark Brown authored
      Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:
      
      With additional testing with multiple links and multiple DAI types, we
      found a couple of mistakes with refcounts, base address, missing
      initialization.
      
      A new helper was also added due to a change in the SoundWire
      programming sequences, with the host driver in charge of setting up
      the DMA channel mapping instead of the firmware.
      9be0b3a0
    • Ranjani Sridharan's avatar
      ASoC: SOF: topology: Fix tuples array allocation · 1c0d023c
      Ranjani Sridharan authored
      The memory allocated for the tuples array assumes that there's 1
      instance of all tokens already. So for those tokens that have multiple
      instances in topology, we need to exclude the initial instance that has
      already been accounted for.
      
      Fixes: 4fdef47a ("ASoC: SOF: ipc4-topology: Add new tokens for input/output pin format count")
      Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
      Link: https://lore.kernel.org/r/20230515085200.17094-1-peter.ujfalusi@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      1c0d023c
    • Ranjani Sridharan's avatar
      ASoC: SOF: Separate the tokens for input and output pin index · be3c2153
      Ranjani Sridharan authored
      Using the same token ID for both input and output format pin index
      results in collisions and incorrect pin index getting parsed from
      topology.
      
      Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
      Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com
      Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
      Link: https://lore.kernel.org/r/20230515104403.32207-1-peter.ujfalusi@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      be3c2153
    • Mark Brown's avatar
      ASoC: SOF: Various runtime pm fixes, improvements · aa70f36f
      Mark Brown authored
      Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:
      
      Three patch to correct error path PM runtime handling in few places.
      
      Regards,
      Peter
      ---
      Pierre-Louis Bossart (3):
        ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions
        ASoC: SOF: pcm: fix pm_runtime imbalance in error handling
        ASoC: SOF: sof-client-probes: fix pm_runtime imbalance in error
          handling
      
       sound/soc/sof/debug.c             |  4 ++--
       sound/soc/sof/pcm.c               | 11 ++++++-----
       sound/soc/sof/sof-client-probes.c | 14 ++++++++------
       3 files changed, 16 insertions(+), 13 deletions(-)
      
      --
      2.40.1
      aa70f36f
    • Lucas Tanure's avatar
      MAINTAINERS: Remove self from Cirrus Codec drivers · dc60b67d
      Lucas Tanure authored
      I'm leaving Cirrus Logic, and will no longer have access to
      hardware and documentation necessary to be effective in a
      maintainership role.
      
      Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com
      Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com
      Link: https://lore.kernel.org/r/20230512154503.741718-1-rf@opensource.cirrus.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      dc60b67d
    • Simon Trimmer's avatar
      ASoC: cs35l56: Prevent unbalanced pm_runtime in dsp_work() on SoundWire · 17082e09
      Simon Trimmer authored
      Flush the SoundWire interrupt handler work instead of cancelling it.
      
      When a SoundWire interrupt is triggered the pm_runtime is held
      until the work has completed. It's therefore unsafe to cancel
      the work, it must be flushed.
      
      Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com
      Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com
      Link: https://lore.kernel.org/r/20230512144237.739000-1-rf@opensource.cirrus.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      17082e09
    • Ranjani Sridharan's avatar
      ASoC: SOF: topology: Fix logic for copying tuples · 41c5305c
      Ranjani Sridharan authored
      Topology could have more instances of the tokens being searched for than
      the number of sets that need to be copied. Stop copying token after the
      limit of number of token instances has been reached. This worked before
      only by chance as we had allocated more size for the tuples array than
      the number of actual tokens being parsed.
      
      Fixes: 7006d20e ("ASoC: SOF: Introduce IPC3 ops")
      Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
      Link: https://lore.kernel.org/r/20230512114630.24439-1-peter.ujfalusi@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      41c5305c
    • Kai Vehmanen's avatar
      ASoC: SOF: pm: save io region state in case of errors in resume · 171b53be
      Kai Vehmanen authored
      If there are failures in DSP runtime resume, the device state will not
      reach active and this makes it impossible e.g. to retrieve a possible
      DSP panic dump via "exception" debugfs node. If
      CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE=y is set, the data in
      cache is stale. If debugfs cache is not used, the region simply cannot
      be read.
      
      To allow debugging these scenarios, update the debugfs cache contents in
      resume error handler. User-space can then later retrieve DSP panic and
      other state via debugfs (requires SOF debugfs cache to be enabled in
      build).
      
      Reported-by: Curtis Malainey <cujomalainey@chromium.org
      Link: https://github.com/thesofproject/linux/issues/4274
      Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com
      Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Reviewed-by: Curtis Malainey <cujomalainey@chromium.org
      Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
      Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
      Link: https://lore.kernel.org/r/20230512104638.21376-1-peter.ujfalusi@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      171b53be
    • Krzysztof Kozlowski's avatar
      ASoC: MAINTAINERS: drop Krzysztof Kozlowski from Samsung audio · 647b5f5f
      Krzysztof Kozlowski authored
      Remove Krzysztof Kozlowski from maintainer of Samsung SoC Audio drivers
      and change the status to maintenance (no one is reality being paid for
      looking at this).
      
      Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
      Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com
      Link: https://lore.kernel.org/r/20230513090228.4340-1-krzysztof.kozlowski@linaro.org
      Signed-off-by: Mark Brown <broonie@kernel.org
      647b5f5f
    • Douglas Anderson's avatar
      ASoC: mediatek: mt8186: Fix use-after-free in driver remove path · a93d2afd
      Douglas Anderson authored
      When devm runs function in the "remove" path for a device it runs them
      in the reverse order. That means that if you have parts of your driver
      that aren't using devm or are using "roll your own" devm w/
      devm_add_action_or_reset() you need to keep that in mind.
      
      The mt8186 audio driver didn't quite get this right. Specifically, in
      mt8186_init_clock() it called mt8186_audsys_clk_register() and then
      went on to call a bunch of other devm function. The caller of
      mt8186_init_clock() used devm_add_action_or_reset() to call
      mt8186_deinit_clock() but, because of the intervening devm functions,
      the order was wrong.
      
      Specifically at probe time, the order was:
      1. mt8186_audsys_clk_register()
      2. afe_priv->clk = devm_kcalloc(...)
      3. afe_priv->clk[i] = devm_clk_get(...)
      
      At remove time, the order (which should have been 3, 2, 1) was:
      1. mt8186_audsys_clk_unregister()
      3. Free all of afe_priv->clk[i]
      2. Free afe_priv->clk
      
      The above seemed to be causing a use-after-free. Luckily, it's easy to
      fix this by simply using devm more correctly. Let's move the
      devm_add_action_or_reset() to the right place. In addition to fixing
      the use-after-free, code inspection shows that this fixes a leak
      (missing call to mt8186_audsys_clk_unregister()) that would have
      happened if any of the syscon_regmap_lookup_by_phandle() calls in
      mt8186_init_clock() had failed.
      
      Fixes: 55b423d5 ("ASoC: mediatek: mt8186: support audio clock control in platform driver")
      Signed-off-by: Douglas Anderson <dianders@chromium.org
      Link: https://lore.kernel.org/r/20230511092437.1.I31cceffc8c45bb1af16eb613e197b3df92cdc19e@changeid
      Signed-off-by: Mark Brown <broonie@kernel.org
      a93d2afd
    • Peter Ujfalusi's avatar
      ASoC: SOF: ipc3-topology: Make sure that only one cmd is sent in dai_config · 4708449e
      Peter Ujfalusi authored
      The commands in sof_ipc_dai_config.flags are encoded as bits:
      1 (bit0) - hw_params
      2 (bit1) - hw_free
      4 (bit2) - pause
      
      These are commands, they cannot be combined as one would assume, for
      example
      3 (bit0 | bit1) is invalid.
      
      This can happen right at the second start of a stream as at the end of the
      first stream we set the hw_free command (bit1) and on the second start we
      would OR on top of it the hw_params (bit0).
      
      Fixes: b66bfc3a ("ASoC: SOF: sof-audio: Fix broken early bclk feature for SSP")
      Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
      Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Link: https://lore.kernel.org/r/20230512110317.5180-1-peter.ujfalusi@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      4708449e
    • Pierre-Louis Bossart's avatar
      ASoC: SOF: sof-client-probes: fix pm_runtime imbalance in error handling · bc424273
      Pierre-Louis Bossart authored
      When an error occurs, we need to make sure the device can pm_runtime
      suspend instead of keeping it active.
      
      Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
      Link: https://lore.kernel.org/r/20230512103315.8921-4-peter.ujfalusi@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      bc424273
    • Pierre-Louis Bossart's avatar
      ASoC: SOF: pcm: fix pm_runtime imbalance in error handling · da0fe8fd
      Pierre-Louis Bossart authored
      When an error occurs, we need to make sure the device can pm_runtime
      suspend instead of keeping it active.
      
      Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
      Link: https://lore.kernel.org/r/20230512103315.8921-3-peter.ujfalusi@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      da0fe8fd
    • Pierre-Louis Bossart's avatar
      ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions · 3de97586
      Pierre-Louis Bossart authored
      When a firmware IPC error happens during a pm_runtime suspend, we
      ignore the error and suspend anyways. However, the code
      unconditionally increases the runtime_pm counter. This results in a
      confusing configuration where the code will suspend, resume but never
      suspend again due to the use of pm_runtime_get_noresume().
      
      The intent of the counter increase was to prevent entry in D3, but if
      that transition to D3 is already started it cannot be stopped. In
      addition, there's no point in that case in trying to prevent anything,
      the firmware error is handled and the next resume will re-initialize
      the firmware completely.
      
      This patch changes the logic to prevent suspend when the device is
      pm_runtime active and has a use_count > 0.
      
      Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
      Link: https://lore.kernel.org/r/20230512103315.8921-2-peter.ujfalusi@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      3de97586
    • Pierre-Louis Bossart's avatar
      ASoC: SOF: Intel: hda-mlink: add helper to program SoundWire PCMSyCM registers · ccc2f0c1
      Pierre-Louis Bossart authored
      These registers enable the HDaudio DMA hardware to split/merge data
      from different PDIs, possibly on different links.
      
      This capability exists for all types of HDaudio extended links, but
      for now is only required for SoundWire. In the SSP/DMIC case, the IP
      is programmed by the DSP firmware.
      
      Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Reviewed-by: Rander Wang <rander.wang@intel.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Link: https://lore.kernel.org/r/20230512174611.84372-7-pierre-louis.bossart@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      ccc2f0c1
    • Pierre-Louis Bossart's avatar
      ASoC: SOF: Intel: hda-mlink: initialize instance_offset member · 9643456e
      Pierre-Louis Bossart authored
      We defined the values but never initialized it for SoundWire/SSP, fix
      this miss.
      
      A Fixes: tag is not provided as instance_offset was not used so far,
      so nothing was really broken. This patch is only required for the
      SoundWire support in the following patch.
      
      Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Reviewed-by: Rander Wang <rander.wang@intel.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Link: https://lore.kernel.org/r/20230512174611.84372-6-pierre-louis.bossart@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      9643456e
    • Pierre-Louis Bossart's avatar
      ASoC: SOF: Intel: hda-mlink: use 'ml_addr' parameter consistently · 7dfd1ccd
      Pierre-Louis Bossart authored
      We mix the use of hlink->ml_addr and the 'ml_addr' parameter. It's the
      same thing, let's align on using the parameter.
      
      Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Reviewed-by: Rander Wang <rander.wang@intel.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Link: https://lore.kernel.org/r/20230512174611.84372-5-pierre-louis.bossart@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      7dfd1ccd
    • Pierre-Louis Bossart's avatar
      ASoC: SOF: Intel: hda-mlink: fix base_ptr computation · af8c32b1
      Pierre-Louis Bossart authored
      The base_ptr value needs to be derived from the remap_addr pointer,
      not the ml_addr. This base_ptr was used only in debug logs that were
      so far not contributed upstream so the issue was not detected. It
      needs to be fixed for SoundWire support on LunarLake.
      
      Fixes: 17c9b6ec ("ASoC: SOF: Intel: hda-mlink: add structures to parse ALT links")
      Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Reviewed-by: Rander Wang <rander.wang@intel.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Link: https://lore.kernel.org/r/20230512174611.84372-4-pierre-louis.bossart@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      af8c32b1
    • Pierre-Louis Bossart's avatar
      ASoC: SOF: Intel: hda-mlink: add helper to get SoundWire hlink · dcb88fc4
      Pierre-Louis Bossart authored
      Same functionality as for DMIC/SSP with different ID.
      
      Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Rander Wang <rander.wang@intel.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Link: https://lore.kernel.org/r/20230512174611.84372-3-pierre-louis.bossart@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      dcb88fc4
    • Pierre-Louis Bossart's avatar
      ASoC: SOF: Intel: hda-mlink: fix sublink refcounting · 7430dea4
      Pierre-Louis Bossart authored
      In hindsight it was a very bad idea to use the same refcount for
      Extended and 'legacy' HDaudio multi-links. The existing solution only
      powers-up the first sublink, which causes SoundWire and SSP tests to
      fail when more than one DAI is used concurrently. Solving this problem
      requires per-sublink refcounting, as suggested in this patch.
      
      The existing refcounting remains for 'legacy' HdAudio links, mainly to
      avoid changing the obscure programming sequence in
      snd_hdac_ext_bus_link_put().
      
      Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
      Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
      Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
      Link: https://lore.kernel.org/r/20230512174611.84372-2-pierre-louis.bossart@linux.intel.com
      Signed-off-by: Mark Brown <broonie@kernel.org
      7430dea4
  4. 12 May, 2023 5 commits
  5. 11 May, 2023 4 commits
  6. 09 May, 2023 1 commit
  7. 08 May, 2023 6 commits
  8. 07 May, 2023 1 commit