Commit | Line | Data |
---|---|---|
6fa3eb70 S |
1 | #ifndef _CUST_BATTERY_METER_H |
2 | #define _CUST_BATTERY_METER_H | |
3 | ||
4 | #include <mach/mt_typedefs.h> | |
5 | ||
6 | // ============================================================ | |
7 | // define | |
8 | // ============================================================ | |
9 | //#define SOC_BY_AUXADC | |
10 | #ifdef CONFIG_MTK_PMIC_MT6397 | |
11 | #define SOC_BY_HW_FG //fg auxadc | |
12 | #else | |
13 | #define SOC_BY_SW_FG //oam | |
14 | #endif | |
15 | ||
4b9e9796 | 16 | #define CUST_CAPACITY_OCV2CV_TRANSFORM |
6fa3eb70 S |
17 | //#define CONFIG_DIS_CHECK_BATTERY |
18 | //#define FIXED_TBAT_25 | |
19 | ||
20 | #if defined(CONFIG_MTK_BQ24296_SUPPORT) \ | |
21 | || defined(CONFIG_MTK_BQ24196_SUPPORT) | |
22 | #define BAT_VOL_USE_ISENSE | |
23 | #define SWCHR_POWER_PATH | |
24 | #endif | |
25 | ||
26 | #if defined(CONFIG_MTK_FAN5402_SUPPORT) \ | |
27 | || defined(CONFIG_MTK_FAN5405_SUPPORT) \ | |
28 | || defined(CONFIG_MTK_BQ24158_SUPPORT) \ | |
29 | || defined(CONFIG_MTK_BQ24196_SUPPORT) \ | |
30 | || defined(CONFIG_MTK_BQ24296_SUPPORT) \ | |
31 | || defined(CONFIG_MTK_NCP1851_SUPPORT) \ | |
32 | || defined(CONFIG_MTK_NCP1854_SUPPORT) \ | |
33 | || defined(CONFIG_MTK_BQ24160_SUPPORT) \ | |
34 | || defined(CONFIG_MTK_BQ24157_SUPPORT) \ | |
35 | || defined(CONFIG_MTK_BQ24250_SUPPORT) \ | |
36 | || defined(CONFIG_MTK_BQ24261_SUPPORT) | |
37 | #define EXTERNAL_SWCHR_SUPPORT | |
38 | #endif | |
39 | ||
40 | /* ADC Channel Number */ | |
41 | #ifdef CONFIG_MTK_PMIC_MT6397 | |
42 | #define CUST_TABT_NUMBER 8 | |
43 | #ifdef BAT_VOL_USE_ISENSE | |
44 | #define VBAT_CHANNEL_NUMBER 1 // w/ powerpath, battery voltage is ISENSE(1) | |
45 | #define ISENSE_CHANNEL_NUMBER 0 // w/ powerpath, system voltage is VSENSE(0) | |
46 | #else | |
47 | #define VBAT_CHANNEL_NUMBER 0 | |
48 | #define ISENSE_CHANNEL_NUMBER 1 | |
49 | #endif | |
50 | #define VCHARGER_CHANNEL_NUMBER 2 | |
51 | #define VBATTEMP_CHANNEL_NUMBER 3 | |
52 | ||
53 | #else //6323 | |
54 | ||
55 | #define CUST_TABT_NUMBER 17 | |
56 | #ifdef BAT_VOL_USE_ISENSE | |
57 | #define VBAT_CHANNEL_NUMBER 6 // w/ powerpath, battery voltage is ISENSE(1) | |
58 | #define ISENSE_CHANNEL_NUMBER 7 // w/ powerpath, system voltage is VSENSE(0) | |
59 | #else | |
60 | #define VBAT_CHANNEL_NUMBER 7 | |
61 | #define ISENSE_CHANNEL_NUMBER 6 | |
62 | #endif | |
63 | #define VCHARGER_CHANNEL_NUMBER 4 | |
64 | #define VBATTEMP_CHANNEL_NUMBER 5 | |
65 | ||
66 | #endif | |
67 | ||
68 | /* ADC resistor */ | |
69 | #define R_BAT_SENSE 4 | |
70 | #define R_I_SENSE 4 | |
71 | #define R_CHARGER_1 330 | |
72 | #define R_CHARGER_2 39 | |
73 | ||
74 | #define TEMPERATURE_T0 110 | |
75 | #define TEMPERATURE_T1 0 | |
76 | #define TEMPERATURE_T2 25 | |
77 | #define TEMPERATURE_T3 50 | |
78 | #define TEMPERATURE_T 255 // This should be fixed, never change the value | |
79 | ||
80 | #define FG_METER_RESISTANCE 0 | |
81 | ||
82 | /* Qmax for battery */ | |
4b9e9796 S |
83 | #define Q_MAX_POS_50 4060 |
84 | #define Q_MAX_POS_25 4060 | |
85 | #define Q_MAX_POS_0 3400 | |
86 | #define Q_MAX_NEG_10 2950 | |
6fa3eb70 | 87 | |
4b9e9796 S |
88 | #define Q_MAX_POS_50_H_CURRENT 4000 |
89 | #define Q_MAX_POS_25_H_CURRENT 4020 | |
90 | #define Q_MAX_POS_0_H_CURRENT 2760 | |
91 | #define Q_MAX_NEG_10_H_CURRENT 2450 | |
6fa3eb70 | 92 | |
4b9e9796 | 93 | /*[BUGFIX]-Add-BEGIN by TCTSZ.pingao.yang, 4/15/2015, pr-975290, change fg integration way */ |
6fa3eb70 | 94 | /* Discharge Percentage */ |
4b9e9796 S |
95 | #define OAM_D5 0 // 1 : D5, 0: D2 |
96 | /*[BUGFIX]-Add-end by TCTSZ.pingao.yang, 4/15/2015*/ | |
6fa3eb70 S |
97 | |
98 | /* battery meter parameter */ | |
99 | #define CUST_TRACKING_POINT 14 | |
4b9e9796 | 100 | #define CUST_R_SENSE 62 //Fixed sensor resistor according to HW designed. |
6fa3eb70 S |
101 | #define CUST_HW_CC 0 |
102 | #define AGING_TUNING_VALUE 100 | |
103 | #define CUST_R_FG_OFFSET 23 | |
104 | ||
105 | #define OCV_BOARD_COMPESATE 0 //mV | |
106 | #define R_FG_BOARD_BASE 1000 | |
107 | #define R_FG_BOARD_SLOPE 1000 //slope | |
108 | #define CAR_TUNE_VALUE 89 | |
109 | ||
110 | ||
111 | /* HW Fuel gague */ | |
112 | #define CURRENT_DETECT_R_FG (-1) //turn off auto detect for auxadc gauge | |
113 | #define MinErrorOffset 1000 | |
114 | #define FG_VBAT_AVERAGE_SIZE 18 | |
115 | #define R_FG_VALUE 20 // mOhm, base is 20 | |
116 | ||
117 | #define CUST_POWERON_DELTA_CAPACITY_TOLRANCE 60 | |
118 | #define CUST_POWERON_LOW_CAPACITY_TOLRANCE 5 | |
119 | #define CUST_POWERON_MAX_VBAT_TOLRANCE 70 | |
120 | #define CUST_POWERON_DELTA_VBAT_TOLRANCE 60 | |
121 | ||
122 | /* Disable Battery check for HQA */ | |
123 | #ifdef MTK_DISABLE_POWER_ON_OFF_VOLTAGE_LIMITATION | |
124 | #define FIXED_TBAT_25 | |
125 | #endif | |
126 | ||
127 | /* Dynamic change wake up period of battery thread when suspend*/ | |
128 | #define VBAT_NORMAL_WAKEUP 3600 //3.6V | |
129 | #define VBAT_LOW_POWER_WAKEUP 3500 //3.5v | |
130 | #define NORMAL_WAKEUP_PERIOD 5400 //90 * 60 = 90 min | |
131 | #define LOW_POWER_WAKEUP_PERIOD 300 //5 * 60 = 5 min | |
132 | #define CLOSE_POWEROFF_WAKEUP_PERIOD 30 //30 s | |
133 | ||
4b9e9796 S |
134 | /*[BUGFIX]-Add-BEGIN by TCTSZ.pingao.yang, 4/15/2015, */ |
135 | #define MAX_SUSPEND_CURRENT 420 // 42 mA | |
136 | #define MIN_SUSPEND_CURRENT 0 // 0 mA | |
137 | #define DEFAUL_SUSPEND_CURRENT 120 //12mA | |
138 | #define SUSPEND_CURRENT_SETP 30 //3mA | |
139 | #define SLEEP_AFTER_FG_DIFF 3 // diff about 3% | |
140 | #define UI_REDUCE_CURRENT 180 //18mA | |
141 | #define SLEEP_REDUCE_CURRENT 60 //6mA | |
142 | /*[BUGFIX]-Add-END by TCTSZ.pingao.yang */ | |
143 | ||
6fa3eb70 | 144 | #endif //#ifndef _CUST_BATTERY_METER_H |