Skip to content

Commit 1f2322f

Browse files
author
Jacopo Mondi
committed
media: pisp_be: Fix pm_runtime underrun in probe
During the probe() routine, the PiSP BE driver needs to power up the interface in order to identify and initialize the hardware. The driver resumes the interface by calling the pispbe_runtime_resume() function directly, without going through the pm_runtime helpers, but later suspends it by calling pm_runtime_put_autosuspend(). This causes a PM usage count imbalance at probe time, notified by the runtime_pm framework with the below message in the system log: pispbe 1000880000.pisp_be: Runtime PM usage count underflow! Fix this by resuming the interface using the pm runtime helpers instead of calling the resume function directly and use the pm_runtime framework in the probe() error path. While at it, remove manual suspend of the interface in the remove() function. The driver cannot be unloaded if in use, so simply disable runtime pm. To simplify the implementation, make the driver depend on PM as the RPI5 platform where the ISP is integrated in uses the PM framework by default. Fixes: 12187bd ("media: raspberrypi: Add support for PiSP BE") Cc: [email protected] Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Jacopo Mondi <[email protected]>
1 parent 9751b58 commit 1f2322f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/media/platform/raspberrypi/pisp_be/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ config VIDEO_RASPBERRYPI_PISP_BE
22
tristate "Raspberry Pi PiSP Backend (BE) ISP driver"
33
depends on V4L_PLATFORM_DRIVERS
44
depends on VIDEO_DEV
5+
depends on PM
56
select VIDEO_V4L2_SUBDEV_API
67
select MEDIA_CONTROLLER
78
select VIDEOBUF2_DMA_CONTIG

drivers/media/platform/raspberrypi/pisp_be/pisp_be.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,7 @@ static int pispbe_probe(struct platform_device *pdev)
17761776
pm_runtime_use_autosuspend(pispbe->dev);
17771777
pm_runtime_enable(pispbe->dev);
17781778

1779-
ret = pispbe_runtime_resume(pispbe->dev);
1779+
ret = pm_runtime_resume_and_get(pispbe->dev);
17801780
if (ret)
17811781
goto pm_runtime_disable_err;
17821782

@@ -1807,7 +1807,7 @@ static int pispbe_probe(struct platform_device *pdev)
18071807
while (num_groups-- > 0)
18081808
pispbe_destroy_node_group(&pispbe->node_group[num_groups]);
18091809
pm_runtime_suspend_err:
1810-
pispbe_runtime_suspend(pispbe->dev);
1810+
pm_runtime_put(pispbe->dev);
18111811
pm_runtime_disable_err:
18121812
pm_runtime_dont_use_autosuspend(pispbe->dev);
18131813
pm_runtime_disable(pispbe->dev);
@@ -1822,7 +1822,6 @@ static int pispbe_remove(struct platform_device *pdev)
18221822
for (int i = PISPBE_NUM_NODE_GROUPS - 1; i >= 0; i--)
18231823
pispbe_destroy_node_group(&pispbe->node_group[i]);
18241824

1825-
pispbe_runtime_suspend(pispbe->dev);
18261825
pm_runtime_dont_use_autosuspend(pispbe->dev);
18271826
pm_runtime_disable(pispbe->dev);
18281827

0 commit comments

Comments
 (0)