ret = i2c_master_send(ptn_bridge->client, buf, ARRAY_SIZE(buf)); if (ret < 0) {
DRM_ERROR("Failed to send i2c command, ret=%d\n", ret); return ret;
}
return 0;
}
staticint ptn3460_select_edid(struct ptn3460_bridge *ptn_bridge)
{ int ret; char val;
/* Load the selected edid into SRAM (accessed at PTN3460_EDID_ADDR) */
ret = ptn3460_write_byte(ptn_bridge, PTN3460_EDID_SRAM_LOAD_ADDR,
ptn_bridge->edid_emulation); if (ret) {
DRM_ERROR("Failed to transfer EDID to sram, ret=%d\n", ret); return ret;
}
/* Enable EDID emulation and select the desired EDID */
val = 1 << PTN3460_EDID_ENABLE_EMULATION |
ptn_bridge->edid_emulation << PTN3460_EDID_EMULATION_SELECTION;
ret = ptn3460_write_byte(ptn_bridge, PTN3460_EDID_EMULATION_ADDR, val); if (ret) {
DRM_ERROR("Failed to write EDID value, ret=%d\n", ret); return ret;
}
/* * There's a bug in the PTN chip where it falsely asserts hotplug before * it is fully functional. We're forced to wait for the maximum start up * time specified in the chip's datasheet to make sure we're really up.
*/
msleep(90);
ret = ptn3460_select_edid(ptn_bridge); if (ret)
DRM_ERROR("Select EDID failed ret=%d\n", ret);
/* Let this driver create connector if requested */
ret = drm_bridge_attach(encoder, ptn_bridge->panel_bridge,
bridge, flags | DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret < 0) return ret;
if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) return 0;
ptn_bridge->connector.polled = DRM_CONNECTOR_POLL_HPD;
ret = drm_connector_init(bridge->dev, &ptn_bridge->connector,
&ptn3460_connector_funcs, DRM_MODE_CONNECTOR_LVDS); if (ret) {
DRM_ERROR("Failed to initialize connector with drm\n"); return ret;
}
drm_connector_helper_add(&ptn_bridge->connector,
&ptn3460_connector_helper_funcs);
drm_connector_register(&ptn_bridge->connector);
drm_connector_attach_encoder(&ptn_bridge->connector,
encoder);
ptn_bridge->gpio_pd_n = devm_gpiod_get(&client->dev, "powerdown",
GPIOD_OUT_HIGH); if (IS_ERR(ptn_bridge->gpio_pd_n)) {
ret = PTR_ERR(ptn_bridge->gpio_pd_n);
dev_err(dev, "cannot get gpio_pd_n %d\n", ret); return ret;
}
/* * Request the reset pin low to avoid the bridge being * initialized prematurely
*/
ptn_bridge->gpio_rst_n = devm_gpiod_get(&client->dev, "reset",
GPIOD_OUT_LOW); if (IS_ERR(ptn_bridge->gpio_rst_n)) {
ret = PTR_ERR(ptn_bridge->gpio_rst_n);
DRM_ERROR("cannot get gpio_rst_n %d\n", ret); return ret;
}
ret = of_property_read_u32(dev->of_node, "edid-emulation",
&ptn_bridge->edid_emulation); if (ret) {
dev_err(dev, "Can't read EDID emulation value\n"); return ret;
}
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.