Skip to content

Commit b519820

Browse files
author
William Breathitt Gray
committed
counter: Introduce the compare component
Compare registers are used in devices to compare a counter channel against a particular count value (e.g. to check if a threshold has been reached). A macro COUNTER_COMP_COMPARE() is introduced to facilitate the creation of compare components as Count extensions. Link: https://lore.kernel.org/r/20250306-introduce-compare-component-v1-1-93993b3dca9c@kernel.org Signed-off-by: William Breathitt Gray <wbg@kernel.org>
1 parent 1adc624 commit b519820

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Documentation/ABI/testing/sysfs-bus-counter

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ Contact: linux-iio@vger.kernel.org
3434
Description:
3535
Count data of Count Y represented as a string.
3636

37+
What: /sys/bus/counter/devices/counterX/countY/compare
38+
KernelVersion: 6.15
39+
Contact: linux-iio@vger.kernel.org
40+
Description:
41+
If the counter device supports compare registers -- registers
42+
used to compare counter channels against a particular count --
43+
the compare count for channel Y is provided by this attribute.
44+
3745
What: /sys/bus/counter/devices/counterX/countY/capture
3846
KernelVersion: 6.1
3947
Contact: linux-iio@vger.kernel.org
@@ -301,6 +309,7 @@ Description:
301309

302310
What: /sys/bus/counter/devices/counterX/cascade_counts_enable_component_id
303311
What: /sys/bus/counter/devices/counterX/external_input_phase_clock_select_component_id
312+
What: /sys/bus/counter/devices/counterX/countY/compare_component_id
304313
What: /sys/bus/counter/devices/counterX/countY/capture_component_id
305314
What: /sys/bus/counter/devices/counterX/countY/ceiling_component_id
306315
What: /sys/bus/counter/devices/counterX/countY/floor_component_id

include/linux/counter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,9 @@ struct counter_array {
580580
#define COUNTER_COMP_CEILING(_read, _write) \
581581
COUNTER_COMP_COUNT_U64("ceiling", _read, _write)
582582

583+
#define COUNTER_COMP_COMPARE(_read, _write) \
584+
COUNTER_COMP_COUNT_U64("compare", _read, _write)
585+
583586
#define COUNTER_COMP_COUNT_MODE(_read, _write, _available) \
584587
{ \
585588
.type = COUNTER_COMP_COUNT_MODE, \

0 commit comments

Comments
 (0)