@mkumard I like the device tree overlay approach, and I’m trying to configuring a device tree for the cmx655D codec such that we can provide alsa-controls via the i2c codec driver (the codec is functional when using a user-space API to control). In addition to the i2c control path there is the reset pin and the interrupt pin (GPIO 13 and GPIO 15). How would we create a device tree overlay to accomplish this task? I see the jetson provides device tree overlay examples but they are almost entirely focused on i2s, which is working.
I’m able to compile and boot this device tree overlay:
/dts-v1/;
/plugin/;
/ {
overlay-name = "cmx655d overlay";
jetson-header-name = "Jetson 40pin Header";
compatible = "nvidia,p3542-0000+p3448-0003";
// define sound card
fragment@0 {
target = <&tegra_sound>;
__overlay__ {
status="okay";
nvidia,dai-link-1 {
link-name = "cmx655-0";
cpu-dai = <&tegra_i2s4>;
codec-dai = <&cmx_codec>;
cpu-dai-name = "I2S4";
codec-dai-name = "cmx655";
format = "i2s";
bitclock-master;
frame-master;
srate = <48000>;
bit-format = "s16_le";
num-channels = <2>;
name-prefix = "x";
status = "okay";
};
};
};
// Define drivers for codec (one input and one output)
fragment@1 {
target = <&hdr40_i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
cmx_codec: cmx655@54 {
#sound-dai-cells = <0>;
compatible = "cml,cmx655D";
status = "okay";
reg = <0x54>;
vdd-supply = <&hdr40_vdd_3v3>;
reset-gpios = <0x5a 0x0f 0x00>;
interrupt-parent = <0x5a>;
interrupts = <0x0d 0x01>;
cmx655,classd-oc-reset-attempts = <5>;
};
};
};
fragment@2 {
target = <&pinmux>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&hdr40_pinmux>;
hdr40_pinmux: header-40pin-pinmux {
hdr40-pin12 {
nvidia,pins = "dap4_sclk_pj7";
nvidia,function = "i2s4b";
nvidia,pull = <0x1>;
nvidia,tristate = <0x0>;
nvidia,enable-input = <0x1>;
};
hdr40-pin35 {
nvidia,pins = "dap4_fs_pj4";
nvidia,function = "i2s4b";
nvidia,pull = <0x1>;
nvidia,tristate = <0x0>;
nvidia,enable-input = <0x1>;
};
hdr40-pin38 {
nvidia,pins = "dap4_din_pj5";
nvidia,function = "i2s4b";
nvidia,pull = <0x1>;
nvidia,tristate = <0x1>;
nvidia,enable-input = <0x1>;
};
hdr40-pin40 {
nvidia,pins = "dap4_dout_pj6";
nvidia,function = "i2s4b";
nvidia,pull = <0x1>;
nvidia,tristate = <0x0>;
nvidia,enable-input = <0x0>;
};
};
};
};
};
but i’m getting these warnings which I suppose are interfering with the configuration:
dtc -@ -I dts -O dtb -o cmx655d.dtbo cmx655d.dts
cmx655d.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
cmx655d.dtbo: Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property
cmx655d.dtbo: Warning (unit_address_vs_reg): Node /fragment@2 has a unit name, but no reg property
cmx655d.dtbo: Warning (gpios_property): Could not get phandle node for /fragment@1/__overlay__/cmx655@54:reset-gpios(cell 0)
cmx655d.dtbo: Warning (interrupts_property): Bad interrupt-parent phandle for /fragment@1/__overlay__/cmx655@54
This is how it was done on the raspberry pi:
/dts-v1/;
/plugin/;
/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Last modified: $Date: 2020-04-09 10:12:39 +0100 (Thu, 09 Apr 2020) $
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Device Tree Overlay for generic I2S audio output on Raspberry Pi
*/
/ {
compatible = "brcm,bcm2708";
// Define sound card
fragment@0 {
target = <&sound>;
__overlay__ {
compatible = "simple-audio-card";
simple-audio-card,name = "CMX655D";
status="okay";
simple-audio-card,dai-link@0 {
format = "i2s";
bitclock-master = <&codec_dai>;
frame-master = <&codec_dai>;
cpu_dai: cpu {
sound-dai = <&i2s>;
};
codec_dai: codec {
sound-dai = <&codec>;
};
};
};
};
// Define drivers for codec (one input and one output)
fragment@1 {
target = <&i2c>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
codec: cmx655 {
reg = <0x54>;
#sound-dai-cells = <0>;
compatible = "cml,cmx655D";
reset-gpios = <&gpio 24 1>;
interrupt-parent = <&gpio>;
interrupts = <25 0x2>; /* falling edge */
interrupt-names = "irq";
pinctrl-names = "default";
pinctrl-0 = <&ev6550DHAT_pins>;
cmx655,classd-oc-reset-attempts = <5>;
};
};
};
// Enable I2S
fragment@2 {
target = <&i2s>;
__overlay__ {
#sound-dai-cells = <0>;
status = "okay";
};
};
// Setup pins used by EV6550DHAT
fragment@3 {
target = <&gpio>;
__overlay__ {
ev6550DHAT_pins: cmx655_pins {
// Pins resetN, IRQn
brcm,pins = <24 25>;
// Out, In
brcm,function = <1 0>;
// No pull, pull up
brcm,pull = <0 2>;
};
};
};
};
What would be the equivalent to this for the jetson nano 2GB? Attached is the generated
kernel_tegra210-p3448-0003-p3542-0000-user-custom.dts (308.0 KB)
device tree source.
Thanks,
Abdo