diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2017-04-14 15:19:42 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-04-14 15:19:41 -0700 |
| commit | d7ac7905d99dde0fd5c4e124d2d220f991074763 (patch) | |
| tree | a8316d2fd084dae3f53cf1e4fba300a1392cc681 | |
| parent | 2a46b117576d4e24586c0db2860cd38e47296bb2 (diff) | |
| parent | f222cd625484218101ca2f52847399feb1bdb432 (diff) | |
Merge "power: qpnp-smb2: Specify the min/max charger switching frequency"
| -rw-r--r-- | Documentation/devicetree/bindings/power/supply/qcom/qpnp-smb2.txt | 12 | ||||
| -rw-r--r-- | drivers/power/supply/qcom/qpnp-smb2.c | 24 | ||||
| -rw-r--r-- | drivers/power/supply/qcom/smb-lib.c | 4 |
3 files changed, 39 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/power/supply/qcom/qpnp-smb2.txt b/Documentation/devicetree/bindings/power/supply/qcom/qpnp-smb2.txt index 5a2c3ecd3d1e..894c34553a22 100644 --- a/Documentation/devicetree/bindings/power/supply/qcom/qpnp-smb2.txt +++ b/Documentation/devicetree/bindings/power/supply/qcom/qpnp-smb2.txt @@ -169,6 +169,18 @@ Charger specific properties: Definition: Boolean flag which when present enables intput suspend for debug battery. +- qcom,min-freq-khz + Usage: optional + Value type: <u32> + Definition: Specifies the minimum charger buck/boost switching frequency + in KHz. It overrides the min frequency defined for the charger. + +- qcom,max-freq-khz + Usage: optional + Value type: <u32> + Definition: Specifies the maximum charger buck/boost switching frequency in + KHz. It overrides the max frequency defined for the charger. + ============================================= Second Level Nodes - SMB2 Charger Peripherals ============================================= diff --git a/drivers/power/supply/qcom/qpnp-smb2.c b/drivers/power/supply/qcom/qpnp-smb2.c index 81e656c06da0..ea36103700e7 100644 --- a/drivers/power/supply/qcom/qpnp-smb2.c +++ b/drivers/power/supply/qcom/qpnp-smb2.c @@ -244,6 +244,8 @@ struct smb_dt_props { int boost_threshold_ua; int fv_uv; int wipower_max_uw; + int min_freq_khz; + int max_freq_khz; u32 step_soc_threshold[STEP_CHARGING_MAX_STEPS - 1]; s32 step_cc_delta[STEP_CHARGING_MAX_STEPS]; struct device_node *revid_dev_node; @@ -338,6 +340,18 @@ static int smb2_parse_dt(struct smb2 *chip) if (rc < 0) chip->dt.boost_threshold_ua = MICRO_P1A; + rc = of_property_read_u32(node, + "qcom,min-freq-khz", + &chip->dt.min_freq_khz); + if (rc < 0) + chip->dt.min_freq_khz = -EINVAL; + + rc = of_property_read_u32(node, + "qcom,max-freq-khz", + &chip->dt.max_freq_khz); + if (rc < 0) + chip->dt.max_freq_khz = -EINVAL; + rc = of_property_read_u32(node, "qcom,wipower-max-uw", &chip->dt.wipower_max_uw); if (rc < 0) @@ -1438,6 +1452,16 @@ static int smb2_init_hw(struct smb2 *chip) smblib_get_charge_param(chg, &chg->param.dc_icl, &chip->dt.dc_icl_ua); + if (chip->dt.min_freq_khz > 0) { + chg->param.freq_buck.min_u = chip->dt.min_freq_khz; + chg->param.freq_boost.min_u = chip->dt.min_freq_khz; + } + + if (chip->dt.max_freq_khz > 0) { + chg->param.freq_buck.max_u = chip->dt.max_freq_khz; + chg->param.freq_boost.max_u = chip->dt.max_freq_khz; + } + /* set a slower soft start setting for OTG */ rc = smblib_masked_write(chg, DC_ENG_SSUPPLY_CFG2_REG, ENG_SSUPPLY_IVREF_OTG_SS_MASK, OTG_SS_SLOW); diff --git a/drivers/power/supply/qcom/smb-lib.c b/drivers/power/supply/qcom/smb-lib.c index 14e9c3a2254d..42833a2ebf06 100644 --- a/drivers/power/supply/qcom/smb-lib.c +++ b/drivers/power/supply/qcom/smb-lib.c @@ -3578,6 +3578,8 @@ static void typec_source_insertion(struct smb_charger *chg) && !is_client_vote_enabled(chg->usb_icl_votable, PD_VOTER) && !is_client_vote_enabled(chg->usb_icl_votable, USB_PSY_VOTER)) vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, true, 100000); + + smblib_set_opt_freq_buck(chg, chg->chg_freq.freq_5V); } static void typec_sink_insertion(struct smb_charger *chg) @@ -3653,8 +3655,8 @@ static void smblib_handle_typec_insertion(struct smb_charger *chg, typec_source_removal(chg); typec_sink_insertion(chg); } else { - typec_source_insertion(chg); typec_sink_removal(chg); + typec_source_insertion(chg); } rp = smblib_get_prop_ufp_mode(chg); |
