[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250901173638.5a61d342@jic23-huawei>
Date: Mon, 1 Sep 2025 17:36:38 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Akshay Jindal <akshayaj.lkd@...il.com>
Cc: anshulusr@...il.com, dlechner@...libre.com, nuno.sa@...log.com,
andy@...nel.org, shuah@...nel.org, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] iio: light: ltr390: Implement runtime PM support
On Mon, 1 Sep 2025 01:41:33 +0530
Akshay Jindal <akshayaj.lkd@...il.com> wrote:
> On Sun, Aug 31, 2025 at 8:41 PM Jonathan Cameron <jic23@...nel.org> wrote:
> >
> > On Sun, 31 Aug 2025 11:09:26 +0530
> > Akshay Jindal <akshayaj.lkd@...il.com> wrote:
> >
> > > On Sat, Aug 30, 2025 at 11:55 PM Jonathan Cameron <jic23@...nel.org> wrote:
> > > >
> > > > On Sat, 30 Aug 2025 17:05:00 +0530
> > > > Akshay Jindal <akshayaj.lkd@...il.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
>
Powered by blists - more mailing lists