diff options
Diffstat (limited to 'drivers/rtc/rtc-s35390a.c')
| -rw-r--r-- | drivers/rtc/rtc-s35390a.c | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c index 7067bca5c20d..77feb603cd4c 100644 --- a/drivers/rtc/rtc-s35390a.c +++ b/drivers/rtc/rtc-s35390a.c | |||
| @@ -210,8 +210,9 @@ static int s35390a_reg2hr(struct s35390a *s35390a, char reg) | |||
| 210 | return hour; | 210 | return hour; |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | static int s35390a_set_datetime(struct i2c_client *client, struct rtc_time *tm) | 213 | static int s35390a_rtc_set_time(struct device *dev, struct rtc_time *tm) |
| 214 | { | 214 | { |
| 215 | struct i2c_client *client = to_i2c_client(dev); | ||
| 215 | struct s35390a *s35390a = i2c_get_clientdata(client); | 216 | struct s35390a *s35390a = i2c_get_clientdata(client); |
| 216 | int i, err; | 217 | int i, err; |
| 217 | char buf[7], status; | 218 | char buf[7], status; |
| @@ -241,8 +242,9 @@ static int s35390a_set_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
| 241 | return err; | 242 | return err; |
| 242 | } | 243 | } |
| 243 | 244 | ||
| 244 | static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm) | 245 | static int s35390a_rtc_read_time(struct device *dev, struct rtc_time *tm) |
| 245 | { | 246 | { |
| 247 | struct i2c_client *client = to_i2c_client(dev); | ||
| 246 | struct s35390a *s35390a = i2c_get_clientdata(client); | 248 | struct s35390a *s35390a = i2c_get_clientdata(client); |
| 247 | char buf[7], status; | 249 | char buf[7], status; |
| 248 | int i, err; | 250 | int i, err; |
| @@ -271,11 +273,12 @@ static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm) | |||
| 271 | tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year, | 273 | tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year, |
| 272 | tm->tm_wday); | 274 | tm->tm_wday); |
| 273 | 275 | ||
| 274 | return rtc_valid_tm(tm); | 276 | return 0; |
| 275 | } | 277 | } |
| 276 | 278 | ||
| 277 | static int s35390a_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alm) | 279 | static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) |
| 278 | { | 280 | { |
| 281 | struct i2c_client *client = to_i2c_client(dev); | ||
| 279 | struct s35390a *s35390a = i2c_get_clientdata(client); | 282 | struct s35390a *s35390a = i2c_get_clientdata(client); |
| 280 | char buf[3], sts = 0; | 283 | char buf[3], sts = 0; |
| 281 | int err, i; | 284 | int err, i; |
| @@ -329,8 +332,9 @@ static int s35390a_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alm) | |||
| 329 | return err; | 332 | return err; |
| 330 | } | 333 | } |
| 331 | 334 | ||
| 332 | static int s35390a_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alm) | 335 | static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) |
| 333 | { | 336 | { |
| 337 | struct i2c_client *client = to_i2c_client(dev); | ||
| 334 | struct s35390a *s35390a = i2c_get_clientdata(client); | 338 | struct s35390a *s35390a = i2c_get_clientdata(client); |
| 335 | char buf[3], sts; | 339 | char buf[3], sts; |
| 336 | int i, err; | 340 | int i, err; |
| @@ -384,26 +388,6 @@ static int s35390a_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alm) | |||
| 384 | return 0; | 388 | return 0; |
| 385 | } | 389 | } |
| 386 | 390 | ||
| 387 | static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) | ||
| 388 | { | ||
| 389 | return s35390a_read_alarm(to_i2c_client(dev), alm); | ||
| 390 | } | ||
| 391 | |||
| 392 | static int s35390a_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) | ||
| 393 | { | ||
| 394 | return s35390a_set_alarm(to_i2c_client(dev), alm); | ||
| 395 | } | ||
| 396 | |||
| 397 | static int s35390a_rtc_read_time(struct device *dev, struct rtc_time *tm) | ||
| 398 | { | ||
| 399 | return s35390a_get_datetime(to_i2c_client(dev), tm); | ||
| 400 | } | ||
| 401 | |||
| 402 | static int s35390a_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
| 403 | { | ||
| 404 | return s35390a_set_datetime(to_i2c_client(dev), tm); | ||
| 405 | } | ||
| 406 | |||
| 407 | static int s35390a_rtc_ioctl(struct device *dev, unsigned int cmd, | 391 | static int s35390a_rtc_ioctl(struct device *dev, unsigned int cmd, |
| 408 | unsigned long arg) | 392 | unsigned long arg) |
| 409 | { | 393 | { |
| @@ -450,7 +434,6 @@ static int s35390a_probe(struct i2c_client *client, | |||
| 450 | int err, err_read; | 434 | int err, err_read; |
| 451 | unsigned int i; | 435 | unsigned int i; |
| 452 | struct s35390a *s35390a; | 436 | struct s35390a *s35390a; |
| 453 | struct rtc_time tm; | ||
| 454 | char buf, status1; | 437 | char buf, status1; |
| 455 | 438 | ||
| 456 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 439 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
| @@ -508,9 +491,6 @@ static int s35390a_probe(struct i2c_client *client, | |||
| 508 | } | 491 | } |
| 509 | } | 492 | } |
| 510 | 493 | ||
| 511 | if (err_read > 0 || s35390a_get_datetime(client, &tm) < 0) | ||
| 512 | dev_warn(&client->dev, "clock needs to be set\n"); | ||
| 513 | |||
| 514 | device_set_wakeup_capable(&client->dev, 1); | 494 | device_set_wakeup_capable(&client->dev, 1); |
| 515 | 495 | ||
| 516 | s35390a->rtc = devm_rtc_device_register(&client->dev, | 496 | s35390a->rtc = devm_rtc_device_register(&client->dev, |
