From patchwork Tue Sep 1 14:11:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Shankar, Uma" X-Patchwork-Id: 7105411 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 57A52BF036 for ; Tue, 1 Sep 2015 13:45:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 93DC3205F2 for ; Tue, 1 Sep 2015 13:45:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 94FF2205F9 for ; Tue, 1 Sep 2015 13:45:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1333C72098; Tue, 1 Sep 2015 06:45:28 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id D3E67720A0 for ; Tue, 1 Sep 2015 06:45:26 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 01 Sep 2015 06:45:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,449,1437462000"; d="scan'208";a="553059553" Received: from ubuntu-tc11.iind.intel.com ([10.223.26.30]) by FMSMGA003.fm.intel.com with ESMTP; 01 Sep 2015 06:45:24 -0700 From: Uma Shankar To: intel-gfx@lists.freedesktop.org Date: Tue, 1 Sep 2015 19:41:48 +0530 Message-Id: <1441116710-14118-13-git-send-email-uma.shankar@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1441116710-14118-1-git-send-email-uma.shankar@intel.com> References: <1441116710-14118-1-git-send-email-uma.shankar@intel.com> Cc: jani.nikula@intel.com, shobhit.kumar@intel.com Subject: [Intel-gfx] [BXT MIPI PATCH v3 12/14] drm/i915/bxt: Program Backlight PWM frequency 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 In some cases, BIOS doesn't initializes DSI panel.DSI and backlight registers are thereby not initialized. Programming the same in driver backlight setup. Signed-off-by: Uma Shankar --- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_panel.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 8407b5c..10f73b1 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -7166,6 +7166,9 @@ enum skl_disp_power_wells { #define TRANS_MSA_12_BPC (3<<5) #define TRANS_MSA_16_BPC (4<<5) +/* Max CDCLK freq for BXT in HZ */ +#define BXT_CDCLK_MAX 624000000 + /* LCPLL Control */ #define LCPLL_CTL 0x130040 #define LCPLL_PLL_DISABLE (1<<31) diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 9fcf86c..8225cea 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -1427,6 +1427,17 @@ bxt_setup_backlight(struct intel_connector *connector, enum pipe unused) panel->backlight.max = I915_READ( BXT_BLC_PWM_FREQ(panel->backlight.controller)); + if (!panel->backlight.max) { + DRM_DEBUG_KMS("PWM freq not programmed by BIOS\n"); + DRM_DEBUG_KMS("Programming PWM freq\n"); + + /* Max Backlight = Max CD Clock / pwm freq) */ + panel->backlight.max = (BXT_CDCLK_MAX / + dev_priv->vbt.backlight.pwm_freq_hz); + I915_WRITE(BXT_BLC_PWM_FREQ(panel->backlight.controller), + panel->backlight.max); + } + val = bxt_get_backlight(connector); panel->backlight.level = intel_panel_compute_brightness(connector, val);