tps40422.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Hardware monitoring driver for TI TPS40422
  4. *
  5. * Copyright (c) 2014 Nokia Solutions and Networks.
  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 tps40422_info = {
  14. .pages = 2,
  15. .format[PSC_VOLTAGE_IN] = linear,
  16. .format[PSC_VOLTAGE_OUT] = linear,
  17. .format[PSC_TEMPERATURE] = linear,
  18. .func[0] = PMBUS_HAVE_VOUT | PMBUS_HAVE_TEMP2
  19. | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_TEMP
  20. | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
  21. .func[1] = PMBUS_HAVE_VOUT | PMBUS_HAVE_TEMP2
  22. | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_TEMP
  23. | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT,
  24. };
  25. static int tps40422_probe(struct i2c_client *client)
  26. {
  27. return pmbus_do_probe(client, &tps40422_info);
  28. }
  29. static const struct i2c_device_id tps40422_id[] = {
  30. {"tps40422", 0},
  31. {}
  32. };
  33. MODULE_DEVICE_TABLE(i2c, tps40422_id);
  34. /* This is the driver that will be inserted */
  35. static struct i2c_driver tps40422_driver = {
  36. .driver = {
  37. .name = "tps40422",
  38. },
  39. .probe_new = tps40422_probe,
  40. .id_table = tps40422_id,
  41. };
  42. module_i2c_driver(tps40422_driver);
  43. MODULE_AUTHOR("Zhu Laiwen <[email protected]>");
  44. MODULE_DESCRIPTION("PMBus driver for TI TPS40422");
  45. MODULE_LICENSE("GPL");
  46. MODULE_IMPORT_NS(PMBUS);