Skip to content

Commit ce38f3f

Browse files
jwrdegoedesre
authored andcommitted
power: supply: axp288_charger: Use alt usb-id extcon on some x86 android tablets
x86 ACPI boards which ship with only Android as their factory image may have pretty broken ACPI tables. This includes broken _AEI ACPI GPIO event handlers, which are normally used to listen to the micro-USB ID pin and: 1. Switch the USB-mux to the host / device USB controllers 2. Disable Vbus path before enabling the 5V boost (AXP reg 0x30 bit 7) 3. Turn 5V Vboost on / off On non broken systems where this is not done through an ACPI GPIO event handler, there is an ACPI INT3496 device describing the involved GPIOs which are handled by the extcon-intel-int3496 driver; and axp288-charger.ko listens to this extcon-device and disables the Vbus path when necessary. On x86 Android boards, with broken ACPI GPIO event handlers, these are disabled by acpi_quirk_skip_gpio_event_handlers() and an intel-int3496 extcon device is manually instantiated by x86-android-tablets.ko . Add support to the axp288-charger code for this setup, so that it properly disables the Vbus path when necessary. Note this uses acpi_quirk_skip_gpio_event_handlers() to identify these systems, to avoid the need to add a separate DMI match table for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent 9d6ff17 commit ce38f3f

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

drivers/power/supply/axp288_charger.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
836836
struct device *dev = &pdev->dev;
837837
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
838838
struct power_supply_config charger_cfg = {};
839+
const char *extcon_name = NULL;
839840
unsigned int val;
840841

841842
/*
@@ -872,8 +873,18 @@ static int axp288_charger_probe(struct platform_device *pdev)
872873
return PTR_ERR(info->cable.edev);
873874
}
874875

875-
if (acpi_dev_present(USB_HOST_EXTCON_HID, NULL, -1)) {
876-
info->otg.cable = extcon_get_extcon_dev(USB_HOST_EXTCON_NAME);
876+
/*
877+
* On devices with broken ACPI GPIO event handlers there also is no ACPI
878+
* "INT3496" (USB_HOST_EXTCON_HID) device. x86-android-tablets.ko
879+
* instantiates an "intel-int3496" extcon on these devs as a workaround.
880+
*/
881+
if (acpi_quirk_skip_gpio_event_handlers())
882+
extcon_name = "intel-int3496";
883+
else if (acpi_dev_present(USB_HOST_EXTCON_HID, NULL, -1))
884+
extcon_name = USB_HOST_EXTCON_NAME;
885+
886+
if (extcon_name) {
887+
info->otg.cable = extcon_get_extcon_dev(extcon_name);
877888
if (IS_ERR(info->otg.cable)) {
878889
dev_err_probe(dev, PTR_ERR(info->otg.cable),
879890
"extcon_get_extcon_dev(%s) failed\n",

0 commit comments

Comments
 (0)