LED / flash API integration - Flash Manager
Subsystems (4)
v5 cover LED / flash API integration - Flash Manager
This patch set is the follow-up of the LED / flash API integration series [1]. For clarity reasons the patchset has been split into five subsets:
- LED Flash Class
- Flash Manager
- V4L2 Flash
- LED Flash Class drivers
- Documentation
The series is based on linux-next-20140820.
Thanks,
Jacek Anaszewski
[1] https://lkml.org/lkml/2014/7/11/914
Jacek Anaszewski (2):
of: add of_node_ncmp wrapper
leds: Add Flash Manager functionality
arch/sparc/include/asm/prom.h | 1 + drivers/leds/Kconfig | 11 + drivers/leds/Makefile | 4 + drivers/leds/led-class-flash.c | 19 ++ drivers/leds/led-flash-gpio-mux.c | 102 ++++++ drivers/leds/led-flash-manager.c | 590 ++++++++++++++++++++++++++++++++++ drivers/leds/of_led_flash_manager.c | 155 +++++++++ include/linux/led-flash-gpio-mux.h | 68 ++++ include/linux/led-flash-manager.h | 146 +++++++++ include/linux/leds.h | 1 + include/linux/of.h | 1 + include/linux/of_led_flash_manager.h | 80 +++++ 12 files changed, 1178 insertions(+) create mode 100644 drivers/leds/led-flash-gpio-mux.c create mode 100644 drivers/leds/led-flash-manager.c create mode 100644 drivers/leds/of_led_flash_manager.c create mode 100644 include/linux/led-flash-gpio-mux.h create mode 100644 include/linux/led-flash-manager.h create mode 100644 include/linux/of_led_flash_manager.h
Signature · 1 line
1.7.9.5
PATCH v5 1/2 of: add of_node_ncmp wrapper
The wrapper for strnicmp is required for checking whether a node has expected prefix.
--- arch/sparc/include/asm/prom.h | 1 + include/linux/of.h | 1 + 2 files changed, 2 insertions(+)
arch/sparc/include/asm/prom.h +1 -0
@@ -30,6 +30,7 @@#define of_compat_cmp (s1, s2, l) strncmp((s1), (s2), (l))#define of_prop_cmp (s1, s2) strcasecmp((s1), (s2))#define of_node_cmp (s1, s2) strcmp((s1), (s2)) +#define of_node_ncmp (s1, s2, n) strnicmp((s1), (s2), (n))struct of_irq_controller {unsigned int (*irq_build)(struct device_node *,unsigned int ,void *);
include/linux/of.h +1 -0
@@ -197,6 +197,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)#define of_compat_cmp (s1, s2, l) strcasecmp((s1), (s2))#define of_prop_cmp (s1, s2) strcmp((s1), (s2))#define of_node_cmp (s1, s2) strcasecmp((s1), (s2)) +#define of_node_ncmp (s1, s2, n) strnicmp((s1), (s2), (n))#endif /* flag descriptions */
Signature · 1 line
1.7.9.5
PATCH v5 2/2 leds: Add Flash Manager functionality
In reply to Jacek AnaszewskiThis patch adds Flash Manager functionality to the LED Flash Class. It allows for changing flash - strobe provider connections dynamically, if the flash led device has its external strobe signal routed through multiplexer(s). This is an optional feature.
Available strobe signal providers are listed in the form of strobe_providerN sysfs attributes. If more than one strobe provider is available then a strobe_provider sysfs attribute shall be used for carrying information about the identifier of the currently selected one.
--- drivers/leds/Kconfig | 11 + drivers/leds/Makefile | 4 + drivers/leds/led-class-flash.c | 19 ++ drivers/leds/led-flash-gpio-mux.c | 102 ++++++ drivers/leds/led-flash-manager.c | 590 ++++++++++++++++++++++++++++++++++ drivers/leds/of_led_flash_manager.c | 155 +++++++++ include/linux/led-flash-gpio-mux.h | 68 ++++ include/linux/led-flash-manager.h | 146 +++++++++ include/linux/leds.h | 1 + include/linux/of_led_flash_manager.h | 80 +++++ 10 files changed, 1176 insertions(+) create mode 100644 drivers/leds/led-flash-gpio-mux.c create mode 100644 drivers/leds/led-flash-manager.c create mode 100644 drivers/leds/of_led_flash_manager.c create mode 100644 include/linux/led-flash-gpio-mux.h create mode 100644 include/linux/led-flash-manager.h create mode 100644 include/linux/of_led_flash_manager.h
drivers/leds/Kconfig +11 -0
@@ -30,6 +30,17 @@ config LEDS_CLASS_FLASH for the flash related features of a LED device. It can be built as a module. +config LEDS_FLASH_MANAGER + bool "LED Flash Manager Support" + depends on LEDS_CLASS_FLASH + depends on OF + help + This option enables the Flash Manager functionality for the + LED Flash Class. It allows for chaning the flash - strobe provider + connections dynamically. You'll need this only if any of the flash + led devices on the board has its external strobe signal routed + through multiplexer(s). + comment "LED drivers" config LEDS_88PM860X
drivers/leds/Makefile +4 -0
@@ -3,6 +3,10 @@ obj-$(CONFIG_NEW_LEDS) += led-core.o obj-$(CONFIG_LEDS_CLASS) += led-class.o obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o +obj-$(CONFIG_LEDS_FLASH_MANAGER) += led-fm.o +led-fm-objs := led-flash-manager.o \ + led-flash-gpio-mux.o \ + of_led_flash_manager.o obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o # LED Platform Drivers
drivers/leds/led-class-flash.c +19 -0
@@ -13,6 +13,7 @@#include <linux/init.h> #include <linux/leds.h> #include <linux/led-class-flash.h> +#include <linux/led-flash-manager.h> #include <linux/module.h> #include <linux/slab.h> #include "leds.h"
@@ -468,6 +469,13 @@ int led_classdev_flash_register(struct device *parent,if (ret <0 )return -EINVAL ; +/* Register in the flash manager if there is related data to parse */ +if (node) { + ret =led_flash_manager_register_flash (flash, node); +if (ret <0 ) + goto err_flash_manager_register; + } +/* Create flash led specific sysfs attributes */ ret =led_flash_create_sysfs_groups (flash);if (ret <0 )
@@ -476,6 +484,8 @@ int led_classdev_flash_register(struct device *parent,return 0 ; err_create_sysfs_groups: +led_flash_manager_unregister_flash (flash); +err_flash_manager_register:led_classdev_unregister (led_cdev);return ret;
@@ -488,6 +498,7 @@ void led_classdev_flash_unregister(struct led_classdev_flash *flash)return ;led_flash_remove_sysfs_groups (flash); +led_flash_manager_unregister_flash (flash);led_classdev_unregister (&flash->led_cdev); }EXPORT_SYMBOL_GPL (led_classdev_flash_unregister);
@@ -542,6 +553,7 @@ EXPORT_SYMBOL_GPL(led_get_flash_fault);int led_set_external_strobe (struct led_classdev_flash *flash,bool enable) { +struct led_classdev *led_cdev = &flash->led_cdev;int ret;if (flash->has_external_strobe) {
@@ -556,6 +568,13 @@ int led_set_external_strobe(struct led_classdev_flash *flash, bool enable) } flash->external_strobe = enable; + +if (led_cdev->flags &LED_DEV_CAP_FL_MANAGER ) { + ret =led_flash_manager_set_external_strobe (flash, + enable); +if (ret <0 ) +return ret; + } }else if (enable) {return -EINVAL ; }
drivers/leds/led-flash-gpio-mux.c new file +102 -0
102 lines not on this page · raw message
drivers/leds/led-flash-manager.c new file +590 -0
590 lines not on this page · raw message
drivers/leds/of_led_flash_manager.c new file +155 -0
155 lines not on this page · raw message
include/linux/led-flash-gpio-mux.h new file +68 -0
68 lines not on this page · raw message
include/linux/led-flash-manager.h new file +146 -0
146 lines not on this page · raw message
include/linux/leds.h +1 -0
@@ -46,6 +46,7 @@ struct led_classdev {#define LED_DEV_CAP_TORCH (1 << 21)#define LED_DEV_CAP_FLASH (1 << 22)#define LED_DEV_CAP_INDICATOR (1 << 23) +#define LED_DEV_CAP_FL_MANAGER (1 << 24)/* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */
include/linux/of_led_flash_manager.h new file +80 -0
80 lines not on this page · raw message
Signature · 1 line
1.7.9.5