[Intel-gfx] [v10 03/12] drm/i915/display: Attach HDR property for capable Gen9 devices

Ville Syrjälä ville.syrjala at linux.intel.com
Wed Nov 25 16:36:18 UTC 2020


On Wed, Nov 04, 2020 at 01:00:53PM +0530, Uma Shankar wrote:
> Attach HDR property for Gen9 devices with MCA LSPCON
> chips.
> 
> v2: Cleaned HDR property attachment logic based on capability
> as per Jani Nikula's suggestion.
> 
> v3: Fixed the HDR property attachment logic as per the new changes
> by Kai-Feng to align with lspcon detection failure on some devices.
> 
> v4: Add HDR proprty in late_register to handle lspcon detection,
> as suggested by Ville.
> 
> v5: Init Lspcon only if advertized from BIOS.
> 
> Signed-off-by: Uma Shankar <uma.shankar at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c     | 14 ++++++++++++++
>  drivers/gpu/drm/i915/display/intel_lspcon.c |  2 +-
>  drivers/gpu/drm/i915/display/intel_lspcon.h |  1 +
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index cf09aca7607b..07eda10f8add 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -6714,6 +6714,8 @@ intel_dp_connector_register(struct drm_connector *connector)
>  {
>  	struct drm_i915_private *i915 = to_i915(connector->dev);
>  	struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector));
> +	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> +	struct intel_lspcon *lspcon = &dig_port->lspcon;
>  	int ret;
>  
>  	ret = intel_connector_register(connector);
> @@ -6727,6 +6729,18 @@ intel_dp_connector_register(struct drm_connector *connector)
>  	ret = drm_dp_aux_register(&intel_dp->aux);
>  	if (!ret)
>  		drm_dp_cec_register_connector(&intel_dp->aux, connector);
> +
> +	if (!intel_bios_is_lspcon_present(i915, dig_port->base.port))
> +		return ret;
> +
> +	if (lspcon_init(dig_port)) {
> +		lspcon_detect_hdr_capability(lspcon);
> +		if (lspcon->hdr_supported)

Kinda messy having all these ifs for this little thing.
Probsbly should do a followup to clean up all this lspcon
init/resume stuff to be less convoluted.

> +			drm_object_attach_property(&connector->base,
> +						   connector->dev->mode_config.hdr_output_metadata_property,
> +						   0);

Assuming this doesn't trip up the
"can't attach props to registered connectors" checks

Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

> +	}
> +
>  	return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c
> index 46565ae555b1..336494b60d11 100644
> --- a/drivers/gpu/drm/i915/display/intel_lspcon.c
> +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c
> @@ -553,7 +553,7 @@ void lspcon_wait_pcon_mode(struct intel_lspcon *lspcon)
>  	lspcon_wait_mode(lspcon, DRM_LSPCON_MODE_PCON);
>  }
>  
> -static bool lspcon_init(struct intel_digital_port *dig_port)
> +bool lspcon_init(struct intel_digital_port *dig_port)
>  {
>  	struct intel_dp *dp = &dig_port->dp;
>  	struct intel_lspcon *lspcon = &dig_port->lspcon;
> diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.h b/drivers/gpu/drm/i915/display/intel_lspcon.h
> index 98043ba50dd4..42ccb21c908f 100644
> --- a/drivers/gpu/drm/i915/display/intel_lspcon.h
> +++ b/drivers/gpu/drm/i915/display/intel_lspcon.h
> @@ -15,6 +15,7 @@ struct intel_digital_port;
>  struct intel_encoder;
>  struct intel_lspcon;
>  
> +bool lspcon_init(struct intel_digital_port *dig_port);
>  void lspcon_detect_hdr_capability(struct intel_lspcon *lspcon);
>  void lspcon_resume(struct intel_digital_port *dig_port);
>  void lspcon_wait_pcon_mode(struct intel_lspcon *lspcon);
> -- 
> 2.26.2

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list