summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/power/qcom-charger/qpnp-smb2.txt8
-rw-r--r--drivers/power/qcom-charger/qpnp-smb2.c8
-rw-r--r--drivers/power/qcom-charger/smb-lib.c26
-rw-r--r--drivers/power/qcom-charger/smb-lib.h1
4 files changed, 40 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/power/qcom-charger/qpnp-smb2.txt b/Documentation/devicetree/bindings/power/qcom-charger/qpnp-smb2.txt
index d5eb33eb124f..58db2c2350e4 100644
--- a/Documentation/devicetree/bindings/power/qcom-charger/qpnp-smb2.txt
+++ b/Documentation/devicetree/bindings/power/qcom-charger/qpnp-smb2.txt
@@ -31,11 +31,19 @@ Charger specific properties:
Usage: optional
Value type: <u32>
Definition: Specifies the maximum fast charge current in micro-amps.
+ If the value is not present, 1Amp is used as default.
+
+- qcom,fv-max-uv
+ Usage: optional
+ Value type: <u32>
+ Definition: Specifies the maximum float voltage in micro-volts.
+ If the value is not present, 4.35V is used as default.
- qcom,usb-icl-ua
Usage: optional
Value type: <u32>
Definition: Specifies the USB input current limit in micro-amps.
+ If the value is not present, 1.5Amps is used as default.
- qcom,dc-icl-ua
Usage: optional
diff --git a/drivers/power/qcom-charger/qpnp-smb2.c b/drivers/power/qcom-charger/qpnp-smb2.c
index ab4ab0c31e08..188a4e02d19f 100644
--- a/drivers/power/qcom-charger/qpnp-smb2.c
+++ b/drivers/power/qcom-charger/qpnp-smb2.c
@@ -26,6 +26,7 @@
#include "pmic-voter.h"
#define SMB2_DEFAULT_FCC_UA 1000000
+#define SMB2_DEFAULT_FV_UV 4350000
#define SMB2_DEFAULT_ICL_UA 1500000
static struct smb_params v1_params = {
@@ -98,6 +99,11 @@ static int smb2_parse_dt(struct smb2 *chip)
chip->dt.fcc_ua = SMB2_DEFAULT_FCC_UA;
rc = of_property_read_u32(node,
+ "qcom,fv-max-uv", &chip->dt.fv_uv);
+ if (rc < 0)
+ chip->dt.fv_uv = SMB2_DEFAULT_FV_UV;
+
+ rc = of_property_read_u32(node,
"qcom,usb-icl-ua", &chip->dt.usb_icl_ua);
if (rc < 0)
chip->dt.usb_icl_ua = SMB2_DEFAULT_ICL_UA;
@@ -477,6 +483,8 @@ static int smb2_init_hw(struct smb2 *chip)
DEFAULT_VOTER, chip->dt.suspend_input, 0);
vote(chg->fcc_votable,
DEFAULT_VOTER, true, chip->dt.fcc_ua);
+ vote(chg->fv_votable,
+ DEFAULT_VOTER, true, chip->dt.fv_uv);
vote(chg->usb_icl_votable,
DEFAULT_VOTER, true, chip->dt.usb_icl_ua);
vote(chg->dc_icl_votable,
diff --git a/drivers/power/qcom-charger/smb-lib.c b/drivers/power/qcom-charger/smb-lib.c
index 33824479a84d..263b8b3bd672 100644
--- a/drivers/power/qcom-charger/smb-lib.c
+++ b/drivers/power/qcom-charger/smb-lib.c
@@ -325,6 +325,16 @@ int smblib_fcc_vote_callback(struct device *dev,
return rc;
}
+int smblib_fv_vote_callback(struct device *dev,
+ int fv_uv, int client, int last_fv_uv, int last_client)
+{
+ struct smb_charger *chg = dev_get_drvdata(dev);
+ int rc = 0;
+
+ rc = smblib_set_charge_param(chg, &chg->param.fv, fv_uv);
+ return rc;
+}
+
#define USBIN_25MA 25000
#define USBIN_100MA 100000
int smblib_usb_icl_vote_callback(struct device *dev,
@@ -1272,8 +1282,9 @@ static void smblib_hvdcp_detect_work(struct work_struct *work)
* INIT *
* ******/
-#define SMB_DEFAULT_FCC_UA 1000000
-#define SMB_DEFAULT_ICL_UA 1500000
+#define SMB_DEFAULT_FCC_UA 1000000
+#define SMB_DEFAULT_FV_UV 4350000
+#define SMB_DEFAULT_ICL_UA 1500000
int smblib_init(struct smb_charger *chg)
{
@@ -1301,7 +1312,7 @@ int smblib_init(struct smb_charger *chg)
}
chg->fcc_votable = create_votable(chg->dev,
- "FCC", VOTE_MIN,
+ "FCC", VOTE_MAX,
NUM_VOTERS, SMB_DEFAULT_FCC_UA,
smblib_fcc_vote_callback);
if (IS_ERR(chg->fcc_votable)) {
@@ -1309,6 +1320,15 @@ int smblib_init(struct smb_charger *chg)
return rc;
}
+ chg->fv_votable = create_votable(chg->dev,
+ "FV", VOTE_MAX,
+ NUM_VOTERS, SMB_DEFAULT_FV_UV,
+ smblib_fv_vote_callback);
+ if (IS_ERR(chg->fv_votable)) {
+ rc = PTR_ERR(chg->fv_votable);
+ return rc;
+ }
+
chg->usb_icl_votable = create_votable(chg->dev,
"USB_ICL", VOTE_MIN,
NUM_VOTERS, SMB_DEFAULT_ICL_UA,
diff --git a/drivers/power/qcom-charger/smb-lib.h b/drivers/power/qcom-charger/smb-lib.h
index b688b5ebf0af..a7e34552370e 100644
--- a/drivers/power/qcom-charger/smb-lib.h
+++ b/drivers/power/qcom-charger/smb-lib.h
@@ -79,6 +79,7 @@ struct smb_charger {
struct votable *usb_suspend_votable;
struct votable *dc_suspend_votable;
struct votable *fcc_votable;
+ struct votable *fv_votable;
struct votable *usb_icl_votable;
struct votable *dc_icl_votable;
struct votable *pd_allowed_votable;