From patchwork Fri Aug 27 03:47:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 12461179 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 1ACC5C432BE for ; Fri, 27 Aug 2021 03:51:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 DE58460E77 for ; Fri, 27 Aug 2021 03:51:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DE58460E77 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=vYENKwOzNxclX+LoJI0drSejmixXoJjnhv2+qkQwFuA=; b=vkVZCiZN5jPbH4 Sw5xfVnVRdsgtR3xgmpOR555t3dyA9+T4ir/qvVXMr3MlczqNE/qQ2g/JaK4wOBisYfrK9indtIe5 6FwVRW4pL4AvTfZcqToOJmY8SE4L08iiB9Vl1CpM8kjaOl0AvK5PZwfs/vjPSewMABsfMTJaOv+b2 6B9o2a5Q4scJr25ZcJmOoT+JexVbdzv2D6sjm9CM6w8Pe+hgSWYaR1QUeschHAyjIJ+5jeGeKraUA OavJ+DMUu0Tv0RsTc7C39CIWJViQAymtXoOdj50YzgNpHZdzRq1mFRUxzk6iBB25ND1OfzCCnmDOa 9xp4UnNiEJ/710ctvD+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJSqq-00BRpa-CI; Fri, 27 Aug 2021 03:48:20 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mJSqj-00BRnt-Lv for linux-arm-kernel@lists.infradead.org; Fri, 27 Aug 2021 03:48:17 +0000 Received: by mail-pj1-x1030.google.com with SMTP id j4-20020a17090a734400b0018f6dd1ec97so3882711pjs.3 for ; Thu, 26 Aug 2021 20:48:12 -0700 (PDT) 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=JqqSaS+xFujsg063LbIZ6FBQCRzCA3jZ3HiQj8yEsME=; b=AgugwqMn5os6t3tUSyTcSvTf2l8zIzffj+S3/N8V1kjd2adSs0Coe2rmeeEB+NUGq5 +Nax/9LNA/4+rDZHly/8IJWb+lqcC4MLTTZMFL2DugCmdfuaQKd2nYrbJjAZL4cAEJH4 xxYDS5c3VFVWpFnxtm+vZl+rIvYg4GIT3vWRZDTHtnaDkVnjs2W16k9kRChz2woZoM7C lDJxq2/YqCjBbjaC8nE8FFHAZ1Loy38POo1E1I6O1w7I67Ogoa++sqcNhXhU9sEX7D/P lHJYzNwZBmA/1ouche3oqhgEnOlUW9cgStv9qXgDCdfCQy18tgGdsiSLn3xXMtjsUJrz kmLw== 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=JqqSaS+xFujsg063LbIZ6FBQCRzCA3jZ3HiQj8yEsME=; b=cKSUdTAqQCLHS9Btcs5b8RfE6Fvzj5iSZ2k+Ul1+ZnWDec9mhwYQcGLUkJdpfDjlOM b+QMm6NgWm8JnkfeNdRGE66ObVuFk4Qdw+7/I+r8e+Tt6m3AVjxtAKt7NjSrNiQ3BZHB /fWhC75Sd2kfZ1B0YLppmBxWer62qJJaSnnkt1Nz+ifAgHlfNe5EFsvVzfx0r3QL3uuq WZJ1CxjPiGtYXfdrcXd6n7AJe1Hc4yKCXVHQzddV/IqesVG2q/otzJwBuK0u/AySYz3b RB+O8E57Cjb8by8LE+WkDuUQ4nHQ/4dKlD3yG9iv4Z+ierRyYIJAs6YrOByILhYJKHJm g+1w== X-Gm-Message-State: AOAM530ogA5GQL1vWscUfv4e5YnCZyhRTfRyn6dcUPNvdKkQqdzii4hy OwzroawraNyc1hKAvqbqqnc= X-Google-Smtp-Source: ABdhPJxNo38rlYLjA8U+ThfxFyw8VE6JDAO6SORGaGgH34iHp7uxCutHV+aYWuq2bXb6OENxHHVuVA== X-Received: by 2002:a17:90b:3e81:: with SMTP id rj1mr8246555pjb.99.1630036092191; Thu, 26 Aug 2021 20:48:12 -0700 (PDT) Received: from localhost.localdomain ([156.146.35.76]) by smtp.gmail.com with ESMTPSA id o6sm4364693pjk.4.2021.08.26.20.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Aug 2021 20:48:11 -0700 (PDT) From: William Breathitt Gray To: jic23@kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, kernel@pengutronix.de, 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, jarkko.nikula@linux.intel.com, William Breathitt Gray Subject: [PATCH v16 00/14] Introduce the Counter character device interface Date: Fri, 27 Aug 2021 12:47:44 +0900 Message-Id: X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210826_204813_798472_4BECE3B5 X-CRM114-Status: GOOD ( 16.88 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Changes in v16: - Define magic numbers for stm32-lptimer-cnt clock polarities - Define magic numbers for stm32-timer-cnt encoder modes - Bump KernelVersion to 5.16 in sysfs-bus-counter ABI documentation - Fix typos in driver API generic-counter.rst documentation file For convenience, this patchset is also available on my personal git repo: https://gitlab.com/vilhelmgray/iio/-/tree/counter_chrdev_v16 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. William Breathitt Gray (14): counter: stm32-lptimer-cnt: Provide defines for clock polarities counter: stm32-timer-cnt: Provide defines for slave mode selection 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 | 38 +- Documentation/driver-api/generic-counter.rst | 358 +++- .../userspace-api/ioctl/ioctl-number.rst | 1 + MAINTAINERS | 3 +- drivers/counter/104-quad-8.c | 699 ++++---- drivers/counter/Kconfig | 6 +- drivers/counter/Makefile | 1 + drivers/counter/counter-chrdev.c | 553 ++++++ drivers/counter/counter-chrdev.h | 14 + drivers/counter/counter-core.c | 191 +++ drivers/counter/counter-sysfs.c | 960 +++++++++++ drivers/counter/counter-sysfs.h | 13 + drivers/counter/counter.c | 1496 ----------------- drivers/counter/ftm-quaddec.c | 60 +- drivers/counter/intel-qep.c | 144 +- drivers/counter/interrupt-cnt.c | 62 +- drivers/counter/microchip-tcb-capture.c | 91 +- drivers/counter/stm32-lptimer-cnt.c | 212 ++- drivers/counter/stm32-timer-cnt.c | 195 +-- drivers/counter/ti-eqep.c | 180 +- include/linux/counter.h | 715 ++++---- include/linux/counter_enum.h | 45 - include/linux/mfd/stm32-lptimer.h | 5 + include/linux/mfd/stm32-timers.h | 4 + include/uapi/linux/counter.h | 154 ++ tools/Makefile | 13 +- tools/counter/Build | 1 + tools/counter/Makefile | 53 + tools/counter/counter_example.c | 93 + 29 files changed, 3569 insertions(+), 2791 deletions(-) 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: 5ffeb17c0d3dd44704b4aee83e297ec07666e4d6