[PATCH] drm/panthor: Add defer probe for firmware load

Andy Yan andyshrk at 163.com
Sat Apr 13 11:49:38 UTC 2024


From: Andy Yan <andy.yan at rock-chips.com>

The firmware in the rootfs will not be accessible until we
are in the SYSTEM_RUNNING state, so return EPROBE_DEFER until
that point.
This let the driver can load firmware when it is builtin.

Signed-off-by: Andy Yan <andy.yan at rock-chips.com>
---

 drivers/gpu/drm/panthor/panthor_fw.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panthor/panthor_fw.c b/drivers/gpu/drm/panthor/panthor_fw.c
index 33c87a59834e..25e375f8333c 100644
--- a/drivers/gpu/drm/panthor/panthor_fw.c
+++ b/drivers/gpu/drm/panthor/panthor_fw.c
@@ -1336,8 +1336,17 @@ int panthor_fw_init(struct panthor_device *ptdev)
 	}
 
 	ret = panthor_fw_load(ptdev);
-	if (ret)
+	if (ret) {
+		/*
+		 * The firmware in the rootfs will not be accessible until we
+		 * are in the SYSTEM_RUNNING state, so return EPROBE_DEFER until
+		 * that point.
+		 */
+		if (system_state < SYSTEM_RUNNING)
+			ret = -EPROBE_DEFER;
+
 		goto err_unplug_fw;
+	}
 
 	ret = panthor_vm_active(fw->vm);
 	if (ret)
-- 
2.34.1



More information about the dri-devel mailing list