lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1322509793-10800-5-git-send-email-dirk.brandewie@gmail.com>
Date:	Mon, 28 Nov 2011 11:49:53 -0800
From:	dirk.brandewie@...il.com
To:	linux-kernel@...r.kernel.org
Cc:	cbouatmailru@...il.com, dg77.kim@...sung.com,
	kyungmin.park@...sung.com, myungjoo.ham@...sung.com,
	Jason.Wortham@...im-ic.com, alan@...ux.intel.com,
	Dirk Brandewie <dirk.brandewie@...il.com>
Subject: [PATCH 4/4] x86-mrst: Add battery fuel guage platform data

From: Dirk Brandewie <dirk.brandewie@...il.com>

Add platform data to configure the MAX17042 at POR.  The accuracy of
the MAX17042 is improved by initializing the fuel gauge with the
battery characterization data.Summary:
---
 arch/x86/platform/mrst/mrst.c |   46 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index b1489a0..b4032a9 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -22,6 +22,8 @@
 #include <linux/i2c.h>
 #include <linux/i2c/pca953x.h>
 #include <linux/gpio_keys.h>
+#include <linux/power_supply.h>
+#include <linux/power/max17042_battery.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/irq.h>
@@ -484,6 +486,49 @@ static void __init *max7315_platform_data(void *info)
 	return max7315;
 }
 
+#define	NTC_47K_TGAIN	0xE4E4
+#define	NTC_47K_TOFF	0x2F1D
+
+static void *max17042_platform_data(void *info)
+{
+	struct i2c_board_info *i2c_info = (struct i2c_board_info *)info;
+	static struct max17042_platform_data platform_data;
+	static struct max17042_config_data config_data = {
+		.tgain = NTC_47K_TGAIN,
+		.toff = NTC_47K_TOFF,
+		.config = 0x2210,
+		.learn_cfg = 0x0076,
+		.filter_cfg = 0x87A4,
+		.relax_cfg = 0x506B,
+		.rcomp0 = 0x0092,
+		.tcompc0 = 0x0B19,
+		.empty_tempco = 0x2D51,
+		.kempty0 = 0x0D83,
+		.fullcap = 14727,
+		.design_cap = 14727,
+		.fullcapnom = 14727,
+		.cell_technology = POWER_SUPPLY_TECHNOLOGY_LION,
+		.cell_char_tbl = {
+	/* Data to be written from 0x80h */
+	0xABB0, 0xB2B0, 0xBB10, 0xBBB0, 0xBC10, 0xBC70, 0xBD00, 0xBD70,
+	0xBDC0, 0xBE10, 0xC010, 0xC130, 0xC4A0, 0xC9C0, 0xCD10, 0xD090,
+ 	/* Data to be written from 0x90h */
+	0x0620, 0x0420, 0x1900, 0x3600, 0x3DA0, 0x2CA0, 0x3C20, 0x3500,
+	0x3500, 0x0440, 0x1240, 0x0DF0, 0x08F0, 0x0870, 0x07F0, 0x07F0,
+	/* Data to be written from 0xA0h */
+	0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+	0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+		},
+	};
+
+	strcpy(i2c_info->type, "max17042");
+	platform_data.enable_por_init = 1;
+	platform_data.config_data = &config_data;
+	platform_data.enable_current_sense = 1;
+
+	return &platform_data;
+}
+
 static void __init *emc1403_platform_data(void *info)
 {
 	static short intr2nd_pdata;
@@ -649,6 +694,7 @@ static const struct devs_id __initconst device_ids[] = {
 	{"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data},
 	{"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data},
 	{"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data},
+	{"max17042", SFI_DEV_TYPE_I2C, 0, &max17042_platform_data},
 	{"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data},
 	{"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data},
 	{"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data},
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ