xref: /freebsd/sys/contrib/device-tree/Bindings/sound/renesas,rsnd.txt (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
1c66ec88fSEmmanuel VadotRenesas R-Car sound
2c66ec88fSEmmanuel Vadot
3c66ec88fSEmmanuel Vadot=============================================
4c66ec88fSEmmanuel Vadot* Modules
5c66ec88fSEmmanuel Vadot=============================================
6c66ec88fSEmmanuel Vadot
7c66ec88fSEmmanuel VadotRenesas R-Car and RZ/G sound is constructed from below modules
8c66ec88fSEmmanuel Vadot(for Gen2 or later)
9c66ec88fSEmmanuel Vadot
10c66ec88fSEmmanuel Vadot SCU		: Sampling Rate Converter Unit
11c66ec88fSEmmanuel Vadot  - SRC		: Sampling Rate Converter
12c66ec88fSEmmanuel Vadot  - CMD
13c66ec88fSEmmanuel Vadot   - CTU	: Channel Transfer Unit
14c66ec88fSEmmanuel Vadot   - MIX	: Mixer
15c66ec88fSEmmanuel Vadot   - DVC	: Digital Volume and Mute Function
16c66ec88fSEmmanuel Vadot SSIU		: Serial Sound Interface Unit
17c66ec88fSEmmanuel Vadot SSI		: Serial Sound Interface
18c66ec88fSEmmanuel Vadot
19c66ec88fSEmmanuel VadotSee detail of each module's channels, connection, limitation on datasheet
20c66ec88fSEmmanuel Vadot
21c66ec88fSEmmanuel Vadot=============================================
22c66ec88fSEmmanuel Vadot* Multi channel
23c66ec88fSEmmanuel Vadot=============================================
24c66ec88fSEmmanuel Vadot
25c66ec88fSEmmanuel VadotMulti channel is supported by Multi-SSI, or TDM-SSI.
26c66ec88fSEmmanuel Vadot
27c66ec88fSEmmanuel Vadot Multi-SSI	: 6ch case, you can use stereo x 3 SSI
28c66ec88fSEmmanuel Vadot TDM-SSI	: 6ch case, you can use TDM
29c66ec88fSEmmanuel Vadot
30c66ec88fSEmmanuel Vadot=============================================
31c66ec88fSEmmanuel Vadot* Enable/Disable each modules
32c66ec88fSEmmanuel Vadot=============================================
33c66ec88fSEmmanuel Vadot
34c66ec88fSEmmanuel VadotSee datasheet to check SRC/CTU/MIX/DVC connect-limitation.
35c66ec88fSEmmanuel VadotDT controls enabling/disabling module.
36c66ec88fSEmmanuel Vadot${LINUX}/arch/arm/boot/dts/r8a7790-lager.dts can be good example.
37c66ec88fSEmmanuel VadotThis is example of
38c66ec88fSEmmanuel Vadot
39c66ec88fSEmmanuel VadotPlayback: [MEM] -> [SRC2] -> [DVC0] -> [SSIU0/SSI0] -> [codec]
40c66ec88fSEmmanuel VadotCapture:  [MEM] <- [DVC1] <- [SRC3] <- [SSIU1/SSI1] <- [codec]
41c66ec88fSEmmanuel Vadot
42c66ec88fSEmmanuel Vadotsee "Example: simple sound card"
43c66ec88fSEmmanuel Vadot
44c66ec88fSEmmanuel VadotYou can use below.
45c66ec88fSEmmanuel Vadot${LINUX}/arch/arm/boot/dts/r8a7790.dts can be good example.
46c66ec88fSEmmanuel Vadot
47c66ec88fSEmmanuel Vadot	&src0	&ctu00	&mix0	&dvc0	&ssi0
48c66ec88fSEmmanuel Vadot	&src1	&ctu01	&mix1	&dvc1	&ssi1
49c66ec88fSEmmanuel Vadot	&src2	&ctu02			&ssi2
50c66ec88fSEmmanuel Vadot	&src3	&ctu03			&ssi3
51c66ec88fSEmmanuel Vadot	&src4				&ssi4
52c66ec88fSEmmanuel Vadot	&src5	&ctu10			&ssi5
53c66ec88fSEmmanuel Vadot	&src6	&ctu11			&ssi6
54c66ec88fSEmmanuel Vadot	&src7	&ctu12			&ssi7
55c66ec88fSEmmanuel Vadot	&src8	&ctu13			&ssi8
56c66ec88fSEmmanuel Vadot	&src9				&ssi9
57c66ec88fSEmmanuel Vadot
58c66ec88fSEmmanuel Vadot=============================================
59c66ec88fSEmmanuel Vadot* SRC (Sampling Rate Converter)
60c66ec88fSEmmanuel Vadot=============================================
61c66ec88fSEmmanuel Vadot
62c66ec88fSEmmanuel Vadot [xx]Hz        [yy]Hz
63c66ec88fSEmmanuel Vadot ------> [SRC] ------>
64c66ec88fSEmmanuel Vadot
65c66ec88fSEmmanuel VadotSRC can convert [xx]Hz to [yy]Hz. Then, it has below 2 modes
66c66ec88fSEmmanuel Vadot
67c66ec88fSEmmanuel Vadot Asynchronous mode:	input data / output data are based on different clocks.
68c66ec88fSEmmanuel Vadot			you can use this mode on Playback / Capture
69c66ec88fSEmmanuel Vadot Synchronous mode:	input data / output data are based on same clocks.
70c66ec88fSEmmanuel Vadot			This mode will be used if system doesn't have its input clock,
71c66ec88fSEmmanuel Vadot			for example digital TV case.
72c66ec88fSEmmanuel Vadot			you can use this mode on Playback
73c66ec88fSEmmanuel Vadot
74c66ec88fSEmmanuel Vadot------------------
75c66ec88fSEmmanuel Vadot**     Asynchronous mode
76c66ec88fSEmmanuel Vadot------------------
77c66ec88fSEmmanuel Vadot
78c66ec88fSEmmanuel VadotYou need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it.
79c66ec88fSEmmanuel Vadotsee "Example: simple sound card for Asynchronous mode"
80c66ec88fSEmmanuel Vadot
81c66ec88fSEmmanuel Vadot------------------
82c66ec88fSEmmanuel Vadot**     Synchronous mode
83c66ec88fSEmmanuel Vadot------------------
84c66ec88fSEmmanuel Vadot
85c66ec88fSEmmanuel Vadot	> amixer set "SRC Out Rate" on
86c66ec88fSEmmanuel Vadot	> aplay xxxx.wav
87c66ec88fSEmmanuel Vadot	> amixer set "SRC Out Rate" 48000
88c66ec88fSEmmanuel Vadot	> amixer set "SRC Out Rate" 44100
89c66ec88fSEmmanuel Vadot
90c66ec88fSEmmanuel Vadot=============================================
91c66ec88fSEmmanuel Vadot* CTU (Channel Transfer Unit)
92c66ec88fSEmmanuel Vadot=============================================
93c66ec88fSEmmanuel Vadot
94c66ec88fSEmmanuel Vadot [xx]ch        [yy]ch
95c66ec88fSEmmanuel Vadot ------> [CTU] -------->
96c66ec88fSEmmanuel Vadot
97*aa1a8ff2SEmmanuel VadotCTU can convert [xx]ch to [yy]ch, or exchange outputted channel.
98c66ec88fSEmmanuel VadotCTU conversion needs matrix settings.
99c66ec88fSEmmanuel VadotFor more detail information, see below
100c66ec88fSEmmanuel Vadot
101c66ec88fSEmmanuel Vadot	Renesas R-Car datasheet
102c66ec88fSEmmanuel Vadot	 - Sampling Rate Converter Unit (SCU)
103c66ec88fSEmmanuel Vadot	  - SCU Operation
104c66ec88fSEmmanuel Vadot	   - CMD Block
105c66ec88fSEmmanuel Vadot	    - Functional Blocks in CMD
106c66ec88fSEmmanuel Vadot
107c66ec88fSEmmanuel Vadot	Renesas R-Car datasheet
108c66ec88fSEmmanuel Vadot	 - Sampling Rate Converter Unit (SCU)
109c66ec88fSEmmanuel Vadot	  - Register Description
110c66ec88fSEmmanuel Vadot	   - CTUn Scale Value exx Register (CTUn_SVxxR)
111c66ec88fSEmmanuel Vadot
112c66ec88fSEmmanuel Vadot	${LINUX}/sound/soc/sh/rcar/ctu.c
113c66ec88fSEmmanuel Vadot	 - comment of header
114c66ec88fSEmmanuel Vadot
115c66ec88fSEmmanuel VadotYou need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it.
116c66ec88fSEmmanuel Vadotsee "Example: simple sound card for channel convert"
117c66ec88fSEmmanuel Vadot
118c66ec88fSEmmanuel VadotEx) Exchange output channel
119c66ec88fSEmmanuel Vadot Input -> Output
120c66ec88fSEmmanuel Vadot  1ch  ->  0ch
121c66ec88fSEmmanuel Vadot  0ch  ->  1ch
122c66ec88fSEmmanuel Vadot
123c66ec88fSEmmanuel Vadot  example of using matrix
124c66ec88fSEmmanuel Vadot	output 0ch = (input 0ch x 0) + (input 1ch x 1)
125c66ec88fSEmmanuel Vadot	output 1ch = (input 0ch x 1) + (input 1ch x 0)
126c66ec88fSEmmanuel Vadot
127c66ec88fSEmmanuel Vadot	amixer set "CTU Reset" on
128c66ec88fSEmmanuel Vadot	amixer set "CTU Pass" 9,10
129c66ec88fSEmmanuel Vadot	amixer set "CTU SV0" 0,4194304
130c66ec88fSEmmanuel Vadot	amixer set "CTU SV1" 4194304,0
131c66ec88fSEmmanuel Vadot
132c66ec88fSEmmanuel Vadot example of changing connection
133c66ec88fSEmmanuel Vadot	amixer set "CTU Reset" on
134c66ec88fSEmmanuel Vadot	amixer set "CTU Pass" 2,1
135c66ec88fSEmmanuel Vadot
136c66ec88fSEmmanuel Vadot=============================================
137c66ec88fSEmmanuel Vadot* MIX (Mixer)
138c66ec88fSEmmanuel Vadot=============================================
139c66ec88fSEmmanuel Vadot
140c66ec88fSEmmanuel VadotMIX merges 2 sounds path. You can see 2 sound interface on system,
141c66ec88fSEmmanuel Vadotand these sounds will be merged by MIX.
142c66ec88fSEmmanuel Vadot
143c66ec88fSEmmanuel Vadot	aplay -D plughw:0,0 xxxx.wav &
144c66ec88fSEmmanuel Vadot	aplay -D plughw:0,1 yyyy.wav
145c66ec88fSEmmanuel Vadot
146c66ec88fSEmmanuel VadotYou need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it.
147c66ec88fSEmmanuel VadotEx)
148c66ec88fSEmmanuel Vadot	[MEM] -> [SRC1] -> [CTU02] -+-> [MIX0] -> [DVC0] -> [SSI0]
149c66ec88fSEmmanuel Vadot	                            |
150c66ec88fSEmmanuel Vadot	[MEM] -> [SRC2] -> [CTU03] -+
151c66ec88fSEmmanuel Vadot
152c66ec88fSEmmanuel Vadotsee "Example: simple sound card for MIXer"
153c66ec88fSEmmanuel Vadot
154c66ec88fSEmmanuel Vadot=============================================
155c66ec88fSEmmanuel Vadot* DVC (Digital Volume and Mute Function)
156c66ec88fSEmmanuel Vadot=============================================
157c66ec88fSEmmanuel Vadot
158c66ec88fSEmmanuel VadotDVC controls Playback/Capture volume.
159c66ec88fSEmmanuel Vadot
160c66ec88fSEmmanuel VadotPlayback Volume
161c66ec88fSEmmanuel Vadot	amixer set "DVC Out" 100%
162c66ec88fSEmmanuel Vadot
163c66ec88fSEmmanuel VadotCapture Volume
164c66ec88fSEmmanuel Vadot	amixer set "DVC In" 100%
165c66ec88fSEmmanuel Vadot
166c66ec88fSEmmanuel VadotPlayback Mute
167c66ec88fSEmmanuel Vadot	amixer set "DVC Out Mute" on
168c66ec88fSEmmanuel Vadot
169c66ec88fSEmmanuel VadotCapture Mute
170c66ec88fSEmmanuel Vadot	amixer set "DVC In Mute" on
171c66ec88fSEmmanuel Vadot
172c66ec88fSEmmanuel VadotVolume Ramp
173c66ec88fSEmmanuel Vadot	amixer set "DVC Out Ramp Up Rate"   "0.125 dB/64 steps"
174c66ec88fSEmmanuel Vadot	amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
175c66ec88fSEmmanuel Vadot	amixer set "DVC Out Ramp" on
176c66ec88fSEmmanuel Vadot	aplay xxx.wav &
177c66ec88fSEmmanuel Vadot	amixer set "DVC Out"  80%  // Volume Down
178c66ec88fSEmmanuel Vadot	amixer set "DVC Out" 100%  // Volume Up
179c66ec88fSEmmanuel Vadot
180c66ec88fSEmmanuel Vadot=============================================
181c66ec88fSEmmanuel Vadot* SSIU (Serial Sound Interface Unit)
182c66ec88fSEmmanuel Vadot=============================================
183c66ec88fSEmmanuel Vadot
184c66ec88fSEmmanuel VadotSSIU can avoid some under/over run error, because it has some buffer.
185c66ec88fSEmmanuel VadotBut you can't use it if SSI was PIO mode.
186c66ec88fSEmmanuel VadotIn DMA mode, you can select not to use SSIU by using "no-busif" via SSI.
187c66ec88fSEmmanuel Vadot
188c66ec88fSEmmanuel VadotSSIU handles BUSIF which will be used for TDM Split mode.
189c66ec88fSEmmanuel VadotThis driver is assuming that audio-graph card will be used.
190c66ec88fSEmmanuel Vadot
191c66ec88fSEmmanuel VadotTDM Split mode merges 4 sounds. You can see 4 sound interface on system,
192c66ec88fSEmmanuel Vadotand these sounds will be merged SSIU/SSI.
193c66ec88fSEmmanuel Vadot
194c66ec88fSEmmanuel Vadot	aplay -D plughw:0,0 xxxx.wav &
195c66ec88fSEmmanuel Vadot	aplay -D plughw:0,1 xxxx.wav &
196c66ec88fSEmmanuel Vadot	aplay -D plughw:0,2 xxxx.wav &
197c66ec88fSEmmanuel Vadot	aplay -D plughw:0,3 xxxx.wav
198c66ec88fSEmmanuel Vadot
199c66ec88fSEmmanuel Vadot	          2ch                     8ch
200c66ec88fSEmmanuel Vadot	[MEM] -> [SSIU 30] -+-> [SSIU 3] --> [Codec]
201c66ec88fSEmmanuel Vadot	          2ch       |
202c66ec88fSEmmanuel Vadot	[MEM] -> [SSIU 31] -+
203c66ec88fSEmmanuel Vadot	          2ch       |
204c66ec88fSEmmanuel Vadot	[MEM] -> [SSIU 32] -+
205c66ec88fSEmmanuel Vadot	          2ch       |
206c66ec88fSEmmanuel Vadot	[MEM] -> [SSIU 33] -+
207c66ec88fSEmmanuel Vadot
208c66ec88fSEmmanuel Vadotsee "Example: simple sound card for TDM Split"
209c66ec88fSEmmanuel Vadot
210c66ec88fSEmmanuel Vadot=============================================
211c66ec88fSEmmanuel Vadot* SSI (Serial Sound Interface)
212c66ec88fSEmmanuel Vadot=============================================
213c66ec88fSEmmanuel Vadot
214c66ec88fSEmmanuel Vadot**  PIO mode
215c66ec88fSEmmanuel Vadot
216c66ec88fSEmmanuel VadotYou can use PIO mode which is for connection check by using.
217c66ec88fSEmmanuel VadotNote: The system will drop non-SSI modules in PIO mode
218c66ec88fSEmmanuel Vadoteven though if DT is selecting other modules.
219c66ec88fSEmmanuel Vadot
220c66ec88fSEmmanuel Vadot	&ssi0 {
221c66ec88fSEmmanuel Vadot		pio-transfer
222c66ec88fSEmmanuel Vadot	};
223c66ec88fSEmmanuel Vadot
224c66ec88fSEmmanuel Vadot** DMA mode without SSIU
225c66ec88fSEmmanuel Vadot
226c66ec88fSEmmanuel VadotYou can use DMA without SSIU.
227c66ec88fSEmmanuel VadotNote: under/over run, or noise are likely to occur
228c66ec88fSEmmanuel Vadot
229c66ec88fSEmmanuel Vadot	&ssi0 {
230c66ec88fSEmmanuel Vadot		no-busif;
231c66ec88fSEmmanuel Vadot	};
232c66ec88fSEmmanuel Vadot
233c66ec88fSEmmanuel Vadot** PIN sharing
234c66ec88fSEmmanuel Vadot
235c66ec88fSEmmanuel VadotEach SSI can share WS pin. It is based on platform.
236c66ec88fSEmmanuel VadotThis is example if SSI1 want to share WS pin with SSI0
237c66ec88fSEmmanuel Vadot
238c66ec88fSEmmanuel Vadot	&ssi1 {
239c66ec88fSEmmanuel Vadot		shared-pin;
240c66ec88fSEmmanuel Vadot	};
241c66ec88fSEmmanuel Vadot
242c66ec88fSEmmanuel Vadot** Multi-SSI
243c66ec88fSEmmanuel Vadot
244c66ec88fSEmmanuel VadotYou can use Multi-SSI.
245c66ec88fSEmmanuel VadotThis is example of SSI0/SSI1/SSI2 (= for 6ch)
246c66ec88fSEmmanuel Vadot
247c66ec88fSEmmanuel Vadotsee "Example: simple sound card for Multi channel"
248c66ec88fSEmmanuel Vadot
249c66ec88fSEmmanuel Vadot** TDM-SSI
250c66ec88fSEmmanuel Vadot
251c66ec88fSEmmanuel VadotYou can use TDM with SSI.
252c66ec88fSEmmanuel VadotThis is example of TDM 6ch.
253c66ec88fSEmmanuel VadotDriver can automatically switches TDM <-> stereo mode in this case.
254c66ec88fSEmmanuel Vadot
255c66ec88fSEmmanuel Vadotsee "Example: simple sound card for TDM"
256