Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5140415imu; Tue, 8 Jan 2019 12:14:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN7C627IgqX9Kk6I1FlBD/+fczb5AZiDJyjKKeI5Le7I2Q5TouDQn7gQEv/wJLemT9c9QP+H X-Received: by 2002:a17:902:7044:: with SMTP id h4mr3116433plt.35.1546978491545; Tue, 08 Jan 2019 12:14:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546978491; cv=none; d=google.com; s=arc-20160816; b=euRBIVBFHyFGAyyEbeJyc11UwFCxQmv3jCkUymLkuPaH1TcKA9kRkyk+cIHEosVSUs YswV/7zT655E9sN06/4U9k1yQcY4tHaHn2B3KuvWXxV1k35/Q2z+oeWqPwhUKKguEl8p Sn7IQsmjQPV5LeKIlbTPcT7h3TgIXROPJXwgqqWEzcH8ij1YflvzyZKHwhLOxx5ZYDL0 duQS8aFTMjKO/FCLxHvSIQAozKI9BKrdVEHvIbKYBRNO6TVZR2tw80kiqu3z5THmx1zl /XKE5H+bA0xVG4wCDEPR4XT6lbIl6X3BZyVYlqb1h4k42mNChfvVJtXOh3/MTSjWpHWc QYJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SFBlOiapoeMguiBYYTnUGe0mBogbRcJeK7TXvovmtoE=; b=dyngn926pQiWyr7ND+GxjEkBzKsgtCcfxVB2x3eNBH8HRFwYXm7maJt1qElUs56FJ7 WIn8bSLmo7O5lUtNx8xqT3skwXGHeIRJDdQK7uYfkbNQNr1sPLSI7wwtBemHtzx/VNDW IwZiCBnxSxWKCMoIOOCnKaeXMeQta3NiaF9DAnVlPPUg7AufM8e3wY4XXekGBUPxTUj/ oYj8pkX3wgTv7odfTbdWYq2794jCaFcr8PAQf4Jh4oqsxj6dkMsk2aBhPF5DdX+hrSow q46ss7uHLShrFGp0YGoqCPpQ54ULP03Zp4TDpEoGYcIenCRKNbRSwdzpqlHx+HqWtikD e29w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Gc+jiKrS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si94441pgf.136.2019.01.08.12.14.20; Tue, 08 Jan 2019 12:14:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Gc+jiKrS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730389AbfAHUK3 (ORCPT + 99 others); Tue, 8 Jan 2019 15:10:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:60796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729094AbfAHT0q (ORCPT ); Tue, 8 Jan 2019 14:26:46 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E3002176F; Tue, 8 Jan 2019 19:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546975605; bh=zj8qwMlHfHKdEqQH9sAdHYS87SfDKNAKYRlWwnBRTfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gc+jiKrS5ruT3oCSls4MUPWEzbCs5/Fr1SUtCuuh+nGiBMNF/9yDrdVrfgX23GRuj 99fxAsI61KDNiYQwxxCV2o+4fIiVC5iTbG0XKJThLIaW3NFtSjMs6Y7hXKqtjHMxA0 ZlOFUQz6JGfRsTv5A3nI5e16YWPDc+pENZZnC4b8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= , =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= , Andy Shevchenko , Sasha Levin , acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 008/117] platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey Date: Tue, 8 Jan 2019 14:24:36 -0500 Message-Id: <20190108192628.121270-8-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190108192628.121270-1-sashal@kernel.org> References: <20190108192628.121270-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: João Paulo Rechi Vita [ Upstream commit 78f3ac76d9e5219589718b9e4733bee21627b3f5 ] In the past, Asus firmwares would change the panel backlight directly through the EC when the display off hotkey (Fn+F7) was pressed, and only notify the OS of such change, with 0x33 when the LCD was ON and 0x34 when the LCD was OFF. These are currently mapped to KEY_DISPLAYTOGGLE and KEY_DISPLAY_OFF, respectively. Most recently the EC on Asus most machines lost ability to toggle the LCD backlight directly, but unless the OS informs the firmware it is going to handle the display toggle hotkey events, the firmware still tries change the brightness through the EC, to no effect. The end result is a long list (at Endless we counted 11) of Asus laptop models where the display toggle hotkey does not perform any action. Our firmware engineers contacts at Asus were surprised that there were still machines out there with the old behavior. Calling WMNB(ASUS_WMI_DEVID_BACKLIGHT==0x00050011, 2) on the _WDG device tells the firmware that it should let the OS handle the display toggle event, in which case it will simply notify the OS of a key press with 0x35, as shown by the DSDT excerpts bellow. Scope (_SB) { (...) Device (ATKD) { (...) Name (_WDG, Buffer (0x28) { /* 0000 */ 0xD0, 0x5E, 0x84, 0x97, 0x6D, 0x4E, 0xDE, 0x11, /* 0008 */ 0x8A, 0x39, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66, /* 0010 */ 0x4E, 0x42, 0x01, 0x02, 0x35, 0xBB, 0x3C, 0x0B, /* 0018 */ 0xC2, 0xE3, 0xED, 0x45, 0x91, 0xC2, 0x4C, 0x5A, /* 0020 */ 0x6D, 0x19, 0x5D, 0x1C, 0xFF, 0x00, 0x01, 0x08 }) Method (WMNB, 3, Serialized) { CreateDWordField (Arg2, Zero, IIA0) CreateDWordField (Arg2, 0x04, IIA1) Local0 = (Arg1 & 0xFFFFFFFF) (...) If ((Local0 == 0x53564544)) { (...) If ((IIA0 == 0x00050011)) { If ((IIA1 == 0x02)) { ^^PCI0.SBRG.EC0.SPIN (0x72, One) ^^PCI0.SBRG.EC0.BLCT = One } Return (One) } } (...) } (...) } (...) } (...) Scope (_SB.PCI0.SBRG.EC0) { (...) Name (BLCT, Zero) (...) Method (_Q10, 0, NotSerialized) // _Qxx: EC Query { If ((BLCT == Zero)) { Local0 = One Local0 = RPIN (0x72) Local0 ^= One SPIN (0x72, Local0) If (ATKP) { Local0 = (0x34 - Local0) ^^^^ATKD.IANE (Local0) } } ElseIf ((BLCT == One)) { If (ATKP) { ^^^^ATKD.IANE (0x35) } } } (...) } Signed-off-by: João Paulo Rechi Vita Signed-off-by: Andy Shevchenko Signed-off-by: Sasha Levin --- drivers/platform/x86/asus-wmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index c285a16675ee..37b5de541270 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -2131,7 +2131,8 @@ static int asus_wmi_add(struct platform_device *pdev) err = asus_wmi_backlight_init(asus); if (err && err != -ENODEV) goto fail_backlight; - } + } else + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL); status = wmi_install_notify_handler(asus->driver->event_guid, asus_wmi_notify, asus); -- 2.19.1