[PATCH v11 6/9] drm/bridge: anx7625: Register Type C mode switches

Andy Shevchenko andriy.shevchenko at linux.intel.com
Mon Feb 6 12:16:19 UTC 2023


On Sat, Feb 04, 2023 at 09:30:37PM +0800, Pin-yen Lin wrote:
> Register USB Type-C mode switches when the "mode-switch" property and
> relevant ports are available in Device Tree. Configure the crosspoint
> switch based on the entered alternate mode for a specific Type-C
> connector.
> 
> Crosspoint switch can also be used for switching the output signal for
> different orientations of a single USB Type-C connector, but the
> orientation switch is not implemented yet. A TODO is added for this.

...

> +	for (i = 0; i < 2; i++) {
> +		if (ctx->port_data[i].dp_connected)
> +			anx7625_set_crosspoint_switch(
> +				ctx, ctx->port_data[i].orientation);

It's more than enough room to place ctx on the previous line.

> +	}

...

> +	struct anx7625_data *ctx = (struct anx7625_data *) port->data;

Redundant explicit casting.

...

> +	struct device *dev = &ctx->client->dev;

Do you really need to keep client in that struct and not simply dev?

...

> +	/* dp on, power on first */

DP ?

...

> +	/* dp off, power off last */

Ditto.

...

> +		num_lanes = fwnode_property_read_u32_array(fwnode, "data-lanes",
> +							   NULL, 0);

Read the kernel doc for this API and amend your code accordingly.

...

> +		if (num_lanes <= 0 || num_lanes > 2) {
> +			dev_err(dev,
> +				"Error on getting data lanes count from %pfwP: %d\n",
> +				fwnode, num_lanes);
> +			ret = num_lanes;

ret == 0?! Carefully consider all cases.

> +			goto unregister_mux;
> +		}

-- 
With Best Regards,
Andy Shevchenko




More information about the dri-devel mailing list