[RK3399][Android7.1] 除錯筆記 Component System 介紹
平臺 | 核心版本 | 安卓版本 |
---|---|---|
RK3399 | Linux4.4 | Android7.1 |
文章目錄
看一下作者的描述:
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.
1、裝置樹中components
We do this in DT by providing a “superdevice” node which specifies the components
2、驅動rockchip_drm_drv.c
分析
把各個component
連線起來的樞紐是驅動檔案 rockchip_drm_drv.c
目錄:kernel/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
2.1、platform
driver
2.2、入口函式probe
首先看第一部分:
of_parse_phandle
DTS
描述中按引數名字取結點
component_match_add(dev, &match, compare_of, port->parent);
繫結CRTC
到match列表中,這樣encoder
在呼叫bind
回撥的時候能通過 drm_of_find_possible_crtcs()
找到它們, 這裡的CRTC
是"vopb"
和"vopl"
.match
這個list
只是用於儲存當前從dts
中找到的有效的component
, 如VOP
,edp
.
找到後在find_components()
的時候會比較是否list
中所有模組都已經被add
進來了
看一下後半段:
新增遠端endpoint
match
上,也是呼叫component_match_add()
實現注意:只有有效的
endpoint
才會被新增到match
中,比如這裡只有edp
被新增進去了。
把match
列表新增到master
中
return component_master_add_with_match(dev, &rockchip_drm_ops, match);
分析下:rockchip_add_endpoints(dev, &match, port);
看一下:component_master_add_with_match
中try_to_bring_up_master
在驅動中superdevice
通過component_master_add_with_match()
執行,成為一個master
。其中的變數match
列表,它從dts
中找到有效的component
, 如VOP(CRTC)
,edp(Connector)
然後新增進來。這樣就有了所有應該載入的component
列表了。另一方面,每個component
對應的驅動在載入後會新增到component_list
這個變數中。
最終通過find_components()
比較match
和component_list
是否全部匹配,並決定是否執行後面的繫結動作。
看一下K神部落格裡的流程: