rk808:modify rtc error and solve the leakage in sleep mode
author张晴 <zhangqing@rock-chips.com>
Sun, 7 Apr 2013 02:54:49 +0000 (10:54 +0800)
committer张晴 <zhangqing@rock-chips.com>
Sun, 7 Apr 2013 02:54:49 +0000 (10:54 +0800)
arch/arm/mach-rk30/board-pmu-rk808.c
arch/arm/mach-rk30/board-rk3168-tb.c
drivers/rtc/rtc-rk808.c

index d2e05f055df2fc4d9f1f60ed576e57e60860d27d..bfeefb85d578d0b60a414aabce981b4ef69045d3 100755 (executable)
@@ -13,6 +13,53 @@ static int rk808_pre_init(struct rk808 *rk808)
 {
        int ret,val;
         printk("%s,line=%d\n", __func__,__LINE__);
+        /***********set ILIM ************/
+       val = rk808_reg_read(rk808,RK808_BUCK3_CONFIG_REG);
+       val &= (~(0x7 <<0));
+       val |= (0x2 <<0);
+       ret = rk808_reg_write(rk808,RK808_BUCK3_CONFIG_REG,val);
+       if (ret < 0) {
+                printk(KERN_ERR "Unable to write RK808_BUCK3_CONFIG_REG reg\n");
+                return ret;
+        }
+
+       val = rk808_reg_read(rk808,RK808_BUCK4_CONFIG_REG);
+       val &= (~(0x7 <<0));
+       val |= (0x3 <<0);
+       ret = rk808_reg_write(rk808,RK808_BUCK4_CONFIG_REG,val);
+       if (ret < 0) {
+                printk(KERN_ERR "Unable to write RK808_BUCK4_CONFIG_REG reg\n");
+                return ret;
+        }
+       
+       val = rk808_reg_read(rk808,RK808_BOOST_CONFIG_REG);
+       val &= (~(0x7 <<0));
+       val |= (0x1 <<0);
+       ret = rk808_reg_write(rk808,RK808_BOOST_CONFIG_REG,val);
+       if (ret < 0) {
+                printk(KERN_ERR "Unable to write RK808_BOOST_CONFIG_REG reg\n");
+                return ret;
+        }
+       /*****************************************/
+       /***********set buck OTP function************/
+       ret = rk808_reg_write(rk808,0x6f,0x5a);
+       if (ret < 0) {
+                printk(KERN_ERR "Unable to write 0x6f reg\n");
+                return ret;
+        }
+       
+       ret = rk808_reg_write(rk808,0x91,0x80);
+       if (ret < 0) {
+                printk(KERN_ERR "Unable to write 0x91 reg\n");
+                return ret;
+        }
+
+        ret = rk808_reg_write(rk808,0x92,0x55);
+        if (ret <0) {
+                printk(KERN_ERR "Unable to write 0x92 reg\n");
+                return ret;
+        }
+       /*****************************************/
        /***********set buck 12.5mv/us ************/
        val = rk808_reg_read(rk808,RK808_BUCK1_CONFIG_REG);
        val &= (~(0x3 <<3));
index f207a4b93cf063eea71e6c870154fe44b1686b20..d8b722cf5d331cc439bdefff4ad1810062518fed 100755 (executable)
@@ -1846,14 +1846,14 @@ static  struct pmu_info  act8846_ldo_info[] = {
 static struct pmu_info  rk808_dcdc_info[] = {
        {
                .name          = "vdd_cpu",   //arm
-               .min_uv          = 1100000,
-               .max_uv         = 1100000,
+               .min_uv          = 1000000,
+               .max_uv         = 1000000,
                .suspend_vol  =  900000,
        },
        {
                .name          = "vdd_core",    //logic
-               .min_uv          = 1100000,
-               .max_uv         = 1100000,
+               .min_uv          = 1000000,
+               .max_uv         = 1000000,
                .suspend_vol  =  900000,
        },
        {
index 8f1b579e3ba376e90ac503acac0560867fe7bdb5..91cd8db2d81b79b8b9b1b7f6e416c981a3fc52b0 100755 (executable)
@@ -110,7 +110,7 @@ static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)
 
                tm->tm_sec = bcd2bin(rtc_data[0]);
                tm->tm_min = bcd2bin(rtc_data[1]);
-               tm->tm_hour = bcd2bin(rtc_data[2]) -8;
+               tm->tm_hour = bcd2bin(rtc_data[2]) ;
                tm->tm_mday = bcd2bin(rtc_data[3]);
                tm->tm_mon = bcd2bin(rtc_data[4]) - 1;
                tm->tm_year = bcd2bin(rtc_data[5]) + 100;       
@@ -118,7 +118,7 @@ static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)
 
                printk( "RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
                        1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, tm->tm_wday,
-                       tm->tm_hour+8, tm->tm_min, tm->tm_sec);
+                       tm->tm_hour, tm->tm_min, tm->tm_sec);
                
                return ret;
 
@@ -135,14 +135,14 @@ static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)
        
         tm->tm_sec = bcd2bin(rtc_data[0]);
          tm->tm_min = bcd2bin(rtc_data[1]);
-         tm->tm_hour = bcd2bin(rtc_data[2]) - 8;
+         tm->tm_hour = bcd2bin(rtc_data[2]) ;
          tm->tm_mday = bcd2bin(rtc_data[3]);
          tm->tm_mon = bcd2bin(rtc_data[4]) - 1;
          tm->tm_year = bcd2bin(rtc_data[5]) + 100;       
          tm->tm_wday = bcd2bin(rtc_data[6]);
 
          dev_dbg(dev, "RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
-                        1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, tm->tm_wday,tm->tm_hour + 8, tm->tm_min, tm->tm_sec);
+                        1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, tm->tm_wday,tm->tm_hour , tm->tm_min, tm->tm_sec);
 
 #endif
        return 0;
@@ -162,14 +162,14 @@ static int rk808_rtc_set_time(struct device *dev, struct rtc_time *tm)
        
        rtc_data[0] = bin2bcd(tm->tm_sec);
        rtc_data[1] = bin2bcd(tm->tm_min);
-       rtc_data[2] = bin2bcd(tm->tm_hour + 8);
+       rtc_data[2] = bin2bcd(tm->tm_hour );
        rtc_data[3] = bin2bcd(tm->tm_mday);
        rtc_data[4] = bin2bcd(tm->tm_mon + 1);
        rtc_data[5] = bin2bcd(tm->tm_year - 100);
        rtc_data[6] = bin2bcd(tm->tm_wday);
 
         dev_dbg(dev, "set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
-                        1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, tm->tm_wday,tm->tm_hour + 8, tm->tm_min, tm->tm_sec);
+                        1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, tm->tm_wday,tm->tm_hour , tm->tm_min, tm->tm_sec);
 
        /*Dummy read*/  
        ret = rk808_reg_read(rk808, RK808_RTC_CTRL_REG);
@@ -255,7 +255,7 @@ static int rk808_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
        /* some of these fields may be wildcard/"match all" */
        alrm->time.tm_sec = bcd2bin(alrm_data[0]);
        alrm->time.tm_min = bcd2bin(alrm_data[1]);
-       alrm->time.tm_hour = bcd2bin(alrm_data[2]) -8;
+       alrm->time.tm_hour = bcd2bin(alrm_data[2]);
        alrm->time.tm_mday = bcd2bin(alrm_data[3]);
        alrm->time.tm_mon = bcd2bin(alrm_data[4]) - 1;
        alrm->time.tm_year = bcd2bin(alrm_data[5]) + 100;
@@ -266,7 +266,7 @@ static int rk808_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
                return ret;
        }
        dev_dbg(dev,"alrm read RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
-                        1900 + alrm->time.tm_year, alrm->time.tm_mon + 1, alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour +8, alrm->time.tm_min, alrm->time.tm_sec);
+                        1900 + alrm->time.tm_year, alrm->time.tm_mon + 1, alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour, alrm->time.tm_min, alrm->time.tm_sec);
 
 
 
@@ -308,12 +308,12 @@ static int rk808_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
                return ret;
        }
 
-        printk("alrm set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
-                        1900 + alrm->time.tm_year, alrm->time.tm_mon + 1, alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour +8, alrm->time.tm_min, alrm->time.tm_sec);
+        dev_dbg(dev,"alrm set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
+                        1900 + alrm->time.tm_year, alrm->time.tm_mon + 1, alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour, alrm->time.tm_min, alrm->time.tm_sec);
 
        alrm_data[0] = bin2bcd(alrm->time.tm_sec);
        alrm_data[1] = bin2bcd(alrm->time.tm_min);
-       alrm_data[2] = bin2bcd(alrm->time.tm_hour + 8);
+       alrm_data[2] = bin2bcd(alrm->time.tm_hour );
        alrm_data[3] = bin2bcd(alrm->time.tm_mday);
        alrm_data[4] = bin2bcd(alrm->time.tm_mon + 1);
        alrm_data[5] = bin2bcd(alrm->time.tm_year - 100);