Commit 47913c1f authored by Hans de Goede's avatar Hans de Goede Committed by Hans Verkuil

media: ov2740: Move fwnode_graph_get_next_endpoint() call up

If the bridge has not yet setup the fwnode-graph then
the fwnode_property_read_u32("clock-frequency") call will fail.

Move the fwnode_graph_get_next_endpoint() call to above reading
the clock-frequency.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 846a37cf
...@@ -929,18 +929,26 @@ static int ov2740_check_hwcfg(struct device *dev) ...@@ -929,18 +929,26 @@ static int ov2740_check_hwcfg(struct device *dev)
int ret; int ret;
unsigned int i, j; unsigned int i, j;
/*
* Sometimes the fwnode graph is initialized by the bridge driver,
* wait for this.
*/
ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
if (!ep)
return -EPROBE_DEFER;
ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk); ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk);
if (ret) if (ret) {
fwnode_handle_put(ep);
return ret; return ret;
}
if (mclk != OV2740_MCLK) if (mclk != OV2740_MCLK) {
fwnode_handle_put(ep);
return dev_err_probe(dev, -EINVAL, return dev_err_probe(dev, -EINVAL,
"external clock %d is not supported\n", "external clock %d is not supported\n",
mclk); mclk);
}
ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
if (!ep)
return -EPROBE_DEFER;
ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg); ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
fwnode_handle_put(ep); fwnode_handle_put(ep);
......
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