From: Ladislav Michl <[EMAIL PROTECTED]>

DS1339 manual, page 6, chapter Date and time operation:
  The DS1339 can be run in either 12-hour or 24-hour mode. Bit 6 of the
  hours register is defined as the 12-hour or 24-hour mode-select bit.
  When high, the 12-hour mode is selected.
 
Patch below makes ds1337 driver work as documented in manual.

Signed-off-by: Ladislav Michl <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/i2c/chips/ds1337.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

--- gregkh-2.6.orig/drivers/i2c/chips/ds1337.c  2005-07-29 11:30:00.000000000 
-0700
+++ gregkh-2.6/drivers/i2c/chips/ds1337.c       2005-07-29 11:34:02.000000000 
-0700
@@ -165,7 +165,7 @@
        buf[0] = 0;             /* reg offset */
        buf[1] = BIN2BCD(dt->tm_sec);
        buf[2] = BIN2BCD(dt->tm_min);
-       buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6);
+       buf[3] = BIN2BCD(dt->tm_hour);
        buf[4] = BIN2BCD(dt->tm_wday) + 1;
        buf[5] = BIN2BCD(dt->tm_mday);
        buf[6] = BIN2BCD(dt->tm_mon) + 1;
@@ -344,9 +344,9 @@
 
        /* Ensure that device is set in 24-hour mode */
        val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR);
-       if ((val >= 0) && (val & (1 << 6)) == 0)
+       if ((val >= 0) && (val & (1 << 6)))
                i2c_smbus_write_byte_data(client, DS1337_REG_HOUR,
-                                         val | (1 << 6));
+                                         val & 0x3f);
 }
 
 static int ds1337_detach_client(struct i2c_client *client)

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to