Skip to contentSkip to conversation

Add AST2600 Video Engine support

PATCH New Jae Hyun Yoo 3 participants 9 messages Jan 7, 2020 – Jan 8, 2020

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

cover Add AST2600 Video Engine support

Video engine in AST2600 has the exactly same register set with AST2500 except VR084 register which provides more precise JPEG size read back. This patch set adds Video Engine node and driver support for AST2600.

Please review it.

Thanks,

Jae

Jae Hyun Yoo (3):
ARM: dts: aspeed-g6: Add Video Engine node
Documentation: dt-bindings: media: add AST2600 Video Engine support
media: aspeed: add AST2600 support

 .../devicetree/bindings/media/aspeed-video.txt    |  5 +++--
 arch/arm/boot/dts/aspeed-g6.dtsi                  | 10 ++++++++++
 drivers/media/platform/aspeed-video.c             | 15 +++++++++++----
 3 files changed, 24 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 ARM: dts: aspeed-g6: Add Video Engine node

The AST2600 has Video Engine so add it.

---
 arch/arm/boot/dts/aspeed-g6.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/aspeed-g6.dtsi +10 -0
index 5f6142d99eeb..89833987e270 100644
@@ -297,6 +297,16 @@
 				quality = <100>;
 			};
 
+			video: video@1e700000 {
+				compatible = "aspeed,ast2600-video-engine";
+				reg = <0x1e700000 0x1000>;
+				clocks = <&syscon ASPEED_CLK_GATE_VCLK>,
+					 <&syscon ASPEED_CLK_GATE_ECLK>;
+				clock-names = "vclk", "eclk";
+				interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+				status = "disabled";
+			};
+
 			gpio0: gpio@1e780000 {
 				#gpio-cells = <2>;
 				gpio-controller;
Signature · 1 line
2.17.1
maintainer
#2 lore raw

PATCH 1/3 ARM: dts: aspeed-g6: Add Video Engine node

Quoted 4 lines · Jae Hyun Yoo

The AST2600 has Video Engine so add it.

I will merge this through the aspeed tree for 5.6.

Cheers,

Joel

Quoted 28 lines
---
 arch/arm/boot/dts/aspeed-g6.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/aspeed-g6.dtsi +10 -1
index 5f6142d99eeb..89833987e270 100644
@@ -297,6 +297,16 @@
                                quality = <100>;
                        };
 
+                       video: video at 1e700000 {
+                               compatible = "aspeed,ast2600-video-engine";
+                               reg = <0x1e700000 0x1000>;
+                               clocks = <&syscon ASPEED_CLK_GATE_VCLK>,
+                                        <&syscon ASPEED_CLK_GATE_ECLK>;
+                               clock-names = "vclk", "eclk";
+                               interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+                               status = "disabled";
+                       };
+
                        gpio0: gpio at 1e780000 {
                                #gpio-cells = <2>;
                                gpio-controller;
--

2.17.1

#3 lore raw

PATCH 2/3 Documentation: dt-bindings: media: add AST2600 Video Engine support

In reply to Jae Hyun Yoo

The AST2600 has Video Engine so add the compatible string into the document.

---
 Documentation/devicetree/bindings/media/aspeed-video.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/media/aspeed-video.txt +3 -2
index ce2894506e1f..d2ca32512272 100644
@@ -1,11 +1,12 @@
 * Device tree bindings for Aspeed Video Engine
 
-The Video Engine (VE) embedded in the Aspeed AST2400 and AST2500 SOCs can
+The Video Engine (VE) embedded in the Aspeed AST2400/2500/2600 SOCs can
 capture and compress video data from digital or analog sources.
 
 Required properties:
  - compatible:		"aspeed,ast2400-video-engine" or
-			"aspeed,ast2500-video-engine"
+			"aspeed,ast2500-video-engine" or
+			"aspeed,ast2600-video-engine"
  - reg:			contains the offset and length of the VE memory region
  - clocks:		clock specifiers for the syscon clocks associated with
 			the VE (ordering must match the clock-names property)
Signature · 1 line
2.17.1
#6 lore raw

PATCH 3/3 media: aspeed: add AST2600 support

In reply to Jae Hyun Yoo

Video engine in AST2600 has the exactly same register set with AST2500 except VR084 register which provides more precise JPEG size read back. This commit adds support for the difference and adds 'aspeed,ast2600-video-engine' compatible OF string.

---
 drivers/media/platform/aspeed-video.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/platform/aspeed-video.c +11 -4
index d8593cb2ae84..0dbe72672338 100644
@@ -72,10 +72,10 @@
 #define  VE_SEQ_CTRL_CAP_BUSY		BIT(16)
 #define  VE_SEQ_CTRL_COMP_BUSY		BIT(18)
 
-#ifdef CONFIG_MACH_ASPEED_G5
-#define  VE_SEQ_CTRL_JPEG_MODE		BIT(13)	/* AST2500 */
-#else
+#ifdef CONFIG_MACH_ASPEED_G4
 #define  VE_SEQ_CTRL_JPEG_MODE		BIT(8)	/* AST2400 */
+#else
+#define  VE_SEQ_CTRL_JPEG_MODE		BIT(13)	/* AST2500/2600 */
 #endif /* CONFIG_MACH_ASPEED_G5 */
 
 #define VE_CTRL				0x008
@@ -135,6 +135,12 @@
 
 #define VE_OFFSET_COMP_STREAM		0x078
 
+#ifdef CONFIG_MACH_ASPEED_G6
+#define VE_JPEG_COMP_SIZE_READ_BACK	0x084	/* AST2600 */
+#else
+#define VE_JPEG_COMP_SIZE_READ_BACK	VE_OFFSET_COMP_STREAM
+#endif
+
 #define VE_SRC_LR_EDGE_DET		0x090
 #define  VE_SRC_LR_EDGE_DET_LEFT	GENMASK(11, 0)
 #define  VE_SRC_LR_EDGE_DET_NO_V	BIT(12)
@@ -572,7 +578,7 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg)
 	if (sts & VE_INTERRUPT_COMP_COMPLETE) {
 		struct aspeed_video_buffer *buf;
 		u32 frame_size = aspeed_video_read(video,
-						   VE_OFFSET_COMP_STREAM);
+						   VE_JPEG_COMP_SIZE_READ_BACK);
 
 		spin_lock(&video->lock);
 		clear_bit(VIDEO_FRAME_INPRG, &video->flags);
@@ -1719,6 +1725,7 @@ static int aspeed_video_remove(struct platform_device *pdev)
 static const struct of_device_id aspeed_video_of_match[] = {
 	{ .compatible = "aspeed,ast2400-video-engine" },
 	{ .compatible = "aspeed,ast2500-video-engine" },
+	{ .compatible = "aspeed,ast2600-video-engine" },
 	{}
 };
 MODULE_DEVICE_TABLE(of, aspeed_video_of_match);
Signature · 1 line
2.17.1
maintainer
#7 lore raw

PATCH 3/3 media: aspeed: add AST2600 support

Quoted 17 lines · Jae Hyun Yoo

Video engine in AST2600 has the exactly same register set with AST2500 except VR084 register which provides more precise JPEG size read back. This commit adds support for the difference and adds 'aspeed,ast2600-video-engine' compatible OF string.

---
 drivers/media/platform/aspeed-video.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/platform/aspeed-video.c +0 -0
index d8593cb2ae84..0dbe72672338 100644
@@ -72,10 +72,10 @@
 #define  VE_SEQ_CTRL_CAP_BUSY          BIT(16)

drivers/media/platform/aspeed-video.c line 79

Quoted 10 lines
drivers/media/platform/aspeed-video.c +3 -3
 #define  VE_SEQ_CTRL_COMP_BUSY         BIT(18)
 
-#ifdef CONFIG_MACH_ASPEED_G5
-#define  VE_SEQ_CTRL_JPEG_MODE         BIT(13) /* AST2500 */
-#else
+#ifdef CONFIG_MACH_ASPEED_G4
 #define  VE_SEQ_CTRL_JPEG_MODE         BIT(8)  /* AST2400 */
+#else
+#define  VE_SEQ_CTRL_JPEG_MODE         BIT(13) /* AST2500/2600 */
 #endif /* CONFIG_MACH_ASPEED_G5 */

Yeah, nah. This should have never been done this way. I will send some patches to fix it up, and you can add ast2600 support on top of them, if that works for you.

Cheers,

Joel

Quoted 35 lines
drivers/media/platform/aspeed-video.c +8 -2
 #define VE_CTRL                                0x008
@@ -135,6 +135,12 @@
 
 #define VE_OFFSET_COMP_STREAM          0x078
 
+#ifdef CONFIG_MACH_ASPEED_G6
+#define VE_JPEG_COMP_SIZE_READ_BACK    0x084   /* AST2600 */
+#else
+#define VE_JPEG_COMP_SIZE_READ_BACK    VE_OFFSET_COMP_STREAM
+#endif
+
 #define VE_SRC_LR_EDGE_DET             0x090
 #define  VE_SRC_LR_EDGE_DET_LEFT       GENMASK(11, 0)
 #define  VE_SRC_LR_EDGE_DET_NO_V       BIT(12)
@@ -572,7 +578,7 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg)
        if (sts & VE_INTERRUPT_COMP_COMPLETE) {
                struct aspeed_video_buffer *buf;
                u32 frame_size = aspeed_video_read(video,
-                                                  VE_OFFSET_COMP_STREAM);
+                                                  VE_JPEG_COMP_SIZE_READ_BACK);
 
                spin_lock(&video->lock);
                clear_bit(VIDEO_FRAME_INPRG, &video->flags);
@@ -1719,6 +1725,7 @@ static int aspeed_video_remove(struct platform_device *pdev)
 static const struct of_device_id aspeed_video_of_match[] = {
        { .compatible = "aspeed,ast2400-video-engine" },
        { .compatible = "aspeed,ast2500-video-engine" },
+       { .compatible = "aspeed,ast2600-video-engine" },
        {}
 };
 MODULE_DEVICE_TABLE(of, aspeed_video_of_match);
--

2.17.1

#8 lore raw

PATCH 3/3 media: aspeed: add AST2600 support

Quoted 20 lines · Joel Stanley
Quoted 19 lines · Jae Hyun Yoo

Video engine in AST2600 has the exactly same register set with AST2500 except VR084 register which provides more precise JPEG size read back. This commit adds support for the difference and adds 'aspeed,ast2600-video-engine' compatible OF string.

---
  drivers/media/platform/aspeed-video.c | 15 +++++++++++----
  1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/platform/aspeed-video.c +0 -0
index d8593cb2ae84..0dbe72672338 100644
@@ -72,10 +72,10 @@
  #define  VE_SEQ_CTRL_CAP_BUSY          BIT(16)
  #define  VE_SEQ_CTRL_COMP_BUSY         BIT(18)
 
Quoted 12 lines

drivers/media/platform/aspeed-video.c line 79

Quoted 8 lines
drivers/media/platform/aspeed-video.c +3 -3
-#ifdef CONFIG_MACH_ASPEED_G5
-#define  VE_SEQ_CTRL_JPEG_MODE         BIT(13) /* AST2500 */
-#else
+#ifdef CONFIG_MACH_ASPEED_G4
  #define  VE_SEQ_CTRL_JPEG_MODE         BIT(8)  /* AST2400 */
+#else
+#define  VE_SEQ_CTRL_JPEG_MODE         BIT(13) /* AST2500/2600 */
  #endif /* CONFIG_MACH_ASPEED_G5 */

Yeah, nah. This should have never been done this way. I will send some patches to fix it up, and you can add ast2600 support on top of them, if that works for you.

Yeah, the runtime configuration in your patch set is right way for it. I'll rebase this patch set on top of your patch.

Thanks,

Jae

Quoted 39 lines

Cheers,

Joel

Quoted 35 lines
drivers/media/platform/aspeed-video.c +8 -2
  #define VE_CTRL                                0x008
@@ -135,6 +135,12 @@
 
  #define VE_OFFSET_COMP_STREAM          0x078
 
+#ifdef CONFIG_MACH_ASPEED_G6
+#define VE_JPEG_COMP_SIZE_READ_BACK    0x084   /* AST2600 */
+#else
+#define VE_JPEG_COMP_SIZE_READ_BACK    VE_OFFSET_COMP_STREAM
+#endif
+
  #define VE_SRC_LR_EDGE_DET             0x090
  #define  VE_SRC_LR_EDGE_DET_LEFT       GENMASK(11, 0)
  #define  VE_SRC_LR_EDGE_DET_NO_V       BIT(12)
@@ -572,7 +578,7 @@ static irqreturn_t aspeed_video_irq(int irq, void *arg)
         if (sts & VE_INTERRUPT_COMP_COMPLETE) {
                 struct aspeed_video_buffer *buf;
                 u32 frame_size = aspeed_video_read(video,
-                                                  VE_OFFSET_COMP_STREAM);
+                                                  VE_JPEG_COMP_SIZE_READ_BACK);
 
                 spin_lock(&video->lock);
                 clear_bit(VIDEO_FRAME_INPRG, &video->flags);
@@ -1719,6 +1725,7 @@ static int aspeed_video_remove(struct platform_device *pdev)
  static const struct of_device_id aspeed_video_of_match[] = {
         { .compatible = "aspeed,ast2400-video-engine" },
         { .compatible = "aspeed,ast2500-video-engine" },
+       { .compatible = "aspeed,ast2600-video-engine" },
         {}
  };
  MODULE_DEVICE_TABLE(of, aspeed_video_of_match);
--

2.17.1