Skip to content

Commit

Permalink
Merge branches 'acpi-drivers', 'acpi-misc' and 'acpi-tools'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Rafael J. Wysocki committed Jul 25, 2016
4 parents 273b5a4 + c11dd70 + c49b43c + a3bcf2d commit 54d0b14
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 13 deletions.
1 change: 1 addition & 0 deletions drivers/acpi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ config ACPI_NFIT_DEBUG
issue.

source "drivers/acpi/apei/Kconfig"
source "drivers/acpi/dptf/Kconfig"

config ACPI_EXTLOG
tristate "Extended Error Log support"
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ acpi-y += acpi_lpss.o acpi_apd.o
acpi-y += acpi_platform.o
acpi-y += acpi_pnp.o
acpi-$(CONFIG_ARM_AMBA) += acpi_amba.o
acpi-y += int340x_thermal.o
acpi-y += power.o
acpi-y += event.o
acpi-$(CONFIG_ACPI_REDUCED_HARDWARE_ONLY) += evged.o
Expand Down Expand Up @@ -104,3 +103,4 @@ obj-$(CONFIG_BXT_WC_PMIC_OPREGION) += pmic/intel_pmic_bxtwc.o
obj-$(CONFIG_ACPI_CONFIGFS) += acpi_configfs.o

video-objs += acpi_video.o video_detect.o
obj-y += dptf/
4 changes: 1 addition & 3 deletions drivers/acpi/acpi_lpat.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/module.h>
#include <linux/export.h>
#include <linux/acpi.h>
#include <acpi/acpi_lpat.h>

Expand Down Expand Up @@ -157,5 +157,3 @@ void acpi_lpat_free_conversion_table(struct acpi_lpat_conversion_table
}
}
EXPORT_SYMBOL_GPL(acpi_lpat_free_conversion_table);

MODULE_LICENSE("GPL");
7 changes: 1 addition & 6 deletions drivers/acpi/dock.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/types.h>
Expand All @@ -33,12 +33,7 @@

#include "internal.h"

#define ACPI_DOCK_DRIVER_DESCRIPTION "ACPI Dock Station Driver"

ACPI_MODULE_NAME("dock");
MODULE_AUTHOR("Kristen Carlson Accardi");
MODULE_DESCRIPTION(ACPI_DOCK_DRIVER_DESCRIPTION);
MODULE_LICENSE("GPL");

static bool immediate_undock = 1;
module_param(immediate_undock, bool, 0644);
Expand Down
15 changes: 15 additions & 0 deletions drivers/acpi/dptf/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
config DPTF_POWER
tristate "DPTF Platform Power Participant"
depends on X86
help
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:
max_platform_power
platform_power_source
adapter_rating
battery_steady_power
charger_type

To compile this driver as a module, choose M here:
the module will be called dptf_power.
4 changes: 4 additions & 0 deletions drivers/acpi/dptf/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
obj-$(CONFIG_ACPI) += int340x_thermal.o
obj-$(CONFIG_DPTF_POWER) += dptf_power.o

ccflags-y += -Idrivers/acpi
128 changes: 128 additions & 0 deletions drivers/acpi/dptf/dptf_power.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
* dptf_power: DPTF platform power driver
* Copyright (c) 2016, Intel Corporation.
*
* 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.
*
*/

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/platform_device.h>

/*
* Presentation of attributes which are defined for INT3407. They are:
* PMAX : Maximum platform powe
* PSRC : Platform power source
* ARTG : Adapter rating
* CTYP : Charger type
* PBSS : Battery steady power
*/
#define DPTF_POWER_SHOW(name, object) \
static ssize_t name##_show(struct device *dev,\
struct device_attribute *attr,\
char *buf)\
{\
struct platform_device *pdev = to_platform_device(dev);\
struct acpi_device *acpi_dev = platform_get_drvdata(pdev);\
unsigned long long val;\
acpi_status status;\
\
status = acpi_evaluate_integer(acpi_dev->handle, #object,\
NULL, &val);\
if (ACPI_SUCCESS(status))\
return sprintf(buf, "%d\n", (int)val);\
else \
return -EINVAL;\
}

DPTF_POWER_SHOW(max_platform_power_mw, PMAX)
DPTF_POWER_SHOW(platform_power_source, PSRC)
DPTF_POWER_SHOW(adapter_rating_mw, ARTG)
DPTF_POWER_SHOW(battery_steady_power_mw, PBSS)
DPTF_POWER_SHOW(charger_type, CTYP)

static DEVICE_ATTR_RO(max_platform_power_mw);
static DEVICE_ATTR_RO(platform_power_source);
static DEVICE_ATTR_RO(adapter_rating_mw);
static DEVICE_ATTR_RO(battery_steady_power_mw);
static DEVICE_ATTR_RO(charger_type);

static struct attribute *dptf_power_attrs[] = {
&dev_attr_max_platform_power_mw.attr,
&dev_attr_platform_power_source.attr,
&dev_attr_adapter_rating_mw.attr,
&dev_attr_battery_steady_power_mw.attr,
&dev_attr_charger_type.attr,
NULL
};

static struct attribute_group dptf_power_attribute_group = {
.attrs = dptf_power_attrs,
.name = "dptf_power"
};

static int dptf_power_add(struct platform_device *pdev)
{
struct acpi_device *acpi_dev;
acpi_status status;
unsigned long long ptype;
int result;

acpi_dev = ACPI_COMPANION(&(pdev->dev));
if (!acpi_dev)
return -ENODEV;

status = acpi_evaluate_integer(acpi_dev->handle, "PTYP", NULL, &ptype);
if (ACPI_FAILURE(status))
return -ENODEV;

if (ptype != 0x11)
return -ENODEV;

result = sysfs_create_group(&pdev->dev.kobj,
&dptf_power_attribute_group);
if (result)
return result;

platform_set_drvdata(pdev, acpi_dev);

return 0;
}

static int dptf_power_remove(struct platform_device *pdev)
{

sysfs_remove_group(&pdev->dev.kobj, &dptf_power_attribute_group);

return 0;
}

static const struct acpi_device_id int3407_device_ids[] = {
{"INT3407", 0},
{"", 0},
};
MODULE_DEVICE_TABLE(acpi, int3407_device_ids);

static struct platform_driver dptf_power_driver = {
.probe = dptf_power_add,
.remove = dptf_power_remove,
.driver = {
.name = "DPTF Platform Power",
.acpi_match_table = int3407_device_ids,
},
};

module_platform_driver(dptf_power_driver);

MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("ACPI DPTF platform power driver");
File renamed without changes.
7 changes: 4 additions & 3 deletions tools/power/acpi/Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
# to something more interesting, like "arm-linux-". If you want
# to compile vs uClibc, that can be done here as well.
CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
CC = $(CROSS)gcc
LD = $(CROSS)gcc
STRIP = $(CROSS)strip
CROSS_COMPILE ?= $(CROSS)
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)gcc
STRIP = $(CROSS_COMPILE)strip
HOSTCC = gcc

# check if compiler option is supported
Expand Down

0 comments on commit 54d0b14

Please sign in to comment.