mrst: Porting Chgr-FG-driver related changes to R3-ICS
authorPavan Kumar S <pavan.kumar.s@intel.com>
Thu, 22 Dec 2011 12:04:52 +0000 (17:34 +0530)
committerbuildbot <buildbot@intel.com>
Tue, 27 Dec 2011 07:16:02 +0000 (23:16 -0800)
BZ: 18239

This patch has the changes in mrst.c w.r.t charger and fuel-gauge drivers,
as part of porting from R2-stable to R3-ICS,

Change-Id: Ib4136131533961ebaa786c007be44255da7c9fea
Signed-off-by: Pavan Kumar S <pavan.kumar.s@intel.com>
Reviewed-on: http://android.intel.com:8080/29735
Reviewed-by: Pallala, Ramakrishna <ramakrishna.pallala@intel.com>
Reviewed-by: Mukherjee, DevapriyaX <devapriyax.mukherjee@intel.com>
Reviewed-by: Gugwad, SantoshX <santoshx.gugwad@intel.com>
Tested-by: Gugwad, SantoshX <santoshx.gugwad@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
arch/x86/platform/mrst/mrst.c

index 838699c..823b498 100644 (file)
@@ -932,6 +932,23 @@ static void *msic_gpio_platform_data(void *info)
        return msic_generic_platform_data(info, INTEL_MSIC_BLOCK_GPIO);
 }
 
+void max17042_i2c_reset_workaround(void)
+{
+/* toggle clock pin of I2C-1 to recover devices from abnormal status.
+ * currently, only max17042 on I2C-1 needs such workaround */
+#define I2C_1_GPIO_PIN 27
+       int i;
+       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_GPIO);
+       gpio_direction_output(I2C_1_GPIO_PIN, 0);
+       gpio_set_value(I2C_1_GPIO_PIN, 1);
+       udelay(10);
+       gpio_set_value(I2C_1_GPIO_PIN, 0);
+       udelay(10);
+       lnw_gpio_set_alt(I2C_1_GPIO_PIN, LNW_ALT_1);
+#undef I2C_1_GPIO_PIN 27
+}
+EXPORT_SYMBOL(max17042_i2c_reset_workaround);
+
 static void *max17042_platform_data(void *info)
 {
        static struct max17042_platform_data platform_data;
@@ -944,6 +961,8 @@ static void *max17042_platform_data(void *info)
        platform_data.is_init_done = 0;
        platform_data.technology = POWER_SUPPLY_TECHNOLOGY_LION;
 
+       platform_data.reset_i2c_lines = max17042_i2c_reset_workaround;
+
 #ifdef CONFIG_BATTERY_INTEL_MDF
        platform_data.current_sense_enabled =
            intel_msic_is_current_sense_enabled;
@@ -953,6 +972,13 @@ static void *max17042_platform_data(void *info)
        platform_data.battery_pack_temp = intel_msic_get_battery_pack_temp;
        platform_data.save_config_data = intel_msic_save_config_data;
        platform_data.restore_config_data = intel_msic_restore_config_data;
+
+       platform_data.is_cap_shutdown_enabled =
+                                       intel_msic_is_capacity_shutdown_en;
+       platform_data.is_volt_shutdown_enabled = intel_msic_is_volt_shutdown_en;
+       platform_data.is_lowbatt_shutdown_enabled =
+                                       intel_msic_is_lowbatt_shutdown_en;
+       platform_data.get_vmin_threshold = intel_msic_get_vsys_min;
 #endif
 
        return &platform_data;