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