Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) ==============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) Flash LED handling under Linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) ==============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) Some LED devices provide two modes - torch and flash. In the LED subsystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) those modes are supported by LED class (see Documentation/leds/leds-class.rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) and LED Flash class respectively. The torch mode related features are enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) by default and the flash ones only if a driver declares it by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) LED_DEV_CAP_FLASH flag.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) In order to enable the support for flash LEDs CONFIG_LEDS_CLASS_FLASH symbol
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) must be defined in the kernel config. A LED Flash class driver must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) registered in the LED subsystem with led_classdev_flash_register function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Following sysfs attributes are exposed for controlling flash LED devices:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) (see Documentation/ABI/testing/sysfs-class-led-flash)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	- flash_brightness
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	- max_flash_brightness
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	- flash_timeout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	- max_flash_timeout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	- flash_strobe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	- flash_fault
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) V4L2 flash wrapper for flash LEDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) =================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) A LED subsystem driver can be controlled also from the level of VideoForLinux2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) subsystem. In order to enable this CONFIG_V4L2_FLASH_LED_CLASS symbol has to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) be defined in the kernel config.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) The driver must call the v4l2_flash_init function to get registered in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) V4L2 subsystem. The function takes six arguments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) - dev:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	flash device, e.g. an I2C device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) - of_node:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	of_node of the LED, may be NULL if the same as device's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) - fled_cdev:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	LED flash class device to wrap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) - iled_cdev:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	LED flash class device representing indicator LED associated with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	fled_cdev, may be NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) - ops:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	V4L2 specific ops
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	* external_strobe_set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 		defines the source of the flash LED strobe -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		V4L2_CID_FLASH_STROBE control or external source, typically
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 		a sensor, which makes it possible to synchronise the flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 		strobe start with exposure start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	* intensity_to_led_brightness and led_brightness_to_intensity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 		perform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		enum led_brightness <-> V4L2 intensity conversion in a device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 		specific manner - they can be used for devices with non-linear
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		LED current scale.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) - config:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	configuration for V4L2 Flash sub-device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	* dev_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 		the name of the media entity, unique in the system,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	* flash_faults
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 		bitmask of flash faults that the LED flash class
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 		device can report; corresponding LED_FAULT* bit definitions are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 		available in <linux/led-class-flash.h>,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	* torch_intensity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 		constraints for the LED in TORCH mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 		in microamperes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	* indicator_intensity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 		constraints for the indicator LED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 		in microamperes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	* has_external_strobe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 		determines whether the flash strobe source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 		can be switched to external,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) On remove the v4l2_flash_release function has to be called, which takes one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) argument - struct v4l2_flash pointer returned previously by v4l2_flash_init.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) This function can be safely called with NULL or error pointer argument.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) Please refer to drivers/leds/leds-max77693.c for an exemplary usage of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) v4l2 flash wrapper.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) Once the V4L2 sub-device is registered by the driver which created the Media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) controller device, the sub-device node acts just as a node of a native V4L2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) flash API device would. The calls are simply routed to the LED flash API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) Opening the V4L2 flash sub-device makes the LED subsystem sysfs interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) unavailable. The interface is re-enabled after the V4L2 flash sub-device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) is closed.