* [PATCH resend] extcon: axp288: Add wakeup support
@ 2020-03-23 21:59 ` Hans de Goede
2020-03-24 22:37 ` Chanwoo Choi
2020-03-25 1:01 ` Sasha Levin
0 siblings, 2 replies; 3+ messages in thread
From: Hans de Goede @ 2020-03-23 21:59 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi, Chen-Yu Tsai
Cc: Hans de Goede, linux-kernel, stable
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>
---
drivers/extcon/extcon-axp288.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index a7f216191493..710a3bb66e95 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -443,9 +443,40 @@ static int axp288_extcon_probe(struct platform_device *pdev)
/* Start charger cable type detection */
axp288_extcon_enable(info);
+ device_init_wakeup(dev, true);
+ platform_set_drvdata(pdev, info);
+
+ return 0;
+}
+
+static int __maybe_unused axp288_extcon_suspend(struct device *dev)
+{
+ struct axp288_extcon_info *info = dev_get_drvdata(dev);
+
+ if (device_may_wakeup(dev))
+ enable_irq_wake(info->irq[VBUS_RISING_IRQ]);
+
return 0;
}
+static int __maybe_unused axp288_extcon_resume(struct device *dev)
+{
+ struct axp288_extcon_info *info = dev_get_drvdata(dev);
+
+ /*
+ * Wakeup when a charger is connected to do charger-type
+ * connection and generate an extcon event which makes the
+ * axp288 charger driver set the input current limit.
+ */
+ if (device_may_wakeup(dev))
+ disable_irq_wake(info->irq[VBUS_RISING_IRQ]);
+
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend,
+ axp288_extcon_resume);
+
static const struct platform_device_id axp288_extcon_table[] = {
{ .name = "axp288_extcon" },
{},
@@ -457,6 +488,7 @@ static struct platform_driver axp288_extcon_driver = {
.id_table = axp288_extcon_table,
.driver = {
.name = "axp288_extcon",
+ .pm = &axp288_extcon_pm_ops,
},
};
--
2.26.0.rc2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH resend] extcon: axp288: Add wakeup support
2020-03-23 21:59 ` [PATCH resend] extcon: axp288: Add wakeup support Hans de Goede
@ 2020-03-24 22:37 ` Chanwoo Choi
2020-03-25 1:01 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Chanwoo Choi @ 2020-03-24 22:37 UTC (permalink / raw)
To: Hans de Goede, MyungJoo Ham, Chen-Yu Tsai; +Cc: linux-kernel, stable
On 3/24/20 6:59 AM, Hans de Goede wrote:
> 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>
> ---
> drivers/extcon/extcon-axp288.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
> index a7f216191493..710a3bb66e95 100644
> --- a/drivers/extcon/extcon-axp288.c
> +++ b/drivers/extcon/extcon-axp288.c
> @@ -443,9 +443,40 @@ static int axp288_extcon_probe(struct platform_device *pdev)
> /* Start charger cable type detection */
> axp288_extcon_enable(info);
>
> + device_init_wakeup(dev, true);
> + platform_set_drvdata(pdev, info);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused axp288_extcon_suspend(struct device *dev)
> +{
> + struct axp288_extcon_info *info = dev_get_drvdata(dev);
> +
> + if (device_may_wakeup(dev))
> + enable_irq_wake(info->irq[VBUS_RISING_IRQ]);
> +
> return 0;
> }
>
> +static int __maybe_unused axp288_extcon_resume(struct device *dev)
> +{
> + struct axp288_extcon_info *info = dev_get_drvdata(dev);
> +
> + /*
> + * Wakeup when a charger is connected to do charger-type
> + * connection and generate an extcon event which makes the
> + * axp288 charger driver set the input current limit.
> + */
> + if (device_may_wakeup(dev))
> + disable_irq_wake(info->irq[VBUS_RISING_IRQ]);
> +
> + return 0;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend,
> + axp288_extcon_resume);
> +
> static const struct platform_device_id axp288_extcon_table[] = {
> { .name = "axp288_extcon" },
> {},
> @@ -457,6 +488,7 @@ static struct platform_driver axp288_extcon_driver = {
> .id_table = axp288_extcon_table,
> .driver = {
> .name = "axp288_extcon",
> + .pm = &axp288_extcon_pm_ops,
> },
> };
>
>
Applied it. Thanks.
--
Best Regards,
Chanwoo Choi
Samsung Electronics
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH resend] extcon: axp288: Add wakeup support
2020-03-23 21:59 ` [PATCH resend] extcon: axp288: Add wakeup support Hans de Goede
2020-03-24 22:37 ` Chanwoo Choi
@ 2020-03-25 1:01 ` Sasha Levin
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2020-03-25 1:01 UTC (permalink / raw)
To: Sasha Levin, Hans de Goede, MyungJoo Ham
Cc: Hans de Goede, linux-kernel, stable, stable
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 866 bytes --]
Hi
[This is an automated email]
This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all
The bot has tested the following trees: v5.5.11, v5.4.27, v4.19.112, v4.14.174, v4.9.217, v4.4.217.
v5.5.11: Build OK!
v5.4.27: Build OK!
v4.19.112: Build OK!
v4.14.174: Build failed! Errors:
drivers/extcon/extcon-axp288.c:326:21: error: ‘dev’ undeclared (first use in this function); did you mean ‘pdev’?
v4.9.217: Failed to apply! Possible dependencies:
dd3a55fc688b ("extcon: axp288: Fix the module not auto-loading")
v4.4.217: Failed to apply! Possible dependencies:
dd3a55fc688b ("extcon: axp288: Fix the module not auto-loading")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
--
Thanks
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-25 1:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20200323215949epcas1p33af2bba09c458dd09ed22e3de200955a@epcas1p3.samsung.com>
2020-03-23 21:59 ` [PATCH resend] extcon: axp288: Add wakeup support Hans de Goede
2020-03-24 22:37 ` Chanwoo Choi
2020-03-25 1:01 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).