WIP FPC-III support
[linux/fpc-iii.git] / drivers / hwmon / pmbus / irps5401.c
blob93ef6d64a33ae06791cad5eae89010dfcc53142a
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Hardware monitoring driver for the Infineon IRPS5401M PMIC.
5 * Copyright (c) 2019 SED Systems, a division of Calian Ltd.
7 * The device supports VOUT_PEAK, IOUT_PEAK, and TEMPERATURE_PEAK, however
8 * this driver does not currently support them.
9 */
11 #include <linux/err.h>
12 #include <linux/i2c.h>
13 #include <linux/init.h>
14 #include <linux/kernel.h>
15 #include <linux/module.h>
16 #include "pmbus.h"
18 #define IRPS5401_SW_FUNC (PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | \
19 PMBUS_HAVE_STATUS_INPUT | \
20 PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \
21 PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \
22 PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | \
23 PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP)
25 #define IRPS5401_LDO_FUNC (PMBUS_HAVE_VIN | \
26 PMBUS_HAVE_STATUS_INPUT | \
27 PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \
28 PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \
29 PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | \
30 PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP)
32 static struct pmbus_driver_info irps5401_info = {
33 .pages = 5,
34 .func[0] = IRPS5401_SW_FUNC,
35 .func[1] = IRPS5401_SW_FUNC,
36 .func[2] = IRPS5401_SW_FUNC,
37 .func[3] = IRPS5401_SW_FUNC,
38 .func[4] = IRPS5401_LDO_FUNC,
41 static int irps5401_probe(struct i2c_client *client)
43 return pmbus_do_probe(client, &irps5401_info);
46 static const struct i2c_device_id irps5401_id[] = {
47 {"irps5401", 0},
51 MODULE_DEVICE_TABLE(i2c, irps5401_id);
53 static struct i2c_driver irps5401_driver = {
54 .driver = {
55 .name = "irps5401",
57 .probe_new = irps5401_probe,
58 .id_table = irps5401_id,
61 module_i2c_driver(irps5401_driver);
63 MODULE_AUTHOR("Robert Hancock");
64 MODULE_DESCRIPTION("PMBus driver for Infineon IRPS5401");
65 MODULE_LICENSE("GPL");