Commit 50111d3f authored by Quentin Schulz's avatar Quentin Schulz Committed by Sebastian Reichel

power: supply: axp20x_usb_power: add 100mA max current limit for AXP223

The X-Powers AXP223 shares most of its behaviour with the AXP221 PMIC
but allows the VBUS power supply max current to be set to 100mA (like
the AXP209 PMIC).

This basically adds a new compatible to the VBUS power supply driver and
adds a check on the compatible when setting current max limit.
Signed-off-by: default avatarQuentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: default avatarChen-Yu Tsai <wens@csie.org>
Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
parent ac88bebe
...@@ -90,11 +90,10 @@ static int axp20x_usb_power_get_property(struct power_supply *psy, ...@@ -90,11 +90,10 @@ static int axp20x_usb_power_get_property(struct power_supply *psy,
switch (v & AXP20X_VBUS_CLIMIT_MASK) { switch (v & AXP20X_VBUS_CLIMIT_MASK) {
case AXP20X_VBUC_CLIMIT_100mA: case AXP20X_VBUC_CLIMIT_100mA:
if (power->axp20x_id == AXP202_ID) { if (power->axp20x_id == AXP221_ID)
val->intval = 100000;
} else {
val->intval = -1; /* No 100mA limit */ val->intval = -1; /* No 100mA limit */
} else
val->intval = 100000;
break; break;
case AXP20X_VBUC_CLIMIT_500mA: case AXP20X_VBUC_CLIMIT_500mA:
val->intval = 500000; val->intval = 500000;
...@@ -317,7 +316,8 @@ static int axp20x_usb_power_probe(struct platform_device *pdev) ...@@ -317,7 +316,8 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
usb_power_desc = &axp20x_usb_power_desc; usb_power_desc = &axp20x_usb_power_desc;
irq_names = axp20x_irq_names; irq_names = axp20x_irq_names;
} else if (power->axp20x_id == AXP221_ID) { } else if (power->axp20x_id == AXP221_ID ||
power->axp20x_id == AXP223_ID) {
usb_power_desc = &axp22x_usb_power_desc; usb_power_desc = &axp22x_usb_power_desc;
irq_names = axp22x_irq_names; irq_names = axp22x_irq_names;
} else { } else {
...@@ -360,6 +360,9 @@ static const struct of_device_id axp20x_usb_power_match[] = { ...@@ -360,6 +360,9 @@ static const struct of_device_id axp20x_usb_power_match[] = {
}, { }, {
.compatible = "x-powers,axp221-usb-power-supply", .compatible = "x-powers,axp221-usb-power-supply",
.data = (void *)AXP221_ID, .data = (void *)AXP221_ID,
}, {
.compatible = "x-powers,axp223-usb-power-supply",
.data = (void *)AXP223_ID,
}, { /* sentinel */ } }, { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, axp20x_usb_power_match); MODULE_DEVICE_TABLE(of, axp20x_usb_power_match);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment