1 // SPDX-License-Identifier: GPL-2.0+
3 * Hardware monitoring driver for TEXAS TPS546D24 buck converter
8 #include <linux/init.h>
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/pmbus.h>
14 static struct pmbus_driver_info tps546d24_info = {
16 .format[PSC_VOLTAGE_IN] = linear,
17 .format[PSC_VOLTAGE_OUT] = linear,
18 .format[PSC_TEMPERATURE] = linear,
19 .format[PSC_CURRENT_OUT] = linear,
20 .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN
21 | PMBUS_HAVE_IOUT | PMBUS_HAVE_VOUT
22 | PMBUS_HAVE_STATUS_IOUT | PMBUS_HAVE_STATUS_VOUT
23 | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP,
26 static int tps546d24_probe(struct i2c_client *client)
30 reg = i2c_smbus_read_byte_data(client, PMBUS_VOUT_MODE);
37 err = i2c_smbus_write_byte_data(client, PMBUS_VOUT_MODE, reg & 0x7f);
41 return pmbus_do_probe(client, &tps546d24_info);
44 static const struct i2c_device_id tps546d24_id[] = {
48 MODULE_DEVICE_TABLE(i2c, tps546d24_id);
50 static const struct of_device_id __maybe_unused tps546d24_of_match[] = {
51 {.compatible = "ti,tps546d24"},
54 MODULE_DEVICE_TABLE(of, tps546d24_of_match);
56 /* This is the driver that will be inserted */
57 static struct i2c_driver tps546d24_driver = {
60 .of_match_table = of_match_ptr(tps546d24_of_match),
62 .probe_new = tps546d24_probe,
63 .id_table = tps546d24_id,
66 module_i2c_driver(tps546d24_driver);
69 MODULE_DESCRIPTION("PMBus driver for TI tps546d24");
70 MODULE_LICENSE("GPL");
71 MODULE_IMPORT_NS(PMBUS);