1 From bf63ca6b17328413611a9d7594ca2c2f710a1def Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Wed, 2 Jul 2008 22:38:06 +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 | 5 +++++
12 2 files changed, 29 insertions(+), 2 deletions(-)
14 diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
15 index 2ed6dc0..ec6b9f1 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 @@ -1933,6 +1937,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 @@ -2142,6 +2148,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 @@ -2234,8 +2251,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 @@ -2274,10 +2294,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 837037e..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,10 @@ 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