千家信息网

Linux DRM的component框架有什么作用

发表于:2025-02-06 作者:千家信息网编辑
千家信息网最后更新 2025年02月06日,这篇文章主要介绍"Linux DRM的component框架有什么作用",在日常操作中,相信很多人在Linux DRM的component框架有什么作用问题上存在疑惑,小编查阅了各式资料,整理出简单好
千家信息网最后更新 2025年02月06日Linux DRM的component框架有什么作用

这篇文章主要介绍"Linux DRM的component框架有什么作用",在日常操作中,相信很多人在Linux DRM的component框架有什么作用问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"Linux DRM的component框架有什么作用"的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

一、component介绍

Linux内核component代码实现文件:drivers/base/component.c

使用git log -p component.c命令,可以查看该文件的第一次提交记录。

commit 2a41e6070dd7ef539d0f3b1652b4839d04378e11Author: Russell King Date:   Fri Jan 10 23:23:37 2014 +0000    drivers/base: provide an infrastructure for componentised subsystems    Subsystems such as ALSA, DRM and others require a single card-level    device structure to represent a subsystem.  However, firmware tends to    describe the individual devices and the connections between them.    Therefore, we need a way to gather up the individual component devices    together, and indicate when we have all the component devices.    We do this in DT by providing a "superdevice" node which specifies    the components, eg:            imx-drm {                    compatible = "fsl,drm";                    crtcs = <&ipu1>;                    connectors = <&hdmi>;            };    The superdevice is declared into the component support, along with the    subcomponents.  The superdevice receives callbacks to locate the    subcomponents, and identify when all components are present.  At this    point, we bind the superdevice, which causes the appropriate subsystem    to be initialised in the conventional way.    When any of the components or superdevice are removed from the system,    we unbind the superdevice, thereby taking the subsystem down.

Linux内核引入component框架的目的:

在DRM、ALSA等子系统中,通过超级设备(superdevice)管理多个组件(component)加载顺序,保证所有组件都可正常使用。

二、超级设备

1.超级设备定义

超级设备也可称为master,一般指某个子系统(如:display-subsystem)。定义文件:rk3399.dtsi,内容如下:

    display_subsystem: display-subsystem {        compatible = "rockchip,display-subsystem";        ports = <&vopl_out>, <&vopb_out>;        clocks = <&cru PLL_VPLL>, <&cru PLL_CPLL>;        clock-names = "hdmi-tmds-pll", "default-vop-pll";        devfreq = <&dmc>;        status = "disabled";    };

2.超级设备加载

超级设备通过component_master_add_with_match()函数进行match注册,实现文件:rockchip_drm_drv.c,内容如下:

static int rockchip_drm_platform_probe(struct platform_device *pdev){    ...    /*     * Bind the crtc ports first, so that     * drm_of_find_possible_crtcs called from encoder .bind callbacks     * works as expected.     */    for (i = 0;; i++) {        ...        port = of_parse_phandle(np, "ports", i);        ...        component_match_add(dev, &match, compare_of, port->parent);  ## 1. Bind CRTC        of_node_put(port);    }    ...    /*     * For each bound crtc, bind the encoders attached to its     * remote endpoint.     */    for (i = 0;; i++) {        port = of_parse_phandle(np, "ports", i);                ...                rockchip_add_endpoints(dev, &match, port);                 ## 2. add endpoints for each port        of_node_put(port);    }    ...    return component_master_add_with_match(dev, &rockchip_drm_ops, match);}
三、component设备

1.component设备定义

component设备用来表示vop和各显示接口(如:HDMI、MIPI等),定义文件:rk3399.dtsi,内容如下:

        vopl_out: port {            #address-cells = <1>;            #size-cells = <0>;            vopl_out_dsi: endpoint@0 {                reg = <0>;                remote-endpoint = <&dsi_in_vopl>;            };            ...            vopl_out_hdmi: endpoint@2 {                reg = <2>;                remote-endpoint = <&hdmi_in_vopl>;            };            ...        };                vopb_out: port {            #address-cells = <1>;            #size-cells = <0>;            ...            vopb_out_dsi: endpoint@1 {                reg = <1>;                remote-endpoint = <&dsi_in_vopb>;            };            vopb_out_hdmi: endpoint@2 {                reg = <2>;                remote-endpoint = <&hdmi_in_vopb>;            };            ...        };

2.component设备加载

component设备通过component_add()函数进行加载。

vop实现文件rockchip_vop_reg.c,代码如下:

static int vop_probe(struct platform_device *pdev){    ...    return component_add(dev, &vop_component_ops);}

HDMI接口实现文件dw_hdmi-rockchip.c,代码如下:

static int dw_hdmi_rockchip_probe(struct platform_device *pdev){    ...    return component_add(&pdev->dev, &dw_hdmi_rockchip_ops);}

其它接口暂不介绍。

PS:

VOP(Video Output Processor)是Rockchip系列SoC的显示控制器。RK3399显示特性如下:

1、Dual VOP: one supports 4096x2160 with AFBC supported;The other supports 2560x16002、Dual channel MIPI-DSI (4 lanes per channel)3、eDP 1.3 (4 lanes with 10.8Gbps) to support display, with PSR4、HDMI 2.0 for 4K 60Hz with HDCP 1.4/2.25、DisplayPort 1.2 (4 lanes, up to 4K 60Hz)6、Supports Rec.2020 and conversion to Rec.709

注:本文代码基于RockPI 4A Debian系统Linux 4.4内核。

到此,关于"Linux DRM的component框架有什么作用"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!

设备 文件 框架 作用 代码 学习 内容 内核 接口 函数 子系统 更多 组件 帮助 实用 接下来 命令 多个 控制器 文章 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 我的世界服务器禁止破坏世界插件 服务器安全风险 时间服务器生产 有关数据库开发的书 数据库的自动收缩怎么设置 企业网站及软件开发与维护 数据库查询所有的信息 王者荣耀忘记自己以前的服务器 网络安全小迪长啥样 广东惠州中专计算机网络技术 软件开发委托协议(个人) 半导体中的软件开发 如何准备软件开发面试 战地5开服务器一个月多少钱 电脑服务器显示Bo是什么意思 部队网络安全学习心得体会 甘南网络安全监测中心主任 数据库查询成绩90分 恐惧饥饿服务器没响应 大学生网络安全与信息化实践 河南中科互联网络科技有限公司 大理软件开发培训 数据库建表标识 工艺品市场调查数据图国家数据库 sql命令查找某个数据库 软件开发概念设计方案 网络安全宣传墙 为什么网络安全是为了人民 顺义区运营软件开发介绍 sql如何批量删除数据库
0