• 基于RV1126 Video分析-----链接 isp 与mipi csi 的media模块


    从前文:<<图像处理模块所代表的V4L2设备注册>> 中了解到。rkcif_mipi设备注册的过程就是以设备通知器为线索,从顶向下,依次找到下一级设备,添加到V4L2设备种,循环处理。将全部的子设备整理到 V4L2设备中,这样可以通过V4L2设备直接管理所包含的各个子设备。 其中各自探测到子设备后,会分别执行各自的bound()函数。
    即 rkcif_mipi,mipi csi, mipi csi dphy 三个模块的 bound()函数!!!

    最后执行 rkcif_mipi 的 complete()函数

    所以 这里 我们就只分析:
    1 rkcif_mipi 的 bound()函数
    2 rkcif_mipi 的 complete()函数

    有下面的分析可以知道,最终

    在这里插入图片描述

    即从这里:

    rkcif_plat_probe
    	rkcif_plat_init
    		rkcif_register_platform_subdevs
    			cif_subdev_notifier
    				v4l2_async_notifier_register
    					__v4l2_async_notifier_register
    
    
    
    
    
    static int __v4l2_async_notifier_register(struct v4l2_async_notifier *notifier)
    {
    	struct device *dev =
    		notifier->v4l2_dev ? notifier->v4l2_dev->dev : NULL;
    	struct v4l2_async_subdev *asd;
    	int ret;
    	int i;
    
    
    	/*
    	动作4
    	
    	工作
    	
    	struct rkcif_device
    		struct device *dev;
    			struct device_node	*of_node; //A associated device tree node           如 节点 rkcif_mipi_lvds                      
    				struct	device_node *child;  //Aa                 第一个子节点      如 节点 	port 				
    					struct	device_node *child; // Aa-1           第一个子节点      如 节点 		cif_mipi_in: endpoint
    						struct fwnode_handle fwnode;				
    
    		struct v4l2_async_notifier notifier;	
    			const struct v4l2_async_notifier_operations *ops ;(init)
    		+---struct list_head waiting;//等待通知链表
    		|	struct v4l2_async_subdev **subdevs;//subdevs数组 保存 对应的远端关联节点的父节点信息			
    		+-------|//subdevs[n] 将远端目标节点封装为 v4l2_async_subdev 结构 保存在该数组				
    				|enum v4l2_async_match_type match_type = V4L2_ASYNC_MATCH_FWNODE  设备树fwnode匹配方式 				
    				|union match				
    					struct fwnode_handle *fwnode;----------------------------->>>>>------------------------相连接的远程节点 mipi_csi2_output 的 父节点port的 fwnode							
    			
    	*/
    	for (i = 0; i < notifier->num_subdevs; i++) {
    		//获取  对应的远端关联节点的父节点信息
    		asd = notifier->subdevs[i];
    		//挂载 到等待队列
    		list_add_tail(&asd->list, ¬ifier->waiting);
    	}
    
    
    	/*
    	
    	这里是一个循环探索的过程
    	
    	第一轮:传入参数:
    		struct rkcif_device
    			struct v4l2_async_notifier notifier
    			
    	 rkcif_device 设备
    		1 遍历全局链表 subdev_list ,搜索到当前异步通知器是waiting链表中的子设备信息,即mipi csi设备。说明探索到已挂在的子设备
    		2 将mipi csi设备 添加到  V4L2 子设备链表中 !!
    		3 执行 rkcif_device设备的 notifier->ops->bound()函数
    		4 绑定 mipi csi设备 通知器
    			struct rkcif_device		  
    				struct v4l2_async_notifier notifier ----------+
    															  |
    			struct csi2_dev                                   |
    				struct v4l2_async_notifier notifier-----------+
    					struct v4l2_async_notifier *parent;-------+
    					
    						
    	第二轮:传入参数:
    		struct csi2_dev  
    			struct v4l2_async_notifier notifier
    			
    					
    	 mipi cis 设备
    		1 遍历全局链表 subdev_list ,搜索到当前异步通知器是waiting链表中的子设备信息,即 mipi csi dphy 设备。说明探索到已挂在的子设备
    		2 将 mipi csi dphy 设备 添加到  V4L2 子设备链表中 !!
    		3 执行 mipi cis 设备的 notifier->ops->bound()函数
    		4 绑定 mipi csi dphy 设备 通知器
    			struct rkcif_device		  
    				struct v4l2_async_notifier notifier ----------+
    															  |
    			struct csi2_dev                                   |
    				struct v4l2_async_notifier notifier-----------+
    					struct v4l2_async_notifier *parent;-------+
    															  |
    			struct mipidphy_priv                              |
    				struct v4l2_async_notifier notifier-----------+
    					struct v4l2_async_notifier *parent;-------+
    						
    	第三轮: 传入参数 
    		struct mipidphy_priv  
    			struct v4l2_async_notifier notifier
    			
    	mipi csi dphy 设备
    		1 遍历全局链表 subdev_list ,搜索到当前异步通知器是waiting链表中的子设备信息,即 sensor 设备。说明探索到已挂在的子设备
    		2 将 sensor 设备 添加到  V4L2 子设备链表中 !!
    		3 执行 mipi csi dphy 设备的 notifier->ops->bound()函数
    		4 绑定 sensor 设备 通知器
    			struct rkcif_device		  
    				struct v4l2_async_notifier notifier ----------+
    															  |
    			struct csi2_dev                                   |
    				struct v4l2_async_notifier notifier-----------+
    					struct v4l2_async_notifier *parent;-------+
    															  |
    			struct mipidphy_priv                              |
    				struct v4l2_async_notifier notifier-----------+
    					struct v4l2_async_notifier *parent;-------+
    															  |
    			struct techpoint                                  |
    				struct v4l2_async_notifier notifier-----------+
    					struct v4l2_async_notifier *parent;-------+
    					
    	第四轮:传入参数:
    		struct techpoint
    			struct v4l2_async_notifier notifier
    		
    	sensor 设备
    		由于sensort 已经是最后一级模块,他没有子设备。直接返回 !!!
    			
    	
    	*/
    	ret = v4l2_async_notifier_try_all_subdevs(notifier);
    	if (ret < 0)
    		goto err_unbind;
    
    	 /*  	参数1  当前设备异步通知器				
             * 条件不满足,暂时不进入分析,不满足原因如下
             * 1. notifier->parent == NULL
             * 2. notifier->v4l2_dev == NULL
    		 
    		 所以其他三个subdev设备 独自初始化时 不满足该函数运行条件
    		 
    		 只有 rkcif_mipi 能执行该函数
             */
    
    	ret = v4l2_async_notifier_try_complete(notifier);
    	if (ret < 0)
    		goto err_unbind;
    
    	  /*
             * 以上2个函数可以看出来,v4l2_dev为空时都不会执行
             * 将这个notifer挂载到链表notifier_list上
             */
    
    	
    	/* Keep also completed notifiers on the list */
    	list_add(¬ifier->list, ¬ifier_list);
    
    	mutex_unlock(&list_lock);
    
    	return 0;
    
    err_unbind:
    	/*
    	 * On failure, unbind all sub-devices registered through this notifier.
    	 */
    	v4l2_async_notifier_unbind_all_subdevs(notifier);
    
    err_unlock:
    	mutex_unlock(&list_lock);
    
    	return ret;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167

    这里会按照顺序 分别执行各自的bound()函数。
    即 rkcif_mipi,mipi csi, mipi csi dphy 三个模块的 bound()函数!!!

    首先 先看 rkcif_mipi 模块的 bound()函数

    struct rkcif_device
    	struct v4l2_async_notifier notifier;
    		const struct v4l2_async_notifier_operations *ops ;(init)
    			.bound = subdev_notifier_bound,
    
    
    // V4L4 异步通知操作集
    static const struct v4l2_async_notifier_operations subdev_notifier_ops = {
    	.bound = subdev_notifier_bound,
    	.complete = subdev_notifier_complete,
    };
    
    //已经成功探测到其中一个子设备,只是把子设备 mipi csi的subdev放入cif_dev->sensors的数组中存储
    	/*
    		参数1 rkcif_device->v4l2_async_notifier
    	参数2 相关联的 mipi csi 的 v4l2_subdev
    	参数3 相关联的 mipi csi 的dts节点
    	*/
    static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,
    				 struct v4l2_subdev *subdev,
    				 struct v4l2_async_subdev *asd)
    {
    	//当前 rkcif_device 设备信息
    	struct rkcif_device *cif_dev = container_of(notifier,
    					struct rkcif_device, notifier);
    					
    		
    	struct rkcif_async_subdev *s_asd = container_of(asd,
    					struct rkcif_async_subdev, asd);
    
    	if (cif_dev->num_sensors == ARRAY_SIZE(cif_dev->sensors)) {
    		v4l2_err(&cif_dev->v4l2_dev,
    			 "%s: the num of subdev is beyond %d\n",
    			 __func__, cif_dev->num_sensors);
    		return -EBUSY;
    	}
    
    //将  相关联的 mipi csi 的 v4l2_subdev 添加到 rkcif_device设备的子sensor[]数组中
    	cif_dev->sensors[cif_dev->num_sensors].lanes = s_asd->lanes;
    	cif_dev->sensors[cif_dev->num_sensors].mbus = s_asd->mbus;
    	cif_dev->sensors[cif_dev->num_sensors].sd = subdev;
    	++cif_dev->num_sensors;
    
    	v4l2_err(subdev, "Async registered subdev\n");
    
    	return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47

    其实没干啥

    只是把子设备 mipi csi的subdev放入cif_dev->sensors的数组中存储

    再看看 rkcif_mipi 的complete()

    static int subdev_notifier_complete(struct v4l2_async_notifier *notifier)
    {
    	struct rkcif_device *dev;
    	struct rkcif_sensor_info *sensor;
    	struct v4l2_subdev *sd;
    	struct v4l2_device *v4l2_dev = NULL;
    	int ret, index;
    
    	// 通过 rkcif_mipi 通知器地址 得到 rkcif_device 地址
    	dev = container_of(notifier, struct rkcif_device, notifier);
    
    	// 获取 rkcif_mipi设备的  v4l2_device信息(v4l2设备)
    	v4l2_dev = &dev->v4l2_dev;
    
    ...
    
    	/*
    		参数:rkcif_mipi对应的 v4l2设备
    	*/
    	ret = rkcif_create_links(dev);
    	if (ret < 0)
    		goto unregister_lvds;
    
    ...
    	return ret;
    }
    
    
    
    
    
    /*
    	参数:rkcif_mipi 对应的 v4l2设备
    */
    static int rkcif_create_links(struct rkcif_device *dev)
    {
    	int ret;
    	u32 flags;
    	unsigned int s, pad, id, stream_num = 0;
    	bool mipi_lvds_linked = false;
    
    	//stream_num =4  
    	if (dev->chip_id < CHIP_RV1126_CIF) {
    		if (dev->inf_id == RKCIF_MIPI_LVDS)
    			stream_num = RKCIF_MAX_STREAM_MIPI;
    		else
    			stream_num = RKCIF_SINGLE_STREAM;
    	} else {
    		stream_num = RKCIF_MAX_STREAM_MIPI;
    	}
    
    	/* sensor links(or mipi-phy) */
    	for (s = 0; s < dev->num_sensors; ++s) {
    		/*
    		已经知道 mipi csi的subdev 存储在 cif_dev->sensors[] 数组中
    		*/
    		struct rkcif_sensor_info *sensor = &dev->sensors[s];
    		struct rkcif_sensor_info linked_sensor;//用来代表 mipi csi 信息
    		struct media_entity *source_entity, *sink_entity;
    
    		linked_sensor.lanes = sensor->lanes;
    
    		//拿到 mipi csi 的 subdev(描述一个V4L2子设备 )
    		linked_sensor.sd = sensor->sd;
    		...
    
    		//遍历 mipi csi 模块抽象的 五个 端口抽象 四个source,1个link
    		for (pad = 0; pad < linked_sensor.sd->entity.num_pads; pad++) {
    			
    			//目标是 四个source
    			if (linked_sensor.sd->entity.pads[pad].flags &
    				MEDIA_PAD_FL_SOURCE) {
    				if (pad == linked_sensor.sd->entity.num_pads) {
    					dev_err(dev->dev,
    						"failed to find src pad for %s\n",
    						linked_sensor.sd->name);
    
    					break;
    				}
    
    ...
    
    				for (id = 0; id < stream_num; id++) {
    					//拿到 mipi csi 模块抽象
    					source_entity = &linked_sensor.sd->entity;
    					
    					// struct video_device 用于创建和管理V4L2设备的结构
    					/*
    						struct rkcif_device
    							struct rkcif_stream		stream[RKCIF_MULTI_STREAMS_NUM]; //理解为四个流,每个流代表一个 video_device 设备
    								struct rkcif_vdev_node		vnode;
    									struct video_device vdev;//每个流代表一个 video_device 设备
    										struct media_entity entity; //每个  video_device 设备 的模块抽象
    					*/
    					sink_entity = &dev->stream[id].vnode.vdev.entity;
    
    					if ((dev->chip_id != CHIP_RK1808_CIF &&
    					     dev->chip_id != CHIP_RV1126_CIF &&
    					     dev->chip_id != CHIP_RV1126_CIF_LITE &&
    					     dev->chip_id != CHIP_RK3568_CIF) ||
    					    (id == pad - 1 && !mipi_lvds_linked))
    						flags = MEDIA_LNK_FL_ENABLED;
    					else
    						flags = 0;
    
    				/* 组成如下组合
    						source_entity          sink_entity
    						pad[1]   ------------     pad[0]
    						pad[2]   ------------     pad[1]
    						pad[3]   ------------     pad[2]
    						pad[4]   ------------     pad[3]
    					
    					*/
    					ret = media_create_pad_link(source_entity,
    								    pad,
    								    sink_entity,
    								    0,
    								    flags);
    					}
    				}
    			}
    		}
    
    	...
    
    	return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127

    /*

    工作
    
    	                                            		mipi csi link                       		rkcif_mipi  /dev/videoX
    											    	|----------------------------------|    	|---------------------------|
    				mipi csi					    	|  #-------------# #-------------# |    	|		media_device        |       
    	   |----------------------------------|	    +---|->| source pad  | | | sink  pad |-|---+    |							|      
    	   |    entity                     	  |	    |	|  #-------------# #-------------# |   | 	|		#------------#   	| 
    	   |                 #-------------#  |     |  	|----------------------------------|   | 	|	    |  entity    |      | 
    	   |                 | source  pad1|--|---->|	                                       | 	| #-----------#      |      |  	
    	   |                 #-------------#  |	    |		rkcif_mipi link                    +->--| | link pad  |      |     	|  
    	   |                 				  |	    |	|----------------------------------|   |	| #-----------#      |	    | 
    	   |   #----------#  				--|-    |	|  #-------------# #-------------# |   |    |		|            |      | 
    	---|-->| sink pad |  				  |     +---|->| source pad  | | | sink  pad |-|---+    |		#------------#      | 
    	   |   #----------#  				  |     	|  #-------------# #-------------# |        |		                    | 
    	   |                 				--|-      	|----------------------------------|        |---------------------------| 
    	   |                 				  |		
    	   |                 				  | 	source pad2 ....link.... /dev/videoY
    	   | 				 				--|-	source pad3 ....link.... /dev/videoZ
    	   |                 				  |		source pad4 ....link.... /dev/videoN
    	   |----------------------------------|		
    	
    	  此时 
    
    		mipi csi 设备抽象   ----    mipi csi   抽象链接  ----   rkcif_mipi 设备抽象
    							----   rkcif_mipi 抽象链接   ----
    								   
    		关联 这两个link : link和backlink
    
    */
    int media_create_pad_link(struct media_entity *source, u16 source_pad,
    			 struct media_entity *sink, u16 sink_pad, u32 flags)
    {
    	struct media_link *link;
    	struct media_link *backlink;
    
    	BUG_ON(source == NULL || sink == NULL);
    	BUG_ON(source_pad >= source->num_pads);
    	BUG_ON(sink_pad >= sink->num_pads);
    
    	/*
    	参数 子设备 mipi csi 的entity中的 links
    
    	创建子设备的 entity	的连接抽象(media_link) 
    	
    		struct media_entity {                             struct media_link {
    			struct list_head links;	-----------创建绑定---------->struct list_head list;
    
    		并返回 media_link
    	*/
    	link = media_add_link(&source->links);
    	if (link == NULL)
    		return -ENOMEM;
    
    	
    	//初始化 子设备的entity中的 连接抽象(media_link) 	
    
    	/* 	 										
    		
    链接管道 子设备 mipi csi -----  正向link ----- rkcif_mipi( dev/deviceX)
    
    	
    																																					
    																								rkcif_mipi  /dev/videoX
    	                                                                                    	|---------------------------|	
    																							|		media_device        |  	
    				mipi csi																	|							|  
    	   |----------------------------------|			mipi csi link                       	|		#------------#   	|  
    	   |    entity                     	  |		|----------------------------------|    	|	    |  entity    |      |
    	   |                 #-------------#  | 	|  #-------------# #-------------# |    	| #-----------#      |      |       
    	   |                 | sourceX pad |--|-----|->| source pad  | | | sink  pad |-|------->| | link pad  |      |     	|      
    	   |                 #-------------#  |		|  #-------------# #-------------# |    	| #-----------#      |	    |
    	   |                 				  |	  	|----------------------------------|    	|		|            |      |  
    	   |   #----------#  				--|-	                                        	|		#------------#      |  	
    	---|-->| sink pad |  				  | 	                                        	|		                    |  
    	   |   #----------#  				  | 	                                        	|---------------------------|  
    	   |                 				--|-	
    	   |                 				  |		
    	   |                 				  | 	
    	   | 				 				--|-	
    	   |                 				  |		
    	   |----------------------------------|		
    	
    		  																						
    	*/                                                                          
    	link->source = &source->pads[source_pad];                                      										
    	link->sink = &sink->pads[sink_pad];
    	link->flags = flags & ~MEDIA_LNK_FL_INTERFACE_LINK;
    
    	/* Initialize graph object embedded at the new link 
    	
    	绑定 子设备 mipi csi  link ----- 多媒体设备
    
    		struct csi2_dev
    			struct v4l2_subdev sd;          绑定 entity---link
    				struct media_entity entity;		|	struct media_link
    					struct list_head links; ---------> 	struct list_head list; 
    														struct media_gobj graph_obj;
    															struct media_device	*mdev------+    
    															struct list_head	list; -----|--->-+
    																						   |     |
    					struct media_gobj graph_obj;                   绑定 多媒体设备--link   |     |
    							struct media_device	*mdev;	-----------------------------------+     | 挂载到多媒体设备中的 links 链表
    								struct list_head links; ------------------<----------------------+
    
    	*/
    	media_gobj_create(source->graph_obj.mdev, MEDIA_GRAPH_LINK,
    			&link->graph_obj);
    
    
    	//关于反向链接 ,即 rkcif_mipi  entity模块的 link
    	/* 
    	
    	struct rkcif_device
    		struct rkcif_stream		stream[RKCIF_MULTI_STREAMS_NUM]; //理解为四个流,每个流代表一个 video_device 设备
    			struct rkcif_vdev_node		vnode;
    				struct video_device vdev;//每个流代表一个 video_device 设备
    					struct media_entity entity; 			struct media_link {
    						struct list_head links;-----创建绑定----->struct list_head list;
    				
    	 */
    	backlink = media_add_link(&sink->links);
    	if (backlink == NULL) {
    		__media_entity_remove_link(source, link);
    		return -ENOMEM;
    	}
    
    /*
    
    链接管道 子设备 mipi csi -----  反向link(rkcif_mipi link) ----- rkcif_mipi
    																																					
    
    																								rkcif_mipi  /dev/videoX
    	                                                                                    	|---------------------------|	
    																							|		media_device        |  	
    				mipi csi																	|							|  
    	   |----------------------------------|			     rkcif_mipi link                    |		#------------#   	|  
    	   |    entity                     	  |		|----------------------------------|    	|	    |  entity    |      |
    	   |                 #-------------#  | 	|  #-------------# #-------------# |    	| #-----------#      |      |       
    	   |                 | sourceX pad |--|-----|->| source pad  | | | sink  pad |-|------->| | link pad  |      |     	|      
    	   |                 #-------------#  |		|  #-------------# #-------------# |    	| #-----------#      |	    |
    	   |                 				  |	  	|----------------------------------|    	|		|            |      |  
    	   |   #----------#  				--|-	                                        	|		#------------#      |  	
    	---|-->| sink pad |  				  | 	                                        	|		                    |  
    	   |   #----------#  				  | 	                                        	|---------------------------|  
    	   |                 				--|-	
    	   |                 				  |		
    	   |                 				  | 	
    	   | 				 				--|-	
    	   |                 				  |		
    	   |----------------------------------|		
    	
    	
    */
    	backlink->source = &source->pads[source_pad];
    	backlink->sink = &sink->pads[sink_pad];
    	backlink->flags = flags;
    	backlink->is_backlink = true;
    
    	/* 
    	
    	绑定 rkcif_mipi link ----- 多媒体设备
    	
    	
    	
    	struct rkcif_device
    		struct rkcif_stream		stream[RKCIF_MULTI_STREAMS_NUM]; //理解为四个流,每个流代表一个 video_device 设备
    			struct rkcif_vdev_node		vnode;
    				struct video_device vdev;//每个流代表一个 video_device 设备
    					struct media_entity entity; 			
    							struct media_gobj graph_obj	
    								struct media_device	*mdev;-------------------------------+
    									struct list_head links; ----------|                  |
    																	  |                  |
    							struct list_head links;//media_link       |挂载到links链表   | 绑定 多媒体
    								struct media_gobj graph_obj	          |                  |
    									struct list_head	list;---------|                  |
    									struct media_device	*mdev;---------------------------+
    									
    	*/
    	media_gobj_create(sink->graph_obj.mdev, MEDIA_GRAPH_LINK,
    			&backlink->graph_obj);
    
    	/*    
    	 * link和backlink关联起来
    	 */
    	link->reverse = backlink;
    	backlink->reverse = link;
    
    	sink->num_backlinks++;
    	sink->num_links++;
    	source->num_links++;
    
    	return 0;
    }
    EXPORT_SYMBOL_GPL(media_create_pad_link);
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
  • 相关阅读:
    简易通讯录Promax
    LeetCode 面试题 03.03. 堆盘子
    #Powerbi 10分钟,理解 Rankx 排名函数
    在Vue+Ts+Vite项目中如何配置别名指向不同的目录并引用
    语法练习:front3
    Spring源码深度解析:六、ConfigurationClassPostProcessor
    oracle11g体系结构
    COMSOL空气反应 模型框架
    数据开源 | Magic Data中英文座舱功能点泛化语料
    网络安全(黑客)自学
  • 原文地址:https://blog.csdn.net/LinuxArmbiggod/article/details/128123685