Linux下Flash-LED的处理
Linux下Flash-LED的處理
一些LED設(shè)備提供兩種模式-torch和flash。在LED子系統(tǒng)中,LED類(lèi)(參見(jiàn)Linux下的LED處理)和LED Flash類(lèi),分別支持這些模式。torch模式相關(guān)的功能在默認(rèn)情況下啟用,只有當(dāng)驅(qū)動(dòng)程序通過(guò)設(shè)置LED_DEV_CAP_flash標(biāo)志來(lái)聲明時(shí),才會(huì)啟用flash功能。
為了啟用對(duì)flash led的支持,必須在內(nèi)核配置中定義flash LEDs CONFIG_LEDS_CLASS_FLASH符號(hào)。必須在具有l(wèi)ed_classdev_flash_register功能的LED子系統(tǒng)中注冊(cè)LED flash類(lèi)驅(qū)動(dòng)程序。
以下sysfs屬性用于控制flash LED設(shè)備:
(see Documentation/ABI/testing/sysfs-class-led-flash)
? flash_brightness
? max_flash_brightness
? flash_timeout
? max_flash_timeout
? flash_strobe
? flash_fault
V4L2 flash wrapper for flash LEDs
LED子系統(tǒng)驅(qū)動(dòng)器,可以從VideoForLinux2子系統(tǒng)level進(jìn)行控制。為了啟用此配置,需要在內(nèi)核配置中定義CONFIG_V4L2_FLASH_LED_CLASS類(lèi)符號(hào)。
驅(qū)動(dòng)程序必須調(diào)用v4l2_flash_init函數(shù)才能在v4l2子系統(tǒng)中注冊(cè)。函數(shù)有六個(gè)參數(shù):
? dev:
flash device, e.g. an I2C device
? of_node:
of_node of the LED, may be NULL if the same as device’s
? fled_cdev:
LED flash class device to wrap
? iled_cdev:
表示與fled_cdev關(guān)聯(lián)LED flash設(shè)備可能為空NULL
? ops:
V4L2 specific ops
o external_strobe_set
定義flash LED strobe的源source - V4L2_CID_FLASH_STROBE control or external source,通常是一個(gè)傳感器,使flash strobe開(kāi)始與曝光開(kāi)始同步成為可能。
o intensity_to_led_brightness and led_brightness_to_intensity
perform enum led_brightness <-> V4L2 intensity conversion in a device specific manner - they can be used for devices with non-linear LED current scale.
? config:
configuration for V4L2 Flash sub-device
o dev_name
the name of the media entity, unique in the system,
o flash_faults
bitmask of flash faults that the LED flash class device can report; corresponding LED_FAULT* bit definitions are available in <linux/led-class-flash.h>,
o torch_intensity
constraints for the LED in TORCH mode in microamperes,
o indicator_intensity
constraints for the indicator LED in microamperes,
o has_external_strobe
determines whether the flash strobe source can be switched to external,
在remove時(shí),必須調(diào)用v4l2_flash_release函數(shù),該函數(shù)接受一個(gè)參數(shù)v4l2_flash_init先前返回的- struct v4l2_flash指針。可使用NULL或error指針參數(shù),安全地調(diào)用此函數(shù)。
請(qǐng)參閱drivers/leds/leds-max77693.c,了解v4l2閃存包裝器的示例性用法。
一旦創(chuàng)建媒體控制器設(shè)備的驅(qū)動(dòng)程序,注冊(cè)了V4L2子設(shè)備,子設(shè)備節(jié)點(diǎn)的作用就像本機(jī)V4L2 flash API設(shè)備的節(jié)點(diǎn)一樣。調(diào)用被簡(jiǎn)單地路由到LED flash API。
打開(kāi)V4L2 flash子設(shè)備,使LED子系統(tǒng)sysfs接口不可用。關(guān)閉V4L2閃存子設(shè)備,接口將重新啟用。
總結(jié)
以上是生活随笔為你收集整理的Linux下Flash-LED的处理的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 视频处理单元Video Processi
- 下一篇: ONNX 实时graph优化方法