Skip to content

Commit 3681d9a

Browse files
Jacopo Mondigregkh
authored andcommitted
media: pisp_be: Fix pm_runtime underrun in probe
commit e9bb2ea upstream. 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: stable@vger.kernel.org Tested-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ff9dd3d commit 3681d9a

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
@@ -3,6 +3,7 @@ config VIDEO_RASPBERRYPI_PISP_BE
33
depends on V4L_PLATFORM_DRIVERS
44
depends on VIDEO_DEV
55
depends on ARCH_BCM2835 || COMPILE_TEST
6+
depends on PM
67
select VIDEO_V4L2_SUBDEV_API
78
select MEDIA_CONTROLLER
89
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
@@ -1726,7 +1726,7 @@ static int pispbe_probe(struct platform_device *pdev)
17261726
pm_runtime_use_autosuspend(pispbe->dev);
17271727
pm_runtime_enable(pispbe->dev);
17281728

1729-
ret = pispbe_runtime_resume(pispbe->dev);
1729+
ret = pm_runtime_resume_and_get(pispbe->dev);
17301730
if (ret)
17311731
goto pm_runtime_disable_err;
17321732

@@ -1748,7 +1748,7 @@ static int pispbe_probe(struct platform_device *pdev)
17481748
disable_devs_err:
17491749
pispbe_destroy_devices(pispbe);
17501750
pm_runtime_suspend_err:
1751-
pispbe_runtime_suspend(pispbe->dev);
1751+
pm_runtime_put(pispbe->dev);
17521752
pm_runtime_disable_err:
17531753
pm_runtime_dont_use_autosuspend(pispbe->dev);
17541754
pm_runtime_disable(pispbe->dev);
@@ -1762,7 +1762,6 @@ static void pispbe_remove(struct platform_device *pdev)
17621762

17631763
pispbe_destroy_devices(pispbe);
17641764

1765-
pispbe_runtime_suspend(pispbe->dev);
17661765
pm_runtime_dont_use_autosuspend(pispbe->dev);
17671766
pm_runtime_disable(pispbe->dev);
17681767
}

0 commit comments

Comments
 (0)