Skip to contentSkip to conversation

drm/i915: Eliminate lots of WARNs when there's no backlight present

PATCH Applied [email protected] 3 participants 5 messages Jan 16, 2014 – Jan 17, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Eliminate lots of WARNs when there's no backlight present

From: Ville Syrjälä <[email protected]>

My 855gm doesn't register the intel backlight but it still ends up calling the backlight code to enable/disable the backlight via the LVDS code. This leads to some WARNs due to backlight.max being 0.

Let's have intel_panel_enable_backlight() and intel_panel_disable_backlight() check whether there's a backlight present or not.

Also move the backlight.present check from asle_set_backlight() into intel_panel_set_backlight() for some extra symmetry.

---
 drivers/gpu/drm/i915/intel_opregion.c | 10 ++--------
 drivers/gpu/drm/i915/intel_panel.c    |  6 +++---
 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_opregion.c +2 -8
index 3da259e..37e9a96 100644
@@ -396,9 +396,7 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
 static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_connector *connector;
 	struct intel_connector *intel_connector;
-	struct intel_panel *panel;
 	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
@@ -417,12 +415,8 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	 * only one).
 	 */
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
-	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-		intel_connector = to_intel_connector(connector);
-		panel = &intel_connector->panel;
-		if (panel->backlight.present)
-			intel_panel_set_backlight(intel_connector, bclp, 255);
-	}
+	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
+		intel_panel_set_backlight(intel_connector, bclp, 255);
 	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
 
 	mutex_unlock(&dev->mode_config.mutex);
drivers/gpu/drm/i915/intel_panel.c +3 -3
index 20ebc3e..350de35 100644
@@ -502,7 +502,7 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level,
 	u32 freq;
 	unsigned long flags;
 
-	if (pipe == INVALID_PIPE)
+	if (!panel->backlight.present || pipe == INVALID_PIPE)
 		return;
 
 	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
@@ -579,7 +579,7 @@ void intel_panel_disable_backlight(struct intel_connector *connector)
 	enum pipe pipe = intel_get_pipe_from_connector(connector);
 	unsigned long flags;
 
-	if (pipe == INVALID_PIPE)
+	if (!panel->backlight.present || pipe == INVALID_PIPE)
 		return;
 
 	/*
@@ -782,7 +782,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
 	enum pipe pipe = intel_get_pipe_from_connector(connector);
 	unsigned long flags;
 
-	if (pipe == INVALID_PIPE)
+	if (!panel->backlight.present || pipe == INVALID_PIPE)
 		return;
 
 	DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe));
Signature · 6 lines
1.8.3.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 6 lines · On Thu, Jan 16, 2014 at 5:27 PM, <[email protected]> wrote:

From: Ville Syrjälä <[email protected]>

My 855gm doesn't register the intel backlight but it still ends up calling the backlight code to enable/disable the backlight via the LVDS code. This leads to some WARNs due to backlight.max being 0.

Quoted 7 lines

Let's have intel_panel_enable_backlight() and intel_panel_disable_backlight() check whether there's a backlight present or not.

Also move the backlight.present check from asle_set_backlight() into intel_panel_set_backlight() for some extra symmetry.

Wouldn't that be a perfect machine to test Jani's init-backlight-from-vbt patch? Iirc all the infrastructure is now there ...
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · On Thu, Jan 16, 2014 at 5:27 PM, <[email protected]> wrote:

From: Ville Syrjälä <[email protected]>

My 855gm doesn't register the intel backlight but it still ends up calling the backlight code to enable/disable the backlight via the LVDS code. This leads to some WARNs due to backlight.max being 0.

Let's have intel_panel_enable_backlight() and intel_panel_disable_backlight() check whether there's a backlight present or not.

Quoted 8 lines
Quoted 4 lines

Also move the backlight.present check from asle_set_backlight() into intel_panel_set_backlight() for some extra symmetry.

Wouldn't that be a perfect machine to test Jani's init-backlight-from-vbt patch? Iirc all the infrastructure is now there ...

My assumption has ben that the intel backlight stuff isn't hooked up to anything. But I guess I could give it a go.

Signature · 2 lines
Ville Syrjälä
Intel OTC
maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]
Quoted 11 lines · On Thu, 16 Jan 2014, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

My 855gm doesn't register the intel backlight but it still ends up calling the backlight code to enable/disable the backlight via the LVDS code. This leads to some WARNs due to backlight.max being 0.

Let's have intel_panel_enable_backlight() and intel_panel_disable_backlight() check whether there's a backlight present or not.

Also move the backlight.present check from asle_set_backlight() into intel_panel_set_backlight() for some extra symmetry.

I have an identical patch in my local repo dated Dec 13... should've sent it out weeks ago. Damn.

Quoted 73 lines
---
 drivers/gpu/drm/i915/intel_opregion.c | 10 ++--------
 drivers/gpu/drm/i915/intel_panel.c    |  6 +++---
 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_opregion.c +2 -8
index 3da259e..37e9a96 100644
@@ -396,9 +396,7 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
 static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_connector *connector;
 	struct intel_connector *intel_connector;
-	struct intel_panel *panel;
 	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
@@ -417,12 +415,8 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	 * only one).
 	 */
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
-	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-		intel_connector = to_intel_connector(connector);
-		panel = &intel_connector->panel;
-		if (panel->backlight.present)
-			intel_panel_set_backlight(intel_connector, bclp, 255);
-	}
+	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
+		intel_panel_set_backlight(intel_connector, bclp, 255);
 	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
 
 	mutex_unlock(&dev->mode_config.mutex);
drivers/gpu/drm/i915/intel_panel.c +3 -3
index 20ebc3e..350de35 100644
@@ -502,7 +502,7 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level,
 	u32 freq;
 	unsigned long flags;
 
-	if (pipe == INVALID_PIPE)
+	if (!panel->backlight.present || pipe == INVALID_PIPE)
 		return;
 
 	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
@@ -579,7 +579,7 @@ void intel_panel_disable_backlight(struct intel_connector *connector)
 	enum pipe pipe = intel_get_pipe_from_connector(connector);
 	unsigned long flags;
 
-	if (pipe == INVALID_PIPE)
+	if (!panel->backlight.present || pipe == INVALID_PIPE)
 		return;
 
 	/*
@@ -782,7 +782,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
 	enum pipe pipe = intel_get_pipe_from_connector(connector);
 	unsigned long flags;
 
-	if (pipe == INVALID_PIPE)
+	if (!panel->backlight.present || pipe == INVALID_PIPE)
 		return;
 
 	DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe));
Signature · 6 lines
1.8.3.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 10 lines · Jani Nikula
Quoted 9 lines · On Thu, 16 Jan 2014, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

My 855gm doesn't register the intel backlight but it still ends up calling the backlight code to enable/disable the backlight via the LVDS code. This leads to some WARNs due to backlight.max being 0.

Let's have intel_panel_enable_backlight() and intel_panel_disable_backlight() check whether there's a backlight present or not.

Quoted 7 lines
Quoted 2 lines

Also move the backlight.present check from asle_set_backlight() into intel_panel_set_backlight() for some extra symmetry.

I have an identical patch in my local repo dated Dec 13... should've sent it out weeks ago. Damn.

Queued for -next, thanks for the patch.
-Daniel

Quoted 81 lines
Quoted 74 lines
---
 drivers/gpu/drm/i915/intel_opregion.c | 10 ++--------
 drivers/gpu/drm/i915/intel_panel.c    |  6 +++---
 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_opregion.c +2 -8
index 3da259e..37e9a96 100644
@@ -396,9 +396,7 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state)
 static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct drm_connector *connector;
 	struct intel_connector *intel_connector;
-	struct intel_panel *panel;
 	struct opregion_asle __iomem *asle = dev_priv->opregion.asle;
 
 	DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
@@ -417,12 +415,8 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	 * only one).
 	 */
 	DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp);
-	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-		intel_connector = to_intel_connector(connector);
-		panel = &intel_connector->panel;
-		if (panel->backlight.present)
-			intel_panel_set_backlight(intel_connector, bclp, 255);
-	}
+	list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head)
+		intel_panel_set_backlight(intel_connector, bclp, 255);
 	iowrite32(DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID, &asle->cblv);
 
 	mutex_unlock(&dev->mode_config.mutex);
drivers/gpu/drm/i915/intel_panel.c +3 -3
index 20ebc3e..350de35 100644
@@ -502,7 +502,7 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level,
 	u32 freq;
 	unsigned long flags;
 
-	if (pipe == INVALID_PIPE)
+	if (!panel->backlight.present || pipe == INVALID_PIPE)
 		return;
 
 	spin_lock_irqsave(&dev_priv->backlight_lock, flags);
@@ -579,7 +579,7 @@ void intel_panel_disable_backlight(struct intel_connector *connector)
 	enum pipe pipe = intel_get_pipe_from_connector(connector);
 	unsigned long flags;
 
-	if (pipe == INVALID_PIPE)
+	if (!panel->backlight.present || pipe == INVALID_PIPE)
 		return;
 
 	/*
@@ -782,7 +782,7 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
 	enum pipe pipe = intel_get_pipe_from_connector(connector);
 	unsigned long flags;
 
-	if (pipe == INVALID_PIPE)
+	if (!panel->backlight.present || pipe == INVALID_PIPE)
 		return;
 
 	DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe));
Signature · 6 lines
1.8.3.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch