mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	media: rcar-vin: Handle parallel subdev in link_notify
Handle parallel subdevices in link_notify callback. If the notified link involves a parallel subdevice, do not change routing of the VIN-CSI-2 devices and mark the VIN instance as using a parallel input. If the CSI-2 link setup succeeds instead, mark the VIN instance as using CSI-2. Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
		
							parent
							
								
									a962a80476
								
							
						
					
					
						commit
						1284605dc8
					
				
					 1 changed files with 34 additions and 1 deletions
				
			
		| 
						 | 
					@ -171,9 +171,37 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Add the new link to the existing mask and check if it works. */
 | 
						/* Add the new link to the existing mask and check if it works. */
 | 
				
			||||||
	csi_id = rvin_group_entity_to_csi_id(group, link->source->entity);
 | 
						csi_id = rvin_group_entity_to_csi_id(group, link->source->entity);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (csi_id == -ENODEV) {
 | 
				
			||||||
 | 
							struct v4l2_subdev *sd;
 | 
				
			||||||
 | 
							unsigned int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/*
 | 
				
			||||||
 | 
							 * Make sure the source entity subdevice is registered as
 | 
				
			||||||
 | 
							 * a parallel input of one of the enabled VINs if it is not
 | 
				
			||||||
 | 
							 * one of the CSI-2 subdevices.
 | 
				
			||||||
 | 
							 *
 | 
				
			||||||
 | 
							 * No hardware configuration required for parallel inputs,
 | 
				
			||||||
 | 
							 * we can return here.
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
							sd = media_entity_to_v4l2_subdev(link->source->entity);
 | 
				
			||||||
 | 
							for (i = 0; i < RCAR_VIN_NUM; i++) {
 | 
				
			||||||
 | 
								if (group->vin[i] && group->vin[i]->parallel &&
 | 
				
			||||||
 | 
								    group->vin[i]->parallel->subdev == sd) {
 | 
				
			||||||
 | 
									group->vin[i]->is_csi = false;
 | 
				
			||||||
 | 
									ret = 0;
 | 
				
			||||||
 | 
									goto out;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							vin_err(vin, "Subdevice %s not registered to any VIN\n",
 | 
				
			||||||
 | 
								link->source->entity->name);
 | 
				
			||||||
 | 
							ret = -ENODEV;
 | 
				
			||||||
 | 
							goto out;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	channel = rvin_group_csi_pad_to_channel(link->source->index);
 | 
						channel = rvin_group_csi_pad_to_channel(link->source->index);
 | 
				
			||||||
	mask_new = mask & rvin_group_get_mask(vin, csi_id, channel);
 | 
						mask_new = mask & rvin_group_get_mask(vin, csi_id, channel);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	vin_dbg(vin, "Try link change mask: 0x%x new: 0x%x\n", mask, mask_new);
 | 
						vin_dbg(vin, "Try link change mask: 0x%x new: 0x%x\n", mask, mask_new);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!mask_new) {
 | 
						if (!mask_new) {
 | 
				
			||||||
| 
						 | 
					@ -183,6 +211,11 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* New valid CHSEL found, set the new value. */
 | 
						/* New valid CHSEL found, set the new value. */
 | 
				
			||||||
	ret = rvin_set_channel_routing(group->vin[master_id], __ffs(mask_new));
 | 
						ret = rvin_set_channel_routing(group->vin[master_id], __ffs(mask_new));
 | 
				
			||||||
 | 
						if (ret)
 | 
				
			||||||
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						vin->is_csi = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	mutex_unlock(&group->lock);
 | 
						mutex_unlock(&group->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue