[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ad24703e-a1b8-4027-90df-bb6aef62058d@tweaklogic.com>
Date: Mon, 5 Feb 2024 00:43:13 +1030
From: Subhajit Ghosh <subhajit.ghosh@...aklogic.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Lars-Peter Clausen <lars@...afoo.de>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Matti Vaittinen <mazziesaccount@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Marek Vasut <marex@...x.de>, Anshul Dalal <anshulusr@...il.com>,
Javier Carrasco <javier.carrasco.cruz@...il.com>,
Matt Ranostay <matt@...ostay.sg>,
Stefan Windfeldt-Prytz <stefan.windfeldt-prytz@...s.com>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 3/3] iio: light: Add support for APDS9306 Light Sensor
On 5/2/24 00:10, Jonathan Cameron wrote:
> On Sun, 4 Feb 2024 21:53:55 +1030
> Subhajit Ghosh <subhajit.ghosh@...aklogic.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)
>>
..
>>
>> 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),
> },..
>
Thank you Jonathan. The above works as intended.
Regards,
Subhajit Ghosh
Powered by blists - more mailing lists