public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Breathitt Gray <william.gray@linaro.org>
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 <william.gray@linaro.org>
Subject: [PATCH v2 0/4] Add support for Counter array components
Date: Fri, 16 Sep 2022 20:39:24 -0400	[thread overview]
Message-ID: <cover.1663372750.git.william.gray@linaro.org> (raw)

Changes in v2:
 - Fixed Counter array component id allocation; was previously
   allocating duplicate ids to subsequent components
 - Introduced the Signal polarity component
 - Added Signal polarity component for 104-quad-8 driver
 - Converted COUNTER_COMP_ARRAY_U64 to COUNTER_COMP_ARRAY
 - Added support for Counter arrays of Signal polarity component type
 - Introduced DEFINE_COUNTER_ARRAY helper macro to define Counter arrays

The COUNTER_COMP_ARRAY Counter component type is introduced to enable
support for Counter array components. With Counter array components,
exposure for buffers on counter devices can be defined via new Counter
array component macros. This should simplify code for driver authors who
would otherwise need to define individual Counter components for each
array element.

Driver authors can handle reads/writes for an array component by
receiving an element index via the `idx` parameter and processing the
respective value via the `val` parameter.

For example, suppose a driver wants to expose a Count's read-only
capture buffer of four elements using a callback
`foobar_capture_read()`::

        DEFINE_COUNTER_ARRAY(foobar_capture_array, COUNTER_COMP_U64,
                             NULL, 4)
        COUNTER_COMP_COUNT_ARRAY_U64("capture", foobar_capture_read,
                                     NULL, foobar_capture_array)

Respective sysfs attributes for each array element would appear for the
respective Count:

* /sys/bus/counter/devices/counterX/countY/capture0
* /sys/bus/counter/devices/counterX/countY/capture1
* /sys/bus/counter/devices/counterX/countY/capture2
* /sys/bus/counter/devices/counterX/countY/capture3

If a user tries to read _capture2_ for example, `idx` will be `2` when
passed to the `foobar_capture_read()` callback, and thus the driver
knows which array element to handle.

In addition, this patchset introduces the Signal polarity component,
which represents the active level of a respective Signal. There are two
possible states: positive (rising edge) and negative (falling edge). The
104-quad-8 driver is updated to expose its index_polarity functionality
via this new polarity component.

A macro COUNTER_COMP_ARRAY_POLARITY() is provided for driver authors to
support Counter arrays of Signal polarity component type;
DEFINE_COUNTER_AVAILABLE may be used to define the polarity modes that
are passed to DEFINE_COUNTER_ARRAY.

William Breathitt Gray (4):
  counter: Introduce the Signal polarity component
  counter: 104-quad-8: Add Signal polarity component
  counter: Consolidate Counter extension sysfs attribute creation
  counter: Introduce the COUNTER_COMP_ARRAY component type

 Documentation/ABI/testing/sysfs-bus-counter |  13 +
 drivers/counter/104-quad-8.c                |  35 +++
 drivers/counter/counter-sysfs.c             | 298 ++++++++++++++++----
 include/linux/counter.h                     | 131 +++++++++
 include/uapi/linux/counter.h                |   6 +
 5 files changed, 434 insertions(+), 49 deletions(-)


base-commit: a12224997bec72d231a8dd642876e6364decdc45
-- 
2.37.3


             reply	other threads:[~2022-09-17  1:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-17  0:39 William Breathitt Gray [this message]
2022-09-17  0:39 ` [PATCH v2 1/4] counter: Introduce the Signal polarity component William Breathitt Gray
2022-09-17  0:39 ` [PATCH v2 2/4] counter: 104-quad-8: Add " William Breathitt Gray
2022-09-17  0:39 ` [PATCH v2 3/4] counter: Consolidate Counter extension sysfs attribute creation William Breathitt Gray
2022-09-17  0:39 ` [PATCH v2 4/4] counter: Introduce the COUNTER_COMP_ARRAY component type William Breathitt Gray
2022-09-17 12:30   ` William Breathitt Gray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1663372750.git.william.gray@linaro.org \
    --to=william.gray@linaro.org \
    --cc=bleung@chromium.org \
    --cc=david@lechnology.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --cc=jpanis@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mranostay@ti.com \
    --cc=robertcnelson@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox