2022-06-07 14:11:31 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2016-01-25 15:43:45 +00:00
|
|
|
/*
|
|
|
|
* I2C access driver for TI TPS65912x PMICs
|
|
|
|
*
|
2020-07-22 19:24:54 +00:00
|
|
|
* Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
|
2016-01-25 15:43:45 +00:00
|
|
|
* Andrew F. Davis <afd@ti.com>
|
|
|
|
*
|
|
|
|
* Based on the TPS65218 driver and the previous TPS65912 driver by
|
|
|
|
* Margarita Olaya Cabrera <magi@slimlogic.co.uk>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/regmap.h>
|
|
|
|
|
|
|
|
#include <linux/mfd/tps65912.h>
|
|
|
|
|
|
|
|
static const struct of_device_id tps65912_i2c_of_match_table[] = {
|
|
|
|
{ .compatible = "ti,tps65912", },
|
|
|
|
{ /* sentinel */ }
|
|
|
|
};
|
2017-01-16 14:41:58 +00:00
|
|
|
MODULE_DEVICE_TABLE(of, tps65912_i2c_of_match_table);
|
2016-01-25 15:43:45 +00:00
|
|
|
|
2022-11-18 22:43:28 +00:00
|
|
|
static int tps65912_i2c_probe(struct i2c_client *client)
|
2016-01-25 15:43:45 +00:00
|
|
|
{
|
|
|
|
struct tps65912 *tps;
|
|
|
|
|
|
|
|
tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
|
|
|
|
if (!tps)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
i2c_set_clientdata(client, tps);
|
|
|
|
tps->dev = &client->dev;
|
|
|
|
tps->irq = client->irq;
|
|
|
|
|
|
|
|
tps->regmap = devm_regmap_init_i2c(client, &tps65912_regmap_config);
|
|
|
|
if (IS_ERR(tps->regmap)) {
|
|
|
|
dev_err(tps->dev, "Failed to initialize register map\n");
|
|
|
|
return PTR_ERR(tps->regmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
return tps65912_device_init(tps);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct i2c_device_id tps65912_i2c_id_table[] = {
|
2024-05-10 21:10:11 +00:00
|
|
|
{ "tps65912" },
|
2016-01-25 15:43:45 +00:00
|
|
|
{ /* sentinel */ }
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(i2c, tps65912_i2c_id_table);
|
|
|
|
|
|
|
|
static struct i2c_driver tps65912_i2c_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "tps65912",
|
|
|
|
.of_match_table = tps65912_i2c_of_match_table,
|
|
|
|
},
|
2023-05-15 18:27:52 +00:00
|
|
|
.probe = tps65912_i2c_probe,
|
2016-01-25 15:43:45 +00:00
|
|
|
.id_table = tps65912_i2c_id_table,
|
|
|
|
};
|
|
|
|
module_i2c_driver(tps65912_i2c_driver);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
|
|
|
|
MODULE_DESCRIPTION("TPS65912x I2C Interface Driver");
|
|
|
|
MODULE_LICENSE("GPL v2");
|