mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 23:51:37 +00:00
e1c5cd7e8a
Add support for mp5023 device from Monolithic Power Systems, Inc. (MPS) vendor. This is a Hot-Swap Controller. Signed-off-by: Howard Chiu <howard.chiu@quantatw.com> Link: https://lore.kernel.org/r/HKAPR04MB400349AA406694FB976D78D096709@HKAPR04MB4003.apcprd04.prod.outlook.com [groeck: Added MODULE_IMPORT_NS, entry in index.rst] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
68 lines
1.5 KiB
C
68 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Driver for MPS MP5023 Hot-Swap Controller
|
|
*/
|
|
|
|
#include <linux/i2c.h>
|
|
#include <linux/module.h>
|
|
#include <linux/of_device.h>
|
|
#include "pmbus.h"
|
|
|
|
static struct pmbus_driver_info mp5023_info = {
|
|
.pages = 1,
|
|
|
|
.format[PSC_VOLTAGE_IN] = direct,
|
|
.format[PSC_VOLTAGE_OUT] = direct,
|
|
.format[PSC_CURRENT_OUT] = direct,
|
|
.format[PSC_POWER] = direct,
|
|
.format[PSC_TEMPERATURE] = direct,
|
|
|
|
.m[PSC_VOLTAGE_IN] = 32,
|
|
.b[PSC_VOLTAGE_IN] = 0,
|
|
.R[PSC_VOLTAGE_IN] = 0,
|
|
.m[PSC_VOLTAGE_OUT] = 32,
|
|
.b[PSC_VOLTAGE_OUT] = 0,
|
|
.R[PSC_VOLTAGE_OUT] = 0,
|
|
.m[PSC_CURRENT_OUT] = 16,
|
|
.b[PSC_CURRENT_OUT] = 0,
|
|
.R[PSC_CURRENT_OUT] = 0,
|
|
.m[PSC_POWER] = 1,
|
|
.b[PSC_POWER] = 0,
|
|
.R[PSC_POWER] = 0,
|
|
.m[PSC_TEMPERATURE] = 2,
|
|
.b[PSC_TEMPERATURE] = 0,
|
|
.R[PSC_TEMPERATURE] = 0,
|
|
|
|
.func[0] =
|
|
PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_PIN |
|
|
PMBUS_HAVE_TEMP | PMBUS_HAVE_IOUT |
|
|
PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP,
|
|
};
|
|
|
|
static int mp5023_probe(struct i2c_client *client)
|
|
{
|
|
return pmbus_do_probe(client, &mp5023_info);
|
|
}
|
|
|
|
static const struct of_device_id __maybe_unused mp5023_of_match[] = {
|
|
{ .compatible = "mps,mp5023", },
|
|
{}
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(of, mp5023_of_match);
|
|
|
|
static struct i2c_driver mp5023_driver = {
|
|
.driver = {
|
|
.name = "mp5023",
|
|
.of_match_table = of_match_ptr(mp5023_of_match),
|
|
},
|
|
.probe_new = mp5023_probe,
|
|
};
|
|
|
|
module_i2c_driver(mp5023_driver);
|
|
|
|
MODULE_AUTHOR("Howard Chiu <howard.chiu@quantatw.com>");
|
|
MODULE_DESCRIPTION("PMBus driver for MPS MP5023 HSC");
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_IMPORT_NS(PMBUS);
|