[PATCH 07/10] drm/i915: Implement MST Aux device registration

Ville Syrjälä ville.syrjala at linux.intel.com
Wed Jul 10 10:06:57 UTC 2019


On Thu, Jul 04, 2019 at 03:05:16PM -0400, sunpeng.li at amd.com wrote:
> From: Leo Li <sunpeng.li at amd.com>
> 
> Implement late_register and early_unregister hooks for MST connectors.
> Call drm helpers for MST connector registration, which registers the
> AUX devices.
> 
> Signed-off-by: Leo Li <sunpeng.li at amd.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp_mst.c | 29 +++++++++++++++++++--
>  1 file changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 60652ebbdf61..be309016f746 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -400,13 +400,38 @@ intel_dp_mst_detect(struct drm_connector *connector, bool force)
>  				      intel_connector->port);
>  }
>  
> +static int
> +intel_dp_mst_connector_late_register(struct drm_connector *connector)
> +{
> +	struct intel_connector *intel_connector = to_intel_connector(connector);
> +	struct drm_dp_mst_port *port = intel_connector->port;
> +
> +	int ret;
> +
> +	ret = intel_connector_register(connector);
> +	if (ret)
> +		return ret;
> +
> +	return drm_dp_mst_connector_late_register(connector, port);

We should probably unwind properly in case of an error from this guy.
Currently it won't matter since intel_connector_register() only sets
up the backlight and that doesn't exist for MST connectors, but if and
when someone adds more stuff to intel_connector_register() they may not
notice that the caller is leaking.

> +}
> +
> +static void
> +intel_dp_mst_connector_early_unregister(struct drm_connector *connector)
> +{
> +	struct intel_connector *intel_connector = to_intel_connector(connector);
> +	struct drm_dp_mst_port *port = intel_connector->port;
> +
> +	drm_dp_mst_connector_early_unregister(connector, port);
> +	intel_connector_unregister(connector);
> +}
> +
>  static const struct drm_connector_funcs intel_dp_mst_connector_funcs = {
>  	.detect = intel_dp_mst_detect,
>  	.fill_modes = drm_helper_probe_single_connector_modes,
>  	.atomic_get_property = intel_digital_connector_atomic_get_property,
>  	.atomic_set_property = intel_digital_connector_atomic_set_property,
> -	.late_register = intel_connector_register,
> -	.early_unregister = intel_connector_unregister,
> +	.late_register = intel_dp_mst_connector_late_register,
> +	.early_unregister = intel_dp_mst_connector_early_unregister,
>  	.destroy = intel_connector_destroy,
>  	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>  	.atomic_duplicate_state = intel_digital_connector_duplicate_state,
> -- 
> 2.22.0

-- 
Ville Syrjälä
Intel


More information about the amd-gfx mailing list