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

Commit 9c2eff9b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "qcom: smb138x: Reduce die temperature samples for initial readings"

parents 8dd05768 240a6fca
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -312,6 +312,7 @@ struct smb_charger {
	u32			wa_flags;
	enum cc2_sink_type	cc2_sink_detach_flag;
	int			boost_current_ua;
	int			temp_speed_reading_count;

	/* extcon for VBUS / ID notification to USB for uUSB */
	struct extcon_dev	*extcon;
+11 −2
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#define STACKED_DIODE_EN_BIT		BIT(2)

#define TDIE_AVG_COUNT	10
#define MAX_SPEED_READING_TIMES		5

enum {
	OOB_COMP_WA_BIT = BIT(0),
@@ -126,8 +127,16 @@ static int smb138x_get_prop_charger_temp(struct smb138x *chip,
	union power_supply_propval pval;
	int rc = 0, avg = 0, i;
	struct smb_charger *chg = &chip->chg;
	int die_avg_count;

	for (i = 0; i < TDIE_AVG_COUNT; i++) {
	if (chg->temp_speed_reading_count < MAX_SPEED_READING_TIMES) {
		chg->temp_speed_reading_count++;
		die_avg_count = 1;
	} else {
		die_avg_count = TDIE_AVG_COUNT;
	}

	for (i = 0; i < die_avg_count; i++) {
		pval.intval = 0;
		rc = smblib_get_prop_charger_temp(chg, &pval);
		if (rc < 0) {
@@ -137,7 +146,7 @@ static int smb138x_get_prop_charger_temp(struct smb138x *chip,
		}
		avg += pval.intval;
	}
	val->intval = avg / TDIE_AVG_COUNT;
	val->intval = avg / die_avg_count;
	return rc;
}