Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp201686imd; Wed, 31 Oct 2018 17:22:28 -0700 (PDT) X-Google-Smtp-Source: AJdET5exO4Tawa6BdmQaYgBKHtP676MsyXqwAXfJKQ24tttb3rAxPpEh7SZqbtgtvtJXKPYwDxTn X-Received: by 2002:a65:5b81:: with SMTP id i1-v6mr5241831pgr.252.1541031748227; Wed, 31 Oct 2018 17:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541031748; cv=none; d=google.com; s=arc-20160816; b=iDc9N2XnhW8pa9zlu+BmvOV/qopp3MullRhYOV8iO73zPaFcC2nMP9bym5mAqbtaUs QWf0XvDszUqLt16LjC/8rEkbUKYMwg6uw6fvsZ69selGm0gF7A/io03RCL/j9dH9EgC5 UQJo+rR+vVcMzMymvXHu/mKf1vQ4AWvHyTWcowVlVUCODLBCTP2Dp0GcFaFwfJYgTauy OD+nlrgTYxwyZoSYbAo1qCXMOsFtXNm24I1qMOQw6gOigVN46VDfA1y5VuJXz/tpjQ/q krPX7vbkC/NzKGgMgh8f+J9F+FF5OpkUdWn3zei/FfQ+1q9QR//3jRTJIO0UMLshXmFP 1idg== 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=46/NOuoiPhhGNrGWXzwwHseMHtA5x0+HvtY23ixXS+s=; b=rd2BgOumz/+K9Uyui42nkIFHTlyU+0eE09wvr9n0vbFqxsQD47Zf9pGN0vtOgX00fr MXTJ6p2KL4RFiGizq8xhQAB835iU8S2gycmTFsdfwqjb2TN4+Ki+0dVJSIOUh1J4cXNz XdR7mktfHecCGRSJGtSU5RZa5XDr2a5/4ZNH4nbnw2PpfDOO6aHic9HTxa5kQz8TzGJY UEJqx/sirgPunTOJb2hsYbX9Eu0zv5ViwuBHhZLncWkaZgl1n2NAUXxpKCZuSw8CevOq 5r4NV7jab4ku9sdjgyFvEccvzIHCypVqSrzQY5UOFCqj16n6mIss8DrQvxOkzciYzQus fjPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tf8az2Bx; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h71-v6si18197623pgc.122.2018.10.31.17.22.12; Wed, 31 Oct 2018 17:22:28 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=tf8az2Bx; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726503AbeKAJWT (ORCPT + 99 others); Thu, 1 Nov 2018 05:22:19 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:46320 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725946AbeKAJWT (ORCPT ); Thu, 1 Nov 2018 05:22:19 -0400 Received: by mail-ed1-f65.google.com with SMTP id f8-v6so2832860edt.13; Wed, 31 Oct 2018 17:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=46/NOuoiPhhGNrGWXzwwHseMHtA5x0+HvtY23ixXS+s=; b=tf8az2Bx2CeDO02zJ1rCCAXLkt9edprsTLl8+mRmCqVZj6cb3JFualyjCzmXiJCr3b gr0znxUuMe9ifSfWm1IruZc5iIrns57Y3jbr4KDrBocs2QlvzVCyom7qo7pq+QNtKVtX AhwGz7GKSCb06ohW+FYJQM0vJNQwGjS7PjJvrE7+XEuAWzQCeK7ck7eit35hQ+GBAovO C7LS9EKFvBFUvrkOqLVb5BCn/WHmuearXlOq+QWuR6Xhas/fTTB5zC/EwubZseC5ylR0 BMOsuum/VqRvVpEx7KoLiYArT7giNrQB87L73sRM/W6COJyAcTlKjo/CWnGRoJc0g2Nh F/IA== 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=46/NOuoiPhhGNrGWXzwwHseMHtA5x0+HvtY23ixXS+s=; b=UgE79G6H507Ryq55RAk5hIRlXkexeXodtCMC2OQeYYDJVaGInsZ/fSsG7Yq3Pr+HCF QeAzZ4MVvR+5fDtQsT2sG0xnBsrrDiSpMMwhE3NTYCwFVSeZ4CTP31gL6DPjjMA/hTU3 /eDe++3z0BSxtPz8ATGD7dmyZrd2NYR8EU0yhUUy5DQWHxXpao1whNm3EZ/q4IyTWubR cv1tn0e5YrU1iWUg1D4+7rJuWKsUsTUN8foU5LaVkiy+uLMa+UAbUp3dI/nSM2bgsii3 i25JjQyvE8ZeNmGYFhX+g/qaLyF3BqDhjnbp02q+rA5IlMFJXxfL23giKPGxFHsGxGMf 7WkQ== X-Gm-Message-State: AGRZ1gIVD+reQOR049HDml0D84+5d2MTnUHNk9ucCjkzEVQkco5FHPqE Tp4h/6vuBqk8R90H6dbfxBI= X-Received: by 2002:a17:906:2201:: with SMTP id s1-v6mr2812543ejs.31.1541031704495; Wed, 31 Oct 2018 17:21:44 -0700 (PDT) Received: from kiddo.lan ([2601:602:9400:bc9f::a3c]) by smtp.gmail.com with ESMTPSA id b9-v6sm2981468ejd.3.2018.10.31.17.21.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 17:21:43 -0700 (PDT) From: "=?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?=" X-Google-Original-From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= To: Corentin Chary , Darren Hart , Andy Shevchenko , acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org Cc: hadess@hadess.net, Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessm.com, =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= Subject: [PATCH 1/3] asus-wmi: Tell the EC the OS will handle the display off hotkey Date: Wed, 31 Oct 2018 17:21:26 -0700 Message-Id: <20181101002128.28884-2-jprvita@endlessm.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181101002128.28884-1-jprvita@endlessm.com> References: <20181101002128.28884-1-jprvita@endlessm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 b52b192a4f16..c25b946bb602 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -2150,7 +2150,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