aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/battery.c
AgeCommit message (Collapse)AuthorFilesLines
2008-11-11Merge branch 'sysfs' into releaseLen Brown1-1/+1
2008-11-07ACPI: consolidate ACPI_*_COMPONENT definitions in acpi_drivers.hBjorn Helgaas1-1/+0
Move all the component definitions for drivers to a single shared place, include/acpi/acpi_drivers.h. Signed-off-by: Bjorn Helgaas <[email protected]> Signed-off-by: Len Brown <[email protected]>
2008-11-06ACPI: struct device - replace bus_id with dev_name(), dev_set_name()Kay Sievers1-1/+1
This patch is part of a larger patch series which will remove the "char bus_id[20]" name string from struct device. The device name is managed in the kobject anyway, and without any size limitation, and just needlessly copied into "struct device". To set and read the device name dev_name(dev) and dev_set_name(dev) must be used. If your code uses static kobjects, which it shouldn't do, "const char *init_name" can be used to statically provide the name the registered device should have. At registration time, the init_name field is cleared, to enforce the use of dev_name(dev) to access the device name at a later time. We need to get rid of all occurrences of bus_id in the entire tree to be able to enable the new interface. Please apply this patch, and possibly convert any remaining remaining occurrences of bus_id. We want to submit a patch to -next, which will remove bus_id from "struct device", to find the remaining pieces to convert, and finally switch over to the new api, which will remove the 20 bytes array and does no longer have a size limitation. Acked-by: Greg Kroah-Hartman <[email protected]> Signed-Off-By: Kay Sievers <[email protected]> Signed-off-by: Len Brown <[email protected]>
2008-10-23Merge branch 'linus' into testLen Brown1-1/+1
Conflicts: MAINTAINERS arch/x86/kernel/acpi/boot.c arch/x86/kernel/acpi/sleep.c drivers/acpi/Kconfig drivers/pnp/Makefile drivers/pnp/quirks.c Signed-off-by: Len Brown <[email protected]>
2008-10-20x86: sysfs: kill owner field from attributeParag Warudkar1-1/+1
Tejun's commit 7b595756ec1f49e0049a9e01a1298d53a7faaa15 made sysfs attribute->owner unnecessary. But the field was left in the structure to ease the merge. It's been over a year since that change and it is now time to start killing attribute->owner along with its users - one arch at a time! This patch is attempt #1 to get rid of attribute->owner only for CONFIG_X86_64 or CONFIG_X86_32 . We will deal with other arches later on as and when possible - avr32 will be the next since that is something I can test. Compile (make allyesconfig / make allmodconfig / custom config) and boot tested. akpm: the idea is that we put the declaration of sttribute.owner inside `#ifndef CONFIG_X86'. But that proved to be too ambitious for now because new usages kept on turning up in subsystem trees. [akpm: remove the ifdef for now] Signed-off-by: Parag Warudkar <[email protected]> Cc: Greg KH <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Len Brown <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Roland Dreier <[email protected]> Cc: David Brownell <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-10-10ACPI: catch calls of acpi_driver_data on pointer of wrong typePavel Machek1-1/+1
Catch attempts to use of acpi_driver_data on pointers of wrong type. akpm: rewritten to use proper C typechecking and remove the "function"-used-as-lvalue thing. Signed-off-by: Pavel Machek <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Len Brown <[email protected]>
2008-04-29acpi: use non-racy method for proc entries creationDenis V. Lunev1-7/+5
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 <[email protected]> Cc: Len Brown <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2008-03-17ACPI: battery: Don't return -EFAIL on broken packages.Alexey Starikovskiy1-6/+5
Acer BIOS has a bug which is exposed when a dead battery is present. The package template that is used to describe battery status is over-written with sane values when the battery is live. But when the batter is dead, a bogus reference in the template is used. In this case, Linux returns a fault, when instead it should simply return that it doesn't know the missing value. http://bugzilla.kernel.org/show_bug.cgi?id=8573 http://bugzilla.kernel.org/show_bug.cgi?id=10202 Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2008-02-05ACPI: battery: add sysfs serial numbermaximilian attems1-0/+5
egrep serial /proc/acpi/battery/BAT0/info serial number: 32090 serial number can tell you from the imminent danger of beeing set on fire. Signed-off-by: maximilian attems <[email protected]> Acked-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2008-01-01ACPI: Make sysfs interface in ACPI power optional.Alexey Starikovskiy1-6/+25
Reference: http://bugzilla.kernel.org/show_bug.cgi?id=9494 Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-12-06ACPI: battery: fix ACPI battery technology reportingAndrey Borzenkov1-1/+1
At least some systems report technology information with trailing spaces: {pts/1}% cat -E /var/tmp/bat/2.6.23 | grep type battery type: Li-ION $ Use strncasecmp to compare model string to skip trailing part Signed-off-by: Andrey Borzenkov <[email protected]> Acked-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-11-20Pull procfs-default into release branchLen Brown1-10/+10
Conflicts: drivers/acpi/sbs.c Signed-off-by: Len Brown <[email protected]>
2007-11-20Pull battery into release branchLen Brown1-0/+2
2007-11-19ACPI: Split out control for /proc/acpi entries from battery, ac, and sbs.Alexey Starikovskiy1-10/+10
Introduce new ACPI_PROCFS_POWER (default Yes) config option and move procfs code in battery, ac, and sbs drivers under it. This is done to allow ACPI_PROCFS to be default No. Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-11-13ACPI: Battery: remove cycle from battery removal.Alexey Starikovskiy1-4/+6
get_property() should not call battery_update(), it also should call get_status() only if battery is present to avoid cycle and oops. Signed-off-by: Alexey Starikovskiy <[email protected]> Tested-by: Rolf Eike Beer <[email protected]> Acked-by: Johannes Weiner <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2007-11-08ACPI: Always return valid 'status' from acpi_battery_get_property()Roland Dreier1-0/+2
If a battery is at a critical charge level and not being charged or discharged, then the ACPI _BST method will return a state of 4, and the current acpi_battery_get_property() code will not set any property value for POWER_SUPPLY_PROP_STATUS. This will cause an oops in power_supply_show_property() when it reads off the end of the status_text array. This actually was causing a 100% reproducible crash on boot on my laptop with two batteries, when one battery was completely drained and the laptop was not plugged in. Fix this by making sure acpi_battery_get_property() returns POWER_SUPPLY_STATUS_UNKNOWN for any battery state it doesn't already handle explicitly. There doesn't seem to be any status enum value defined that makes more sense than 'unknown' for a battery at a critical charge level. Signed-off-by: Roland Dreier <[email protected]> Acked-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <lenb@t61.(none)>
2007-10-29ACPI: Battery: Allow extract string from integerAlexey Starikovskiy1-10/+15
Some machines return integer instead of expected string. Signed-off-by: Alexey Starikovskiy <[email protected]> Tested-by: Andrey Borzenkov <[email protected]> Tested-by: Frans Pop <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-10-29ACPI: battery: Support for non-spec name for LiIon technologyAlexey Starikovskiy1-0/+2
Support Li-Ion as possible name for technology. Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-10-29ACPI: battery: register power_supply subdevice only when battery is presentAndrey Borzenkov1-55/+75
Make sure no power_supply object is present unless we actualy detect presence of battery. This fixes ghost batteries detected by HAL Signed-off-by: Andrey Borzenkov <[email protected]> Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-10-25ACPI: battery: Update battery information upon sysfs read.Alexey Starikovskiy1-0/+3
Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-10-25ACPI: battery: remove dead codeAdrian Bunk1-4/+0
After commit f1d4661abe05d0a2c014166042d15ed8b69ae8f2 this was dead code. Spotted by the Coverity checker. Signed-off-by: Adrian Bunk <[email protected]> Acked-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-09-27ACPI: Battery: add sysfs alarmAlexey Starikovskiy1-1/+32
Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-09-27ACPI: Battery: Add sysfs supportAlexey Starikovskiy1-22/+164
Refer to Documentation/power_supply_class.txt for interface description. Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-09-27ACPI: Battery: Misc clean-ups, no functional changesAlexey Starikovskiy1-217/+125
Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-09-27ACPI: Battery: simplify update schemeAlexey Starikovskiy1-223/+57
Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-09-27ACPI: Battery: don't use acpi_extract_package()Alexey Starikovskiy1-220/+139
acpi_extract_package() creates more problems with memory management than it solves as helper for package handling. Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-08-25Pull events into release branchLen Brown1-1/+4
Conflicts: drivers/acpi/video.c Signed-off-by: Len Brown <[email protected]>
2007-08-23ACPI: Schedule /proc/acpi/event for removalLen Brown1-1/+1
Schedule /proc/acpi/event for removal in 6 months. Re-name acpi_bus_generate_event() to acpi_bus_generate_proc_event() to make sure there is no confusion that it is for /proc/acpi/event only. Add CONFIG_ACPI_PROC_EVENT to allow removal of /proc/acpi/event. There is no functional change if CONFIG_ACPI_PROC_EVENT=y Signed-off-by: Len Brown <[email protected]>
2007-08-23ACPI: don't duplicate input events on netlinkZhang Rui1-0/+3
The previous events patch added a netlink event for every user of the legacy /proc/acpi/event interface. However, some users of /proc/acpi/event are really input events, and they already report their events via the input layer. Introduce a new interface, acpi_bus_generate_netlink_event(), which is explicitly called by devices that want to repoprt events via netlink. This allows the input-like events to opt-out of generating netlink events. In summary: events that are sent via netlink: ac/battery/sbs thermal processor thinkpad_acpi dock/bay events that are sent via input layer: button video hotkey thinkpad_acpi hotkey asus_acpi/asus-laptop hotkey sonypi/sonylaptop Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-08-15Revert "ACPI: Battery: Synchronize battery operations."Len Brown1-17/+30
This reverts commit 3bd92ba19a89fe61ebf58804f9c8675372f50c1c. It is no longer necessary, and it opens up a race. Acked-by: Vladimir Lebedev <[email protected]> Acked-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-08-03ACPI: Battery: Synchronize battery operations.Alexey Starikovskiy1-30/+17
http://bugzilla.kernel.org/show_bug.cgi?id=8768 Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-07-23ACPI: autoload modules - Create __mod_acpi_device_table symbol for all ACPI ↵Thomas Renninger1-2/+7
drivers modpost is going to use these to create e.g. acpi:ACPI0001 in modules.alias. Signed-off-by: Thomas Renninger <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-05-11ACPI: battery: syntax cleanupAlexey Starikovskiy1-246/+172
In response to review comments from Andrew Morton Signed-off-by: Alexey Starikovskiy <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-04-21process reading battery status hangsVladimir Lebedev1-2/+0
http://bugzilla.kernel.org/show_bug.cgi?id=8351 Signed-off-by: Vladimir Lebedev <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-03-07ACPI: battery: LindentVladimir Lebedev1-13/+23
Signed-off-by: Vladimir Lebedev <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-03-07ACPI: Cache battery status instead of re-evaluating AMLVladimir Lebedev1-172/+441
/proc exports _BST in a single file, and _BST is re-evaulated whenever that file is read. Sometimes user-space reads this file frequently, and on some systems _BST takes a long time to evaluate due to a slow EC. Further, when we move to sysfs, the values returned from _BST will be in multiple files, and evaluating _BST for each file read would make matters worse. Here code is added to support caching the results of _BST. A new module parameter "update_time" tells how many seconds the cached _BST should be used before it is re-evaluated. Currently, update_time defaults to 0, and so the existing behaviour of re-evaluating on each read retained. Signed-off-by: Vladimir Lebedev <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-03-07ACPI: battery: make internal names consistent with battery "state"Vladimir Lebedev1-9/+9
Cleanup -- No functional changes. Battery state is currently exported in a proc "state" file. Update associated #defines and routines to be consistent. Signed-off-by: Vladimir Lebedev <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-02-16Pull bugzilla-7200 into release branchLen Brown1-0/+15
2007-02-12ACPI: delete extra #defines in /drivers/acpi/ driversLen Brown1-2/+1
Cosmetic only. Except in a single case, #define ACPI_*_DRIVER_NAME were invoked 0 or 1 times. Signed-off-by: Len Brown <[email protected]>
2007-02-12ACPI: fix acpi_driver.name usageLen Brown1-1/+1
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 <[email protected]>
2007-02-12ACPI: clean up ACPI_MODULE_NAME() useLen Brown1-2/+2
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 <[email protected]>
2007-02-10ACPI: battery: check for battery present on /proc/battery accessVladimir Lebedev1-0/+15
http://bugzilla.kernel.org/show_bug.cgi?id=7200 Signed-off-by: Vladimir Lebedev <[email protected]> Signed-off-by: Len Brown <[email protected]>
2007-02-03Pull sysfs into test branchLen Brown1-2/+2
Conflicts: Documentation/feature-removal-schedule.txt include/acpi/acpi_drivers.h Signed-off-by: Len Brown <[email protected]>
2006-12-20ACPI: replace kmalloc+memset with kzallocBurman Yan1-6/+3
Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Len Brown <[email protected]>
2006-12-16Pull style into test branchLen Brown1-11/+11
Conflicts: drivers/acpi/button.c drivers/acpi/ec.c drivers/acpi/osl.c drivers/acpi/sbs.c
2006-12-15ACPI: add ACPI bus_type for driver modelPatrick Mochel1-2/+2
Add ACPI bus_type for Linux driver model. 1. .shutdown method is added into acpi_driver.ops needed by bus_type operations. 2. remove useless parameter 'int state' in .resume method. 3. change parameter 'int state' to 'pm_message_t state' in .suspend method. Note: The new .uevent method mark ACPI drivers by PNPID instead of by name. Udev script needs to look for "HWID=" or "COMPTID=" to load ACPI drivers as a result. Signed-off-by: Li Shaohua <[email protected]> Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Len Brown <[email protected]>
2006-10-14ACPI: check battery status on resume for un/plug events during sleepJiri Kosina1-0/+14
Add ->resume method to the ACPI battery handler to check if the battery state has changed during sleep. If yes, update the ACPI internal data structures for benefit of /proc/acpi/battery/. Signed-off-by: Jiri Kosina <[email protected]> Cc: Stefan Seyfried <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Len Brown <[email protected]>
2006-10-14ACPI: Remove unnecessary from/to-void* and to-void casts in drivers/acpiJan Engelhardt1-11/+11
Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Len Brown <[email protected]>
2006-08-15ACPI: fix boot with acpi=offPavel Machek1-0/+3
Fix acpi_ac/battery boot with acpi=off Signed-off-by: Pavel Machek <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Len Brown <[email protected]>
2006-07-10ACPI: add 'const' to several ACPI file_operationsArjan van de Ven1-3/+3
Signed-off-by: Arjan van de Ven <[email protected]> Signed-off-by: Len Brown <[email protected]>