From patchwork Wed Mar 8 21:30:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puthikorn Voravootivat X-Patchwork-Id: 9611993 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 D0F716016C for ; Wed, 8 Mar 2017 21:31:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1DEC2863F for ; Wed, 8 Mar 2017 21:31:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B525728642; Wed, 8 Mar 2017 21:31:03 +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 5DE5F2863F for ; Wed, 8 Mar 2017 21:31:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D45D589DD5; Wed, 8 Mar 2017 21:31:01 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pf0-x229.google.com (mail-pf0-x229.google.com [IPv6:2607:f8b0:400e:c00::229]) by gabe.freedesktop.org (Postfix) with ESMTPS id 727B46EA52 for ; Wed, 8 Mar 2017 21:31:00 +0000 (UTC) Received: by mail-pf0-x229.google.com with SMTP id j5so19641378pfb.2 for ; Wed, 08 Mar 2017 13:31:00 -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=qIWuhX1L/8u+cP8Sewg7BYVJmv5Q4zI9D+bGclnq4KE=; b=lM+46addejvgF81ORsckeOHVT2ijGvrRg7h/4eHeABYNp0HfDYKB6uKSsrXQqBVrYh z+JnhHiMJfvE1Peb/m5EYzRKX0olfqh3rCgoN5f8RHiyf/Bk+fwsPSOM+Kyl7O1NsJ19 X8RCjcMRq+HT2KTGjnb2Of71RQ5AnYr9WW+CcmK5nK3LKMoE9jCuZUOPH9xOqVFJm0ka OrErESTjmxZtfSBBy8K6G4F0GohZBostNmQkZ9+XLqOFgp5u4FQ+E/xC9WD7Xxh8s1au W9idSCHu9U6w8G7rjjGKWt38RSxYl1oeWOAkvq7UlQ5AhGHp9TsiMdFw9usiN+zFIJUg kVdw== 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=qIWuhX1L/8u+cP8Sewg7BYVJmv5Q4zI9D+bGclnq4KE=; b=FAPByg0xt29DFynMRWu/z2ubJwSvz1/V3SYMVVJnL5xPKFpYyv1P2z1fTEOi68DaOG hAh36wS2T4oteXATzNGdniapU35FetsM4aURCdbri5ijJld28EZzz1NOThwJ0SejuN+3 42bXCZfbViFGlwihUgbI9V77beOPPvrTS+KqpXLwYy3rjyPzYXgRlyfkcyUw6cq13d5F 2k9D5Wvoj1ZIuTgT9dtKXm0oGdU9TEmaWIQ1UZOdabXyHkKsyqYsL2A87jvxvYAQCFRu S0iBN3LRh9NGAce33+k6AX6IfBtdUIU3lrp4h6QEc57jH7dUgghSZWUzK05IlHvooNMw biBA== X-Gm-Message-State: AMke39nNPC21TMozGImmLQ4OSG4E1ZZcN1ljUB5WQtMjHqBjz6q0TiER8HdlUPlZIIDGs5nY X-Received: by 10.84.241.69 with SMTP id u5mr11800730plm.107.1489008659650; Wed, 08 Mar 2017 13:30:59 -0800 (PST) Received: from puthik2.mtv.corp.google.com ([172.22.64.53]) by smtp.gmail.com with ESMTPSA id b14sm7920040pfh.114.2017.03.08.13.30.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Mar 2017 13:30:58 -0800 (PST) Received: by puthik2.mtv.corp.google.com (Postfix, from userid 218808) id EF65711F754; Wed, 8 Mar 2017 13:30:57 -0800 (PST) From: Puthikorn Voravootivat To: intel-gfx@lists.freedesktop.org Date: Wed, 8 Mar 2017 13:30:49 -0800 Message-Id: <20170308213053.194062-2-puthik@chromium.org> X-Mailer: git-send-email 2.12.0.246.ga2ecc84866-goog In-Reply-To: <20170308213053.194062-1-puthik@chromium.org> References: <20170308213053.194062-1-puthik@chromium.org> Cc: Puthikorn Voravootivat Subject: [Intel-gfx] [PATCH 1/5] drm/i915: Fix condition check for backlight control via DPCD 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 support these conditions to allow the backlight adjust via dpcd register. 1) DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP 2) DP_EDP_BACKLIGHT_AUX_ENABLE_CAP 3) not DP_EDP_BACKLIGHT_PIN_ENABLE_CAP 4) not DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP Condition 2,3,4 are incorect because of the following reasons. For 2), "backlight can be enabled via AUX" is not "brightness can be adjusted via AUX". For 3) and 4), this requires panel to not support backlight adjustment via eDP BL_PWM_DIM pin, but there are some panels that support both AUX and eDP pin. This patch fixes the condition by checking for these instead. 1) DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP 2) DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP 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/intel_dp_aux_backlight.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c index 6532e226db29..abfb09c1269f 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", @@ -142,10 +146,8 @@ 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[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))) { + if ((intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP) && + (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP)) { DRM_DEBUG_KMS("AUX Backlight Control Supported!\n"); return true; }