aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@marvell.com>2010-01-08 06:29:23 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2010-03-07 16:17:06 -0500
commitd50f8f339f6901fccc9d4292b65ce8b69d7413d4 (patch)
treeda0256c7151f96177209c392c49e1a9b058f2f23 /include/linux
parent34a4b2391e9fbd12de9817de4ae409528bd7d7b6 (diff)
mfd: Initial max8925 support
Basic Max8925 support, which is a power management IC from Maxim Semiconductor. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mfd/max8925.h119
1 files changed, 119 insertions, 0 deletions
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
new file mode 100644
index 000000000000..2326246ddef2
--- /dev/null
+++ b/include/linux/mfd/max8925.h
@@ -0,0 +1,119 @@
1/*
2 * Maxim8925 Interface
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 * Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_MFD_MAX8925_H
13#define __LINUX_MFD_MAX8925_H
14
15#include <linux/interrupt.h>
16
17/* Charger registers */
18#define MAX8925_CHG_IRQ1 (0x7e)
19#define MAX8925_CHG_IRQ2 (0x7f)
20#define MAX8925_CHG_IRQ1_MASK (0x80)
21#define MAX8925_CHG_IRQ2_MASK (0x81)
22
23/* GPM registers */
24#define MAX8925_SYSENSEL (0x00)
25#define MAX8925_ON_OFF_IRQ1 (0x01)
26#define MAX8925_ON_OFF_IRQ1_MASK (0x02)
27#define MAX8925_ON_OFF_STAT (0x03)
28#define MAX8925_ON_OFF_IRQ2 (0x0d)
29#define MAX8925_ON_OFF_IRQ2_MASK (0x0e)
30#define MAX8925_RESET_CNFG (0x0f)
31
32/* Touch registers */
33#define MAX8925_TSC_IRQ (0x00)
34#define MAX8925_TSC_IRQ_MASK (0x01)
35
36/* RTC registers */
37#define MAX8925_RTC_STATUS (0x1a)
38#define MAX8925_RTC_IRQ (0x1c)
39#define MAX8925_RTC_IRQ_MASK (0x1d)
40
41/* bit definitions */
42#define CHG_IRQ1_MASK (0x07)
43#define CHG_IRQ2_MASK (0xff)
44#define ON_OFF_IRQ1_MASK (0xff)
45#define ON_OFF_IRQ2_MASK (0x03)
46#define TSC_IRQ_MASK (0x03)
47#define RTC_IRQ_MASK (0x0c)
48
49#define MAX8925_NUM_IRQ (32)
50
51#define MAX8925_NAME_SIZE (32)
52
53enum {
54 MAX8925_INVALID = 0,
55 MAX8925_RTC,
56 MAX8925_ADC,
57 MAX8925_GPM, /* general power management */
58 MAX8925_MAX,
59};
60
61#define MAX8925_IRQ_VCHG_OVP (0)
62#define MAX8925_IRQ_VCHG_F (1)
63#define MAX8925_IRQ_VCHG_R (2)
64#define MAX8925_IRQ_VCHG_THM_OK_R (8)
65#define MAX8925_IRQ_VCHG_THM_OK_F (9)
66#define MAX8925_IRQ_VCHG_BATTLOW_F (10)
67#define MAX8925_IRQ_VCHG_BATTLOW_R (11)
68#define MAX8925_IRQ_VCHG_RST (12)
69#define MAX8925_IRQ_VCHG_DONE (13)
70#define MAX8925_IRQ_VCHG_TOPOFF (14)
71#define MAX8925_IRQ_VCHG_TMR_FAULT (15)
72#define MAX8925_IRQ_GPM_RSTIN (16)
73#define MAX8925_IRQ_GPM_MPL (17)
74#define MAX8925_IRQ_GPM_SW_3SEC (18)
75#define MAX8925_IRQ_GPM_EXTON_F (19)
76#define MAX8925_IRQ_GPM_EXTON_R (20)
77#define MAX8925_IRQ_GPM_SW_1SEC (21)
78#define MAX8925_IRQ_GPM_SW_F (22)
79#define MAX8925_IRQ_GPM_SW_R (23)
80#define MAX8925_IRQ_GPM_SYSCKEN_F (24)
81#define MAX8925_IRQ_GPM_SYSCKEN_R (25)
82
83#define MAX8925_IRQ_TSC_STICK (0)
84#define MAX8925_IRQ_TSC_NSTICK (1)
85
86struct max8925_irq {
87 irq_handler_t handler;
88 void *data;
89};
90
91struct max8925_chip {
92 struct device *dev;
93 struct mutex io_lock;
94 struct mutex irq_lock;
95 struct i2c_client *i2c;
96 struct max8925_irq irq[MAX8925_NUM_IRQ];
97
98 const char *name;
99 int chip_id;
100 int chip_irq;
101};
102
103struct max8925_platform_data {
104 int chip_id;
105 int chip_irq;
106};
107
108extern int max8925_reg_read(struct i2c_client *, int);
109extern int max8925_reg_write(struct i2c_client *, int, unsigned char);
110extern int max8925_bulk_read(struct i2c_client *, int, int, unsigned char *);
111extern int max8925_bulk_write(struct i2c_client *, int, int, unsigned char *);
112extern int max8925_set_bits(struct i2c_client *, int, unsigned char,
113 unsigned char);
114
115extern int max8925_device_init(struct max8925_chip *,
116 struct max8925_platform_data *);
117extern void max8925_device_exit(struct max8925_chip *);
118#endif /* __LINUX_MFD_MAX8925_H */
119