vitalic
Posts: 21
Joined: Tue Sep 20, 2016 7:29 pm

Merge 2 DTS

Wed Apr 17, 2019 5:27 pm

Hallo,

i allready tried to merge 2 DTS to have 1 DTB after compiling to get my both cards connected via GPIO to work via I2S.

Hifiberry DAC uses this DTS

Code: Select all

// Definitions for HiFiBerry DAC
/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2708";

	[email protected] {
		target = <&sound>;
		__overlay__ {
			compatible = "hifiberry,hifiberry-dac";
			i2s-controller = <&i2s>;
			status = "okay";
		};
	};

	[email protected] {
		target = <&i2s>;
		__overlay__ {
			status = "okay";
		};
	};

	[email protected] {
		target-path = "/";
		__overlay__ {
			pcm5102a-codec {
				#sound-dai-cells = <0>;
				compatible = "ti,pcm5102a";
				status = "okay";
			};
		};
	};
};
DABboard uses this one (first code is decompiled from audiosense-pi second is the original one from github with include)

Code: Select all

/dts-v1/;

/ {
	compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

	[email protected] {
		target = <&i2s>;
		__overlay__ {
			status = "okay";
		};
	};

	[email protected] {
		target-path = "/";
		__overlay__ {
			codec-reg-1v8 {
				compatible = "regulator-fixed";
				regulator-name = "tlv320aic3204_1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-always-on;
			};
		};
	};

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			codec-rst {
				brcm,pins = <0x1a>;
				brcm,function = <0x1>;
			};
		};
	};

	[email protected] {
		target = <&i2c1>;

		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			codec_osc {
				compatible = "fixed-clock";
				#clock-cells = <0x0>;
				clock-frequency = <0xb71b00>;
			};

			[email protected] {
				#sound-dai-cells = <0x0>;
				compatible = "ti,tlv320aic32x4";
				reg = <0x18>;
				clocks = <0x1>;
				clock-names = "mclk";
				iov-supply = <&vdd_3v3_reg>;
				ldoin-supply = <&vdd_3v3_reg>;
				gpio-controller;
				#gpio-cells = <0x2>;
				reset-gpios = <&gpio 0x1a 0x0>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&sound>;

		__overlay__ {
			compatible = "as,audiosense-pi";
			i2s-controller = <&i2s>;
			status = "okay";
		};
	};

	__symbols__ {
		codec_reg_1v8 = "/[email protected]/__overlay__/codec-reg-1v8";
		codec_rst = "/[email protected]/__overlay__/codec-rst";
		codec_osc = "/[email protected]/__overlay__/codec_osc";
		codec = "/[email protected]/__overlay__/[email protected]";
	};

	__fixups__ {
		i2s = "/[email protected]:target:0", "/[email protected]/__overlay__:i2s-controller:0";
		gpio = "/[email protected]:target:0", "/[email protected]/__overlay__/[email protected]:reset-gpios:0";
		i2c1 = "/[email protected]:target:0";
		vdd_3v3_reg = "/[email protected]/__overlay__/[email protected]:iov-supply:0", "/[email protected]/__overlay__/[email protected]:ldoin-supply:0";
		sound = "/[email protected]:target:0";
	};

	__local_fixups__ {

		[email protected] {

			__overlay__ {

				[email protected] {
					clocks = <0x0>;
				};
			};
		};
	};
};
i wasn't able to compile this one, although i tried to use /include/ instead of #include

Code: Select all

// Definitions for audiosense add on soundcard
/dts-v1/;
/plugin/;
#include <dt-bindings/pinctrl/bcm2835.h>
#include <dt-bindings/gpio/gpio.h>

/ {
	compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

	[email protected] {
		target = <&i2s>;
		__overlay__ {
			status = "okay";
		};
	};

	[email protected] {
		target-path = "/";
		__overlay__ {
			codec_reg_1v8: codec-reg-1v8 {
				compatible = "regulator-fixed";
				regulator-name = "tlv320aic3204_1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-always-on;
			};
		};
	};

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			codec_rst: codec-rst {
				brcm,pins = <26>;
				brcm,function = <BCM2835_FSEL_GPIO_OUT>;
			};
		};
	};

	[email protected] {
		target = <&i2c1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			/* audio external oscillator */
			codec_osc: codec_osc {
				compatible = "fixed-clock";
				#clock-cells = <0>;
				clock-frequency = <12000000>;	/* 12 MHz */
			};

			codec: [email protected] {
				#sound-dai-cells = <0>;
				compatible = "ti,tlv320aic32x4";
				reg = <0x18>;

				clocks = <&codec_osc>;
				clock-names = "mclk";

				iov-supply = <&vdd_3v3_reg>;
				ldoin-supply = <&vdd_3v3_reg>;

				gpio-controller;
				#gpio-cells = <2>;
				reset-gpios = <&gpio 26 GPIO_ACTIVE_HIGH>;

				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&sound>;
		__overlay__ {
			compatible = "as,audiosense-pi";
			i2s-controller = <&i2s>;
			status = "okay";
		};
	};
};
So my first tries managed to mkae the Hifiberry work with this merged code:

Code: Select all

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

    [email protected] {
        target = <&sound>;
        __overlay__ {
            compatible = "simple-audio-card";
            simple-audio-card,name = "Dual";

            status="okay";

            capture_link: simple-audio-card,[email protected] {
                format = "i2s";

                r_cpu_dai: cpu {
                    sound-dai = <&i2s>;

/* example TDM slot configuration
                    dai-tdm-slot-num = <2>;
                    dai-tdm-slot-width = <32>;
*/
                };

                r_codec_dai: codec {
                    sound-dai = <&codec_in>;
                };
            };

            playback_link: simple-audio-card,[email protected] {
                format = "i2s";

                p_cpu_dai: cpu {
                    sound-dai = <&i2s>;

/* example TDM slot configuration
                    dai-tdm-slot-num = <2>;
                    dai-tdm-slot-width = <32>;
*/
                };

                p_codec_dai: codec {
                    sound-dai = <&codec_out>;
                };
            };
        };
    };

    [email protected] {
        target-path = "/";
        __overlay__ {
            codec_out: spdif-transmitter {
                #address-cells = <0>;
                #size-cells = <0>;
                #sound-dai-cells = <0>;
                compatible = "ti,pcm5102a";
                status = "okay";
            };
            codec_in: spdif-receiver {
                #address-cells = <0>;
                #size-cells = <0>;
                #sound-dai-cells = <0>;
                compatible = "linux,spdif-dir";
                status = "okay";
            };
        };
    };

    [email protected] {
        target = <&i2s>;
        __overlay__ {
            #sound-dai-cells = <0>;
            status = "okay";
        };
    };
};
Trying to use

Code: Select all

compatible = "ti,tlv320aic32x4"
for the DABboard in [email protected] caused aplay -l not to find the Hifiberry anymore.

With the merged DTS i have shown, the Hifiberry worked. Sound was clear.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2072
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Merge 2 DTS

Wed Apr 17, 2019 9:21 pm

First of all, you can make it easier to compile the audiosense overlay by replacing the symbols constant macros with their real values. The decompiled version handily tells us what to substitute:

Code: Select all

// Definitions for audiosense add on soundcard
/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

	[email protected] {
		target = <&i2s>;
		__overlay__ {
			status = "okay";
		};
	};

	[email protected] {
		target-path = "/";
		__overlay__ {
			codec_reg_1v8: codec-reg-1v8 {
				compatible = "regulator-fixed";
				regulator-name = "tlv320aic3204_1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-always-on;
			};
		};
	};

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			codec_rst: codec-rst {
				brcm,pins = <26>;
				brcm,function = <1>; // BCM2835_FSEL_GPIO_OUT
			};
		};
	};

	[email protected] {
		target = <&i2c1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			/* audio external oscillator */
			codec_osc: codec_osc {
				compatible = "fixed-clock";
				#clock-cells = <0>;
				clock-frequency = <12000000>;	/* 12 MHz */
			};

			codec: [email protected] {
				#sound-dai-cells = <0>;
				compatible = "ti,tlv320aic32x4";
				reg = <0x18>;

				clocks = <&codec_osc>;
				clock-names = "mclk";

				iov-supply = <&vdd_3v3_reg>;
				ldoin-supply = <&vdd_3v3_reg>;

				gpio-controller;
				#gpio-cells = <2>;
				reset-gpios = <&gpio 26 0>; // GPIO_ACTIVE_HIGH

				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&sound>;
		__overlay__ {
			compatible = "as,audiosense-pi";
			i2s-controller = <&i2s>;
			status = "okay";
		};
	};
};
Otherwise you need to run cpp on the source with the correct include paths pointing to the kernel headers, feeding the output file to dtc.

The rest is more advanced and will take a bit longer.

vitalic
Posts: 21
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Thu Apr 18, 2019 10:12 am

PhilE wrote:
Wed Apr 17, 2019 9:21 pm
First of all, you can make it easier to compile the audiosense overlay by replacing the symbols constant macros with their real values. The decompiled version handily tells us what to substitute:

Code: Select all

// Definitions for audiosense add on soundcard
/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

	[email protected] {
		target = <&i2s>;
		__overlay__ {
			status = "okay";
		};
	};

	[email protected] {
		target-path = "/";
		__overlay__ {
			codec_reg_1v8: codec-reg-1v8 {
				compatible = "regulator-fixed";
				regulator-name = "tlv320aic3204_1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-always-on;
			};
		};
	};

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			codec_rst: codec-rst {
				brcm,pins = <26>;
				brcm,function = <1>; // BCM2835_FSEL_GPIO_OUT
			};
		};
	};

	[email protected] {
		target = <&i2c1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			/* audio external oscillator */
			codec_osc: codec_osc {
				compatible = "fixed-clock";
				#clock-cells = <0>;
				clock-frequency = <12000000>;	/* 12 MHz */
			};

			codec: [email protected] {
				#sound-dai-cells = <0>;
				compatible = "ti,tlv320aic32x4";
				reg = <0x18>;

				clocks = <&codec_osc>;
				clock-names = "mclk";

				iov-supply = <&vdd_3v3_reg>;
				ldoin-supply = <&vdd_3v3_reg>;

				gpio-controller;
				#gpio-cells = <2>;
				reset-gpios = <&gpio 26 0>; // GPIO_ACTIVE_HIGH

				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&sound>;
		__overlay__ {
			compatible = "as,audiosense-pi";
			i2s-controller = <&i2s>;
			status = "okay";
		};
	};
};
Otherwise you need to run cpp on the source with the correct include paths pointing to the kernel headers, feeding the output file to dtc.

The rest is more advanced and will take a bit longer.
Thanks for that. Compiled it to dtbo and at least this "custom" audiosense-pi dtbo works. So with this DTS i'm also able to make the DABboard work.

I will also try to combine these working DTS to one. But as you wrote this is more advanced. So if you also try to merge them, that would be great.

vitalic
Posts: 21
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Sat Apr 20, 2019 9:54 am

So I tried a while to get this done but always failed. Now I tried to build one dtb for both. Somehow i get little success but still a big problem:

mixed dts

Code: Select all

// Definitions for HiFiBerry DAC
/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

	[email protected] {
		target = <&i2s>;
		__overlay__ {
			status = "okay";
		};
	};
	
	[email protected] {
		target = <&sound>;
		__overlay__ {
			compatible = "hifiberry,hifiberry-dac";
			i2s-controller = <&i2s>;
			status = "okay";
		};
	};
	
	[email protected] {
		target = <&soc>;
		__overlay__ {
			soundinput{
				compatible = "as,audiosense-pi";
				i2s-controller = <&i2s>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target-path = "/";
		__overlay__ {
			pcm5102a-codec {
				#sound-dai-cells = <0>;
				compatible = "ti,pcm5102a";
				status = "okay";
			};
			
			codec_reg_1v8: codec-reg-1v8 {
				compatible = "regulator-fixed";
				regulator-name = "tlv320aic3204_1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-always-on;
			};
		};
	};
	
	[email protected] {
		target = <&gpio>;
		__overlay__ {
			codec_rst: codec-rst {
				brcm,pins = <26>;
				brcm,function = <1>; // BCM2835_FSEL_GPIO_OUT
			};
		};
	};
	
	[email protected] {
		target = <&i2c1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			/* audio external oscillator */
			codec_osc: codec_osc {
				compatible = "fixed-clock";
				#clock-cells = <0>;
				clock-frequency = <12000000>;	/* 12 MHz */
			};

			codec: [email protected] {
				#sound-dai-cells = <0>;
				compatible = "ti,tlv320aic32x4";
				reg = <0x18>;

				clocks = <&codec_osc>;
				clock-names = "mclk";

				iov-supply = <&vdd_3v3_reg>;
				ldoin-supply = <&vdd_3v3_reg>;

				gpio-controller;
				#gpio-cells = <2>;
				reset-gpios = <&gpio 26 0>; // GPIO_ACTIVE_HIGH

				status = "okay";
			};
		};
	};
};
error in dmesg:

Code: Select all

[email protected]:~ $ dmesg | grep hifi
[    3.656689] snd-rpi-simple soc:sound: pcm5102a-hifi <-> 3f203000.i2s mapping ok
[    3.671581] audiosense-snd-card soc:soundinput: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[    3.919697] audiosense-snd-card soc:soundinput: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[    3.935110] audiosense-snd-card soc:soundinput: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[    4.038907] audiosense-snd-card soc:soundinput: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[    4.068096] audiosense-snd-card soc:soundinput: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[    4.122563] audiosense-snd-card soc:soundinput: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[    4.208576] audiosense-snd-card soc:soundinput: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[    4.209630] audiosense-snd-card soc:soundinput: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[    4.353417] audiosense-snd-card soc:soundinput: ASoC: CODEC DAI tlv320aic32x4-hifi not registered - will retry
[    4.504262] bcm2835-i2s 3f203000.i2s: Trying to bind component to card "audiosense-pi" but is already bound to card "snd_rpi_hifiberry_dac"
both are listed:

Code: Select all

[email protected]:~ $ /sbin/lsmod | grep snd
snd_soc_tlv320aic32x4_i2c    16384  0
snd_soc_tlv320aic32x4    40960  1 snd_soc_tlv320aic32x4_i2c
snd_soc_audiosense_pi    16384  0
snd_soc_rpi_simple_soundcard    16384  2
snd_soc_bcm2835_i2s    20480  0
snd_soc_pcm5102a       16384  1
snd_soc_core          192512  6 snd_soc_audiosense_pi,vc4,snd_soc_bcm2835_i2s,snd_soc_tlv320aic32x4,snd_soc_pcm5102a,snd_soc_rpi_simple_soundcard
snd_compress           20480  1 snd_soc_core
snd_pcm_dmaengine      16384  1 snd_soc_core
snd_pcm               102400  7 snd_soc_audiosense_pi,vc4,snd_pcm_dmaengine,snd_soc_bcm2835_i2s,snd_soc_tlv320aic32x4,snd_soc_core,snd_soc_rpi_simple_soundcard
snd_timer              32768  1 snd_pcm
snd                    73728  9 snd_compress,snd_timer,snd_soc_tlv320aic32x4,snd_soc_core,snd_pcm

HiassofT
Posts: 167
Joined: Fri Jun 30, 2017 10:07 pm
Location: Salzburg, Austria
Contact: Website

Re: Merge 2 DTS

Sat Apr 20, 2019 12:14 pm

In your DT overlay you are trying to load 2 sound card drivers (the Hifiberry one and the Audiosense one) which both need (exclusive access to) bcm2835-i2s - and dmesg is telling you that the second driver can't be loaded because the first one already grabbed bsm2835-i2s

Code: Select all

bcm2835-i2s 3f203000.i2s: Trying to bind component to card "audiosense-pi" but is already bound to card "snd_rpi_hifiberry_dac"
What you would need to get this working is one sound card driver that connects both codecs (pcm5102 and tlv320aic32x4) to bcm2835-i2s.

Looking at the code this is going to be rather problematic, as pcm5102 is configured as a clock slave (SND_SOC_DAIFMT_CBS_CFS) and tlv320aic32x4 as a clock master (SND_SOC_DAIFMT_CBM_CFM). If both codecs were used in slave mode (thus bcm2835-i2s driving the clock) it might have been feasible but I guess you're out of luck in this case. There may be some solution, but it certainly won't be simple.

so long,

Hias

vitalic
Posts: 21
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Sun Apr 21, 2019 9:29 am

Where is the driver located?

I only need the capture function of the dabboard. The si ic is able to do much more like line in mic in and line out but i only need the dab and fm function.

So hifiberry needs to be slave for the pi and the dabboard.

HiassofT
Posts: 167
Joined: Fri Jun 30, 2017 10:07 pm
Location: Salzburg, Austria
Contact: Website

Re: Merge 2 DTS

Sun Apr 21, 2019 3:10 pm

The driver source code is here https://github.com/raspberrypi/linux/tr ... nd/soc/bcm (hifiberry-dac uses the rpi-simple-soundcard driver).

On a second thought with a Hifiberry DAC (not dacplus!) things will be a lot easier (sorry, had the dacplus in mind first). The driver is pure boilerplate code to create an audio interface (it only defines allowed sample rates and formats) and doesn't do any actual codec configuration.

So just loading the audiosense-pi overlay should work - you'll be playing sound on the audiosense card (which seems to support both playback and capture), but the hifiberry dac can just pick these up and output sound.

So, don't care about any hifiberry dac overlays / drivers at all.

so long,

Hias

vitalic
Posts: 21
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Sun Apr 21, 2019 4:07 pm

Sounds interesting but how should the hifiberry get registered by the pi when it's not activated in the config.txt?

HiassofT
Posts: 167
Joined: Fri Jun 30, 2017 10:07 pm
Location: Salzburg, Austria
Contact: Website

Re: Merge 2 DTS

Sun Apr 21, 2019 4:38 pm

vitalic wrote:
Sun Apr 21, 2019 4:07 pm
Sounds interesting but how should the hifiberry get registered by the pi when it's not activated in the config.txt?
It won't be registered - you just record from and play to the audiosense pi. No need to tell the system you hooked up another card for playback in parallel :-)

so long,

Hias

vitalic
Posts: 21
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Sun Apr 21, 2019 5:16 pm

Ah, ok, so i guess you mean that the hifiberry will only listen to the I2S in stealth mode...

So i just tried to play a wav file, but can't get no sound out of the speaker connected to the hifiberry.

What is the right command to record from and to the same card ?

aplay -l

Code: Select all

[email protected]:~ $ aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: audiosensepi [audiosense-pi], Gerät 0: TLV320AIC3204 Hifi Audio tlv320aic32x4-hifi-0 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
arecord -l

Code: Select all

[email protected]:~ $ arecord -l
**** Liste der Hardware-Geräte (CAPTURE) ****
Karte 0: audiosensepi [audiosense-pi], Gerät 0: TLV320AIC3204 Hifi Audio tlv320aic32x4-hifi-0 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
  
As you can see, both got the same hw adress 0.

So i tried

Code: Select all

[email protected]:~ $ arecord -D plughw:0 -c 2 -r 48000 -f S16_LE -q | aplay -D hw:0 -c 2 -q &
[1] 1068
and if i try to play a wav on hw 0 i get the error that device is already in use.

vitalic
Posts: 21
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Mon Apr 22, 2019 12:05 pm

So still playing around a little bit with merging both overlays.

This is the dts i'm testing right now based on a dual.dts with 2 cards addes to simple-audio-card:

Code: Select all

/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2837", "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

    [email protected] {
        target = <&sound>;
        __overlay__ {
            compatible = "simple-audio-card";
            simple-audio-card,name = "Dual";
	
            status="okay";

            capture_link: simple-audio-card,[email protected] {
                format = "i2s";

                r_cpu_dai: cpu {
                    sound-dai = <&i2s>;

                };

                r_codec_dai: codec {
                    sound-dai = <&codec_in>;
                };
            };

            playback_link: simple-audio-card,[email protected] {
                format = "i2s";

                p_cpu_dai: cpu {
                    sound-dai = <&i2s>;

                };

                p_codec_dai: codec {
                    sound-dai = <&codec_out>;
                };
            };
        };
    };

    [email protected] {
        target-path = "/";
        __overlay__ {
            codec_out: hifiberry {
                #address-cells = <0>;
                #size-cells = <0>;
                #sound-dai-cells = <0>;
                compatible = "ti,pcm5102a";
		i2s-controller = <&i2s>;
                status = "okay";
            };
            codec_in: dabboard {
                #address-cells = <0>;
                #size-cells = <0>;
                #sound-dai-cells = <0>;
                compatible = "as,audiosense-pi";
		i2s-controller = <&i2s>;
                status = "okay";
            };
        };
    };

    [email protected] {
        target = <&i2s>;
        __overlay__ {
            #sound-dai-cells = <0>;
            status = "okay";
        };
    };
	
	[email protected] {
		target-path = "/";
		__overlay__ {
			codec_reg_1v8: codec-reg-1v8 {
				compatible = "regulator-fixed";
				regulator-name = "tlv320aic3204_1v8";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-always-on;
			};
		};
	};
	
	[email protected] {
		target = <&gpio>;
		__overlay__ {
			codec_rst: codec-rst {
				brcm,pins = <26>;
				brcm,function = <1>; // BCM2835_FSEL_GPIO_OUT
			};
		};
	};
	
	[email protected] {
		target = <&i2c1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			/* audio external oscillator */
			codec_osc: codec_osc {
				compatible = "fixed-clock";
				#clock-cells = <0>;
				clock-frequency = <12000000>;	/* 12 MHz */
			};

			codec: [email protected] {
				#sound-dai-cells = <0>;
				compatible = "ti,tlv320aic32x4";
				reg = <0x18>;

				clocks = <&codec_osc>;
				clock-names = "mclk";

				iov-supply = <&vdd_3v3_reg>;
				ldoin-supply = <&vdd_3v3_reg>;

				gpio-controller;
				#gpio-cells = <2>;
				reset-gpios = <&gpio 26 0>; // GPIO_ACTIVE_HIGH

				status = "okay";
			};
		};
	};
};

This way i get audiosense-pi to work but not the hifiberry.

Code: Select all

[email protected]:~ $ aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: audiosensepi [audiosense-pi], Gerät 0: TLV320AIC3204 Hifi Audio tlv320aic32x4-hifi-0 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
When i replace "as,audiosense-pi" with "linux,spdif-dir" i get this:

Code: Select all

[email protected]:~ $ aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: Dual [Dual], Gerät 0: bcm2835-i2s-pcm5102a-hifi pcm5102a-hifi-0 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
  
  [email protected]:~ $ arecord -l
**** Liste der Hardware-Geräte (CAPTURE) ****
Karte 0: Dual [Dual], Gerät 1: bcm2835-i2s-dir-hifi dir-hifi-1 []
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0

So there are two different devices. That's what i would expect too, if i use the first compiled dts, but somehow the audiosense-pi overwrites the hifiberry. Any ideas?

HiassofT
Posts: 167
Joined: Fri Jun 30, 2017 10:07 pm
Location: Salzburg, Austria
Contact: Website

Re: Merge 2 DTS

Mon Apr 22, 2019 12:46 pm

The "arecord | aplay" command should work fine - I tested it on my Cirrus Logic Audio Card with current rpi-update kernel and it worked.

No idea what's going wrong. There might be a bug in the audiosense pi driver (or the codec) or something odd is going on with the DAB board.

Unfortunately the docs of the DAB board don't provide much hints about the hardware - the schematics only shows the Si4869 DAB chip (which, according to the datasheet supports I2S slave mode) connected to the RPi, but no signs of a TI TLV320AIC3204 chip, as required by the audiosense-pi drver. Something doesn't quite add up here...

so long,

Hias

vitalic
Posts: 21
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Mon Apr 22, 2019 12:59 pm

That's right. There is no TI TLV320AIC3204 ic soldered on the board. Just the Si4869 DAB ic. Don't know why they use the audiosense-pi overlay for this board.

I also tried to just use the hifiberry in stealth mode. That was working, but only when i wanted to hear DAB. All other sounds were not played anymore, because thi Si4869 ic is not designed to perform as output soundcard.

As long as i can't use both at the same time, this dab board is useless.

vitalic
Posts: 21
Joined: Tue Sep 20, 2016 7:29 pm

Re: Merge 2 DTS

Mon Apr 22, 2019 7:17 pm

Some searches about the Si486x brought me to github https://github.com/teknoid/dabpi/blob/m ... DABP.patch, where a rpi-dabpi overlay is placed.

Therefor i need to compile a new kernel module (snd-soc-si468x).

Is there an easy way to do so? Never compiled something for the kernel before.

Return to “Device Tree”