950-0657-mfd-simple-mfd-i2c-Add-configuration-for-RPi-POE-HAT.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From 6a08616a30213fd40a17c38c63de4b9c9503a537 Mon Sep 17 00:00:00 2001
  2. From: Dave Stevenson <[email protected]>
  3. Date: Wed, 19 Jan 2022 17:22:57 +0000
  4. Subject: [PATCH] mfd: simple-mfd-i2c: Add configuration for RPi POE
  5. HAT
  6. The Raspbery Pi PoE+ HAT exposes a fan controller and power
  7. supply status reporting via a single I2C address.
  8. Create an MFD device that allows loading of the relevant
  9. sub-drivers, with a shared I2C regmap.
  10. Signed-off-by: Dave Stevenson <[email protected]>
  11. ---
  12. drivers/mfd/Kconfig | 10 ++++++++++
  13. drivers/mfd/simple-mfd-i2c.c | 10 ++++++++++
  14. 2 files changed, 20 insertions(+)
  15. --- a/drivers/mfd/Kconfig
  16. +++ b/drivers/mfd/Kconfig
  17. @@ -1094,6 +1094,16 @@ config MFD_SPMI_PMIC
  18. Say M here if you want to include support for the SPMI PMIC
  19. series as a module. The module will be called "qcom-spmi-pmic".
  20. +config MFD_RASPBERRYPI_POE_HAT
  21. + tristate "Raspberry Pi PoE HAT MFD"
  22. + depends on I2C
  23. + select MFD_SIMPLE_MFD_I2C
  24. + help
  25. + This module supports the PWM fan controller found on the Raspberry Pi
  26. + POE and POE+ HAT boards, and the power supply driver on the POE+ HAT.
  27. + (Functionally it relies on MFD_SIMPLE_MFD_I2C to provide the framework
  28. + that loads the child drivers).
  29. +
  30. config MFD_RDC321X
  31. tristate "RDC R-321x southbridge"
  32. select MFD_CORE
  33. --- a/drivers/mfd/simple-mfd-i2c.c
  34. +++ b/drivers/mfd/simple-mfd-i2c.c
  35. @@ -29,6 +29,15 @@ static const struct regmap_config regmap
  36. .val_bits = 8,
  37. };
  38. +static const struct regmap_config regmap_config_16r_8v = {
  39. + .reg_bits = 16,
  40. + .val_bits = 8,
  41. +};
  42. +
  43. +static const struct simple_mfd_data rpi_poe_core = {
  44. + .regmap_config = &regmap_config_16r_8v,
  45. +};
  46. +
  47. static int simple_mfd_i2c_probe(struct i2c_client *i2c)
  48. {
  49. const struct simple_mfd_data *simple_mfd_data;
  50. @@ -64,6 +73,7 @@ static int simple_mfd_i2c_probe(struct i
  51. static const struct of_device_id simple_mfd_i2c_of_match[] = {
  52. { .compatible = "kontron,sl28cpld" },
  53. + { .compatible = "raspberrypi,poe-core", &rpi_poe_core },
  54. {}
  55. };
  56. MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match);