Commit Graph

27 Commits

Author SHA1 Message Date
mycroft 007e2cd3b4 There's no need to clear the data_s fields now that the VALID bits are correct. 2003-11-01 09:41:25 +00:00
mycroft 6831bfd482 Remove some unused #defines. 2003-11-01 03:45:58 +00:00
mycroft fbd3c995b1 Remove an outdated comment. 2003-10-31 21:39:51 +00:00
mycroft fec4c11f9e Catch up with ABI changes in ACPI-CA. Some additional changes to acpi_bat to
set the VALID bits correctly, so we don't report garbage for missing batteries.
2003-10-31 20:54:18 +00:00
mycroft 68a1d153b6 Use ratecheck() to prevent envstat(1) doing many ACPI calls at once. Now my
MP3 player doesn't skip...
2003-10-30 22:12:02 +00:00
gson 144519b826 The unit displayed when printing battery capacities and
charge/discharge rates was incorrect - the value printed is actually
in A, W, Ah, or Wh, not in mA, mW, mAh, or mWh (assuming as we must
that the period is interpreted as a decimal point, not a thousands
separator).
2003-08-31 01:36:12 +00:00
gson f60f21cf0b The remaining capacity percentage was incorrect for batteries larger than
21.47 Wh becaue of integer overflow.
2003-05-29 02:47:49 +00:00
kochi 0d6c5a668c * make use of NetBSD ACPI APIs (acpi_eval_{struct,integer})
* minor cleanups
2003-05-22 15:35:51 +00:00
yamt 545cae513c this doesn't need to include callout.h anymore. 2003-04-26 16:38:00 +00:00
christos 580397c542 back-out previous; it was wrong. 2003-02-24 20:03:02 +00:00
christos 29cd3b6180 fix memory leaks. 2003-02-24 19:58:09 +00:00
tshiozak d62eb597a2 fix a few problems in the last commit:
- make sure that the driver checks the battery presence at acpibat_update()
    if the battery has been not present, because the driver sometimes
    (i.e. boot time or resuming time) miss to sense the presence.
  - make sure that the driver always update the status at acpibat_gtredata();
    I misunderstood about ACPI_NOTIFY_BatteryStatusChanged event.
2003-02-17 14:37:57 +00:00
tshiozak f27a62da88 - reduce the frequency of updating informations on the power sources;
it is very slow to access to EC on some machines (i.e. CASIO FIVA 2xx).
- clean the flags up.
- add locks while updating informations.
- some cosmetic changes.
2003-02-16 16:50:09 +00:00
explorer 59e0238f99 add envsys support to acpi A/C adapter and batteries. This is still a work
in progress, much like the rest of ACPI.
2002-12-31 05:26:56 +00:00
explorer a26c9e1804 When a battery isn't present, display that rather than bogus values. 2002-12-30 13:06:43 +00:00
chris eabbfc15c6 Fix build break.. 2002-12-30 10:19:59 +00:00
explorer 6ce13e9a31 clean up printing of battery info. This includes other changes I've toyed with, #if 0'd out 2002-12-30 09:37:50 +00:00
jmcneill 165d7516fb Again, in acpibat_get_status, bail rather than continuing if the package
we receive contains less elements than expected.
2002-12-30 06:20:02 +00:00
jmcneill 46e00cd6f7 Oops, I didn't mean for that commented out verbose flag to make it into the
last commit -- uncomment it again.
2002-12-30 04:52:13 +00:00
jmcneill e49259c17a If we receive a battery information package with less than 13 elements,
cleanup and return rather than trying to continue anyway.
2002-12-30 04:47:22 +00:00
thorpej c9b3657ce9 Add trailing ; to CFATTACH_DECL. 2002-10-02 16:33:28 +00:00
thorpej 387fc6dc87 Use CFATTACH_DECL(). 2002-09-30 20:37:04 +00:00
thorpej f818766afe Declare all cfattach structures const. 2002-09-27 20:31:45 +00:00
christos 64bf5ef14f Fix battery support (Masanori Kanaoka).
XXX: ToDo: Still the battery charge is 96% when the battery is
fully charged on my libretto because of the estimated total charge offset.
2002-08-20 14:07:51 +00:00
kanaoka 6e12c44e0f - Fix typo in a message.
- Avoid to divide by 0.
   When booting without battery, sc->sc_design_capacity become 0.
2002-08-18 07:45:04 +00:00
explorer 4dd0826200 display the V, W, and Wh rather than mV, mW, and mWh 2002-08-02 16:51:48 +00:00
sommerfeld b8de140e4e Prototype ACPI Control Method Battery driver.
ACPI defines two different battery device interfaces: "Control Method"
batteries, in which AML methods are defined in order to get battery
status and set battery alarm thresholds, and a "Smart Battery" device,
which is an SMbus device accessed through the ACPI Embedded Controller
device; this driver knows how to attach to the former sort of device.

As a total kludge, since we haven't wired things up to sysmon/envsys
yet, we report battery status through a once-per-minute kernel printf,
so don't use this driver yet if you want your disk to spin down.

Motivated by and tested on Sony PCG-R505TL laptop, which has
nonfunctional APM.

configure as:

acpibat* at acpi ?

Sample output:

acpibat0 at acpi0: ACPI Battery
acpibat0: Sony Corp. LION
acpibat0: Design 38480mWh, Predicted 38480mWh Warn 120mWh Low 0mWh
acpibat0: discharging: 15112mV cap 25480mWh (66%) rate 16849mW
...
acpibat0: discharging: 15224mV cap 25070mWh (65%) rate 18405mW
...
acpibat0: discharging: 15200mV cap 24310mWh (63%) rate 13771mW
...
acpibat0: charging: 15768mV cap 23330mWh (60%) rate 20388mW
2002-03-24 03:46:10 +00:00