From: Jonathan Cameron <jic23@kernel.org>
To: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Marek Vasut <marex@denx.de>, Anshul Dalal <anshulusr@gmail.com>,
Javier Carrasco <javier.carrasco.cruz@gmail.com>,
Matt Ranostay <matt@ranostay.sg>,
Stefan Windfeldt-Prytz <stefan.windfeldt-prytz@axis.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/3] iio: light: Add support for APDS9306 Light Sensor
Date: Sun, 4 Feb 2024 13:40:56 +0000 [thread overview]
Message-ID: <20240204134056.5dc64e8b@jic23-huawei> (raw)
In-Reply-To: <fd404067-bc24-449c-94b4-f59a54c3f532@tweaklogic.com>
On Sun, 4 Feb 2024 21:53:55 +1030
Subhajit Ghosh <subhajit.ghosh@tweaklogic.com> wrote:
> Hi Jonathan,
> >>
> >>> +
> >>> +static struct iio_event_spec apds9306_event_spec_als[] = {
> >>> + {
> >>> + .type = IIO_EV_TYPE_THRESH,
> >>> + .dir = IIO_EV_DIR_RISING,
> >>> + .mask_shared_by_all = BIT(IIO_EV_INFO_VALUE),
> >>> + }, {
> >>> + .type = IIO_EV_TYPE_THRESH,
> >>> + .dir = IIO_EV_DIR_FALLING,
> >>> + .mask_shared_by_all = BIT(IIO_EV_INFO_VALUE),
> >>> + }, {
> >>> + .type = IIO_EV_TYPE_THRESH,
> >>> + .mask_shared_by_all = BIT(IIO_EV_INFO_PERIOD),
> >>> + }, {
> >>> + .type = IIO_EV_TYPE_THRESH_ADAPTIVE,
> >>> + .mask_shared_by_all = BIT(IIO_EV_INFO_VALUE) |
> >>> + BIT(IIO_EV_INFO_ENABLE),
> >>> + }, {
> >>> + .mask_separate = BIT(IIO_EV_INFO_ENABLE),
> >>
> >> What's the intent of this final entry?
> >> The type will default to IIO_EV_TYPE_THRESH anyway but if that
> >> the intent you should specify it. There isn't an 'obvious'
> >> default for type in the same way there sort of is for dir
> >> (as it's either direction).
> > Understood, let me experiment and see the ABI difference, if any and get back to you.
> >
> This device has two channels - ALS and CLEAR. One interrupt enable option and
> one Channel selection option (Clear or ALS). According to our previous discussions:
> https://lore.kernel.org/all/20230415183543.6d5e3392@jic23-huawei/
> the event_spec was updated to have two interrupt enable attributes - one for CLEAR and
> one for ALS. (Intensity channel and Illuminance channel)
>
> If I remove the final entry I am getting only one enable option (intensity channel):
> /sys/bus/iio/devices/iio:device0/
> |-- events
> | |-- in_intensity_clear_thresh_either_en
> | |-- thresh_adaptive_either_en
> | |-- thresh_adaptive_either_value
> | |-- thresh_adaptive_either_values_available
> | |-- thresh_either_period
> | |-- thresh_either_period_available
> | |-- thresh_falling_value
> | `-- thresh_rising_value
>
> The last entry gives be the following event attributes, enable attributes for both
> intensity and illuminance channels:
> /sys/bus/iio/devices/iio:device0/
> |-- events
> | |-- in_illuminance_thresh_either_en
> | |-- in_intensity_clear_thresh_either_en
> | |-- thresh_adaptive_either_en
> | |-- thresh_adaptive_either_value
> | |-- thresh_adaptive_either_values_available
> | |-- thresh_either_period
> | |-- thresh_either_period_available
> | |-- thresh_falling_value
> | `-- thresh_rising_value
>
> Please let me know if this sounds ok to you.
Looks like coincidence of enum values being 0.
It's really
{
.type = IIO_EV_TYPE_THRESH, /* Value 0 */
.dir = IIO_EV_DIR_EITHER, /* value 0 */
.mask_separate = BIT(IIO_EV_INFO_ENABLE),
Dropping 'defaults' for these things is fine if they are the obvious default
or other parameters mean they aren't used, but that isn't the case here so
please be explicit for all the values that are used.
You can put this final mask a few lines earlier as the other fields match
anyway.
{
.type = IIO_EV_TYPE_THRESH,
.dir = IIO_EV_DIR_EITHER,
.mask_shared_by_all = BIT(IIO_EV_INFO_PERIOD),
.mask_separate = BIT(IIO_EV_INFO_ENABLE),
},..
>
> Regards,
> Subhajit Ghosh
next prev parent reply other threads:[~2024-02-04 13:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-21 5:17 [PATCH v5 0/3] Support for Avago APDS9306 Ambient Light Sensor Subhajit Ghosh
2024-01-21 5:17 ` [PATCH v5 1/3] dt-bindings: iio: light: Squash APDS9300 and APDS9960 schemas Subhajit Ghosh
2024-01-21 15:27 ` Jonathan Cameron
2024-01-22 10:11 ` Subhajit Ghosh
2024-01-22 9:50 ` Krzysztof Kozlowski
2024-01-22 10:23 ` Subhajit Ghosh
2024-01-21 5:17 ` [PATCH v5 2/3] dt-bindings: iio: light: Avago APDS9306 Subhajit Ghosh
2024-01-21 15:36 ` Jonathan Cameron
2024-01-22 10:03 ` Subhajit Ghosh
2024-01-22 9:51 ` Krzysztof Kozlowski
2024-01-22 10:07 ` Subhajit Ghosh
2024-01-22 12:30 ` Krzysztof Kozlowski
2024-01-21 5:17 ` [PATCH v5 3/3] iio: light: Add support for APDS9306 Light Sensor Subhajit Ghosh
2024-01-21 9:22 ` Christophe JAILLET
2024-01-21 12:52 ` Andy Shevchenko
2024-01-22 11:42 ` Subhajit Ghosh
2024-01-22 11:39 ` Subhajit Ghosh
2024-01-21 15:23 ` Jonathan Cameron
2024-01-22 10:56 ` Subhajit Ghosh
2024-01-22 11:04 ` Jonathan Cameron
2024-01-22 11:48 ` Subhajit Ghosh
2024-02-04 11:23 ` Subhajit Ghosh
2024-02-04 13:40 ` Jonathan Cameron [this message]
2024-02-04 14:13 ` Subhajit Ghosh
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=20240204134056.5dc64e8b@jic23-huawei \
--to=jic23@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=anshulusr@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--cc=matt@ranostay.sg \
--cc=mazziesaccount@gmail.com \
--cc=robh+dt@kernel.org \
--cc=stefan.windfeldt-prytz@axis.com \
--cc=subhajit.ghosh@tweaklogic.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