Skip to contentSkip to conversation

media: sun4i-csi: Fix 'Unbalanced pm_runtime_enable!'

PATCH New Oleg Verych 2 participants 5 messages Jan 7, 2023 – Jan 16, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: sun4i-csi: Fix 'Unbalanced pm_runtime_enable!'

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

---

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(+)
drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c +1 -0
index 18e6c65f4..86c5235a0 100644
@@ -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);
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 media: sun4i-csi: Use CSI_INT_STA_REG name, fix typo in a comment

---
 drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c +2 -2
index a3e826a75..95b5633b7 100644
@@ -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);
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH] media: sun4i-csi: Use CSI_INT_STA_REG name, fix typo in a comment

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.

Quoted 26 lines
---
 drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c +2 -2
index a3e826a75..95b5633b7 100644
@@ -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);
Signature · 3 lines
Kind regards,

Sakari Ailus
#3 lore raw

PATCH 1/1 media: sun4i-csi: Use CSI_INT_STA_REG name, fix typo in a comment

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.

---
 drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c +2 -2
index a3e826a75..95b5633b7 100644
@@ -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);
Signature · 1 line
2.20.1
#4 lore raw

PATCH 1/1 doc sunxi: update CCU wiki page link in clocks.rst

In reply to Oleg Verych

Update wiki page link to the Allwinner sunXi SoC Clock Control Module.

---
Hi!

Can I ask additional question to those in the file?

How is it possible to setup PLL7 to particular frequency and select it as a source to CSI0 via CCM_CSI0_CLK[1]?

Is it possible to put such device tree example in documentation?

Thanks!

[1] https://linux-sunxi.org/Clock_Control_Module#CCM_CSI0_CLK

 Documentation/arm/sunxi/clocks.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/arm/sunxi/clocks.rst +1 -1
index 23bd03f3e..f435bdd70 100644
@@ -49,7 +49,7 @@ Q: Were can I learn more about the sunxi clocks?
 A: The linux-sunxi wiki contains a page documenting the clock registers,
    you can find it at
 
-        http://linux-sunxi.org/A10/CCM
+        https://linux-sunxi.org/Clock_Control_Module
 
    The authoritative source for information at this time is the ccmu driver
    released by Allwinner, you can find it at
Signature · 1 line
2.20.1