Re: [PATCH 09/11] drm/i915: Convert backlight_lock to a mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 15 Sep 2014, Daniel Vetter <daniel.vetter@xxxxxxxx> wrote:
> Originally the irq safe spinlock was required because of asle
> interrupts. But since
>
> commit 7bd688cd66db93f6430f6e2b3145ee5686daa315
> Author: Jani Nikula <jani.nikula@xxxxxxxxx>
> Date:   Fri Nov 8 16:48:56 2013 +0200
>
>     drm/i915: handle backlight through chip specific functions

I think

commit 91a60f20712179e56b7a6c3d332a5f6f9a54aa11
Author: Jani Nikula <jani.nikula@xxxxxxxxx>
Date:   Thu Oct 31 18:55:48 2013 +0200

    drm/i915: move opregion asle request handling to a work queue

is probably more accurate.

Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx>

> there's no need for this any more. So switch to the simpler mutex.
>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_dma.c    |  2 +-
>  drivers/gpu/drm/i915/i915_drv.h    |  2 +-
>  drivers/gpu/drm/i915/intel_panel.c | 30 ++++++++++++------------------
>  3 files changed, 14 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 1403b01e8216..0bc1583114e7 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1614,7 +1614,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
>  
>  	spin_lock_init(&dev_priv->irq_lock);
>  	spin_lock_init(&dev_priv->gpu_error.lock);
> -	spin_lock_init(&dev_priv->backlight_lock);
> +	mutex_init(&dev_priv->backlight_lock);
>  	spin_lock_init(&dev_priv->uncore.lock);
>  	spin_lock_init(&dev_priv->mm.object_stat_lock);
>  	spin_lock_init(&dev_priv->mmio_flip_lock);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 17dfce0f4e68..07dafa2c2d8c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1528,7 +1528,7 @@ struct drm_i915_private {
>  	struct intel_overlay *overlay;
>  
>  	/* backlight registers and fields in struct intel_panel */
> -	spinlock_t backlight_lock;
> +	struct mutex backlight_lock;
>  
>  	/* LVDS info */
>  	bool no_aux_handshake;
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 18784470a760..f17ada3742de 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -538,14 +538,13 @@ static u32 intel_panel_get_backlight(struct intel_connector *connector)
>  	struct drm_device *dev = connector->base.dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	u32 val;
> -	unsigned long flags;
>  
> -	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
> +	mutex_lock(&dev_priv->backlight_lock);
>  
>  	val = dev_priv->display.get_backlight(connector);
>  	val = intel_panel_compute_brightness(connector, val);
>  
> -	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
> +	mutex_unlock(&dev_priv->backlight_lock);
>  
>  	DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val);
>  	return val;
> @@ -629,12 +628,11 @@ static void intel_panel_set_backlight(struct intel_connector *connector,
>  	struct intel_panel *panel = &connector->panel;
>  	enum pipe pipe = intel_get_pipe_from_connector(connector);
>  	u32 hw_level;
> -	unsigned long flags;
>  
>  	if (!panel->backlight.present || pipe == INVALID_PIPE)
>  		return;
>  
> -	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
> +	mutex_lock(&dev_priv->backlight_lock);
>  
>  	WARN_ON(panel->backlight.max == 0);
>  
> @@ -644,7 +642,7 @@ static void intel_panel_set_backlight(struct intel_connector *connector,
>  	if (panel->backlight.enabled)
>  		intel_panel_actually_set_backlight(connector, hw_level);
>  
> -	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
> +	mutex_unlock(&dev_priv->backlight_lock);
>  }
>  
>  /* set backlight brightness to level in range [0..max], assuming hw min is
> @@ -658,12 +656,11 @@ void intel_panel_set_backlight_acpi(struct intel_connector *connector,
>  	struct intel_panel *panel = &connector->panel;
>  	enum pipe pipe = intel_get_pipe_from_connector(connector);
>  	u32 hw_level;
> -	unsigned long flags;
>  
>  	if (!panel->backlight.present || pipe == INVALID_PIPE)
>  		return;
>  
> -	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
> +	mutex_lock(&dev_priv->backlight_lock);
>  
>  	WARN_ON(panel->backlight.max == 0);
>  
> @@ -679,7 +676,7 @@ void intel_panel_set_backlight_acpi(struct intel_connector *connector,
>  	if (panel->backlight.enabled)
>  		intel_panel_actually_set_backlight(connector, hw_level);
>  
> -	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
> +	mutex_unlock(&dev_priv->backlight_lock);
>  }
>  
>  static void pch_disable_backlight(struct intel_connector *connector)
> @@ -733,7 +730,6 @@ void intel_panel_disable_backlight(struct intel_connector *connector)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_panel *panel = &connector->panel;
>  	enum pipe pipe = intel_get_pipe_from_connector(connector);
> -	unsigned long flags;
>  
>  	if (!panel->backlight.present || pipe == INVALID_PIPE)
>  		return;
> @@ -749,14 +745,14 @@ void intel_panel_disable_backlight(struct intel_connector *connector)
>  		return;
>  	}
>  
> -	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
> +	mutex_lock(&dev_priv->backlight_lock);
>  
>  	if (panel->backlight.device)
>  		panel->backlight.device->props.power = FB_BLANK_POWERDOWN;
>  	panel->backlight.enabled = false;
>  	dev_priv->display.disable_backlight(connector);
>  
> -	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
> +	mutex_unlock(&dev_priv->backlight_lock);
>  }
>  
>  static void bdw_enable_backlight(struct intel_connector *connector)
> @@ -937,14 +933,13 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_panel *panel = &connector->panel;
>  	enum pipe pipe = intel_get_pipe_from_connector(connector);
> -	unsigned long flags;
>  
>  	if (!panel->backlight.present || pipe == INVALID_PIPE)
>  		return;
>  
>  	DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe));
>  
> -	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
> +	mutex_lock(&dev_priv->backlight_lock);
>  
>  	WARN_ON(panel->backlight.max == 0);
>  
> @@ -962,7 +957,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
>  	if (panel->backlight.device)
>  		panel->backlight.device->props.power = FB_BLANK_UNBLANK;
>  
> -	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
> +	mutex_unlock(&dev_priv->backlight_lock);
>  }
>  
>  #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
> @@ -1267,7 +1262,6 @@ int intel_panel_setup_backlight(struct drm_connector *connector)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>  	struct intel_panel *panel = &intel_connector->panel;
> -	unsigned long flags;
>  	int ret;
>  
>  	if (!dev_priv->vbt.backlight.present) {
> @@ -1280,9 +1274,9 @@ int intel_panel_setup_backlight(struct drm_connector *connector)
>  	}
>  
>  	/* set level and max in panel struct */
> -	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
> +	mutex_lock(&dev_priv->backlight_lock);
>  	ret = dev_priv->display.setup_backlight(intel_connector);
> -	spin_unlock_irqrestore(&dev_priv->backlight_lock, flags);
> +	mutex_unlock(&dev_priv->backlight_lock);
>  
>  	if (ret) {
>  		DRM_DEBUG_KMS("failed to setup backlight for connector %s\n",
> -- 
> 1.9.3
>

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux