module: Convert symbol namespace to string literal
[linux.git] / drivers / hwmon / pmbus / tps546d24.c
blob44d7a6df1dbdfc9506359ea530842fbd2f07726b
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Hardware monitoring driver for TEXAS TPS546D24 buck converter
4 */
6 #include <linux/err.h>
7 #include <linux/i2c.h>
8 #include <linux/init.h>
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/pmbus.h>
12 #include "pmbus.h"
14 static struct pmbus_driver_info tps546d24_info = {
15 .pages = 1,
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)
28 int reg;
30 reg = i2c_smbus_read_byte_data(client, PMBUS_VOUT_MODE);
31 if (reg < 0)
32 return reg;
34 if (reg & 0x80) {
35 int err;
37 err = i2c_smbus_write_byte_data(client, PMBUS_VOUT_MODE, reg & 0x7f);
38 if (err < 0)
39 return err;
41 return pmbus_do_probe(client, &tps546d24_info);
44 static const struct i2c_device_id tps546d24_id[] = {
45 {"tps546d24"},
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 = {
58 .driver = {
59 .name = "tps546d24",
60 .of_match_table = of_match_ptr(tps546d24_of_match),
62 .probe = tps546d24_probe,
63 .id_table = tps546d24_id,
66 module_i2c_driver(tps546d24_driver);
68 MODULE_AUTHOR("Duke Du <dukedu83@gmail.com>");
69 MODULE_DESCRIPTION("PMBus driver for TI tps546d24");
70 MODULE_LICENSE("GPL");
71 MODULE_IMPORT_NS("PMBUS");