rk31:pmu:rt5025:to slove without battery can turns on system
author张晴 <zhangqing@rock-chips.com>
Fri, 25 Oct 2013 07:44:43 +0000 (15:44 +0800)
committer张晴 <zhangqing@rock-chips.com>
Fri, 25 Oct 2013 07:44:43 +0000 (15:44 +0800)
arch/arm/mach-rk30/board-pmu-rt5025.c
drivers/mfd/rt5025-irq.c
drivers/power/rt5025-battery.c
drivers/power/rt5025-swjeita.c
include/linux/mfd/rt5025.h

index e6aee327ff7aff8ecbe373b46fb1a411a75e9a6a..9c3c1260e7c02b4ab7653a7a2651c82aa533cb51 100644 (file)
@@ -419,8 +419,8 @@ static struct rt5025_irq_data rt5025_irq_data = {
 
 //temp unit: 'c*10 degree
 static int jeita_temp[4] = { 0, 150, 500, 600};
-                            //-5',  5',   15', 20',   45'   55'   55',  65'
-static u8 jeita_scalar[8] = { 0x30, 0x2B, 0x25, 0x20, 0x15, 0x10, 0x10, 0x0D };
+                            //-5',  5',   10', 20',   45'   55'   55',  65'
+static u8 jeita_scalar[8] = { 0x30, 0x2B, 0x28, 0x22, 0x15, 0x10, 0x10, 0x0D };
 //cc unit: xxx mA
 static int jeita_temp_cc[][5] = {{ 500,  500,  500,  500, 500},    // not plugin
                                 {   0 , 500,  500,  500,   0},    // normal USB
index 84619d7bca15c370d88d6187e4ebccef2c62a889..c0fa0dae5b5e0ae21428bafa95cf560dfd6674bc 100644 (file)
@@ -38,6 +38,7 @@ struct rt5025_irq_info {
        int intr_pin;
        int irq;
        int suspend;
+       int init_once;
 };
 
 static void rt5025_work_func(struct work_struct *work)
@@ -114,14 +115,17 @@ static void rt5025_work_func(struct work_struct *work)
 
                        if (chg_event & (CHG_EVENT_INAC_PLUGIN | CHG_EVENT_INUSB_PLUGIN))
                        {
-                               rt5025_set_charging_buck(ii->i2c, 0);
-                               mdelay(50);
-                               rt5025_set_charging_buck(ii->i2c, 1);
-                               mdelay(100);
-                               rt5025_set_charging_buck(ii->i2c, 0);
-                               mdelay(50);
-                               rt5025_set_charging_buck(ii->i2c, 1);
-                               mdelay(200);
+                               if (!ii->init_once)
+                               {
+                                       rt5025_set_charging_buck(ii->i2c, 0);
+                                       mdelay(50);
+                                       rt5025_set_charging_buck(ii->i2c, 1);
+                                       mdelay(100);
+                                       rt5025_set_charging_buck(ii->i2c, 0);
+                                       mdelay(50);
+                                       rt5025_set_charging_buck(ii->i2c, 1);
+                                       mdelay(200);
+                               }
                        }
 
                        if (ii->chip->power_info->chg_term <= 3)
@@ -150,6 +154,9 @@ static void rt5025_work_func(struct work_struct *work)
                rt5025_gauge_irq_handler(ii->chip->battery_info, irq_stat[5] & RT5025_FLG_VOLT);
        #endif /* CONFIG_POWER_RT5025 */
 
+       if (ii->init_once)
+               ii->init_once = 0;
+
        /* restore all irq enable bit */
        rt5025_reg_write(ii->i2c, RT5025_REG_IRQEN1, irq_enable[0]);
        rt5025_reg_write(ii->i2c, RT5025_REG_IRQEN2, irq_enable[1]);
@@ -258,6 +265,7 @@ static int __devinit rt5025_irq_probe(struct platform_device *pdev)
        if (pdata->cb)
                ii->event_cb = pdata->cb;
        wake_lock_init(&ii->irq_wake_lock, WAKE_LOCK_SUSPEND, "rt_irq_wake");
+       ii->init_once = 1;
 
        rt5025_irq_reg_init(ii, pdata->irq_data);
        rt5025_interrupt_init(ii);
index ba7cb2061a350fefa0d3014f86ad515b383fbe7e..6590417897a2588b59ac591d87e4130848237b38 100644 (file)
@@ -506,7 +506,7 @@ static void rt5025_get_dchg_cc(struct rt5025_battery_info *bi)
 {
   u8 data[4];
   u32 qh_old,ql_old,qh_new,ql_new;
-  u32 cc_masec,offset;
+  u32 cc_masec,offset=0;
   
   if (rt5025_read_reg(bi->client, RT5025_REG_QDCHGH_MSB, data, 4) < 0){
     printk(KERN_ERR "%s: Failed to read QDCHG\n", __func__);
index 965fe64fc42e8fac664fe3650735ba5b19399f1c..cb72a33a50dde8bb96f9e4fed188839f20cc80d7 100644 (file)
@@ -327,16 +327,44 @@ static void thermal_reg_work_func(struct work_struct *work)
 {
        struct delayed_work *delayed_work = (struct delayed_work *)container_of(work, struct delayed_work, work);
        struct rt5025_swjeita_info *swji = (struct rt5025_swjeita_info *)container_of(delayed_work, struct rt5025_swjeita_info, thermal_reg_work);
-       int therm_region;
+       int therm_region = 0;
        
        RTINFO("%s ++", __func__);
        rt5025_get_internal_temp(swji);
+
+       #if 1
+       switch (swji->cur_therm_region)
+       {
+               case 0:
+                       if (swji->cur_inttemp >=820)
+                               therm_region = 1;
+                       else
+                               therm_region = 0;
+                       break;
+               case 1:
+                       if (swji->cur_inttemp <= 780)
+                               therm_region = 0;
+                       else if (swji->cur_inttemp >= 1020)
+                               therm_region = 2;
+                       else
+                               therm_region = 1; 
+                       break;
+               case 2:
+                       if (swji->cur_inttemp <= 980)
+                               therm_region = 1;
+                       else
+                               therm_region = 2;
+                       break;
+                       
+       }
+       #else
        if (swji->cur_inttemp < 800)
                therm_region = 0;
        else if (swji->cur_inttemp >= 800 && swji->cur_inttemp < 1000)
                therm_region = 1;
        else
                therm_region = 2;
+       #endif /* #if 1*/
 
        if (therm_region != swji->cur_therm_region)
        {
index 267766deeeff534c82a1150b6732e9bf0bae0405..fd8b9fe8a3e9fc282fe4a96ff53dd6d0876482df 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/android_alarm.h>
 
 #define RT5025_DEVICE_NAME "RT5025"
-#define RT5025_DRV_VER    "1.0.5_R"
+#define RT5025_DRV_VER    "1.0.6_R"
 
 enum {
        RT5025_RSTDELAY1_100MS,