From 2fd5a57af6cdb256c24d561bd7c6a0d10ccb542e Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Tue, 18 Oct 2022 06:49:18 -0600
Subject: [PATCH] Convert CONFIG_VIDEO_LOGO_MAX_SIZE to Kconfig

This converts the following to Kconfig:
   CONFIG_VIDEO_LOGO_MAX_SIZE

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 configs/m53menlo_defconfig          |  1 +
 configs/mx6qsabrelite_defconfig     |  1 +
 configs/nitrogen6dl2g_defconfig     |  1 +
 configs/nitrogen6dl_defconfig       |  1 +
 configs/nitrogen6q2g_defconfig      |  1 +
 configs/nitrogen6q_defconfig        |  1 +
 configs/nitrogen6s1g_defconfig      |  1 +
 configs/nitrogen6s_defconfig        |  1 +
 configs/s5pc210_universal_defconfig |  1 +
 configs/trats2_defconfig            |  1 +
 configs/trats_defconfig             |  1 +
 drivers/video/Kconfig               |  7 ++++++-
 include/configs/m53menlo.h          |  5 -----
 include/configs/mx23evk.h           | 11 -----------
 include/configs/mx28evk.h           |  7 -------
 include/configs/nitrogen6x.h        |  1 -
 include/configs/s5pc210_universal.h |  1 -
 include/configs/trats.h             |  3 ---
 include/configs/trats2.h            |  3 ---
 scripts/config_whitelist.txt        |  1 -
 20 files changed, 17 insertions(+), 33 deletions(-)

diff --git a/configs/m53menlo_defconfig b/configs/m53menlo_defconfig
index 4bd98d235b..d7e864e83d 100644
--- a/configs/m53menlo_defconfig
+++ b/configs/m53menlo_defconfig
@@ -126,6 +126,7 @@ CONFIG_SPLASHIMAGE_GUARD=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_SPLASH_SOURCE=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x200000
 CONFIG_BMP_16BPP=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=8000
 CONFIG_IMX_WATCHDOG=y
diff --git a/configs/mx6qsabrelite_defconfig b/configs/mx6qsabrelite_defconfig
index 2834e479e8..a440bf4dd4 100644
--- a/configs/mx6qsabrelite_defconfig
+++ b/configs/mx6qsabrelite_defconfig
@@ -92,5 +92,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x600000
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6dl2g_defconfig b/configs/nitrogen6dl2g_defconfig
index 7da9dade3a..3d7027de14 100644
--- a/configs/nitrogen6dl2g_defconfig
+++ b/configs/nitrogen6dl2g_defconfig
@@ -97,5 +97,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x600000
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6dl_defconfig b/configs/nitrogen6dl_defconfig
index 2e9be9cc66..dd1f0584a7 100644
--- a/configs/nitrogen6dl_defconfig
+++ b/configs/nitrogen6dl_defconfig
@@ -97,5 +97,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x600000
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6q2g_defconfig b/configs/nitrogen6q2g_defconfig
index dd513faddc..89a2fb72eb 100644
--- a/configs/nitrogen6q2g_defconfig
+++ b/configs/nitrogen6q2g_defconfig
@@ -100,5 +100,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x600000
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6q_defconfig b/configs/nitrogen6q_defconfig
index 9e4374cae0..176e4fb800 100644
--- a/configs/nitrogen6q_defconfig
+++ b/configs/nitrogen6q_defconfig
@@ -100,5 +100,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x600000
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6s1g_defconfig b/configs/nitrogen6s1g_defconfig
index aa28beee34..6522a103f6 100644
--- a/configs/nitrogen6s1g_defconfig
+++ b/configs/nitrogen6s1g_defconfig
@@ -97,5 +97,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x600000
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/nitrogen6s_defconfig b/configs/nitrogen6s_defconfig
index d98c213652..dc2a8183b8 100644
--- a/configs/nitrogen6s_defconfig
+++ b/configs/nitrogen6s_defconfig
@@ -97,5 +97,6 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_SPLASH_SCREEN=y
 CONFIG_SPLASH_SCREEN_ALIGN=y
 CONFIG_VIDEO_BMP_GZIP=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x600000
 CONFIG_VIDEO_BMP_RLE8=y
 CONFIG_BMP_16BPP=y
diff --git a/configs/s5pc210_universal_defconfig b/configs/s5pc210_universal_defconfig
index c2e1b67ce6..9443be7dfa 100644
--- a/configs/s5pc210_universal_defconfig
+++ b/configs/s5pc210_universal_defconfig
@@ -62,3 +62,4 @@ CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_GADGET_DWC2_OTG_PHY=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x4e236
diff --git a/configs/trats2_defconfig b/configs/trats2_defconfig
index c86c3975ff..a4417560b1 100644
--- a/configs/trats2_defconfig
+++ b/configs/trats2_defconfig
@@ -65,4 +65,5 @@ CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_GADGET_DWC2_OTG_PHY=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x4e236
 CONFIG_LIB_HW_RAND=y
diff --git a/configs/trats_defconfig b/configs/trats_defconfig
index 9bded4cb57..76e2c2644e 100644
--- a/configs/trats_defconfig
+++ b/configs/trats_defconfig
@@ -62,4 +62,5 @@ CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_GADGET_DWC2_OTG_PHY=y
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
+CONFIG_VIDEO_LOGO_MAX_SIZE=0x4e236
 CONFIG_LIB_HW_RAND=y
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d160271abe..3a692b8a3c 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -926,7 +926,12 @@ config VIDEO_BMP_GZIP
 	  splashscreen support or the bmp command.
 
 config VIDEO_LOGO_MAX_SIZE
-	bool "Maximum size of the bitmap logo in bytes"
+	hex "Maximum size of the bitmap logo in bytes"
+	default 0x100000
+	help
+	  Sets the maximum uncompressed size of the logo. This is needed when
+	  decompressing a BMP file using the gzip algorithm, since it cannot
+	  read the size from the bitmap header.
 
 config VIDEO_BMP_RLE8
 	bool "Run length encoded BMP image (RLE8) support"
diff --git a/include/configs/m53menlo.h b/include/configs/m53menlo.h
index 139919f391..03e1619c86 100644
--- a/include/configs/m53menlo.h
+++ b/include/configs/m53menlo.h
@@ -78,11 +78,6 @@
 #define CONFIG_MXC_USB_FLAGS		0
 #endif
 
-/*
- * LCD
- */
-#define CONFIG_VIDEO_LOGO_MAX_SIZE	(2 << 20)
-
 /* LVDS display */
 #define CONFIG_SYS_LDB_CLOCK			33260000
 #define CONFIG_IMX_VIDEO_SKIP
diff --git a/include/configs/mx23evk.h b/include/configs/mx23evk.h
index 69d4552546..4c0531212e 100644
--- a/include/configs/mx23evk.h
+++ b/include/configs/mx23evk.h
@@ -15,17 +15,6 @@
 #define PHYS_SDRAM_1_SIZE		0x08000000	/* Max 128 MB RAM */
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
 
-/* Environment */
-
-/* Environment is in MMC */
-
-/* USB */
-
-/* Framebuffer support */
-#ifdef CONFIG_DM_VIDEO
-#define CONFIG_VIDEO_LOGO_MAX_SIZE	(512 << 10)
-#endif
-
 /* Extra Environments */
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"update_sd_firmware_filename=u-boot.sd\0" \
diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index 6c2fcbf764..140f5e98c5 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -22,13 +22,6 @@
 #define	CONFIG_RTC_MXS
 #endif
 
-/* USB */
-
-/* Framebuffer support */
-#ifdef CONFIG_DM_VIDEO
-#define CONFIG_VIDEO_LOGO_MAX_SIZE	(512 << 10)
-#endif
-
 /* Extra Environment */
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"ubifs_file=filesystem.ubifs\0" \
diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
index ee3c5e4afa..d507f8f11c 100644
--- a/include/configs/nitrogen6x.h
+++ b/include/configs/nitrogen6x.h
@@ -27,7 +27,6 @@
 #define CONFIG_MXC_USB_FLAGS	0
 
 /* Framebuffer and LCD */
-#define CONFIG_VIDEO_LOGO_MAX_SIZE (6 * 1024 * 1024)
 #define CONFIG_IMX_HDMI
 #define CONFIG_IMX_VIDEO_SKIP
 
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 585c67b791..a2b62f5f6d 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -121,6 +121,5 @@ int universal_spi_read(void);
  * LCD Settings
  */
 #define CONFIG_LD9040
-#define CONFIG_VIDEO_LOGO_MAX_SIZE ((500 * 160 * 4) + 54)
 
 #endif	/* __CONFIG_H */
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 973d15962c..daa8cc79b2 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -147,7 +147,4 @@
 /* LCD console */
 #define LCD_BPP			LCD_COLOR16
 
-/* LCD */
-#define CONFIG_VIDEO_LOGO_MAX_SIZE  ((500 * 160 * 4) + 54)
-
 #endif	/* __CONFIG_H */
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 24afc22022..052045a601 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -137,7 +137,4 @@
 /* LCD console */
 #define LCD_BPP                 LCD_COLOR16
 
-/* LCD */
-#define CONFIG_VIDEO_LOGO_MAX_SIZE ((500 * 160 * 4) + 54)
-
 #endif	/* __CONFIG_H */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 18ccfc6047..6e4b02ff37 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1346,7 +1346,6 @@ CONFIG_USB_TTY
 CONFIG_U_BOOT_HDR_SIZE
 CONFIG_VAR_SIZE_SPL
 CONFIG_VERY_BIG_RAM
-CONFIG_VIDEO_LOGO_MAX_SIZE
 CONFIG_VSC7385_ENET
 CONFIG_VSC7385_IMAGE
 CONFIG_VSC7385_IMAGE_SIZE
-- 
2.39.5