xref: /linux/drivers/hwmon/pmbus/irps5401.c (revision 164666fa66669d437bdcc8d5f1744a2aee73be41)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Hardware monitoring driver for the Infineon IRPS5401M PMIC.
4  *
5  * Copyright (c) 2019 SED Systems, a division of Calian Ltd.
6  *
7  * The device supports VOUT_PEAK, IOUT_PEAK, and TEMPERATURE_PEAK, however
8  * this driver does not currently support them.
9  */
10 
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"
17 
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)
24 
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)
31 
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,
39 };
40 
41 static int irps5401_probe(struct i2c_client *client)
42 {
43 	return pmbus_do_probe(client, &irps5401_info);
44 }
45 
46 static const struct i2c_device_id irps5401_id[] = {
47 	{"irps5401", 0},
48 	{}
49 };
50 
51 MODULE_DEVICE_TABLE(i2c, irps5401_id);
52 
53 static struct i2c_driver irps5401_driver = {
54 	.driver = {
55 		   .name = "irps5401",
56 		   },
57 	.probe_new = irps5401_probe,
58 	.id_table = irps5401_id,
59 };
60 
61 module_i2c_driver(irps5401_driver);
62 
63 MODULE_AUTHOR("Robert Hancock");
64 MODULE_DESCRIPTION("PMBus driver for Infineon IRPS5401");
65 MODULE_LICENSE("GPL");
66 MODULE_IMPORT_NS(PMBUS);
67