2d66e12658b0a94ff40584dc6b4d6234d1b49dc3
[openwrt/staging/pepe2k.git] /
1 From aa4a0729c4e6f94fde5281d6454342bbd4fc69e1 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 @@ -1152,6 +1152,16 @@ config MFD_SY7636A
22 To enable support for building sub-devices as modules,
23 choose M here.
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 @@ -75,6 +84,7 @@ static const struct simple_mfd_data sile
57 static const struct of_device_id simple_mfd_i2c_of_match[] = {
58 { .compatible = "kontron,sl28cpld" },
59 { .compatible = "silergy,sy7636a", .data = &silergy_sy7636a},
60 + { .compatible = "raspberrypi,poe-core", &rpi_poe_core },
61 {}
62 };
63 MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match);