aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ec.c
Commit message (Collapse)AuthorAgeFilesLines
* ACPI: Avoid bogus EC timeout when EC is in Polling modeZhao Yakui2008-08-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When EC is in Polling mode, OS will check the EC status continually by using the following source code: clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); while (time_before(jiffies, delay)) { if (acpi_ec_check_status(ec, event)) return 0; msleep(1); } But msleep is realized by the function of schedule_timeout. At the same time although one process is already waken up by some events, it won't be scheduled immediately. So maybe there exists the following phenomena: a. The current jiffies is already after the predefined jiffies. But before timeout happens, OS has no chance to check the EC status again. b. If preemptible schedule is enabled, maybe preempt schedule will happen before checking loop. When the process is resumed again, maybe timeout already happens, which means that OS has no chance to check the EC status. In such case maybe EC status is already what OS expects when timeout happens. But OS has no chance to check the EC status and regards it as AE_TIME. So it will be more appropriate that OS will try to check the EC status again when timeout happens. If the EC status is what we expect, it won't be regarded as timeout. Only when the EC status is not what we expect, it will be regarded as timeout, which means that EC controller can't give a response in time. http://bugzilla.kernel.org/show_bug.cgi?id=9823 http://bugzilla.kernel.org/show_bug.cgi?id=11141 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
* ACPI : Add the EC dmi table to fix the incorrect ECDT tableZhao Yakui2008-08-151-0/+34
| | | | | | | | | | | | | | | | | | | | On some ASUS laptops the ECDT gives the incorrect command/status & Data I/O register address. AK: it seems like the command/data addresses are exchanged. In such case it will cause that EC device can't be initialized correctly. To add the EC dmi table is to fix this issue. If the laptop falls into the EC dmi table, the EC command/data I/O address will be fixed. AK: Add comments describing this better http://bugzilla.kernel.org/show_bug.cgi?id=9399 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> tested-by : Jan Kasprzak <kas@fi.muni.cz> Signed-off-by: Andi Kleen <ak@linux.intel.com>
* ACPI: EC: Use msleep instead of udelay while waiting for event.Alexey Starikovskiy2008-06-111-1/+1
| | | | | | | http://bugzilla.kernel.org/show_bug.cgi?id=10724 Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
* Merge branch 'release' of ↵Linus Torvalds2008-04-301-116/+124
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (179 commits) ACPI: Fix acpi_processor_idle and idle= boot parameters interaction acpi: fix section mismatch warning in pnpacpi intel_menlo: fix build warning ACPI: Cleanup: Remove unneeded, multiple local dummy variables ACPI: video - fix permissions on some proc entries ACPI: video - properly handle errors when registering proc elements ACPI: video - do not store invalid entries in attached_array list ACPI: re-name acpi_pm_ops to acpi_suspend_ops ACER_WMI/ASUS_LAPTOP: fix build bug thinkpad_acpi: fix possible NULL pointer dereference if kstrdup failed ACPI: check a return value correctly in acpi_power_get_context() #if 0 acpi/bay.c:eject_removable_drive() eeepc-laptop: add hwmon fan control eeepc-laptop: add backlight eeepc-laptop: add base driver ACPI: thinkpad-acpi: bump up version to 0.20 ACPI: thinkpad-acpi: fix selects in Kconfig ACPI: thinkpad-acpi: use a private workqueue ACPI: thinkpad-acpi: fluff really minor fix ACPI: thinkpad-acpi: use uppercase for "LED" on user documentation ... Fixed conflicts in drivers/acpi/video.c and drivers/misc/intel_menlow.c manually.
| * ACPI: EC: Don't delete boot ECAlexey Starikovskiy2008-03-241-24/+19
| | | | | | | | | | Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
| * ACPI: EC: Use default setup handlerAlexey Starikovskiy2008-03-241-15/+1
| | | | | | | | | | Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
| * ACPI: EC: Detect irq stormAlexey Starikovskiy2008-03-241-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Problem seems to be that hw fails to clear GPE after we service it and write 1 into corresponding bit. Thus, as soon as we get interrupts enabled again, we receive a new one. Google gives too many results for "acer interrupt storm" for this being one-broken-machine case. Reference: 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>
| * ACPI: EC: Switch off GPE mode during suspend/resumeAlexey Starikovskiy2008-03-241-22/+38
| | | | | | | | | | Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
| * ACPI: EC: Replace broken controller workarounds with poll mode.Alexey Starikovskiy2008-03-241-49/+12
| | | | | | | | | | Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
| * ACPI: EC: Improve debug outputAlexey Starikovskiy2008-03-241-4/+4
| | | | | | | | | | Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
| * ACPI: EC: Add poll timerAlexey Starikovskiy2008-03-241-4/+39
| | | | | | | | | | | | | | | | 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>
| * ACPI: EC: Restore udelay in poll modeAlexey Starikovskiy2008-03-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | This fixes keyboard event handling on some systems. Note that this delay was thought unnecessary, and removed from linux-2.6.20 with 50c1e1138cb94f6aca0f8555777edbcefe0324e2 '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>
* | acpi: use non-racy method for proc entries creationDenis V. Lunev2008-04-291-8/+3
|/ | | | | | | | | | | | | | Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data be setup before gluing PDE to main tree. Add correct ->owner to proc_fops to fix reading/module unloading race. Signed-off-by: Denis V. Lunev <den@openvz.org> Cc: Len Brown <lenb@kernel.org> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Revert "ACPI: EC: Handle IRQ storm on Acer laptops"Alexey Starikovskiy2008-03-181-11/+0
| | | | | | | | | | | This reverts commit 2c81ce4c9c37b910210f2640c28e98a0c398dc26. 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>
*-. Merge branches 'release', 'bugzilla-8570', 'bugzilla-9966', 'bugzilla-9998', ↵Len Brown2008-03-131-5/+12
|\ \ | | | | | | | | | 'bugzilla-10100', 'bugzilla-10132', 'bugzilla-10138' and 'bugzilla-10206' into release
| | * Revert "ACPI: EC: Use proper handle for boot EC"Len Brown2008-03-111-5/+1
| |/ |/| | | | | | | | | | | | | This reverts commit 208c70a45624400fafd7511b96bc426bf01f8f5e. http://bugzilla.kernel.org/show_bug.cgi?id=10100 Signed-off-by: Len Brown <len.brown@intel.com>
| * ACPI: EC: Handle IRQ storm on Acer laptopsAlexey Starikovskiy2008-03-111-0/+11
|/ | | | | | | | | | | | | | | 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>
* ACPI: EC: Use proper handle for boot ECAlexey Starikovskiy2008-02-141-1/+5
| | | | | | | | | | | | | 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>
*---. Merge branches 'release', 'bugzilla-6217', 'bugzilla-6629', 'bugzilla-6933', ↵Len Brown2008-02-071-4/+15
|\ \ \ | | | | | | | | | | | | 'bugzilla-7186', 'bugzilla-8269', 'bugzilla-8570', 'bugzilla-9139', 'bugzilla-9277', 'bugzilla-9341', 'bugzilla-9444', 'bugzilla-9614', 'bugzilla-9643' and 'bugzilla-9644' into release
| | | * ACPI: EC: Some hardware requires burst mode to operate properlyAlexey Starikovskiy2008-01-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | * ACPI: EC: Do the byte access with a fast pathAlexey Starikovskiy2008-01-101-4/+11
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | ACPI: EC: "DEBUG" needs to be defined earlierMárton Németh2008-01-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | ACPI: EC: add leading zeros to debug messagesMárton Németh2008-01-231-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | ACPI: EC: fix dmesg spam regressionAlexey Starikovskiy2008-01-231-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | ACPI: EC: Enable boot EC before bus_scanAlexey Starikovskiy2008-01-011-1/+13
| |/ |/| | | | | | | | | | | | | | | | | | | 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>
* | Pull bugzilla-9327 into release branchLen Brown2007-11-201-19/+42
|\ \ | | | | | | | | | | | | | | | | | | | | | Conflicts: drivers/acpi/ec.c Signed-off-by: Len Brown <len.brown@intel.com>
| * | ACPI: EC: Workaround for optimized controllers (version 3)Alexey Starikovskiy2007-11-201-13/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 (66c5f4e7367b0085652931b2f3366de29e7ff5ec), 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>
| * | ACPI: EC: use printk_ratelimit(), add some DEBUG mode messagesMárton Németh2007-11-201-19/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Revert "ACPI: EC: Workaround for optimized controllers"Len Brown2007-11-201-22/+13
| | | | | | | | | | | | This reverts commit f2d68935ba08cf80f151bbdb5628381184e4a498.
* | | Pull fluff into release branchLen Brown2007-11-201-2/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: drivers/acpi/ec.c Signed-off-by: Len Brown <len.brown@intel.com>
| * | | ACPI: Add missing spaces to printk formatJoe Perches2007-11-191-2/+2
| | |/ | |/| | | | | | | | | | Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Len Brown <len.brown@intel.com>
* | | Pull bugzilla-9327 into release branchLen Brown2007-11-201-13/+22
|\ \ \ | | |/ | |/|
| * | ACPI: EC: Workaround for optimized controllersAlexey Starikovskiy2007-11-191-13/+22
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 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 (66c5f4e7367b0085652931b2f3366de29e7ff5ec), 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>
* | ACPI: EC: Don't init EC early if it has no _INIAlexey Starikovskiy2007-11-191-0/+8
|/ | | | | | | | | | | | | | | | 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>
* ACPI: EC: fix use-after-freeAdrian Bunk2007-10-251-2/+2
| | | | | | | | | | | | This patch fixes a use-after-free introduced by commit 30c08574da0ead1a47797ce028218ce5b2de61c7 (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>
* ACPI: EC: Output changes to operational modeAlexey Starikovskiy2007-10-251-3/+14
| | | | | | | | 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>
* ACPI: EC: Add workaround for "optimized" controllersAlexey Starikovskiy2007-10-251-1/+9
| | | | | | | | | | 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>
* ACPI: EC: Don't re-enable GPE for each transaction.Alexey Starikovskiy2007-10-251-5/+0
| | | | | | | | | | | | | | 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 5d57a6a55ec0bdcb952dbcd3f8ffcde8a3ee9413, 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>
* ACPI: EC: auto select interrupt modeAlexey Starikovskiy2007-10-251-35/+16
| | | | | | | | | 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>
* ACPI: EC: Don't expect interrupt after last readAlexey Starikovskiy2007-10-251-1/+3
| | | | | | | | 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>
* ACPI: EC: Replace atomic variables with bitsAlexey Starikovskiy2007-10-251-41/+38
| | | | | | | | | | 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>
* Pull bugzilla-8709 into release branchLen Brown2007-10-101-51/+39
|\
| * ACPI: EC: Drop ECDT-based boot_ec as soon as we find DSDT-based one.Alexey Starikovskiy2007-09-051-51/+39
| | | | | | | | | | | | | | | | | | 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>
* | ACPI: EC: Add new query handler to list head.Alexey Starikovskiy2007-09-271-2/+1
|/ | | | | Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
* ACPI: EC: Check if boot_ec was really found in DSDTAlexey Starikovskiy2007-08-301-1/+2
| | | | | | | | | | 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>
* ACPI: EC: revert fix for bugzilla 8709Alexey Starikovskiy2007-08-241-16/+31
| | | | | | | | This is a manual revert of 7c010de7506954e973abfab5c5999c5a97f7a73e, 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>
* ACPI: EC: Fix "no battery" regressionAlexey Starikovskiy2007-08-141-0/+17
| | | | | | | | | 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>
* ACPI EC: remove potential deadlock from ECAlexey Starikovskiy2007-08-111-2/+0
| | | | | | 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>
* ACPI: EC: fix run-together printk linesMeelis Roos2007-08-031-1/+1
| | | | | Signed-off-by: Meelis Roos <mroos@linux.ee> Signed-off-by: Len Brown <len.brown@intel.com>
* ACPI: EC: acpi_ec_remove(): fix use-after-freeAdrian Bunk2007-08-031-2/+2
| | | | | | | | | | | This patch fixes an obvious use-after-free introduced by commit 837012ede14a8fc088be3682c964da7fc6af026b. 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>