From 146e4908149108967c544e005a1d4d3139502e7f Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Mon, 9 Nov 2015 14:04:31 -0200 Subject: [PATCH] mx6sabre_common: Dynamically change the video output Use the 'hdmidetect' command in U-boot to load the appropriate video arguments. If HDMI is connected during boot then make HDMI as the primary framebuffer, otherwise let LVDS be the primary framebuffer. Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- configs/mx6sabreauto_defconfig | 2 ++ configs/mx6sabresd_defconfig | 2 ++ include/configs/mx6sabre_common.h | 15 ++++++++------- include/configs/mx6sabresd.h | 3 --- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/configs/mx6sabreauto_defconfig b/configs/mx6sabreauto_defconfig index 8856567846..622f5fd715 100644 --- a/configs/mx6sabreauto_defconfig +++ b/configs/mx6sabreauto_defconfig @@ -11,6 +11,8 @@ CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_NXP_BOARD_REVISION=y CONFIG_NR_DRAM_BANKS=1 +CONFIG_VIDEO=y +CONFIG_CMD_HDMIDETECT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" # CONFIG_CONSOLE_MUX is not set CONFIG_SYS_CONSOLE_IS_IN_ENV=y diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig index e0202ef57d..de36d8657d 100644 --- a/configs/mx6sabresd_defconfig +++ b/configs/mx6sabresd_defconfig @@ -10,6 +10,8 @@ CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_NR_DRAM_BANKS=1 +CONFIG_VIDEO=y +CONFIG_CMD_HDMIDETECT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" # CONFIG_CONSOLE_MUX is not set CONFIG_SYS_CONSOLE_IS_IN_ENV=y diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h index 5ba937aa37..3b583b28ae 100644 --- a/include/configs/mx6sabre_common.h +++ b/include/configs/mx6sabre_common.h @@ -55,13 +55,15 @@ #define EMMC_ENV "" #endif -#ifndef VIDEO_ARGS -#define VIDEO_ARGS "" -#endif +#define VIDEO_ARGS "${video_args}" +#define VIDEO_ARGS_SCRIPT "run video_args_script; " -#ifndef VIDEO_ARGS_SCRIPT -#define VIDEO_ARGS_SCRIPT "" -#endif +#define CONFIG_PREBOOT \ + "if hdmidet; then " \ + "setenv video_interfaces hdmi lvds; " \ + "else " \ + "setenv video_interfaces lvds hdmi; " \ + "fi;" #define CONFIG_EXTRA_ENV_SETTINGS \ "script=boot.scr\0" \ @@ -101,7 +103,6 @@ "video_args_lcd=setenv video_args $video_args " \ "video=mxcfb${fb}:dev=lcd,CLAA-WVGA,if=RGB666\0" \ "fb=0\0" \ - "video_interfaces=hdmi lvds lcd\0" \ "video_args_script=" \ "for v in ${video_interfaces}; do " \ "run video_args_${v}; " \ diff --git a/include/configs/mx6sabresd.h b/include/configs/mx6sabresd.h index b5a952db67..555942a2c2 100644 --- a/include/configs/mx6sabresd.h +++ b/include/configs/mx6sabresd.h @@ -18,9 +18,6 @@ #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ -#define VIDEO_ARGS "${video_args}" -#define VIDEO_ARGS_SCRIPT "run video_args_script; " - #include "mx6sabre_common.h" /* Falcon Mode */ -- 2.40.1