// SPDX-License-Identifier: GPL-2.0
#include "qcom-msm8974pro-sony-xperia-shinano-common.dtsi"

/ {
	model = "Sony Xperia Z2 Tablet";
	compatible = "sony,xperia-castor", "qcom,msm8974pro", "qcom,msm8974";
	chassis-type = "tablet";

	vreg_bl_vddio: lcd-backlight-vddio {
		compatible = "regulator-fixed";
		regulator-name = "vreg_bl_vddio";
		regulator-min-microvolt = <3150000>;
		regulator-max-microvolt = <3150000>;

		gpio = <&tlmm 69 0>;
		enable-active-high;

		vin-supply = <&pm8941_s3>;
		startup-delay-us = <70000>;

		pinctrl-0 = <&lcd_backlight_en_pin_a>;
		pinctrl-names = "default";
	};
};

&blsp2_i2c5 {
	clock-frequency = <355000>;

	status = "okay";

	lp8566_wled: backlight@2c {
		compatible = "ti,lp8556";
		reg = <0x2c>;
		power-supply = <&vreg_bl_vddio>;

		bl-name = "backlight";
		dev-ctrl = /bits/ 8 <0x05>;
		init-brt = /bits/ 8 <0x3f>;

		rom-a0h {
			rom-addr = /bits/ 8 <0xa0>;
			rom-val = /bits/ 8 <0xff>;
		};

		rom-a1h {
			rom-addr = /bits/ 8 <0xa1>;
			rom-val = /bits/ 8 <0x3f>;
		};

		rom-a2h {
			rom-addr = /bits/ 8 <0xa2>;
			rom-val = /bits/ 8 <0x20>;
		};

		rom-a3h {
			rom-addr = /bits/ 8 <0xa3>;
			rom-val = /bits/ 8 <0x5e>;
		};

		rom-a4h {
			rom-addr = /bits/ 8 <0xa4>;
			rom-val = /bits/ 8 <0x02>;
		};

		rom-a5h {
			rom-addr = /bits/ 8 <0xa5>;
			rom-val = /bits/ 8 <0x04>;
		};

		rom-a6h {
			rom-addr = /bits/ 8 <0xa6>;
			rom-val = /bits/ 8 <0x80>;
		};

		rom-a7h {
			rom-addr = /bits/ 8 <0xa7>;
			rom-val = /bits/ 8 <0xf7>;
		};

		rom-a9h {
			rom-addr = /bits/ 8 <0xa9>;
			rom-val = /bits/ 8 <0x80>;
		};

		rom-aah {
			rom-addr = /bits/ 8 <0xaa>;
			rom-val = /bits/ 8 <0x0f>;
		};

		rom-aeh {
			rom-addr = /bits/ 8 <0xae>;
			rom-val = /bits/ 8 <0x0f>;
		};
	};
};

&blsp2_uart1 {
	status = "okay";

	bluetooth {
		compatible = "brcm,bcm43438-bt";
		max-speed = <3000000>;

		pinctrl-0 = <&bt_host_wake_pin>, <&bt_dev_wake_pin>, <&bt_reg_on_pin>;
		pinctrl-names = "default";

		host-wakeup-gpios = <&tlmm 95 GPIO_ACTIVE_HIGH>;
		device-wakeup-gpios = <&tlmm 96 GPIO_ACTIVE_HIGH>;
		shutdown-gpios = <&pm8941_gpios 16 GPIO_ACTIVE_HIGH>;
	};
};

&pm8941_gpios {
	bt_reg_on_pin: bt-reg-on-state {
		pins = "gpio16";
		function = "normal";
		output-low;
		power-source = <PM8941_GPIO_S3>;
	};
};

&rpm_requests {
	regulators-1 {
		pm8941_l11: l11 {
			regulator-min-microvolt = <1300000>;
			regulator-max-microvolt = <1350000>;
		};

		pm8941_l19: l19 {
			regulator-min-microvolt = <2850000>;
			regulator-max-microvolt = <2850000>;
		};
	};
};

&smbb {
	qcom,fast-charge-safe-current = <1500000>;
	qcom,fast-charge-current-limit = <1500000>;
	qcom,dc-current-limit = <1800000>;
	usb-charge-current-limit = <1800000>;
	qcom,fast-charge-safe-voltage = <4400000>;
	qcom,fast-charge-high-threshold-voltage = <4350000>;
	qcom,fast-charge-low-threshold-voltage = <3400000>;
	qcom,auto-recharge-threshold-voltage = <4200000>;
	qcom,minimum-input-voltage = <4300000>;

	status = "okay";
};

&synaptics_touchscreen {
	vio-supply = <&pm8941_lvs3>;
};

&tlmm {
	bt_dev_wake_pin: bt-dev-wake-state {
		pins = "gpio96";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	bt_host_wake_pin: bt-host-wake-state {
		pins = "gpio95";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
		output-low;
	};

	lcd_backlight_en_pin_a: lcd-backlight-vddio-state {
		pins = "gpio69";
		function = "gpio";
		drive-strength = <10>;
		output-low;
		bias-disable;
	};
};
