aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c/bq2415x.h
blob: 859e3cfb6f5f2434788f3bbe336a4fb08832ef67 (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
/*
 * Copyright (C) 2010 Texas Instruments
 * Author: Balaji T K
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _LINUX_BQ2415X_I2C_H
#define _LINUX_BQ2415X_I2C_H

#define BQ2415x_START_CHARGING		(1 << 0)
#define BQ2415x_STOP_CHARGING		(1 << 1)
#define BQ2415x_CHARGER_FAULT		(1 << 2)

#define BQ2415x_CHARGE_DONE		0x20
#define BQ2415x_FAULT_VBUS_OVP		0x31
#define BQ2415x_FAULT_SLEEP		0x32
#define BQ2415x_FAULT_BAD_ADAPTOR	0x33
#define BQ2415x_FAULT_BAT_OVP		0x34
#define BQ2415x_FAULT_THERMAL_SHUTDOWN	0x35
#define BQ2415x_FAULT_TIMER		0x36
#define BQ2415x_FAULT_NO_BATTERY	0x37

/* not a bq generated event,we use this to reset the
 * the timer from the twl driver.
 */
#define BQ2415x_RESET_TIMER		0x38

/* BQ24153 / BQ24156 / BQ24158 */
/* Status/Control Register */
#define REG_STATUS_CONTROL		0x00
#define		TIMER_RST		(1 << 7)
#define		ENABLE_STAT_PIN		(1 << 6)

/* Control Register */
#define REG_CONTROL_REGISTER		0x01
#define	INPUT_CURRENT_LIMIT_SHIFT	6
#define	ENABLE_ITERM_SHIFT		3

/* Control/Battery Voltage Register */
#define REG_BATTERY_VOLTAGE		0x02
#define	VOLTAGE_SHIFT			2

/* Vender/Part/Revision Register */
#define REG_PART_REVISION		0x03

/* Battery Termination/Fast Charge Current Register */
#define REG_BATTERY_CURRENT		0x04
#define	BQ24156_CURRENT_SHIFT		3
#define	BQ24153_CURRENT_SHIFT		4

/* Special Charger Voltage/Enable Pin Status Register */
#define REG_SPECIAL_CHARGER_VOLTAGE	0x05

/* Safety Limit Register */
#define REG_SAFETY_LIMIT		0x06
#define	MAX_CURRENT_SHIFT		4

#define BQ24153 (1 << 3)
#define BQ24156 (1 << 6)
#define BQ24158 (1 << 8)

#define BQ2415x_WATCHDOG_TIMEOUT	20000

struct bq2415x_platform_data {
	int max_charger_currentmA;
	int max_charger_voltagemV;
	int termination_currentmA;
};

#endif