mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
media: i2c: ov5675: Wait for endpoint
Defer probe if endpoint is not yet available. And do it before acquiring clock, gpio and regulators. Signed-off-by: Antti Laakso <antti.laakso@linux.intel.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
ebeec2b000
commit
c409dea36f
|
|
@ -1181,17 +1181,26 @@ static int ov5675_get_hwcfg(struct ov5675 *ov5675)
|
|||
if (!fwnode)
|
||||
return -ENXIO;
|
||||
|
||||
ep = fwnode_graph_get_endpoint_by_id(fwnode, 0, 0,
|
||||
FWNODE_GRAPH_ENDPOINT_NEXT);
|
||||
ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
|
||||
fwnode_handle_put(ep);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ov5675->xvclk = devm_v4l2_sensor_clk_get(dev, NULL);
|
||||
if (IS_ERR(ov5675->xvclk))
|
||||
return dev_err_probe(dev, PTR_ERR(ov5675->xvclk),
|
||||
"failed to get xvclk: %pe\n",
|
||||
ov5675->xvclk);
|
||||
if (IS_ERR(ov5675->xvclk)) {
|
||||
ret = dev_err_probe(dev, PTR_ERR(ov5675->xvclk),
|
||||
"failed to get xvclk\n");
|
||||
goto check_hwcfg_error;
|
||||
}
|
||||
|
||||
xvclk_rate = clk_get_rate(ov5675->xvclk);
|
||||
if (xvclk_rate != OV5675_XVCLK_19_2) {
|
||||
dev_err(dev, "external clock rate %u is unsupported",
|
||||
xvclk_rate);
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto check_hwcfg_error;
|
||||
}
|
||||
|
||||
ov5675->reset_gpio = devm_gpiod_get_optional(dev, "reset",
|
||||
|
|
@ -1199,7 +1208,7 @@ static int ov5675_get_hwcfg(struct ov5675 *ov5675)
|
|||
if (IS_ERR(ov5675->reset_gpio)) {
|
||||
ret = PTR_ERR(ov5675->reset_gpio);
|
||||
dev_err(dev, "failed to get reset-gpios: %d\n", ret);
|
||||
return ret;
|
||||
goto check_hwcfg_error;
|
||||
}
|
||||
|
||||
for (i = 0; i < OV5675_NUM_SUPPLIES; i++)
|
||||
|
|
@ -1208,16 +1217,7 @@ static int ov5675_get_hwcfg(struct ov5675 *ov5675)
|
|||
ret = devm_regulator_bulk_get(dev, OV5675_NUM_SUPPLIES,
|
||||
ov5675->supplies);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
|
||||
if (!ep)
|
||||
return -ENXIO;
|
||||
|
||||
ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
|
||||
fwnode_handle_put(ep);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto check_hwcfg_error;
|
||||
|
||||
if (bus_cfg.bus.mipi_csi2.num_data_lanes != OV5675_DATA_LANES) {
|
||||
dev_err(dev, "number of CSI2 data lanes %d is not supported",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user