summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx/patches-2.6.26/0155-introduce-pcf50633-resume-dependency-list.patch.patch
blob: a02b1a08d603068e944ce2ab367a314265ec1aed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
From 897069d6ec20d26b29e4f71264e2c68de8a93053 Mon Sep 17 00:00:00 2001
From: Andy Green <andy@openmoko.com>
Date: Fri, 25 Jul 2008 23:06:11 +0100
Subject: [PATCH] introduce-pcf50633-resume-dependency-list.patch

Adds resume dependency support to pcf50633

Signed-off-by: Andy Green <andy@openmoko.com>
---
 drivers/i2c/chips/pcf50633.c |   26 ++++++++++++++++++++++++--
 include/linux/pcf50633.h     |    6 ++++++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
index 38cabd2..e477cd7 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
diff --git a/include/linux/pcf50633.h b/include/linux/pcf50633.h
index c0fdbe8..2bef616 100644
--- a/include/linux/pcf50633.h
+++ b/include/linux/pcf50633.h
@@ -2,6 +2,7 @@
 #define _LINUX_PCF50633_H
 
 #include <linux/pcf506xx.h>
+#include <linux/resume-dependency.h>
 
 
 /* public in-kernel pcf50633 api */
@@ -124,6 +125,11 @@ pcf50633_battvolt(struct pcf50633_data *pcf);
 extern int
 pcf50633_report_resumers(struct pcf50633_data *pcf, char *buf);
 
+extern void
+pcf50633_register_resume_dependency(struct pcf50633_data *pcf,
+					struct pcf50633_resume_dependency *dep);
+
+
 #define PCF50633_FEAT_EXTON	0x00000001	/* not yet supported */
 #define PCF50633_FEAT_MBC	0x00000002
 #define PCF50633_FEAT_BBC	0x00000004	/* not yet supported */
-- 
1.5.6.3