diff options
author | Harry Yang <harryy@codeaurora.org> | 2017-03-14 12:23:01 -0700 |
---|---|---|
committer | Harry Yang <harryy@codeaurora.org> | 2017-03-24 13:29:40 -0700 |
commit | 71aeac7a9c65bd869d19acf325f4dc19d309e16d (patch) | |
tree | 29a6a661f0d2173f8d0bbd17b964f24b9394762b | |
parent | 27489753bffb6dcf909a49e4e32a2c974675824a (diff) |
qcom: smb138x-charger: Add support for setting parallel mode
More than one parallel configurations between PMI8998 and SMB138x are
supported. Update the parallel mode from DT.
Change-Id: I07c30e8d4d860acaf24dd5d0608dca6ba3e65559
Signed-off-by: Harry Yang <harryy@codeaurora.org>
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
-rw-r--r-- | Documentation/devicetree/bindings/power/supply/qcom/smb138x-charger.txt | 6 | ||||
-rw-r--r-- | drivers/power/supply/qcom/smb138x-charger.c | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/power/supply/qcom/smb138x-charger.txt b/Documentation/devicetree/bindings/power/supply/qcom/smb138x-charger.txt index c8f2a5a8e496..92ef23c3a290 100644 --- a/Documentation/devicetree/bindings/power/supply/qcom/smb138x-charger.txt +++ b/Documentation/devicetree/bindings/power/supply/qcom/smb138x-charger.txt @@ -31,6 +31,12 @@ Charger specific properties: revid module. This is used to identify the SMB subtype. +- qcom,parallel-mode + Usage: optional + Value type: <u32> + Definition: Specifies parallel charging mode. If not specified, MID-MID + option is selected by default. + - qcom,suspend-input Usage: optional Value type: <empty> diff --git a/drivers/power/supply/qcom/smb138x-charger.c b/drivers/power/supply/qcom/smb138x-charger.c index d57944e18e3b..a68c9455a5e8 100644 --- a/drivers/power/supply/qcom/smb138x-charger.c +++ b/drivers/power/supply/qcom/smb138x-charger.c @@ -96,6 +96,7 @@ struct smb_dt_props { int dc_icl_ua; int chg_temp_max_mdegc; int connector_temp_max_mdegc; + int pl_mode; }; struct smb138x { @@ -161,6 +162,11 @@ static int smb138x_parse_dt(struct smb138x *chip) return -EINVAL; } + rc = of_property_read_u32(node, + "qcom,parallel-mode", &chip->dt.pl_mode); + if (rc < 0) + chip->dt.pl_mode = POWER_SUPPLY_PL_USBMID_USBMID; + chip->dt.suspend_input = of_property_read_bool(node, "qcom,suspend-input"); @@ -588,7 +594,7 @@ static int smb138x_parallel_get_prop(struct power_supply *psy, val->strval = "smb138x"; break; case POWER_SUPPLY_PROP_PARALLEL_MODE: - val->intval = POWER_SUPPLY_PL_USBMID_USBMID; + val->intval = chip->dt.pl_mode; break; case POWER_SUPPLY_PROP_CONNECTOR_HEALTH: val->intval = smb138x_get_prop_connector_health(chip); |