aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/mc13783.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mfd/mc13783.h')
-rw-r--r--include/linux/mfd/mc13783.h239
1 files changed, 98 insertions, 141 deletions
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index 0fa44fb8dd26..b4c741e352c2 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2009 Pengutronix 2 * Copyright 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> 3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it under 5 * This program is free software; you can redistribute it and/or modify it under
@@ -9,48 +9,83 @@
9#ifndef __LINUX_MFD_MC13783_H 9#ifndef __LINUX_MFD_MC13783_H
10#define __LINUX_MFD_MC13783_H 10#define __LINUX_MFD_MC13783_H
11 11
12#include <linux/interrupt.h> 12#include <linux/mfd/mc13xxx.h>
13 13
14struct mc13783; 14struct mc13783;
15 15
16void mc13783_lock(struct mc13783 *mc13783); 16struct mc13xxx *mc13783_to_mc13xxx(struct mc13783 *mc13783);
17void mc13783_unlock(struct mc13783 *mc13783);
18 17
19int mc13783_reg_read(struct mc13783 *mc13783, unsigned int offset, u32 *val); 18static inline void mc13783_lock(struct mc13783 *mc13783)
20int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val); 19{
21int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset, 20 mc13xxx_lock(mc13783_to_mc13xxx(mc13783));
22 u32 mask, u32 val); 21}
22
23static inline void mc13783_unlock(struct mc13783 *mc13783)
24{
25 mc13xxx_unlock(mc13783_to_mc13xxx(mc13783));
26}
27
28static inline int mc13783_reg_read(struct mc13783 *mc13783,
29 unsigned int offset, u32 *val)
30{
31 return mc13xxx_reg_read(mc13783_to_mc13xxx(mc13783), offset, val);
32}
33
34static inline int mc13783_reg_write(struct mc13783 *mc13783,
35 unsigned int offset, u32 val)
36{
37 return mc13xxx_reg_write(mc13783_to_mc13xxx(mc13783), offset, val);
38}
39
40static inline int mc13783_reg_rmw(struct mc13783 *mc13783,
41 unsigned int offset, u32 mask, u32 val)
42{
43 return mc13xxx_reg_rmw(mc13783_to_mc13xxx(mc13783), offset, mask, val);
44}
23 45
24int mc13783_get_flags(struct mc13783 *mc13783); 46static inline int mc13783_get_flags(struct mc13783 *mc13783)
47{
48 return mc13xxx_get_flags(mc13783_to_mc13xxx(mc13783));
49}
25 50
26int mc13783_irq_request(struct mc13783 *mc13783, int irq, 51static inline int mc13783_irq_request(struct mc13783 *mc13783, int irq,
27 irq_handler_t handler, const char *name, void *dev); 52 irq_handler_t handler, const char *name, void *dev)
28int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, 53{
29 irq_handler_t handler, const char *name, void *dev); 54 return mc13xxx_irq_request(mc13783_to_mc13xxx(mc13783), irq,
30int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev); 55 handler, name, dev);
56}
31 57
32int mc13783_irq_mask(struct mc13783 *mc13783, int irq); 58static inline int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq,
33int mc13783_irq_unmask(struct mc13783 *mc13783, int irq); 59 irq_handler_t handler, const char *name, void *dev)
34int mc13783_irq_status(struct mc13783 *mc13783, int irq, 60{
35 int *enabled, int *pending); 61 return mc13xxx_irq_request_nounmask(mc13783_to_mc13xxx(mc13783), irq,
36int mc13783_irq_ack(struct mc13783 *mc13783, int irq); 62 handler, name, dev);
63}
37 64
38static inline int mc13783_mask(struct mc13783 *mc13783, int irq) __deprecated; 65static inline int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev)
39static inline int mc13783_mask(struct mc13783 *mc13783, int irq)
40{ 66{
41 return mc13783_irq_mask(mc13783, irq); 67 return mc13xxx_irq_free(mc13783_to_mc13xxx(mc13783), irq, dev);
42} 68}
43 69
44static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) __deprecated; 70static inline int mc13783_irq_mask(struct mc13783 *mc13783, int irq)
45static inline int mc13783_unmask(struct mc13783 *mc13783, int irq)
46{ 71{
47 return mc13783_irq_unmask(mc13783, irq); 72 return mc13xxx_irq_mask(mc13783_to_mc13xxx(mc13783), irq);
48} 73}
49 74
50static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) __deprecated; 75static inline int mc13783_irq_unmask(struct mc13783 *mc13783, int irq)
51static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq)
52{ 76{
53 return mc13783_irq_ack(mc13783, irq); 77 return mc13xxx_irq_unmask(mc13783_to_mc13xxx(mc13783), irq);
78}
79static inline int mc13783_irq_status(struct mc13783 *mc13783, int irq,
80 int *enabled, int *pending)
81{
82 return mc13xxx_irq_status(mc13783_to_mc13xxx(mc13783),
83 irq, enabled, pending);
84}
85
86static inline int mc13783_irq_ack(struct mc13783 *mc13783, int irq)
87{
88 return mc13xxx_irq_ack(mc13783_to_mc13xxx(mc13783), irq);
54} 89}
55 90
56#define MC13783_ADC0 43 91#define MC13783_ADC0 43
@@ -66,96 +101,18 @@ static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq)
66 MC13783_ADC0_TSMOD1 | \ 101 MC13783_ADC0_TSMOD1 | \
67 MC13783_ADC0_TSMOD2) 102 MC13783_ADC0_TSMOD2)
68 103
69struct mc13783_led_platform_data { 104#define mc13783_regulator_init_data mc13xxx_regulator_init_data
70#define MC13783_LED_MD 0 105#define mc13783_regulator_platform_data mc13xxx_regulator_platform_data
71#define MC13783_LED_AD 1 106#define mc13783_led_platform_data mc13xxx_led_platform_data
72#define MC13783_LED_KP 2 107#define mc13783_leds_platform_data mc13xxx_leds_platform_data
73#define MC13783_LED_R1 3 108
74#define MC13783_LED_G1 4 109#define mc13783_platform_data mc13xxx_platform_data
75#define MC13783_LED_B1 5 110#define MC13783_USE_TOUCHSCREEN MC13XXX_USE_TOUCHSCREEN
76#define MC13783_LED_R2 6 111#define MC13783_USE_CODEC MC13XXX_USE_CODEC
77#define MC13783_LED_G2 7 112#define MC13783_USE_ADC MC13XXX_USE_ADC
78#define MC13783_LED_B2 8 113#define MC13783_USE_RTC MC13XXX_USE_RTC
79#define MC13783_LED_R3 9 114#define MC13783_USE_REGULATOR MC13XXX_USE_REGULATOR
80#define MC13783_LED_G3 10 115#define MC13783_USE_LED MC13XXX_USE_LED
81#define MC13783_LED_B3 11
82#define MC13783_LED_MAX MC13783_LED_B3
83 int id;
84 const char *name;
85 const char *default_trigger;
86
87/* Three or two bits current selection depending on the led */
88 char max_current;
89};
90
91struct mc13783_leds_platform_data {
92 int num_leds;
93 struct mc13783_led_platform_data *led;
94
95#define MC13783_LED_TRIODE_MD (1 << 0)
96#define MC13783_LED_TRIODE_AD (1 << 1)
97#define MC13783_LED_TRIODE_KP (1 << 2)
98#define MC13783_LED_BOOST_EN (1 << 3)
99#define MC13783_LED_TC1HALF (1 << 4)
100#define MC13783_LED_SLEWLIMTC (1 << 5)
101#define MC13783_LED_SLEWLIMBL (1 << 6)
102#define MC13783_LED_TRIODE_TC1 (1 << 7)
103#define MC13783_LED_TRIODE_TC2 (1 << 8)
104#define MC13783_LED_TRIODE_TC3 (1 << 9)
105 int flags;
106
107#define MC13783_LED_AB_DISABLED 0
108#define MC13783_LED_AB_MD1 1
109#define MC13783_LED_AB_MD12 2
110#define MC13783_LED_AB_MD123 3
111#define MC13783_LED_AB_MD1234 4
112#define MC13783_LED_AB_MD1234_AD1 5
113#define MC13783_LED_AB_MD1234_AD12 6
114#define MC13783_LED_AB_MD1_AD 7
115 char abmode;
116
117#define MC13783_LED_ABREF_200MV 0
118#define MC13783_LED_ABREF_400MV 1
119#define MC13783_LED_ABREF_600MV 2
120#define MC13783_LED_ABREF_800MV 3
121 char abref;
122
123#define MC13783_LED_PERIOD_10MS 0
124#define MC13783_LED_PERIOD_100MS 1
125#define MC13783_LED_PERIOD_500MS 2
126#define MC13783_LED_PERIOD_2S 3
127 char bl_period;
128 char tc1_period;
129 char tc2_period;
130 char tc3_period;
131};
132
133/* to be cleaned up */
134struct regulator_init_data;
135
136struct mc13783_regulator_init_data {
137 int id;
138 struct regulator_init_data *init_data;
139};
140
141struct mc13783_regulator_platform_data {
142 int num_regulators;
143 struct mc13783_regulator_init_data *regulators;
144};
145
146struct mc13783_platform_data {
147 int num_regulators;
148 struct mc13783_regulator_init_data *regulators;
149 struct mc13783_leds_platform_data *leds;
150
151#define MC13783_USE_TOUCHSCREEN (1 << 0)
152#define MC13783_USE_CODEC (1 << 1)
153#define MC13783_USE_ADC (1 << 2)
154#define MC13783_USE_RTC (1 << 3)
155#define MC13783_USE_REGULATOR (1 << 4)
156#define MC13783_USE_LED (1 << 5)
157 unsigned int flags;
158};
159 116
160#define MC13783_ADC_MODE_TS 1 117#define MC13783_ADC_MODE_TS 1
161#define MC13783_ADC_MODE_SINGLE_CHAN 2 118#define MC13783_ADC_MODE_SINGLE_CHAN 2
@@ -199,46 +156,46 @@ int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
199#define MC13783_REGU_PWGT1SPI 31 156#define MC13783_REGU_PWGT1SPI 31
200#define MC13783_REGU_PWGT2SPI 32 157#define MC13783_REGU_PWGT2SPI 32
201 158
202#define MC13783_IRQ_ADCDONE 0 159#define MC13783_IRQ_ADCDONE MC13XXX_IRQ_ADCDONE
203#define MC13783_IRQ_ADCBISDONE 1 160#define MC13783_IRQ_ADCBISDONE MC13XXX_IRQ_ADCBISDONE
204#define MC13783_IRQ_TS 2 161#define MC13783_IRQ_TS MC13XXX_IRQ_TS
205#define MC13783_IRQ_WHIGH 3 162#define MC13783_IRQ_WHIGH 3
206#define MC13783_IRQ_WLOW 4 163#define MC13783_IRQ_WLOW 4
207#define MC13783_IRQ_CHGDET 6 164#define MC13783_IRQ_CHGDET MC13XXX_IRQ_CHGDET
208#define MC13783_IRQ_CHGOV 7 165#define MC13783_IRQ_CHGOV 7
209#define MC13783_IRQ_CHGREV 8 166#define MC13783_IRQ_CHGREV MC13XXX_IRQ_CHGREV
210#define MC13783_IRQ_CHGSHORT 9 167#define MC13783_IRQ_CHGSHORT MC13XXX_IRQ_CHGSHORT
211#define MC13783_IRQ_CCCV 10 168#define MC13783_IRQ_CCCV MC13XXX_IRQ_CCCV
212#define MC13783_IRQ_CHGCURR 11 169#define MC13783_IRQ_CHGCURR MC13XXX_IRQ_CHGCURR
213#define MC13783_IRQ_BPON 12 170#define MC13783_IRQ_BPON MC13XXX_IRQ_BPON
214#define MC13783_IRQ_LOBATL 13 171#define MC13783_IRQ_LOBATL MC13XXX_IRQ_LOBATL
215#define MC13783_IRQ_LOBATH 14 172#define MC13783_IRQ_LOBATH MC13XXX_IRQ_LOBATH
216#define MC13783_IRQ_UDP 15 173#define MC13783_IRQ_UDP 15
217#define MC13783_IRQ_USB 16 174#define MC13783_IRQ_USB 16
218#define MC13783_IRQ_ID 19 175#define MC13783_IRQ_ID 19
219#define MC13783_IRQ_SE1 21 176#define MC13783_IRQ_SE1 21
220#define MC13783_IRQ_CKDET 22 177#define MC13783_IRQ_CKDET 22
221#define MC13783_IRQ_UDM 23 178#define MC13783_IRQ_UDM 23
222#define MC13783_IRQ_1HZ 24 179#define MC13783_IRQ_1HZ MC13XXX_IRQ_1HZ
223#define MC13783_IRQ_TODA 25 180#define MC13783_IRQ_TODA MC13XXX_IRQ_TODA
224#define MC13783_IRQ_ONOFD1 27 181#define MC13783_IRQ_ONOFD1 27
225#define MC13783_IRQ_ONOFD2 28 182#define MC13783_IRQ_ONOFD2 28
226#define MC13783_IRQ_ONOFD3 29 183#define MC13783_IRQ_ONOFD3 29
227#define MC13783_IRQ_SYSRST 30 184#define MC13783_IRQ_SYSRST MC13XXX_IRQ_SYSRST
228#define MC13783_IRQ_RTCRST 31 185#define MC13783_IRQ_RTCRST MC13XXX_IRQ_RTCRST
229#define MC13783_IRQ_PC 32 186#define MC13783_IRQ_PC MC13XXX_IRQ_PC
230#define MC13783_IRQ_WARM 33 187#define MC13783_IRQ_WARM MC13XXX_IRQ_WARM
231#define MC13783_IRQ_MEMHLD 34 188#define MC13783_IRQ_MEMHLD MC13XXX_IRQ_MEMHLD
232#define MC13783_IRQ_PWRRDY 35 189#define MC13783_IRQ_PWRRDY 35
233#define MC13783_IRQ_THWARNL 36 190#define MC13783_IRQ_THWARNL MC13XXX_IRQ_THWARNL
234#define MC13783_IRQ_THWARNH 37 191#define MC13783_IRQ_THWARNH MC13XXX_IRQ_THWARNH
235#define MC13783_IRQ_CLK 38 192#define MC13783_IRQ_CLK MC13XXX_IRQ_CLK
236#define MC13783_IRQ_SEMAF 39 193#define MC13783_IRQ_SEMAF 39
237#define MC13783_IRQ_MC2B 41 194#define MC13783_IRQ_MC2B 41
238#define MC13783_IRQ_HSDET 42 195#define MC13783_IRQ_HSDET 42
239#define MC13783_IRQ_HSL 43 196#define MC13783_IRQ_HSL 43
240#define MC13783_IRQ_ALSPTH 44 197#define MC13783_IRQ_ALSPTH 44
241#define MC13783_IRQ_AHSSHORT 45 198#define MC13783_IRQ_AHSSHORT 45
242#define MC13783_NUM_IRQ 46 199#define MC13783_NUM_IRQ MC13XXX_NUM_IRQ
243 200
244#endif /* __LINUX_MFD_MC13783_H */ 201#endif /* ifndef __LINUX_MFD_MC13783_H */