// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright 2018
 * Lukasz Majewski, DENX Software Engineering, lukma@denx.de
 */

/dts-v1/;
#include "imx53-kp.dtsi"

/ {
	model = "K+P imx53 DDC";
	compatible = "kiebackpeter,imx53-ddc", "fsl,imx53";

	backlight_lcd: backlight {
		compatible = "pwm-backlight";
		pwms = <&pwm2 0 50000>;
		power-supply = <&reg_backlight>;
		brightness-levels = <0 24 28 32 36
				     40 44 48 52 56
				     60 64 68 72 76
				     80 84 88 92 96 100>;
		default-brightness-level = <20>;
	};

	lcd_display: display {
		compatible = "fsl,imx-parallel-display";
		#address-cells = <1>;
		#size-cells = <0>;
		interface-pix-fmt = "rgb24";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_disp>;

		port@0 {
			reg = <0>;

			display1_in: endpoint {
				remote-endpoint = <&ipu_di1_disp1>;
			};
		};

		port@1 {
			reg = <1>;

			lcd_display_out: endpoint {
				remote-endpoint = <&lcd_panel_in>;
			};
		};
	};

	lcd_panel: lcd-panel {
		compatible = "koe,tx14d24vm1bpa";
		backlight = <&backlight_lcd>;
		power-supply = <&reg_3v3>;

		port {
			lcd_panel_in: endpoint {
				remote-endpoint = <&lcd_display_out>;
			};
		};
	};

	reg_backlight: regulator-backlight {
		compatible = "regulator-fixed";
		regulator-name = "backlight-supply";
		regulator-min-microvolt = <15000000>;
		regulator-max-microvolt = <15000000>;
		regulator-always-on;
	};
};

&fec {
	status = "okay";
};

&i2c3 {
	adc@48 {
		compatible = "ti,ads1015";
		reg = <0x48>;
		#address-cells = <1>;
		#size-cells = <0>;

		channel@4 {
			reg = <4>;
			ti,gain = <2>;
			ti,datarate = <4>;
		};

		channel@6 {
			reg = <6>;
			ti,gain = <2>;
			ti,datarate = <4>;
		};
	};

	gpio-expander2@21 {
		compatible = "nxp,pcf8574";
		reg = <0x21>;
		interrupts = <109>;
		#gpio-cells = <2>;
		gpio-controller;
	};
};

&iomuxc {
	imx53-kp-ddc {
		pinctrl_disp: dispgrp {
			fsl,pins = <
				MX53_PAD_EIM_A16__IPU_DI1_DISP_CLK      0x4
				MX53_PAD_EIM_DA10__IPU_DI1_PIN15        0x4
				MX53_PAD_EIM_DA9__IPU_DISP1_DAT_0       0x4
				MX53_PAD_EIM_DA8__IPU_DISP1_DAT_1       0x4
				MX53_PAD_EIM_DA7__IPU_DISP1_DAT_2       0x4
				MX53_PAD_EIM_DA6__IPU_DISP1_DAT_3       0x4
				MX53_PAD_EIM_DA5__IPU_DISP1_DAT_4       0x4
				MX53_PAD_EIM_DA4__IPU_DISP1_DAT_5       0x4
				MX53_PAD_EIM_DA3__IPU_DISP1_DAT_6       0x4
				MX53_PAD_EIM_DA2__IPU_DISP1_DAT_7       0x4
				MX53_PAD_EIM_DA1__IPU_DISP1_DAT_8       0x4
				MX53_PAD_EIM_DA0__IPU_DISP1_DAT_9       0x4
				MX53_PAD_EIM_EB1__IPU_DISP1_DAT_10      0x4
				MX53_PAD_EIM_EB0__IPU_DISP1_DAT_11      0x4
				MX53_PAD_EIM_A17__IPU_DISP1_DAT_12      0x4
				MX53_PAD_EIM_A18__IPU_DISP1_DAT_13      0x4
				MX53_PAD_EIM_A19__IPU_DISP1_DAT_14      0x4
				MX53_PAD_EIM_A20__IPU_DISP1_DAT_15      0x4
				MX53_PAD_EIM_A21__IPU_DISP1_DAT_16      0x4
				MX53_PAD_EIM_A22__IPU_DISP1_DAT_17      0x4
				MX53_PAD_EIM_A23__IPU_DISP1_DAT_18      0x4
				MX53_PAD_EIM_A24__IPU_DISP1_DAT_19      0x4
				MX53_PAD_EIM_D31__IPU_DISP1_DAT_20      0x4
				MX53_PAD_EIM_D30__IPU_DISP1_DAT_21      0x4
				MX53_PAD_EIM_D26__IPU_DISP1_DAT_22      0x4
				MX53_PAD_EIM_D27__IPU_DISP1_DAT_23      0x4
				MX53_PAD_GPIO_1__PWM2_PWMO 0x4
			>;
		};
	};
};

&ipu_di1_disp1 {
	remote-endpoint = <&display1_in>;
};

&pmic {
	fsl,mc13xxx-uses-touch;
};