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

Commit 86cc63b4 authored by Dipen Parmar's avatar Dipen Parmar
Browse files

hwmon: qpnp-voltage: Correct the offset calculation



For PM8916 temperature coefficient calculation required
to use offset value independent of temperature.

Change-Id: I918ac21882dd29de85af8973f403baa651b346ec
Signed-off-by: default avatarDipen Parmar <dipenp@codeaurora.org>
parent 41a1d813
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -691,14 +691,12 @@ static int32_t qpnp_ocv_comp(int64_t *result,
	case QPNP_REV_ID_8916_2_0:
		switch (vadc->id) {
		case COMP_ID_SMIC:
			if (die_temp < 0) {
			offset = (-QPNP_VBAT_COEFF_38);
			if (die_temp < 0)
				temp_var = die_temp * QPNP_VBAT_COEFF_36;
			} else if (die_temp > 40000) {
				offset = (-QPNP_VBAT_COEFF_38);
			else if (die_temp > 40000)
				temp_var = ((die_temp - 40000) *
						(-QPNP_VBAT_COEFF_37));
			}
			break;
		case COMP_ID_TSMC:
			if (die_temp < 10000)
@@ -852,8 +850,8 @@ static int32_t qpnp_vbat_sns_comp(int64_t *result,
			break;
		/* FAB_ID is non-zero */
		default:
			if (die_temp > 50000) {
			offset = QPNP_VBAT_COEFF_35;
			if (die_temp > 50000) {
				temp_var = ((die_temp - 25000) *
				(QPNP_VBAT_COEFF_34));
			}