| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 1 | /* | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 2 | * Copyright 2009 Pengutronix | 
|  | 3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 4 | * | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 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. | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 8 | */ | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 9 | #ifndef __LINUX_MFD_MC13783_H | 
|  | 10 | #define __LINUX_MFD_MC13783_H | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 11 |  | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 12 | #include <linux/interrupt.h> | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 13 |  | 
|  | 14 | struct mc13783; | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 15 |  | 
|  | 16 | void mc13783_lock(struct mc13783 *mc13783); | 
|  | 17 | void mc13783_unlock(struct mc13783 *mc13783); | 
|  | 18 |  | 
|  | 19 | int mc13783_reg_read(struct mc13783 *mc13783, unsigned int offset, u32 *val); | 
|  | 20 | int mc13783_reg_write(struct mc13783 *mc13783, unsigned int offset, u32 val); | 
|  | 21 | int mc13783_reg_rmw(struct mc13783 *mc13783, unsigned int offset, | 
|  | 22 | u32 mask, u32 val); | 
|  | 23 |  | 
|  | 24 | int mc13783_irq_request(struct mc13783 *mc13783, int irq, | 
|  | 25 | irq_handler_t handler, const char *name, void *dev); | 
|  | 26 | int mc13783_irq_request_nounmask(struct mc13783 *mc13783, int irq, | 
|  | 27 | irq_handler_t handler, const char *name, void *dev); | 
|  | 28 | int mc13783_irq_free(struct mc13783 *mc13783, int irq, void *dev); | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 29 |  | 
| Uwe Kleine-König | 5720502 | 2010-03-05 13:44:25 -0800 | [diff] [blame] | 30 | int mc13783_irq_mask(struct mc13783 *mc13783, int irq); | 
|  | 31 | int mc13783_irq_unmask(struct mc13783 *mc13783, int irq); | 
| Uwe Kleine-König | 86c3400 | 2010-03-05 13:44:29 -0800 | [diff] [blame] | 32 | int mc13783_irq_status(struct mc13783 *mc13783, int irq, | 
|  | 33 | int *enabled, int *pending); | 
| Uwe Kleine-König | 5720502 | 2010-03-05 13:44:25 -0800 | [diff] [blame] | 34 | int mc13783_irq_ack(struct mc13783 *mc13783, int irq); | 
|  | 35 |  | 
|  | 36 | static inline int mc13783_mask(struct mc13783 *mc13783, int irq) __deprecated; | 
|  | 37 | static inline int mc13783_mask(struct mc13783 *mc13783, int irq) | 
|  | 38 | { | 
|  | 39 | return mc13783_irq_mask(mc13783, irq); | 
|  | 40 | } | 
|  | 41 |  | 
|  | 42 | static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) __deprecated; | 
|  | 43 | static inline int mc13783_unmask(struct mc13783 *mc13783, int irq) | 
|  | 44 | { | 
|  | 45 | return mc13783_irq_unmask(mc13783, irq); | 
|  | 46 | } | 
|  | 47 |  | 
|  | 48 | static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) __deprecated; | 
|  | 49 | static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) | 
|  | 50 | { | 
|  | 51 | return mc13783_irq_ack(mc13783, irq); | 
|  | 52 | } | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 53 |  | 
|  | 54 | #define MC13783_ADC0		43 | 
|  | 55 | #define MC13783_ADC0_ADREFEN		(1 << 10) | 
|  | 56 | #define MC13783_ADC0_ADREFMODE		(1 << 11) | 
|  | 57 | #define MC13783_ADC0_TSMOD0		(1 << 12) | 
|  | 58 | #define MC13783_ADC0_TSMOD1		(1 << 13) | 
|  | 59 | #define MC13783_ADC0_TSMOD2		(1 << 14) | 
|  | 60 | #define MC13783_ADC0_ADINC1		(1 << 16) | 
|  | 61 | #define MC13783_ADC0_ADINC2		(1 << 17) | 
|  | 62 |  | 
|  | 63 | #define MC13783_ADC0_TSMOD_MASK		(MC13783_ADC0_TSMOD0 | \ | 
|  | 64 | MC13783_ADC0_TSMOD1 | \ | 
|  | 65 | MC13783_ADC0_TSMOD2) | 
|  | 66 |  | 
| Philippe Rétornaz | 7fdcef8 | 2010-05-19 09:24:31 +0200 | [diff] [blame] | 67 | struct mc13783_led_platform_data { | 
|  | 68 | #define MC13783_LED_MD		0 | 
|  | 69 | #define MC13783_LED_AD		1 | 
|  | 70 | #define MC13783_LED_KP		2 | 
|  | 71 | #define MC13783_LED_R1		3 | 
|  | 72 | #define MC13783_LED_G1		4 | 
|  | 73 | #define MC13783_LED_B1		5 | 
|  | 74 | #define MC13783_LED_R2		6 | 
|  | 75 | #define MC13783_LED_G2		7 | 
|  | 76 | #define MC13783_LED_B2		8 | 
|  | 77 | #define MC13783_LED_R3		9 | 
|  | 78 | #define MC13783_LED_G3		10 | 
|  | 79 | #define MC13783_LED_B3		11 | 
|  | 80 | #define MC13783_LED_MAX MC13783_LED_B3 | 
|  | 81 | int id; | 
|  | 82 | const char *name; | 
|  | 83 | const char *default_trigger; | 
|  | 84 |  | 
|  | 85 | /* Three or two bits current selection depending on the led */ | 
|  | 86 | char max_current; | 
|  | 87 | }; | 
|  | 88 |  | 
|  | 89 | struct mc13783_leds_platform_data { | 
|  | 90 | int num_leds; | 
|  | 91 | struct mc13783_led_platform_data *led; | 
|  | 92 |  | 
|  | 93 | #define MC13783_LED_TRIODE_MD	(1 << 0) | 
|  | 94 | #define MC13783_LED_TRIODE_AD	(1 << 1) | 
|  | 95 | #define MC13783_LED_TRIODE_KP	(1 << 2) | 
|  | 96 | #define MC13783_LED_BOOST_EN	(1 << 3) | 
|  | 97 | #define MC13783_LED_TC1HALF	(1 << 4) | 
|  | 98 | #define MC13783_LED_SLEWLIMTC	(1 << 5) | 
|  | 99 | #define MC13783_LED_SLEWLIMBL	(1 << 6) | 
|  | 100 | #define MC13783_LED_TRIODE_TC1	(1 << 7) | 
|  | 101 | #define MC13783_LED_TRIODE_TC2	(1 << 8) | 
|  | 102 | #define MC13783_LED_TRIODE_TC3	(1 << 9) | 
|  | 103 | int flags; | 
|  | 104 |  | 
|  | 105 | #define MC13783_LED_AB_DISABLED		0 | 
|  | 106 | #define MC13783_LED_AB_MD1		1 | 
|  | 107 | #define MC13783_LED_AB_MD12		2 | 
|  | 108 | #define MC13783_LED_AB_MD123		3 | 
|  | 109 | #define MC13783_LED_AB_MD1234		4 | 
|  | 110 | #define MC13783_LED_AB_MD1234_AD1	5 | 
|  | 111 | #define MC13783_LED_AB_MD1234_AD12	6 | 
|  | 112 | #define MC13783_LED_AB_MD1_AD		7 | 
|  | 113 | char abmode; | 
|  | 114 |  | 
|  | 115 | #define MC13783_LED_ABREF_200MV	0 | 
|  | 116 | #define MC13783_LED_ABREF_400MV	1 | 
|  | 117 | #define MC13783_LED_ABREF_600MV	2 | 
|  | 118 | #define MC13783_LED_ABREF_800MV	3 | 
|  | 119 | char abref; | 
|  | 120 |  | 
|  | 121 | #define MC13783_LED_PERIOD_10MS		0 | 
|  | 122 | #define MC13783_LED_PERIOD_100MS	1 | 
|  | 123 | #define MC13783_LED_PERIOD_500MS	2 | 
|  | 124 | #define MC13783_LED_PERIOD_2S		3 | 
|  | 125 | char bl_period; | 
|  | 126 | char tc1_period; | 
|  | 127 | char tc2_period; | 
|  | 128 | char tc3_period; | 
|  | 129 | }; | 
|  | 130 |  | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 131 | /* to be cleaned up */ | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 132 | struct regulator_init_data; | 
|  | 133 |  | 
|  | 134 | struct mc13783_regulator_init_data { | 
|  | 135 | int id; | 
|  | 136 | struct regulator_init_data *init_data; | 
|  | 137 | }; | 
|  | 138 |  | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 139 | struct mc13783_regulator_platform_data { | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 140 | int num_regulators; | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 141 | struct mc13783_regulator_init_data *regulators; | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 142 | }; | 
|  | 143 |  | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 144 | struct mc13783_platform_data { | 
|  | 145 | int num_regulators; | 
|  | 146 | struct mc13783_regulator_init_data *regulators; | 
| Philippe Rétornaz | 7fdcef8 | 2010-05-19 09:24:31 +0200 | [diff] [blame] | 147 | struct mc13783_leds_platform_data *leds; | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 148 |  | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 149 | #define MC13783_USE_TOUCHSCREEN (1 << 0) | 
|  | 150 | #define MC13783_USE_CODEC	(1 << 1) | 
|  | 151 | #define MC13783_USE_ADC		(1 << 2) | 
|  | 152 | #define MC13783_USE_RTC		(1 << 3) | 
|  | 153 | #define MC13783_USE_REGULATOR	(1 << 4) | 
| Philippe Rétornaz | 7fdcef8 | 2010-05-19 09:24:31 +0200 | [diff] [blame] | 154 | #define MC13783_USE_LED		(1 << 5) | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 155 | unsigned int flags; | 
|  | 156 | }; | 
|  | 157 |  | 
|  | 158 | #define MC13783_ADC_MODE_TS		1 | 
|  | 159 | #define MC13783_ADC_MODE_SINGLE_CHAN	2 | 
|  | 160 | #define MC13783_ADC_MODE_MULT_CHAN	3 | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 161 |  | 
|  | 162 | int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode, | 
|  | 163 | unsigned int channel, unsigned int *sample); | 
|  | 164 |  | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 165 |  | 
|  | 166 | #define	MC13783_SW_SW1A		0 | 
|  | 167 | #define	MC13783_SW_SW1B		1 | 
|  | 168 | #define	MC13783_SW_SW2A		2 | 
|  | 169 | #define	MC13783_SW_SW2B		3 | 
|  | 170 | #define	MC13783_SW_SW3		4 | 
|  | 171 | #define	MC13783_SW_PLL		5 | 
|  | 172 | #define	MC13783_REGU_VAUDIO	6 | 
|  | 173 | #define	MC13783_REGU_VIOHI	7 | 
|  | 174 | #define	MC13783_REGU_VIOLO	8 | 
|  | 175 | #define	MC13783_REGU_VDIG	9 | 
|  | 176 | #define	MC13783_REGU_VGEN	10 | 
|  | 177 | #define	MC13783_REGU_VRFDIG	11 | 
|  | 178 | #define	MC13783_REGU_VRFREF	12 | 
|  | 179 | #define	MC13783_REGU_VRFCP	13 | 
|  | 180 | #define	MC13783_REGU_VSIM	14 | 
|  | 181 | #define	MC13783_REGU_VESIM	15 | 
|  | 182 | #define	MC13783_REGU_VCAM	16 | 
|  | 183 | #define	MC13783_REGU_VRFBG	17 | 
|  | 184 | #define	MC13783_REGU_VVIB	18 | 
|  | 185 | #define	MC13783_REGU_VRF1	19 | 
|  | 186 | #define	MC13783_REGU_VRF2	20 | 
|  | 187 | #define	MC13783_REGU_VMMC1	21 | 
|  | 188 | #define	MC13783_REGU_VMMC2	22 | 
|  | 189 | #define	MC13783_REGU_GPO1	23 | 
|  | 190 | #define	MC13783_REGU_GPO2	24 | 
|  | 191 | #define	MC13783_REGU_GPO3	25 | 
|  | 192 | #define	MC13783_REGU_GPO4	26 | 
|  | 193 | #define	MC13783_REGU_V1		27 | 
|  | 194 | #define	MC13783_REGU_V2		28 | 
|  | 195 | #define	MC13783_REGU_V3		29 | 
|  | 196 | #define	MC13783_REGU_V4		30 | 
| Alberto Panizzo | f4b97b3 | 2010-01-19 12:48:54 +0100 | [diff] [blame] | 197 | #define	MC13783_REGU_PWGT1SPI	31 | 
|  | 198 | #define	MC13783_REGU_PWGT2SPI	32 | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 199 |  | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 200 | #define MC13783_IRQ_ADCDONE	0 | 
|  | 201 | #define MC13783_IRQ_ADCBISDONE	1 | 
|  | 202 | #define MC13783_IRQ_TS		2 | 
|  | 203 | #define MC13783_IRQ_WHIGH	3 | 
|  | 204 | #define MC13783_IRQ_WLOW	4 | 
|  | 205 | #define MC13783_IRQ_CHGDET	6 | 
|  | 206 | #define MC13783_IRQ_CHGOV	7 | 
|  | 207 | #define MC13783_IRQ_CHGREV	8 | 
|  | 208 | #define MC13783_IRQ_CHGSHORT	9 | 
|  | 209 | #define MC13783_IRQ_CCCV	10 | 
|  | 210 | #define MC13783_IRQ_CHGCURR	11 | 
|  | 211 | #define MC13783_IRQ_BPON	12 | 
|  | 212 | #define MC13783_IRQ_LOBATL	13 | 
|  | 213 | #define MC13783_IRQ_LOBATH	14 | 
|  | 214 | #define MC13783_IRQ_UDP		15 | 
|  | 215 | #define MC13783_IRQ_USB		16 | 
|  | 216 | #define MC13783_IRQ_ID		19 | 
|  | 217 | #define MC13783_IRQ_SE1		21 | 
|  | 218 | #define MC13783_IRQ_CKDET	22 | 
|  | 219 | #define MC13783_IRQ_UDM		23 | 
|  | 220 | #define MC13783_IRQ_1HZ		24 | 
|  | 221 | #define MC13783_IRQ_TODA	25 | 
|  | 222 | #define MC13783_IRQ_ONOFD1	27 | 
|  | 223 | #define MC13783_IRQ_ONOFD2	28 | 
|  | 224 | #define MC13783_IRQ_ONOFD3	29 | 
|  | 225 | #define MC13783_IRQ_SYSRST	30 | 
|  | 226 | #define MC13783_IRQ_RTCRST	31 | 
|  | 227 | #define MC13783_IRQ_PC		32 | 
|  | 228 | #define MC13783_IRQ_WARM	33 | 
|  | 229 | #define MC13783_IRQ_MEMHLD	34 | 
|  | 230 | #define MC13783_IRQ_PWRRDY	35 | 
|  | 231 | #define MC13783_IRQ_THWARNL	36 | 
|  | 232 | #define MC13783_IRQ_THWARNH	37 | 
|  | 233 | #define MC13783_IRQ_CLK		38 | 
|  | 234 | #define MC13783_IRQ_SEMAF	39 | 
|  | 235 | #define MC13783_IRQ_MC2B	41 | 
|  | 236 | #define MC13783_IRQ_HSDET	42 | 
|  | 237 | #define MC13783_IRQ_HSL		43 | 
|  | 238 | #define MC13783_IRQ_ALSPTH	44 | 
|  | 239 | #define MC13783_IRQ_AHSSHORT	45 | 
|  | 240 | #define MC13783_NUM_IRQ		46 | 
| Sascha Hauer | 8238add | 2009-08-19 01:40:28 +0200 | [diff] [blame] | 241 |  | 
| Uwe Kleine-König | 9e27267 | 2009-11-30 00:53:17 +0100 | [diff] [blame] | 242 | #endif /* __LINUX_MFD_MC13783_H */ |