From patchwork Wed Apr 5 06:49:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 9663073 X-Patchwork-Delegate: dvhart@infradead.org 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 CD64960353 for ; Wed, 5 Apr 2017 06:52:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE5F6284F8 for ; Wed, 5 Apr 2017 06:52:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2F6628514; Wed, 5 Apr 2017 06:52:21 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E7B228338 for ; Wed, 5 Apr 2017 06:52:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753185AbdDEGwO (ORCPT ); Wed, 5 Apr 2017 02:52:14 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33815 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754286AbdDEGtU (ORCPT ); Wed, 5 Apr 2017 02:49:20 -0400 Received: by mail-lf0-f67.google.com with SMTP id x137so356755lff.1 for ; Tue, 04 Apr 2017 23:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D+nF/DPQzPVhmuAX3OFIhavIHtFV41W0BNW/dKV+RF4=; b=hoR7peW7clJgksNIBllrkWiaDZlfhh//eyhNnKecbLLcZc3/2ASqK6rhu36yovCx2U To6bgCu79RTRfgIoxz6FX7q5nGw3BjCl52ePNCy36CgyK79UFtlRGtHcRYp65s8B4r3E pJZRo23pwWfpoG8iwsYs/IWM0t7echREnNqY0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D+nF/DPQzPVhmuAX3OFIhavIHtFV41W0BNW/dKV+RF4=; b=kjSJCTZO5XziehkRK7v9zrbeTgtg2J+TrxsaxrXmRZtWIpBFQ1JQZ3433ZOv0kFk8n 34GkI2gafw6xmwp8xbapXvPCMGNn59iZlAe6qwFsyT5DyvRSV4wsZi7dnQvxcmoPVHSd KwpttwKQLLJhmORUGl00iv+05MTIvSN/90Tx3DgVA4o+o1ncION3Ym3c3mYAAaOVbExI msrUtsW7dj54RtLlwr3IpPtQb68vIFHWkVhCQ0S7WHZGDleYNrSOd7Im9sXslmfFSOF/ kzEiqCaVLEEN+s3VRGOyWNwTBg744HxFrh3s2S9Cnnp/Hp7fK/c47mBXykeP0NgitnNA 2dcQ== X-Gm-Message-State: AFeK/H0MnFb/7bse3tjOHwF2L6OLnWaoLIpy1URYZeHsLVg1mmWW4VzRpSGbl+Uc4nL0oQ== X-Received: by 10.25.161.81 with SMTP id k78mr9167753lfe.111.1491374958670; Tue, 04 Apr 2017 23:49:18 -0700 (PDT) Received: from ozzy.nask.waw.pl ([2001:a10:160:3::3]) by smtp.googlemail.com with ESMTPSA id o91sm3619921lfg.1.2017.04.04.23.49.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 23:49:18 -0700 (PDT) From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Jonathan Woithe , Darren Hart , Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 06/11] platform/x86: fujitsu-laptop: clean up use_alt_lcd_levels handling Date: Wed, 5 Apr 2017 08:49:05 +0200 Message-Id: <20170405064910.3162-7-kernel@kempniu.pl> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170405064910.3162-1-kernel@kempniu.pl> References: <20170405064910.3162-1-kernel@kempniu.pl> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The value of each module parameter can be changed on the fly via sysfs. However, the current way of handling use_alt_lcd_levels prevents the user from dynamically switching from a value of 0 or 1 back to autodetection as the latter is only performed upon ACPI device instantiation. Fix this by moving autodetection (in a simplified form) to set_lcd_level() and changing module parameter type to int. Do not announce autodetection results in a debug message as current value of use_alt_lcd_levels can simply be read from sysfs. Clarify module parameter description. Signed-off-by: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index b019060d6dc4..cd2da9a02592 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -362,6 +362,12 @@ static int set_lcd_level(int level) char *method; switch (use_alt_lcd_levels) { + case -1: + if (acpi_has_method(fujitsu_bl->acpi_handle, "SBL2")) + method = "SBL2"; + else + method = "SBLL"; + break; case 1: method = "SBL2"; break; @@ -606,21 +612,10 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) pr_err("_INI Method failed\n"); } - if (use_alt_lcd_levels == -1) { - if (acpi_has_method(NULL, "\\_SB.PCI0.LPCB.FJEX.SBL2")) - use_alt_lcd_levels = 1; - else - use_alt_lcd_levels = 0; - vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as %i\n", - use_alt_lcd_levels); - } - /* do config (detect defaults) */ - use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0; disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0; - vdbg_printk(FUJLAPTOP_DBG_INFO, - "config: [alt interface: %d], [adjust disable: %d]\n", - use_alt_lcd_levels, disable_brightness_adjust); + vdbg_printk(FUJLAPTOP_DBG_INFO, "config: [adjust disable: %d]\n", + disable_brightness_adjust); if (get_max_brightness() <= 0) fujitsu_bl->max_brightness = FUJITSU_LCD_N_LEVELS; @@ -1153,9 +1148,8 @@ static void __exit fujitsu_cleanup(void) module_init(fujitsu_init); module_exit(fujitsu_cleanup); -module_param(use_alt_lcd_levels, uint, 0644); -MODULE_PARM_DESC(use_alt_lcd_levels, - "Use alternative interface for lcd_levels (needed for Lifebook s6410)."); +module_param(use_alt_lcd_levels, int, 0644); +MODULE_PARM_DESC(use_alt_lcd_levels, "Interface used for setting LCD brightness level (-1 = auto, 0 = force SBLL, 1 = force SBL2)"); module_param(disable_brightness_adjust, uint, 0644); MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment ."); #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG