OS: Android 7.1
Board: Firefly-RK3399
Kernel: v4.4.55

上一篇文章介绍了DRM的概念,有CRTC, Encoder, Connector等好多个模块,各个模块都作为一个组件添加到组件系统中,通过组件驱动来管理。

关于component system,下面是作者的一段话:

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.

也就是说DRM类似ALSA框架那样有一个代表整个子系统的东西,作者称它为”superdevice”, superdevice管理components,在rk平台上对应的dts node就是:
rk3399.dtsi

    display_subsystem: display-subsystem {compatible = "rockchip,display-subsystem";ports = <&vopl_out>, <&vopb_out>;status = "disabled";};

在rk3399-android.dtsi中被打开:

&display_subsystem {status = "okay";ports = <&vopb_out>, <&vopl_out>;memory-region = <&drm_logo>;route {......route_edp: route-edp {.....connect = <&vopb_out_edp>;};};
};

对应的驱动文件是 rockchip_drm_drv.c, 在驱动中superdevice通过component_master_add_with_match()添加成为一个master。

static int rockchip_drm_platform_probe(struct platform_device *pdev)
{//绑定CRTC到match列表中,这样encoder在调用bind回调的时候能通过 drm_of_find_possible_crtcs()找到它们, 这里的CRTC是"vopb"和"vopl".//match这个list只是用于保存当前从dts中找到的有效的component, 如VOP,edp.//找到后在find_components()的时候会比较是否list中所有模块都已经被add进来了component_match_add(dev, &match, compare_of, port->parent);......//添加远程endpoint到match上,也是调用component_match_add()实现//注意:只有有效的endpoint才会被添加到match中,比如这里只有edp被添加进去了。rockchip_add_endpoints(dev, &match, port);......//把match列表添加到master中return component_master_add_with_match(dev, &rockchip_drm_ops, match);
}

当前的endpoint有:

    vopb: vop@ff900000 {......vopb_out: port {#address-cells = <1>;#size-cells = <0>;vopb_out_edp: endpoint@0 {reg = <0>;remote-endpoint = <&edp_in_vopb>;};vopb_out_mipi: endpoint@1 {reg = <1>;remote-endpoint = <&mipi_in_vopb>;};vopb_out_hdmi: endpoint@2 {reg = <2>;remote-endpoint = <&hdmi_in_vopb>;};vopb_out_dp: endpoint@3 {reg = <3>;remote-endpoint = <&dp_in_vopb>;};};};

vopl里也有四个,通过remote-endpoint node找到parent node分别是edp: edp@ff970000, mipi_dsi: mipi@ff960000, hdmi: hdmi@ff940000,cdn_dp: dp@fec00000 。

其中的rockchip_drm_ops在所有components被found后会调用bind来绑定所有devices.

static const struct component_master_ops rockchip_drm_ops = {.bind = rockchip_drm_bind,.unbind = rockchip_drm_unbind,
};

调用过程:
component_master_add_with_match -> try_to_bring_up_master -> find_components ->
master->ops->bind

component_master_add_with_match()第一次不一定会成功,当且仅当所有的component都ready之后,master才会被bring up。因此在开机log中刚开始看到“failed to bind xxx”的信息是正常的。

那么这时候没有ready的话下次什么时候会再执行这个动作呢?
答案:每个component在被add的时候都会去重新调用try_to_bring_up_master()去判断是否所有component全部被match上。

find_components()就是用来寻找并判断所有match列表中的components是不是都被add即初始化了,如果没有ready,那么就不会再去走后面bring up master的流程。

拿edp驱动举例, analogix_dp-rockchip.c中有如下调用:
rockchip_dp_probe -> component_add -> try_to_bring_up_masters

master就会被bring up,master->bind就会被调用,最终也会调用各个component的bind回调函数。
rockchip_drm_bind -> component_bind_all -> component_bind -> component->ops->bind

借用rk drm作者的一张流程加载图可以对加载过程有更清晰的了解。


参考
Patchwork [RFC,26/46] drivers/base: provide an infrastructure for componentised subsystems
[PATCH 2/2] component: add kernel-docs in the header
rockchip_drm_integration_helper-zh.pdf

[RK3399][Android7.1] DRM中的Component System相关推荐

  1. [RK3399][Android7.1] Display中的VOP模块介绍

    OS: Android 7.1 Board: Firefly-RK3399 Uboot: v2017.02 什么是VOP ? 全称 Visual Output Processor, 是Rockchip ...

  2. [RK3399][Android7.1] Audio中的MCLK时钟小结

    Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 引用: I2S有3个主要信号: 1.串行时钟SCLK,也叫位时钟BCLK,即对应数字音频的每一位数据, ...

  3. [RK3399][Android7.1] Audio中的Ducking模式

    Platform: rk3399 OS: Android 7.1 Kernel: v4.4.83 概念: Ducking就是当其他应用在使用音频时降低自身音量的过程. 举例: 当你开车在边听车载音乐边 ...

  4. Entity Component System

    2019独角兽企业重金招聘Python工程师标准>>> http://t-machine.org/index.php/2007/09/03/entity-systems-are-th ...

  5. Unity下一轮最大的变革-Entity Component System C# Jobs System

    ECS+jobs实现的酷炫效果 新一代Entity Component System(ECS)将会彻底改变Unity的底层概念(GameObject-Component 系统)和现有工作方式.Mono ...

  6. RK3399 Android7.1系统多个应用出现概率性打开闪退的问题

    比如设置应用打开闪退的报错信息如下: 09-29 16:30:37.105  1675  1675 D AndroidRuntime: Shutting down VM 09-29 16:30:37. ...

  7. RK3399 Android7.1 编译

    RK3399 Android7.1 编译 文章目录 RK3399 Android7.1 编译 前言 设置 Linux 编译环境 安装 JDK 可选- 更新默认的 Java 版本 安装所需的程序包(Ub ...

  8. Unity2018新功能之Entity Component System(ECS)一

    Entities介绍 Entities是Unity2018新引入的一个全新游戏设计框架,我们称之为实体组件系统(Entity Component System,简称ECS),它的出现使我们能够集中精力 ...

  9. android手机底噪,[RK3399][Android7.1] 调试笔记 --- Codec播放音乐会有底噪

    Platform: RK3399 OS: Android 7.1 Kernel: v4.4.83 背景: 移植完Codec RT5640之后,发现播放声音的时候底部有噪声. 用示波器测量到的左右声道波 ...

  10. [RK3399][Android7.1] 调试笔记 --- 系统默认时钟配置

    OS: Android 7.1 Board: Firefly-RK3399 Kernel: v4.4.55 分两个模块,一个是cpu,还有一个是pmu模块,这里只举例cpu,cpu又分在两个文件中定义 ...

最新文章

  1. 卷积神经网络模型可解释性
  2. 暑期集训5:并查集 线段树 练习题A:  HDU - 1232 ​​​​​​​
  3. python爬取正确但不出文件_python爬取糗事百科,该如何正确保存到本地文件夹?报错-问答-阿里云开发者社区-阿里云...
  4. 国产麒麟Linux安装体验
  5. RTMP 流媒体系统协议 简介
  6. 邮件发送打印机更改打印机连接的通知
  7. 计算机组成 面试 ---杂货铺
  8. spring配置的相关文章
  9. CSS Image Rollovers翻转效果Image Sprites图片精灵
  10. AngularJS实战之Controller之间的通信
  11. Node.js 应用故障排查手册 —— 类死循环导致进程阻塞
  12. jks与keystore的区别
  13. 华为服务器备件系统,华为企业业务中国区经销商备件系列宣传(共8期)
  14. 1018. 锤子剪刀布 (20)-PAT乙级真题
  15. LeetCode 热题 HOT 100 完整题解笔记知识点分类 C++代码实现
  16. Android 仿网易新闻底部Tab
  17. 如何正确添加水印保护自己的版权?
  18. (十五)final关键字
  19. 最全最简单的dubbo教程-开篇《一》
  20. ZOC7 for Mac破解版激活方法附注册码

热门文章

  1. poj 1113 graham模板(水平序)
  2. ubuntu 卸载NetworkManager
  3. [C#] UTF-8 ENCODING=QUOTED-PRINTABLE 的解码和编码
  4. word域高级应用 if 域 域邮件合并的值的更改 日期的更改
  5. Spring.NET学习笔记17——事务传播行为(基础篇) Level 200
  6. 一个计算周次和本周时间范围的代码(c#)
  7. Visual Studio Team System面面观系列课程幸运听众 又一次中奖,哈哈
  8. msgpack使用 php_如何使用msgpack进行读写?
  9. 通过Spring @PostConstruct 和 @PreDestroy 方法 实现初始化和销毁bean之前进行的操作
  10. 正则表达式-grep命令