Hi,

I am sending bug fix patch for Intel MSIC battery driver.

In my earlier patches.. I have changed the IPC command call "len" argument from 
1 to sizeof(variable).
http://lists.meego.com/pipermail/meego-kernel/2010-December/001760.html

But in the IPC driver they are again calculating the size with by (4 * len), to 
this fix I am reverting
Back my changes so that we pass the length as multiples of DWORD.

Also battery SFI Table got revised slightly. So updating the SFI Table 
structure and modified temperature lookup function.


Signed-off-by: Ramakrishna Pallala <[email protected]>
---
 drivers/power/intel_mdf_battery.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/power/intel_mdf_battery.c 
b/drivers/power/intel_mdf_battery.c
index cd4ccde..77c613f 100644
--- a/drivers/power/intel_mdf_battery.c
+++ b/drivers/power/intel_mdf_battery.c
@@ -338,6 +338,7 @@ static int const therm_curve_data[THERM_CURVE_MAX_SAMPLES]
 /* Parameters defining the range */
 struct temp_mon_table {
        short int temp_up_lim;
+       short int temp_low_lim;
        short int rbatt;
        short int full_chrg_vol;
        short int full_chrg_cur;
@@ -357,7 +358,6 @@ struct msic_batt_sfi_prop {
        short int battery_type;
        short int temp_mon_ranges;
        struct temp_mon_table temp_mon_range[SFI_TEMP_NR_RNG];
-       short int temp_least_ll;
 } __packed;
 
 static struct msic_batt_sfi_prop *sfi_table;
@@ -891,7 +891,7 @@ static unsigned int msic_read_coloumb_ctr(void)
 
        /* determine other parameters */
        err = intel_scu_ipc_command(IPCMSG_BATTERY, IPCCMD_CC_READ, NULL, 0,
-                                               &cvalue, sizeof(cvalue));
+                                               &cvalue, 1);
        if (err)
                dev_warn(msic_dev, "IPC Command Failed %s\n", __func__);
 
@@ -1698,17 +1698,11 @@ static void calculate_charge_cycles(struct 
msic_power_module_info *mbi,
 
 static unsigned int sfi_temp_range_lookup(int adc_temp)
 {
-       int i, up_lim, low_lim;
+       int i;
 
        for (i = 0; i < sfi_table->temp_mon_ranges; i++) {
-               /* find teh low temperature limit */
-               if (i == (sfi_table->temp_mon_ranges - 1))
-                       low_lim = sfi_table->temp_least_ll;
-               else
-                       low_lim = sfi_table->temp_mon_range[i+1].temp_up_lim;
-               up_lim = sfi_table->temp_mon_range[i].temp_up_lim;
-
-               if (adc_temp <= up_lim && adc_temp > low_lim) {
+               if (adc_temp <= sfi_table->temp_mon_range[i].temp_up_lim &&
+                       adc_temp > sfi_table->temp_mon_range[i].temp_low_lim) {
                        dev_dbg(msic_dev, "Temp Range %d\n", i);
                        break;
                }
@@ -2301,7 +2295,7 @@ static void ipc_ocv_to_chrg_update(struct 
msic_power_module_info *mbi)
 
        /* Send the Open Circuit Charge Value to SCU */
        err = intel_scu_ipc_command(IPCMSG_BATTERY, IPCCMD_CC_WRITE, &chr_ocv,
-                                               sizeof(chr_ocv), NULL, 0);
+                                               1, NULL, 0);
        if (err)
                dev_warn(msic_dev, "IPC Command Failed %s\n", __func__);
 }
-- 
1.7.2.3






Attachment: 0001-IPC-command-fix-patch.patch
Description: 0001-IPC-command-fix-patch.patch

_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to