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

Commit 44b3abeb authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-qg: Fix reading negative temperature from SDAM"

parents 7dc85150 7dc7078e
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -2712,7 +2712,7 @@ static struct ocv_all ocv[] = {
#define S7_ERROR_MARGIN_UV		20000
static int qg_determine_pon_soc(struct qpnp_qg *chip)
{
	int rc = 0, batt_temp = 0, i;
	int rc = 0, batt_temp = 0, i, shutdown_temp = 0;
	bool use_pon_ocv = true;
	unsigned long rtc_sec = 0;
	u32 ocv_uv = 0, soc = 0, pon_soc = 0, full_soc = 0, cutoff_soc = 0;
@@ -2753,6 +2753,7 @@ static int qg_determine_pon_soc(struct qpnp_qg *chip)
		pr_err("Failed to read shutdown params rc=%d\n", rc);
		goto use_pon_ocv;
	}
	shutdown_temp = sign_extend32(shutdown[SDAM_TEMP], 15);

	rc = lookup_soc_ocv(&pon_soc, ocv[S7_PON_OCV].ocv_uv, batt_temp, false);
	if (rc < 0) {
@@ -2765,7 +2766,7 @@ static int qg_determine_pon_soc(struct qpnp_qg *chip)
			shutdown[SDAM_SOC],
			shutdown[SDAM_OCV_UV],
			shutdown[SDAM_TIME_SEC],
			shutdown[SDAM_TEMP],
			shutdown_temp,
			rtc_sec, batt_temp,
			pon_soc);
	/*
@@ -2782,8 +2783,8 @@ static int qg_determine_pon_soc(struct qpnp_qg *chip)
		goto use_pon_ocv;

	if (!is_between(0, chip->dt.shutdown_temp_diff,
			abs(shutdown[SDAM_TEMP] -  batt_temp)) &&
			(shutdown[SDAM_TEMP] < 0 || batt_temp < 0))
			abs(shutdown_temp -  batt_temp)) &&
			(shutdown_temp < 0 || batt_temp < 0))
		goto use_pon_ocv;

	if ((chip->dt.shutdown_soc_threshold != -EINVAL) &&