Skip to contentSkip to conversation

video: Armada XP: Move driver to DM_VIDEO

PATCH Superseded Stefan Roese 2 participants 8 messages Jan 30, 2019 – Feb 5, 2019

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

PATCH v2 1/1 video: Armada XP: Move driver to DM_VIDEO

This patch moves the Armada XP video / LCD driver to DM_VIDEO. With this move, the legacy interface board_video_init() is removed from the theadorable board code (only user of this video driver). The support via DT will be added in a separate patch.

This patch also enables DM_VIDEO for the theadorable board, as this is needed to not break git bisect'ability.

---
v2:
- Add DM_VIDEO in theadorable_debug_defconfig in this patch

 arch/arm/mach-mvebu/include/mach/cpu.h |  12 -
 board/theadorable/theadorable.c        |  16 --
 configs/theadorable_debug_defconfig    |   3 +-
 drivers/video/mvebu_lcd.c              | 321 +++++++++++++++----------
 4 files changed, 193 insertions(+), 159 deletions(-)
arch/arm/mach-mvebu/include/mach/cpu.h +0 -12
index 85d7dd1610..9e23043a48 100644
@@ -158,18 +158,6 @@ int serdes_phy_config(void);
  */
 int ddr3_init(void);
 
-struct mvebu_lcd_info {
-	u32 fb_base;
-	int x_res;
-	int y_res;
-	int x_fp;		/* frontporch */
-	int y_fp;
-	int x_bp;		/* backporch */
-	int y_bp;
-};
-
-int mvebu_lcd_register_init(struct mvebu_lcd_info *lcd_info);
-
 /*
  * get_ref_clk
  *
board/theadorable/theadorable.c +0 -16
index 1169d67746..acd46b0026 100644
@@ -222,22 +222,6 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
-int board_video_init(void)
-{
-	struct mvebu_lcd_info lcd_info;
-
-	/* Reserved memory area via CONFIG_SYS_MEM_TOP_HIDE */
-	lcd_info.fb_base	= gd->ram_size;
-	lcd_info.x_res		= 240;
-	lcd_info.x_fp		= 1;
-	lcd_info.x_bp		= 45;
-	lcd_info.y_res		= 320;
-	lcd_info.y_fp		= 1;
-	lcd_info.y_bp		= 3;
-
-	return mvebu_lcd_register_init(&lcd_info);
-}
-
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
configs/theadorable_debug_defconfig +1 -2
index ac6dfd6844..a7d02e957a 100644
@@ -71,6 +71,5 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
+CONFIG_DM_VIDEO=y
 CONFIG_VIDEO_MVEBU=y
-CONFIG_VIDEO=y
-# CONFIG_VIDEO_SW_CURSOR is not set
drivers/video/mvebu_lcd.c +192 -129

565 lines not on this page · raw message

Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/1 video: bmp: Add support for 24bpp BMP files on 16bpp displays

This patch adds support to load 24bpp BMP files on 16bpp displays. This will be used by the theadorable board. The "old" bmp command did support this operartion mode and to not break compatibility with the move to DM_VIDEO, we need to add this support to the "new" bmp code.

---
v2:
- No change

 drivers/video/video_bmp.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/video/video_bmp.c +17 -6
index 2898b0b55d..193f37d275 100644
@@ -229,11 +229,12 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 	}
 
 	/*
-	 * We support displaying 8bpp BMPs on 16bpp LCDs
+	 * We support displaying 8bpp and 24bpp BMPs on 16bpp LCDs
 	 * and displaying 24bpp BMPs on 32bpp LCDs
-	 * */
+	 */
 	if (bpix != bmp_bpix &&
 	    !(bmp_bpix == 8 && bpix == 16) &&
+	    !(bmp_bpix == 24 && bpix == 16) &&
 	    !(bmp_bpix == 24 && bpix == 32)) {
 		printf("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
 		       bpix, get_unaligned_le16(&bmp->header.bit_count));
@@ -318,12 +319,22 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 	case 24:
 		for (i = 0; i < height; ++i) {
 			for (j = 0; j < width; j++) {
-				*(fb++) = *(bmap++);
-				*(fb++) = *(bmap++);
-				*(fb++) = *(bmap++);
-				*(fb++) = 0;
+				if (bpix == 16) {
+					/* 16bit 555RGB format */
+					*(u16 *)fb = ((bmap[2] >> 3) << 10) |
+						((bmap[1] >> 3) << 5) |
+						(bmap[0] >> 3);
+					bmap += 3;
+					fb += 2;
+				} else {
+					*(fb++) = *(bmap++);
+					*(fb++) = *(bmap++);
+					*(fb++) = *(bmap++);
+					*(fb++) = 0;
+				}
 			}
 			fb -= priv->line_length + width * (bpix / 8);
+			bmap += (padded_width - width) * 3;
 		}
 		break;
 #endif /* CONFIG_BMP_24BPP */
Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 1/1 video: bmp: Add support for 24bpp BMP files on 16bpp displays

Quoted 7 lines · On Wed, 30 Jan 2019 08:54:12 +0100 Stefan Roese sr at denx.de wrote:

This patch adds support to load 24bpp BMP files on 16bpp displays. This will be used by the theadorable board. The "old" bmp command did support this operartion mode and to not break compatibility with the move to DM_VIDEO, we need to add this support to the "new" bmp code.

--
Anatolij

#3 lore raw

PATCH v2 1/1 arm: mvebu: theadorable: Enable video / LCD support with the new DM driver

In reply to Stefan Roese

With the new DM_VIDEO support in the Armada XP LCD driver, this patch adds the needed DT node for the LCD controller to the theadorable dts file. This DT property is not added to the Armada XP dtsi files, as this LCD feature is pretty unusual for this SoC and I personally know of no other board that uses this controller.

This patch also enables CONFIG_BMP_16BPP/24BPP/32BPP, as the "old" bmp command supported these BMP files.

---
v2:
- Remove theadorable_debug_config change (its included in the video driver patch now)
- Commit text reworded because of this

 arch/arm/dts/armada-xp-theadorable.dts | 25 +++++++++++++++++++++++++
 include/configs/theadorable.h          |  4 ++++
 2 files changed, 29 insertions(+)
arch/arm/dts/armada-xp-theadorable.dts +25 -0
index 9b66ec678d..5695e9b758 100644
@@ -159,6 +159,31 @@
 					spi-max-frequency = <27777777>;
 				};
 			};
+
+			/* The LCD controller is only used on this board */
+			lcd0: lcd-controller at e0000 {
+				compatible = "marvell,armada-xp-lcd";
+				reg = <0xe0000 0x10000>;
+				status = "okay";
+				u-boot,dm-pre-reloc;
+
+				display-timings {
+					native-mode = <&timing0>;
+					timing0: panel0 {
+						hactive = <240>;
+						vactive = <320>;
+						hfront-porch = <1>;
+						hback-porch = <45>;
+						vfront-porch = <1>;
+						vback-porch = <3>;
+
+						/* Some dummy parameters */
+						clock-frequency = <0>;
+						hsync-len = <0>;
+						vsync-len = <0>;
+					};
+				};
+			};
 		};
 	};
 };
include/configs/theadorable.h +4 -0
index 6837d55507..d0c75757ed 100644
@@ -65,6 +65,10 @@
 /* Enable LCD and reserve 512KB from top of memory*/
 #define CONFIG_SYS_MEM_TOP_HIDE		0x80000
 
+#define CONFIG_BMP_16BPP
+#define CONFIG_BMP_24BPP
+#define CONFIG_BMP_32BPP
+
 /* FPGA programming support */
 #define CONFIG_FPGA_STRATIX_V
 
Signature · 1 line
2.20.1
#4 lore raw

PATCH v2 1/1 arm: mvebu: theadorable: Enable video / LCD support with the new DM driver

Quoted 11 lines · On Wed, 30 Jan 2019 08:54:13 +0100 Stefan Roese sr at denx.de wrote:

With the new DM_VIDEO support in the Armada XP LCD driver, this patch adds the needed DT node for the LCD controller to the theadorable dts file. This DT property is not added to the Armada XP dtsi files, as this LCD feature is pretty unusual for this SoC and I personally know of no other board that uses this controller.

This patch also enables CONFIG_BMP_16BPP/24BPP/32BPP, as the "old" bmp command supported these BMP files.

--
Anatolij

#5 lore raw

PATCH v2 1/1 arm: mvebu: theadorable: Enable video / LCD support with the new DM driver

Quoted 9 lines · Anatolij Gustschin
Quoted 6 lines · On Wed, 30 Jan 2019 08:54:13 +0100 Stefan Roese sr at denx.de wrote:

With the new DM_VIDEO support in the Armada XP LCD driver, this patch adds the needed DT node for the LCD controller to the theadorable dts file. This DT property is not added to the Armada XP dtsi files, as this LCD feature is pretty unusual for this SoC and I personally know of no other board that uses this controller.

Quoted 7 lines
Quoted 5 lines

This patch also enables CONFIG_BMP_16BPP/24BPP/32BPP, as the "old" bmp command supported these BMP files.

Applied to u-boot-marvell/master

Thanks,
Stefan

#6 lore raw

PATCH v2 1/1 video: Armada XP: Move driver to DM_VIDEO

In reply to Stefan Roese
Quoted 10 lines · On Wed, 30 Jan 2019 08:54:11 +0100 Stefan Roese sr at denx.de wrote:

This patch moves the Armada XP video / LCD driver to DM_VIDEO. With this move, the legacy interface board_video_init() is removed from the theadorable board code (only user of this video driver). The support via DT will be added in a separate patch.

This patch also enables DM_VIDEO for the theadorable board, as this is needed to not break git bisect'ability.

--
Anatolij

#7 lore raw

PATCH v2 1/1 video: Armada XP: Move driver to DM_VIDEO

Quoted 8 lines · Anatolij Gustschin
Quoted 5 lines · On Wed, 30 Jan 2019 08:54:11 +0100 Stefan Roese sr at denx.de wrote:

This patch moves the Armada XP video / LCD driver to DM_VIDEO. With this move, the legacy interface board_video_init() is removed from the theadorable board code (only user of this video driver). The support via DT will be added in a separate patch.

Quoted 7 lines
Quoted 5 lines

This patch also enables DM_VIDEO for the theadorable board, as this is needed to not break git bisect'ability.

Applied to u-boot-marvell/master

Thanks,
Stefan