Blob Blame History Raw
Delivered-To: hdegoede@gapps.redhat.com
Received: by 2002:ac9:6402:0:0:0:0:0 with SMTP id r2csp1159009ock;
        Mon, 20 May 2019 23:28:40 -0700 (PDT)
X-Google-Smtp-Source: APXvYqzEtwqq6Q1hbrBqTEFvHJuczfsldfTxiiS018/hst2dmGipO/i52QcWyXJaIxAb/ecz61yL
X-Received: by 2002:a05:620a:1116:: with SMTP id o22mr60937067qkk.23.1558420120852;
        Mon, 20 May 2019 23:28:40 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1558420120; cv=none;
        d=google.com; s=arc-20160816;
        b=j/NtlSCAGn5q9DlinYEqsw+9oDJu7zz7hZdeHecj2hwygNbfIbK6CHEBtQws9lpBM2
         2X/7zdY451jiHHtP8cXvYsVRkvlIyOgd7jagu+kIOpgVY+IoiEW0UzuWY/dUMwQTK6D+
         CD9FmPs0hMdTVx8++AHS3N+SNujtJcFpRngUYfPJ0YOmbQJGt4nKRKaW0kkZD1pBsK91
         +YhTSQqz4e2xZ02r0LbfWgYWyE1ppjjz53nTq6ezyvKhQ84JViMf5kFMoGUDKoLRVH5U
         sH5xsZCzzGptH0dA6oJJzk8rjDc+puOwJWIW8D5fsCz93a0rRi/ia5rfsN54P/MpPMgQ
         DsHg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:delivered-to;
        bh=KdOwY7jBol7uA/PFFDO66V1bihnYwiif3YrjkSKRUiA=;
        b=gSM2abji2zLjywkvGpQ72oLfbsLhc8/waOBxP9JVMgMzkd6YXKAMdqeDG78UgEUkZX
         RS//NNHSAIA+CDPrZHd9IBuV/GA887Hoezn4lryvCIYVNjoWOcBuFlG5/ix32GqMUNs5
         gQDcToEn7rWl2LJpuhgMDLfvCcV8B77lRJThslE6zeeLR/M4lTklAl2epcopBQmZqXqS
         QaIJg7rndM61R469mrv9TLpaBxun3CAA8OQ+W0+j059ZoiGUMIJ4ZsuMCpvTHp4gQ5fe
         EmXXpAFxUE8a70UmSgRqIDbaqC6ik9ox9yCLhu1Aby5fvHeBW78nA83obbfix90uBmak
         QVag==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain gapps.redhat.com configured 209.132.183.28 as internal address) smtp.mailfrom=hdegoede@redhat.com
Return-Path: <hdegoede@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
        by mx.google.com with ESMTPS id a51si948515qta.226.2019.05.20.23.28.40
        for <hdegoede@gapps.redhat.com>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 20 May 2019 23:28:40 -0700 (PDT)
Received-SPF: pass (google.com: domain gapps.redhat.com configured 209.132.183.28 as internal address)
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain gapps.redhat.com configured 209.132.183.28 as internal address) smtp.mailfrom=hdegoede@redhat.com
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.redhat.com (Postfix) with ESMTPS id 1EB1285539
	for <hdegoede@gapps.redhat.com>; Tue, 21 May 2019 06:28:40 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
	id 18D0E19C67; Tue, 21 May 2019 06:28:40 +0000 (UTC)
Delivered-To: hdegoede@redhat.com
Received: from shalem.localdomain.com (ovpn-116-215.ams2.redhat.com [10.36.116.215])
	by smtp.corp.redhat.com (Postfix) with ESMTP id 8119F19C5B;
	Tue, 21 May 2019 06:28:38 +0000 (UTC)
From: Hans de Goede <hdegoede@redhat.com>
To: Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	Corentin Chary <corentin.chary@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	acpi4asus-user@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	=?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= <jprvita@endlessm.com>
Subject: [PATCH] platform/x86: asus-wmi: Only Tell EC the OS will handle display hotkeys from asus_nb_wmi
Date: Tue, 21 May 2019 08:28:37 +0200
Message-Id: <20190521062837.3887-1-hdegoede@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 21 May 2019 06:28:40 +0000 (UTC)

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will
handle the display off hotkey") causes the backlight to be permanently off
on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC
1015BX, Asus EeePC 1025C).

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added
by that commit is made conditional in this commit and only enabled in
the quirk_entry structs in the asus-nb-wmi driver fixing the broken
display / backlight on various EeePC laptop models.

Cc: João Paulo Rechi Vita <jprvita@endlessm.com>
Fixes: 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/asus-nb-wmi.c | 8 ++++++++
 drivers/platform/x86/asus-wmi.c    | 2 +-
 drivers/platform/x86/asus-wmi.h    | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index b6f2ff95c3ed..59f3a37a44d7 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
 
 static struct quirk_entry quirk_asus_unknown = {
 	.wapf = 0,
+	.wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_q500a = {
 	.i8042_filter = asus_q500a_i8042_filter,
+	.wmi_backlight_set_devstate = true,
 };
 
 /*
@@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = {
 static struct quirk_entry quirk_asus_x55u = {
 	.wapf = 4,
 	.wmi_backlight_power = true,
+	.wmi_backlight_set_devstate = true,
 	.no_display_toggle = true,
 };
 
 static struct quirk_entry quirk_asus_wapf4 = {
 	.wapf = 4,
+	.wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_x200ca = {
 	.wapf = 2,
+	.wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_ux303ub = {
 	.wmi_backlight_native = true,
+	.wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_x550lb = {
+	.wmi_backlight_set_devstate = true,
 	.xusb2pr = 0x01D9,
 };
 
 static struct quirk_entry quirk_asus_forceals = {
+	.wmi_backlight_set_devstate = true,
 	.wmi_force_als_set = true,
 };
 
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index ee1fa93708ec..a66e99500c12 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -2131,7 +2131,7 @@ static int asus_wmi_add(struct platform_device *pdev)
 		err = asus_wmi_backlight_init(asus);
 		if (err && err != -ENODEV)
 			goto fail_backlight;
-	} else
+	} else if (asus->driver->quirks->wmi_backlight_set_devstate)
 		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
 	status = wmi_install_notify_handler(asus->driver->event_guid,
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index 6c1311f4b04d..57a79bddb286 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -44,6 +44,7 @@ struct quirk_entry {
 	bool store_backlight_power;
 	bool wmi_backlight_power;
 	bool wmi_backlight_native;
+	bool wmi_backlight_set_devstate;
 	bool wmi_force_als_set;
 	int wapf;
 	/*
-- 
2.21.0