Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3433104rwe; Mon, 29 Aug 2022 11:36:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR6KoZE+Fq4FPvNKtZnsSsp2OrtWr5FFrTlnsCwwlzTziBisekbsaC0YteGfQ6d5rtpQYYJ1 X-Received: by 2002:a17:902:ef95:b0:174:3bad:6560 with SMTP id iz21-20020a170902ef9500b001743bad6560mr17125384plb.109.1661798171896; Mon, 29 Aug 2022 11:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661798171; cv=none; d=google.com; s=arc-20160816; b=xc7BrpNk+4ZEIlm9Wng60NL4R+MQwtaRtxQY1+kbZn+dsIqCRilyoru23rXoIWTStB NhS29C0E2hHubzhR0DOivfegOEkqlnv6k1vMmS1D4WxfFC3HwkMSZ08dubnu+7dydqaP MvD0RhUQysMSf9p6gXlVxzbO1faeemO4NIvx/3xY2nHMrnTa7WGsTC6umthThNDi//n0 ktZS9Pk7xy1Xsn9/JLsmld+lI16MGzpE0paNA0FRUsa3jUO4s3rOY2lRvNAfpXpiyljy 2t3uZK3bBCTTK3b3jh1Jcpck7yNeFdmf6Cec1XksFn99UUUhTvAH+1IWdLB5pPgWQ7/r cU0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=qdDb9tWzMIRUUOu1womGdW8Ris4uNbk5SDgfso9s5R0=; b=o03J7EKNXjn12a3XFyje9JaL4Xs4qn4+ibswN5aix3IeaYXNJAi0Qf2fd2I5AMZdMj FhYciQsMglJt6DiDTes0JfvyShPlAhp5g2R40CRKcz7SLEYeUC9M/b+H0Cm9CT8dQMxu 6ZF9HQl8jaJg7doMy+fP+VSLFum/KVOzeXVj/j+uJqNlHKzbeDeX0qF6rFvap59QuR9I HGK+C70WALAD7Vp+6xLeUaZ22/omlmQOyFIfh8MVQEMKPwKnv6IujfWDmW0MfqI3Yh8Z 50AVGKF+gLGt736zFStnnrlH/zqcYTJsuDSJGyj6IvDIg/Dz5Hx7kr/S0CetShkMO7kY UFeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=afDem3it; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a056a00230f00b00536009c81b7si10115740pfh.148.2022.08.29.11.36.00; Mon, 29 Aug 2022 11:36:11 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=afDem3it; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230491AbiH2RZl (ORCPT + 99 others); Mon, 29 Aug 2022 13:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbiH2RZg (ORCPT ); Mon, 29 Aug 2022 13:25:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DEAD4C608; Mon, 29 Aug 2022 10:25:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C7FA8B8119D; Mon, 29 Aug 2022 17:25:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB40BC433C1; Mon, 29 Aug 2022 17:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661793929; bh=9OEgeUDCfTi9FzYK0R6gTerji4mpgeD8bhEZsF5KzR8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=afDem3itAZHSy7KJzrY90B4UEoilNN1Lctj4Zaur3HrwS2OLzyWjBIt2tsylnVhFZ 8QLmkL4dNJ4h4xbsS7tOMe5VRpMcMt31J4PkN53EqaLNNmftKgPqeBXA9XsqvsPpLC xH6+R61FfqyhRwRNJ7ALvFFYoN7C3wY2wQ7iuXjnUOrPGKck0Wa/kGUEGhodRRTP48 vmMbZ5klkGXBQhJTWKLwhAOzplrYTIy9f/eObujF3P4xZvG7H1Wews8Xv528HbBcz1 Juq1teDCxB89eHFPy8wIngG3+MGJ0HRZZhds5tqsfaEhv/3qVDjs434l412tjjqEIk LTRKpAt1ryj3Q== Date: Mon, 29 Aug 2022 17:51:09 +0100 From: Jonathan Cameron To: Jagath Jog J Cc: andy.shevchenko@gmail.com, hadess@hadess.net, hdegoede@redhat.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/2] iio: Add new event type gesture and use direction for single and double tap Message-ID: <20220829175109.7e0544ee@jic23-huawei> In-Reply-To: <20220825194604.15645-2-jagathjog1996@gmail.com> References: <20220825194604.15645-1-jagathjog1996@gmail.com> <20220825194604.15645-2-jagathjog1996@gmail.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Aug 2022 01:16:03 +0530 Jagath Jog J wrote: > Add new event type for tap called gesture and the direction can be used > to differentiate single and double tap. This may be used by accelerometer > sensors to express single and double tap events. For directional tap, > modifiers like IIO_MOD_(X/Y/Z) can be used along with singletap and > doubletap direction. > > Signed-off-by: Jagath Jog J LGTM though I'm still keen for more review on this, particularly with an eye on generality. J > --- > Documentation/ABI/testing/sysfs-bus-iio | 69 +++++++++++++++++++++++++ > drivers/iio/industrialio-event.c | 7 ++- > include/linux/iio/types.h | 2 + > include/uapi/linux/iio/types.h | 3 ++ > tools/iio/iio_event_monitor.c | 8 ++- > 5 files changed, 87 insertions(+), 2 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio > index e81ba6f5e1c8..4035173030b7 100644 > --- a/Documentation/ABI/testing/sysfs-bus-iio > +++ b/Documentation/ABI/testing/sysfs-bus-iio > @@ -2038,3 +2038,72 @@ Description: > Available range for the forced calibration value, expressed as: > > - a range specified as "[min step max]" > + > +What: /sys/.../events/in_accel_gesture_singletap_en > +What: /sys/.../events/in_accel_gesture_doubletap_en > +KernelVersion: 6.1 > +Contact: linux-iio@vger.kernel.org > +Description: > + Device generates an event on a single or double tap. > + > +What: /sys/.../events/in_accel_gesture_singletap_value > +What: /sys/.../events/in_accel_gesture_doubletap_value > +KernelVersion: 6.1 > +Contact: linux-iio@vger.kernel.org > +Description: > + Specifies the threshold value that the device is comparing > + against to generate the tap gesture event. The lower > + threshold value increases the sensitivity of tap detection. > + Units and the exact meaning of value are device-specific. > + > +What: /sys/.../events/in_accel_gesture_tap_value_available > +KernelVersion: 6.1 > +Contact: linux-iio@vger.kernel.org > +Description: > + Lists all available threshold values which can be used to > + modify the sensitivity of the tap detection. > + > +What: /sys/.../events/in_accel_gesture_singletap_reset_timeout > +What: /sys/.../events/in_accel_gesture_doubletap_reset_timeout > +KernelVersion: 6.1 > +Contact: linux-iio@vger.kernel.org > +Description: > + Specifies the timeout value in seconds for the tap detector > + to not to look for another tap event after the event as > + occurred. Basically the minimum quiet time between the two > + single-tap's or two double-tap's. > + > +What: /sys/.../events/in_accel_gesture_tap_reset_timeout_available > +KernelVersion: 6.1 > +Contact: linux-iio@vger.kernel.org > +Description: > + Lists all available tap reset timeout values. Units in seconds. > + > +What: /sys/.../events/in_accel_gesture_doubletap_tap2_min_delay > +KernelVersion: 6.1 > +Contact: linux-iio@vger.kernel.org > +Description: > + Specifies the minimum quiet time in seconds between the two > + taps of a double tap. > + > +What: /sys/.../events/in_accel_gesture_doubletap_tap2_min_delay_available > +KernelVersion: 6.1 > +Contact: linux-iio@vger.kernel.org > +Description: > + Lists all available delay values between two taps in the double > + tap. Units in seconds. > + > +What: /sys/.../events/in_accel_gesture_tap_maxtomin_time > +KernelVersion: 6.1 > +Contact: linux-iio@vger.kernel.org > +Description: > + Specifies the maximum time difference allowed between upper > + and lower peak of tap to consider it as the valid tap event. > + Units in seconds. > + > +What: /sys/.../events/in_accel_gesture_tap_maxtomin_time_available > +KernelVersion: 6.1 > +Contact: linux-iio@vger.kernel.org > +Description: > + Lists all available time values between upper peak to lower > + peak. Units in seconds. > diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c > index b5e059e15b0a..65ef0fc3be23 100644 > --- a/drivers/iio/industrialio-event.c > +++ b/drivers/iio/industrialio-event.c > @@ -231,12 +231,15 @@ static const char * const iio_ev_type_text[] = { > [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive", > [IIO_EV_TYPE_CHANGE] = "change", > [IIO_EV_TYPE_MAG_REFERENCED] = "mag_referenced", > + [IIO_EV_TYPE_GESTURE] = "gesture", > }; > > static const char * const iio_ev_dir_text[] = { > [IIO_EV_DIR_EITHER] = "either", > [IIO_EV_DIR_RISING] = "rising", > - [IIO_EV_DIR_FALLING] = "falling" > + [IIO_EV_DIR_FALLING] = "falling", > + [IIO_EV_DIR_SINGLETAP] = "singletap", > + [IIO_EV_DIR_DOUBLETAP] = "doubletap", > }; > > static const char * const iio_ev_info_text[] = { > @@ -247,6 +250,8 @@ static const char * const iio_ev_info_text[] = { > [IIO_EV_INFO_HIGH_PASS_FILTER_3DB] = "high_pass_filter_3db", > [IIO_EV_INFO_LOW_PASS_FILTER_3DB] = "low_pass_filter_3db", > [IIO_EV_INFO_TIMEOUT] = "timeout", > + [IIO_EV_INFO_RESET_TIMEOUT] = "reset_timeout", > + [IIO_EV_INFO_TAP2_MIN_DELAY] = "tap2_min_delay", > }; > > static enum iio_event_direction iio_ev_attr_dir(struct iio_dev_attr *attr) > diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h > index a7aa91f3a8dc..4716a4b3d614 100644 > --- a/include/linux/iio/types.h > +++ b/include/linux/iio/types.h > @@ -17,6 +17,8 @@ enum iio_event_info { > IIO_EV_INFO_HIGH_PASS_FILTER_3DB, > IIO_EV_INFO_LOW_PASS_FILTER_3DB, > IIO_EV_INFO_TIMEOUT, > + IIO_EV_INFO_RESET_TIMEOUT, > + IIO_EV_INFO_TAP2_MIN_DELAY, > }; > > #define IIO_VAL_INT 1 > diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h > index 472cead10d8d..913864221ac4 100644 > --- a/include/uapi/linux/iio/types.h > +++ b/include/uapi/linux/iio/types.h > @@ -105,6 +105,7 @@ enum iio_event_type { > IIO_EV_TYPE_MAG_ADAPTIVE, > IIO_EV_TYPE_CHANGE, > IIO_EV_TYPE_MAG_REFERENCED, > + IIO_EV_TYPE_GESTURE, > }; > > enum iio_event_direction { > @@ -112,6 +113,8 @@ enum iio_event_direction { > IIO_EV_DIR_RISING, > IIO_EV_DIR_FALLING, > IIO_EV_DIR_NONE, > + IIO_EV_DIR_SINGLETAP, > + IIO_EV_DIR_DOUBLETAP, > }; > > #endif /* _UAPI_IIO_TYPES_H_ */ > diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c > index 2f4581658859..b3b3ea399f67 100644 > --- a/tools/iio/iio_event_monitor.c > +++ b/tools/iio/iio_event_monitor.c > @@ -69,12 +69,15 @@ static const char * const iio_ev_type_text[] = { > [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive", > [IIO_EV_TYPE_CHANGE] = "change", > [IIO_EV_TYPE_MAG_REFERENCED] = "mag_referenced", > + [IIO_EV_TYPE_GESTURE] = "gesture", > }; > > static const char * const iio_ev_dir_text[] = { > [IIO_EV_DIR_EITHER] = "either", > [IIO_EV_DIR_RISING] = "rising", > - [IIO_EV_DIR_FALLING] = "falling" > + [IIO_EV_DIR_FALLING] = "falling", > + [IIO_EV_DIR_SINGLETAP] = "singletap", > + [IIO_EV_DIR_DOUBLETAP] = "doubletap", > }; > > static const char * const iio_modifier_names[] = { > @@ -227,6 +230,7 @@ static bool event_is_known(struct iio_event_data *event) > case IIO_EV_TYPE_THRESH_ADAPTIVE: > case IIO_EV_TYPE_MAG_ADAPTIVE: > case IIO_EV_TYPE_CHANGE: > + case IIO_EV_TYPE_GESTURE: > break; > default: > return false; > @@ -236,6 +240,8 @@ static bool event_is_known(struct iio_event_data *event) > case IIO_EV_DIR_EITHER: > case IIO_EV_DIR_RISING: > case IIO_EV_DIR_FALLING: > + case IIO_EV_DIR_SINGLETAP: > + case IIO_EV_DIR_DOUBLETAP: > case IIO_EV_DIR_NONE: > break; > default: