Loading drivers/power/supply/qcom/smb-lib.h +1 −0 Original line number Diff line number Diff line Loading @@ -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; Loading drivers/power/supply/qcom/smb138x-charger.c +11 −2 Original line number Diff line number Diff line Loading @@ -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), Loading Loading @@ -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) { Loading @@ -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; } Loading Loading
drivers/power/supply/qcom/smb-lib.h +1 −0 Original line number Diff line number Diff line Loading @@ -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; Loading
drivers/power/supply/qcom/smb138x-charger.c +11 −2 Original line number Diff line number Diff line Loading @@ -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), Loading Loading @@ -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) { Loading @@ -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; } Loading