|
| 1 | +diff --git a/cmd/Kconfig b/cmd/Kconfig |
| 2 | +index 1d7ddb4ed36..8572dc4353e 100644 |
| 3 | +--- a/cmd/Kconfig |
| 4 | ++++ b/cmd/Kconfig |
| 5 | +@@ -176,6 +176,20 @@ config CMD_CPU |
| 6 | + internal name) and clock frequency. Other information may be |
| 7 | + available depending on the CPU driver. |
| 8 | + |
| 9 | ++config CMD_RPI_DISPLAY |
| 10 | ++ bool "rpidisplay" |
| 11 | ++ depends on ARCH_BCM283X |
| 12 | ++ help |
| 13 | ++ Enable commands to detect Raspberry Pi 7" DSI display connection. |
| 14 | ++ |
| 15 | ++ This provides two commands: |
| 16 | ++ - rpidisplay: Shows detailed detection information |
| 17 | ++ - testrpidisplay: Silent test for use in boot scripts |
| 18 | ++ |
| 19 | ++ Detection is performed by querying the VideoCore GPU for the |
| 20 | ++ active display resolution. The official Raspberry Pi 7" DSI |
| 21 | ++ display uses 800x480 resolution. |
| 22 | ++ |
| 23 | + config CMD_FWU_METADATA |
| 24 | + bool "fwu metadata read" |
| 25 | + depends on FWU_MULTI_BANK_UPDATE |
| 26 | +diff --git a/cmd/Makefile b/cmd/Makefile |
| 27 | +index d1f369deec0..033ea1312ed 100644 |
| 28 | +--- a/cmd/Makefile |
| 29 | ++++ b/cmd/Makefile |
| 30 | +@@ -48,6 +48,7 @@ obj-$(CONFIG_CMD_CLK) += clk.o |
| 31 | + obj-$(CONFIG_CMD_CLS) += cls.o |
| 32 | + obj-$(CONFIG_CMD_CONFIG) += config.o |
| 33 | + obj-$(CONFIG_CMD_CONITRACE) += conitrace.o |
| 34 | ++obj-$(CONFIG_CMD_RPI_DISPLAY) += rpi_display.o |
| 35 | + obj-$(CONFIG_CMD_CONSOLE) += console.o |
| 36 | + obj-$(CONFIG_CMD_CPU) += cpu.o |
| 37 | + obj-$(CONFIG_CMD_DATE) += date.o |
| 38 | +@@ -201,7 +202,6 @@ obj-$(CONFIG_CMD_LZMADEC) += lzmadec.o |
| 39 | + obj-$(CONFIG_CMD_UFS) += ufs.o |
| 40 | + obj-$(CONFIG_CMD_USB) += usb.o disk.o |
| 41 | + obj-$(CONFIG_CMD_VIDCONSOLE) += video.o |
| 42 | +- |
| 43 | + obj-$(CONFIG_CMD_FASTBOOT) += fastboot.o |
| 44 | + obj-$(CONFIG_CMD_FS_UUID) += fs_uuid.o |
| 45 | + |
| 46 | +diff --git a/cmd/rpi_display.c b/cmd/rpi_display.c |
| 47 | +new file mode 100644 |
| 48 | +index 00000000000..07abdc08552 |
| 49 | +--- /dev/null |
| 50 | ++++ b/cmd/rpi_display.c |
| 51 | +@@ -0,0 +1,81 @@ |
| 52 | ++// SPDX-License-Identifier: GPL-2.0+ |
| 53 | ++/* |
| 54 | ++ * Raspberry Pi 7" DSI Display Detection Command |
| 55 | ++ * Detects if the official Raspberry Pi 7" DSI display is connected |
| 56 | ++ */ |
| 57 | ++ |
| 58 | ++#include <command.h> |
| 59 | ++#include <asm/arch/msg.h> |
| 60 | ++ |
| 61 | ++static int do_rpi_display(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
| 62 | ++{ |
| 63 | ++ int width, height; |
| 64 | ++ int ret; |
| 65 | ++ |
| 66 | ++ printf("=== Raspberry Pi 7\" DSI Display Detection ===\n"); |
| 67 | ++ |
| 68 | ++ /* Use official VideoCore mailbox interface to get display resolution */ |
| 69 | ++ ret = bcm2835_get_video_size(&width, &height); |
| 70 | ++ if (ret) { |
| 71 | ++ printf("Failed to query VideoCore display size (ret=%d)\n", ret); |
| 72 | ++ printf("Display Status: NOT DETECTED\n"); |
| 73 | ++ return 2; |
| 74 | ++ } |
| 75 | ++ |
| 76 | ++ printf("VideoCore reports display: %dx%d", width, height); |
| 77 | ++ |
| 78 | ++ /* Official Raspberry Pi 7" DSI display is 800x480 */ |
| 79 | ++ if (width == 800 && height == 480) { |
| 80 | ++ printf(" - RASPBERRY PI 7\" DSI DISPLAY DETECTED!\n"); |
| 81 | ++ printf("Display Status: CONNECTED\n"); |
| 82 | ++ return 0; |
| 83 | ++ } |
| 84 | ++ /* No resolution could indicate no display */ |
| 85 | ++ else if (width == 0 || height == 0) { |
| 86 | ++ printf(" - No active display\n"); |
| 87 | ++ printf("Display Status: NOT DETECTED\n"); |
| 88 | ++ return 1; |
| 89 | ++ } |
| 90 | ++ else { |
| 91 | ++ printf(" - Not Raspberry Pi DSI display (resolution %dx%d)\n", width, height); |
| 92 | ++ printf("Display Status: NOT DETECTED\n"); |
| 93 | ++ return 1; |
| 94 | ++ } |
| 95 | ++} |
| 96 | ++ |
| 97 | ++static int do_test_rpi_display(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
| 98 | ++{ |
| 99 | ++ int width, height; |
| 100 | ++ int ret; |
| 101 | ++ |
| 102 | ++ /* Silent test using VideoCore mailbox interface */ |
| 103 | ++ ret = bcm2835_get_video_size(&width, &height); |
| 104 | ++ if (ret) { |
| 105 | ++ return 2; /* Failed to query VideoCore */ |
| 106 | ++ } |
| 107 | ++ |
| 108 | ++ /* Check for Raspberry Pi DSI display resolutions */ |
| 109 | ++ if ((width == 800 && height == 480)) { |
| 110 | ++ return 0; /* DSI display found */ |
| 111 | ++ } |
| 112 | ++ |
| 113 | ++ return 1; /* DSI display not found */ |
| 114 | ++} |
| 115 | ++ |
| 116 | ++U_BOOT_CMD( |
| 117 | ++ rpidisplay, 1, 1, do_rpi_display, |
| 118 | ++ "detect Raspberry Pi DSI display", |
| 119 | ++ "\n" |
| 120 | ++ "Detects Raspberry Pi 7\" DSI display by checking resolution:\n" |
| 121 | ++ " - 800x480 = Official Raspberry Pi 7\" DSI display\n" |
| 122 | ++ "Returns: 0=connected, 1=not detected, 2=no video" |
| 123 | ++); |
| 124 | ++ |
| 125 | ++U_BOOT_CMD( |
| 126 | ++ testrpidisplay, 1, 1, do_test_rpi_display, |
| 127 | ++ "silent test for Raspberry Pi DSI display", |
| 128 | ++ "\n" |
| 129 | ++ "Silent test for Raspberry Pi DSI display (for use in scripts):\n" |
| 130 | ++ "Returns: 0=connected, 1=not detected, 2=no video\n" |
| 131 | ++ "Usage: if testrpidisplay; then echo DSI found; fi" |
| 132 | ++); |
0 commit comments