1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Driver for MPS MP5023 Hot-Swap Controller
7 #include <linux/module.h>
8 #include <linux/of_device.h>
11 static struct pmbus_driver_info mp5023_info = {
14 .format[PSC_VOLTAGE_IN] = direct,
15 .format[PSC_VOLTAGE_OUT] = direct,
16 .format[PSC_CURRENT_OUT] = direct,
17 .format[PSC_POWER] = direct,
18 .format[PSC_TEMPERATURE] = direct,
20 .m[PSC_VOLTAGE_IN] = 32,
21 .b[PSC_VOLTAGE_IN] = 0,
22 .R[PSC_VOLTAGE_IN] = 0,
23 .m[PSC_VOLTAGE_OUT] = 32,
24 .b[PSC_VOLTAGE_OUT] = 0,
25 .R[PSC_VOLTAGE_OUT] = 0,
26 .m[PSC_CURRENT_OUT] = 16,
27 .b[PSC_CURRENT_OUT] = 0,
28 .R[PSC_CURRENT_OUT] = 0,
32 .m[PSC_TEMPERATURE] = 2,
33 .b[PSC_TEMPERATURE] = 0,
34 .R[PSC_TEMPERATURE] = 0,
37 PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_PIN |
38 PMBUS_HAVE_TEMP | PMBUS_HAVE_IOUT |
39 PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP,
42 static int mp5023_probe(struct i2c_client *client)
44 return pmbus_do_probe(client, &mp5023_info);
47 static const struct of_device_id __maybe_unused mp5023_of_match[] = {
48 { .compatible = "mps,mp5023", },
52 MODULE_DEVICE_TABLE(of, mp5023_of_match);
54 static struct i2c_driver mp5023_driver = {
57 .of_match_table = of_match_ptr(mp5023_of_match),
59 .probe_new = mp5023_probe,
62 module_i2c_driver(mp5023_driver);
65 MODULE_DESCRIPTION("PMBus driver for MPS MP5023 HSC");
66 MODULE_LICENSE("GPL");
67 MODULE_IMPORT_NS(PMBUS);