mirror of
https://github.com/torvalds/linux.git
synced 2026-12-05 21:04:14 +00:00
Based on the normalized pattern:
this program is free software you can redistribute it and/or modify it
under the terms of the gnu general public license version 2 as
published by the free software foundation this program is distributed
as is without any warranty of any kind whether expressed or implied
without even the implied warranty of merchantability or fitness for a
particular purpose see the gnu general public license version 2 for
more details
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-only
has been chosen to replace the boilerplate/reference.
Reviewed-by: Allison Randal <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
75 lines
1.8 KiB
C
75 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* I2C access driver for TI TPS65912x PMICs
|
|
*
|
|
* Copyright (C) 2015 Texas Instruments Incorporated - https://www.ti.com/
|
|
* Andrew F. Davis <[email protected]>
|
|
*
|
|
* Based on the TPS65218 driver and the previous TPS65912 driver by
|
|
* Margarita Olaya Cabrera <[email protected]>
|
|
*/
|
|
|
|
#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 */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, tps65912_i2c_of_match_table);
|
|
|
|
static int tps65912_i2c_probe(struct i2c_client *client,
|
|
const struct i2c_device_id *ids)
|
|
{
|
|
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 int tps65912_i2c_remove(struct i2c_client *client)
|
|
{
|
|
struct tps65912 *tps = i2c_get_clientdata(client);
|
|
|
|
tps65912_device_exit(tps);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct i2c_device_id tps65912_i2c_id_table[] = {
|
|
{ "tps65912", 0 },
|
|
{ /* 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,
|
|
},
|
|
.probe = tps65912_i2c_probe,
|
|
.remove = tps65912_i2c_remove,
|
|
.id_table = tps65912_i2c_id_table,
|
|
};
|
|
module_i2c_driver(tps65912_i2c_driver);
|
|
|
|
MODULE_AUTHOR("Andrew F. Davis <[email protected]>");
|
|
MODULE_DESCRIPTION("TPS65912x I2C Interface Driver");
|
|
MODULE_LICENSE("GPL v2");
|