Commit 39bb6df6 authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] s5p-fimc: Update graph traversal for entities with multiple source pads

We cannot assume that the passed entity the fimc_pipeline_prepare()
function is supposed to start the media graph traversal from will
always have its sink pad at pad index 0. Find the starting media
entity's sink pad by iterating over its all pads and checking the
pad flags. This ensures proper handling of FIMC, FIMC-LITE and
FIMC-IS-ISP subdevs that have more than one sink and one source pad.
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 76323e50
...@@ -40,14 +40,13 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, ...@@ -40,14 +40,13 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
bool on); bool on);
/** /**
* fimc_pipeline_prepare - update pipeline information with subdevice pointers * fimc_pipeline_prepare - update pipeline information with subdevice pointers
* @fimc: fimc device terminating the pipeline * @me: media entity terminating the pipeline
* *
* Caller holds the graph mutex. * Caller holds the graph mutex.
*/ */
static void fimc_pipeline_prepare(struct fimc_pipeline *p, static void fimc_pipeline_prepare(struct fimc_pipeline *p,
struct media_entity *me) struct media_entity *me)
{ {
struct media_pad *pad = &me->pads[0];
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
int i; int i;
...@@ -55,15 +54,21 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p, ...@@ -55,15 +54,21 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,
p->subdevs[i] = NULL; p->subdevs[i] = NULL;
while (1) { while (1) {
if (!(pad->flags & MEDIA_PAD_FL_SINK)) struct media_pad *pad = NULL;
/* Find remote source pad */
for (i = 0; i < me->num_pads; i++) {
struct media_pad *spad = &me->pads[i];
if (!(spad->flags & MEDIA_PAD_FL_SINK))
continue;
pad = media_entity_remote_source(spad);
if (pad)
break; break;
}
/* source pad */
pad = media_entity_remote_source(pad);
if (pad == NULL || if (pad == NULL ||
media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV) media_entity_type(pad->entity) != MEDIA_ENT_T_V4L2_SUBDEV)
break; break;
sd = media_entity_to_v4l2_subdev(pad->entity); sd = media_entity_to_v4l2_subdev(pad->entity);
switch (sd->grp_id) { switch (sd->grp_id) {
...@@ -84,8 +89,9 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p, ...@@ -84,8 +89,9 @@ static void fimc_pipeline_prepare(struct fimc_pipeline *p,
pr_warn("%s: Unknown subdev grp_id: %#x\n", pr_warn("%s: Unknown subdev grp_id: %#x\n",
__func__, sd->grp_id); __func__, sd->grp_id);
} }
/* sink pad */ me = &sd->entity;
pad = &sd->entity.pads[0]; if (me->num_pads == 1)
break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment