Merge remote-tracking branch 'selinux/next'
[deliverable/linux.git] / include / linux / mfd / axp20x.h
CommitLineData
cfb61a41
CC
1/*
2 * Functions and registers to access AXP20X power management chip.
3 *
4 * Copyright (C) 2013, Carlo Caione <carlo@caione.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_MFD_AXP20X_H
12#define __LINUX_MFD_AXP20X_H
13
69fb4dca
HG
14#include <linux/regmap.h>
15
cfb61a41 16enum {
d8d79f8f
MS
17 AXP152_ID = 0,
18 AXP202_ID,
cfb61a41 19 AXP209_ID,
f05be589 20 AXP221_ID,
02071f0f 21 AXP223_ID,
af7e9069 22 AXP288_ID,
95f3d817 23 AXP806_ID,
20147f0d 24 AXP809_ID,
af7e9069 25 NR_AXP20X_VARIANTS,
cfb61a41
CC
26};
27
28#define AXP20X_DATACACHE(m) (0x04 + (m))
29
30/* Power supply */
d8d79f8f
MS
31#define AXP152_PWR_OP_MODE 0x01
32#define AXP152_LDO3456_DC1234_CTRL 0x12
33#define AXP152_ALDO_OP_MODE 0x13
34#define AXP152_LDO0_CTRL 0x15
35#define AXP152_DCDC2_V_OUT 0x23
36#define AXP152_DCDC2_V_SCAL 0x25
37#define AXP152_DCDC1_V_OUT 0x26
38#define AXP152_DCDC3_V_OUT 0x27
39#define AXP152_ALDO12_V_OUT 0x28
40#define AXP152_DLDO1_V_OUT 0x29
41#define AXP152_DLDO2_V_OUT 0x2a
42#define AXP152_DCDC4_V_OUT 0x2b
43#define AXP152_V_OFF 0x31
44#define AXP152_OFF_CTRL 0x32
45#define AXP152_PEK_KEY 0x36
46#define AXP152_DCDC_FREQ 0x37
47#define AXP152_DCDC_MODE 0x80
48
cfb61a41
CC
49#define AXP20X_PWR_INPUT_STATUS 0x00
50#define AXP20X_PWR_OP_MODE 0x01
51#define AXP20X_USB_OTG_STATUS 0x02
52#define AXP20X_PWR_OUT_CTRL 0x12
53#define AXP20X_DCDC2_V_OUT 0x23
54#define AXP20X_DCDC2_LDO3_V_SCAL 0x25
55#define AXP20X_DCDC3_V_OUT 0x27
56#define AXP20X_LDO24_V_OUT 0x28
57#define AXP20X_LDO3_V_OUT 0x29
58#define AXP20X_VBUS_IPSOUT_MGMT 0x30
59#define AXP20X_V_OFF 0x31
60#define AXP20X_OFF_CTRL 0x32
61#define AXP20X_CHRG_CTRL1 0x33
62#define AXP20X_CHRG_CTRL2 0x34
63#define AXP20X_CHRG_BAK_CTRL 0x35
64#define AXP20X_PEK_KEY 0x36
65#define AXP20X_DCDC_FREQ 0x37
66#define AXP20X_V_LTF_CHRG 0x38
67#define AXP20X_V_HTF_CHRG 0x39
68#define AXP20X_APS_WARN_L1 0x3a
69#define AXP20X_APS_WARN_L2 0x3b
70#define AXP20X_V_LTF_DISCHRG 0x3c
71#define AXP20X_V_HTF_DISCHRG 0x3d
72
f05be589
BB
73#define AXP22X_PWR_OUT_CTRL1 0x10
74#define AXP22X_PWR_OUT_CTRL2 0x12
75#define AXP22X_PWR_OUT_CTRL3 0x13
76#define AXP22X_DLDO1_V_OUT 0x15
77#define AXP22X_DLDO2_V_OUT 0x16
78#define AXP22X_DLDO3_V_OUT 0x17
79#define AXP22X_DLDO4_V_OUT 0x18
80#define AXP22X_ELDO1_V_OUT 0x19
81#define AXP22X_ELDO2_V_OUT 0x1a
82#define AXP22X_ELDO3_V_OUT 0x1b
83#define AXP22X_DC5LDO_V_OUT 0x1c
84#define AXP22X_DCDC1_V_OUT 0x21
85#define AXP22X_DCDC2_V_OUT 0x22
86#define AXP22X_DCDC3_V_OUT 0x23
87#define AXP22X_DCDC4_V_OUT 0x24
88#define AXP22X_DCDC5_V_OUT 0x25
89#define AXP22X_DCDC23_V_RAMP_CTRL 0x27
90#define AXP22X_ALDO1_V_OUT 0x28
91#define AXP22X_ALDO2_V_OUT 0x29
92#define AXP22X_ALDO3_V_OUT 0x2a
93#define AXP22X_CHRG_CTRL3 0x35
94
95f3d817
CYT
95#define AXP806_STARTUP_SRC 0x00
96#define AXP806_CHIP_ID 0x03
97#define AXP806_PWR_OUT_CTRL1 0x10
98#define AXP806_PWR_OUT_CTRL2 0x11
99#define AXP806_DCDCA_V_CTRL 0x12
100#define AXP806_DCDCB_V_CTRL 0x13
101#define AXP806_DCDCC_V_CTRL 0x14
102#define AXP806_DCDCD_V_CTRL 0x15
103#define AXP806_DCDCE_V_CTRL 0x16
104#define AXP806_ALDO1_V_CTRL 0x17
105#define AXP806_ALDO2_V_CTRL 0x18
106#define AXP806_ALDO3_V_CTRL 0x19
107#define AXP806_DCDC_MODE_CTRL1 0x1a
108#define AXP806_DCDC_MODE_CTRL2 0x1b
109#define AXP806_DCDC_FREQ_CTRL 0x1c
110#define AXP806_BLDO1_V_CTRL 0x20
111#define AXP806_BLDO2_V_CTRL 0x21
112#define AXP806_BLDO3_V_CTRL 0x22
113#define AXP806_BLDO4_V_CTRL 0x23
114#define AXP806_CLDO1_V_CTRL 0x24
115#define AXP806_CLDO2_V_CTRL 0x25
116#define AXP806_CLDO3_V_CTRL 0x26
117#define AXP806_VREF_TEMP_WARN_L 0xf3
118
cfb61a41 119/* Interrupt */
d8d79f8f
MS
120#define AXP152_IRQ1_EN 0x40
121#define AXP152_IRQ2_EN 0x41
122#define AXP152_IRQ3_EN 0x42
123#define AXP152_IRQ1_STATE 0x48
124#define AXP152_IRQ2_STATE 0x49
125#define AXP152_IRQ3_STATE 0x4a
126
cfb61a41
CC
127#define AXP20X_IRQ1_EN 0x40
128#define AXP20X_IRQ2_EN 0x41
129#define AXP20X_IRQ3_EN 0x42
130#define AXP20X_IRQ4_EN 0x43
131#define AXP20X_IRQ5_EN 0x44
af7e9069 132#define AXP20X_IRQ6_EN 0x45
cfb61a41
CC
133#define AXP20X_IRQ1_STATE 0x48
134#define AXP20X_IRQ2_STATE 0x49
135#define AXP20X_IRQ3_STATE 0x4a
136#define AXP20X_IRQ4_STATE 0x4b
137#define AXP20X_IRQ5_STATE 0x4c
af7e9069 138#define AXP20X_IRQ6_STATE 0x4d
cfb61a41
CC
139
140/* ADC */
141#define AXP20X_ACIN_V_ADC_H 0x56
142#define AXP20X_ACIN_V_ADC_L 0x57
143#define AXP20X_ACIN_I_ADC_H 0x58
144#define AXP20X_ACIN_I_ADC_L 0x59
145#define AXP20X_VBUS_V_ADC_H 0x5a
146#define AXP20X_VBUS_V_ADC_L 0x5b
147#define AXP20X_VBUS_I_ADC_H 0x5c
148#define AXP20X_VBUS_I_ADC_L 0x5d
149#define AXP20X_TEMP_ADC_H 0x5e
150#define AXP20X_TEMP_ADC_L 0x5f
151#define AXP20X_TS_IN_H 0x62
152#define AXP20X_TS_IN_L 0x63
153#define AXP20X_GPIO0_V_ADC_H 0x64
154#define AXP20X_GPIO0_V_ADC_L 0x65
155#define AXP20X_GPIO1_V_ADC_H 0x66
156#define AXP20X_GPIO1_V_ADC_L 0x67
157#define AXP20X_PWR_BATT_H 0x70
158#define AXP20X_PWR_BATT_M 0x71
159#define AXP20X_PWR_BATT_L 0x72
160#define AXP20X_BATT_V_H 0x78
161#define AXP20X_BATT_V_L 0x79
162#define AXP20X_BATT_CHRG_I_H 0x7a
163#define AXP20X_BATT_CHRG_I_L 0x7b
164#define AXP20X_BATT_DISCHRG_I_H 0x7c
165#define AXP20X_BATT_DISCHRG_I_L 0x7d
166#define AXP20X_IPSOUT_V_HIGH_H 0x7e
167#define AXP20X_IPSOUT_V_HIGH_L 0x7f
168
169/* Power supply */
170#define AXP20X_DCDC_MODE 0x80
171#define AXP20X_ADC_EN1 0x82
172#define AXP20X_ADC_EN2 0x83
173#define AXP20X_ADC_RATE 0x84
174#define AXP20X_GPIO10_IN_RANGE 0x85
175#define AXP20X_GPIO1_ADC_IRQ_RIS 0x86
176#define AXP20X_GPIO1_ADC_IRQ_FAL 0x87
177#define AXP20X_TIMER_CTRL 0x8a
178#define AXP20X_VBUS_MON 0x8b
179#define AXP20X_OVER_TMP 0x8f
180
f05be589
BB
181#define AXP22X_PWREN_CTRL1 0x8c
182#define AXP22X_PWREN_CTRL2 0x8d
183
cfb61a41 184/* GPIO */
d8d79f8f
MS
185#define AXP152_GPIO0_CTRL 0x90
186#define AXP152_GPIO1_CTRL 0x91
187#define AXP152_GPIO2_CTRL 0x92
188#define AXP152_GPIO3_CTRL 0x93
189#define AXP152_LDOGPIO2_V_OUT 0x96
190#define AXP152_GPIO_INPUT 0x97
191#define AXP152_PWM0_FREQ_X 0x98
192#define AXP152_PWM0_FREQ_Y 0x99
193#define AXP152_PWM0_DUTY_CYCLE 0x9a
194#define AXP152_PWM1_FREQ_X 0x9b
195#define AXP152_PWM1_FREQ_Y 0x9c
196#define AXP152_PWM1_DUTY_CYCLE 0x9d
197
cfb61a41
CC
198#define AXP20X_GPIO0_CTRL 0x90
199#define AXP20X_LDO5_V_OUT 0x91
200#define AXP20X_GPIO1_CTRL 0x92
201#define AXP20X_GPIO2_CTRL 0x93
202#define AXP20X_GPIO20_SS 0x94
203#define AXP20X_GPIO3_CTRL 0x95
204
f05be589
BB
205#define AXP22X_LDO_IO0_V_OUT 0x91
206#define AXP22X_LDO_IO1_V_OUT 0x93
207#define AXP22X_GPIO_STATE 0x94
208#define AXP22X_GPIO_PULL_DOWN 0x95
209
cfb61a41
CC
210/* Battery */
211#define AXP20X_CHRG_CC_31_24 0xb0
212#define AXP20X_CHRG_CC_23_16 0xb1
213#define AXP20X_CHRG_CC_15_8 0xb2
214#define AXP20X_CHRG_CC_7_0 0xb3
215#define AXP20X_DISCHRG_CC_31_24 0xb4
216#define AXP20X_DISCHRG_CC_23_16 0xb5
217#define AXP20X_DISCHRG_CC_15_8 0xb6
218#define AXP20X_DISCHRG_CC_7_0 0xb7
219#define AXP20X_CC_CTRL 0xb8
220#define AXP20X_FG_RES 0xb9
221
553ed4b5
BP
222/* OCV */
223#define AXP20X_RDC_H 0xba
224#define AXP20X_RDC_L 0xbb
225#define AXP20X_OCV(m) (0xc0 + (m))
226#define AXP20X_OCV_MAX 0xf
227
f05be589
BB
228/* AXP22X specific registers */
229#define AXP22X_BATLOW_THRES1 0xe6
230
af7e9069
JP
231/* AXP288 specific registers */
232#define AXP288_PMIC_ADC_H 0x56
233#define AXP288_PMIC_ADC_L 0x57
234#define AXP288_ADC_TS_PIN_CTRL 0x84
af7e9069 235#define AXP288_PMIC_ADC_EN 0x84
af7e9069 236
774e0b41
TB
237/* Fuel Gauge */
238#define AXP288_FG_RDC1_REG 0xba
239#define AXP288_FG_RDC0_REG 0xbb
240#define AXP288_FG_OCVH_REG 0xbc
241#define AXP288_FG_OCVL_REG 0xbd
242#define AXP288_FG_OCV_CURVE_REG 0xc0
243#define AXP288_FG_DES_CAP1_REG 0xe0
244#define AXP288_FG_DES_CAP0_REG 0xe1
245#define AXP288_FG_CC_MTR1_REG 0xe2
246#define AXP288_FG_CC_MTR0_REG 0xe3
247#define AXP288_FG_OCV_CAP_REG 0xe4
248#define AXP288_FG_CC_CAP_REG 0xe5
249#define AXP288_FG_LOW_CAP_REG 0xe6
250#define AXP288_FG_TUNE0 0xe8
251#define AXP288_FG_TUNE1 0xe9
252#define AXP288_FG_TUNE2 0xea
253#define AXP288_FG_TUNE3 0xeb
254#define AXP288_FG_TUNE4 0xec
255#define AXP288_FG_TUNE5 0xed
af7e9069 256
cfb61a41
CC
257/* Regulators IDs */
258enum {
259 AXP20X_LDO1 = 0,
260 AXP20X_LDO2,
261 AXP20X_LDO3,
262 AXP20X_LDO4,
263 AXP20X_LDO5,
264 AXP20X_DCDC2,
265 AXP20X_DCDC3,
266 AXP20X_REG_ID_MAX,
267};
268
f05be589
BB
269enum {
270 AXP22X_DCDC1 = 0,
271 AXP22X_DCDC2,
272 AXP22X_DCDC3,
273 AXP22X_DCDC4,
274 AXP22X_DCDC5,
275 AXP22X_DC1SW,
276 AXP22X_DC5LDO,
277 AXP22X_ALDO1,
278 AXP22X_ALDO2,
279 AXP22X_ALDO3,
280 AXP22X_ELDO1,
281 AXP22X_ELDO2,
282 AXP22X_ELDO3,
283 AXP22X_DLDO1,
284 AXP22X_DLDO2,
285 AXP22X_DLDO3,
286 AXP22X_DLDO4,
287 AXP22X_RTC_LDO,
288 AXP22X_LDO_IO0,
289 AXP22X_LDO_IO1,
290 AXP22X_REG_ID_MAX,
291};
292
95f3d817
CYT
293enum {
294 AXP806_DCDCA = 0,
295 AXP806_DCDCB,
296 AXP806_DCDCC,
297 AXP806_DCDCD,
298 AXP806_DCDCE,
299 AXP806_ALDO1,
300 AXP806_ALDO2,
301 AXP806_ALDO3,
302 AXP806_BLDO1,
303 AXP806_BLDO2,
304 AXP806_BLDO3,
305 AXP806_BLDO4,
306 AXP806_CLDO1,
307 AXP806_CLDO2,
308 AXP806_CLDO3,
309 AXP806_SW,
310 AXP806_REG_ID_MAX,
311};
312
20147f0d
CYT
313enum {
314 AXP809_DCDC1 = 0,
315 AXP809_DCDC2,
316 AXP809_DCDC3,
317 AXP809_DCDC4,
318 AXP809_DCDC5,
319 AXP809_DC1SW,
320 AXP809_DC5LDO,
321 AXP809_ALDO1,
322 AXP809_ALDO2,
323 AXP809_ALDO3,
324 AXP809_ELDO1,
325 AXP809_ELDO2,
326 AXP809_ELDO3,
327 AXP809_DLDO1,
328 AXP809_DLDO2,
329 AXP809_RTC_LDO,
330 AXP809_LDO_IO0,
331 AXP809_LDO_IO1,
332 AXP809_SW,
333 AXP809_REG_ID_MAX,
334};
335
cfb61a41 336/* IRQs */
d8d79f8f
MS
337enum {
338 AXP152_IRQ_LDO0IN_CONNECT = 1,
339 AXP152_IRQ_LDO0IN_REMOVAL,
340 AXP152_IRQ_ALDO0IN_CONNECT,
341 AXP152_IRQ_ALDO0IN_REMOVAL,
342 AXP152_IRQ_DCDC1_V_LOW,
343 AXP152_IRQ_DCDC2_V_LOW,
344 AXP152_IRQ_DCDC3_V_LOW,
345 AXP152_IRQ_DCDC4_V_LOW,
346 AXP152_IRQ_PEK_SHORT,
347 AXP152_IRQ_PEK_LONG,
348 AXP152_IRQ_TIMER,
349 AXP152_IRQ_PEK_RIS_EDGE,
350 AXP152_IRQ_PEK_FAL_EDGE,
351 AXP152_IRQ_GPIO3_INPUT,
352 AXP152_IRQ_GPIO2_INPUT,
353 AXP152_IRQ_GPIO1_INPUT,
354 AXP152_IRQ_GPIO0_INPUT,
355};
356
cfb61a41
CC
357enum {
358 AXP20X_IRQ_ACIN_OVER_V = 1,
359 AXP20X_IRQ_ACIN_PLUGIN,
360 AXP20X_IRQ_ACIN_REMOVAL,
361 AXP20X_IRQ_VBUS_OVER_V,
362 AXP20X_IRQ_VBUS_PLUGIN,
363 AXP20X_IRQ_VBUS_REMOVAL,
364 AXP20X_IRQ_VBUS_V_LOW,
365 AXP20X_IRQ_BATT_PLUGIN,
366 AXP20X_IRQ_BATT_REMOVAL,
367 AXP20X_IRQ_BATT_ENT_ACT_MODE,
368 AXP20X_IRQ_BATT_EXIT_ACT_MODE,
369 AXP20X_IRQ_CHARG,
370 AXP20X_IRQ_CHARG_DONE,
371 AXP20X_IRQ_BATT_TEMP_HIGH,
372 AXP20X_IRQ_BATT_TEMP_LOW,
373 AXP20X_IRQ_DIE_TEMP_HIGH,
374 AXP20X_IRQ_CHARG_I_LOW,
375 AXP20X_IRQ_DCDC1_V_LONG,
376 AXP20X_IRQ_DCDC2_V_LONG,
377 AXP20X_IRQ_DCDC3_V_LONG,
378 AXP20X_IRQ_PEK_SHORT = 22,
379 AXP20X_IRQ_PEK_LONG,
380 AXP20X_IRQ_N_OE_PWR_ON,
381 AXP20X_IRQ_N_OE_PWR_OFF,
382 AXP20X_IRQ_VBUS_VALID,
383 AXP20X_IRQ_VBUS_NOT_VALID,
384 AXP20X_IRQ_VBUS_SESS_VALID,
385 AXP20X_IRQ_VBUS_SESS_END,
386 AXP20X_IRQ_LOW_PWR_LVL1,
387 AXP20X_IRQ_LOW_PWR_LVL2,
388 AXP20X_IRQ_TIMER,
389 AXP20X_IRQ_PEK_RIS_EDGE,
390 AXP20X_IRQ_PEK_FAL_EDGE,
391 AXP20X_IRQ_GPIO3_INPUT,
392 AXP20X_IRQ_GPIO2_INPUT,
393 AXP20X_IRQ_GPIO1_INPUT,
394 AXP20X_IRQ_GPIO0_INPUT,
395};
396
f05be589
BB
397enum axp22x_irqs {
398 AXP22X_IRQ_ACIN_OVER_V = 1,
399 AXP22X_IRQ_ACIN_PLUGIN,
400 AXP22X_IRQ_ACIN_REMOVAL,
401 AXP22X_IRQ_VBUS_OVER_V,
402 AXP22X_IRQ_VBUS_PLUGIN,
403 AXP22X_IRQ_VBUS_REMOVAL,
404 AXP22X_IRQ_VBUS_V_LOW,
405 AXP22X_IRQ_BATT_PLUGIN,
406 AXP22X_IRQ_BATT_REMOVAL,
407 AXP22X_IRQ_BATT_ENT_ACT_MODE,
408 AXP22X_IRQ_BATT_EXIT_ACT_MODE,
409 AXP22X_IRQ_CHARG,
410 AXP22X_IRQ_CHARG_DONE,
411 AXP22X_IRQ_BATT_TEMP_HIGH,
412 AXP22X_IRQ_BATT_TEMP_LOW,
413 AXP22X_IRQ_DIE_TEMP_HIGH,
414 AXP22X_IRQ_PEK_SHORT,
415 AXP22X_IRQ_PEK_LONG,
416 AXP22X_IRQ_LOW_PWR_LVL1,
417 AXP22X_IRQ_LOW_PWR_LVL2,
418 AXP22X_IRQ_TIMER,
419 AXP22X_IRQ_PEK_RIS_EDGE,
420 AXP22X_IRQ_PEK_FAL_EDGE,
421 AXP22X_IRQ_GPIO1_INPUT,
422 AXP22X_IRQ_GPIO0_INPUT,
423};
424
af7e9069
JP
425enum axp288_irqs {
426 AXP288_IRQ_VBUS_FALL = 2,
427 AXP288_IRQ_VBUS_RISE,
428 AXP288_IRQ_OV,
429 AXP288_IRQ_FALLING_ALT,
430 AXP288_IRQ_RISING_ALT,
431 AXP288_IRQ_OV_ALT,
432 AXP288_IRQ_DONE = 10,
433 AXP288_IRQ_CHARGING,
434 AXP288_IRQ_SAFE_QUIT,
435 AXP288_IRQ_SAFE_ENTER,
436 AXP288_IRQ_ABSENT,
437 AXP288_IRQ_APPEND,
438 AXP288_IRQ_QWBTU,
439 AXP288_IRQ_WBTU,
440 AXP288_IRQ_QWBTO,
441 AXP288_IRQ_WBTO,
442 AXP288_IRQ_QCBTU,
443 AXP288_IRQ_CBTU,
444 AXP288_IRQ_QCBTO,
445 AXP288_IRQ_CBTO,
446 AXP288_IRQ_WL2,
447 AXP288_IRQ_WL1,
448 AXP288_IRQ_GPADC,
449 AXP288_IRQ_OT = 31,
450 AXP288_IRQ_GPIO0,
451 AXP288_IRQ_GPIO1,
452 AXP288_IRQ_POKO,
453 AXP288_IRQ_POKL,
454 AXP288_IRQ_POKS,
455 AXP288_IRQ_POKN,
456 AXP288_IRQ_POKP,
457 AXP288_IRQ_TIMER,
458 AXP288_IRQ_MV_CHNG,
459 AXP288_IRQ_BC_USB_CHNG,
460};
461
95f3d817
CYT
462enum axp806_irqs {
463 AXP806_IRQ_DIE_TEMP_HIGH_LV1,
464 AXP806_IRQ_DIE_TEMP_HIGH_LV2,
465 AXP806_IRQ_DCDCA_V_LOW,
466 AXP806_IRQ_DCDCB_V_LOW,
467 AXP806_IRQ_DCDCC_V_LOW,
468 AXP806_IRQ_DCDCD_V_LOW,
469 AXP806_IRQ_DCDCE_V_LOW,
470 AXP806_IRQ_PWROK_LONG,
471 AXP806_IRQ_PWROK_SHORT,
472 AXP806_IRQ_WAKEUP,
473 AXP806_IRQ_PWROK_FALL,
474 AXP806_IRQ_PWROK_RISE,
475};
476
20147f0d
CYT
477enum axp809_irqs {
478 AXP809_IRQ_ACIN_OVER_V = 1,
479 AXP809_IRQ_ACIN_PLUGIN,
480 AXP809_IRQ_ACIN_REMOVAL,
481 AXP809_IRQ_VBUS_OVER_V,
482 AXP809_IRQ_VBUS_PLUGIN,
483 AXP809_IRQ_VBUS_REMOVAL,
484 AXP809_IRQ_VBUS_V_LOW,
485 AXP809_IRQ_BATT_PLUGIN,
486 AXP809_IRQ_BATT_REMOVAL,
487 AXP809_IRQ_BATT_ENT_ACT_MODE,
488 AXP809_IRQ_BATT_EXIT_ACT_MODE,
489 AXP809_IRQ_CHARG,
490 AXP809_IRQ_CHARG_DONE,
491 AXP809_IRQ_BATT_CHG_TEMP_HIGH,
492 AXP809_IRQ_BATT_CHG_TEMP_HIGH_END,
493 AXP809_IRQ_BATT_CHG_TEMP_LOW,
494 AXP809_IRQ_BATT_CHG_TEMP_LOW_END,
495 AXP809_IRQ_BATT_ACT_TEMP_HIGH,
496 AXP809_IRQ_BATT_ACT_TEMP_HIGH_END,
497 AXP809_IRQ_BATT_ACT_TEMP_LOW,
498 AXP809_IRQ_BATT_ACT_TEMP_LOW_END,
499 AXP809_IRQ_DIE_TEMP_HIGH,
500 AXP809_IRQ_LOW_PWR_LVL1,
501 AXP809_IRQ_LOW_PWR_LVL2,
502 AXP809_IRQ_TIMER,
503 AXP809_IRQ_PEK_RIS_EDGE,
504 AXP809_IRQ_PEK_FAL_EDGE,
505 AXP809_IRQ_PEK_SHORT,
506 AXP809_IRQ_PEK_LONG,
507 AXP809_IRQ_PEK_OVER_OFF,
508 AXP809_IRQ_GPIO1_INPUT,
509 AXP809_IRQ_GPIO0_INPUT,
510};
511
af7e9069
JP
512#define AXP288_TS_ADC_H 0x58
513#define AXP288_TS_ADC_L 0x59
514#define AXP288_GP_ADC_H 0x5a
515#define AXP288_GP_ADC_L 0x5b
516
cfb61a41
CC
517struct axp20x_dev {
518 struct device *dev;
4fd41151 519 int irq;
cfb61a41
CC
520 struct regmap *regmap;
521 struct regmap_irq_chip_data *regmap_irqc;
522 long variant;
af7e9069
JP
523 int nr_cells;
524 struct mfd_cell *cells;
525 const struct regmap_config *regmap_cfg;
526 const struct regmap_irq_chip *regmap_irq_chip;
cfb61a41
CC
527};
528
774e0b41
TB
529#define BATTID_LEN 64
530#define OCV_CURVE_SIZE 32
531#define MAX_THERM_CURVE_SIZE 25
532#define PD_DEF_MIN_TEMP 0
533#define PD_DEF_MAX_TEMP 55
534
535struct axp20x_fg_pdata {
536 char battid[BATTID_LEN + 1];
537 int design_cap;
538 int min_volt;
539 int max_volt;
540 int max_temp;
541 int min_temp;
542 int cap1;
543 int cap0;
544 int rdc1;
545 int rdc0;
546 int ocv_curve[OCV_CURVE_SIZE];
547 int tcsz;
548 int thermistor_curve[MAX_THERM_CURVE_SIZE][2];
549};
550
843735b7
RP
551struct axp20x_chrg_pdata {
552 int max_cc;
553 int max_cv;
554 int def_cc;
555 int def_cv;
556};
557
f0312378
RP
558struct axp288_extcon_pdata {
559 /* GPIO pin control to switch D+/D- lines b/w PMIC and SOC */
560 struct gpio_desc *gpio_mux_cntl;
561};
562
69fb4dca
HG
563/* generic helper function for reading 9-16 bit wide regs */
564static inline int axp20x_read_variable_width(struct regmap *regmap,
565 unsigned int reg, unsigned int width)
566{
567 unsigned int reg_val, result;
568 int err;
569
570 err = regmap_read(regmap, reg, &reg_val);
571 if (err)
572 return err;
573
574 result = reg_val << (width - 8);
575
576 err = regmap_read(regmap, reg + 1, &reg_val);
577 if (err)
578 return err;
579
580 result |= reg_val;
581
582 return result;
583}
584
4fd41151
CYT
585/**
586 * axp20x_match_device(): Setup axp20x variant related fields
587 *
588 * @axp20x: axp20x device to setup (.dev field must be set)
589 * @dev: device associated with this axp20x device
590 *
591 * This lets the axp20x core configure the mfd cells and register maps
592 * for later use.
593 */
594int axp20x_match_device(struct axp20x_dev *axp20x);
595
596/**
597 * axp20x_device_probe(): Probe a configured axp20x device
598 *
599 * @axp20x: axp20x device to probe (must be configured)
600 *
601 * This function lets the axp20x core register the axp20x mfd devices
602 * and irqchip. The axp20x device passed in must be fully configured
603 * with axp20x_match_device, its irq set, and regmap created.
604 */
605int axp20x_device_probe(struct axp20x_dev *axp20x);
606
607/**
608 * axp20x_device_probe(): Remove a axp20x device
609 *
610 * @axp20x: axp20x device to remove
611 *
612 * This tells the axp20x core to remove the associated mfd devices
613 */
614int axp20x_device_remove(struct axp20x_dev *axp20x);
615
cfb61a41 616#endif /* __LINUX_MFD_AXP20X_H */
This page took 0.172854 seconds and 5 git commands to generate.