Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4419424rwb; Tue, 20 Sep 2022 13:43:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47fvyCqMGsaYor0aJUe1TsRBMSkGM0BsdrzhE28Q8AGS0fqnam904Z36WdTgY2XesTROfp X-Received: by 2002:a17:90a:d50b:b0:200:76c6:9cef with SMTP id t11-20020a17090ad50b00b0020076c69cefmr5948290pju.232.1663706595149; Tue, 20 Sep 2022 13:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663706595; cv=none; d=google.com; s=arc-20160816; b=JSX4RVeF8nu3efl9E3MOF1TkzrJpC2cRkysFMS+o3V6e9w7a9xTlKbUV5Hv7xtRU8e wmXOaUJRe4hJotokhEzr6BphFL2tEpfGIyJHSAUB9HObDhxLBeiHC+Dfpi3weweDTm4C YILAMWv9KYQh96Z8/R+Fls2ucmWrhfJiLbyOuj/Ajxu5SNGRn4i+aS08ZcNu5ErJVgRI +09nzEbjV+HTjewBtEeSUR9tpFP2y0r61+dgFgQ5RNh3JNgjJzATnZnpN7KpxV7Lf9Ny fAqcW8sALHrlFBsTOkgwFtIRWU6YT48YImPfO3sifWOG8P4PLAlMDQfTHnlSutw2RUTa 2t9A== 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:date:subject:cc:to:from :dkim-signature; bh=lP9Jf81Swn6HKhzeqSgb5dx7kwZ1I6PvW+Qk6QnaJIM=; b=Qijq6cYiYPE4DaWgNoQvRaxKfaGmv3yBtklW0/DX8ZPC3GhlRAQAwVCFmnNA0rkFdQ icl/KDrqYIrAvE/tFA7rQD6uMgjT/8FOToCw0WBeT+ARk5GBLFc4qtPkqatVVnM4a6Uo zmM6X2f+V9OkvJEidyGEQ/2ROk7EiB3HSSTcpdPymBLdbPKrx0Z8oYJLfWnEP8BZknTu sCgLjBXwEaMLh/9F3OXP9OU0hzF6J9NCplwSxL7W94L89Po6Sb1igRcIDi9dryCxSDPe JIGyeBXGHPEdeAK3iKZPCbIXbDZkj2Y72R5TLr8h+uECKXzIIvKcFUkOY2zr4V7H0B3a PA7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mn+XocFI; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k189-20020a6384c6000000b00415ff45dce3si656026pgd.839.2022.09.20.13.43.03; Tue, 20 Sep 2022 13:43:15 -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=@linaro.org header.s=google header.b=mn+XocFI; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231136AbiITUB4 (ORCPT + 99 others); Tue, 20 Sep 2022 16:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231137AbiITUBp (ORCPT ); Tue, 20 Sep 2022 16:01:45 -0400 Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5303452FD2 for ; Tue, 20 Sep 2022 13:01:44 -0700 (PDT) Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-12b542cb1d3so5836899fac.13 for ; Tue, 20 Sep 2022 13:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=lP9Jf81Swn6HKhzeqSgb5dx7kwZ1I6PvW+Qk6QnaJIM=; b=mn+XocFI9IgOzLf24JS8tHEgsTnBgE4LGh8VUQUZ/PdLXavL5/96BlY/5O437ZmoNj Ms1IbUvflE+mIMbwlxolfk8SsZg6frg4TgbF2e12wT+b8mQrgn+kBBPDMJr/2dv6D2JL Ey5Am5OPOuZdbFXYRCpk2h7eUd+ybr6y7vlyU8O0OdStNfKYfwC5lwXNBD3BgTYcFtkr lO0euV7UOctGTgyN1owGgZd9BFXLf1jfmEkOu0NDN274EcG/xaNfyNvWsQZSrxeY7fQ2 AuK2sMuGetebvnRi1HkKdG8Il5brmy+sFp9WTJNzYoco9/knhBTMPQM4ojA5Hk7EQU4T 7vAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=lP9Jf81Swn6HKhzeqSgb5dx7kwZ1I6PvW+Qk6QnaJIM=; b=J6J9WERCwNvAoLmoaZvDAr9cArkCFQ/rJy16aaVKz8KwIDqGAWoCEToRsJJify8Cku q2dBlavqpIBAhmhicE1Q/NNZVvuzI5MSskJOwz/aY4GZlVAn71IqGFpPBwI2WdGVkqyr doxt9oEHpFHqH73wZiWfbkJVZjoWG66YzGVkYgSPB1+catQ+6ZbGDYUyj28uJ5MdKYRL YlERfOWMUpkKkX2EOgjv7ZozdbdHdtJpIZ6AnIjrlzmjmVsVIoG9E8OaDUuOd94zUVat MPT6oQbSTY2W67fDHm+w1z1meFuSxBUtJTprSK2c4AMP9fWxeIbtvwiQYvrhrgI8LkiG Gqiw== X-Gm-Message-State: ACrzQf2PcSDJurbbV+0YVY8h7ce8E98JPc3AUNq07I15Q/RYq+cIIKPO DnONJflsz3FndVbjAABEgD+FQg== X-Received: by 2002:a05:6870:352:b0:10e:d4ee:a3f2 with SMTP id n18-20020a056870035200b0010ed4eea3f2mr3094146oaf.172.1663704103435; Tue, 20 Sep 2022 13:01:43 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id bm43-20020a0568081aab00b0034d14c6ce3dsm325634oib.16.2022.09.20.13.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 13:01:43 -0700 (PDT) From: William Breathitt Gray To: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mranostay@ti.com, jpanis@baylibre.com, gwendal@chromium.org, bleung@chromium.org, groeck@chromium.org, jic23@kernel.org, david@lechnology.com, robertcnelson@gmail.com, William Breathitt Gray Subject: [PATCH v5 3/5] counter: Introduce the Count capture component Date: Tue, 20 Sep 2022 13:21:27 -0400 Message-Id: X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: X-Mailing-List: linux-kernel@vger.kernel.org Some devices provide a latch function to save historic Count values. This patch standardizes exposure of such functionality as Count capture components. A COUNTER_COMP_CAPTURE macro is provided for driver authors to define a capture component. A new event COUNTER_EVENT_CAPTURE is introduced to represent Count value capture events. Cc: Julien Panis Signed-off-by: William Breathitt Gray --- Documentation/ABI/testing/sysfs-bus-counter | 6 ++++++ include/linux/counter.h | 3 +++ include/uapi/linux/counter.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-counter b/Documentation/ABI/testing/sysfs-bus-counter index a234022f9add..30b6e1faa6f6 100644 --- a/Documentation/ABI/testing/sysfs-bus-counter +++ b/Documentation/ABI/testing/sysfs-bus-counter @@ -4,6 +4,12 @@ Contact: linux-iio@vger.kernel.org Description: Count data of Count Y represented as a string. +What: /sys/bus/counter/devices/counterX/countY/capture +KernelVersion: 6.1 +Contact: linux-iio@vger.kernel.org +Description: + Historical capture of the Count Y count data. + What: /sys/bus/counter/devices/counterX/countY/ceiling KernelVersion: 5.2 Contact: linux-iio@vger.kernel.org diff --git a/include/linux/counter.h b/include/linux/counter.h index 60428d06915d..2c6594c240d4 100644 --- a/include/linux/counter.h +++ b/include/linux/counter.h @@ -453,6 +453,9 @@ struct counter_available { .priv = &(_available), \ } +#define COUNTER_COMP_CAPTURE(_read, _write) \ + COUNTER_COMP_COUNT_U64("capture", _read, _write) + #define COUNTER_COMP_CEILING(_read, _write) \ COUNTER_COMP_COUNT_U64("ceiling", _read, _write) diff --git a/include/uapi/linux/counter.h b/include/uapi/linux/counter.h index e9610e1944dc..8ab12d731e3b 100644 --- a/include/uapi/linux/counter.h +++ b/include/uapi/linux/counter.h @@ -63,6 +63,8 @@ enum counter_event_type { COUNTER_EVENT_INDEX, /* State of counter is changed */ COUNTER_EVENT_CHANGE_OF_STATE, + /* Count value captured */ + COUNTER_EVENT_CAPTURE, }; /** -- 2.37.3