Open zavdimka opened 5 months ago
Find solution
Use only overlay with out edit main DTB.
/dts-v1/;
/plugin/;
/ {
fragment@0{
target-path = "/soc@3000000/pinctrl@300b000";
__overlay__ {
i2c0_pins: i2c0-pins {
pins = "PI1\0PI2";
function = "i2s0";
drive-strength = <0x14>;
bias-disable;
};
i2c0tx_pins: i2c0tx-pins {
pins = "PI3";
function = "i2s0_dout0";
drive-strength = <0x14>;
bias-disable;
};
i2c0rx_pins: i2c0rx-pins {
pins = "PI4";
function = "i2s0_din0";
drive-strength = <0x14>;
bias-disable;
};
i2c0sleep_pins: i2c0sleep-pins{
pins = "PI0\0PI1\0PI2\0PI3\0PI4";
function = "gpio_in";
drive-strength = <0x14>;
bias-disable;
};
};
};
fragment@1 {
target-path = "/soc@3000000/ahub0_plat";
__overlay__ {
status = "okay";
pinctrl_used;
pinctrl-names = "default\0sleep";
pinctrl-0 = <&i2c0_pins &i2c0tx_pins &i2c0rx_pins>;
pinctrl-1 = <&i2c0sleep_pins>;
};
};
fragment@2 {
target-path = "/soc@3000000/ahub0_mach";
__overlay__ {
status = "okay";
};
};
};
But when I test it with AUDIODEV=hw:2,0 play -V -r 48000 -n -b 16 -c 2 synth sin 440 vol -12dB there still no sound. cat /sys/kernel/debug/pinctrl/300b000.pinctrl/pinmux-pins gives
pin 257 (PI1): device soc@3000000:ahub0_plat function i2s0 group PI1
pin 258 (PI2): device soc@3000000:ahub0_plat function i2s0 group PI2
pin 259 (PI3): device soc@3000000:ahub0_plat function i2s0_dout0 group PI3
pin 260 (PI4): device soc@3000000:ahub0_plat function i2s0_din0 group PI4
Update:
Need to select in alsamixer for card ahubdam
Item I2S0 Src Select [APBIF_TXDIF0]
Hi Dmitriy, I really would love to get this i2s interface going on my Orange Pi Zero 2W. Seems you solved this. Could you give me some more details, how you managed it ?
Hey @zavdimka, I have a feeling that I'm following your steps. Here is the DTS:
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h616";
fragment@0 {
target = <&pio>;
__overlay__ {
ahub_daudio0_pins_a: ahub_daudio0@0 {
pins = "PI0", "PI1", "PI2";
function = "i2s0";
drive-strength = <0x14>;
bias-disable;
};
ahub_daudio0_pins_b: ahub_daudio0@1 {
pins = "PI3";
function = "i2s0_dout0";
drive-strength = <0x14>;
bias-disable;
};
ahub_daudio0_pins_c: ahub_daudio0@2 {
pins = "PI4";
function = "i2s0_din0";
drive-strength = <0x14>;
bias-disable;
};
ahub_daudio0_pins_d: ahub_daudio0_sleep {
pins = "PI0", "PI1", "PI2", "PI3", "PI4";
function = "gpio_in";
drive-strength = <0x14>;
bias-disable;
};
};
};
fragment@1 {
target-path = "/soc";
__overlay__ {
ahub0_plat: ahub0_plat {
#sound-dai-cells = <0>;
compatible = "allwinner,sunxi-snd-plat-ahub";
apb_num = <0>; /* for dma port 3 */
dmas = <&dma 3>, <&dma 3>;
dma-names = "tx", "rx";
playback_cma = <128>;
capture_cma = <128>;
tx_fifo_size = <128>;
rx_fifo_size = <128>;
pinctrl-names = "default", "sleep";
pinctrl_used;
pinctrl-0 = <&ahub_daudio0_pins_a>, <&ahub_daudio0_pins_b>, <&ahub_daudio0_pins_c>;
pinctrl-1 = <&ahub_daudio0_pins_d>;
status = "okay";
};
ahub0_mach: ahub0_mach {
compatible = "allwinner,sunxi-snd-mach";
soundcard-mach,name = "ahubi2s0";
soundcard-mach,format = "i2s";
status = "okay";
soundcard-mach,cpu {
sound-dai = <&ahub0_plat>;
};
soundcard-mach,codec {
};
};
};
};
};
...but what I got is:
[ 9.671505] [sound 231][AHUB_DAM snd_soc_sunxi_ahub_mem_get] regmap is invalid
[ 9.671520] [sound 1342][AHUB sunxi_ahub_dev_probe] remap get failed
[ 9.671526] sunxi-snd-plat-ahub: probe of soc:ahub0_plat failed with error -22
Did you manage to sort it out?
The overlays posted here didn't work for me but I tweaked them and got it working on the Orange Pi Zero 2W 5.4.125 ubuntu focal image.
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target = <&pio>;
__overlay__ {
ahub_daudio0_pins_a: ahub_daudio0@0 {
pins = "PI0", "PI1", "PI2";
function = "i2s0";
drive-strength = <0x14>;
bias-disable;
};
ahub_daudio0_pins_b: ahub_daudio0@1 {
pins = "PI3";
function = "i2s0_dout0";
drive-strength = <0x14>;
bias-disable;
};
ahub_daudio0_pins_c: ahub_daudio0@2 {
pins = "PI4";
function = "i2s0_din0";
drive-strength = <0x14>;
bias-disable;
};
ahub_daudio0_pins_d: ahub_daudio0_sleep {
pins = "PI0", "PI1", "PI2", "PI3", "PI4";
function = "gpio_in";
drive-strength = <0x14>;
bias-disable;
};
};
};
fragment@1 {
target-path = "/soc@3000000/ahub0_plat";
__overlay__ {
status = "okay";
pinctrl-0 = <&ahub_daudio0_pins_a>, <&ahub_daudio0_pins_b>;
pinctrl-1 = <&ahub_daudio0_pins_d>;
pinctrl-names = "default", "sleep";
};
};
fragment@2 {
target-path = "/soc@3000000/ahub0_mach";
__overlay__ {
status = "okay";
};
};
};
I output my audio to a pcm5102 DAC using the following configuration:
PI0 --> I2S SCK PI1 --> I2S BCK PI2 --> I2S LCK PI3 --> I2S DATA 3.3V --> to VIN power of DAC board\ GND --> to GND power of DAC board\
If you do not need the MCLK/SCK pin and would prefer not to have it in the overlay, just remove PI0. I didn't integrate the PI4/DIN0 because I'm still working on microphone support.
Hi people, I'm new to this platform. Would you care to elaborate on how to make this work? Thanks!
I'm really sorry for offtop but I find this repo the most powerfull about device tree H616 based board. If it not get you into trouble, can you help to make i2s0 work. (PI0-PI 4) There are some records about i2s in dts file but it still don't touch any pins. Can you give advise next step to make it work?
DTS file original from image with out any changes