[PATCH 2/2] media: ipu-bridge: Poll for IVSC CSI device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The MEI CSI device is created as MEI boots up. This often takes place
after the IPU6 driver probes, in which case the IPU6 driver returned
-EPROBE_DEFER. The MEI CSI driver also returns -EPROBE_DEFER if the
firmware nodes created by the IPU bridge (via IPU6 driver) aren't in
place.

If no other drivers are being probed after this point, neither IPU6 nor
MEI CSI drivers will be re-probed. Address this (hopefully temporarily) by
polling MEI CSI device in the IPU bridge initialisation.

Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
---
 drivers/media/pci/intel/ipu-bridge.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
index b2cf80d62ba2..45c39bd93d74 100644
--- a/drivers/media/pci/intel/ipu-bridge.c
+++ b/drivers/media/pci/intel/ipu-bridge.c
@@ -4,6 +4,7 @@
 #include <linux/acpi.h>
 #include <linux/device.h>
 #include <linux/i2c.h>
+#include <linux/iopoll.h>
 #include <linux/mei_cl_bus.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
@@ -138,17 +139,21 @@ static struct device *ipu_bridge_get_ivsc_csi_dev(struct acpi_device *adev)
 	/* IVSC device on platform bus */
 	dev = bus_find_device(&platform_bus_type, NULL, adev,
 			      ipu_bridge_match_ivsc_dev);
-	if (dev) {
-		snprintf(name, sizeof(name), "%s-%pUl", dev_name(dev), &uuid);
+	if (!dev)
+		return NULL;
 
-		csi_dev = device_find_child_by_name(dev, name);
+	snprintf(name, sizeof(name), "%s-%pUl", dev_name(dev), &uuid);
 
-		put_device(dev);
+	/*
+	 * FIXME: instantiate MEI CSI software nodes outside the IPU bridge (or
+	 * call IPU bridge from MEI CSI). Wait up to 60 seconds here.
+	 */
+	read_poll_timeout(device_find_child_by_name, csi_dev, csi_dev,
+			  20000, 60000000, false, dev, name);
 
-		return csi_dev;
-	}
+	put_device(dev);
 
-	return NULL;
+	return csi_dev;
 }
 
 static int ipu_bridge_check_ivsc_dev(struct ipu_sensor *sensor,
-- 
2.39.2





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux