2 * include/linux/power/rt5025-battery.h
3 * Include header file for Richtek RT5025 battery Driver
5 * Copyright (C) 2013 Richtek Electronics
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.
13 #ifndef __LINUX_RT5025_BATTERY_H
14 #define __LINUX_RT5025_BATTERY_H
16 #undef ROCKCHIP_BATTERY_6900MAH
17 #undef ROCKCHIP_BATTERY_4000MAH
19 #define RT5025_REG_IRQ_CTL 0x50
20 #define RT5025_REG_IRQ_FLAG 0x51
21 #define RT5025_REG_VALRT_MAXTH 0x53
22 #define RT5025_REG_VALRT_MIN1TH 0x54
23 #define RT5025_REG_VALRT_MIN2TH 0x55
24 #define RT5025_REG_TALRT_MAXTH 0x56
25 #define RT5025_REG_TALRT_MINTH 0x57
26 #define RT5025_REG_VCELL_MSB 0x58
27 #define RT5025_REG_VCELL_LSB 0x59
28 #define RT5025_REG_INT_TEMPERATUE_MSB 0x5A
29 #define RT5025_REG_INT_TEMPERATUE_LSB 0x5B
30 #define RT5025_REG_EXT_TEMPERATUE_MSB 0x5E
31 #define RT5025_REG_EXT_TEMPERATUE_LSB 0x5F
32 #define RT5025_REG_TIMER 0x60
33 #define RT5025_REG_CHANNEL_MSB 0x62
34 #define RT5025_REG_CHANNEL_LSB 0x63
35 #define RT5025_REG_CURRENT_MSB 0x76
36 #define RT5025_REG_CURRENT_LSB 0x77
37 #define RT5025_REG_QCHGH_MSB 0x78
38 #define RT5025_REG_QCHGH_LSB 0x79
39 #define RT5025_REG_QCHGL_MSB 0x7A
40 #define RT5025_REG_QCHGL_LSB 0x7B
41 #define RT5025_REG_QDCHGH_MSB 0x7C
42 #define RT5025_REG_QDCHGH_LSB 0x7D
43 #define RT5025_REG_QDCHGL_MSB 0x7E
44 #define RT5025_REG_QDCHGL_LSB 0x7F
46 #define IRQ_CTL_BIT_TMX (1 << 5)
47 #define IRQ_CTL_BIT_TMN (1 << 4)
48 #define IRQ_CTL_BIT_VMX (1 << 2)
49 #define IRQ_CTL_BIT_VMN1 (1 << 1)
50 #define IRQ_CTL_BIT_VMN2 (1 << 0)
52 #define IRQ_FLG_BIT_TMX (1 << 5)
53 #define IRQ_FLG_BIT_TMN (1 << 4)
54 #define IRQ_FLG_BIT_VMX (1 << 2)
55 #define IRQ_FLG_BIT_VMN1 (1 << 1)
56 #define IRQ_FLG_BIT_VMN2 (1 << 0)
58 #define CHANNEL_H_BIT_CLRQDCHG (1 << 7)
59 #define CHANNEL_H_BIT_CLRQCHG (1 << 6)
61 #define CHANNEL_L_BIT_CADC_EN (1 << 7)
62 #define CHANNEL_L_BIT_INTEMPCH (1 << 6)
63 #define CHANNEL_L_BIT_AINCH (1 << 2)
64 #define CHANNEL_L_BIT_VBATSCH (1 << 1)
65 #define CHANNEL_L_BIT_VADC_EN (1 << 0)
67 #define NORMAL_POLL 30 /* 30 sec */
68 #define TP_POLL 5 /* 5 sec */
69 #define EDV_POLL 5 /* 1 sec */
70 #define SMOOTH_POLL 20 /* 5 sec */
71 #define SUSPEND_POLL (30*60) /* 30 min */
73 #define LOW_BAT_WAKE_LOK_TIME 120
75 #define HIGH_TEMP_THRES 650
76 #define HIGH_TEMP_RECOVER 430
77 #define LOW_TEMP_THRES (-30)
78 #define LOW_TEMP_RECOVER 0
79 #define TEMP_ABNORMAL_COUNT 3
82 #define IRQ_THRES_UNIT 1953
84 #define TALRTMAX_VALUE 0x38 //65.39'C
85 #define TALRTMIN_VALUE 0x9 //-18.75'C
86 #define TRLS_VALUE 55 //5'C ; unit:mV
87 #define VRLS_VALUE 100 //100mV
92 //#define SLEEP_CURRENT 3 //mA
115 #if defined(ROCKCHIP_BATTERY_6900MAH)
116 #include <linux/power/rockchip-6900ma-bat.h>
117 #elif defined(ROCKCHIP_BATTERY_4000MAH)
118 #include <linux/power/rockchip-4000ma-bat.h>
120 #include <linux/power/rockchip-general-bat.h>
123 #define VALRTMIN2_VALUE (rt5025_battery_param2[4].x * 100 / IRQ_THRES_UNIT + 1) //EDV0 voltage
125 #endif /* #ifndef __LINUX_RT5025_BATTERY_H */