Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201329
b: refs/heads/master
c: 2884fce
h: refs/heads/master
i:
  201327: 1ccd7d5
v: v3
  • Loading branch information
Rudolf Marek authored and Linus Torvalds committed Jul 27, 2010
1 parent e23ab95 commit 7b4c86b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 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: b82bab4bbe9efa7bc7177fc20620fff19bd95484
refs/heads/master: 2884fce165047db7df422e52a672970fa09c87b5
20 changes: 17 additions & 3 deletions trunk/drivers/rtc/rtc-rx8581.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static int rx8581_set_datetime(struct i2c_client *client, struct rtc_time *tm)
return -EIO;
}

err = i2c_smbus_write_byte_data(client, RX8581_REG_FLAG,
err = i2c_smbus_write_byte_data(client, RX8581_REG_CTRL,
(data | RX8581_CTRL_STOP));
if (err < 0) {
dev_err(&client->dev, "Unable to write control register\n");
Expand All @@ -182,15 +182,29 @@ static int rx8581_set_datetime(struct i2c_client *client, struct rtc_time *tm)
return -EIO;
}

/* get VLF and clear it */
data = i2c_smbus_read_byte_data(client, RX8581_REG_FLAG);
if (data < 0) {
dev_err(&client->dev, "Unable to read flag register\n");
return -EIO;
}

err = i2c_smbus_write_byte_data(client, RX8581_REG_FLAG,
(data & ~(RX8581_FLAG_VLF)));
if (err != 0) {
dev_err(&client->dev, "Unable to write flag register\n");
return -EIO;
}

/* Restart the clock */
data = i2c_smbus_read_byte_data(client, RX8581_REG_CTRL);
if (data < 0) {
dev_err(&client->dev, "Unable to read control register\n");
return -EIO;
}

err = i2c_smbus_write_byte_data(client, RX8581_REG_FLAG,
(data | ~(RX8581_CTRL_STOP)));
err = i2c_smbus_write_byte_data(client, RX8581_REG_CTRL,
(data & ~(RX8581_CTRL_STOP)));
if (err != 0) {
dev_err(&client->dev, "Unable to write control register\n");
return -EIO;
Expand Down

0 comments on commit 7b4c86b

Please sign in to comment.