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

media: rcar-vin: Rework CSI-2 firmware parsing

Rework the CSI-2 firmware parsing code to not use the soon to be
removed v4l2_async_notifier_parse_fwnode_endpoints_by_port() helper. The
change only aims to prepare for the removing of the old helper and there
are no functional change.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 497d574d
...@@ -812,37 +812,48 @@ static const struct v4l2_async_notifier_operations rvin_group_notify_ops = { ...@@ -812,37 +812,48 @@ static const struct v4l2_async_notifier_operations rvin_group_notify_ops = {
.complete = rvin_group_notify_complete, .complete = rvin_group_notify_complete,
}; };
static int rvin_mc_parse_of_endpoint(struct device *dev, static int rvin_mc_parse_of(struct rvin_dev *vin, unsigned int id)
struct v4l2_fwnode_endpoint *vep,
struct v4l2_async_subdev *asd)
{ {
struct rvin_dev *vin = dev_get_drvdata(dev); struct fwnode_handle *ep, *fwnode;
int ret = 0; struct v4l2_fwnode_endpoint vep = {
.bus_type = V4L2_MBUS_CSI2_DPHY,
};
struct v4l2_async_subdev *asd;
int ret;
if (vep->base.port != 1 || vep->base.id >= RVIN_CSI_MAX) ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(vin->dev), 1, id, 0);
return -EINVAL; if (!ep)
return 0;
if (!of_device_is_available(to_of_node(asd->match.fwnode))) { fwnode = fwnode_graph_get_remote_endpoint(ep);
vin_dbg(vin, "OF device %pOF disabled, ignoring\n", ret = v4l2_fwnode_endpoint_parse(ep, &vep);
to_of_node(asd->match.fwnode)); fwnode_handle_put(ep);
return -ENOTCONN; if (ret) {
vin_err(vin, "Failed to parse %pOF\n", to_of_node(fwnode));
ret = -EINVAL;
goto out;
} }
mutex_lock(&vin->group->lock); if (!of_device_is_available(to_of_node(fwnode))) {
vin_dbg(vin, "OF device %pOF disabled, ignoring\n",
if (vin->group->csi[vep->base.id].asd) { to_of_node(fwnode));
vin_dbg(vin, "OF device %pOF already handled\n",
to_of_node(asd->match.fwnode));
ret = -ENOTCONN; ret = -ENOTCONN;
goto out; goto out;
} }
vin->group->csi[vep->base.id].asd = asd; asd = v4l2_async_notifier_add_fwnode_subdev(&vin->group->notifier,
fwnode, sizeof(*asd));
if (IS_ERR(asd)) {
ret = PTR_ERR(asd);
goto out;
}
vin->group->csi[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(asd->match.fwnode), vep->base.id); to_of_node(fwnode), vep.base.id);
out: out:
mutex_unlock(&vin->group->lock); fwnode_handle_put(fwnode);
return ret; return ret;
} }
...@@ -850,7 +861,7 @@ static int rvin_mc_parse_of_endpoint(struct device *dev, ...@@ -850,7 +861,7 @@ static int rvin_mc_parse_of_endpoint(struct device *dev,
static int rvin_mc_parse_of_graph(struct rvin_dev *vin) static int rvin_mc_parse_of_graph(struct rvin_dev *vin)
{ {
unsigned int count = 0, vin_mask = 0; unsigned int count = 0, vin_mask = 0;
unsigned int i; unsigned int i, id;
int ret; int ret;
mutex_lock(&vin->group->lock); mutex_lock(&vin->group->lock);
...@@ -881,12 +892,14 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin) ...@@ -881,12 +892,14 @@ static int rvin_mc_parse_of_graph(struct rvin_dev *vin)
if (!(vin_mask & BIT(i))) if (!(vin_mask & BIT(i)))
continue; continue;
ret = v4l2_async_notifier_parse_fwnode_endpoints_by_port( for (id = 0; id < RVIN_CSI_MAX; id++) {
vin->group->vin[i]->dev, &vin->group->notifier, if (vin->group->csi[id].asd)
sizeof(struct v4l2_async_subdev), 1, continue;
rvin_mc_parse_of_endpoint);
if (ret) ret = rvin_mc_parse_of(vin->group->vin[i], id);
return ret; if (ret)
return ret;
}
} }
if (list_empty(&vin->group->notifier.asd_list)) if (list_empty(&vin->group->notifier.asd_list))
......
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