Rock Pi4 DT overlay for JustBoom AMP

I’d like to use a JustBoom amp hat with the rock Pi4, but have been drawing a blank looking for documentation sufficient to help build a DT overlay for it, based on the existing overlay for the raspberry Pi.

What should I read? where should I begin? is there any kind of relatively straightforward guide?

I’ve been trying with this overlay:

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

/ {
	model = "ROCK PI 4B";
    compatible = "rockchip,rockpi", "rockchip,rk3399";


	fragment@0 {
		target = <&i2s1>;
		__overlay__ {
			status = "okay";
		};
	};

	fragment@1 {
		target = <&i2c7>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			pcm5122@4d {
				#sound-dai-cells = <0>;
				compatible = "ti,pcm5122";
				reg = <0x4d>;
				AVDD-supply = <&vdd_3v3_reg>;
				DVDD-supply = <&vdd_3v3_reg>;
				CPVDD-supply = <&vdd_3v3_reg>;
				status = "okay";
			};
		};
	};

	fragment@2 {
		target = <&sound>;
		frag2: __overlay__ {
			compatible = "justboom,justboom-dac";
			i2s-controller = <&i2s1>;
			status = "okay";
		};
	};

	__overrides__ {
		24db_digital_gain = <&frag2>,"justboom,24db_digital_gain?";
	};
};

but so far i’m not having any luck. I’m using a kernel compiled with the needed drivers, and I think i have everything updated to the correct versions to support overlays…

Only the device tree overlay is not enough, you need to check if pcm5122 driver is enabled. device tree only specify the hardware resource the driver can use. But the driver let the sound card to work using the assigned resource by device tree.

I believe i do have that driver enabled - i built a kernel for it.

I have determined the existing hifiberry-dacplus shares the same driver, but uses different clock settings.

This overlay is based on that one, with the clock settings changed / removed, as they are in the raspi overlay:

/dts-v1/;
/plugin/;

/ {
	compatible = "rockchip,rk3399";

	fragment@0 {
		target = <&i2c1>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			pcm5122@4d {
				#sound-dai-cells = <0>;
				compatible = "ti,pcm5122";
				reg = <0x4d>;
				AVDD-supply = <&vcc3v3_sys>;
				DVDD-supply = <&vcc3v3_sys>;
				CPVDD-supply = <&vcc3v3_sys>;
				status = "okay";
			};
		};
	};

	fragment@1 {
		target-path = "/sound-ext-card";
		
        __overlay__ {
			compatible = "justboom,justboom-dac";
			i2s-controller = <&i2s1>;
			status = "okay";
		};
	};

    fragment@2 {
		target = <&i2s1>;
		__overlay__ {
			status = "okay";
            #sound-dai-cells = <0>;
		};
	};

	__overrides__ {
	24db_digital_gain =
		<&sound_ext_card>,"justboom,24db_digital_gain?";
	slave = <&sound_ext_card>,"justboom-dac,slave?";
  };
};

the hifiberry-dacplus overlay loads and enables the sound card, but no sound comes out, presumably because it is configured to use the wrong clock source. I’m preparing to try the overlay posted above.