.. | .. |
---|
143 | 143 | |
---|
144 | 144 | struct axp_config_info *axp_config = &bat_power->dts_info; |
---|
145 | 145 | |
---|
| 146 | + regmap_bulk_read(bat_power->regmap, AXP803_OCVBATH_RES, temp_val, 2); |
---|
| 147 | + ocv_vol = ((temp_val[0] << 4) | (temp_val[1] & 0xF)) * 1100 / 1000; |
---|
| 148 | + |
---|
146 | 149 | ret = regmap_read(bat_power->regmap, AXP803_CAP, ®_value); |
---|
147 | 150 | if (ret) |
---|
148 | 151 | return ret; |
---|
.. | .. |
---|
160 | 163 | rest_vol = 100; |
---|
161 | 164 | } |
---|
162 | 165 | |
---|
| 166 | + if (ocv_vol < axp_config->pmu_vol_min) { |
---|
| 167 | + // pr_err("kickpi: ocv_vol %d < min %d, rest_vol %d -> 0\n", ocv_vol, axp_config->pmu_vol_min, rest_vol); |
---|
| 168 | + rest_vol = 0; |
---|
| 169 | + } |
---|
| 170 | + |
---|
163 | 171 | return rest_vol; |
---|
164 | 172 | } |
---|
165 | 173 | |
---|
.. | .. |
---|
234 | 242 | pr_debug("calc_info: ocv_vol:%d rdc:%d coulumb_counter:%d batt_max_cap:%d\n", |
---|
235 | 243 | ocv_vol, rdc, coulumb_counter, batt_max_cap); |
---|
236 | 244 | } |
---|
| 245 | + |
---|
| 246 | + if (ocv_vol < axp_config->pmu_vol_min) { |
---|
| 247 | + // pr_err("kickpi: ocv_vol %d < min %d, rest_vol %d -> 0\n", ocv_vol, axp_config->pmu_vol_min, rest_vol); |
---|
| 248 | + rest_vol = 0; |
---|
| 249 | + } |
---|
237 | 250 | |
---|
238 | 251 | return rest_vol; |
---|
239 | 252 | } |
---|
.. | .. |
---|
671 | 684 | } |
---|
672 | 685 | |
---|
673 | 686 | regmap_read(map, AXP803_BATCAP0, &val); |
---|
674 | | - if ((axp_config->pmu_battery_cap) && (!(val & 0x80))) { |
---|
675 | | - cur_coulomb_counter = axp_config->pmu_battery_cap |
---|
| 687 | + //if ((axp_config->pmu_battery_cap) && (!(val & 0x80))) { |
---|
| 688 | + // always update from dts |
---|
| 689 | + if ((axp_config->pmu_battery_cap)) { |
---|
| 690 | + cur_coulomb_counter = axp_config->pmu_battery_cap |
---|
676 | 691 | * 1000 / 1456; |
---|
677 | 692 | regmap_write(map, AXP803_BATCAP0, ((cur_coulomb_counter >> 8) | 0x80)); |
---|
678 | 693 | regmap_write(map, AXP803_BATCAP1, cur_coulomb_counter & 0x00FF); |
---|
.. | .. |
---|
915 | 930 | AXP_OF_PROP_READ(pmu_runtime_chgcur, INTCHGCUR / 1000); |
---|
916 | 931 | AXP_OF_PROP_READ(pmu_suspend_chgcur, 1200); |
---|
917 | 932 | AXP_OF_PROP_READ(pmu_shutdown_chgcur, 1200); |
---|
| 933 | + AXP_OF_PROP_READ(pmu_vol_min, 3400); |
---|
918 | 934 | AXP_OF_PROP_READ(pmu_init_chgvol, INTCHGVOL / 1000); |
---|
919 | 935 | AXP_OF_PROP_READ(pmu_init_chgend_rate, INTCHGENDRATE); |
---|
920 | 936 | AXP_OF_PROP_READ(pmu_init_chg_enabled, 1); |
---|