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, fabien.lahoudere@collabora.com,
gwendal@chromium.org, enric.balletbo@collabora.com,
bleung@chromium.org, groeck@chromium.org, jic23@kernel.org,
david@lechnology.com, robertcnelson@gmail.com,
William Breathitt Gray <william.gray@linaro.org>
Subject: [RFC PATCH 0/2] Add support for Counter array components
Date: Mon, 29 Aug 2022 11:17:29 -0400 [thread overview]
Message-ID: <cover.1661785438.git.william.gray@linaro.org> (raw)
The COUNTER_COMP_ARRAY_U64 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.
For example, suppose a driver wants to expose a Count's read-only
capture buffer of four elements using a callback `foobar_read()`::
COUNTER_COMP_COUNT_ARRAY_U64("capture", foobar_read, NULL, 4)
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_read()` callback, and thus the driver knows which
array element to handle.
Currently, only u64 arrays are supported. One thing to consider is
whether it would make sense to support arrays of other types. This would
allow support for arrays that don't necessarily correlate to a buffer on
the device, but rather serve as logical groupings of components.
For example, if a Signal has four polarity modes, a driver author can
define a Counter array component to handle the exposure of all four
together rather than defining individual components for each one. This
is the reason I've chosen the more generic "array" terminology for this
feature rather than "buffer".
William Breathitt Gray (2):
counter: Consolidate Counter extension sysfs attribute creation
counter: Introduce the COUNTER_COMP_ARRAY_U64 component type
drivers/counter/counter-sysfs.c | 210 ++++++++++++++++++++++++--------
include/linux/counter.h | 78 ++++++++++++
2 files changed, 239 insertions(+), 49 deletions(-)
base-commit: a12224997bec72d231a8dd642876e6364decdc45
--
2.37.2
next reply other threads:[~2022-08-29 15:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-29 15:17 William Breathitt Gray [this message]
2022-08-29 15:17 ` [RFC PATCH 1/2] counter: Consolidate Counter extension sysfs attribute creation William Breathitt Gray
2022-08-29 15:17 ` [RFC PATCH 2/2] counter: Introduce the COUNTER_COMP_ARRAY_U64 component type William Breathitt Gray
2022-09-06 14:41 ` Julien Panis
2022-09-10 23:40 ` 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.1661785438.git.william.gray@linaro.org \
--to=william.gray@linaro.org \
--cc=bleung@chromium.org \
--cc=david@lechnology.com \
--cc=enric.balletbo@collabora.com \
--cc=fabien.lahoudere@collabora.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;
as well as URLs for NNTP newsgroup(s).