xref: /freebsd/sys/contrib/device-tree/Bindings/sound/st,stm32-sai.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel VadotSTMicroelectronics STM32 Serial Audio Interface (SAI).
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotThe SAI interface (Serial Audio Interface) offers a wide set of audio protocols
4*c66ec88fSEmmanuel Vadotas I2S standards, LSB or MSB-justified, PCM/DSP, TDM, and AC'97.
5*c66ec88fSEmmanuel VadotThe SAI contains two independent audio sub-blocks. Each sub-block has
6*c66ec88fSEmmanuel Vadotits own clock generator and I/O lines controller.
7*c66ec88fSEmmanuel Vadot
8*c66ec88fSEmmanuel VadotRequired properties:
9*c66ec88fSEmmanuel Vadot  - compatible: Should be "st,stm32f4-sai" or "st,stm32h7-sai"
10*c66ec88fSEmmanuel Vadot  - reg: Base address and size of SAI common register set.
11*c66ec88fSEmmanuel Vadot  - clocks: Must contain phandle and clock specifier pairs for each entry
12*c66ec88fSEmmanuel Vadot	in clock-names.
13*c66ec88fSEmmanuel Vadot  - clock-names: Must contain "pclk" "x8k" and "x11k"
14*c66ec88fSEmmanuel Vadot	"pclk": Clock which feeds the peripheral bus interface.
15*c66ec88fSEmmanuel Vadot	        Mandatory for "st,stm32h7-sai" compatible.
16*c66ec88fSEmmanuel Vadot	        Not used for "st,stm32f4-sai" compatible.
17*c66ec88fSEmmanuel Vadot	"x8k": SAI parent clock for sampling rates multiple of 8kHz.
18*c66ec88fSEmmanuel Vadot	"x11k": SAI parent clock for sampling rates multiple of 11.025kHz.
19*c66ec88fSEmmanuel Vadot  - interrupts: cpu DAI interrupt line shared by SAI sub-blocks
20*c66ec88fSEmmanuel Vadot
21*c66ec88fSEmmanuel VadotOptional properties:
22*c66ec88fSEmmanuel Vadot  - resets: Reference to a reset controller asserting the SAI
23*c66ec88fSEmmanuel Vadot
24*c66ec88fSEmmanuel VadotSAI subnodes:
25*c66ec88fSEmmanuel VadotTwo subnodes corresponding to SAI sub-block instances A et B can be defined.
26*c66ec88fSEmmanuel VadotSubnode can be omitted for unsused sub-block.
27*c66ec88fSEmmanuel Vadot
28*c66ec88fSEmmanuel VadotSAI subnodes required properties:
29*c66ec88fSEmmanuel Vadot  - compatible: Should be "st,stm32-sai-sub-a" or "st,stm32-sai-sub-b"
30*c66ec88fSEmmanuel Vadot	for SAI sub-block A or B respectively.
31*c66ec88fSEmmanuel Vadot  - reg: Base address and size of SAI sub-block register set.
32*c66ec88fSEmmanuel Vadot  - clocks: Must contain one phandle and clock specifier pair
33*c66ec88fSEmmanuel Vadot	for sai_ck which feeds the internal clock generator.
34*c66ec88fSEmmanuel Vadot	If the SAI shares a master clock, with another SAI set as MCLK
35*c66ec88fSEmmanuel Vadot	clock provider, SAI provider phandle must be specified here.
36*c66ec88fSEmmanuel Vadot  - clock-names: Must contain "sai_ck".
37*c66ec88fSEmmanuel Vadot	Must also contain "MCLK", if SAI shares a master clock,
38*c66ec88fSEmmanuel Vadot	with a SAI set as MCLK clock provider.
39*c66ec88fSEmmanuel Vadot  - dmas: see Documentation/devicetree/bindings/dma/st,stm32-dma.yaml
40*c66ec88fSEmmanuel Vadot  - dma-names: identifier string for each DMA request line
41*c66ec88fSEmmanuel Vadot	"tx": if sai sub-block is configured as playback DAI
42*c66ec88fSEmmanuel Vadot	"rx": if sai sub-block is configured as capture DAI
43*c66ec88fSEmmanuel Vadot  - pinctrl-names: should contain only value "default"
44*c66ec88fSEmmanuel Vadot  - pinctrl-0: see Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml
45*c66ec88fSEmmanuel Vadot
46*c66ec88fSEmmanuel VadotSAI subnodes Optional properties:
47*c66ec88fSEmmanuel Vadot  - st,sync: specify synchronization mode.
48*c66ec88fSEmmanuel Vadot	By default SAI sub-block is in asynchronous mode.
49*c66ec88fSEmmanuel Vadot	This property sets SAI sub-block as slave of another SAI sub-block.
50*c66ec88fSEmmanuel Vadot	Must contain the phandle and index of the sai sub-block providing
51*c66ec88fSEmmanuel Vadot	the synchronization.
52*c66ec88fSEmmanuel Vadot  - st,iec60958: support S/PDIF IEC6958 protocol for playback
53*c66ec88fSEmmanuel Vadot	IEC60958 protocol is not available for capture.
54*c66ec88fSEmmanuel Vadot	By default, custom protocol is assumed, meaning that protocol is
55*c66ec88fSEmmanuel Vadot	configured according to protocol defined in related DAI link node,
56*c66ec88fSEmmanuel Vadot	such as i2s, left justified, right justified, dsp and pdm protocols.
57*c66ec88fSEmmanuel Vadot	Note: ac97 protocol is not supported by SAI driver
58*c66ec88fSEmmanuel Vadot   - #clock-cells: should be 0. This property must be present if the SAI device
59*c66ec88fSEmmanuel Vadot	is a master clock provider, according to clocks bindings, described in
60*c66ec88fSEmmanuel Vadot	Documentation/devicetree/bindings/clock/clock-bindings.txt.
61*c66ec88fSEmmanuel Vadot
62*c66ec88fSEmmanuel VadotThe device node should contain one 'port' child node with one child 'endpoint'
63*c66ec88fSEmmanuel Vadotnode, according to the bindings defined in Documentation/devicetree/bindings/
64*c66ec88fSEmmanuel Vadotgraph.txt.
65*c66ec88fSEmmanuel Vadot
66*c66ec88fSEmmanuel VadotExample:
67*c66ec88fSEmmanuel Vadotsound_card {
68*c66ec88fSEmmanuel Vadot	compatible = "audio-graph-card";
69*c66ec88fSEmmanuel Vadot	dais = <&sai1b_port>;
70*c66ec88fSEmmanuel Vadot};
71*c66ec88fSEmmanuel Vadot
72*c66ec88fSEmmanuel Vadotsai1: sai1@40015800 {
73*c66ec88fSEmmanuel Vadot	compatible = "st,stm32h7-sai";
74*c66ec88fSEmmanuel Vadot	#address-cells = <1>;
75*c66ec88fSEmmanuel Vadot	#size-cells = <1>;
76*c66ec88fSEmmanuel Vadot	ranges = <0 0x40015800 0x400>;
77*c66ec88fSEmmanuel Vadot	reg = <0x40015800 0x4>;
78*c66ec88fSEmmanuel Vadot	clocks = <&rcc SAI1_CK>, <&rcc PLL1_Q>, <&rcc PLL2_P>;
79*c66ec88fSEmmanuel Vadot	clock-names = "pclk", "x8k", "x11k";
80*c66ec88fSEmmanuel Vadot	interrupts = <87>;
81*c66ec88fSEmmanuel Vadot
82*c66ec88fSEmmanuel Vadot	sai1a: audio-controller@40015804 {
83*c66ec88fSEmmanuel Vadot		compatible = "st,stm32-sai-sub-a";
84*c66ec88fSEmmanuel Vadot		reg = <0x4 0x1C>;
85*c66ec88fSEmmanuel Vadot		clocks = <&rcc SAI1_CK>;
86*c66ec88fSEmmanuel Vadot		clock-names = "sai_ck";
87*c66ec88fSEmmanuel Vadot		dmas = <&dmamux1 1 87 0x400 0x0>;
88*c66ec88fSEmmanuel Vadot		dma-names = "tx";
89*c66ec88fSEmmanuel Vadot		pinctrl-names = "default";
90*c66ec88fSEmmanuel Vadot		pinctrl-0 = <&pinctrl_sai1a>;
91*c66ec88fSEmmanuel Vadot
92*c66ec88fSEmmanuel Vadot		sai1b_port: port {
93*c66ec88fSEmmanuel Vadot			cpu_endpoint: endpoint {
94*c66ec88fSEmmanuel Vadot				remote-endpoint = <&codec_endpoint>;
95*c66ec88fSEmmanuel Vadot				format = "i2s";
96*c66ec88fSEmmanuel Vadot			};
97*c66ec88fSEmmanuel Vadot		};
98*c66ec88fSEmmanuel Vadot	};
99*c66ec88fSEmmanuel Vadot};
100*c66ec88fSEmmanuel Vadot
101*c66ec88fSEmmanuel Vadotaudio-codec {
102*c66ec88fSEmmanuel Vadot	codec_port: port {
103*c66ec88fSEmmanuel Vadot		codec_endpoint: endpoint {
104*c66ec88fSEmmanuel Vadot			remote-endpoint = <&cpu_endpoint>;
105*c66ec88fSEmmanuel Vadot		};
106*c66ec88fSEmmanuel Vadot	};
107*c66ec88fSEmmanuel Vadot};
108