Add base to the warning threshold.

This commit is contained in:
Ganbold Tsagaankhuu 2019-02-22 03:11:27 +00:00
parent f23e684bbf
commit 3e6de15436
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=344456

View File

@ -195,8 +195,9 @@ MALLOC_DEFINE(M_AXP8XX_REG, "AXP8xx regulator", "AXP8xx power regulator");
#define AXP_BAT_COULOMB_LO 0xe3
#define AXP_BAT_CAP_WARN 0xe6
#define AXP_BAT_CAP_WARN_LV1 0xf0 /* Bits 4, 5, 6, 7 */
#define AXP_BAT_CAP_WARN_LV2 0xf /* Bits 0, 1, 2, 3 */
#define AXP_BAT_CAP_WARN_LV1 0xf0 /* Bits 4, 5, 6, 7 */
#define AXP_BAP_CAP_WARN_LV1BASE 5 /* 5-20%, 1% per step */
#define AXP_BAT_CAP_WARN_LV2 0xf /* Bits 0, 1, 2, 3 */
/* Sensor conversion macros */
#define AXP_SENSOR_BAT_H(hi) ((hi) << 4)
@ -1527,6 +1528,7 @@ axp8xx_attach(device_t dev)
/* Get thresholds */
if (axp8xx_read(dev, AXP_BAT_CAP_WARN, &val, 1) == 0) {
sc->warn_thres = (val & AXP_BAT_CAP_WARN_LV1) >> 4;
sc->warn_thres += AXP_BAP_CAP_WARN_LV1BASE;
sc->shut_thres = (val & AXP_BAT_CAP_WARN_LV2);
if (bootverbose) {
device_printf(dev,