From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>, <579lpy@gmail.com>,
<lars@metafoo.de>, <robh+dt@kernel.org>,
<krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>,
<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>
Subject: Re: [PATCH v3 1/2] iio: humidity: Add driver for ti HDC302x humidity sensors
Date: Fri, 1 Dec 2023 18:14:30 +0000 [thread overview]
Message-ID: <20231201181430.00002634@Huawei.com> (raw)
In-Reply-To: <570ea978-4ffc-48fa-92df-463f84610a5f@gmail.com>
On Thu, 30 Nov 2023 19:59:03 +0100
Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:
> Hi,
>
> On 25.11.23 15:52, Jonathan Cameron wrote:
> >> +
> >> +static const struct iio_chan_spec hdc3020_channels[] = {
> >> + {
> >> + .type = IIO_TEMP,
> >
> > There is only one temp channel so I'd like to see the peaks added to this
> > one as well. Can be done if we add a new bit of ABI for the min value
> > seen.
> >
> > Whilst naming .index = 0, .channel = 0 is different from this case
> > the ABI and all userspace software should treat them the same hence this
> > is an ambiguous channel specification.
> >
> >> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> >> + BIT(IIO_CHAN_INFO_SCALE),
> >> + },
> >> + {
> >> + /* For minimum value during measurement */
> >
> > Please add some docs for this - preferably in patch description
> > or cover letter if it is too long for there. You are using the ABI in a fashion
> > not previously considered.
> >
> > I don't think it is a good solution. Perhaps keeping IIO_CHAN_INFO_PEAK
> > as assumed to be maximum, we could add a new IIO_CHAN_INFO_TROUGH
> > perhaps? Hopefully the scale applies to both peak and trough so we
> > don't need separate attributes.
> >
> If only IIO_CHAN_INFO_TROUGH is added without an additional _SCALE, in
> this particular case you end up having the following sysfs entries:
>
> in_humidityrelative_peak_raw
> in_humidityrelative_peak_scale
> in_temp_peak_raw
> in_temp_peak_scale
> in_humidityrelative_trough_raw
> in_temp_trough_raw
>
> I just would like to know if documenting the trough attribute in a way
> that it is clear that the peak_scale applies for it as well is better
> than adding a TROUGH_SCALE. We would save the additional attribute, but
> at first sight it is not that obvious (it makes sense that the scale is
> the same for both peaks, but the names are not so consistent anymore).
Agreed this isn't that intuitive.
>
> I suppose that often the raw and peak scales are also the same, but
> there are indeed two separate attributes. On the other hand I don't know
> if the additional attribute would imply bigger issues (maintenance,
> documentation, etc) than just adding the line, so I leave the question open.
I wonder if we should have the ABI state that peak_scale is only applicable
it it overrides the _scale value. Here I think they are the same anyway
thus not providing peak_scale would leave us with a single attribute reflecting
scale of _raw, _peak_raw and _trough_raw
I think this is already the case in reality. We have two users of the peak interface
and only one of them provides peak_scale. Hopefully hdc2010 is
assuming _scale applies to it.
So maybe this is just a documentation update and drop peak_scale from this
driver.
Jonathan
>
> Thank you and best regards,
> Javier Carrasco
>
prev parent reply other threads:[~2023-12-01 18:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-25 10:22 [PATCH v3 1/2] iio: humidity: Add driver for ti HDC302x humidity sensors 579lpy
2023-11-25 10:27 ` [PATCH v3 2/2] dt-bindings: iio: humidity: Add TI HDC302x support 579lpy
2023-11-25 14:55 ` Jonathan Cameron
2023-11-27 17:53 ` Conor Dooley
2023-11-25 14:52 ` [PATCH v3 1/2] iio: humidity: Add driver for ti HDC302x humidity sensors Jonathan Cameron
2023-11-30 18:59 ` Javier Carrasco
2023-12-01 18:14 ` 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=20231201181430.00002634@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=579lpy@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=robh+dt@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.