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

Commit f3d1e0b7 authored by Siddartha Mohanadoss's avatar Siddartha Mohanadoss Committed by Stephen Boyd
Browse files

hwmon: qpnp-adc-current: Fix external rsense value



When external rsense is selected the api used to
calculate the rsense needs to return back. Instead
it recalculates the rsense using the trim procedure
used for calcuating the internal rsense. Fix it
by returning the value that is used for the external
rsense.

Change-Id: Icde61ca2c95d1b4ab64d9f6db2fc97ac4e47daab
Signed-off-by: default avatarSiddartha Mohanadoss <smohanad@codeaurora.org>
parent 95b4a526
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -646,13 +646,15 @@ int32_t qpnp_iadc_get_rsense(int32_t *rsense)
{
	struct qpnp_iadc_drv *iadc = qpnp_iadc;
	uint8_t	rslt_rsense;
	int32_t	rc, sign_bit = 0;
	int32_t	rc = 0, sign_bit = 0;

	if (!iadc || !iadc->iadc_initialized)
		return -EPROBE_DEFER;

	if (iadc->external_rsense)
	if (iadc->external_rsense) {
		*rsense = iadc->rsense;
		return rc;
	}

	rc = qpnp_iadc_read_reg(QPNP_IADC_NOMINAL_RSENSE, &rslt_rsense);
	if (rc < 0) {