Commit 45d29185 authored by William Breathitt Gray's avatar William Breathitt Gray Committed by Greg Kroah-Hartman

counter: Introduce the Count capture component

Some devices provide a latch function to save historic Count values.
This patch standardizes exposure of such functionality as Count capture
components. A COUNTER_COMP_CAPTURE macro is provided for driver authors
to define a capture component. A new event COUNTER_EVENT_CAPTURE is
introduced to represent Count value capture events.

Cc: Julien Panis <jpanis@baylibre.com>
Link: https://lore.kernel.org/r/c239572ab4208d0d6728136e82a88ad464369a7a.1664204990.git.william.gray@linaro.org/Signed-off-by: default avatarWilliam Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/3cebaa0b807a225eb277d771504fe6dba7269ffd.1664318353.git.william.gray@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9830288a
...@@ -4,6 +4,12 @@ Contact: linux-iio@vger.kernel.org ...@@ -4,6 +4,12 @@ Contact: linux-iio@vger.kernel.org
Description: Description:
Count data of Count Y represented as a string. Count data of Count Y represented as a string.
What: /sys/bus/counter/devices/counterX/countY/capture
KernelVersion: 6.1
Contact: linux-iio@vger.kernel.org
Description:
Historical capture of the Count Y count data.
What: /sys/bus/counter/devices/counterX/countY/ceiling What: /sys/bus/counter/devices/counterX/countY/ceiling
KernelVersion: 5.2 KernelVersion: 5.2
Contact: linux-iio@vger.kernel.org Contact: linux-iio@vger.kernel.org
...@@ -203,6 +209,7 @@ Description: ...@@ -203,6 +209,7 @@ Description:
both edges: both edges:
Any state transition. Any state transition.
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/ceiling_component_id
What: /sys/bus/counter/devices/counterX/countY/floor_component_id What: /sys/bus/counter/devices/counterX/countY/floor_component_id
What: /sys/bus/counter/devices/counterX/countY/count_mode_component_id What: /sys/bus/counter/devices/counterX/countY/count_mode_component_id
......
...@@ -453,6 +453,9 @@ struct counter_available { ...@@ -453,6 +453,9 @@ struct counter_available {
.priv = &(_available), \ .priv = &(_available), \
} }
#define COUNTER_COMP_CAPTURE(_read, _write) \
COUNTER_COMP_COUNT_U64("capture", _read, _write)
#define COUNTER_COMP_CEILING(_read, _write) \ #define COUNTER_COMP_CEILING(_read, _write) \
COUNTER_COMP_COUNT_U64("ceiling", _read, _write) COUNTER_COMP_COUNT_U64("ceiling", _read, _write)
......
...@@ -63,6 +63,8 @@ enum counter_event_type { ...@@ -63,6 +63,8 @@ enum counter_event_type {
COUNTER_EVENT_INDEX, COUNTER_EVENT_INDEX,
/* State of counter is changed */ /* State of counter is changed */
COUNTER_EVENT_CHANGE_OF_STATE, COUNTER_EVENT_CHANGE_OF_STATE,
/* Count value captured */
COUNTER_EVENT_CAPTURE,
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment