From patchwork Thu Sep 25 03:15:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aaron Lu X-Patchwork-Id: 4972901 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C4F169F32B for ; Thu, 25 Sep 2014 04:05:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1EB42026D for ; Thu, 25 Sep 2014 04:05:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E0A612025A for ; Thu, 25 Sep 2014 04:05:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 618686E01F; Wed, 24 Sep 2014 21:05:45 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 7675B6E6B9; Wed, 24 Sep 2014 20:15:39 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 24 Sep 2014 20:15:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,594,1406617200"; d="scan'208";a="578612142" Received: from aaronlu.sh.intel.com ([10.239.37.127]) by orsmga001.jf.intel.com with ESMTP; 24 Sep 2014 20:15:35 -0700 Message-ID: <542388D7.1010008@intel.com> Date: Thu, 25 Sep 2014 11:15:35 +0800 From: Aaron Lu MIME-Version: 1.0 To: =?windows-1252?Q?Pali_Roh=E1r?= , Hans de Goede Subject: Re: ACPI/i915: Cannot configure display brightness on Dell Latitude E6440 References: <201409232206.02819@pali> <201409241453.46756@pali> <5422D66D.6090903@redhat.com> <201409242021.10107@pali> In-Reply-To: <201409242021.10107@pali> X-Mailman-Approved-At: Wed, 24 Sep 2014 21:05:44 -0700 Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org, Zhang Rui , Len Brown X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Hi Hans, Thanks for following up and explaining the situation to Pali. On 09/25/2014 02:21 AM, Pali Rohár wrote: > On Wednesday 24 September 2014 16:34:21 Hans de Goede wrote: >> Ok, so the dell-laptop interface is just an obsolete wrapper >> around the i915 opregion code, which shows that the right >> interface to use is the i915 one, which we do if you don't >> specify any kernel commandline parameters, case closed. >> >> Regards, >> >> Hans > > Nope, its not closed. > > Still i915 interface has problem with setting backlight. It > exports lot of levels which turning display off. Which breaking > exiting applications for configuring display brightness. This is > still big regression as black screen is not want people want to > see. > > Driver dell-laptop has exported only few - not thousands level > (which is insane) and only usefull levels (not lot of levels > which turn display off). > > So for this reason using i915 backlight interface is not possible > and also Dell (for E6440) set kernel param acpi_backlight=vendor > to use dell_laptop module for controlling brightness. > > On my laptop E6440 is better for using dell-laptop and not acpi > or i915. Hi Pali, Please test this patch: diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index ca52ad2ae7d1..15534345bd57 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c @@ -396,6 +396,24 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state) return -EINVAL; } +/* + * Some of the Thinkpads' firmware will issue a backlight change operation + * region request unconditionally on AC plug/unplug, this is undesirable and + * should be ignored. Then there is a Dell laptop whose vendor backlight + * interface also makes use of operation region request to change backlight + * level and we have to keep it work. The rule used here is: if the vendor + * backlight interface is not in use and the ACPI backlight interface is + * broken, we ignore the requests; oterwise, we keep processing them. + */ +static bool should_ignore_backlight_request(void) +{ + if (acpi_video_backlight_support() && + !acpi_video_verify_backlight_support()) + return true; + + return false; +} + static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -404,11 +422,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); - /* - * If the acpi_video interface is not supposed to be used, don't - * bother processing backlight level change requests from firmware. - */ - if (!acpi_video_verify_backlight_support()) { + if (should_ignore_backlight_request()) { DRM_DEBUG_KMS("opregion backlight request ignored\n"); return 0; }