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 13:18:45 +0000 [thread overview]
Message-ID: <20250112131845.539ecc7c@jic23-huawei> (raw)
In-Reply-To: <20250107-veml6030-scale-v1-1-1281e3ad012c@gmail.com>
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?
I'd also be tempted to do the caching and regfield changes as separate patches.
Jonathan
next prev parent reply other threads:[~2025-01-12 13:18 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 [this message]
2025-01-12 14:10 ` Javier Carrasco
2025-01-12 16:40 ` Jonathan Cameron
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=20250112131845.539ecc7c@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