From patchwork Wed Feb 6 10:24:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 2102971 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id D7BE4DF2A1 for ; Wed, 6 Feb 2013 10:24:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BD0F1E676A for ; Wed, 6 Feb 2013 02:24:07 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by gabe.freedesktop.org (Postfix) with ESMTP id B3055E5FF5 for ; Wed, 6 Feb 2013 02:22:32 -0800 (PST) Received: by mail-ee0-f48.google.com with SMTP id t10so572782eei.7 for ; Wed, 06 Feb 2013 02:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=kJ/uoTNJkfrxP5KuGYj1MLoAYnahBfDFP62OxpOhdUU=; b=csNPaiKRAOGmz/JEn+J5RprbC0g6OUnZlayOurkZHdD5jvNMC9FJahlMNOA8PGFwKq 0w+b3m8ehq67oZlSCTM4ltngW3ii/8RZYu4luRTQ2sIcNQf4m5ZjtUP8yjuEUfOndQG/ wddQo5N4SsDTYDMWc5jkoWmAGXYq6EREJJcCM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=kJ/uoTNJkfrxP5KuGYj1MLoAYnahBfDFP62OxpOhdUU=; b=RPhKYBOWNsAIagK9mFpfXaFwGSphIkcikaChOGPSwrQKgZNAQGgcTFDbsrfPDPY2FB AYCG+NZ8iOmfKp0QcjC2ZgHGTxQUh9zpIfM/U3Ocviats9ht9FUKkwQ16/ngvcE+pHKz aU2UqQWyOyxEf2ugxpZ1Ee1Bs44hwr4namxLzGjSYRnl6xvNPmeSFG3LNVBqwNMtclHq ItgjU3LoayPZVhdVnnyP0FQ/UkM6JXpO/sjWDMt5VW9+KWPO3jk64r+WlgvOigEWwl0s et44kBLI/936Q5xyRklRAoDptboeoO9wbHmSNEGv16UjwNeAJPEOkS9+eyf5rAjmfVhi rbTw== X-Received: by 10.14.213.131 with SMTP id a3mr62148255eep.24.1360146151628; Wed, 06 Feb 2013 02:22:31 -0800 (PST) Received: from phenom.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id q5sm35964763eeo.17.2013.02.06.02.22.29 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Feb 2013 02:22:30 -0800 (PST) From: Daniel Vetter To: Intel Graphics Development Date: Wed, 6 Feb 2013 11:24:41 +0100 Message-Id: <1360146281-21375-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQn9Wp0KrSa6ie49Yhi5WRctbDfi/LDglYXqp0Z8jhZuA6xOZZiT98cSJSsh4Yreb3lC070r Cc: Takashi Iwai , Daniel Vetter , stable@vger.kernel.org Subject: [Intel-gfx] [PATCH] drm/i915: write backlight harder 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: , MIME-Version: 1.0 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 770c12312ad617172b1a65b911d3e6564fc5aca8 is the first bad commit commit 770c12312ad617172b1a65b911d3e6564fc5aca8 Author: Takashi Iwai Date: Sat Aug 11 08:56:42 2012 +0200 drm/i915: Fix blank panel at reopening lid changed the register write sequence for restoring the backlight, which helped prevent non-working backlights on some machines. Turns out that the original sequence was the right thing to do for a different set of machines. Worse, setting the backlight level _after_ enabling it seems to reset it somehow. So we need to make that one conditional upon the backlight having been reset to zero, and add the old one back. Cargo-culting at it's best, but it seems to work. Cc: stable@vger.kernel.org Cc: Takashi Iwai Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=47941 Signed-off-by: Daniel Vetter Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/intel_panel.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index bee8cb6..a3730e0 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -321,6 +321,9 @@ void intel_panel_enable_backlight(struct drm_device *dev, if (dev_priv->backlight_level == 0) dev_priv->backlight_level = intel_panel_get_max_backlight(dev); + dev_priv->backlight_enabled = true; + intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); + if (INTEL_INFO(dev)->gen >= 4) { uint32_t reg, tmp; @@ -356,12 +359,12 @@ void intel_panel_enable_backlight(struct drm_device *dev, } set_level: - /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1. - * BLC_PWM_CPU_CTL may be cleared to zero automatically when these - * registers are set. + /* Check the current backlight level and try to set again if it's zero. + * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically + * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written. */ - dev_priv->backlight_enabled = true; - intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); + if (!intel_panel_get_backlight(dev)) + intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); } static void intel_panel_init_backlight(struct drm_device *dev)