1 From 2a1042fc56273fac721207597968af313751c17b Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Wed, 2 Jul 2008 22:43:53 +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 | 32 ++++++++++++++++++++++++++++++++
9 drivers/serial/s3c2410.c | 17 +++++++++++++++++
10 2 files changed, 49 insertions(+), 0 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..d70a481 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,21 @@ static DEVICE_ATTR(reset, 0644, gsm_read, gsm_write);
38 static DEVICE_ATTR(download, 0644, gsm_read, gsm_write);
41 +static void gsm_resume_work(struct work_struct *w)
43 + printk(KERN_INFO "%s: waiting...\n", __FUNCTION__);
44 + if (gsm_autounlock_delay)
45 + msleep(gsm_autounlock_delay);
46 + if (gsm_auto_flowcontrolled) {
47 + if (machine_is_neo1973_gta01())
48 + s3c24xx_fake_rx_interrupt(10000);
49 + s3c2410_gpio_cfgpin(S3C2410_GPH1, S3C2410_GPH1_nRTS0);
50 + gsm_auto_flowcontrolled = 0;
52 + printk(KERN_INFO "%s: done.\n", __FUNCTION__);
55 +static int gta01_gsm_resume(struct platform_device *pdev);
56 static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
58 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
59 @@ -189,11 +208,22 @@ static int gta01_gsm_suspend(struct platform_device *pdev, pm_message_t state)
60 if (machine_is_neo1973_gta02())
61 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
63 + /* register our resume dependency on the appropriate UART being up */
64 + resume_dep_gsm_uart.callback = gta01_gsm_resume;
65 + resume_dep_gsm_uart.context = (void *)pdev;
67 + s3c24xx_serial_register_resume_dependency(&resume_dep_gsm_uart, 0);
72 static int gta01_gsm_resume(struct platform_device *pdev)
74 + if (resume_dep_gsm_uart.called_flag != 1)
77 + resume_dep_gsm_uart.called_flag++; /* only run once */
79 /* GPIO state is saved/restored by S3C2410 core GPIO driver, so we
80 * don't need to do much here. */
82 @@ -279,6 +309,8 @@ static int __init gta01_gsm_probe(struct platform_device *pdev)
83 if (machine_is_neo1973_gta02())
84 s3c2410_gpio_setpin(GTA02_GPIO_nDL_GSM, 1);
86 + init_resume_dependency_list(&resume_dep_gsm_uart);
88 return sysfs_create_group(&pdev->dev.kobj, >a01_gsm_attr_group);
91 diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
92 index b566f42..bc6736d 100644
93 --- a/drivers/serial/s3c2410.c
94 +++ b/drivers/serial/s3c2410.c
96 #include <linux/serial.h>
97 #include <linux/delay.h>
98 #include <linux/clk.h>
99 +#include <linux/resume-dependency.h>
103 @@ -112,6 +113,8 @@ struct s3c24xx_uart_port {
106 struct uart_port port;
108 + struct resume_dependency resume_dependency;
112 @@ -1085,6 +1088,8 @@ static int s3c24xx_serial_probe(struct platform_device *dev,
113 ourport = &s3c24xx_serial_ports[probe_index];
116 + init_resume_dependency_list(&ourport->resume_dependency);
118 dbg("%s: initialising port %p...\n", __FUNCTION__, ourport);
120 ret = s3c24xx_serial_init_port(ourport, info, dev);
121 @@ -1125,6 +1130,16 @@ static int s3c24xx_serial_suspend(struct platform_device *dev, pm_message_t stat
125 +void s3c24xx_serial_register_resume_dependency(struct resume_dependency *
126 + resume_dependency, int uart_index)
128 + struct s3c24xx_uart_port *ourport = &s3c24xx_serial_ports[uart_index];
130 + register_resume_dependency(&ourport->resume_dependency,
131 + resume_dependency);
133 +EXPORT_SYMBOL(s3c24xx_serial_register_resume_dependency);
135 static int s3c24xx_serial_resume(struct platform_device *dev)
137 struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
138 @@ -1138,6 +1153,8 @@ static int s3c24xx_serial_resume(struct platform_device *dev)
139 uart_resume_port(&s3c24xx_uart_drv, port);
142 + callback_all_resume_dependencies(&ourport->resume_dependency);