A22:modify battery parameter and add log of battery status changed
authorroot <root@lw.(none)>
Fri, 8 Jul 2011 06:36:09 +0000 (14:36 +0800)
committerroot <root@lw.(none)>
Fri, 8 Jul 2011 06:37:39 +0000 (14:37 +0800)
arch/arm/mach-rk29/board-rk29-a22.c
drivers/power/wm831x_power.c

index 4238cb417e8c5821029a8cb8586d3991acbca56f..c5eb8a7dbb5430b4f45afd8c86eed057af73b0e6 100755 (executable)
@@ -847,7 +847,7 @@ struct wm831x_battery_pdata wm831x_battery_platdata = {
        .trickle_ilim = 200,   /** Trickle charge current limit, in mA */
        .vsel = 4200,           /** Target voltage, in mV */
        .eoc_iterm = 90,      /** End of trickle charge current, in mA */
-       .fast_ilim = 500,      /** Fast charge current limit, in mA */
+       .fast_ilim = 600,      /** Fast charge current limit, in mA */
        .timeout = 240,        /** Charge cycle timeout, in minutes */
        .syslo = 3300,    /* syslo threshold, in mV*/
        .sysok = 3500,    /* sysko threshold, in mV*/
index d3cf3e5664052b649459bc232c909ca4367c06a7..145911ab9b6635833c83d32bcb5e719fc0e1eb3b 100755 (executable)
@@ -18,6 +18,7 @@
 #include <linux/mfd/wm831x/auxadc.h>
 #include <linux/mfd/wm831x/pmu.h>
 #include <linux/mfd/wm831x/pdata.h>
+#include <linux/mfd/wm831x/irq.h>
 
 #define WM831X_DEBUG
 #undef  WM831X_DEBUG
@@ -36,8 +37,8 @@
 #define batt_num   52
 
 static int batt_step_table[batt_num] = {
-       3370,3405,3440,3475,3505,3530,
-       3550,3567,3584,3600,3615,
+       3380,3405,3440,3475,3505,3525,
+       3540,3557,3570,3580,3610,
        3630,3643,3655,3665,3673,
        3680,3687,3693,3699,3705,
        3710,3714,3718,3722,3726,
@@ -669,21 +670,21 @@ static const char *wm831x_bat_irqs[] = {
        "START",
 };
 
-#if 0
 static irqreturn_t wm831x_bat_irq(int irq, void *data)
 {
        struct wm831x_power *wm831x_power = data;
        struct wm831x *wm831x = wm831x_power->wm831x;
-
-       dev_dbg(wm831x->dev, "Battery status changed: %d\n", irq);
-       WM_BATT_DBG("%s:Battery status changed %d\n", __FUNCTION__, irq);
+       int irq0;
+       
+       irq0 = wm831x->irq_base + WM831X_IRQ_CHG_BATT_HOT + 1;
+       dev_crit(wm831x->dev, "battery changed: i=%d\n", irq-irq0);
+                       
        /* The battery charger is autonomous so we don't need to do
         * anything except kick user space */
        power_supply_changed(&wm831x_power->battery);
 
        return IRQ_HANDLED;
 }
-#endif
 
 /*********************************************************************
  *             Initialisation
@@ -766,7 +767,7 @@ void wm831x_batt_vol_level(struct wm831x_power *wm831x_power, int batt_vol, int
                        *level = wm831x_power->batt_info.level;
 
                if (*level >= 100)
-                       *level = 99;
+                       *level = 100;
                if (*level < 0)
                        *level = 0;
        }
@@ -911,7 +912,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev)
        struct power_supply *usb;
        struct power_supply *battery;
        struct power_supply *wall;
-       int ret, irq;
+       int ret, irq, i;
 
        power = kzalloc(sizeof(struct wm831x_power), GFP_KERNEL);
        if (power == NULL)
@@ -975,7 +976,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev)
                        irq, ret);
                goto err_syslo;
        }
-#if 0       //ʹÓòéѯµÄ·½Ê½
+
        for (i = 0; i < ARRAY_SIZE(wm831x_bat_irqs); i++) {
                irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]);
                ret = request_threaded_irq(irq, NULL, wm831x_bat_irq,
@@ -990,7 +991,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev)
                        goto err_bat_irq;
                }
        }
-#endif
+
        power->interval = TIMER_MS_COUNTS;
        power->batt_info.level = 100;
        power->batt_info.voltage   = 4200;
@@ -1007,7 +1008,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev)
        printk("%s:wm831x_power initialized\n",__FUNCTION__);
        power_test_sysfs_init();
        return ret;
-#if 0
+
 err_bat_irq:
        for (; i >= 0; i--) {
                irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]);
@@ -1015,7 +1016,7 @@ err_bat_irq:
        }
        irq = platform_get_irq_byname(pdev, "PWR SRC");
        free_irq(irq, power);
-#endif
+
 err_syslo:
        irq = platform_get_irq_byname(pdev, "SYSLO");
        free_irq(irq, power);
@@ -1056,17 +1057,17 @@ static __devexit int wm831x_power_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM
 static int wm831x_battery_suspend(struct platform_device *dev, pm_message_t state)
 {
-       //struct wm831x_power *power = (struct wm831x_power *)platform_get_drvdata(dev);
-       //flush_scheduled_work();
-       //del_timer(&power->timer);
+       struct wm831x_power *power = (struct wm831x_power *)platform_get_drvdata(dev);
+       flush_scheduled_work();
+       del_timer(&power->timer);
        return 0;
 }
 
 static int wm831x_battery_resume(struct platform_device *dev)
 {
-       //struct wm831x_power *power = (struct wm831x_power *)platform_get_drvdata(dev);
-       //power->timer.expires = jiffies + msecs_to_jiffies(power->interval);
-       //add_timer(&power->timer);
+       struct wm831x_power *power = (struct wm831x_power *)platform_get_drvdata(dev);
+       power->timer.expires = jiffies + msecs_to_jiffies(power->interval);
+       add_timer(&power->timer);
        return 0;
 }
 #else