Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * Hardware monitoring driver for the Infineon IRPS5401M PMIC.
0004  *
0005  * Copyright (c) 2019 SED Systems, a division of Calian Ltd.
0006  *
0007  * The device supports VOUT_PEAK, IOUT_PEAK, and TEMPERATURE_PEAK, however
0008  * this driver does not currently support them.
0009  */
0010 
0011 #include <linux/err.h>
0012 #include <linux/i2c.h>
0013 #include <linux/init.h>
0014 #include <linux/kernel.h>
0015 #include <linux/module.h>
0016 #include "pmbus.h"
0017 
0018 #define IRPS5401_SW_FUNC (PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | \
0019               PMBUS_HAVE_STATUS_INPUT | \
0020               PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \
0021               PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \
0022               PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | \
0023               PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP)
0024 
0025 #define IRPS5401_LDO_FUNC (PMBUS_HAVE_VIN | \
0026                PMBUS_HAVE_STATUS_INPUT | \
0027                PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \
0028                PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \
0029                PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | \
0030                PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP)
0031 
0032 static struct pmbus_driver_info irps5401_info = {
0033     .pages = 5,
0034     .func[0] = IRPS5401_SW_FUNC,
0035     .func[1] = IRPS5401_SW_FUNC,
0036     .func[2] = IRPS5401_SW_FUNC,
0037     .func[3] = IRPS5401_SW_FUNC,
0038     .func[4] = IRPS5401_LDO_FUNC,
0039 };
0040 
0041 static int irps5401_probe(struct i2c_client *client)
0042 {
0043     return pmbus_do_probe(client, &irps5401_info);
0044 }
0045 
0046 static const struct i2c_device_id irps5401_id[] = {
0047     {"irps5401", 0},
0048     {}
0049 };
0050 
0051 MODULE_DEVICE_TABLE(i2c, irps5401_id);
0052 
0053 static struct i2c_driver irps5401_driver = {
0054     .driver = {
0055            .name = "irps5401",
0056            },
0057     .probe_new = irps5401_probe,
0058     .id_table = irps5401_id,
0059 };
0060 
0061 module_i2c_driver(irps5401_driver);
0062 
0063 MODULE_AUTHOR("Robert Hancock");
0064 MODULE_DESCRIPTION("PMBus driver for Infineon IRPS5401");
0065 MODULE_LICENSE("GPL");
0066 MODULE_IMPORT_NS(PMBUS);