aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-rs5c372.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-rs5c372.c')
-rw-r--r--drivers/rtc/rtc-rs5c372.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index d4eff8d7131f..c5038329058c 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -207,8 +207,9 @@ static unsigned rs5c_hr2reg(struct rs5c372 *rs5c, unsigned hour)
207 return bin2bcd(hour); 207 return bin2bcd(hour);
208} 208}
209 209
210static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm) 210static int rs5c372_rtc_read_time(struct device *dev, struct rtc_time *tm)
211{ 211{
212 struct i2c_client *client = to_i2c_client(dev);
212 struct rs5c372 *rs5c = i2c_get_clientdata(client); 213 struct rs5c372 *rs5c = i2c_get_clientdata(client);
213 int status = rs5c_get_regs(rs5c); 214 int status = rs5c_get_regs(rs5c);
214 215
@@ -234,12 +235,12 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm)
234 tm->tm_sec, tm->tm_min, tm->tm_hour, 235 tm->tm_sec, tm->tm_min, tm->tm_hour,
235 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); 236 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
236 237
237 /* rtc might need initialization */ 238 return 0;
238 return rtc_valid_tm(tm);
239} 239}
240 240
241static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm) 241static int rs5c372_rtc_set_time(struct device *dev, struct rtc_time *tm)
242{ 242{
243 struct i2c_client *client = to_i2c_client(dev);
243 struct rs5c372 *rs5c = i2c_get_clientdata(client); 244 struct rs5c372 *rs5c = i2c_get_clientdata(client);
244 unsigned char buf[7]; 245 unsigned char buf[7];
245 int addr; 246 int addr;
@@ -305,17 +306,6 @@ static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim)
305} 306}
306#endif 307#endif
307 308
308static int rs5c372_rtc_read_time(struct device *dev, struct rtc_time *tm)
309{
310 return rs5c372_get_datetime(to_i2c_client(dev), tm);
311}
312
313static int rs5c372_rtc_set_time(struct device *dev, struct rtc_time *tm)
314{
315 return rs5c372_set_datetime(to_i2c_client(dev), tm);
316}
317
318
319static int rs5c_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) 309static int rs5c_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
320{ 310{
321 struct i2c_client *client = to_i2c_client(dev); 311 struct i2c_client *client = to_i2c_client(dev);
@@ -581,7 +571,6 @@ static int rs5c372_probe(struct i2c_client *client,
581 int err = 0; 571 int err = 0;
582 int smbus_mode = 0; 572 int smbus_mode = 0;
583 struct rs5c372 *rs5c372; 573 struct rs5c372 *rs5c372;
584 struct rtc_time tm;
585 574
586 dev_dbg(&client->dev, "%s\n", __func__); 575 dev_dbg(&client->dev, "%s\n", __func__);
587 576
@@ -662,9 +651,6 @@ static int rs5c372_probe(struct i2c_client *client,
662 goto exit; 651 goto exit;
663 } 652 }
664 653
665 if (rs5c372_get_datetime(client, &tm) < 0)
666 dev_warn(&client->dev, "clock needs to be set\n");
667
668 dev_info(&client->dev, "%s found, %s\n", 654 dev_info(&client->dev, "%s found, %s\n",
669 ({ char *s; switch (rs5c372->type) { 655 ({ char *s; switch (rs5c372->type) {
670 case rtc_r2025sd: s = "r2025sd"; break; 656 case rtc_r2025sd: s = "r2025sd"; break;