From patchwork Wed Mar 8 21:30:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puthikorn Voravootivat X-Patchwork-Id: 9611997 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 9FCB86016C for ; Wed, 8 Mar 2017 21:31:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 932C32863F for ; Wed, 8 Mar 2017 21:31:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8833A28642; Wed, 8 Mar 2017 21:31:06 +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 4C8CE2863F for ; Wed, 8 Mar 2017 21:31:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4220C6EA53; Wed, 8 Mar 2017 21:31:04 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pg0-x235.google.com (mail-pg0-x235.google.com [IPv6:2607:f8b0:400e:c05::235]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4F5F96EA54 for ; Wed, 8 Mar 2017 21:31:02 +0000 (UTC) Received: by mail-pg0-x235.google.com with SMTP id g2so286722pge.3 for ; Wed, 08 Mar 2017 13:31:02 -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=o19NM4zgZ6TnadpyzVwywiY1DXzW4E/kN31/Dl2yxyI=; b=iMSQgV5GD1f9PaimyE/c4BtuX6iIxB6AO0MKVaCjuaPRjLuuFfea2uKFWouggi7k0h HtieIIPyNfEk9ZOrL/dp0j4ERHbwc7xTVUo1zYyuV/+lcO5X/kAYRtU+VN487E3ErtGH PeW1AeLj17Ws/NwHdyrugsUdY/g85yo6NdFlL2lgyI/lzxHzLyeU02DG3Z/Djjyfw9G3 /raj1StlbbmVW9ByBNAeicSN211hI38EROHdvC3xOCtVzYZXTt5tFEOBQXzxeatZDGyv uEG7zyDLPRS2sJubWeTe1+Gmlq0XUuvShznotAq8ZSAF7XrQiCUhpX/JbN+0GeuhMWQR 6URA== 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=o19NM4zgZ6TnadpyzVwywiY1DXzW4E/kN31/Dl2yxyI=; b=SCGB2XxchfMWtSCZ7h+Swv6wyB7V6ew9ntuGX3qDpE/xzKEADmBv/6r3x+ZW1vElww RHG5XN/SZ2CiBqsTCM+NdxqsZVId5/rpI/VyqA5VLXO6wmHnAjx1qpeyM4/Jk5h9kjc9 fmizWTa5s4ISYYL3hSautYiRGuEpwYsLw+QlQ0J4myHkKxak6VLiU8Ge1/43aIXCW3J7 iTeGw/zigSX3sKZwfIwsYTF1ohXk4HvkgIX4Dm7cjG+v20fOcPVDnQnGhx78TdSCVIes 1SOYCrX55nJJ+TQY/CDGA16/WUWoiTb8kj9IJAN504WpTGoFeWWFx0ZvTBB06/kwNGUl dcCg== X-Gm-Message-State: AMke39nCuiaksNh0aI8irSHPw2JMrIL9JvZLZ3ntY4QYSpU6Defccp2lYYMHZV/4WbVLqF6E X-Received: by 10.84.138.129 with SMTP id 1mr11916149plp.37.1489008661423; Wed, 08 Mar 2017 13:31:01 -0800 (PST) Received: from puthik2.mtv.corp.google.com ([2620:0:1000:1301:35f1:722d:e24d:8205]) by smtp.gmail.com with ESMTPSA id l188sm7973196pfl.28.2017.03.08.13.30.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Mar 2017 13:31:00 -0800 (PST) Received: by puthik2.mtv.corp.google.com (Postfix, from userid 218808) id F0D6011F861; 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:52 -0800 Message-Id: <20170308213053.194062-5-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 4/5] drm/i915: Use highest frequency divider for PWM 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 TCON tend to have better brightness scaling with lower PWM frequency. This patch set the divider to highest value to lower the PWM frequency. Signed-off-by: Puthikorn Voravootivat --- drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c index 643b604be2de..32b426006a6a 100644 --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c @@ -116,6 +116,7 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector) uint8_t dpcd_buf = 0; uint8_t new_dpcd_buf = 0; uint8_t edp_backlight_mode = 0; + bool freq_cap = false; set_aux_backlight_enable(intel_dp, true); @@ -146,10 +147,20 @@ static void intel_dp_aux_enable_backlight(struct intel_connector *connector) intel_dp_aux_set_dynamic_backlight_percent(intel_dp, 0, 100); } + /* Use highest frequency divider if supported */ + freq_cap = intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP; + if (freq_cap) + new_dpcd_buf |= DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE; + if (new_dpcd_buf != dpcd_buf) { drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_BACKLIGHT_MODE_SET_REGISTER, new_dpcd_buf); } + + if (freq_cap) { + drm_dp_dpcd_writeb(&intel_dp->aux, DP_EDP_BACKLIGHT_FREQ_SET, + 0xff); + } } static void intel_dp_aux_disable_backlight(struct intel_connector *connector)