EM/Battery: Moving battery characterization data into board file for clovertrail
authorPandey Raj <raj.pandey@intel.com>
Mon, 16 Apr 2012 10:03:33 +0000 (15:33 +0530)
committerbuildbot <buildbot@intel.com>
Tue, 17 Apr 2012 17:32:45 +0000 (10:32 -0700)
BZ: 30263

This patch is submitted to move the battery characterization data into board
file. Since there is a dependency on SMIP to provide this data, moving data
temporarily. Once the SMIP provides the battery characterization data, the
driver will read the data from SMIP only.

Change-Id: I45f677e5cd8a33bcfe1015959765332dafbe9379
Signed-off-by: Pandey Raj <raj.pandey@intel.com>
Reviewed-on: http://android.intel.com:8080/43549
Reviewed-by: Gross, Mark <mark.gross@intel.com>
Reviewed-by: Pallala, Ramakrishna <ramakrishna.pallala@intel.com>
Tested-by: Kallappa Manjanna, MadhukumarX <madhukumarx.kallappa.manjanna@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
arch/x86/platform/intel-mid/device_libs/platform_max17042.c

index ecf50e8..b0f4b62 100644 (file)
@@ -92,6 +92,49 @@ int mfld_fg_save_config_data(const char *name, void *data, int len)
 }
 EXPORT_SYMBOL(mfld_fg_save_config_data);
 
+static uint16_t ctp_cell_char_tbl[] = {
+       /* Data to be written from 0x80h */
+       0x9d70, 0xb720, 0xb940, 0xba50, 0xbba0, 0xbc70, 0xbce0, 0xbd40,
+       0xbe60, 0xbf60, 0xc1e0, 0xc470, 0xc700, 0xc970, 0xcce0, 0xd070,
+
+       /* Data to be written from 0x90h */
+       0x00c0, 0x1730, 0x0690, 0x1260, 0x2a00, 0x3100, 0x3a30, 0x15a0,
+       0x18f0, 0x0c80, 0x0c20, 0x0b10, 0x0b60, 0x07e0, 0x07a0, 0x07a0,
+
+       /* Data to be written from 0xA0h */
+       0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+       0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+};
+
+static void ctp_fg_restore_config_data(const char *name, void *data, int len)
+{
+       struct max17042_config_data *fg_cfg_data =
+                               (struct max17042_config_data *)data;
+       fg_cfg_data->cfg = 0x2210;
+       fg_cfg_data->learn_cfg = 0x0076;
+       fg_cfg_data->filter_cfg = 0x87a4;
+       fg_cfg_data->relax_cfg = 0x506b;
+       memcpy(&fg_cfg_data->cell_char_tbl, ctp_cell_char_tbl,
+                                       sizeof(ctp_cell_char_tbl));
+       fg_cfg_data->rcomp0 = 0x0047;
+       fg_cfg_data->tempCo = 0x1920;
+       fg_cfg_data->etc = 0x00e0;
+       fg_cfg_data->kempty0 = 0x0100;
+       fg_cfg_data->ichgt_term = 0x0240;
+       fg_cfg_data->full_cap = 3400;
+       fg_cfg_data->design_cap = 3400;
+       fg_cfg_data->full_capnom = 3400;
+       fg_cfg_data->soc_empty = 0x0060;
+       fg_cfg_data->rsense = 1;
+}
+EXPORT_SYMBOL(ctp_fg_restore_config_data);
+
+static int ctp_fg_save_config_data(const char *name, void *data, int len)
+{
+       return 0;
+}
+EXPORT_SYMBOL(ctp_fg_save_config_data);
+
 void *max17042_platform_data(void *info)
 {
        static struct max17042_platform_data platform_data;
@@ -137,6 +180,12 @@ void *max17042_platform_data(void *info)
        platform_data.restore_config_data = mfld_fg_restore_config_data;
        platform_data.save_config_data = mfld_fg_save_config_data;
 #endif
+#ifdef CONFIG_BOARD_CTP
+       platform_data.enable_current_sense = true;
+       platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
+       platform_data.restore_config_data = ctp_fg_restore_config_data;
+       platform_data.save_config_data = ctp_fg_save_config_data;
+#endif
 #ifdef CONFIG_CHARGER_SMB347 /* redridge dv10 */
        platform_data.battery_status = smb347_get_charging_status;
 #endif