From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Len Brown <len.brown@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, Lv Zheng <zetalog@gmail.com>,
linux-acpi@vger.kernel.org, Daniel Drake <drake@endlessm.com>
Subject: [PATCH 3/3] ACPI / EC: Add EC setting preference support
Date: Tue, 16 May 2017 17:47:03 +0800 [thread overview]
Message-ID: <259815d15a25b7f6e6dd1b8c765f17c9f38d8ccc.1494927504.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1494927504.git.lv.zheng@intel.com>
Due to unknown reasons, Windows may prefer ECDT EC GPE rather than DSDT
EC GPE setting as some ASUS BIOSen report wrong GPE in DSDT EC but correct
one in ECDT EC. Without knowing the root cause, this patch simply allows
users to specify preferred EC settings (ID and GPE) via command line and
provides default value to always prefere DSDT settings. Users can work
the ASUS BIOS problem around with "ec_use_boot_ec_gpe=Y".
Link: https://bugzilla.kernel.org/show_bug.cgi?id=195651
Tested-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
drivers/acpi/ec.c | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index a7e74ae..b4ae29f 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -155,6 +155,14 @@ static bool ec_no_dsdt_boot_ec __read_mostly = false;
module_param(ec_no_dsdt_boot_ec, bool, 0644);
MODULE_PARM_DESC(ec_no_dsdt_boot_ec, "Do not probe DSDT EC as boot EC");
+static bool ec_use_boot_ec_id __read_mostly = false;
+module_param(ec_use_boot_ec_id, bool, 0644);
+MODULE_PARM_DESC(ec_use_boot_ec_id, "Override EC_ID using boot EC setting");
+
+static bool ec_use_boot_ec_gpe __read_mostly = false;
+module_param(ec_use_boot_ec_gpe, bool, 0644);
+MODULE_PARM_DESC(ec_use_boot_ec_gpe, "Override GPE_BIT using boot EC setting");
+
struct acpi_ec_query_handler {
struct list_head node;
acpi_ec_query_func func;
@@ -1574,14 +1582,28 @@ static bool acpi_is_boot_ec(struct acpi_ec *ec)
{
if (!boot_ec)
return false;
- if (ec->handle == boot_ec->handle &&
- ec->gpe == boot_ec->gpe &&
- ec->command_addr == boot_ec->command_addr &&
+ if (ec->command_addr == boot_ec->command_addr &&
ec->data_addr == boot_ec->data_addr)
return true;
return false;
}
+static void acpi_ec_config_preference(struct acpi_ec *ec)
+{
+ if (ec->handle != boot_ec->handle) {
+ if (ec_use_boot_ec_id)
+ ec->handle = boot_ec->handle;
+ else
+ boot_ec->handle = ec->handle;
+ }
+ if (ec->gpe != boot_ec->gpe) {
+ if (ec_use_boot_ec_gpe)
+ ec->gpe = boot_ec->gpe;
+ else
+ boot_ec->gpe = ec->gpe;
+ }
+}
+
static int acpi_ec_add(struct acpi_device *device)
{
struct acpi_ec *ec = NULL;
@@ -1600,8 +1622,8 @@ static int acpi_ec_add(struct acpi_device *device)
}
if (acpi_is_boot_ec(ec)) {
- boot_ec_is_ecdt = false;
- acpi_handle_debug(ec->handle, "duplicated.\n");
+ acpi_handle_debug(ec->handle, "duplicated late.\n");
+ acpi_ec_config_preference(ec);
acpi_ec_free(ec);
ec = boot_ec;
ret = acpi_config_boot_ec(ec, ec->handle, true, false);
@@ -1699,6 +1721,10 @@ int __init acpi_ec_dsdt_probe(void)
ret = -ENODEV;
goto error;
}
+ if (acpi_is_boot_ec(ec)) {
+ acpi_handle_debug(ec->handle, "duplicated early.\n");
+ acpi_ec_config_preference(ec);
+ }
/*
* When the DSDT EC is available, always re-configure boot EC to
* have _REG evaluated. _REG can only be evaluated after the
--
2.7.4
next prev parent reply other threads:[~2017-05-16 9:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 9:46 [PATCH 0/3] ACPI / EC: Add quirk modes for boot EC support Lv Zheng
2017-05-16 9:46 ` [PATCH 1/3] ACPI / EC: Enhance boot EC sanity check Lv Zheng
2017-05-16 9:46 ` [PATCH 2/3] ACPI / EC: Add support to skip boot stage DSDT probe Lv Zheng
2017-05-16 9:47 ` Lv Zheng [this message]
2017-05-19 7:07 ` [PATCH v2 0/3] ACPI / EC: Add quirk modes for boot EC support Lv Zheng
2017-05-19 7:07 ` [PATCH v2 1/3] ACPI / EC: Enhance boot EC sanity check Lv Zheng
2017-05-19 7:07 ` [PATCH v2 2/3] ACPI / EC: Add support to skip boot stage DSDT probe Lv Zheng
2017-05-19 7:07 ` [PATCH v2 3/3] ACPI / EC: Fix media keys not working problem on some Asus laptops Lv Zheng
2017-06-15 1:41 ` [PATCH v3 0/4] ACPI / EC: Add quirk modes for boot EC support Lv Zheng
2017-06-15 1:41 ` [PATCH v3 1/4] ACPI / EC: Enhance boot EC sanity check Lv Zheng
2017-06-15 1:41 ` [PATCH v3 2/4] ACPI / EC: Add support to skip boot stage DSDT probe Lv Zheng
2017-06-15 1:41 ` [PATCH v3 3/4] ACPI / EC: Fix media keys not working problem on some Asus laptops Lv Zheng
2017-06-15 1:41 ` [PATCH v3 4/4] ACPI / EC: Add quirk for GL720VMK Lv Zheng
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=259815d15a25b7f6e6dd1b8c765f17c9f38d8ccc.1494927504.git.lv.zheng@intel.com \
--to=lv.zheng@intel.com \
--cc=drake@endlessm.com \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
--cc=zetalog@gmail.com \
/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).