From patchwork Thu Jul 20 09:25:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 9854391 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D136600F5 for ; Thu, 20 Jul 2017 09:25:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2580728749 for ; Thu, 20 Jul 2017 09:25:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A2D12876B; Thu, 20 Jul 2017 09:25:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 785D228749 for ; Thu, 20 Jul 2017 09:25:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 069C26E650; Thu, 20 Jul 2017 09:25:38 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD09E6E650 for ; Thu, 20 Jul 2017 09:25:36 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jul 2017 02:25:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,383,1496127600"; d="scan'208";a="880802741" Received: from mmetzger-mobl4.ger.corp.intel.com (HELO localhost) ([10.252.43.104]) by FMSMGA003.fm.intel.com with ESMTP; 20 Jul 2017 02:25:32 -0700 From: Jani Nikula To: intel-gfx@lists.freedesktop.org Date: Thu, 20 Jul 2017 12:25:17 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Cc: jani.nikula@intel.com, Daniel Vetter , Puthikorn Voravootivat , Jenny TC , Dhinakaran Pandiyan Subject: [Intel-gfx] [PATCH 2/2] Revert "drm/i915: Add heuristic to determine better way to adjust brightness" X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 560a758d39c616f83ac25ff6e0816a49ebe6401c. The DPCD backlight commits regress a Thinkpad X1 Carbon 4th Gen and a BXT-P (in CI). Enabling dynamic backlight boots to a black screen, and enabling DPCD backlight leads to a black screen after suspend/resume. References: http://mid.mail-archive.com/20170706135349.6tu3lz7uehazlnnn@boom References: http://mid.mail-archive.com/20170627132326.f2q3yn4bh5flji4q@boom Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101619 Reported-by: David Weinehall Fixes: 560a758d39c6 ("drm/i915: Add heuristic to determine better way to adjust brightness") Cc: Jenny TC Cc: David Weinehall Cc: Puthikorn Voravootivat Cc: Dhinakaran Pandiyan Cc: Daniel Vetter Cc: intel-gfx@lists.freedesktop.org Signed-off-by: Jani Nikula Reviewed-by: Dhinakaran Pandiyan for --- drivers/gpu/drm/i915/i915_params.c | 7 ++- drivers/gpu/drm/i915/i915_params.h | 2 +- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 61 ++------------------------- 3 files changed, 7 insertions(+), 63 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index 5b5ab15d191f..14e2c2e57f96 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -63,7 +63,7 @@ struct i915_params i915 __read_mostly = { .huc_firmware_path = NULL, .enable_dp_mst = true, .inject_load_failure = 0, - .enable_dpcd_backlight = -1, + .enable_dpcd_backlight = false, .enable_gvt = false, }; @@ -246,10 +246,9 @@ MODULE_PARM_DESC(enable_dp_mst, module_param_named_unsafe(inject_load_failure, i915.inject_load_failure, uint, 0400); MODULE_PARM_DESC(inject_load_failure, "Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point)"); -module_param_named_unsafe(enable_dpcd_backlight, i915.enable_dpcd_backlight, int, 0600); +module_param_named(enable_dpcd_backlight, i915.enable_dpcd_backlight, bool, 0600); MODULE_PARM_DESC(enable_dpcd_backlight, - "Enable support for DPCD backlight control " - "(-1:auto (default), 0:force disable, 1:force enabled if supported"); + "Enable support for DPCD backlight control (default:false)"); module_param_named(enable_gvt, i915.enable_gvt, bool, 0400); MODULE_PARM_DESC(enable_gvt, diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h index 0d6cf9138dc4..febbfdbd30bd 100644 --- a/drivers/gpu/drm/i915/i915_params.h +++ b/drivers/gpu/drm/i915/i915_params.h @@ -53,7 +53,6 @@ func(int, edp_vswing); \ func(int, reset); \ func(unsigned int, inject_load_failure); \ - func(int, enable_dpcd_backlight); \ /* leave bools at the end to not create holes */ \ func(bool, alpha_support); \ func(bool, enable_cmd_parser); \ @@ -67,6 +66,7 @@ func(bool, verbose_state_checks); \ func(bool, nuclear_pageflip); \ func(bool, enable_dp_mst); \ + func(bool, enable_dpcd_backlight); \ func(bool, enable_gvt) #define MEMBER(T, member) T member diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c index fea161727c6e..d2830ba3162e 100644 --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c @@ -251,66 +251,15 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector) /* Check the eDP Display control capabilities registers to determine if * the panel can support backlight control over the aux channel */ - if ((intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP) && - (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP)) { + if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP && + (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP) && + !(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP)) { DRM_DEBUG_KMS("AUX Backlight Control Supported!\n"); return true; } return false; } -/* - * Heuristic function whether we should use AUX for backlight adjustment or not. - * - * We should use AUX for backlight brightness adjustment if panel doesn't this - * via PWM pin or using AUX is better than using PWM pin. - * - * The heuristic to determine that using AUX pin is better than using PWM pin is - * that the panel support any of the feature list here. - * - Regional backlight brightness adjustment - * - Backlight PWM frequency set - * - More than 8 bits resolution of brightness level - * - Backlight enablement via AUX and not by BL_ENABLE pin - * - * If all above are not true, assume that using PWM pin is better. - */ -static bool -intel_dp_aux_display_control_heuristic(struct intel_connector *connector) -{ - struct intel_dp *intel_dp = enc_to_intel_dp(&connector->encoder->base); - uint8_t reg_val; - - /* Panel doesn't support adjusting backlight brightness via PWN pin */ - if (!(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP)) - return true; - - /* Panel supports regional backlight brightness adjustment */ - if (drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_GENERAL_CAP_3, - ®_val) != 1) { - DRM_DEBUG_KMS("Failed to read DPCD register 0x%x\n", - DP_EDP_GENERAL_CAP_3); - return false; - } - if (reg_val > 0) - return true; - - /* Panel supports backlight PWM frequency set */ - if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP) - return true; - - /* Panel supports more than 8 bits resolution of brightness level */ - if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT) - return true; - - /* Panel supports enabling backlight via AUX but not by BL_ENABLE pin */ - if ((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) && - !(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP)) - return true; - - return false; - -} - int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector) { struct intel_panel *panel = &intel_connector->panel; @@ -321,10 +270,6 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector) if (!intel_dp_aux_display_control_capable(intel_connector)) return -ENODEV; - if (i915.enable_dpcd_backlight == -1 && - !intel_dp_aux_display_control_heuristic(intel_connector)) - return -ENODEV; - panel->backlight.setup = intel_dp_aux_setup_backlight; panel->backlight.enable = intel_dp_aux_enable_backlight; panel->backlight.disable = intel_dp_aux_disable_backlight;