[PATCH 04/13] drm/sun4i: tcon-top: Keep mixer routes distinct
Chen-Yu Tsai
wens at kernel.org
Mon Aug 3 09:44:55 PDT 2026
On Tue, Aug 4, 2026 at 12:11 AM Jernej Skrabec <jernej.skrabec at gmail.com> wrote:
>
> Both mixer selectors reset to TCON 0. Selecting the same TCON for both
> mixers causes black or corrupted output.
>
> When a route would collide, park the other mixer on another described
> TCON, or an unused selector if none exists.
>
> Since the TCON index is now used as a shift, also reject negative
> values.
>
> Tested on Orange Pi 3 with TCON_LCD0 and TCON_TV0.
>
> Link: https://lore.kernel.org/linux-sunxi/Zn8GVkpwXwhaUFno@titan/
> Link: https://lore.kernel.org/linux-sunxi/20241108-tcon_fix-v1-1-616218cc0d5f@jookia.org/
> Fixes: 05db311a792d ("drm/sun4i: tcon-top: Add helpers for mux switching")
> Signed-off-by: Jernej Skrabec <jernej.skrabec at gmail.com>
Reviewed-by: Chen-Yu Tsai <wens at kernel.org>
Though I have a couple nits.
> ---
> drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 71 +++++++++++++++++++++-----
> drivers/gpu/drm/sun4i/sun8i_tcon_top.h | 6 +++
> 2 files changed, 65 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
> index 8adda578c51b..9cbd655518b2 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
> @@ -25,6 +25,49 @@ static bool sun8i_tcon_top_node_is_tcon_top(struct device_node *node)
> return !!of_match_node(sun8i_tcon_top_of_table, node);
> }
>
> +static unsigned int sun8i_tcon_top_get_tcon_map(struct device_node *node)
> +{
> + static const u32 out_ports[] = {
> + TCON_TOP_MIXER0_OUT_PORT,
> + TCON_TOP_MIXER1_OUT_PORT,
> + };
> + unsigned int i, map = 0;
> +
> + for (i = 0; i < ARRAY_SIZE(out_ports); i++) {
You can declare `i` directly in the for statement.
> + struct device_node *port;
> +
> + port = of_graph_get_port_by_id(node, out_ports[i]);
You could probably use the __free() cleanup macro and make `port`
scoped and put the reference automatically.
> + if (!port)
> + continue;
> +
> + for_each_of_graph_port_endpoint(port, ep) {
> + struct of_endpoint endpoint;
> +
> + if (of_graph_parse_endpoint(ep, &endpoint))
> + continue;
> +
> + if (endpoint.id < TCON_TOP_PORT_TCON_NUM)
> + map |= BIT(endpoint.id);
> + }
> +
> + of_node_put(port);
And this line wouldn't be needed.
> + }
> +
> + return map;
> +}
> +
[...]
More information about the linux-arm-kernel
mailing list