Commit graph

15 commits

Author SHA1 Message Date
Sumeet Pawnikar
657b95d34b ACPI: DPTF: Support Meteor Lake
Add Meteor Lake ACPI IDs for DPTF devices.

Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2022-05-25 15:37:07 +02:00
Sumeet Pawnikar
42e5ed0618 ACPI: DPTF: Add support for high frequency impedance notification
Add high frequency impedance notification support under DPTF.
This returns high frequency impedance value that can be obtained
from battery fuel gauge whenever there is change over a threshold.
Also, corrected the typo from IMPEDANCED_CHNGED to IMPEDANCE_CHANGED.

Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2022-05-06 20:51:42 +02:00
Sumeet Pawnikar
290a20782a ACPI: DPTF: Correct description of INT3407 / INT3532 attributes
Remove duplicate comments of PBSS for Battery steady state power and
correct the typo for PMAX Maximum platform power.

Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2022-04-22 16:57:42 +02:00
Srinivas Pandruvada
a510c78e5b ACPI: DPTF: Support Raptor Lake
Add Raptor Lake ACPI IDs for DPTF devices.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2022-01-17 19:45:38 +01:00
Srinivas Pandruvada
38748bcb94 ACPI: DPTF: Support Alder Lake
Add Alder Lake ACPI IDs for DPTF devices.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-11-10 18:52:51 +01:00
Rafael J. Wysocki
ff44fe3e67 ACPI: DPTF: Fix participant driver names
Change the names of DPTF participant drivers to adhere to the
sysfs file naming conventions (no spaces present in the name in
particular).

Fixes: 2ce6324ead ("ACPI: DPTF: Add PCH FIVR participant driver")
Fixes: 6256ebd5da ("ACPI / DPTF: Add DPTF power participant driver")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Borislav Petkov <bp@suse.de>
2020-10-16 18:16:39 +02:00
Srinivas Pandruvada
1e05daca83 ACPI: DPTF: Add battery participant for TigerLake
Add DPTF battery participant ACPI ID for platforms based on the Intel
TigerLake SoC.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-06-29 14:00:57 +02:00
Srinivas Pandruvada
7b52b200cf 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>
2020-05-25 12:05:26 +02:00
Srinivas Pandruvada
668ce99e4e ACPI: DPTF: Additional sysfs attributes for power participant driver
Add two additional attributes to the existing power participant driver:
rest_of_platform_power_mw: (RO) Shows the rest of worst case platform
power in mW outside of S0C. This will help in power distribution to SoC
and rest of the system. For example on a test system, this value is 2.5W
with a 15W TDP SoC. Based on the adapter rating (adapter_rating_mw), user
space software can decide on proper power allocation to SoC to improve
short term performance via powercap/RAPL interface.

prochot_confirm: (WO) Confirm EC about a prochot notification.

Also userspace is notified via sysfs_notify(), whenever power source or
rest of the platform power is changed. So user space can use poll()
system call on those attributes.

The ACPI methods used in this patch are as follows:

PROP
This object evaluates to the rest of worst case platform power in mW.
Bits:
23:0 Worst case rest of platform power in mW.

PBOK
PBOK is a method designed to provide a mechanism for OSPM to change power
setting before EC can de-assert a PROCHOT from a device. The EC may
receive several PROCHOTs, so it has a sequence number attached to PSRC
(read via existing attribute "platform_power_source"). Once OSPM takes
action for a PSRC change notification, it can call PBOK method to confirm
with the sequence number.
Bits:
3:0 Power Delivery State Change Sequence number
30  Reserved
31  0 – Not OK to de-assert PROCHOT
    1 – OK to de-assert PROCHOT

PSRC (Platform Power Source): Not new in this patch but for
documentation for new bits
This object evaluates to an integer that represents the system power
source as well as the power delivery state change sequence number.
Bits:
3:0 The current power source as an integer for AC, DC, USB, Wireless.
0 = DC, 1 = AC, 2 = USB, 3 = Wireless Charging
7:4 Power Delivery State Change Sequence Number. Default value is 0

Notifications:
0x81: (Power State Change) Used to notify when the power source has
changed.
0x84: (PROP change) Used to notify when the platform rest of power has
changed.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
[ rjw: Subject, minor ABI documentation edit ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-05-25 12:03:43 +02:00
Gayatri Kammela
b62c770fee ACPI: Update Tiger Lake ACPI device IDs
Tiger Lake's new unique ACPI device IDs for DPTF and fan drivers are not
valid as the IDs are missing 'C'. Fix the IDs by updating them.

After the update, the new IDs should now look like
INT1047 --> INTC1047
INT1040 --> INTC1040
INT1043 --> INTC1043
INT1044 --> INTC1044

Fixes: 55cfe6a5c5 ("ACPI: DPTF: Add Tiger Lake ACPI device IDs")
Fixes: c248dfe7e0 ("ACPI: fan: Add Tiger Lake ACPI device ID")
Suggested-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
Signed-off-by: Gayatri Kammela <gayatri.kammela@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-04-01 13:20:21 +02:00
Gayatri Kammela
55cfe6a5c5 ACPI: DPTF: Add Tiger Lake ACPI device IDs
Tiger Lake has new unique ACPI device IDs that need to be added to the
DPTF drivers to support it.

Signed-off-by: Gayatri Kammela <gayatri.kammela@intel.com>
[ rjw: Subject & changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-12-19 22:51:55 +01:00
Thomas Gleixner
2025cf9e19 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms and conditions of the gnu general public license
  version 2 as published by the free software foundation this program
  is distributed in the hope it will be useful but without any
  warranty without even the implied warranty of merchantability or
  fitness for a particular purpose see the gnu general public license
  for more details

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 263 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05 17:36:37 +02:00
Kefeng Wang
b0f65b9179 ACPI / DPTF: Use dev_get_drvdata()
Skip conversion to platform_device and use dev_get_drvdata() directly.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2019-04-23 10:57:12 +02:00
Arvind Yadav
9e4de6a8ee ACPI / DPTF: constify attribute_group structures
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
    904	    496	      0	   1400	    578	drivers/acpi/dptf/dptf_power.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
    944	    432	      0	   1376	    560	drivers/acpi/dptf/dptf_power.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-07-04 22:15:28 +02:00
Srinivas Pandruvada
6256ebd5da ACPI / DPTF: Add DPTF power participant driver
This driver adds support for Dynamic Platform and Thermal Framework
(DPTF) Platform Power Participant device (INT3407) support.

This participant is responsible for exposing platform telemetry such as:
    max_platform_power
    platform_power_source
    adapter_rating
    battery_steady_power
    charger_type

These attributes are presented via sysfs interface under the INT3407
platform device:
$ls /sys/bus/platform/devices/INT3407\:00/dptf_power/
    adapter_rating_mw
    battery_steady_power_mw
    charger_type
    max_platform_power_mw
    platform_power_source
    `
ACPI methods description used in this driver:
    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 adapter is plugged in.
    CTYP: Charger Type,
            Traditional : 0x01
            Hybrid: 0x02
            NVDC: 0x03
    PBSS: Returns max sustained power for battery in milliWatts.

The INT3407 also contains _BTS and _BIX objects, which are compliant to
ACPI 5.0, specification. Those objects are already used by ACPI battery
(PNP0C0A) driver and information about them is exported via Linux power
supply class registration.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-07-21 13:40:09 +02:00