Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm: rz-du: Support panels connected directly to the DPAD output

This patch is based on the commit 73eb5476df72 ("drm: rcar-du: Support
panels connected directly to the DPAD outputs").

The RZ DU driver assumes that a bridge is always connected to the DU
output. This is valid for the HDMI output, but the DPAD output can be
connected directly to a panel, in which case no bridge is available.

To support this use case, detect whether the entities connected to the DU
DPAD output is encoders or panels based on the number of ports of their DT
node, and retrieve the corresponding type of DRM objects. For panels,
additionally create panel bridge instances.

Signed-off-by: hienhuynh <hien.huynh.px@renesas.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Link: https://lore.kernel.org/r/20250508095042.25164-1-biju.das.jz@bp.renesas.com

authored by

hienhuynh and committed by
Biju Das
1f372c1f 64a8d0aa

+40 -4
+40 -4
drivers/gpu/drm/renesas/rz-du/rzg2l_du_encoder.c
··· 22 22 * Encoder 23 23 */ 24 24 25 + static unsigned int rzg2l_du_encoder_count_ports(struct device_node *node) 26 + { 27 + struct device_node *ports; 28 + struct device_node *port; 29 + unsigned int num_ports = 0; 30 + 31 + ports = of_get_child_by_name(node, "ports"); 32 + if (!ports) 33 + ports = of_node_get(node); 34 + 35 + for_each_child_of_node(ports, port) { 36 + if (of_node_name_eq(port, "port")) 37 + num_ports++; 38 + } 39 + 40 + of_node_put(ports); 41 + 42 + return num_ports; 43 + } 44 + 25 45 static const struct drm_encoder_funcs rzg2l_du_encoder_funcs = { 26 46 }; 27 47 ··· 70 50 struct drm_bridge *bridge; 71 51 int ret; 72 52 73 - /* Locate the DRM bridge from the DT node. */ 74 - bridge = of_drm_find_bridge(enc_node); 75 - if (!bridge) 76 - return -EPROBE_DEFER; 53 + /* 54 + * Locate the DRM bridge from the DT node. For the DPAD outputs, if the 55 + * DT node has a single port, assume that it describes a panel and 56 + * create a panel bridge. 57 + */ 58 + if (output == RZG2L_DU_OUTPUT_DPAD0 && rzg2l_du_encoder_count_ports(enc_node) == 1) { 59 + struct drm_panel *panel = of_drm_find_panel(enc_node); 60 + 61 + if (IS_ERR(panel)) 62 + return PTR_ERR(panel); 63 + 64 + bridge = devm_drm_panel_bridge_add_typed(rcdu->dev, panel, 65 + DRM_MODE_CONNECTOR_DPI); 66 + if (IS_ERR(bridge)) 67 + return PTR_ERR(bridge); 68 + } else { 69 + bridge = of_drm_find_bridge(enc_node); 70 + if (!bridge) 71 + return -EPROBE_DEFER; 72 + } 77 73 78 74 dev_dbg(rcdu->dev, "initializing encoder %pOF for output %s\n", 79 75 enc_node, rzg2l_du_output_name(output));