| 476 | } |
| 477 | |
| 478 | static int |
| 479 | a10hdmi_get_edid(device_t dev, uint8_t **edid, uint32_t *edid_len) |
| 480 | { |
| 481 | struct a10hdmi_softc *sc; |
| 482 | int error, retry; |
| 483 | |
| 484 | sc = device_get_softc(dev); |
| 485 | retry = DDC_READ_RETRY; |
| 486 | |
| 487 | while (--retry > 0) { |
| 488 | /* I2C software reset */ |
| 489 | HDMI_WRITE(sc, DDC_FIFO_CTRL, 0); |
| 490 | HDMI_WRITE(sc, DDC_CTRL, CTRL_DDC_EN | CTRL_DDC_SWRST); |
| 491 | DELAY(SWRST_DELAY); |
| 492 | if (HDMI_READ(sc, DDC_CTRL) & CTRL_DDC_SWRST) { |
| 493 | device_printf(dev, "DDC software reset failed\n"); |
| 494 | return (ENXIO); |
| 495 | } |
| 496 | |
| 497 | /* Configure DDC clock */ |
| 498 | HDMI_WRITE(sc, DDC_CLOCK, DDC_CLOCK_M | DDC_CLOCK_N); |
| 499 | |
| 500 | /* Enable SDA/SCL */ |
| 501 | HDMI_WRITE(sc, DDC_CTRL_LINE, |
| 502 | DDC_LINE_SCL_ENABLE | DDC_LINE_SDA_ENABLE); |
| 503 | |
| 504 | /* Read EDID block */ |
| 505 | error = a10hdmi_ddc_read(sc, 0, sc->edid); |
| 506 | if (error == 0) { |
| 507 | *edid = sc->edid; |
| 508 | *edid_len = sizeof(sc->edid); |
| 509 | break; |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | if (error == 0) |
| 514 | a10hdmi_detect_hdmi(sc, &sc->has_hdmi, &sc->has_audio); |
| 515 | else |
| 516 | sc->has_hdmi = sc->has_audio = 0; |
| 517 | |
| 518 | return (error); |
| 519 | } |
| 520 | |
| 521 | static void |
| 522 | a10hdmi_set_audiomode(device_t dev, const struct videomode *mode) |
nothing calls this directly
no test coverage detected