Commit Graph

228 Commits (a10d206ef1a83121ab7430cb196e0376a7145b22)

Author SHA1 Message Date
Alexey Starikovskiy 223883b7aa ACPI: EC: Switch off GPE mode during suspend/resume
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-03-24 20:50:36 -04:00
Alexey Starikovskiy b77d81b267 ACPI: EC: Replace broken controller workarounds with poll mode.
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-03-24 20:49:48 -04:00
Alexey Starikovskiy dc0e8490fe ACPI: EC: Improve debug output
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-03-24 20:48:46 -04:00
Alexey Starikovskiy 845625cdcb ACPI: EC: Add poll timer
If we can not use interrupt mode of EC for some reason, start polling
EC for events periodically.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-03-24 20:48:10 -04:00
Alexey Starikovskiy e6e82a3087 ACPI: EC: Restore udelay in poll mode
This fixes keyboard event handling on some systems.

Note that this delay was thought unnecessary, and removed
from linux-2.6.20 with 50c1e1138c
'ACPI: ec: Drop udelay() from poll mode. Loop by reading status field instead.'

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-03-24 20:47:35 -04:00
Alexey Starikovskiy d7a0e1f564 Revert "ACPI: EC: Handle IRQ storm on Acer laptops"
This reverts commit 2c81ce4c9c.

It caused several new troubles (eg suspend slowdown bisected down to
this patch by Pavel Machek), so just revert it for now.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-18 21:32:24 -07:00
Len Brown 1ca721cdb7 Merge branches 'release', 'bugzilla-8570', 'bugzilla-9966', 'bugzilla-9998', 'bugzilla-10100', 'bugzilla-10132', 'bugzilla-10138' and 'bugzilla-10206' into release 2008-03-13 01:59:45 -04:00
Alexey Starikovskiy 2c81ce4c9c ACPI: EC: Handle IRQ storm on Acer laptops
On some Acer systems, the HW fails to clear the GPE source,
causing an interrupt storm.

So in EC interrupt mode, we count how many interrupts we
receive when waiting.  If we get more than 5, we give
up on interrupt mode and revert to polling mode.

Also, for polling mode to work on Acers, we need
to insert a delay.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-03-11 13:30:00 -04:00
Len Brown 4af8e10a6c Revert "ACPI: EC: Use proper handle for boot EC"
This reverts commit 208c70a456.

http://bugzilla.kernel.org/show_bug.cgi?id=10100

Signed-off-by: Len Brown <len.brown@intel.com>
2008-03-11 00:27:16 -04:00
Alexey Starikovskiy 208c70a456 ACPI: EC: Use proper handle for boot EC
Fall back to ACPI_ROOT_HANDLE only in case of error.

ACPI: EC: EC description table is found, configuring boot EC
ACPI Error (evregion-0316): No handler for Region [ECOR] (ffff81007a651620) [EmbeddedControl] [20070126]
ACPI Error (exfldio-0289): Region EmbeddedControl(3) has no handler [20070126]

http://bugzilla.kernel.org/show_bug.cgi?id=9916

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-02-14 15:58:47 -05:00
Len Brown c64768a7d6 Merge branches 'release', 'bugzilla-6217', 'bugzilla-6629', 'bugzilla-6933', 'bugzilla-7186', 'bugzilla-8269', 'bugzilla-8570', 'bugzilla-9139', 'bugzilla-9277', 'bugzilla-9341', 'bugzilla-9444', 'bugzilla-9614', 'bugzilla-9643' and 'bugzilla-9644' into release 2008-02-07 03:09:43 -05:00
Márton Németh d772b3b323 ACPI: EC: "DEBUG" needs to be defined earlier
The "DEBUG" symbol needs to be defined before #including <linux/kernel.h> to
get the pr_debug() working.

Signed-off-by: Márton Németh <nm127@freemail.hu>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-01-23 22:34:09 -05:00
Márton Németh 86dae0154a ACPI: EC: add leading zeros to debug messages
Add leading zeros to pr_debug() calls. For example if x=0x0a, the format
"0x%2x" will result the string "0x a", the format "0x%2.2x" will result "0x0a".

Signed-off-by: Márton Németh <nm127@freemail.hu>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-01-23 22:33:06 -05:00
Alexey Starikovskiy 03d1d99c55 ACPI: EC: fix dmesg spam regression
Return OBF_1 optimization workaround

http://bugzilla.kernel.org/show_bug.cgi?id=8459

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-01-23 22:28:34 -05:00
Alexey Starikovskiy b3b233c7d9 ACPI: EC: Some hardware requires burst mode to operate properly
Burst mode temporary (50 ms) locks EC to do only transactions with
driver, without it some hardware returns abstract garbage.

Reference: http://bugzilla.kernel.org/show_bug.cgi?id=9341

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-01-10 20:50:12 -05:00
Alexey Starikovskiy 3e71a87d03 ACPI: EC: Do the byte access with a fast path
Specification allows only byte access for EC region, so
make it separate from bug-compatible multi-byte access.
Also do not allow return of garbage in supplied *value.

Reference: http://bugzilla.kernel.org/show_bug.cgi?id=9341

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-01-10 20:49:14 -05:00
Alexey Starikovskiy c04209a794 ACPI: EC: Enable boot EC before bus_scan
Some _STA methods called during bus_scan() might require EC region handler,
which might be enabled later in the scan.
Enable it explicitly before scan to avoid errors.

Reference: http://bugzilla.kernel.org/show_bug.cgi?id=9627

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2008-01-01 14:12:55 -05:00
Len Brown a3f095ade0 Pull bugzilla-9327 into release branch
Conflicts:

	drivers/acpi/ec.c

Signed-off-by: Len Brown <len.brown@intel.com>
2007-11-20 20:07:49 -05:00
Alexey Starikovskiy e790cc8bbb ACPI: EC: Workaround for optimized controllers (version 3)
Some controllers fail to send confirmation GPE after address or data write.
Detect this and don't expect such confirmation in future.
This is a generalization of previous workaround
(66c5f4e736), which did only read address.

Reference: http://bugzilla.kernel.org/show_bug.cgi?id=9327

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Tested-by: Romano Giannetti <romano.giannetti@gmail.com>
Tested-by: Mats Johannesson
Signed-off-by: Len Brown <len.brown@intel.com>
2007-11-20 20:06:15 -05:00
Márton Németh 3ebe08a749 ACPI: EC: use printk_ratelimit(), add some DEBUG mode messages
Sometimes it is usefull to see raw protocol dump.
Uncomment '#define DEBUG' at the beginning of file to make EC
really verbose.

Signed-off-by: Márton Németh <nm127@freemail.hu>
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-11-20 20:04:39 -05:00
Len Brown 0af2f653c5 Revert "ACPI: EC: Workaround for optimized controllers"
This reverts commit f2d68935ba.
2007-11-20 19:59:08 -05:00
Len Brown e6532b8883 Pull fluff into release branch
Conflicts:

	drivers/acpi/ec.c

Signed-off-by: Len Brown <len.brown@intel.com>
2007-11-20 01:21:47 -05:00
Len Brown 22201f7402 Pull bugzilla-9327 into release branch 2007-11-20 01:18:19 -05:00
Joe Perches 4fdb2a05ef ACPI: Add missing spaces to printk format
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-11-19 21:53:32 -05:00
Alexey Starikovskiy 5870a8cd23 ACPI: EC: Don't init EC early if it has no _INI
Option to init EC early inserted to handle #8598 ASUS problem,
introduced several others.

EC driver in this particular case has fake _INI method, not present on
other machines, which don't need or break from this workaround, so lets use
its presence as a flag for early init.

http://bugzilla.kernel.org/show_bug.cgi?id=9262
http://bugzilla.kernel.org/show_bug.cgi?id=8598
https://bugzilla.novell.com/show_bug.cgi?id=334806

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-11-19 12:20:48 -05:00
Alexey Starikovskiy f2d68935ba ACPI: EC: Workaround for optimized controllers
Some controllers fail to send confirmation GPE after address write.
Detect this and don't expect such confirmation in future.
This is a generalization of previous workaround
(66c5f4e736), which did only read address.

http://bugzilla.kernel.org/show_bug.cgi?id=9327

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Tested-by: Romano Giannetti <romano.giannetti@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-11-19 01:05:01 -05:00
Adrian Bunk 1544fdbc85 ACPI: EC: fix use-after-free
This patch fixes a use-after-free introduced by
commit 30c08574da
(ACPI: EC: Add new query handler to list head)

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-10-25 16:38:02 -04:00
Alexey Starikovskiy 95b937e3f5 ACPI: EC: Output changes to operational mode
Insert printk() for every change in operational mode.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-10-25 16:31:31 -04:00
Alexey Starikovskiy 66c5f4e736 ACPI: EC: Add workaround for "optimized" controllers
Some controllers do not send interrupts for OBF=1 event, but send
them for IBF=0. Add workaround for them.

Reference: http://bugzilla.kernel.org/show_bug.cgi?id=8459

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-10-25 16:31:31 -04:00
Alexey Starikovskiy 1c55053c21 ACPI: EC: Don't re-enable GPE for each transaction.
With the auto selection of operation mode, absence of GPEs does not
really degrade performance, so let PM code to handle
enabling/disabling GPEs.
This is a revert of 5d57a6a55e,
which was meant to be temporary.

Reference: http://bugzilla.kernel.org/show_bug.cgi?id=7977

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-10-25 16:31:31 -04:00
Alexey Starikovskiy 7843932ac4 ACPI: EC: auto select interrupt mode
Start in POLL mode, and if we receive confirmation GPE,
switch to INT mode.
If confirmations are not sent, switch back to POLL.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-10-25 16:31:31 -04:00
Alexey Starikovskiy 0c5d31f48e ACPI: EC: Don't expect interrupt after last read
There is no interrupt after last read according to spec, so
don't set bit that we are expecting one.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-10-25 16:31:31 -04:00
Alexey Starikovskiy 080e412cc0 ACPI: EC: Replace atomic variables with bits
Number of flags is about to be increased, so it is better to
put them all into bits.
No functional changes.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-10-25 16:31:31 -04:00
Len Brown 731aa5fd99 Pull bugzilla-8709 into release branch 2007-10-10 00:30:55 -04:00
Alexey Starikovskiy 30c08574da ACPI: EC: Add new query handler to list head.
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-09-27 15:50:22 -04:00
Alexey Starikovskiy 4c61106066 ACPI: EC: Drop ECDT-based boot_ec as soon as we find DSDT-based one.
ASUS notebooks have numerous problems with EC initialization
This patch tries to work around three known issues reported
in bugzilla 8598, 8709 and 8909/8919.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-09-05 19:56:38 -04:00
Alexey Starikovskiy 2d8348b429 ACPI: EC: Check if boot_ec was really found in DSDT
acpi_get_devices() returns success if it did not find any device.
We have to check for this case.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Tested-by: Daniel Ritz <daniel.ritz-ml@swissonline.ch>
Tested-by: Luca <kronos.it@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-30 22:20:13 -07:00
Alexey Starikovskiy f9319f903f ACPI: EC: revert fix for bugzilla 8709
This is a manual revert of 7c010de750,
a fix that broke another ASUS in 8909 and 8919.

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-24 00:30:59 -04:00
Alexey Starikovskiy c019b19330 ACPI: EC: Fix "no battery" regression
Restore deleted call to register query methods.

http://bugzilla.kernel.org/show_bug.cgi?id=8886

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-14 01:03:42 -04:00
Alexey Starikovskiy 199e9e7d11 ACPI EC: remove potential deadlock from EC
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-11 22:26:24 -04:00
Meelis Roos 0a52450998 ACPI: EC: fix run-together printk lines
Signed-off-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-03 22:42:02 -04:00
Adrian Bunk 07ddf768d8 ACPI: EC: acpi_ec_remove(): fix use-after-free
This patch fixes an obvious use-after-free introduced by
commit 837012ede1.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-03 22:28:11 -04:00
Alexey Starikovskiy 7c010de750 ACPI: EC: Switch from boot_ec as soon as we find its desc in DSDT.
Some ASUS laptops fail to use boot time EC
and need to eventually switch to one described in DSDT.

http://bugzilla.kernel.org/show_bug.cgi?id=8709

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-03 17:57:53 -04:00
Len Brown 52fe4bdf40 ACPI: EC: fix build warning
drivers/acpi/ec.c:657: warning: ‘acpi_ec_register_query_methods’ defined but not used

Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-03 17:55:53 -04:00
Alexey Starikovskiy cd8c93a4e0 ACPI: EC: If ECDT is not found, look up EC in DSDT.
Some ASUS laptops access EC space from device _INI methods, but do not
provide ECDT for early EC setup. In order to make them function properly,
there is a need to find EC is DSDT before any _INI is called.

Similar functionality was turned on by acpi_fake_ecdt=1 command line
before. Now it is on all the time.

http://bugzilla.kernel.org/show_bug.cgi?id=8598

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-03 17:52:48 -04:00
Alexey Starikovskiy f1cd1fe61b ACPI: EC: Remove noisy debug printk fron EC driver.
ACPI: EC: Handler for query 0x57 is not found!

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-03 17:28:17 -04:00
Thomas Renninger 1ba90e3a87 ACPI: autoload modules - Create __mod_acpi_device_table symbol for all ACPI drivers
modpost is going to use these to create e.g. acpi:ACPI0001
in modules.alias.

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-07-23 13:56:42 -04:00
Alexey Starikovskiy 837012ede1 ACPI EC: Add support for non-AML EC query handlers
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-06-23 15:55:13 -04:00
Alexey Starikovskiy 4350933a74 ACPI EC: drop usage of ACPI_DEBUG_PRINT as too heavy weight
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-06-23 15:55:06 -04:00
Alexey Starikovskiy 5b7734b440 ACPI EC: Re-factor EC space handler to avoid using label/goto for cycle.
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-06-23 15:54:56 -04:00
Lennart Poettering 00eb43a189 acpi,msi-laptop: Fall back to EC polling mode for MSI laptop specific EC commands
The ACPI EC that is used in MSI laptops knows some non-standard
commands for changing the screen brighntess and a few other things,
which are used by the msi-laptop.c driver. Unfortunately for these
commands no GPE events for IBF and OBF are triggered. Since nowadays
the EC code uses the ec_intr=1 mode by default, this causes these
operations to timeout, although they don't fail. In result, all
operations that you can do with the msi-laptop.c driver take more or
less 1s to complete, which is awfully slow.

In one of the more recent kernels (2.6.20?) the EC subsystem has been
revamped. With that change the EC timeout has been increased. before
that increase the MSI EC accesses were slow -- but not *that* slow,
hence I took notice of this limitation of the MSI EC hardware only very
recently.

The standard EC operations on the MSI EC as defined in the ACPI spec
support GPE events properly.

The following patch adds a new argument "force_poll" to the
ec_transaction() function (and friends). If set to 1, the function
will poll for IBF/OBF even if ec_intr=1 is enabled. If set to 0 the
current behaviour is used. The msi-laptop driver is modified to make
use of this new flag, so that OBF/IBF is polled for the special MSI EC
transactions -- but only for them.

Signed-off-by: Lennart Poettering <mzxreary@0pointer.de>
Acked-by: Alexey Starikovskiy <aystarik@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-05-10 03:52:22 -04:00
Alexey Starikovskiy 9fd9f8e8bd ACPI: EC: Block queries until EC is fully initialized
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:29 -05:00
Alexey Starikovskiy 01f2246269 ACPI: EC: Cleanup of EC initialization
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:29 -05:00
Alexey Starikovskiy d033879c98 ACPI: EC: first_ec is better to be acpi_ec than acpi_device.
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:28 -05:00
Alexey Starikovskiy d66d969df8 ACPI: EC: Rename ec_ecdt to more informative boot_ec
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:28 -05:00
Alexey Starikovskiy c0900c3512 ACPI: EC: Clean ECDT and namespace parsing.
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:28 -05:00
Alexey Starikovskiy e828432104 ACPI: EC: Put install handlers into separate function.
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:28 -05:00
Alexey Starikovskiy 3d02b90be2 ACPI: EC: Remove casts to/from void* from ec.c
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:28 -05:00
Alexey Starikovskiy c45aac43fe ACPI: EC: enable burst functionality in EC.
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:28 -05:00
Alexey Starikovskiy 33c7a0738c ACPI: EC: "Fake ECDT" workaround is not needed any longer.
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:28 -05:00
Alexey Starikovskiy a5f8dee2d3 ACPI: EC: Don't use Global Lock if not asked to do so
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:27:27 -05:00
Alexey Starikovskiy 9e19721960 ACPI: ec: fix race in status register access
Delay the read of the EC status register until
after the event that caused it occurs -- otherwise
it is possible to read and act on stale status that was
associated with the previous event.

Do this with a perpetually incrementing "event_count" to detect
when a new event occurs and it is safe to read status.

There is no workaround for polling mode -- it is inherently
exposed to reading and acting on stale status, since it
doesn't have an interrupt to tell it the event completed.

http://bugzilla.kernel.org/show_bug.cgi?id=8110

Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09 23:16:23 -05:00
Len Brown c0cd79d114 Pull fluff into release branch
Conflicts:

	arch/x86_64/pci/mmconfig.c
	drivers/acpi/bay.c

Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-16 22:10:32 -05:00
Alexey Starikovskiy c24e912b61 ACPI: ec: add unlock in error path
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-16 12:51:53 -05:00
Len Brown 7cda93e008 ACPI: delete extra #defines in /drivers/acpi/ drivers
Cosmetic only.

Except in a single case, #define ACPI_*_DRIVER_NAME
were invoked 0 or 1 times.

Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-12 23:50:52 -05:00
Len Brown c2b6705b75 ACPI: fix acpi_driver.name usage
It was erroneously used as a description rather than a name.

ie. turn this:

lenb@se7525gp2:/sys> ls bus/acpi/drivers
ACPI AC Adapter Driver  ACPI Embedded Controller Driver  ACPI Power Resource Driver
ACPI Battery Driver     ACPI Fan Driver                  ACPI Processor Driver
ACPI Button Driver      ACPI PCI Interrupt Link Driver   ACPI Thermal Zone Driver
ACPI container driver   ACPI PCI Root Bridge Driver      hpet

into this:

lenb@se7525gp2:~> ls /sys/bus/acpi/drivers
ac  battery  button  container  ec  fan  hpet  pci_link  pci_root  power  processor  thermal

Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-12 23:33:40 -05:00
Len Brown f52fd66d2e ACPI: clean up ACPI_MODULE_NAME() use
cosmetic only

Make "module name" actually match the file name.
Invoke with ';' as leaving it off confuses Lindent and gcc doesn't care.
Fix indentation where Lindent did get confused.

Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-12 22:42:12 -05:00
Alexey Starikovskiy 15a58ed121 ACPICA: Remove duplicate table definitions (non-conflicting), cont
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-02 21:14:29 -05:00
Alexey Starikovskiy ad363f80c3 ACPICA: Remove duplicate table definitions.
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-02 21:14:28 -05:00
Alexey Starikovskiy ad71860a17 ACPICA: minimal patch to integrate new tables into Linux
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-02 21:14:22 -05:00
Len Brown 723fe2ca82 ACPI: ec: enable printk on cmdline use
if somebody uses "ec_intr=", lets be sure to
capture that in the dmesg even in the non-debug case.

Signed-off-by: Len Brown <len.brown@intel.com>
2007-01-06 00:02:07 -05:00
Guillaume Chazarain c6e19194b6 ACPI: EC: move verbose printk to debug build only
The recent EC cleanup left a printk enabled on handler evaluation
resulting in a bunch of messages on normal operation, like so:

ACPI: EC: evaluating _Q60

Signed-off-by: Len Brown <len.brown@intel.com>
2007-01-02 00:12:19 -05:00
Burman Yan 36bcbec7ce ACPI: replace kmalloc+memset with kzalloc
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-20 16:54:54 -05:00
Len Brown 706b75ddbe Pull ec into test branch 2006-12-20 02:52:33 -05:00
Adrian Bunk a854e08a5a ACPI: make drivers/acpi/ec.c:ec_ecdt static
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-20 00:44:39 -05:00
Len Brown 463e7c7cf9 Pull trivial into test branch
Conflicts:

	drivers/acpi/ec.c
2006-12-16 00:45:07 -05:00
Alexey Starikovskiy 6ccedb10e3 ACPI: ec: Lindent once again
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:09 -05:00
Alexey Starikovskiy 3261ff4db3 ACPI: ec: Change #define to enums there possible.
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:09 -05:00
Alexey Starikovskiy 78d0af3392 ACPI: ec: Style changes.
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:07 -05:00
Alexey Starikovskiy 523953b41e ACPI: ec: Acquire Global Lock under EC mutex.
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:07 -05:00
Alexey Starikovskiy 50c1e1138c ACPI: ec: Drop udelay() from poll mode. Loop by reading status field instead.
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:07 -05:00
Alexey Starikovskiy a86e277259 ACPI: ec: Rename gpe_bit to gpe
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:07 -05:00
Alexey Starikovskiy c787a8551e ACPI: ec: Change semaphore to mutex.
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:07 -05:00
Alexey Starikovskiy 5d0c288b73 ACPI: ec: Query only single query at a time.
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:06 -05:00
Alexey Starikovskiy e41334c0a6 ACPI: ec: Remove calls to clear_gpe() and enable_gpe(), as these are handled at
dispatch_gpe() level.

Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:06 -05:00
Alexey Starikovskiy af3fd1404f ACPI: ec: Remove expect_event and all races around it.
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:06 -05:00
Alexey Starikovskiy bec5a1e060 ACPI: ec: Read status register from check_status() function
Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:06 -05:00
Alexey Starikovskiy 5c4064124a ACPI: ec: Increase timeout from 50 to 500 ms to handle old slow machines.
http://bugzilla.kernel.org/show_bug.cgi?id=7466

Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:05 -05:00
Alexey Starikovskiy 5d57a6a55e ACPI: ec: Enable EC GPE at beginning of transaction
Temporary measure until resume sequence is right.

Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:05 -05:00
Alexey Starikovskiy d91df1aaa9 ACPI: ec: Allow for write semantics in any command.
Check for transaction attributes, not command index to decide on event to
expect.

Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-08 02:56:04 -05:00
Randy Dunlap 616362de2f ACPI: make ec_transaction not extern
Fix sparse warning:
drivers/acpi/ec.c:372:12: warning: function 'ec_transaction' with external linkage has definition

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-10-27 01:47:34 -04:00
Lennart Poettering ab9e43c640 ACPI: EC: export ec_transaction() for msi-laptop driver
Signed-off-by: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-10-14 00:49:56 -04:00
Denis M. Sadykov 6ffb221a82 ACPI: EC: Simplify acpi_hw_low_level*() with inb()/outb().
Simplify acpi_hw_low_level_xxx() functions to inb() and outb().

Signed-off-by: Alexey Y. Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-10-14 00:49:56 -04:00
Denis M. Sadykov 8e0341ba79 ACPI: EC: Unify poll and interrupt gpe handlers
Signed-off-by: Alexey Y. Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-10-14 00:49:55 -04:00
Denis M. Sadykov 3576cf619b ACPI: EC: Unify poll and interrupt mode transaction functions
Signed-off-by: Alexey Y. Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-10-14 00:49:55 -04:00
Denis M. Sadykov 703959d47e ACPI: EC: Remove unused variables and duplicated code
Signed-off-by: Alexey Y. Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-10-14 00:49:54 -04:00
Denis M. Sadykov 7c6db5e512 ACPI: EC: Remove unnecessary delay added by previous transation patch.
Remove unnecessary delay (50 ms) while reading data from EC in interrupt mode.

Signed-off-by: Alexey Y. Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-10-14 00:49:53 -04:00
Lennart Poettering d7a76e4cb3 ACPI: consolidate functions in acpi ec driver
Unify the following functions:

    acpi_ec_poll_read()
    acpi_ec_poll_write()
    acpi_ec_poll_query()
    acpi_ec_intr_read()
    acpi_ec_intr_write()
    acpi_ec_intr_query()

into:

    acpi_ec_poll_transaction()
    acpi_ec_intr_transaction()

These new functions take as arguments an ACPI EC command, a few bytes
to write to the EC data register and a buffer for a few bytes to read
from the EC data register. The old _read(), _write(), _query() are
just special cases of these functions.

Then unified the code in acpi_ec_poll_transaction() and
acpi_ec_intr_transaction() a little more. Both functions are now just
wrappers around the new acpi_ec_transaction_unlocked() function. The
latter contains the EC access logic, the two original
function now just do their special way of locking and call the the
new function for the actual work.

This saves a lot of very similar code. The primary reason for doing
this, however, is that my driver for MSI 270 laptops needs to issue
some non-standard EC commands in a safe way. Due to this I added a new
exported function similar to ec_write()/ec_write() which is called
ec_transaction() and is essentially just a wrapper around
acpi_ec_{poll,intr}_transaction().

Signed-off-by: Lennart Poettering <mzxreary@0pointer.de>
Acked-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-10-14 00:49:52 -04:00
Arjan van de Ven d75080328a ACPI: add 'const' to several ACPI file_operations
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-07-10 00:04:29 -04:00
Vladimir Lebedev 49fee981fa ACPI: fix battery on HP NX6125
EC problem was cause of both battery and AC issues.
http://bugzilla.kernel.org/show_bug.cgi?id=6455

Signed-off-by: Len Brown <len.brown@intel.com>
2006-06-28 12:44:45 -04:00
Patrick Mochel d550d98d33 ACPI: delete tracing macros from drivers/acpi/*.c
Signed-off-by: Len Brown <len.brown@intel.com>
2006-06-27 00:41:40 -04:00
Len Brown 6468463abd ACPI: un-export ACPI_ERROR() -- use printk(KERN_ERR...)
Signed-off-by: Len Brown <len.brown@intel.com>
2006-06-27 00:01:06 -04:00
Thomas Renninger a6fc67202e ACPI: Enable ACPI error messages w/o CONFIG_ACPI_DEBUG
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-06-26 23:58:43 -04:00
Len Brown 5b542e4422 Pull bugzilla-5764 into release branch 2006-06-15 21:34:21 -04:00
Len Brown 60e04a5c53 Pull ec into release branch 2006-06-15 15:35:37 -04:00
Len Brown b3899c6613 Pull acpica into release branch 2006-06-15 15:19:48 -04:00
Alexey Starikovskiy b8d35192c5 ACPI: execute Notify() handlers on new thread
http://bugzilla.kernel.org/show_bug.cgi?id=5534

Thanks to Peter Wainwright for isolating the issue.
Thanks to Andi Kleen and Bob Moore for feedback.
Thanks to Richard Mace and others for testing.
Updates by Konstantin Karasyov.

Signed-off-by: Konstantin Karasyov <konstantin.a.karasyov@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-06-14 02:43:23 -04:00
Rich Townsend f9a6ee1afb ACPI: replace spin_lock_irq with mutex for ec poll mode
http://bugzilla.kernel.org/show_bug.cgi?id=5764

Signed-off-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-05-19 00:49:52 -04:00
Jiri Slaby ff2fc3e9e3 ACPI: EC acpi-ecdt-uid-hack
On some boxes ecdt uid may be equal to 0, so do not test for uids equality,
so that fake handler will be unconditionally removed to allow loading the
real one.

See http://bugzilla.kernel.org/show_bug.cgi?id=6111

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Luming Yu <luming.yu@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-01 22:33:06 -05:00
OGAWA Hirofumi 9b41046cd0 [PATCH] Don't pass boot parameters to argv_init[]
The boot cmdline is parsed in parse_early_param() and
parse_args(,unknown_bootoption).

And __setup() is used in obsolete_checksetup().

	start_kernel()
		-> parse_args()
			-> unknown_bootoption()
				-> obsolete_checksetup()

If __setup()'s callback (->setup_func()) returns 1 in
obsolete_checksetup(), obsolete_checksetup() thinks a parameter was
handled.

If ->setup_func() returns 0, obsolete_checksetup() tries other
->setup_func().  If all ->setup_func() that matched a parameter returns 0,
a parameter is seted to argv_init[].

Then, when runing /sbin/init or init=app, argv_init[] is passed to the app.
If the app doesn't ignore those arguments, it will warning and exit.

This patch fixes a wrong usage of it, however fixes obvious one only.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-31 12:18:53 -08:00
Len Brown 9fdb62af92 [ACPI] merge 3549 4320 4485 4588 4980 5483 5651 acpica asus fops pnpacpi branches into release
Signed-off-by: Len Brown <len.brown@intel.com>
2006-01-24 17:52:48 -05:00
Arjan van de Ven 858119e159 [PATCH] Unlinline a bunch of other functions
Remove the "inline" keyword from a bunch of big functions in the kernel with
the goal of shrinking it by 30kb to 40kb

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-14 18:27:06 -08:00
Bob Moore 50eca3eb89 [ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code -
specifically, optimizations in the area of the AML/internal
resource conversion code. The code has been optimized to
simplify and eliminate duplicated code, CPU stack use has
been decreased by optimizing function parameters and local
variables, and naming conventions across the manager have
been standardized for clarity and ease of maintenance (this
includes function, parameter, variable, and struct/typedef
names.)

All Resource Manager dispatch and information tables have
been moved to a single location for clarity and ease of
maintenance. One new file was created, named "rsinfo.c".

The ACPI return macros (return_ACPI_STATUS, etc.) have
been modified to guarantee that the argument is
not evaluated twice, making them less prone to macro
side-effects. However, since there exists the possibility
of additional stack use if a particular compiler cannot
optimize them (such as in the debug generation case),
the original macros are optionally available.  Note that
some invocations of the return_VALUE macro may now cause
size mismatch warnings; the return_UINT8 and return_UINT32
macros are provided to eliminate these. (From Randy Dunlap)

Implemented a new mechanism to enable debug tracing for
individual control methods. A new external interface,
acpi_debug_trace(), is provided to enable this mechanism. The
intent is to allow the host OS to easily enable and disable
tracing for problematic control methods. This interface
can be easily exposed to a user or debugger interface if
desired. See the file psxface.c for details.

acpi_ut_callocate() will now return a valid pointer if a
length of zero is specified - a length of one is used
and a warning is issued. This matches the behavior of
acpi_ut_allocate().

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-12-10 00:20:25 -05:00
Len Brown 1e8df53c92 [ACPI] Embedded Controller (EC) driver printk syntax update
no functional changes

Signed-off-by: Len Brown <len.brown@intel.com>
2005-12-05 16:48:54 -05:00
Len Brown 53f11d4ff8 [ACPI] Enable Embedded Controller (EC) interrupt mode by default
"ec_intr=0" reverts to polling
"ec_burst=" no longer exists.

Signed-off-by: Len Brown <len.brown@intel.com>
Acked-by: Luming Yu <luming.yu@intel.com>
2005-12-05 16:47:30 -05:00
Len Brown 02b28a33aa [ACPI] Embedded Controller (EC) driver syntax update
"intr" largely replaces "burst" for syntax to follow semantics
"poll" largely replaces "polling" for economy of expression
append "interrupt mode" or "polling mode" to dmesg line

no functional changes

Signed-off-by: Len Brown <len.brown@intel.com>
2005-12-05 16:37:16 -05:00
Luming Yu 06a2a3855e [ACPI] Disable EC burst mode w/o disabling EC interrupts
Need to de-couple the concept of polling/interrupts
vs burst/non-burst.

http://bugzilla.kernel.org/show_bug.cgi?id=4980

Signed-off-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-12-01 21:00:53 -05:00
Len Brown eca008c813 [ACPI] handle ACPICA 20050916's acpi_resource.type rename
Signed-off-by: Len Brown <len.brown@intel.com>
2005-09-22 00:28:05 -04:00
Len Brown 50526df605 [ACPI] Lindent drivers/acpi/ec.c
necessary for clean merge from acpi-2.6.12 to-akpm

Signed-off-by: Len Brown <len.brown@intel.com>
2005-08-11 17:33:10 -04:00
Luming Yu 716e084edb [ACPI] Fix "ec_burst=1" mode latency issue
http://bugzilla.kernel.org/show_bug.cgi?id=3851

Signed-off-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-08-11 17:30:51 -04:00
Luming Yu 7b15f5e7bb [ACPI] revert Embedded Controller to polling-mode by default (ala 2.6.12)
Burst mode isn't ready for prime time,
but can be enabled for test via "ec_burst=1"

Signed-off-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-08-03 17:40:43 -04:00
Luming Yu 45bea1555f [ACPI] Add "ec_polling" boot option
EC burst mode benefits many machines, some of
them significantly.  However, our current
implementation fails on some machines such
as Rafael's Asus L5D.

This patch restores the alternative EC polling code,
which can be enabled at boot time via "ec_polling"

http://bugzilla.kernel.org/show_bug.cgi?id=4665

Signed-off-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-07-29 18:15:25 -04:00
Luming Yu 668d74c04c ACPI: delete unnecessary EC console messages
http://bugzilla.kernel.org/show_bug.cgi?id=4534

Signed-off-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-07-23 00:26:33 -04:00
Luming Yu 17e9c78a75 [ACPI] EC GPE-disabled issue
http://bugzilla.kernel.org/show_bug.cgi?id=3851

Signed-off-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-07-12 00:12:53 -04:00
Andrew Morton 83ea744522 [ACPI] fix build warning
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-07-11 23:56:57 -04:00
Luming Yu fa9cd547e0 [ACPI] fix EC access width
http://bugzilla.kernel.org/show_bug.cgi?id=4346

Written-by: David Shaohua Li and Luming Yu
Signed-off-by: Len Brown <len.brown@intel.com>
2005-07-11 23:53:38 -04:00
Dmitry Torokhov 451566f45a [ACPI] Enable EC Burst Mode
Fixes several Embedded Controller issues, including
button failure and battery status AE_TIME failure.

http://bugzilla.kernel.org/show_bug.cgi?id=3851

Based on patch by: Andi Kleen <ak@suse.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Luming Yu <luming.yu@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2005-07-11 23:52:48 -04:00
Linus Torvalds 1da177e4c3 Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
2005-04-16 15:20:36 -07:00