Skip to content

Commit 9c94553

Browse files
jwrdegoedechanwoochoi
authored andcommitted
extcon: axp288: Add wakeup support
On devices with an AXP288, we need to wakeup from suspend when a charger is plugged in, so that we can do charger-type detection and so that the axp288-charger driver, which listens for our extcon events, can configure the input-current-limit accordingly. Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
1 parent 995bb10 commit 9c94553

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎drivers/extcon/extcon-axp288.c‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,40 @@ static int axp288_extcon_probe(struct platform_device *pdev)
443443
/* Start charger cable type detection */
444444
axp288_extcon_enable(info);
445445

446+
device_init_wakeup(dev, true);
447+
platform_set_drvdata(pdev, info);
448+
449+
return 0;
450+
}
451+
452+
static int __maybe_unused axp288_extcon_suspend(struct device *dev)
453+
{
454+
struct axp288_extcon_info *info = dev_get_drvdata(dev);
455+
456+
if (device_may_wakeup(dev))
457+
enable_irq_wake(info->irq[VBUS_RISING_IRQ]);
458+
446459
return 0;
447460
}
448461

462+
static int __maybe_unused axp288_extcon_resume(struct device *dev)
463+
{
464+
struct axp288_extcon_info *info = dev_get_drvdata(dev);
465+
466+
/*
467+
* Wakeup when a charger is connected to do charger-type
468+
* connection and generate an extcon event which makes the
469+
* axp288 charger driver set the input current limit.
470+
*/
471+
if (device_may_wakeup(dev))
472+
disable_irq_wake(info->irq[VBUS_RISING_IRQ]);
473+
474+
return 0;
475+
}
476+
477+
static SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend,
478+
axp288_extcon_resume);
479+
449480
static const struct platform_device_id axp288_extcon_table[] = {
450481
{ .name = "axp288_extcon" },
451482
{},
@@ -457,6 +488,7 @@ static struct platform_driver axp288_extcon_driver = {
457488
.id_table = axp288_extcon_table,
458489
.driver = {
459490
.name = "axp288_extcon",
491+
.pm = &axp288_extcon_pm_ops,
460492
},
461493
};
462494

0 commit comments

Comments
 (0)