Re: [PATCH 1/2] ASoC: SOF: imx: Add i.MX8ULP HW support

From: Mark Brown
Date: Tue Jul 19 2022 - 07:41:59 EST


On Tue, Jul 19, 2022 at 01:26:06PM +0800, Shengjiu Wang wrote:

Not a thorough review, just a few nitpicks:

> +#define MBOX_SIZE 0x1000
> +
> +struct arm_smccc_res smc_resource;

This should be static shouldn't it?

> +static void imx8ulp_dsp_handle_reply(struct imx_dsp_ipc *ipc)
> +{
> + struct imx8ulp_priv *priv = imx_dsp_get_data(ipc);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&priv->sdev->ipc_lock, flags);
> +
> + imx8ulp_get_reply(priv->sdev);
> + snd_sof_ipc_reply(priv->sdev, 0);
> + spin_unlock_irqrestore(&priv->sdev->ipc_lock, flags);

Minor nitpick but a blank line before the unlock to match the one after
the lock would be a bit easier to read.

> + regmap_update_bits(priv->regmap, SYSCTRL0, EXECUTE_BIT, EXECUTE_BIT);
> + usleep_range(1, 2);
> +
> + arm_smccc_smc(FSL_SIP_HIFI_XRDC, 0, 0, 0, 0, 0, 0, 0, &smc_resource);

You need linux/arm-smccc.h for this (as 0day said).

> + if (ret) {
> + dev_err(&pdev->dev, "failed to init reserved memory region %d\n", ret);
> + goto exit_pdev_unregister;
> + }
> +
> + priv->clks->dsp_clks = imx8ulp_dsp_clks;
> + priv->clks->num_dsp_clks = ARRAY_SIZE(imx8ulp_dsp_clks);
> +
> + ret = imx8_parse_clocks(sdev, priv->clks);
> + if (ret < 0)
> + goto exit_pdev_unregister;
> +
> + ret = imx8_enable_clocks(sdev, priv->clks);
> + if (ret < 0)
> + goto exit_pdev_unregister;

We're registering the platform device before we enable the clocks - is
that safe?

> +static int imx8ulp_remove(struct snd_sof_dev *sdev)
> +{
> + struct imx8ulp_priv *priv = sdev->pdata->hw_pdata;
> +
> + platform_device_unregister(priv->ipc_dev);
> +
> + return 0;
> +}

Could we just use devm? I'm not seeing an ordering issue but I might be
missing something.

Attachment: signature.asc
Description: PGP signature