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

From: Andy Yan
Date: Sat Apr 13 2024 - 07:50:55 EST


From: Andy Yan <andy.yan@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
---

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