[Intel-gfx] [PATCH 15/44] drm/i915: Make panel/backlight safe to setup/cleanup multiple times

Jani Nikula jani.nikula at linux.intel.com
Thu Jun 16 06:34:05 UTC 2016


On Wed, 15 Jun 2016, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Allow everyone to call intel_panel_setup_backlight() (i.e. only take
> effect if we have previously been initialised for use as a panel) and,
> for paranoia, allow intel_panel_cleanup_backlight() to be called
> multiple times.

Maybe I'm dumb or blind or both, but I don't see why this patch is
needed, even in light of the following patches. Please enlighten me.

BR,
Jani.

>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_drv.h   | 1 +
>  drivers/gpu/drm/i915/intel_panel.c | 7 +++++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 8dc67adace6b..111038e29ec3 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -201,6 +201,7 @@ struct intel_panel {
>  	struct drm_display_mode *fixed_mode;
>  	struct drm_display_mode *downclock_mode;
>  	int fitting_mode;
> +	bool is_panel;
>  
>  	/* backlight */
>  	struct {
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index f0b1602c3258..8bd076b11af1 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -1670,6 +1670,9 @@ int intel_panel_setup_backlight(struct drm_connector *connector, enum pipe pipe)
>  	struct intel_panel *panel = &intel_connector->panel;
>  	int ret;
>  
> +	if (!panel->is_panel)
> +		return 0;
> +
>  	if (!dev_priv->vbt.backlight.present) {
>  		if (dev_priv->quirks & QUIRK_BACKLIGHT_PRESENT) {
>  			DRM_DEBUG_KMS("no backlight present per VBT, but present per quirk\n");
> @@ -1709,6 +1712,9 @@ void intel_panel_destroy_backlight(struct drm_connector *connector)
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>  	struct intel_panel *panel = &intel_connector->panel;
>  
> +	if (!panel->backlight.present)
> +		return;
> +
>  	/* dispose of the pwm */
>  	if (panel->backlight.pwm)
>  		pwm_put(panel->backlight.pwm);
> @@ -1796,6 +1802,7 @@ int intel_panel_init(struct intel_panel *panel,
>  
>  	panel->fixed_mode = fixed_mode;
>  	panel->downclock_mode = downclock_mode;
> +	panel->is_panel = true;
>  
>  	return 0;
>  }

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list