mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
Add fcc_ma/fv_mv and thermal_level debug info in kernel
Charging: Add thermal_level, fcc_ma/fv_mv and otg_enabled debug info in kernel Change-Id: Ieb994c688641f1a2b26c665c875433295bd0f597 Reviewed-on: https://gerrit.mot.com/2339182 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yonghua Yan <yanyh2@motorola.com> Reviewed-by: Wentao Xu <xuwt2@motorola.com> Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
7ce2dadc30
commit
b67dba787f
3 changed files with 57 additions and 14 deletions
|
|
@ -1387,18 +1387,36 @@ static void mmi_notify_paired_battery(struct mmi_charger *charger)
|
|||
charger->battery->paired_batt->info);
|
||||
}
|
||||
|
||||
static int mmi_get_cur_thermal_level(struct mmi_charger_chip *chip, int *val)
|
||||
{
|
||||
union power_supply_propval prop;
|
||||
int ret;
|
||||
if (!chip->batt_psy) {
|
||||
mmi_err(chip, "No battery supply found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = power_supply_get_property(chip->batt_psy,
|
||||
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &prop);
|
||||
if (!ret)
|
||||
*val = prop.intval;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void mmi_get_charger_info(struct mmi_charger_chip *chip,
|
||||
struct mmi_charger *charger)
|
||||
{
|
||||
struct mmi_battery_info *batt_info = &charger->batt_info;
|
||||
struct mmi_charger_info *chg_info = &charger->chg_info;
|
||||
int thermal_level = 0;
|
||||
|
||||
mmi_get_cur_thermal_level(chip, &thermal_level);
|
||||
charger->driver->get_batt_info(charger->driver->data, batt_info);
|
||||
charger->driver->get_chg_info(charger->driver->data, chg_info);
|
||||
mmi_info(chip, "[C:%s]: batt_mv %d, batt_ma %d, batt_soc %d,"
|
||||
" batt_temp %d, batt_status %d, batt_sn %s,"
|
||||
" chrg_present %d, chrg_type %d, chrg_pmax_mw %d,"
|
||||
" chrg_mv %d, chrg_ma %d\n",
|
||||
" batt_temp %d, batt_status %d, batt_sn %s, batt_fv_mv %d,"
|
||||
" batt_fcc_ma %d\n",
|
||||
charger->driver->name,
|
||||
batt_info->batt_mv,
|
||||
batt_info->batt_ma,
|
||||
|
|
@ -1406,11 +1424,19 @@ static void mmi_get_charger_info(struct mmi_charger_chip *chip,
|
|||
batt_info->batt_temp,
|
||||
batt_info->batt_status,
|
||||
batt_info->batt_sn,
|
||||
batt_info->batt_fv_mv,
|
||||
batt_info->batt_fcc_ma);
|
||||
mmi_info(chip, "[C:%s]: chrg_present %d, chrg_type %d, chrg_pmax_mw %d,"
|
||||
" chrg_mv %d, chrg_ma %d, chrg_otg_enabled %d, thermal_level %d\n",
|
||||
charger->driver->name,
|
||||
chg_info->chrg_present,
|
||||
chg_info->chrg_type,
|
||||
chg_info->chrg_pmax_mw,
|
||||
chg_info->chrg_mv,
|
||||
chg_info->chrg_ma);
|
||||
chg_info->chrg_ma,
|
||||
chg_info->chrg_otg_enabled,
|
||||
thermal_level);
|
||||
|
||||
}
|
||||
|
||||
static void mmi_update_charger_status(struct mmi_charger_chip *chip,
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ struct mmi_battery_info {
|
|||
int batt_full_uah;
|
||||
int batt_design_uah;
|
||||
int batt_chg_counter;
|
||||
int batt_fv_mv;
|
||||
int batt_fcc_ma;
|
||||
char batt_sn[MMI_BATT_SN_LEN];
|
||||
};
|
||||
|
||||
|
|
@ -76,6 +78,7 @@ struct mmi_charger_info {
|
|||
int chrg_type;
|
||||
int chrg_pmax_mw;
|
||||
int chrg_present;
|
||||
bool chrg_otg_enabled;
|
||||
int lpd_present;
|
||||
int vbus_present;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ struct battery_info {
|
|||
int batt_full_uah;
|
||||
int batt_design_uah;
|
||||
int batt_chg_counter;
|
||||
int batt_fv_uv;
|
||||
int batt_fcc_ua;
|
||||
};
|
||||
|
||||
struct charger_info {
|
||||
|
|
@ -74,6 +76,7 @@ struct charger_info {
|
|||
int chrg_type;
|
||||
int chrg_pmax_mw;
|
||||
int chrg_present;
|
||||
bool chrg_otg_enabled;
|
||||
};
|
||||
|
||||
struct charger_profile_info {
|
||||
|
|
@ -568,9 +571,10 @@ static int qti_charger_get_batt_info(void *data, struct mmi_battery_info *batt_i
|
|||
int rc;
|
||||
struct qti_charger *chg = data;
|
||||
int batt_status = chg->batt_info.batt_status;
|
||||
struct battery_info info;
|
||||
|
||||
rc = qti_charger_read(chg, OEM_PROP_BATT_INFO,
|
||||
&chg->batt_info,
|
||||
&info,
|
||||
sizeof(struct battery_info));
|
||||
if (rc)
|
||||
return rc;
|
||||
|
|
@ -578,10 +582,16 @@ static int qti_charger_get_batt_info(void *data, struct mmi_battery_info *batt_i
|
|||
if (chg->chg_cfg.full_charged)
|
||||
chg->batt_info.batt_status = POWER_SUPPLY_STATUS_FULL;
|
||||
|
||||
chg->batt_info.batt_ma /= 1000;
|
||||
chg->batt_info.batt_mv /= 1000;
|
||||
chg->batt_info.batt_soc /= 100;
|
||||
chg->batt_info.batt_temp /= 100;
|
||||
chg->batt_info.batt_ma = info.batt_ua / 1000;
|
||||
chg->batt_info.batt_mv = info.batt_uv / 1000;
|
||||
chg->batt_info.batt_soc = info.batt_soc / 100;
|
||||
chg->batt_info.batt_temp = info.batt_temp / 100;
|
||||
chg->batt_info.batt_status = info.batt_status;
|
||||
chg->batt_info.batt_full_uah = info.batt_full_uah;
|
||||
chg->batt_info.batt_design_uah = info.batt_design_uah;
|
||||
chg->batt_info.batt_chg_counter = info.batt_chg_counter;
|
||||
chg->batt_info.batt_fv_mv = info.batt_fv_uv / 1000;
|
||||
chg->batt_info.batt_fcc_ma = info.batt_fcc_ua / 1000;
|
||||
memcpy(batt_info, &chg->batt_info, sizeof(struct mmi_battery_info));
|
||||
|
||||
if (batt_status != chg->batt_info.batt_status) {
|
||||
|
|
@ -684,10 +694,11 @@ static int qti_charger_get_chg_info(void *data, struct mmi_charger_info *chg_inf
|
|||
{
|
||||
int rc;
|
||||
struct qti_charger *chg = data;
|
||||
struct charger_info info;
|
||||
struct wls_dump wls_info;
|
||||
|
||||
rc = qti_charger_read(chg, OEM_PROP_CHG_INFO,
|
||||
&chg->chg_info,
|
||||
&info,
|
||||
sizeof(struct charger_info));
|
||||
if (rc)
|
||||
return rc;
|
||||
|
|
@ -704,12 +715,15 @@ static int qti_charger_get_chg_info(void *data, struct mmi_charger_info *chg_inf
|
|||
chg->lpd_info.lpd_rsbu1,
|
||||
chg->lpd_info.lpd_rsbu2);
|
||||
|
||||
chg->chg_info.chrg_mv /= 1000;
|
||||
chg->chg_info.chrg_ma /= 1000;
|
||||
if (!chg->chg_info.chrg_present &&
|
||||
chg->chg_info.chrg_type != 0)
|
||||
chg->chg_info.chrg_mv = info.chrg_uv / 1000;
|
||||
chg->chg_info.chrg_ma = info.chrg_ua / 1000;
|
||||
chg->chg_info.chrg_type = info.chrg_type;
|
||||
chg->chg_info.chrg_pmax_mw = info.chrg_pmax_mw;
|
||||
chg->chg_info.chrg_present = info.chrg_present;
|
||||
if (!info.chrg_present && info.chrg_type != 0)
|
||||
chg->chg_info.chrg_present = 1;
|
||||
|
||||
chg->chg_info.chrg_otg_enabled = info.chrg_otg_enabled;
|
||||
chg->chg_info.vbus_present = chg->chg_info.chrg_mv > VBUS_MIN_MV;
|
||||
chg->chg_info.lpd_present = chg->lpd_info.lpd_present;
|
||||
memcpy(chg_info, &chg->chg_info, sizeof(struct mmi_charger_info));
|
||||
|
|
|
|||
Loading…
Reference in a new issue