[ar71xx] fix GPIO function select bit definitions (based on a patch by Jonas <jmajau...
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1163-fix-glamo-mci-resume-dependency-on-pcf50633.patch.patch
1 From 5ad924f2ed05ff695f523f62040a9c63b44084a0 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:12 +0100
4 Subject: [PATCH] fix-glamo-mci-resume-dependency-on-pcf50633.patch
5
6 Glamo MCI has a resume order dependncy on pcf50633, it has to be able to
7 power the SD slot via it.
8 Signed-off-by: Andy Green <andy@openmoko.com>
9 ---
10 arch/arm/mach-s3c2440/mach-gta02.c | 25 +++++++++++++++++++++++++
11 drivers/mfd/glamo/glamo-core.c | 8 ++++++++
12 drivers/mfd/glamo/glamo-core.h | 3 +++
13 drivers/mfd/glamo/glamo-mci.c | 11 ++++++++++-
14 include/linux/glamofb.h | 2 ++
15 5 files changed, 48 insertions(+), 1 deletions(-)
16
17 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
18 index 69a952a..64d275d 100644
19 --- a/arch/arm/mach-s3c2440/mach-gta02.c
20 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
21 @@ -92,6 +92,8 @@ static spinlock_t motion_irq_lock;
22 struct resume_dependency resume_dep_jbt_pcf;
23 /* the dependency of jbt / LCM on glamo resume */
24 struct resume_dependency resume_dep_jbt_glamo;
25 +/* the dependency of Glamo MCI on pcf50633 resume (has to power SD slot) */
26 +struct resume_dependency resume_dep_glamo_mci_pcf;
27
28
29 /* define FIQ IPC struct */
30 @@ -1317,6 +1319,26 @@ gta02_glamo_mmc_set_power(unsigned char power_mode, unsigned short vdd)
31 }
32 }
33
34 +
35 +static int gta02_glamo_mci_all_dependencies_resumed(struct platform_device *dev)
36 +{
37 + return resume_dep_glamo_mci_pcf.called_flag;
38 +}
39 +
40 +/* register jbt resume action to be dependent on pcf50633 and glamo resume */
41 +
42 +static void gta02_glamo_mci_suspending(struct platform_device *dev)
43 +{
44 + void glamo_mci_resume(void *dev); /* little white lies about types */
45 +
46 + resume_dep_glamo_mci_pcf.callback = glamo_mci_resume;
47 + resume_dep_glamo_mci_pcf.context = (void *)dev;
48 + pcf50633_register_resume_dependency(pcf50633_global,
49 + &resume_dep_glamo_mci_pcf);
50 +}
51 +
52 +
53 +
54 /* Smedia Glamo 3362 */
55
56 static struct glamofb_platform_data gta02_glamo_pdata = {
57 @@ -1352,6 +1374,9 @@ static struct glamofb_platform_data gta02_glamo_pdata = {
58 /* glamo MMC function platform data */
59 .glamo_set_mci_power = gta02_glamo_mmc_set_power,
60 .glamo_irq_is_wired = glamo_irq_is_wired,
61 + .mci_suspending = gta02_glamo_mci_suspending,
62 + .mci_all_dependencies_resumed =
63 + gta02_glamo_mci_all_dependencies_resumed,
64 };
65
66 static struct resource gta02_glamo_resources[] = {
67 diff --git a/drivers/mfd/glamo/glamo-core.c b/drivers/mfd/glamo/glamo-core.c
68 index 445ff24..3edbfa8 100644
69 --- a/drivers/mfd/glamo/glamo-core.c
70 +++ b/drivers/mfd/glamo/glamo-core.c
71 @@ -270,6 +270,8 @@ struct glamo_mci_pdata glamo_mci_def_pdata = {
72 .glamo_set_mci_power = NULL, /* filled in from MFD platform data */
73 .ocr_avail = MMC_VDD_32_33,
74 .glamo_irq_is_wired = NULL, /* filled in from MFD platform data */
75 + .mci_suspending = NULL, /* filled in from MFD platform data */
76 + .mci_all_dependencies_resumed = NULL, /* filled in from MFD platform data */
77 };
78 EXPORT_SYMBOL_GPL(glamo_mci_def_pdata);
79
80 @@ -1112,6 +1114,10 @@ static int __init glamo_probe(struct platform_device *pdev)
81 glamo->pdata->glamo_set_mci_power;
82 glamo_mci_def_pdata.glamo_irq_is_wired =
83 glamo->pdata->glamo_irq_is_wired;
84 + glamo_mci_def_pdata.mci_suspending =
85 + glamo->pdata->mci_suspending;
86 + glamo_mci_def_pdata.mci_all_dependencies_resumed =
87 + glamo->pdata->mci_all_dependencies_resumed;
88
89 glamo_2d_dev.dev.parent = &pdev->dev;
90 mangle_mem_resources(glamo_2d_dev.resource,
91 @@ -1181,6 +1187,8 @@ static int __init glamo_probe(struct platform_device *pdev)
92 glamo_pll_rate(glamo, GLAMO_PLL1),
93 glamo_pll_rate(glamo, GLAMO_PLL2));
94
95 + glamo_lcm_reset(1);
96 +
97 for (irq = IRQ_GLAMO(0); irq <= IRQ_GLAMO(8); irq++) {
98 set_irq_chip(irq, &glamo_irq_chip);
99 set_irq_handler(irq, handle_level_irq);
100 diff --git a/drivers/mfd/glamo/glamo-core.h b/drivers/mfd/glamo/glamo-core.h
101 index 1fee059..b1531b3 100644
102 --- a/drivers/mfd/glamo/glamo-core.h
103 +++ b/drivers/mfd/glamo/glamo-core.h
104 @@ -71,6 +71,9 @@ struct glamo_mci_pdata {
105 void (*glamo_set_mci_power)(unsigned char power_mode,
106 unsigned short vdd);
107 int (*glamo_irq_is_wired)(void);
108 + void (*mci_suspending)(struct platform_device *dev);
109 + int (*mci_all_dependencies_resumed)(struct platform_device *dev);
110 +
111 };
112
113
114 diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c
115 index 05bbfc4..37e3d3c 100644
116 --- a/drivers/mfd/glamo/glamo-mci.c
117 +++ b/drivers/mfd/glamo/glamo-mci.c
118 @@ -817,18 +817,27 @@ static int glamo_mci_suspend(struct platform_device *dev, pm_message_t state)
119 struct glamo_mci_host *host = mmc_priv(mmc);
120
121 host->suspending++;
122 + if (host->pdata->mci_all_dependencies_resumed)
123 + (host->pdata->mci_suspending)(dev);
124 +
125 return mmc_suspend_host(mmc, state);
126 }
127
128 -static int glamo_mci_resume(struct platform_device *dev)
129 +int glamo_mci_resume(struct platform_device *dev)
130 {
131 struct mmc_host *mmc = platform_get_drvdata(dev);
132 struct glamo_mci_host *host = mmc_priv(mmc);
133
134 + if (host->pdata->mci_all_dependencies_resumed)
135 + if (!(host->pdata->mci_all_dependencies_resumed)(dev))
136 + return 0;
137 +
138 host->suspending--;
139
140 return mmc_resume_host(mmc);
141 }
142 +EXPORT_SYMBOL_GPL(glamo_mci_resume);
143 +
144
145 #else /* CONFIG_PM */
146 #define glamo_mci_suspend NULL
147 diff --git a/include/linux/glamofb.h b/include/linux/glamofb.h
148 index bb4ed0a..bb1a398 100644
149 --- a/include/linux/glamofb.h
150 +++ b/include/linux/glamofb.h
151 @@ -32,6 +32,8 @@ struct glamofb_platform_data {
152 void (*glamo_set_mci_power)(unsigned char power_mode,
153 unsigned short vdd);
154 int (*glamo_irq_is_wired)(void);
155 + void (*mci_suspending)(struct platform_device *dev);
156 + int (*mci_all_dependencies_resumed)(struct platform_device *dev);
157 };
158
159 int glamofb_cmd_mode(struct glamofb_handle *gfb, int on);
160 --
161 1.5.6.3
162
This page took 0.067308 seconds and 5 git commands to generate.