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

Commit 31d7344d authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss
Browse files

hwmon: qpnp-adc-voltage: Add measurement interval mode



Support clients to issue measurement interval mode on a given
channel. VADC_USR can only support one measurement interval
mode request. When any client issues a single VADC request,
the channel on which measurement interval mode is being
requested will be put on hold, the single ADC conversion
request handled and the channel for the measurement interval
will resume. The measurement interval mode request allows
clients to set thresholds and recieve notification once a
threshold is crossed.

Change-Id: If99f4ab43ec1cd9b838ace7fb358bf3e426e48fd
Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
parent d5fc7ff6
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -13,7 +13,10 @@ Required properties:
- address-cells : Must be one.
- size-cells : Must be zero.
- interrupts : The USR bank peripheral VADC interrupt.
- interrupt-names : Should contain "eoc-int-en-set".
- interrupt-names : Should contain "eoc-int-en-set" for EOC,
		"high-thr-en-set" for high threshold interrupts and
		"low-thr-en-set" for low threshold interrupts. High and low threshold
		interrupts are to be enabled if VADC_USR needs to support recurring measurement.
- qcom,adc-bit-resolution : Bit resolution of the ADC.
- qcom,adc-vdd-reference : Voltage reference used by the ADC.

@@ -25,6 +28,9 @@ Optional properties:
- qcom,pmic-revid : Phandle pointing to the revision peripheral node. Use it to query the
		    PMIC type and revision for applying the appropriate temperature
		    compensation parameters.
-qcom,vadc-meas-int-mode : Enable VADC_USR to handle requests to perform recurring measurements
			   for any one supported channel along with supporting single conversion
			   requests.

Client required property:
- qcom,<consumer name>-vadc : The phandle to the corresponding vadc device.
+467 −25

File changed.

Preview size limit exceeded, changes collapsed.

+37 −1
Original line number Diff line number Diff line
@@ -251,7 +251,6 @@ enum qpnp_adc_scale_fn_type {
	SCALE_NONE,
};


/**
 * enum qpnp_adc_tm_rscale_fn_type - Scaling function used to convert the
 *	channels input voltage/temperature to corresponding ADC code that is
@@ -274,6 +273,20 @@ enum qpnp_adc_tm_rscale_fn_type {
	SCALE_RSCALE_NONE,
};

/**
 * enum qpnp_vadc_rscale_fn_type - Scaling function used to convert the
 *	channels input voltage/temperature to corresponding ADC code that is
 *	applied for thresholds. Check the corresponding channels scaling to
 *	determine the appropriate temperature/voltage units that are passed
 *	to the scaling function. The order below should match the one in the
 *	driver for qpnp_adc_scale_fn[].
 */
enum qpnp_vadc_rscale_fn_type {
	SCALE_RVADC_ABSOLUTE = 0,
	SCALE_RVADC_PMIC_THERM = 3,
	SCALE_RVADC_SCALE_NONE,
};

/**
 * enum qpnp_adc_fast_avg_ctl - Provides ability to obtain single result
 *		from the ADC that is an average of multiple measurement
@@ -1511,6 +1524,24 @@ int32_t qpnp_vbat_sns_comp_result(struct qpnp_vadc_chip *dev,
 * returns internal mapped PMIC number and revision id.
 */
int qpnp_adc_get_revid_version(struct device *dev);
/**
 * qpnp_vadc_channel_monitor() - Configures kernel clients a channel to
 *		monitor the corresponding ADC channel for threshold detection.
 *		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_btm_param type.
 *		Clients pass the low/high temperature along with the threshold
 *		notification callback.
 */
int32_t qpnp_vadc_channel_monitor(struct qpnp_vadc_chip *chip,
					struct qpnp_adc_tm_btm_param *param);
/**
 * qpnp_vadc_end_channel_monitor() - Disables recurring measurement mode for
 *		VADC_USR and disables the bank.
 * @param:	device instance for the VADC
 */
int32_t qpnp_vadc_end_channel_monitor(struct qpnp_vadc_chip *chip);
#else
static inline int32_t qpnp_vadc_read(struct qpnp_vadc_chip *dev,
				uint32_t channel,
@@ -1656,6 +1687,11 @@ static inline int32_t qpnp_vbat_sns_comp_result(struct qpnp_vadc_chip *dev,
{ return -ENXIO; }
static inline int qpnp_adc_get_revid_version(struct device *dev)
{ return -ENXIO; }
static inline int32_t qpnp_vadc_channel_monitor(struct qpnp_vadc_chip *chip,
					struct qpnp_adc_tm_btm_param *param)
{ return -ENXIO; }
static inline int32_t qpnp_vadc_end_channel_monitor(struct qpnp_vadc_chip *chip)
{ return -ENXIO; }
#endif

/* Public API */