[PATCH linux dev-4.10 v7] ARM: dts: aspeed: witherspoon: Add gpio-keys-polled for fan presence

Cédric Le Goater clg at kaod.org
Fri Aug 4 08:16:20 AEST 2017


On 08/03/2017 08:50 PM, Eddie James wrote:
> From: "Edward A. James" <eajames at us.ibm.com>
> 
> Add gpio-keys-polled node for pca955x fan presence lines. Change the binding
> of the pca9552 to remove the leds and instead define all the provided gpio pins
> there. Add back the leds in a 'gpio-leds' compatible entry.
> 
> Polling period of 1 second to be determined to be the max acceptable
> value based on discussions with Brad Bishop and Matt Spinler. Tested
> with gpiomon program - verified.
> 
> Patch based on Cedric's example - thanks! Tested on witherspoon.

You did the most difficult part: testing. 

Acked-by: Cédric Le Goater <clg at kaod.org>

Thanks,

C. 


> 
> Signed-off-by: Edward A. James <eajames at us.ibm.com>
> ---
>  arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 152 ++++++++++++++++++-----
>  1 file changed, 124 insertions(+), 28 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> index c0f992e..9ab8e46 100644
> --- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> +++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> @@ -56,6 +56,77 @@
>  		};
>  	};
>  
> +	gpio-keys-polled {
> +		compatible = "gpio-keys-polled";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		poll-interval = <1000>;
> +
> +		fan0-presence {
> +			label = "fan0-presence";
> +			gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
> +			linux,code = <4>;
> +		};
> +
> +		fan1-presence {
> +			label = "fan1-presence";
> +			gpios = <&pca0 5 GPIO_ACTIVE_LOW>;
> +			linux,code = <5>;
> +		};
> +
> +		fan2-presence {
> +			label = "fan2-presence";
> +			gpios = <&pca0 6 GPIO_ACTIVE_LOW>;
> +			linux,code = <6>;
> +		};
> +
> +		fan3-presence {
> +			label = "fan3-presence";
> +			gpios = <&pca0 7 GPIO_ACTIVE_LOW>;
> +			linux,code = <7>;
> +		};
> +	};
> +
> +	pca_leds {
> +		compatible = "gpio-leds";
> +
> +		fan0 {
> +			label = "fan0";
> +			default-state = "keep";
> +			gpios = <&pca0 0 GPIO_ACTIVE_LOW>;
> +		};
> +		fan1 {
> +			label = "fan1";
> +			default-state = "keep";
> +			gpios = <&pca0 1 GPIO_ACTIVE_LOW>;
> +		};
> +		fan2 {
> +			label = "fan2";
> +			default-state = "keep";
> +			gpios = <&pca0 2 GPIO_ACTIVE_LOW>;
> +		};
> +		fan3 {
> +			label = "fan3";
> +			default-state = "keep";
> +			gpios = <&pca0 3 GPIO_ACTIVE_LOW>;
> +		};
> +		front_fault {
> +			label = "front-fault";
> +			default-state = "keep";
> +			gpios = <&pca0 13 GPIO_ACTIVE_LOW>;
> +		};
> +		front_power {
> +			label = "front-power";
> +			default-state = "keep";
> +			gpios = <&pca0 14 GPIO_ACTIVE_LOW>;
> +		};
> +		front_id {
> +			label = "front-id";
> +			default-state = "keep";
> +			gpios = <&pca0 15 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
>  	leds {
>  		compatible = "gpio-leds";
>  
> @@ -278,47 +349,72 @@
>  		#address-cells = <1>;
>  		#size-cells = <0>;
>  
> -		fan0: led at 0 {
> -			label = "fan0";
> -			default-state = "keep";
> +		gpio-controller;
> +		#gpio-cells = <2>;
> +
> +		gpio at 0 {
>  			reg = <0>;
> -			type = <PCA955X_TYPE_LED>;
> +			type = <PCA955X_TYPE_GPIO>;
>  		};
> -		fan1: led at 1 {
> -			label = "fan1";
> -			default-state = "keep";
> +		gpio at 1 {
>  			reg = <1>;
> -			type = <PCA955X_TYPE_LED>;
> +			type = <PCA955X_TYPE_GPIO>;
>  		};
> -		fan2: led at 2 {
> -			label = "fan2";
> -			default-state = "keep";
> +		gpio at 2 {
>  			reg = <2>;
> -			type = <PCA955X_TYPE_LED>;
> +			type = <PCA955X_TYPE_GPIO>;
>  		};
> -		fan3: led at 3 {
> -			label = "fan3";
> -			default-state = "keep";
> +		gpio at 3 {
>  			reg = <3>;
> -			type = <PCA955X_TYPE_LED>;
> +			type = <PCA955X_TYPE_GPIO>;
>  		};
> -		front_fault: led at 13 {
> -			label = "front-fault";
> -			default-state = "keep";
> +		gpio at 4 {
> +			reg = <4>;
> +			type = <PCA955X_TYPE_GPIO>;
> +		};
> +		gpio at 5 {
> +			reg = <5>;
> +			type = <PCA955X_TYPE_GPIO>;
> +		};
> +		gpio at 6 {
> +			reg = <6>;
> +			type = <PCA955X_TYPE_GPIO>;
> +		};
> +		gpio at 7 {
> +			reg = <7>;
> +			type = <PCA955X_TYPE_GPIO>;
> +		};
> +		gpio at 8 {
> +			reg = <8>;
> +			type = <PCA955X_TYPE_GPIO>;
> +		};
> +		gpio at 9 {
> +			reg = <9>;
> +			type = <PCA955X_TYPE_GPIO>;
> +		};
> +		gpio at 10 {
> +			reg = <10>;
> +			type = <PCA955X_TYPE_GPIO>;
> +		};
> +		gpio at 11 {
> +			reg = <11>;
> +			type = <PCA955X_TYPE_GPIO>;
> +		};
> +		gpio at 12 {
> +			reg = <12>;
> +			type = <PCA955X_TYPE_GPIO>;
> +		};
> +		gpio at 13 {
>  			reg = <13>;
> -			type = <PCA955X_TYPE_LED>;
> +			type = <PCA955X_TYPE_GPIO>;
>  		};
> -		front_power: led at 14 {
> -			label = "front-power";
> -			default-state = "keep";
> +		gpio at 14 {
>  			reg = <14>;
> -			type = <PCA955X_TYPE_LED>;
> +			type = <PCA955X_TYPE_GPIO>;
>  		};
> -		front_id: led at 15 {
> -			label = "front-id";
> -			default-state = "keep";
> +		gpio at 15 {
>  			reg = <15>;
> -			type = <PCA955X_TYPE_LED>;
> +			type = <PCA955X_TYPE_GPIO>;
>  		};
>  	};
>  };
> 



More information about the openbmc mailing list