From patchwork Mon Mar 6 09:33:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 9605481 X-Patchwork-Delegate: andy.shevchenko@gmail.com 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 D32B5602B4 for ; Mon, 6 Mar 2017 09:34:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3FF127F54 for ; Mon, 6 Mar 2017 09:34:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95D4A2832B; Mon, 6 Mar 2017 09:34:37 +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=ham 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 E38BE27F54 for ; Mon, 6 Mar 2017 09:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753964AbdCFJef (ORCPT ); Mon, 6 Mar 2017 04:34:35 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:33615 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754004AbdCFJeX (ORCPT ); Mon, 6 Mar 2017 04:34:23 -0500 Received: by mail-lf0-f50.google.com with SMTP id a6so69660950lfa.0 for ; Mon, 06 Mar 2017 01:33:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=q6REYrO5usKIemZoJV9LJDO5k83U35OndXZiTtROAHQ=; b=cveDSZUsC0cZUSSJ0HAkU0B5aNv/1xqsWP0kaURKKEuxVEuDpdEdxje0erLBs8xJEn m8fO8iR44ZsDggKhdoOkpBDf+kOJ6MdCe3kdOsKWNyTSIVessMtuAcBO2qBcNgdd4GE3 Y+MeciW0GIxipQGAGaOUkNMD60j9h2wMrk4Vo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=q6REYrO5usKIemZoJV9LJDO5k83U35OndXZiTtROAHQ=; b=pUrf3bSHD7+J/jifR6PeiAc9Ej10mncV2aD5hmVlWT4Fb01jy+91+nSGB9RZVFDxbZ nGao3kEna+eS2cTU3/S8uE3N8mvbQUSdhnjnv4Zp85NxKDuC/Giy0uXhQDY0CPMT/tM9 F5eYdS2iJWASjwiuBx/ZBzhPLvc0QNoUIcXF5qA5AQDL5dYzaskXd6abzKYFdTEgxKi2 jruUTT7iLUeuizB4qiAIPBgx6ByCSVShs/q9pAKFjTdjNNCtG6O0MM00jITdKq//2AtE AXHYGRSpxnUNDUITsUQkrAWyGAGHo38boPMYgW0bl3FmTJamuaKbwtZdrr1yRl4VTTgM qWaA== X-Gm-Message-State: AMke39mBB7MdyLajTANoTDIihEKW7vFo3W9VCRjWnQ+eu9Ub1HZBtqv1epr3CUfEO8OeKQ== X-Received: by 10.25.225.216 with SMTP id l85mr4241727lfk.129.1488792833456; Mon, 06 Mar 2017 01:33:53 -0800 (PST) Received: from ozzy.nask.waw.pl ([2001:a10:160:3::3]) by smtp.gmail.com with ESMTPSA id c1sm1153772lfc.55.2017.03.06.01.33.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 01:33:52 -0800 (PST) Date: Mon, 6 Mar 2017 10:33:50 +0100 From: =?utf-8?B?TWljaGHFgiBLxJlwaWXFhA==?= To: Jonathan Woithe Cc: Darren Hart , Andy Shevchenko , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 0/4] fujitsu_init() cleanup Message-ID: <20170306093350.GB1372@ozzy.nask.waw.pl> References: <20170301081044.12141-1-kernel@kempniu.pl> <20170304014723.GA7944@marvin.atrad.com.au> <20170305234854.GG28473@marvin.atrad.com.au> <20170306044905.GA3845@kmp-mobile.hq.kempniu.pl> <20170306050104.GT28473@marvin.atrad.com.au> <20170306081030.GA30975@marvin.atrad.com.au> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170306081030.GA30975@marvin.atrad.com.au> User-Agent: Mutt/1.8.0 (2017-02-23) 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 > Hi Michael > > Some quick feedback. > > On Mon, Mar 06, 2017 at 03:31:04PM +1030, Jonathan Woithe wrote: > > > > I can add that immediately after loading the driver the value returned by a > > > > read of bl_power is 0. As noted above, setting to 1 makes no difference to > > > > the backlight, neither does returning it to 0. > > > > > > Have you tried setting bl_power to 4? Because that is the value of > > > FB_BLANK_POWERDOWN, which is the value the patch is supposed to handle. > > > > Oh no, I didn't try 4. I should have. I will try to squeeze in a test of > > this tonight (time is short but the test won't take a lot of time). > > With an unpatched 4.5 kernel, writing 4 (as opposed to 1, which I stupidly > tried earlier) to bl_power caused the backlight to turn off. Writing 0 > turned it back on again. > > With patches 1-4/4 applied, writing 4 to bl_power did *NOT* turn the > backlight off. > > With patch 2 reverted, writing 4 to bl_power turned the backlight off. > Writing 0 to bl_power turned it back on again. > > This means that patch 2/4 seems to prevent bl_power from operating as > expected on the S7020 hardware. Without this patch (but with all the others > in place) bl_power works. > > I am unlikely to have any more time to investigate this further tonight. > > In light of the above findings, what would you like to do? Thanks for testing, good that we caught this before the patch series was applied. I think it is reasonable to skip applying this version of the series as at least patch 2/4 is faulty and breaks a working feature. Moving on, though, as I do not have access to Fujitsu hardware on which this feature works, I was hoping you could help me verify whether my assumptions were reasonable in the first place. I attached a crude patch to this message. I would like to understand how the underlying ACPI variables behave when the FEXT interface is used, so please apply this patch on top of dvhart/testing (i.e. without this series applied). After compiling, please load the module with debugging enabled, then test backlight control once again by writing 4 and then 0 to bl_power (this should work). Then please send me all the messages spit out by the driver into dmesg. This should shed some light on the matter. Thanks! diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index e12cc3504d48..34bf97d4d463 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -463,7 +463,11 @@ static int bl_get_brightness(struct backlight_device *b) static int bl_update_status(struct backlight_device *b) { + unsigned long long blank; + acpi_status status; + acpi_handle handle; int ret; + if (b->props.power == FB_BLANK_POWERDOWN) ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x3); else @@ -473,6 +477,26 @@ static int bl_update_status(struct backlight_device *b) "Unable to adjust backlight power, error code %i\n", ret); + vdbg_printk(FUJLAPTOP_DBG_INFO, "Backlight power set to %d\n", b->props.power); + + status = acpi_evaluate_integer(NULL, "\\BLCT", NULL, &blank); + if (ACPI_SUCCESS(status)) + vdbg_printk(FUJLAPTOP_DBG_INFO, "BLCT = %llx\n", blank); + else + vdbg_printk(FUJLAPTOP_DBG_ERROR, "Cannot evaluate BLCT\n"); + + status = acpi_evaluate_integer(NULL, "\\NGTM", NULL, &blank); + if (ACPI_SUCCESS(status)) + vdbg_printk(FUJLAPTOP_DBG_INFO, "NGTM = %llx\n", blank); + else + vdbg_printk(FUJLAPTOP_DBG_ERROR, "Cannot evaluate NGTM\n"); + + status = acpi_get_handle(NULL, "\\_SB.FEXT.SBLC", &handle); + if (ACPI_SUCCESS(status)) + vdbg_printk(FUJLAPTOP_DBG_INFO, "Got ACPI handle for SBLC\n"); + else + vdbg_printk(FUJLAPTOP_DBG_ERROR, "Cannot get ACPI handle for SBLC\n"); + if (use_alt_lcd_levels) ret = set_lcd_level_alt(b->props.brightness); else -- 2.12.0