Re: [PATCH 1/3] ASoC: ti: omap-mcbsp: Ignore errors for getting fck_src

From: Péter Ujfalusi
Date: Tue Sep 19 2023 - 14:25:50 EST




On 7/5/23 22:03, Andreas Kemnade wrote:
> Commit 349355ce3a05 ("ARM: OMAP2+: Drop legacy platform data for omap4 mcbsp")
> dropped prcm_fck for omap4,

it also dropped the pad_fck for that matter.

> so the clk_src might not be >available making the
> clk_get(src) fail.

Wow, so OMAP4 audio is pretty broken if would ever need to select FCLK?
By default we don't on OMAP4, but this is astonishing.

> In such cases, rely on the devicetree to assign
> the correct parent.

You cannot rely on DT to dynamically select the FCLK parent for
different use cases.
The dai_set_dai_sysclk() cannot select between internal or external
source of the reference clock and DT cannot handle this.
If one sampling frequency is available with pad_fck while other is only
possible with internal clock then this is no longer possible.

> Signed-off-by: Andreas Kemnade <andreas@xxxxxxxxxxxx>
> ---
> sound/soc/ti/omap-mcbsp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c
> index 21fa7b9787997..f9fe96b61852b 100644
> --- a/sound/soc/ti/omap-mcbsp.c
> +++ b/sound/soc/ti/omap-mcbsp.c
> @@ -70,8 +70,8 @@ static int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id)
>
> fck_src = clk_get(mcbsp->dev, src);
> if (IS_ERR(fck_src)) {
> - dev_err(mcbsp->dev, "CLKS: could not clk_get() %s\n", src);
> - return -EINVAL;
> + dev_info(mcbsp->dev, "CLKS: could not clk_get() %s\n", src);
> + return 0;

I would rather have some clock alias for OMAP4/5 to provide the clocks
that we need for the fclk.
If we did not got the clock we needed to select we cannot say that all
is good, carry on.
Normally the machine driver does this and it thinks that we switched
clocks while we did not and the clocking is all wrong now.

> }
>
> pm_runtime_put_sync(mcbsp->dev);

--
Péter