30
30
#define PCF85063_REG_SC 0x04 /* datetime */
31
31
#define PCF85063_REG_SC_OS 0x80
32
32
33
+ struct pcf85063_config {
34
+ struct regmap_config regmap ;
35
+ };
36
+
33
37
struct pcf85063 {
34
38
struct rtc_device * rtc ;
35
39
struct regmap * regmap ;
@@ -147,17 +151,29 @@ static int pcf85063_load_capacitance(struct pcf85063 *pcf85063,
147
151
PCF85063_REG_CTRL1_CAP_SEL , reg );
148
152
}
149
153
150
- static const struct regmap_config regmap_config = {
151
- .reg_bits = 8 ,
152
- .val_bits = 8 ,
153
- .max_register = 0x11 ,
154
+ static const struct pcf85063_config pcf85063a_config = {
155
+ .regmap = {
156
+ .reg_bits = 8 ,
157
+ .val_bits = 8 ,
158
+ .max_register = 0x11 ,
159
+ },
160
+ };
161
+
162
+ static const struct pcf85063_config pcf85063tp_config = {
163
+ .regmap = {
164
+ .reg_bits = 8 ,
165
+ .val_bits = 8 ,
166
+ .max_register = 0x0a ,
167
+ },
154
168
};
155
169
156
170
static int pcf85063_probe (struct i2c_client * client )
157
171
{
158
172
struct pcf85063 * pcf85063 ;
159
173
unsigned int tmp ;
160
174
int err ;
175
+ const struct pcf85063_config * config = & pcf85063tp_config ;
176
+ const void * data = of_device_get_match_data (& client -> dev );
161
177
162
178
dev_dbg (& client -> dev , "%s\n" , __func__ );
163
179
@@ -166,7 +182,10 @@ static int pcf85063_probe(struct i2c_client *client)
166
182
if (!pcf85063 )
167
183
return - ENOMEM ;
168
184
169
- pcf85063 -> regmap = devm_regmap_init_i2c (client , & regmap_config );
185
+ if (data )
186
+ config = data ;
187
+
188
+ pcf85063 -> regmap = devm_regmap_init_i2c (client , & config -> regmap );
170
189
if (IS_ERR (pcf85063 -> regmap ))
171
190
return PTR_ERR (pcf85063 -> regmap );
172
191
@@ -196,7 +215,9 @@ static int pcf85063_probe(struct i2c_client *client)
196
215
197
216
#ifdef CONFIG_OF
198
217
static const struct of_device_id pcf85063_of_match [] = {
199
- { .compatible = "nxp,pcf85063" },
218
+ { .compatible = "nxp,pcf85063" , .data = & pcf85063tp_config },
219
+ { .compatible = "nxp,pcf85063tp" , .data = & pcf85063tp_config },
220
+ { .compatible = "nxp,pcf85063a" , .data = & pcf85063a_config },
200
221
{}
201
222
};
202
223
MODULE_DEVICE_TABLE (of , pcf85063_of_match );
0 commit comments