aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <[email protected]>2020-07-06 20:36:31 +0200
committerMauro Carvalho Chehab <[email protected]>2020-07-19 10:33:03 +0200
commit05930cf1e5c5d7d526e492cfe0f0bb3116bc29de (patch)
tree6d75c40b6ada7434cdd1a7fe6a8f4ac3af012076
parent45dd15e6ce2241da7d3f08b86b680d8b7d3dcd67 (diff)
media: ti-vpe: cal: Read hardware revision earlier during probe
Read the hardware revision and info right after allocating resources, as there's no need to delay doing so until all initialization is complete. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
-rw-r--r--drivers/media/platform/ti-vpe/cal.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index 340cbf385d42..fca591a94aca 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -2408,6 +2408,15 @@ static int cal_probe(struct platform_device *pdev)
if (ret)
return ret;
+ /* Read the revision and hardware info to verify hardware access. */
+ pm_runtime_enable(&pdev->dev);
+ ret = pm_runtime_get_sync(&pdev->dev);
+ if (ret)
+ goto error_pm_runtime;
+
+ cal_get_hwinfo(cal);
+ pm_runtime_put_sync(&pdev->dev);
+
/* Create CAMERARX PHYs. */
for (i = 0; i < cal->data->num_csi2_phy; ++i) {
cal->phy[i] = cal_camerarx_create(cal, i);
@@ -2445,25 +2454,13 @@ static int cal_probe(struct platform_device *pdev)
}
}
- /* Read the revision and hardware info to verify hardware access. */
- pm_runtime_enable(&pdev->dev);
- ret = pm_runtime_get_sync(&pdev->dev);
- if (ret)
- goto error_pm_runtime;
-
- cal_get_hwinfo(cal);
- pm_runtime_put_sync(&pdev->dev);
-
/* Register the media device. */
ret = cal_media_register(cal);
if (ret)
- goto error_pm_runtime;
+ goto error_context;
return 0;
-error_pm_runtime:
- pm_runtime_disable(&pdev->dev);
-
error_context:
for (i = 0; i < ARRAY_SIZE(cal->ctx); i++) {
ctx = cal->ctx[i];
@@ -2477,6 +2474,9 @@ error_camerarx:
for (i = 0; i < ARRAY_SIZE(cal->phy); i++)
cal_camerarx_destroy(cal->phy[i]);
+error_pm_runtime:
+ pm_runtime_disable(&pdev->dev);
+
return ret;
}