Re: [PATCH v12 05/10] drm/bridge: anx7625: Check for Type-C during panel registration

From: Andy Shevchenko
Date: Tue Feb 21 2023 - 06:51:21 EST


On Tue, Feb 21, 2023 at 05:50:49PM +0800, Pin-yen Lin wrote:
> The output port endpoints can be connected to USB-C connectors.
> Running drm_of_find_panel_or_bridge() with such endpoints leads to
> a continuous return value of -EPROBE_DEFER, even though there is
> no panel present.
>
> To avoid this, check for the existence of a "mode-switch" property in
> the port endpoint, and skip panel registration completely if so.

...

> + port_node = of_graph_get_port_by_id(np, 1);
> + fwnode_for_each_typec_mode_switch(&port_node->fwnode, fwnode) {
> + fwnode_handle_put(fwnode);
> + return 0;
> + }

With the proposed count API:

unsigned int count;
...
port_node = ...
count = typec_mode_switch_node_count(&port_node->fwnode);
if (count == 0)
return 0;

--
With Best Regards,
Andy Shevchenko