From patchwork Fri Mar 10 22:33:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puthikorn Voravootivat X-Patchwork-Id: 9618065 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 5D9636046A for ; Fri, 10 Mar 2017 22:33:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B3CB287B2 for ; Fri, 10 Mar 2017 22:33:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C857287B4; Fri, 10 Mar 2017 22:33:44 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 B354D287B2 for ; Fri, 10 Mar 2017 22:33:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8463D6E12E; Fri, 10 Mar 2017 22:33:42 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pf0-x236.google.com (mail-pf0-x236.google.com [IPv6:2607:f8b0:400e:c00::236]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B4376E12E for ; Fri, 10 Mar 2017 22:33:41 +0000 (UTC) Received: by mail-pf0-x236.google.com with SMTP id w189so46750065pfb.0 for ; Fri, 10 Mar 2017 14:33:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KglbgbqnTAtuQ1SY9Mj6qpVNjg3Y56n2ifywePfw+Ig=; b=msE7qbnE3i4L08iBjADCYL3o8CpncY49B6cae7wBX6BKXL0Rey6rH2EOM32jQUjTYq V4wtqf6Q0Jf35rbBNNpEiW6PisKWJvHFZbs7PIIgBYdpSujZMquHXwBbqkjnfqJhQmrU 8B7O8b2FsVWascFrP9TQc5H0zM/errS7esZJfPn3C2sEoSO8egSh3jv+UhjqcmSOA5QG obZHHAJRDzZnyJOOSq7IGjQf5zHFQWqkCrfMJuYcv7o1CEZHGdeJHFl0LWnGenkjJB0k F0Xl7Ytma5rhX+cQWhRoM2iq/oqAsYv2ZhfkVs0h8fh5/oISHlxZgPuWq+6z0jopgV2J TSBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=KglbgbqnTAtuQ1SY9Mj6qpVNjg3Y56n2ifywePfw+Ig=; b=DC/g5W6cBXA8a1l8nCww/2SQZqSZSrPhQ1ecRa6vY8p/4wDxq57Wf+tKWZ3npIEohj SVYmThTH7TaV6sk6PSlAlGrpYY5Q0BhXmoNCTHWBuZpLxUO7B50en0EauHBdFbuBt806 nYekoINUwAPvWCskr0DLQoKkThYQQZMIgDiQtRMxfWnjNnqD1AQTsfIDjcsPfc8TeTQE YkH1tdNM60dShiCUxyR7fvBkIZETST1jBa40Ur2BGzWwL4X5eMn3kOq+XrcDhemAju/y jQ9Yli8qPVNhXfZ4HXy9rWXGNBhpNcwUg0c3h4KFeS4CgmnL2tcc5ACrlLHD8tKitCxG O4ow== X-Gm-Message-State: AMke39kBrMV5vG/iFPWgcuR1c27ZkIZmuXccANaUe49ccmTVT/YtnHC5JghG8t6KxtK+tgGz X-Received: by 10.99.222.17 with SMTP id f17mr23082391pgg.127.1489185220846; Fri, 10 Mar 2017 14:33:40 -0800 (PST) Received: from puthik2.mtv.corp.google.com ([2620:0:1000:1301:c556:1c14:f921:6e24]) by smtp.gmail.com with ESMTPSA id z68sm20641556pgz.11.2017.03.10.14.33.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Mar 2017 14:33:40 -0800 (PST) Received: by puthik2.mtv.corp.google.com (Postfix, from userid 218808) id 430C011F728; Fri, 10 Mar 2017 14:33:39 -0800 (PST) From: Puthikorn Voravootivat To: intel-gfx@lists.freedesktop.org, Jani Nikula Date: Fri, 10 Mar 2017 14:33:32 -0800 Message-Id: <20170310223335.46635-2-puthik@chromium.org> X-Mailer: git-send-email 2.12.0.246.ga2ecc84866-goog In-Reply-To: <20170310223335.46635-1-puthik@chromium.org> References: <20170310223335.46635-1-puthik@chromium.org> Cc: Puthikorn Voravootivat Subject: [Intel-gfx] [PATCH v2 1/4] drm/i915: Add DPCD prefered mode for backlight control 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 Currently the intel_dp_aux_backlight driver requires eDP panel to not also support backlight adjustment via PWM pin to use this driver. This force the eDP panel that support both ways of backlight adjustment to do it via PWM pin. This patch adds the new prefer DPCD mode in the i915_param to make it enable to prefer DPCD over the PWM via kernel param. This patch also add a check to DP_EDP_BACKLIGHT_AUX_ENABLE_CAP in set_aux_backlight_enable() since the backlight enablement can be done via BL_ENABLE eDP connector pin in the case that it does not support doing that via AUX. Signed-off-by: Puthikorn Voravootivat --- drivers/gpu/drm/i915/i915_params.c | 6 ++--- drivers/gpu/drm/i915/i915_params.h | 2 +- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 33 +++++++++++++++++++-------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index 2e9645e6555a..d1b014515707 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -61,7 +61,7 @@ struct i915_params i915 __read_mostly = { .guc_log_level = -1, .enable_dp_mst = true, .inject_load_failure = 0, - .enable_dpcd_backlight = false, + .enable_dpcd_backlight = 0, .enable_gvt = false, }; @@ -236,9 +236,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(enable_dpcd_backlight, i915.enable_dpcd_backlight, bool, 0600); +module_param_named(enable_dpcd_backlight, i915.enable_dpcd_backlight, int, 0600); MODULE_PARM_DESC(enable_dpcd_backlight, - "Enable support for DPCD backlight control (default:false)"); + "Enable support for DPCD backlight control (0:disable (default), 1:prefer PWM pin, 2: prefer DPCD)"); 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 55d47eea172e..c0d85b258082 100644 --- a/drivers/gpu/drm/i915/i915_params.h +++ b/drivers/gpu/drm/i915/i915_params.h @@ -49,6 +49,7 @@ func(int, use_mmio_flip); \ func(int, mmio_debug); \ func(int, edp_vswing); \ + func(int, enable_dpcd_backlight); \ func(unsigned int, inject_load_failure); \ /* leave bools at the end to not create holes */ \ func(bool, alpha_support); \ @@ -64,7 +65,6 @@ 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 6532e226db29..da69f01a6a83 100644 --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c @@ -28,6 +28,10 @@ static void set_aux_backlight_enable(struct intel_dp *intel_dp, bool enable) { uint8_t reg_val = 0; + /* Early return when display use other mechanism to enable backlight. */ + if (!(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP)) + return; + if (drm_dp_dpcd_readb(&intel_dp->aux, DP_EDP_DISPLAY_CONTROL_REGISTER, ®_val) < 0) { DRM_DEBUG_KMS("Failed to read DPCD register 0x%x\n", @@ -138,27 +142,36 @@ static bool intel_dp_aux_display_control_capable(struct intel_connector *connector) { struct intel_dp *intel_dp = enc_to_intel_dp(&connector->encoder->base); + bool supported; /* 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[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) && - !((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP) || - (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP))) { - DRM_DEBUG_KMS("AUX Backlight Control Supported!\n"); - return true; + switch (i915.enable_dpcd_backlight) { + case 1: /* prefer PWM pin */ + supported = (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP) && + (intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) && + !(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP) && + !(intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP); + break; + case 2: /* prefer DPCD */ + supported = (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP) && + (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP); + break; + default: + supported = false; } - return false; + + if (supported) + DRM_DEBUG_KMS("AUX Backlight Control Supported!\n"); + + return supported; } int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector) { struct intel_panel *panel = &intel_connector->panel; - if (!i915.enable_dpcd_backlight) - return -ENODEV; - if (!intel_dp_aux_display_control_capable(intel_connector)) return -ENODEV;