linux/arch/arm64/boot/dts/qcom/sm8550-sony-xperia-yodo-pdx234.dts

// SPDX-License-Identifier: BSD-3-Clause
/*
 * Copyright (c) 2023, Linaro Limited
 */

/dts-v1/;

#include <dt-bindings/firmware/qcom,scm.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
#include <dt-bindings/sound/cs35l45.h>
#include "sm8550.dtsi"
#include "pm8010.dtsi"
#include "pm8550.dtsi"
#include "pm8550b.dtsi"
#define PMK8550VE_SID 5
#include "pm8550ve.dtsi"
#include "pm8550vs.dtsi"
#include "pmk8550.dtsi"
/* TODO: Only one SID of PMR735D seems accessible? */

/delete-node/ &hwfence_shbuf;
/delete-node/ &mpss_mem;
/delete-node/ &rmtfs_mem;
/ {
	model = "Sony Xperia 1 V";
	compatible = "sony,pdx234", "qcom,sm8550";
	chassis-type = "handset";

	aliases {
		i2c0 = &i2c0;
		i2c4 = &i2c4;
		i2c10 = &i2c10;
		i2c11 = &i2c11;
		i2c16 = &i2c_hub_2;
		serial0 = &uart7;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	gpio-keys {
		compatible = "gpio-keys";
		label = "gpio-keys";

		pinctrl-0 = <&focus_n &snapshot_n &vol_down_n>;
		pinctrl-names = "default";

		key-camera-focus {
			label = "Camera Focus";
			linux,code = <KEY_CAMERA_FOCUS>;
			gpios = <&pm8550b_gpios 8 GPIO_ACTIVE_LOW>;
			debounce-interval = <15>;
			linux,can-disable;
			wakeup-source;
		};

		key-camera-snapshot {
			label = "Camera Snapshot";
			gpios = <&pm8550b_gpios 7 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_CAMERA>;
			debounce-interval = <15>;
			linux,can-disable;
			wakeup-source;
		};

		key-volume-down {
			label = "Volume Down";
			linux,code = <KEY_VOLUMEDOWN>;
			gpios = <&pm8550_gpios 6 GPIO_ACTIVE_LOW>;
			debounce-interval = <15>;
			linux,can-disable;
			wakeup-source;
		};
	};

	pmic-glink {
		compatible = "qcom,sm8550-pmic-glink", "qcom,pmic-glink";
		orientation-gpios = <&tlmm 11 GPIO_ACTIVE_HIGH>;
		#address-cells = <1>;
		#size-cells = <0>;

		connector@0 {
			compatible = "usb-c-connector";
			reg = <0>;
			power-role = "dual";
			data-role = "dual";

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

				port@0 {
					reg = <0>;

					pmic_glink_hs_in: endpoint {
						remote-endpoint = <&usb_1_dwc3_hs>;
					};
				};

				port@1 {
					reg = <1>;

					pmic_glink_ss_in: endpoint {
						remote-endpoint = <&usb_dp_qmpphy_out>;
					};
				};
			};
		};
	};

	reserved-memory {
		mpss_mem: mpss-region@89800000 {
			reg = <0x0 0x89800000 0x0 0x10800000>;
			no-map;
		};

		splash@b8000000 {
			reg = <0x0 0xb8000000 0x0 0x2b00000>;
			no-map;
		};

		hwfence_shbuf: hwfence-shbuf-region@e6440000 {
			reg = <0x0 0xe6440000 0x0 0x2dd000>;
			no-map;
		};

		rmtfs_mem: memory@f8b00000 {
			compatible = "qcom,rmtfs-mem";
			reg = <0x0 0xf8b00000 0x0 0x280000>;
			no-map;

			qcom,client-id = <1>;
			qcom,vmid = <QCOM_SCM_VMID_MSS_MSA>;
		};

		ramoops@ffd00000 {
			compatible = "ramoops";
			reg = <0x0 0xffd00000 0x0 0xc0000>;
			console-size = <0x40000>;
			record-size = <0x1000>;
			pmsg-size = <0x40000>;
			ecc-size = <16>;
		};

		rdtag-store-region@ffdc0000 {
			reg = <0x0 0xffdc0000 0x0 0x40000>;
			no-map;
		};
	};

	vph_pwr: vph-pwr-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vph_pwr";
		regulator-min-microvolt = <3700000>;
		regulator-max-microvolt = <3700000>;

		regulator-always-on;
		regulator-boot-on;
	};
};

&apps_rsc {
	regulators-0 {
		compatible = "qcom,pm8550-rpmh-regulators";
		qcom,pmic-id = "b";

		pm8550_bob1: bob1 {
			regulator-name = "pm8550_bob1";
			regulator-min-microvolt = <3416000>;
			regulator-max-microvolt = <3960000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		/* TODO: bob2 @ 2.704-3.008V doesn't fall into the vreg driver constraints */

		pm8550_l1: ldo1 {
			regulator-name = "pm8550_l1";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l2: ldo2 {
			regulator-name = "pm8550_l2";
			regulator-min-microvolt = <3008000>;
			regulator-max-microvolt = <3008000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		/* L4 exists in cmd-db, but the board seems to crash on access */

		pm8550_l5: ldo5 {
			regulator-name = "pm8550_l5";
			regulator-min-microvolt = <3104000>;
			regulator-max-microvolt = <3104000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l6: ldo6 {
			regulator-name = "pm8550_l6";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <3008000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l7: ldo7 {
			regulator-name = "pm8550_l7";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <3008000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l8: ldo8 {
			regulator-name = "pm8550_l8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <3008000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l9: ldo9 {
			regulator-name = "pm8550_l9";
			regulator-min-microvolt = <2960000>;
			regulator-max-microvolt = <3008000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l10: ldo10 {
			regulator-name = "pm8550_l10";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l11: ldo11 {
			regulator-name = "pm8550_l11";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1504000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l12: ldo12 {
			regulator-name = "pm8550_l12";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l13: ldo13 {
			regulator-name = "pm8550_l13";
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3000000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l14: ldo14 {
			regulator-name = "pm8550_l14";
			regulator-min-microvolt = <3304000>;
			regulator-max-microvolt = <3304000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l15: ldo15 {
			regulator-name = "pm8550_l15";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l16: ldo16 {
			regulator-name = "pm8550_l16";
			regulator-min-microvolt = <2800000>;
			regulator-max-microvolt = <2800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550_l17: ldo17 {
			regulator-name = "pm8550_l17";
			regulator-min-microvolt = <2504000>;
			regulator-max-microvolt = <2504000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};
	};

	regulators-1 {
		compatible = "qcom,pm8550vs-rpmh-regulators";
		qcom,pmic-id = "c";

		pm8550vs_0_l1: ldo1 {
			regulator-name = "pm8550vs_0_l1";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_0_l3: ldo3 {
			regulator-name = "pm8550vs_0_l3";
			regulator-min-microvolt = <880000>;
			regulator-max-microvolt = <912000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};
	};

	regulators-2 {
		compatible = "qcom,pm8550vs-rpmh-regulators";
		qcom,pmic-id = "d";

		pm8550vs_1_l1: ldo1 {
			regulator-name = "pm8550vs_1_l1";
			regulator-min-microvolt = <880000>;
			regulator-max-microvolt = <920000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		/* L3 exists in cmd-db, but the board seems to crash on access */
	};

	regulators-3 {
		compatible = "qcom,pm8550vs-rpmh-regulators";
		qcom,pmic-id = "e";

		pm8550vs_2_s4: smps4 {
			regulator-name = "pm8550vs_2_s4";
			regulator-min-microvolt = <904000>;
			regulator-max-microvolt = <984000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_2_s5: smps5 {
			regulator-name = "pm8550vs_2_s5";
			regulator-min-microvolt = <1010000>;
			regulator-max-microvolt = <1120000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_2_l1: ldo1 {
			regulator-name = "pm8550vs_2_l1";
			regulator-min-microvolt = <880000>;
			regulator-max-microvolt = <912000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_2_l2: ldo2 {
			regulator-name = "pm8550vs_2_l2";
			regulator-min-microvolt = <880000>;
			regulator-max-microvolt = <968000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_2_l3: ldo3 {
			regulator-name = "pm8550vs_2_l3";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};
	};

	regulators-4 {
		compatible = "qcom,pm8550ve-rpmh-regulators";
		qcom,pmic-id = "f";

		pm8550ve_s4: smps4 {
			regulator-name = "pm8550ve_s4";
			regulator-min-microvolt = <500000>;
			regulator-max-microvolt = <700000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550ve_l1: ldo1 {
			regulator-name = "pm8550ve_l1";
			regulator-min-microvolt = <912000>;
			regulator-max-microvolt = <912000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550ve_l2: ldo2 {
			regulator-name = "pm8550ve_l2";
			regulator-min-microvolt = <880000>;
			regulator-max-microvolt = <912000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550ve_l3: ldo3 {
			regulator-name = "pm8550ve_l3";
			regulator-min-microvolt = <912000>;
			regulator-max-microvolt = <912000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};
	};

	regulators-5 {
		compatible = "qcom,pm8550vs-rpmh-regulators";
		qcom,pmic-id = "g";

		pm8550vs_3_s1: smps1 {
			regulator-name = "pm8550vs_3_s1";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1300000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_3_s2: smps2 {
			regulator-name = "pm8550vs_3_s2";
			regulator-min-microvolt = <500000>;
			regulator-max-microvolt = <1036000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_3_s3: smps3 {
			regulator-name = "pm8550vs_3_s3";
			regulator-min-microvolt = <300000>;
			regulator-max-microvolt = <1004000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_3_s4: smps4 {
			regulator-name = "pm8550vs_3_s4";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1352000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_3_s5: smps5 {
			regulator-name = "pm8550vs_3_s5";
			regulator-min-microvolt = <500000>;
			regulator-max-microvolt = <1004000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_3_s6: smps6 {
			regulator-name = "pm8550vs_3_s6";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <2000000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_3_l1: ldo1 {
			regulator-name = "pm8550vs_3_l1";
			regulator-min-microvolt = <1144000>;
			regulator-max-microvolt = <1256000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_3_l2: ldo2 {
			regulator-name = "pm8550vs_3_l2";
			regulator-min-microvolt = <1104000>;
			regulator-max-microvolt = <1200000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		pm8550vs_3_l3: ldo3 {
			regulator-name = "pm8550vs_3_l3";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};
	};

	/* TODO: Unknown PMIC @ k, l, PM8010 @ m, n */
};

&gpi_dma1 {
	status = "okay";
};

&gpi_dma2 {
	status = "okay";
};

&i2c_hub_2 {
	clock-frequency = <400000>;
	status = "okay";

	pmic@75 {
		compatible = "dlg,slg51000";
		reg = <0x75>;
		dlg,cs-gpios = <&pm8550vs_g_gpios 4 GPIO_ACTIVE_HIGH>;

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

		regulators {
			slg51000_a_ldo1: ldo1 {
				regulator-name = "slg51000_a_ldo1";
				regulator-min-microvolt = <2400000>;
				regulator-max-microvolt = <3300000>;
			};

			slg51000_a_ldo2: ldo2 {
				regulator-name = "slg51000_a_ldo2";
				regulator-min-microvolt = <2400000>;
				regulator-max-microvolt = <3300000>;
			};

			slg51000_a_ldo3: ldo3 {
				regulator-name = "slg51000_a_ldo3";
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <3750000>;
			};

			slg51000_a_ldo4: ldo4 {
				regulator-name = "slg51000_a_ldo4";
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <3750000>;
			};

			slg51000_a_ldo5: ldo5 {
				regulator-name = "slg51000_a_ldo5";
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1200000>;
			};

			slg51000_a_ldo6: ldo6 {
				regulator-name = "slg51000_a_ldo6";
				regulator-min-microvolt = <500000>;
				regulator-max-microvolt = <1200000>;
			};

			slg51000_a_ldo7: ldo7 {
				regulator-name = "slg51000_a_ldo7";
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <3750000>;
			};
		};
	};
};

&i2c_master_hub_0 {
	status = "okay";
};

&i2c0 {
	clock-frequency = <1000000>;
	status = "okay";

	/* NXP NFC @ 28 */
};

&i2c4 {
	clock-frequency = <400000>;
	status = "okay";

	/* LX Semi SW82907 touchscreen @ 28 */
};

&i2c10 {
	clock-frequency = <1000000>;
	status = "okay";

	/* Cirrus Logic CS40L25A boosted haptics driver @ 40 */
};

&i2c11 {
	clock-frequency = <1000000>;
	status = "okay";

	cs35l41_l: speaker-amp@30 {
		compatible = "cirrus,cs35l45";
		reg = <0x30>;
		interrupts-extended = <&tlmm 182 IRQ_TYPE_LEVEL_LOW>;
		reset-gpios = <&tlmm 183 GPIO_ACTIVE_HIGH>;
		cirrus,asp-sdout-hiz-ctrl = <(CS35L45_ASP_TX_HIZ_UNUSED | CS35L45_ASP_TX_HIZ_DISABLED)>;
		#sound-dai-cells = <1>;

		cirrus,gpio-ctrl2 {
			gpio-ctrl = <0x2>;
		};
	};

	cs35l41_r: speaker-amp@31 {
		compatible = "cirrus,cs35l45";
		reg = <0x31>;
		interrupts-extended = <&tlmm 182 IRQ_TYPE_LEVEL_LOW>;
		reset-gpios = <&tlmm 183 GPIO_ACTIVE_HIGH>;
		cirrus,asp-sdout-hiz-ctrl = <(CS35L45_ASP_TX_HIZ_UNUSED | CS35L45_ASP_TX_HIZ_DISABLED)>;
		#sound-dai-cells = <1>;

		cirrus,gpio-ctrl2 {
			gpio-ctrl = <0x2>;
		};
	};
};

&pcie0 {
	wake-gpios = <&tlmm 96 GPIO_ACTIVE_HIGH>;
	perst-gpios = <&tlmm 94 GPIO_ACTIVE_LOW>;

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

	status = "okay";
};

&pcie0_phy {
	vdda-phy-supply = <&pm8550vs_2_l1>;
	vdda-pll-supply = <&pm8550vs_2_l3>;

	status = "okay";
};

&pm8550_flash {
	status = "okay";

	led-0 {
		function = LED_FUNCTION_FLASH;
		color = <LED_COLOR_ID_WHITE>;
		led-sources = <1>, <4>;
		led-max-microamp = <500000>;
		flash-max-microamp = <1000000>;
		flash-max-timeout-us = <1280000>;
		function-enumerator = <0>;
	};

	led-1 {
		function = LED_FUNCTION_FLASH;
		color = <LED_COLOR_ID_YELLOW>;
		led-sources = <2>, <3>;
		led-max-microamp = <500000>;
		flash-max-microamp = <1000000>;
		flash-max-timeout-us = <1280000>;
		function-enumerator = <1>;
	};
};

&pm8550_gpios {
	vol_down_n: volume-down-n-state {
		pins = "gpio6";
		function = "normal";
		power-source = <1>;
		bias-pull-up;
		input-enable;
	};

	sdc2_card_det_n: sd-card-det-n-state {
		pins = "gpio12";
		function = "normal";
		power-source = <1>;
		bias-pull-down;
		output-disable;
		input-enable;
	};
};

&pm8550b_gpios {
	snapshot_n: snapshot-n-state {
		pins = "gpio7";
		function = "normal";
		power-source = <1>;
		bias-pull-up;
		input-enable;
	};

	focus_n: focus-n-state {
		pins = "gpio8";
		function = "normal";
		power-source = <1>;
		bias-pull-up;
		input-enable;
	};
};

&pm8550vs_g_gpios {
	cam_pwr_a_cs: cam-pwr-a-cs-state {
		pins = "gpio4";
		function = "normal";
		power-source = <0x01>;
		drive-push-pull;
		output-low;
		qcom,drive-strength = <PMIC_GPIO_STRENGTH_HIGH>;
	};
};

&pm8550b_eusb2_repeater {
	qcom,tune-usb2-disc-thres = /bits/ 8 <0x6>;
	qcom,tune-usb2-amplitude = /bits/ 8 <0xf>;
	qcom,tune-usb2-preem = /bits/ 8 <0x7>;
	vdd18-supply = <&pm8550_l15>;
	vdd3-supply = <&pm8550_l5>;
};

&pon_pwrkey {
	status = "okay";
};

&pon_resin {
	linux,code = <KEY_VOLUMEUP>;
	status = "okay";
};

&qupv3_id_0 {
	status = "okay";
};

&qupv3_id_1 {
	status = "okay";
};

&remoteproc_adsp {
	firmware-name = "qcom/sm8550/Sony/yodo/adsp.mbn",
			"qcom/sm8550/Sony/yodo/adsp_dtb.mbn";
	status = "okay";
};

&remoteproc_cdsp {
	firmware-name = "qcom/sm8550/Sony/yodo/cdsp.mbn",
			"qcom/sm8550/Sony/yodo/cdsp_dtb.mbn";
	status = "okay";
};

&sdhc_2 {
	cd-gpios = <&pm8550_gpios 12 GPIO_ACTIVE_HIGH>;
	pinctrl-0 = <&sdc2_default &sdc2_card_det_n>;
	pinctrl-1 = <&sdc2_sleep &sdc2_card_det_n>;
	pinctrl-names = "default", "sleep";
	vmmc-supply = <&pm8550_l9>;
	vqmmc-supply = <&pm8550_l8>;
	no-sdio;
	no-mmc;
	status = "okay";
};

&sleep_clk {
	clock-frequency = <32000>;
};

&tlmm {
	gpio-reserved-ranges = <32 8>;
};

&uart7 {
	status = "okay";
};

&usb_1 {
	status = "okay";
};

&usb_1_dwc3_hs {
	remote-endpoint = <&pmic_glink_hs_in>;
};

&usb_1_hsphy {
	vdd-supply = <&pm8550vs_2_l1>;
	vdda12-supply = <&pm8550vs_2_l3>;
	phys = <&pm8550b_eusb2_repeater>;

	status = "okay";
};

&usb_dp_qmpphy {
	vdda-phy-supply = <&pm8550vs_2_l3>;
	vdda-pll-supply = <&pm8550ve_l3>;

	status = "okay";
};

&usb_dp_qmpphy_out {
	remote-endpoint = <&pmic_glink_ss_in>;
};

&xo_board {
	clock-frequency = <76800000>;
};