linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: sun4i-csi: Fix 'Unbalanced pm_runtime_enable!'
@ 2023-01-07  8:37 Oleg Verych
  2023-01-09 20:24 ` [PATCH] media: sun4i-csi: Use CSI_INT_STA_REG name, fix typo in a comment Oleg Verych
  0 siblings, 1 reply; 4+ messages in thread
From: Oleg Verych @ 2023-01-07  8:37 UTC (permalink / raw)
  To: open list:ARM/Allwinner sunXi SoC support
  Cc: Oleg Verych, Maxime Ripard, Mauro Carvalho Chehab,
	open list:ALLWINNER A10 CSI DRIVER

When removing the module, balance PM runtime enable with
the corresponding disable call.

Signed-off-by: Oleg Verych <olecom@gmail.com>
---

dmesg:
```
[   32.570802] i2c-core: driver [ov5640] registered
[   32.585345] sun4i-csi 1c09000.csi: Device registered as video0
[  396.520467] random: crng init done
[ 1603.050944] ov5640 2-003c: remove
[ 1603.051878] i2c-core: driver [ov5640] unregistered
...
[ 1603.108832] i2c-core: driver [ov5640] registered
[ 1603.119400] sun4i-csi 1c09000.csi: Device registered as video0
[ 1603.119984] sun4i-csi 1c09000.csi: Unbalanced pm_runtime_enable!
```

 drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
index 18e6c65f4..86c5235a0 100644
--- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
+++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c
@@ -264,6 +264,7 @@ static int sun4i_csi_remove(struct platform_device *pdev)
 {
 	struct sun4i_csi *csi = platform_get_drvdata(pdev);
 
+	pm_runtime_disable(&pdev->dev);
 	v4l2_async_nf_unregister(&csi->notifier);
 	v4l2_async_nf_cleanup(&csi->notifier);
 	vb2_video_unregister_device(&csi->vdev);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] media: sun4i-csi: Use CSI_INT_STA_REG name, fix typo in a comment
  2023-01-07  8:37 [PATCH] media: sun4i-csi: Fix 'Unbalanced pm_runtime_enable!' Oleg Verych
@ 2023-01-09 20:24 ` Oleg Verych
  2023-01-16 19:07   ` Sakari Ailus
  0 siblings, 1 reply; 4+ messages in thread
From: Oleg Verych @ 2023-01-09 20:24 UTC (permalink / raw)
  To: open list:ARM/Allwinner sunXi SoC support
  Cc: Oleg Verych, Maxime Ripard, Mauro Carvalho Chehab,
	open list:ALLWINNER A10 CSI DRIVER, linux-sunxi

---
 drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c
index a3e826a75..95b5633b7 100644
--- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c
+++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c
@@ -245,7 +245,7 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count)
 	 * We need a scratch buffer in case where we'll not have any
 	 * more buffer queued so that we don't error out. One of those
 	 * cases is when you end up at the last frame to capture, you
-	 * don't havea any buffer queued any more, and yet it doesn't
+	 * don't have any buffer queued any more, and yet it doesn't
 	 * really matter since you'll never reach the next buffer.
 	 *
 	 * Since we support the multi-planar API, we need to have a
@@ -311,7 +311,7 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count)
 	writel(CSI_BUF_CTRL_DBE, csi->regs + CSI_BUF_CTRL_REG);
 
 	/* Clear the pending interrupts */
-	writel(CSI_INT_FRM_DONE, csi->regs + 0x34);
+	writel(CSI_INT_FRM_DONE, csi->regs + CSI_INT_STA_REG);
 
 	/* Enable frame done interrupt */
 	writel(CSI_INT_FRM_DONE, csi->regs + CSI_INT_EN_REG);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] media: sun4i-csi: Use CSI_INT_STA_REG name, fix typo in a comment
  2023-01-09 20:24 ` [PATCH] media: sun4i-csi: Use CSI_INT_STA_REG name, fix typo in a comment Oleg Verych
@ 2023-01-16 19:07   ` Sakari Ailus
  2023-01-16 23:03     ` Oleg Verych
  0 siblings, 1 reply; 4+ messages in thread
From: Sakari Ailus @ 2023-01-16 19:07 UTC (permalink / raw)
  To: Oleg Verych
  Cc: open list:ARM/Allwinner sunXi SoC support, Maxime Ripard,
	Mauro Carvalho Chehab, open list:ALLWINNER A10 CSI DRIVER,
	linux-sunxi

Hi Oleg,

On Mon, Jan 09, 2023 at 11:24:56PM +0300, Oleg Verych wrote:

Please add a more elaborate description of the patch here. Looks good
otherwise.

> ---
>  drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c
> index a3e826a75..95b5633b7 100644
> --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c
> +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c
> @@ -245,7 +245,7 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count)
>  	 * We need a scratch buffer in case where we'll not have any
>  	 * more buffer queued so that we don't error out. One of those
>  	 * cases is when you end up at the last frame to capture, you
> -	 * don't havea any buffer queued any more, and yet it doesn't
> +	 * don't have any buffer queued any more, and yet it doesn't
>  	 * really matter since you'll never reach the next buffer.
>  	 *
>  	 * Since we support the multi-planar API, we need to have a
> @@ -311,7 +311,7 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count)
>  	writel(CSI_BUF_CTRL_DBE, csi->regs + CSI_BUF_CTRL_REG);
>  
>  	/* Clear the pending interrupts */
> -	writel(CSI_INT_FRM_DONE, csi->regs + 0x34);
> +	writel(CSI_INT_FRM_DONE, csi->regs + CSI_INT_STA_REG);
>  
>  	/* Enable frame done interrupt */
>  	writel(CSI_INT_FRM_DONE, csi->regs + CSI_INT_EN_REG);

-- 
Kind regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] media: sun4i-csi: Use CSI_INT_STA_REG name, fix typo in a comment
  2023-01-16 19:07   ` Sakari Ailus
@ 2023-01-16 23:03     ` Oleg Verych
  0 siblings, 0 replies; 4+ messages in thread
From: Oleg Verych @ 2023-01-16 23:03 UTC (permalink / raw)
  To: open list:ARM/Allwinner sunXi SoC support
  Cc: Oleg Verych, Maxime Ripard, Mauro Carvalho Chehab, Sakari Ailus,
	open list:ALLWINNER A10 CSI DRIVER, linux-sunxi

Fix interrupt status register offset usage to be a defined name
CSI_INT_STA_REG (= 0x34) instead of a plain number.

Additionally fix a typo in a comment of the same file.

Signed-off-by: Oleg Verych <olecom@gmail.com>

---
 drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c
index a3e826a75..95b5633b7 100644
--- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c
+++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c
@@ -245,7 +245,7 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count)
 	 * We need a scratch buffer in case where we'll not have any
 	 * more buffer queued so that we don't error out. One of those
 	 * cases is when you end up at the last frame to capture, you
-	 * don't havea any buffer queued any more, and yet it doesn't
+	 * don't have any buffer queued any more, and yet it doesn't
 	 * really matter since you'll never reach the next buffer.
 	 *
 	 * Since we support the multi-planar API, we need to have a
@@ -311,7 +311,7 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count)
 	writel(CSI_BUF_CTRL_DBE, csi->regs + CSI_BUF_CTRL_REG);
 
 	/* Clear the pending interrupts */
-	writel(CSI_INT_FRM_DONE, csi->regs + 0x34);
+	writel(CSI_INT_FRM_DONE, csi->regs + CSI_INT_STA_REG);
 
 	/* Enable frame done interrupt */
 	writel(CSI_INT_FRM_DONE, csi->regs + CSI_INT_EN_REG);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-16 23:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07  8:37 [PATCH] media: sun4i-csi: Fix 'Unbalanced pm_runtime_enable!' Oleg Verych
2023-01-09 20:24 ` [PATCH] media: sun4i-csi: Use CSI_INT_STA_REG name, fix typo in a comment Oleg Verych
2023-01-16 19:07   ` Sakari Ailus
2023-01-16 23:03     ` Oleg Verych

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).