summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-04-18 14:07:56 +0200
committerSebastian Reichel <sebastian.reichel@collabora.co.uk>2018-04-26 00:44:27 +0200
commit5b76ad50d20feb8867ebe9112c2287ef57f976db (patch)
tree1413759b3ab95ab9c5acc6751d5cf27f4ec09175 /drivers/power
parent2490640b2764ee570eef83528a8fd888f3b6103c (diff)
downloadlinux-5b76ad50d20feb8867ebe9112c2287ef57f976db.tar.bz2
power: supply: axp288_charger: Support 3500 and 4000 mA input current limit
The AXP288 supports an input-current-limit of up to 4000 mA, this commit adds support for the 3500 and 4000 mA settings which were missing until now. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/axp288_charger.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
index 9bfbde15b07d..6982927b05c0 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -88,6 +88,8 @@
#define CHRG_VBUS_ILIM_2000MA 0x4 /* 2000mA */
#define CHRG_VBUS_ILIM_2500MA 0x5 /* 2500mA */
#define CHRG_VBUS_ILIM_3000MA 0x6 /* 3000mA */
+#define CHRG_VBUS_ILIM_3500MA 0x7 /* 3500mA */
+#define CHRG_VBUS_ILIM_4000MA 0x8 /* 4000mA */
#define CHRG_VLTFC_0C 0xA5 /* 0 DegC */
#define CHRG_VHTFC_45C 0x1F /* 45 DegC */
@@ -223,9 +225,11 @@ static int axp288_charger_get_vbus_inlmt(struct axp288_chrg_info *info)
return 2500000;
case CHRG_VBUS_ILIM_3000MA:
return 3000000;
+ case CHRG_VBUS_ILIM_3500MA:
+ return 3500000;
default:
- dev_warn(&info->pdev->dev, "Unknown ilim reg val: %d\n", val);
- return 0;
+ /* All b1xxx values map to 4000 mA */
+ return 4000000;
}
}
@@ -235,7 +239,11 @@ static inline int axp288_charger_set_vbus_inlmt(struct axp288_chrg_info *info,
int ret;
u8 reg_val;
- if (inlmt >= 3000000)
+ if (inlmt >= 4000000)
+ reg_val = CHRG_VBUS_ILIM_4000MA << CHRG_VBUS_ILIM_BIT_POS;
+ else if (inlmt >= 3500000)
+ reg_val = CHRG_VBUS_ILIM_3500MA << CHRG_VBUS_ILIM_BIT_POS;
+ else if (inlmt >= 3000000)
reg_val = CHRG_VBUS_ILIM_3000MA << CHRG_VBUS_ILIM_BIT_POS;
else if (inlmt >= 2500000)
reg_val = CHRG_VBUS_ILIM_2500MA << CHRG_VBUS_ILIM_BIT_POS;