The Linux Kernel Mailing List
 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: Add debugfs register access support
Date: Mon, 28 Jul 2025 14:52:59 +0100	[thread overview]
Message-ID: <20250728145259.753b3999@jic23-huawei> (raw)
In-Reply-To: <20250724143945.636380-1-akshayaj.lkd@gmail.com>

On Thu, 24 Jul 2025 20:09:39 +0530
Akshay Jindal <akshayaj.lkd@gmail.com> wrote:

> Add support for debugfs_reg_access through the driver's iio_info structure
> to enable low-level register read/write access for debugging.
> 
> Signed-off-by: Akshay Jindal <akshayaj.lkd@gmail.com>

>  drivers/iio/light/ltr390.c | 53 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/drivers/iio/light/ltr390.c b/drivers/iio/light/ltr390.c
> index ee59bbb8aa09..b1028d027e1b 100644
> --- a/drivers/iio/light/ltr390.c
> +++ b/drivers/iio/light/ltr390.c
> @@ -38,12 +38,21 @@
>  #define LTR390_ALS_UVS_GAIN		0x05
>  #define LTR390_PART_ID			0x06
>  #define LTR390_MAIN_STATUS		0x07
> +
>  #define LTR390_ALS_DATA			0x0D
> +#define LTR390_ALS_DATA_BYTE(n)		((LTR390_ALS_DATA) + (n))
						(LTR390_ALS_DATA + (n))

etc  There is no benefit in brackets around the bit that isn't a parameter
of the macro that I can see.


> +
>  #define LTR390_UVS_DATA			0x10
> +#define LTR390_UVS_DATA_BYTE(n)		((LTR390_UVS_DATA) + (n))
> +
>  #define LTR390_INT_CFG			0x19
>  #define LTR390_INT_PST			0x1A
> +
>  #define LTR390_THRESH_UP		0x21
> +#define LTR390_THRESH_UP_BYTE(n)	((LTR390_THRESH_UP) + (n))
> +
>  #define LTR390_THRESH_LOW		0x24
> +#define LTR390_THRESH_LOW_BYTE(n)	((LTR390_THRESH_LOW) + (n))
>  
>  #define LTR390_PART_NUMBER_ID		0xb
>  #define LTR390_ALS_UVS_GAIN_MASK	GENMASK(2, 0)
> @@ -98,11 +107,40 @@ struct ltr390_data {
>  	int int_time_us;
>  };
>  
> +static const struct regmap_range ltr390_readable_reg_ranges[] = {
> +	regmap_reg_range(LTR390_MAIN_CTRL, LTR390_MAIN_CTRL),
> +	regmap_reg_range(LTR390_ALS_UVS_MEAS_RATE, LTR390_MAIN_STATUS),
> +	regmap_reg_range(LTR390_ALS_DATA_BYTE(0), LTR390_ALS_DATA_BYTE(2)),
> +	regmap_reg_range(LTR390_UVS_DATA_BYTE(0), LTR390_UVS_DATA_BYTE(2)),

If we are doing maximum length ranges can we not combine the two above?
Looks to be 0xd,0xe,0xf,0x10,0x11 and 0x012, so a continuous range similar
to the thresholds below.

> +	regmap_reg_range(LTR390_INT_CFG, LTR390_INT_PST),
> +	regmap_reg_range(LTR390_THRESH_UP_BYTE(0), LTR390_THRESH_LOW_BYTE(2)),
> +};

Thanks,

Jonathan


  parent reply	other threads:[~2025-07-28 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-24 14:39 [PATCH v3] iio: light: ltr390: Add debugfs register access support Akshay Jindal
2025-07-24 21:59 ` Shuah Khan
2025-07-27 20:23   ` Akshay Jindal
2025-07-28 13:52 ` Jonathan Cameron [this message]
2025-07-28 16:19   ` Akshay Jindal

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=20250728145259.753b3999@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