ACPI / EC: Use busy polling mode when GPE is not enabled
PATCH 1/1 ACPI / EC: Use busy polling mode when GPE is not enabled
From: Lv Zheng <[email protected]>
Previously we have report that during system bootup, the EC command was running too slow because the EC GPE has not been enabled yet (For example, _REG tries to access the EC operation region, while the EC GPE has not been enabled at that stage). Actually we can optimize this scenario by using busy polling mode if GPE is disabled, which is much faster than the default behavior.
--- drivers/acpi/ec.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/acpi/ec.c +9 -1
@@ -342,6 +342,14 @@ static const char *acpi_ec_cmd_string(u8 cmd)* GPE Registers * -------------------------------------------------------------------------- */ +static inline bool acpi_ec_is_gpe_enabled (struct acpi_ec *ec) +{ +acpi_event_status gpe_status =0 ; + + (void )acpi_get_gpe_status (NULL , ec->gpe, &gpe_status); +return (gpe_status &ACPI_EVENT_FLAG_ENABLE_SET ) ? true : false; +} +static inline bool acpi_ec_is_gpe_raised (struct acpi_ec *ec) {acpi_event_status gpe_status =0 ;
@@ -734,7 +742,7 @@ static int ec_guard(struct acpi_ec *ec)/* Ensure guarding period before polling EC status */ do { - if (ec_busy_polling) { + if (!acpi_ec_is_gpe_enabled(ec) || ec_busy_polling) { /* Perform busy polling */ if (ec_transaction_completed(ec)) return 0;
Signature · 1 line
2.7.4
Hi, Yu
Quoted 11 lines
From: Chen, Yu C
Subject: [PATCH] ACPI / EC: Use busy polling mode when GPE is not enabledFrom: Lv Zheng <[email protected]>
Previously we have report that during system bootup, the EC command was running too slow because the EC GPE has not been enabled yet (For example,
_REGtries to access the EC operation region, while the EC GPE has not been enabled at that stage). Actually we can optimize this scenario by using busy polling mode if GPE is disabled, which is much faster than the default behavior.
I suddenly realized that why I didn't put this check during my previous EC work.
Though this patch can solve the issue in question, it doesn't handle runtime EC polling in a proper way. Sorry for my damaged memory.
Let me provide a different fix.
So please drop it.
Thanks and best regards
Lv
Quoted 37 lines
Reported-and-tested-by Chen Yu <[email protected]>Signed-off-by Lv Zheng <[email protected]>--- drivers/acpi/ec.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/acpi/ec.c +9
-2@@ -342,6 +342,14 @@ static const char *acpi_ec_cmd_string(u8 cmd)* GPE Registers * -------------------------------------------------------------------------- */ +static inline bool acpi_ec_is_gpe_enabled (struct acpi_ec *ec) +{ +acpi_event_status gpe_status =0 ; + + (void )acpi_get_gpe_status (NULL , ec->gpe, &gpe_status); +return (gpe_status &ACPI_EVENT_FLAG_ENABLE_SET ) ? true : false; +} +static inline bool acpi_ec_is_gpe_raised (struct acpi_ec *ec) {acpi_event_status gpe_status =0 ;@@ -734,7 +742,7 @@ static int ec_guard(struct acpi_ec *ec)/* Ensure guarding period before polling EC status */ do { - if (ec_busy_polling) { + if (!acpi_ec_is_gpe_enabled(ec) || ec_busy_polling) { /* Perform busy polling */ if (ec_transaction_completed(ec)) return 0; --2.7.4