Skip to content

Commit

Permalink
google_charger: make disable power source function working
Browse files Browse the repository at this point in the history
Bug: 132317588
Test: adb shell "echo XX > sys/devices/platform/soc/soc:google,charger/charge_stop_level"
      If current SOC > XX (stop level), usb input current will be stopped.
      And it will be recovered when current SOC <= XX

Change-Id: I240d945e1f7d28dc1ab4aa3e1e98693973fe2233
Signed-off-by: Ken Tsou <kentsou@google.com>
Signed-off-by: AleX Pelosi <apelosi@google.com>
  • Loading branch information
Ken Tsou authored and AleX Pelosi committed May 21, 2019
1 parent eadb900 commit 302b913
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 118 deletions.
22 changes: 20 additions & 2 deletions drivers/power/supply/google/google_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,13 +1364,12 @@ static int msc_logic(struct batt_drv *batt_drv)
chg_state->f.icl);

if ((batt_drv->chg_state.f.flags & GBMS_CS_FLAG_BUCK_EN) == 0) {
/* here on: disconnect */

if (batt_drv->buck_enabled == 0)
goto msc_logic_exit;

/* here on: disconnect */
batt_chg_stats_pub(batt_drv, "disconnect", false);

batt_res_state_set(&batt_drv->res_state, false);

/* change curve before changing the state */
Expand Down Expand Up @@ -1742,6 +1741,21 @@ static int debug_set_ssoc_rls(void *data, u64 val)
DEFINE_SIMPLE_ATTRIBUTE(debug_ssoc_rls_fops,
debug_get_ssoc_rls, debug_set_ssoc_rls, "%u\n");

static int debug_force_psy_update(void *data, u64 val)
{
struct batt_drv *batt_drv = (struct batt_drv *)data;

if (!batt_drv->psy)
return -EINVAL;

power_supply_changed(batt_drv->psy);
return 0;
}

DEFINE_SIMPLE_ATTRIBUTE(debug_force_psy_update_fops,
NULL, debug_force_psy_update, "%u\n");


static ssize_t debug_get_ssoc_uicurve(struct file *filp,
char __user *buf,
size_t count, loff_t *ppos)
Expand Down Expand Up @@ -1938,7 +1952,11 @@ static int batt_init_fs(struct batt_drv *batt_drv)
batt_drv, &debug_ssoc_rls_fops);
debugfs_create_file("ssoc_uicurve", 0600, de,
batt_drv, &debug_ssoc_uicurve_cstr_fops);
debugfs_create_file("force_psy_update", 0400, de,
batt_drv, &debug_force_psy_update_fops);
}


#endif

return ret;
Expand Down
1 change: 1 addition & 0 deletions drivers/power/supply/google/google_bms.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ const char *gbms_chg_ev_adapter_s(int adapter);

/* Votables */
#define VOTABLE_MSC_CHG_DISABLE "MSC_CHG_DISABLE"
#define VOTABLE_MSC_PWR_DISABLE "MSC_PWR_DISABLE"
#define VOTABLE_MSC_INTERVAL "MSC_INTERVAL"
#define VOTABLE_MSC_FCC "MSC_FCC"
#define VOTABLE_MSC_FV "MSC_FV"
Expand Down
Loading

0 comments on commit 302b913

Please sign in to comment.