lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1347636868-3100-1-git-send-email-grant.likely@secretlab.ca>
Date:	Fri, 14 Sep 2012 16:34:28 +0100
From:	Grant Likely <grant.likely@...retlab.ca>
To:	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc:	Grant Likely <grant.likely@...retlab.ca>,
	Daniel Vetter <daniel.vetter@...ll.ch>,
	David Airlie <airlied@...ux.ie>,
	Matthew Garrett <mjg@...hat.com>,
	David Woodhouse <dwmw2@...radead.org>
Subject: [PATCH] i915: Don't register backlight when max PWM value is unknown

When a backlight isn't connected to the i915 it doesn't make any sense
to register the backlight device, but the driver currently tries to limp
along using a max brightness value of 1. Instead, this patch makes it so
that if the maximum PWM value cannot be determined, then the backlight
will not be registered.

Tested on MacbookPro8,3.

Signed-off-by: Grant Likely <grant.likely@...retlab.ca>
Cc: Daniel Vetter <daniel.vetter@...ll.ch>
Cc: David Airlie <airlied@...ux.ie>
Cc: Matthew Garrett <mjg@...hat.com>
Cc: David Woodhouse <dwmw2@...radead.org>
---
 drivers/gpu/drm/i915/intel_panel.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 3df4f5f..f410c6e 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -168,13 +168,8 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev)
 	u32 max;
 
 	max = i915_read_blc_pwm_ctl(dev_priv);
-	if (max == 0) {
-		/* XXX add code here to query mode clock or hardware clock
-		 * and program max PWM appropriately.
-		 */
-		pr_warn_once("fixme: max PWM is zero\n");
-		return 1;
-	}
+	if (max == 0)
+		return 0; /* Cannot read max PWM. Assume no backlight */
 
 	if (HAS_PCH_SPLIT(dev)) {
 		max >>= 16;
@@ -413,6 +408,12 @@ int intel_panel_setup_backlight(struct drm_device *dev)
 	struct backlight_properties props;
 	struct drm_connector *connector;
 
+	/* Is there a backlight present? max will be zero if not */
+	if (intel_panel_get_max_backlight(dev) == 0) {
+		DRM_INFO("i915 doesn't seem to be connected to backlight\n");
+		return 0;
+	}
+
 	intel_panel_init_backlight(dev);
 
 	if (dev_priv->int_lvds_connector)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ