qcom-charger: smb-lib: add votable for parallel charging

Add a votable structure - one veto to disable or unanimous
approval to enable.

Provide an open and flexiable machanism to enable/disable
parallel charging based on various dynamically changing
factors.

CRs-Fixed: 1023703
Change-Id: I552467645d6f8f633afe273b173a636e0eb396a7
Signed-off-by: Harry Yang <harryy@codeaurora.org>
This commit is contained in:
Harry Yang 2016-06-15 11:40:54 -07:00 committed by Kyle Yan
parent 46926992f6
commit 8d43acccb8
2 changed files with 16 additions and 0 deletions

View file

@ -471,6 +471,12 @@ static int smblib_awake_vote_callback(struct votable *votable, void *data,
return 0;
}
static int smblib_pl_disable_vote_callback(struct votable *votable, void *data,
int pl_disable, const char *client)
{
return 0;
}
/*****************
* OTG REGULATOR *
*****************/
@ -1435,6 +1441,14 @@ int smblib_create_votables(struct smb_charger *chg)
return rc;
}
chg->pl_disable_votable = create_votable("PL_DISABLE", VOTE_SET_ANY,
smblib_pl_disable_vote_callback,
chg);
if (IS_ERR(chg->pl_disable_votable)) {
rc = PTR_ERR(chg->pl_disable_votable);
return rc;
}
return rc;
}
@ -1473,6 +1487,7 @@ int smblib_deinit(struct smb_charger *chg)
destroy_votable(chg->dc_icl_votable);
destroy_votable(chg->pd_allowed_votable);
destroy_votable(chg->awake_votable);
destroy_votable(chg->pl_disable_votable);
return 0;
}

View file

@ -88,6 +88,7 @@ struct smb_charger {
struct votable *dc_icl_votable;
struct votable *pd_allowed_votable;
struct votable *awake_votable;
struct votable *pl_disable_votable;
/* work */
struct delayed_work hvdcp_detect_work;