From: 张晴 Date: Sun, 7 Apr 2013 02:54:49 +0000 (+0800) Subject: rk808:modify rtc error and solve the leakage in sleep mode X-Git-Tag: firefly_0821_release~7295 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b7e689877e2581d2935392a4a567d3024a5e93d1;p=firefly-linux-kernel-4.4.55.git rk808:modify rtc error and solve the leakage in sleep mode --- diff --git a/arch/arm/mach-rk30/board-pmu-rk808.c b/arch/arm/mach-rk30/board-pmu-rk808.c index d2e05f055df2..bfeefb85d578 100755 --- a/arch/arm/mach-rk30/board-pmu-rk808.c +++ b/arch/arm/mach-rk30/board-pmu-rk808.c @@ -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)); diff --git a/arch/arm/mach-rk30/board-rk3168-tb.c b/arch/arm/mach-rk30/board-rk3168-tb.c index f207a4b93cf0..d8b722cf5d33 100755 --- a/arch/arm/mach-rk30/board-rk3168-tb.c +++ b/arch/arm/mach-rk30/board-rk3168-tb.c @@ -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, }, { diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c index 8f1b579e3ba3..91cd8db2d81b 100755 --- a/drivers/rtc/rtc-rk808.c +++ b/drivers/rtc/rtc-rk808.c @@ -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);