mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>, Shawn Tu <shawnx.tu@intel.com>,
	Jacopo Mondi <jacopo@jmondi.org>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v2 2/5] media: i2c: ov5645: Use runtime PM
Date: Thu, 27 Oct 2022 18:37:58 +0000	[thread overview]
Message-ID: <Y1rQBmXj71C1RrwB@paasikivi.fi.intel.com> (raw)
In-Reply-To: <CA+V-a8uhYymEVg7jdLVGNLsVD3=O1mk-_NVERu00W+gsv-7QXg@mail.gmail.com>

Hi Prabhakar,

On Thu, Oct 27, 2022 at 05:32:07PM +0100, Lad, Prabhakar wrote:
> Hi Sakari,
> 
> On Thu, Oct 27, 2022 at 1:47 PM Sakari Ailus
> <sakari.ailus@linux.intel.com> wrote:
> >
> > Hi Prabhakar,
> >
> > On Thu, Oct 27, 2022 at 01:01:52PM +0100, Lad, Prabhakar wrote:
> > > Hi Sakari,
> > >
> > > On Thu, Oct 27, 2022 at 12:20 PM Sakari Ailus
> > > <sakari.ailus@linux.intel.com> wrote:
> > > >
> > > > Hi Prabhakar,
> > > >
> > > > One more comment.
> > > >
> > > > On Fri, Oct 14, 2022 at 07:34:56PM +0100, Prabhakar wrote:
> > > > > @@ -1209,12 +1190,16 @@ static int ov5645_probe(struct i2c_client *client)
> > > > >
> > > > >       dev_info(dev, "OV5645 detected at address 0x%02x\n", client->addr);
> > > > >
> > > > > +     pm_runtime_set_active(dev);
> > > > > +     pm_runtime_get_noresume(dev);
> > > > > +     pm_runtime_enable(dev);
> > > >
> > > > You won't gain anything by eanbling runtime PM here. Just move it to the
> > > > end of the function before the rest of the calls. Error handling becomes
> > > > more simple.
> > > >
> > > If I move the above calls below I get the below warning:
> > >
> > > [    2.633386] ov5645 0-003c: Runtime PM usage count underflow!
> > >
> > > This is because of the last patch which moves ov5645_entity_init_cfg()
> > > before registering the subdev. ov5645_entity_init_cfg() calls s_ctrl
> > > due to which we are seeing the above message. Please let me know how
> > > to proceed on this.
> >
> > Ah. Yes, this is a problem with the usage pattern of
> > pm_runtime_get_if_in_use(). But please don't change that.
> >
> > You can still move enabling runtime PM later in the function.
> >
> Agreed, the final version looks like below:
> 
>     pm_runtime_set_active(dev);
>     pm_runtime_get_noresume(dev);
> 

You'll have to enable runtime PM here, before pm_runtime_get_if_in_use()
gets called.

I'll see if it could be made to work in a sensible way when runtime PM
isn't enabled yet.

>     ov5645_entity_init_cfg(&ov5645->sd, NULL);
> 
>     ret = v4l2_async_register_subdev(&ov5645->sd);
>     if (ret < 0) {
>         dev_err(dev, "could not register v4l2 device\n");
>         goto err_pm_runtime;
>     }
> 
>     pm_runtime_set_autosuspend_delay(dev, 1000);
>     pm_runtime_use_autosuspend(dev);
>     pm_runtime_enable(dev);

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2022-10-27 18:46 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 18:34 [PATCH v2 0/5] media: i2c: ov5645 driver enhancements Prabhakar
2022-10-14 18:34 ` [PATCH v2 1/5] media: dt-bindings: ov5645: Convert OV5645 binding to a schema Prabhakar
2022-10-14 21:00   ` Rob Herring
2022-10-14 21:05   ` Rob Herring
2022-10-14 21:27     ` Lad, Prabhakar
2022-10-14 21:40       ` Rob Herring
2022-10-15  5:54         ` Laurent Pinchart
2022-10-15 13:17           ` Krzysztof Kozlowski
2022-10-17  7:43             ` Lad, Prabhakar
2022-10-26 16:56           ` Rob Herring
2022-10-14 18:34 ` [PATCH v2 2/5] media: i2c: ov5645: Use runtime PM Prabhakar
2022-10-14 19:18   ` Sakari Ailus
2022-10-14 21:30     ` Lad, Prabhakar
2022-10-15  6:05     ` Laurent Pinchart
2022-10-15  6:25       ` Laurent Pinchart
2022-10-26 12:07         ` Lad, Prabhakar
2022-10-27 11:20   ` Sakari Ailus
2022-10-27 12:01     ` Lad, Prabhakar
2022-10-27 12:47       ` Sakari Ailus
2022-10-27 16:32         ` Lad, Prabhakar
2022-10-27 18:37           ` Sakari Ailus [this message]
2022-10-28 21:05             ` Lad, Prabhakar
2022-10-31 14:25             ` Sakari Ailus
2022-10-31 16:10               ` Lad, Prabhakar
2022-10-14 18:34 ` [PATCH v2 3/5] media: i2c: ov5645: Drop empty comment Prabhakar
2022-10-15  6:05   ` Laurent Pinchart
2022-10-14 18:34 ` [PATCH v2 4/5] media: i2c: ov5645: Return zero for s_stream(0) Prabhakar
2022-10-15  6:25   ` Laurent Pinchart
2022-10-15 21:35     ` Sakari Ailus
2022-10-15 23:23       ` Laurent Pinchart
2022-10-16 20:19         ` Sakari Ailus
2022-10-16 21:03           ` Laurent Pinchart
2022-10-17  7:12             ` Sakari Ailus
2022-10-17  7:40               ` Lad, Prabhakar
2022-10-14 18:34 ` [PATCH v2 5/5] media: i2c: ov5645: Call ov5645_entity_init_cfg() before registering the subdev Prabhakar
2022-10-15  6:26   ` Laurent Pinchart
2022-10-26 11:59     ` Lad, Prabhakar
2022-10-14 18:40 ` [PATCH v2 0/5] media: i2c: ov5645 driver enhancements Lad, Prabhakar

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=Y1rQBmXj71C1RrwB@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil@xs4all.nl \
    --cc=jacopo@jmondi.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnx.tu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®