1 From 5bba01c998f5c88ab2337df915e135e0d950c7a9 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:16 +0100
4 Subject: [PATCH] fix-gsm-resume-problems.patch
6 Signed-off-by: Andy Green <andy@openmoko.com>
8 arch/arm/plat-s3c24xx/neo1973_pm_gsm.c | 19 +++++++++++++++++++
9 drivers/serial/s3c2410.c | 19 ++++++++++++++++++-
10 2 files changed, 37 insertions(+), 1 deletions(-)
12 diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
13 index 149b866..6b6b2f4 100644
14 --- a/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
15 +++ b/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
17 #include <linux/console.h>
18 #include <linux/errno.h>
19 #include <linux/interrupt.h>
20 +#include <linux/resume-dependency.h>
23 #include <asm/mach-types.h>
32 +struct resume_dependency resume_dep_gsm_uart;
34 static struct gta01pm_priv gta01_gsm;
36 static struct console *find_s3c24xx_console(void)
37 @@ -179,6 +183,8 @@ static DEVICE_ATTR(reset, 0644, gsm_read, gsm_write);
38 static DEVICE_ATTR(download, 0644, gsm_read, gsm_write);
42 +static int gta01_gsm_resume(struct platform_device *pdev);
43 static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
45 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
46 @@ -189,11 +195,22 @@ static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
47 if (machine_is_neo1973_gta02())
48 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
50 + /* register our resume dependency on the appropriate UART being up */
51 + resume_dep_gsm_uart.callback = gta01_gsm_resume;
52 + resume_dep_gsm_uart.context = (void *)pdev;
54 + s3c24xx_serial_register_resume_dependency(&resume_dep_gsm_uart, 0);
59 static int gta01_gsm_resume(struct platform_device *pdev)
61 + if (resume_dep_gsm_uart.called_flag != 1)
64 + resume_dep_gsm_uart.called_flag++; /* only run once */
66 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
67 * don't need to do much here. */
69 @@ -279,6 +296,8 @@ static int __init gta01_gsm_probe(struct platform_device *pdev)
70 if (machine_is_neo1973_gta02())
71 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
73 + init_resume_dependency_list(&resume_dep_gsm_uart);
75 return sysfs_create_group(&pdev->dev.kobj, >a01_gsm_attr_group);
78 diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
79 index bd87c79..32cceae 100644
80 --- a/drivers/serial/s3c2410.c
81 +++ b/drivers/serial/s3c2410.c
83 #include <linux/serial.h>
84 #include <linux/delay.h>
85 #include <linux/clk.h>
86 +#include <linux/resume-dependency.h>
90 @@ -112,6 +113,8 @@ struct s3c24xx_uart_port {
93 struct uart_port port;
95 + struct resume_dependency resume_dependency;
99 @@ -1088,7 +1091,9 @@ static int s3c24xx_serial_probe(struct platform_device *dev,
100 ourport = &s3c24xx_serial_ports[probe_index];
103 - dbg("%s: initialising port %p...\n", __func__, ourport);
104 + init_resume_dependency_list(&ourport->resume_dependency);
106 + dbg("%s: initialising port %p...\n", __FUNCTION__, ourport);
108 ret = s3c24xx_serial_init_port(ourport, info, dev);
110 @@ -1128,6 +1133,16 @@ static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t stat
114 +void s3c24xx_serial_register_resume_dependency(struct resume_dependency *
115 + resume_dependency, int uart_index)
117 + struct s3c24xx_uart_port *ourport = &s3c24xx_serial_ports[uart_index];
119 + register_resume_dependency(&ourport->resume_dependency,
120 + resume_dependency);
122 +EXPORT_SYMBOL(s3c24xx_serial_register_resume_dependency);
124 static int s3c24xx_serial_resume(struct platform_device *dev)
126 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
127 @@ -1141,6 +1156,8 @@ static int s3c24xx_serial_resume(struct platform_device *dev)
128 uart_resume_port(&s3c24xx_uart_drv, port);
131 + callback_all_resume_dependencies(&ourport->resume_dependency);