From patchwork Thu May 4 00:28:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puthikorn Voravootivat X-Patchwork-Id: 9710655 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 066CE60385 for ; Thu, 4 May 2017 00:28:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECBC528648 for ; Thu, 4 May 2017 00:28:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1A1F2867A; Thu, 4 May 2017 00:28:58 +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 9289428648 for ; Thu, 4 May 2017 00:28:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FE306E3D2; Thu, 4 May 2017 00:28:53 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pg0-x234.google.com (mail-pg0-x234.google.com [IPv6:2607:f8b0:400e:c05::234]) by gabe.freedesktop.org (Postfix) with ESMTPS id 131EA6E3D2 for ; Thu, 4 May 2017 00:28:52 +0000 (UTC) Received: by mail-pg0-x234.google.com with SMTP id o3so2767380pgn.2 for ; Wed, 03 May 2017 17:28:52 -0700 (PDT) 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=Zso9YbMLKQa69LAJGiZEEdP3qV7CuD9lw5tlBjnnK+I=; b=tdLFY4Y+Y2xLZ/54oYn+Z3bYWqkLlCowWH5mo8PEg/97sqETBTm0EvXQ9mqNHFUiRJ T++j1joqGh+kpqF5vKWLYUuZKMB9+tr/5FkVq7J6/m+izndb+RlEn4zu3Lmx6XsNWGKa fH3EBbQsY8CuHRZakCmycrgvKa8uqjdae3pLTqekbJG2Y9mPrb/A7XMzB4AHQuxeI5Ws MohPOhjspz7LVERI42wNZHSpX8N9xKPvM5w4Vf8tom1fUp0CApL/cDeTjaco+gGSeXRV DRvViUobtwNpKgMT1lj26r0Pa6nh9I8n+7f6hoys/Wo19Tn7jLdzOEOEuogkEqIsms2I /eVw== 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=Zso9YbMLKQa69LAJGiZEEdP3qV7CuD9lw5tlBjnnK+I=; b=InG2KFtQGcmAUqNoDWDSX7KXXKAln6rjL9RQejTCxfFjMUz5k2e9EYwg7EloIkcSrt Ds/JIVPO2dBNeKQtgIPuoEyUcLOxv3QCcqU9mFhcaMhksNbORrxxf315uzG5haz1C5RQ o5QIDW7y3fr6pBNeARM2R8Yhw3AVaXIIyKNISeGBPD6+gZUOgkhnbuedND8Uy0HqLgl6 Lvxi3UZSN/UJ5VUMZDrXlpqekNpvjZYENQb27PHjzjeFdPMJz+G+zEsPR0mJqixsP2yr RbQTuramrtoe7cqPKABVKZRkKQXMOQnlsnaZ6wBJp3o/VVQwqz1e0ioYmWk9kBpSCgYc QvUg== X-Gm-Message-State: AN3rC/5LzZ0i4M/yeVS9LtuOjjBUW0TLfh5T2x9yAP9FDLYA/Rp6iYpi wUx/+U6U6+Pqv1v0 X-Received: by 10.98.214.6 with SMTP id r6mr7619825pfg.181.1493857731453; Wed, 03 May 2017 17:28:51 -0700 (PDT) Received: from puthik2.mtv.corp.google.com ([172.22.64.53]) by smtp.gmail.com with ESMTPSA id l186sm457338pgd.42.2017.05.03.17.28.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 May 2017 17:28:49 -0700 (PDT) Received: by puthik2.mtv.corp.google.com (Postfix, from userid 218808) id 5467211F8FE; Wed, 3 May 2017 17:28:46 -0700 (PDT) From: Puthikorn Voravootivat To: intel-gfx@lists.freedesktop.org Date: Wed, 3 May 2017 17:28:31 -0700 Message-Id: <20170504002836.120988-5-puthik@chromium.org> X-Mailer: git-send-email 2.13.0.rc1.294.g07d810a77f-goog In-Reply-To: <20170504002836.120988-1-puthik@chromium.org> References: <20170504002836.120988-1-puthik@chromium.org> Cc: dri-devel@lists.freedesktop.org, Puthikorn Voravootivat , Dhinakaran Pandiyan Subject: [Intel-gfx] [PATCH v5 4/9] drm/i915: Allow choosing how to adjust brightness if both supported 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 Add option to allow choosing how to adjust brightness if panel supports both PWM pin and AUX channel. 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 | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index b6a7e363d076..323d12badace 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 = false, + .enable_dpcd_backlight = -1, .enable_gvt = false, }; @@ -248,7 +248,9 @@ 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_PARM_DESC(enable_dpcd_backlight, - "Enable support for DPCD backlight control (default:false)"); + "Enable support for DPCD backlight control " + "(-1:disable (default), 0:Use PWM pin if both supported, " + "1:Use DPCD if both supported"); 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 34148cc8637c..ac02efce6e22 100644 --- a/drivers/gpu/drm/i915/i915_params.h +++ b/drivers/gpu/drm/i915/i915_params.h @@ -66,7 +66,7 @@ func(bool, verbose_state_checks); \ func(bool, nuclear_pageflip); \ func(bool, enable_dp_mst); \ - func(bool, enable_dpcd_backlight); \ + func(int, 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 5b83c9737644..e82f7cb9a7af 100644 --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c @@ -175,11 +175,26 @@ intel_dp_aux_display_control_capable(struct intel_connector *connector) return false; } +static bool +intel_dp_pwm_pin_display_control_capable(struct intel_connector *connector) +{ + struct intel_dp *intel_dp = enc_to_intel_dp(&connector->encoder->base); + + /* Check the eDP Display control capabilities registers to determine if + * the panel can support backlight control via BL_PWM_DIM eDP pin + */ + return intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP; +} + int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector) { struct intel_panel *panel = &intel_connector->panel; - if (!i915.enable_dpcd_backlight) + if (i915.enable_dpcd_backlight == -1) + return -ENODEV; + + if (i915.enable_dpcd_backlight == 0 && + intel_dp_pwm_pin_display_control_capable(intel_connector)) return -ENODEV; if (!intel_dp_aux_display_control_capable(intel_connector))