Skip to contentSkip to conversation

media: Add registration helpers for V4L2 flash sub-devices

PATCH Superseded Jacek Anaszewski 1 participant 1 message Apr 30, 2015

Subsystems (2)

v7 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

PATCH v7 1/1 media: Add registration helpers for V4L2 flash sub-devices

This patch adds helper functions for registering/unregistering LED Flash class devices as V4L2 sub-devices. The functions should be called from the LED subsystem device driver. In case the support for V4L2 Flash sub-devices is disabled in the kernel config the functions' empty versions will be used.

---
- moved enum ctrl_init_data_id definition from *.c to *.h file and switched to allocating the memory for ctrls property of struct v4l2_flash dynamically
- set V4L2_CTRL_FLAG_EXECUTE_ON_WRITE flag for the writable volatile controls to meet the requirements introduced by the recent modifications in v42l-ctrl.c

 drivers/media/v4l2-core/Kconfig                |   11 +
 drivers/media/v4l2-core/Makefile               |    2 +
 drivers/media/v4l2-core/v4l2-flash-led-class.c |  653 ++++++++++++++++++++++++
 include/media/v4l2-flash-led-class.h           |  127 +++++
 4 files changed, 793 insertions(+)
 create mode 100644 drivers/media/v4l2-core/v4l2-flash-led-class.c
 create mode 100644 include/media/v4l2-flash-led-class.h
drivers/media/v4l2-core/Kconfig +11 -0
index ba7e21a..c505dc3 100644
@@ -44,6 +44,17 @@ config V4L2_MEM2MEM_DEV
         tristate
         depends on VIDEOBUF2_CORE
 
+# Used by LED subsystem flash drivers
+config V4L2_FLASH_LED_CLASS
+	tristate "V4L2 flash API for LED flash class devices"
+	depends on VIDEO_V4L2_SUBDEV_API
+	depends on LEDS_CLASS_FLASH
+	---help---
+	  Say Y here to enable V4L2 flash API support for LED flash
+	  class drivers.
+
+	  When in doubt, say N.
+
 # Used by drivers that need Videobuf modules
 config VIDEOBUF_GEN
 	tristate
drivers/media/v4l2-core/Makefile +2 -0
index 63d29f2..dc3de00 100644
@@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o
 
 obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o
 
+obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash-led-class.o
+
 obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
 obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
 obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
drivers/media/v4l2-core/v4l2-flash-led-class.c new file +653 -0

653 lines not on this page · raw message

include/media/v4l2-flash-led-class.h new file +127 -0

127 lines not on this page · raw message

Signature · 1 line
1.7.9.5