Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5518rwp; Wed, 12 Jul 2023 08:57:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlH+WyiNoq3CPh1zwYro60jyjiECsNe7TiR8z3Kyh1npeWkByGNQnRLiNV19N6pjFeuHu3LL X-Received: by 2002:a05:6a20:1c6:b0:12f:dc60:4817 with SMTP id 6-20020a056a2001c600b0012fdc604817mr15388004pzz.47.1689177420005; Wed, 12 Jul 2023 08:57:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689177419; cv=none; d=google.com; s=arc-20160816; b=Xmxv97odKxcEOhm+Xobdhtdh4HxWISfcmVGs/skbO8WKCUX8uS46n0ulMsbq7CDIr0 VrHD9BX/5fdKXQrv8tpAVNLMQg8ZBqgNSGXSD9tetEEFTcUOLHzCFm4yLY+aNtMbK9NM 3RDW6ibGV5ay5TeB9x5l3A8qiqreq1B8AbtPOb0+BH926o+jve7BWaKw7mjYzn9504al +KMRqc3N9rGHomNf7SggK8crBlxyw22VT5S4kaA8hb3Jp6EhRM90ZrBD0BBZ7t5Z5dLJ uitioQ/cxIxNFq/2ljapRdoANznY6PdMP0GW9Kc8vc6Z2D7V+4fDp4r/jq5h3fB1GLU+ GzRA== 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:in-reply-to:subject :cc:to:from:user-agent:references:dkim-signature; bh=rwAJJHUO0JnZisxLO3+eFKnrpeHeVsnZgdBx2AOpPlA=; fh=ftIB+k+CYHfLUAU/a4e0Loa51Tj4ciVRtUnwPKg5ZEw=; b=T4y22UR0cVwoplyJoLTo0RUzFU38UBfg18tHG2p3rgimg5Zh/u9Gxjx4en+IYOJw2E YxvgXrTb50MPQgl9FuRqwCGrYyJsMKiqzUZh7EoXsn/znonKNmV6hQRjbSGhk1WX4x+y PoeVvrMS5OlFCR0dD08GjZt3VSXJBbZv175z9lsuX8ENnCyXKwGe6+lTwoiJp1l8Xd8U 0aB4WnRxyuDGs9er4w5VLvNOmce63956kiEMqH//NU3DX9gy1ZXSCIvbt+5SWkK0I6tl ot5AVUbllr+vdWyuxDMItp0Bqmsrkz6zN6oHHKHDTzURZfH2nGzSXzAONE4YbKeP1h0g hGqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=NQ6s4KOj; 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=axis.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z68-20020a636547000000b0055ba896ec95si3365360pgb.779.2023.07.12.08.56.47; Wed, 12 Jul 2023 08:56:59 -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 (test mode) header.i=@axis.com header.s=axis-central1 header.b=NQ6s4KOj; 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=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233638AbjGLP2N (ORCPT + 99 others); Wed, 12 Jul 2023 11:28:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233572AbjGLP2I (ORCPT ); Wed, 12 Jul 2023 11:28:08 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 944A71BD5; Wed, 12 Jul 2023 08:28:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1689175688; x=1720711688; h=references:from:to:cc:subject:in-reply-to:date: message-id:mime-version; bh=rwAJJHUO0JnZisxLO3+eFKnrpeHeVsnZgdBx2AOpPlA=; b=NQ6s4KOjUS5ga4u+fH6m5CmRjglX2vF2+/ngr+g0pucYk6hI4J5dcIVM 8og+YZ9SU3q4TI2Vh1+Tk3xQx73bTn3BkPGkb2vzDEc64vOlxrHJaF1YY Hs8HWtIrziXLxoaLt7iH2oVH0E5XYCpZ1u0qrAXfq3HKKUoU2oqFciEnU BC2XurzRQyiv3vUKAW2ABbDKl55yoABeY6PQNVEgwz5/fZQ2gCsHEgMpw tCInreteLoh70i+G9NegVWtlNuI4bhWWgAQWKNDSlGA9UwXlCntbfXeS9 MZjTKx+4Rw1uKjpYcdpT2bx/HDVsAMQs31rPYZ0lonAm4uvo8RoIy/xAl g==; References: User-agent: a.out From: Waqar Hameed To: Jonathan Cameron , Lars-Peter Clausen CC: , , Subject: [PATCH v2 2/3] iio: Add event enums for running period and count In-Reply-To: Date: Wed, 12 Jul 2023 17:12:16 +0200 Message-ID: <206111caec7e4a8ae0e7628fb49b9ac295097177.1689174736.git.waqar.hameed@axis.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.5.60] X-ClientProxiedBy: se-mail01w.axis.com (10.20.40.7) To se-mail01w.axis.com (10.20.40.7) 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_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 There are devices (such as Murata IRS-D200 PIR proximity sensor) that check the data signal with a running period. I.e. for a specified time, they count the number of conditions that have occurred, and then signal if that is more than a specified amount. `IIO_EV_INFO_PERIOD` resets when the condition no longer is true and is therefore not suitable for these devices. Add a new `iio_event_info` `IIO_EV_INFO_RUNNING_PERIOD` that can be used as a running period. Also add a new `IIO_EV_INFO_RUNNING_COUNT` that can be used to specify the number of conditions that must occur during this running period. Signed-off-by: Waqar Hameed --- Documentation/ABI/testing/sysfs-bus-iio | 16 ++++++++++++++++ drivers/iio/industrialio-event.c | 2 ++ include/linux/iio/types.h | 2 ++ 3 files changed, 20 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index 7140e8e7313f..a2854dc9a839 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -2163,3 +2163,19 @@ Contact: linux-iio@vger.kernel.org Description: An example format is 16-bytes, 2-digits-per-byte, HEX-string representing the sensor unique ID number. + +What: /sys/.../events/in_proximity_thresh_either_runningperiod +KernelVersion: 6.6 +Contact: linux-iio@vger.kernel.org +Description: + A running period of time (in seconds) for which + in_proximity_thresh_either_runningcount amount of conditions + must occur before an event is generated. If direction is not + specified then this period applies to both directions. + +What: /sys/.../events/in_proximity_thresh_either_runningcount +KernelVersion: 6.6 +Contact: linux-iio@vger.kernel.org +Description: + Number of conditions that must occur, during a running + period, before an event is generated. diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index f77ce49d4c36..19f7a91157ee 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c @@ -252,6 +252,8 @@ static const char * const iio_ev_info_text[] = { [IIO_EV_INFO_TIMEOUT] = "timeout", [IIO_EV_INFO_RESET_TIMEOUT] = "reset_timeout", [IIO_EV_INFO_TAP2_MIN_DELAY] = "tap2_min_delay", + [IIO_EV_INFO_RUNNING_PERIOD] = "runningperiod", + [IIO_EV_INFO_RUNNING_COUNT] = "runningcount", }; 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 82faa98c719a..117bde7d6ad7 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h @@ -19,6 +19,8 @@ enum iio_event_info { IIO_EV_INFO_TIMEOUT, IIO_EV_INFO_RESET_TIMEOUT, IIO_EV_INFO_TAP2_MIN_DELAY, + IIO_EV_INFO_RUNNING_PERIOD, + IIO_EV_INFO_RUNNING_COUNT, }; #define IIO_VAL_INT 1 -- 2.30.2