Thread (7 messages) 7 messages, 2 authors, 2016-06-23

Re: [PATCH v2 2/3] acpi: dptf_power: Add DPTF power participant

From: "Rafael J. Wysocki" <rafael@kernel.org>
Date: 2016-06-23 13:23:50

On Thu, Jun 23, 2016 at 1:48 AM, Rafael J. Wysocki [off-list ref] wrote:
On Thu, Jun 23, 2016 at 5:42 AM, Srinivas Pandruvada
[off-list ref] wrote:
quoted
This driver adds support for Dynamic Platform and Thermal Framework
(DPTF) Platform Power Participant device support.
This participant is responsible for exposing platform telemetry such as
platform Power, battery Information such as state of Charge, estimated
maximum sustainable power (PMax), SMART battery spec information.

This driver is implemented as a platform driver for INT3407 and presented
as power_supply device. Since this has common features with the ACPI
battery, existing interface provide by battery_common driver are reused
to present as a battery power supply device.

Since this driver will also register a battery power supply device,this
driver will exit if CONFIG_ACPI_BATTERY is defined.

There are two types of objects in INT3407:
- Same as ACPI Battery objects: _BST and _BIX. These are exposed as
standard power supply attributes.
- Specific to INT3407, which are related to platform power
There are some objects, for which it doesn't make sense to enhance
power_supply class and add attributes there. They are represented as
sysfs attribute under acpi device.
The below part of the changelog should really go to a doc under Documentation/.
quoted
Here the bid for INT3407 is TPWR
in the following example.
/sys/class/power_supply/TPWR
├── alarm
├── capacity
├── capacity_level
├── cycle_count
├── device -> ../../../INT3407:00
│   ├── dptf_power
│   │   ├── adapter_rating
│   │   ├── battery_steady_power
│   │   ├── charger_type
│   │   ├── max_platform_power
│   │   ├── platform_power_source
│   │   ├── power_sampling_period

For example representing AC/adapter properties as a power_supply
properties will not make sense for a battery device. In some case
when there is an existing property, the meaning is different.
For example charger_type has a equivalent power_supply property,
which has different symantics than INT3407.

ACPI methods description used in this driver:
PSOC: Platform Battery State Of Charge as a percentage.
PMAX: Maximum platform power that can be supported by the battery in mW.
PSRC: System charge source,
        0x00 = DC
        0x01 = AC
        0x02 = USB
        0x03 = Wireless Charger
ARTG: Adapter rating in mW (Maximum Adapter power) Must be 0 if no AC
        Adaptor is plugged in.
CTYP: Charger Type,
        Traditional : 0x01
        Hybrid: 0x02
        NVDC: 0x03
PBSS: Returns max sustained power for battery in milliWatts.
DPSP: Sets the polling interval in 10ths of seconds. A value of 0 tells
        the driver to use event notification for PMAX and PBSS

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/acpi/Kconfig      |  17 +++++
 drivers/acpi/Makefile     |   1 +
 drivers/acpi/dptf_power.c | 184 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 202 insertions(+)
 create mode 100644 drivers/acpi/dptf_power.c
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 27ae351..03a34b4 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -526,4 +526,21 @@ config XPOWER_PMIC_OPREGION

 endif

+config DPTF_POWER
+       tristate "DPTF Platform Power Participant"
+       depends on X86
+       select ACPI_BATTERY_COMMON
+       select POWER_SUPPLY
+       default y
+       help
+         This driver adds support for Dynamic Platform and Thermal Framework
+         (DPTF) Platform Power Participant device support.
+         This participant is responsible for exposing platform telemetry such
+         as platform Power, battery Information such as state of Charge,
+         estimated maximum sustainable power (PMax), SMART battery spec
+         information.
+
+         To compile this driver as a module, choose M here:
+         the module will be called dptf_power.
+
 endif  # ACPI
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 950bf8e..1c76715 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -75,6 +75,7 @@ obj-$(CONFIG_ACPI)            += acpi_memhotplug.o
 obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o
 obj-$(CONFIG_ACPI_BATTERY_COMMON) += battery_common.o
 obj-$(CONFIG_ACPI_BATTERY)     += battery.o
+obj-$(CONFIG_DPTF_POWER)       += dptf_power.o
Now that I think about it, maybe it would be better to put that into
drivers/platform/x86?
Or we can create a dptf directory under drivers/acpi/ if you prefer.

I'd rather avoid mixing the DPTF stuff with generic ACPI code in any case.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help