mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Akshay Jindal <akshayaj.lkd@gmail.com>
Cc: anshulusr@gmail.com, dlechner@baylibre.com, nuno.sa@analog.com,
	andy@kernel.org, shuah@kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] iio: light: ltr390: Implement runtime PM support
Date: Mon, 1 Sep 2025 17:36:38 +0100	[thread overview]
Message-ID: <20250901173638.5a61d342@jic23-huawei> (raw)
In-Reply-To: <CAE3SzaRncowQSu4DDT6020hBJiJs0GGkNkjzi8CPxJ5kukoFPw@mail.gmail.com>

On Mon, 1 Sep 2025 01:41:33 +0530
Akshay Jindal <akshayaj.lkd@gmail.com> wrote:

> On Sun, Aug 31, 2025 at 8:41 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Sun, 31 Aug 2025 11:09:26 +0530
> > Akshay Jindal <akshayaj.lkd@gmail.com> wrote:
> >  
> > > On Sat, Aug 30, 2025 at 11:55 PM Jonathan Cameron <jic23@kernel.org> wrote:  
> > > >
> > > > On Sat, 30 Aug 2025 17:05:00 +0530
> > > > Akshay Jindal <akshayaj.lkd@gmail.com> wrote:  
> > > > >  static int ltr390_debugfs_reg_access(struct iio_dev *indio_dev,
> > > > >                                               unsigned int reg, unsigned int writeval,
> > > > >                                               unsigned int *readval)
> > > > >  {
> > > > >       struct ltr390_data *data = iio_priv(indio_dev);
> > > > > +     struct device *dev = &data->client->dev;
> > > > > +     int ret;
> > > > >
> > > > > -     guard(mutex)(&data->lock);
> > > > > +     ret = pm_runtime_resume_and_get(dev);  
> > > >
> > > > So this makes me wonder.  I'd been assuming our disable was only turning the
> > > > sensor off, not register access?  Seeing as it's controlled by a register
> > > > we can clearly access at least some.
> > > >
> > > > If that's the case why do we need to runtime resume for debug register
> > > > read/write?  We shouldn't care if the sensors are reading or not. In fact
> > > > if we do turn the power on we changed the state we are debugging which is
> > > > probably not a good plan.  
> > > Are you suggesting to remove pm_runtime_* calls from all the functions or
> > > just the debugfs function?  
> >
> > All the ones where it's not needed.  So as far as I can see it is only
> > needed when actually grabbing date.  
> 
> These are the functions where I have used it currently.
> static const struct iio_info ltr390_info = {
>         .read_raw = ltr390_read_raw,----> reads sensor data, scale,
> int_time, samp_frequency from register
>         .write_raw = ltr390_write_raw,-------> writes sampling
> frequency, scale, int_time into register.
>         .read_avail = ltr390_read_avail, ----------------> no reg read
>         .read_event_value = ltr390_read_event_value,-----> reads
> interrupt threshold value from register
>         .read_event_config = ltr390_read_event_config,----> reads
> INT_CFG register
>         .write_event_value = ltr390_write_event_value,------> writes
> threshold value into register
>         .write_event_config = ltr390_write_event_config,-----> writes
> into INT_CFG register
>         .debugfs_reg_access = ltr390_debugfs_reg_access,-->
> reads/writes into all registers
> };
> 
> Going by your comment, I think I need it only in read_raw and
> write_event_config.

Yes, I think so but you should test that nothing fails  on the other calls
without it.

> There is a similar sensor, ltrf216a (same company, liteon). There only
> read_raw has
> these pm_runtime_* calls. Let me know your thoughts. I will make the change and
> include updated testing details.
> 
> Thanks,
> Akshay
> 


      parent reply	other threads:[~2025-09-01 16:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-30 11:35 Akshay Jindal
2025-08-30 12:34 ` Andy Shevchenko
2025-08-30 13:24   ` Akshay Jindal
2025-08-30 14:46     ` Andy Shevchenko
2025-08-30 18:02       ` Akshay Jindal
2025-08-30 18:25 ` Jonathan Cameron
2025-08-31  5:39   ` Akshay Jindal
2025-08-31 15:11     ` Jonathan Cameron
2025-08-31 20:11       ` Akshay Jindal
2025-08-31 20:15         ` Akshay Jindal
2025-09-01 16:36         ` Jonathan Cameron [this message]

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=20250901173638.5a61d342@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=akshayaj.lkd@gmail.com \
    --cc=andy@kernel.org \
    --cc=anshulusr@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=shuah@kernel.org \
    /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®