平台 | 内核版本 | 安卓版本 |
---|---|---|
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神博客里的流程: