summaryrefslogtreecommitdiff
path: root/include/linux/mfd/abx500/ab5500-bm.h
blob: 05ebc8c38407fc7af8aedd429dd4bedef82e8ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
 * Copyright ST-Ericsson 2011.
 *
 * Author: Arun Murthy <arun.murthy@stericsson.com>
 * Licensed under GPLv2.
 */

#ifndef _AB5500_BM_H
#define _AB5500_BM_H

#define AB5500_MCB		0x2F
/*
 * USB/ULPI register offsets
 * Bank : 0x5
 */
#define AB5500_USB_LINE_STATUS		0x80
#define AB5500_USB_PHY_STATUS		0x89
#define AB5500_CHGFSM_CHARGER_DETECT	0xBF
#define AB5500_CHGFSM_USB_BTEMP_CURR_LIM	0xAD
#define AB5500_USB_LINE_CTRL2		0x82
#define AB5500_USB_OTG_CTRL		0x87

/*
 * Charger / control register offfsets
 * Bank : 0x0B
 */
#define AB5500_CVBUSM			0x11
#define AB5500_LEDT			0x12
#define AB5500_VSRC			0x13
#define AB5500_ICSR			0x14
#define AB5500_OCSRV			0x15
#define AB5500_CVREC			0x16
#define AB5500_CREVS			0x17
#define AB5500_CCTRL			0x18
#define AB5500_TBDATA			0x19
#define AB5500_CPWM			0x1A
#define AB5500_DCIOCURRENT		0x1B
#define AB5500_USB_HS_CURR_LIM		0x1C
#define AB5500_WALL_HS_CURR_LIM		0x1D

/*
 * FG, Battcom and ACC registers offsets
 * Bank : 0x0C
 */
#define AB5500_FG_CH0			0x00
#define AB5500_FG_CH1			0x01
#define AB5500_FG_CH2			0x02
#define AB5500_FG_DIS_CH0		0x03
#define AB5500_FG_DIS_CH1		0x04
#define AB5500_FG_DIS_CH2		0x05
#define AB5500_FGDIS_COUNT0		0x06
#define AB5500_FGDIS_COUNT1		0x07
#define AB5500_FG_VAL_COUNT0		0x08
#define AB5500_FG_VAL_COUNT1		0x09
#define AB5500_FGDIR_READ0		0x0A
#define AB5500_FGDIR_READ1		0x0B
#define AB5500_FG_CONTROL_A		0x0C
#define AB5500_FG_CONTROL_B		0x0F
#define AB5500_FG_CONTROL_C		0x10
#define AB5500_FG_DIS			0x0D
#define AB5500_FG_EOC			0x0E
#define AB5500_FG_CB			0x0F
#define AB5500_FG_CC			0x10
#define AB5500_UIOR			0x1A
#define AB5500_UART			0x1B
#define AB5500_URI			0x1C
#define AB5500_UART_RQ			0x1D
#define AB5500_ACC_DETECT1		0x20
#define AB5500_ACC_DETECT2		0x21
#define AB5500_ACC_DETECTCTRL		0x23
#define AB5500_ACC_AVCTRL		0x24
#define AB5500_ACC_DETECT3_DEG_LITCH_TIME	0x30
#define AB5500_ACC_DETECT3_KEY_PRESS_TIME	0x31
#define AB5500_ACC_DETECT3_LONG_KEY_TIME	0x32
#define AB5500_ACC_DETECT3_TIME_READ_MS		0x33
#define AB5500_ACC_DETECT3_TIME_READ_LS		0x34
#define AB5500_ACC_DETECT3_CONTROL		0x35
#define AB5500_ACC_DETECT3_LEVEL		0x36
#define AB5500_ACC_DETECT3_TIMER_READ_CTL	0x37

/*
 * Interrupt register offsets
 * Bank : 0x0E
 */
#define AB5500_IT_SOURCE8		0x28
#define AB5500_IT_SOURCE9		0x29

/* BatCtrl Current Source Constants */
#define BAT_CTRL_7U_ENA			(0x01 << 0)
#define BAT_CTRL_15U_ENA		(0x01 << 1)
#define BAT_CTRL_30U_ENA		(0x01 << 2)
#define BAT_CTRL_60U_ENA		(0x01 << 3)
#define BAT_CTRL_120U_ENA		(0x01 << 4)
#define BAT_CTRL_CMP_ENA		0x04
#define FORCE_BAT_CTRL_CMP_HIGH		0x08
#define BAT_CTRL_PULL_UP_ENA		0x10

/* Battery type */
#define BATTERY_UNKNOWN			0

#ifdef CONFIG_AB5500_BM
struct ab5500_btemp *ab5500_btemp_get(void);
int ab5500_btemp_get_batctrl_temp(struct ab5500_btemp *btemp);
void ab5500_fg_reinit(void);
#else
static inline struct ab5500_btemp *ab5500_btemp_get(void)
{
	return 0;
}
static inline int ab5500_btemp_get_batctrl_temp(struct ab5500_btemp *btemp)
{
	return 0;
}
static inline void ab5500_fg_reinit(void) {}
#endif
#endif /* _AB5500_BM_H */