[U-Boot, 06/13] board: ge: mx53ppd: enable DM_VIDEO

Ian Ray ian.ray at ge.com
Fri Jan 31 14:07:57 CET 2020


Enable DM_VIDEO for mx53ppd.
Enable DM_REGULATOR_FIXED and DM_PWM for the backlight.
Remove unused MX53PPD_LCD_POWER.
Remove old (incorrect) setup_iomux_lcd.
Enable backlight via display enable handler.
Use cls command to initiate display in HW agnostic manner.
Modify `failbootcmd' to use lcdputs.

Signed-off-by: Ian Ray <ian.ray at ge.com>
Signed-off-by: Robert Beckett <bob.beckett at collabora.com>
---
 arch/arm/dts/imx53-ppd-uboot.dtsi |   5 ++
 board/ge/mx53ppd/Makefile         |   2 +-
 board/ge/mx53ppd/mx53ppd.c        |   3 -
 board/ge/mx53ppd/mx53ppd_video.c  | 126 +++++++++++++-------------------------
 board/ge/mx53ppd/ppd_gpio.h       |   2 -
 configs/mx53ppd_defconfig         |   7 ++-
 include/configs/mx53ppd.h         |  13 ++--
 7 files changed, 61 insertions(+), 97 deletions(-)

diff --git a/arch/arm/dts/imx53-ppd-uboot.dtsi b/arch/arm/dts/imx53-ppd-uboot.dtsi
index 0f81947..d38a1bc 100644
--- a/arch/arm/dts/imx53-ppd-uboot.dtsi
+++ b/arch/arm/dts/imx53-ppd-uboot.dtsi
@@ -14,6 +14,11 @@
 		compatible = "u-boot,bootcount-i2c-eeprom";
 		i2c-eeprom = <&bootcount>;
 	};
+
+	panel-lvds0 {
+		compatible = "simple-panel";
+		backlight = <&pwm_bl>;
+	};
 };
 
 &eeprom {
diff --git a/board/ge/mx53ppd/Makefile b/board/ge/mx53ppd/Makefile
index 9fae414..f423e80 100644
--- a/board/ge/mx53ppd/Makefile
+++ b/board/ge/mx53ppd/Makefile
@@ -7,4 +7,4 @@
 # Jason Liu <r64343 at freescale.com>
 
 obj-y			+= mx53ppd.o
-obj-$(CONFIG_VIDEO)	+= mx53ppd_video.o
+obj-$(CONFIG_DM_VIDEO)	+= mx53ppd_video.o
diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c
index ea3f217..044fd80 100644
--- a/board/ge/mx53ppd/mx53ppd.c
+++ b/board/ge/mx53ppd/mx53ppd.c
@@ -39,8 +39,6 @@
 #include "../../ge/common/ge_common.h"
 #include "../../ge/common/vpd_reader.h"
 
-#define MX53PPD_LCD_POWER		IMX_GPIO_NR(3, 24)
-
 DECLARE_GLOBAL_DATA_PTR;
 
 static u32 mx53_dram_size[2];
@@ -163,7 +161,6 @@ void ppd_gpio_init(void)
 int board_early_init_f(void)
 {
 	setup_iomux_fec();
-	setup_iomux_lcd();
 	ppd_gpio_init();
 
 	return 0;
diff --git a/board/ge/mx53ppd/mx53ppd_video.c b/board/ge/mx53ppd/mx53ppd_video.c
index 9dd9f0c..3240ed6 100644
--- a/board/ge/mx53ppd/mx53ppd_video.c
+++ b/board/ge/mx53ppd/mx53ppd_video.c
@@ -9,69 +9,20 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <linux/list.h>
-#include <asm/gpio.h>
 #include <asm/arch/iomux-mx53.h>
+#include <asm/mach-imx/video.h>
 #include <linux/fb.h>
 #include <ipu_pixfmt.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/io.h>
-#include <pwm.h>
-#include "ppd_gpio.h"
+#include <panel.h>
 
-#define MX53PPD_LCD_POWER		IMX_GPIO_NR(3, 24)
-
-static struct fb_videomode const nv_spwg = {
-	.name		= "NV-SPWGRGB888",
-	.refresh	= 60,
-	.xres		= 800,
-	.yres		= 480,
-	.pixclock	= 15384,
-	.left_margin	= 16,
-	.right_margin	= 210,
-	.upper_margin	= 10,
-	.lower_margin	= 22,
-	.hsync_len	= 30,
-	.vsync_len	= 13,
-	.sync		= FB_SYNC_EXT,
-	.vmode		= FB_VMODE_NONINTERLACED
-};
-
-void setup_iomux_lcd(void)
+static int detect_lcd(struct display_info_t const *dev)
 {
-	static const iomux_v3_cfg_t lcd_pads[] = {
-		MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK,
-		MX53_PAD_DI0_PIN15__IPU_DI0_PIN15,
-		MX53_PAD_DI0_PIN2__IPU_DI0_PIN2,
-		MX53_PAD_DI0_PIN3__IPU_DI0_PIN3,
-		MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0,
-		MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1,
-		MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2,
-		MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3,
-		MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4,
-		MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5,
-		MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6,
-		MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7,
-		MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8,
-		MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9,
-		MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10,
-		MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11,
-		MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12,
-		MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13,
-		MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14,
-		MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15,
-		MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16,
-		MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17,
-		MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18,
-		MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19,
-		MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20,
-		MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21,
-		MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22,
-		MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23,
-	};
-
-	imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads));
+	return 1;
 }
 
 static void lcd_enable(void)
@@ -96,40 +47,49 @@ static void lcd_enable(void)
 		IOMUXC_GPR2_DATA_WIDTH_CH0_24BIT |
 		IOMUXC_GPR2_LVDS_CH0_MODE_ENABLED_DI0,
 		&iomux->gpr[2]);
-
-	/* Enable backlights  */
-	pwm_init(1, 0, 0);
-
-	/* duty cycle 5000000ns, period: 5000000ns */
-	pwm_config(1, 5000000, 5000000);
-
-	/* Backlight Power */
-	gpio_request(BACKLIGHT_ENABLE, "BACKLIGHT_ENABLE");
-	gpio_direction_output(BACKLIGHT_ENABLE, 1);
-
-	pwm_enable(1);
 }
 
-static int do_lcd_enable(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static void do_enable_backlight(struct display_info_t const *dev)
 {
+	struct udevice *panel;
+	int ret;
+
 	lcd_enable();
-	return 0;
-}
 
-U_BOOT_CMD(
-	ppd_lcd_enable,	1,	1,	do_lcd_enable,
-	"enable PPD LCD",
-	"no parameters"
-);
+	ret = uclass_get_device(UCLASS_PANEL, 0, &panel);
+	if (ret) {
+		printf("Could not find panel: %d\n", ret);
+		return;
+	}
 
-int board_video_skip(void)
-{
-	int ret;
+	panel_set_backlight(panel, 100);
+	panel_enable_backlight(panel);
+}
+
+struct display_info_t const displays[] = {
+	{
+		.bus	= -1,
+		.addr	= -1,
+		.pixfmt	= IPU_PIX_FMT_RGB24,
+		.detect	= detect_lcd,
+		.enable	= do_enable_backlight,
+		.mode = {
+			.name		= "NV-SPWGRGB888",
+			.refresh	= 60,
+			.xres		= 800,
+			.yres		= 480,
+			.pixclock	= 15384,
+			.left_margin	= 16,
+			.right_margin	= 210,
+			.upper_margin	= 10,
+			.lower_margin	= 22,
+			.hsync_len	= 30,
+			.vsync_len	= 13,
+			.sync		= FB_SYNC_EXT,
+			.vmode		= FB_VMODE_NONINTERLACED
+		}
+	}
+};
 
-	ret = ipuv3_fb_init(&nv_spwg, 0, IPU_PIX_FMT_RGB24);
-	if (ret)
-		printf("Display cannot be configured: %d\n", ret);
+size_t display_count = ARRAY_SIZE(displays);
 
-	return ret;
-}
diff --git a/board/ge/mx53ppd/ppd_gpio.h b/board/ge/mx53ppd/ppd_gpio.h
index ba2d1ba..163782a 100644
--- a/board/ge/mx53ppd/ppd_gpio.h
+++ b/board/ge/mx53ppd/ppd_gpio.h
@@ -57,7 +57,6 @@ struct gpio_cfg {
 #define POWER_DOWN_LVDS0_DESERIALIZER_N IMX_GPIO_NR(2, 22)
 #define POWER_DOWN_LVDS1_DESERIALIZER_N IMX_GPIO_NR(2, 27)
 #define ENABLE_PWR_TO_LCD_AND_UI_INTERFACE IMX_GPIO_NR(2, 17)
-#define BACKLIGHT_ENABLE IMX_GPIO_NR(5, 29)
 #define RESET_I2C1_BUS_SEGMENT_MUX_N IMX_GPIO_NR(2, 18)
 #define ECSPI1_CS0 IMX_GPIO_NR(5, 17)
 #define ECSPI1_CS1 IMX_GPIO_NR(4, 10)
@@ -87,7 +86,6 @@ static const struct gpio_cfg ppd_gpios[] = {
 	{ POWER_DOWN_LVDS0_DESERIALIZER_N, 1 },
 	{ POWER_DOWN_LVDS1_DESERIALIZER_N, 1 },
 	{ ENABLE_PWR_TO_LCD_AND_UI_INTERFACE, 1 },
-	{ BACKLIGHT_ENABLE, 0 },
 	{ RESET_I2C1_BUS_SEGMENT_MUX_N, 1 },
 	{ ECSPI1_CS0, 1 },
 	{ ECSPI1_CS1, 1 },
diff --git a/configs/mx53ppd_defconfig b/configs/mx53ppd_defconfig
index 0d499a3..2f29c3e 100644
--- a/configs/mx53ppd_defconfig
+++ b/configs/mx53ppd_defconfig
@@ -24,6 +24,7 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_BOOTCOUNT=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
+CONFIG_CMD_CLS=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
@@ -52,6 +53,7 @@ CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX5=y
 CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_PWM_IMX=y
 CONFIG_DM_RTC=y
 CONFIG_RTC_S35392A=y
@@ -61,8 +63,11 @@ CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_MX5=y
 CONFIG_VIDEO_IPUV3=y
-CONFIG_VIDEO=y
 # CONFIG_VIDEO_SW_CURSOR is not set
 CONFIG_WATCHDOG_TIMEOUT_MSECS=8000
 CONFIG_IMX_WATCHDOG=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_DM_VIDEO=y
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_DM_PWM=y
+CONFIG_VIDEO_BPP16=y
diff --git a/include/configs/mx53ppd.h b/include/configs/mx53ppd.h
index e7eca82..8fa7d15 100644
--- a/include/configs/mx53ppd.h
+++ b/include/configs/mx53ppd.h
@@ -91,13 +91,10 @@
 		"/boot/bootcause/firstboot\0" \
 	"swappartitions=setexpr partnum 3 - ${partnum}\0" \
 	"failbootcmd=" \
-		"ppd_lcd_enable; " \
-		"msg=\"Monitor failed to start.  " \
-			"Try again, or contact GE Service for support.\"; " \
-		"echo $msg; " \
-		"setenv stdout vga; " \
-		"echo \"\n\n\n\n    \" $msg; " \
-		"setenv stdout serial; " \
+		"cls; " \
+		"setcurs 5 4; " \
+		"lcdputs \"Monitor failed to start. " \
+		"Try again, or contact GE Service for support.\"; " \
 		"bootcount reset; \0" \
 	"altbootcmd=" \
 		"run doquiet; " \
@@ -172,4 +169,6 @@
 /* Backlight Control */
 #define CONFIG_IMX6_PWM_PER_CLK 66666000
 
+#define CONFIG_IMX_VIDEO_SKIP
+
 #endif				/* __CONFIG_H */
-- 
2.10.1



More information about the U-Boot mailing list