// SPDX-License-Identifier: GPL-2.0

&ssbi {
	pm8921: pmic {
		compatible = "qcom,pm8921";
		#interrupt-cells = <2>;
		interrupt-controller;
		#address-cells = <1>;
		#size-cells = <0>;

		pwrkey@1c {
			compatible = "qcom,pm8921-pwrkey";
			reg = <0x1c>;
			interrupts-extended = <&pm8921 50 IRQ_TYPE_EDGE_RISING>,
					      <&pm8921 51 IRQ_TYPE_EDGE_RISING>;
			debounce = <15625>;
			pull-up;
		};

		pm8921_mpps: mpps@50 {
			compatible = "qcom,pm8921-mpp",
				     "qcom,ssbi-mpp";
			reg = <0x50>;
			gpio-controller;
			#gpio-cells = <2>;
			gpio-ranges = <&pm8921_mpps 0 0 12>;
			interrupt-controller;
			#interrupt-cells = <2>;
		};

		rtc@11d {
			compatible = "qcom,pm8921-rtc";
			reg = <0x11d>;
			interrupts-extended = <&pm8921 39 IRQ_TYPE_EDGE_RISING>;
			allow-set-time;
		};

		pm8921_keypad: keypad@148 {
			compatible = "qcom,pm8921-keypad";
			reg = <0x148>;
			interrupts-extended = <&pm8921 74 IRQ_TYPE_EDGE_RISING>,
					      <&pm8921 75 IRQ_TYPE_EDGE_RISING>;
			debounce = <15>;
			scan-delay = <32>;
			row-hold = <91500>;
			status = "disabled";
		};

		pm8921_gpio: gpio@150 {

			compatible = "qcom,pm8921-gpio",
				     "qcom,ssbi-gpio";
			reg = <0x150>;
			interrupt-controller;
			#interrupt-cells = <2>;
			gpio-controller;
			gpio-ranges = <&pm8921_gpio 0 0 44>;
			#gpio-cells = <2>;

		};

		pm8921_xoadc: xoadc@197 {
			compatible = "qcom,pm8921-adc";
			reg = <0x197>;
			interrupts-extended = <&pm8921 78 IRQ_TYPE_EDGE_RISING>;
			#address-cells = <2>;
			#size-cells = <0>;
			#io-channel-cells = <2>;

			vcoin: adc-channel@0 {
				reg = <0x00 0x00>;
			};

			vbat: adc-channel@1 {
				reg = <0x00 0x01>;
			};

			dcin: adc-channel@2 {
				reg = <0x00 0x02>;
			};

			vph_pwr: adc-channel@4 {
				reg = <0x00 0x04>;
			};

			batt_therm: adc-channel@8 {
				reg = <0x00 0x08>;
			};

			batt_id: adc-channel@9 {
				reg = <0x00 0x09>;
			};

			usb_vbus: adc-channel@a {
				reg = <0x00 0x0a>;
			};

			die_temp: adc-channel@b {
				reg = <0x00 0x0b>;
			};

			ref_625mv: adc-channel@c {
				reg = <0x00 0x0c>;
			};

			ref_1250mv: adc-channel@d {
				reg = <0x00 0x0d>;
			};

			chg_temp: adc-channel@e {
				reg = <0x00 0x0e>;
			};

			ref_muxoff: adc-channel@f {
				reg = <0x00 0x0f>;
			};
		};
	};
};

/ {
	/*
	 * These channels from the ADC are simply hardware monitors.
	 * That is why the ADC is referred to as "HKADC" - HouseKeeping
	 * ADC.
	 */
	iio-hwmon {
		compatible = "iio-hwmon";
		io-channels = <&pm8921_xoadc 0x00 0x01>, /* Battery */
			      <&pm8921_xoadc 0x00 0x02>, /* DC in (charger) */
			      <&pm8921_xoadc 0x00 0x04>, /* VPH the main system voltage */
			      <&pm8921_xoadc 0x00 0x0b>, /* Die temperature */
			      <&pm8921_xoadc 0x00 0x0c>, /* Reference voltage 1.25V */
			      <&pm8921_xoadc 0x00 0x0d>, /* Reference voltage 0.625V */
			      <&pm8921_xoadc 0x00 0x0e>; /* Charger temperature */
	};
};
