aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-rx8581.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-08-04 00:52:34 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-08-04 00:52:34 -0400
commitbaea90ea14b316e4599f000c713e446908a5aef6 (patch)
tree17eae40f15832b466121d8f962028472c4568a13 /drivers/rtc/rtc-rx8581.c
parent36239c6704b71da7fb8e2a9429e159a84d0c5a3e (diff)
parent3a09b1be53d23df780a0cd0e4087a05e2ca4a00c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/rtc/rtc-rx8581.c')
-rw-r--r--drivers/rtc/rtc-rx8581.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
index 9718aaaa8215..600b890a3c15 100644
--- a/drivers/rtc/rtc-rx8581.c
+++ b/drivers/rtc/rtc-rx8581.c
@@ -168,7 +168,7 @@ static int rx8581_set_datetime(struct i2c_client *client, struct rtc_time *tm)
168 return -EIO; 168 return -EIO;
169 } 169 }
170 170
171 err = i2c_smbus_write_byte_data(client, RX8581_REG_FLAG, 171 err = i2c_smbus_write_byte_data(client, RX8581_REG_CTRL,
172 (data | RX8581_CTRL_STOP)); 172 (data | RX8581_CTRL_STOP));
173 if (err < 0) { 173 if (err < 0) {
174 dev_err(&client->dev, "Unable to write control register\n"); 174 dev_err(&client->dev, "Unable to write control register\n");
@@ -182,6 +182,20 @@ static int rx8581_set_datetime(struct i2c_client *client, struct rtc_time *tm)
182 return -EIO; 182 return -EIO;
183 } 183 }
184 184
185 /* get VLF and clear it */
186 data = i2c_smbus_read_byte_data(client, RX8581_REG_FLAG);
187 if (data < 0) {
188 dev_err(&client->dev, "Unable to read flag register\n");
189 return -EIO;
190 }
191
192 err = i2c_smbus_write_byte_data(client, RX8581_REG_FLAG,
193 (data & ~(RX8581_FLAG_VLF)));
194 if (err != 0) {
195 dev_err(&client->dev, "Unable to write flag register\n");
196 return -EIO;
197 }
198
185 /* Restart the clock */ 199 /* Restart the clock */
186 data = i2c_smbus_read_byte_data(client, RX8581_REG_CTRL); 200 data = i2c_smbus_read_byte_data(client, RX8581_REG_CTRL);
187 if (data < 0) { 201 if (data < 0) {
@@ -189,8 +203,8 @@ static int rx8581_set_datetime(struct i2c_client *client, struct rtc_time *tm)
189 return -EIO; 203 return -EIO;
190 } 204 }
191 205
192 err = i2c_smbus_write_byte_data(client, RX8581_REG_FLAG, 206 err = i2c_smbus_write_byte_data(client, RX8581_REG_CTRL,
193 (data | ~(RX8581_CTRL_STOP))); 207 (data & ~(RX8581_CTRL_STOP)));
194 if (err != 0) { 208 if (err != 0) {
195 dev_err(&client->dev, "Unable to write control register\n"); 209 dev_err(&client->dev, "Unable to write control register\n");
196 return -EIO; 210 return -EIO;