From patchwork Tue Oct 29 07:18:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lu X-Patchwork-Id: 3107141 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 75D13BF924 for ; Tue, 29 Oct 2013 10:26:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3732B200F4 for ; Tue, 29 Oct 2013 10:26:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 71BAB200ED for ; Tue, 29 Oct 2013 10:26:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2AE56EEA89; Tue, 29 Oct 2013 03:26:27 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [143.182.124.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 45C9DEE9EC; Tue, 29 Oct 2013 00:18:23 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 29 Oct 2013 00:18:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,535,1378882800"; d="scan'208";a="381523486" Received: from aaronlu.sh.intel.com ([10.239.37.146]) by azsmga001.ch.intel.com with ESMTP; 29 Oct 2013 00:18:14 -0700 Message-ID: <526F615D.2090602@intel.com> Date: Tue, 29 Oct 2013 15:18:53 +0800 From: Aaron Lu Organization: Intel, Shanghai, PRC MIME-Version: 1.0 To: Jani Nikula , Igor Gnatenko Subject: Re: [PATCH v5 0/4] Fix Win8 backlight issue References: <1381498066-16011-1-git-send-email-aaron.lu@intel.com> <2140073.U60XyxRqVZ@vostro.rjw.lan> <5268D6BB.3010207@intel.com> <1382682925.3328.4.camel@ThinkPad-X230.localdomain> <526DCFD7.7060002@intel.com> <87fvrl7r6g.fsf@intel.com> In-Reply-To: <87fvrl7r6g.fsf@intel.com> X-Mailman-Approved-At: Tue, 29 Oct 2013 03:25:42 -0700 Cc: James Hogan , Mike Galbraith , dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, Henrique de Moraes Holschuh , Matthew Garrett , linux-acpi@vger.kernel.org, Kalle Valo , Yves-Alexis Perez , Martin Steigerwald , Lee Chun-Yi , Ben Jencks , =?UTF-8?B?SsO2cmcgT3R0ZQ==?= , intel-gfx@lists.freedesktop.org, Kevin Smith , Rinat Ibragimov , Peter Weber , Joerg Platte , Seth Forshee , Lennart Poettering , Mika Westerberg , Theodore Tso , Kamal Mostafa , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Richard Purdie X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.7 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 On 10/28/2013 04:09 PM, Jani Nikula wrote: > On Mon, 28 Oct 2013, Aaron Lu wrote: >> +static int __init video_set_use_native_backlight(const struct dmi_system_id *d) >> +{ >> + use_native_backlight = true; >> + return 0; >> +} > > Hi Aaron, it might be beneficial to make use_native_backlight support > three values: force true, force false, and use platform default based on > DMI. Makes sense. I modified the patch a little bit so that if user has specified the cmdline option use_native_backlight=0/1, it will always take effect no matter if the system is in DMI table or not. From: Aaron Lu Subject: [PATCH] ACPI / video: Add systems that should favor native backlight interface Some system's ACPI video backlight control interface is broken and the native backlight control interface should be used by default. This patch sets the use_native_backlight parameter to true for those systems so that video backlight control interface will not be created. To be specific, the ThinkPad T430s/X230, Lenovo Yoga 13 and Dell Inspiron 7520 are added here. Note that the user specified kernel cmdline option will always have the highest priority, i.e. if use_native_backlight=0 is specified and the system is in the DMI table, the video module will not skip register backlight interface for it. Thinkpad T430s: Reported-by: Theodore Tso Reported-and-tested-by: Peter Weber Thinkpad X230: Reported-and-tested-by: Igor Gnatenko Lenovo Yoga 13: Reported-by: Lennart Poettering Reported-and-tested-by: Kevin Smith Dell Inspiron 7520: Reported-by: Rinat Ibragimov Reference: https://bugzilla.kernel.org/show_bug.cgi?id=51231 Signed-off-by: Aaron Lu --- drivers/acpi/video.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 38c3a28..41bd4b4 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -89,11 +89,12 @@ static bool use_bios_initial_backlight = 1; module_param(use_bios_initial_backlight, bool, 0644); /* - * For Windows 8 systems: if set ture and the GPU driver has - * registered a backlight interface, skip registering ACPI video's. + * For Windows 8 systems: used to decide if video module + * should skip registering backlight interface of its own. */ -static bool use_native_backlight = false; -module_param(use_native_backlight, bool, 0644); +static int use_native_backlight_param = -1; +module_param_named(use_native_backlight, use_native_backlight_param, int, 0444); +static bool use_native_backlight_dmi = false; static int register_count; static struct mutex video_list_lock; @@ -239,9 +240,17 @@ static int acpi_video_get_next_level(struct acpi_video_device *device, static int acpi_video_switch_brightness(struct acpi_video_device *device, int event); +static bool acpi_video_use_native_backlight(void) +{ + if (use_native_backlight_param != -1) + return !!use_native_backlight_param; + else + return use_native_backlight_dmi; +} + static bool acpi_video_verify_backlight_support(void) { - if (acpi_osi_is_win8() && use_native_backlight && + if (acpi_osi_is_win8() && acpi_video_use_native_backlight() && backlight_device_registered(BACKLIGHT_RAW)) return false; return acpi_video_backlight_support(); @@ -412,6 +421,12 @@ static int video_ignore_initial_backlight(const struct dmi_system_id *d) return 0; } +static int __init video_set_use_native_backlight(const struct dmi_system_id *d) +{ + use_native_backlight_dmi = true; + return 0; +} + static struct dmi_system_id video_dmi_table[] __initdata = { /* * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 @@ -512,6 +527,38 @@ static struct dmi_system_id video_dmi_table[] __initdata = { DMI_MATCH(DMI_PRODUCT_NAME, "HP 250 G1 Notebook PC"), }, }, + { + .callback = video_set_use_native_backlight, + .ident = "ThinkPad T430s", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"), + }, + }, + { + .callback = video_set_use_native_backlight, + .ident = "ThinkPad X230", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X230"), + }, + }, + { + .callback = video_set_use_native_backlight, + .ident = "Lenovo Yoga 13", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga 13"), + }, + }, + { + .callback = video_set_use_native_backlight, + .ident = "Dell Inspiron 7520", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_VERSION, "Inspiron 7520"), + }, + }, {} };