drm/rockchip: add DRM_RENDER_ALLOW
[firefly-linux-kernel-4.4.55.git] / include / linux / i2c / bq2415x.h
1 /*
2  * Copyright (C) 2010 Texas Instruments
3  * Author: Balaji T K
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published by
7  * the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #ifndef _LINUX_BQ2415X_I2C_H
19 #define _LINUX_BQ2415X_I2C_H
20
21 #define BQ2415x_START_CHARGING          (1 << 0)
22 #define BQ2415x_STOP_CHARGING           (1 << 1)
23 #define BQ2415x_CHARGER_FAULT           (1 << 2)
24
25 #define BQ2415x_CHARGE_DONE             0x20
26 #define BQ2415x_FAULT_VBUS_OVP          0x31
27 #define BQ2415x_FAULT_SLEEP             0x32
28 #define BQ2415x_FAULT_BAD_ADAPTOR       0x33
29 #define BQ2415x_FAULT_BAT_OVP           0x34
30 #define BQ2415x_FAULT_THERMAL_SHUTDOWN  0x35
31 #define BQ2415x_FAULT_TIMER             0x36
32 #define BQ2415x_FAULT_NO_BATTERY        0x37
33
34 /* not a bq generated event,we use this to reset the
35  * the timer from the twl driver.
36  */
37 #define BQ2415x_RESET_TIMER             0x38
38
39 /* BQ24153 / BQ24156 / BQ24158 */
40 /* Status/Control Register */
41 #define REG_STATUS_CONTROL              0x00
42 #define         TIMER_RST               (1 << 7)
43 #define         ENABLE_STAT_PIN         (1 << 6)
44
45 /* Control Register */
46 #define REG_CONTROL_REGISTER            0x01
47 #define INPUT_CURRENT_LIMIT_SHIFT       6
48 #define ENABLE_ITERM_SHIFT              3
49
50 /* Control/Battery Voltage Register */
51 #define REG_BATTERY_VOLTAGE             0x02
52 #define VOLTAGE_SHIFT                   2
53
54 /* Vender/Part/Revision Register */
55 #define REG_PART_REVISION               0x03
56
57 /* Battery Termination/Fast Charge Current Register */
58 #define REG_BATTERY_CURRENT             0x04
59 #define BQ24156_CURRENT_SHIFT           3
60 #define BQ24153_CURRENT_SHIFT           4
61
62 /* Special Charger Voltage/Enable Pin Status Register */
63 #define REG_SPECIAL_CHARGER_VOLTAGE     0x05
64
65 /* Safety Limit Register */
66 #define REG_SAFETY_LIMIT                0x06
67 #define MAX_CURRENT_SHIFT               4
68
69 #define BQ24153 (1 << 3)
70 #define BQ24156 (1 << 6)
71 #define BQ24158 (1 << 8)
72
73 #define BQ2415x_WATCHDOG_TIMEOUT        20000
74
75 struct bq2415x_platform_data {
76         int max_charger_currentmA;
77         int max_charger_voltagemV;
78         int termination_currentmA;
79 };
80
81 #endif