RockPi S + CS42448 I2S/I2C DAC setup

I assumed that radxa would put all the necessary patches into their bsp structure to make their mainline identical to this repo, but apparently there are some key differences.

But it’s ok, for the couple of modules I need to work on (mostly dwc2 and uac2 gadget function) the mainline code can be backported to this kernel, not many changes there since 6.1.

Anyway thank you very much, without your help I would never be able to move forward with this. It’s just a pitty nobody from Radxa stepped in, a simple recommendation to use their kernel repo instead of their bsp would have saved me many tens of hours…

Things are not so simple, as always. The radxa kernel is based on rockchip android kernel. E.g. Rockchip engineers make patches totally unrelated to rockchip HW which are never submitted upstream to the respective subsystems (such as changes to the USB gadget UAC2 function https://github.com/radxa/kernel/commit/01ccdd1489f1fd6006498aca34aad4dab5cac192 ).

So I end up with working I2S, but totally broken dwc2 USB gadget mode (which works perfectly in mainline). One must appreciate the RaspberryPi team which tracks mainline in their kernel very closely. This android kernel swamp is a nightmare…

Sorry for the offtopic, it’s just a frustratingly huge waste of time…

Actually the reason is missing CONFIG_ROCKCHIP_OPP=y in rk3308_linux_defconfig . As a result no operating points defined in rk3308.dtsi are used and all cores run at the initial 800MHz. After adding this config the cpufreq features start working and the SoC can be switched to any frequency, including the upstream-disabled 1.2 and 1.3GHz.

The actual frequency can be measured with the kernel perf tool

sudo ./perf stat sleep 1

 Performance counter stats for 'sleep 1':

              4.25 msec task-clock                       #    0.004 CPUs utilized          
                 3      context-switches                 #  706.242 /sec                   
                 0      cpu-migrations                   #    0.000 /sec                   
                54      page-faults                      #   12.712 K/sec                  
         5,437,117      cycles                           #    **1.280 GHz**                    
         1,385,027      instructions                     #    0.25  insn per cycle         
           245,433      branches                         #   57.778 M/sec                  
            27,744      branch-misses                    #   11.30% of all branches

Just FYI, found RK3308B-S based board - BPI-P2 PRO
It has better Wifi/BT chip onboard (BCM4345) b/g/n with 5Ghz support but board form factor is bigger though.

Thanks a lot for the link. To be honest - IMO this SoC’s audio features are very unique but standard boards offer only a sadly limited subset of all its capabilities. There are many SBCs with 8ch I/O I2S (starting at 10+ USD, up to RPi5 with its excellent software support and performance) . But this SoC allows up to 26 IO channels I2S at 384kHz/32bit (tested to be clean, with the android kernel of course :slight_smile: ) plus SPDIF IO plus 8ch ADC inputs with microphone preamps plus 8ch PDM inputs - all for 20USD incl. eMMC, while powered from the incoming USB port - that is VERY unique. I am looking at the Rock Pi S core board which offers almost all the important pins with very few external components required. For me it’s the only way of using this SoC to make it shine (in other words to make sense) compared to all the many other SoCs (most of which are more powerful and some of which offer incomparably better SW support).