xref: /OK3568_Linux_fs/kernel/Documentation/hwmon/acpi_power_meter.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunKernel driver power_meter
2*4882a593Smuzhiyun=========================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunThis driver talks to ACPI 4.0 power meters.
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunSupported systems:
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun  * Any recent system with ACPI 4.0.
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun    Prefix: 'power_meter'
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun    Datasheet: https://uefi.org/specifications, section 10.4.
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunAuthor: Darrick J. Wong
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunDescription
17*4882a593Smuzhiyun-----------
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunThis driver implements sensor reading support for the power meters exposed in
20*4882a593Smuzhiyunthe ACPI 4.0 spec (Chapter 10.4).  These devices have a simple set of
21*4882a593Smuzhiyunfeatures--a power meter that returns average power use over a configurable
22*4882a593Smuzhiyuninterval, an optional capping mechanism, and a couple of trip points.  The
23*4882a593Smuzhiyunsysfs interface conforms with the specification outlined in the "Power" section
24*4882a593Smuzhiyunof Documentation/hwmon/sysfs-interface.rst.
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunSpecial Features
27*4882a593Smuzhiyun----------------
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunThe `power[1-*]_is_battery` knob indicates if the power supply is a battery.
30*4882a593SmuzhiyunBoth `power[1-*]_average_{min,max}` must be set before the trip points will work.
31*4882a593SmuzhiyunWhen both of them are set, an ACPI event will be broadcast on the ACPI netlink
32*4882a593Smuzhiyunsocket and a poll notification will be sent to the appropriate
33*4882a593Smuzhiyun`power[1-*]_average` sysfs file.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunThe `power[1-*]_{model_number, serial_number, oem_info}` fields display
36*4882a593Smuzhiyunarbitrary strings that ACPI provides with the meter.  The measures/ directory
37*4882a593Smuzhiyuncontains symlinks to the devices that this meter measures.
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunSome computers have the ability to enforce a power cap in hardware.  If this is
40*4882a593Smuzhiyunthe case, the `power[1-*]_cap` and related sysfs files will appear.  When the
41*4882a593Smuzhiyunaverage power consumption exceeds the cap, an ACPI event will be broadcast on
42*4882a593Smuzhiyunthe netlink event socket and a poll notification will be sent to the
43*4882a593Smuzhiyunappropriate `power[1-*]_alarm` file to indicate that capping has begun, and the
44*4882a593Smuzhiyunhardware has taken action to reduce power consumption.  Most likely this will
45*4882a593Smuzhiyunresult in reduced performance.
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunThere are a few other ACPI notifications that can be sent by the firmware.  In
48*4882a593Smuzhiyunall cases the ACPI event will be broadcast on the ACPI netlink event socket as
49*4882a593Smuzhiyunwell as sent as a poll notification to a sysfs file.  The events are as
50*4882a593Smuzhiyunfollows:
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun`power[1-*]_cap` will be notified if the firmware changes the power cap.
53*4882a593Smuzhiyun`power[1-*]_interval` will be notified if the firmware changes the averaging
54*4882a593Smuzhiyuninterval.
55