* [PATCH v4 1/2] modify pl011 driver to let it work as wakeup source
@ 2015-09-16 6:46 Zhaoyang Huang
2015-09-16 6:47 ` [PATCH v4 2/2] add property of "linux,wakeup" for juno.dts Zhaoyang Huang
0 siblings, 1 reply; 4+ messages in thread
From: Zhaoyang Huang @ 2015-09-16 6:46 UTC (permalink / raw)
To: linux-pm; +Cc: amit.kucheria, sudeep.holla
the commit use the latest dev_pm_set_wake_irq API instead
of the enable_irq_wake and IRQF_NO_SUSPEND to configure the
ttyAMA device to work as the wakeup source
Signed-off-by: Zhaoyang Huang <zhaoyang.huang@linaro.org>
---
drivers/tty/serial/amba-pl011.c | 47 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index fd27e98..1923b94 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -59,6 +59,11 @@
#include <linux/sizes.h>
#include <linux/io.h>
#include <linux/acpi.h>
+#include <linux/suspend.h>
+#include <linux/pm_wakeirq.h>
+#include <linux/irq.h>
+
+static struct device *uart_dev;
#define UART_NR 14
@@ -2353,11 +2358,29 @@ static int pl011_register_port(struct uart_amba_port *uap)
return ret;
}
+struct uart_match {
+ struct uart_port *port;
+ struct uart_driver *driver;
+};
+
+static int match_uart_port(struct device *dev, void *data)
+{
+ struct uart_match *match = data;
+
+ dev_t devt = MKDEV(match->driver->major, match->driver->minor) +
+ match->port->line;
+
+ pr_info("the match data of ttyAMA0 is %d %d\n",
+ (int)devt, (int)dev->devt);
+
+ return dev->devt == devt; /* Actually, only one tty per port */
+}
static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
{
struct uart_amba_port *uap;
struct vendor_data *vendor = id->data;
int portnr, ret;
+ struct uart_match match;
portnr = pl011_find_free_port();
if (portnr < 0)
@@ -2387,13 +2410,35 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
amba_set_drvdata(dev, uap);
- return pl011_register_port(uap);
+ ret = pl011_register_port(uap);
+
+ if (!of_find_property(dev->dev.of_node, "linux,wakeup", NULL)) {
+ uart_dev = NULL;
+ return ret;
+ }
+
+ match.port = &uap->port;
+ match.driver = &amba_reg;
+
+ uart_dev = device_find_child(&dev->dev, &match, match_uart_port);
+
+ if (uart_dev) {
+ device_init_wakeup(uart_dev, true);
+ dev_pm_set_wake_irq(uart_dev, uap->port.irq);
+ }
+
+ return ret;
}
static int pl011_remove(struct amba_device *dev)
{
struct uart_amba_port *uap = amba_get_drvdata(dev);
+ if (uart_dev) {
+ dev_pm_clear_wake_irq(uart_dev);
+ device_init_wakeup(uart_dev, false);
+ }
+
uart_remove_one_port(&amba_reg, &uap->port);
pl011_unregister_port(uap);
return 0;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v4 2/2] add property of "linux,wakeup" for juno.dts
2015-09-16 6:46 [PATCH v4 1/2] modify pl011 driver to let it work as wakeup source Zhaoyang Huang
@ 2015-09-16 6:47 ` Zhaoyang Huang
2015-09-16 8:41 ` Sudeep Holla
0 siblings, 1 reply; 4+ messages in thread
From: Zhaoyang Huang @ 2015-09-16 6:47 UTC (permalink / raw)
To: linux-pm; +Cc: amit.kucheria, sudeep.holla
add property of "linux,wakeup" to let the driver know
if the device should work as wakeup source
Signed-off-by: Zhaoyang Huang <zhaoyang.huang@linaro.org>
---
Documentation/devicetree/bindings/serial/pl011.txt | 3 ++-
arch/arm64/boot/dts/arm/juno-base.dtsi | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/serial/pl011.txt b/Documentation/devicetree/bindings/serial/pl011.txt
index cbae3d9..609e8e9 100644
--- a/Documentation/devicetree/bindings/serial/pl011.txt
+++ b/Documentation/devicetree/bindings/serial/pl011.txt
@@ -35,7 +35,8 @@ Optional properties:
- poll-timeout-ms:
Poll timeout when auto-poll is set, default
3000ms.
-
+- linux,wakeup:
+ set the pl011 work as wakeup source for suspend to ram/idle
See also bindings/arm/primecell.txt
Example:
diff --git a/arch/arm64/boot/dts/arm/juno-base.dtsi b/arch/arm64/boot/dts/arm/juno-base.dtsi
index a3d5a77..f7bb150 100644
--- a/arch/arm64/boot/dts/arm/juno-base.dtsi
+++ b/arch/arm64/boot/dts/arm/juno-base.dtsi
@@ -152,6 +152,7 @@
interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&soc_uartclk>, <&soc_refclk100mhz>;
clock-names = "uartclk", "apb_pclk";
+ linux,wakeup;
};
i2c@7ffa0000 {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v4 2/2] add property of "linux,wakeup" for juno.dts
2015-09-16 6:47 ` [PATCH v4 2/2] add property of "linux,wakeup" for juno.dts Zhaoyang Huang
@ 2015-09-16 8:41 ` Sudeep Holla
[not found] ` <CAN2waFukpBgLM-NawcyqRMEbqC_v3VVoPSP=j0sJ6tJ1vMikqw@mail.gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Sudeep Holla @ 2015-09-16 8:41 UTC (permalink / raw)
To: Zhaoyang Huang, linux-pm@vger.kernel.org
Cc: Sudeep Holla, amit.kucheria@linaro.org
On 16/09/15 07:47, Zhaoyang Huang wrote:
> add property of "linux,wakeup" to let the driver know
> if the device should work as wakeup source
>
I think I made it *pretty clear multiple times by now* that PL011 is
*not a wakeup source* on Juno. I have no idea what you are testing, it
simply can't wakeup the system for suspended state. So I seriously doubt
now what is that you are testing.
So, this patch clearly gets NACK.
Regards,
Sudeep
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4 2/2] add property of "linux,wakeup" for juno.dts
[not found] ` <CAN2waFukpBgLM-NawcyqRMEbqC_v3VVoPSP=j0sJ6tJ1vMikqw@mail.gmail.com>
@ 2015-09-16 8:59 ` Sudeep Holla
0 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2015-09-16 8:59 UTC (permalink / raw)
To: Zhaoyang Huang
Cc: Sudeep Holla, linux-pm@vger.kernel.org, amit.kucheria@linaro.org
Hi Zhaouyang,
On 16/09/15 09:53, Zhaoyang Huang wrote:
> Hi Sudeep,
Please stop top-posting, I have told you many times now in private.
> Sorry for the confusions I made. I am testing the suspend to idle on
> juno, which is similar to suspend to ram, while the difference is the
> cpu will go into idle itself(you can refer the function freeze_enter())
> instead of running cpu_suspend finally. I find that the pl011 can wakeup
> the system by receiving from the tty.
>
No, it shouldn't be allowed to be configured as wakeup if it can't
wakeup from S2R. So please stop sending this patch. I need to see real
use case for PL011 as a wakeup source.
Also, if we go by your definition, we can make any interrupt as wakeup
source. You need to understand that we hardware support for an interrupt
to be a wakeup irq.
Regards,
Sudeep
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-16 8:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 6:46 [PATCH v4 1/2] modify pl011 driver to let it work as wakeup source Zhaoyang Huang
2015-09-16 6:47 ` [PATCH v4 2/2] add property of "linux,wakeup" for juno.dts Zhaoyang Huang
2015-09-16 8:41 ` Sudeep Holla
[not found] ` <CAN2waFukpBgLM-NawcyqRMEbqC_v3VVoPSP=j0sJ6tJ1vMikqw@mail.gmail.com>
2015-09-16 8:59 ` Sudeep Holla
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).