irps5401.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Hardware monitoring driver for the Infineon IRPS5401M PMIC.
  4. *
  5. * Copyright (c) 2019 SED Systems, a division of Calian Ltd.
  6. *
  7. * The device supports VOUT_PEAK, IOUT_PEAK, and TEMPERATURE_PEAK, however
  8. * this driver does not currently support them.
  9. */
  10. #include <linux/err.h>
  11. #include <linux/i2c.h>
  12. #include <linux/init.h>
  13. #include <linux/kernel.h>
  14. #include <linux/module.h>
  15. #include "pmbus.h"
  16. #define IRPS5401_SW_FUNC (PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | \
  17. PMBUS_HAVE_STATUS_INPUT | \
  18. PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \
  19. PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \
  20. PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | \
  21. PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP)
  22. #define IRPS5401_LDO_FUNC (PMBUS_HAVE_VIN | \
  23. PMBUS_HAVE_STATUS_INPUT | \
  24. PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT | \
  25. PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT | \
  26. PMBUS_HAVE_PIN | PMBUS_HAVE_POUT | \
  27. PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP)
  28. static struct pmbus_driver_info irps5401_info = {
  29. .pages = 5,
  30. .func[0] = IRPS5401_SW_FUNC,
  31. .func[1] = IRPS5401_SW_FUNC,
  32. .func[2] = IRPS5401_SW_FUNC,
  33. .func[3] = IRPS5401_SW_FUNC,
  34. .func[4] = IRPS5401_LDO_FUNC,
  35. };
  36. static int irps5401_probe(struct i2c_client *client)
  37. {
  38. return pmbus_do_probe(client, &irps5401_info);
  39. }
  40. static const struct i2c_device_id irps5401_id[] = {
  41. {"irps5401", 0},
  42. {}
  43. };
  44. MODULE_DEVICE_TABLE(i2c, irps5401_id);
  45. static struct i2c_driver irps5401_driver = {
  46. .driver = {
  47. .name = "irps5401",
  48. },
  49. .probe_new = irps5401_probe,
  50. .id_table = irps5401_id,
  51. };
  52. module_i2c_driver(irps5401_driver);
  53. MODULE_AUTHOR("Robert Hancock");
  54. MODULE_DESCRIPTION("PMBus driver for Infineon IRPS5401");
  55. MODULE_LICENSE("GPL");
  56. MODULE_IMPORT_NS(PMBUS);