From: Jonathan Cameron <jic23@kernel.org>
To: "Javier Carrasco" <javier.carrasco.cruz@gmail.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
"Rishi Gupta" <gupt21@gmail.com>, <linux-iio@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH 1/2] iio: light: veml6030: extend regmap to support regfields and caching
Date: Sun, 12 Jan 2025 16:40:06 +0000 [thread overview]
Message-ID: <20250112164006.218cf045@jic23-huawei> (raw)
In-Reply-To: <D705L20050OB.3UOW9R2QA4QA5@gmail.com>
On Sun, 12 Jan 2025 15:10:14 +0100
"Javier Carrasco" <javier.carrasco.cruz@gmail.com> wrote:
> On Sun Jan 12, 2025 at 2:18 PM CET, Jonathan Cameron wrote:
> > On Tue, 07 Jan 2025 21:50:21 +0100
> > Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:
> >
> > > The configuration registers are not volatile and are not affected
> > > by read operations (i.e. not precious), making them suitable to be
> > > cached in order to reduce the number of accesses to the device.
> > >
> > > Add support for regfields as well to simplify register operations,
> > > taking into account the different fields for the veml6030/veml7700 and
> > > veml6035.
> > >
> > > Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> > > ---
> > > drivers/iio/light/veml6030.c | 141 +++++++++++++++++++++++++++++++++++--------
> > > 1 file changed, 116 insertions(+), 25 deletions(-)
> > >
> > > diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
> > > index 9b71825eea9bee2146be17ed2f30f5a8f7ad37e3..a6385c6d3fba59a6b22845a3c5e252b619faed65 100644
> > > --- a/drivers/iio/light/veml6030.c
> > > +++ b/drivers/iio/light/veml6030.c
> > > @@ -65,6 +65,11 @@ enum veml6030_scan {
> > > VEML6030_SCAN_TIMESTAMP,
> > > };
> > >
> > > +struct veml6030_rf {
> > > + struct regmap_field *it;
> > > + struct regmap_field *gain;
> > > +};
> > > +
> > > struct veml603x_chip {
> > > const char *name;
> > > const int(*scale_vals)[][2];
> > > @@ -75,6 +80,7 @@ struct veml603x_chip {
> > > int (*set_info)(struct iio_dev *indio_dev);
> > > int (*set_als_gain)(struct iio_dev *indio_dev, int val, int val2);
> > > int (*get_als_gain)(struct iio_dev *indio_dev, int *val, int *val2);
> > > + int (*regfield_init)(struct iio_dev *indio_dev);
> >
> > With only two fields, why use a callback rather than just adding the two
> > const struct reg_field into this structure directly?
>
> The rationale was that extending the driver for more devices with
> additional fields would not require extra elements in the struct that
> would only apply to some devices. All members of this struct are rather
> basic and all devices will require them, and although integration time
> and gain regfields will be required too, if a new regfield for a
> specific device is added, it will be added to the rest as empty element.
>
> But that's probably too much "if" and "would", so I am fine with your
> suggestion.
Absolutely - it is in kernel stuff so we can always revisit if it turns
out to make more sense this way.
>
> >
> > I'd also be tempted to do the caching and regfield changes as separate patches.
> >
>
> Then I will split the patch for v2.
>
> > Jonathan
>
> Thank you for your feedback and best regards,
> Javier Carrasco
next prev parent reply other threads:[~2025-01-12 16:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 20:50 [PATCH 0/2] iio: light: fix scale in veml6030 Javier Carrasco
2025-01-07 20:50 ` [PATCH 1/2] iio: light: veml6030: extend regmap to support regfields and caching Javier Carrasco
2025-01-12 13:18 ` Jonathan Cameron
2025-01-12 14:10 ` Javier Carrasco
2025-01-12 16:40 ` Jonathan Cameron [this message]
2025-01-07 20:50 ` [PATCH 2/2] iio: light: veml6030: fix scale to conform to ABI Javier Carrasco
2025-01-09 17:46 ` Javier Carrasco
2025-01-12 13:22 ` Jonathan Cameron
2025-01-13 11:56 ` Matti Vaittinen
2025-01-13 15:05 ` Javier Carrasco
2025-01-13 19:52 ` Matti Vaittinen
2025-01-13 22:32 ` Javier Carrasco
2025-01-14 6:43 ` Matti Vaittinen
2025-01-14 13:02 ` Javier Carrasco
2025-01-14 14:26 ` Matti Vaittinen
2025-01-18 12:16 ` Jonathan Cameron
2025-01-13 10:25 ` [PATCH 0/2] iio: light: fix scale in veml6030 Matti Vaittinen
2025-01-13 11:02 ` Javier Carrasco
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=20250112164006.218cf045@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=gupt21@gmail.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.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