summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@ocgnet.org>2006-04-18 22:20:27 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-19 09:13:49 -0700
commit8db08de4f6ae24e90aedf5125b5ddd52ffff15f4 (patch)
treea35f45d38b25f1ad9ddbc006712488d26ecaf987 /drivers/i2c
parentb73781c866f671ff5a84d7c840510b43e8731d13 (diff)
downloadlinux-3.10-8db08de4f6ae24e90aedf5125b5ddd52ffff15f4.tar.gz
linux-3.10-8db08de4f6ae24e90aedf5125b5ddd52ffff15f4.tar.bz2
linux-3.10-8db08de4f6ae24e90aedf5125b5ddd52ffff15f4.zip
[PATCH] m41t00: fix bitmasks when writing to chip
Fix the bitmasks used when writing to the M41T00 registers. The original code used a mask of 0x7f when writing to each register, this is incorrect and probably the result of a copy-paste error. As a result years from 1980 to 1999 will be read back as 2000 to 2019. Signed-off-by: David Barksdale <amatus@ocgnet.org> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/chips/m41t00.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c
index 27fc9ff2961..99ab4ec3439 100644
--- a/drivers/i2c/chips/m41t00.c
+++ b/drivers/i2c/chips/m41t00.c
@@ -131,13 +131,13 @@ m41t00_set(void *arg)
if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0)
|| (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f)
< 0)
- || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x7f)
+ || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x3f)
< 0)
- || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x7f)
+ || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x3f)
< 0)
- || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x7f)
+ || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x1f)
< 0)
- || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0x7f)
+ || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0xff)
< 0))
dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n");