mirror of https://gitee.com/openkylin/linux.git
ACPI: EC: Separate delays for MSI hardware
MSI notebooks require very strict delays, while all others are happy with msleep(). References: http://bugzilla.kernel.org/show_bug.cgi?id=9998 Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
8e0ee43bc2
commit
34ff4dbccc
|
@ -67,7 +67,7 @@ enum ec_command {
|
||||||
|
|
||||||
#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
|
#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
|
||||||
#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
|
#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
|
||||||
#define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */
|
#define ACPI_EC_CDELAY 10 /* Wait 10us before polling EC */
|
||||||
|
|
||||||
#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts
|
#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts
|
||||||
per one transaction */
|
per one transaction */
|
||||||
|
@ -236,13 +236,23 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ec_delay(void)
|
||||||
|
{
|
||||||
|
/* EC in MSI notebooks don't tolerate delays other than 550 usec */
|
||||||
|
if (EC_FLAGS_MSI)
|
||||||
|
udelay(ACPI_EC_DELAY);
|
||||||
|
else
|
||||||
|
/* Use shortest sleep available */
|
||||||
|
msleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
static int ec_poll(struct acpi_ec *ec)
|
static int ec_poll(struct acpi_ec *ec)
|
||||||
{
|
{
|
||||||
unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
|
unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
|
||||||
udelay(ACPI_EC_UDELAY);
|
udelay(ACPI_EC_CDELAY);
|
||||||
while (time_before(jiffies, delay)) {
|
while (time_before(jiffies, delay)) {
|
||||||
gpe_transaction(ec, acpi_ec_read_status(ec));
|
gpe_transaction(ec, acpi_ec_read_status(ec));
|
||||||
udelay(ACPI_EC_UDELAY);
|
ec_delay();
|
||||||
if (ec_transaction_done(ec))
|
if (ec_transaction_done(ec))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue