[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241118133150.GA2001051@gnbcxd0016.gnb.st.com>
Date: Mon, 18 Nov 2024 14:31:50 +0100
From: Alain Volmat <alain.volmat@...s.st.com>
To: Philipp Zabel <p.zabel@...gutronix.de>
CC: Hugues Fruchet <hugues.fruchet@...s.st.com>,
Mauro Carvalho Chehab
<mchehab@...nel.org>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre
Torgue <alexandre.torgue@...s.st.com>,
Hans Verkuil
<hverkuil-cisco@...all.nl>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Rob
Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor
Dooley <conor+dt@...nel.org>, <linux-media@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<devicetree@...r.kernel.org>
Subject: Re: [PATCH v2 03/15] media: stm32: csi: addition of the STM32 CSI
driver
Hi Philipp
On Tue, Nov 05, 2024 at 11:14:47AM +0100, Philipp Zabel wrote:
> On Di, 2024-11-05 at 08:49 +0100, Alain Volmat wrote:
> > The STM32 CSI controller is tightly coupled with the DCMIPP and act as an
> > input stage to receive data coming from the sensor and transferring
> > them into the DCMIPP.
> >
> > Signed-off-by: Alain Volmat <alain.volmat@...s.st.com>
> >
> > ---
> > v2: correct data-lanes handling, using values 1 & 2
> > update yaml filename in MAINTAINERS
> > ---
> > MAINTAINERS | 8 +
> > drivers/media/platform/st/stm32/Kconfig | 14 +
> > drivers/media/platform/st/stm32/Makefile | 1 +
> > drivers/media/platform/st/stm32/stm32-csi.c | 1144 +++++++++++++++++++++++++++
> > 4 files changed, 1167 insertions(+)
> >
> [...]
> > diff --git a/drivers/media/platform/st/stm32/stm32-csi.c b/drivers/media/platform/st/stm32/stm32-csi.c
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..c7f47472c6b3699e94113ce0f38b280a2e45ce15
> > --- /dev/null
> > +++ b/drivers/media/platform/st/stm32/stm32-csi.c
> > @@ -0,0 +1,1144 @@
> [...]
> > +static int stm32_csi_get_resources(struct stm32_csi_dev *csidev,
> > + struct platform_device *pdev)
> > +{
> > + int irq, ret;
> > +
> > + csidev->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
> > + if (IS_ERR(csidev->base))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(csidev->base),
> > + "Failed to ioremap resource\n");
> > +
> > + csidev->pclk = devm_clk_get(&pdev->dev, "pclk");
> > + if (IS_ERR(csidev->pclk))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(csidev->pclk),
> > + "Couldn't get pclk\n");
> > +
> > + csidev->txesc = devm_clk_get(&pdev->dev, "txesc");
> > + if (IS_ERR(csidev->txesc))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(csidev->txesc),
> > + "Couldn't get txesc\n");
> > +
> > + csidev->csi2phy = devm_clk_get(&pdev->dev, "csi2phy");
> > + if (IS_ERR(csidev->csi2phy))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(csidev->csi2phy),
> > + "Couldn't get csi2phy\n");
>
> Consider using devm_clk_bulk_get().
Ok, I change this in the v3.
>
> > + csidev->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
> > + if (IS_ERR(csidev->rstc))
> > + return dev_err_probe(&pdev->dev, PTR_ERR(csidev->rstc),
> > + "Couldn't get reset control\n");
>
> If this wasn't in a separate function, rstc wouldn't have to be stored
> on csidev as it's only ever used in stm32_csi_probe().
Ok, whole reset handling moved into the probe function.
>
> > +
> > + csidev->supplies[0].supply = "vdd";
> > + csidev->supplies[1].supply = "vdda18";
> > + ret = devm_regulator_bulk_get(&pdev->dev, ARRAY_SIZE(csidev->supplies),
> > + csidev->supplies);
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "Failed to request regulator vdd\n");
> > +
> > + irq = platform_get_irq(pdev, 0);
> > + if (irq < 0)
> > + return irq;
> > +
> > + ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
> > + stm32_csi_irq_thread, IRQF_ONESHOT,
> > + dev_name(&pdev->dev), csidev);
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "Unable to request irq");
> > +
> > + return 0;
> > +}
>
> regards
> Philipp
Regards
Alain
Powered by blists - more mailing lists