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

Commit 52729240 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 temperature compensation for PM8909"

parents 56c15e62 d5c09ffd
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -748,6 +748,8 @@ static int32_t
#define QPNP_VBAT_COEFF_48	2190
#define QPNP_VBAT_COEFF_49	4180
#define QPNP_VBAT_COEFF_50	27800000
#define QPNP_VBAT_COEFF_51	5110
#define QPNP_VBAT_COEFF_52	34444000

static int32_t qpnp_ocv_comp(int64_t *result,
			struct qpnp_vadc_chip *vadc, int64_t die_temp)
@@ -920,6 +922,13 @@ static int32_t qpnp_ocv_comp(int64_t *result,
			break;
		}
		break;
	case QPNP_REV_ID_8909_1_1:
		switch (vadc->id) {
		case COMP_ID_SMIC:
			temp_var = (QPNP_VBAT_COEFF_52);
			break;
		}
		break;
	default:
		temp_var = 0;
		break;
@@ -1103,6 +1112,18 @@ static int32_t qpnp_vbat_sns_comp(int64_t *result,
			break;
		}
		break;
	case QPNP_REV_ID_8909_1_1:
		switch (vadc->id) {
		case COMP_ID_SMIC:
			if (die_temp < 30000)
				temp_var = (QPNP_VBAT_COEFF_52);
			else if (die_temp > 30000)
				temp_var = (((die_temp - 30000) *
					(-QPNP_VBAT_COEFF_51)) +
					(QPNP_VBAT_COEFF_52));
			break;
		}
		break;
	default:
		temp_var = 0;
		break;