1 From 897069d6ec20d26b29e4f71264e2c68de8a93053 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:11 +0100
4 Subject: [PATCH] introduce-pcf50633-resume-dependency-list.patch
6 Adds resume dependency support to pcf50633
8 Signed-off-by: Andy Green <andy@openmoko.com>
10 drivers/i2c/chips/pcf50633.c | 26 ++++++++++++++++++++++++--
11 include/linux/pcf50633.h | 6 ++++++
12 2 files changed, 30 insertions(+), 2 deletions(-)
14 diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
15 index 38cabd2..e477cd7 100644
16 --- a/drivers/i2c/chips/pcf50633.c
17 +++ b/drivers/i2c/chips/pcf50633.c
19 #include <asm/arch/gta02.h>
22 +#include <linux/resume-dependency.h>
25 #define DEBUGP(x, args ...) printk("%s: " x, __FUNCTION__, ## args)
26 @@ -167,6 +168,9 @@ struct pcf50633_data {
28 } ldo[__NUM_PCF50633_REGS];
31 + struct resume_dependency resume_dependency;
36 @@ -1924,6 +1928,8 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
38 pcf50633_global = data;
40 + init_resume_dependency_list(data->resume_dependency);
42 populate_sysfs_group(data);
44 err = sysfs_create_group(&new_client->dev.kobj, &pcf_attr_group);
45 @@ -2132,6 +2138,17 @@ int pcf50633_report_resumers(struct pcf50633_data *pcf, char *buf)
50 + * we need to export this because pcf50633_data is kept opaque
53 +void pcf50633_register_resume_dependency(struct pcf50633_data *pcf,
54 + struct pcf50633_resume_dependency *dep)
56 + register_resume_dependency(pcf->resume_dependency, dep);
58 +EXPORT_SYMBOL_GPL(pcf50633_register_resume_dep);
61 static int pcf50633_suspend(struct device *dev, pm_message_t state)
63 @@ -2223,8 +2240,11 @@ static int pcf50633_resume(struct device *dev)
64 struct i2c_client *client = to_i2c_client(dev);
65 struct pcf50633_data *pcf = i2c_get_clientdata(client);
67 + struct list_head *pos, *q;
68 + struct pcf50633_resume_dependency *dep;
71 - /* mutex_lock(&pcf->lock); */ /* resume in atomic context */
72 + mutex_lock(&pcf->lock);
74 __reg_write(pcf, PCF50633_REG_LEDENA, 0x01);
76 @@ -2263,10 +2283,12 @@ static int pcf50633_resume(struct device *dev)
77 __reg_write(pcf, reg_out+1, pcf->standby_regs.ldo[i].ena);
80 - /* mutex_unlock(&pcf->lock); */ /* resume in atomic context */
81 + mutex_unlock(&pcf->lock);
83 pcf50633_irq(pcf->irq, pcf);
85 + callback_all_resume_dependencies(pcf->resume_dependency);
90 diff --git a/include/linux/pcf50633.h b/include/linux/pcf50633.h
91 index c0fdbe8..2bef616 100644
92 --- a/include/linux/pcf50633.h
93 +++ b/include/linux/pcf50633.h
95 #define _LINUX_PCF50633_H
97 #include <linux/pcf506xx.h>
98 +#include <linux/resume-dependency.h>
101 /* public in-kernel pcf50633 api */
102 @@ -124,6 +125,11 @@ pcf50633_battvolt(struct pcf50633_data *pcf);
104 pcf50633_report_resumers(struct pcf50633_data *pcf, char *buf);
107 +pcf50633_register_resume_dependency(struct pcf50633_data *pcf,
108 + struct pcf50633_resume_dependency *dep);
111 #define PCF50633_FEAT_EXTON 0x00000001 /* not yet supported */
112 #define PCF50633_FEAT_MBC 0x00000002
113 #define PCF50633_FEAT_BBC 0x00000004 /* not yet supported */