Commit Graph

13 Commits

Author SHA1 Message Date
Stefan Roese
a8eeaf2f7a cmd_led: Extend led command to support blinking and more leds
This patch extends the U-Boot "led" command to support automatic blinking
by setting a blink frequency in milliseconds. Additionally the number of
supported LEDs is increased to 6 (0...5).

This will be used by the PCA9551 LED driver.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
2015-04-23 09:43:08 -04:00
Wolfgang Denk
3765b3e7bd Coding Style cleanup: remove trailing white space
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:53 -04:00
Wolfgang Denk
1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Otavio Salvador
af73034c6b led: Use STATUS_LED_ON and STATUS_LED_OFF when calling __led_set
This fixes the gpio_led driver which needs to compare againt a
STATUS_LED_ON to enable a led.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2013-03-07 17:22:57 +01:00
Robert P. J. Day
d4b901dd73 cmd_led.c: Standardize format of help and usage info.
Current "led" help and usage info has redundancy and extraneous
newlines, tweak it to be consistent with other commands.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
2012-12-06 13:56:39 -07:00
Simon Glass
4c12eeb8b5 Convert cmd_usage() calls in common to use a return value
Change all files in common/ to use CMD_RET_USAGE instead of calling
cmd_usage() directly. I'm not completely sure about this patch since
the code since impact is small (100 byte or so on ARM) and it might
need splitting into smaller patches. But for now here it is.

Signed-off-by: Simon Glass <sjg@chromium.org>
2012-03-06 21:09:46 +01:00
Jason Kridner
2d3be7c456 led: remove camel casing of led identifiers globally
Result of running the following command to address Wolfgang's
comment about camel case:

for file in `find . | grep '\.[chS]$'`; do perl -i -pe
's/(green|yellow|red|blue)_LED_(on|off)/$1_led_$2/g' $file; done

Discussion:
http://patchwork.ozlabs.org/patch/84988/

Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2011-09-13 08:30:52 +02:00
Joel A Fernandes
b8bc8973a1 led: Remove state-saving of led for toggle functionality and add toggle option to led command
* Read the led output state from GPIO instead saving state in memory when it is [re]set
* Added a toggle option to the led command

Previous discussion:
http://lists.denx.de/pipermail/u-boot/2011-May/093068.html

Changes since v1:
Fixed checkpatch errors

Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com>
Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2011-09-04 11:36:22 +02:00
Joel A Fernandes
d604cda34a led: Fixed setting of STATUS_LED_BIT1 when led_name is 'all'
Fix for only one led getting set or reset when the led_name is 'all'

Previous discussion:
http://lists.denx.de/pipermail/u-boot/2011-May/093068.html

Changes since v1:
Fixed checkpatch if statement error noticed by Sergei.

Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com>
Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2011-09-04 11:36:22 +02:00
Jason Kridner
4086b51cb7 led: correct off/on locations in structure
Although the initialization should probably be done with names, the
existing implementation has these structures filled in the opposite
order.

Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2011-09-04 11:36:22 +02:00
Jason Kridner
95492d784b Corrected LED name match finding avoiding extraneous Usage printouts
Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2011-09-04 11:36:21 +02:00
Wolfgang Denk
cd6881b519 Minor coding style cleanup.
Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-05-19 22:22:44 +02:00
Jason Kridner
b633f66f02 Add 'led' command
This patch allows any board implementing the coloured LED API
to control the LEDs from the console.

led [green | yellow | red | all ]  [ on | off ]

or

led [ 1 | 2 | 3 | all ]  [ on | off ]

Adds configuration item CONFIG_CMD_LED enabling the command.

Partially based on patch from Ulf Samuelsson:
http://www.mail-archive.com/u-boot@lists.denx.de/msg09593.html.

Updated based on feedback:
http://www.mail-archive.com/u-boot@lists.denx.de/msg41847.html
https://groups.google.com/d/topic/beagleboard/8Wf1HiK_QBo/discussion
* Fixed a handful of style issues.
* Significantly reduced the number of #ifdefs and redundant code
* Converted redundant code into loops test against a structure
* Made use of cmd_usage()
* Introduced a str_onoff() function, but haven't yet put it in common
* Eliminated trailing newline

Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2011-04-27 19:38:05 +02:00