[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aTac1eXTlzPaE-EQ@kekkonen.localdomain>
Date: Mon, 8 Dec 2025 11:39:33 +0200
From: Sakari Ailus <sakari.ailus@...ux.intel.com>
To: Jai Luthra <jai.luthra@...asonboard.com>
Cc: Rishikesh Donadkar <r-donadkar@...com>, jai.luthra@...ux.dev,
laurent.pinchart@...asonboard.com, mripard@...nel.org,
y-abhilashchandra@...com, devarsht@...com, s-jain1@...com,
vigneshr@...com, mchehab@...nel.org, robh@...nel.org,
krzk+dt@...nel.org, p.zabel@...gutronix.de, conor+dt@...nel.org,
hverkuil-cisco@...all.nl, tomi.valkeinen@...asonboard.com,
changhuang.liang@...rfivetech.com, jack.zhu@...rfivetech.com,
sjoerd@...labora.com, dan.carpenter@...aro.org,
hverkuil+cisco@...nel.org, linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v8 17/18] media: ti: j721e-csi2rx: Support runtime suspend
Hi Jai,
On Mon, Dec 08, 2025 at 01:17:21PM +0530, Jai Luthra wrote:
> > > @@ -1579,6 +1622,10 @@ static int ti_csi2rx_probe(struct platform_device *pdev)
> > > goto err_notifier;
> > > }
> > >
> > > + pm_runtime_set_active(csi->dev);
> > > + pm_runtime_enable(csi->dev);
> >
> > Note that the sub-device driver's UAPI may be already available to users
> > when the async sub-device is registered. Therefore you'll need enable
> > runtime PM before that.
> >
>
> The only place where the driver actually writes registers to the hardware
> is in .start_streaming(), which I presume can only be called after the
> whole media pipeline is probed?
Correct, but without enabling runtime PM before registering the async
sub-device there's no guarantee of that order.
>
> > > + pm_request_idle(csi->dev);
> > > +
> > > return 0;
> > >
> > > err_notifier:
> > > @@ -1609,6 +1656,9 @@ static void ti_csi2rx_remove(struct platform_device *pdev)
> > > mutex_destroy(&csi->mutex);
> > > dma_free_coherent(csi->dev, csi->drain.len, csi->drain.vaddr,
> > > csi->drain.paddr);
> >
> > Is there a guarantee the device is in a particular runtime PM state here,
> > e.g. suspended?
> >
>
> I don't think so, userspace could attempt to remove the device while
> streaming. Good point, I haven't checked what all goes wrong in that case.
We don't really support that yet. :-)
I'd still check the runtime Pm state and if it's active, I'd power the
device off.
>
> > > + pm_runtime_disable(&pdev->dev);
> > > + pm_runtime_set_suspended(&pdev->dev);
> > > +
> > > }
> > >
> > > static const struct of_device_id ti_csi2rx_of_match[] = {
> > > @@ -1623,6 +1673,7 @@ static struct platform_driver ti_csi2rx_pdrv = {
> > > .driver = {
> > > .name = TI_CSI2RX_MODULE_NAME,
> > > .of_match_table = ti_csi2rx_of_match,
> > > + .pm = &ti_csi2rx_pm_ops,
> > > },
> > > };
> > >
> >
--
Kind regards,
Sakari Ailus
Powered by blists - more mailing lists