2 * include/linux/power/rt5025/rt5025-battery.h
3 * Include header file for Richtek RT5025 battery Driver
5 * Copyright (C) 2013 Richtek Technology Corp.
6 * cy_huang <cy_huang@richtek.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
14 #ifndef __LINUX_RT5025_BATTERY_H
15 #define __LINUX_RT5025_BATTERY_H
17 #undef ROCKCHIP_BATTERY_6900MAH
18 #undef ROCKCHIP_BATTERY_4000MAH
20 #define RT5025_REG_IRQ_CTL 0x50
21 #define RT5025_REG_IRQ_FLAG 0x51
22 #define RT5025_REG_VALRT_MAXTH 0x53
23 #define RT5025_REG_VALRT_MIN1TH 0x54
24 #define RT5025_REG_VALRT_MIN2TH 0x55
25 #define RT5025_REG_TALRT_MAXTH 0x56
26 #define RT5025_REG_TALRT_MINTH 0x57
27 #define RT5025_REG_VCELL_MSB 0x58
28 #define RT5025_REG_VCELL_LSB 0x59
29 #define RT5025_REG_INT_TEMPERATUE_MSB 0x5A
30 #define RT5025_REG_INT_TEMPERATUE_LSB 0x5B
31 #define RT5025_REG_EXT_TEMPERATUE_MSB 0x5E
32 #define RT5025_REG_EXT_TEMPERATUE_LSB 0x5F
33 #define RT5025_REG_TIMER 0x60
34 #define RT5025_REG_CHANNEL_MSB 0x62
35 #define RT5025_REG_CHANNEL_LSB 0x63
36 #define RT5025_REG_CURRENT_MSB 0x76
37 #define RT5025_REG_CURRENT_LSB 0x77
38 #define RT5025_REG_QCHGH_MSB 0x78
39 #define RT5025_REG_QCHGH_LSB 0x79
40 #define RT5025_REG_QCHGL_MSB 0x7A
41 #define RT5025_REG_QCHGL_LSB 0x7B
42 #define RT5025_REG_QDCHGH_MSB 0x7C
43 #define RT5025_REG_QDCHGH_LSB 0x7D
44 #define RT5025_REG_QDCHGL_MSB 0x7E
45 #define RT5025_REG_QDCHGL_LSB 0x7F
47 #define IRQ_CTL_BIT_TMX (1 << 5)
48 #define IRQ_CTL_BIT_TMN (1 << 4)
49 #define IRQ_CTL_BIT_VMX (1 << 2)
50 #define IRQ_CTL_BIT_VMN1 (1 << 1)
51 #define IRQ_CTL_BIT_VMN2 (1 << 0)
53 #define IRQ_FLG_BIT_TMX (1 << 5)
54 #define IRQ_FLG_BIT_TMN (1 << 4)
55 #define IRQ_FLG_BIT_VMX (1 << 2)
56 #define IRQ_FLG_BIT_VMN1 (1 << 1)
57 #define IRQ_FLG_BIT_VMN2 (1 << 0)
59 #define CHANNEL_H_BIT_CLRQDCHG (1 << 7)
60 #define CHANNEL_H_BIT_CLRQCHG (1 << 6)
62 #define CHANNEL_L_BIT_CADC_EN (1 << 7)
63 #define CHANNEL_L_BIT_INTEMPCH (1 << 6)
64 #define CHANNEL_L_BIT_AINCH (1 << 2)
65 #define CHANNEL_L_BIT_VBATSCH (1 << 1)
66 #define CHANNEL_L_BIT_VADC_EN (1 << 0)
68 #define NORMAL_POLL 30 /* 30 sec */
69 #define TP_POLL 5 /* 5 sec */
70 #define EDV_POLL 5 /* 1 sec */
71 #define SMOOTH_POLL 20 /* 5 sec */
72 #define SUSPEND_POLL (30*60) /* 30 min */
74 #define LOW_BAT_WAKE_LOK_TIME 120
76 #define HIGH_TEMP_THRES 650
77 #define HIGH_TEMP_RECOVER 430
78 #define LOW_TEMP_THRES (-30)
79 #define LOW_TEMP_RECOVER 0
80 #define TEMP_ABNORMAL_COUNT 3
83 #define IRQ_THRES_UNIT 1953
85 #define TALRTMAX_VALUE 0x38 /*65.39'C*/
86 #define TALRTMIN_VALUE 0x9 /*-18.75'C*/
87 #define TRLS_VALUE 55 /*5'C ; unit:mV*/
88 #define VRLS_VALUE 100 /*100mV*/
93 /*#define SLEEP_CURRENT 3 //mA*/
103 } battery_graph_prop;
116 #if defined(ROCKCHIP_BATTERY_6900MAH)
117 #include <linux/power/rockchip-6900ma-bat.h>
118 #elif defined(ROCKCHIP_BATTERY_4000MAH)
119 #include <linux/power/rockchip-4000ma-bat.h>
121 #include <linux/power/rockchip-general-bat.h>
124 #define VALRTMIN2_VALUE (rt5025_battery_param2[4].x * 100 / IRQ_THRES_UNIT + 1) /*EDV0 voltage*/
126 #endif /* #ifndef __LINUX_RT5025_BATTERY_H */