[ar71xx] fix GPIO function select bit definitions (based on a patch by Jonas <jmajau...
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1155-introduce-pcf50633-resume-dependency-list.patch.patch
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
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 | 6 ++++++
12 2 files changed, 30 insertions(+), 2 deletions(-)
13
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
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 1
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 @@ -1924,6 +1928,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 @@ -2132,6 +2138,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 @@ -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);
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 @@ -2263,10 +2283,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 c0fdbe8..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,11 @@ 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 #define PCF50633_FEAT_BBC 0x00000004 /* not yet supported */
114 --
115 1.5.6.3
116
This page took 0.044579 seconds and 5 git commands to generate.