Re: [PATCH v8 3/5] media: stm32-dcmipp: STM32 DCMIPP camera interface driver
From: Philipp Zabel
Date: Mon Nov 27 2023 - 06:39:12 EST
On Mi, 2023-11-22 at 08:39 +0100, Alain Volmat wrote:
> From: Hugues Fruchet <hugues.fruchet@xxxxxxxxxxx>
>
> This V4L2 subdev driver enables Digital Camera Memory Interface
> Pixel Processor(DCMIPP) of STMicroelectronics STM32 SoC series.
>
> Signed-off-by: Hugues Fruchet <hugues.fruchet@xxxxxxxxxxx>
> Signed-off-by: Alain Volmat <alain.volmat@xxxxxxxxxxx>
> ---
[...]
> diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
> new file mode 100644
> index 000000000000..28ddb26314c3
> --- /dev/null
> +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-core.c
> @@ -0,0 +1,604 @@
[...]
> +struct dcmipp_device {
> + /* The platform device */
> + struct platform_device pdev;
> + struct device *dev;
> +
> + /* Hardware resources */
> + struct reset_control *rstc;
As long as rstc is only used in dcmipp_probe(), there is no need to
carry it around in struct dcmipp_device.
[...]
> +static int dcmipp_probe(struct platform_device *pdev)
> +{
> + struct dcmipp_device *dcmipp;
> + struct clk *kclk;
rstc could be a local variable here.
[...]
> + /* Get hardware resources from devicetree */
> + dcmipp->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> + if (IS_ERR(dcmipp->rstc))
> + return dev_err_probe(&pdev->dev, PTR_ERR(dcmipp->rstc),
> + "Could not get reset control\n");
[...]
> + /* Reset device */
> + ret = reset_control_assert(dcmipp->rstc);
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to assert the reset line\n");
> + return ret;
> + }
> +
> + usleep_range(3000, 5000);
> +
> + ret = reset_control_deassert(dcmipp->rstc);
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to deassert the reset line\n");
> + return ret;
> + }
regards
Philipp