[Intel-gfx] [PATCH 3/3] drm/i915: Add backlight Control using DPCD registers for DP connectors

Jani Nikula jani.nikula at linux.intel.com
Thu Mar 31 07:31:20 UTC 2016


On Wed, 30 Mar 2016, Yetunde Adebisi <yetundex.adebisi at intel.com> wrote:
> This patch enables support for DPCD backlight control for DP connectors.
> The VESA spec defines DPCD backlight control only for eDP but some add-on
> cards like the Chrontel CH7511B DP-LVDS cards have the display control
> DPCD registers enabled.
> This patch registers a backlight device exposed via sysfs that controls the
> connected panel backlight by writing to DPCD registers on the CH7511B
> add-on card

I'm not convinced. Seems like a gross spec violating hack to work around
the issue that CH7511B is not configured as eDP in the first place.

BR,
Jani.


>
> Signed-off-by: Yetunde Adebisi <yetundex.adebisi at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c               | 25 ++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_dp_aux_backlight.c |  7 ++++++
>  drivers/gpu/drm/i915/intel_drv.h              |  2 ++
>  drivers/gpu/drm/i915/intel_panel.c            | 33 +++++++++++++++++++--------
>  4 files changed, 57 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 9e9e7f1..8bbfb7f 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -5631,6 +5631,30 @@ intel_dp_drrs_init(struct intel_connector *intel_connector,
>  	return downclock_mode;
>  }
>  
> +/*
> + * Called on DP connector initialization to check for aux backlight control
> + * capability on the sink device and if present, initialize it.
> + */
> +static void intel_dp_init_aux_backlight(struct intel_dp *intel_dp,
> +		struct drm_connector *connector)
> +{
> +	struct intel_connector *intel_connector = to_intel_connector(connector);
> +
> +	if (is_edp(intel_dp))
> +		return;
> +
> +	if (i915.enable_dpcd_backlight &&
> +			(intel_dp_dpcd_read_wake(&intel_dp->aux, DP_EDP_DPCD_REV,
> +					intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
> +							sizeof(intel_dp->edp_dpcd)) &&
> +							intel_dp_aux_init_backlight_funcs(intel_connector) == 0) {
> +		intel_panel_setup_backlight(connector, INVALID_PIPE);
> +
> +		intel_connector->panel.backlight.power = intel_dp_aux_backlight_power;
> +		intel_connector->panel.backlight.enabled = true;
> +		}
> +}
> +
>  static bool intel_edp_init_connector(struct intel_dp *intel_dp,
>  				     struct intel_connector *intel_connector)
>  {
> @@ -5868,6 +5892,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
>  		goto fail;
>  	}
>  
> +	intel_dp_init_aux_backlight(intel_dp, connector);
>  	intel_dp_add_properties(intel_dp, connector);
>  
>  	/* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
> diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> index a5361d6..efa657f 100644
> --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> @@ -168,3 +168,10 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)
>  
>  	return 0;
>  }
> +
> +void intel_dp_aux_backlight_power(struct intel_connector *connector,
> +				      bool enable)
> +{
> +	set_aux_backlight_enable(enc_to_intel_dp(&connector->encoder->base),
> +			enable);
> +}
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 782a103..ab92e89 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1324,6 +1324,8 @@ ssize_t intel_dp_dpcd_read_wake(struct drm_dp_aux *aux, unsigned int offset,
>  
>  /* intel_dp_aux_backlight.c */
>  int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector);
> +void intel_dp_aux_backlight_power(struct intel_connector *connector,
> +				      bool enable);
>  
>  /* intel_dp_mst.c */
>  int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index cdfcdad..d678e55 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -1193,16 +1193,29 @@ static int intel_backlight_device_register(struct intel_connector *connector)
>  	else
>  		props.power = FB_BLANK_POWERDOWN;
>  
> -	/*
> -	 * Note: using the same name independent of the connector prevents
> -	 * registration of multiple backlight devices in the driver.
> -	 */
> -	panel->backlight.device =
> -		backlight_device_register("intel_backlight",
> -					  connector->base.kdev,
> -					  connector,
> -					  &intel_backlight_device_ops, &props);
> -
> +	if (connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
> +		char *name = kasprintf(GFP_KERNEL, "intel_aux_backlight-%s",
> +				connector->base.name);
> +		if (!name)
> +			return -ENOMEM;
> +
> +		panel->backlight.device =
> +			backlight_device_register(name,
> +						  connector->base.kdev,
> +						  connector,
> +						  &intel_backlight_device_ops, &props);
> +			kfree(name);
> +	} else {
> +		/*
> +		 * Note: using the same name independent of the connector prevents
> +		 * registration of multiple backlight devices in the driver.
> +		 */
> +		panel->backlight.device =
> +			backlight_device_register("intel_backlight",
> +						  connector->base.kdev,
> +						  connector,
> +						  &intel_backlight_device_ops, &props);
> +	}
>  	if (IS_ERR(panel->backlight.device)) {
>  		DRM_ERROR("Failed to register backlight: %ld\n",
>  			  PTR_ERR(panel->backlight.device));

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list