From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: "Otto Pflüger" <otto.pflueger@abscue.de>, linux-arm-msm@vger.kernel.org
Cc: Banajit Goswami <bgoswami@quicinc.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-sound@vger.kernel.org,
~postmarketos/upstreaming@lists.sr.ht
Subject: Re: [PATCH v2 2/4] ASoC: qcom: q6afe: provide fallback for digital codec clock
Date: Fri, 17 Nov 2023 13:26:43 +0000 [thread overview]
Message-ID: <d8ef8fe6-2856-40fc-a95e-5bf68c0f1a8b@linaro.org> (raw)
In-Reply-To: <20231029165716.69878-3-otto.pflueger@abscue.de>
Thanks Otto for the patch,
On 29/10/2023 16:57, Otto Pflüger wrote:
> When q6afe is used as a clock provider through q6afe-clocks.c, it uses
> an interface for setting clocks that is not present in older firmware
> versions. However, using Q6AFE_LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE
> as the codec MCLK in the device tree can be useful on older platforms
> too. Provide a fallback that sets this clock using the old method when
> an old firmware version is detected.
>
> MSM8916 did not need this because of a workaround that controls this
> clock directly through the GCC driver, but newer SoCs do not have this
> clock in their GCC drivers because it is meant to be controlled by the
> DSP.
>
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
> ---
> sound/soc/qcom/qdsp6/q6afe.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
> index 91d39f6ad0bd..f14d3b366aa4 100644
> --- a/sound/soc/qcom/qdsp6/q6afe.c
> +++ b/sound/soc/qcom/qdsp6/q6afe.c
> @@ -1111,6 +1111,32 @@ int q6afe_set_lpass_clock(struct device *dev, int clk_id, int attri,
> struct q6afe *afe = dev_get_drvdata(dev->parent);
> struct afe_clk_set cset = {0,};
>
> + /*
> + * v2 clocks specified in the device tree may not be supported by the
> + * firmware. If this is the digital codec core clock, fall back to the
> + * old method for setting it.
> + */
> + if (q6core_get_adsp_version() < Q6_ADSP_VERSION_2_7) {
> + struct q6afe_port *port;
> + struct afe_digital_clk_cfg dcfg = {0,};
> + int ret;
> +
> + if (clk_id != Q6AFE_LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE)
> + return -EINVAL;
> +
> + port = q6afe_port_get_from_id(dev, PRIMARY_MI2S_RX);
> + if (IS_ERR(port))
> + return PTR_ERR(port);
> +
> + dcfg.i2s_cfg_minor_version = AFE_API_VERSION_I2S_CONFIG;
> + dcfg.clk_val = freq;
> + dcfg.clk_root = 5;
> + ret = q6afe_set_digital_codec_core_clock(port, &dcfg);
> +
> + q6afe_port_put(port);
This redirection of clks looks totally confusing and hacky.
Why can not we do this from machine driver based something like this:
if (q6core_get_adsp_version() < Q6_ADSP_VERSION_2_7)
ret = snd_soc_dai_set_sysclk(cpu_dai, LPAIF_DIG_CLK, freq, 0);
--srini
> + return ret;
> + }
> +
> cset.clk_set_minor_version = AFE_API_VERSION_CLOCK_SET;
> cset.clk_id = clk_id;
> cset.clk_freq_in_hz = freq;
next prev parent reply other threads:[~2023-11-17 13:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-29 16:57 [PATCH v2 0/4] ASoC: qcom: check ADSP version when setting clocks Otto Pflüger
2023-10-29 16:57 ` [PATCH v2 1/4] ASoC: qcom: q6core: expose ADSP core firmware version Otto Pflüger
2023-11-17 13:26 ` Srinivas Kandagatla
2023-10-29 16:57 ` [PATCH v2 2/4] ASoC: qcom: q6afe: provide fallback for digital codec clock Otto Pflüger
2023-11-17 13:26 ` Srinivas Kandagatla [this message]
2023-12-04 10:34 ` Stephan Gerhold
2023-12-11 18:18 ` Srinivas Kandagatla
2023-10-29 16:57 ` [PATCH v2 3/4] ASoC: qcom: q6afe-dai: check ADSP version when setting sysclk Otto Pflüger
2023-11-17 13:26 ` Srinivas Kandagatla
2023-10-29 16:57 ` [PATCH v2 4/4] ASoC: qcom: q6afe: remove "port already open" error Otto Pflüger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d8ef8fe6-2856-40fc-a95e-5bf68c0f1a8b@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=bgoswami@quicinc.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=otto.pflueger@abscue.de \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox