All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep()
@ 2009-09-07 21:14 Karol Lewandowski
  2009-09-07 21:57 ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 4+ messages in thread
From: Karol Lewandowski @ 2009-09-07 21:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: astarikovskiy, lenb, linux-acpi, rjwysocki

Hello,

Following patch reverts commit that changed usleep() to mleep()
in ACPI's EC driver. That change made hotkeys on my Thinkpad T21
unusable after resume.  

This time, it's regression from 2.6.29 (it was repeadly broken and
fixed in older kernels too).
See http://bugzilla.kernel.org/show_bug.cgi?id=11674 for reference.

I've tested this patch with 2.6.31-rc9 -- hotkeys work again.

Please consider applying this to 2.6.31-tree and maybe 2.6.30-stable
as well.


Thanks.


commit 215c964fcccedc3f8967d57f7051e803e746a38d
Author: Karol Lewandowski <karol.k.lewandowski@gmail.com>
Date:   Mon Sep 7 21:13:02 2009 +0200

    Revert "ACPI: EC: Separate delays for MSI hardware"
    
    This reverts commit 34ff4dbccccce54c83b1234d39b7ad9e548a75dd.

    Revert timeout to old value (larger than spec requires[*]) instead
    of using vendor-dependent delays.

    Without this revert my Thinkpad T21 stops generating hotkey events
    after resume (with 2.6.31-rc9).  See bug #11674 for reference.

    [*] ACPI spec at http://www.acpi.info/DOWNLOADS/ACPIspec30b.pdf
    page 386, "Burst Enable Embedded Controller" defines EC's
    response timeout as =< 50us.

Signed-off-by: Karol Lewandowski <karol.k.lewandowski@gmail.com>

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 391f331..20eed99 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -67,7 +67,7 @@ enum ec_command {
 
 #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_CDELAY		10	/* Wait 10us before polling EC */
+#define ACPI_EC_UDELAY		100	/* Wait 100us before polling EC again */
 
 #define ACPI_EC_STORM_THRESHOLD 8	/* number of false interrupts
 					   per one transaction */
@@ -236,23 +236,13 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
 	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)
 {
 	unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
-	udelay(ACPI_EC_CDELAY);
+	udelay(ACPI_EC_UDELAY);
 	while (time_before(jiffies, delay)) {
 		gpe_transaction(ec, acpi_ec_read_status(ec));
-		ec_delay();
+		udelay(ACPI_EC_UDELAY);
 		if (ec_transaction_done(ec))
 			return 0;
 	}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep()
  2009-09-07 21:14 [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep() Karol Lewandowski
@ 2009-09-07 21:57 ` Henrique de Moraes Holschuh
  2009-09-07 22:04   ` Karol Lewandowski
  0 siblings, 1 reply; 4+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-09-07 21:57 UTC (permalink / raw)
  To: Karol Lewandowski
  Cc: linux-kernel, astarikovskiy, lenb, linux-acpi, rjwysocki

On Mon, 07 Sep 2009, Karol Lewandowski wrote:
> Following patch reverts commit that changed usleep() to mleep()
> in ACPI's EC driver. That change made hotkeys on my Thinkpad T21
> unusable after resume.

Karol, can you send us the dmidecode information for your thinkpad?

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep()
  2009-09-07 21:57 ` Henrique de Moraes Holschuh
@ 2009-09-07 22:04   ` Karol Lewandowski
  2009-09-07 22:43     ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 4+ messages in thread
From: Karol Lewandowski @ 2009-09-07 22:04 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh
  Cc: Karol Lewandowski, linux-kernel, astarikovskiy, lenb, linux-acpi,
	rjwysocki

On Mon, Sep 07, 2009 at 06:57:12PM -0300, Henrique de Moraes Holschuh wrote:
> On Mon, 07 Sep 2009, Karol Lewandowski wrote:
> > Following patch reverts commit that changed usleep() to mleep()
> > in ACPI's EC driver. That change made hotkeys on my Thinkpad T21
> > unusable after resume.
> 
> Karol, can you send us the dmidecode information for your thinkpad?

Sure, here goes dmidecode output with UUID and SN grayed out (I guess
that isn't needed).


# dmidecode 2.9
SMBIOS 2.3 present.
45 structures occupying 1573 bytes.
Table at 0x000E0010.

Handle 0x0000, DMI type 0, 20 bytes
BIOS Information
	Vendor: IBM
	Version: KZET34WW (1.16 )
	Release Date: 04/28/2004
	Address: 0xE0000
	Runtime Size: 128 kB
	ROM Size: 512 kB
	Characteristics:
		ISA is supported
		PCI is supported
		PC Card (PCMCIA) is supported
		PNP is supported
		APM is supported
		BIOS is upgradeable
		BIOS shadowing is allowed
		ESCD support is available
		Boot from CD is supported
		Selectable boot is supported
		Boot from PC Card (PCMCIA) is supported
		EDD is supported
		3.5"/720 KB floppy services are supported (int 13h)
		3.5"/2.88 MB floppy services are supported (int 13h)
		Print screen service is supported (int 5h)
		8042 keyboard services are supported (int 9h)
		Serial services are supported (int 14h)
		Printer services are supported (int 17h)
		CGA/mono video services are supported (int 10h)
		ACPI is supported
		AGP is supported
		LS-120 boot is supported
		BIOS boot specification is supported

Handle 0x0001, DMI type 1, 25 bytes
System Information
	Manufacturer: IBM
	Product Name: 26478AG
	Version: Not Available
	Serial Number: -------
	UUID: ------------------------------------
	Wake-up Type: Power Switch

Handle 0x0002, DMI type 2, 8 bytes
Base Board Information
	Manufacturer: IBM
	Product Name: 26478AG
	Version: Not Available
	Serial Number: -----------

Handle 0x0003, DMI type 3, 17 bytes
Chassis Information
	Manufacturer: IBM
	Type: Notebook
	Lock: Not Present
	Version: Not Available
	Serial Number: Not Available
	Asset Tag: No Asset Information
	Boot-up State: Unknown
	Power Supply State: Unknown
	Thermal State: Unknown
	Security Status: Unknown
	OEM Information: 0x00000000

Handle 0x0004, DMI type 126, 17 bytes
Inactive

Handle 0x0005, DMI type 126, 17 bytes
Inactive

Handle 0x0006, DMI type 4, 32 bytes
Processor Information
	Socket Designation: None
	Type: Central Processor
	Family: Pentium III
	Manufacturer: GenuineIntel
	ID: 8A 06 00 00 FF F9 83 03
	Signature: Type 0, Family 6, Model 8, Stepping 10
	Flags:
		FPU (Floating-point unit on-chip)
		VME (Virtual mode extension)
		DE (Debugging extension)
		PSE (Page size extension)
		TSC (Time stamp counter)
		MSR (Model specific registers)
		PAE (Physical address extension)
		MCE (Machine check exception)
		CX8 (CMPXCHG8 instruction supported)
		SEP (Fast system call)
		MTRR (Memory type range registers)
		PGE (Page global enable)
		MCA (Machine check architecture)
		CMOV (Conditional move instruction supported)
		PAT (Page attribute table)
		PSE-36 (36-bit page size extension)
		MMX (MMX technology supported)
		FXSR (Fast floating-point save and restore)
		SSE (Streaming SIMD extensions)
	Version: Pentium(R) III
	Voltage: 1.6 V
	External Clock: 100 MHz
	Max Speed: 800 MHz
	Current Speed: 800 MHz
	Status: Populated, Enabled
	Upgrade: None
	L1 Cache Handle: 0x000A
	L2 Cache Handle: 0x000B
	L3 Cache Handle: Not Provided

Handle 0x0007, DMI type 5, 20 bytes
Memory Controller Information
	Error Detecting Method: None
	Error Correcting Capabilities:
		None
	Supported Interleave: One-way Interleave
	Current Interleave: One-way Interleave
	Maximum Memory Module Size: 512 MB
	Maximum Total Memory Size: 1024 MB
	Supported Speeds:
		Other
	Supported Memory Types:
		DIMM
		SDRAM
	Memory Module Voltage: 3.3 V
	Associated Memory Slots: 2
		0x0008
		0x0009
	Enabled Error Correcting Capabilities:
		None

Handle 0x0008, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM Slot 1
	Bank Connections: 0 3
	Current Speed: Unknown
	Type: DIMM SDRAM
	Installed Size: 128 MB (Double-bank Connection)
	Enabled Size: 128 MB (Double-bank Connection)
	Error Status: OK

Handle 0x0009, DMI type 6, 12 bytes
Memory Module Information
	Socket Designation: DIMM Slot 2
	Bank Connections: 1 4
	Current Speed: Unknown
	Type: DIMM SDRAM
	Installed Size: 128 MB (Double-bank Connection)
	Enabled Size: 128 MB (Double-bank Connection)
	Error Status: OK

Handle 0x000A, DMI type 7, 19 bytes
Cache Information
	Socket Designation: Internal L1 Cache
	Configuration: Enabled, Socketed, Level 1
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 32 KB
	Maximum Size: 32 KB
	Supported SRAM Types:
		Synchronous
	Installed SRAM Type: Synchronous
	Speed: Unknown
	Error Correction Type: Unknown
	System Type: Other
	Associativity: 4-way Set-associative

Handle 0x000B, DMI type 7, 19 bytes
Cache Information
	Socket Designation: Internal L2 Cache
	Configuration: Enabled, Socketed, Level 2
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 256 KB
	Maximum Size: 256 KB
	Supported SRAM Types:
		Synchronous
	Installed SRAM Type: Unknown
	Speed: Unknown
	Error Correction Type: Multi-bit ECC
	System Type: Unified
	Associativity: Other

Handle 0x000C, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Serial
	External Connector Type: DB-9 male
	Port Type: Serial Port 16550A Compatible

Handle 0x000D, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Infrared
	External Connector Type: Infrared
	Port Type: Other

Handle 0x000E, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Parallel
	External Connector Type: DB-25 female
	Port Type: Parallel Port ECP/EPP

Handle 0x000F, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: External Monitor
	External Connector Type: DB-15 female
	Port Type: Video Port

Handle 0x0010, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: PS/2 Mouse
	External Connector Type: PS/2
	Port Type: Mouse Port

Handle 0x0011, DMI type 126, 9 bytes
Inactive

Handle 0x0012, DMI type 126, 9 bytes
Inactive

Handle 0x0013, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Line-In Jack
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x0014, DMI type 126, 9 bytes
Inactive

Handle 0x0015, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Microphone Jack
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x0016, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Headphone Jack
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x0017, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: S-Video-Out
	External Connector Type: Other
	Port Type: Video Port

Handle 0x0018, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Modem
	External Connector Type: RJ-11
	Port Type: Modem Port

Handle 0x0019, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: Ethernet
	External Connector Type: RJ-45
	Port Type: Network Port

Handle 0x001A, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: USB 1
	External Connector Type: Access Bus (USB)
	Port Type: USB

Handle 0x001B, DMI type 126, 9 bytes
Inactive

Handle 0x001C, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: Not Available
	Internal Connector Type: None
	External Reference Designator: UltraPort(TM)
	External Connector Type: Other
	Port Type: USB

Handle 0x001D, DMI type 9, 13 bytes
System Slot Information
	Designation: CardBus Slot 1
	Type: 32-bit PC Card (PCMCIA)
	Current Usage: Available
	Length: Other
	ID: Adapter 0, Socket 0
	Characteristics:
		5.0 V is provided
		3.3 V is provided
		PC Card-16 is supported
		Cardbus is supported
		Zoom Video is supported
		Modem ring resume is supported
		PME signal is supported
		Hot-plug devices are supported

Handle 0x001E, DMI type 9, 13 bytes
System Slot Information
	Designation: CardBus Slot 2
	Type: 32-bit PC Card (PCMCIA)
	Current Usage: Available
	Length: Other
	ID: Adapter 1, Socket 0
	Characteristics:
		5.0 V is provided
		3.3 V is provided
		PC Card-16 is supported
		Cardbus is supported
		Zoom Video is supported
		Modem ring resume is supported
		PME signal is supported
		Hot-plug devices are supported

Handle 0x001F, DMI type 126, 13 bytes
Inactive

Handle 0x0020, DMI type 126, 13 bytes
Inactive

Handle 0x0021, DMI type 9, 13 bytes
System Slot Information
	Designation: Mini-PCI Slot 1
	Type: 32-bit PCI
	Current Usage: Available
	Length: Other
	ID: 1
	Characteristics:
		5.0 V is provided
		3.3 V is provided
		PME signal is supported
		SMBus signal is supported

Handle 0x0022, DMI type 126, 13 bytes
Inactive

Handle 0x0023, DMI type 16, 15 bytes
Physical Memory Array
	Location: System Board Or Motherboard
	Use: System Memory
	Error Correction Type: None
	Maximum Capacity: 1 GB
	Error Information Handle: Not Provided
	Number Of Devices: 2

Handle 0x0024, DMI type 17, 23 bytes
Memory Device
	Array Handle: 0x0023
	Error Information Handle: No Error
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 128 MB
	Form Factor: SODIMM
	Set: None
	Locator: DIMM 1
	Bank Locator: Bank 0/3
	Type: SDRAM
	Type Detail: Synchronous
	Speed: Unknown

Handle 0x0025, DMI type 17, 23 bytes
Memory Device
	Array Handle: 0x0023
	Error Information Handle: No Error
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 128 MB
	Form Factor: SODIMM
	Set: None
	Locator: DIMM 2
	Bank Locator: Bank 1/4
	Type: SDRAM
	Type Detail: Synchronous
	Speed: Unknown

Handle 0x0026, DMI type 19, 15 bytes
Memory Array Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x0000FFFFFFF
	Range Size: 256 MB
	Physical Array Handle: 0x0023
	Partition Width: 0

Handle 0x0027, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x00007FFFFFF
	Range Size: 128 MB
	Physical Device Handle: 0x0024
	Memory Array Mapped Address Handle: 0x0026
	Partition Row Position: 1

Handle 0x0028, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00008000000
	Ending Address: 0x0000FFFFFFF
	Range Size: 128 MB
	Physical Device Handle: 0x0025
	Memory Array Mapped Address Handle: 0x0026
	Partition Row Position: 1

Handle 0x0029, DMI type 21, 7 bytes
Built-in Pointing Device
	Type: Track Point
	Interface: PS/2
	Buttons: 3

Handle 0x002A, DMI type 32, 11 bytes
System Boot Information
	Status: No errors detected

Handle 0x002B, DMI type 128, 12 bytes
OEM-specific Type
	Header and Data:
		80 0C 2B 00 01 01 02 00 01 00 18 01
	Strings:
		Alert on LAN
		IBM 0020

Handle 0x002C, DMI type 127, 4 bytes
End Of Table

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep()
  2009-09-07 22:04   ` Karol Lewandowski
@ 2009-09-07 22:43     ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 4+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-09-07 22:43 UTC (permalink / raw)
  To: Karol Lewandowski
  Cc: linux-kernel, astarikovskiy, lenb, linux-acpi, rjwysocki

On Tue, 08 Sep 2009, Karol Lewandowski wrote:
> > On Mon, 07 Sep 2009, Karol Lewandowski wrote:
> > > Following patch reverts commit that changed usleep() to mleep()
> > > in ACPI's EC driver. That change made hotkeys on my Thinkpad T21
> > > unusable after resume.
> > 
> > Karol, can you send us the dmidecode information for your thinkpad?
> 
> Sure, here goes dmidecode output with UUID and SN grayed out (I guess
> that isn't needed).

Thank you, and yes, it is a good idea to gray out the UUID and SN, we don't
need or want them.

Can you please send the output of recent acpidump to me by private email?
You are using the latest T21 BIOS, and a full ACPI dump can be quite
valuable for my work in thinkpad-acpi.

I think the best way to go about this, as long as we don't get reports from
many other boxes failing to resume or hitting ACPI EC problems, is to add a
"slow_thinkpad_ec" quirk, and use dmi matches to enable it on the T21 and
other thinkpads of that vintage (definately all of the T2x and A2x, maybe a
few others.  I have a candidate list here that I assembled for other
reasons.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-07 22:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-07 21:14 [PATCH] Fix ACPI's EC regression from 2.6.29: use usleep() instead of msleep() Karol Lewandowski
2009-09-07 21:57 ` Henrique de Moraes Holschuh
2009-09-07 22:04   ` Karol Lewandowski
2009-09-07 22:43     ` Henrique de Moraes Holschuh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.