1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Hardware monitoring driver for Analog Devices ADP1050 4 * 5 * Copyright (C) 2024 Analog Devices, Inc. 6 */ 7 #include <linux/bits.h> 8 #include <linux/i2c.h> 9 #include <linux/mod_devicetable.h> 10 #include <linux/module.h> 11 12 #include "pmbus.h" 13 14 static struct pmbus_driver_info adp1050_info = { 15 .pages = 1, 16 .format[PSC_VOLTAGE_IN] = linear, 17 .format[PSC_VOLTAGE_OUT] = linear, 18 .format[PSC_CURRENT_IN] = linear, 19 .format[PSC_TEMPERATURE] = linear, 20 .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT 21 | PMBUS_HAVE_VIN | PMBUS_HAVE_STATUS_INPUT 22 | PMBUS_HAVE_IIN | PMBUS_HAVE_TEMP 23 | PMBUS_HAVE_STATUS_TEMP, 24 }; 25 26 static int adp1050_probe(struct i2c_client *client) 27 { 28 return pmbus_do_probe(client, &adp1050_info); 29 } 30 31 static const struct i2c_device_id adp1050_id[] = { 32 {"adp1050"}, 33 {} 34 }; 35 MODULE_DEVICE_TABLE(i2c, adp1050_id); 36 37 static const struct of_device_id adp1050_of_match[] = { 38 { .compatible = "adi,adp1050"}, 39 {} 40 }; 41 MODULE_DEVICE_TABLE(of, adp1050_of_match); 42 43 static struct i2c_driver adp1050_driver = { 44 .driver = { 45 .name = "adp1050", 46 .of_match_table = adp1050_of_match, 47 }, 48 .probe = adp1050_probe, 49 .id_table = adp1050_id, 50 }; 51 module_i2c_driver(adp1050_driver); 52 53 MODULE_AUTHOR("Radu Sabau <radu.sabau@analog.com>"); 54 MODULE_DESCRIPTION("Analog Devices ADP1050 HWMON PMBus Driver"); 55 MODULE_LICENSE("GPL"); 56 MODULE_IMPORT_NS(PMBUS); 57