Skip to contentSkip to conversation

Aspeed: Enable video engine

PATCH Applied Eddie James 3 participants 7 messages Apr 24, 2019 – Apr 26, 2019

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

v2 cover Aspeed: Enable video engine

This series enables the video engine on Aspeed BMC platforms. The use of the video engine reset line, originally planned to be made externally available in the clock driver, is removed from the video engine driver. A node for the video engine is added to the AST2500 devicetree.
The series also includes a missing property for reserved memory in the devicetree documentation, and a small change to make the video engine driver start without reserved memory.

Changes since v1:
- Drop clock patch since it's been applied
- Add a missing semi-colon in the devicetree doc

Eddie James (4):
media: platform: Aspeed: Remove use of reset line
media: platform: Aspeed: Make reserved memory optional
media: dt-bindings: aspeed-video: Add missing memory-region property
ARM: dts: aspeed-g5: Add video engine

 .../devicetree/bindings/media/aspeed-video.txt     |  6 ++++
 arch/arm/boot/dts/aspeed-g5.dtsi                   | 10 +++++++
 drivers/media/platform/aspeed-video.c              | 33 ++++------------------
 3 files changed, 22 insertions(+), 27 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/4 media: platform: Aspeed: Remove use of reset line

The reset line is toggled by enabling the clocks, so it's not necessary to manually toggle the reset as well.

---
 drivers/media/platform/aspeed-video.c | 27 +++++----------------------
 1 file changed, 5 insertions(+), 22 deletions(-)
drivers/media/platform/aspeed-video.c +5 -22
index 692e08e..55c55a6 100644
@@ -14,7 +14,6 @@
 #include <linux/of_irq.h>
 #include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
-#include <linux/reset.h>
 #include <linux/sched.h>
 #include <linux/spinlock.h>
 #include <linux/string.h>
@@ -208,7 +207,6 @@ struct aspeed_video {
 	void __iomem *base;
 	struct clk *eclk;
 	struct clk *vclk;
-	struct reset_control *rst;
 
 	struct device *dev;
 	struct v4l2_ctrl_handler ctrl_handler;
@@ -483,19 +481,10 @@ static void aspeed_video_enable_mode_detect(struct aspeed_video *video)
 	aspeed_video_update(video, VE_SEQ_CTRL, 0, VE_SEQ_CTRL_TRIG_MODE_DET);
 }
 
-static void aspeed_video_reset(struct aspeed_video *video)
-{
-	/* Reset the engine */
-	reset_control_assert(video->rst);
-
-	/* Don't usleep here; function may be called in interrupt context */
-	udelay(100);
-	reset_control_deassert(video->rst);
-}
-
 static void aspeed_video_off(struct aspeed_video *video)
 {
-	aspeed_video_reset(video);
+	/* Disable interrupts */
+	aspeed_video_write(video, VE_INTERRUPT_CTRL, 0);
 
 	/* Turn off the relevant clocks */
 	clk_disable_unprepare(video->vclk);
@@ -507,8 +496,6 @@ static void aspeed_video_on(struct aspeed_video *video)
 	/* Turn on the relevant clocks */
 	clk_prepare_enable(video->eclk);
 	clk_prepare_enable(video->vclk);
-
-	aspeed_video_reset(video);
 }
 
 static void aspeed_video_bufs_done(struct aspeed_video *video,
@@ -1464,7 +1451,9 @@ static void aspeed_video_stop_streaming(struct vb2_queue *q)
 		 * Need to force stop any DMA and try and get HW into a good
 		 * state for future calls to start streaming again.
 		 */
-		aspeed_video_reset(video);
+		aspeed_video_off(video);
+		aspeed_video_on(video);
+
 		aspeed_video_init_regs(video);
 
 		aspeed_video_get_resolution(video);
@@ -1619,12 +1608,6 @@ static int aspeed_video_init(struct aspeed_video *video)
 		return PTR_ERR(video->vclk);
 	}
 
-	video->rst = devm_reset_control_get_exclusive(dev, NULL);
-	if (IS_ERR(video->rst)) {
-		dev_err(dev, "Unable to get VE reset\n");
-		return PTR_ERR(video->rst);
-	}
-
 	rc = of_reserved_mem_device_init(dev);
 	if (rc) {
 		dev_err(dev, "Unable to reserve memory\n");
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v2 2/4 media: platform: Aspeed: Make reserved memory optional

In reply to Eddie James

Reserved memory doesn't need to be required; system memory would work fine.

---
 drivers/media/platform/aspeed-video.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/media/platform/aspeed-video.c +1 -5
index 55c55a6..8144fe3 100644
@@ -1608,11 +1608,7 @@ static int aspeed_video_init(struct aspeed_video *video)
 		return PTR_ERR(video->vclk);
 	}
 
-	rc = of_reserved_mem_device_init(dev);
-	if (rc) {
-		dev_err(dev, "Unable to reserve memory\n");
-		return rc;
-	}
+	of_reserved_mem_device_init(dev);
 
 	rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
 	if (rc) {
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH v2 3/4 media: dt-bindings: aspeed-video: Add missing memory-region property

In reply to Eddie James

Missed documenting this property in the initial commit.

---
Changes since v1:
- Add missing semi-colon

 Documentation/devicetree/bindings/media/aspeed-video.txt | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/media/aspeed-video.txt +6 -0
index 78b464a..ce28945 100644
@@ -14,6 +14,11 @@ Required properties:
 			the VE
  - interrupts:		the interrupt associated with the VE on this platform
 
+Optional properties:
+ - memory-region:
+	phandle to a memory region to allocate from, as defined in
+	Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
+
 Example:
 
 video-engine at 1e700000 {
@@ -23,4 +28,5 @@ video-engine at 1e700000 {
     clock-names = "vclk", "eclk";
     resets = <&syscon ASPEED_RESET_VIDEO>;
     interrupts = <7>;
+    memory-region = <&video_engine_memory>;
 };
Signature · 1 line
1.8.3.1
maintainer
#4 lore raw

Re: [PATCH v2 3/4] media: dt-bindings: aspeed-video: Add missing memory-region property

Quoted 10 lines · Eddie James

Missed documenting this property in the initial commit.

---
Changes since v1:
- Add missing semi-colon

 Documentation/devicetree/bindings/media/aspeed-video.txt | 6 ++++++
 1 file changed, 6 insertions(+)

Please add Acked-by/Reviewed-by tags when posting new versions. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for acks received on the version they apply.

If a tag was not added on purpose, please state why and what changed.

#5 lore raw

Re: [PATCH v2 3/4] media: dt-bindings: aspeed-video: Add missing memory-region property

Quoted 12 lines · Rob Herring
Quoted 10 lines · Eddie James

Missed documenting this property in the initial commit.

---
Changes since v1:
- Add missing semi-colon

 Documentation/devicetree/bindings/media/aspeed-video.txt | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 6 lines

Please add Acked-by/Reviewed-by tags when posting new versions. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for acks received on the version they apply.

If a tag was not added on purpose, please state why and what changed.

I noticed the same when I was processing this patch. I've added back your 'Reviewed-by' tag.

So there is no need to repost, Eddie. Just remember this for the next time :-)

Regards,

Hans

#6 lore raw

Re: [PATCH v2 3/4] media: dt-bindings: aspeed-video: Add missing memory-region property

In reply to Rob Herring
Quoted 8 lines · Rob Herring
Quoted 7 lines · Eddie James

Missed documenting this property in the initial commit.

---
Changes since v1:
- Add missing semi-colon

Quoted 8 lines
Quoted 3 lines
  Documentation/devicetree/bindings/media/aspeed-video.txt | 6 ++++++
  1 file changed, 6 insertions(+)

Please add Acked-by/Reviewed-by tags when posting new versions. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for acks received on the version they apply.

If a tag was not added on purpose, please state why and what changed.

Yes, I left it off because I added a semi-colon (trivial, I know, but it did change). The change log is there below the commit message.

Thanks,

Eddie

Quoted 1 line