diff mbox

ARM: mvebu: Add RN104 SATA LEDs driven via NXP PCA9554 I2C to GPIO muxer

Message ID 877gchmggw.fsf@natisbad.org (mailing list archive)
State New, archived
Headers show

Commit Message

Arnaud Ebalard Nov. 9, 2013, 9:07 p.m. UTC
NETGEAR ReadyNAS 104 has a NXP PCA9554 I2C to GPIO chip. Among the 8 GPIO
lines the chip makes available, four are used on the device to control
the SATA LEDs (the four remaining ones are used for SATA disk presence).
This patch adds DT entries for NXP PCA9554 and the four SATA GPIO LEDs.

Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
---
Hi Jason,

This one depends on the patch (ARM: mvebu: Add Netgear ReadyNAS 104
board) which you pushed to Olof for inclusion in v3.13.

If you wonder why NETGEAR was short on GPIO lines from the Armada 370
SoC and had to add this, the answer is: the front Winstar WH1602 LCD
consumes 7 lines.

Cheers,

a+

 arch/arm/boot/dts/armada-370-netgear-rn104.dts | 31 ++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

Comments

Sebastian Hesselbarth Nov. 9, 2013, 11:59 p.m. UTC | #1
On 11/09/2013 10:07 PM, Arnaud Ebalard wrote:
> NETGEAR ReadyNAS 104 has a NXP PCA9554 I2C to GPIO chip. Among the 8 GPIO
> lines the chip makes available, four are used on the device to control
> the SATA LEDs (the four remaining ones are used for SATA disk presence).
> This patch adds DT entries for NXP PCA9554 and the four SATA GPIO LEDs.
>
> Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
> ---
[...]
> diff --git a/arch/arm/boot/dts/armada-370-netgear-rn104.dts b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
> index b0b32f5..1efc871 100644
> --- a/arch/arm/boot/dts/armada-370-netgear-rn104.dts
> +++ b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
> @@ -123,6 +123,13 @@
>   					fan_startv = <1>;
>   					pwm_polarity = <0>;
>   				};
> +
> +				pca9554: pca9554@23 {
> +					compatible = "nxp,pca9554";
> +					gpio-controller;
> +					#gpio-cells = <2>;
> +					reg = <0x23>;
> +				};
>   			};
>   		};
>   	};
> @@ -154,6 +161,30 @@
>   			gpios = <&gpio2 0 1>;    /* GPIO 64 Active Low */
>   			linux,default-trigger = "keep";
>   		};
> +
> +		sata1_led {
> +			label = "rn104:blue:sata1";
> +			gpios = <&pca9554 0 1>;  /* Active Low */

Same comment as for ReadyNAS 2120 patch:

#include <dt-bindings/gpio/gpio.h> and use GPIO_ACTIVE_HIGH/LOW.

Sebastian

> +			default-state = "off";
> +		};
> +
> +		sata2_led {
> +			label = "rn104:blue:sata2";
> +			gpios = <&pca9554 1 1>;  /* Active Low */
> +			default-state = "off";
> +		};
> +
> +		sata3_led {
> +			label = "rn104:blue:sata3";
> +			gpios = <&pca9554 2 1>;  /* Active Low */
> +			default-state = "off";
> +		};
> +
> +		sata4_led {
> +			label = "rn104:blue:sata4";
> +			gpios = <&pca9554 3 1>;  /* Active Low */
> +			default-state = "off";
> +		};
>   	};
>
>   	gpio_keys {
>
Arnaud Ebalard Nov. 10, 2013, 12:50 a.m. UTC | #2
Hi,

Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> writes:

>> +
>> +		sata1_led {
>> +			label = "rn104:blue:sata1";
>> +			gpios = <&pca9554 0 1>;  /* Active Low */
>
> Same comment as for ReadyNAS 2120 patch:
>
> #include <dt-bindings/gpio/gpio.h> and use GPIO_ACTIVE_HIGH/LOW.
>
> Sebastian

Will fix that and resend tomorrow.

Cheers,

a+
Arnaud Ebalard Nov. 11, 2013, 8:07 p.m. UTC | #3
Hi Sebastian,

Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> writes:

>> @@ -154,6 +161,30 @@
>>   			gpios = <&gpio2 0 1>;    /* GPIO 64 Active Low */
>>   			linux,default-trigger = "keep";
>>   		};
>> +
>> +		sata1_led {
>> +			label = "rn104:blue:sata1";
>> +			gpios = <&pca9554 0 1>;  /* Active Low */
>
> Same comment as for ReadyNAS 2120 patch:
>
> #include <dt-bindings/gpio/gpio.h> and use GPIO_ACTIVE_HIGH/LOW.

Unlike RN2120 .dts for which I was able to change all the high/low
values for macros in a single move, if I do the changes here for this
specific patch, the .dts file for the RN104 will contain both values and
macros.

What about the following options?:

 - send a preliminary patch to change all the values for macros in RN104
   .dts file once -rc1 is here and then resubmit the PCA9554 patch with
   macros?
 - have the patch applied as is and then convert the whole RN104 .dts w/
   another patch.

Anyway, once RN2120 is accepted, I intend to spend some time doing some
housekeeping on other readynas .dts file based on the comments you made
recently (macros, reg, addressing, phy info, etc), and also some minor
points (whitespaces).

Cheers,

a+
Sebastian Hesselbarth Nov. 11, 2013, 8:22 p.m. UTC | #4
On 11/11/2013 09:07 PM, Arnaud Ebalard wrote:
> Hi Sebastian,
>
> Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> writes:
>
>>> @@ -154,6 +161,30 @@
>>>    			gpios = <&gpio2 0 1>;    /* GPIO 64 Active Low */
>>>    			linux,default-trigger = "keep";
>>>    		};
>>> +
>>> +		sata1_led {
>>> +			label = "rn104:blue:sata1";
>>> +			gpios = <&pca9554 0 1>;  /* Active Low */
>>
>> Same comment as for ReadyNAS 2120 patch:
>>
>> #include <dt-bindings/gpio/gpio.h> and use GPIO_ACTIVE_HIGH/LOW.
>
> Unlike RN2120 .dts for which I was able to change all the high/low
> values for macros in a single move, if I do the changes here for this
> specific patch, the .dts file for the RN104 will contain both values and
> macros.
>
> What about the following options?:
>
>   - send a preliminary patch to change all the values for macros in RN104
>     .dts file once -rc1 is here and then resubmit the PCA9554 patch with
>     macros?
>   - have the patch applied as is and then convert the whole RN104 .dts w/
>     another patch.

I'd say, respin this with gpio.h and go for a round of cleanup later.

> Anyway, once RN2120 is accepted, I intend to spend some time doing some
> housekeeping on other readynas .dts file based on the comments you made
> recently (macros, reg, addressing, phy info, etc), and also some minor
> points (whitespaces).

Great!

Sebastian
diff mbox

Patch

diff --git a/arch/arm/boot/dts/armada-370-netgear-rn104.dts b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
index b0b32f5..1efc871 100644
--- a/arch/arm/boot/dts/armada-370-netgear-rn104.dts
+++ b/arch/arm/boot/dts/armada-370-netgear-rn104.dts
@@ -123,6 +123,13 @@ 
 					fan_startv = <1>;
 					pwm_polarity = <0>;
 				};
+
+				pca9554: pca9554@23 {
+					compatible = "nxp,pca9554";
+					gpio-controller;
+					#gpio-cells = <2>;
+					reg = <0x23>;
+				};
 			};
 		};
 	};
@@ -154,6 +161,30 @@ 
 			gpios = <&gpio2 0 1>;    /* GPIO 64 Active Low */
 			linux,default-trigger = "keep";
 		};
+
+		sata1_led {
+			label = "rn104:blue:sata1";
+			gpios = <&pca9554 0 1>;  /* Active Low */
+			default-state = "off";
+		};
+
+		sata2_led {
+			label = "rn104:blue:sata2";
+			gpios = <&pca9554 1 1>;  /* Active Low */
+			default-state = "off";
+		};
+
+		sata3_led {
+			label = "rn104:blue:sata3";
+			gpios = <&pca9554 2 1>;  /* Active Low */
+			default-state = "off";
+		};
+
+		sata4_led {
+			label = "rn104:blue:sata4";
+			gpios = <&pca9554 3 1>;  /* Active Low */
+			default-state = "off";
+		};
 	};
 
 	gpio_keys {