add rtc for android
author林辉辉 <lhh@rock-chips.com>
Tue, 18 May 2010 15:31:53 +0000 (15:31 +0000)
committer黄涛 <huangtao@rock-chips.com>
Mon, 21 Jun 2010 05:35:12 +0000 (13:35 +0800)
.config
drivers/rtc/rtc-HYM8563.c

diff --git a/.config b/.config
index 65ea64e1f0f6222343235a58fe2771267d27d5d9..2c59ca9b2000170e750036b56382c1ee5bafcd0a 100644 (file)
--- a/.config
+++ b/.config
@@ -1085,7 +1085,8 @@ CONFIG_SWITCH=y
 # CONFIG_ACCESSIBILITY is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-# CONFIG_RTC_HCTOSYS is not set
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
 
 #
index 095127fa3607b3db00018bce27773bd5681a3b68..753ae3f41372157dfda85b3ebffed4743fb81c45 100644 (file)
@@ -159,6 +159,12 @@ static int hym8563_read_datetime(struct i2c_client *client, struct rtc_time *tm)
        if(tm->tm_year < 0)
                tm->tm_year = 0;        
        tm->tm_isdst = 0;       
+       DBG("%s [%d]tm_sec=%d \n",__FUNCTION__,__LINE__,tm->tm_sec);
+       DBG("%s [%d]tm_min=%d \n",__FUNCTION__,__LINE__,tm->tm_min);
+       DBG("%s [%d]tm_hour=%d \n",__FUNCTION__,__LINE__,tm->tm_hour);
+       DBG("%s [%d]tm_mday=%d \n",__FUNCTION__,__LINE__,tm->tm_mday);
+       DBG("%s [%d]tm_mon=%d \n",__FUNCTION__,__LINE__,tm->tm_mon);
+       DBG("%s [%d]tm_year=%d \n",__FUNCTION__,__LINE__,tm->tm_year);
        return 0;
 }
 
@@ -173,6 +179,12 @@ static int hym8563_set_time(struct i2c_client *client, struct rtc_time *tm)
        u8 mon_day,i;
        u8 ret = 0;
        
+       DBG("%s [%d]tm_sec=%d \n",__FUNCTION__,__LINE__,tm->tm_sec);
+       DBG("%s [%d]tm_min=%d \n",__FUNCTION__,__LINE__,tm->tm_min);
+       DBG("%s [%d]tm_hour=%d \n",__FUNCTION__,__LINE__,tm->tm_hour);
+       DBG("%s [%d]tm_mday=%d \n",__FUNCTION__,__LINE__,tm->tm_mday);
+       DBG("%s [%d]tm_mon=%d \n",__FUNCTION__,__LINE__,tm->tm_mon);
+       DBG("%s [%d]tm_year=%d \n",__FUNCTION__,__LINE__,tm->tm_year);
        mon_day = rtc_month_days((tm->tm_mon), tm->tm_year + 1900);
        
        if(tm->tm_sec >= 60 || tm->tm_sec < 0 )         //set  sec
@@ -361,12 +373,6 @@ static int __devinit  hym8563_probe(struct i2c_client *client,const struct i2c_d
        hym8563_init_device(client);
        hym8563_read_datetime(client, &tm_read);        //read time from hym8563
        
-       DBG("%s [%d]tm_sec=%d \n",__FUNCTION__,__LINE__,tm_read.tm_sec);
-       DBG("%s [%d]tm_min=%d \n",__FUNCTION__,__LINE__,tm_read.tm_min);
-       DBG("%s [%d]tm_hour=%d \n",__FUNCTION__,__LINE__,tm_read.tm_hour);
-       DBG("%s [%d]tm_mday=%d \n",__FUNCTION__,__LINE__,tm_read.tm_mday);
-       DBG("%s [%d]tm_mon=%d \n",__FUNCTION__,__LINE__,tm_read.tm_mon);
-       DBG("%s [%d]tm_year=%d \n",__FUNCTION__,__LINE__,tm_read.tm_year);
        if(((tm_read.tm_year < 70) | (tm_read.tm_year > 137 )) | (tm_read.tm_mon == -1))        //if the hym8563 haven't initialized
        {
                hym8563_set_time(client, &tm);  //initialize the hym8563