// SPDX-License-Identifier: (GPL-2.0+ OR MIT)

/dts-v1/;

#include "rk3588s-nanopi-m6.dtsi"

/ {
	model = "FriendlyElec NanoPi M6";
	compatible = "friendlyarm,nanopi-m6", "rockchip,rk3588s";

	analog-sound {
		compatible = "audio-graph-card";
		label = "rk3588s-rt5616";

		pinctrl-names = "default";
		pinctrl-0 = <&hp_det>;
		hp-det-gpios = <&gpio1 RK_PC4 GPIO_ACTIVE_LOW>;

		dais = <&i2s0_8ch_p0>;
		routing =
			"Headphones", "HPOL",
			"Headphones", "HPOR",
			"MIC1", "Microphone Jack",
			"Microphone Jack", "micbias1";
		widgets =
			"Headphone", "Headphones",
			"Microphone", "Microphone Jack";
	};
};

&i2c7 {
	audio-codec@1b {
		compatible = "realtek,rt5616";
		reg = <0x1b>;
		assigned-clocks = <&cru I2S0_8CH_MCLKOUT_TO_IO>;
		assigned-clock-rates = <12288000>;
		clocks = <&cru I2S0_8CH_MCLKOUT_TO_IO>;
		clock-names = "mclk";
		#sound-dai-cells = <0>;

		port {
			rt5616_p0: endpoint {
				remote-endpoint = <&i2s0_8ch_p0_0>;
			};
		};
	};
};

&i2s0_8ch {
	i2s0_8ch_p0: port {
		i2s0_8ch_p0_0: endpoint {
			dai-format = "i2s";
			mclk-fs = <256>;
			remote-endpoint = <&rt5616_p0>;
		};
	};
};