Devicetree
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Lakshay Piplani <lakshay.piplani@nxp.com>,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	marcelo.schmitt1@gmail.com, gregkh@linuxfoundation.org,
	viro@zeniv.linux.org.uk, peterz@infradead.org,
	jstephan@baylibre.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, devicetree@vger.kernel.org,
	ilpo.jarvinen@linux.intel.com, jonathan.cameron@huawei.com,
	akpm@linux-foundation.org, chao@kernel.org, jaegeuk@kernel.org,
	vikash.bansal@nxp.com, priyanka.jain@nxp.com,
	shashank.rebbapragada@nxp.com, Frank.Li@nxp.com
Subject: Re: [PATCH v2 2/2] iio: temperature: Add driver for NXP P3T175x temperature sensor
Date: Mon, 1 Sep 2025 16:47:17 +0100	[thread overview]
Message-ID: <20250901164717.6cba2d50@jic23-huawei> (raw)
In-Reply-To: <72c3ae7d-cb54-4a1b-a27a-9e673ffaddcc@kernel.org>

On Sun, 31 Aug 2025 18:46:32 +0200
Krzysztof Kozlowski <krzk@kernel.org> wrote:

> On 27/08/2025 12:31, Lakshay Piplani wrote:
> > Add support for the NXP P3T175x (P3T1750/P3T1755) family of temperature
> > sensor devices. These devices communicates via both I2C or I3C interfaces.
> > 
> > This driver belongs under IIO because:
> >   The P3T1750/P3T1755 sensors require interrupt or IBI support to handle
> >   threshold events, which the hwmon subsystem does not provide. In contrast,
> >   the IIO subsystem offers robust event handling that matches the hardware
> >   capabilities of these sensors. Therefore, this driver is better suited
> >   under IIO.
> >   
> 
> 
Picking out one thing that made me curious.

> ...
> 
> > +static int p3t1755_write_event_value(struct iio_dev *indio_dev,
> > +				     const struct iio_chan_spec *chan,
> > +				     enum iio_event_type type,
> > +				     enum iio_event_direction dir,
> > +				     enum iio_event_info info, int val,
> > +				     int val2)
> > +{
> > +	struct p3t1755_data *data = iio_priv(indio_dev);
> > +	unsigned int reg;
> > +	__be16 be;
> > +
> > +	if (type != IIO_EV_TYPE_THRESH || info != IIO_EV_INFO_VALUE)
> > +		return -EINVAL;
> > +
> > +	reg = (dir == IIO_EV_DIR_RISING) ? P3T1755_REG_HIGH_LIM :
> > +					   P3T1755_REG_LOW_LIM;
> > +
> > +	if (val < -2048 || val > 2047)
> > +		return -ERANGE;
> > +
> > +	be = cpu_to_be16((u16)((val & 0xfff) << 4));
> > +
> > +	return regmap_bulk_write(data->regmap, reg, &be, sizeof(be));  
> 
> Now I wonder why regmap does not handle your data format?

This device does have a novel definition of register. There
are 4 of them, 3 of which are 12 bits zero padded to 16 and
the other 8 bits.

So, I think only way to wrap that up fully in regmap would be
a pair of regmaps one of which has only a single register in it.

Agreed though that using bulk accesses is not a good plan.
I'd been assuming that was actually a pair of registers, not
a single larger one.


Jonathan


  reply	other threads:[~2025-09-01 15:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27 10:31 [PATCH v2 1/2] dt-bindings: iio: temperature: Add NXP P3T175x support Lakshay Piplani
2025-08-27 10:31 ` [PATCH v2 2/2] iio: temperature: Add driver for NXP P3T175x temperature sensor Lakshay Piplani
2025-08-27 14:36   ` David Lechner
2025-08-29 15:43   ` Andy Shevchenko
2025-08-31 16:46   ` Krzysztof Kozlowski
2025-09-01 15:47     ` Jonathan Cameron [this message]
2025-09-02 11:06       ` Andy Shevchenko
2025-08-27 13:59 ` [PATCH v2 1/2] dt-bindings: iio: temperature: Add NXP P3T175x support David Lechner
2025-08-31 16:01 ` Jonathan Cameron
2025-08-31 16:47 ` Krzysztof Kozlowski

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=20250901164717.6cba2d50@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy@kernel.org \
    --cc=chao@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jaegeuk@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=jstephan@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lakshay.piplani@nxp.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=peterz@infradead.org \
    --cc=priyanka.jain@nxp.com \
    --cc=robh@kernel.org \
    --cc=shashank.rebbapragada@nxp.com \
    --cc=vikash.bansal@nxp.com \
    --cc=viro@zeniv.linux.org.uk \
    /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