|
25 | 25 | * Model this as 2 PLL clocks which are parents to the outputs. |
26 | 26 | */ |
27 | 27 |
|
28 | | -enum { |
29 | | - CDCE913, |
30 | | - CDCE925, |
31 | | - CDCE937, |
32 | | - CDCE949, |
33 | | -}; |
34 | | - |
35 | 28 | struct clk_cdce925_chip_info { |
36 | 29 | int num_plls; |
37 | 30 | int num_outputs; |
38 | 31 | }; |
39 | 32 |
|
40 | | -static const struct clk_cdce925_chip_info clk_cdce925_chip_info_tbl[] = { |
41 | | - [CDCE913] = { .num_plls = 1, .num_outputs = 3 }, |
42 | | - [CDCE925] = { .num_plls = 2, .num_outputs = 5 }, |
43 | | - [CDCE937] = { .num_plls = 3, .num_outputs = 7 }, |
44 | | - [CDCE949] = { .num_plls = 4, .num_outputs = 9 }, |
45 | | -}; |
46 | | - |
47 | 33 | #define MAX_NUMBER_OF_PLLS 4 |
48 | 34 | #define MAX_NUMBER_OF_OUTPUTS 9 |
49 | 35 |
|
@@ -621,20 +607,10 @@ static struct regmap_bus regmap_cdce925_bus = { |
621 | 607 | .read = cdce925_regmap_i2c_read, |
622 | 608 | }; |
623 | 609 |
|
624 | | -static const struct i2c_device_id cdce925_id[] = { |
625 | | - { "cdce913", CDCE913 }, |
626 | | - { "cdce925", CDCE925 }, |
627 | | - { "cdce937", CDCE937 }, |
628 | | - { "cdce949", CDCE949 }, |
629 | | - { } |
630 | | -}; |
631 | | -MODULE_DEVICE_TABLE(i2c, cdce925_id); |
632 | | - |
633 | 610 | static int cdce925_probe(struct i2c_client *client) |
634 | 611 | { |
635 | 612 | struct clk_cdce925_chip *data; |
636 | 613 | struct device_node *node = client->dev.of_node; |
637 | | - const struct i2c_device_id *id = i2c_match_id(cdce925_id, client); |
638 | 614 | const char *parent_name; |
639 | 615 | const char *pll_clk_name[MAX_NUMBER_OF_PLLS] = {NULL,}; |
640 | 616 | struct clk_init_data init; |
@@ -665,7 +641,7 @@ static int cdce925_probe(struct i2c_client *client) |
665 | 641 | return -ENOMEM; |
666 | 642 |
|
667 | 643 | data->i2c_client = client; |
668 | | - data->chip_info = &clk_cdce925_chip_info_tbl[id->driver_data]; |
| 644 | + data->chip_info = i2c_get_match_data(client); |
669 | 645 | config.max_register = CDCE925_OFFSET_PLL + |
670 | 646 | data->chip_info->num_plls * 0x10 - 1; |
671 | 647 | data->regmap = devm_regmap_init(&client->dev, ®map_cdce925_bus, |
@@ -822,12 +798,41 @@ static int cdce925_probe(struct i2c_client *client) |
822 | 798 | return err; |
823 | 799 | } |
824 | 800 |
|
| 801 | +static const struct clk_cdce925_chip_info clk_cdce913_info = { |
| 802 | + .num_plls = 1, |
| 803 | + .num_outputs = 3, |
| 804 | +}; |
| 805 | + |
| 806 | +static const struct clk_cdce925_chip_info clk_cdce925_info = { |
| 807 | + .num_plls = 2, |
| 808 | + .num_outputs = 5, |
| 809 | +}; |
| 810 | + |
| 811 | +static const struct clk_cdce925_chip_info clk_cdce937_info = { |
| 812 | + .num_plls = 3, |
| 813 | + .num_outputs = 7, |
| 814 | +}; |
| 815 | + |
| 816 | +static const struct clk_cdce925_chip_info clk_cdce949_info = { |
| 817 | + .num_plls = 4, |
| 818 | + .num_outputs = 9, |
| 819 | +}; |
| 820 | + |
| 821 | +static const struct i2c_device_id cdce925_id[] = { |
| 822 | + { "cdce913", (kernel_ulong_t)&clk_cdce913_info }, |
| 823 | + { "cdce925", (kernel_ulong_t)&clk_cdce925_info }, |
| 824 | + { "cdce937", (kernel_ulong_t)&clk_cdce937_info }, |
| 825 | + { "cdce949", (kernel_ulong_t)&clk_cdce949_info }, |
| 826 | + { } |
| 827 | +}; |
| 828 | +MODULE_DEVICE_TABLE(i2c, cdce925_id); |
| 829 | + |
825 | 830 | static const struct of_device_id clk_cdce925_of_match[] = { |
826 | | - { .compatible = "ti,cdce913" }, |
827 | | - { .compatible = "ti,cdce925" }, |
828 | | - { .compatible = "ti,cdce937" }, |
829 | | - { .compatible = "ti,cdce949" }, |
830 | | - { }, |
| 831 | + { .compatible = "ti,cdce913", .data = &clk_cdce913_info }, |
| 832 | + { .compatible = "ti,cdce925", .data = &clk_cdce925_info }, |
| 833 | + { .compatible = "ti,cdce937", .data = &clk_cdce937_info }, |
| 834 | + { .compatible = "ti,cdce949", .data = &clk_cdce949_info }, |
| 835 | + { } |
831 | 836 | }; |
832 | 837 | MODULE_DEVICE_TABLE(of, clk_cdce925_of_match); |
833 | 838 |
|
|
0 commit comments