Commit 83634470 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: ov2680: Wait for endpoint fwnode before continuing with probe()

Defer probe() until the endpoint fwnode is available. This is necessary
on ACPI platforms where the bridge code creating the fwnodes may also e.g.
set the "clock-frequency" device property and add GPIO mappings.
Acked-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: default avatarDaniel Scally <dan.scally@ideasonboard.com>
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 avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 8e50a122
...@@ -717,10 +717,22 @@ static int ov2680_check_id(struct ov2680_dev *sensor) ...@@ -717,10 +717,22 @@ static int ov2680_check_id(struct ov2680_dev *sensor)
static int ov2680_parse_dt(struct ov2680_dev *sensor) static int ov2680_parse_dt(struct ov2680_dev *sensor)
{ {
struct device *dev = sensor->dev; struct device *dev = sensor->dev;
struct fwnode_handle *ep_fwnode;
struct gpio_desc *gpio; struct gpio_desc *gpio;
unsigned int rate = 0; unsigned int rate = 0;
int i, ret; int i, ret;
/*
* Sometimes the fwnode graph is initialized by the bridge driver.
* Bridge drivers doing this may also add GPIO mappings, wait for this.
*/
ep_fwnode = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL);
if (!ep_fwnode)
return dev_err_probe(dev, -EPROBE_DEFER,
"waiting for fwnode graph endpoint\n");
fwnode_handle_put(ep_fwnode);
/* /*
* The pin we want is named XSHUTDN in the datasheet. Linux sensor * The pin we want is named XSHUTDN in the datasheet. Linux sensor
* drivers have standardized on using "powerdown" as con-id name * drivers have standardized on using "powerdown" as con-id name
...@@ -801,7 +813,7 @@ static int ov2680_probe(struct i2c_client *client) ...@@ -801,7 +813,7 @@ static int ov2680_probe(struct i2c_client *client)
ret = ov2680_parse_dt(sensor); ret = ov2680_parse_dt(sensor);
if (ret < 0) if (ret < 0)
return -EINVAL; return ret;
ret = ov2680_mode_init(sensor); ret = ov2680_mode_init(sensor);
if (ret < 0) if (ret < 0)
......
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