Commit b5198201 authored by William Breathitt Gray's avatar William Breathitt Gray
Browse files

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: default avatarWilliam Breathitt Gray <wbg@kernel.org>
parent 1adc6240
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -34,6 +34,14 @@ Contact: linux-iio@vger.kernel.org
Description:
		Count data of Count Y represented as a string.

What:		/sys/bus/counter/devices/counterX/countY/compare
KernelVersion:	6.15
Contact:	linux-iio@vger.kernel.org
Description:
		If the counter device supports compare registers -- registers
		used to compare counter channels against a particular count --
		the compare count for channel Y is provided by this attribute.

What:		/sys/bus/counter/devices/counterX/countY/capture
KernelVersion:	6.1
Contact:	linux-iio@vger.kernel.org
@@ -301,6 +309,7 @@ Description:

What:		/sys/bus/counter/devices/counterX/cascade_counts_enable_component_id
What:		/sys/bus/counter/devices/counterX/external_input_phase_clock_select_component_id
What:		/sys/bus/counter/devices/counterX/countY/compare_component_id
What:		/sys/bus/counter/devices/counterX/countY/capture_component_id
What:		/sys/bus/counter/devices/counterX/countY/ceiling_component_id
What:		/sys/bus/counter/devices/counterX/countY/floor_component_id
+3 −0
Original line number Diff line number Diff line
@@ -580,6 +580,9 @@ struct counter_array {
#define COUNTER_COMP_CEILING(_read, _write) \
	COUNTER_COMP_COUNT_U64("ceiling", _read, _write)

#define COUNTER_COMP_COMPARE(_read, _write) \
	COUNTER_COMP_COUNT_U64("compare", _read, _write)

#define COUNTER_COMP_COUNT_MODE(_read, _write, _available) \
{ \
	.type = COUNTER_COMP_COUNT_MODE, \