1 // SPDX-License-Identifier: GPL-2.0+
3 * I2C bus interface for ATC260x PMICs
5 * Copyright (C) 2019 Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
6 * Copyright (C) 2020 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
10 #include <linux/mfd/atc260x/core.h>
11 #include <linux/module.h>
13 #include <linux/regmap.h>
15 static int atc260x_i2c_probe(struct i2c_client
*client
)
17 struct atc260x
*atc260x
;
18 struct regmap_config regmap_cfg
;
21 atc260x
= devm_kzalloc(&client
->dev
, sizeof(*atc260x
), GFP_KERNEL
);
25 atc260x
->dev
= &client
->dev
;
26 atc260x
->irq
= client
->irq
;
28 ret
= atc260x_match_device(atc260x
, ®map_cfg
);
32 i2c_set_clientdata(client
, atc260x
);
34 atc260x
->regmap
= devm_regmap_init_i2c(client
, ®map_cfg
);
35 if (IS_ERR(atc260x
->regmap
)) {
36 ret
= PTR_ERR(atc260x
->regmap
);
37 dev_err(&client
->dev
, "failed to init regmap: %d\n", ret
);
41 return atc260x_device_probe(atc260x
);
44 static const struct of_device_id atc260x_i2c_of_match
[] = {
45 { .compatible
= "actions,atc2603c", .data
= (void *)ATC2603C
},
46 { .compatible
= "actions,atc2609a", .data
= (void *)ATC2609A
},
49 MODULE_DEVICE_TABLE(of
, atc260x_i2c_of_match
);
51 static struct i2c_driver atc260x_i2c_driver
= {
54 .of_match_table
= atc260x_i2c_of_match
,
56 .probe
= atc260x_i2c_probe
,
58 module_i2c_driver(atc260x_i2c_driver
);
60 MODULE_DESCRIPTION("ATC260x PMICs I2C bus interface");
61 MODULE_AUTHOR("Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>");
62 MODULE_AUTHOR("Cristian Ciocaltea <cristian.ciocaltea@gmail.com>");
63 MODULE_LICENSE("GPL");