Skip to content

Commit ea2b23b

Browse files
William Breathitt Graygregkh
authored andcommitted
counter: Documentation: Add Generic Counter sysfs documentation
This patch adds standard documentation for the userspace sysfs attributes of the Generic Counter interface. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0040a39 commit ea2b23b

2 files changed

Lines changed: 231 additions & 0 deletions

File tree

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
What: /sys/bus/counter/devices/counterX/countY/count
2+
KernelVersion: 5.2
3+
Contact: linux-iio@vger.kernel.org
4+
Description:
5+
Count data of Count Y represented as a string.
6+
7+
What: /sys/bus/counter/devices/counterX/countY/ceiling
8+
KernelVersion: 5.2
9+
Contact: linux-iio@vger.kernel.org
10+
Description:
11+
Count value ceiling for Count Y. This is the upper limit for the
12+
respective counter.
13+
14+
What: /sys/bus/counter/devices/counterX/countY/floor
15+
KernelVersion: 5.2
16+
Contact: linux-iio@vger.kernel.org
17+
Description:
18+
Count value floor for Count Y. This is the lower limit for the
19+
respective counter.
20+
21+
What: /sys/bus/counter/devices/counterX/countY/count_mode
22+
KernelVersion: 5.2
23+
Contact: linux-iio@vger.kernel.org
24+
Description:
25+
Count mode for channel Y. The ceiling and floor values for
26+
Count Y are used by the count mode where required. The following
27+
count modes are available:
28+
29+
normal:
30+
Counting is continuous in either direction.
31+
32+
range limit:
33+
An upper or lower limit is set, mimicking limit switches
34+
in the mechanical counterpart. The upper limit is set to
35+
the Count Y ceiling value, while the lower limit is set
36+
to the Count Y floor value. The counter freezes at
37+
count = ceiling when counting up, and at count = floor
38+
when counting down. At either of these limits, the
39+
counting is resumed only when the count direction is
40+
reversed.
41+
42+
non-recycle:
43+
The counter is disabled whenever a counter overflow or
44+
underflow takes place. The counter is re-enabled when a
45+
new count value is loaded to the counter via a preset
46+
operation or direct write.
47+
48+
modulo-n:
49+
A count value boundary is set between the Count Y floor
50+
value and the Count Y ceiling value. The counter is
51+
reset to the Count Y floor value at count = ceiling when
52+
counting up, while the counter is set to the Count Y
53+
ceiling value at count = floor when counting down; the
54+
counter does not freeze at the boundary points, but
55+
counts continuously throughout.
56+
57+
What: /sys/bus/counter/devices/counterX/countY/count_mode_available
58+
What: /sys/bus/counter/devices/counterX/countY/error_noise_available
59+
What: /sys/bus/counter/devices/counterX/countY/function_available
60+
What: /sys/bus/counter/devices/counterX/countY/signalZ_action_available
61+
KernelVersion: 5.2
62+
Contact: linux-iio@vger.kernel.org
63+
Description:
64+
Discrete set of available values for the respective Count Y
65+
configuration are listed in this file. Values are delimited by
66+
newline characters.
67+
68+
What: /sys/bus/counter/devices/counterX/countY/direction
69+
KernelVersion: 5.2
70+
Contact: linux-iio@vger.kernel.org
71+
Description:
72+
Read-only attribute that indicates the count direction of Count
73+
Y. Two count directions are available: forward and backward.
74+
75+
Some counter devices are able to determine the direction of
76+
their counting. For example, quadrature encoding counters can
77+
determine the direction of movement by evaluating the leading
78+
phase of the respective A and B quadrature encoding signals.
79+
This attribute exposes such count directions.
80+
81+
What: /sys/bus/counter/devices/counterX/countY/enable
82+
KernelVersion: 5.2
83+
Contact: linux-iio@vger.kernel.org
84+
Description:
85+
Whether channel Y counter is enabled. Valid attribute values are
86+
boolean.
87+
88+
This attribute is intended to serve as a pause/unpause mechanism
89+
for Count Y. Suppose a counter device is used to count the total
90+
movement of a conveyor belt: this attribute allows an operator
91+
to temporarily pause the counter, service the conveyor belt,
92+
and then finally unpause the counter to continue where it had
93+
left off.
94+
95+
What: /sys/bus/counter/devices/counterX/countY/error_noise
96+
KernelVersion: 5.2
97+
Contact: linux-iio@vger.kernel.org
98+
Description:
99+
Read-only attribute that indicates whether excessive noise is
100+
present at the channel Y counter inputs.
101+
102+
What: /sys/bus/counter/devices/counterX/countY/function
103+
KernelVersion: 5.2
104+
Contact: linux-iio@vger.kernel.org
105+
Description:
106+
Count function mode of Count Y; count function evaluation is
107+
triggered by conditions specified by the Count Y signalZ_action
108+
attributes. The following count functions are available:
109+
110+
increase:
111+
Accumulated count is incremented.
112+
113+
decrease:
114+
Accumulated count is decremented.
115+
116+
pulse-direction:
117+
Rising edges on signal A updates the respective count.
118+
The input level of signal B determines direction.
119+
120+
quadrature x1 a:
121+
If direction is forward, rising edges on quadrature pair
122+
signal A updates the respective count; if the direction
123+
is backward, falling edges on quadrature pair signal A
124+
updates the respective count. Quadrature encoding
125+
determines the direction.
126+
127+
quadrature x1 b:
128+
If direction is forward, rising edges on quadrature pair
129+
signal B updates the respective count; if the direction
130+
is backward, falling edges on quadrature pair signal B
131+
updates the respective count. Quadrature encoding
132+
determines the direction.
133+
134+
quadrature x2 a:
135+
Any state transition on quadrature pair signal A updates
136+
the respective count. Quadrature encoding determines the
137+
direction.
138+
139+
quadrature x2 b:
140+
Any state transition on quadrature pair signal B updates
141+
the respective count. Quadrature encoding determines the
142+
direction.
143+
144+
quadrature x4:
145+
Any state transition on either quadrature pair signals
146+
updates the respective count. Quadrature encoding
147+
determines the direction.
148+
149+
What: /sys/bus/counter/devices/counterX/countY/name
150+
KernelVersion: 5.2
151+
Contact: linux-iio@vger.kernel.org
152+
Description:
153+
Read-only attribute that indicates the device-specific name of
154+
Count Y. If possible, this should match the name of the
155+
respective channel as it appears in the device datasheet.
156+
157+
What: /sys/bus/counter/devices/counterX/countY/preset
158+
KernelVersion: 5.2
159+
Contact: linux-iio@vger.kernel.org
160+
Description:
161+
If the counter device supports preset registers -- registers
162+
used to load counter channels to a set count upon device-defined
163+
preset operation trigger events -- the preset count for channel
164+
Y is provided by this attribute.
165+
166+
What: /sys/bus/counter/devices/counterX/countY/preset_enable
167+
KernelVersion: 5.2
168+
Contact: linux-iio@vger.kernel.org
169+
Description:
170+
Whether channel Y counter preset operation is enabled. Valid
171+
attribute values are boolean.
172+
173+
What: /sys/bus/counter/devices/counterX/countY/signalZ_action
174+
KernelVersion: 5.2
175+
Contact: linux-iio@vger.kernel.org
176+
Description:
177+
Action mode of Count Y for Signal Z. This attribute indicates
178+
the condition of Signal Z that triggers the count function
179+
evaluation for Count Y. The following action modes are
180+
available:
181+
182+
none:
183+
Signal does not trigger the count function. In
184+
Pulse-Direction count function mode, this Signal is
185+
evaluated as Direction.
186+
187+
rising edge:
188+
Low state transitions to high state.
189+
190+
falling edge:
191+
High state transitions to low state.
192+
193+
both edges:
194+
Any state transition.
195+
196+
What: /sys/bus/counter/devices/counterX/name
197+
KernelVersion: 5.2
198+
Contact: linux-iio@vger.kernel.org
199+
Description:
200+
Read-only attribute that indicates the device-specific name of
201+
the Counter. This should match the name of the device as it
202+
appears in its respective datasheet.
203+
204+
What: /sys/bus/counter/devices/counterX/num_counts
205+
KernelVersion: 5.2
206+
Contact: linux-iio@vger.kernel.org
207+
Description:
208+
Read-only attribute that indicates the total number of Counts
209+
belonging to the Counter.
210+
211+
What: /sys/bus/counter/devices/counterX/num_signals
212+
KernelVersion: 5.2
213+
Contact: linux-iio@vger.kernel.org
214+
Description:
215+
Read-only attribute that indicates the total number of Signals
216+
belonging to the Counter.
217+
218+
What: /sys/bus/counter/devices/counterX/signalY/signal
219+
KernelVersion: 5.2
220+
Contact: linux-iio@vger.kernel.org
221+
Description:
222+
Signal data of Signal Y represented as a string.
223+
224+
What: /sys/bus/counter/devices/counterX/signalY/name
225+
KernelVersion: 5.2
226+
Contact: linux-iio@vger.kernel.org
227+
Description:
228+
Read-only attribute that indicates the device-specific name of
229+
Signal Y. If possible, this should match the name of the
230+
respective signal as it appears in the device datasheet.

‎MAINTAINERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4058,6 +4058,7 @@ COUNTER SUBSYSTEM
40584058
M: William Breathitt Gray <vilhelm.gray@gmail.com>
40594059
L: linux-iio@vger.kernel.org
40604060
S: Maintained
4061+
F: Documentation/ABI/testing/sysfs-bus-counter*
40614062
F: drivers/counter/
40624063
F: include/linux/counter.h
40634064
F: include/linux/counter_enum.h

0 commit comments

Comments
 (0)