Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2019 03:11:28 +0000 (UTC)
From:      Ganbold Tsagaankhuu <ganbold@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344456 - head/sys/arm/allwinner
Message-ID:  <201902220311.x1M3BSxG058164@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ganbold
Date: Fri Feb 22 03:11:27 2019
New Revision: 344456
URL: https://svnweb.freebsd.org/changeset/base/344456

Log:
  Add base to the warning threshold.

Modified:
  head/sys/arm/allwinner/axp81x.c

Modified: head/sys/arm/allwinner/axp81x.c
==============================================================================
--- head/sys/arm/allwinner/axp81x.c	Fri Feb 22 03:10:24 2019	(r344455)
+++ head/sys/arm/allwinner/axp81x.c	Fri Feb 22 03:11:27 2019	(r344456)
@@ -195,8 +195,9 @@ MALLOC_DEFINE(M_AXP8XX_REG, "AXP8xx regulator", "AXP8x
 #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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902220311.x1M3BSxG058164>