Skip to content

Commit 45d2918

Browse files
William Breathitt Graygregkh
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/c239572ab4208d0d6728136e82a88ad464369a7a.1664204990.git.william.gray@linaro.org/ Signed-off-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/3cebaa0b807a225eb277d771504fe6dba7269ffd.1664318353.git.william.gray@linaro.org Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9830288 commit 45d2918

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Documentation/ABI/testing/sysfs-bus-counter

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Contact: [email protected]
44
Description:
55
Count data of Count Y represented as a string.
66

7+
What: /sys/bus/counter/devices/counterX/countY/capture
8+
KernelVersion: 6.1
9+
10+
Description:
11+
Historical capture of the Count Y count data.
12+
713
What: /sys/bus/counter/devices/counterX/countY/ceiling
814
KernelVersion: 5.2
915
@@ -203,6 +209,7 @@ Description:
203209
both edges:
204210
Any state transition.
205211

212+
What: /sys/bus/counter/devices/counterX/countY/capture_component_id
206213
What: /sys/bus/counter/devices/counterX/countY/ceiling_component_id
207214
What: /sys/bus/counter/devices/counterX/countY/floor_component_id
208215
What: /sys/bus/counter/devices/counterX/countY/count_mode_component_id

include/linux/counter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ struct counter_available {
453453
.priv = &(_available), \
454454
}
455455

456+
#define COUNTER_COMP_CAPTURE(_read, _write) \
457+
COUNTER_COMP_COUNT_U64("capture", _read, _write)
458+
456459
#define COUNTER_COMP_CEILING(_read, _write) \
457460
COUNTER_COMP_COUNT_U64("ceiling", _read, _write)
458461

include/uapi/linux/counter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ enum counter_event_type {
6363
COUNTER_EVENT_INDEX,
6464
/* State of counter is changed */
6565
COUNTER_EVENT_CHANGE_OF_STATE,
66+
/* Count value captured */
67+
COUNTER_EVENT_CAPTURE,
6668
};
6769

6870
/**

0 commit comments

Comments
 (0)