From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Paul Gazzillo <paul@pgazz.com>,
Zhigang Shi <Zhigang.Shi@liteon.com>,
Shreeya Patel <shreeya.patel@collabora.com>,
Dmitry Osipenko <dmitry.osipenko@collabora.com>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 5/6] iio: light: ROHM BU27034 Ambient Light Sensor
Date: Sat, 18 Mar 2023 16:57:58 +0000 [thread overview]
Message-ID: <20230318165758.4daff10a@jic23-huawei> (raw)
In-Reply-To: <1161c822-ece3-4654-f11d-c775f8c64f65@gmail.com>
On Tue, 14 Mar 2023 11:39:22 +0200
Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> On 3/12/23 17:36, Jonathan Cameron wrote:
> > On Sun, 5 Mar 2023 14:22:51 +0200
> > Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> >
> >> On 3/4/23 22:17, Jonathan Cameron wrote:
> >>> On Thu, 2 Mar 2023 12:58:59 +0200
> >>> Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>
> //snip
>
> >>>
> >>>> +static const struct iio_chan_spec bu27034_channels[] = {
> >>>> + {
> >>>> + .type = IIO_LIGHT,
> >>>> + .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
> >>>> + BIT(IIO_CHAN_INFO_SCALE),
> >>>
> >>> What is this scale for?
> >>
> >> The scale is to inform users that we return data using milli lux.
> >>
> >>> Given the channel is computed from various different inputs, is there a
> >>> clear definition of how it is scaled? What does a write to it mean?
> >>
> >> Nothing. writing anything else but milli lux scale fails with -EINVAL.
> >>
> >> I guess I am doing something in an unusual way here :) Do you have a
> >> suggestion for me?
> >
> > Return data in lux? Or return it as INFO_RAW - thus making it clear
> > that the reading is not in expected units and a conversion must be
> > applied by userspace. SCALE is not applied to PROCESSED by userspace.
> >
>
> I just noticed a thing. I used the iio_generic_buffer to test the
> changes - and it got the channel values scaled to luxes even for the
> PROCESSED channel. So, it seems to me the iio_generic_buffer does apply
> the scale for PROCESSED channels too. I think that is slightly
> misleading. Oh, and this is not intended to be a complaint - just a
> report that there might be some room for an improvement :)
Ah. Looks like the code doesn't have any check on whether the sysfs
read is _raw or _processed which is kind of understandable.
This may be the first case where those have both applied on a channel
that is available via buffered route.
Given processed channels are rarely IIO_VAL_INT which is kind of necessary
to poke it in the buffered route, that may well be true.
Jonathan
>
> Yours,
> -- Matti
>
next prev parent reply other threads:[~2023-03-18 16:43 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 10:57 [PATCH v2 0/6] Support ROHM BU27034 ALS sensor Matti Vaittinen
2023-03-02 10:57 ` [PATCH v2 1/6] dt-bindings: iio: light: Support ROHM BU27034 Matti Vaittinen
2023-03-02 10:57 ` [PATCH v2 2/6] iio: light: Add gain-time-scale helpers Matti Vaittinen
2023-03-02 15:05 ` Andy Shevchenko
2023-03-03 7:54 ` Vaittinen, Matti
2023-03-06 11:13 ` Andy Shevchenko
2023-03-13 11:31 ` Matti Vaittinen
2023-03-13 14:39 ` Andy Shevchenko
2023-03-14 10:28 ` Matti Vaittinen
2023-03-14 11:31 ` Andy Shevchenko
2023-03-14 11:36 ` Andy Shevchenko
2023-03-15 7:20 ` Vaittinen, Matti
2023-03-18 16:49 ` Jonathan Cameron
2023-03-04 18:35 ` Jonathan Cameron
2023-03-04 19:42 ` Matti Vaittinen
2023-03-06 11:15 ` Andy Shevchenko
2023-03-02 10:58 ` [PATCH v2 3/6] iio: test: test " Matti Vaittinen
2023-03-02 10:58 ` [PATCH v2 4/6] MAINTAINERS: Add IIO " Matti Vaittinen
2023-03-02 10:58 ` [PATCH v2 5/6] iio: light: ROHM BU27034 Ambient Light Sensor Matti Vaittinen
2023-03-02 14:17 ` Matti Vaittinen
2023-03-02 15:34 ` Andy Shevchenko
2023-03-03 9:17 ` Matti Vaittinen
2023-03-04 19:02 ` Jonathan Cameron
2023-03-04 20:28 ` Matti Vaittinen
2023-03-04 20:17 ` Jonathan Cameron
2023-03-05 12:22 ` Matti Vaittinen
2023-03-12 15:36 ` Jonathan Cameron
2023-03-13 9:39 ` Matti Vaittinen
2023-03-18 16:54 ` Jonathan Cameron
2023-03-19 15:59 ` Matti Vaittinen
2023-03-14 9:39 ` Matti Vaittinen
2023-03-18 16:57 ` Jonathan Cameron [this message]
2023-03-05 13:10 ` Matti Vaittinen
2023-03-06 11:21 ` Andy Shevchenko
2023-03-13 8:54 ` Matti Vaittinen
2023-03-02 10:59 ` [PATCH v2 6/6] MAINTAINERS: Add ROHM BU27034 Matti Vaittinen
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=20230318165758.4daff10a@jic23-huawei \
--to=jic23@kernel.org \
--cc=Zhigang.Shi@liteon.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dmitry.osipenko@collabora.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mazziesaccount@gmail.com \
--cc=paul@pgazz.com \
--cc=shreeya.patel@collabora.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