[RK3399][Android7.1] 调试笔记 Component System 介绍

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33487044/article/details/85417742
平台 内核版本 安卓版本
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描述中按参数名字取结点

扫描二维码关注公众号,回复: 4806717 查看本文章

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进来了
在这里插入图片描述

看一下后半段:
在这里插入图片描述

添加远程endpointmatch上,也是调用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()比较matchcomponent_list是否全部匹配,并决定是否执行后面的绑定动作。

我的另一篇博客详细流程

看一下K神博客里的流程:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_33487044/article/details/85417742
今日推荐