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 419158411bSRobert Hancock static int irps5401_probe(struct i2c_client *client, 429158411bSRobert Hancock const struct i2c_device_id *id) 439158411bSRobert Hancock { 449158411bSRobert Hancock return pmbus_do_probe(client, id, &irps5401_info); 459158411bSRobert Hancock } 469158411bSRobert Hancock 479158411bSRobert Hancock static const struct i2c_device_id irps5401_id[] = { 489158411bSRobert Hancock {"irps5401", 0}, 499158411bSRobert Hancock {} 509158411bSRobert Hancock }; 519158411bSRobert Hancock 529158411bSRobert Hancock MODULE_DEVICE_TABLE(i2c, irps5401_id); 539158411bSRobert Hancock 549158411bSRobert Hancock static struct i2c_driver irps5401_driver = { 559158411bSRobert Hancock .driver = { 569158411bSRobert Hancock .name = "irps5401", 579158411bSRobert Hancock }, 589158411bSRobert Hancock .probe = irps5401_probe, 599158411bSRobert Hancock .remove = pmbus_do_remove, 609158411bSRobert Hancock .id_table = irps5401_id, 619158411bSRobert Hancock }; 629158411bSRobert Hancock 639158411bSRobert Hancock module_i2c_driver(irps5401_driver); 649158411bSRobert Hancock 659158411bSRobert Hancock MODULE_AUTHOR("Robert Hancock"); 669158411bSRobert Hancock MODULE_DESCRIPTION("PMBus driver for Infineon IRPS5401"); 679158411bSRobert Hancock MODULE_LICENSE("GPL"); 68