内核配置中的:Multifunction device drivers


Multifunction Device Drivers(多功能设备Linux下驱动开发)

先来一个英文简介:

Multifunction devices embed several functions (e.g. GPIOs, touchscreens, keyboards, current regulators, power management chips, etc...) in one single integrated circuit. They usually talk to the main CPU through one or more IRQ lines and low speed data busses (SPI, I2C, etc..). They appear as one single device to the main system through the data bus and the MFD framework allows for sub devices (a.k.a. functions) to appear as discrete platform devices. MFDs are typically found on embedded platforms.

Multifunction devices embed several functions (e.g. GPIOs, touchscreens, keyboards, current regulators, power management chips, etc...) in one single integrated circuit. They usually talk to the main CPU through one or more IRQ lines and low speed data busses (SPI, I2C, etc..). They appear as one single device to the main system through the data bus and the MFD framework allows for sub devices (a.k.a. functions) to appear as discrete platform devices. MFDs are typically found on embedded platforms.多功能设备中嵌入了一些功能(如个GPIO,触摸屏,键盘,电流调节器,电源管理芯片等。)在一个单片集成电路。他们通常会谈论到主CPU通过一个或多个的IRQ线和低速数据总线(SPI,I2C,等等)。它们显示为一个单一的设备,主系统通过数据总线,和MFD框架允许出现的独立平台设备的子设备(又名功能)。通常只有在嵌入式平台上的MFD。

====================================================================================================================================

英文简介转自:http://blog.micro-studios.com/?p=309

精简Android-kernel时出查找:

知其功能,但仍不知如何取舍。。。


STMicroelectronics STM32F1 Series Device Support, Drivers and Examples Version: 2.1.0 Keil.STM32F1xx_DFP.2.1.0.pack Updated CMSIS drivers: EMAC: Improved robustness by function checking that driver is powered (EMAC_FLAG_POWER) CAN: Corrected functionality when only one CAN controller is used Corrected pin remap configuration for CAN2 port pins Corrected functionality when NULL pointer is provided for one or both signal callbacks in Initialize function USB Device: Corrected Isochronous transfer Corrected IN Endpoint FIFO flush procedure USB Host: Removed interrupt priority handling Corrected multiple packet sending Corrected PowerControl function for unconditional Power Off USART: Corrected Peripheral Reset and Clock enable/disable (check if peripheral is available on selected device) Corrected CTS handling and added signal CTS change event. SPI: Corrected Peripheral Reset and Clock enable/disable (check if peripheral is available on selected device) Corrected Bus Speed configuration Corrected 8bit/16bit Data register access, regarding the Data frame size -I2C: Corrected invalid __I2C_DMA field in I2C_DMA_TxEvent and I2C_DMA_RxEvent functions Updated/added examples: Added examples using Network DualStack (IPv4/IPv6) Middleware targeting MCBSTM32C (Keil.MDK-Middleware.7.0.0.pack required) Updated emWin examples to emWin V5.32 Updated CAN examples Updated USB Host examples Updated USB Device CDC ACM VirtualCOM examples Updated RTE_Device.h: Corrected USART Pin configuration Added trace configuration to the debug description and updated Quick Start Guide
<think>嗯,用户的问题是关于如何将RK3588设备的USB默认模式从ADB切换到UVC模式。首先,我需要回顾一下之前的相关引用内容,看看有没有可用的信息。引用中提到ADB是Android调试工具,RK平台的Linux系统支持ADB,而UAC和UVC可能需要配置内核和设备树。比如引用[4]提到在kernel config中添加CONFIG_USB_CONFIGFS_F_UAC1=y来开启UAC1驱动,这可能与配置USB功能有关。不过UVC可能需要不同的内核配置,比如CONFIG_USB_CONFIGFS_F_UVC。 接下来,用户的需求是切换模式,这通常涉及到修改设备树(dts)或内核配置,以及功能配置。可能需要修改设备树中的USB控制器设置,或者调整USB gadget的配置。例如,引用[1]中修改了uart8的pinctrl,可能类似的节点需要调整。另外,引用[3]提到external_camera_config.xml文件配置USB摄像头分辨率和缓冲区,这可能与UVC有关,但用户的问题更偏向底层模式切换,而不是应用层配置。 步骤可能包括:1. 确保内核支持UVC gadget,编译配置相关选项;2. 修改设备树的USB节点,设置正确的模式和功能;3. 调整功能配置脚本,加载UVC模块并禁用ADB;4. 更新固件并测试。可能需要参考RK3588的官方文档,确认UVC驱动的支持情况,以及如何配置复合设备。同时要注意ADB和UVC是否可以同时使用,或者需要完全禁用ADB。 用户可能需要具体的内核配置选项,比如CONFIG_USB_CONFIGFS_F_UVC是否启用,设备树中USB控制器的状态是否为"okay",以及如何编写功能配置脚本。此外,引用[4]提到UAC和ADB复合使用,可能需要类似的复合配置方法,但改为UVC和ADB或其他组合。需要检查是否有冲突,确保驱动兼容。最后,测试时可能需要连接PC查看设备是否被识别为摄像头,并使用工具验证UVC功能是否正常。</think>### RK3588 USB模式切换至UVC的实现方法 #### 一、核心配置原理 RK3588的USB模式切换需要修改内核配置、设备树定义和功能复合配置三个层面。ADB和UVC同属USB Gadget功能子系统,通过配置`configfs`实现功能切换[^4]。 #### 二、具体操作步骤 1. **内核配置验证** ```bash # 确认内核配置包含以下关键选项 CONFIG_USB_CONFIGFS=y CONFIG_USB_CONFIGFS_F_UVC=y # UVC功能支持 CONFIG_USB_CONFIGFS_F_FS=y # ADB功能支持 ``` 可通过`make menuconfig`路径检查: `Device Drivers -> USB support -> USB Gadget -> USB functions configurable through configfs` 2. **设备树调整** 在设备树文件中确认USB控制器状态: ```dts &usbdrd_dwc3_0 { status = "okay"; dr_mode = "peripheral"; // 必须设为设备模式 }; ``` 参考引用[1]中的UART配置模式,类似需要确保PHY正常工作。 3. **功能配置脚本** 创建`/usr/bin/uvc-gadget.sh`: ```bash #!/bin/bash modprobe libcomposite cd /sys/kernel/config/usb_gadget/ mkdir -p uvc_gadget && cd uvc_gadget # 定义基础参数 echo 0x1d6b > idVendor # Linux Foundation echo 0x0104 > idProduct # Multifunction Composite echo 0x0100 > bcdDevice # 创建功能关联 mkdir -p functions/uvc.usb0 # UVC功能 mkdir -p functions/ffs.adb # ADB功能(可选保留) # 配置UVC参数(分辨率/格式) echo 3072 > functions/uvc.usb0/streaming_maxpacket mkdir -p functions/uvc.usb0/streaming/uncompressed/u/720p echo 1280 > functions/uvc.usb0/streaming/uncompressed/u/720p/wWidth echo 720 > functions/uvc.usb0/streaming/uncompressed/u/720p/wHeight # 绑定功能到配置 mkdir -p configs/c.1 ln -s functions/uvc.usb0 configs/c.1/ # 若需保留ADB复合功能,参考引用[4]添加: # ln -s functions/ffs.adb configs/c.1/ # 启用设备 echo <udc控制器> > UDC # 如fe800000.dwc3 ``` 注意替换实际UDC控制器名称,可通过`ls /sys/class/udc/`查询 4. **固件更新与验证** ```bash # 烧写新固件后执行 chmod +x /usr/bin/uvc-gadget.sh systemctl disable adbd # 禁用ADB服务 reboot ``` #### 三、关键验证方法 1. Windows设备管理器应识别为"USB Video Device" 2. 使用`guvcview`或`ffmpeg`测试视频流: ```bash ffmpeg -f v4l2 -input_format mjpeg -i /dev/video0 test.mp4 ``` 3. 通过`dmesg | grep UVC`查看内核日志确认驱动加载
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

袁保康

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值