I have no issue with that portion of it. What I am missing is how to create the overlay itself.PhilE wrote: ↑Mon Nov 06, 2017 4:04 pmThat's about the most user friendly documentation there is. The steps are:
1. Create/locate overlay as a .dts file.
2. Compile .dts file into a .dtbo file (but the actual filename doesn't matter here, so the guide isn't wrong).
3. Pass the .dtbo file name to the eepmake script.
At which step do you get lost?
How do you go about adding an overlay to the rpi/linux tree?PhilE wrote: ↑Mon Nov 06, 2017 5:33 pmMost people use one or more of the existing overlays in the kernel tree (source here) as a starting point. The complexity of the overlay, and whether or not you need a driver, very much depends on your hardware.
Something else you need to know is that it is now possible to put the name of an overlay into the EEPROM - which then works like an automatic "dtoverlay=<overlay-name>" directive. This makes it easier to change an overlay after release but does depend on you getting the overlay included in the raspberrypi/linux tree in the first place.
You can create a Pull Request, or an Issue if that's easier.How do you go about adding an overlay to the rpi/linux tree?
Yes - that's the main reason for the built-in overlay - all you have to do is plug in the HAT and the necessary kernel modules are loaded automatically.Also if I compile one of the existing overlays into the eeprom config. Does that mean that overlay will not require a line in the /boot/config.txt.
Ok, does this occur even if the overlay is not built into the rpi/Linux device tree?Yes - that's the main reason for the built-in overlay - all you have to do is plug in the HAT and the necessary kernel modules are loaded automatically.
Code: Select all
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
[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 = "linux,spdif-dit";
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";
};
};
};
/* compile with:
dtc [email protected] -H epapr -O dtb -o dual.dtbo -Wno-unit_address_vs_reg dual.dts
*/
Code: Select all
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
[email protected] {
target = <&sound>;
__overlay__ {
compatible = "simple-audio-card";
simple-audio-card,name = "I2S_DAC";
status="okay";
playback_link: simple-audio-card,[email protected] {
format = "i2s";
p_cpu_dai: cpu {
sound-dai = <&i2s>;
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 = "linux,spdif-dit";
status = "okay";
};
};
};
[email protected] {
target = <&i2s>;
__overlay__ {
#sound-dai-cells = <0>;
status = "okay";
};
};
};
/* compile with:
dtc [email protected] -H epapr -O dtb -o dual.dtbo -Wno-unit_address_vs_reg dual.dts
*/
Code: Select all
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
This is exactly what I was looking for, I believe that is achieved with:
Code: Select all
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
Could you please show the steps that are required to setup the .asoundrc for limiting to samples rates above 32kHz.
After doing some digging I see that there is a codec driver for the PCM1794A which is the chip that I am using in my design, but I do not know how to modify the overlay to include this codec instead of the simple-card one.HiassofT wrote: ↑Thu Nov 09, 2017 5:25 pmI don't think that's possible via .asoundrc. I'm only aware of the rate alsa plugin which allows you to use a fixed rate.
The only thing you can do in the simple-card overlay is to use a different codec driver which comes with the correct constraints.- but I'm also not aware of any "generic" driver that does that.
Alternative is to write either a codec driver or a soundcard driver and setup the correct constraints there.
so long,
Hias
Code: Select all
/*
Do I just replace every line that says comapatible = ??? with compatible = "ti,pcm1794a";
To get the following:
*/
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
[email protected] {
target = <&sound>;
__overlay__ {
compatible = "ti,pcm1794a";
simple-audio-card,name = "I2S_DAC";
status="okay";
playback_link: simple-audio-card,[email protected] {
format = "i2s";
p_cpu_dai: cpu {
sound-dai = <&i2s>;
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 {
compatible = "ti,pcm1794a";
status = "okay";
};
};
};
[email protected] {
target = <&i2s>;
__overlay__ {
#sound-dai-cells = <0>;
status = "okay";
};
};
};
Code: Select all
[email protected] {
target-path = "/";
__overlay__ {
codec_out: pcm1794a-codec {
#sound-dai-cells = <0>;
compatible = "ti,pcm1794a";
status = "okay";
};
};
};
Code: Select all
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
[email protected] {
target = <&sound>;
__overlay__ {
compatible = "simple-audio-card";
simple-audio-card,name = "I2S_DAC";
status="okay";
playback_link: simple-audio-card,[email protected] {
format = "i2s";
p_cpu_dai: cpu {
sound-dai = <&i2s>;
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: pcm1794a-codec {
#sound-dai-cells = <0>;
compatible = "ti,pcm1794a";
status = "okay";
};
};
};
[email protected] {
target = <&i2s>;
__overlay__ {
#sound-dai-cells = <0>;
status = "okay";
};
};
};
/* compile with:
dtc [email protected] -H epapr -O dtb -o dual.dtbo -Wno-unit_address_vs_reg dual.dts
*/
HiassofT wrote: ↑Fri Nov 10, 2017 9:58 amI think you might also need #sound-dai-cells = <0>; like in the rpi-dac overlay https://github.com/raspberrypi/linux/bl ... ts#L15-L24
Plus better change the name of the node. eg:
Code: Select all
[email protected] { target-path = "/"; __overlay__ { codec_out: pcm1794a-codec { #sound-dai-cells = <0>; compatible = "ti,pcm1794a"; status = "okay"; }; }; };
so long,
Hias
Thank you, I will be trying this out.PhilE wrote: ↑Fri Nov 10, 2017 12:10 pmSomething like this:Code: Select all
/dts-v1/; /plugin/; / { compatible = "brcm,bcm2708"; [email protected] { target = <&sound>; __overlay__ { compatible = "simple-audio-card"; simple-audio-card,name = "I2S_DAC"; status="okay"; playback_link: simple-audio-card,[email protected] { format = "i2s"; p_cpu_dai: cpu { sound-dai = <&i2s>; 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: pcm1794a-codec { #sound-dai-cells = <0>; compatible = "ti,pcm1794a"; status = "okay"; }; }; }; [email protected] { target = <&i2s>; __overlay__ { #sound-dai-cells = <0>; status = "okay"; }; }; }; /* compile with: dtc [email protected] -H epapr -O dtb -o dual.dtbo -Wno-unit_address_vs_reg dual.dts */
Is there an instruction somewhere to add the overlay to the kernel? I got an overlay working.PhilE wrote: ↑Mon Nov 06, 2017 8:51 pmDon't think of getting an overlay into the kernel as problematic - essentially, you ask through one of the channels mentioned above and, provided it is correctly written and documented, I'll approve it (and if it isn't I'll help you get there). Additional module support - especially adding a custom driver - is harder but still nothing to be daunted by.
I have created an issue here: https://github.com/raspberrypi/linux/issues/2302PhilE wrote: ↑Sun Dec 03, 2017 10:02 pmCreate a pull request here: https://github.com/raspberrypi/linux/pulls
If you search the closed PRs you will find other overlays being added. If that seems too complicated, create an issue instead, including the overlay content and a description for the overlay README.