From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BFAFC433DB for ; Tue, 9 Mar 2021 13:22:19 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2702B64EBB for ; Tue, 9 Mar 2021 13:22:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2702B64EBB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=A/O+RoXKlqPmfjTh4p1kqnVj4F5O/EMXVGjmINULZ3k=; b=iAa3p4XMcHHv6+2LcM0XqCpC6v /+X1vKfwJqZsKJENKa5ZVFn4n9Gyh6QwvyhANXaKWoO8k3mWFLhzyGNRz5FkAkN5/frQ6tvUnB8Ib +IEVcTvQGAotGknT/V8cl4M1Z+JxtScoLzvyy9xYkxNbLgGp73s9GWxjHSdLLR70xTnb+EJuT4SWk bVZl0je0a2CGEuTuAJSHsN+N/j9sNo5Uxr5ZM834SFwV/ChMsHphLqOa8Tb6XE/agZIaP3df16f/G n0w3iGVpDYuspH9exjGQjVn+WTgbyRWVz+o3sOx+S4O2yhSGeT/QdW3CCmWcXxEjABrVx/JQYcdey OSt7xH1Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lJcHj-004Zzq-QN; Tue, 09 Mar 2021 13:20:28 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lJcHV-004Zsr-VB for linux-arm-kernel@lists.infradead.org; Tue, 09 Mar 2021 13:20:22 +0000 Received: by mail-pg1-x533.google.com with SMTP id t26so8747402pgv.3 for ; Tue, 09 Mar 2021 05:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/UQXlkoZL9oIV4Vm/y3H2dkMxHwkxK4VsNYeOuqh9c0=; b=nZnVTGDqVOA4wPPRl/vxLH1zpDwIVKmhxegagbYco/EsThrlk3Npxs2ax9l80v9SZR eh4cODZzz7wtWcxfM9hn9d/S1TLT0Q0ChkQsGT7Q1p33e6p+b8siIF1XyXaL59XMZV0I zWrT6K2nVkesRY1+lzmYTRI26kicxcvBVr4sBr3VjMWZX1fxDAPsHC95UrE7sXYBQ6G0 k2JvmPiTlIREN8r7fcBsyXb2N0LEJy1AtU4colTytxWyt/H5IDS8OkfXzwE5O/gKhoxL 3Ab/9iu7DQIU9qRIYPuHmBKAJTZEgLRxIivVDziEUxJphgGo9k+v5a/ZRCcplClA3UAF ZvrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/UQXlkoZL9oIV4Vm/y3H2dkMxHwkxK4VsNYeOuqh9c0=; b=gy6mo2/T0MVazEHTsXAy2svJ2qEStJ0tryfmuD5qS3RX2OAOyyYbjUBKHN6EFfu7Dt Do0mJQACRilRk66lbGR11ldMJwToqwV8uH6vGLxPEDCszi/inznFAbybsFZoCmMLzQJK tXm7UMWrrqDRbo5vM9aBdRkDciI7uGF/NeWkvfRvjxHS6ON9nJFord34eaatuxQScm1T r1QniCE4el34KUrssfn200Q88rMNMk7bDtAiEHeS/gLOkYukEq3W1165bOkZfSNwQ6zh Kr29buupVwGmwdWPSe29nnmRnBi3trTtesSWbZWpNE84CaoaFZKprDmwSDHDCW1Q4hO5 3lLg== X-Gm-Message-State: AOAM531eDeKEl4uZxLmBHxxmkvs2MgSZ/4p5WXdc1Z1aZHEid+a6xyUW n0QWO1E/VUc5LDYnYDeOkfs= X-Google-Smtp-Source: ABdhPJxITphI+0Q1/mUBxAdrWpnlO5YBUHufs2D1Mk5a7ka6o7dmWAEbqklf8Zm62u5NOVP0XmW32A== X-Received: by 2002:a63:df10:: with SMTP id u16mr7437528pgg.308.1615296011574; Tue, 09 Mar 2021 05:20:11 -0800 (PST) Received: from localhost.localdomain ([156.146.35.76]) by smtp.gmail.com with ESMTPSA id y9sm7647421pfl.201.2021.03.09.05.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 05:20:10 -0800 (PST) From: William Breathitt Gray To: jic23@kernel.org Cc: kernel@pengutronix.de, linux-stm32@st-md-mailman.stormreply.com, a.fatoum@pengutronix.de, kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.belloni@bootlin.com, david@lechnology.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, syednwaris@gmail.com, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, o.rempel@pengutronix.de, William Breathitt Gray Subject: [PATCH v9 00/33] Introduce the Counter character device interface Date: Tue, 9 Mar 2021 22:19:13 +0900 Message-Id: X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210309_132015_509444_31E6638C X-CRM114-Status: GOOD ( 22.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Changes in v9: - Implemented example userspace counter application under tools/counter - Replaced extension*_name attributes with *_component_id attributes; this should hopefully be a more intuitive way to find the desired IDs - Changed to use regular spinlock because raw_spinlock is not needed - Implemented chrdev_lock mutex to limit chrdev to a single open() at a time - Improved struct counter_component documentation with examples - Reverted "counter_count_function" to "counter_function" naming change for drivers; individual maintainers can change this if they so desire - Utilized "return 0" in switch blocks to return early where possible - Utilized default cases in switch blocks to improve clarity and intent - Refactored counter_register to make use of cdev_add_device(); counter_chrdev_add() has been simplified as a result - Inlined counter_chrdev_realloc_queue() because it is only used by the events_queue_size sysfs attribute - Replaced deprecated ida_simple_* calls with ida_alloc()/ida_free() - Made use of struct device "id" member to construct the cdev node name - Made use of kfifo_size() instead of rolling my own - Implemented changes necessary to migrate interrupt-cnt driver Note that this revision is based on top of 5 prerequisite patches: * counter: add IRQ or GPIO based counter * dt-bindings: counter: add interrupt-counter binding * counter: stm32-timer-cnt: fix ceiling miss-alignment with reload register * counter: stm32-timer-cnt: fix ceiling write max value * counter: stm32-timer-cnt: Report count function when SLAVE_MODE_DISABLED I pulled out a lot of bits and pieces to their own patches; hopefully that makes reviewing this patchset much simpler than before. This patchset is also available on my personal public git repo for anyone who wants a quick way to clone: https://gitlab.com/vilhelmgray/iio/-/tree/counter_chrdev_v9 The patches preceding "counter: Internalize sysfs interface code" are primarily cleanup and fixes that can be picked up and applied now to the IIO tree if so desired. The "counter: Internalize sysfs interface code" patch as well may be considered for pickup because it is relatively safe and makes no changes to the userspace interface. To summarize the main points of this patchset: there are no changes to the existing Counter sysfs userspace interface; a Counter character device interface is introduced that allows Counter events and associated data to be read() by userspace; the events_configure() and watch_validate() driver callbacks are introduced to support Counter events; and IRQ support is added to the 104-QUAD-8 driver, serving as an example of how to support the new Counter events functionality. Something that should still be discussed: should the struct counter_event "status" member be 8 bits or 32 bits wide? This member will provide the return status (system error number) of an event operation. William Breathitt Gray (33): docs: counter: Consolidate Counter sysfs attributes documentation docs: counter: Fix spelling counter: 104-quad-8: Remove pointless comment counter: 104-quad-8: Return error when invalid mode during ceiling_write counter: 104-quad-8: Annotate hardware config module parameter counter: 104-quad-8: Add const qualifiers for quad8_preset_register_set counter: 104-quad-8: Add const qualifier for functions_list array counter: interrupt-cnt: Add const qualifier for functions_list array counter: microchip-tcb-capture: Add const qualifier for functions_list array counter: stm32-lptimer-cnt: Add const qualifier for functions_list array counter: stm32-timer-cnt: Add const qualifier for functions_list array counter: 104-quad-8: Add const qualifier for actions_list array counter: ftm-quaddec: Add const qualifier for actions_list array counter: interrupt-cnt: Add const qualifier for actions_list array counter: microchip-tcb-capture: Add const qualifier for actions_list array counter: stm32-lptimer-cnt: Add const qualifier for actions_list array counter: stm32-timer-cnt: Add const qualifier for actions_list array counter: Return error code on invalid modes counter: Standardize to ERANGE for limit exceeded errors counter: Rename counter_signal_value to counter_signal_level counter: Rename counter_count_function to counter_function counter: Internalize sysfs interface code counter: Update counter.h comments to reflect sysfs internalization docs: counter: Update to reflect sysfs internalization counter: Move counter enums to uapi header counter: Add character device interface docs: counter: Document character device interface tools/counter: Create Counter tools counter: Implement signalZ_action_component_id sysfs attribute counter: Implement *_component_id sysfs attributes counter: Implement events_queue_size sysfs attribute counter: 104-quad-8: Replace mutex with spinlock counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8 Documentation/ABI/testing/sysfs-bus-counter | 112 +- .../ABI/testing/sysfs-bus-counter-104-quad-8 | 61 - .../ABI/testing/sysfs-bus-counter-ftm-quaddec | 16 - Documentation/driver-api/generic-counter.rst | 368 +++- .../userspace-api/ioctl/ioctl-number.rst | 1 + MAINTAINERS | 7 +- drivers/counter/104-quad-8.c | 739 ++++---- drivers/counter/Kconfig | 6 +- drivers/counter/Makefile | 1 + drivers/counter/counter-chrdev.c | 486 ++++++ drivers/counter/counter-chrdev.h | 14 + drivers/counter/counter-core.c | 192 +++ drivers/counter/counter-sysfs.c | 953 +++++++++++ drivers/counter/counter-sysfs.h | 13 + drivers/counter/counter.c | 1496 ----------------- drivers/counter/ftm-quaddec.c | 61 +- drivers/counter/interrupt-cnt.c | 75 +- drivers/counter/microchip-tcb-capture.c | 105 +- drivers/counter/stm32-lptimer-cnt.c | 176 +- drivers/counter/stm32-timer-cnt.c | 149 +- drivers/counter/ti-eqep.c | 221 +-- include/linux/counter.h | 716 ++++---- include/linux/counter_enum.h | 45 - include/uapi/linux/counter.h | 133 ++ tools/Makefile | 13 +- tools/counter/Build | 1 + tools/counter/Makefile | 53 + tools/counter/counter_example.c | 95 ++ 28 files changed, 3522 insertions(+), 2786 deletions(-) delete mode 100644 Documentation/ABI/testing/sysfs-bus-counter-104-quad-8 delete mode 100644 Documentation/ABI/testing/sysfs-bus-counter-ftm-quaddec create mode 100644 drivers/counter/counter-chrdev.c create mode 100644 drivers/counter/counter-chrdev.h create mode 100644 drivers/counter/counter-core.c create mode 100644 drivers/counter/counter-sysfs.c create mode 100644 drivers/counter/counter-sysfs.h delete mode 100644 drivers/counter/counter.c delete mode 100644 include/linux/counter_enum.h create mode 100644 include/uapi/linux/counter.h create mode 100644 tools/counter/Build create mode 100644 tools/counter/Makefile create mode 100644 tools/counter/counter_example.c base-commit: 4ef57c4862e38e6034978d8b247a511292d7055a prerequisite-patch-id: 41fda3a386861edad110c644567fad373a5a175e prerequisite-patch-id: c6c2ab3173f5a0136d1e9b7b96ccd115fa35d66e prerequisite-patch-id: 7e3cd78924d79890b690f3029e0d4f5b3902a73c prerequisite-patch-id: 98f0a6c1d188a7dec01a5587fb7566ac637385a1 prerequisite-patch-id: 884299e23b6426ea43282e9701996e794cb6aa34 -- 2.30.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel