ACPI: DPTF: Add battery participant driver
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fri, 22 May 2020 21:45:09 +0000 (14:45 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 25 May 2020 10:05:26 +0000 (12:05 +0200)
commit7b52b200cf5bdd04f3ee22121960bd6f4ec5efa1
tree1b53a7cde688e551498dd96f24f325acc03baad8
parent668ce99e4ed4c07bb14465f80492bc6cf76ed3c9
ACPI: DPTF: Add battery participant driver

This driver adds support for Dynamic Platform and Thermal Framework
battery participant device support.

These attributes are presented via sysfs interface under the platform
device for the battery participant:
$ls /sys/bus/platform/devices/INT3532:00/dptf_battery
current_discharge_capbility_ma
max_platform_power_mw
no_load_voltage_mv
high_freq_impedance_mohm
max_steady_state_power_mw

Refer to the documentation at
Documentation/ABI/testing/sysfs-platform-dptf
for details.

Here the implementation reuses existing dptf-power.c as the motivation and
processing is same. It also shares one ACPI method. Here this change is
using participant type, "PTYP" method to identify and do different
processing. By using participant type, create/delete either "dptf_power"
or "dptf_battery" attribute group and send notifications.

The particpant type for for the battery participant is 0x0C.

ACPI methods description:

PMAX (Intel(R) Dynamic Tuning Platform Max Power Supplied by Battery):
This object evaluates to the maximum platform power that can be supported
by the battery in milli watts.

PBSS (Intel(R) Dynamic Tuning Power Battery Steady State):
This object returns the max sustained power for battery in milli watts.

RBHF (Intel(R) Dynamic Tuning High Frequency Impedance):
This object returns high frequency impedance value that can be obtained
from battery fuel gauge.

VBNL (Intel(R) Dynamic Tuning No-Load Voltage)
This object returns battery instantaneous no-load voltage that can be
obtained from battery fuel gauge in milli volts

CMPP (Intel(R) Dynamic Tuning Current Discharge Capability)
This object returns battery discharge current capability obtained from
battery fuel gauge milli amps.

Notifications:

0x80: PMAX change. Used to notify Intel(R)Dynamic Tuning Battery
participant driver when the PMAX has changed by 250mw.
0x83: PBSS change. Used to notify Intel(R) Dynamic Tuning Battery
participant driver when the power source has changed.
0x85: RBHF change. Used to notify Intel(R)Dynamic Tuning Battery
participant driver when the RBHF has changed over a threshold by
5mOhm.
0x86: Battery Capability change. Used to notify Intel(R)Dynamic Tuning
Battery participant driver when the battery capability has changed.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ rjw: Subject ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Documentation/ABI/testing/sysfs-platform-dptf
drivers/acpi/dptf/dptf_power.c