Commit 05930cf1 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarBenoit Parrot <bparrot@ti.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 45dd15e6
...@@ -2408,6 +2408,15 @@ static int cal_probe(struct platform_device *pdev) ...@@ -2408,6 +2408,15 @@ static int cal_probe(struct platform_device *pdev)
if (ret) if (ret)
return 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. */ /* Create CAMERARX PHYs. */
for (i = 0; i < cal->data->num_csi2_phy; ++i) { for (i = 0; i < cal->data->num_csi2_phy; ++i) {
cal->phy[i] = cal_camerarx_create(cal, i); cal->phy[i] = cal_camerarx_create(cal, i);
...@@ -2445,25 +2454,13 @@ static int cal_probe(struct platform_device *pdev) ...@@ -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. */ /* Register the media device. */
ret = cal_media_register(cal); ret = cal_media_register(cal);
if (ret) if (ret)
goto error_pm_runtime; goto error_context;
return 0; return 0;
error_pm_runtime:
pm_runtime_disable(&pdev->dev);
error_context: error_context:
for (i = 0; i < ARRAY_SIZE(cal->ctx); i++) { for (i = 0; i < ARRAY_SIZE(cal->ctx); i++) {
ctx = cal->ctx[i]; ctx = cal->ctx[i];
...@@ -2477,6 +2474,9 @@ static int cal_probe(struct platform_device *pdev) ...@@ -2477,6 +2474,9 @@ static int cal_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(cal->phy); i++) for (i = 0; i < ARRAY_SIZE(cal->phy); i++)
cal_camerarx_destroy(cal->phy[i]); cal_camerarx_destroy(cal->phy[i]);
error_pm_runtime:
pm_runtime_disable(&pdev->dev);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment