256 lines · plain
1Renesas R-Car sound2 3=============================================4* Modules5=============================================6 7Renesas R-Car and RZ/G sound is constructed from below modules8(for Gen2 or later)9 10 SCU : Sampling Rate Converter Unit11 - SRC : Sampling Rate Converter12 - CMD13 - CTU : Channel Transfer Unit14 - MIX : Mixer15 - DVC : Digital Volume and Mute Function16 SSIU : Serial Sound Interface Unit17 SSI : Serial Sound Interface18 19See detail of each module's channels, connection, limitation on datasheet20 21=============================================22* Multi channel23=============================================24 25Multi channel is supported by Multi-SSI, or TDM-SSI.26 27 Multi-SSI : 6ch case, you can use stereo x 3 SSI28 TDM-SSI : 6ch case, you can use TDM29 30=============================================31* Enable/Disable each modules32=============================================33 34See datasheet to check SRC/CTU/MIX/DVC connect-limitation.35DT controls enabling/disabling module.36${LINUX}/arch/arm/boot/dts/r8a7790-lager.dts can be good example.37This is example of38 39Playback: [MEM] -> [SRC2] -> [DVC0] -> [SSIU0/SSI0] -> [codec]40Capture: [MEM] <- [DVC1] <- [SRC3] <- [SSIU1/SSI1] <- [codec]41 42see "Example: simple sound card"43 44You can use below.45${LINUX}/arch/arm/boot/dts/r8a7790.dts can be good example.46 47 &src0 &ctu00 &mix0 &dvc0 &ssi048 &src1 &ctu01 &mix1 &dvc1 &ssi149 &src2 &ctu02 &ssi250 &src3 &ctu03 &ssi351 &src4 &ssi452 &src5 &ctu10 &ssi553 &src6 &ctu11 &ssi654 &src7 &ctu12 &ssi755 &src8 &ctu13 &ssi856 &src9 &ssi957 58=============================================59* SRC (Sampling Rate Converter)60=============================================61 62 [xx]Hz [yy]Hz63 ------> [SRC] ------>64 65SRC can convert [xx]Hz to [yy]Hz. Then, it has below 2 modes66 67 Asynchronous mode: input data / output data are based on different clocks.68 you can use this mode on Playback / Capture69 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 Playback73 74------------------75** Asynchronous mode76------------------77 78You need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it.79see "Example: simple sound card for Asynchronous mode"80 81------------------82** Synchronous mode83------------------84 85 > amixer set "SRC Out Rate" on86 > aplay xxxx.wav87 > amixer set "SRC Out Rate" 4800088 > amixer set "SRC Out Rate" 4410089 90=============================================91* CTU (Channel Transfer Unit)92=============================================93 94 [xx]ch [yy]ch95 ------> [CTU] -------->96 97CTU can convert [xx]ch to [yy]ch, or exchange outputted channel.98CTU conversion needs matrix settings.99For more detail information, see below100 101 Renesas R-Car datasheet102 - Sampling Rate Converter Unit (SCU)103 - SCU Operation104 - CMD Block105 - Functional Blocks in CMD106 107 Renesas R-Car datasheet108 - Sampling Rate Converter Unit (SCU)109 - Register Description110 - CTUn Scale Value exx Register (CTUn_SVxxR)111 112 ${LINUX}/sound/soc/sh/rcar/ctu.c113 - comment of header114 115You need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it.116see "Example: simple sound card for channel convert"117 118Ex) Exchange output channel119 Input -> Output120 1ch -> 0ch121 0ch -> 1ch122 123 example of using matrix124 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" on128 amixer set "CTU Pass" 9,10129 amixer set "CTU SV0" 0,4194304130 amixer set "CTU SV1" 4194304,0131 132 example of changing connection133 amixer set "CTU Reset" on134 amixer set "CTU Pass" 2,1135 136=============================================137* MIX (Mixer)138=============================================139 140MIX merges 2 sounds path. You can see 2 sound interface on system,141and these sounds will be merged by MIX.142 143 aplay -D plughw:0,0 xxxx.wav &144 aplay -D plughw:0,1 yyyy.wav145 146You need to use "simple-scu-audio-card" or "audio-graph-scu-card" for it.147Ex)148 [MEM] -> [SRC1] -> [CTU02] -+-> [MIX0] -> [DVC0] -> [SSI0]149 |150 [MEM] -> [SRC2] -> [CTU03] -+151 152see "Example: simple sound card for MIXer"153 154=============================================155* DVC (Digital Volume and Mute Function)156=============================================157 158DVC controls Playback/Capture volume.159 160Playback Volume161 amixer set "DVC Out" 100%162 163Capture Volume164 amixer set "DVC In" 100%165 166Playback Mute167 amixer set "DVC Out Mute" on168 169Capture Mute170 amixer set "DVC In Mute" on171 172Volume Ramp173 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" on176 aplay xxx.wav &177 amixer set "DVC Out" 80% // Volume Down178 amixer set "DVC Out" 100% // Volume Up179 180=============================================181* SSIU (Serial Sound Interface Unit)182=============================================183 184SSIU can avoid some under/over run error, because it has some buffer.185But you can't use it if SSI was PIO mode.186In DMA mode, you can select not to use SSIU by using "no-busif" via SSI.187 188SSIU handles BUSIF which will be used for TDM Split mode.189This driver is assuming that audio-graph card will be used.190 191TDM Split mode merges 4 sounds. You can see 4 sound interface on system,192and 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.wav198 199 2ch 8ch200 [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 208see "Example: simple sound card for TDM Split"209 210=============================================211* SSI (Serial Sound Interface)212=============================================213 214** PIO mode215 216You can use PIO mode which is for connection check by using.217Note: The system will drop non-SSI modules in PIO mode218even though if DT is selecting other modules.219 220 &ssi0 {221 pio-transfer222 };223 224** DMA mode without SSIU225 226You can use DMA without SSIU.227Note: under/over run, or noise are likely to occur228 229 &ssi0 {230 no-busif;231 };232 233** PIN sharing234 235Each SSI can share WS pin. It is based on platform.236This is example if SSI1 want to share WS pin with SSI0237 238 &ssi1 {239 shared-pin;240 };241 242** Multi-SSI243 244You can use Multi-SSI.245This is example of SSI0/SSI1/SSI2 (= for 6ch)246 247see "Example: simple sound card for Multi channel"248 249** TDM-SSI250 251You can use TDM with SSI.252This is example of TDM 6ch.253Driver can automatically switches TDM <-> stereo mode in this case.254 255see "Example: simple sound card for TDM"256