linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Corentin Chary <corentin.chary@gmail.com>
To: Len Brown <lenb@kernel.org>, Matthew Garrett <mjg59@srcf.ucam.org>
Cc: linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org,
	AceLan Kao <acelan.kao@canonical.com>,
	Corentin Chary <corentin.chary@gmail.com>,
	Corentin Chary <corentincj@iksaif.net>,
	Matthew Garrett <mjg@redhat.com>,
	acpi4asus-user@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: [PATCH 6/7] asus-wmi: control backlight power through WMI, not ACPI
Date: Thu, 14 Jun 2012 13:05:12 +0200	[thread overview]
Message-ID: <1339671912-27715-1-git-send-email-corentin.chary@gmail.com> (raw)
In-Reply-To: <1339572727-24744-7-git-send-email-corentin.chary@gmail.com>

From: AceLan Kao <acelan.kao@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/1000146

Some h/w that can adjust screen brightness through ACPI functions, but
can't turn on/off the backlight power correctly. So, we list those h/w in
quirks and try to turn on/off the backlight power through WMI.
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-wmi.c  |    5 +++++
 drivers/platform/x86/asus-wmi.h  |    1 +
 drivers/platform/x86/eeepc-wmi.c |   25 ++++++++++++++++++++++++-
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 77aadde..7e89e04 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -47,6 +47,7 @@
 #include <linux/thermal.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
+#include <acpi/video.h>
 
 #include "asus-wmi.h"
 
@@ -1681,7 +1682,11 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_rfkill;
 
+	if (asus->driver->quirks->wmi_backlight_power)
+		acpi_video_dmi_promote_vendor();
 	if (!acpi_video_backlight_support()) {
+		pr_info("Disabling ACPI video driver\n");
+		acpi_video_unregister();
 		err = asus_wmi_backlight_init(asus);
 		if (err && err != -ENODEV)
 			goto fail_backlight;
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index d43b667..9c1da8b 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -39,6 +39,7 @@ struct quirk_entry {
 	bool hotplug_wireless;
 	bool scalar_panel_brightness;
 	bool store_backlight_power;
+	bool wmi_backlight_power;
 	int wapf;
 };
 
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 6567613..5838332 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -79,7 +79,7 @@ static const struct key_entry eeepc_wmi_keymap[] = {
 	{ KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */
 	{ KE_KEY, HOME_PRESS, { KEY_CONFIG } }, /* Home/Express gate key */
 	{ KE_KEY, 0xe8, { KEY_SCREENLOCK } },
-	{ KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } },
+	{ KE_KEY, 0xe9, { KEY_DISPLAYTOGGLE } },
 	{ KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } },
 	{ KE_KEY, 0xec, { KEY_CAMERA_UP } },
 	{ KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
@@ -107,6 +107,11 @@ static struct quirk_entry quirk_asus_et2012_type3 = {
 	.store_backlight_power = true,
 };
 
+static struct quirk_entry quirk_asus_x101ch = {
+	/* We need this when ACPI function doesn't do this well */
+	.wmi_backlight_power = true,
+};
+
 static struct quirk_entry *quirks;
 
 static void et2012_quirks(void)
@@ -157,6 +162,24 @@ static struct dmi_system_id asus_quirks[] = {
 		},
 		.driver_data = &quirk_asus_unknown,
 	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK Computer INC. X101CH",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X101CH"),
+		},
+		.driver_data = &quirk_asus_x101ch,
+	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUSTeK Computer INC. 1015CX",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "1015CX"),
+		},
+		.driver_data = &quirk_asus_x101ch,
+	},
 	{},
 };
 
-- 
1.7.9.5

  reply	other threads:[~2012-06-14 11:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13  7:32 [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Corentin Chary
2012-06-13  7:32 ` [PATCH 1/7] acpi: add a way to promote/demote vendor backlight drivers Corentin Chary
2012-06-26 22:19   ` Mattia Dongili
2012-06-29 12:19     ` Corentin Chary
2012-06-13  7:32 ` [PATCH 2/7] drivers-platform-x86: use acpi_video_dmi_promote_vendor() Corentin Chary
2012-06-14  9:58   ` joeyli
2012-06-14 10:54     ` Corentin Chary
2012-06-14 11:04       ` Corentin Chary
2012-06-14 12:53         ` joeyli
2012-06-14 20:02         ` Seth Forshee
2012-06-13  7:32 ` [PATCH 3/7] samsung-laptop: X360 ACPI backlight device is broken Corentin Chary
2012-06-13  7:32 ` [PATCH 4/7] acpi/video_detect: blacklist samsung x360 Corentin Chary
2012-06-13  7:32 ` [PATCH 5/7] samsung-laptop: support R40/R41 Corentin Chary
2012-06-13  7:32 ` [PATCH 6/7] asus-wmi: control backlight power through WMI, not ACPI Corentin Chary
2012-06-14 11:05   ` Corentin Chary [this message]
2012-06-13  7:32 ` [PATCH 7/7] asus-wmi: enable resume on lid open Corentin Chary
2012-06-26 18:42 ` [PATCH 0/7] platform-drivers-x86: backlight, samsung and asus Matthew Garrett
2012-06-29 12:16   ` Corentin Chary
2012-07-16  5:45     ` Corentin Chary
2012-07-23 13:35       ` Matthew Garrett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339671912-27715-1-git-send-email-corentin.chary@gmail.com \
    --to=corentin.chary@gmail.com \
    --cc=acelan.kao@canonical.com \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=corentincj@iksaif.net \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=mjg@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).