From 5b492ba019c392089cd370e224ff5d7a61236ead Mon Sep 17 00:00:00 2001 From: zwp Date: Sun, 10 Jul 2011 20:33:04 -0700 Subject: [PATCH] HYM8563 RTC: combine several i2c operations to one operation in oder to prevent kernel crashing when alarm suspend. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 闹钟休眠的时候需要进行i2c传输,某些情况下会出现休眠时i2c超时的情况,导致系统崩溃。 原来连续地址的i2c读写分为1个字节的多次传输,这里将其改为多个字节的一次传输 --- drivers/rtc/rtc-HYM8563.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-HYM8563.c b/drivers/rtc/rtc-HYM8563.c index 1b5690d08049..9c6f9b72f68c 100644 --- a/drivers/rtc/rtc-HYM8563.c +++ b/drivers/rtc/rtc-HYM8563.c @@ -93,9 +93,11 @@ static int hym8563_read_datetime(struct i2c_client *client, struct rtc_time *tm) u8 i,regs[HYM8563_RTC_SECTION_LEN] = { 0, }; mutex_lock(&hym8563->mutex); - for (i = 0; i < HYM8563_RTC_SECTION_LEN; i++) { - hym8563_i2c_read_regs(client, RTC_SEC+i, ®s[i], 1); - } +// for (i = 0; i < HYM8563_RTC_SECTION_LEN; i++) { +// hym8563_i2c_read_regs(client, RTC_SEC+i, ®s[i], 1); +// } + hym8563_i2c_read_regs(client, RTC_SEC, regs, HYM8563_RTC_SECTION_LEN); + mutex_unlock(&hym8563->mutex); tm->tm_sec = bcd2bin(regs[0x00] & 0x7F); @@ -181,9 +183,11 @@ static int hym8563_set_time(struct i2c_client *client, struct rtc_time *tm) regs[0x05] = (regs[0x05] & 0x80)| (bin2bcd(tm->tm_mon + 1) & 0x7F); //set the month mutex_lock(&hym8563->mutex); - for(i=0;imutex); return 0; -- 2.34.1