Skip to contentSkip to conversation

media: platform: Add Aspeed Video Engine driver

RFC In review Eddie James 2 participants 6 messages Aug 7, 2018 – Aug 16, 2018

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

cover media: platform: Add Aspeed Video Engine driver

The Video Engine (VE) embedded in the Aspeed AST2400 and AST2500 SOCs can capture and compress video data from digital or analog sources. With the Aspeed chip acting a service processor, the Video Engine can capture the host processor graphics output.

This series fixes the Aspeed video engine clocking and adds the V4L2 driver for the video engine. The driver triggers the hardware to automatically capture the host graphics output and compress it to JPEGs.

Eddie James (3):
clock: aspeed: Setup video engine clocking
dt-bindings: media: Add Aspeed Video Engine binding documentation
media: platform: Add Aspeed Video Engine driver

 .../devicetree/bindings/media/aspeed-video.txt     |   25 +
 drivers/clk/clk-aspeed.c                           |   61 +-
 drivers/media/platform/Kconfig                     |    8 +
 drivers/media/platform/Makefile                    |    1 +
 drivers/media/platform/aspeed-video-jpeg.h         |  122 ++
 drivers/media/platform/aspeed-video.c              | 1289 ++++++++++++++++++++
 include/dt-bindings/clock/aspeed-clock.h           |    1 +
 7 files changed, 1506 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/media/aspeed-video.txt
 create mode 100644 drivers/media/platform/aspeed-video-jpeg.h
 create mode 100644 drivers/media/platform/aspeed-video.c
Signature · 1 line
1.8.3.1
#1 lore raw

RFC 1/3 clock: aspeed: Setup video engine clocking

Add the video engine reset bit and add the eclk clock divider table. The eclk can be muxed, but for the sake of simplicity, force the eclk source to be the mpll clock.

---
 drivers/clk/clk-aspeed.c                 | 61 +++++++++++++++++++++++++++++++-
 include/dt-bindings/clock/aspeed-clock.h |  1 +
 2 files changed, 61 insertions(+), 1 deletion(-)
drivers/clk/clk-aspeed.c +60 -1
index 8796b8a..c1a64ae 100644
@@ -20,6 +20,7 @@
 
 #define ASPEED_RESET_CTRL	0x04
 #define ASPEED_CLK_SELECTION	0x08
+#define  ASPEED_CLK_SEL_VE	GENMASK(3, 2)
 #define ASPEED_CLK_STOP_CTRL	0x0c
 #define ASPEED_MPLL_PARAM	0x20
 #define ASPEED_HPLL_PARAM	0x24
@@ -87,7 +88,7 @@ struct aspeed_clk_gate {
 /* TODO: ask Aspeed about the actual parent data */
 static const struct aspeed_gate_data aspeed_gates[] = {
 	/*				 clk rst   name			parent	flags */
-	[ASPEED_CLK_GATE_ECLK] =	{  0, -1, "eclk-gate",		"eclk",	0 }, /* Video Engine */
+	[ASPEED_CLK_GATE_ECLK] =	{  0,  6, "eclk-gate",		"eclk",	0 }, /* Video Engine */
 	[ASPEED_CLK_GATE_GCLK] =	{  1,  7, "gclk-gate",		NULL,	0 }, /* 2D engine */
 	[ASPEED_CLK_GATE_MCLK] =	{  2, -1, "mclk-gate",		"mpll",	CLK_IS_CRITICAL }, /* SDRAM */
 	[ASPEED_CLK_GATE_VCLK] =	{  3,  6, "vclk-gate",		NULL,	0 }, /* Video Capture */
@@ -113,6 +114,18 @@ struct aspeed_clk_gate {
 	[ASPEED_CLK_GATE_LHCCLK] =	{ 28, -1, "lhclk-gate",		"lhclk", 0 }, /* LPC master/LPC+ */
 };
 
+static const struct clk_div_table ast2500_eclk_div_table[] = {
+	{ 0x0, 2 },
+	{ 0x1, 2 },
+	{ 0x2, 3 },
+	{ 0x3, 4 },
+	{ 0x4, 5 },
+	{ 0x5, 6 },
+	{ 0x6, 7 },
+	{ 0x7, 8 },
+	{ 0 }
+};
+
 static const struct clk_div_table ast2500_mac_div_table[] = {
 	{ 0x0, 4 }, /* Yep, really. Aspeed confirmed this is correct */
 	{ 0x1, 4 },
@@ -192,18 +205,21 @@ static struct clk_hw *aspeed_ast2500_calc_pll(const char *name, u32 val)
 
 struct aspeed_clk_soc_data {
 	const struct clk_div_table *div_table;
+	const struct clk_div_table *eclk_div_table;
 	const struct clk_div_table *mac_div_table;
 	struct clk_hw *(*calc_pll)(const char *name, u32 val);
 };
 
 static const struct aspeed_clk_soc_data ast2500_data = {
 	.div_table = ast2500_div_table,
+	.eclk_div_table = ast2500_eclk_div_table,
 	.mac_div_table = ast2500_mac_div_table,
 	.calc_pll = aspeed_ast2500_calc_pll,
 };
 
 static const struct aspeed_clk_soc_data ast2400_data = {
 	.div_table = ast2400_div_table,
+	.eclk_div_table = ast2400_div_table,
 	.mac_div_table = ast2400_div_table,
 	.calc_pll = aspeed_ast2400_calc_pll,
 };
@@ -317,6 +333,7 @@ struct aspeed_reset {
 	[ASPEED_RESET_PECI]	= 10,
 	[ASPEED_RESET_I2C]	=  2,
 	[ASPEED_RESET_AHB]	=  1,
+	[ASPEED_RESET_VIDEO]	=  6,
 
 	/*
 	 * SCUD4 resets start at an offset to separate them from
@@ -522,6 +539,48 @@ static int aspeed_clk_probe(struct platform_device *pdev)
 		return PTR_ERR(hw);
 	aspeed_clk_data->hws[ASPEED_CLK_24M] = hw;
 
+	/* Video Engine (ECLK) clock divider (ignore mux; set parent MPLL) */
+	regmap_read(map, ASPEED_CLK_SELECTION, &val);
+	if (val & ASPEED_CLK_SEL_VE) {
+		/* ECLK clock select isn't MPLL; reset to MPLL */
+		u32 clk = BIT(aspeed_gates[ASPEED_CLK_GATE_ECLK].clock_idx);
+		u32 rst = BIT(aspeed_gates[ASPEED_CLK_GATE_ECLK].reset_idx);
+		u32 stop;
+
+		dev_info(dev, "setting eclk mux to mpll\n");
+
+		/* Put Video Engine in reset */
+		regmap_update_bits(map, ASPEED_RESET_CTRL, rst, rst);
+		udelay(100);
+
+		/* Stop the clock if it's running */
+		regmap_read(map, ASPEED_CLK_STOP_CTRL, &stop);
+		if (!(stop & clk))
+			regmap_update_bits(map, ASPEED_CLK_STOP_CTRL, clk,
+					   clk);
+
+		/* Set clock select to MPLL */
+		regmap_update_bits(map, ASPEED_CLK_SELECTION,
+				   ASPEED_VE_CLK_SEL, 0);
+
+		/* Start the clock if it was originally running */
+		if (!(stop & clk)) {
+			regmap_update_bits(map, ASPEED_CLK_STOP_CTRL, clk, 0);
+			mdelay(10);
+		}
+
+		/* Take Video Engine out of reset */
+		regmap_update_bits(map, ASPEED_RESET_CTRL, rst, 0);
+	}
+
+	hw = clk_hw_register_divider_table(dev, "eclk", "mpll", 0,
+			scu_base + ASPEED_CLK_SELECTION, 28, 3, 0,
+			soc_data->eclk_div_table,
+			&aspeed_clk_lock);
+	if (IS_ERR(hw))
+		return PTR_ERR(hw);
+	aspeed_clk_data->hws[ASPEED_CLK_ECLK] = hw;
+
 	/*
 	 * TODO: There are a number of clocks that not included in this driver
 	 * as more information is required:
include/dt-bindings/clock/aspeed-clock.h +1 -0
index 4476184..f1813db 100644
@@ -50,5 +50,6 @@
 #define ASPEED_RESET_I2C		7
 #define ASPEED_RESET_AHB		8
 #define ASPEED_RESET_CRT1		9
+#define ASPEED_RESET_VIDEO		10
 
 #endif
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [RFC 1/3] clock: aspeed: Setup video engine clocking

Quoted 113 lines · Eddie James

Add the video engine reset bit and add the eclk clock divider table. The eclk can be muxed, but for the sake of simplicity, force the eclk source to be the mpll clock.

---
 drivers/clk/clk-aspeed.c                 | 61 +++++++++++++++++++++++++++++++-
 include/dt-bindings/clock/aspeed-clock.h |  1 +
 2 files changed, 61 insertions(+), 1 deletion(-)
drivers/clk/clk-aspeed.c +1 -1
index 8796b8a..c1a64ae 100644
@@ -20,6 +20,7 @@
 
 #define ASPEED_RESET_CTRL	0x04
 #define ASPEED_CLK_SELECTION	0x08
+#define  ASPEED_CLK_SEL_VE	GENMASK(3, 2)
 #define ASPEED_CLK_STOP_CTRL	0x0c
 #define ASPEED_MPLL_PARAM	0x20
 #define ASPEED_HPLL_PARAM	0x24
@@ -87,7 +88,7 @@ struct aspeed_clk_gate {
 /* TODO: ask Aspeed about the actual parent data */
 static const struct aspeed_gate_data aspeed_gates[] = {
 	/*				 clk rst   name			parent	flags */
-	[ASPEED_CLK_GATE_ECLK] =	{  0, -1, "eclk-gate",		"eclk",	0 }, /* Video 

Engine */

drivers/clk/clk-aspeed.c +1 -0
+	[ASPEED_CLK_GATE_ECLK] =	{  0,  6, "eclk-gate",		"eclk",	0 }, /* Video 

Engine */

drivers/clk/clk-aspeed.c +0 -0
 	[ASPEED_CLK_GATE_GCLK] =	{  1,  7, "gclk-gate",		NULL,	0 }, /* 2D engine */
 	[ASPEED_CLK_GATE_MCLK] =	{  2, -1, "mclk-gate",		"mpll",	

CLK_IS_CRITICAL }, /* SDRAM */
[ASPEED_CLK_GATE_VCLK] = { 3, 6, "vclk-gate", NULL, 0 }, /* Video
Capture */

drivers/clk/clk-aspeed.c +0 -0
@@ -113,6 +114,18 @@ struct aspeed_clk_gate {
 	[ASPEED_CLK_GATE_LHCCLK] =	{ 28, -1, "lhclk-gate",		"lhclk", 0 }, /* LPC 

master/LPC+ */
};

drivers/clk/clk-aspeed.c +15 -0
+static const struct clk_div_table ast2500_eclk_div_table[] = {
+	{ 0x0, 2 },
+	{ 0x1, 2 },
+	{ 0x2, 3 },
+	{ 0x3, 4 },
+	{ 0x4, 5 },
+	{ 0x5, 6 },
+	{ 0x6, 7 },
+	{ 0x7, 8 },
+	{ 0 }
+};
+
 static const struct clk_div_table ast2500_mac_div_table[] = {
 	{ 0x0, 4 }, /* Yep, really. Aspeed confirmed this is correct */
 	{ 0x1, 4 },
@@ -192,18 +205,21 @@ static struct clk_hw 
 *aspeed_ast2500_calc_pll(const char *name, u32 val)
 
 struct aspeed_clk_soc_data {
 	const struct clk_div_table *div_table;
+	const struct clk_div_table *eclk_div_table;
 	const struct clk_div_table *mac_div_table;
 	struct clk_hw *(*calc_pll)(const char *name, u32 val);
 };
 
 static const struct aspeed_clk_soc_data ast2500_data = {
 	.div_table = ast2500_div_table,
+	.eclk_div_table = ast2500_eclk_div_table,
 	.mac_div_table = ast2500_mac_div_table,
 	.calc_pll = aspeed_ast2500_calc_pll,
 };
 
 static const struct aspeed_clk_soc_data ast2400_data = {
 	.div_table = ast2400_div_table,
+	.eclk_div_table = ast2400_div_table,
 	.mac_div_table = ast2400_div_table,
 	.calc_pll = aspeed_ast2400_calc_pll,

};

drivers/clk/clk-aspeed.c +24 -0
@@ -317,6 +333,7 @@ struct aspeed_reset {
 	[ASPEED_RESET_PECI]	= 10,
 	[ASPEED_RESET_I2C]	=  2,
 	[ASPEED_RESET_AHB]	=  1,
+	[ASPEED_RESET_VIDEO]	=  6,
 
 	/*
 	 * SCUD4 resets start at an offset to separate them from
@@ -522,6 +539,48 @@ static int aspeed_clk_probe(struct platform_device *pdev)
 		return PTR_ERR(hw);
 	aspeed_clk_data->hws[ASPEED_CLK_24M] = hw;
 
+	/* Video Engine (ECLK) clock divider (ignore mux; set parent MPLL) */
+	regmap_read(map, ASPEED_CLK_SELECTION, &val);
+	if (val & ASPEED_CLK_SEL_VE) {
+		/* ECLK clock select isn't MPLL; reset to MPLL */
+		u32 clk = BIT(aspeed_gates[ASPEED_CLK_GATE_ECLK].clock_idx);
+		u32 rst = BIT(aspeed_gates[ASPEED_CLK_GATE_ECLK].reset_idx);
+		u32 stop;
+
+		dev_info(dev, "setting eclk mux to mpll\n");
+
+		/* Put Video Engine in reset */
+		regmap_update_bits(map, ASPEED_RESET_CTRL, rst, rst);
+		udelay(100);
+
+		/* Stop the clock if it's running */
+		regmap_read(map, ASPEED_CLK_STOP_CTRL, &stop);
+		if (!(stop & clk))
+			regmap_update_bits(map, ASPEED_CLK_STOP_CTRL, clk,
+					   clk);
+
+		/* Set clock select to MPLL */
+		regmap_update_bits(map, ASPEED_CLK_SELECTION,
+				   ASPEED_VE_CLK_SEL, 0);

drivers/clk/clk-aspeed.c static int aspeed_clk_probe(struct platform_device *pdev) · line 574

Quoted 10 lines
drivers/clk/clk-aspeed.c +10 -0
+
+		/* Start the clock if it was originally running */
+		if (!(stop & clk)) {
+			regmap_update_bits(map, ASPEED_CLK_STOP_CTRL, clk, 0);
+			mdelay(10);
+		}
+
+		/* Take Video Engine out of reset */
+		regmap_update_bits(map, ASPEED_RESET_CTRL, rst, 0);
+	}

This seems like a bit of hack? Shouldn't we describe the clock tree including the mux and let it sort itself out?

Quoted 27 lines
drivers/clk/clk-aspeed.c +9 -0
+
+	hw = clk_hw_register_divider_table(dev, "eclk", "mpll", 0,
+			scu_base + ASPEED_CLK_SELECTION, 28, 3, 0,
+			soc_data->eclk_div_table,
+			&aspeed_clk_lock);
+	if (IS_ERR(hw))
+		return PTR_ERR(hw);
+	aspeed_clk_data->hws[ASPEED_CLK_ECLK] = hw;
+
 	/*
 	 * TODO: There are a number of clocks that not included in this driver
 	 * as more information is required:
include/dt- renamed from include/dt-bindings/clock/aspeed-clock.h +0 -0

bindings/clock/aspeed-clock.h
index 4476184..f1813db 100644

include/dt-bindings/clock/aspeed-clock.h +1 -0
@@ -50,5 +50,6 @@
 #define ASPEED_RESET_I2C		7
 #define ASPEED_RESET_AHB		8
 #define ASPEED_RESET_CRT1		9
+#define ASPEED_RESET_VIDEO		10
 
 #endif
Signature · 1 line
1.8.3.1
#3 lore raw

Re: [RFC 1/3] clock: aspeed: Setup video engine clocking

Quoted 118 lines · Andrew Jeffery
Quoted 117 lines · Eddie James

Add the video engine reset bit and add the eclk clock divider table. The eclk can be muxed, but for the sake of simplicity, force the eclk source to be the mpll clock.

---
  drivers/clk/clk-aspeed.c                 | 61 +++++++++++++++++++++++++++++++-
  include/dt-bindings/clock/aspeed-clock.h |  1 +
  2 files changed, 61 insertions(+), 1 deletion(-)
drivers/clk/clk-aspeed.c +1 -1
index 8796b8a..c1a64ae 100644
@@ -20,6 +20,7 @@
 
  #define ASPEED_RESET_CTRL	0x04
  #define ASPEED_CLK_SELECTION	0x08
+#define  ASPEED_CLK_SEL_VE	GENMASK(3, 2)
  #define ASPEED_CLK_STOP_CTRL	0x0c
  #define ASPEED_MPLL_PARAM	0x20
  #define ASPEED_HPLL_PARAM	0x24
@@ -87,7 +88,7 @@ struct aspeed_clk_gate {
  /* TODO: ask Aspeed about the actual parent data */
  static const struct aspeed_gate_data aspeed_gates[] = {
  	/*				 clk rst   name			parent	flags */
-	[ASPEED_CLK_GATE_ECLK] =	{  0, -1, "eclk-gate",		"eclk",	0 }, /* Video

Engine */

drivers/clk/clk-aspeed.c +1 -0
+	[ASPEED_CLK_GATE_ECLK] =	{  0,  6, "eclk-gate",		"eclk",	0 }, /* Video

Engine */
[ASPEED_CLK_GATE_GCLK] = { 1, 7, "gclk-gate", NULL, 0 }, /* 2D engine */
[ASPEED_CLK_GATE_MCLK] = { 2, -1, "mclk-gate", "mpll",
CLK_IS_CRITICAL }, /* SDRAM */
[ASPEED_CLK_GATE_VCLK] = { 3, 6, "vclk-gate", NULL, 0 }, /* Video
Capture */

drivers/clk/clk-aspeed.c +0 -0
@@ -113,6 +114,18 @@ struct aspeed_clk_gate {
  	[ASPEED_CLK_GATE_LHCCLK] =	{ 28, -1, "lhclk-gate",		"lhclk", 0 }, /* LPC

master/LPC+ */
};

drivers/clk/clk-aspeed.c +15 -0
+static const struct clk_div_table ast2500_eclk_div_table[] = {
+	{ 0x0, 2 },
+	{ 0x1, 2 },
+	{ 0x2, 3 },
+	{ 0x3, 4 },
+	{ 0x4, 5 },
+	{ 0x5, 6 },
+	{ 0x6, 7 },
+	{ 0x7, 8 },
+	{ 0 }
+};
+
  static const struct clk_div_table ast2500_mac_div_table[] = {
  	{ 0x0, 4 }, /* Yep, really. Aspeed confirmed this is correct */
  	{ 0x1, 4 },
@@ -192,18 +205,21 @@ static struct clk_hw
 *aspeed_ast2500_calc_pll(const char *name, u32 val)
 
  struct aspeed_clk_soc_data {
  	const struct clk_div_table *div_table;
+	const struct clk_div_table *eclk_div_table;
  	const struct clk_div_table *mac_div_table;
  	struct clk_hw *(*calc_pll)(const char *name, u32 val);
  };
 
  static const struct aspeed_clk_soc_data ast2500_data = {
  	.div_table = ast2500_div_table,
+	.eclk_div_table = ast2500_eclk_div_table,
  	.mac_div_table = ast2500_mac_div_table,
  	.calc_pll = aspeed_ast2500_calc_pll,
  };
 
  static const struct aspeed_clk_soc_data ast2400_data = {
  	.div_table = ast2400_div_table,
+	.eclk_div_table = ast2400_div_table,
  	.mac_div_table = ast2400_div_table,
  	.calc_pll = aspeed_ast2400_calc_pll,
  };
drivers/clk/clk-aspeed.c +28 -0
@@ -317,6 +333,7 @@ struct aspeed_reset {
  	[ASPEED_RESET_PECI]	= 10,
  	[ASPEED_RESET_I2C]	=  2,
  	[ASPEED_RESET_AHB]	=  1,
+	[ASPEED_RESET_VIDEO]	=  6,
 
  	/*
  	 * SCUD4 resets start at an offset to separate them from
@@ -522,6 +539,48 @@ static int aspeed_clk_probe(struct platform_device *pdev)
  		return PTR_ERR(hw);
  	aspeed_clk_data->hws[ASPEED_CLK_24M] = hw;
 
+	/* Video Engine (ECLK) clock divider (ignore mux; set parent MPLL) */
+	regmap_read(map, ASPEED_CLK_SELECTION, &val);
+	if (val & ASPEED_CLK_SEL_VE) {
+		/* ECLK clock select isn't MPLL; reset to MPLL */
+		u32 clk = BIT(aspeed_gates[ASPEED_CLK_GATE_ECLK].clock_idx);
+		u32 rst = BIT(aspeed_gates[ASPEED_CLK_GATE_ECLK].reset_idx);
+		u32 stop;
+
+		dev_info(dev, "setting eclk mux to mpll\n");
+
+		/* Put Video Engine in reset */
+		regmap_update_bits(map, ASPEED_RESET_CTRL, rst, rst);
+		udelay(100);
+
+		/* Stop the clock if it's running */
+		regmap_read(map, ASPEED_CLK_STOP_CTRL, &stop);
+		if (!(stop & clk))
+			regmap_update_bits(map, ASPEED_CLK_STOP_CTRL, clk,
+					   clk);
+
+		/* Set clock select to MPLL */
+		regmap_update_bits(map, ASPEED_CLK_SELECTION,
+				   ASPEED_VE_CLK_SEL, 0);
+
+		/* Start the clock if it was originally running */
+		if (!(stop & clk)) {
+			regmap_update_bits(map, ASPEED_CLK_STOP_CTRL, clk, 0);
Quoted 8 lines

drivers/clk/clk-aspeed.c static int aspeed_clk_probe(struct platform_device *pdev) · line 574

Quoted 6 lines
drivers/clk/clk-aspeed.c +6 -0
+			mdelay(10);
+		}
+
+		/* Take Video Engine out of reset */
+		regmap_update_bits(map, ASPEED_RESET_CTRL, rst, 0);
+	}

This seems like a bit of hack? Shouldn't we describe the clock tree including the mux and let it sort itself out?

Yes. I literally couldn't figure out how to do that... any help would be great :D

Thanks,
Eddie

Quoted 28 lines
Quoted 28 lines
drivers/clk/clk-aspeed.c +9 -0
+
+	hw = clk_hw_register_divider_table(dev, "eclk", "mpll", 0,
+			scu_base + ASPEED_CLK_SELECTION, 28, 3, 0,
+			soc_data->eclk_div_table,
+			&aspeed_clk_lock);
+	if (IS_ERR(hw))
+		return PTR_ERR(hw);
+	aspeed_clk_data->hws[ASPEED_CLK_ECLK] = hw;
+
  	/*
  	 * TODO: There are a number of clocks that not included in this driver
  	 * as more information is required:
include/dt- renamed from include/dt-bindings/clock/aspeed-clock.h +0 -0

bindings/clock/aspeed-clock.h
index 4476184..f1813db 100644

include/dt-bindings/clock/aspeed-clock.h +1 -0
@@ -50,5 +50,6 @@
  #define ASPEED_RESET_I2C		7
  #define ASPEED_RESET_AHB		8
  #define ASPEED_RESET_CRT1		9
+#define ASPEED_RESET_VIDEO		10
 
  #endif
Signature · 1 line
1.8.3.1
#4 lore raw

RFC 2/3 dt-bindings: media: Add Aspeed Video Engine binding documentation

In reply to Eddie James

Document the bindings.

---
 .../devicetree/bindings/media/aspeed-video.txt     | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/aspeed-video.txt
Documentation/devicetree/bindings/media/aspeed-video.txt new file +25 -0
new file mode 100644
index 0000000..91a494e
@@ -0,0 +1,25 @@
+* Device tree bindings for Aspeed Video Engine
+
+The Video Engine (VE) embedded in the Aspeed AST2400 and AST2500 SOCs can
+capture and compress video data from digital or analog sources.
+
+Required properties:
+ - compatible:		"aspeed,ast2400-video" or "aspeed,ast2500-video"
+ - reg:			contains the offset and length of the VE memory region
+ - clocks:		pointers to the the "vclk" and "eclk" of the syscon
+ - clock-names:		"vclk-gate", "eclk-gate"
+ - resets:		pointer to the VE reset of the syscon
+ - interrupts:		the interrupt associated with the VE on this platform
+ - reg-scu:		pointer to the syscon itself
+
+Example:
+
+video: video@1e700000 {
+        compatible = "aspeed,ast2500-video";
+        reg = <0x1e700000 0x20000>;
+        clocks = <&syscon ASPEED_CLK_GATE_VCLK>, <&syscon ASPEED_CLK_GATE_ECLK>;
+        clock-names = "vclk-gate", "eclk-gate";
+        resets = <&syscon ASPEED_RESET_VIDEO>;
+        interrupts = <7>;
+        reg-scu = <&syscon>;
+};
Signature · 1 line
1.8.3.1
#5 lore raw

RFC 3/3 media: platform: Add Aspeed Video Engine driver

In reply to Eddie James

The Video Engine (VE) embedded in the Aspeed AST2400 and AST2500 SOCs can capture and compress video data from digital or analog sources. With the Aspeed chip acting a service processor, the Video Engine can capture the host processor graphics output.

Add a V4L2 driver to capture video data and compress it to JPEG images, making the data available through a standard read interface.

---
 drivers/media/platform/Kconfig             |    8 +
 drivers/media/platform/Makefile            |    1 +
 drivers/media/platform/aspeed-video-jpeg.h |  122 +++
 drivers/media/platform/aspeed-video.c      | 1289 ++++++++++++++++++++++++++++
 4 files changed, 1420 insertions(+)
 create mode 100644 drivers/media/platform/aspeed-video-jpeg.h
 create mode 100644 drivers/media/platform/aspeed-video.c
drivers/media/platform/Kconfig +8 -0
index c7a1cf8..3faa830 100644
@@ -31,6 +31,14 @@ source "drivers/media/platform/davinci/Kconfig"
 
 source "drivers/media/platform/omap/Kconfig"
 
+config VIDEO_ASPEED
+	tristate "Aspeed AST2400 and AST2500 Video Engine driver"
+	depends on VIDEO_V4L2
+	help
+	  Support for the Aspeed Video Engine (VE) embedded in the Aspeed
+	  AST2400 and AST2500 SOCs. The VE can capture and compress video data
+	  from digital or analog sources.
+
 config VIDEO_SH_VOU
 	tristate "SuperH VOU video output driver"
 	depends on MEDIA_CAMERA_SUPPORT
drivers/media/platform/Makefile +1 -0
index 932515d..f6fe523 100644
@@ -3,6 +3,7 @@
 # Makefile for the video capture/playback device drivers.
 #
 
+obj-$(CONFIG_VIDEO_ASPEED)		+= aspeed-video.o
 obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o
 obj-$(CONFIG_VIDEO_CAFE_CCIC) += marvell-ccic/
 obj-$(CONFIG_VIDEO_MMP_CAMERA) += marvell-ccic/
drivers/media/platform/aspeed-video-jpeg.h new file +122 -0

122 lines not on this page · raw message

drivers/media/platform/aspeed-video.c new file +1289 -0

1,289 lines not on this page · raw message

Signature · 1 line
1.8.3.1