mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
mfd: Add LP87565 PMIC support
The LP87565 chip is a power management IC for Portable Navigation Systems
and Tablet Computing devices. It contains the following components:
- Configurable Bucks(Single and multi-phase).
- Configurable General Purpose Output Signals (GPO).
The LP87565-Q1 variant device uses two 2-phase outputs configuration,
Buck0 is master for Buck0/1 output and Buck2 is master for Buck2/3
output.
Signed-off-by: Keerthy <[email protected]>
Acked-by: Rob Herring <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
This commit is contained in:
parent
f58b14e663
commit
1e3496000c
5 changed files with 428 additions and 0 deletions
|
|
@ -1351,6 +1351,20 @@ config MFD_TI_LP873X
|
|||
This driver can also be built as a module. If so, the module
|
||||
will be called lp873x.
|
||||
|
||||
config MFD_TI_LP87565
|
||||
tristate "TI LP87565 Power Management IC"
|
||||
depends on I2C && OF
|
||||
select MFD_CORE
|
||||
select REGMAP_I2C
|
||||
help
|
||||
If you say yes here then you get support for the LP87565 series of
|
||||
Power Management Integrated Circuits (PMIC).
|
||||
These include voltage regulators, thermal protection, configurable
|
||||
General Purpose Outputs (GPO) that are used in portable devices.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called lp87565.
|
||||
|
||||
config MFD_TPS65218
|
||||
tristate "TI TPS65218 Power Management chips"
|
||||
depends on I2C
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o
|
|||
obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o
|
||||
|
||||
obj-$(CONFIG_MFD_TI_LP873X) += lp873x.o
|
||||
obj-$(CONFIG_MFD_TI_LP87565) += lp87565.o
|
||||
|
||||
obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o
|
||||
obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o
|
||||
|
|
|
|||
100
drivers/mfd/lp87565.c
Normal file
100
drivers/mfd/lp87565.c
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Author: Keerthy <j-keerthy@ti.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation version 2.
|
||||
*/
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/mfd/core.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include <linux/mfd/lp87565.h>
|
||||
|
||||
static const struct regmap_config lp87565_regmap_config = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.max_register = LP87565_REG_MAX,
|
||||
};
|
||||
|
||||
static const struct mfd_cell lp87565_cells[] = {
|
||||
{ .name = "lp87565-q1-regulator", },
|
||||
{ .name = "lp87565-q1-gpio", },
|
||||
};
|
||||
|
||||
static const struct of_device_id of_lp87565_match_table[] = {
|
||||
{ .compatible = "ti,lp87565", },
|
||||
{
|
||||
.compatible = "ti,lp87565-q1",
|
||||
.data = (void *)LP87565_DEVICE_TYPE_LP87565_Q1,
|
||||
},
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, of_lp87565_match_table);
|
||||
|
||||
static int lp87565_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *ids)
|
||||
{
|
||||
struct lp87565 *lp87565;
|
||||
const struct of_device_id *of_id;
|
||||
int ret;
|
||||
unsigned int otpid;
|
||||
|
||||
lp87565 = devm_kzalloc(&client->dev, sizeof(*lp87565), GFP_KERNEL);
|
||||
if (!lp87565)
|
||||
return -ENOMEM;
|
||||
|
||||
lp87565->dev = &client->dev;
|
||||
|
||||
lp87565->regmap = devm_regmap_init_i2c(client, &lp87565_regmap_config);
|
||||
if (IS_ERR(lp87565->regmap)) {
|
||||
ret = PTR_ERR(lp87565->regmap);
|
||||
dev_err(lp87565->dev,
|
||||
"Failed to initialize register map: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_read(lp87565->regmap, LP87565_REG_OTP_REV, &otpid);
|
||||
if (ret) {
|
||||
dev_err(lp87565->dev, "Failed to read OTP ID\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
lp87565->rev = otpid & LP87565_OTP_REV_OTP_ID;
|
||||
|
||||
of_id = of_match_device(of_lp87565_match_table, &client->dev);
|
||||
if (of_id)
|
||||
lp87565->dev_type = (enum lp87565_device_type)of_id->data;
|
||||
|
||||
i2c_set_clientdata(client, lp87565);
|
||||
|
||||
ret = mfd_add_devices(lp87565->dev, PLATFORM_DEVID_AUTO, lp87565_cells,
|
||||
ARRAY_SIZE(lp87565_cells), NULL, 0, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id lp87565_id_table[] = {
|
||||
{ "lp87565-q1", 0 },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, lp87565_id_table);
|
||||
|
||||
static struct i2c_driver lp87565_driver = {
|
||||
.driver = {
|
||||
.name = "lp87565",
|
||||
.of_match_table = of_lp87565_match_table,
|
||||
},
|
||||
.probe = lp87565_probe,
|
||||
.id_table = lp87565_id_table,
|
||||
};
|
||||
module_i2c_driver(lp87565_driver);
|
||||
|
||||
MODULE_AUTHOR("J Keerthy <[email protected]>");
|
||||
MODULE_DESCRIPTION("lp87565 chip family Multi-Function Device driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
Loading…
Reference in a new issue