Devicetree
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Svyatoslav Ryhel <clamor95@gmail.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Esben Haabendal" <esben@geanix.com>,
	"Kuppuswamy Sathyanarayanan"
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	"Uwe Kleine-König (The Capable Hub)"
	<u.kleine-koenig@baylibre.com>, "Pan Chuang" <panchuang@vivo.com>,
	"Hemanth Selam" <hemanth.selam@gmail.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Nikita Travkin" <nikita@trvn.ru>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/4] iio: light: ltr501: Add support for the LTR-659PS-01 proximity sensor
Date: Sat, 14 Nov 2026 23:02:10 +0000	[thread overview]
Message-ID: <20261114230210.4b2c4cb1@jic23-hlaptop> (raw)
In-Reply-To: <20261108094253.83899-5-clamor95@gmail.com>

On Sun,  8 Nov 2026 11:42:53 +0200
Svyatoslav Ryhel <clamor95@gmail.com> wrote:

> Add support for the Lite-On LTR-659PS-01 proximity sensor. This device is
> nearly identical to the LTR-559ALS-01, but omits all elements related to
> ambient light sensing.
> 
> Add a no_als_support flag, similar to how no_irq_support is used, to
> isolate ALS register access for the LTR-659PS-01, since ALS registers are
> marked as reserved and interactions with them are discouraged.
> 
> The ltr501_trigger_handler relied on the scan index to identify channels.
> This approach is fragile regarding channel status flags and can break if
> the index is not strictly set. Switch to checking the channel type
> instead.
> 
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Just trivial stuff inline.

Thanks,

Jonathan

> @@ -1260,16 +1295,21 @@ static irqreturn_t ltr501_trigger_handler(int irq, void *p)
>  		aligned_s64 ts;
>  	} scan = { };
>  	__le16 als_buf[2];
> +	unsigned int i;
>  	u8 mask = 0;
>  	int j = 0;
>  	int ret, psdata;
>  
>  	/* figure out which data needs to be ready */
> -	if (test_bit(0, indio_dev->active_scan_mask) ||
> -	    test_bit(1, indio_dev->active_scan_mask))
> -		mask |= LTR501_STATUS_ALS_RDY;
> -	if (test_bit(2, indio_dev->active_scan_mask))
> -		mask |= LTR501_STATUS_PS_RDY;
> +	for_each_set_bit(i, indio_dev->active_scan_mask, indio_dev->num_channels) {

iio_for_each_active_channel() should work here.  The longer term plan is
to make some of this stuff opaque so I have a series that I haven't posted
yet converting most users over to this macro.

> +		const struct iio_chan_spec *chan = iio_find_channel_from_si(indio_dev, i);
Fine exporting that helper.

Thanks,

Jonathan

> +
> +		if (chan->type == IIO_INTENSITY)
> +			mask |= LTR501_STATUS_ALS_RDY;
> +
> +		if (chan->type == IIO_PROXIMITY)
> +			mask |= LTR501_STATUS_PS_RDY;
> +	}



      parent reply	other threads:[~2026-11-14 23:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08  9:42 [PATCH v3 0/4] iio: light: ltr501: Add LTR-659PS-01 prox sensor support Svyatoslav Ryhel
2026-11-08  9:42 ` [PATCH v3 1/4] iio: light: ltr501: Switch to read_avail() op from manual attribute registration Svyatoslav Ryhel
2026-11-08  9:50   ` sashiko-bot
2026-11-09 20:03   ` Andy Shevchenko
2026-11-14 22:55   ` Jonathan Cameron
2026-11-08  9:42 ` [PATCH v3 2/4] iio: light: ltr501: Switch to modern match mechanism Svyatoslav Ryhel
2026-11-08  9:42 ` [PATCH v3 3/4] dt-bindings: iio: light: ltr501: Document LTR659 proximity sensor Svyatoslav Ryhel
2026-11-08  9:42 ` [PATCH v3 4/4] iio: light: ltr501: Add support for the LTR-659PS-01 " Svyatoslav Ryhel
2026-11-08 10:01   ` sashiko-bot
2026-11-08 21:48   ` kernel test robot
2026-11-09 20:04     ` Andy Shevchenko
2026-11-09 20:07       ` Svyatoslav Ryhel
2026-11-14 14:45         ` Svyatoslav Ryhel
2026-11-14 22:59           ` Jonathan Cameron
2026-11-14 23:02   ` 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=20261114230210.4b2c4cb1@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=esben@geanix.com \
    --cc=hemanth.selam@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikita@trvn.ru \
    --cc=nuno.sa@analog.com \
    --cc=panchuang@vivo.com \
    --cc=robh@kernel.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=u.kleine-koenig@baylibre.com \
    /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