Re: [PATCH v2 1/2] serial: add LED trigger support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 05, 2016 at 04:55:24PM +0200, Tobias Doerffel wrote:
> Add initial LED trigger support for serial ports by providing a simple
> API for registering/unregistering RX/TX/RXTX LED triggers for a serial
> port as well as actually triggering LEDs.
> 
> UART drivers simply need to call uart_led_event() in their respective
> receive and transmit routines to support the LED triggers.
> 
> Signed-off-by: Tobias Doerffel <tobias.doerffel@xxxxxxxxxxxxxx>
> ---
>  MAINTAINERS                      |  2 ++
>  drivers/tty/serial/Kconfig       | 12 +++++++
>  drivers/tty/serial/Makefile      |  1 +
>  drivers/tty/serial/serial_leds.c | 67 ++++++++++++++++++++++++++++++++++++++++
>  include/linux/serial_core.h      | 13 ++++++++
>  include/linux/serial_leds.h      | 41 ++++++++++++++++++++++++
>  6 files changed, 136 insertions(+)
>  create mode 100644 drivers/tty/serial/serial_leds.c
>  create mode 100644 include/linux/serial_leds.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index ab65bbe..e36d69c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10905,7 +10905,9 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
>  F:	Documentation/serial/
>  F:	drivers/tty/
>  F:	drivers/tty/serial/serial_core.c
> +F:	drivers/tty/serial/serial_leds.c
>  F:	include/linux/serial_core.h
> +F:	include/linux/serial_leds.h
>  F:	include/linux/serial.h
>  F:	include/linux/tty.h
>  F:	include/uapi/linux/serial_core.h
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index f38beb2..b178ac8 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -787,6 +787,18 @@ config SERIAL_CORE
>  config SERIAL_CORE_CONSOLE
>  	bool
>  
> +config SERIAL_LEDS
> +	bool "Enable LED triggers for serial ports"
> +	depends on LEDS_CLASS
> +	select LEDS_TRIGGERS
> +	---help---
> +	  This option adds LED triggers for receiving and transmitting data
> +	  from/to serial ports. Please note that not all drivers take
> +	  advantage of this feature yet.
> +
> +	  Say Y here if you are working on a system with led-class supported
> +	  LEDs and you want to use them as serial port activity indicators.
> +
>  config CONSOLE_POLL
>  	bool
>  
> diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile
> index 5ab4111..e85b473 100644
> --- a/drivers/tty/serial/Makefile
> +++ b/drivers/tty/serial/Makefile
> @@ -3,6 +3,7 @@
>  #
>  
>  obj-$(CONFIG_SERIAL_CORE) += serial_core.o
> +obj-$(CONFIG_SERIAL_LEDS) += serial_leds.o
>  obj-$(CONFIG_SERIAL_21285) += 21285.o
>  
>  obj-$(CONFIG_SERIAL_EARLYCON) += earlycon.o
> diff --git a/drivers/tty/serial/serial_leds.c b/drivers/tty/serial/serial_leds.c
> new file mode 100644
> index 0000000..84c8d9c
> --- /dev/null
> +++ b/drivers/tty/serial/serial_leds.c
> @@ -0,0 +1,67 @@
> +/*
> + * Copyright 2016, Tobias Doerffel <tobias.doerffel@xxxxxxxxxxxxxx>
> + *
> + * This program is free software; you uart redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/leds.h>
> +#include <linux/serial_leds.h>
> +
> +static unsigned long led_delay = 50;
> +module_param(led_delay, ulong, 0644);
> +MODULE_PARM_DESC(led_delay,
> +		"blink delay time for activity leds (msecs, default: 50).");

No, no module parameter, sorry, that will not work for multiple led
devices.

This isn't the 1990's anymore :)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux