0
guidol

[Info] FriendlyARM PCM5102A-Hat with NanoPi Neo under mainline

Recommended Posts

I did that on a NanoPi Neo with the FriendlyARM PCM5102A Hat

https://www.friendlyarm.com/index.php?route=product/product&product_id=169 )
using kernel 4.14.87-sunxi and armbian 5.67 (or later would be only 5.65?)
(before that I did use legacy kernel 3.4.x with the PCM510A)


and the armbian-BuildSystem

plus (THANKS to) informations in threads from  @dony71 , @Christos, @Valery Rezvyakov
and the the Reference-Threads you could find above :)

 

----------------------------------------------------------------------------------------------------------------------------------
BACKUP DTB (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

cp /boot/dtb/sun8i-h3-nanopi-neo.dtb /boot/dtb/sun8i-h3-nanopi-neo.dtb_org

 

----------------------------------------------------------------------------------------------------------------------------------
CONVERT dtb to dts (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

dtc -I dtb -O dts /boot/dtb/sun8i-h3-nanopi-neo.dtb -o /boot/dtb/sun8i-h3-nanopi-neo.dts

 

----------------------------------------------------------------------------------------------------------------------------------
EDIT 
/boot/dtb/sun8i-h3-nanopi-neo.dts
----------------------------------------------------------------------------------------------------------------------------------

nano /boot/dtb/sun8i-h3-nanopi-neo.dts

 

----------------------------------------------------------------------------------------------------------------------------------
FROM

 

                i2s@1c22000 {
                        #sound-dai-cells = <0x0>;
                        compatible = "allwinner,sun8i-h3-i2s";
                        reg = <0x1c22000 0x400>;
                        interrupts = <0x0 0xd 0x4>;
                        clocks = <0x3 0x38 0x3 0x54>;
                        clock-names = "apb", "mod";
                        dmas = <0x13 0x3 0x13 0x3>;
                        resets = <0x3 0x2b>;
                        dma-names = "rx", "tx";
                        status = "disabled";
                        phandle = <0x4e>;
                };

 


TO
 

                i2s@1c22000 {
                        #sound-dai-cells = <0x0>;
                        compatible = "allwinner,sun8i-h3-i2s";
                        reg = <0x1c22000 0x400>;
                        interrupts = <0x0 0xd 0x4>;
                        clocks = <0x3 0x38 0x3 0x54>;
                        clock-names = "apb", "mod";
                        dmas = <0x13 0x3 0x13 0x3>;
                        resets = <0x3 0x2b>;
                        dma-names = "rx", "tx";
                        status = "okay";
                        phandle = <0x4e>;
                };


----------------------------------------------------------------------------------------------------------------------------------
CONVERT (BACK) dts to dtb (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

dtc -I dts -O dtb /boot/dtb/sun8i-h3-nanopi-neo.dts -o /boot/dtb/sun8i-h3-nanopi-neo.dtb_I2S_okay

 

----------------------------------------------------------------------------------------------------------------------------------
COPY new dtb over dtb (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

cp /boot/dtb/sun8i-h3-nanopi-neo.dtb_I2S_okay /boot/dtb/sun8i-h3-nanopi-neo.dtb
                
----------------------------------------------------------------------------------------------------------------------------------
COPY sun8i-h3-I2S-out.dts to home (working directory on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

copy sun8i-h3-I2S-out.dts -->  /home/guido/

 

----------------------------------------------------------------------------------------------------------------------------------
armbian-add-overlay (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

root@npi-neo(192.168.6.24):/home/guido# armbian-add-overlay ./sun8i-h3-I2S-out.dts
Compiling the overlay
Copying the compiled overlay file to /boot/overlay-user/
Reboot is required to apply the changes


----------------------------------------------------------------------------------------------------------------------------------
dtbo is created (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

root@npi-neo(192.168.6.24):/home/guido# ls -l /boot/overlay-user/
insgesamt 4
-rw-r--r-- 1 root root 1323 Dez  7 19:34 sun8i-h3-I2S-out.dtbo

 

----------------------------------------------------------------------------------------------------------------------------------
user-overlay is created in /boot/armbianEnv.txt (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

verbosity=1
logo=disabled
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
overlays=usbhost1 usbhost2
rootdev=UUID=33ca90d6-130b-4d5f-a8f4-95b3b97ef5c0
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
user_overlays=sun8i-h3-I2S-out

 

----------------------------------------------------------------------------------------------------------------------------------
now REBOOT (on NanoPi Neo)

----------------------------------------------------------------------------------------------------------------------------------

root@npi-neo(192.168.6.24):~# lsmod|grep i2s

sun4i_i2s              16384  0
snd_soc_core          118784  2 sun4i_i2s,sun8i_codec_analog
snd_pcm                69632  3 sun4i_i2s,snd_pcm_dmaengine,snd_soc_core
 

----------------------------------------------------------------------------------------------------------------------------------
EDIT config-default.conf (on armbian-BuildSystem)
----------------------------------------------------------------------------------------------------------------------------------

cd /home/guido/build
nano ./config-default.conf

replace content /home/guido/build/config-default.conf with attached
config-default.conf_nanopineo

./compile

-> With this conf, script compilation will stop to overwrite kernel source to build patch
-> At that time, overwrite original Kconfig with the one you modified above

(at "Make changes to U-Boot" press ENTER to proceed)

wait for
"Make your changes to /home/guido/build/cache/sources/linux-mainline/linux-4.14.y then press ENTER"
BUT DONT PRESS ENTER YET

 

----------------------------------------------------------------------------------------------------------------------------------
EDIT/SAVE Kconfig in a 2nd shell-Window (on armbian-BuildSystem)
----------------------------------------------------------------------------------------------------------------------------------

nano /home/guido/build/cache/sources/linux-mainline/linux-4.14.y/sound/soc/codecs/Kconfig

 

the part FROM
 

config SND_SOC_PCM5102A
    tristate

TO
 

config SND_SOC_PCM5102A
    tristate "Texas Instruments PCM5102A CODEC - I2S"

 

----------------------------------------------------------------------------------------------------------------------------------
NOW PRESS ENTER in the 1st shell-Windows (.compile.sh) (on armbian-BuildSystem)

----------------------------------------------------------------------------------------------------------------------------------

-> Then script compilation will stop again to ask whether you want to add pcm5102a to compile
-> Default is N, so you need to enter m for module compilation

After compile is complete
 

----------------------------------------------------------------------------------------------------------------------------------
copy (via SCP/FTP?) the .deb's from /home/guido/build/output/debs (on armbian-BuildSystem) 
to /home/guido/ (on the NanoPi Neo)

----------------------------------------------------------------------------------------------------------------------------------

 

----------------------------------------------------------------------------------------------------------------------------------
INSTALL the .deb's (here only header and image - because it was already 5.67 (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

cd /home/guido 
dpkg -i ./linux-headers-next-sunxi_5.67_armhf.deb
dpkg -i ./linux-image-next-sunxi_5.67_armhf.deb
(image did include the .ko module for the pcm5102a)

 

----------------------------------------------------------------------------------------------------------------------------------

now REBOOT (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

 

=====================================================================================
=====================================================================================

!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ATTENTION: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
After reboot my NanoPi Neo show the following armbian-version:
ARMBIAN 5.65 stable Debian GNU/Linux 9 (stretch) 4.14.84-sunxi
and 2 upgrades for headers&image (without the PCM5102A support)

please keep in mind to freeze the kernel-updates in armbian-config
for not to loose the support (module) for the PCM5120A!
armbian-config -> system -> Freeze Disable kernel upgrades
=====================================================================================
=====================================================================================


----------------------------------------------------------------------------------------------------------------------------------
BE HAPPY about a successful i2s mapping in dmesg (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

root@npi-neo(192.168.6.24):~# dmesg|grep -i i2s
[    6.911751] asoc-simple-card sound_i2s: pcm5102a-hifi <-> 1c22000.i2s mapping ok

 

----------------------------------------------------------------------------------------------------------------------------------
I enabled also ananlog-Codec (on NanoPi Neo)
----------------------------------------------------------------------------------------------------------------------------------

root@npi-neo(192.168.6.24):/home/guido# aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: Codec [H3 Audio Codec], Gerät 0: CDC PCM Codec-0 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 1: I2Smaster [I2S-master], Gerät 0: 1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0


----------------------------------------------------------------------------------------------------------------------------------
/etc/asound.conf (on NanoPi Neo) - later I2S did switch automatically to card 0 :(
----------------------------------------------------------------------------------------------------------------------------------

 

pcm.!default {
    type hw
    card 1
    device 0
}

ctl.!default {
    type hw
    card 1
}


 

----------------------------------------------------------------------------------------------------------------------------------
Reference-Threads
----------------------------------------------------------------------------------------------------------------------------------

 

config-default.conf.mod_nanopineo

sun8i-h3-I2S-out.dts

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
0