if (conn->hpd_gpio) { if (gpiod_get_value_cansleep(conn->hpd_gpio)) return connector_status_connected; else return connector_status_disconnected;
}
if (conn->bridge.ddc && drm_probe_ddc(conn->bridge.ddc)) return connector_status_connected;
switch (conn->bridge.type) { case DRM_MODE_CONNECTOR_DVIA: case DRM_MODE_CONNECTOR_DVID: case DRM_MODE_CONNECTOR_DVII: case DRM_MODE_CONNECTOR_HDMIA: case DRM_MODE_CONNECTOR_HDMIB: /* *ForDVIandHDMIconnectorsaDDCprobefailureindicates *thatnocableisconnected.
*/ return connector_status_disconnected;
case DRM_MODE_CONNECTOR_Composite: case DRM_MODE_CONNECTOR_SVIDEO: case DRM_MODE_CONNECTOR_VGA: default: /* *CompositeandS-Videoconnectorshavenootherdetection *meanthantheHPDGPIO.ForVGAconnectors,evenifwehave *anI2Cbus,wecan'tassumethatthecableisdisconnected *ifdrm_probe_ddcfails,assomecablesdon'twiretheDDC *pins.
*/ return connector_status_unknown;
}
}
type = (uintptr_t)of_device_get_match_data(&pdev->dev);
/* Get the exact connector type. */ switch (type) { case DRM_MODE_CONNECTOR_DVII: { bool analog, digital;
analog = of_property_read_bool(pdev->dev.of_node, "analog");
digital = of_property_read_bool(pdev->dev.of_node, "digital"); if (analog && !digital) {
conn->bridge.type = DRM_MODE_CONNECTOR_DVIA;
} elseif (!analog && digital) {
conn->bridge.type = DRM_MODE_CONNECTOR_DVID;
} elseif (analog && digital) {
conn->bridge.type = DRM_MODE_CONNECTOR_DVII;
} else {
dev_err(&pdev->dev, "DVI connector with no type\n"); return -EINVAL;
} break;
}
case DRM_MODE_CONNECTOR_HDMIA: { constchar *hdmi_type;
ret = of_property_read_string(pdev->dev.of_node, "type",
&hdmi_type); if (ret < 0) {
dev_err(&pdev->dev, "HDMI connector with no type\n"); return -EINVAL;
}
if (conn->hpd_irq >= 0) {
ret = devm_request_threaded_irq(&pdev->dev, conn->hpd_irq,
NULL, display_connector_hpd_irq,
IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING |
IRQF_ONESHOT, "HPD", conn); if (ret) {
dev_info(&pdev->dev, "Failed to request HPD edge interrupt, falling back to polling\n");
conn->hpd_irq = -EINVAL;
}
}
/* Retrieve the DDC I2C adapter for DVI, HDMI and VGA connectors. */ if (type == DRM_MODE_CONNECTOR_DVII ||
type == DRM_MODE_CONNECTOR_HDMIA ||
type == DRM_MODE_CONNECTOR_VGA) { struct device_node *phandle;
phandle = of_parse_phandle(pdev->dev.of_node, "ddc-i2c-bus", 0); if (phandle) {
conn->bridge.ddc = of_get_i2c_adapter_by_node(phandle);
of_node_put(phandle); if (!conn->bridge.ddc) return -EPROBE_DEFER;
} else {
dev_dbg(&pdev->dev, "No I2C bus specified, disabling EDID readout\n");
}
}
/* Get the DP PWR for DP connector. */ if (type == DRM_MODE_CONNECTOR_DisplayPort) { int ret;
ret = display_connector_get_supply(pdev, conn, "dp-pwr"); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "failed to get DP PWR regulator\n");
}
/* enable DDC */ if (type == DRM_MODE_CONNECTOR_HDMIA) { int ret;
if (IS_ERR(conn->ddc_en)) {
dev_err(&pdev->dev, "Couldn't get ddc-en gpio\n"); return PTR_ERR(conn->ddc_en);
}
ret = display_connector_get_supply(pdev, conn, "hdmi-pwr"); if (ret < 0) return dev_err_probe(&pdev->dev, ret, "failed to get HDMI +5V Power regulator\n");
}
if (conn->supply) {
ret = regulator_enable(conn->supply); if (ret) {
dev_err(&pdev->dev, "failed to enable PWR regulator: %d\n", ret); return ret;
}
}
conn->bridge.of_node = pdev->dev.of_node;
if (conn->bridge.ddc)
conn->bridge.ops |= DRM_BRIDGE_OP_EDID
| DRM_BRIDGE_OP_DETECT; /* Detecting the monitor requires reading DPCD */ if (conn->hpd_gpio && type != DRM_MODE_CONNECTOR_DisplayPort)
conn->bridge.ops |= DRM_BRIDGE_OP_DETECT; if (conn->hpd_irq >= 0)
conn->bridge.ops |= DRM_BRIDGE_OP_HPD;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.