Re: [PATCH v2 2/5] gpio: gxp: Add HPE GXP GPIO

From: Linus Walleij
Date: Thu Jun 01 2023 - 07:39:45 EST


Hi Nick,

thanks for your patch!

On Wed, May 31, 2023 at 5:23 PM <nick.hawkins@xxxxxxx> wrote:

> +/* Provide info for fan driver */
> +u8 fan_presence;
> +EXPORT_SYMBOL(fan_presence);
> +
> +u8 fan_fail;
> +EXPORT_SYMBOL(fan_fail);
> +
> +/* Remember last PSU config */
> +u8 psu_presence;

As Bartosz said this doesn't work.

to me it looks like you should define a GPIO-controlled fan in the
device tree, similar to this:

fan0: gpio-fan {
compatible = "gpio-fan";
gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
gpio-fan,speed-map = <0 0>, <10000 1>;
#cooling-cells = <2>;
};

Then that cooling cell should be used by a thermal driver for the chassis
to keep the temperature reasonable. I bet you have a temperature sensor
as well, meaning they should form a thermal zone controlled by the fan.

Examples of chassis thermal zones in device tree:
arch/arm/boot/dts/gemini-dlink-dir-685.dts
arch/arm/boot/dts/gemini-dlink-dns-313.dts

Yours,
Linus Walleij