diff mbox

[v2,8/9] ARM: dts: Add leds support to STM32F429 Discovery board

Message ID 1445102604-11502-9-git-send-email-mcoquelin.stm32@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maxime Coquelin Oct. 17, 2015, 5:23 p.m. UTC
Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
---
 arch/arm/boot/dts/stm32f429-disco.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Linus Walleij Oct. 26, 2015, 1:41 p.m. UTC | #1
On Sat, Oct 17, 2015 at 7:23 PM, Maxime Coquelin
<mcoquelin.stm32@gmail.com> wrote:

> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
(...)
> +       leds {
> +               compatible = "gpio-leds";
> +               red {
> +                       gpios = <&gpiog 14 0>;
> +               };
> +               green {
> +                       gpios = <&gpiog 13 0>;
> +               };

I suggest you add labels to these LEDs.

label = "red-LED"
label = "green-LED"

This make things so much easier in sysfs.

Usually people also want to add a default linux,trigger to these,
like linux,default-trigger = "heartbeat"; but whatever you prefer.

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Maxime Coquelin Oct. 27, 2015, 8:31 p.m. UTC | #2
2015-10-26 14:41 GMT+01:00 Linus Walleij <linus.walleij@linaro.org>:
> On Sat, Oct 17, 2015 at 7:23 PM, Maxime Coquelin
> <mcoquelin.stm32@gmail.com> wrote:
>
>> Signed-off-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> (...)
>> +       leds {
>> +               compatible = "gpio-leds";
>> +               red {
>> +                       gpios = <&gpiog 14 0>;
>> +               };
>> +               green {
>> +                       gpios = <&gpiog 13 0>;
>> +               };
>
> I suggest you add labels to these LEDs.
>
> label = "red-LED"
> label = "green-LED"
>
> This make things so much easier in sysfs.

I'm not sure to understand where it makes things easier in sysfs.
This is the sysfs path for the red led:
/sys/class/leds/red/

Indeed, if label is not present, it gets the node name.

>
> Usually people also want to add a default linux,trigger to these,
> like linux,default-trigger = "heartbeat"; but whatever you prefer.

Makes sense, I will add default trigger in next version.

> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Thanks!
Maxime
Andreas Färber Oct. 27, 2015, 9:37 p.m. UTC | #3
Am 27.10.2015 um 21:31 schrieb Maxime Coquelin:
> 2015-10-26 14:41 GMT+01:00 Linus Walleij <linus.walleij@linaro.org>:
>> Usually people also want to add a default linux,trigger to these,
>> like linux,default-trigger = "heartbeat"; but whatever you prefer.
> 
> Makes sense, I will add default trigger in next version.

Previously, consensus seemed to be not to use heartbeat as default, but
rather off or on.

Regards,
Andreas
Linus Walleij Oct. 27, 2015, 9:46 p.m. UTC | #4
On Tue, Oct 27, 2015 at 10:37 PM, Andreas Färber <afaerber@suse.de> wrote:
> Am 27.10.2015 um 21:31 schrieb Maxime Coquelin:
>> 2015-10-26 14:41 GMT+01:00 Linus Walleij <linus.walleij@linaro.org>:
>>> Usually people also want to add a default linux,trigger to these,
>>> like linux,default-trigger = "heartbeat"; but whatever you prefer.
>>
>> Makes sense, I will add default trigger in next version.
>
> Previously, consensus seemed to be not to use heartbeat as default, but
> rather off or on.

Which consensus, where, and for whom?

Heartbeat is awesome.

Yours,
Linus Walleij
Andreas Färber Oct. 27, 2015, 9:52 p.m. UTC | #5
Am 27.10.2015 um 22:46 schrieb Linus Walleij:
> Heartbeat is awesome.

Yes, it's awesome for testing, but not for a .dts file that ends up in a
distro (not the case here, of course) and keeps blinking on the desk.

If someone wants LEDs to blink, they can set that via sysfs or by
modifying their .dts locally.

sunxi chose to keep LEDs off my default. For qcom we had a similar
discussion some weeks ago. I don't regularly read Linux patches, so feel
free to skim the archives yourself.

Cheers,
Andreas
Daniel Thompson Oct. 28, 2015, 8:09 a.m. UTC | #6
On 27/10/15 21:52, Andreas Färber wrote:
> Am 27.10.2015 um 22:46 schrieb Linus Walleij:
>> Heartbeat is awesome.
>
> Yes, it's awesome for testing, but not for a .dts file that ends up in a
> distro (not the case here, of course) and keeps blinking on the desk.
>
> If someone wants LEDs to blink, they can set that via sysfs or by
> modifying their .dts locally.
>
> sunxi chose to keep LEDs off my default. For qcom we had a similar
> discussion some weeks ago. I don't regularly read Linux patches, so feel
> free to skim the archives yourself.

Among the existing DTS files there is pretty significant use of 
heartbeat although its not absolute.

There are 119 files that set a default-trigger, of these 91 (~75%) 
include a line to configure a heartbeat.

Personally I'd be very happy with heartbeat by default on STM32... I've 
seldom worked on a board without a default-enabled heartbeat so they 
make me feel comfortable. ;-)


Daniel.
Maxime Coquelin Oct. 28, 2015, 2:24 p.m. UTC | #7
2015-10-28 9:09 GMT+01:00 Daniel Thompson <daniel.thompson@linaro.org>:
> On 27/10/15 21:52, Andreas Färber wrote:
>>
>> Am 27.10.2015 um 22:46 schrieb Linus Walleij:
>>>
>>> Heartbeat is awesome.
>>
>>
>> Yes, it's awesome for testing, but not for a .dts file that ends up in a
>> distro (not the case here, of course) and keeps blinking on the desk.
>>
>> If someone wants LEDs to blink, they can set that via sysfs or by
>> modifying their .dts locally.
>>
>> sunxi chose to keep LEDs off my default. For qcom we had a similar
>> discussion some weeks ago. I don't regularly read Linux patches, so feel
>> free to skim the archives yourself.
>
>
> Among the existing DTS files there is pretty significant use of heartbeat
> although its not absolute.
>
> There are 119 files that set a default-trigger, of these 91 (~75%) include a
> line to configure a heartbeat.
>
> Personally I'd be very happy with heartbeat by default on STM32... I've
> seldom worked on a board without a default-enabled heartbeat so they make me
> feel comfortable. ;-)

I will add heartbeat in next version, which will arrive when the
pinctrl driver first review is done.

Thanks,
Maxime
diff mbox

Patch

diff --git a/arch/arm/boot/dts/stm32f429-disco.dts b/arch/arm/boot/dts/stm32f429-disco.dts
index e3ce796..532c499 100644
--- a/arch/arm/boot/dts/stm32f429-disco.dts
+++ b/arch/arm/boot/dts/stm32f429-disco.dts
@@ -64,6 +64,16 @@ 
 	aliases {
 		serial0 = &usart1;
 	};
+
+	leds {
+		compatible = "gpio-leds";
+		red {
+			gpios = <&gpiog 14 0>;
+		};
+		green {
+			gpios = <&gpiog 13 0>;
+		};
+	};
 };
 
 &clk_hse {