qcom-charger: Change usb_icl votable for PD vote
Currently there is an issue introduced by forcing the results of the icl_votable while pd is active. icl_votable is a min voter and since the DEFAULT_VOTER votes 1.5Amps that becomes the max one could draw when pd is active. This is incorrect and hence the issue. Note that DEFAULT_VOTER is only needed while DCP is present. So, to fix it, rename DEFAULT_VOTER to DCP_VOTER and make DCP_VOTER unvote and vote when pd_active is set and unset respectively. CRs-Fixed: 1091477 Change-Id: I7435f05f20e12a7704ae5d9597b5cdc9b5a61d00 Signed-off-by: Harry Yang <harryy@codeaurora.org>
This commit is contained in:
parent
4b1c2e228c
commit
73337d532d
4 changed files with 22 additions and 2 deletions
|
@ -1069,6 +1069,7 @@ static int smb2_init_hw(struct smb2 *chip)
|
|||
&chip->dt.dc_icl_ua);
|
||||
|
||||
chg->otg_cl_ua = chip->dt.otg_cl_ua;
|
||||
chg->dcp_icl_ua = chip->dt.usb_icl_ua;
|
||||
|
||||
rc = smblib_read(chg, APSD_RESULT_STATUS_REG, &stat);
|
||||
if (rc < 0) {
|
||||
|
@ -1101,7 +1102,7 @@ static int smb2_init_hw(struct smb2 *chip)
|
|||
vote(chg->fv_votable,
|
||||
DEFAULT_VOTER, true, chip->dt.fv_uv);
|
||||
vote(chg->usb_icl_votable,
|
||||
DEFAULT_VOTER, true, chip->dt.usb_icl_ua);
|
||||
DCP_VOTER, true, chip->dt.usb_icl_ua);
|
||||
vote(chg->dc_icl_votable,
|
||||
DEFAULT_VOTER, true, chip->dt.dc_icl_ua);
|
||||
vote(chg->hvdcp_disable_votable, DEFAULT_VOTER,
|
||||
|
|
|
@ -2015,6 +2015,13 @@ int smblib_set_prop_pd_active(struct smb_charger *chg,
|
|||
return rc;
|
||||
}
|
||||
|
||||
rc = vote(chg->usb_icl_votable, DCP_VOTER, false, 0);
|
||||
if (rc < 0) {
|
||||
smblib_err(chg, "Couldn't vote for USB ICL rc=%d\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = smblib_masked_write(chg, USBIN_ICL_OPTIONS_REG,
|
||||
USBIN_MODE_CHG_BIT, USBIN_MODE_CHG_BIT);
|
||||
if (rc < 0) {
|
||||
|
@ -2031,6 +2038,14 @@ int smblib_set_prop_pd_active(struct smb_charger *chg,
|
|||
return rc;
|
||||
}
|
||||
} else {
|
||||
rc = vote(chg->usb_icl_votable, DCP_VOTER, true,
|
||||
chg->dcp_icl_ua);
|
||||
if (rc < 0) {
|
||||
smblib_err(chg, "Couldn't vote for USB ICL rc=%d\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = smblib_masked_write(chg, CMD_APSD_REG,
|
||||
ICL_OVERRIDE_BIT, 0);
|
||||
if (rc < 0) {
|
||||
|
|
|
@ -28,6 +28,7 @@ enum print_reason {
|
|||
#define DEFAULT_VOTER "DEFAULT_VOTER"
|
||||
#define USER_VOTER "USER_VOTER"
|
||||
#define PD_VOTER "PD_VOTER"
|
||||
#define DCP_VOTER "DCP_VOTER"
|
||||
#define USB_PSY_VOTER "USB_PSY_VOTER"
|
||||
#define PL_TAPER_WORK_RUNNING_VOTER "PL_TAPER_WORK_RUNNING_VOTER"
|
||||
#define PARALLEL_PSY_VOTER "PARALLEL_PSY_VOTER"
|
||||
|
@ -203,6 +204,7 @@ struct smb_charger {
|
|||
int *thermal_mitigation;
|
||||
|
||||
int otg_cl_ua;
|
||||
int dcp_icl_ua;
|
||||
|
||||
int fake_capacity;
|
||||
|
||||
|
|
|
@ -630,10 +630,12 @@ static int smb138x_init_hw(struct smb138x *chip)
|
|||
vote(chg->fcc_votable,
|
||||
DEFAULT_VOTER, true, chip->dt.fcc_ua);
|
||||
vote(chg->usb_icl_votable,
|
||||
DEFAULT_VOTER, true, chip->dt.usb_icl_ua);
|
||||
DCP_VOTER, true, chip->dt.usb_icl_ua);
|
||||
vote(chg->dc_icl_votable,
|
||||
DEFAULT_VOTER, true, chip->dt.dc_icl_ua);
|
||||
|
||||
chg->dcp_icl_ua = chip->dt.usb_icl_ua;
|
||||
|
||||
/* configure charge enable for software control; active high */
|
||||
rc = smblib_masked_write(chg, CHGR_CFG2_REG,
|
||||
CHG_EN_POLARITY_BIT | CHG_EN_SRC_BIT, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue