zoukankan      html  css  js  c++  java
  • Linux下Flash-LED的处理

    Linux下Flash-LED的处理

    一些LED设备提供两种模式-torch和flash。在LED子系统中,LED类(参见Linux下的LED处理)和LED Flash类,分别支持这些模式。torch模式相关的功能在默认情况下启用,只有当驱动程序通过设置LED_DEV_CAP_flash标志来声明时,才会启用flash功能。

    为了启用对flash led的支持,必须在内核配置中定义flash LEDs CONFIG_LEDS_CLASS_FLASH符号。必须在具有led_classdev_flash_register功能的LED子系统中注册LED flash类驱动程序。

    以下sysfs属性用于控制flash LED设备:

     (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子系统驱动器,可以从VideoForLinux2子系统level进行控制。为了启用此配置,需要在内核配置中定义CONFIG_V4L2_FLASH_LED_CLASS类符号。

    驱动程序必须调用v4l2_flash_init函数才能在v4l2子系统中注册。函数有六个参数:

    • 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关联LED flash设备可能为空NULL

    • ops:

    V4L2 specific ops

    • external_strobe_set

    定义flash LED strobe的源source - V4L2_CID_FLASH_STROBE control or external source,通常是一个传感器,使flash strobe开始与曝光开始同步成为可能。

    • 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

    • dev_name

    the name of the media entity, unique in the system,

    • 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>,

    • torch_intensity

    constraints for the LED in TORCH mode in microamperes,

    • indicator_intensity

    constraints for the indicator LED in microamperes,

    • has_external_strobe

    determines whether the flash strobe source can be switched to external,

    在remove时,必须调用v4l2_flash_release函数,该函数接受一个参数v4l2_flash_init先前返回的- struct v4l2_flash指针。可使用NULL或error指针参数,安全地调用此函数。

    请参阅drivers/leds/leds-max77693.c,了解v4l2闪存包装器的示例性用法。

    一旦创建媒体控制器设备的驱动程序,注册了V4L2子设备,子设备节点的作用就像本机V4L2 flash API设备的节点一样。调用被简单地路由到LED flash API。

    打开V4L2 flash子设备,使LED子系统sysfs接口不可用。关闭V4L2闪存子设备,接口将重新启用。

    人工智能芯片与自动驾驶
  • 相关阅读:
    C++ Programming with TDD之一:GMOCK框架简介
    Linux Programming之MySQL
    Python之自动单元测试之一(unittest使用实例)
    关于过去的这一个月——面试经历
    谈谈Python中对象拷贝
    C++之Effective STL学习笔记Item21
    C++之Effective STL学习笔记Item7
    C++之Effective STL学习笔记Item20
    C++之Effective STL学习笔记Item14
    Coding Rules
  • 原文地址:https://www.cnblogs.com/wujianming-110117/p/14311400.html
Copyright © 2011-2022 走看看