create firmware image for the Ubiquiti LS-SR71 board
[openwrt/openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1172-introduce-pcf50633-resume-dependency-list.patch.patch
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
5
6 Adds resume dependency support to pcf50633
7
8 Signed-off-by: Andy Green <andy@openmoko.com>
9 ---
10 drivers/i2c/chips/pcf50633.c | 26 ++++++++++++++++++++++++--
11 include/linux/pcf50633.h | 5 +++++
12 2 files changed, 29 insertions(+), 2 deletions(-)
13
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
18 @@ -53,6 +53,7 @@
19 #include <asm/arch/gta02.h>
20
21 #include "pcf50633.h"
22 +#include <linux/resume-dependency.h>
23
24 #if 0
25 #define DEBUGP(x, args ...) printk("%s: " x, __FUNCTION__, ## args)
26 @@ -167,6 +168,9 @@ struct pcf50633_data {
27 u_int8_t ena;
28 } ldo[__NUM_PCF50633_REGS];
29 } standby_regs;
30 +
31 + struct resume_dependency resume_dependency;
32 +
33 #endif
34 };
35
36 @@ -1933,6 +1937,8 @@ static int pcf50633_detect(struct i2c_adapter *adapter, int address, int kind)
37
38 pcf50633_global = data;
39
40 + init_resume_dependency_list(data->resume_dependency);
41 +
42 populate_sysfs_group(data);
43
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)
46
47 #ifdef CONFIG_PM
48
49 +/*
50 + * we need to export this because pcf50633_data is kept opaque
51 + */
52 +
53 +void pcf50633_register_resume_dependency(struct pcf50633_data *pcf,
54 + struct pcf50633_resume_dependency *dep)
55 +{
56 + register_resume_dependency(pcf->resume_dependency, dep);
57 +}
58 +EXPORT_SYMBOL_GPL(pcf50633_register_resume_dep);
59 +
60
61 static int pcf50633_suspend(struct device *dev, pm_message_t state)
62 {
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);
66 int i;
67 + struct list_head *pos, *q;
68 + struct pcf50633_resume_dependency *dep;
69 +
70
71 - /* mutex_lock(&pcf->lock); */ /* resume in atomic context */
72 + mutex_lock(&pcf->lock);
73
74 __reg_write(pcf, PCF50633_REG_LEDENA, 0x01);
75
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);
78 }
79
80 - /* mutex_unlock(&pcf->lock); */ /* resume in atomic context */
81 + mutex_unlock(&pcf->lock);
82
83 pcf50633_irq(pcf->irq, pcf);
84
85 + callback_all_resume_dependencies(pcf->resume_dependency);
86 +
87 return 0;
88 }
89 #else
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
94 @@ -2,6 +2,7 @@
95 #define _LINUX_PCF50633_H
96
97 #include <linux/pcf506xx.h>
98 +#include <linux/resume-dependency.h>
99
100
101 /* public in-kernel pcf50633 api */
102 @@ -124,6 +125,10 @@ pcf50633_battvolt(struct pcf50633_data *pcf);
103 extern int
104 pcf50633_report_resumers(struct pcf50633_data *pcf, char *buf);
105
106 +extern void
107 +pcf50633_register_resume_dependency(struct pcf50633_data *pcf,
108 + struct pcf50633_resume_dependency *dep);
109 +
110
111 #define PCF50633_FEAT_EXTON 0x00000001 /* not yet supported */
112 #define PCF50633_FEAT_MBC 0x00000002
113 --
114 1.5.6.5
115