您好,登錄后才能下訂單哦!
這篇文章主要介紹“Linux DRM的component框架有什么作用”,在日常操作中,相信很多人在Linux DRM的component框架有什么作用問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對(duì)大家解答”Linux DRM的component框架有什么作用”的疑惑有所幫助!接下來,請(qǐng)跟著小編一起來學(xué)習(xí)吧!
Linux內(nèi)核component代碼實(shí)現(xiàn)文件:drivers/base/component.c
。
使用git log -p component.c
命令,可以查看該文件的第一次提交記錄。
commit 2a41e6070dd7ef539d0f3b1652b4839d04378e11Author: Russell King <rmk+kernel@arm.linux.org.uk>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內(nèi)核引入component框架的目的:
在DRM、ALSA等子系統(tǒng)中,通過超級(jí)設(shè)備(superdevice)管理多個(gè)組件(component)加載順序,保證所有組件都可正常使用。
1.超級(jí)設(shè)備定義
超級(jí)設(shè)備也可稱為master,一般指某個(gè)子系統(tǒng)(如:display-subsystem
)。定義文件:rk3399.dtsi
,內(nèi)容如下:
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.超級(jí)設(shè)備加載
超級(jí)設(shè)備通過component_master_add_with_match()
函數(shù)進(jìn)行match注冊(cè),實(shí)現(xiàn)文件:rockchip_drm_drv.c
,內(nèi)容如下:
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);}
1.component設(shè)備定義
component設(shè)備用來表示vop和各顯示接口(如:HDMI、MIPI等),定義文件:rk3399.dtsi
,內(nèi)容如下:
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設(shè)備加載
component設(shè)備通過component_add()
函數(shù)進(jìn)行加載。
vop實(shí)現(xiàn)文件rockchip_vop_reg.c
,代碼如下:
static int vop_probe(struct platform_device *pdev){ ... return component_add(dev, &vop_component_ops);}
HDMI接口實(shí)現(xiàn)文件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系統(tǒng)Linux 4.4內(nèi)核。
到此,關(guān)于“Linux DRM的component框架有什么作用”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。