Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ffd9334 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "thermal: adc_tm: adc_init for sdm660"

parents cd72f50a d466b3ca
Loading
Loading
Loading
Loading
+173 −263
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@
 */
 */


#include <dt-bindings/spmi/spmi.h>
#include <dt-bindings/spmi/spmi.h>
#include <dt-bindings/iio/qcom,spmi-vadc.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/interrupt-controller/irq.h>


&spmi_bus {
&spmi_bus {
@@ -59,105 +60,39 @@
			};
			};
		};
		};


		qcom,temp-alarm@2400 {
		pm660_tz: qcom,temp-alarm@2400 {
			compatible = "qcom,qpnp-temp-alarm";
			compatible = "qcom,spmi-temp-alarm";
			reg = <0x2400 0x100>;
			reg = <0x2400 0x100>;
			interrupts = <0x0 0x24 0x0 IRQ_TYPE_EDGE_RISING>;
			interrupts = <0x0 0x24 0x0 IRQ_TYPE_EDGE_RISING>;
			label = "pm660_tz";
			#thermal-sensor-cells = <0>;
			qcom,channel-num = <6>;
			qcom,temperature-threshold-set = <1>;
			qcom,temp_alarm-vadc = <&pm660_vadc>;
		};
		};


		pm660_gpios: pinctrl@c000 {
		pm660_gpios: gpios {
			compatible = "qcom,spmi-gpio";
			compatible = "qcom,qpnp-pin";
			reg = <0xc000 0xd00>;
			interrupts = <0x0 0xc0 0 IRQ_TYPE_NONE>,
					<0x0 0xc1 0 IRQ_TYPE_NONE>,
					<0x0 0xc2 0 IRQ_TYPE_NONE>,
					<0x0 0xc3 0 IRQ_TYPE_NONE>,
					<0x0 0xc4 0 IRQ_TYPE_NONE>,
					<0x0 0xc5 0 IRQ_TYPE_NONE>,
					<0x0 0xc6 0 IRQ_TYPE_NONE>,
					<0x0 0xc7 0 IRQ_TYPE_NONE>,
					<0x0 0xc8 0 IRQ_TYPE_NONE>,
					<0x0 0xc9 0 IRQ_TYPE_NONE>,
					<0x0 0xca 0 IRQ_TYPE_NONE>,
					<0x0 0xcb 0 IRQ_TYPE_NONE>,
					<0x0 0xcc 0 IRQ_TYPE_NONE>;
			interrupt-names = "pm660_gpio1", "pm660_gpio2",
					"pm660_gpio3", "pm660_gpio4",
					"pm660_gpio5", "pm660_gpio6",
					"pm660_gpio7", "pm660_gpio8",
					"pm660_gpio9", "pm660_gpio10",
					"pm660_gpio11", "pm660_gpio12",
					"pm660_gpio13";
			gpio-controller;
			gpio-controller;
			#gpio-cells = <2>;
			#gpio-cells = <2>;
			#address-cells = <1>;
			#size-cells = <1>;
			label = "pm660-gpio";

			gpio@c000 {
				reg = <0xc000 0x100>;
				qcom,pin-num = <1>;
				status = "disabled";
			};

			gpio@c100 {
				reg = <0xc100 0x100>;
				qcom,pin-num = <2>;
				status = "disabled";
			};

			gpio@c200 {
				reg = <0xc200 0x100>;
				qcom,pin-num = <3>;
				status = "disabled";
			};

			gpio@c300 {
				reg = <0xc300 0x100>;
				qcom,pin-num = <4>;
				status = "disabled";
			};

			gpio@c400 {
				reg = <0xc400 0x100>;
				qcom,pin-num = <5>;
				status = "disabled";
			};

			gpio@c500 {
				reg = <0xc500 0x100>;
				qcom,pin-num = <6>;
				status = "disabled";
			};

			gpio@c600 {
				reg = <0xc600 0x100>;
				qcom,pin-num = <7>;
				status = "disabled";
			};

			gpio@c700 {
				reg = <0xc700 0x100>;
				qcom,pin-num = <8>;
				status = "disabled";
			};

			gpio@c800 {
				reg = <0xc800 0x100>;
				qcom,pin-num = <9>;
				status = "disabled";
			};

			gpio@c900 {
				reg = <0xc900 0x100>;
				qcom,pin-num = <10>;
				status = "disabled";
			};

			gpio@ca00 {
				reg = <0xca00 0x100>;
				qcom,pin-num = <11>;
				status = "disabled";
			};

			gpio@cb00 {
				reg = <0xcb00 0x100>;
				qcom,pin-num = <12>;
				status = "disabled";
			};

			gpio@cc00 {
				reg = <0xcc00 0x100>;
				qcom,pin-num = <13>;
				status = "disabled";
			};
		};

		pm660_coincell: qcom,coincell@2800 {
			compatible = "qcom,qpnp-coincell";
			reg = <0x2800 0x100>;
		};
		};


		pm660_rtc: qcom,pm660_rtc {
		pm660_rtc: qcom,pm660_rtc {
@@ -177,140 +112,91 @@
		};
		};


		pm660_vadc: vadc@3100 {
		pm660_vadc: vadc@3100 {
			compatible = "qcom,qpnp-vadc-hc";
			compatible = "qcom,spmi-adc-rev2";
			reg = <0x3100 0x100>;
			reg = <0x3100 0x100>;
			#address-cells = <1>;
			#address-cells = <1>;
			#size-cells = <0>;
			#size-cells = <0>;
			interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
			interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
			interrupt-names = "eoc-int-en-set";
			interrupt-names = "eoc-int-en-set";
			qcom,adc-bit-resolution = <15>;
			#io-channel-cells = <1>;
			qcom,adc-vdd-reference = <1875>;
			io-channel-ranges;


			chan@6 {
			/* Channel nodes */
			die_temp {
				reg = <ADC_DIE_TEMP>;
				label = "die_temp";
				label = "die_temp";
				reg = <6>;
				qcom,pre-scaling = <1 1>;
				qcom,decimation = <2>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,calibration-type = "absolute";
				qcom,scale-function = <3>;
				qcom,hw-settle-time = <0>;
				qcom,fast-avg-setup = <0>;
				qcom,cal-val = <0>;
			};
			};


			chan@0 {
			ref_gnd {
				reg = <ADC_REF_GND>;
				label = "ref_gnd";
				label = "ref_gnd";
				reg = <0>;
				qcom,pre-scaling = <1 1>;
				qcom,decimation = <2>;
			};
				qcom,pre-div-channel-scaling = <0>;

				qcom,calibration-type = "absolute";
			vref_1p25 {
				qcom,scale-function = <0>;
				reg = <ADC_1P25VREF>;
				qcom,hw-settle-time = <0>;
				label = "vref_1p25";
				qcom,fast-avg-setup = <0>;
				qcom,pre-scaling = <1 1>;
				qcom,cal-val = <0>;
			};
			};



			chan@1 {
			vph_pwr {
				label = "ref_1250v";
				reg = <ADC_VPH_PWR>;
				reg = <1>;
				qcom,decimation = <2>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,calibration-type = "absolute";
				qcom,scale-function = <0>;
				qcom,hw-settle-time = <0>;
				qcom,fast-avg-setup = <0>;
				qcom,cal-val = <0>;
			};

			chan@83 {
				label = "vph_pwr";
				label = "vph_pwr";
				reg = <0x83>;
				qcom,pre-scaling = <1 3>;
				qcom,decimation = <2>;
				qcom,pre-div-channel-scaling = <1>;
				qcom,calibration-type = "absolute";
				qcom,scale-function = <0>;
				qcom,hw-settle-time = <0>;
				qcom,fast-avg-setup = <0>;
			};
			};


			chan@85 {
			vcoin {
				reg = <ADC_VCOIN>;
				label = "vcoin";
				label = "vcoin";
				reg = <0x85>;
				qcom,pre-scaling = <1 3>;
				qcom,decimation = <2>;
				qcom,pre-div-channel-scaling = <1>;
				qcom,calibration-type = "absolute";
				qcom,scale-function = <0>;
				qcom,hw-settle-time = <0>;
				qcom,fast-avg-setup = <0>;
			};
			};


			chan@4c {
			xo_therm {
				reg = <ADC_XO_THERM_PU2>;
				label = "xo_therm";
				label = "xo_therm";
				reg = <0x4c>;
				qcom,ratiometric;
				qcom,decimation = <2>;
				qcom,hw-settle-time = <200>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,pre-scaling = <1 1>;
				qcom,calibration-type = "ratiometric";
				qcom,scale-function = <4>;
				qcom,hw-settle-time = <2>;
				qcom,fast-avg-setup = <0>;
			};
			};


			chan@4d {
			msm_therm{
				reg = <ADC_AMUX_THM1_PU2>;
				label = "msm_therm";
				label = "msm_therm";
				reg = <0x4d>;
				qcom,ratiometric;
				qcom,decimation = <2>;
				qcom,hw-settle-time = <200>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,pre-scaling = <1 1>;
				qcom,calibration-type = "ratiometric";
				qcom,scale-function = <2>;
				qcom,hw-settle-time = <2>;
				qcom,fast-avg-setup = <0>;
			};
			};


			chan@51 {
			quiet_therm{
				reg = <ADC_AMUX_THM5_PU2>;
				label = "quiet_therm";
				label = "quiet_therm";
				reg = <0x51>;
				qcom,ratiometric;
				qcom,decimation = <2>;
				qcom,hw-settle-time = <200>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,pre-scaling = <1 1>;
				qcom,calibration-type = "ratiometric";
				qcom,scale-function = <2>;
				qcom,hw-settle-time = <2>;
				qcom,fast-avg-setup = <0>;
			};
			};


			chan@4e {
			emmc_therm{
				reg = <ADC_AMUX_THM2_PU2>;
				label = "emmc_therm";
				label = "emmc_therm";
				reg = <0x4e>;
				qcom,ratiometric;
				qcom,decimation = <2>;
				qcom,hw-settle-time = <200>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,pre-scaling = <1 1>;
				qcom,calibration-type = "ratiometric";
				qcom,scale-function = <2>;
				qcom,hw-settle-time = <2>;
				qcom,fast-avg-setup = <0>;
				qcom,vadc-thermal-node;
			};
			};


			chan@4f {
			pa_therm0{
				reg = <ADC_AMUX_THM3_PU2>;
				label = "pa_therm0";
				label = "pa_therm0";
				reg = <0x4f>;
				qcom,ratiometric;
				qcom,decimation = <2>;
				qcom,hw-settle-time = <200>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,pre-scaling = <1 1>;
				qcom,calibration-type = "ratiometric";
				qcom,scale-function = <2>;
				qcom,hw-settle-time = <2>;
				qcom,fast-avg-setup = <0>;
				qcom,vadc-thermal-node;
			};
			};


			chan@1d {
			drax_temp{
				reg = <ANA_IN>;
				label = "drax_temp";
				label = "drax_temp";
				reg = <0x1d>;
				qcom,pre-scaling = <1 1>;
				qcom,decimation = <2>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,calibration-type = "absolute";
				qcom,scale-function = <3>;
				qcom,hw-settle-time = <0>;
				qcom,fast-avg-setup = <0>;
				qcom,cal-val = <0>;
			};
			};
		};
		};


@@ -476,60 +362,14 @@
		};
		};


		pm660_adc_tm: vadc@3400 {
		pm660_adc_tm: vadc@3400 {
			compatible = "qcom,qpnp-adc-tm-hc";
			compatible = "qcom,adc-tm5";
			reg = <0x3400 0x100>;
			reg = <0x3400 0x100>;
			interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>;
			interrupt-names = "thr-int-en";
			#address-cells = <1>;
			#address-cells = <1>;
			#size-cells = <0>;
			#size-cells = <0>;
			interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>;
			#thermal-sensor-cells = <1>;
			interrupt-names = "eoc-int-en-set";
			qcom,pmic-revid = <&pm660_revid>;
			qcom,adc-bit-resolution = <15>;
			qcom,adc-vdd-reference = <1875>;
			qcom,adc_tm-vadc = <&pm660_vadc>;
			qcom,decimation = <0>;
			qcom,fast-avg-setup = <0>;

			chan@83 {
				label = "vph_pwr";
				reg = <0x83>;
				qcom,pre-div-channel-scaling = <1>;
				qcom,calibration-type = "absolute";
				qcom,scale-function = <0>;
				qcom,hw-settle-time = <0>;
				qcom,btm-channel-number = <0x60>;
			};

			chan@4d {
				label = "msm_therm";
				reg = <0x4d>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,calibration-type = "ratiometric";
				qcom,scale-function = <2>;
				qcom,hw-settle-time = <2>;
				qcom,btm-channel-number = <0x68>;
				qcom,thermal-node;
			};

			chan@51 {
				label = "quiet_therm";
				reg = <0x51>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,calibration-type = "ratiometric";
				qcom,scale-function = <2>;
				qcom,hw-settle-time = <2>;
				qcom,btm-channel-number = <0x70>;
				qcom,thermal-node;
			};

			chan@4c {
				label = "xo_therm";
				reg = <0x4c>;
				qcom,pre-div-channel-scaling = <0>;
				qcom,calibration-type = "ratiometric";
				qcom,scale-function = <4>;
				qcom,hw-settle-time = <2>;
				qcom,btm-channel-number = <0x78>;
				qcom,thermal-node;
			};
		};
		};


		pm660_rradc: rradc@4500 {
		pm660_rradc: rradc@4500 {
@@ -630,28 +470,98 @@
		#size-cells = <0>;
		#size-cells = <0>;


		pm660_haptics: qcom,haptic@c000 {
		pm660_haptics: qcom,haptic@c000 {
			compatible = "qcom,qpnp-haptic";
			compatible = "qcom,pm660-haptics";
			reg = <0xc000 0x100>;
			reg = <0xc000 0x100>;
			interrupts = <0x1 0xc0 0x0 IRQ_TYPE_EDGE_BOTH>,
			interrupts = <0x1 0xc0 0x0 IRQ_TYPE_EDGE_BOTH>,
				     <0x1 0xc0 0x1 IRQ_TYPE_EDGE_BOTH>;
				     <0x1 0xc0 0x1 IRQ_TYPE_EDGE_BOTH>;
			interrupt-names = "sc-irq", "play-irq";
			interrupt-names = "hap-sc-irq", "hap-play-irq";
			qcom,pmic-revid = <&pm660_revid>;
			qcom,pmic-misc = <&pm660_misc>;
			qcom,misc-clk-trim-error-reg = <0xf3>;
			qcom,actuator-type = "lra";
			qcom,actuator-type = "lra";
			qcom,play-mode = "direct";
			qcom,vmax-mv = <3200>;
			qcom,vmax-mv = <3200>;
			qcom,ilim-ma = <800>;
			qcom,play-rate-us = <6667>;
			qcom,wave-shape = "square";
			qcom,lra-resonance-sig-shape = "sine";
			qcom,wave-play-rate-us = <6667>;
			qcom,lra-auto-resonance-mode = "qwd";
			qcom,int-pwm-freq-khz = <505>;
			qcom,lra-allow-variable-play-rate;
			qcom,sc-debounce-cycles = <8>;

			qcom,en-brake;
			wf_0 {
			qcom,brake-pattern = [03 03 00 00];
				/* CLICK */
			qcom,lra-high-z = "opt0";
				qcom,effect-id = <0>;
			qcom,lra-auto-res-mode = "qwd";
				qcom,wf-vmax-mv = <3600>;
			qcom,lra-calibrate-at-eop = <0>;
				qcom,wf-pattern = [3e 3e 3e];
			qcom,correct-lra-drive-freq;
				qcom,wf-play-rate-us = <6667>;
				qcom,wf-brake-pattern = [01 00 00 00];
				qcom,lra-auto-resonance-disable;
			};
			wf_1 {
				/* DOUBLE CLICK */
				qcom,effect-id = <1>;
				qcom,wf-vmax-mv = <3600>;
				qcom,wf-pattern = [7e 7e 02 02 02 02 02 02];
				qcom,wf-play-rate-us = <7143>;
				qcom,wf-repeat-count = <2>;
				qcom,wf-s-repeat-count = <1>;
				qcom,lra-auto-resonance-disable;
			};
			wf_2 {
				/* TICK */
				qcom,effect-id = <2>;
				qcom,wf-vmax-mv = <3600>;
				qcom,wf-pattern = [7e 7e];
				qcom,wf-play-rate-us = <4000>;
				qcom,lra-auto-resonance-disable;
			};
			wf_3 {
				/* THUD */
				qcom,effect-id = <3>;
				qcom,wf-vmax-mv = <3600>;
				qcom,wf-pattern = [7e 7e 7e];
				qcom,wf-play-rate-us = <6667>;
				qcom,lra-auto-resonance-disable;
			};
			wf_4 {
				/* POP */
				qcom,effect-id = <4>;
				qcom,wf-vmax-mv = <3600>;
				qcom,wf-pattern = [7e 7e];
				qcom,wf-play-rate-us = <5000>;
				qcom,lra-auto-resonance-disable;
			};
			wf_5 {
				/* HEAVY CLICK */
				qcom,effect-id = <5>;
				qcom,wf-vmax-mv = <3600>;
				qcom,wf-pattern = [7e 7e 7e];
				qcom,wf-play-rate-us = <6667>;
				qcom,wf-brake-pattern = [03 00 00 00];
				qcom,lra-auto-resonance-disable;
			};
		};
	};
};

&thermal_zones {
	pm660_temp_alarm: pm660-tz {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&pm660_tz>;
		wake-capable-sensor;

		trips {
			pm660_trip0: trip0 {
				temperature = <95000>;
				hysteresis = <0>;
				type = "passive";
			};
			pm660_trip1: trip1 {
				temperature = <115000>;
				hysteresis = <0>;
				type = "passive";
			};
			trip2 {
				temperature = <145000>;
				hysteresis = <0>;
				type = "passive";
			};
		};
		};
	};
	};
};
};
+117 −196
Original line number Original line Diff line number Diff line
@@ -39,93 +39,37 @@
				<PON_POWER_OFF_SHUTDOWN>;
				<PON_POWER_OFF_SHUTDOWN>;
		};
		};


		qcom,temp-alarm@2400 {
		pm660l_tz: qcom,temp-alarm@2400 {
			compatible = "qcom,qpnp-temp-alarm";
			compatible = "qcom,spmi-temp-alarm";
			reg = <0x2400 0x100>;
			reg = <0x2400 0x100>;
			interrupts = <0x2 0x24 0x0 IRQ_TYPE_EDGE_RISING>;
			interrupts = <0x2 0x24 0x0 IRQ_TYPE_EDGE_RISING>;
			label = "pm660l_tz";
			#thermal-sensor-cells = <0>;
		};
			qcom,temperature-threshold-set = <1>;

		};
		pm660l_gpios: gpios {

			compatible = "qcom,qpnp-pin";
		pm660l_gpios: pinctrl@c000 {
			compatible = "qcom,spmi-gpio";
			reg = <0xc000 0xc00>;
			interrupts = <0x0 0xc0 0 IRQ_TYPE_NONE>,
			<0x0 0xc1 0 IRQ_TYPE_NONE>,
			<0x0 0xc2 0 IRQ_TYPE_NONE>,
			<0x0 0xc3 0 IRQ_TYPE_NONE>,
			<0x0 0xc4 0 IRQ_TYPE_NONE>,
			<0x0 0xc5 0 IRQ_TYPE_NONE>,
			<0x0 0xc6 0 IRQ_TYPE_NONE>,
			<0x0 0xc7 0 IRQ_TYPE_NONE>,
			<0x0 0xc8 0 IRQ_TYPE_NONE>,
			<0x0 0xc9 0 IRQ_TYPE_NONE>,
			<0x0 0xca 0 IRQ_TYPE_NONE>,
			<0x0 0xcb 0 IRQ_TYPE_NONE>;
			interrupt-names = "pm660l_gpio1", "pm660l_gpio2",
					"pm660l_gpio3", "pm660l_gpio4",
					"pm660l_gpio5", "pm660l_gpio6",
					"pm660l_gpio7", "pm660l_gpio8",
					"pm660l_gpio9", "pm660l_gpio10",
					"pm660l_gpio11", "pm660l_gpio12";
			gpio-controller;
			gpio-controller;
			#gpio-cells = <2>;
			#gpio-cells = <2>;
			#address-cells = <1>;
			#size-cells = <1>;
			label = "pm660l-gpio";

			gpio@c000 {
				reg = <0xc000 0x100>;
				qcom,pin-num = <1>;
				status = "disabled";
			};

			gpio@c100 {
				reg = <0xc100 0x100>;
				qcom,pin-num = <2>;
				status = "disabled";
			};

			gpio@c200 {
				reg = <0xc200 0x100>;
				qcom,pin-num = <3>;
				status = "disabled";
			};

			gpio@c300 {
				reg = <0xc300 0x100>;
				qcom,pin-num = <4>;
				status = "disabled";
			};

			gpio@c400 {
				reg = <0xc400 0x100>;
				qcom,pin-num = <5>;
				status = "disabled";
			};

			gpio@c500 {
				reg = <0xc500 0x100>;
				qcom,pin-num = <6>;
				status = "disabled";
			};

			gpio@c600 {
				reg = <0xc600 0x100>;
				qcom,pin-num = <7>;
				status = "disabled";
			};

			gpio@c700 {
				reg = <0xc700 0x100>;
				qcom,pin-num = <8>;
				status = "disabled";
			};

			gpio@c800 {
				reg = <0xc800 0x100>;
				qcom,pin-num = <9>;
				status = "disabled";
			};

			gpio@c900 {
				reg = <0xc900 0x100>;
				qcom,pin-num = <10>;
				status = "disabled";
			};

			gpio@ca00 {
				reg = <0xca00 0x100>;
				qcom,pin-num = <11>;
				status = "disabled";
			};

			gpio@cb00 {
				reg = <0xcb00 0x100>;
				qcom,pin-num = <12>;
				status = "disabled";
			};

		};
		};
	};
	};


@@ -135,141 +79,90 @@
		#address-cells = <2>;
		#address-cells = <2>;
		#size-cells = <0>;
		#size-cells = <0>;


		pm660l_pwm_1: pwm@b100 {
		pm660l_lpg: qcom,pwms@b100 {
			compatible = "qcom,qpnp-pwm";
			compatible = "qcom,pwm-lpg";
			reg = <0xb100 0x100>,
			reg = <0xb100 0x300>, <0xb000 0x100>;
			      <0xb042 0x7e>;
			reg-names = "lpg-base", "lut-base";
			reg-names = "qpnp-lpg-channel-base",
					"qpnp-lpg-lut-base";
			qcom,channel-id = <1>;
			qcom,lpg-lut-size = <0x7e>;
			qcom,supported-sizes = <6>, <9>;
			qcom,ramp-index = <0>;
			#pwm-cells = <2>;
			#pwm-cells = <2>;
		};
			qcom,num-lpg-channels = <3>;

			qcom,lut-patterns = <0 10 20 30 40 50 60 70 80 90 100
		pm660l_pwm_2: pwm@b200 {
			90 80 70 60 50 40 30 20 10 0>;
			compatible = "qcom,qpnp-pwm";

			reg = <0xb200 0x100>,
			lpg1 {
			      <0xb042 0x7e>;
				qcom,lpg-chan-id = <1>;
			reg-names = "qpnp-lpg-channel-base",
				qcom,ramp-step-ms = <100>;
					 "qpnp-lpg-lut-base";
				qcom,ramp-pause-hi-count = <2>;
			qcom,channel-id = <2>;
				qcom,ramp-pause-lo-count = <2>;
			qcom,lpg-lut-size = <0x7e>;
				qcom,ramp-low-index = <0>;
			qcom,supported-sizes = <6>, <9>;
				qcom,ramp-high-index = <20>;
			qcom,ramp-index = <1>;
				qcom,ramp-from-low-to-high;
				qcom,ramp-pattern-repeat;
			};
			lpg2 {
				qcom,lpg-chan-id = <2>;
				qcom,ramp-step-ms = <100>;
				qcom,ramp-pause-hi-count = <2>;
				qcom,ramp-pause-lo-count = <2>;
				qcom,ramp-low-index = <0>;
				qcom,ramp-high-index = <20>;
				qcom,ramp-from-low-to-high;
				qcom,ramp-pattern-repeat;
			};

			lpg3 {
				qcom,lpg-chan-id = <3>;
				qcom,ramp-step-ms = <100>;
				qcom,ramp-pause-hi-count = <2>;
				qcom,ramp-pause-lo-count = <2>;
				qcom,ramp-low-index = <0>;
				qcom,ramp-high-index = <20>;
				qcom,ramp-from-low-to-high;
				qcom,ramp-pattern-repeat;
			};
		};

		pm660l_pwm: qcom,pwms@b400 {
			compatible = "qcom,pwm-lpg";
			reg = <0xb400 0x100>;
			reg-names = "lpg-base";
			#pwm-cells = <2>;
			#pwm-cells = <2>;
			qcom,num-lpg-channels = <1>;
		};
		};


		pm660l_pwm_3: pwm@b300 {
		pm660l_rgb_led: qcom,leds@d000 {
			compatible = "qcom,qpnp-pwm";
			compatible = "qcom,tri-led";
			reg = <0xb300 0x100>,
			      <0xb042 0x7e>;
			reg-names = "qpnp-lpg-channel-base",
					 "qpnp-lpg-lut-base";
			qcom,channel-id = <3>;
			qcom,lpg-lut-size = <0x7e>;
			qcom,supported-sizes = <6>, <9>;
			qcom,ramp-index = <2>;
			#pwm-cells = <2>;
			qcom,period = <6000000>;

			qcom,lpg {
				label = "lpg";
				cell-index = <0>;
				qcom,duty-percents =
					<0x01 0x0a 0x14 0x1e 0x28 0x32 0x3c
					0x46 0x50 0x5a 0x64
					0x64 0x5a 0x50 0x46 0x3c 0x32 0x28 0x1e
					0x14 0x0a 0x01>;
			};
		};

		pm660l_pwm_4: pwm@b400 {
			compatible = "qcom,qpnp-pwm";
			reg = <0xb400 0x100>,
			      <0xb042 0x7e>;
			reg-names = "qpnp-lpg-channel-base",
					 "qpnp-lpg-lut-base";
			qcom,channel-id = <4>;
			qcom,lpg-lut-size = <0x7e>;
			qcom,supported-sizes = <6>, <9>;
			qcom,ramp-index = <3>;
			#pwm-cells = <2>;
			status = "disabled";
		};

		qcom,leds@d000 {
			compatible = "qcom,leds-qpnp";
			reg = <0xd000 0x100>;
			reg = <0xd000 0x100>;
			label = "rgb";
			red {

				label = "red";
			red_led: qcom,rgb_0 {
				pwms = <&pm660l_lpg 2 1000000>;
				label = "rgb";
				led-sources = <0>;
				qcom,id = <3>;
				linux,default-trigger = "timer";
				qcom,mode = "pwm";
			};
				pwms = <&pm660l_pwm_3 0 0>;
			green {
				qcom,pwm-us = <1000>;
				label = "green";
				qcom,max-current = <12>;
				pwms = <&pm660l_lpg 1 1000000>;
				qcom,default-state = "off";
				led-sources = <1>;
				linux,name = "red";
				linux,default-trigger = "timer";
				qcom,start-idx = <0>;
			};
				qcom,idx-len = <22>;
			blue {
				qcom,duty-pcts =
				label = "blue";
					[01 0a 14 1e 28 32 3c 46 50 5a 64
				pwms = <&pm660l_lpg 0 1000000>;
					64 5a 50 46 3c 32 28 1e 14 0a 01];
				led-sources = <2>;
				qcom,use-blink;
				linux,default-trigger = "timer";
			};

			green_led: qcom,rgb_1 {
				label = "rgb";
				qcom,id = <4>;
				qcom,mode = "pwm";
				pwms = <&pm660l_pwm_2 0 0>;
				qcom,pwm-us = <1000>;
				qcom,max-current = <12>;
				qcom,default-state = "off";
				linux,name = "green";
			};

			blue_led: qcom,rgb_2 {
				label = "rgb";
				qcom,id = <5>;
				qcom,mode = "pwm";
				pwms = <&pm660l_pwm_1 0 0>;
				qcom,pwm-us = <1000>;
				qcom,max-current = <12>;
				qcom,default-state = "off";
				linux,name = "blue";
			};
			};
		};
		};


		pm660l_wled: qcom,leds@d800 {
		pm660l_wled: qcom,leds@d800 {
			compatible = "qcom,qpnp-wled";
			compatible = "qcom,pm660l-spmi-wled";
			reg = <0xd800 0x100>,
			reg = <0xd800 0x100>,
				<0xd900 0x100>;
				<0xd900 0x100>;
			reg-names = "qpnp-wled-ctrl-base",
			reg-names = "wled-ctrl-base",
					"qpnp-wled-sink-base";
					"wled-sink-base";
			interrupts = <0x3 0xd8 0x1 IRQ_TYPE_EDGE_RISING>;
			interrupts = <0x3 0xd8 0x1 IRQ_TYPE_EDGE_RISING>;
			interrupt-names = "ovp-irq";
			interrupt-names = "ovp-irq";
			linux,name = "wled";
			label = "backlight";
			linux,default-trigger = "bkl-trigger";
			qcom,fdbk-output = "auto";
			qcom,vref-uv = <127500>;
			qcom,switch-freq-khz = <800>;
			qcom,ovp-mv = <29600>;
			qcom,ilim-ma = <970>;
			qcom,boost-duty-ns = <26>;
			qcom,mod-freq-khz = <9600>;
			qcom,dim-mode = "hybrid";
			qcom,hyb-thres = <625>;
			qcom,sync-dly-us = <800>;
			qcom,fs-curr-ua = <25000>;
			qcom,cons-sync-write-delay-us = <1000>;
			qcom,led-strings-list = [00 01 02];
			qcom,loop-auto-gm-en;
			qcom,pmic-revid = <&pm660l_revid>;
			qcom,pmic-revid = <&pm660l_revid>;
			qcom,auto-calibration-enable;
			qcom,auto-calibration;
			status = "ok";
			status = "ok";
		};
		};


@@ -467,3 +360,31 @@
		};
		};
	};
	};
};
};

&thermal_zones {
	pm660l_temp_alarm: pm660l-tz {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "step_wise";
		thermal-sensors = <&pm660l_tz>;
		wake-capable-sensor;

		trips {
			pm660l_trip0: trip0 {
				temperature = <95000>;
				hysteresis = <0>;
				type = "passive";
			};
			pm660l_trip1: trip1 {
				temperature = <115000>;
				hysteresis = <0>;
				type = "passive";
			};
			trip2 {
				temperature = <145000>;
				hysteresis = <0>;
				type = "passive";
			};
		};
	};
};
+6 −1
Original line number Original line Diff line number Diff line
@@ -126,7 +126,12 @@
};
};


&pm660l_wled {
&pm660l_wled {
	qcom,led-strings-list = [01 02];
	qcom,string-cfg= <3>;
	status = "ok";
};

&pm660l_lcdb {
	status = "ok";
};
};


&dsi_dual_nt35597_truly_video {
&dsi_dual_nt35597_truly_video {
+75 −2
Original line number Original line Diff line number Diff line
@@ -685,6 +685,8 @@
					3200 3200 3200 3200 3200 3200>;
					3200 3200 3200 3200 3200 3200>;
	};
	};


	thermal_zones: thermal-zones { };

	uartblsp1dm1: serial@0c170000 {
	uartblsp1dm1: serial@0c170000 {
		compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
		compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
		reg = <0xc170000 0x1000>;
		reg = <0xc170000 0x1000>;
@@ -2761,8 +2763,8 @@


#include "sdm660-ion.dtsi"
#include "sdm660-ion.dtsi"
#include "sdm660-bus.dtsi"
#include "sdm660-bus.dtsi"
#include "msm-pm660.dtsi"
#include "pm660.dtsi"
#include "msm-pm660l.dtsi"
#include "pm660l.dtsi"
#include "pm660-rpm-regulator.dtsi"
#include "pm660-rpm-regulator.dtsi"
#include "pm660l-rpm-regulator.dtsi"
#include "pm660l-rpm-regulator.dtsi"
#include "sdm660-regulator.dtsi"
#include "sdm660-regulator.dtsi"
@@ -2924,5 +2926,76 @@
	status = "ok";
	status = "ok";
};
};


&pm660_adc_tm {
	io-channels = <&pm660_vadc ADC_XO_THERM_PU2>,
			<&pm660_vadc ADC_AMUX_THM1_PU2>,
			<&pm660_vadc ADC_AMUX_THM5_PU2>;

	/* Channel nodes */
	xo_therm {
		reg = <ADC_XO_THERM_PU2>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

	msm_therm{
		reg = <ADC_AMUX_THM1_PU2>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

	quiet_therm{
		reg = <ADC_AMUX_THM5_PU2>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};
};

&thermal_zones {
	xo-therm-adc {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm660_adc_tm ADC_XO_THERM_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	msm-therm-adc {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm660_adc_tm ADC_AMUX_THM1_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	quiet-therm-adc {
		polling-delay-passive = <0>;
		polling-delay = <5000>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm660_adc_tm ADC_AMUX_THM5_PU2>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};
};
#include "sdm660-mdss.dtsi"
#include "sdm660-mdss.dtsi"
#include "sdm660-mdss-pll.dtsi"
#include "sdm660-mdss-pll.dtsi"
+31 −11
Original line number Original line Diff line number Diff line
@@ -37,6 +37,9 @@
#define ADC_TM_MEAS_INTERVAL_CTL		0x44
#define ADC_TM_MEAS_INTERVAL_CTL		0x44
#define ADC_TM_MEAS_INTERVAL_CTL2		0x45
#define ADC_TM_MEAS_INTERVAL_CTL2		0x45


#define ADC_TM_MEAS_INTERVAL_CTL_660		0x50
#define ADC_TM_MEAS_INTERVAL_CTL2_660		0x51

#define ADC_TM_MEAS_INTERVAL_CTL2_SHIFT		0x4
#define ADC_TM_MEAS_INTERVAL_CTL2_SHIFT		0x4
#define ADC_TM_MEAS_INTERVAL_CTL2_MASK		0xf0
#define ADC_TM_MEAS_INTERVAL_CTL2_MASK		0xf0
#define ADC_TM_MEAS_INTERVAL_CTL3_MASK		0xf
#define ADC_TM_MEAS_INTERVAL_CTL3_MASK		0xf
@@ -1046,22 +1049,31 @@ static int adc_tm5_init(struct adc_tm_chip *chip, uint32_t dt_chans)
{
{
	u8 buf[4], channels_available, meas_int_timer_2_3 = 0;
	u8 buf[4], channels_available, meas_int_timer_2_3 = 0;
	int ret;
	int ret;
	int dig_param_len = 4;
	int pmic_subtype_660 = 0;
	unsigned int offset_btm_idx = 0, i;
	unsigned int offset_btm_idx = 0, i;


	ret = adc_tm5_read_reg(chip, ADC_TM_NUM_BTM, &channels_available, 1);
	if ((chip->pmic_rev_id) &&
		(chip->pmic_rev_id->pmic_subtype == PM660_SUBTYPE)) {
		dig_param_len = 2;
		pmic_subtype_660 = 1;
	} else {
		ret = adc_tm5_read_reg(chip, ADC_TM_NUM_BTM,
					&channels_available, 1);
		if (ret < 0) {
		if (ret < 0) {
			pr_err("read failed for BTM channels\n");
			pr_err("read failed for BTM channels\n");
			return ret;
			return ret;
		}
		}


		if (dt_chans > channels_available) {
		if (dt_chans > channels_available) {
		pr_err("Number of nodes greater than channels supported:%d\n",
			pr_err("More nodes than channels supported:%d\n",
						channels_available);
						channels_available);
			return -EINVAL;
			return -EINVAL;
		}
		}
	}


	ret = adc_tm5_read_reg(chip,
	ret = adc_tm5_read_reg(chip,
			ADC_TM_ADC_DIG_PARAM, buf, 4);
			ADC_TM_ADC_DIG_PARAM, buf, dig_param_len);
	if (ret < 0) {
	if (ret < 0) {
		pr_err("adc-tm block read failed with %d\n", ret);
		pr_err("adc-tm block read failed with %d\n", ret);
		return ret;
		return ret;
@@ -1083,10 +1095,18 @@ static int adc_tm5_init(struct adc_tm_chip *chip, uint32_t dt_chans)
	buf[3] = meas_int_timer_2_3;
	buf[3] = meas_int_timer_2_3;


	ret = adc_tm5_write_reg(chip,
	ret = adc_tm5_write_reg(chip,
			ADC_TM_ADC_DIG_PARAM, buf, 4);
			ADC_TM_ADC_DIG_PARAM, buf, dig_param_len);
	if (ret < 0)
	if (ret < 0)
		pr_err("adc-tm block write failed with %d\n", ret);
		pr_err("adc-tm block write failed with %d\n", ret);


	if (pmic_subtype_660) {
		ret = adc_tm5_write_reg(chip,
				ADC_TM_MEAS_INTERVAL_CTL_660, &buf[2], 2);

		if (ret < 0)
			pr_err("adc-tm block write failed with %d\n", ret);
	}

	spin_lock_init(&chip->adc_tm_lock);
	spin_lock_init(&chip->adc_tm_lock);
	mutex_init(&chip->adc_mutex_lock);
	mutex_init(&chip->adc_mutex_lock);