Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1445169
| From | Peter Chen <hzpeterchen@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V2] leds: trigger: Introduce an USB port trigger |
| Date | 2016-07-18 04:40 +0200 |
| Message-ID | <rW6Dn-jV-11@gated-at.bofh.it> (permalink) |
| References | <rTIvv-6WO-1@gated-at.bofh.it> <rViGB-3uN-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Jul 15, 2016 at 11:10:45PM +0200, Rafał Miłecki wrote:
> +
> +usbport trigger:
> +- usb-ports : List of USB ports that usbport should observed for turning on a
> + given LED.
> +
%s/should/should be
> Examples:
>
> system-status {
> @@ -58,6 +64,11 @@ system-status {
> ...
> };
>
> +usb {
> + label = "USB";
> + usb-ports = <&ohci_port1>, <&ehci_port1>;
> +};
> +
> camera-flash {
> label = "Flash";
> led-sources = <0>, <1>;
> diff --git a/Documentation/leds/ledtrig-usbport.txt b/Documentation/leds/ledtrig-usbport.txt
> new file mode 100644
> index 0000000..642c4cd
> --- /dev/null
> +++ b/Documentation/leds/ledtrig-usbport.txt
> @@ -0,0 +1,19 @@
> +USB port LED trigger
> +====================
> +
> +This LED trigger can be used for signaling user a presence of USB device in a
> +given port. It simply turns on LED when device appears and turns it off when it
> +disappears.
> +
> +It requires specifying a list of USB ports that should be observed. This can be
> +done in DT by setting a proper property with list of a phandles. If more than
> +one port is specified, LED will be turned on as along as there is at least one
> +device connected to any of ports.
> +
> +This trigger can be activated from user space on led class devices as shown
> +below:
> +
> + echo usbport > trigger
> +
> +Nevertheless, current there isn't a way to specify list of USB ports from user
> +space.
> diff --git a/drivers/leds/trigger/Kconfig b/drivers/leds/trigger/Kconfig
> index 9893d91..5b8e7c7 100644
> --- a/drivers/leds/trigger/Kconfig
> +++ b/drivers/leds/trigger/Kconfig
> @@ -126,4 +126,12 @@ config LEDS_TRIGGER_PANIC
> a different trigger.
> If unsure, say Y.
>
> +config LEDS_TRIGGER_USBPORT
> + tristate "USB port LED trigger"
> + depends on LEDS_TRIGGERS && USB && OF
> + help
> + This allows LEDs to be controlled by USB events. This trigger will
> + enable LED if some USB device gets connected to any of ports specified
> + in DT.
> +
> endif # LEDS_TRIGGERS
> diff --git a/drivers/leds/trigger/Makefile b/drivers/leds/trigger/Makefile
> index 8cc64a4..80e2494 100644
> --- a/drivers/leds/trigger/Makefile
> +++ b/drivers/leds/trigger/Makefile
> @@ -10,3 +10,4 @@ obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
> obj-$(CONFIG_LEDS_TRIGGER_TRANSIENT) += ledtrig-transient.o
> obj-$(CONFIG_LEDS_TRIGGER_CAMERA) += ledtrig-camera.o
> obj-$(CONFIG_LEDS_TRIGGER_PANIC) += ledtrig-panic.o
> +obj-$(CONFIG_LEDS_TRIGGER_USBPORT) += ledtrig-usbport.o
> diff --git a/drivers/leds/trigger/ledtrig-usbport.c b/drivers/leds/trigger/ledtrig-usbport.c
> new file mode 100644
> index 0000000..97b064c
> --- /dev/null
> +++ b/drivers/leds/trigger/ledtrig-usbport.c
> @@ -0,0 +1,206 @@
> +/*
> + * USB port LED trigger
> + *
> + * Copyright (C) 2016 Rafał Miłecki <rafal.milecki@gmail.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or (at
> + * your option) any later version.
> + */
GPL v2 only.
> +MODULE_AUTHOR("Rafał Miłecki <rafal.milecki@gmail.com>");
> +MODULE_DESCRIPTION("USB port trigger");
> +MODULE_LICENSE("GPL");
GPL v2
After you fix above, feel free to add:
Reviewed-by: Peter Chen <peter.chen@nxp.com>
--
Best Regards,
Peter Chen
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-07-11 14:30 +0200
Re: [PATCH] leds: trigger: Introduce an USB port trigger Jacek Anaszewski <j.anaszewski@samsung.com> - 2016-07-13 17:00 +0200
[PATCH V2] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-07-15 23:20 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Peter Chen <hzpeterchen@gmail.com> - 2016-07-18 04:40 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-07-18 06:50 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Peter Chen <hzpeterchen@gmail.com> - 2016-07-18 07:50 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-07-18 08:00 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Peter Chen <hzpeterchen@gmail.com> - 2016-07-18 08:10 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-07-18 09:00 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Pavel Machek <pavel@ucw.cz> - 2016-07-20 10:10 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Pavel Machek <pavel@ucw.cz> - 2016-07-20 10:10 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Rob Herring <robh@kernel.org> - 2016-07-20 03:10 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Rafał Miłecki <zajec5@gmail.com> - 2016-07-20 10:10 +0200
Re: [PATCH V2] leds: trigger: Introduce an USB port trigger Rob Herring <robh@kernel.org> - 2016-07-21 22:50 +0200
csiph-web