devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
To: Jonathan Cameron <jic23@kernel.org>
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: Mon, 5 Feb 2024 00:43:13 +1030	[thread overview]
Message-ID: <ad24703e-a1b8-4027-90df-bb6aef62058d@tweaklogic.com> (raw)
In-Reply-To: <20240204134056.5dc64e8b@jic23-huawei>

On 5/2/24 00:10, Jonathan Cameron wrote:
> 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)
>>
...
>>
>> 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


      reply	other threads:[~2024-02-04 14:14 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
2024-02-04 14:13           ` Subhajit Ghosh [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=ad24703e-a1b8-4027-90df-bb6aef62058d@tweaklogic.com \
    --to=subhajit.ghosh@tweaklogic.com \
    --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=jic23@kernel.org \
    --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 \
    /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).