Jump to content

[Info] FriendlyARM PCM5102A-Hat with NanoPi Neo under mainline 4.x.x and dev 5.x.x


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

 

- change: status from "disabled" to "okay"

----------------------------------------------------------------------------------------------------------------------------------
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)

does only work if you got the kernel-headers installed for your actual kernel-version

(at this time the lastest kernel-header are (via armbian-config -> Software -> Install Headers)

Linux kernel headers for 4.14.84-sunxi on armhf - so NOT for kernel 4.19.y)
----------------------------------------------------------------------------------------------------------------------------------

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
Texas Instruments PCM5102A CODEC - I2S (SND_SOC_PCM5102A) [N/m/?] (NEW) m = 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

Link to comment
Share on other sites

Yesterday I did read on twitter about a new 4.19.y armbian for the Neo - so I did try that with my PCM5102A-Hat:
 

Quote

Added polished, minimal and top performant #Bionic or #Stretch based images with optimised @linuxfoundation K4.19.y, @armbian hardware configurator and @armbian software installer for @AllwinnerTech #H3 powered #nanopineo https://www.armbian.com/nanopi-neo

 

I did try it like in my instructions above in this thread, but failed (again) with the armbian-add-overlay part.

armbian-add-overlay told me that it cant compile a overlay-dts.

I did found the information that this is because of the missing kernel-headers - the older dtc did told this "secret".

 

OK - I did try to install the kernel-headers via armbian-config -> software, BUT this will not install the kernel-headers for the current kernel-version :(

It will only install the latest available as kernel-header-package.

 

Latest available was 4.14.87 and I did use the new "next" 4.19

 

So I had to use at first the armbian-build-system to create the following .deb's for me :
 

-rw-r--r-- 1 root root   173380 Jan 11 21:43 linux-dtb-next-sunxi_5.70_armhf.deb
-rw-r--r-- 1 root root 10608812 Jan 11 21:43 linux-headers-next-sunxi_5.70_armhf.deb
-rw-r--r-- 1 root root 19933808 Jan 11 21:43 linux-image-next-sunxi_5.70_armhf.deb
-rw-r--r-- 1 root root   171212 Jan 11 20:39 linux-u-boot-next-nanopineo_5.70_armhf.deb

While editing the Kconfig file I did see the name/path has changed

from 

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

to 

/home/guido/build/cache/sources/linux-mainline/orange-pi-4.19/sound/soc/codecs/Kconfig

but there was nothing to change because it was already
[EDIT] there was nothing to change, because it was the 2nd compile and the patch was created at the 1st compile.

 

( @dony71 did you also see that there isnt to change anything? I am not sure about the menu-driven screen after selecting m for Module,
  but it did work and create the module)

config SND_SOC_PCM5102A
    tristate "Texas Instruments PCM5102A CODEC - I2S"

 

After installing the .deb's I hadnt no problem anymore with armbian-add-overlay - because now I had the right kernel-headers for my kernel :)

 

Later I converted the .dtb to .dts, edited the .dts and converted it back to .dtb

 

Now the PCM5102A-Hat is running under

ARMBIAN 5.69 stable Debian GNU/Linux 9 (stretch) 4.19.13-sunxi

Linux npi-neo 4.19.13-sunxi #5.70 SMP Fri Jan 11 21:40:58 +03 2019 armv7l GNU/Linux

 

dmesg|grep -i i2s
 

[    8.524723] asoc-simple-card sound_i2s: pcm5102a-hifi <-> 1c22000.i2s mapping ok

aplay -l
 

**** List of PLAYBACK Hardware Devices ****
card 0: Codec [H3 Audio Codec], device 0: CDC PCM Codec-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: I2Smaster [I2S-master], device 0: 1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0


FOR SURE: I did freeze the kernel/updates in armbian-config to keep my PCM5102A working after updating in the future ;)

 

Link to comment
Share on other sites

Around  8 months later I did test my instructions with my NanoPi Neo and 

Debian Buster with Armbian Linux 5.3.3-sunxi <== dev-version
package bsp-kernel[5.98] u-boot[5.98] dtb[5.98] firmware[5.98] config[5.98]

 

Some changes:

 

1.) in the actual armbian-build-system there is no more a ./build/config-default.conf

now you have (after backuping the file) to fill in the content of the attached config-example.conf
to ./build/userpatches/config-example.conf


On my mind I recall there is a symbolic link from ./build/userpatches/config-default.conf
to ./build/userpatches/config-example.conf - so I edited this file ;)

 

2.) for the actual Armbian Linux 5.3.3-sunxi <== dev-version
you have to edit /home/guido/build/cache/sources/linux-mainline/orange-pi-5.3/sound/soc/codecs/Kconfig
( former filenames: 

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

/home/guido/build/cache/sources/linux-mainline/orange-pi-4.19/sound/soc/codecs/Kconfig )
 

from

config SND_SOC_PCM5102A
        tristate

to

config SND_SOC_PCM5102A
        tristate "Texas Instruments PCM5102A CODEC - I2S"

 

gentle reminder: (because I missed it again while compiling  and had to compile 3 times :( )

when asked about compiling the PCM5102A module press m

Texas Instruments PCM5102A CODEC - I2S (SND_SOC_PCM5102A) [N/m/?] (NEW) m = m for module compilation

 

But with these changes it also does work with kernel 5.3.3 armbian dev debian buster :)

 

Debian Buster with Armbian Linux 5.3.3-sunxi
package bsp-kernel[5.98] u-boot[5.98] dtb[5.98] firmware[5.98] config[5.98]

# lsmod |grep i2s

sun4i_i2s              20480  2
snd_soc_core          118784  6 sun4i_codec,sun4i_i2s,sun8i_codec_analog,snd_soc_simple_card_utils,snd_soc_pcm5102a,snd_soc_simple_card
snd_pcm                65536  4 sun4i_codec,sun4i_i2s,snd_pcm_dmaengine,snd_soc_core

# dmesg|grep i2s

[   11.866626] asoc-simple-card sound_i2s: pcm5102a-hifi <-> 1c22000.i2s mapping ok

# aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: I2Smaster [I2S-master], device 0: 1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

# find / -name pcm5102a* 2>/dev/null

/sys/kernel/debug/asoc/I2S-master/pcm5102a
/sys/devices/platform/pcm5102a
/sys/firmware/devicetree/base/__symbols__/pcm5102a
/sys/firmware/devicetree/base/pcm5102a
/sys/bus/platform/devices/pcm5102a
/sys/bus/platform/drivers/pcm5102a-codec
/sys/bus/platform/drivers/pcm5102a-codec/pcm5102a
/usr/src/linux-headers-5.3.3-sunxi/include/config/snd/soc/pcm5102a.h

 

config-example.conf

Link to comment
Share on other sites

3 hours ago, TonyMac32 said:

@guidol should we have an I2S overlay for the H3 boards?  I don't see why not...

Yes ;) a working overlay would be fine if there is also support included for the 5102A in the kernel :)

 

see
 

config SND_SOC_PCM5102A
        tristate "Texas Instruments PCM5102A CODEC - I2S"

above...

Link to comment
Share on other sites

on a new compiled it also worked on my NanoPi Neo and the PCM5102A-Hat
with armbian Bullseye and dev-kernel :) 
 

 _   _ ____  _   _   _
| \ | |  _ \(_) | \ | | ___  ___
|  \| | |_) | | |  \| |/ _ \/ _ \
| |\  |  __/| | | |\  |  __/ (_) |
|_| \_|_|   |_| |_| \_|\___|\___/

Welcome to Armbian bullseye with Linux 5.5.8-sunxi

No end-user support: built from trunk & unsupported (bullseye) userspace!

package bsp-kernel[20.05.0-trunk] u-boot[20.05.0-trunk] dtb   [20.05.0-trunk]
firmware          [20.05.0-trunk] config[20.05.0-trunk] branch[dev]

uname -a
Linux npi-neo-25 5.5.8-sunxi #trunk SMP Fri Mar 20 16:22:45 +03 2020 armv7l GNU/Linux

aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: I2Smaster [I2S-master], Gerät 0: 1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0 [1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0]
  Sub-Geräte: 0/1
  Sub-Gerät #0: subdevice #0
    
lsmod|grep snd
snd_soc_simple_card    16384  1
snd_soc_simple_card_utils    16384  1 snd_soc_simple_card
snd_soc_pcm5102a       16384  1
snd_soc_core          118784  5 sun4i_i2s,sun8i_codec_analog,snd_soc_simple_card_utils,snd_soc_pcm5102a,snd_soc_simple_card
snd_pcm_dmaengine      16384  1 snd_soc_core
snd_pcm                69632  4 sun4i_i2s,snd_pcm_dmaengine,snd_soc_core
snd_timer              24576  1 snd_pcm
snd                    45056  4 snd_timer,snd_soc_core,snd_pcm
soundcore              16384  1 snd
    
apt-mark hold linux-dtb-dev-sunxi
linux-dtb-dev-sunxi auf Halten gesetzt.

apt-mark showhold
linux-dtb-dev-sunxi    
    

 

Link to comment
Share on other sites

does work - as expected - also on armbian focal dev:
 

Welcome to Armbian Focal with Linux 5.6.16-sunxi
package bsp-kernel[20.08.0-trunk] u-boot[20.08.0-trunk] dtb   [20.08.0-trunk]
firmware          [20.08.0-trunk] config[20.08.0-trunk] branch[dev]

Linux npi-neo 5.6.16-sunxi #trunk SMP Sat Jun 6 00:13:28 +03 2020 armv7l armv7l armv7l GNU/Linux

**** List of PLAYBACK Hardware Devices ****
card 0: I2Smaster [I2S-master], device 0: 1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0 [1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Had only to activate I2S in .dtb and "add-overlay" sun8i-h3-I2S-out.dts ;)

and for sure

apt-mark hold linux-dtb-dev-sunxi

Link to comment
Share on other sites

Today I tested volumio ( https://volumio.org/ )

Quote

The audiophile music player designed and
fine-tuned for high quality music playback.
Free and Open Source Forever.

on a x86-system and a Raspberry Pi3 and on a webpage I did read that a PCM5102A DAC can be used with the Raspberry Pi (40 Pin header) as a HiFiBerry-DAC.

So I searched how to connect the FriendlyARM (Neo) PCM5102A-Hat to the Raspberry 40-pin header:
 

I2S Raspberry Pi
https://raspberrypi.stackexchange.com/questions/76188/how-to-make-pcm5102-dac-work-on-raspberry-pi-zerow
https://blog.himbeer.me/2018/12/27/how-to-connect-a-pcm5102-i2s-dac-to-your-raspberry-pi/
http://wiki.friendlyarm.com/wiki/index.php/NanoHat_PCM5102A
 
DAC BOARD   > Raspberry Pi 3 Model B connector J8
PCM5102A
12 Pin							cablecolor	signal
=======================================================================================
GND         > PIN 6     (GND) Ground			BLACK		GND
.
DIN         > PIN 40    (GPIO21)			WHITE		I2S/PCM Serial Data Input
BCK         > PIN 12    (GPIO18)			GREY		I2S/PCM Sample Rate Clock
LRCK        > PIN 35    (GPIO19)			VIOLETT		I2S/PCM Sample Rate Clock/Sync
.
.
.
.
.
.
VIN         > PIN 2     (5V)				BROWN		5V Power In
=======================================================================================

At he first configuration of Volumio configure I2S as active and select as I2S-DAC-type HiFiBerry DAC or Generic I2S DAC

nanopi_PCM5102A_cabled.jpg

RPi3_nanopi_PCM5102A_detail.jpg

RPi3_nanopi_PCM5102A_Overview.jpg

I2S_HiFiBerry_Setting.jpg

Link to comment
Share on other sites

I  want a digital music player base on NanoPi NEO,  with device PCM5102A I2S sound card build.

here is my pross: 

1: Kernel: uname -a
Linux nanopineo 5.8.14-sunxi #trunk SMP Sun Oct 11 18:51:16 CST 2020 armv7l armv7l armv7l GNU/Linux

 

2: build u-boot and kernel with armbian--build , and It is passed, so wirite the IMG file to sd card!.

 

3: I use command dtc to conver dtb to source, and chang I2S, SPI0, IR0,CODEC
i2s@1c22000 ---->okay
codec@1c22c00 --->okay
spi@1c68000 --->okay
ir@1f02000 --->okay
from 'disable' to 'okay', 
filename="sun8i-h3-nanopi-neo_OK-IR-I2S-SPI0.dts". and then build to "sun8i-h3-nanopi-neo.dtb", and copy to /boot/dtb directory.  

 

4: I use 'armbian-add-overly  ./sun8i-h3-nanopi-neo_OK-IR-I2S-SPI0.dts' to create a user dtbo file, and reboot whth in /boot/armbinEnv.txt

 

5: file pcm5102 has been created successfuly.
root@nanopineo:~# ls -l /lib/modules/5.8.14-sunxi/kernel/sound/soc/codecs/snd-soc-pcm5102a.ko 
-rw-r--r-- 1 root root 6733 Oct 11 18:51 /lib/modules/5.8.14-sunxi/kernel/sound/soc/codecs/snd-soc-pcm5102a.ko

 

6: Now, /dev/lirc0, /dev/spidev0.0,  /dev/snd build ok!
root@nanopineo:~# ls /dev/sp*
/dev/spidev0.0
root@nanopineo:~# ls /dev/s*
/dev/spidev0.0  /dev/stderr  /dev/stdin  /dev/stdout

/dev/shm:

/dev/snd:
by-path  controlC0  pcmC0D0c  pcmC0D0p  seq  timer


7: aplay info:
 aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Codec [H3 Audio Codec], device 0: CDC PCM Codec-0 [CDC PCM Codec-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 

8: dmesg info:
[    3.630710] debugfs: Directory '1c22c00.codec' with parent 'H3 Audio Codec' already present!
[    3.632908] sun4i-codec 1c22c00.codec: Codec <-> 1c22c00.codec mapping ok
[   11.555242] cedrus 1c0e000.video-codec: Device registered as /dev/video0

 

9: but when I play a mp3 music, report error:
--------- play report -------------
play WARN alsa: can't encode 0-bit Unknown or not applicable
play FAIL formats: no handler for file extension `mp3'
----------mplayer report:----------------
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)

9: small TFT driver fb_ili9341 call method has change, fbtft_device is not exist with this versin, so, I turn on it is a long way!!

10, PCM5102A work error! where is error ??? help !  I have a long way .

Link to comment
Share on other sites

4 hours ago, spender said:


7: aplay info:
 aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Codec [H3 Audio Codec], device 0: CDC PCM Codec-0 [CDC PCM Codec-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 

8: dmesg info:
[    3.630710] debugfs: Directory '1c22c00.codec' with parent 'H3 Audio Codec' already present!
[    3.632908] sun4i-codec 1c22c00.codec: Codec <-> 1c22c00.codec mapping ok
[   11.555242] cedrus 1c0e000.video-codec: Device registered as /dev/video0

 

the soundcard H3 Audio Codec is only the "normal" analog audio device - not a I2S-audio device.
 

I also got since 5.8.x kernels the problem with a NanoPi A64 that 

1c22c00.codec mapping ok

but I cant get any sound out of the I2S-audio-device.

 

I think its not only a NanoPi Neo problem :( - but when the I2S device like

Karte 1: I2Smaster [I2S-master], Gerät 0: 1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0 []

doenst show up - then there is another problem in your .dtb/.dts :(

Link to comment
Share on other sites

@spender

PCM5102A-Test with Raspberry did end here ;) - so I could test my instructions with armbian buster and Kernel 5.9.0

again on the NanoPi Neo :) 

 

I had only to

- enable (from disabled to okay) i2s@1c22000 in .dtb (decomple and compile)

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

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

 

- build / addoverlay (  armbian-add-overlay ./sun8i-h3-I2S-out.dts )

- create /etc/asound.conf
[EDIT]
- apt-mark hold linux-dtb-dev-sunxi

- reboot

 

and it works again very well:
 

 _   _ ____  _   _   _
| \ | |  _ \(_) | \ | | ___  ___
|  \| | |_) | | |  \| |/ _ \/ _ \
| |\  |  __/| | | |\  |  __/ (_) |
|_| \_|_|   |_| |_| \_|\___|\___/

Welcome to Armbian 20.08.11 Buster with Linux 5.9.0-sunxi

package bsp-kernel[20.08.11] u-boot[20.08.11] dtb   [20.08.11]
firmware          [20.08.11] config[20.08.11] branch[dev]

root@npi-neo-25(192.168.6.25):~# aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: I2Smaster [I2S-master], Gerät 0: 1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0 [1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0

root@npi-neo-25(192.168.6.25):~# nano /etc/asound.conf
# ====================================================
pcm.!default {
    type hw
    card 0
    device 0
}

ctl.!default {
    type hw
    card 0
}
# ====================================================

root@npi-neo-25(192.168.6.25):/toshiba# mpg123 -v -b 1024 ./Powerup.mp3

 

sun8i-h3-I2S-out.dts

Link to comment
Share on other sites

8 hours ago, spender said:

According to the method you introduced, the music played happily. thank you very much.  Good good study, day day UP.

@spender for not loosing the .dtb-change (disabled to okay) you also have to set the dtb-package on hold
(here armbian dev example):

apt-mark hold linux-dtb-dev-sunxi
linux-dtb-dev-sunxi auf Halten gesetzt.

apt-mark showhold
linux-dtb-dev-sunxi

if you are not using dev you could find your dtb-packe with the following command:
root@npi-neo-25(192.168.6.25):~# dpkg -l|grep dtb
linux-dtb-dev-sunxi		20.08.11	armhf	Linux DTB, version 5.9.0-sunxi

 

Link to comment
Share on other sites

Thanks again! There is a new knowledge point! Identified as not modifying dtb.
Now I am trying to add an ILI9341 screen to IT. Since the new kernel no longer supports fbtft_device.ko, it is modified to be defined by DT in dtb. I don't know yet. I am learning how to learn overlay to revise, just like this pcm5102a. If you don’t understand, try to add it yourself. If it is really unclear, I will post for help! enjoy working!

20201018155708.jpg

Link to comment
Share on other sites

1 hour ago, spender said:

@spender If you don’t understand, try to add it yourself. If it is really unclear, I will post for help! enjoy working!

Sorry - Iam not a big specialist in dtb-files. So I cant help you with the display :( 

It could be very difficult/impossible to support the display via dtb when the kernel doenst support it.
But as I remember reading teh forum you did aleready got a own thread for the display (or was it another member of the form)?:

 

Link to comment
Share on other sites

change of .dtb (activating 1c22000) & creating overlay (armbian-add-overlay ./sun8i-h3-I2S-out.dts) does also work on 

uname -a
Linux npi-neo-25 5.10.0-sunxi #trunk SMP Wed Dec 16 17:45:03 +03 2020 armv7l GNU/Linux

package bsp-kernel[21.02.0-trunk] u-boot[21.02.0-trunk] dtb   [21.02.0-trunk]
firmware          [21.02.0-trunk] config[21.02.0-trunk] branch[dev]

like before on kernel 5.9.0 ;)

Link to comment
Share on other sites

  • guidol changed the title to [Info] FriendlyARM PCM5102A-Hat with NanoPi Neo under mainline 4.x.x and dev 5.x.x

Instead of manipulating the main device tree, enabling i2s@1c22000 should be possible via overlay as well, like:

    fragment@0 {
        target-path = "/soc/i2s@1c22000";
        __overlay__ {
            status = "okay";
        };
    };

 

Hence the whole overlay:

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun8i-h3";

    fragment@0 {
        target-path = "/soc/i2s@1c22000";
        __overlay__ {
            status = "okay";
        };
    };

    fragment@1 { 
        target-path = "/"; 
        __overlay__ { 
            pcm5102a: pcm5102a {
                #sound-dai-cells = <0>;
                compatible = "ti,pcm5102a";
                pcm510x,format = "i2s";
            };
        };
     };

    fragment@2 {
        target = <&i2s0>;
        __overlay__ {
            status = "okay";
            pinctrl-0 = <&i2s0_pins>;
            sound-dai = <&pcm5102a>;
            pinctrl-names = "default";
        };
    };

    fragment@3 {
        target-path = "/";
        __overlay__ {
            sound_i2s {
                compatible = "simple-audio-card";
                simple-audio-card,name = "I2S-master";
                simple-audio-card,mclk-fs = <256>;
                simple-audio-card,format = "i2s";
                status = "okay";
                simple-audio-card,cpu {
                    sound-dai = <&i2s0>;
                };
                simple-audio-card,codec {
                    sound-dai = <&pcm5102a>;
                };
            };
        };
    };
};


I will verify that the path /soc/i2s@1c22000 is correct, I guess there is a symbol for this as well, but obviously it is not <&i2s0>.

Link to comment
Share on other sites

Good afternoon dear Gurus!
I have a Nano Pe Neo Armbian board.
It turned out to output sound to the 5102 chip using your theme.
The question arose how can I output sound in TDM format.
I use the ADAU1452 chip, but I think that this is not important.
As I understand it, you need to correctly register the overlay. but I'm confused. can you please. if it's not difficult, explain how to correctly register the audio settings file for alsa so that I have 4 sound cards in tdm format to output armbian.
thank you very much. Posted in the wrong thread last time. I'm sorry

Link to comment
Share on other sites

I may not have written correctly, I would like to transmit several channels on the i2s bus at the same time 6 pcs. As I understand it, you can take any chip that supports multichannel transmission such as front left, right, rear, left right and centre and subwoofer. These chips should just use the method not left justify but tdm

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines