summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-08-03 12:33:31 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2023-08-14 21:27:56 +0300
commit83634470b0eee34e22d8703408a7808d430ee606 (patch)
tree2227cad07ddf7c86df890e1776baa5a2ddd51f60 /drivers/media
parent8e50a1221f89136e9a3c2bcff22c38b376b730cb (diff)
downloadlinux-83634470b0eee34e22d8703408a7808d430ee606.tar.xz
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: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/i2c/ov2680.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
index a8c257f3bcd6..d4664581b49b 100644
--- a/drivers/media/i2c/ov2680.c
+++ b/drivers/media/i2c/ov2680.c
@@ -717,11 +717,23 @@ static int ov2680_check_id(struct ov2680_dev *sensor)
static int ov2680_parse_dt(struct ov2680_dev *sensor)
{
struct device *dev = sensor->dev;
+ struct fwnode_handle *ep_fwnode;
struct gpio_desc *gpio;
unsigned int rate = 0;
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
* drivers have standardized on using "powerdown" as con-id name
* for powerdown or shutdown pins. Older DTB files use "reset",
@@ -801,7 +813,7 @@ static int ov2680_probe(struct i2c_client *client)
ret = ov2680_parse_dt(sensor);
if (ret < 0)
- return -EINVAL;
+ return ret;
ret = ov2680_mode_init(sensor);
if (ret < 0)