1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-09 10:25:20 +02:00
openwrt-xburst/target/linux/s3c24xx/patches-2.6.26/1163-fix-glamo-mci-resume-dependency-on-pcf50633.patch.patch

163 lines
5.7 KiB
Diff
Raw Normal View History

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