// SPDX-License-Identifier: GPL-2.0

#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/max77620.h>

/ {
	i2c@7000d000 {
		pmic: pmic@3c {
			compatible = "maxim,max77663";
			reg = <0x3c>;

			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
			#interrupt-cells = <2>;
			interrupt-controller;

			#gpio-cells = <2>;
			gpio-controller;

			system-power-controller;

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

			cpu-pwr-req-hog {
				gpio-hog;
				gpios = <6 GPIO_ACTIVE_HIGH>;
				input;
			};

			fps {
				fps0 {
					maxim,fps-event-source = <MAX77620_FPS_EVENT_SRC_EN0>;
				};

				fps1 {
					maxim,fps-event-source = <MAX77620_FPS_EVENT_SRC_EN1>;
				};

				fps2 {
					maxim,fps-event-source = <MAX77620_FPS_EVENT_SRC_EN0>;
				};
			};

			max77620_default: pinmux {
				gpio4 {
					pins = "gpio4";
					function = "32k-out1";
				};
			};

			regulators {
				in-sd0-supply = <&vdd_5v0_sys>;
				in-sd1-supply = <&vdd_5v0_sys>;
				in-sd2-supply = <&vdd_5v0_sys>;
				in-sd3-supply = <&vdd_5v0_sys>;
				in-sd4-supply = <&vdd_5v0_sys>;

				in-ldo0-1-supply = <&vdd_1v35>;
				in-ldo2-supply   = <&vdd_3v3_sys>;
				in-ldo3-5-supply = <&vdd_3v3_sys>;
				in-ldo4-6-supply = <&vdd_5v0_sys>;
				in-ldo7-8-supply = <&vdd_1v35>;

				vdd_cpu: sd0 {
					regulator-name = "vdd_cpu";
					regulator-min-microvolt = <800000>;
					regulator-max-microvolt = <1250000>;
					regulator-coupled-with = <&vdd_core>;
					regulator-coupled-max-spread = <300000>;
					regulator-max-step-microvolt = <100000>;
					regulator-always-on;
					regulator-boot-on;

					nvidia,tegra-cpu-regulator;
				};

				vdd_core: sd1 {
					regulator-name = "vdd_core";
					regulator-min-microvolt = <950000>;
					regulator-max-microvolt = <1350000>;
					regulator-coupled-with = <&vdd_cpu>;
					regulator-coupled-max-spread = <300000>;
					regulator-max-step-microvolt = <100000>;
					regulator-always-on;
					regulator-boot-on;

					nvidia,tegra-core-regulator;
				};

				vdd_1v8: sd2 {
					regulator-name = "vdd_gen1v8";
					regulator-min-microvolt = <1800000>;
					regulator-max-microvolt = <1800000>;
					regulator-always-on;
					regulator-boot-on;
				};

				vdd_1v35: sd3 {
					regulator-name = "vdd_ddr3l_1v35";
					regulator-min-microvolt = <1350000>;
					regulator-max-microvolt = <1350000>;
					regulator-always-on;
					regulator-boot-on;
				};

				ldo0 {
					regulator-name = "vdd_ddr_hs";
					regulator-min-microvolt = <1000000>;
					regulator-max-microvolt = <1000000>;
					regulator-always-on;
					regulator-boot-on;
				};

				ldo2 {
					regulator-name = "vdd_ddr_rx";
					regulator-min-microvolt = <2800000>;
					regulator-max-microvolt = <2800000>;
					regulator-always-on;
					regulator-boot-on;
				};

				vcore_emmc: ldo3 {
					regulator-name = "vcore_emmc";
					regulator-min-microvolt = <2850000>;
					regulator-max-microvolt = <3100000>;
					regulator-always-on;
				};

				ldo4 {
					regulator-name = "vdd_rtc";
					regulator-min-microvolt = <1200000>;
					regulator-max-microvolt = <1200000>;
					regulator-always-on;
					regulator-boot-on;
				};

				ldo5 {
					regulator-name = "vdd_camera";
					regulator-min-microvolt = <1800000>;
					regulator-max-microvolt = <1800000>;
				};

				ldo6 {
					regulator-name = "vddio_sdmmc";
					regulator-min-microvolt = <1800000>;
					regulator-max-microvolt = <3300000>;
					regulator-always-on;
					regulator-boot-on;
				};

				ldo7 {
					regulator-name = "avdd_dsi_csi";
					regulator-min-microvolt = <1200000>;
					regulator-max-microvolt = <1200000>;
				};

				ldo8 {
					regulator-name = "avdd_pll";
					regulator-min-microvolt = <1200000>;
					regulator-max-microvolt = <1200000>;
					regulator-always-on;
					regulator-boot-on;
				};
			};
		};
	};

	vdd_3v3_sys: regulator-3v3 {
		gpio = <&pmic 3 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	regulator-usb {
		compatible = "regulator-fixed";
		regulator-name = "avdd_usb";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
		regulator-boot-on;
		gpio = <&pmic 2 GPIO_ACTIVE_HIGH>;
		enable-active-high;
		vin-supply = <&vdd_3v3_sys>;
	};

	pmc@7000e400 {
		i2c-thermtrip {
			nvidia,i2c-controller-id = <4>;
			nvidia,bus-addr = <0x3c>;
			nvidia,reg-addr = <0x41>;
			nvidia,reg-data = <0xe0>;
		};
	};
};