From patchwork Sat Nov 3 00:27:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,11/17] edid: Add I2C command for printing the EDID Date: Fri, 02 Nov 2012 14:27:27 -0000 From: Simon Glass X-Patchwork-Id: 196784 Message-Id: <1351902453-27956-12-git-send-email-sjg@chromium.org> To: U-Boot Mailing List Cc: Tom Rini , Sean Paul From: Tom Wai-Hong Tam Add a single command to read the EDID information over I2C. For example: SMDK5250 # i2c dev 7 Setting bus to 7 SMDK5250 # i2c edid 50 EDID version: 1.4 Product ID code: 305c Manufacturer: AUO Serial number: 00000000 Manufactured in week: 0 year: 2011 Video input definition: digital signal, voltage level 0, blank to black Monitor is non-RGB Maximum visible display size: 26 cm x 14 cm Power management features: no active off, no suspend, no standby Estabilished timings: Standard timings: 1366x768 60 Hz (detailed) 1366x768 60 Hz (detailed) Monitor ID: 2VD2K.B116XW Signed-off-by: Tom Wai-Hong Tam Signed-off-by: Sean Paul Signed-off-by: Simon Glass --- README | 7 +++++++ common/cmd_i2c.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-) diff --git a/README b/README index 31e25fe..daa95cb 100644 --- a/README +++ b/README @@ -1465,6 +1465,13 @@ CBFS (Coreboot Filesystem) support Normally display is black on white background; define CONFIG_SYS_WHITE_ON_BLACK to get it inverted. + + CONFIG_I2C_EDI + + Enables an 'i2c edid' command which can read EDID + information over I2C from an attached LCD display. + + - Splash Screen Support: CONFIG_SPLASH_SCREEN If this option is set, the environment is checked for diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 82e63e1..e7f7b55 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -78,6 +78,7 @@ #include #include +#include #include #include #include @@ -1246,6 +1247,38 @@ static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) } #endif +/* + * Syntax: + * i2c edid {i2c_chip} + */ +#if defined(CONFIG_I2C_EDID) +int do_edid(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{ + u_char chip; + struct edid1_info edid; + + if (argc < 2) { + cmd_usage(cmdtp); + return 1; + } + + chip = simple_strtoul(argv[1], NULL, 16); + if (i2c_read(chip, 0, 1, (uchar *)&edid, sizeof(edid)) != 0) { + puts("Error reading EDID content.\n"); + return 1; + } + + if (edid_check_info(&edid)) { + puts("Content isn't valid EDID.\n"); + return 1; + } + + edid_print_info(&edid); + return 0; + +} +#endif /* CONFIG_I2C_EDID */ + #if defined(CONFIG_I2C_MUX) static int do_i2c_add_bus(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) { @@ -1335,6 +1368,9 @@ static cmd_tbl_t cmd_i2c_sub[] = { #if defined(CONFIG_I2C_MULTI_BUS) U_BOOT_CMD_MKENT(dev, 1, 1, do_i2c_bus_num, "", ""), #endif /* CONFIG_I2C_MULTI_BUS */ +#if defined(CONFIG_I2C_EDID) + U_BOOT_CMD_MKENT(edid, 1, 1, do_edid, "", ""), +#endif /* CONFIG_I2C_EDID */ U_BOOT_CMD_MKENT(loop, 3, 1, do_i2c_loop, "", ""), U_BOOT_CMD_MKENT(md, 3, 1, do_i2c_md, "", ""), U_BOOT_CMD_MKENT(mm, 2, 1, do_i2c_mm, "", ""), @@ -1387,6 +1423,9 @@ U_BOOT_CMD( #if defined(CONFIG_I2C_MULTI_BUS) "i2c dev [dev] - show or set current I2C bus\n" #endif /* CONFIG_I2C_MULTI_BUS */ +#if defined(CONFIG_I2C_EDID) + "i2c edid chip - print EDID configuration information\n" +#endif /* CONFIG_I2C_EDID */ "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device\n" "i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device\n" "i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)\n"