Merge "dt-bindings: qpnp-smb5: Support disabling of USB-PD via DT"

This commit is contained in:
qctecmdr Service 2019-03-13 05:24:47 -07:00 committed by Gerrit - the friendly Code Review server
commit da627679e5
2 changed files with 15 additions and 2 deletions

View file

@ -275,6 +275,11 @@ Charger specific properties:
Definition: Boolean flag which when present enables hardware-controlled Definition: Boolean flag which when present enables hardware-controlled
operation of HVDCP. operation of HVDCP.
- qcom,usb-pd-disable
Usage: optional
Value type: bool
Definition: Boolean flag which when present disables USB-PD operation.
============================================= =============================================
Second Level Nodes - SMB5 Charger Peripherals Second Level Nodes - SMB5 Charger Peripherals
============================================= =============================================

View file

@ -173,6 +173,7 @@ struct smb_dt_props {
int chg_inhibit_thr_mv; int chg_inhibit_thr_mv;
bool no_battery; bool no_battery;
bool hvdcp_disable; bool hvdcp_disable;
bool hvdcp_autonomous;
int sec_charger_config; int sec_charger_config;
int auto_recharge_soc; int auto_recharge_soc;
int auto_recharge_vbat_mv; int auto_recharge_vbat_mv;
@ -401,6 +402,9 @@ static int smb5_parse_dt_misc(struct smb5 *chip, struct device_node *node)
"qcom,hvdcp-disable"); "qcom,hvdcp-disable");
chg->hvdcp_disable = chip->dt.hvdcp_disable; chg->hvdcp_disable = chip->dt.hvdcp_disable;
chip->dt.hvdcp_autonomous = of_property_read_bool(node,
"qcom,hvdcp-autonomous-enable");
chip->dt.auto_recharge_soc = -EINVAL; chip->dt.auto_recharge_soc = -EINVAL;
rc = of_property_read_u32(node, "qcom,auto-recharge-soc", rc = of_property_read_u32(node, "qcom,auto-recharge-soc",
&chip->dt.auto_recharge_soc); &chip->dt.auto_recharge_soc);
@ -1915,11 +1919,15 @@ static int smb5_init_hw(struct smb5 *chip)
} }
/* /*
* Disable HVDCP autonomous mode operation by default. Additionally, if * Disable HVDCP autonomous mode operation by default, providing a DT
* specified in DT: disable HVDCP and HVDCP authentication algorithm. * knob to turn it on if required. Additionally, if specified in DT,
* disable HVDCP and HVDCP authentication algorithm.
*/ */
val = (chg->hvdcp_disable) ? 0 : val = (chg->hvdcp_disable) ? 0 :
(HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT); (HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT);
if (chip->dt.hvdcp_autonomous)
val |= HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT;
rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG, rc = smblib_masked_write(chg, USBIN_OPTIONS_1_CFG_REG,
(HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT | (HVDCP_AUTH_ALG_EN_CFG_BIT | HVDCP_EN_BIT |
HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT), HVDCP_AUTONOMOUS_MODE_EN_CFG_BIT),