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