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

Commit 697fe0dd authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss
Browse files

thermal: qpnp-adc: Update ADC_TM peripheral registration



Register ADC_TM peripheral with of_thermal to support
clients using thermal core to set trips and read temperature.
Update ADC_TM driver to activate the trip threshold for
warm and cool zones when thermal core sets the trip threshold
and enable the sensor.

In addition remove support for qpnp-adc-tm peripheral register
configuration.

Change-Id: Ie2d3955bfed62b183d8872cd1ce49d5f783e06ae
Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
parent e40d860d
Loading
Loading
Loading
Loading
+20 −48
Original line number Diff line number Diff line
@@ -11,8 +11,7 @@ to set thresholds and receive threshold notifications.
VADC_TM node

Required properties:
- compatible : should be "qcom,qpnp-adc-tm" for thermal ADC driver.
	     : should be "qcom,qpnp-adc-tm-hc" for thermal ADC driver using
- compatible : should be "qcom,qpnp-adc-tm-hc" for thermal ADC driver using
	       refreshed BTM peripheral.
- reg : offset and length of the PMIC Aribter register map.
- address-cells : Must be one.
@@ -156,51 +155,6 @@ client_node {
	qcom,client-adc_tm = <&pm8941_adc_tm>;
};

Example for "qcom,qpnp-adc-tm" device:
	/* Main Node */
	qcom,vadc@3400 {
                        compatible = "qcom,qpnp-adc-tm";
                        reg = <0x3400 0x100>;
			#address-cells = <1>;
			#size-cells = <0>;
                        interrupts = <0x0 0x34 0x0>,
					<0x0 0x34 0x3>,
					<0x0 0x34 0x4>;
			interrupt-names = "eoc-int-en-set",
					  "high-thr-en-set",
					  "low-thr-en-set";
                        qcom,adc-bit-resolution = <15>;
                        qcom,adc-vdd-reference = <1800>;
			qcom,adc_tm-vadc = <&pm8941_vadc>;

			/* Channel Node to be registered as part of thermal sysfs */
                        chan@b5 {
                                label = "pa_therm1";
				reg = <0xb5>;
                                qcom,decimation = <0>;
                                qcom,pre-div-channel-scaling = <0>;
                                qcom,calibration-type = "absolute";
                                qcom,scale-function = <2>;
                                qcom,hw-settle-time = <0>;
                                qcom,fast-avg-setup = <0>;
				qcom,btm-channel-number = <0x70>;
				qcom,thermal-node;
                        };

			/* Channel Node */
			chan@6 {
				label = "vbat_sns";
				reg = <6>;
				qcom,decimation = <0>;
				qcom,pre-div-channel-scaling = <1>;
				qcom,calibration-type = "absolute";
				qcom,scale-function = <3>;
				qcom,hw-settle-time = <0>;
				qcom,fast-avg-setup = <0>;
				qcom,btm-channel-number = <0x78>;
			};
	};

Example for "qcom,qpnp-adc-tm-hc" device:
	/* Main Node */
	pm8998_adc_tm: vadc@3400 {
@@ -218,7 +172,7 @@ Example for "qcom,qpnp-adc-tm-hc" device:

			/* Channel Node to be registered as part of thermal sysfs */
                        chan@b5 {
                                label = "pa_therm1";
                                label = "msm_therm";
				reg = <0xb5>;
                                qcom,pre-div-channel-scaling = <0>;
                                qcom,calibration-type = "absolute";
@@ -239,3 +193,21 @@ Example for "qcom,qpnp-adc-tm-hc" device:
				qcom,btm-channel-number = <0x78>;
			};
	};

/* Example to register thermal sensor using of_thermal */
&thermal_zones {
	msm-therm-adc {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&pm8998_adc_tm 0xb5>;
		thermal-governor = "user_space";

		trips {
			active-config0 {
				temperature = <65000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};
};
+281 −1504

File changed.

Preview size limit exceeded, changes collapsed.

+0 −19
Original line number Diff line number Diff line
@@ -2215,25 +2215,6 @@ static inline int qpnp_iadc_resume_calibration(struct qpnp_iadc_chip *iadc)
/* Public API */
#if defined(CONFIG_THERMAL_QPNP_ADC_TM)				\
			|| defined(CONFIG_THERMAL_QPNP_ADC_TM_MODULE)
/**
 * qpnp_adc_tm_usbid_configure() - Configures Channel 0 of VADC_BTM to
 *		monitor USB_ID channel using 100k internal pull-up.
 *		USB driver passes the high/low voltage threshold along
 *		with the notification callback once the set thresholds
 *		are crossed.
 * @param:	Structure pointer of qpnp_adc_tm_usbid_param type.
 *		Clients pass the low/high voltage along with the threshold
 *		notification callback.
 */
int32_t qpnp_adc_tm_usbid_configure(struct qpnp_adc_tm_chip *chip,
					struct qpnp_adc_tm_btm_param *param);
/**
 * qpnp_adc_tm_usbid_end() - Disables the monitoring of channel 0 thats
 *		assigned for monitoring USB_ID. Disables the low/high
 *		threshold activation for channel 0 as well.
 * @param:	none.
 */
int32_t qpnp_adc_tm_usbid_end(struct qpnp_adc_tm_chip *chip);
/**
 * qpnp_adc_tm_channel_measure() - Configures kernel clients a channel to
 *		monitor the corresponding ADC channel for threshold detection.