1 #ifndef _CUST_BATTERY_METER_H
2 #define _CUST_BATTERY_METER_H
4 #include <mach/mt_typedefs.h>
6 // ============================================================
8 // ============================================================
9 //#define SOC_BY_AUXADC
10 #ifdef CONFIG_MTK_PMIC_MT6397
11 #define SOC_BY_HW_FG //fg auxadc
13 #define SOC_BY_SW_FG //oam
16 //#define CONFIG_DIS_CHECK_BATTERY
17 //#define FIXED_TBAT_25
19 #if defined(CONFIG_MTK_BQ24296_SUPPORT) \
20 || defined(CONFIG_MTK_BQ24196_SUPPORT)
21 #define BAT_VOL_USE_ISENSE
22 #define SWCHR_POWER_PATH
25 #if defined(CONFIG_MTK_FAN5402_SUPPORT) \
26 || defined(CONFIG_MTK_FAN5405_SUPPORT) \
27 || defined(CONFIG_MTK_BQ24158_SUPPORT) \
28 || defined(CONFIG_MTK_BQ24196_SUPPORT) \
29 || defined(CONFIG_MTK_BQ24296_SUPPORT) \
30 || defined(CONFIG_MTK_NCP1851_SUPPORT) \
31 || defined(CONFIG_MTK_NCP1854_SUPPORT) \
32 || defined(CONFIG_MTK_BQ24160_SUPPORT) \
33 || defined(CONFIG_MTK_BQ24157_SUPPORT) \
34 || defined(CONFIG_MTK_BQ24250_SUPPORT) \
35 || defined(CONFIG_MTK_BQ24261_SUPPORT)
36 #define EXTERNAL_SWCHR_SUPPORT
39 /* ADC Channel Number */
40 #ifdef CONFIG_MTK_PMIC_MT6397
41 #define CUST_TABT_NUMBER 8
42 #ifdef BAT_VOL_USE_ISENSE
43 #define VBAT_CHANNEL_NUMBER 1 // w/ powerpath, battery voltage is ISENSE(1)
44 #define ISENSE_CHANNEL_NUMBER 0 // w/ powerpath, system voltage is VSENSE(0)
46 #define VBAT_CHANNEL_NUMBER 0
47 #define ISENSE_CHANNEL_NUMBER 1
49 #define VCHARGER_CHANNEL_NUMBER 2
50 #define VBATTEMP_CHANNEL_NUMBER 3
54 #define CUST_TABT_NUMBER 17
55 #ifdef BAT_VOL_USE_ISENSE
56 #define VBAT_CHANNEL_NUMBER 6 // w/ powerpath, battery voltage is ISENSE(1)
57 #define ISENSE_CHANNEL_NUMBER 7 // w/ powerpath, system voltage is VSENSE(0)
59 #define VBAT_CHANNEL_NUMBER 7
60 #define ISENSE_CHANNEL_NUMBER 6
62 #define VCHARGER_CHANNEL_NUMBER 4
63 #define VBATTEMP_CHANNEL_NUMBER 5
70 #define R_CHARGER_1 330
71 #define R_CHARGER_2 39
73 #define TEMPERATURE_T0 110
74 #define TEMPERATURE_T1 0
75 #define TEMPERATURE_T2 25
76 #define TEMPERATURE_T3 50
77 #define TEMPERATURE_T 255 // This should be fixed, never change the value
79 #define FG_METER_RESISTANCE 0
81 /* Qmax for battery */
82 #define Q_MAX_POS_50 3009
83 #define Q_MAX_POS_25 3009
84 #define Q_MAX_POS_0 3009
85 #define Q_MAX_NEG_10 3009
87 #define Q_MAX_POS_50_H_CURRENT 2975
88 #define Q_MAX_POS_25_H_CURRENT 2975
89 #define Q_MAX_POS_0_H_CURRENT 2975
90 #define Q_MAX_NEG_10_H_CURRENT 2975
93 /* Discharge Percentage */
94 #define OAM_D5 1 // 1 : D5, 0: D2
97 /* battery meter parameter */
98 #define CUST_TRACKING_POINT 14
99 #define CUST_R_SENSE 200
101 #define AGING_TUNING_VALUE 100
102 #define CUST_R_FG_OFFSET 23
104 #define OCV_BOARD_COMPESATE 0 //mV
105 #define R_FG_BOARD_BASE 1000
106 #define R_FG_BOARD_SLOPE 1000 //slope
107 #define CAR_TUNE_VALUE 89
111 #define CURRENT_DETECT_R_FG (-1) //turn off auto detect for auxadc gauge
112 #define MinErrorOffset 1000
113 #define FG_VBAT_AVERAGE_SIZE 18
114 #define R_FG_VALUE 20 // mOhm, base is 20
116 #define CUST_POWERON_DELTA_CAPACITY_TOLRANCE 60
117 #define CUST_POWERON_LOW_CAPACITY_TOLRANCE 5
118 #define CUST_POWERON_MAX_VBAT_TOLRANCE 70
119 #define CUST_POWERON_DELTA_VBAT_TOLRANCE 60
121 /* Disable Battery check for HQA */
122 #ifdef MTK_DISABLE_POWER_ON_OFF_VOLTAGE_LIMITATION
123 #define FIXED_TBAT_25
126 /* Dynamic change wake up period of battery thread when suspend*/
127 #define VBAT_NORMAL_WAKEUP 3600 //3.6V
128 #define VBAT_LOW_POWER_WAKEUP 3500 //3.5v
129 #define NORMAL_WAKEUP_PERIOD 5400 //90 * 60 = 90 min
130 #define LOW_POWER_WAKEUP_PERIOD 300 //5 * 60 = 5 min
131 #define CLOSE_POWEROFF_WAKEUP_PERIOD 30 //30 s
133 #endif //#ifndef _CUST_BATTERY_METER_H