diff options
Diffstat (limited to 'drivers/rtc/rtc-rs5c372.c')
-rw-r--r-- | drivers/rtc/rtc-rs5c372.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 47db289bb0a3..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); |
@@ -515,6 +524,7 @@ static int rs5c372_probe(struct i2c_client *client, | |||
515 | 524 | ||
516 | rs5c372->client = client; | 525 | rs5c372->client = client; |
517 | i2c_set_clientdata(client, rs5c372); | 526 | i2c_set_clientdata(client, rs5c372); |
527 | rs5c372->type = id->driver_data; | ||
518 | 528 | ||
519 | /* we read registers 0x0f then 0x00-0x0f; skip the first one */ | 529 | /* we read registers 0x0f then 0x00-0x0f; skip the first one */ |
520 | rs5c372->regs = &rs5c372->buf[1]; | 530 | rs5c372->regs = &rs5c372->buf[1]; |
@@ -523,19 +533,6 @@ static int rs5c372_probe(struct i2c_client *client, | |||
523 | if (err < 0) | 533 | if (err < 0) |
524 | goto exit_kfree; | 534 | goto exit_kfree; |
525 | 535 | ||
526 | if (strcmp(client->name, "rs5c372a") == 0) | ||
527 | rs5c372->type = rtc_rs5c372a; | ||
528 | else if (strcmp(client->name, "rs5c372b") == 0) | ||
529 | rs5c372->type = rtc_rs5c372b; | ||
530 | else if (strcmp(client->name, "rv5c386") == 0) | ||
531 | rs5c372->type = rtc_rv5c386; | ||
532 | else if (strcmp(client->name, "rv5c387a") == 0) | ||
533 | rs5c372->type = rtc_rv5c387a; | ||
534 | else { | ||
535 | rs5c372->type = rtc_rs5c372b; | ||
536 | dev_warn(&client->dev, "assuming rs5c372b\n"); | ||
537 | } | ||
538 | |||
539 | /* clock may be set for am/pm or 24 hr time */ | 536 | /* clock may be set for am/pm or 24 hr time */ |
540 | switch (rs5c372->type) { | 537 | switch (rs5c372->type) { |
541 | case rtc_rs5c372a: | 538 | case rtc_rs5c372a: |
@@ -652,6 +649,7 @@ static struct i2c_driver rs5c372_driver = { | |||
652 | }, | 649 | }, |
653 | .probe = rs5c372_probe, | 650 | .probe = rs5c372_probe, |
654 | .remove = rs5c372_remove, | 651 | .remove = rs5c372_remove, |
652 | .id_table = rs5c372_id, | ||
655 | }; | 653 | }; |
656 | 654 | ||
657 | static __init int rs5c372_init(void) | 655 | static __init int rs5c372_init(void) |