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

Commit 1b592c7f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hwmon: qpnp-adc-voltage: Add optional VADC property"

parents 2860e197 2b0865bd
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -8,8 +8,8 @@ for the USR peripheral of the VADC.
VADC node

Required properties:
- compatible : should be "qcom,qpnp-vadc" for Voltage ADC driver and
		"qcom,qpnp-vadc-hc" for VADC_HC voltage ADC driver.
- compatible : should be "qcom,qpnp-vadc" for Voltage ADC device driver and
		"qcom,qpnp-vadc-hc" for VADC_HC voltage ADC device driver.
- reg : offset and length of the PMIC Aribter register map.
- address-cells : Must be one.
- size-cells : Must be zero.
@@ -40,6 +40,12 @@ Optional properties:
			   by the thermal framework.
- hkadc_ldo-supply : Add this property if VADC needs to perform a Software Vote for the HKADC.
- hkadc_ok-supply : Add this property if the VADC needs to perform a Software vote for the HKADC VREG_OK.
- qcom,cal-val : Add this property for VADC_HC voltage ADC device to select from the following
		unsigned int. If the property is not present the default calibration value of
		using the timer value is chosen.
		    0 : The calibration values used for measurement are from a timer.
		    1 : Forces a fresh measurement for calibration values at the same time
			measurement is taken.

Client required property:
- qcom,<consumer name>-vadc : The phandle to the corresponding vadc device.
@@ -51,11 +57,15 @@ Required properties:
- label : Channel name used for sysfs entry.
- reg : AMUX channel number.
- qcom,decimation : Sampling rate to use for the individual channel measurement.
		    Select from following unsigned int.
		    Select from following unsigned int for Voltage ADC device.
		    0 : 512
		    1 : 1K
		    2 : 2K
		    3 : 4K
		    Select from following unsigned int for VADC_HC voltage ADC device.
		    0 : 256
		    1 : 512
		    2 : 1024
- qcom,pre-div-channel-scaling : Pre-div used for the channel before the signal
				 is being measured. Some of the AMUX channels
				 support dividing the signal from a predetermined
@@ -109,7 +119,7 @@ Required properties:
- qcom,fast-avg-setup : Average number of samples to be used for measurement. Fast averaging
			provides the option to obtain a single measurement from the ADC that
			is an average of multiple samples. The value selected is 2^(value)
			Select from the following unsigned int.
			Select from the following unsigned int for Voltage ADC device.
			0 : 1
			1 : 2
			2 : 4
@@ -119,6 +129,12 @@ Required properties:
			6 : 64
			7 : 128
			8 : 256
			Select from the following unsigned int for VADC_HC ADC device.
			0 : 1
			1 : 2
			2 : 4
			3 : 8
			4 : 16

Example:
	/* Main Node */
+12 −0
Original line number Diff line number Diff line
@@ -1772,6 +1772,7 @@ int32_t qpnp_adc_get_devicetree_data(struct spmi_device *spmi,
	struct qpnp_adc_properties *adc_prop;
	struct qpnp_adc_amux_properties *amux_prop;
	int count_adc_channel_list = 0, decimation, rc = 0, i = 0;
	int cal_val_hc = 0;
	bool adc_hc;

	if (!node)
@@ -1889,6 +1890,17 @@ int32_t qpnp_adc_get_devicetree_data(struct spmi_device *spmi,
			pr_err("Invalid channel fast average setup\n");
			return -EINVAL;
		}
		if (of_device_is_compatible(node, "qcom,qpnp-vadc-hc")) {
			rc = of_property_read_u32(child, "qcom,cal-val",
							&cal_val_hc);
			if (rc) {
				pr_debug("Use calibration value from timer\n");
				adc_channel_list[i].cal_val = ADC_TIMER_CAL;
			} else {
				adc_channel_list[i].cal_val = cal_val_hc;
			}
		}

		/* Individual channel properties */
		adc_channel_list[i].name = (char *)channel_name;
		adc_channel_list[i].channel_num = channel_num;