xref: /linux/Documentation/ABI/testing/sysfs-bus-iio-timer-stm32 (revision e2be04c7f9958dde770eeb8b30e829ca969b37bb)
1What:		/sys/bus/iio/devices/triggerX/master_mode_available
2KernelVersion:	4.11
3Contact:	benjamin.gaignard@st.com
4Description:
5		Reading returns the list possible master modes which are:
6		- "reset"     :	The UG bit from the TIMx_EGR register is
7				used as trigger output (TRGO).
8		- "enable"    : The Counter Enable signal CNT_EN is used
9				as trigger output.
10		- "update"    : The update event is selected as trigger output.
11				For instance a master timer can then be used
12				as a prescaler for a slave timer.
13		- "compare_pulse" : The trigger output send a positive pulse
14				    when the CC1IF flag is to be set.
15		- "OC1REF"    : OC1REF signal is used as trigger output.
16		- "OC2REF"    : OC2REF signal is used as trigger output.
17		- "OC3REF"    : OC3REF signal is used as trigger output.
18		- "OC4REF"    : OC4REF signal is used as trigger output.
19		Additional modes (on TRGO2 only):
20		- "OC5REF"    : OC5REF signal is used as trigger output.
21		- "OC6REF"    : OC6REF signal is used as trigger output.
22		- "compare_pulse_OC4REF":
23		  OC4REF rising or falling edges generate pulses.
24		- "compare_pulse_OC6REF":
25		  OC6REF rising or falling edges generate pulses.
26		- "compare_pulse_OC4REF_r_or_OC6REF_r":
27		  OC4REF or OC6REF rising edges generate pulses.
28		- "compare_pulse_OC4REF_r_or_OC6REF_f":
29		  OC4REF rising or OC6REF falling edges generate pulses.
30		- "compare_pulse_OC5REF_r_or_OC6REF_r":
31		  OC5REF or OC6REF rising edges generate pulses.
32		- "compare_pulse_OC5REF_r_or_OC6REF_f":
33		  OC5REF rising or OC6REF falling edges generate pulses.
34
35		+-----------+   +-------------+            +---------+
36		| Prescaler +-> | Counter     |        +-> | Master  | TRGO(2)
37		+-----------+   +--+--------+-+        |-> | Control +-->
38		                   |        |          ||  +---------+
39		                +--v--------+-+ OCxREF ||  +---------+
40		                | Chx compare +----------> | Output  | ChX
41		                +-----------+-+         |  | Control +-->
42		                      .     |           |  +---------+
43		                      .     |           |    .
44		                +-----------v-+ OC6REF  |    .
45		                | Ch6 compare +---------+>
46		                +-------------+
47
48		Example with: "compare_pulse_OC4REF_r_or_OC6REF_r":
49
50		                X
51		              X   X
52		            X .   . X
53		          X   .   .   X
54		        X     .   .     X
55		count X .     .   .     . X
56		        .     .   .     .
57		        .     .   .     .
58		        +---------------+
59		OC4REF  |     .   .     |
60		      +-+     .   .     +-+
61		        .     +---+     .
62		OC6REF  .     |   |     .
63		      +-------+   +-------+
64		        +-+   +-+
65		TRGO2   | |   | |
66		      +-+ +---+ +---------+
67
68What:		/sys/bus/iio/devices/triggerX/master_mode
69KernelVersion:	4.11
70Contact:	benjamin.gaignard@st.com
71Description:
72		Reading returns the current master modes.
73		Writing set the master mode
74
75What:		/sys/bus/iio/devices/triggerX/sampling_frequency
76KernelVersion:	4.11
77Contact:	benjamin.gaignard@st.com
78Description:
79		Reading returns the current sampling frequency.
80		Writing an value different of 0 set and start sampling.
81		Writing 0 stop sampling.
82
83What:		/sys/bus/iio/devices/iio:deviceX/in_count0_preset
84KernelVersion:	4.12
85Contact:	benjamin.gaignard@st.com
86Description:
87		Reading returns the current preset value.
88		Writing sets the preset value.
89		When counting up the counter starts from 0 and fires an
90		event when reach preset value.
91		When counting down the counter start from preset value
92		and fire event when reach 0.
93
94What:		/sys/bus/iio/devices/iio:deviceX/in_count_quadrature_mode_available
95KernelVersion:	4.12
96Contact:	benjamin.gaignard@st.com
97Description:
98		Reading returns the list possible quadrature modes.
99
100What:		/sys/bus/iio/devices/iio:deviceX/in_count0_quadrature_mode
101KernelVersion:	4.12
102Contact:	benjamin.gaignard@st.com
103Description:
104		Configure the device counter quadrature modes:
105		channel_A:
106			Encoder A input servers as the count input and B as
107			the UP/DOWN direction control input.
108
109		channel_B:
110			Encoder B input serves as the count input and A as
111			the UP/DOWN direction control input.
112
113		quadrature:
114			Encoder A and B inputs are mixed to get direction
115			and count with a scale of 0.25.
116
117What:		/sys/bus/iio/devices/iio:deviceX/in_count_enable_mode_available
118KernelVersion:	4.12
119Contact:	benjamin.gaignard@st.com
120Description:
121		Reading returns the list possible enable modes.
122
123What:		/sys/bus/iio/devices/iio:deviceX/in_count0_enable_mode
124KernelVersion:	4.12
125Contact:	benjamin.gaignard@st.com
126Description:
127		Configure the device counter enable modes, in all case
128		counting direction is set by in_count0_count_direction
129		attribute and the counter is clocked by the internal clock.
130		always:
131			Counter is always ON.
132
133		gated:
134			Counting is enabled when connected trigger signal
135			level is high else counting is disabled.
136
137		triggered:
138			Counting is enabled on rising edge of the connected
139			trigger, and remains enabled for the duration of this
140			selected mode.
141
142What:		/sys/bus/iio/devices/iio:deviceX/in_count_trigger_mode_available
143KernelVersion:	4.13
144Contact:	benjamin.gaignard@st.com
145Description:
146		Reading returns the list possible trigger modes.
147
148What:		/sys/bus/iio/devices/iio:deviceX/in_count0_trigger_mode
149KernelVersion:	4.13
150Contact:	benjamin.gaignard@st.com
151Description:
152		Configure the device counter trigger mode
153		counting direction is set by in_count0_count_direction
154		attribute and the counter is clocked by the connected trigger
155		rising edges.
156