From 03e5ef833f387177c5f40f8cc57c452d43145bb3 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 19 Jan 2022 17:29:13 +0000 Subject: [PATCH 677/828] dtoverlays: Add option for PoE HAT to use Linux I2C instead of FW. Adds parameter "i2c" to use the PoE HAT I2C MFD driver to instantiate the PoE HAT drivers, instead of being off the firmware. Signed-off-by: Dave Stevenson --- arch/arm/boot/dts/overlays/README | 4 ++ .../arm/boot/dts/overlays/rpi-poe-overlay.dts | 62 +++++++++++++++---- .../dts/overlays/rpi-poe-plus-overlay.dts | 15 +++++ 3 files changed, 69 insertions(+), 12 deletions(-) --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -2858,6 +2858,8 @@ Params: poe_fan_temp0 Temperat speeds up (default 55000) poe_fan_temp3_hyst Temperature delta (in millicelcius) at which the fan slows down (default 5000) + i2c Control the fan via Linux I2C drivers instead of + the firmware. Name: rpi-poe-plus @@ -2879,6 +2881,8 @@ Params: poe_fan_temp0 Temperat speeds up (default 55000) poe_fan_temp3_hyst Temperature delta (in millicelcius) at which the fan slows down (default 5000) + i2c Control the fan via Linux I2C drivers instead of + the firmware. Name: rpi-proto --- a/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts +++ b/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts @@ -8,16 +8,6 @@ compatible = "brcm,bcm2835"; fragment@0 { - target = <&firmware>; - __overlay__ { - fwpwm: pwm { - compatible = "raspberrypi,firmware-poe-pwm"; - #pwm-cells = <2>; - }; - }; - }; - - fragment@1 { target-path = "/"; __overlay__ { fan: pwm-fan { @@ -29,7 +19,7 @@ }; }; - fragment@2 { + fragment@1 { target = <&cpu_thermal>; __overlay__ { trips { @@ -75,7 +65,7 @@ }; }; - fragment@3 { + fragment@2 { target-path = "/__overrides__"; __overlay__ { poe_fan_temp0 = <&trip0>,"temperature:0"; @@ -89,6 +79,52 @@ }; }; + fragment@3 { + target = <&firmware>; + __overlay__ { + fwpwm: pwm { + compatible = "raspberrypi,firmware-poe-pwm"; + #pwm-cells = <2>; + }; + }; + }; + + fragment@4 { + target = <&i2c0>; + __dormant__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + poe_mfd: poe@51 { + compatible = "raspberrypi,poe-core"; + reg = <0x51>; + status = "okay"; + + poe_mfd_pwm: poe_pwm@f0 { + compatible = "raspberrypi,poe-pwm"; + reg = <0xf0>; + status = "okay"; + #pwm-cells = <2>; + }; + }; + }; + }; + + fragment@5 { + target = <&i2c0if>; + __dormant__ { + status = "okay"; + }; + }; + + fragment@6 { + target = <&i2c0mux>; + __dormant__ { + status = "okay"; + }; + }; + __overrides__ { poe_fan_temp0 = <&trip0>,"temperature:0"; poe_fan_temp0_hyst = <&trip0>,"hysteresis:0"; @@ -98,5 +134,7 @@ poe_fan_temp2_hyst = <&trip2>,"hysteresis:0"; poe_fan_temp3 = <&trip3>,"temperature:0"; poe_fan_temp3_hyst = <&trip3>,"hysteresis:0"; + i2c = <0>, "-3+4+5+6", + <&fan>,"pwms:0=",<&poe_mfd_pwm>; }; }; --- a/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts +++ b/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts @@ -16,6 +16,21 @@ }; }; }; + fragment@11 { + target = <&poe_mfd>; + __dormant__ { + rpi-poe-power-supply@f2 { + compatible = "raspberrypi,rpi-poe-power-supply"; + reg = <0xf2>; + status = "okay"; + }; + }; + }; + + __overrides__ { + i2c = <0>, "-3+4+5+6-10+11", + <&fan>,"pwms:0=",<&poe_mfd_pwm>; + }; }; &fan {