Skip to content

Commit 54d0b14

Browse files
committed
Merge branches 'acpi-drivers', 'acpi-misc' and 'acpi-tools'
* acpi-drivers: ACPI / DPTF: move int340x_thermal.c to the DPTF folder ACPI / DPTF: Add DPTF power participant driver * acpi-misc: ACPI / lpat: make it explicitly non-modular ACPI / dock: make dock explicitly non-modular * acpi-tools: tools/acpi: use CROSS_COMPILE to define prefix
4 parents 273b5a4 + c11dd70 + c49b43c + a3bcf2d commit 54d0b14

File tree

9 files changed

+155
-13
lines changed

9 files changed

+155
-13
lines changed

drivers/acpi/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ config ACPI_NFIT_DEBUG
482482
issue.
483483

484484
source "drivers/acpi/apei/Kconfig"
485+
source "drivers/acpi/dptf/Kconfig"
485486

486487
config ACPI_EXTLOG
487488
tristate "Extended Error Log support"

drivers/acpi/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ acpi-y += acpi_lpss.o acpi_apd.o
4444
acpi-y += acpi_platform.o
4545
acpi-y += acpi_pnp.o
4646
acpi-$(CONFIG_ARM_AMBA) += acpi_amba.o
47-
acpi-y += int340x_thermal.o
4847
acpi-y += power.o
4948
acpi-y += event.o
5049
acpi-$(CONFIG_ACPI_REDUCED_HARDWARE_ONLY) += evged.o
@@ -104,3 +103,4 @@ obj-$(CONFIG_BXT_WC_PMIC_OPREGION) += pmic/intel_pmic_bxtwc.o
104103
obj-$(CONFIG_ACPI_CONFIGFS) += acpi_configfs.o
105104

106105
video-objs += acpi_video.o video_detect.o
106+
obj-y += dptf/

drivers/acpi/acpi_lpat.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* GNU General Public License for more details.
1414
*/
1515

16-
#include <linux/module.h>
16+
#include <linux/export.h>
1717
#include <linux/acpi.h>
1818
#include <acpi/acpi_lpat.h>
1919

@@ -157,5 +157,3 @@ void acpi_lpat_free_conversion_table(struct acpi_lpat_conversion_table
157157
}
158158
}
159159
EXPORT_SYMBOL_GPL(acpi_lpat_free_conversion_table);
160-
161-
MODULE_LICENSE("GPL");

drivers/acpi/dock.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222

2323
#include <linux/kernel.h>
24-
#include <linux/module.h>
24+
#include <linux/moduleparam.h>
2525
#include <linux/slab.h>
2626
#include <linux/init.h>
2727
#include <linux/types.h>
@@ -33,12 +33,7 @@
3333

3434
#include "internal.h"
3535

36-
#define ACPI_DOCK_DRIVER_DESCRIPTION "ACPI Dock Station Driver"
37-
3836
ACPI_MODULE_NAME("dock");
39-
MODULE_AUTHOR("Kristen Carlson Accardi");
40-
MODULE_DESCRIPTION(ACPI_DOCK_DRIVER_DESCRIPTION);
41-
MODULE_LICENSE("GPL");
4237

4338
static bool immediate_undock = 1;
4439
module_param(immediate_undock, bool, 0644);

drivers/acpi/dptf/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
config DPTF_POWER
2+
tristate "DPTF Platform Power Participant"
3+
depends on X86
4+
help
5+
This driver adds support for Dynamic Platform and Thermal Framework
6+
(DPTF) Platform Power Participant device (INT3407) support.
7+
This participant is responsible for exposing platform telemetry:
8+
max_platform_power
9+
platform_power_source
10+
adapter_rating
11+
battery_steady_power
12+
charger_type
13+
14+
To compile this driver as a module, choose M here:
15+
the module will be called dptf_power.

drivers/acpi/dptf/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
obj-$(CONFIG_ACPI) += int340x_thermal.o
2+
obj-$(CONFIG_DPTF_POWER) += dptf_power.o
3+
4+
ccflags-y += -Idrivers/acpi

drivers/acpi/dptf/dptf_power.c

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/*
2+
* dptf_power: DPTF platform power driver
3+
* Copyright (c) 2016, Intel Corporation.
4+
*
5+
* This program is free software; you can redistribute it and/or modify it
6+
* under the terms and conditions of the GNU General Public License,
7+
* version 2, as published by the Free Software Foundation.
8+
*
9+
* This program is distributed in the hope it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12+
* more details.
13+
*
14+
*/
15+
16+
#include <linux/kernel.h>
17+
#include <linux/module.h>
18+
#include <linux/acpi.h>
19+
#include <linux/platform_device.h>
20+
21+
/*
22+
* Presentation of attributes which are defined for INT3407. They are:
23+
* PMAX : Maximum platform powe
24+
* PSRC : Platform power source
25+
* ARTG : Adapter rating
26+
* CTYP : Charger type
27+
* PBSS : Battery steady power
28+
*/
29+
#define DPTF_POWER_SHOW(name, object) \
30+
static ssize_t name##_show(struct device *dev,\
31+
struct device_attribute *attr,\
32+
char *buf)\
33+
{\
34+
struct platform_device *pdev = to_platform_device(dev);\
35+
struct acpi_device *acpi_dev = platform_get_drvdata(pdev);\
36+
unsigned long long val;\
37+
acpi_status status;\
38+
\
39+
status = acpi_evaluate_integer(acpi_dev->handle, #object,\
40+
NULL, &val);\
41+
if (ACPI_SUCCESS(status))\
42+
return sprintf(buf, "%d\n", (int)val);\
43+
else \
44+
return -EINVAL;\
45+
}
46+
47+
DPTF_POWER_SHOW(max_platform_power_mw, PMAX)
48+
DPTF_POWER_SHOW(platform_power_source, PSRC)
49+
DPTF_POWER_SHOW(adapter_rating_mw, ARTG)
50+
DPTF_POWER_SHOW(battery_steady_power_mw, PBSS)
51+
DPTF_POWER_SHOW(charger_type, CTYP)
52+
53+
static DEVICE_ATTR_RO(max_platform_power_mw);
54+
static DEVICE_ATTR_RO(platform_power_source);
55+
static DEVICE_ATTR_RO(adapter_rating_mw);
56+
static DEVICE_ATTR_RO(battery_steady_power_mw);
57+
static DEVICE_ATTR_RO(charger_type);
58+
59+
static struct attribute *dptf_power_attrs[] = {
60+
&dev_attr_max_platform_power_mw.attr,
61+
&dev_attr_platform_power_source.attr,
62+
&dev_attr_adapter_rating_mw.attr,
63+
&dev_attr_battery_steady_power_mw.attr,
64+
&dev_attr_charger_type.attr,
65+
NULL
66+
};
67+
68+
static struct attribute_group dptf_power_attribute_group = {
69+
.attrs = dptf_power_attrs,
70+
.name = "dptf_power"
71+
};
72+
73+
static int dptf_power_add(struct platform_device *pdev)
74+
{
75+
struct acpi_device *acpi_dev;
76+
acpi_status status;
77+
unsigned long long ptype;
78+
int result;
79+
80+
acpi_dev = ACPI_COMPANION(&(pdev->dev));
81+
if (!acpi_dev)
82+
return -ENODEV;
83+
84+
status = acpi_evaluate_integer(acpi_dev->handle, "PTYP", NULL, &ptype);
85+
if (ACPI_FAILURE(status))
86+
return -ENODEV;
87+
88+
if (ptype != 0x11)
89+
return -ENODEV;
90+
91+
result = sysfs_create_group(&pdev->dev.kobj,
92+
&dptf_power_attribute_group);
93+
if (result)
94+
return result;
95+
96+
platform_set_drvdata(pdev, acpi_dev);
97+
98+
return 0;
99+
}
100+
101+
static int dptf_power_remove(struct platform_device *pdev)
102+
{
103+
104+
sysfs_remove_group(&pdev->dev.kobj, &dptf_power_attribute_group);
105+
106+
return 0;
107+
}
108+
109+
static const struct acpi_device_id int3407_device_ids[] = {
110+
{"INT3407", 0},
111+
{"", 0},
112+
};
113+
MODULE_DEVICE_TABLE(acpi, int3407_device_ids);
114+
115+
static struct platform_driver dptf_power_driver = {
116+
.probe = dptf_power_add,
117+
.remove = dptf_power_remove,
118+
.driver = {
119+
.name = "DPTF Platform Power",
120+
.acpi_match_table = int3407_device_ids,
121+
},
122+
};
123+
124+
module_platform_driver(dptf_power_driver);
125+
126+
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
127+
MODULE_LICENSE("GPL v2");
128+
MODULE_DESCRIPTION("ACPI DPTF platform power driver");
File renamed without changes.

tools/power/acpi/Makefile.config

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
5454
# to something more interesting, like "arm-linux-". If you want
5555
# to compile vs uClibc, that can be done here as well.
5656
CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
57-
CC = $(CROSS)gcc
58-
LD = $(CROSS)gcc
59-
STRIP = $(CROSS)strip
57+
CROSS_COMPILE ?= $(CROSS)
58+
CC = $(CROSS_COMPILE)gcc
59+
LD = $(CROSS_COMPILE)gcc
60+
STRIP = $(CROSS_COMPILE)strip
6061
HOSTCC = gcc
6162

6263
# check if compiler option is supported

0 commit comments

Comments
 (0)