ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Linux下Flash-LED的处理

2021-01-22 08:03:33  阅读:223  来源: 互联网

标签:Flash LED flash strobe Linux device led V4L2


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闪存子设备,接口将重新启用。

 

标签:Flash,LED,flash,strobe,Linux,device,led,V4L2
来源: https://www.cnblogs.com/wujianming-110117/p/14311400.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有