Message ID | 20221110101241.10576-1-subhajit.ghosh@vixtechnology.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp61661wru; Thu, 10 Nov 2022 02:26:27 -0800 (PST) X-Google-Smtp-Source: AMsMyM798ISg8Vfz8zRebqKwAgZ7tnz+dR33ikig4C4oZ22IPwexD0q/lms45Y3sk/f8I7Fbcm6A X-Received: by 2002:a63:ec51:0:b0:46f:ed8d:7089 with SMTP id r17-20020a63ec51000000b0046fed8d7089mr39416511pgj.469.1668075987245; Thu, 10 Nov 2022 02:26:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668075987; cv=none; d=google.com; s=arc-20160816; b=Wu2m3cGqeNHL9BQ7aoEHzgT0xNstxpJYXP/y9SGdo8j5Ax0pnCL/QoxqF/BDl2GkEH SdratAPnJW0FWZBPaMWSBebCu0MNpHSMBeLV6xrpjR1lY8apXJJtI+zzHI8VnC4pL0DM OzNi48Yh1WHDfKCQz558/xXwFWolKg0+qJ2Hn+1SfJJUvxWG3oyDsGgmc/69HsprWoar jqA2Bi7Qx9mMd+9aPWC9xAN7fZtPTI+I6z9SzRxZ/B2evFjCx1zi6bzrR7QAEQgLIlKS weTu/2Q+1Opg3/3dSEWC++YPAcXSq8gfX4QIlDPT+5zJ8+odi6J3nFdaP7AdM7qRgfhr LI2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=74dqQiWyLQjEOzWoO3Lrynyy+auSFuDxVLH1zUULTMU=; b=lc7dN7+EG35LB6tq+JBBjvYkmkyWchaKrKdi5zBjGLEvld66hoSGvc/7fDlM2mQwY0 JsQcTpt2NEffygZT4mQpaYYOv2ubBYYG0nXqx7cZ8rSVlM1JyQsb/SJxfO8kW247Hqdb 60qCgIo+gd2Z6wQzrC/6W7eY9NNKoiN7l5LklslCpaE6sZE4evbkROP+wrhKVgDdblhu bE0KJ/ISkaEBcDrRaufb2z42ABVfTo7x1gRcABDYpGJ7F4WjAXzWn/MIW81n63yg5/VS GadQu/ul08ExQoI6dYLATTJRbd6b05Np+zJlkoryUoTSNUS9mov6mxk/VmnLewBp+0cb bOTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vixtechnology.com header.s=google header.b=T8GSEQH6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 134-20020a63018c000000b0046fcf7ac293si19378140pgb.767.2022.11.10.02.26.11; Thu, 10 Nov 2022 02:26:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vixtechnology.com header.s=google header.b=T8GSEQH6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229923AbiKJKNI (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Thu, 10 Nov 2022 05:13:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbiKJKNG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 10 Nov 2022 05:13:06 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A6B6E88 for <linux-kernel@vger.kernel.org>; Thu, 10 Nov 2022 02:13:01 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id t25-20020a1c7719000000b003cfa34ea516so3784950wmi.1 for <linux-kernel@vger.kernel.org>; Thu, 10 Nov 2022 02:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vixtechnology.com; s=google; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=74dqQiWyLQjEOzWoO3Lrynyy+auSFuDxVLH1zUULTMU=; b=T8GSEQH6ZHbWd8QVqxqpQ9ZUWHItXnpymEf1Jnd82S9OK467+z7t4NXF54DstpL3XI IxrLCrxuIVO1Q2MKKEcBmPcC63l+Mn9G7O6+ka6M/gZIdtIrx9nV2bquketNx/5NC17R rypjBAI6UrignKil62TaixvnOCsUerzq3FoFw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=74dqQiWyLQjEOzWoO3Lrynyy+auSFuDxVLH1zUULTMU=; b=zKIXc5mPQqmpN77YjdHQvu5gTTE5vXUVzbneQRT7i2XBwFfOa3PFGYJ0M0fivlIGqZ r2PswFjVGw/jOTmEYfEOOO8HV6N3bFXAhHAX/2vZIk2Vkki4wCSTnNuE7kR+lJGILlUf 2Hcr13QL4KJYHEwHDyeZ9SNqhPVqZ1iCamN92z4GAMgSCiHDkDlN77lxv4l7kD/WTGtN w6wF0npXaemw58cE5F1Z/WHofHFjnO02sQHLk3Hxjb+RhLmfrcnxxVgYVDbNO8S1hHgR wwQQYrvkh3x1w0H6jSh3ypJkNhTajNk4sc8NnTWwChSdPElPrkr+hX9JIawkxqfPJxkY SVdg== X-Gm-Message-State: ACrzQf2X1IQnRdS19veZKrL0VSsX7YY76H1Zla9fPBT++xgP/q69Y2ef uBFsJm1vj7BXDr4DCUYr2Y670f121Y4GfUIKXW9Wzf6jE/EGgGnqkMQQhJxgsdI79gbVTk5pRQt yEWMamluCyEjH4CdW1nM/rXLFt3I= X-Received: by 2002:a05:600c:3c82:b0:3b5:60a6:c80f with SMTP id bg2-20020a05600c3c8200b003b560a6c80fmr43691567wmb.199.1668075180017; Thu, 10 Nov 2022 02:13:00 -0800 (PST) Received: from subhajit-ThinkPad-Yoga-370.vix.local ([124.148.245.238]) by smtp.gmail.com with ESMTPSA id f17-20020a056000129100b002368a6deaf8sm15574055wrx.57.2022.11.10.02.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 02:12:59 -0800 (PST) From: Subhajit Ghosh <subhajit.ghosh@vixtechnology.com> To: matt.ranostay@konsulko.com, jic23@kernel.org, lars@metafoo.de, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: Subhajit Ghosh <subhajit.ghosh@vixtechnology.com> Subject: [PATCH] iio: light: apds9960: Fix iio_event_spec structures Date: Thu, 10 Nov 2022 18:12:41 +0800 Message-Id: <20221110101241.10576-1-subhajit.ghosh@vixtechnology.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749104446109145325?= X-GMAIL-MSGID: =?utf-8?q?1749104446109145325?= |
Series |
iio: light: apds9960: Fix iio_event_spec structures
|
|
Commit Message
Subhajit Ghosh
Nov. 10, 2022, 10:12 a.m. UTC
There is only one interrupt enable option for both ALS low and high
thresholds, and one for both Proximity low and high thresholds.
Signed-off-by: Subhajit Ghosh <subhajit.ghosh@vixtechnology.com>
---
drivers/iio/light/apds9960.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
Comments
On Thu, Nov 10, 2022 at 6:13 PM Subhajit Ghosh <subhajit.ghosh@vixtechnology.com> wrote: > > There is only one interrupt enable option for both ALS low and high > thresholds, and one for both Proximity low and high thresholds. > > Signed-off-by: Subhajit Ghosh <subhajit.ghosh@vixtechnology.com> > --- > drivers/iio/light/apds9960.c | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c > index 4141c0fa7bc4..df9ccbcf0ffe 100644 > --- a/drivers/iio/light/apds9960.c > +++ b/drivers/iio/light/apds9960.c > @@ -223,14 +223,16 @@ static const struct iio_event_spec apds9960_pxs_event_spec[] = { > { > .type = IIO_EV_TYPE_THRESH, > .dir = IIO_EV_DIR_RISING, > - .mask_separate = BIT(IIO_EV_INFO_VALUE) | > - BIT(IIO_EV_INFO_ENABLE), > + .mask_separate = BIT(IIO_EV_INFO_VALUE), Probably more concise to use the following, and you won't need to add an additional item to the structs. .mask_separate = BIT(IIO_EV_INFO_VALUE), .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE), > }, > { > .type = IIO_EV_TYPE_THRESH, > .dir = IIO_EV_DIR_FALLING, > - .mask_separate = BIT(IIO_EV_INFO_VALUE) | > - BIT(IIO_EV_INFO_ENABLE), > + .mask_separate = BIT(IIO_EV_INFO_VALUE), > + }, > + { > + .type = IIO_EV_TYPE_THRESH, > + .mask_separate = BIT(IIO_EV_INFO_ENABLE), Same here. - Matt > }, > }; > > @@ -238,14 +240,16 @@ static const struct iio_event_spec apds9960_als_event_spec[] = { > { > .type = IIO_EV_TYPE_THRESH, > .dir = IIO_EV_DIR_RISING, > - .mask_separate = BIT(IIO_EV_INFO_VALUE) | > - BIT(IIO_EV_INFO_ENABLE), > + .mask_separate = BIT(IIO_EV_INFO_VALUE), > }, > { > .type = IIO_EV_TYPE_THRESH, > .dir = IIO_EV_DIR_FALLING, > - .mask_separate = BIT(IIO_EV_INFO_VALUE) | > - BIT(IIO_EV_INFO_ENABLE), > + .mask_separate = BIT(IIO_EV_INFO_VALUE), > + }, > + { > + .type = IIO_EV_TYPE_THRESH, > + .mask_separate = BIT(IIO_EV_INFO_ENABLE), > }, > }; > > -- > 2.34.1 > > > -- > This email is confidential. If you have received this email in error please > notify us immediately by return email and delete this email and any > attachments. Vix accepts no liability for any damage caused by this email > or any attachments due to viruses, interference, interception, corruption > or unauthorised access.
>> .type = IIO_EV_TYPE_THRESH, >> .dir = IIO_EV_DIR_RISING, >> - .mask_separate = BIT(IIO_EV_INFO_VALUE) | >> - BIT(IIO_EV_INFO_ENABLE), >> + .mask_separate = BIT(IIO_EV_INFO_VALUE), > > Probably more concise to use the following, and you won't need to add > an additional item to the structs. > > .mask_separate = BIT(IIO_EV_INFO_VALUE), > .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE), > Above is the first thing I tried. Current implementation: root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ in_intensity_clear_thresh_falling_en in_intensity_clear_thresh_falling_value in_intensity_clear_thresh_rising_en in_intensity_clear_thresh_rising_value in_proximity_thresh_falling_en in_proximity_thresh_falling_value in_proximity_thresh_rising_en in_proximity_thresh_rising_value First method (Which you are suggesting): .mask_separate = BIT(IIO_EV_INFO_VALUE), .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE), root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ in_intensity_clear_thresh_falling_value in_intensity_clear_thresh_rising_value in_intensity_thresh_falling_en in_intensity_thresh_rising_en The above says all channels with with the type IIO_INTENSITY has the same enable but we require this particular channel (in_intensity_clear) regardless of direction to have the same enable. Using mask_shared_by_dir and mask_shared_by_all does not provide the logical attribute name. This patch provides the below: root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ in_intensity_clear_thresh_either_en in_intensity_clear_thresh_falling_value in_intensity_clear_thresh_rising_value in_proximity_thresh_either_en in_proximity_thresh_falling_value in_proximity_thresh_rising_value Verified using iio_event_monitor: root@stm32mp1:~# ./iio_event_monitor /dev/iio:device0 Event: time: 1647143384807582753, type: proximity, channel: 0, evtype: thresh, direction: either Regards Subhajit Ghosh
On Thu, Nov 10, 2022 at 10:45 PM Subhajit Ghosh <subhajit.ghosh@vixtechnology.com> wrote: > > > >> .type = IIO_EV_TYPE_THRESH, > >> .dir = IIO_EV_DIR_RISING, > >> - .mask_separate = BIT(IIO_EV_INFO_VALUE) | > >> - BIT(IIO_EV_INFO_ENABLE), > >> + .mask_separate = BIT(IIO_EV_INFO_VALUE), > > > > Probably more concise to use the following, and you won't need to add > > an additional item to the structs. > > > > .mask_separate = BIT(IIO_EV_INFO_VALUE), > > .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE), > > > > Above is the first thing I tried. > > Current implementation: > > root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ > in_intensity_clear_thresh_falling_en > in_intensity_clear_thresh_falling_value > in_intensity_clear_thresh_rising_en > in_intensity_clear_thresh_rising_value > > in_proximity_thresh_falling_en > in_proximity_thresh_falling_value > in_proximity_thresh_rising_en > in_proximity_thresh_rising_value > > > First method (Which you are suggesting): > .mask_separate = BIT(IIO_EV_INFO_VALUE), > .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE), > > root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ > in_intensity_clear_thresh_falling_value > in_intensity_clear_thresh_rising_value > in_intensity_thresh_falling_en > in_intensity_thresh_rising_en > > The above says all channels with with the type IIO_INTENSITY has > the same enable but we require this particular channel (in_intensity_clear) > regardless of direction to have the same enable. > Using mask_shared_by_dir and mask_shared_by_all does not provide the logical > attribute name. > > > This patch provides the below: > > root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ > in_intensity_clear_thresh_either_en > in_intensity_clear_thresh_falling_value > in_intensity_clear_thresh_rising_value > > in_proximity_thresh_either_en > in_proximity_thresh_falling_value > in_proximity_thresh_rising_value > > Verified using iio_event_monitor: > > root@stm32mp1:~# ./iio_event_monitor /dev/iio:device0 > Event: time: 1647143384807582753, type: proximity, channel: 0, evtype: thresh, direction: either > Hmm maybe Jonathan will have some feedback on this (and if it is okay to break the ABI interface). Been awhile since I've touched this driver and a little rusty on iio events. But I am guessing your method makes sense since the event(s) has direction and a type, and can't just have one of the .mask_shared_by_dir and mask_shared_by_type. In any case: Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> - Matt > > Regards > Subhajit Ghosh > > -- > This email is confidential. If you have received this email in error please > notify us immediately by return email and delete this email and any > attachments. Vix accepts no liability for any damage caused by this email > or any attachments due to viruses, interference, interception, corruption > or unauthorised access.
>> > > Hmm maybe Jonathan will have some feedback on this (and if it is okay > to break the ABI interface). Been awhile since I've touched > this driver and a little rusty on iio events. But I am guessing your > method makes sense since the event(s) has direction and a type, and > can't just have one of the .mask_shared_by_dir and mask_shared_by_type. > > In any case: > > Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> > Thank you so much for your time and review Matt. Apologies for the company disclaimer message which auto generates after the message body. I am still working on proper submission skills. Regards, Subhajit Ghosh
On Fri, 11 Nov 2022 10:50:35 +0800 Matt Ranostay <matt.ranostay@konsulko.com> wrote: > On Thu, Nov 10, 2022 at 10:45 PM Subhajit Ghosh > <subhajit.ghosh@vixtechnology.com> wrote: > > > > > > >> .type = IIO_EV_TYPE_THRESH, > > >> .dir = IIO_EV_DIR_RISING, > > >> - .mask_separate = BIT(IIO_EV_INFO_VALUE) | > > >> - BIT(IIO_EV_INFO_ENABLE), > > >> + .mask_separate = BIT(IIO_EV_INFO_VALUE), > > > > > > Probably more concise to use the following, and you won't need to add > > > an additional item to the structs. > > > > > > .mask_separate = BIT(IIO_EV_INFO_VALUE), > > > .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE), > > > > > > > Above is the first thing I tried. > > > > Current implementation: > > > > root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ > > in_intensity_clear_thresh_falling_en > > in_intensity_clear_thresh_falling_value > > in_intensity_clear_thresh_rising_en > > in_intensity_clear_thresh_rising_value > > > > in_proximity_thresh_falling_en > > in_proximity_thresh_falling_value > > in_proximity_thresh_rising_en > > in_proximity_thresh_rising_value > > > > > > First method (Which you are suggesting): > > .mask_separate = BIT(IIO_EV_INFO_VALUE), > > .mask_shared_by_type = BIT(IIO_EV_INFO_ENABLE), > > > > root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ > > in_intensity_clear_thresh_falling_value > > in_intensity_clear_thresh_rising_value > > in_intensity_thresh_falling_en > > in_intensity_thresh_rising_en > > > > The above says all channels with with the type IIO_INTENSITY has > > the same enable but we require this particular channel (in_intensity_clear) > > regardless of direction to have the same enable. > > Using mask_shared_by_dir and mask_shared_by_all does not provide the logical > > attribute name. > > > > > > This patch provides the below: > > > > root@stm32mp1:~# ls -1 /sys/bus/iio/devices/iio:device0/events/ > > in_intensity_clear_thresh_either_en > > in_intensity_clear_thresh_falling_value > > in_intensity_clear_thresh_rising_value > > > > in_proximity_thresh_either_en > > in_proximity_thresh_falling_value > > in_proximity_thresh_rising_value > > > > Verified using iio_event_monitor: > > > > root@stm32mp1:~# ./iio_event_monitor /dev/iio:device0 > > Event: time: 1647143384807582753, type: proximity, channel: 0, evtype: thresh, direction: either > > > > Hmm maybe Jonathan will have some feedback on this (and if it is okay > to break the ABI interface). Been awhile since I've touched > this driver and a little rusty on iio events. But I am guessing your > method makes sense since the event(s) has direction and a type, and > can't just have one of the .mask_shared_by_dir and mask_shared_by_type. > > In any case: > > Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> Hmm. Given that event enables often cover a couple of different things (as done here) it isn't unknown for those to not be as easily covered as you have done. As such, we have drivers were the ABI allows for enabling one event to end up enabling several others (even though they have separate enable attributes). It's always been permitted for one IIO attribute write to have an effect on other attributes simply because we can't represent all dependencies. Now the bigger complexity / surprise here is the return of the either direction in response to enabling either rising or falling. That is going to rather surprise your average writer of userspace code. So patch covers what we should definitely have had in the first place. Hence it's a question of risk of someone running code that will be affected by the ABI change. One of those fingers crossed moments... Jonathan > > > - Matt > > > > > Regards > > Subhajit Ghosh > > > > -- > > This email is confidential. If you have received this email in error please > > notify us immediately by return email and delete this email and any > > attachments. Vix accepts no liability for any damage caused by this email > > or any attachments due to viruses, interference, interception, corruption > > or unauthorised access.
> Hmm. Given that event enables often cover a couple of different things > (as done here) it isn't unknown for those to not be as easily covered > as you have done. As such, we have drivers were the ABI allows for > enabling one event to end up enabling several others (even though they > have separate enable attributes). It's always been permitted for one > IIO attribute write to have an effect on other attributes simply because > we can't represent all dependencies. > > Now the bigger complexity / surprise here is the return of the either > direction in response to enabling either rising or falling. > That is going to rather surprise your average writer of userspace cod This is where the inconsistency was found. When an ALS threshold rising value was given and as soon as it was enabled, interrupts started firing in low light conditions as there was some value present in the ALS falling threshold(reset value is not defined in the datasheet for this register), but falling threshold value was neither fed nor enabled! > So patch covers what we should definitely have had in the first place. > Hence it's a question of risk of someone running code that will be affected > by the ABI change. One of those fingers crossed moments... I understand that breaking existing userspace applications is not the best thing to do. > > Jonathan Thank you for your time and comments. Regards, Subhajit Ghosh
On Fri, 11 Nov 2022 21:44:48 +0800 Subhajit Ghosh <subhajit.ghosh@vixtechnology.com> wrote: > > Hmm. Given that event enables often cover a couple of different things > > (as done here) it isn't unknown for those to not be as easily covered > > as you have done. As such, we have drivers were the ABI allows for > > enabling one event to end up enabling several others (even though they > > have separate enable attributes). It's always been permitted for one > > IIO attribute write to have an effect on other attributes simply because > > we can't represent all dependencies. > > > > Now the bigger complexity / surprise here is the return of the either > > direction in response to enabling either rising or falling. > > That is going to rather surprise your average writer of userspace cod This is where the inconsistency was found. When an ALS threshold rising > value was given and as soon as it was enabled, interrupts started firing > in low light conditions as there was some value present in the ALS falling > threshold(reset value is not defined in the datasheet for this register), > but falling threshold value was neither fed nor enabled! > > > So patch covers what we should definitely have had in the first place. > > Hence it's a question of risk of someone running code that will be affected > > by the ABI change. One of those fingers crossed moments... > I understand that breaking existing userspace applications is not the best > thing to do. Given the risks around this one, I'm going to apply it to the togreg branch of iio.git which is lined up for next merge cycle. That should in theory provide more time before it hits upstream / gets back ported to stable releases for people to notice the change. Hopefully no one will though! Applied to the togreg branch of iio.git and pushed out initially as testing to let 0-day poke at it. Thanks, Jonathan > > > > > Jonathan > > Thank you for your time and comments. > > Regards, > Subhajit Ghosh >
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c index 4141c0fa7bc4..df9ccbcf0ffe 100644 --- a/drivers/iio/light/apds9960.c +++ b/drivers/iio/light/apds9960.c @@ -223,14 +223,16 @@ static const struct iio_event_spec apds9960_pxs_event_spec[] = { { .type = IIO_EV_TYPE_THRESH, .dir = IIO_EV_DIR_RISING, - .mask_separate = BIT(IIO_EV_INFO_VALUE) | - BIT(IIO_EV_INFO_ENABLE), + .mask_separate = BIT(IIO_EV_INFO_VALUE), }, { .type = IIO_EV_TYPE_THRESH, .dir = IIO_EV_DIR_FALLING, - .mask_separate = BIT(IIO_EV_INFO_VALUE) | - BIT(IIO_EV_INFO_ENABLE), + .mask_separate = BIT(IIO_EV_INFO_VALUE), + }, + { + .type = IIO_EV_TYPE_THRESH, + .mask_separate = BIT(IIO_EV_INFO_ENABLE), }, }; @@ -238,14 +240,16 @@ static const struct iio_event_spec apds9960_als_event_spec[] = { { .type = IIO_EV_TYPE_THRESH, .dir = IIO_EV_DIR_RISING, - .mask_separate = BIT(IIO_EV_INFO_VALUE) | - BIT(IIO_EV_INFO_ENABLE), + .mask_separate = BIT(IIO_EV_INFO_VALUE), }, { .type = IIO_EV_TYPE_THRESH, .dir = IIO_EV_DIR_FALLING, - .mask_separate = BIT(IIO_EV_INFO_VALUE) | - BIT(IIO_EV_INFO_ENABLE), + .mask_separate = BIT(IIO_EV_INFO_VALUE), + }, + { + .type = IIO_EV_TYPE_THRESH, + .mask_separate = BIT(IIO_EV_INFO_ENABLE), }, };