Commit 161b56a8 authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

media: rcar-vin: Rename array storing subdevice information

The VIN group have always been connected to CSI-2 receivers and this
have spilled over to the naming of the array storing the subdevice
information. In preparation for connecting other types of subdevices
rename the array to remotes.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarJacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 27b9a6f9
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
*/ */
/* group lock should be held when calling this function. */ /* group lock should be held when calling this function. */
static int rvin_group_entity_to_csi_id(struct rvin_group *group, static int rvin_group_entity_to_remote_id(struct rvin_group *group,
struct media_entity *entity) struct media_entity *entity)
{ {
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
...@@ -57,8 +57,8 @@ static int rvin_group_entity_to_csi_id(struct rvin_group *group, ...@@ -57,8 +57,8 @@ static int rvin_group_entity_to_csi_id(struct rvin_group *group,
sd = media_entity_to_v4l2_subdev(entity); sd = media_entity_to_v4l2_subdev(entity);
for (i = 0; i < RVIN_CSI_MAX; i++) for (i = 0; i < RVIN_REMOTES_MAX; i++)
if (group->csi[i].subdev == sd) if (group->remotes[i].subdev == sd)
return i; return i;
return -ENODEV; return -ENODEV;
...@@ -163,14 +163,14 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags, ...@@ -163,14 +163,14 @@ static int rvin_group_link_notify(struct media_link *link, u32 flags,
if (!csi_pad) if (!csi_pad)
continue; continue;
csi_id = rvin_group_entity_to_csi_id(group, csi_pad->entity); csi_id = rvin_group_entity_to_remote_id(group, csi_pad->entity);
channel = rvin_group_csi_pad_to_channel(csi_pad->index); channel = rvin_group_csi_pad_to_channel(csi_pad->index);
mask &= rvin_group_get_mask(group->vin[i], csi_id, channel); mask &= rvin_group_get_mask(group->vin[i], csi_id, channel);
} }
/* 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_remote_id(group, link->source->entity);
if (csi_id == -ENODEV) { if (csi_id == -ENODEV) {
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
...@@ -766,10 +766,10 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier) ...@@ -766,10 +766,10 @@ static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier)
continue; continue;
/* Check that CSI-2 is part of the group. */ /* Check that CSI-2 is part of the group. */
if (!vin->group->csi[route->csi].subdev) if (!vin->group->remotes[route->csi].subdev)
continue; continue;
source = &vin->group->csi[route->csi].subdev->entity; source = &vin->group->remotes[route->csi].subdev->entity;
source_idx = rvin_group_csi_channel_to_pad(route->channel); source_idx = rvin_group_csi_channel_to_pad(route->channel);
source_pad = &source->pads[source_idx]; source_pad = &source->pads[source_idx];
...@@ -806,10 +806,10 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier, ...@@ -806,10 +806,10 @@ static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier,
mutex_lock(&vin->group->lock); mutex_lock(&vin->group->lock);
for (i = 0; i < RVIN_CSI_MAX; i++) { for (i = 0; i < RVIN_CSI_MAX; i++) {
if (vin->group->csi[i].asd != asd) if (vin->group->remotes[i].asd != asd)
continue; continue;
vin->group->csi[i].subdev = NULL; vin->group->remotes[i].subdev = NULL;
vin_dbg(vin, "Unbind CSI-2 %s from slot %u\n", subdev->name, i); vin_dbg(vin, "Unbind %s from slot %u\n", subdev->name, i);
break; break;
} }
...@@ -828,10 +828,10 @@ static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier, ...@@ -828,10 +828,10 @@ static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier,
mutex_lock(&vin->group->lock); mutex_lock(&vin->group->lock);
for (i = 0; i < RVIN_CSI_MAX; i++) { for (i = 0; i < RVIN_CSI_MAX; i++) {
if (vin->group->csi[i].asd != asd) if (vin->group->remotes[i].asd != asd)
continue; continue;
vin->group->csi[i].subdev = subdev; vin->group->remotes[i].subdev = subdev;
vin_dbg(vin, "Bound CSI-2 %s to slot %u\n", subdev->name, i); vin_dbg(vin, "Bound %s to slot %u\n", subdev->name, i);
break; break;
} }
...@@ -883,7 +883,7 @@ static int rvin_mc_parse_of(struct rvin_dev *vin, unsigned int id) ...@@ -883,7 +883,7 @@ static int rvin_mc_parse_of(struct rvin_dev *vin, unsigned int id)
goto out; goto out;
} }
vin->group->csi[vep.base.id].asd = asd; vin->group->remotes[vep.base.id].asd = asd;
vin_dbg(vin, "Add group OF device %pOF to slot %u\n", vin_dbg(vin, "Add group OF device %pOF to slot %u\n",
to_of_node(fwnode), vep.base.id); to_of_node(fwnode), vep.base.id);
...@@ -928,7 +928,7 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin) ...@@ -928,7 +928,7 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin)
continue; continue;
for (id = 0; id < RVIN_CSI_MAX; id++) { for (id = 0; id < RVIN_CSI_MAX; id++) {
if (vin->group->csi[id].asd) if (vin->group->remotes[id].asd)
continue; continue;
ret = rvin_mc_parse_of(vin->group->vin[i], id); ret = rvin_mc_parse_of(vin->group->vin[i], id);
......
...@@ -48,6 +48,8 @@ enum rvin_csi_id { ...@@ -48,6 +48,8 @@ enum rvin_csi_id {
RVIN_CSI_MAX, RVIN_CSI_MAX,
}; };
#define RVIN_REMOTES_MAX RVIN_CSI_MAX
/** /**
* enum rvin_dma_state - DMA states * enum rvin_dma_state - DMA states
* @STOPPED: No operation in progress * @STOPPED: No operation in progress
...@@ -267,8 +269,8 @@ struct rvin_dev { ...@@ -267,8 +269,8 @@ struct rvin_dev {
* @count: number of enabled VIN instances found in DT * @count: number of enabled VIN instances found in DT
* @notifier: group notifier for CSI-2 async subdevices * @notifier: group notifier for CSI-2 async subdevices
* @vin: VIN instances which are part of the group * @vin: VIN instances which are part of the group
* @csi: array of pairs of fwnode and subdev pointers * @remotes: array of pairs of fwnode and subdev pointers
* to all CSI-2 subdevices. * to all remote subdevices.
*/ */
struct rvin_group { struct rvin_group {
struct kref refcount; struct kref refcount;
...@@ -283,7 +285,7 @@ struct rvin_group { ...@@ -283,7 +285,7 @@ struct rvin_group {
struct { struct {
struct v4l2_async_subdev *asd; struct v4l2_async_subdev *asd;
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
} csi[RVIN_CSI_MAX]; } remotes[RVIN_REMOTES_MAX];
}; };
int rvin_dma_register(struct rvin_dev *vin, int irq); int rvin_dma_register(struct rvin_dev *vin, int irq);
......
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