MCPcopy Create free account
hub / github.com/F-Stack/f-stack / a10hdmi_get_edid

Function a10hdmi_get_edid

freebsd/arm/allwinner/a10_hdmi.c:478–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478static int
479a10hdmi_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
521static void
522a10hdmi_set_audiomode(device_t dev, const struct videomode *mode)

Callers

nothing calls this directly

Calls 5

device_get_softcFunction · 0.85
device_printfFunction · 0.85
a10hdmi_ddc_readFunction · 0.85
a10hdmi_detect_hdmiFunction · 0.85
DELAYFunction · 0.50

Tested by

no test coverage detected