Skip to contentSkip to conversation

max17042_battery: Add support for max17047/50 chip

PATCH Applied Ramakrishna Pallala 2 participants 2 messages May 5, 2012 – May 6, 2012 Power supply

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 max17042_battery: Add support for max17047/50 chip

max17047 is improved version of max17042 chip. It has few HW bug fixes with minor changes in register set.

max17050 is same as max17047 chip except its silicon packging. So from driver's point of view there is no difference btw max1047 and max1050.

This patch adds the support to dynamically detect the chip type and adds steps to initialize the max17047 chip.

This patch is generated on top of the following patch:
[PATCH] max17042_battery: Handle irq request failure case

---
 drivers/power/Kconfig                  |    5 +-
 drivers/power/max17042_battery.c       |   69 ++++++++++++++++++++++++++-----
 include/linux/power/max17042_battery.h |   17 ++++++++
 3 files changed, 78 insertions(+), 13 deletions(-)
drivers/power/Kconfig +3 -2
index 0c52a40..947b3ed 100644
@@ -181,14 +181,15 @@ config BATTERY_MAX17040
 	  to operate with a single lithium cell
 
 config BATTERY_MAX17042
-	tristate "Maxim MAX17042/8997/8966 Fuel Gauge"
+	tristate "Maxim MAX17042/17047/17050/8997/8966 Fuel Gauge"
 	depends on I2C
 	help
 	  MAX17042 is fuel-gauge systems for lithium-ion (Li+) batteries
 	  in handheld and portable equipment. The MAX17042 is configured
 	  to operate with a single lithium cell. MAX8997 and MAX8966 are
 	  multi-function devices that include fuel gauages that are compatible
-	  with MAX17042.
+	  with MAX17042. This driver also supports max17047/50 chips which are
+	  improved version of max17042.
 
 config BATTERY_Z2
 	tristate "Z2 battery driver"
drivers/power/max17042_battery.c +58 -11

137 lines not on this page · raw message

include/linux/power/max17042_battery.h +17 -0
index e01b167..89dd84f 100644
@@ -116,6 +116,18 @@ enum max17042_register {
 	MAX17042_VFSOC		= 0xFF,
 };
 
+/* Registers specific to max17047/50 */
+enum max17047_register {
+	MAX17047_QRTbl00	= 0x12,
+	MAX17047_FullSOCThr	= 0x13,
+	MAX17047_QRTbl10	= 0x22,
+	MAX17047_QRTbl20	= 0x32,
+	MAX17047_V_empty	= 0x3A,
+	MAX17047_QRTbl30	= 0x42,
+};
+
+enum max170xx_chip_type {MAX17042, MAX17047};
+
 /*
  * used for setting a register to a desired value
  * addr : address for a register
@@ -144,6 +156,7 @@ struct max17042_config_data {
 	u16	shdntimer;	/* 0x03F */
 
 	/* App data */
+	u16	full_soc_thresh;	/* 0x13 */
 	u16	design_cap;	/* 0x18 */
 	u16	ichgt_term;	/* 0x1E */
 
@@ -162,6 +175,10 @@ struct max17042_config_data {
 	u16	lavg_empty;	/* 0x36 */
 	u16	dqacc;		/* 0x45 */
 	u16	dpacc;		/* 0x46 */
+	u16	qrtbl00;	/* 0x12 */
+	u16	qrtbl10;	/* 0x22 */
+	u16	qrtbl20;	/* 0x32 */
+	u16	qrtbl30;	/* 0x42 */
 
 	/* Cell technology from power_supply.h */
 	u16	cell_technology;
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 6 lines · Ramakrishna Pallala

max17047 is improved version of max17042 chip. It has few HW bug fixes with minor changes in register set.

max17050 is same as max17047 chip except its silicon packging. So from driver's point of view there is no difference btw max1047 and max1050.

Quoted 8 lines

This patch adds the support to dynamically detect the chip type and adds steps to initialize the max17047 chip.

This patch is generated on top of the following patch:
[PATCH] max17042_battery: Handle irq request failure case

---

Applied, thank you!

Signature · 2 lines
Anton Vorontsov
Email: [email protected]