xref: /linux/drivers/hwmon/pmbus/irps5401.c (revision dd43193976b9a7b2affe8fb71780bb96d16a8449)
19158411bSRobert Hancock // SPDX-License-Identifier: GPL-2.0+
29158411bSRobert Hancock /*
39158411bSRobert Hancock  * Hardware monitoring driver for the Infineon IRPS5401M PMIC.
49158411bSRobert Hancock  *
59158411bSRobert Hancock  * Copyright (c) 2019 SED Systems, a division of Calian Ltd.
69158411bSRobert Hancock  *
79158411bSRobert Hancock  * The device supports VOUT_PEAK, IOUT_PEAK, and TEMPERATURE_PEAK, however
89158411bSRobert Hancock  * this driver does not currently support them.
99158411bSRobert Hancock  */
109158411bSRobert Hancock 
119158411bSRobert Hancock #include <linux/err.h>
129158411bSRobert Hancock #include <linux/i2c.h>
139158411bSRobert Hancock #include <linux/init.h>
149158411bSRobert Hancock #include <linux/kernel.h>
159158411bSRobert Hancock #include <linux/module.h>
169158411bSRobert Hancock #include "pmbus.h"
179158411bSRobert Hancock 
189158411bSRobert Hancock #define IRPS5401_SW_FUNC (PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | \
199158411bSRobert Hancock 			  PMBUS_HAVE_STATUS_INPUT | \
209158411bSRobert Hancock 			  PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \
219158411bSRobert Hancock 			  PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \
229158411bSRobert Hancock 			  PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | \
239158411bSRobert Hancock 			  PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP)
249158411bSRobert Hancock 
259158411bSRobert Hancock #define IRPS5401_LDO_FUNC (PMBUS_HAVE_VIN | \
269158411bSRobert Hancock 			   PMBUS_HAVE_STATUS_INPUT | \
279158411bSRobert Hancock 			   PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \
289158411bSRobert Hancock 			   PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \
299158411bSRobert Hancock 			   PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | \
309158411bSRobert Hancock 			   PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP)
319158411bSRobert Hancock 
329158411bSRobert Hancock static struct pmbus_driver_info irps5401_info = {
339158411bSRobert Hancock 	.pages = 5,
349158411bSRobert Hancock 	.func[0] = IRPS5401_SW_FUNC,
359158411bSRobert Hancock 	.func[1] = IRPS5401_SW_FUNC,
369158411bSRobert Hancock 	.func[2] = IRPS5401_SW_FUNC,
379158411bSRobert Hancock 	.func[3] = IRPS5401_SW_FUNC,
389158411bSRobert Hancock 	.func[4] = IRPS5401_LDO_FUNC,
399158411bSRobert Hancock };
409158411bSRobert Hancock 
41*dd431939SStephen Kitt static int irps5401_probe(struct i2c_client *client)
429158411bSRobert Hancock {
43*dd431939SStephen Kitt 	return pmbus_do_probe(client, &irps5401_info);
449158411bSRobert Hancock }
459158411bSRobert Hancock 
469158411bSRobert Hancock static const struct i2c_device_id irps5401_id[] = {
479158411bSRobert Hancock 	{"irps5401", 0},
489158411bSRobert Hancock 	{}
499158411bSRobert Hancock };
509158411bSRobert Hancock 
519158411bSRobert Hancock MODULE_DEVICE_TABLE(i2c, irps5401_id);
529158411bSRobert Hancock 
539158411bSRobert Hancock static struct i2c_driver irps5401_driver = {
549158411bSRobert Hancock 	.driver = {
559158411bSRobert Hancock 		   .name = "irps5401",
569158411bSRobert Hancock 		   },
57*dd431939SStephen Kitt 	.probe_new = irps5401_probe,
589158411bSRobert Hancock 	.remove = pmbus_do_remove,
599158411bSRobert Hancock 	.id_table = irps5401_id,
609158411bSRobert Hancock };
619158411bSRobert Hancock 
629158411bSRobert Hancock module_i2c_driver(irps5401_driver);
639158411bSRobert Hancock 
649158411bSRobert Hancock MODULE_AUTHOR("Robert Hancock");
659158411bSRobert Hancock MODULE_DESCRIPTION("PMBus driver for Infineon IRPS5401");
669158411bSRobert Hancock MODULE_LICENSE("GPL");
67