linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>, 579lpy@gmail.com
Cc: 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: Thu, 30 Nov 2023 19:59:03 +0100	[thread overview]
Message-ID: <570ea978-4ffc-48fa-92df-463f84610a5f@gmail.com> (raw)
In-Reply-To: <20231125145208.01194d91@jic23-huawei>

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).

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.

Thank you and best regards,
Javier Carrasco

  reply	other threads:[~2023-11-30 19:04 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 [this message]
2023-12-01 18:14     ` Jonathan Cameron

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=570ea978-4ffc-48fa-92df-463f84610a5f@gmail.com \
    --to=javier.carrasco.cruz@gmail.com \
    --cc=579lpy@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).