|
68 | 68 |
|
69 | 69 | static struct i2c_driver isl1208_driver; |
70 | 70 |
|
71 | | -/* ISL1208 various variants */ |
72 | | -enum isl1208_id { |
73 | | - TYPE_ISL1208 = 0, |
74 | | - TYPE_ISL1209, |
75 | | - TYPE_ISL1218, |
76 | | - TYPE_ISL1219, |
77 | | - ISL_LAST_ID |
78 | | -}; |
79 | | - |
80 | 71 | /* Chip capabilities table */ |
81 | | -static const struct isl1208_config { |
| 72 | +struct isl1208_config { |
82 | 73 | unsigned int nvmem_length; |
83 | 74 | unsigned has_tamper:1; |
84 | 75 | unsigned has_timestamp:1; |
85 | | -} isl1208_configs[] = { |
86 | | - [TYPE_ISL1208] = { 2, false, false }, |
87 | | - [TYPE_ISL1209] = { 2, true, false }, |
88 | | - [TYPE_ISL1218] = { 8, false, false }, |
89 | | - [TYPE_ISL1219] = { 2, true, true }, |
| 76 | +}; |
| 77 | + |
| 78 | +static const struct isl1208_config config_isl1208 = { |
| 79 | + .nvmem_length = 2, |
| 80 | + .has_tamper = false, |
| 81 | + .has_timestamp = false |
| 82 | +}; |
| 83 | + |
| 84 | +static const struct isl1208_config config_isl1209 = { |
| 85 | + .nvmem_length = 2, |
| 86 | + .has_tamper = true, |
| 87 | + .has_timestamp = false |
| 88 | +}; |
| 89 | + |
| 90 | +static const struct isl1208_config config_isl1218 = { |
| 91 | + .nvmem_length = 8, |
| 92 | + .has_tamper = false, |
| 93 | + .has_timestamp = false |
| 94 | +}; |
| 95 | + |
| 96 | +static const struct isl1208_config config_isl1219 = { |
| 97 | + .nvmem_length = 2, |
| 98 | + .has_tamper = true, |
| 99 | + .has_timestamp = true |
90 | 100 | }; |
91 | 101 |
|
92 | 102 | static const struct i2c_device_id isl1208_id[] = { |
93 | | - { "isl1208", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1208] }, |
94 | | - { "isl1209", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1209] }, |
95 | | - { "isl1218", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1218] }, |
96 | | - { "isl1219", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1219] }, |
| 103 | + { "isl1208", .driver_data = (kernel_ulong_t)&config_isl1208 }, |
| 104 | + { "isl1209", .driver_data = (kernel_ulong_t)&config_isl1209 }, |
| 105 | + { "isl1218", .driver_data = (kernel_ulong_t)&config_isl1218 }, |
| 106 | + { "isl1219", .driver_data = (kernel_ulong_t)&config_isl1219 }, |
97 | 107 | { } |
98 | 108 | }; |
99 | 109 | MODULE_DEVICE_TABLE(i2c, isl1208_id); |
100 | 110 |
|
101 | 111 | static const __maybe_unused struct of_device_id isl1208_of_match[] = { |
102 | | - { .compatible = "isil,isl1208", .data = &isl1208_configs[TYPE_ISL1208] }, |
103 | | - { .compatible = "isil,isl1209", .data = &isl1208_configs[TYPE_ISL1209] }, |
104 | | - { .compatible = "isil,isl1218", .data = &isl1208_configs[TYPE_ISL1218] }, |
105 | | - { .compatible = "isil,isl1219", .data = &isl1208_configs[TYPE_ISL1219] }, |
| 112 | + { .compatible = "isil,isl1208", .data = &config_isl1208 }, |
| 113 | + { .compatible = "isil,isl1209", .data = &config_isl1209 }, |
| 114 | + { .compatible = "isil,isl1218", .data = &config_isl1218 }, |
| 115 | + { .compatible = "isil,isl1219", .data = &config_isl1219 }, |
106 | 116 | { } |
107 | 117 | }; |
108 | 118 | MODULE_DEVICE_TABLE(of, isl1208_of_match); |
|
0 commit comments