mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mfd: mc13892: more descriptive charger register defines
@ 2016-11-04  9:19 Alexander Kurz
  2016-11-07  7:54 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kurz @ 2016-11-04  9:19 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Kurz

Make access to the mc13892 charger parameter voltage, current and max power
dissipation readable in terms of millivolts, milliamps and milliwatts.

Signed-off-by: Alexander Kurz <akurz@blala.de>
---
 arch/arm/boards/efika-mx-smartbook/board.c |  4 +--
 include/mfd/mc13892.h                      | 40 +++++++++++++++++++++++-------
 2 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/arch/arm/boards/efika-mx-smartbook/board.c b/arch/arm/boards/efika-mx-smartbook/board.c
index d7c11dc..d7c5681 100644
--- a/arch/arm/boards/efika-mx-smartbook/board.c
+++ b/arch/arm/boards/efika-mx-smartbook/board.c
@@ -74,9 +74,7 @@ static void efikamx_power_init(struct mc13xxx *mc)
 
 	/* Externally powered */
 	mc13xxx_reg_read(mc, MC13892_REG_CHARGE, &val);
-	val |= MC13782_CHARGE_ICHRG0 | MC13782_CHARGE_ICHRG1 |
-		MC13782_CHARGE_ICHRG2 | MC13782_CHARGE_ICHRG3 |
-		MC13782_CHARGE_CHGAUTOB;
+	val |= MC13782_CHARGE_ICHRG_FULL | MC13782_CHARGE_CHGAUTOB;
 	mc13xxx_reg_write(mc, MC13892_REG_CHARGE, val);
 
 	/* power up the system first */
diff --git a/include/mfd/mc13892.h b/include/mfd/mc13892.h
index c92a462..8b52239 100644
--- a/include/mfd/mc13892.h
+++ b/include/mfd/mc13892.h
@@ -29,21 +29,43 @@
 
 /* REG_CHARGE */
 
-#define MC13782_CHARGE_VCHRG0		(1 << 0)
-#define MC13782_CHARGE_VCHRG1		(1 << 1)
-#define MC13782_CHARGE_VCHRG2		(1 << 2)
-#define MC13782_CHARGE_ICHRG0		(1 << 3)
-#define MC13782_CHARGE_ICHRG1		(1 << 4)
-#define MC13782_CHARGE_ICHRG2		(1 << 5)
-#define MC13782_CHARGE_ICHRG3		(1 << 6)
+#define MC13782_CHARGE_VCHRG_3800	(0 << 0)
+#define MC13782_CHARGE_VCHRG_4100	(1 << 0)
+#define MC13782_CHARGE_VCHRG_4150	(2 << 0)
+#define MC13782_CHARGE_VCHRG_4200	(3 << 0)
+#define MC13782_CHARGE_VCHRG_4250	(4 << 0)
+#define MC13782_CHARGE_VCHRG_4300	(5 << 0)
+#define MC13782_CHARGE_VCHRG_4375	(6 << 0)
+#define MC13782_CHARGE_VCHRG_4450	(7 << 0)
+#define MC13782_CHARGE_VCHRG_MASK	(7 << 0)
+#define MC13782_CHARGE_ICHRG_0		(0 << 3)
+#define MC13782_CHARGE_ICHRG_80		(1 << 3)
+#define MC13782_CHARGE_ICHRG_240	(2 << 3)
+#define MC13782_CHARGE_ICHRG_320	(3 << 3)
+#define MC13782_CHARGE_ICHRG_400	(4 << 3)
+#define MC13782_CHARGE_ICHRG_480	(5 << 3)
+#define MC13782_CHARGE_ICHRG_560	(6 << 3)
+#define MC13782_CHARGE_ICHRG_640	(7 << 3)
+#define MC13782_CHARGE_ICHRG_720	(8 << 3)
+#define MC13782_CHARGE_ICHRG_800	(9 << 3)
+#define MC13782_CHARGE_ICHRG_880	(10 << 3)
+#define MC13782_CHARGE_ICHRG_960	(11 << 3)
+#define MC13782_CHARGE_ICHRG_1040	(12 << 3)
+#define MC13782_CHARGE_ICHRG_1200	(13 << 3)
+#define MC13782_CHARGE_ICHRG_1600	(14 << 3)
+#define MC13782_CHARGE_ICHRG_FULL	(15 << 3)
+#define MC13782_CHARGE_ICHRG_MASK	(15 << 3)
 #define MC13782_CHARGE_TREN		(1 << 7)
 #define MC13782_CHARGE_ACKLPB		(1 << 8)
 #define MC13782_CHARGE_THCHKB		(1 << 9)
 #define MC13782_CHARGE_FETOVRD		(1 << 10)
 #define MC13782_CHARGE_FETCTRL		(1 << 11)
 #define MC13782_CHARGE_RVRSMODE		(1 << 13)
-#define MC13782_CHARGE_PLIM0		(1 << 15)
-#define MC13782_CHARGE_PLIM1		(1 << 16)
+#define MC13782_CHARGE_PLIM_600		(0 << 15)
+#define MC13782_CHARGE_PLIM_800		(1 << 15)
+#define MC13782_CHARGE_PLIM_1000	(2 << 15)
+#define MC13782_CHARGE_PLIM_1200	(3 << 15)
+#define MC13782_CHARGE_PLIM_MASK	(3 << 15)
 #define MC13782_CHARGE_PLIMDIS		(1 << 17)
 #define MC13782_CHARGE_CHRGLEDEN	(1 << 18)
 #define MC13782_CHARGE_CHGTMRRST	(1 << 19)
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mfd: mc13892: more descriptive charger register defines
  2016-11-04  9:19 [PATCH] mfd: mc13892: more descriptive charger register defines Alexander Kurz
@ 2016-11-07  7:54 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2016-11-07  7:54 UTC (permalink / raw)
  To: Alexander Kurz; +Cc: barebox

On Fri, Nov 04, 2016 at 10:19:06AM +0100, Alexander Kurz wrote:
> Make access to the mc13892 charger parameter voltage, current and max power
> dissipation readable in terms of millivolts, milliamps and milliwatts.
> 
> Signed-off-by: Alexander Kurz <akurz@blala.de>

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-07  7:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-04  9:19 [PATCH] mfd: mc13892: more descriptive charger register defines Alexander Kurz
2016-11-07  7:54 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox