← Documents Documentation/devicetree/bindings/sound/renesas,rsnd.txt GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings / Sound

Renesas R-Car sound

R-Car·RZ/G의 SRC·CTU·MIX·DVC·SSIU·SSI module과 multichannel 경로를 설명합니다.

Source pathDocumentation/devicetree/bindings/sound/renesas,rsnd.txt
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

renesas,rsnd.txt:1-255

R-Car·RZ/G의 SRC·CTU·MIX·DVC·SSIU·SSI module과 multichannel 경로를 설명합니다. 영어 원문 전체와 줄 좌표를 보존하고, 한국어 전문 번역에서는 module·property·command·source path를 원형으로 유지하며 ASCII 구조도와 표를 구조화해 제공합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

R-Car sound module 구성

1-20

Renesas R-Car 및 RZ/G sound(Gen2 이후)는 SCU(Sampling Rate Converter Unit), SSIU(Serial Sound Interface Unit), SSI(Serial Sound Interface)로 구성됩니다. SCU에는 SRC(Sampling Rate Converter)와 CMD가 있고 CMD 아래에는 CTU(Channel Transfer Unit), MIX(Mixer), DVC(Digital Volume and Mute Function)가 있습니다.

각 module의 channel 수, 연결 및 제한은 해당 SoC datasheet를 확인해야 합니다.

Multi-SSI와 TDM-SSI

21-29

Multichannel audio는 Multi-SSI 또는 TDM-SSI로 지원합니다. 6-channel의 경우 Multi-SSI는 stereo SSI 3개를 사용하고 TDM-SSI는 하나의 TDM stream을 사용합니다.

Module 선택과 연결 경로

30-57

SRC·CTU·MIX·DVC 사이의 연결 제한은 datasheet를 따라야 하며 DT가 각 module의 활성화 여부를 제어합니다. `${LINUX}/arch/arm/boot/dts/r8a7790-lager.dts`와 `${LINUX}/arch/arm/boot/dts/r8a7790.dts`가 참고 예제입니다.

Playback은 memory에서 SRC2, DVC0, SSIU0/SSI0을 거쳐 codec으로 진행하고 capture는 codec에서 SSIU1/SSI1, SRC3, DVC1을 거쳐 memory로 돌아옵니다.

R-Car playback·capture module chain
MEMSRC2DVC0SSIU0 / SSI0codec
codecSSIU1 / SSI1SRC3DVC1MEM

원문의 방향과 module 순서를 두 개의 경로로 재구성했습니다.

사용 가능한 phandle은 SRC0~SRC9, CTU00~CTU03 및 CTU10~CTU13, MIX0~MIX1, DVC0~DVC1, SSI0~SSI9입니다. 같은 index 행에 있는 module만 고정 연결되는 것은 아니며 datasheet의 connection limitation을 확인해야 합니다.

SRC rate conversion mode

58-89

SRC는 입력 sample rate `[xx]Hz`를 출력 `[yy]Hz`로 변환합니다. Asynchronous mode는 input과 output data가 서로 다른 clock을 사용하며 playback과 capture 모두에서 쓸 수 있습니다. `simple-scu-audio-card` 또는 `audio-graph-scu-card`가 필요합니다.

Synchronous mode는 input과 output이 같은 clock을 사용합니다. Digital TV처럼 system에 input clock이 없을 때 사용하며 playback에서만 쓸 수 있습니다. `SRC Out Rate` mixer control로 활성화하거나 48,000·44,100 Hz를 선택합니다.

SRC sampling-rate conversion
Input [xx] HzSRCOutput [yy] Hz

입력 sample rate가 SRC를 지나 출력 sample rate로 변환됩니다.

> amixer set "SRC Out Rate" on
> aplay xxxx.wav
> amixer set "SRC Out Rate" 48000
> amixer set "SRC Out Rate" 44100

CTU channel conversion

90-135

CTU는 `[xx]ch`를 `[yy]ch`로 변환하거나 output channel 순서를 교환합니다. 변환에는 matrix 설정이 필요하며 R-Car datasheet의 SCU operation·CMD functional block·`CTUn_SVxxR` 설명과 `${LINUX}/sound/soc/renesas/rcar/ctu.c` header comment를 참고합니다.

예시는 2-channel input의 channel 0과 1을 서로 바꿉니다. Output 0은 input 0×0 + input 1×1, output 1은 input 0×1 + input 1×0으로 계산하며 `CTU SV0`, `CTU SV1` coefficient 4,194,304를 사용합니다. `CTU Pass`로 connection만 변경할 수도 있습니다.

CTU channel transfer
Input [xx] chCTU matrixOutput [yy] ch

CTU가 channel 수 또는 channel mapping을 변환합니다.

Ex) Exchange output channel
 Input -> Output
  1ch  ->  0ch
  0ch  ->  1ch

  example of using matrix
        output 0ch = (input 0ch x 0) + (input 1ch x 1)
        output 1ch = (input 0ch x 1) + (input 1ch x 0)

        amixer set "CTU Reset" on
        amixer set "CTU Pass" 9,10
        amixer set "CTU SV0" 0,4194304
        amixer set "CTU SV1" 4194304,0

 example of changing connection
        amixer set "CTU Reset" on
        amixer set "CTU Pass" 2,1

MIX path merge

136-153

MIX는 두 sound path를 하나로 합칩니다. System에는 두 sound interface가 보이며 각각 재생한 stream이 MIX에서 병합됩니다. 이 구성에도 `simple-scu-audio-card` 또는 `audio-graph-scu-card`가 필요합니다.

R-Car MIX merge
MEM stream 0SRC1CTU02MIX0DVC0SSI0
MEM stream 1SRC2CTU03MIX0DVC0SSI0

두 memory playback path가 MIX0에서 합쳐져 하나의 DVC·SSI path로 나갑니다.

DVC volume·mute·ramp

154-179

DVC는 playback과 capture volume을 제어합니다. `DVC Out`과 `DVC In`으로 volume을, `DVC Out Mute`와 `DVC In Mute`로 mute를 제어합니다.

Volume ramp는 `DVC Out Ramp Up Rate`, `DVC Out Ramp Down Rate`, `DVC Out Ramp`를 설정해 단계적인 volume 변화를 적용합니다. 예제는 0.125 dB/64-step 상승과 0.125 dB/512-step 하강 rate를 사용합니다.

Playback Volume
        amixer set "DVC Out" 100%

Capture Volume
        amixer set "DVC In" 100%

Playback Mute
        amixer set "DVC Out Mute" on

Capture Mute
        amixer set "DVC In Mute" on

Volume Ramp
        amixer set "DVC Out Ramp Up Rate"   "0.125 dB/64 steps"
        amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
        amixer set "DVC Out Ramp" on
        aplay xxx.wav &
        amixer set "DVC Out"  80%  // Volume Down
        amixer set "DVC Out" 100%  // Volume Up

SSIU buffer와 TDM Split

180-209

SSIU는 buffer를 통해 일부 underrun·overrun error를 줄이지만 SSI가 PIO mode이면 사용할 수 없습니다. DMA mode에서는 SSI의 `no-busif`로 SSIU를 우회할 수 있습니다. SSIU는 TDM Split mode에 쓰는 BUSIF도 처리하며 driver는 audio-graph card 사용을 전제로 합니다.

TDM Split mode에서는 system에 네 sound interface가 보이고 각각의 2-channel stream이 SSIU30~SSIU33에서 SSIU3으로 합쳐져 8-channel codec stream이 됩니다.

aplay -D plughw:0,0 xxxx.wav &
aplay -D plughw:0,1 xxxx.wav &
aplay -D plughw:0,2 xxxx.wav &
aplay -D plughw:0,3 xxxx.wav
SSIU TDM Split 4×2ch → 8ch
MEM 0 (2ch)SSIU30SSIU3 (8ch)Codec
MEM 1 (2ch)SSIU31SSIU3 (8ch)Codec
MEM 2 (2ch)SSIU32SSIU3 (8ch)Codec
MEM 3 (2ch)SSIU33SSIU3 (8ch)Codec

네 개의 2-channel memory stream이 SSIU3에서 하나의 8-channel codec stream으로 병합됩니다.

SSI transfer·pin·multichannel mode

210-255

Connection 확인용 PIO mode는 `pio-transfer`로 활성화합니다. PIO에서는 DT가 다른 module을 선택해도 system이 SSI 이외의 module을 제거합니다.

&ssi0 {
        pio-transfer
};

DMA mode에서 SSIU 없이 동작하려면 `no-busif`를 사용하지만 underrun·overrun 또는 noise가 발생하기 쉽습니다.

&ssi0 {
        no-busif;
};

Platform이 지원하면 SSI끼리 WS pin을 공유할 수 있습니다. SSI1이 SSI0의 WS pin을 공유하는 예제는 `shared-pin`을 사용합니다.

&ssi1 {
        shared-pin;
};

Multi-SSI는 SSI0·SSI1·SSI2를 묶어 6-channel을 구성할 수 있습니다. TDM-SSI도 6-channel TDM을 지원하며 이 경우 driver가 TDM과 stereo mode를 자동 전환합니다.