max20751.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Hardware monitoring driver for Maxim MAX20751
  4. *
  5. * Copyright (c) 2015 Guenter Roeck
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/module.h>
  9. #include <linux/init.h>
  10. #include <linux/err.h>
  11. #include <linux/i2c.h>
  12. #include "pmbus.h"
  13. static struct pmbus_driver_info max20751_info = {
  14. .pages = 1,
  15. .format[PSC_VOLTAGE_IN] = linear,
  16. .format[PSC_VOLTAGE_OUT] = vid,
  17. .vrm_version[0] = vr12,
  18. .format[PSC_TEMPERATURE] = linear,
  19. .format[PSC_CURRENT_OUT] = linear,
  20. .format[PSC_POWER] = linear,
  21. .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
  22. PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT |
  23. PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
  24. PMBUS_HAVE_POUT,
  25. };
  26. static int max20751_probe(struct i2c_client *client)
  27. {
  28. return pmbus_do_probe(client, &max20751_info);
  29. }
  30. static const struct i2c_device_id max20751_id[] = {
  31. {"max20751", 0},
  32. {}
  33. };
  34. MODULE_DEVICE_TABLE(i2c, max20751_id);
  35. static struct i2c_driver max20751_driver = {
  36. .driver = {
  37. .name = "max20751",
  38. },
  39. .probe_new = max20751_probe,
  40. .id_table = max20751_id,
  41. };
  42. module_i2c_driver(max20751_driver);
  43. MODULE_AUTHOR("Guenter Roeck <[email protected]>");
  44. MODULE_DESCRIPTION("PMBus driver for Maxim MAX20751");
  45. MODULE_LICENSE("GPL");
  46. MODULE_IMPORT_NS(PMBUS);