xref: /openbmc/linux/Documentation/ABI/testing/sysfs-bus-iio-timer-stm32 (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
193fbe91bSBenjamin GaignardWhat:		/sys/bus/iio/devices/triggerX/master_mode_available
293fbe91bSBenjamin GaignardKernelVersion:	4.11
393fbe91bSBenjamin GaignardContact:	benjamin.gaignard@st.com
493fbe91bSBenjamin GaignardDescription:
593fbe91bSBenjamin Gaignard		Reading returns the list possible master modes which are:
6*34433332SMauro Carvalho Chehab
7*34433332SMauro Carvalho Chehab
8*34433332SMauro Carvalho Chehab		- "reset"
9*34433332SMauro Carvalho Chehab				The UG bit from the TIMx_EGR register is
104adec7daSBenjamin Gaignard				used as trigger output (TRGO).
11*34433332SMauro Carvalho Chehab		- "enable"
12*34433332SMauro Carvalho Chehab				The Counter Enable signal CNT_EN is used
134adec7daSBenjamin Gaignard				as trigger output.
14*34433332SMauro Carvalho Chehab		- "update"
15*34433332SMauro Carvalho Chehab				The update event is selected as trigger output.
164adec7daSBenjamin Gaignard				For instance a master timer can then be used
174adec7daSBenjamin Gaignard				as a prescaler for a slave timer.
18*34433332SMauro Carvalho Chehab		- "compare_pulse"
19*34433332SMauro Carvalho Chehab				The trigger output send a positive pulse
204adec7daSBenjamin Gaignard				when the CC1IF flag is to be set.
21*34433332SMauro Carvalho Chehab		- "OC1REF"
22*34433332SMauro Carvalho Chehab				OC1REF signal is used as trigger output.
23*34433332SMauro Carvalho Chehab		- "OC2REF"
24*34433332SMauro Carvalho Chehab				OC2REF signal is used as trigger output.
25*34433332SMauro Carvalho Chehab		- "OC3REF"
26*34433332SMauro Carvalho Chehab				OC3REF signal is used as trigger output.
27*34433332SMauro Carvalho Chehab		- "OC4REF"
28*34433332SMauro Carvalho Chehab				OC4REF signal is used as trigger output.
29*34433332SMauro Carvalho Chehab
306fb34812SFabrice Gasnier		Additional modes (on TRGO2 only):
31*34433332SMauro Carvalho Chehab
32*34433332SMauro Carvalho Chehab		- "OC5REF"
33*34433332SMauro Carvalho Chehab				OC5REF signal is used as trigger output.
34*34433332SMauro Carvalho Chehab		- "OC6REF"
35*34433332SMauro Carvalho Chehab				OC6REF signal is used as trigger output.
366fb34812SFabrice Gasnier		- "compare_pulse_OC4REF":
376fb34812SFabrice Gasnier				OC4REF rising or falling edges generate pulses.
386fb34812SFabrice Gasnier		- "compare_pulse_OC6REF":
396fb34812SFabrice Gasnier				OC6REF rising or falling edges generate pulses.
406fb34812SFabrice Gasnier		- "compare_pulse_OC4REF_r_or_OC6REF_r":
416fb34812SFabrice Gasnier				OC4REF or OC6REF rising edges generate pulses.
426fb34812SFabrice Gasnier		- "compare_pulse_OC4REF_r_or_OC6REF_f":
43*34433332SMauro Carvalho Chehab				OC4REF rising or OC6REF falling edges generate
44*34433332SMauro Carvalho Chehab				pulses.
456fb34812SFabrice Gasnier		- "compare_pulse_OC5REF_r_or_OC6REF_r":
466fb34812SFabrice Gasnier				OC5REF or OC6REF rising edges generate pulses.
476fb34812SFabrice Gasnier		- "compare_pulse_OC5REF_r_or_OC6REF_f":
48*34433332SMauro Carvalho Chehab				OC5REF rising or OC6REF falling edges generate
49*34433332SMauro Carvalho Chehab				pulses.
50*34433332SMauro Carvalho Chehab
51*34433332SMauro Carvalho Chehab		::
526fb34812SFabrice Gasnier
536fb34812SFabrice Gasnier		  +-----------+   +-------------+            +---------+
546fb34812SFabrice Gasnier		  | Prescaler +-> | Counter     |        +-> | Master  | TRGO(2)
556fb34812SFabrice Gasnier		  +-----------+   +--+--------+-+        |-> | Control +-->
566fb34812SFabrice Gasnier		                     |        |          ||  +---------+
576fb34812SFabrice Gasnier		                  +--v--------+-+ OCxREF ||  +---------+
586fb34812SFabrice Gasnier		                  | Chx compare +----------> | Output  | ChX
596fb34812SFabrice Gasnier		                  +-----------+-+         |  | Control +-->
606fb34812SFabrice Gasnier		                        .     |           |  +---------+
616fb34812SFabrice Gasnier		                        .     |           |    .
626fb34812SFabrice Gasnier		                  +-----------v-+ OC6REF  |    .
636fb34812SFabrice Gasnier		                  | Ch6 compare +---------+>
646fb34812SFabrice Gasnier		                  +-------------+
656fb34812SFabrice Gasnier
66*34433332SMauro Carvalho Chehab		Example with: "compare_pulse_OC4REF_r_or_OC6REF_r"::
676fb34812SFabrice Gasnier
686fb34812SFabrice Gasnier		                  X
696fb34812SFabrice Gasnier		                X   X
706fb34812SFabrice Gasnier		              X .   . X
716fb34812SFabrice Gasnier		            X   .   .   X
726fb34812SFabrice Gasnier		          X     .   .     X
736fb34812SFabrice Gasnier		  count X .     .   .     . X
746fb34812SFabrice Gasnier		          .     .   .     .
756fb34812SFabrice Gasnier		          .     .   .     .
766fb34812SFabrice Gasnier		          +---------------+
776fb34812SFabrice Gasnier		  OC4REF  |     .   .     |
786fb34812SFabrice Gasnier		        +-+     .   .     +-+
796fb34812SFabrice Gasnier		          .     +---+     .
806fb34812SFabrice Gasnier		  OC6REF  .     |   |     .
816fb34812SFabrice Gasnier		        +-------+   +-------+
826fb34812SFabrice Gasnier		          +-+   +-+
836fb34812SFabrice Gasnier		  TRGO2   | |   | |
846fb34812SFabrice Gasnier		        +-+ +---+ +---------+
8593fbe91bSBenjamin Gaignard
8693fbe91bSBenjamin GaignardWhat:		/sys/bus/iio/devices/triggerX/master_mode
8793fbe91bSBenjamin GaignardKernelVersion:	4.11
8893fbe91bSBenjamin GaignardContact:	benjamin.gaignard@st.com
8993fbe91bSBenjamin GaignardDescription:
9093fbe91bSBenjamin Gaignard		Reading returns the current master modes.
9193fbe91bSBenjamin Gaignard		Writing set the master mode
9293fbe91bSBenjamin Gaignard
934adec7daSBenjamin GaignardWhat:		/sys/bus/iio/devices/iio:deviceX/in_count0_preset
944adec7daSBenjamin GaignardKernelVersion:	4.12
954adec7daSBenjamin GaignardContact:	benjamin.gaignard@st.com
964adec7daSBenjamin GaignardDescription:
974adec7daSBenjamin Gaignard		Reading returns the current preset value.
984adec7daSBenjamin Gaignard		Writing sets the preset value.
994adec7daSBenjamin Gaignard		When counting up the counter starts from 0 and fires an
1004adec7daSBenjamin Gaignard		event when reach preset value.
1014adec7daSBenjamin Gaignard		When counting down the counter start from preset value
1024adec7daSBenjamin Gaignard		and fire event when reach 0.
1034adec7daSBenjamin Gaignard
1042a830a45SBenjamin GaignardWhat:		/sys/bus/iio/devices/iio:deviceX/in_count_enable_mode_available
1052a830a45SBenjamin GaignardKernelVersion:	4.12
1062a830a45SBenjamin GaignardContact:	benjamin.gaignard@st.com
1072a830a45SBenjamin GaignardDescription:
1082a830a45SBenjamin Gaignard		Reading returns the list possible enable modes.
1092a830a45SBenjamin Gaignard
1102a830a45SBenjamin GaignardWhat:		/sys/bus/iio/devices/iio:deviceX/in_count0_enable_mode
1112a830a45SBenjamin GaignardKernelVersion:	4.12
1122a830a45SBenjamin GaignardContact:	benjamin.gaignard@st.com
1132a830a45SBenjamin GaignardDescription:
1142a830a45SBenjamin Gaignard		Configure the device counter enable modes, in all case
1152a830a45SBenjamin Gaignard		counting direction is set by in_count0_count_direction
1162a830a45SBenjamin Gaignard		attribute and the counter is clocked by the internal clock.
117*34433332SMauro Carvalho Chehab
1182a830a45SBenjamin Gaignard		always:
1192a830a45SBenjamin Gaignard			Counter is always ON.
1202a830a45SBenjamin Gaignard
1212a830a45SBenjamin Gaignard		gated:
1222a830a45SBenjamin Gaignard			Counting is enabled when connected trigger signal
1232a830a45SBenjamin Gaignard			level is high else counting is disabled.
1242a830a45SBenjamin Gaignard
1252a830a45SBenjamin Gaignard		triggered:
1262a830a45SBenjamin Gaignard			Counting is enabled on rising edge of the connected
1272a830a45SBenjamin Gaignard			trigger, and remains enabled for the duration of this
1282a830a45SBenjamin Gaignard			selected mode.
1299eba381bSBenjamin Gaignard
1309eba381bSBenjamin GaignardWhat:		/sys/bus/iio/devices/iio:deviceX/in_count_trigger_mode_available
1319eba381bSBenjamin GaignardKernelVersion:	4.13
1329eba381bSBenjamin GaignardContact:	benjamin.gaignard@st.com
1339eba381bSBenjamin GaignardDescription:
1349eba381bSBenjamin Gaignard		Reading returns the list possible trigger modes.
1359eba381bSBenjamin Gaignard
1369eba381bSBenjamin GaignardWhat:		/sys/bus/iio/devices/iio:deviceX/in_count0_trigger_mode
1379eba381bSBenjamin GaignardKernelVersion:	4.13
1389eba381bSBenjamin GaignardContact:	benjamin.gaignard@st.com
1399eba381bSBenjamin GaignardDescription:
1409eba381bSBenjamin Gaignard		Configure the device counter trigger mode
1419eba381bSBenjamin Gaignard		counting direction is set by in_count0_count_direction
1429eba381bSBenjamin Gaignard		attribute and the counter is clocked by the connected trigger
1439eba381bSBenjamin Gaignard		rising edges.
144