diff options
Diffstat (limited to 'drivers/rtc/rtc-rs5c372.c')
-rw-r--r-- | drivers/rtc/rtc-rs5c372.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 7e63074708eb..56caf6b2c3e5 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -69,6 +69,15 @@ enum rtc_type { | |||
69 | rtc_rv5c387a, | 69 | rtc_rv5c387a, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static const struct i2c_device_id rs5c372_id[] = { | ||
73 | { "rs5c372a", rtc_rs5c372a }, | ||
74 | { "rs5c372b", rtc_rs5c372b }, | ||
75 | { "rv5c386", rtc_rv5c386 }, | ||
76 | { "rv5c387a", rtc_rv5c387a }, | ||
77 | { } | ||
78 | }; | ||
79 | MODULE_DEVICE_TABLE(i2c, rs5c372_id); | ||
80 | |||
72 | /* REVISIT: this assumes that: | 81 | /* REVISIT: this assumes that: |
73 | * - we're in the 21st century, so it's safe to ignore the century | 82 | * - we're in the 21st century, so it's safe to ignore the century |
74 | * bit for rv5c38[67] (REG_MONTH bit 7); | 83 | * bit for rv5c38[67] (REG_MONTH bit 7); |
@@ -494,7 +503,8 @@ static void rs5c_sysfs_unregister(struct device *dev) | |||
494 | 503 | ||
495 | static struct i2c_driver rs5c372_driver; | 504 | static struct i2c_driver rs5c372_driver; |
496 | 505 | ||
497 | static int rs5c372_probe(struct i2c_client *client) | 506 | static int rs5c372_probe(struct i2c_client *client, |
507 | const struct i2c_device_id *id) | ||
498 | { | 508 | { |
499 | int err = 0; | 509 | int err = 0; |
500 | struct rs5c372 *rs5c372; | 510 | struct rs5c372 *rs5c372; |
@@ -514,6 +524,7 @@ static int rs5c372_probe(struct i2c_client *client) | |||
514 | 524 | ||
515 | rs5c372->client = client; | 525 | rs5c372->client = client; |
516 | i2c_set_clientdata(client, rs5c372); | 526 | i2c_set_clientdata(client, rs5c372); |
527 | rs5c372->type = id->driver_data; | ||
517 | 528 | ||
518 | /* we read registers 0x0f then 0x00-0x0f; skip the first one */ | 529 | /* we read registers 0x0f then 0x00-0x0f; skip the first one */ |
519 | rs5c372->regs = &rs5c372->buf[1]; | 530 | rs5c372->regs = &rs5c372->buf[1]; |
@@ -522,19 +533,6 @@ static int rs5c372_probe(struct i2c_client *client) | |||
522 | if (err < 0) | 533 | if (err < 0) |
523 | goto exit_kfree; | 534 | goto exit_kfree; |
524 | 535 | ||
525 | if (strcmp(client->name, "rs5c372a") == 0) | ||
526 | rs5c372->type = rtc_rs5c372a; | ||
527 | else if (strcmp(client->name, "rs5c372b") == 0) | ||
528 | rs5c372->type = rtc_rs5c372b; | ||
529 | else if (strcmp(client->name, "rv5c386") == 0) | ||
530 | rs5c372->type = rtc_rv5c386; | ||
531 | else if (strcmp(client->name, "rv5c387a") == 0) | ||
532 | rs5c372->type = rtc_rv5c387a; | ||
533 | else { | ||
534 | rs5c372->type = rtc_rs5c372b; | ||
535 | dev_warn(&client->dev, "assuming rs5c372b\n"); | ||
536 | } | ||
537 | |||
538 | /* clock may be set for am/pm or 24 hr time */ | 536 | /* clock may be set for am/pm or 24 hr time */ |
539 | switch (rs5c372->type) { | 537 | switch (rs5c372->type) { |
540 | case rtc_rs5c372a: | 538 | case rtc_rs5c372a: |
@@ -651,6 +649,7 @@ static struct i2c_driver rs5c372_driver = { | |||
651 | }, | 649 | }, |
652 | .probe = rs5c372_probe, | 650 | .probe = rs5c372_probe, |
653 | .remove = rs5c372_remove, | 651 | .remove = rs5c372_remove, |
652 | .id_table = rs5c372_id, | ||
654 | }; | 653 | }; |
655 | 654 | ||
656 | static __init int rs5c372_init(void) | 655 | static __init int rs5c372_init(void) |