Message ID | 20221018195122.8877-1-linux.amoon@gmail.com |
---|---|
State | Accepted |
Commit | 44a201df71739a3c5ef3c40e58ebaccfd052d430 |
Headers | show |
Series | arm64: dts: meson: Enable active coling using gpio-fan on Odroid N2/N2+ | expand |
Am Dienstag, 18. Oktober 2022, 21:51:19 CEST schrieb Anand Moon: > Odroid N2/N2+ support active cooling via gpio-fan controller. > Add fan controls and tip point for cpu and ddr thermal sensor > on this boards. > > Signed-off-by: Anand Moon <linux.amoon@gmail.com> > --- > .../dts/amlogic/meson-g12b-odroid-n2.dtsi | 42 +++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi > b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi index > fd3fa82e4c33..e61a4285a910 100644 > --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi > +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi > @@ -39,6 +39,14 @@ emmc_pwrseq: emmc-pwrseq { > reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; > }; > > + fan: gpio-fan { > + compatible = "gpio-fan"; > + gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; > + /* Using Dummy Speed */ > + gpio-fan,speed-map = <0 0>, <1 1>; > + #cooling-cells = <2>; > + }; > + > leds { > compatible = "gpio-leds"; > > @@ -410,6 +418,40 @@ &cpu103 { > clock-latency = <50000>; > }; > > +&cpu_thermal { > + trips { > + cpu_active: cpu-active { > + temperature = <60000>; /* millicelsius */ > + hysteresis = <2000>; /* millicelsius */ > + type = "active"; > + }; > + }; > + > + cooling-maps { > + map { > + trip = <&cpu_active>; > + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + }; > + }; > +}; > + > +&ddr_thermal { > + trips { > + ddr_active: cpu-active { I suspect this node name shall be 'ddr-active', not 'cpu-active'. Best regards, Alexander > + temperature = <60000>; /* millicelsius */ > + hysteresis = <2000>; /* millicelsius */ > + type = "active"; > + }; > + }; > + > + cooling-maps { > + map { > + trip = <&ddr_active>; > + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; > + }; > + }; > +}; > + > &ext_mdio { > external_phy: ethernet-phy@0 { > /* Realtek RTL8211F (0x001cc916) */ > > base-commit: aae703b02f92bde9264366c545e87cec451de471
Hi Martin / Neil, On Thu, 20 Oct 2022 at 02:10, Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote: > > Hi Anand, > > On Wed, Oct 19, 2022 at 7:17 PM Anand Moon <linux.amoon@gmail.com> wrote: > [...] > > > > +&pwm_AO_ab { > > > > > > &pwm_AO_cd not _ab > > > > > No it has a conflict with CPU_B (vddcpu_b) PWM > Uh, you're right. That's probably why the Hardkernel team uses a > software based PWM implementation: [0] > In hindsight they should have used a different pad either for VDDCPU_B > or the fan. > > I think the most pragmatic approach (since the "GPIO PWM" driver is > not upstream and I don't know if something like that would be accepted > upstream) is to use a GPIO based fan as you did in your initial patch. > Not sure what others think though. > When I use gpio-fan I get the following output with gpioinfo Feature it woks as expected. $ .sudo gpioinfo .... gpiochip1 - 15 lines: line 0: unnamed unused input active-high line 1: unnamed unused input active-high line 2: unnamed "enable" output active-high [used] line 3: unnamed unused input active-high line 4: unnamed unused output active-high line 5: unnamed unused input active-high line 6: unnamed unused input active-high line 7: unnamed unused input active-high line 8: unnamed "regulator-tflash_vdd" output active-high [used] line 9: unnamed "TF_IO" output active-high [used] line 10: unnamed "gpio-fan" output active-high [used] line 11: unnamed "n2:blue" output active-high [used] line 12: unnamed unused input active-high line 13: unnamed unused input active-high line 14: unnamed unused input active-high When I am using pwm-fan using *pwm_ao_d_10_pins* pin is not getting registered below hence it is not working on my end. $ .sudo gpioinfo .... gpiochip1 - 15 lines: line 0: unnamed unused input active-high line 1: unnamed unused input active-high line 2: unnamed "enable" output active-high [used] line 3: unnamed unused input active-high line 4: unnamed unused output active-high line 5: unnamed unused input active-high line 6: unnamed unused input active-high line 7: unnamed unused input active-high line 8: unnamed "regulator-tflash_vdd" output active-high [used] line 9: unnamed "TF_IO" output active-high [used] line 10: unnamed unused output active-high line 11: unnamed "n2:blue" output active-high [used] line 12: unnamed unused input active-high line 13: unnamed unused input active-high line 14: unnamed unused input active-high Thanks -Anand > > Best regards, > Martin > > > [0] https://github.com/hardkernel/linux/blob/c109dec94e7e819554830acfac4b6ed96e230179/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dtsi#L356-L359
On 21/10/2022 07:07, Anand Moon wrote: > Hi Martin / Neil, > > On Thu, 20 Oct 2022 at 02:10, Martin Blumenstingl > <martin.blumenstingl@googlemail.com> wrote: >> >> Hi Anand, >> >> On Wed, Oct 19, 2022 at 7:17 PM Anand Moon <linux.amoon@gmail.com> wrote: >> [...] >>>>> +&pwm_AO_ab { >>>> >>>> &pwm_AO_cd not _ab >>>> >>> No it has a conflict with CPU_B (vddcpu_b) PWM >> Uh, you're right. That's probably why the Hardkernel team uses a >> software based PWM implementation: [0] >> In hindsight they should have used a different pad either for VDDCPU_B >> or the fan. >> >> I think the most pragmatic approach (since the "GPIO PWM" driver is >> not upstream and I don't know if something like that would be accepted >> upstream) is to use a GPIO based fan as you did in your initial patch. >> Not sure what others think though. >> > > When I use gpio-fan I get the following output with gpioinfo > Feature it woks as expected. > > $ .sudo gpioinfo > .... > gpiochip1 - 15 lines: > line 0: unnamed unused input active-high > line 1: unnamed unused input active-high > line 2: unnamed "enable" output active-high [used] > line 3: unnamed unused input active-high > line 4: unnamed unused output active-high > line 5: unnamed unused input active-high > line 6: unnamed unused input active-high > line 7: unnamed unused input active-high > line 8: unnamed "regulator-tflash_vdd" output active-high [used] > line 9: unnamed "TF_IO" output active-high [used] > line 10: unnamed "gpio-fan" output active-high [used] > line 11: unnamed "n2:blue" output active-high [used] > line 12: unnamed unused input active-high > line 13: unnamed unused input active-high > line 14: unnamed unused input active-high > > When I am using pwm-fan using *pwm_ao_d_10_pins* pin is not getting > registered below hence it is not working on my end. It's expected because it's not used as a GPIO but another function, you should look in the pinctrl debugfs files to see it. > > $ .sudo gpioinfo > .... > gpiochip1 - 15 lines: > line 0: unnamed unused input active-high > line 1: unnamed unused input active-high > line 2: unnamed "enable" output active-high [used] > line 3: unnamed unused input active-high > line 4: unnamed unused output active-high > line 5: unnamed unused input active-high > line 6: unnamed unused input active-high > line 7: unnamed unused input active-high > line 8: unnamed "regulator-tflash_vdd" output active-high [used] > line 9: unnamed "TF_IO" output active-high [used] > line 10: unnamed unused output active-high > line 11: unnamed "n2:blue" output active-high [used] > line 12: unnamed unused input active-high > line 13: unnamed unused input active-high > line 14: unnamed unused input active-high > > Thanks > -Anand > > > > >> >> Best regards, >> Martin >> >> >> [0] https://github.com/hardkernel/linux/blob/c109dec94e7e819554830acfac4b6ed96e230179/arch/arm64/boot/dts/amlogic/meson64_odroidn2.dtsi#L356-L359
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi index fd3fa82e4c33..e61a4285a910 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi @@ -39,6 +39,14 @@ emmc_pwrseq: emmc-pwrseq { reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; }; + fan: gpio-fan { + compatible = "gpio-fan"; + gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; + /* Using Dummy Speed */ + gpio-fan,speed-map = <0 0>, <1 1>; + #cooling-cells = <2>; + }; + leds { compatible = "gpio-leds"; @@ -410,6 +418,40 @@ &cpu103 { clock-latency = <50000>; }; +&cpu_thermal { + trips { + cpu_active: cpu-active { + temperature = <60000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&cpu_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + +&ddr_thermal { + trips { + ddr_active: cpu-active { + temperature = <60000>; /* millicelsius */ + hysteresis = <2000>; /* millicelsius */ + type = "active"; + }; + }; + + cooling-maps { + map { + trip = <&ddr_active>; + cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; +}; + &ext_mdio { external_phy: ethernet-phy@0 { /* Realtek RTL8211F (0x001cc916) */
Odroid N2/N2+ support active cooling via gpio-fan controller. Add fan controls and tip point for cpu and ddr thermal sensor on this boards. Signed-off-by: Anand Moon <linux.amoon@gmail.com> --- .../dts/amlogic/meson-g12b-odroid-n2.dtsi | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) base-commit: aae703b02f92bde9264366c545e87cec451de471