All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Pratyush Yadav <p.yadav@ti.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Nikhil Devshatwar <nikhil.nd@ti.com>,
	Dongchun Zhu <dongchun.zhu@mediatek.com>,
	Jacopo Mondi <jacopo+renesas@jmondi.org>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	Martina Krasteva <martinax.krasteva@intel.com>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Raag Jadav <raagjadav@gmail.com>,
	Steve Longerbeam <slongerbeam@gmail.com>,
	Tianshu Qiu <tian.shu.qiu@intel.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org
Subject: Re: [PATCH v3 01/11] media: ov5640: Use runtime PM to control sensor power
Date: Thu, 8 Jul 2021 00:44:15 +0300	[thread overview]
Message-ID: <20210707214415.GY3@paasikivi.fi.intel.com> (raw)
In-Reply-To: <YOYWCRg0P65U41Fg@pendragon.ideasonboard.com>

Hi Laurent,

On Thu, Jul 08, 2021 at 12:00:57AM +0300, Laurent Pinchart wrote:
> Hi Sakari,
> 
> On Wed, Jul 07, 2021 at 11:37:18PM +0300, Sakari Ailus wrote:
> > On Fri, Jun 25, 2021 at 12:51:50AM +0530, Pratyush Yadav wrote:
> > > Calling s_power subdev callback is discouraged. Instead, the subdevs
> > > should use runtime PM to control its power. Use runtime PM callbacks to
> > > control sensor power. The pm counter is incremented when the stream is
> > > started and decremented when the stream is stopped.
> > > 
> > > Refactor s_stream() a bit to make this new control flow easier. Add a
> > > helper to choose whether mipi or dvp set_stream needs to be called. The
> > > logic flow is also changed to make it a bit clearer.
> > > 
> > > Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
> > > 
> > > ---
> > > 
> > > Changes in v3:
> > > - Clean up the logic in ov5640_s_stream() a bit.
> > > - Use pm_runtime_resume_and_get() instead of pm_runtime_get_sync().
> > > - Rename the label error_pm to disable_pm.
> > > 
> > > Changes in v2:
> > > - New in v2.
> > > 
> > >  drivers/media/i2c/Kconfig  |   2 +-
> > >  drivers/media/i2c/ov5640.c | 127 +++++++++++++++++++++++--------------
> > >  2 files changed, 79 insertions(+), 50 deletions(-)
> > > 
> > > diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> > > index 588f8eb95984..8f43a4d7bcc1 100644
> > > --- a/drivers/media/i2c/Kconfig
> > > +++ b/drivers/media/i2c/Kconfig
> > > @@ -929,7 +929,7 @@ config VIDEO_OV2740
> > >  
> > >  config VIDEO_OV5640
> > >  	tristate "OmniVision OV5640 sensor support"
> > > -	depends on OF
> > > +	depends on OF && PM
> > 
> > Could you add support for runtime PM without requiring CONFIG_PM?
> > 
> > Essentially you'll need to power on the device in probe and power it off in
> > probe, and make sure the runtime PM nop variant functions return the value
> > you'd expect.
> 
> I've gone through that in several sensor drivers, and it really
> increases the complexity to get it right, to a point where I'm not
> comfortable asking someone to do the same (not to mention the very, very

I don't think it's very complicated, really. Looking at examples of other
drivers (e.g. imx334) doing exactly the same helps as you don't need to
check for individual functions.

The complexity of the power management in this driver is mostly because of
evolutionary development done over time, it's an old driver.

> high chance that it won't be done correctly). What's the practical
> drawback in requiring CONFIG_PM ?

Good question. CONFIG_PM is something you can disable (for a reason I can't
think of though). Why should a driver depend on it when it could perfectly
work without it as well?

Although this might not amount to a practical drawback. :-)

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2021-07-07 21:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 19:21 [PATCH v3 00/11] CSI2RX support on J721E Pratyush Yadav
2021-06-24 19:21 ` [PATCH v3 01/11] media: ov5640: Use runtime PM to control sensor power Pratyush Yadav
2021-07-07 20:37   ` Sakari Ailus
2021-07-07 21:00     ` Laurent Pinchart
2021-07-07 21:44       ` Sakari Ailus [this message]
2021-07-07 21:51         ` Laurent Pinchart
2021-07-08 10:28           ` Sakari Ailus
2021-06-24 19:21 ` [PATCH v3 02/11] media: cadence: csi2rx: Unregister v4l2 async notifier Pratyush Yadav
2021-06-24 19:21 ` [PATCH v3 03/11] media: cadence: csi2rx: Add external DPHY support Pratyush Yadav
2021-06-24 19:21 ` [PATCH v3 04/11] media: cadence: csi2rx: Soft reset the streams before starting capture Pratyush Yadav
2021-06-24 19:21 ` [PATCH v3 05/11] media: cadence: csi2rx: Set the STOP bit when stopping a stream Pratyush Yadav
2021-06-24 19:21 ` [PATCH v3 06/11] media: cadence: csi2rx: Fix stream data configuration Pratyush Yadav
2021-06-24 19:21 ` [PATCH v3 07/11] media: cadence: csi2rx: Populate subdev devnode Pratyush Yadav
2021-06-24 19:21 ` [PATCH v3 08/11] media: Re-structure TI platform drivers Pratyush Yadav
2021-06-24 19:21 ` [PATCH v3 09/11] media: ti: Add CSI2RX support for J721E Pratyush Yadav
2021-06-24 19:21 ` [PATCH v3 10/11] media: dt-bindings: Add DT bindings for TI J721E CSI2RX driver Pratyush Yadav
2021-07-01 14:02   ` Rob Herring
2021-06-24 19:22 ` [PATCH v3 11/11] media: dt-bindings: Convert Cadence CSI2RX binding to YAML Pratyush Yadav
2021-07-01 18:55   ` Rob Herring
2021-07-07 18:45     ` Pratyush Yadav
2021-07-01  7:56 ` [PATCH v3 00/11] CSI2RX support on J721E Tomi Valkeinen
2021-07-07 18:56   ` Pratyush Yadav
2021-07-08  8:19     ` Jacopo Mondi
2021-07-08  8:43       ` Tomi Valkeinen
2021-07-08 11:25         ` Pratyush Yadav
2021-09-09 18:11   ` Pratyush Yadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210707214415.GY3@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=dongchun.zhu@mediatek.com \
    --cc=jacopo+renesas@jmondi.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=martinax.krasteva@intel.com \
    --cc=mchehab@kernel.org \
    --cc=nikhil.nd@ti.com \
    --cc=p.yadav@ti.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=raagjadav@gmail.com \
    --cc=slongerbeam@gmail.com \
    --cc=tian.shu.qiu@intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.