From patchwork Fri Jul 26 13:24:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 2834158 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 617379F243 for ; Fri, 26 Jul 2013 13:23:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1AEAB2024F for ; Fri, 26 Jul 2013 13:23:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 95B4A20250 for ; Fri, 26 Jul 2013 13:23:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A731E6417 for ; Fri, 26 Jul 2013 06:23:39 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 717ADE5F43 for ; Fri, 26 Jul 2013 06:23:28 -0700 (PDT) Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 26 Jul 2013 06:23:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,751,1367996400"; d="scan'208";a="273725763" Received: from jnikula-mobl1.fi.intel.com (HELO localhost) ([10.237.72.185]) by AZSMGA002.ch.intel.com with ESMTP; 26 Jul 2013 06:23:26 -0700 From: Jani Nikula To: Felipe Contreras , In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <1370818899-8595-1-git-send-email-matthew.garrett@nebula.com> <1448863.3slS729B6b@vostro.rjw.lan> User-Agent: Notmuch/0.15.2+227~g0ff681e (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Fri, 26 Jul 2013 16:24:57 +0300 Message-ID: <87a9l95u8m.fsf@intel.com> MIME-Version: 1.0 Cc: "Rafael J. Wysocki" , daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org Subject: Re: [Intel-gfx] [Update][PATCH 0/3] Fix backlight issues on some Windows 8 systems X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP [distribution massively reduced] On Sat, 20 Jul 2013, Felipe Contreras wrote: > I tried this patch series and it's as I expected, it's the same as > acpi_backlight=vendor, and the intel backlight driver doesn't work > correctly in this machine. If you are actually serious about the > mantra of "no user-space regressions", then for this machine at least, > you need to use the ACPI backlight with Windows8 OSI disabled, until > the intel backlight driver is fixed. My patch does that: > > http://article.gmane.org/gmane.linux.acpi.devel/60969 Hi Felipe, would you mind trying the following patch on top of -rc2, without your quirk patch? Up front, I'm not sure what all your failure modes are, I'm not claiming this fixes them, and frankly, it didn't do anything on a machine I tried... I just have this hunch it might help with the ACPI hotkeys on some BIOSes. Maybe you're the lucky one! :) BR, Jani. From eb1493a7551dafb4bac3d65e4ed3ecd2e46f7f67 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Fri, 7 Dec 2012 15:32:45 +0200 Subject: [PATCH] drm/i915: set the BIOS current backlight reference level Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Cc: Jani Nikula This should keep BIOS brightness keys and i915 backlight device better in sync. Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/intel_opregion.c | 20 +++++++++++++++++++- drivers/gpu/drm/i915/intel_panel.c | 3 +++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 82ea281..5a1cfa3 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2059,10 +2059,13 @@ extern int intel_opregion_setup(struct drm_device *dev); extern void intel_opregion_init(struct drm_device *dev); extern void intel_opregion_fini(struct drm_device *dev); extern void intel_opregion_asle_intr(struct drm_device *dev); +extern void intel_opregion_asle_set_cblv(struct drm_device *dev, u32 level, u32 max); #else static inline void intel_opregion_init(struct drm_device *dev) { return; } static inline void intel_opregion_fini(struct drm_device *dev) { return; } static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; } +} +static inline void intel_opregion_asle_set_cblv(struct drm_device *dev, u32 level, u32 max) { return; } #endif /* intel_acpi.c */ diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index cfb8fb6..00fce49 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c @@ -158,6 +158,25 @@ struct opregion_asle { #define ACPI_LVDS_OUTPUT (4<<8) #ifdef CONFIG_ACPI + +/* set backlight brightness reference to level in range [0..max] */ +void intel_opregion_asle_set_cblv(struct drm_device *dev, u32 level, u32 max) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + struct opregion_asle __iomem *asle = dev_priv->opregion.asle; + + if (!asle) + return; + + if (level > max) + level = max; + + /* scale to 0...100 per opregion spec */ + level = level * 100 / max; + + iowrite32(level | ASLE_CBLV_VALID, &asle->cblv); +} + static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -173,7 +192,6 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) return ASLE_BACKLIGHT_FAILED; intel_panel_set_backlight(dev, bclp, 255); - iowrite32((bclp*0x64)/0xff | ASLE_CBLV_VALID, &asle->cblv); return 0; } diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 67e2c1f..a497e20 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -497,6 +497,9 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level, u32 max) goto out; } + /* set brightness reference value for bios hotkeys */ + intel_opregion_asle_set_cblv(dev, level, max); + /* scale to hardware */ level = level * freq / max;