aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/s3c24xx/patches-2.6.26/1163-fix-glamo-mci-resume-dependency-on-pcf50633.patch.patch
blob: 9d41e02c2e91a7667ba93dbc010a461424524801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
From 5ad924f2ed05ff695f523f62040a9c63b44084a0 Mon Sep 17 00:00:00 2001
From: Andy Green <andy@openmoko.com>
Date: Fri, 25 Jul 2008 23:06:12 +0100
Subject: [PATCH] fix-glamo-mci-resume-dependency-on-pcf50633.patch

Glamo MCI has a resume order dependncy on pcf50633, it has to be able to
power the SD slot via it.
Signed-off-by: Andy Green <andy@openmoko.com>
---
 arch/arm/mach-s3c2440/mach-gta02.c |   25 +++++++++++++++++++++++++
 drivers/mfd/glamo/glamo-core.c     |    8 ++++++++
 drivers/mfd/glamo/glamo-core.h     |    3 +++
 drivers/mfd/glamo/glamo-mci.c      |   11 ++++++++++-
 include/linux/glamofb.h            |    2 ++
 5 files changed, 48 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 69a952a..64d275d 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -92,6 +92,8 @@ static spinlock_t motion_irq_lock;
 struct resume_dependency resume_dep_jbt_pcf;
 /* the dependency of jbt / LCM on glamo resume */
 struct resume_dependency resume_dep_jbt_glamo;
+/* the dependency of Glamo MCI on pcf50633 resume (has to power SD slot) */
+struct resume_dependency resume_dep_glamo_mci_pcf;
 
 
 /* define FIQ IPC struct */
@@ -1317,6 +1319,26 @@ gta02_glamo_mmc_set_power(unsigned char power_mode, unsigned short vdd)
 	}
 }
 
+
+static int gta02_glamo_mci_all_dependencies_resumed(struct platform_device *dev)
+{
+	return resume_dep_glamo_mci_pcf.called_flag;
+}
+
+/* register jbt resume action to be dependent on pcf50633 and glamo resume */
+
+static void gta02_glamo_mci_suspending(struct platform_device *dev)
+{
+	void glamo_mci_resume(void *dev); /* little white lies about types */
+
+	resume_dep_glamo_mci_pcf.callback = glamo_mci_resume;
+	resume_dep_glamo_mci_pcf.context = (void *)dev;
+	pcf50633_register_resume_dependency(pcf50633_global,
+						     &resume_dep_glamo_mci_pcf);
+}
+
+
+
 /* Smedia Glamo 3362 */
 
 static struct glamofb_platform_data gta02_glamo_pdata = {
@@ -1352,6 +1374,9 @@ static struct glamofb_platform_data gta02_glamo_pdata = {
 	/* glamo MMC function platform data */
 	.glamo_set_mci_power = gta02_glamo_mmc_set_power,
 	.glamo_irq_is_wired = glamo_irq_is_wired,
+	.mci_suspending = gta02_glamo_mci_suspending,
+	.mci_all_dependencies_resumed =
+				      gta02_glamo_mci_all_dependencies_resumed,
 };
 
 static struct resource gta02_glamo_resources[] = {
diff --git a/drivers/mfd/glamo/glamo-core.c b/drivers/mfd/glamo/glamo-core.c
index 445ff24..3edbfa8 100644
--- a/drivers/mfd/glamo/glamo-core.c
+++ b/drivers/mfd/glamo/glamo-core.c
@@ -270,6 +270,8 @@ struct glamo_mci_pdata glamo_mci_def_pdata = {
 	.glamo_set_mci_power	= NULL, /* filled in from MFD platform data */
 	.ocr_avail		= MMC_VDD_32_33,
 	.glamo_irq_is_wired	= NULL, /* filled in from MFD platform data */
+	.mci_suspending = NULL, /* filled in from MFD platform data */
+	.mci_all_dependencies_resumed = NULL, /* filled in from MFD platform data */
 };
 EXPORT_SYMBOL_GPL(glamo_mci_def_pdata);
 
@@ -1112,6 +1114,10 @@ static int __init glamo_probe(struct platform_device *pdev)
 					glamo->pdata->glamo_set_mci_power;
 	glamo_mci_def_pdata.glamo_irq_is_wired =
 					glamo->pdata->glamo_irq_is_wired;
+	glamo_mci_def_pdata.mci_suspending =
+					glamo->pdata->mci_suspending;
+	glamo_mci_def_pdata.mci_all_dependencies_resumed =
+				glamo->pdata->mci_all_dependencies_resumed;
 
 	glamo_2d_dev.dev.parent = &pdev->dev;
 	mangle_mem_resources(glamo_2d_dev.resource,
@@ -1181,6 +1187,8 @@ static int __init glamo_probe(struct platform_device *pdev)
 		 glamo_pll_rate(glamo, GLAMO_PLL1),
 		 glamo_pll_rate(glamo, GLAMO_PLL2));
 
+	glamo_lcm_reset(1);
+
 	for (irq = IRQ_GLAMO(0); irq <= IRQ_GLAMO(8); irq++) {
 		set_irq_chip(irq, &glamo_irq_chip);
 		set_irq_handler(irq, handle_level_irq);
diff --git a/drivers/mfd/glamo/glamo-core.h b/drivers/mfd/glamo/glamo-core.h
index 1fee059..b1531b3 100644
--- a/drivers/mfd/glamo/glamo-core.h
+++ b/drivers/mfd/glamo/glamo-core.h
@@ -71,6 +71,9 @@ struct glamo_mci_pdata {
 	void		(*glamo_set_mci_power)(unsigned char power_mode,
 				     unsigned short vdd);
 	int		(*glamo_irq_is_wired)(void);
+	void		(*mci_suspending)(struct platform_device *dev);
+	int		(*mci_all_dependencies_resumed)(struct platform_device *dev);
+
 };
 
 
diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c
index 05bbfc4..37e3d3c 100644
--- a/drivers/mfd/glamo/glamo-mci.c
+++ b/drivers/mfd/glamo/glamo-mci.c
@@ -817,18 +817,27 @@ static int glamo_mci_suspend(struct platform_device *dev, pm_message_t state)
 	struct glamo_mci_host 	*host = mmc_priv(mmc);
 
 	host->suspending++;
+	if (host->pdata->mci_all_dependencies_resumed)
+		(host->pdata->mci_suspending)(dev);
+
 	return mmc_suspend_host(mmc, state);
 }
 
-static int glamo_mci_resume(struct platform_device *dev)
+int glamo_mci_resume(struct platform_device *dev)
 {
 	struct mmc_host *mmc = platform_get_drvdata(dev);
 	struct glamo_mci_host 	*host = mmc_priv(mmc);
 
+	if (host->pdata->mci_all_dependencies_resumed)
+		if (!(host->pdata->mci_all_dependencies_resumed)(dev))
+			return 0;
+
 	host->suspending--;
 
 	return mmc_resume_host(mmc);
 }
+EXPORT_SYMBOL_GPL(glamo_mci_resume);
+
 
 #else /* CONFIG_PM */
 #define glamo_mci_suspend NULL
diff --git a/include/linux/glamofb.h b/include/linux/glamofb.h
index bb4ed0a..bb1a398 100644
--- a/include/linux/glamofb.h
+++ b/include/linux/glamofb.h
@@ -32,6 +32,8 @@ struct glamofb_platform_data {
 	void		(*glamo_set_mci_power)(unsigned char power_mode,
 				     unsigned short vdd);
 	int		(*glamo_irq_is_wired)(void);
+	void		(*mci_suspending)(struct platform_device *dev);
+	int		(*mci_all_dependencies_resumed)(struct platform_device *dev);
 };
 
 int glamofb_cmd_mode(struct glamofb_handle *gfb, int on);
-- 
1.5.6.3