Skip to content

Commit

Permalink
media: ti-vpe: cal: Read hardware revision earlier during probe
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pinchartl authored and sigmaris committed Aug 8, 2020
1 parent 7cfcc25 commit 186dfea
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions drivers/media/platform/ti-vpe/cal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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];
Expand All @@ -2477,6 +2474,9 @@ static int cal_probe(struct platform_device *pdev)
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;
}

Expand Down

0 comments on commit 186dfea

Please sign in to comment.