// SPDX-License-Identifier: BSD-3-Clause
/*
 * Copyright (c) 2026, Thundercomm All rights reserved.
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>

&{/} {
	cam1_imx219_clk: clock-camera1-24m {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <24000000>;
	};

	leds-camera1 {
		compatible = "gpio-leds";

		pinctrl-0 = <&cam1_privacy_led_state>;
		pinctrl-names = "default";

		cam1_privacy_led: led-camera1 {
			function = LED_FUNCTION_INDICATOR;
			function-enumerator = <1>;
			gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};
	};

	/* Camera module power domain controlled through connector PWR_EN. */
	vreg_cam1_pwr: regulator-camera1-pwr {
		compatible = "regulator-fixed";

		regulator-name = "vreg_camera1_pwr";

		gpio = <&tlmm 57 GPIO_ACTIVE_HIGH>;
		enable-active-high;

		pinctrl-0 = <&cam1_pwr_en>;
		pinctrl-names = "default";

		vin-supply = <&vreg_vcc3v3_output>;
	};
};

&camss {
	vdda-phy-supply = <&vreg_l10c_0p88>;
	vdda-pll-supply = <&vreg_l6b_1p2>;

	status = "okay";

	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		port@1 {
			reg = <1>;

			csiphy1_ep: endpoint {
				data-lanes = <0 1>;
				remote-endpoint = <&cam1_imx219_ep>;
			};
		};
	};
};

&cci1 {
	status = "okay";
};

&cci1_i2c0 {
	#address-cells = <1>;
	#size-cells = <0>;

	camera@10 {
		compatible = "sony,imx219";
		reg = <0x10>;

		clocks = <&cam1_imx219_clk>;

		VANA-supply = <&vreg_cam1_pwr>;
		VDIG-supply = <&vreg_cam1_pwr>;
		VDDL-supply = <&vreg_cam1_pwr>;

		leds = <&cam1_privacy_led>;
		led-names = "privacy";

		port {
			cam1_imx219_ep: endpoint {
				data-lanes = <1 2>;
				link-frequencies = /bits/ 64 <456000000>;
				remote-endpoint = <&csiphy1_ep>;
			};
		};
	};
};

&tlmm {
	cam1_privacy_led_state: cam1-privacy-led-state {
		pins = "gpio18";
		function = "gpio";
		drive-strength = <8>;
		bias-disable;
	};

	cam1_pwr_en: cam1-pwr-en-state {
		pins = "gpio57";
		function = "gpio";
		drive-strength = <8>;
		bias-disable;
	};
};