Commit 735987c5a85b7e249903248f2ec85b467afa3de8

Authored by Tom Wai-Hong Tam
Committed by Tom Rini
1 parent d46b5f7dcb

edid: Add I2C command for printing the EDID

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 <waihong@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 2 changed files with 44 additions and 0 deletions Side-by-side Diff

... ... @@ -1488,6 +1488,11 @@
1488 1488  
1489 1489 Support drawing of RLE8-compressed bitmaps on the LCD.
1490 1490  
  1491 + CONFIG_I2C_EDID
  1492 +
  1493 + Enables an 'i2c edid' command which can read EDID
  1494 + information over I2C from an attached LCD display.
  1495 +
1491 1496  
1492 1497 - Splash Screen Support: CONFIG_SPLASH_SCREEN
1493 1498  
... ... @@ -78,6 +78,7 @@
78 78  
79 79 #include <common.h>
80 80 #include <command.h>
  81 +#include <edid.h>
81 82 #include <environment.h>
82 83 #include <i2c.h>
83 84 #include <malloc.h>
... ... @@ -1340,6 +1341,38 @@
1340 1341 }
1341 1342 #endif
1342 1343  
  1344 +/*
  1345 + * Syntax:
  1346 + * i2c edid {i2c_chip}
  1347 + */
  1348 +#if defined(CONFIG_I2C_EDID)
  1349 +int do_edid(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
  1350 +{
  1351 + u_char chip;
  1352 + struct edid1_info edid;
  1353 +
  1354 + if (argc < 2) {
  1355 + cmd_usage(cmdtp);
  1356 + return 1;
  1357 + }
  1358 +
  1359 + chip = simple_strtoul(argv[1], NULL, 16);
  1360 + if (i2c_read(chip, 0, 1, (uchar *)&edid, sizeof(edid)) != 0) {
  1361 + puts("Error reading EDID content.\n");
  1362 + return 1;
  1363 + }
  1364 +
  1365 + if (edid_check_info(&edid)) {
  1366 + puts("Content isn't valid EDID.\n");
  1367 + return 1;
  1368 + }
  1369 +
  1370 + edid_print_info(&edid);
  1371 + return 0;
  1372 +
  1373 +}
  1374 +#endif /* CONFIG_I2C_EDID */
  1375 +
1343 1376 #if defined(CONFIG_I2C_MUX)
1344 1377 /**
1345 1378 * do_i2c_add_bus() - Handle the "i2c bus" command-line command
... ... @@ -1487,6 +1520,9 @@
1487 1520 #if defined(CONFIG_I2C_MULTI_BUS)
1488 1521 U_BOOT_CMD_MKENT(dev, 1, 1, do_i2c_bus_num, "", ""),
1489 1522 #endif /* CONFIG_I2C_MULTI_BUS */
  1523 +#if defined(CONFIG_I2C_EDID)
  1524 + U_BOOT_CMD_MKENT(edid, 1, 1, do_edid, "", ""),
  1525 +#endif /* CONFIG_I2C_EDID */
1490 1526 U_BOOT_CMD_MKENT(loop, 3, 1, do_i2c_loop, "", ""),
1491 1527 U_BOOT_CMD_MKENT(md, 3, 1, do_i2c_md, "", ""),
1492 1528 U_BOOT_CMD_MKENT(mm, 2, 1, do_i2c_mm, "", ""),
... ... @@ -1547,6 +1583,9 @@
1547 1583 #if defined(CONFIG_I2C_MULTI_BUS)
1548 1584 "i2c dev [dev] - show or set current I2C bus\n"
1549 1585 #endif /* CONFIG_I2C_MULTI_BUS */
  1586 +#if defined(CONFIG_I2C_EDID)
  1587 + "i2c edid chip - print EDID configuration information\n"
  1588 +#endif /* CONFIG_I2C_EDID */
1550 1589 "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device\n"
1551 1590 "i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device\n"
1552 1591 "i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)\n"