From patchwork Mon Mar 31 18:13:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesse Barnes X-Patchwork-Id: 3917311 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 DC2F99F370 for ; Mon, 31 Mar 2014 18:14:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F41B6203AB for ; Mon, 31 Mar 2014 18:14:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 13D1520364 for ; Mon, 31 Mar 2014 18:14:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 096776E3D2; Mon, 31 Mar 2014 11:14:14 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from gproxy3-pub.mail.unifiedlayer.com (gproxy3-pub.mail.unifiedlayer.com [69.89.30.42]) by gabe.freedesktop.org (Postfix) with SMTP id 8C7BC6E3D7 for ; Mon, 31 Mar 2014 11:14:12 -0700 (PDT) Received: (qmail 30767 invoked by uid 0); 31 Mar 2014 18:14:11 -0000 Received: from unknown (HELO cmgw2) (10.0.90.83) by gproxy3.mail.unifiedlayer.com with SMTP; 31 Mar 2014 18:14:11 -0000 Received: from box514.bluehost.com ([74.220.219.114]) by cmgw2 with id kJE41n0022UhLwi01JE73p; Mon, 31 Mar 2014 12:14:10 -0600 X-Authority-Analysis: v=2.1 cv=QsvNgzCd c=1 sm=1 tr=0 a=9W6Fsu4pMcyimqnCr1W0/w==:117 a=9W6Fsu4pMcyimqnCr1W0/w==:17 a=cNaOj0WVAAAA:8 a=f5113yIGAAAA:8 a=VFrlcMyEpNYA:10 a=3ROhxo7VqVMA:10 a=TBVoxVdAAAAA:8 a=GhZ5P8ky69gA:10 a=G6VvcRi8Q2da0QNwd74A:9 a=rW6DTWptwo0A:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuousgeek.org; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:To:From; bh=6H/jdeaUEl1oSBUSwxHjbx26mkOslNlvPEFRT0NkFDc=; b=aY3Y11j8fu2djuTEitJZPULUx+ZOIom7Twrzbg2LPlLf/yTkHUqlmyewIeVByv8mqObRZEQZelqlojMrGCQhNKGeutBao2IUMShVdK4pB5hEd5fpojdJyyDPwFNHg2l7; Received: from [67.161.37.189] (port=56306 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1.2:CAMELLIA256-SHA:256) (Exim 4.82) (envelope-from ) id 1WUgii-00041t-BU for intel-gfx@lists.freedesktop.org; Mon, 31 Mar 2014 12:14:04 -0600 From: Jesse Barnes To: intel-gfx@lists.freedesktop.org Date: Mon, 31 Mar 2014 11:13:57 -0700 Message-Id: <1396289637-1013-3-git-send-email-jbarnes@virtuousgeek.org> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1396289637-1013-1-git-send-email-jbarnes@virtuousgeek.org> References: <1396289637-1013-1-git-send-email-jbarnes@virtuousgeek.org> X-Identified-User: {10642:box514.bluehost.com:virtuous:virtuousgeek.org} {sentby:smtp auth 67.161.37.189 authed with jbarnes@virtuousgeek.org} Subject: [Intel-gfx] [PATCH 3/3] drm/i915/vlv: use min brightness from VBT X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 Going below the minimum value may affect the BLC_EN line, so try to use the VBT provided minimum where possible, otherwise use an experimentally derived value to prevent the panel from coming up. Signed-off-by: Jesse Barnes --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_bios.c | 3 ++- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_panel.c | 10 +++++++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index ff02225..3c40dcb 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1148,6 +1148,7 @@ struct intel_vbt_data { struct { u16 pwm_freq_hz; bool active_low_pwm; + u8 min_brightness; } backlight; /* MIPI DSI */ diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 4867f4c..e8dedf5 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c @@ -301,11 +301,12 @@ parse_lfp_backlight(struct drm_i915_private *dev_priv, struct bdb_header *bdb) dev_priv->vbt.backlight.pwm_freq_hz = entry->pwm_freq_hz; dev_priv->vbt.backlight.active_low_pwm = entry->active_low_pwm; + dev_priv->vbt.backlight.min_brightness = entry->min_brightness; DRM_DEBUG_KMS("VBT backlight PWM modulation frequency %u Hz, " "active %s, min brightness %u, level %u\n", dev_priv->vbt.backlight.pwm_freq_hz, dev_priv->vbt.backlight.active_low_pwm ? "low" : "high", - entry->min_brightness, + dev_priv->vbt.backlight.min_brightness, backlight_data->level[panel_type]); } diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 0e91c40..053a968 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -166,6 +166,7 @@ struct intel_panel { bool present; u32 level; u32 max; + u32 min; bool enabled; bool combination_mode; /* gen 2/4 only */ bool active_low_pwm; diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 21c5e6f..27d7508 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -510,6 +510,9 @@ void intel_panel_set_backlight(struct intel_connector *connector, u32 level, else level = freq / max * level; + if (level < panel->backlight.min) + level = panel->backlight.min; + panel->backlight.level = level; if (panel->backlight.device) panel->backlight.device->props.brightness = level; @@ -1047,7 +1050,12 @@ static int vlv_setup_backlight(struct intel_connector *connector) ctl = I915_READ(VLV_BLC_PWM_CTL(PIPE_A)); panel->backlight.max = ctl >> 16; - if (!panel->backlight.max) + panel->backlight.min = dev_priv->vbt.backlight.min_brightness; + /* sane (i.e. checked on scope) default */ + if (!panel->backlight.min) + panel->backlight.min = 64; + if (!panel->backlight.max || + panel->backlight.max < panel->backlight.min) return -ENODEV; val = _vlv_get_backlight(dev, PIPE_A);