Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Hardware monitoring driver for TI TPS40422
0004  *
0005  * Copyright (c) 2014 Nokia Solutions and Networks.
0006  */
0007 
0008 #include <linux/kernel.h>
0009 #include <linux/module.h>
0010 #include <linux/init.h>
0011 #include <linux/err.h>
0012 #include <linux/i2c.h>
0013 #include "pmbus.h"
0014 
0015 static struct pmbus_driver_info tps40422_info = {
0016     .pages = 2,
0017     .format[PSC_VOLTAGE_IN] = linear,
0018     .format[PSC_VOLTAGE_OUT] = linear,
0019     .format[PSC_TEMPERATURE] = linear,
0020     .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_TEMP2
0021         | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_TEMP
0022         | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
0023     .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_TEMP2
0024         | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_TEMP
0025         | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
0026 };
0027 
0028 static int tps40422_probe(struct i2c_client *client)
0029 {
0030     return pmbus_do_probe(client, &tps40422_info);
0031 }
0032 
0033 static const struct i2c_device_id tps40422_id[] = {
0034     {"tps40422", 0},
0035     {}
0036 };
0037 
0038 MODULE_DEVICE_TABLE(i2c, tps40422_id);
0039 
0040 /* This is the driver that will be inserted */
0041 static struct i2c_driver tps40422_driver = {
0042     .driver = {
0043            .name = "tps40422",
0044            },
0045     .probe_new = tps40422_probe,
0046     .id_table = tps40422_id,
0047 };
0048 
0049 module_i2c_driver(tps40422_driver);
0050 
0051 MODULE_AUTHOR("Zhu Laiwen <richard.zhu@nsn.com>");
0052 MODULE_DESCRIPTION("PMBus driver for TI TPS40422");
0053 MODULE_LICENSE("GPL");
0054 MODULE_IMPORT_NS(PMBUS);