Home | History | Annotate | Download | only in acpi
History log of /src/sys/dev/acpi/acpi_bat.c
RevisionDateAuthorComments
 1.123  27-Apr-2024  christos Remove 0 initializations (since the softc is zalloc'ed) and the initial
refresh which will have no data.
 1.122  26-Apr-2024  christos PR/58201: Malte Dehling: re-order sysmon initialization before acpi
registration, to avoid needing to call to acpi_deregister_notify on sysmon
failure.
 1.121  07-Jan-2022  riastradh branches: 1.121.4;
acpibat(4): Fix race in detach with AcpiOsExecute deferred call.
 1.120  31-Dec-2021  riastradh acpibat(4): Print ACPI error when _STA fails.
 1.119  31-Dec-2021  riastradh acpibat(4): Delete excessive blank lines.

Makes it hard to follow when there is a big gap between everything
even when there is a tight logical coupling, like setting and testing
an error code.
 1.118  31-Dec-2021  riastradh acpibat(4): Fix attach and detach ordering.

On attach: Don't register acpibat_resume handler with pmf or
acpibat_notify_handler with acpi until it is safe to call
acpibat_update_info and acpibat_update_status.
=> This requires the sc->sc_sensor array to be allocated, so allocate
that first.
=> This requires sc->sc_sme to be created, so defer them to
config_interrupts after sysmon_envsys_register.
=> Make sure to register the notify handler before initially polling
the info and status.

On detach: Deregister pmf handler and acpi notifier before we destroy
anything.
 1.117  29-Jan-2021  thorpej Use acpi_compatible_match().
 1.116  10-Aug-2018  riastradh branches: 1.116.14;
Don't hold up boot: defer acpibat(4) inquiry until threads are running.

ok jmcneill@
 1.115  23-Apr-2015  pgoyette branches: 1.115.16; 1.115.18;
Update module dependencies for all the existing modules that depend on sysmon components.
 1.114  31-Dec-2014  mlelstv handle unknown values. Also BIF_UNIT is an enum, not a bitmask.
 1.113  02-Oct-2014  riastradh branches: 1.113.2;
Don't kdassert about crap provided by the firmware.
 1.112  14-Aug-2012  jruoho branches: 1.112.2;
Collect rnd(9) entropy from coretemp(4), acpibat(4), aibs(4), hpacel(4),
thinkpad(4), and aps(4).
 1.111  13-Jul-2011  jruoho branches: 1.111.2;
In revision 1.103 the serial number was used to determine whether the
battery was changed to another one. However, this is unreliable as many
vendors hardcode the serial number string in the DSDT. Thus, use the design
capacity and voltage instead; these are likely read from the battery itself.
 1.110  20-Jun-2011  pgoyette Initialize battery capacity sensor value before registering.
 1.109  16-Feb-2011  jruoho branches: 1.109.2;
Change the preprocessor defines around the module(9)'s modcmd() calls such
that the modules show in modstat(8) even though these are "builtin".
 1.108  13-Jan-2011  jruoho branches: 1.108.2; 1.108.4;
Upon request from jmcneill@, put the check back that prevents unnecessary
readings during the sysmon_envsys(9) poll cycle. Some systems (notably,
Asus EeePC) have so badly implemented AML that reading the values via
envstat(8) alone can cause considerable delays.
 1.107  09-Jan-2011  jruoho Print a message if ACPI 4.0 functionality is present (in which case the
driver should be updated).
 1.106  04-Jan-2011  jruoho Revert the changes made in the commit:

"Do not queue functions via sysmon_taskq(9) in the pmf(9) resume hooks.
There is a small and unlikely race when the drivers are loaded as modules;
suspend, resume, queue a function, and immediately unload the module."

Queueing the checks in the resume hooks was observed to improve the resume
time by several seconds (!) on a system with poorly implemented AML code.
The observed race condition is a wider issue related to modules; things like
sysmon_taskq(9) should be modified to allow cancelling of queued functions.
 1.105  25-Oct-2010  jruoho Bump WARNS to 4.
 1.104  14-Aug-2010  jruoho Do not queue functions via sysmon_taskq(9) in the pmf(9) resume hooks.
There is a small and unlikely race when the drivers are loaded as modules;
suspend, resume, queue a function, and immediately unload the module.
 1.103  30-Jun-2010  jruoho Only aprint*() the battery information if the battery has changed. Based on
suggestion from mrg@. The used serial number is hopefully unique enough as
an identifier. Should fix PR kern/43505 by David Demelier.
 1.102  27-Apr-2010  jruoho Use ACPICA's standard notify values from <actypes.h> and move the
device-specific notify constants to the device-specific files.
 1.101  16-Apr-2010  christos fix dmesg printing.
 1.100  15-Apr-2010  jruoho As discussed with jmcneill@, install a global "bus notification handler"
that receives all notifications and deliver notifications to drivers via it.
 1.99  14-Apr-2010  jruoho No need to spread the ACPICA type system any more than is necessary:

UINT8 -> uint8_t and UINT32 -> uint32_t.
 1.98  03-Apr-2010  jruoho Update the limits when a change from absent to present is detected.
 1.97  26-Mar-2010  pooka Catch up with cosmetic changes to output from config(1)
 1.96  26-Mar-2010  pooka Convert to config_init/fini_component.

tested by jruoho
 1.95  24-Mar-2010  pgoyette Set the SME_INIT_REFRESH flag so that the sensors' values (including
charge's max_value) are available when the event monitors are created.
 1.94  22-Mar-2010  jruoho Fix the previous commit properly: we need to set all sensor-flags during the
initialization of sysmon_envsys(9), otherwise, if _STA does not return true
during the attachment of the driver, it is possible that a flag is never
set. This flaw has always been present, but it only got exposed after the
conversion to use the sysmon-limits.
 1.93  22-Mar-2010  jruoho Set the capacity flags already in the acpibat_get_info(),
instead of acpibat_get_status().
 1.92  21-Mar-2010  pooka Convert acpibat to use ioconf instead of homerolled config glue.

Note, config whines about things like:
files.acpi:30: attaching undefined device `apm'

I intentionally was a lazy boy and didn't include a ton of dirt to
keep the hot napalm and riot blasts in the config thread rolling ;)

tested by jruoho (thanks!)
 1.91  17-Mar-2010  jruoho Print also the so-called "granularity" values when the _BIF is evaluated.
These refer to the smallest increment in capacity that the battery is
capable of measuring.
 1.90  17-Mar-2010  jruoho Remove the technology "sensor" (a fixed constant). Report this information
in an improved output when the battery information changes (i.e. device
attachment or battery removal/insertion).
 1.89  17-Mar-2010  jruoho Remove the timer-based check in the sensor refresh routine. We henceforth
trust that the sysmon_envsys(9)'s polling is functioning properly. Discussed
with drochner@, jmcneill@, and pgoyette@.
 1.88  17-Mar-2010  jruoho Fix the testing of temporarily unknown values.
 1.87  17-Mar-2010  jruoho Move the low and warning capacity sensors to the limits framework provided
by sysmon_envsys(9).
 1.86  14-Mar-2010  pgoyette branches: 1.86.2;
Remove setting of edata->monitor since that member no longer exists.
 1.85  08-Mar-2010  jruoho Use the predefined ACPI_STA_BATTERY_PRESENT instead of defining a local one.
 1.84  05-Mar-2010  jruoho Remove <dev/acpi/acpica.h> from all files. It is included from
<dev/acpi/acpivar.h>. Ditto for <dev/sysmon/sysmonvar.h>, <sys/bus.h>,
<dev/pci/pcivar.h>, and <dev/isa/isavar.h>.

Also nuke a lot of unused and invalid headers. Some of these are audibly
provided by standard headers (namely <sys/param.h> and <sys/device.h>), some
have nothing to do with ACPI devices (e.g. <sys/syslog.h>), and some are
nonexistent local includes (e.g. "mpu_ym.h"). Moreoever, try to group the
includes into their respective blocks.

Tested with GENERIC and ALL (i386). No functional change.
 1.83  28-Feb-2010  jruoho Introduce support for ACPI kernel modules.

Tested on couple of laptops.
 1.82  24-Feb-2010  dyoung A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.81  31-Jan-2010  jruoho branches: 1.81.2;
Allocate the sensor structures dynamically.
 1.80  31-Jan-2010  jruoho Add detachment routines.
 1.79  27-Jan-2010  drochner the "Battery Present Rate" is only required to be valid if the battery
is discharging; it might make sense when charging, but it doesn't
make sense if neither is the case -- remove a wrong assertion and
arrange the code to make this obvious
(actually, the ACPI spec says that the requirement is only for
rechargeable batteries)
 1.78  24-Jan-2010  jruoho * Reintroduce a state variable. From njoly@.
* Always mark the charge state sensor as valid.
 1.77  23-Jan-2010  jruoho Cleanup:

* Remove ACPI_BAT_DEBUG.
* Reduce the amount of error reporting.
* Remove the internal bookkeeping flags.
* Remove the debugging functions used to print status and information
changes. This information is fully conveyed in the output of envstat(8).
* Always evaluate _STA. If it fails or the battery is not present, mark
all remaining sensors as invalid. This will eliminate the convoluted
update routine.
* Semantics.

Over 200 LOC was eliminated, but functional change should again be minimal.

ok jmcneill@, pgoyette@
 1.76  21-Jan-2010  jruoho In preparation for upcoming changes:

* Provide proper definitions and use these.
* Clarify the evaluation of _STA.
* Mark the state of a sensor according to the return value from _STA.
* Share the basic object evaluation in _BIF and _BST.
* Verify the object types before using the objects.
* Be aware of bogus values from _BIF and _BST, as noted in the
specification.

Despite of the list, functional change should be minimal. Ok pgoyette@.
 1.75  08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.74  29-Sep-2009  jmcneill If the driver thinks a battery is not present, poll for present status.
Workaround for firmware that doesn't report battery present status
immediately at boot and doesn't issue a subsequent notify when the
information becomes available.
 1.73  16-Sep-2009  mlelstv Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.
 1.72  25-Aug-2009  jmcneill PR# kern/41179: Incorrect return values from AcpiOsExecute()

ACPICA functions return ACPI_STATUS instead of int, so use it for
consistency.
 1.71  12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.70  12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.69  03-Jun-2008  jmcneill branches: 1.69.8; 1.69.12; 1.69.16;
Reintroduce acpibat_refresh, only have it refresh battery status (not info,
we will get notified for changes there). Use SME_POLL_ONLY so applications
that use GTREDATA don't cause trouble, and don't use SME_INIT_REFRESH as it
appears to be completely broken.
 1.68  03-Jun-2008  jmcneill Refresh battery info/status on resume.
 1.67  03-Jun-2008  jmcneill Simplify SME usage within acpibat:

* No need for sme_refresh callback; GPE handler will tell us when the
device status changed (otherwise we can refresh data up to once a second,
and that can take time!)
* Since sme_refresh callback is gone, mutex is no longer required to
synchronize GPE handlers and refresh thread, so nuke it.
* Don't do any more work in GPE handler than required; use AcpiOsExecute
to clear battery status/information in the sysmon_task_queue along with
the refresh.

With these changes running GNOME's battstat-applet-2 no longer causes
my mouse to stutter once a second, and significantly reduces its CPU usage.
 1.66  28-Apr-2008  martin branches: 1.66.2;
Remove clause 3 and 4 from TNF licenses
 1.65  23-Mar-2008  xtraeme branches: 1.65.2; 1.65.4;
Use the SME_INIT_REFRESH flag to fetch sensor data once in the
autoconf(9) process.
 1.64  09-Dec-2007  jmcneill branches: 1.64.10;
Merge jmcneill-pm branch.
 1.63  05-Dec-2007  ad branches: 1.63.2;
Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
 1.62  16-Nov-2007  xtraeme branches: 1.62.2;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.61  03-Nov-2007  xtraeme branches: 1.61.2;
- Rename ENVSYS_BATTERY_STATE units to ENVSYS_BATTERY_CAPACITY and
introduce ENVSYS_BATTERY_CHARGE, which is the same than an Indicator and
it's used to know if the battery is currently charging or discharging.

- Require two sensors at least for SME_CLASS_BATTERY to make the low-power
condition work: a ENVSYS_BATTERY_CAPACITY plus ENVSYS_BATTERY_CHARGE.

- Simplify sme_event_check_lowpower() and make it check the required
sensors in the SME_CLASS_ACADAPTER and SME_CLASS_BATTERY classes.
If the acadapter is not ready, trust the state returned by the battery
device.

Based on suggestion from joerg@.
 1.60  02-Nov-2007  plunky do not embed acpi device names in the sensor names
fake it in the compat code for the old envsys API
 1.59  18-Oct-2007  joerg Convert to device_t/softc split. Use aprint API.
 1.58  17-Oct-2007  joerg Separate softc and device_t. Convert to aprint API and make the driver
less verbose by default.
 1.57  10-Oct-2007  xtraeme branches: 1.57.2;
Fix the problems described in:
http://mail-index.netbsd.org/current-users/2007/07/16/0012.html

- Introduce sme_class into the sysmon_envsys struct to specify a
class; currently there are two classes: SME_CLASS_ACADAPTER and
SME_CLASS_BATTERY.

- Add a new envsys event: PENVSYS_EVENT_LOW_POWER that is reached when
all SME_CLASS_BATTERY devices are in CRITICAL/LOW state and there's not
any SME_CLASS_ACADAPTER connected.

- Add the 'low-power' event into the sensor_battery script that will
shutdown the system gracefully via 'shutdown -p'. If powerd(8) is
not running, cpu_reboot(9) with RB_POWERDOWN is used.

- Make acpiacad(4) a SME_CLASS_ACADAPTER device and acpibat(4) a
SME_CLASS_BATTERY device.

Update the documentation accordingly to these changes.
 1.56  04-Sep-2007  xtraeme branches: 1.56.2;
- Use a ENVSYS_BATTERY_STATE sensor rather than ENVSYS_GSTRING.
- Use ENVSYS_FMONSTCHANGED on the ENVSYS_BATTERY_STATE sensor to monitor
state changes.
 1.55  02-Sep-2007  xtraeme Add a new sensor of type ENVSYS_GSTRING. This is useful to print
the current battery charge state.

$ envstat -dacpibat0 -s"acpibat0 charge state"
acpibat0 charge state: NORMAL
$

It will show WARNING, CRITICAL, LOW or NORMAL depending on the
state it is.
 1.54  26-Aug-2007  xtraeme branches: 1.54.2;
Set ENVSYS_FMONNOTSUPP in the last two missing sensors, forgot in previous.
 1.53  26-Aug-2007  xtraeme Only assing the monitoring flags once in acpibat_init_envsys() before
registering the driver.
 1.52  08-Aug-2007  cube Fix a few minor envsys2 bugs/oddities in acpi_bat(4).

- mark (DIS)CHARGERATE as invalid when (DIS)CHARGING so that envstat
doesn't print some weird stats where the system appears to be doing
both
- handle the case when it's doing neither by marking *RATE as invalid
and setting CHARGING to OFF (because we're not charging, even though
we're not discharging)
- fix print_stats to print correct values in those cases, and a real
percentage (i.e., computed against LFCCAPACITY)
 1.51  16-Jul-2007  xtraeme branches: 1.51.2; 1.51.6;
Disable monitoring in the ACPIBAT_TECHNOLOGY sensor, which is just
informative.
 1.50  05-Jul-2007  xtraeme Final round, after more comments from yamt and cube:

For indicators, if sensor is valid but it should report that it is
in disabled state (OFF), just set value_cur to 0 without changing its
state.
 1.49  05-Jul-2007  xtraeme acpibat_print_stat(): in the 'charging' indicator sensor, check its state
to select the correct string rather than using value_cur.
 1.48  05-Jul-2007  xtraeme Use only one Indicator sensor when the battery is connected/disconnected
and another one only for charging/discharging.
 1.47  03-Jul-2007  xtraeme Rather than using two AcpiInstallNotifyHandler() with ACPI_DEVICE_NOTIFY
and ACPI_SYSTEM_NOTIFY, use ACPI_ALL_NOTIFY and remove a redundant
call.
 1.46  01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.45  16-Nov-2006  christos branches: 1.45.8; 1.45.10;
__unused removal on arguments; approved by core.
 1.44  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.43  20-Feb-2006  kochi branches: 1.43.14; 1.43.16;
use aprint_*
 1.42  16-Feb-2006  kochi prototypes don't need argument names
 1.41  11-Dec-2005  christos branches: 1.41.2; 1.41.4; 1.41.6;
merge ktrace-lwp.
 1.40  25-Jun-2004  mycroft branches: 1.40.12;
Handle a "device check" message by reloading battery information.
 1.39  01-May-2004  kochi specify static where appropriate.
 1.38  12-Apr-2004  kochi minor space nit from Alexander Yurchenko.
 1.37  11-Apr-2004  kochi return (x) -> return x
use consitent variable name for ACPI_STATUS
 1.36  24-Mar-2004  kanaoka branches: 1.36.2;
Make it compile (int -> ACPI_INTEGER)
 1.35  03-Nov-2003  mycroft More cleanup:
* Use ACPI_FAILURE() and ACPI_SUCCESS().
* Output exception strings in a few more places.
 1.34  03-Nov-2003  mycroft Clean up some messages:
* Use AcpiFormatException() in a bunch of places.
* acpi_resource_parse() already prints an error, so don't do it in the callers.
 1.33  03-Nov-2003  kochi * now the size of ACPI_DEVICE_INFO is variable:
it can now accomodate multiple _CIDs
sizeof(ACPI_DEVICE_INFO) should not be used
* make ad_devinfo member in acpi_devnode a pointer
* implement acpi_match_hid() to simplify matching devices;
_CIDs are also taken into account now as well as _HID
 1.32  01-Nov-2003  mycroft Don't bothering reinitializing the sensor name strings when the battery info
is updated. Do print out the battery manufacturer info, though. (It's too
bad we can't return this through envsys........)
 1.31  01-Nov-2003  mycroft Provide percentages for the threshold values too.
 1.30  01-Nov-2003  mycroft Whoops, made a typo there.
 1.29  01-Nov-2003  mycroft Split "load" into "charge rate" and "discharge rate", depending on the state
of the battery.
 1.28  01-Nov-2003  mycroft Small change to use the "last full capacity" as the capacity maximum.
 1.27  01-Nov-2003  mycroft There's no need to clear the data_s fields now that the VALID bits are correct.
 1.26  01-Nov-2003  mycroft Remove some unused #defines.
 1.25  31-Oct-2003  mycroft Remove an outdated comment.
 1.24  31-Oct-2003  mycroft 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.
 1.23  30-Oct-2003  mycroft Use ratecheck() to prevent envstat(1) doing many ACPI calls at once. Now my
MP3 player doesn't skip...
 1.22  31-Aug-2003  gson 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).
 1.21  29-May-2003  gson branches: 1.21.2;
The remaining capacity percentage was incorrect for batteries larger than
21.47 Wh becaue of integer overflow.
 1.20  22-May-2003  kochi * make use of NetBSD ACPI APIs (acpi_eval_{struct,integer})
* minor cleanups
 1.19  26-Apr-2003  yamt this doesn't need to include callout.h anymore.
 1.18  24-Feb-2003  christos back-out previous; it was wrong.
 1.17  24-Feb-2003  christos fix memory leaks.
 1.16  17-Feb-2003  tshiozak 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.
 1.15  16-Feb-2003  tshiozak - 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.
 1.14  31-Dec-2002  explorer add envsys support to acpi A/C adapter and batteries. This is still a work
in progress, much like the rest of ACPI.
 1.13  30-Dec-2002  explorer When a battery isn't present, display that rather than bogus values.
 1.12  30-Dec-2002  chris Fix build break..
 1.11  30-Dec-2002  explorer clean up printing of battery info. This includes other changes I've toyed with, #if 0'd out
 1.10  30-Dec-2002  jmcneill Again, in acpibat_get_status, bail rather than continuing if the package
we receive contains less elements than expected.
 1.9  30-Dec-2002  jmcneill Oops, I didn't mean for that commented out verbose flag to make it into the
last commit -- uncomment it again.
 1.8  30-Dec-2002  jmcneill If we receive a battery information package with less than 13 elements,
cleanup and return rather than trying to continue anyway.
 1.7  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.6  30-Sep-2002  thorpej Use CFATTACH_DECL().
 1.5  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4  20-Aug-2002  christos 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.
 1.3  18-Aug-2002  kanaoka - Fix typo in a message.
- Avoid to divide by 0.
When booting without battery, sc->sc_design_capacity become 0.
 1.2  02-Aug-2002  explorer display the V, W, and Wh rather than mV, mW, and mWh
 1.1  24-Mar-2002  sommerfeld branches: 1.1.2; 1.1.4; 1.1.8;
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
 1.1.8.4  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.8.3  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.8.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1  24-Mar-2002  jdolecek file acpi_bat.c was added on branch kqueue on 2002-06-23 17:45:02 +0000
 1.1.4.1  29-Aug-2002  gehenna catch up with -current.
 1.1.2.6  03-Jan-2003  thorpej Sync with HEAD.
 1.1.2.5  18-Oct-2002  nathanw Catch up to -current.
 1.1.2.4  27-Aug-2002  nathanw Catch up to -current.
 1.1.2.3  13-Aug-2002  nathanw Catch up to -current.
 1.1.2.2  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1  24-Mar-2002  nathanw file acpi_bat.c was added on branch nathanw_sa on 2002-04-01 07:45:06 +0000
 1.21.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1  03-Aug-2004  skrll Sync with HEAD
 1.36.2.1  02-Jul-2004  he Pull up revision 1.40 (requested by mycroft in ticket #572):
Handle a ``device check'' message by reloading battery
information.
 1.40.12.8  24-Mar-2008  yamt sync with head.
 1.40.12.7  21-Jan-2008  yamt sync with head
 1.40.12.6  07-Dec-2007  yamt sync with head
 1.40.12.5  15-Nov-2007  yamt sync with head.
 1.40.12.4  27-Oct-2007  yamt sync with head.
 1.40.12.3  03-Sep-2007  yamt sync with head.
 1.40.12.2  30-Dec-2006  yamt sync with head.
 1.40.12.1  21-Jun-2006  yamt sync with head.
 1.41.6.1  22-Apr-2006  simonb Sync with head.
 1.41.4.1  09-Sep-2006  rpaulo sync with head
 1.41.2.2  01-Mar-2006  yamt sync with head.
 1.41.2.1  18-Feb-2006  yamt sync with head.
 1.43.16.2  10-Dec-2006  yamt sync with head.
 1.43.16.1  22-Oct-2006  yamt sync with head
 1.43.14.1  18-Nov-2006  ad Sync with head.
 1.45.10.1  11-Jul-2007  mjf Sync with head.
 1.45.8.5  23-Oct-2007  ad Sync with head.
 1.45.8.4  12-Oct-2007  ad Sync with head.
 1.45.8.3  09-Oct-2007  ad Sync with head.
 1.45.8.2  20-Aug-2007  ad Sync with HEAD.
 1.45.8.1  15-Jul-2007  ad Sync with head.
 1.51.6.11  09-Dec-2007  jmcneill Sync with HEAD.
 1.51.6.10  08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.51.6.9  21-Nov-2007  joerg Sync with HEAD.
 1.51.6.8  06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.51.6.7  04-Nov-2007  jmcneill Sync with HEAD.
 1.51.6.6  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.51.6.5  02-Oct-2007  jmcneill Update to ACPI-CA 20070320
 1.51.6.4  02-Oct-2007  joerg Sync with HEAD.
 1.51.6.3  03-Sep-2007  jmcneill Sync with HEAD.
 1.51.6.2  09-Aug-2007  jmcneill Sync with HEAD.
 1.51.6.1  05-Aug-2007  jmcneill Certain devices either don't require a power handler, or are restored
on resume outside of the pnp power management framework. For such devices,
introduce the null power handler, pnp_generic_power.
 1.51.2.3  10-Sep-2007  skrll Sync with HEAD.
 1.51.2.2  03-Sep-2007  skrll Sync with HEAD.
 1.51.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.54.2.2  09-Jan-2008  matt sync with HEAD
 1.54.2.1  06-Nov-2007  matt sync with HEAD
 1.56.2.2  18-Oct-2007  yamt sync with head.
 1.56.2.1  14-Oct-2007  yamt sync with head.
 1.57.2.3  18-Nov-2007  bouyer Sync with HEAD
 1.57.2.2  13-Nov-2007  bouyer Sync with HEAD
 1.57.2.1  25-Oct-2007  bouyer Sync with HEAD.
 1.61.2.3  27-Dec-2007  mjf Sync with HEAD.
 1.61.2.2  08-Dec-2007  mjf Sync with HEAD.
 1.61.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.62.2.2  26-Dec-2007  ad Sync with head.
 1.62.2.1  08-Dec-2007  ad Sync with head.
 1.63.2.1  11-Dec-2007  yamt sync with head.
 1.64.10.3  05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.64.10.2  02-Jun-2008  mjf Sync with HEAD.
 1.64.10.1  03-Apr-2008  mjf Sync with HEAD.
 1.65.4.7  09-Oct-2010  yamt sync with head
 1.65.4.6  11-Aug-2010  yamt sync with head.
 1.65.4.5  11-Mar-2010  yamt sync with head
 1.65.4.4  16-Sep-2009  yamt sync with head
 1.65.4.3  16-May-2009  yamt sync with head
 1.65.4.2  04-May-2009  yamt sync with head.
 1.65.4.1  16-May-2008  yamt sync with head.
 1.65.2.2  04-Jun-2008  yamt sync with head
 1.65.2.1  18-May-2008  yamt sync with head.
 1.66.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.69.16.1  21-Apr-2010  matt sync to netbsd-5
 1.69.12.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.69.8.1  05-Oct-2009  sborrill Pull up revision 1.74 (requested by jmcneill in ticket #1067)

If the driver thinks a battery is not present, poll for present status.
Workaround for firmware that doesn't report battery present status
immediately at boot and doesn't issue a subsequent notify when the
information becomes available.
 1.81.2.3  06-Nov-2010  uebayasi Sync with HEAD.
 1.81.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.81.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.86.2.3  05-Mar-2011  rmind sync with head
 1.86.2.2  03-Jul-2010  rmind sync with head
 1.86.2.1  30-May-2010  rmind sync with head
 1.108.4.1  17-Feb-2011  bouyer Sync with HEAD
 1.108.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.109.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.111.2.1  30-Oct-2012  yamt sync with head
 1.112.2.1  03-Dec-2017  jdolecek update from HEAD
 1.113.2.2  06-Jun-2015  skrll Sync with HEAD
 1.113.2.1  06-Apr-2015  skrll Sync with HEAD
 1.115.18.1  10-Jun-2019  christos Sync with HEAD
 1.115.16.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.116.14.1  03-Apr-2021  thorpej Sync with HEAD.
 1.121.4.1  12-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #844):

sys/dev/acpi/acpi_bat.c: revision 1.122
sys/dev/acpi/acpi_bat.c: revision 1.123

PR/58201: Malte Dehling: re-order sysmon initialization before acpi
registration, to avoid needing to call to acpi_deregister_notify on sysmon
failure.

Remove 0 initializations (since the softc is zalloc'ed) and the initial
refresh which will have no data.

RSS XML Feed