All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>
To: Chang Yu <marcus.yu.56@gmail.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"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>,
	"Shi Hao" <i.shihao.999@gmail.com>,
	"Joshua Crofts" <joshua.crofts1@gmail.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/2] iio: light: add AS7343 multi-spectral sensor driver
Date: Fri, 25 Sep 2026 00:02:34 +0200	[thread overview]
Message-ID: <arWccqy8YlLJxeWA@gmail.com> (raw)
In-Reply-To: <20260919235145.48273-3-marcus.yu.56@gmail.com>

On Sat, Sep 19, 2026 at 04:51:45PM -0700, Chang Yu wrote:
> +static int as7343_read_raw(struct iio_dev *indio_dev,
> +			   struct iio_chan_spec const *chan,
> +			   int *val, int *val2, long mask)
> +{
> +	struct as7343_data *data = iio_priv(indio_dev);
> +	struct regmap *map = data->regmap;
> +	struct device *dev = regmap_get_device(map);
> +	unsigned int unused;
> +	__le16 result;
> +	int ret;
> +
> +	PM_RUNTIME_ACQUIRE_AUTOSUSPEND(dev, pm);
> +	ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> +	if (ret)
> +		return ret;
> +
> +	switch (mask) {
> +	case IIO_CHAN_INFO_RAW: {
> +		/* Wait until integration time passes for all 3 cycles. */
> +		msleep(160);

three integration periods hardcoded next to a hardcoded integration
time, so nothing keeps them in sync. make ATIME/ASTEP writable and the
fixed wait no longer covers a readout. as73211, which this is based on,
computes the timeout and polls NDATA. STATUS2 (0x90) bit 6 is AVALID is
defined and never read, does it cover all three cycles? the datasheet
does not say.

> +
> +		/*
> +		 * Reading ASTATUS latches all data registers to this read.
> +		 * We don't care about the returned saturation/gain status for
> +		 * now.
> +		 */
> +		guard(mutex)(&data->mutex);
> +
> +		ret = regmap_read(map, AS7343_ASTATUS_REG, &unused);
> +		if (ret)
> +			return ret;
> +
> +		ret = regmap_bulk_read(map, chan->address,
> +				       &result, sizeof(result));
> +		if (ret)
> +			return ret;
> +
> +		*val = le16_to_cpu(result);
> +		return IIO_VAL_INT;
> +	}
> +
> +	default:
> +		return -EINVAL;
> +	}
> +}
--
cheers, jose a. p-a

  parent reply	other threads:[~2026-09-24 22:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 23:51 [PATCH v5 0/2] Add support for AS7343 multi-spectral sensor Chang Yu
2026-09-19 23:51 ` [PATCH v5 1/2] dt-bindings: iio: light: add as7343 Chang Yu
2026-09-20  0:26   ` Jonathan Cameron
2026-09-19 23:51 ` [PATCH v5 2/2] iio: light: add AS7343 multi-spectral sensor driver Chang Yu
2026-09-20  0:04   ` sashiko-bot
2026-09-20  0:26   ` Jonathan Cameron
2026-09-21  4:21     ` Chang Yu
2026-09-24 18:22   ` Andy Shevchenko
2026-10-10  8:35     ` Chang Yu
2026-10-11  3:12     ` Chang Yu
2026-09-24 22:02   ` Jose A. Perez de Azpillaga [this message]
2026-09-25  0:52     ` Chang Yu

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=arWccqy8YlLJxeWA@gmail.com \
    --to=azpijr@gmail.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=i.shihao.999@gmail.com \
    --cc=jic23@kernel.org \
    --cc=joshua.crofts1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcus.yu.56@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.