aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorAndy Green <andy@openmoko.com>2008-11-19 17:09:46 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:09:46 +0000
commitd4f8c947ca4693e5a08c252bcd2f0bb6d1e99592 (patch)
tree1f53bc3e9914192b9aceed4278a8df1bc7c14269 /drivers/i2c
parent45fcad39f329506d3a18ef289792d1f8bdeb0a98 (diff)
introduce-pcf50633-resume-dependency-list.patch
Adds resume dependency support to pcf50633 Signed-off-by: Andy Green <andy@openmoko.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/chips/pcf50633.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
index 38cabd23c51..e477cd7fa32 100644
--- a/drivers/i2c/chips/pcf50633.c
+++ b/drivers/i2c/chips/pcf50633.c
@@ -53,6 +53,7 @@
#include <asm/arch/gta02.h>
#include "pcf50633.h"
+#include <linux/resume-dependency.h>
#if 1
#define DEBUGP(x, args ...) printk("%s: " x, __FUNCTION__, ## args)
@@ -167,6 +168,9 @@ struct pcf50633_data {
u_int8_t ena;
} ldo[__NUM_PCF50633_REGS];
} standby_regs;
+
+ struct resume_dependency resume_dependency;
+
#endif
};
@@ -1924,6 +1928,8 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
pcf50633_global = data;
+ init_resume_dependency_list(data->resume_dependency);
+
populate_sysfs_group(data);
err = sysfs_create_group(&new_client->dev.kobj, &pcf_attr_group);
@@ -2132,6 +2138,17 @@ int pcf50633_report_resumers(struct pcf50633_data *pcf, char *buf)
#ifdef CONFIG_PM
+/*
+ * we need to export this because pcf50633_data is kept opaque
+ */
+
+void pcf50633_register_resume_dependency(struct pcf50633_data *pcf,
+ struct pcf50633_resume_dependency *dep)
+{
+ register_resume_dependency(pcf->resume_dependency, dep);
+}
+EXPORT_SYMBOL_GPL(pcf50633_register_resume_dep);
+
static int pcf50633_suspend(struct device *dev, pm_message_t state)
{
@@ -2223,8 +2240,11 @@ static int pcf50633_resume(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct pcf50633_data *pcf = i2c_get_clientdata(client);
int i;
+ struct list_head *pos, *q;
+ struct pcf50633_resume_dependency *dep;
+
- /* mutex_lock(&pcf->lock); */ /* resume in atomic context */
+ mutex_lock(&pcf->lock);
__reg_write(pcf, PCF50633_REG_LEDENA, 0x01);
@@ -2263,10 +2283,12 @@ static int pcf50633_resume(struct device *dev)
__reg_write(pcf, reg_out+1, pcf->standby_regs.ldo[i].ena);
}
- /* mutex_unlock(&pcf->lock); */ /* resume in atomic context */
+ mutex_unlock(&pcf->lock);
pcf50633_irq(pcf->irq, pcf);
+ callback_all_resume_dependencies(pcf->resume_dependency);
+
return 0;
}
#else