diff options
-rw-r--r-- | drivers/power/supply/axp288_charger.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c index 6be2fe27bb07..d51ebd1da65e 100644 --- a/drivers/power/supply/axp288_charger.c +++ b/drivers/power/supply/axp288_charger.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/acpi.h> | ||
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
18 | #include <linux/device.h> | 19 | #include <linux/device.h> |
19 | #include <linux/regmap.h> | 20 | #include <linux/regmap.h> |
@@ -113,7 +114,8 @@ | |||
113 | #define ILIM_3000MA 3000 /* 3000mA */ | 114 | #define ILIM_3000MA 3000 /* 3000mA */ |
114 | 115 | ||
115 | #define AXP288_EXTCON_DEV_NAME "axp288_extcon" | 116 | #define AXP288_EXTCON_DEV_NAME "axp288_extcon" |
116 | #define USB_HOST_EXTCON_DEV_NAME "INT3496:00" | 117 | #define USB_HOST_EXTCON_HID "INT3496" |
118 | #define USB_HOST_EXTCON_NAME "INT3496:00" | ||
117 | 119 | ||
118 | static const unsigned int cable_ids[] = | 120 | static const unsigned int cable_ids[] = |
119 | { EXTCON_CHG_USB_SDP, EXTCON_CHG_USB_CDP, EXTCON_CHG_USB_DCP }; | 121 | { EXTCON_CHG_USB_SDP, EXTCON_CHG_USB_CDP, EXTCON_CHG_USB_DCP }; |
@@ -807,10 +809,14 @@ static int axp288_charger_probe(struct platform_device *pdev) | |||
807 | return -EPROBE_DEFER; | 809 | return -EPROBE_DEFER; |
808 | } | 810 | } |
809 | 811 | ||
810 | info->otg.cable = extcon_get_extcon_dev(USB_HOST_EXTCON_DEV_NAME); | 812 | if (acpi_dev_present(USB_HOST_EXTCON_HID, NULL, -1)) { |
811 | if (info->otg.cable == NULL) { | 813 | info->otg.cable = extcon_get_extcon_dev(USB_HOST_EXTCON_NAME); |
812 | dev_dbg(dev, "EXTCON_USB_HOST is not ready, probe deferred\n"); | 814 | if (info->otg.cable == NULL) { |
813 | return -EPROBE_DEFER; | 815 | dev_dbg(dev, "EXTCON_USB_HOST is not ready, probe deferred\n"); |
816 | return -EPROBE_DEFER; | ||
817 | } | ||
818 | dev_info(&pdev->dev, | ||
819 | "Using " USB_HOST_EXTCON_HID " extcon for usb-id\n"); | ||
814 | } | 820 | } |
815 | 821 | ||
816 | platform_set_drvdata(pdev, info); | 822 | platform_set_drvdata(pdev, info); |
@@ -849,13 +855,15 @@ static int axp288_charger_probe(struct platform_device *pdev) | |||
849 | /* Register for OTG notification */ | 855 | /* Register for OTG notification */ |
850 | INIT_WORK(&info->otg.work, axp288_charger_otg_evt_worker); | 856 | INIT_WORK(&info->otg.work, axp288_charger_otg_evt_worker); |
851 | info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt; | 857 | info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt; |
852 | ret = devm_extcon_register_notifier(&pdev->dev, info->otg.cable, | 858 | if (info->otg.cable) { |
859 | ret = devm_extcon_register_notifier(&pdev->dev, info->otg.cable, | ||
853 | EXTCON_USB_HOST, &info->otg.id_nb); | 860 | EXTCON_USB_HOST, &info->otg.id_nb); |
854 | if (ret) { | 861 | if (ret) { |
855 | dev_err(dev, "failed to register EXTCON_USB_HOST notifier\n"); | 862 | dev_err(dev, "failed to register EXTCON_USB_HOST notifier\n"); |
856 | return ret; | 863 | return ret; |
864 | } | ||
865 | schedule_work(&info->otg.work); | ||
857 | } | 866 | } |
858 | schedule_work(&info->otg.work); | ||
859 | 867 | ||
860 | /* Register charger interrupts */ | 868 | /* Register charger interrupts */ |
861 | for (i = 0; i < CHRG_INTR_END; i++) { | 869 | for (i = 0; i < CHRG_INTR_END; i++) { |