mbox series

[v2,0/4] ASoC: qcom: check ADSP version when setting clocks

Message ID 20231029165716.69878-1-otto.pflueger@abscue.de (mailing list archive)
Headers show
Series ASoC: qcom: check ADSP version when setting clocks | expand

Message

Otto Pflüger Oct. 29, 2023, 4:57 p.m. UTC
The apq8016_sbc driver currently works on APQ8016 and MSM8916 devices. It
should also work on MSM8909 (and newer SoCs like MSM8917 and MSM8953 if
the quinary MI2S line is added); however, newer devices with these SoCs
ship with newer firmware that uses a different interface for controlling
the digital codec and bit clocks, which causes the driver to fail because
it cannot set LPAIF_BIT_CLK.

In order to fix this problem, modify the LPAIF_* clock implementation in
the qdsp6 driver to use the newer clock API if a newer firmware version is
detected. This seems to be a better solution than exposing the firmware
version to other drivers like apq8016_sbc and forcing them to figure out
which clock to use.

On MSM8916, a hack is currently used to control the LPAIF_DIG_CLK directly
through the GCC driver, but on devices with the newer firmware, the
INTERNAL_DIGITAL_CODEC_CORE clock provided by q6afe-clocks in the qdsp6
driver can be used instead. Add a fallback to make this clock work with
the older firmware too, allowing one to specify it as the codec's "mclk"
in the device tree:

  compatible = "qcom,msm8916-wcd-digital-codec";
  clocks = <&xo_board>,
           <&q6afecc LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE
                     LPASS_CLK_ATTRIBUTE_COUPLE_NO>;
  clock-names = "ahbix", "mclk";
  assigned-clocks = <&q6afecc LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE
                              LPASS_CLK_ATTRIBUTE_COUPLE_NO>;
  assigned-clock-rates = <9600000>;

This works both on MSM8916 and on the newer SoCs mentioned above.

---
Changes in v2:
- Log unknown AVS versions
- Move some checks to q6afe-dai as suggested by Srinivas
- Also implement LPAIF_OSR_CLK for ports that have it

Otto Pflüger (4):
  ASoC: qcom: q6core: expose ADSP core firmware version
  ASoC: qcom: q6afe: provide fallback for digital codec clock
  ASoC: qcom: q6afe-dai: check ADSP version when setting sysclk
  ASoC: qcom: q6afe: remove "port already open" error

 sound/soc/qcom/qdsp6/q6afe-dai.c | 98 +++++++++++++++++++++++++++-----
 sound/soc/qcom/qdsp6/q6afe.c     | 30 +++++++++-
 sound/soc/qcom/qdsp6/q6core.c    | 65 +++++++++++++++++++++
 sound/soc/qcom/qdsp6/q6core.h    |  9 +++
 4 files changed, 185 insertions(+), 17 deletions(-)


base-commit: 66f1e1ea3548378ff6387b1ce0b40955d54e86aa