Lines Matching +full:resistance +full:- +full:temp +full:- +full:table
1 // SPDX-License-Identifier: GPL-2.0
6 #include "ab8500-bm.h"
10 /* Default: between this temp and AB8500_TEMP_UNDER charging is reduced */
12 /* Default: between this temp and AB8500_TEMP_OVER charging is reduced */
14 /* Default: over this temp, charging is stopped */
47 * Note that the batres_vs_temp table must be strictly sorted by falling
48 * temperature values to work. Factory resistance is 300 mOhm and the
49 * resistance values to the right are percentages of 300 mOhm.
52 { .temp = 40, .resistance = 40 /* 120 mOhm */ },
53 { .temp = 30, .resistance = 45 /* 135 mOhm */ },
54 { .temp = 20, .resistance = 55 /* 165 mOhm */ },
55 { .temp = 10, .resistance = 77 /* 230 mOhm */ },
56 { .temp = 00, .resistance = 108 /* 325 mOhm */ },
57 { .temp = -10, .resistance = 158 /* 445 mOhm */ },
58 { .temp = -20, .resistance = 198 /* 595 mOhm */ },
144 struct device *dev = &psy->dev; in ab8500_bm_of_probe()
147 ret = power_supply_get_battery_info(psy, &bm->bi); in ab8500_bm_of_probe()
152 bi = bm->bi; in ab8500_bm_of_probe()
155 if (bi->charge_full_design_uah < 0) in ab8500_bm_of_probe()
157 bi->charge_full_design_uah = 612000; in ab8500_bm_of_probe()
163 if ((bi->voltage_min_design_uv < 0) || in ab8500_bm_of_probe()
164 (bi->voltage_max_design_uv < 0)) { in ab8500_bm_of_probe()
166 bi->voltage_min_design_uv = 3700000; in ab8500_bm_of_probe()
168 bi->voltage_max_design_uv = 4050000; in ab8500_bm_of_probe()
171 if (bi->constant_charge_current_max_ua < 0) in ab8500_bm_of_probe()
172 bi->constant_charge_current_max_ua = 400000; in ab8500_bm_of_probe()
174 if (bi->constant_charge_voltage_max_uv < 0) in ab8500_bm_of_probe()
175 bi->constant_charge_voltage_max_uv = 4100000; in ab8500_bm_of_probe()
177 if (bi->charge_term_current_ua) in ab8500_bm_of_probe()
179 bi->charge_term_current_ua = 200000; in ab8500_bm_of_probe()
181 if (!bi->maintenance_charge || !bi->maintenance_charge_size) { in ab8500_bm_of_probe()
182 bi->maintenance_charge = ab8500_maint_charg_table; in ab8500_bm_of_probe()
183 bi->maintenance_charge_size = ARRAY_SIZE(ab8500_maint_charg_table); in ab8500_bm_of_probe()
186 if (bi->alert_low_temp_charge_current_ua < 0 || in ab8500_bm_of_probe()
187 bi->alert_low_temp_charge_voltage_uv < 0) in ab8500_bm_of_probe()
189 bi->alert_low_temp_charge_current_ua = 300000; in ab8500_bm_of_probe()
190 bi->alert_low_temp_charge_voltage_uv = 4000000; in ab8500_bm_of_probe()
192 if (bi->alert_high_temp_charge_current_ua < 0 || in ab8500_bm_of_probe()
193 bi->alert_high_temp_charge_voltage_uv < 0) in ab8500_bm_of_probe()
195 bi->alert_high_temp_charge_current_ua = 300000; in ab8500_bm_of_probe()
196 bi->alert_high_temp_charge_voltage_uv = 4000000; in ab8500_bm_of_probe()
200 * Internal resistance and factory resistance are tightly coupled in ab8500_bm_of_probe()
203 if ((bi->factory_internal_resistance_uohm < 0) || in ab8500_bm_of_probe()
204 !bi->resist_table) { in ab8500_bm_of_probe()
205 bi->factory_internal_resistance_uohm = 300000; in ab8500_bm_of_probe()
206 bi->resist_table = temp_to_batres_tbl_thermistor; in ab8500_bm_of_probe()
207 bi->resist_table_size = ARRAY_SIZE(temp_to_batres_tbl_thermistor); in ab8500_bm_of_probe()
211 if (bi->bti_resistance_ohm < 0 || in ab8500_bm_of_probe()
212 bi->bti_resistance_tolerance < 0) { in ab8500_bm_of_probe()
213 bi->bti_resistance_ohm = 7000; in ab8500_bm_of_probe()
214 bi->bti_resistance_tolerance = 20; in ab8500_bm_of_probe()
217 if (!bi->ocv_table[0]) { in ab8500_bm_of_probe()
218 /* Default capacity table at say 25 degrees Celsius */ in ab8500_bm_of_probe()
219 bi->ocv_temp[0] = 25; in ab8500_bm_of_probe()
220 bi->ocv_table[0] = ocv_cap_tbl; in ab8500_bm_of_probe()
221 bi->ocv_table_size[0] = ARRAY_SIZE(ocv_cap_tbl); in ab8500_bm_of_probe()
224 if (bi->temp_min == INT_MIN) in ab8500_bm_of_probe()
225 bi->temp_min = AB8500_TEMP_UNDER; in ab8500_bm_of_probe()
226 if (bi->temp_max == INT_MAX) in ab8500_bm_of_probe()
227 bi->temp_max = AB8500_TEMP_OVER; in ab8500_bm_of_probe()
228 if (bi->temp_alert_min == INT_MIN) in ab8500_bm_of_probe()
229 bi->temp_alert_min = AB8500_TEMP_LOW; in ab8500_bm_of_probe()
230 if (bi->temp_alert_max == INT_MAX) in ab8500_bm_of_probe()
231 bi->temp_alert_max = AB8500_TEMP_HIGH; in ab8500_bm_of_probe()
232 bm->temp_hysteresis = AB8500_TEMP_HYSTERESIS; in ab8500_bm_of_probe()
240 power_supply_put_battery_info(psy, bm->bi); in ab8500_bm_of_remove()