1 // SPDX-License-Identifier: GPL-2.0+
3 * Hardware monitoring driver for STMicroelectronics digital controller PM6764TR
8 #include <linux/init.h>
9 #include <linux/kernel.h>
10 #include <linux/module.h>
11 #include <linux/pmbus.h>
14 #define PM6764TR_PMBUS_READ_VOUT 0xD4
16 static int pm6764tr_read_word_data(struct i2c_client
*client
, int page
, int phase
, int reg
)
21 case PMBUS_VIRT_READ_VMON
:
22 ret
= pmbus_read_word_data(client
, page
, phase
, PM6764TR_PMBUS_READ_VOUT
);
31 static struct pmbus_driver_info pm6764tr_info
= {
33 .format
[PSC_VOLTAGE_IN
] = linear
,
34 .format
[PSC_VOLTAGE_OUT
] = vid
,
35 .format
[PSC_TEMPERATURE
] = linear
,
36 .format
[PSC_CURRENT_OUT
] = linear
,
37 .format
[PSC_POWER
] = linear
,
38 .func
[0] = PMBUS_HAVE_VIN
| PMBUS_HAVE_IIN
| PMBUS_HAVE_PIN
|
39 PMBUS_HAVE_IOUT
| PMBUS_HAVE_POUT
| PMBUS_HAVE_VMON
|
40 PMBUS_HAVE_STATUS_IOUT
| PMBUS_HAVE_STATUS_VOUT
|
41 PMBUS_HAVE_TEMP
| PMBUS_HAVE_STATUS_TEMP
,
42 .read_word_data
= pm6764tr_read_word_data
,
45 static int pm6764tr_probe(struct i2c_client
*client
)
47 return pmbus_do_probe(client
, &pm6764tr_info
);
50 static const struct i2c_device_id pm6764tr_id
[] = {
54 MODULE_DEVICE_TABLE(i2c
, pm6764tr_id
);
56 static const struct of_device_id __maybe_unused pm6764tr_of_match
[] = {
57 {.compatible
= "st,pm6764tr"},
61 /* This is the driver that will be inserted */
62 static struct i2c_driver pm6764tr_driver
= {
65 .of_match_table
= of_match_ptr(pm6764tr_of_match
),
67 .probe
= pm6764tr_probe
,
68 .id_table
= pm6764tr_id
,
71 module_i2c_driver(pm6764tr_driver
);
73 MODULE_AUTHOR("Charles Hsu");
74 MODULE_DESCRIPTION("PMBus driver for ST PM6764TR");
75 MODULE_LICENSE("GPL");
76 MODULE_IMPORT_NS("PMBUS");