ret = clk_set_rate(oldi->serial, rate); if (ret) {
dev_err(oldi->dev, "OLDI%u: failed to set serial clk rate to %lu Hz\n",
oldi->oldi_instance, rate); return ret;
}
new_rate = clk_get_rate(oldi->serial);
if (dispc_pclk_diff(rate, new_rate) > 5)
dev_warn(oldi->dev, "OLDI%u Clock rate %lu differs over 5%% from requested %lu\n",
oldi->oldi_instance, new_rate, rate);
/* * The power control bits are Active Low, and remain powered off by * default. That is, the bits are set to 1. To power on the OLDI TXes, * the bits must be cleared to 0. Since there are cases where not all * OLDI TXes are being used, the power logic selectively powers them * on. * Setting the variable 'val' to particular bit masks, makes sure that * the undesired OLDI TXes remain powered off.
*/
if (enable) { switch (oldi->link_type) { case OLDI_MODE_SINGLE_LINK: /* Power-on only the required OLDI TX's IO*/
mask = OLDI_PWRDOWN_TX(oldi->oldi_instance) | OLDI_PWRDN_BG; break; case OLDI_MODE_CLONE_SINGLE_LINK: case OLDI_MODE_DUAL_LINK: /* Power-on both the OLDI TXes' IOs */
mask = OLDI_PWRDOWN_TX(oldi->oldi_instance) |
OLDI_PWRDOWN_TX(oldi->companion_instance) |
OLDI_PWRDN_BG; break; default: /* * This code execution should never reach here as any * OLDI with an unsupported OLDI mode would never get * registered in the first place. * However, power-off the OLDI in concern just in case.
*/
mask = OLDI_PWRDOWN_TX(oldi->oldi_instance);
enable = false; break;
}
} else { switch (oldi->link_type) { case OLDI_MODE_CLONE_SINGLE_LINK: case OLDI_MODE_DUAL_LINK:
mask = OLDI_PWRDOWN_TX(oldi->oldi_instance) |
OLDI_PWRDOWN_TX(oldi->companion_instance) |
OLDI_PWRDN_BG; break; case OLDI_MODE_SINGLE_LINK: default:
mask = OLDI_PWRDOWN_TX(oldi->oldi_instance); break;
}
}
ret = tidss_configure_oldi(oldi->tidss, oldi->parent_vp, oldi_cfg); if (ret == -ETIMEDOUT)
dev_warn(oldi->dev, "OLDI%u: timeout waiting for OLDI reset done.\n",
oldi->oldi_instance);
/* * Find if the OLDI is paired with another OLDI for combined OLDI * operation (dual-link or clone).
*/
companion = of_parse_phandle(oldi_tx, "ti,companion-oldi", 0); if (!companion) /* * The OLDI TX does not have a companion, nor is it a * secondary OLDI. It will operate independently.
*/ return OLDI_MODE_SINGLE_LINK;
if (of_property_read_u32(companion, "reg", &companion_reg)) return OLDI_MODE_UNSUPPORTED;
if (companion_reg > (TIDSS_MAX_OLDI_TXES - 1)) /* Invalid companion OLDI reg value. */ return OLDI_MODE_UNSUPPORTED;
*companion_instance = (int)companion_reg;
if (of_property_read_bool(oldi_tx, "ti,secondary-oldi"))
secondary_oldi = true;
/* * We need to work out if the sink is expecting us to function in * dual-link mode. We do this by looking at the DT port nodes, the * OLDI TX ports are connected to. If they are marked as expecting * even pixels and odd pixels, then we need to enable dual-link.
*/
port0 = of_graph_get_port_by_id(oldi_tx, 1);
port1 = of_graph_get_port_by_id(companion, 1);
pixel_order = drm_of_lvds_get_dual_link_pixel_order(port0, port1);
of_node_put(port0);
of_node_put(port1);
of_node_put(companion);
switch (pixel_order) { case -EINVAL: /* * The dual-link properties were not found in at least * one of the sink nodes. Since 2 OLDI ports are present * in the DT, it can be safely assumed that the required * configuration is Clone Mode.
*/ return (secondary_oldi ? OLDI_MODE_SECONDARY_CLONE_SINGLE_LINK :
OLDI_MODE_CLONE_SINGLE_LINK);
case DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS: /* * Primary OLDI can only support "ODD" pixels. So, from its * perspective, the pixel order has to be ODD-EVEN.
*/ return (secondary_oldi ? OLDI_MODE_UNSUPPORTED :
OLDI_MODE_DUAL_LINK);
case DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS: /* * Secondary OLDI can only support "EVEN" pixels. So, from its * perspective, the pixel order has to be EVEN-ODD.
*/ return (secondary_oldi ? OLDI_MODE_SECONDARY_DUAL_LINK :
OLDI_MODE_UNSUPPORTED);
ep = of_graph_get_endpoint_by_regs(oldi_tx, OLDI_INPUT_PORT, -1); if (ep) {
dss_port = of_graph_get_remote_port(ep); if (!dss_port) {
ret = -ENODEV; goto err_return_ep_port;
}
ret = of_property_read_u32(dss_port, "reg", parent_vp);
for_each_available_child_of_node(oldi_parent, child) {
ret = get_parent_dss_vp(child, &parent_vp); if (ret) { if (ret == -ENODEV) { /* * ENODEV means that this particular OLDI node * is not connected with the DSS, which is not * a harmful case. There could be another OLDI * which may still be connected. * Continue to search for that.
*/
ret = 0; continue;
} goto err_put_node;
}
ret = of_property_read_u32(child, "reg", &oldi_instance); if (ret) goto err_put_node;
/* * Now that it's confirmed that OLDI is connected with DSS, * let's continue getting the OLDI sinks ahead and other OLDI * properties.
*/
bridge = devm_drm_of_get_bridge(tidss->dev, child,
OLDI_OUTPUT_PORT, 0); if (IS_ERR(bridge)) { /* * Either there was no OLDI sink in the devicetree, or * the OLDI sink has not been added yet. In any case, * return. * We don't want to have an OLDI node connected to DSS * but not to any sink.
*/
ret = dev_err_probe(tidss->dev, PTR_ERR(bridge), "no panel/bridge for OLDI%u.\n",
oldi_instance); goto err_put_node;
}
link_type = get_oldi_mode(child, &companion_instance); if (link_type == OLDI_MODE_UNSUPPORTED) {
ret = dev_err_probe(tidss->dev, -EINVAL, "OLDI%u: Unsupported OLDI connection.\n",
oldi_instance); goto err_put_node;
} elseif ((link_type == OLDI_MODE_SECONDARY_CLONE_SINGLE_LINK) ||
(link_type == OLDI_MODE_CLONE_SINGLE_LINK)) { /* * The OLDI driver cannot support OLDI clone mode * properly at present. * The clone mode requires 2 working encoder-bridge * pipelines, generating from the same crtc. The DRM * framework does not support this at present. If * there were to be, say, 2 OLDI sink bridges each * connected to an OLDI TXes, they couldn't both be * supported simultaneously. * This driver still has some code pertaining to OLDI * clone mode configuration in DSS hardware for future, * when there is a better infrastructure in the DRM * framework to support 2 encoder-bridge pipelines * simultaneously. * Till that time, this driver shall error out if it * detects a clone mode configuration.
*/
ret = dev_err_probe(tidss->dev, -EOPNOTSUPP, "The OLDI driver does not support Clone Mode at present.\n"); goto err_put_node;
} elseif (link_type == OLDI_MODE_SECONDARY_DUAL_LINK) { /* * This is the secondary OLDI node, which serves as a * companion to the primary OLDI, when it is configured * for the dual-link mode. Since the primary OLDI will * be a part of bridge chain, no need to put this one * too. Continue onto the next OLDI node.
*/ continue;
}
oldi = devm_drm_bridge_alloc(tidss->dev, struct tidss_oldi, bridge,
&tidss_oldi_bridge_funcs); if (IS_ERR(oldi)) {
ret = PTR_ERR(oldi); goto err_put_node;
}
/* * Only the primary OLDI needs to reference the io-ctrl system * registers, and the serial clock. * We don't require a check for secondary OLDI in dual-link mode * because the driver will not create a drm_bridge instance. * But the driver will need to create a drm_bridge instance, * for secondary OLDI in clone mode (once it is supported).
*/ if (link_type != OLDI_MODE_SECONDARY_CLONE_SINGLE_LINK) {
oldi->io_ctrl = syscon_regmap_lookup_by_phandle(child, "ti,oldi-io-ctrl"); if (IS_ERR(oldi->io_ctrl)) {
ret = dev_err_probe(oldi->dev, PTR_ERR(oldi->io_ctrl), "OLDI%u: syscon_regmap_lookup_by_phandle failed.\n",
oldi_instance); goto err_put_node;
}
oldi->serial = of_clk_get_by_name(child, "serial"); if (IS_ERR(oldi->serial)) {
ret = dev_err_probe(oldi->dev, PTR_ERR(oldi->serial), "OLDI%u: Failed to get serial clock.\n",
oldi_instance); goto err_put_node;
}
}
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.