aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/ab8500.h201
-rw-r--r--include/linux/mfd/ab8500/gpadc.h32
-rw-r--r--include/linux/mfd/ab8500/gpio.h21
-rw-r--r--include/linux/mfd/ab8500/sysctrl.h254
-rw-r--r--include/linux/mfd/db5500-prcmu.h45
-rw-r--r--include/linux/mfd/max77663-core.h178
-rw-r--r--include/linux/mfd/max8907c.h259
-rw-r--r--include/linux/mfd/ricoh583.h164
-rw-r--r--include/linux/mfd/tps6591x.h124
9 files changed, 1278 insertions, 0 deletions
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
new file mode 100644
index 00000000000..838c6b487cc
--- /dev/null
+++ b/include/linux/mfd/ab8500.h
@@ -0,0 +1,201 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 * Author: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
6 */
7#ifndef MFD_AB8500_H
8#define MFD_AB8500_H
9
10#include <linux/device.h>
11
12/*
13 * AB8500 bank addresses
14 */
15#define AB8500_SYS_CTRL1_BLOCK 0x1
16#define AB8500_SYS_CTRL2_BLOCK 0x2
17#define AB8500_REGU_CTRL1 0x3
18#define AB8500_REGU_CTRL2 0x4
19#define AB8500_USB 0x5
20#define AB8500_TVOUT 0x6
21#define AB8500_DBI 0x7
22#define AB8500_ECI_AV_ACC 0x8
23#define AB8500_RESERVED 0x9
24#define AB8500_GPADC 0xA
25#define AB8500_CHARGER 0xB
26#define AB8500_GAS_GAUGE 0xC
27#define AB8500_AUDIO 0xD
28#define AB8500_INTERRUPT 0xE
29#define AB8500_RTC 0xF
30#define AB8500_MISC 0x10
31#define AB8500_DEVELOPMENT 0x11
32#define AB8500_DEBUG 0x12
33#define AB8500_PROD_TEST 0x13
34#define AB8500_OTP_EMUL 0x15
35
36/*
37 * Interrupts
38 */
39
40#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0
41#define AB8500_INT_UN_PLUG_TV_DET 1
42#define AB8500_INT_PLUG_TV_DET 2
43#define AB8500_INT_TEMP_WARM 3
44#define AB8500_INT_PON_KEY2DB_F 4
45#define AB8500_INT_PON_KEY2DB_R 5
46#define AB8500_INT_PON_KEY1DB_F 6
47#define AB8500_INT_PON_KEY1DB_R 7
48#define AB8500_INT_BATT_OVV 8
49#define AB8500_INT_MAIN_CH_UNPLUG_DET 10
50#define AB8500_INT_MAIN_CH_PLUG_DET 11
51#define AB8500_INT_USB_ID_DET_F 12
52#define AB8500_INT_USB_ID_DET_R 13
53#define AB8500_INT_VBUS_DET_F 14
54#define AB8500_INT_VBUS_DET_R 15
55#define AB8500_INT_VBUS_CH_DROP_END 16
56#define AB8500_INT_RTC_60S 17
57#define AB8500_INT_RTC_ALARM 18
58#define AB8500_INT_BAT_CTRL_INDB 20
59#define AB8500_INT_CH_WD_EXP 21
60#define AB8500_INT_VBUS_OVV 22
61#define AB8500_INT_MAIN_CH_DROP_END 23
62#define AB8500_INT_CCN_CONV_ACC 24
63#define AB8500_INT_INT_AUD 25
64#define AB8500_INT_CCEOC 26
65#define AB8500_INT_CC_INT_CALIB 27
66#define AB8500_INT_LOW_BAT_F 28
67#define AB8500_INT_LOW_BAT_R 29
68#define AB8500_INT_BUP_CHG_NOT_OK 30
69#define AB8500_INT_BUP_CHG_OK 31
70#define AB8500_INT_GP_HW_ADC_CONV_END 32
71#define AB8500_INT_ACC_DETECT_1DB_F 33
72#define AB8500_INT_ACC_DETECT_1DB_R 34
73#define AB8500_INT_ACC_DETECT_22DB_F 35
74#define AB8500_INT_ACC_DETECT_22DB_R 36
75#define AB8500_INT_ACC_DETECT_21DB_F 37
76#define AB8500_INT_ACC_DETECT_21DB_R 38
77#define AB8500_INT_GP_SW_ADC_CONV_END 39
78#define AB8500_INT_GPIO6R 40
79#define AB8500_INT_GPIO7R 41
80#define AB8500_INT_GPIO8R 42
81#define AB8500_INT_GPIO9R 43
82#define AB8500_INT_GPIO10R 44
83#define AB8500_INT_GPIO11R 45
84#define AB8500_INT_GPIO12R 46
85#define AB8500_INT_GPIO13R 47
86#define AB8500_INT_GPIO24R 48
87#define AB8500_INT_GPIO25R 49
88#define AB8500_INT_GPIO36R 50
89#define AB8500_INT_GPIO37R 51
90#define AB8500_INT_GPIO38R 52
91#define AB8500_INT_GPIO39R 53
92#define AB8500_INT_GPIO40R 54
93#define AB8500_INT_GPIO41R 55
94#define AB8500_INT_GPIO6F 56
95#define AB8500_INT_GPIO7F 57
96#define AB8500_INT_GPIO8F 58
97#define AB8500_INT_GPIO9F 59
98#define AB8500_INT_GPIO10F 60
99#define AB8500_INT_GPIO11F 61
100#define AB8500_INT_GPIO12F 62
101#define AB8500_INT_GPIO13F 63
102#define AB8500_INT_GPIO24F 64
103#define AB8500_INT_GPIO25F 65
104#define AB8500_INT_GPIO36F 66
105#define AB8500_INT_GPIO37F 67
106#define AB8500_INT_GPIO38F 68
107#define AB8500_INT_GPIO39F 69
108#define AB8500_INT_GPIO40F 70
109#define AB8500_INT_GPIO41F 71
110#define AB8500_INT_ADP_SOURCE_ERROR 72
111#define AB8500_INT_ADP_SINK_ERROR 73
112#define AB8500_INT_ADP_PROBE_PLUG 74
113#define AB8500_INT_ADP_PROBE_UNPLUG 75
114#define AB8500_INT_ADP_SENSE_OFF 76
115#define AB8500_INT_USB_PHY_POWER_ERR 78
116#define AB8500_INT_USB_LINK_STATUS 79
117#define AB8500_INT_BTEMP_LOW 80
118#define AB8500_INT_BTEMP_LOW_MEDIUM 81
119#define AB8500_INT_BTEMP_MEDIUM_HIGH 82
120#define AB8500_INT_BTEMP_HIGH 83
121#define AB8500_INT_USB_CHARGER_NOT_OK 89
122#define AB8500_INT_ID_WAKEUP_R 90
123#define AB8500_INT_ID_DET_R1R 92
124#define AB8500_INT_ID_DET_R2R 93
125#define AB8500_INT_ID_DET_R3R 94
126#define AB8500_INT_ID_DET_R4R 95
127#define AB8500_INT_ID_WAKEUP_F 96
128#define AB8500_INT_ID_DET_R1F 98
129#define AB8500_INT_ID_DET_R2F 99
130#define AB8500_INT_ID_DET_R3F 100
131#define AB8500_INT_ID_DET_R4F 101
132#define AB8500_INT_USB_CHG_DET_DONE 102
133#define AB8500_INT_USB_CH_TH_PROT_F 104
134#define AB8500_INT_USB_CH_TH_PROT_R 105
135#define AB8500_INT_MAIN_CH_TH_PROT_F 106
136#define AB8500_INT_MAIN_CH_TH_PROT_R 107
137#define AB8500_INT_USB_CHARGER_NOT_OKF 111
138
139#define AB8500_NR_IRQS 112
140#define AB8500_NUM_IRQ_REGS 14
141
142/**
143 * struct ab8500 - ab8500 internal structure
144 * @dev: parent device
145 * @lock: read/write operations lock
146 * @irq_lock: genirq bus lock
147 * @irq: irq line
148 * @chip_id: chip revision id
149 * @write: register write
150 * @read: register read
151 * @rx_buf: rx buf for SPI
152 * @tx_buf: tx buf for SPI
153 * @mask: cache of IRQ regs for bus lock
154 * @oldmask: cache of previous IRQ regs for bus lock
155 */
156struct ab8500 {
157 struct device *dev;
158 struct mutex lock;
159 struct mutex irq_lock;
160
161 int irq_base;
162 int irq;
163 u8 chip_id;
164
165 int (*write) (struct ab8500 *a8500, u16 addr, u8 data);
166 int (*read) (struct ab8500 *a8500, u16 addr);
167
168 unsigned long tx_buf[4];
169 unsigned long rx_buf[4];
170
171 u8 mask[AB8500_NUM_IRQ_REGS];
172 u8 oldmask[AB8500_NUM_IRQ_REGS];
173};
174
175struct regulator_reg_init;
176struct regulator_init_data;
177struct ab8500_gpio_platform_data;
178
179/**
180 * struct ab8500_platform_data - AB8500 platform data
181 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
182 * @init: board-specific initialization after detection of ab8500
183 * @num_regulator_reg_init: number of regulator init registers
184 * @regulator_reg_init: regulator init registers
185 * @num_regulator: number of regulators
186 * @regulator: machine-specific constraints for regulators
187 */
188struct ab8500_platform_data {
189 int irq_base;
190 void (*init) (struct ab8500 *);
191 int num_regulator_reg_init;
192 struct ab8500_regulator_reg_init *regulator_reg_init;
193 int num_regulator;
194 struct regulator_init_data *regulator;
195 struct ab8500_gpio_platform_data *gpio;
196};
197
198extern int __devinit ab8500_init(struct ab8500 *ab8500);
199extern int __devexit ab8500_exit(struct ab8500 *ab8500);
200
201#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/ab8500/gpadc.h b/include/linux/mfd/ab8500/gpadc.h
new file mode 100644
index 00000000000..46b954011f1
--- /dev/null
+++ b/include/linux/mfd/ab8500/gpadc.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2010 ST-Ericsson SA
3 * Licensed under GPLv2.
4 *
5 * Author: Arun R Murthy <arun.murthy@stericsson.com>
6 * Author: Daniel Willerud <daniel.willerud@stericsson.com>
7 */
8
9#ifndef _AB8500_GPADC_H
10#define _AB8500_GPADC_H
11
12/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */
13#define BAT_CTRL 0x01
14#define BTEMP_BALL 0x02
15#define MAIN_CHARGER_V 0x03
16#define ACC_DETECT1 0x04
17#define ACC_DETECT2 0x05
18#define ADC_AUX1 0x06
19#define ADC_AUX2 0x07
20#define MAIN_BAT_V 0x08
21#define VBUS_V 0x09
22#define MAIN_CHARGER_C 0x0A
23#define USB_CHARGER_C 0x0B
24#define BK_BAT_V 0x0C
25#define DIE_TEMP 0x0D
26
27struct ab8500_gpadc;
28
29struct ab8500_gpadc *ab8500_gpadc_get(char *name);
30int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 input);
31
32#endif /* _AB8500_GPADC_H */
diff --git a/include/linux/mfd/ab8500/gpio.h b/include/linux/mfd/ab8500/gpio.h
new file mode 100644
index 00000000000..488a8c920a2
--- /dev/null
+++ b/include/linux/mfd/ab8500/gpio.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright ST-Ericsson 2010.
3 *
4 * Author: Bibek Basu <bibek.basu@stericsson.com>
5 * Licensed under GPLv2.
6 */
7
8#ifndef _AB8500_GPIO_H
9#define _AB8500_GPIO_H
10
11/*
12 * Platform data to register a block: only the initial gpio/irq number.
13 */
14
15struct ab8500_gpio_platform_data {
16 int gpio_base;
17 u32 irq_base;
18 u8 config_reg[7];
19};
20
21#endif /* _AB8500_GPIO_H */
diff --git a/include/linux/mfd/ab8500/sysctrl.h b/include/linux/mfd/ab8500/sysctrl.h
new file mode 100644
index 00000000000..10da0291f8f
--- /dev/null
+++ b/include/linux/mfd/ab8500/sysctrl.h
@@ -0,0 +1,254 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> for ST Ericsson.
4 * License terms: GNU General Public License (GPL) version 2
5 */
6#ifndef __AB8500_SYSCTRL_H
7#define __AB8500_SYSCTRL_H
8
9#include <linux/bitops.h>
10
11#ifdef CONFIG_AB8500_CORE
12
13int ab8500_sysctrl_read(u16 reg, u8 *value);
14int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value);
15
16#else
17
18static inline int ab8500_sysctrl_read(u16 reg, u8 *value)
19{
20 return 0;
21}
22
23static inline int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
24{
25 return 0;
26}
27
28#endif /* CONFIG_AB8500_CORE */
29
30static inline int ab8500_sysctrl_set(u16 reg, u8 bits)
31{
32 return ab8500_sysctrl_write(reg, bits, bits);
33}
34
35static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
36{
37 return ab8500_sysctrl_write(reg, bits, 0);
38}
39
40/* Registers */
41#define AB8500_TURNONSTATUS 0x100
42#define AB8500_RESETSTATUS 0x101
43#define AB8500_PONKEY1PRESSSTATUS 0x102
44#define AB8500_SYSCLKREQSTATUS 0x142
45#define AB8500_STW4500CTRL1 0x180
46#define AB8500_STW4500CTRL2 0x181
47#define AB8500_STW4500CTRL3 0x200
48#define AB8500_MAINWDOGCTRL 0x201
49#define AB8500_MAINWDOGTIMER 0x202
50#define AB8500_LOWBAT 0x203
51#define AB8500_BATTOK 0x204
52#define AB8500_SYSCLKTIMER 0x205
53#define AB8500_SMPSCLKCTRL 0x206
54#define AB8500_SMPSCLKSEL1 0x207
55#define AB8500_SMPSCLKSEL2 0x208
56#define AB8500_SMPSCLKSEL3 0x209
57#define AB8500_SYSULPCLKCONF 0x20A
58#define AB8500_SYSULPCLKCTRL1 0x20B
59#define AB8500_SYSCLKCTRL 0x20C
60#define AB8500_SYSCLKREQ1VALID 0x20D
61#define AB8500_SYSTEMCTRLSUP 0x20F
62#define AB8500_SYSCLKREQ1RFCLKBUF 0x210
63#define AB8500_SYSCLKREQ2RFCLKBUF 0x211
64#define AB8500_SYSCLKREQ3RFCLKBUF 0x212
65#define AB8500_SYSCLKREQ4RFCLKBUF 0x213
66#define AB8500_SYSCLKREQ5RFCLKBUF 0x214
67#define AB8500_SYSCLKREQ6RFCLKBUF 0x215
68#define AB8500_SYSCLKREQ7RFCLKBUF 0x216
69#define AB8500_SYSCLKREQ8RFCLKBUF 0x217
70#define AB8500_DITHERCLKCTRL 0x220
71#define AB8500_SWATCTRL 0x230
72#define AB8500_HIQCLKCTRL 0x232
73#define AB8500_VSIMSYSCLKCTRL 0x233
74
75/* Bits */
76#define AB8500_TURNONSTATUS_PORNVBAT BIT(0)
77#define AB8500_TURNONSTATUS_PONKEY1DBF BIT(1)
78#define AB8500_TURNONSTATUS_PONKEY2DBF BIT(2)
79#define AB8500_TURNONSTATUS_RTCALARM BIT(3)
80#define AB8500_TURNONSTATUS_MAINCHDET BIT(4)
81#define AB8500_TURNONSTATUS_VBUSDET BIT(5)
82#define AB8500_TURNONSTATUS_USBIDDETECT BIT(6)
83
84#define AB8500_RESETSTATUS_RESETN4500NSTATUS BIT(0)
85#define AB8500_RESETSTATUS_SWRESETN4500NSTATUS BIT(2)
86
87#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_MASK 0x7F
88#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_SHIFT 0
89
90#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ1STATUS BIT(0)
91#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ2STATUS BIT(1)
92#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ3STATUS BIT(2)
93#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ4STATUS BIT(3)
94#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ5STATUS BIT(4)
95#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ6STATUS BIT(5)
96#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ7STATUS BIT(6)
97#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ8STATUS BIT(7)
98
99#define AB8500_STW4500CTRL1_SWOFF BIT(0)
100#define AB8500_STW4500CTRL1_SWRESET4500N BIT(1)
101#define AB8500_STW4500CTRL1_THDB8500SWOFF BIT(2)
102
103#define AB8500_STW4500CTRL2_RESETNVAUX1VALID BIT(0)
104#define AB8500_STW4500CTRL2_RESETNVAUX2VALID BIT(1)
105#define AB8500_STW4500CTRL2_RESETNVAUX3VALID BIT(2)
106#define AB8500_STW4500CTRL2_RESETNVMODVALID BIT(3)
107#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY1VALID BIT(4)
108#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY2VALID BIT(5)
109#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY3VALID BIT(6)
110#define AB8500_STW4500CTRL2_RESETNVSMPS1VALID BIT(7)
111
112#define AB8500_STW4500CTRL3_CLK32KOUT2DIS BIT(0)
113#define AB8500_STW4500CTRL3_RESETAUDN BIT(1)
114#define AB8500_STW4500CTRL3_RESETDENCN BIT(2)
115#define AB8500_STW4500CTRL3_THSDENA BIT(3)
116
117#define AB8500_MAINWDOGCTRL_MAINWDOGENA BIT(0)
118#define AB8500_MAINWDOGCTRL_MAINWDOGKICK BIT(1)
119#define AB8500_MAINWDOGCTRL_WDEXPTURNONVALID BIT(4)
120
121#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_MASK 0x7F
122#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_SHIFT 0
123
124#define AB8500_LOWBAT_LOWBATENA BIT(0)
125#define AB8500_LOWBAT_LOWBAT_MASK 0x7E
126#define AB8500_LOWBAT_LOWBAT_SHIFT 1
127
128#define AB8500_BATTOK_BATTOKSEL0THF_MASK 0x0F
129#define AB8500_BATTOK_BATTOKSEL0THF_SHIFT 0
130#define AB8500_BATTOK_BATTOKSEL1THF_MASK 0xF0
131#define AB8500_BATTOK_BATTOKSEL1THF_SHIFT 4
132
133#define AB8500_SYSCLKTIMER_SYSCLKTIMER_MASK 0x0F
134#define AB8500_SYSCLKTIMER_SYSCLKTIMER_SHIFT 0
135#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_MASK 0xF0
136#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_SHIFT 4
137
138#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_MASK 0x03
139#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_SHIFT 0
140#define AB8500_SMPSCLKCTRL_3M2CLKINTENA BIT(2)
141
142#define AB8500_SMPSCLKSEL1_VARMCLKSEL_MASK 0x07
143#define AB8500_SMPSCLKSEL1_VARMCLKSEL_SHIFT 0
144#define AB8500_SMPSCLKSEL1_VAPECLKSEL_MASK 0x38
145#define AB8500_SMPSCLKSEL1_VAPECLKSEL_SHIFT 3
146
147#define AB8500_SMPSCLKSEL2_VMODCLKSEL_MASK 0x07
148#define AB8500_SMPSCLKSEL2_VMODCLKSEL_SHIFT 0
149#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_MASK 0x38
150#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_SHIFT 3
151
152#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_MASK 0x07
153#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_SHIFT 0
154#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_MASK 0x38
155#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_SHIFT 3
156
157#define AB8500_SYSULPCLKCONF_ULPCLKCONF_MASK 0x03
158#define AB8500_SYSULPCLKCONF_ULPCLKCONF_SHIFT 0
159#define AB8500_SYSULPCLKCONF_CLK27MHZSTRE BIT(2)
160#define AB8500_SYSULPCLKCONF_TVOUTCLKDELN BIT(3)
161#define AB8500_SYSULPCLKCONF_TVOUTCLKINV BIT(4)
162#define AB8500_SYSULPCLKCONF_ULPCLKSTRE BIT(5)
163#define AB8500_SYSULPCLKCONF_CLK27MHZBUFENA BIT(6)
164#define AB8500_SYSULPCLKCONF_CLK27MHZPDENA BIT(7)
165
166#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_MASK 0x03
167#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_SHIFT 0
168#define AB8500_SYSULPCLKCTRL1_ULPCLKREQ BIT(2)
169#define AB8500_SYSULPCLKCTRL1_4500SYSCLKREQ BIT(3)
170#define AB8500_SYSULPCLKCTRL1_AUDIOCLKENA BIT(4)
171#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF2REQ BIT(5)
172#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF3REQ BIT(6)
173#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF4REQ BIT(7)
174
175#define AB8500_SYSCLKCTRL_TVOUTPLLENA BIT(0)
176#define AB8500_SYSCLKCTRL_TVOUTCLKENA BIT(1)
177#define AB8500_SYSCLKCTRL_USBCLKENA BIT(2)
178
179#define AB8500_SYSCLKREQ1VALID_SYSCLKREQ1VALID BIT(0)
180#define AB8500_SYSCLKREQ1VALID_ULPCLKREQ1VALID BIT(1)
181#define AB8500_SYSCLKREQ1VALID_USBSYSCLKREQ1VALID BIT(2)
182
183#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_MASK 0x03
184#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_SHIFT 0
185#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_MASK 0x0C
186#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_SHIFT 2
187#define AB8500_SYSTEMCTRLSUP_INTDB8500NOD BIT(4)
188
189#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF2 BIT(2)
190#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF3 BIT(3)
191#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF4 BIT(4)
192
193#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF2 BIT(2)
194#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF3 BIT(3)
195#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF4 BIT(4)
196
197#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF2 BIT(2)
198#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF3 BIT(3)
199#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF4 BIT(4)
200
201#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF2 BIT(2)
202#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF3 BIT(3)
203#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF4 BIT(4)
204
205#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF2 BIT(2)
206#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF3 BIT(3)
207#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF4 BIT(4)
208
209#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF2 BIT(2)
210#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF3 BIT(3)
211#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF4 BIT(4)
212
213#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF2 BIT(2)
214#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF3 BIT(3)
215#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF4 BIT(4)
216
217#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF2 BIT(2)
218#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF3 BIT(3)
219#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF4 BIT(4)
220
221#define AB8500_DITHERCLKCTRL_VARMDITHERENA BIT(0)
222#define AB8500_DITHERCLKCTRL_VSMPS3DITHERENA BIT(1)
223#define AB8500_DITHERCLKCTRL_VSMPS1DITHERENA BIT(2)
224#define AB8500_DITHERCLKCTRL_VSMPS2DITHERENA BIT(3)
225#define AB8500_DITHERCLKCTRL_VMODDITHERENA BIT(4)
226#define AB8500_DITHERCLKCTRL_VAPEDITHERENA BIT(5)
227#define AB8500_DITHERCLKCTRL_DITHERDEL_MASK 0xC0
228#define AB8500_DITHERCLKCTRL_DITHERDEL_SHIFT 6
229
230#define AB8500_SWATCTRL_UPDATERF BIT(0)
231#define AB8500_SWATCTRL_SWATENABLE BIT(1)
232#define AB8500_SWATCTRL_RFOFFTIMER_MASK 0x1C
233#define AB8500_SWATCTRL_RFOFFTIMER_SHIFT 2
234#define AB8500_SWATCTRL_SWATBIT5 BIT(6)
235
236#define AB8500_HIQCLKCTRL_SYSCLKREQ1HIQENAVALID BIT(0)
237#define AB8500_HIQCLKCTRL_SYSCLKREQ2HIQENAVALID BIT(1)
238#define AB8500_HIQCLKCTRL_SYSCLKREQ3HIQENAVALID BIT(2)
239#define AB8500_HIQCLKCTRL_SYSCLKREQ4HIQENAVALID BIT(3)
240#define AB8500_HIQCLKCTRL_SYSCLKREQ5HIQENAVALID BIT(4)
241#define AB8500_HIQCLKCTRL_SYSCLKREQ6HIQENAVALID BIT(5)
242#define AB8500_HIQCLKCTRL_SYSCLKREQ7HIQENAVALID BIT(6)
243#define AB8500_HIQCLKCTRL_SYSCLKREQ8HIQENAVALID BIT(7)
244
245#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ1VALID BIT(0)
246#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ2VALID BIT(1)
247#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ3VALID BIT(2)
248#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ4VALID BIT(3)
249#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ5VALID BIT(4)
250#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ6VALID BIT(5)
251#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6)
252#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7)
253
254#endif /* __AB8500_SYSCTRL_H */
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h
new file mode 100644
index 00000000000..f0977986402
--- /dev/null
+++ b/include/linux/mfd/db5500-prcmu.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 *
6 * U5500 PRCMU API.
7 */
8#ifndef __MACH_PRCMU_U5500_H
9#define __MACH_PRCMU_U5500_H
10
11#ifdef CONFIG_UX500_SOC_DB5500
12
13void db5500_prcmu_early_init(void);
14
15int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
16int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
17
18#else /* !CONFIG_UX500_SOC_DB5500 */
19
20static inline void db5500_prcmu_early_init(void)
21{
22}
23
24static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
25{
26 return -ENOSYS;
27}
28
29static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
30{
31 return -ENOSYS;
32}
33
34#endif /* CONFIG_UX500_SOC_DB5500 */
35
36static inline int db5500_prcmu_config_abb_event_readout(u32 abb_events)
37{
38#ifdef CONFIG_MACH_U5500_SIMULATOR
39 return 0;
40#else
41 return -1;
42#endif
43}
44
45#endif /* __MACH_PRCMU_U5500_H */
diff --git a/include/linux/mfd/max77663-core.h b/include/linux/mfd/max77663-core.h
new file mode 100644
index 00000000000..acfe22aac53
--- /dev/null
+++ b/include/linux/mfd/max77663-core.h
@@ -0,0 +1,178 @@
1/*
2 * include/linux/mfd/max77663-core.h
3 *
4 * Copyright 2011 Maxim Integrated Products, Inc.
5 * Copyright (C) 2011-2012 NVIDIA Corporation
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_MAX77663_CORE_H__
15#define __LINUX_MFD_MAX77663_CORE_H__
16
17#include <linux/irq.h>
18#include <linux/mfd/core.h>
19
20/*
21 * Interrupts
22 */
23enum {
24 MAX77663_IRQ_LBT_LB, /* Low-Battery */
25 MAX77663_IRQ_LBT_THERM_ALRM1, /* Thermal alarm status, > 120C */
26 MAX77663_IRQ_LBT_THERM_ALRM2, /* Thermal alarm status, > 140C */
27
28 MAX77663_IRQ_GPIO0, /* GPIO0 edge detection */
29 MAX77663_IRQ_GPIO1, /* GPIO1 edge detection */
30 MAX77663_IRQ_GPIO2, /* GPIO2 edge detection */
31 MAX77663_IRQ_GPIO3, /* GPIO3 edge detection */
32 MAX77663_IRQ_GPIO4, /* GPIO4 edge detection */
33 MAX77663_IRQ_GPIO5, /* GPIO5 edge detection */
34 MAX77663_IRQ_GPIO6, /* GPIO6 edge detection */
35 MAX77663_IRQ_GPIO7, /* GPIO7 edge detection */
36
37 MAX77663_IRQ_ONOFF_HRDPOWRN, /* Hard power off warnning */
38 MAX77663_IRQ_ONOFF_EN0_1SEC, /* EN0 active for 1s */
39 MAX77663_IRQ_ONOFF_EN0_FALLING, /* EN0 falling */
40 MAX77663_IRQ_ONOFF_EN0_RISING, /* EN0 rising */
41 MAX77663_IRQ_ONOFF_LID_FALLING, /* LID falling */
42 MAX77663_IRQ_ONOFF_LID_RISING, /* LID rising */
43 MAX77663_IRQ_ONOFF_ACOK_FALLING,/* ACOK falling */
44 MAX77663_IRQ_ONOFF_ACOK_RISING, /* ACOK rising */
45
46 MAX77663_IRQ_RTC, /* RTC */
47 MAX77663_IRQ_SD_PF, /* SD power fail */
48 MAX77663_IRQ_LDO_PF, /* LDO power fail */
49 MAX77663_IRQ_32K, /* 32kHz oscillator */
50 MAX77663_IRQ_NVER, /* Non-Volatile Event Recorder */
51
52 MAX77663_IRQ_NR,
53};
54
55/*
56 *GPIOs
57 */
58enum {
59 MAX77663_GPIO0,
60 MAX77663_GPIO1,
61 MAX77663_GPIO2,
62 MAX77663_GPIO3,
63 MAX77663_GPIO4,
64 MAX77663_GPIO5,
65 MAX77663_GPIO6,
66 MAX77663_GPIO7,
67
68 MAX77663_GPIO_NR,
69};
70
71/* Direction */
72enum max77663_gpio_dir {
73 GPIO_DIR_DEF,
74 GPIO_DIR_IN,
75 GPIO_DIR_OUT,
76};
77
78/* Data output */
79enum max77663_gpio_data_out {
80 GPIO_DOUT_DEF,
81 GPIO_DOUT_HIGH,
82 GPIO_DOUT_LOW,
83};
84
85/* Output drive */
86enum max77663_gpio_out_drv {
87 GPIO_OUT_DRV_DEF,
88 GPIO_OUT_DRV_PUSH_PULL,
89 GPIO_OUT_DRV_OPEN_DRAIN,
90};
91
92/* Pull-up */
93enum max77663_gpio_pull_up {
94 GPIO_PU_DEF,
95 GPIO_PU_ENABLE,
96 GPIO_PU_DISABLE,
97};
98
99/* Pull-down */
100enum max77663_gpio_pull_down {
101 GPIO_PD_DEF,
102 GPIO_PD_ENABLE,
103 GPIO_PD_DISABLE,
104};
105
106/* Alternate */
107enum max77663_gpio_alt {
108 GPIO_ALT_DEF,
109 GPIO_ALT_ENABLE,
110 GPIO_ALT_DISABLE,
111};
112
113/*
114 * Flags
115 */
116#define SLP_LPM_ENABLE 0x01
117
118struct max77663_gpio_config {
119 int gpio; /* gpio number */
120 enum max77663_gpio_dir dir;
121 enum max77663_gpio_data_out dout;
122 enum max77663_gpio_out_drv out_drv;
123 enum max77663_gpio_pull_up pull_up;
124 enum max77663_gpio_pull_down pull_down;
125 enum max77663_gpio_alt alternate;
126};
127
128struct max77663_platform_data {
129 int irq_base;
130 int gpio_base;
131
132 int num_gpio_cfgs;
133 struct max77663_gpio_config *gpio_cfgs;
134
135 int num_subdevs;
136 struct mfd_cell *sub_devices;
137
138 unsigned int flags;
139
140 unsigned char rtc_i2c_addr;
141
142 bool use_power_off;
143};
144
145#if defined(CONFIG_MFD_MAX77663)
146int max77663_read(struct device *dev, u8 addr, void *values, u32 len,
147 bool is_rtc);
148int max77663_write(struct device *dev, u8 addr, void *values, u32 len,
149 bool is_rtc);
150int max77663_set_bits(struct device *dev, u8 addr, u8 mask, u8 value,
151 bool is_rtc);
152int max77663_gpio_set_alternate(int gpio, int alternate);
153#else
154static inline int max77663_read(struct device *dev, u8 addr, void *values,
155 u32 len, bool is_rtc)
156{
157 return 0;
158}
159
160static inline int max77663_write(struct device *dev, u8 addr, void *values,
161 u32 len, bool is_rtc)
162{
163 return 0;
164}
165
166static inline int max77663_set_bits(struct device *dev, u8 addr, u8 mask,
167 u8 value, bool is_rtc)
168{
169 return 0;
170}
171
172static inline int max77663_gpio_set_alternate(int gpio, int alternate)
173{
174 return 0;
175}
176#endif /* defined(CONFIG_MFD_MAX77663) */
177
178#endif /* __LINUX_MFD_MAX77663_CORE_H__ */
diff --git a/include/linux/mfd/max8907c.h b/include/linux/mfd/max8907c.h
new file mode 100644
index 00000000000..48014b0485c
--- /dev/null
+++ b/include/linux/mfd/max8907c.h
@@ -0,0 +1,259 @@
1/* linux/mfd/max8907c.h
2 *
3 * Functions to access MAX8907C power management chip.
4 *
5 * Copyright (C) 2010 Gyungoh Yoo <jack.yoo@maxim-ic.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_MAX8907C_H
13#define __LINUX_MFD_MAX8907C_H
14
15/* MAX8907C register map */
16#define MAX8907C_REG_SYSENSEL 0x00
17#define MAX8907C_REG_ON_OFF_IRQ1 0x01
18#define MAX8907C_REG_ON_OFF_IRQ1_MASK 0x02
19#define MAX8907C_REG_ON_OFF_STAT 0x03
20#define MAX8907C_REG_SDCTL1 0x04
21#define MAX8907C_REG_SDSEQCNT1 0x05
22#define MAX8907C_REG_SDV1 0x06
23#define MAX8907C_REG_SDCTL2 0x07
24#define MAX8907C_REG_SDSEQCNT2 0x08
25#define MAX8907C_REG_SDV2 0x09
26#define MAX8907C_REG_SDCTL3 0x0A
27#define MAX8907C_REG_SDSEQCNT3 0x0B
28#define MAX8907C_REG_SDV3 0x0C
29#define MAX8907C_REG_ON_OFF_IRQ2 0x0D
30#define MAX8907C_REG_ON_OFF_IRQ2_MASK 0x0E
31#define MAX8907C_REG_RESET_CNFG 0x0F
32#define MAX8907C_REG_LDOCTL16 0x10
33#define MAX8907C_REG_LDOSEQCNT16 0x11
34#define MAX8907C_REG_LDO16VOUT 0x12
35#define MAX8907C_REG_SDBYSEQCNT 0x13
36#define MAX8907C_REG_LDOCTL17 0x14
37#define MAX8907C_REG_LDOSEQCNT17 0x15
38#define MAX8907C_REG_LDO17VOUT 0x16
39#define MAX8907C_REG_LDOCTL1 0x18
40#define MAX8907C_REG_LDOSEQCNT1 0x19
41#define MAX8907C_REG_LDO1VOUT 0x1A
42#define MAX8907C_REG_LDOCTL2 0x1C
43#define MAX8907C_REG_LDOSEQCNT2 0x1D
44#define MAX8907C_REG_LDO2VOUT 0x1E
45#define MAX8907C_REG_LDOCTL3 0x20
46#define MAX8907C_REG_LDOSEQCNT3 0x21
47#define MAX8907C_REG_LDO3VOUT 0x22
48#define MAX8907C_REG_LDOCTL4 0x24
49#define MAX8907C_REG_LDOSEQCNT4 0x25
50#define MAX8907C_REG_LDO4VOUT 0x26
51#define MAX8907C_REG_LDOCTL5 0x28
52#define MAX8907C_REG_LDOSEQCNT5 0x29
53#define MAX8907C_REG_LDO5VOUT 0x2A
54#define MAX8907C_REG_LDOCTL6 0x2C
55#define MAX8907C_REG_LDOSEQCNT6 0x2D
56#define MAX8907C_REG_LDO6VOUT 0x2E
57#define MAX8907C_REG_LDOCTL7 0x30
58#define MAX8907C_REG_LDOSEQCNT7 0x31
59#define MAX8907C_REG_LDO7VOUT 0x32
60#define MAX8907C_REG_LDOCTL8 0x34
61#define MAX8907C_REG_LDOSEQCNT8 0x35
62#define MAX8907C_REG_LDO8VOUT 0x36
63#define MAX8907C_REG_LDOCTL9 0x38
64#define MAX8907C_REG_LDOSEQCNT9 0x39
65#define MAX8907C_REG_LDO9VOUT 0x3A
66#define MAX8907C_REG_LDOCTL10 0x3C
67#define MAX8907C_REG_LDOSEQCNT10 0x3D
68#define MAX8907C_REG_LDO10VOUT 0x3E
69#define MAX8907C_REG_LDOCTL11 0x40
70#define MAX8907C_REG_LDOSEQCNT11 0x41
71#define MAX8907C_REG_LDO11VOUT 0x42
72#define MAX8907C_REG_LDOCTL12 0x44
73#define MAX8907C_REG_LDOSEQCNT12 0x45
74#define MAX8907C_REG_LDO12VOUT 0x46
75#define MAX8907C_REG_LDOCTL13 0x48
76#define MAX8907C_REG_LDOSEQCNT13 0x49
77#define MAX8907C_REG_LDO13VOUT 0x4A
78#define MAX8907C_REG_LDOCTL14 0x4C
79#define MAX8907C_REG_LDOSEQCNT14 0x4D
80#define MAX8907C_REG_LDO14VOUT 0x4E
81#define MAX8907C_REG_LDOCTL15 0x50
82#define MAX8907C_REG_LDOSEQCNT15 0x51
83#define MAX8907C_REG_LDO15VOUT 0x52
84#define MAX8907C_REG_OUT5VEN 0x54
85#define MAX8907C_REG_OUT5VSEQ 0x55
86#define MAX8907C_REG_OUT33VEN 0x58
87#define MAX8907C_REG_OUT33VSEQ 0x59
88#define MAX8907C_REG_LDOCTL19 0x5C
89#define MAX8907C_REG_LDOSEQCNT19 0x5D
90#define MAX8907C_REG_LDO19VOUT 0x5E
91#define MAX8907C_REG_LBCNFG 0x60
92#define MAX8907C_REG_SEQ1CNFG 0x64
93#define MAX8907C_REG_SEQ2CNFG 0x65
94#define MAX8907C_REG_SEQ3CNFG 0x66
95#define MAX8907C_REG_SEQ4CNFG 0x67
96#define MAX8907C_REG_SEQ5CNFG 0x68
97#define MAX8907C_REG_SEQ6CNFG 0x69
98#define MAX8907C_REG_SEQ7CNFG 0x6A
99#define MAX8907C_REG_LDOCTL18 0x72
100#define MAX8907C_REG_LDOSEQCNT18 0x73
101#define MAX8907C_REG_LDO18VOUT 0x74
102#define MAX8907C_REG_BBAT_CNFG 0x78
103#define MAX8907C_REG_CHG_CNTL1 0x7C
104#define MAX8907C_REG_CHG_CNTL2 0x7D
105#define MAX8907C_REG_CHG_IRQ1 0x7E
106#define MAX8907C_REG_CHG_IRQ2 0x7F
107#define MAX8907C_REG_CHG_IRQ1_MASK 0x80
108#define MAX8907C_REG_CHG_IRQ2_MASK 0x81
109#define MAX8907C_REG_CHG_STAT 0x82
110#define MAX8907C_REG_WLED_MODE_CNTL 0x84
111#define MAX8907C_REG_ILED_CNTL 0x84
112#define MAX8907C_REG_II1RR 0x8E
113#define MAX8907C_REG_II2RR 0x8F
114#define MAX8907C_REG_LDOCTL20 0x9C
115#define MAX8907C_REG_LDOSEQCNT20 0x9D
116#define MAX8907C_REG_LDO20VOUT 0x9E
117
118/* RTC register */
119#define MAX8907C_REG_RTC_SEC 0x00
120#define MAX8907C_REG_RTC_MIN 0x01
121#define MAX8907C_REG_RTC_HOURS 0x02
122#define MAX8907C_REG_RTC_WEEKDAY 0x03
123#define MAX8907C_REG_RTC_DATE 0x04
124#define MAX8907C_REG_RTC_MONTH 0x05
125#define MAX8907C_REG_RTC_YEAR1 0x06
126#define MAX8907C_REG_RTC_YEAR2 0x07
127#define MAX8907C_REG_ALARM0_SEC 0x08
128#define MAX8907C_REG_ALARM0_MIN 0x09
129#define MAX8907C_REG_ALARM0_HOURS 0x0A
130#define MAX8907C_REG_ALARM0_WEEKDAY 0x0B
131#define MAX8907C_REG_ALARM0_DATE 0x0C
132#define MAX8907C_REG_ALARM0_MONTH 0x0D
133#define MAX8907C_REG_ALARM0_YEAR1 0x0E
134#define MAX8907C_REG_ALARM0_YEAR2 0x0F
135#define MAX8907C_REG_ALARM1_SEC 0x10
136#define MAX8907C_REG_ALARM1_MIN 0x11
137#define MAX8907C_REG_ALARM1_HOURS 0x12
138#define MAX8907C_REG_ALARM1_WEEKDAY 0x13
139#define MAX8907C_REG_ALARM1_DATE 0x14
140#define MAX8907C_REG_ALARM1_MONTH 0x15
141#define MAX8907C_REG_ALARM1_YEAR1 0x16
142#define MAX8907C_REG_ALARM1_YEAR2 0x17
143#define MAX8907C_REG_ALARM0_CNTL 0x18
144#define MAX8907C_REG_ALARM1_CNTL 0x19
145#define MAX8907C_REG_RTC_STATUS 0x1A
146#define MAX8907C_REG_RTC_CNTL 0x1B
147#define MAX8907C_REG_RTC_IRQ 0x1C
148#define MAX8907C_REG_RTC_IRQ_MASK 0x1D
149#define MAX8907C_REG_MPL_CNTL 0x1E
150
151/* ADC and Touch Screen Controller register map */
152
153#define MAX8907C_CTL 0
154#define MAX8907C_SEQCNT 1
155#define MAX8907C_VOUT 2
156
157/* mask bit fields */
158#define MAX8907C_MASK_LDO_SEQ 0x1C
159#define MAX8907C_MASK_LDO_EN 0x01
160#define MAX8907C_MASK_VBBATTCV 0x03
161#define MAX8907C_MASK_OUT5V_VINEN 0x10
162#define MAX8907C_MASK_OUT5V_ENSRC 0x0E
163#define MAX8907C_MASK_OUT5V_EN 0x01
164
165/* Power off bit in RESET_CNFG reg */
166#define MAX8907C_MASK_POWER_OFF 0x40
167
168#define MAX8907C_MASK_PWR_EN 0x80
169#define MAX8907C_MASK_CTL_SEQ 0x1C
170
171#define MAX8907C_PWR_EN 0x80
172#define MAX8907C_CTL_SEQ 0x04
173
174#define MAX8907C_SD_SEQ1 0x02
175#define MAX8907C_SD_SEQ2 0x06
176
177#define MAX8907C_DELAY_CNT0 0x00
178
179#define MAX8907C_POWER_UP_DELAY_CNT1 0x10
180#define MAX8907C_POWER_UP_DELAY_CNT12 0xC0
181
182#define MAX8907C_POWER_DOWN_DELAY_CNT12 0x0C
183
184#define RTC_I2C_ADDR 0x68
185
186/*
187 * MAX8907B revision requires s/w WAR to connect PWREN input to
188 * sequencer 2 because of the bug in the silicon.
189 */
190#define MAX8907B_II2RR_PWREN_WAR (0x12)
191
192/* Defines common for all supplies PWREN sequencer selection */
193#define MAX8907B_SEQSEL_PWREN_LXX 1 /* SEQ2 (PWREN) */
194
195/* IRQ definitions */
196enum {
197 MAX8907C_IRQ_VCHG_DC_OVP,
198 MAX8907C_IRQ_VCHG_DC_F,
199 MAX8907C_IRQ_VCHG_DC_R,
200 MAX8907C_IRQ_VCHG_THM_OK_R,
201 MAX8907C_IRQ_VCHG_THM_OK_F,
202 MAX8907C_IRQ_VCHG_MBATTLOW_F,
203 MAX8907C_IRQ_VCHG_MBATTLOW_R,
204 MAX8907C_IRQ_VCHG_RST,
205 MAX8907C_IRQ_VCHG_DONE,
206 MAX8907C_IRQ_VCHG_TOPOFF,
207 MAX8907C_IRQ_VCHG_TMR_FAULT,
208 MAX8907C_IRQ_GPM_RSTIN,
209 MAX8907C_IRQ_GPM_MPL,
210 MAX8907C_IRQ_GPM_SW_3SEC,
211 MAX8907C_IRQ_GPM_EXTON_F,
212 MAX8907C_IRQ_GPM_EXTON_R,
213 MAX8907C_IRQ_GPM_SW_1SEC,
214 MAX8907C_IRQ_GPM_SW_F,
215 MAX8907C_IRQ_GPM_SW_R,
216 MAX8907C_IRQ_GPM_SYSCKEN_F,
217 MAX8907C_IRQ_GPM_SYSCKEN_R,
218 MAX8907C_IRQ_RTC_ALARM1,
219 MAX8907C_IRQ_RTC_ALARM0,
220 MAX8907C_NR_IRQS,
221};
222
223struct max8907c {
224 struct device *dev;
225 struct mutex io_lock;
226 struct mutex irq_lock;
227 struct i2c_client *i2c_power;
228 struct i2c_client *i2c_rtc;
229 int irq_base;
230 int core_irq;
231
232 unsigned char cache_chg[2];
233 unsigned char cache_on[2];
234 unsigned char cache_rtc;
235
236};
237
238struct max8907c_platform_data {
239 int num_subdevs;
240 struct platform_device **subdevs;
241 int irq_base;
242 int (*max8907c_setup)(void);
243 bool use_power_off;
244};
245
246int max8907c_reg_read(struct i2c_client *i2c, u8 reg);
247int max8907c_reg_bulk_read(struct i2c_client *i2c, u8 reg, u8 count, u8 *val);
248int max8907c_reg_write(struct i2c_client *i2c, u8 reg, u8 val);
249int max8907c_reg_bulk_write(struct i2c_client *i2c, u8 reg, u8 count, u8 *val);
250int max8907c_set_bits(struct i2c_client *i2c, u8 reg, u8 mask, u8 val);
251
252int max8907c_irq_init(struct max8907c *chip, int irq, int irq_base);
253void max8907c_irq_free(struct max8907c *chip);
254int max8907c_suspend(struct i2c_client *i2c, pm_message_t state);
255int max8907c_resume(struct i2c_client *i2c);
256void max8907c_deep_sleep(int enter);
257int max8907c_pwr_en_config(void);
258int max8907c_pwr_en_attach(void);
259#endif
diff --git a/include/linux/mfd/ricoh583.h b/include/linux/mfd/ricoh583.h
new file mode 100644
index 00000000000..4e38cded0fa
--- /dev/null
+++ b/include/linux/mfd/ricoh583.h
@@ -0,0 +1,164 @@
1/* include/linux/mfd/ricoh583.h
2 *
3 * Core driver interface to access RICOH583 power management chip.
4 *
5 * Copyright (C) 2011 NVIDIA Corporation
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef __LINUX_MFD_RICOH583_H
24#define __LINUX_MFD_RICOH583_H
25
26#include <linux/rtc.h>
27/* RICOH583 IRQ definitions */
28enum {
29 RICOH583_IRQ_ONKEY,
30 RICOH583_IRQ_ACOK,
31 RICOH583_IRQ_LIDOPEN,
32 RICOH583_IRQ_PREOT,
33 RICOH583_IRQ_CLKSTP,
34 RICOH583_IRQ_ONKEY_OFF,
35 RICOH583_IRQ_WD,
36 RICOH583_IRQ_EN_PWRREQ1,
37 RICOH583_IRQ_EN_PWRREQ2,
38 RICOH583_IRQ_PRE_VINDET,
39
40 RICOH583_IRQ_DC0LIM,
41 RICOH583_IRQ_DC1LIM,
42 RICOH583_IRQ_DC2LIM,
43 RICOH583_IRQ_DC3LIM,
44
45 RICOH583_IRQ_CTC,
46 RICOH583_IRQ_YALE,
47 RICOH583_IRQ_DALE,
48 RICOH583_IRQ_WALE,
49
50 RICOH583_IRQ_AIN1L,
51 RICOH583_IRQ_AIN2L,
52 RICOH583_IRQ_AIN3L,
53 RICOH583_IRQ_VBATL,
54 RICOH583_IRQ_VIN3L,
55 RICOH583_IRQ_VIN8L,
56 RICOH583_IRQ_AIN1H,
57 RICOH583_IRQ_AIN2H,
58 RICOH583_IRQ_AIN3H,
59 RICOH583_IRQ_VBATH,
60 RICOH583_IRQ_VIN3H,
61 RICOH583_IRQ_VIN8H,
62 RICOH583_IRQ_ADCEND,
63
64 RICOH583_IRQ_GPIO0,
65 RICOH583_IRQ_GPIO1,
66 RICOH583_IRQ_GPIO2,
67 RICOH583_IRQ_GPIO3,
68 RICOH583_IRQ_GPIO4,
69 RICOH583_IRQ_GPIO5,
70 RICOH583_IRQ_GPIO6,
71 RICOH583_IRQ_GPIO7,
72 RICOH583_NR_IRQS,
73};
74
75/* Ricoh583 gpio definitions */
76enum {
77 RICOH583_GPIO0,
78 RICOH583_GPIO1,
79 RICOH583_GPIO2,
80 RICOH583_GPIO3,
81 RICOH583_GPIO4,
82 RICOH583_GPIO5,
83 RICOH583_GPIO6,
84 RICOH583_GPIO7,
85
86 RICOH583_NR_GPIO,
87};
88
89enum ricoh583_deepsleep_control_id {
90 RICOH583_DS_NONE,
91 RICOH583_DS_DC0,
92 RICOH583_DS_DC1,
93 RICOH583_DS_DC2,
94 RICOH583_DS_DC3,
95 RICOH583_DS_LDO0,
96 RICOH583_DS_LDO1,
97 RICOH583_DS_LDO2,
98 RICOH583_DS_LDO3,
99 RICOH583_DS_LDO4,
100 RICOH583_DS_LDO5,
101 RICOH583_DS_LDO6,
102 RICOH583_DS_LDO7,
103 RICOH583_DS_LDO8,
104 RICOH583_DS_LDO9,
105 RICOH583_DS_PSO0,
106 RICOH583_DS_PSO1,
107 RICOH583_DS_PSO2,
108 RICOH583_DS_PSO3,
109 RICOH583_DS_PSO4,
110 RICOH583_DS_PSO5,
111 RICOH583_DS_PSO6,
112 RICOH583_DS_PSO7,
113};
114enum ricoh583_ext_pwrreq_control {
115 RICOH583_EXT_PWRREQ1_CONTROL = 0x1,
116 RICOH583_EXT_PWRREQ2_CONTROL = 0x2,
117};
118
119struct ricoh583_subdev_info {
120 int id;
121 const char *name;
122 void *platform_data;
123};
124
125struct ricoh583_rtc_platform_data {
126 int irq;
127 struct rtc_time time;
128};
129
130struct ricoh583_gpio_init_data {
131 unsigned pulldn_en:1; /* Enable pull down */
132 unsigned output_mode_en:1; /* Enable output mode during init */
133 unsigned output_val:1; /* Output value if it is in output mode */
134 unsigned init_apply:1; /* Apply init data on configuring gpios*/
135};
136
137struct ricoh583_platform_data {
138 int num_subdevs;
139 struct ricoh583_subdev_info *subdevs;
140 int gpio_base;
141 int irq_base;
142
143 struct ricoh583_gpio_init_data *gpio_init_data;
144 int num_gpioinit_data;
145 bool enable_shutdown_pin;
146};
147
148extern int ricoh583_read(struct device *dev, uint8_t reg, uint8_t *val);
149extern int ricoh583_bulk_reads(struct device *dev, u8 reg, u8 count,
150 uint8_t *val);
151extern int ricoh583_write(struct device *dev, u8 reg, uint8_t val);
152extern int ricoh583_bulk_writes(struct device *dev, u8 reg, u8 count,
153 uint8_t *val);
154extern int ricoh583_set_bits(struct device *dev, u8 reg, uint8_t bit_mask);
155extern int ricoh583_clr_bits(struct device *dev, u8 reg, uint8_t bit_mask);
156extern int ricoh583_update(struct device *dev, u8 reg, uint8_t val,
157 uint8_t mask);
158extern int ricoh583_ext_power_req_config(struct device *dev,
159 enum ricoh583_deepsleep_control_id control_id,
160 enum ricoh583_ext_pwrreq_control ext_pwr_req,
161 int deepsleep_slot_nr);
162extern int ricoh583_power_off(void);
163
164#endif
diff --git a/include/linux/mfd/tps6591x.h b/include/linux/mfd/tps6591x.h
new file mode 100644
index 00000000000..d0d829fc8ab
--- /dev/null
+++ b/include/linux/mfd/tps6591x.h
@@ -0,0 +1,124 @@
1/*
2 * include/linux/mfd/tps6591x.c
3 * Core driver interface for TI TPS6591x PMIC family
4 *
5 * Copyright (C) 2011 NVIDIA Corporation
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef __LINUX_MFD_TPS6591X_H
24#define __LINUX_MFD_TPS6591X_H
25
26#include <linux/rtc.h>
27
28enum {
29 TPS6591X_INT_PWRHOLD_F,
30 TPS6591X_INT_VMBHI,
31 TPS6591X_INT_PWRON,
32 TPS6591X_INT_PWRON_LP,
33 TPS6591X_INT_PWRHOLD_R,
34 TPS6591X_INT_HOTDIE,
35 TPS6591X_INT_RTC_ALARM,
36 TPS6591X_INT_RTC_PERIOD,
37 TPS6591X_INT_GPIO0,
38 TPS6591X_INT_GPIO1,
39 TPS6591X_INT_GPIO2,
40 TPS6591X_INT_GPIO3,
41 TPS6591X_INT_GPIO4,
42 TPS6591X_INT_GPIO5,
43 TPS6591X_INT_WTCHDG,
44 TPS6591X_INT_VMBCH2_H,
45 TPS6591X_INT_VMBCH2_L,
46 TPS6591X_INT_PWRDN,
47
48 /* Last entry */
49 TPS6591X_INT_NR,
50};
51
52/* Gpio definitions */
53enum {
54 TPS6591X_GPIO_GP0 = 0,
55 TPS6591X_GPIO_GP1 = 1,
56 TPS6591X_GPIO_GP2 = 2,
57 TPS6591X_GPIO_GP3 = 3,
58 TPS6591X_GPIO_GP4 = 4,
59 TPS6591X_GPIO_GP5 = 5,
60 TPS6591X_GPIO_GP6 = 6,
61 TPS6591X_GPIO_GP7 = 7,
62 TPS6591X_GPIO_GP8 = 8,
63
64 /* Last entry */
65 TPS6591X_GPIO_NR,
66};
67
68struct tps6591x_subdev_info {
69 int id;
70 const char *name;
71 void *platform_data;
72};
73
74struct tps6591x_rtc_platform_data {
75 int irq;
76 struct rtc_time time;
77};
78
79struct tps6591x_sleep_keepon_data {
80 /* set 1 to maintain the following on sleep mode */
81 unsigned therm_keepon:1; /* themal monitoring */
82 unsigned clkout32k_keepon:1; /* CLK32KOUT */
83 unsigned vrtc_keepon:1; /* LD0 full load capability */
84 unsigned i2chs_keepon:1; /* high speed internal clock */
85};
86
87struct tps6591x_gpio_init_data {
88 unsigned sleep_en:1; /* Enable sleep mode */
89 unsigned pulldn_en:1; /* Enable pull down */
90 unsigned output_mode_en:1; /* Enable output mode during init */
91 unsigned output_val:1; /* Output value if it is in output mode */
92 unsigned init_apply:1; /* Apply init data on configuring gpios*/
93};
94
95struct tps6591x_platform_data {
96 int gpio_base;
97 int irq_base;
98
99 int num_subdevs;
100 struct tps6591x_subdev_info *subdevs;
101
102 bool dev_slp_en;
103 struct tps6591x_sleep_keepon_data *slp_keepon;
104
105 struct tps6591x_gpio_init_data *gpio_init_data;
106 int num_gpioinit_data;
107
108 bool use_power_off;
109};
110
111/*
112 * NOTE: the functions below are not intended for use outside
113 * of the TPS6591X sub-device drivers
114 */
115extern int tps6591x_write(struct device *dev, int reg, uint8_t val);
116extern int tps6591x_writes(struct device *dev, int reg, int len, uint8_t *val);
117extern int tps6591x_read(struct device *dev, int reg, uint8_t *val);
118extern int tps6591x_reads(struct device *dev, int reg, int len, uint8_t *val);
119extern int tps6591x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
120extern int tps6591x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
121extern int tps6591x_update(struct device *dev, int reg, uint8_t val,
122 uint8_t mask);
123
124#endif /*__LINUX_MFD_TPS6591X_H */