Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233697
b: refs/heads/master
c: a2d6d2f
h: refs/heads/master
i:
  233695: 3247813
v: v3
  • Loading branch information
Lei Xu authored and Linus Torvalds committed Feb 25, 2011
1 parent ed86e54 commit fbf8c65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 294f6cf48666825d23c9372ef37631232746e40d
refs/heads/master: a2d6d2fa90c0e1d2cc1d59ccb5bbe93bb28b7413
14 changes: 9 additions & 5 deletions trunk/drivers/rtc/rtc-ds3232.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C
*
* Copyright (C) 2009-2010 Freescale Semiconductor.
* Copyright (C) 2009-2011 Freescale Semiconductor.
* Author: Jack Lan <jack.lan@freescale.com>
*
* This program is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -141,9 +141,11 @@ static int ds3232_read_time(struct device *dev, struct rtc_time *time)
time->tm_hour = bcd2bin(hour);
}

time->tm_wday = bcd2bin(week);
/* Day of the week in linux range is 0~6 while 1~7 in RTC chip */
time->tm_wday = bcd2bin(week) - 1;
time->tm_mday = bcd2bin(day);
time->tm_mon = bcd2bin(month & 0x7F);
/* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */
time->tm_mon = bcd2bin(month & 0x7F) - 1;
if (century)
add_century = 100;

Expand All @@ -162,9 +164,11 @@ static int ds3232_set_time(struct device *dev, struct rtc_time *time)
buf[0] = bin2bcd(time->tm_sec);
buf[1] = bin2bcd(time->tm_min);
buf[2] = bin2bcd(time->tm_hour);
buf[3] = bin2bcd(time->tm_wday); /* Day of the week */
/* Day of the week in linux range is 0~6 while 1~7 in RTC chip */
buf[3] = bin2bcd(time->tm_wday + 1);
buf[4] = bin2bcd(time->tm_mday); /* Date */
buf[5] = bin2bcd(time->tm_mon);
/* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */
buf[5] = bin2bcd(time->tm_mon + 1);
if (time->tm_year >= 100) {
buf[5] |= 0x80;
buf[6] = bin2bcd(time->tm_year - 100);
Expand Down

0 comments on commit fbf8c65

Please sign in to comment.