aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Longerbeam <slongerbeam@gmail.com>2019-01-14 17:10:19 -0800
committerRyo Kataoka <ryo.kataoka.wt@renesas.com>2019-03-22 20:50:28 +0900
commit620f3e493e55cf958dfadfa40b728ab921e5ab55 (patch)
treed7d0cf74f00f1255025814cdc1b23b6838f54f49
parent505e5f61f280cc4a06942d8f4493d10af4011ee7 (diff)
downloadrenesas-bsp-620f3e493e55cf958dfadfa40b728ab921e5ab55.tar.gz
media: rcar-vin: Allow independent VIN link enablement
There is a block of code in rvin_group_link_notify() that prevents enabling a link to a VIN node if any entity in the media graph is in use. This prevents enabling a VIN link even if there is an in-use entity somewhere in the graph that is independent of the link's pipeline. For example, the code block will prevent enabling a link from the first rcar-csi2 receiver to a VIN node even if there is an enabled link somewhere far upstream on the second independent rcar-csi2 receiver pipeline. If this code block is meant to prevent modifying a link if any entity in the graph is actively involved in streaming (because modifying the CHSEL register fields can disrupt any/all running streams), then the entities stream counts should be checked rather than the use counts. (There is already such a check in __media_entity_setup_link() that verifies the stream_count of the link's source and sink entities are both zero, but that is insufficient, since there should be no running streams in the entire graph). Modify the code block to check the entity stream_count instead of the use_count (and elaborate on the comment). VIN node links can now be enabled even if there are other independent in-use entities that are not streaming. Fixes: c0cc5aef31 ("media: rcar-vin: add link notify for Gen3") Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Link: https://patchwork.kernel.org/patch/10763675/ [koji.matsuoka.xm: the part of the patch for kernel v4.14.75 was rebased and imported] Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
-rw-r--r--drivers/media/platform/rcar-vin/rcar-core.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
index c57a0a5313deac..d6f99dbb165dd0 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -1,7 +1,7 @@
/*
* Driver for Renesas R-Car VIN
*
- * Copyright (C) 2016-2018 Renesas Electronics Corp.
+ * Copyright (C) 2016-2019 Renesas Electronics Corp.
* Copyright (C) 2011-2013 Renesas Solutions Corp.
* Copyright (C) 2013 Cogent Embedded, Inc., <source@cogentembedded.com>
* Copyright (C) 2008 Magnus Damm
@@ -135,9 +135,13 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags,
!is_media_entity_v4l2_video_device(link->sink->entity))
return 0;
- /* If any entity is in use don't allow link changes. */
+ /*
+ * Don't allow link changes if any entity in the graph is
+ * streaming, modifying the CHSEL register fields can disrupt
+ * running streams.
+ */
media_device_for_each_entity(entity, &group->mdev)
- if (entity->use_count)
+ if (entity->stream_count)
return -EBUSY;
mutex_lock(&group->lock);