From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: Naushir Patuck <naush@raspberrypi.com>,
Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>,
David Plowman <david.plowman@raspberrypi.com>,
Dave Stevenson <dave.stevenson@raspberrypi.com>,
Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans Verkuil <hverkuil@xs4all.nl>,
linux-media@vger.kernel.org,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v7 4/4] media: pisp_be: Fix pm_runtime underrun in probe
Date: Mon, 16 Jun 2025 17:17:56 +0300 [thread overview]
Message-ID: <20250616141756.GC32454@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250606-pispbe-mainline-split-jobs-handling-v6-v7-4-46169f0622b7@ideasonboard.com>
Hi Jacopo,
Thank you for the patch.
On Fri, Jun 06, 2025 at 12:29:24PM +0200, Jacopo Mondi wrote:
> 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: 12187bd5d4f8 ("media: raspberrypi: Add support for PiSP BE")
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
>
> --
>
> Cc: stable@vger.kernel.org
This should go just below the Fixes: tag.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> drivers/media/platform/raspberrypi/pisp_be/Kconfig | 1 +
> drivers/media/platform/raspberrypi/pisp_be/pisp_be.c | 5 ++---
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/raspberrypi/pisp_be/Kconfig b/drivers/media/platform/raspberrypi/pisp_be/Kconfig
> index 46765a2e4c4d..a9e51fd94aad 100644
> --- a/drivers/media/platform/raspberrypi/pisp_be/Kconfig
> +++ b/drivers/media/platform/raspberrypi/pisp_be/Kconfig
> @@ -3,6 +3,7 @@ config VIDEO_RASPBERRYPI_PISP_BE
> depends on V4L_PLATFORM_DRIVERS
> depends on VIDEO_DEV
> depends on ARCH_BCM2835 || COMPILE_TEST
> + depends on PM
> select VIDEO_V4L2_SUBDEV_API
> select MEDIA_CONTROLLER
> select VIDEOBUF2_DMA_CONTIG
> diff --git a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
> index c25f7d9b404c..e49e4cc322db 100644
> --- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
> +++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
> @@ -1718,7 +1718,7 @@ static int pispbe_probe(struct platform_device *pdev)
> pm_runtime_use_autosuspend(pispbe->dev);
> pm_runtime_enable(pispbe->dev);
>
> - ret = pispbe_runtime_resume(pispbe->dev);
> + ret = pm_runtime_resume_and_get(pispbe->dev);
> if (ret)
> goto pm_runtime_disable_err;
>
> @@ -1740,7 +1740,7 @@ static int pispbe_probe(struct platform_device *pdev)
> disable_devs_err:
> pispbe_destroy_devices(pispbe);
> pm_runtime_suspend_err:
> - pispbe_runtime_suspend(pispbe->dev);
> + pm_runtime_put(pispbe->dev);
> pm_runtime_disable_err:
> pm_runtime_dont_use_autosuspend(pispbe->dev);
> pm_runtime_disable(pispbe->dev);
> @@ -1754,7 +1754,6 @@ static void pispbe_remove(struct platform_device *pdev)
>
> pispbe_destroy_devices(pispbe);
>
> - pispbe_runtime_suspend(pispbe->dev);
> pm_runtime_dont_use_autosuspend(pispbe->dev);
> pm_runtime_disable(pispbe->dev);
> }
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2025-06-16 14:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-06 10:29 [PATCH v7 0/4] media: pisp-be: Split jobs creation and scheduling Jacopo Mondi
2025-06-06 10:29 ` [PATCH v7 1/4] media: pisp_be: Drop reference to non-existing function Jacopo Mondi
2025-06-13 8:00 ` Naushir Patuck
2025-06-06 10:29 ` [PATCH v7 2/4] media: pisp_be: Remove config validation from schedule() Jacopo Mondi
2025-06-13 8:31 ` Naushir Patuck
2025-06-06 10:29 ` [PATCH v7 3/4] media: pisp_be: Split jobs creation and scheduling Jacopo Mondi
2025-06-16 14:40 ` Laurent Pinchart
2025-06-17 12:32 ` Jacopo Mondi
2025-06-17 13:53 ` Laurent Pinchart
2025-06-17 14:06 ` Jacopo Mondi
2025-06-06 10:29 ` [PATCH v7 4/4] media: pisp_be: Fix pm_runtime underrun in probe Jacopo Mondi
2025-06-16 14:17 ` Laurent Pinchart [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250616141756.GC32454@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=david.plowman@raspberrypi.com \
--cc=florian.fainelli@broadcom.com \
--cc=hverkuil@xs4all.nl \
--cc=jacopo.mondi@ideasonboard.com \
--cc=kernel-list@raspberrypi.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=mchehab@kernel.org \
--cc=naush@raspberrypi.com \
--cc=nick.hollinghurst@raspberrypi.com \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®