|
7 | 7 |
|
8 | 8 | #include "battery_fuel_gauge.h" |
9 | 9 | #include "battery_smart.h" |
10 | | -#include "charge_state.h" |
11 | | -#include "common.h" |
12 | 10 | #include "console.h" |
13 | | -#include "gpio.h" |
14 | 11 | #include "hooks.h" |
15 | 12 | #include "util.h" |
16 | 13 |
|
17 | 14 | #define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args) |
18 | 15 |
|
19 | 16 |
|
20 | | -static enum battery_present batt_pres_prev = BP_NOT_SURE; |
21 | | - |
22 | 17 | /* Get type of the battery connected on the board */ |
23 | 18 | static int get_battery_type(void) |
24 | 19 | { |
@@ -118,20 +113,6 @@ int board_cut_off_battery(void) |
118 | 113 | return rv ? EC_RES_ERROR : EC_RES_SUCCESS; |
119 | 114 | } |
120 | 115 |
|
121 | | -enum battery_present battery_hw_present(void) |
122 | | -{ |
123 | | - /* The GPIO is low when the battery is physically present */ |
124 | | - return gpio_get_level(GPIO_EC_BATT_PRES_L) ? BP_NO : BP_YES; |
125 | | -} |
126 | | - |
127 | | -static int battery_init(void) |
128 | | -{ |
129 | | - int batt_status; |
130 | | - |
131 | | - return battery_status(&batt_status) ? 0 : |
132 | | - !!(batt_status & STATUS_INITIALIZED); |
133 | | -} |
134 | | - |
135 | 116 | /* |
136 | 117 | * This function checks the charge/discharge FET status bits. Each battery type |
137 | 118 | * supported provides the register address, mask, and disconnect value for these |
@@ -181,46 +162,3 @@ enum battery_disconnect_state battery_get_disconnect_state(void) |
181 | 162 |
|
182 | 163 | return BATTERY_NOT_DISCONNECTED; |
183 | 164 | } |
184 | | - |
185 | | -/* |
186 | | - * Physical detection of battery. |
187 | | - */ |
188 | | -static enum battery_present battery_check_present_status(void) |
189 | | -{ |
190 | | - enum battery_present batt_pres; |
191 | | - |
192 | | - /* Get the physical hardware status */ |
193 | | - batt_pres = battery_hw_present(); |
194 | | - |
195 | | - /* |
196 | | - * If the battery is not physically connected, then no need to perform |
197 | | - * any more checks. |
198 | | - */ |
199 | | - if (batt_pres != BP_YES) |
200 | | - return batt_pres; |
201 | | - |
202 | | - /* |
203 | | - * If the battery is present now and was present last time we checked, |
204 | | - * return early. |
205 | | - */ |
206 | | - if (batt_pres == batt_pres_prev) |
207 | | - return batt_pres; |
208 | | - |
209 | | - /* |
210 | | - * Ensure that battery is: |
211 | | - * 1. Not in cutoff |
212 | | - * 2. Initialized |
213 | | - */ |
214 | | - if (battery_is_cut_off() != BATTERY_CUTOFF_STATE_NORMAL || |
215 | | - battery_init() == 0) { |
216 | | - batt_pres = BP_NO; |
217 | | - } |
218 | | - |
219 | | - return batt_pres; |
220 | | -} |
221 | | - |
222 | | -enum battery_present battery_is_present(void) |
223 | | -{ |
224 | | - batt_pres_prev = battery_check_present_status(); |
225 | | - return batt_pres_prev; |
226 | | -} |
0 commit comments