aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@marvell.com>2009-12-15 16:01:47 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2010-03-07 16:17:03 -0500
commit5c42e8c4a9c86ea26ed4ecb732a842dea0dfb6b6 (patch)
treeffac1c091a0bedde01c802123e7a602945fd6f62 /include
parent2cc50bee9934deb6dfe32929a4c1742cf83d6db3 (diff)
mfd: Add irq support in 88pm860x
88PM860x is a complex PMIC device. It contains touch, charger, sound, rtc, backlight, led, and so on. Host communicates to 88PM860x by I2C bus. Use thread irq to support this usage case. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mfd/88pm860x.h54
1 files changed, 28 insertions, 26 deletions
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 5845ae47df30..b4d6018ba0d6 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -12,6 +12,8 @@
12#ifndef __LINUX_MFD_88PM860X_H 12#ifndef __LINUX_MFD_88PM860X_H
13#define __LINUX_MFD_88PM860X_H 13#define __LINUX_MFD_88PM860X_H
14 14
15#include <linux/interrupt.h>
16
15enum { 17enum {
16 CHIP_INVALID = 0, 18 CHIP_INVALID = 0,
17 CHIP_PM8606, 19 CHIP_PM8606,
@@ -109,33 +111,10 @@ enum {
109 111
110/* Misc Registers */ 112/* Misc Registers */
111#define PM8607_CHIP_ID (0x00) 113#define PM8607_CHIP_ID (0x00)
114#define PM8607_B0_MISC1 (0x0C)
112#define PM8607_LDO1 (0x10) 115#define PM8607_LDO1 (0x10)
113#define PM8607_DVC3 (0x26) 116#define PM8607_DVC3 (0x26)
114#define PM8607_MISC1 (0x40) 117#define PM8607_A1_MISC1 (0x40)
115
116/* bit definitions for PM8607 events */
117#define PM8607_EVENT_ONKEY (1 << 0)
118#define PM8607_EVENT_EXTON (1 << 1)
119#define PM8607_EVENT_CHG (1 << 2)
120#define PM8607_EVENT_BAT (1 << 3)
121#define PM8607_EVENT_RTC (1 << 4)
122#define PM8607_EVENT_CC (1 << 5)
123#define PM8607_EVENT_VBAT (1 << 8)
124#define PM8607_EVENT_VCHG (1 << 9)
125#define PM8607_EVENT_VSYS (1 << 10)
126#define PM8607_EVENT_TINT (1 << 11)
127#define PM8607_EVENT_GPADC0 (1 << 12)
128#define PM8607_EVENT_GPADC1 (1 << 13)
129#define PM8607_EVENT_GPADC2 (1 << 14)
130#define PM8607_EVENT_GPADC3 (1 << 15)
131#define PM8607_EVENT_AUDIO_SHORT (1 << 16)
132#define PM8607_EVENT_PEN (1 << 17)
133#define PM8607_EVENT_HEADSET (1 << 18)
134#define PM8607_EVENT_HOOK (1 << 19)
135#define PM8607_EVENT_MICIN (1 << 20)
136#define PM8607_EVENT_CHG_TIMEOUT (1 << 21)
137#define PM8607_EVENT_CHG_DONE (1 << 22)
138#define PM8607_EVENT_CHG_FAULT (1 << 23)
139 118
140/* bit definitions of Status Query Interface */ 119/* bit definitions of Status Query Interface */
141#define PM8607_STATUS_CC (1 << 3) 120#define PM8607_STATUS_CC (1 << 3)
@@ -154,7 +133,12 @@ enum {
154#define PM8607_BUCK3_DOUBLE (1 << 6) 133#define PM8607_BUCK3_DOUBLE (1 << 6)
155 134
156/* bit definitions of Misc1 */ 135/* bit definitions of Misc1 */
157#define PM8607_MISC1_PI2C (1 << 0) 136#define PM8607_A1_MISC1_PI2C (1 << 0)
137#define PM8607_B0_MISC1_INV_INT (1 << 0)
138#define PM8607_B0_MISC1_INT_CLEAR (1 << 1)
139#define PM8607_B0_MISC1_INT_MASK (1 << 2)
140#define PM8607_B0_MISC1_PI2C (1 << 3)
141#define PM8607_B0_MISC1_RESET (1 << 6)
158 142
159/* Interrupt Number in 88PM8607 */ 143/* Interrupt Number in 88PM8607 */
160enum { 144enum {
@@ -187,15 +171,26 @@ enum {
187 PM8607_CHIP_B0 = 0x48, 171 PM8607_CHIP_B0 = 0x48,
188}; 172};
189 173
174#define PM860X_NUM_IRQ 24
175
176struct pm860x_irq {
177 irq_handler_t handler;
178 void *data;
179};
180
190struct pm860x_chip { 181struct pm860x_chip {
191 struct device *dev; 182 struct device *dev;
192 struct mutex io_lock; 183 struct mutex io_lock;
184 struct mutex irq_lock;
193 struct i2c_client *client; 185 struct i2c_client *client;
194 struct i2c_client *companion; /* companion chip client */ 186 struct i2c_client *companion; /* companion chip client */
187 struct pm860x_irq irq[PM860X_NUM_IRQ];
195 188
196 int buck3_double; /* DVC ramp slope double */ 189 int buck3_double; /* DVC ramp slope double */
197 unsigned short companion_addr; 190 unsigned short companion_addr;
198 int id; 191 int id;
192 int irq_mode;
193 int chip_irq;
199 unsigned char chip_version; 194 unsigned char chip_version;
200 195
201}; 196};
@@ -210,6 +205,7 @@ enum {
210struct pm860x_platform_data { 205struct pm860x_platform_data {
211 unsigned short companion_addr; /* I2C address of companion chip */ 206 unsigned short companion_addr; /* I2C address of companion chip */
212 int i2c_port; /* Controlled by GI2C or PI2C */ 207 int i2c_port; /* Controlled by GI2C or PI2C */
208 int irq_mode; /* Clear interrupt by read/write(0/1) */
213 struct regulator_init_data *regulator[PM8607_MAX_REGULATOR]; 209 struct regulator_init_data *regulator[PM8607_MAX_REGULATOR];
214}; 210};
215 211
@@ -220,6 +216,12 @@ extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *);
220extern int pm860x_set_bits(struct i2c_client *, int, unsigned char, 216extern int pm860x_set_bits(struct i2c_client *, int, unsigned char,
221 unsigned char); 217 unsigned char);
222 218
219extern int pm860x_mask_irq(struct pm860x_chip *, int);
220extern int pm860x_unmask_irq(struct pm860x_chip *, int);
221extern int pm860x_request_irq(struct pm860x_chip *, int,
222 irq_handler_t handler, void *);
223extern int pm860x_free_irq(struct pm860x_chip *, int);
224
223extern int pm860x_device_init(struct pm860x_chip *chip, 225extern int pm860x_device_init(struct pm860x_chip *chip,
224 struct pm860x_platform_data *pdata); 226 struct pm860x_platform_data *pdata);
225extern void pm860x_device_exit(struct pm860x_chip *chip); 227extern void pm860x_device_exit(struct pm860x_chip *chip);