bcm27xx: add support for linux v5.15
[openwrt/staging/wigyori.git] / target / linux / bcm27xx / patches-5.15 / 950-0659-power-rpi-poe-Drop-CURRENT_AVG-as-it-is-not-hardware.patch
1 From dd73451d7f93925a0aca446c5fef68c543658637 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 20 Jan 2022 15:48:03 +0000
4 Subject: [PATCH] power: rpi-poe: Drop CURRENT_AVG as it is not
5 hardware averaged
6
7 As documented the _AVG parameters are meant to be hardware
8 averaged, but the implementation for the PoE+ HAT was done in
9 software in the firmware.
10
11 Drop the property.
12
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
14 ---
15 drivers/power/supply/rpi_poe_power.c | 10 ----------
16 1 file changed, 10 deletions(-)
17
18 --- a/drivers/power/supply/rpi_poe_power.c
19 +++ b/drivers/power/supply/rpi_poe_power.c
20 @@ -106,15 +106,6 @@ static int rpi_poe_power_supply_get_prop
21 r_val->intval = (val > 5);
22 return 0;
23
24 - case POWER_SUPPLY_PROP_CURRENT_AVG:
25 - val = 50;
26 - ret = read_reg(ctx->fw, RPI_POE_ADC_REG, &val);
27 - if (ret)
28 - return ret;
29 - val = (val * 3300)/9821;
30 - r_val->intval = val * 1000;
31 - return 0;
32 -
33 case POWER_SUPPLY_PROP_CURRENT_NOW:
34 ret = read_reg(ctx->fw, RPI_POE_ADC_REG, &val);
35 if (ret)
36 @@ -145,7 +136,6 @@ static int rpi_poe_power_supply_get_prop
37 static enum power_supply_property rpi_poe_power_supply_properties[] = {
38 POWER_SUPPLY_PROP_HEALTH,
39 POWER_SUPPLY_PROP_ONLINE,
40 - POWER_SUPPLY_PROP_CURRENT_AVG,
41 POWER_SUPPLY_PROP_CURRENT_NOW,
42 POWER_SUPPLY_PROP_CURRENT_MAX,
43 };