aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-24 18:51:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-24 18:51:02 -0500
commit09da8dfa98682d871987145ed11e3232accac860 (patch)
tree152a9bb1e52f70db6efb66fffbdc4871f749d7df /drivers/base
parent3aacd625f20129f5a41ea3ff3b5353b0e4dabd01 (diff)
parent7744064731a9543105e207504e0262f883bc14c0 (diff)
Merge tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management updates from Rafael Wysocki: "As far as the number of commits goes, the top spot belongs to ACPI this time with cpufreq in the second position and a handful of PM core, PNP and cpuidle updates. They are fixes and cleanups mostly, as usual, with a couple of new features in the mix. The most visible change is probably that we will create struct acpi_device objects (visible in sysfs) for all devices represented in the ACPI tables regardless of their status and there will be a new sysfs attribute under those objects allowing user space to check that status via _STA. Consequently, ACPI device eject or generally hot-removal will not delete those objects, unless the table containing the corresponding namespace nodes is unloaded, which is extremely rare. Also ACPI container hotplug will be handled quite a bit differently and cpufreq will support CPU boost ("turbo") generically and not only in the acpi-cpufreq driver. Specifics: - ACPI core changes to make it create a struct acpi_device object for every device represented in the ACPI tables during all namespace scans regardless of the current status of that device. In accordance with this, ACPI hotplug operations will not delete those objects, unless the underlying ACPI tables go away. - On top of the above, new sysfs attribute for ACPI device objects allowing user space to check device status by triggering the execution of _STA for its ACPI object. From Srinivas Pandruvada. - ACPI core hotplug changes reducing code duplication, integrating the PCI root hotplug with the core and reworking container hotplug. - ACPI core simplifications making it use ACPI_COMPANION() in the code "glueing" ACPI device objects to "physical" devices. - ACPICA update to upstream version 20131218. This adds support for the DBG2 and PCCT tables to ACPICA, fixes some bugs and improves debug facilities. From Bob Moore, Lv Zheng and Betty Dall. - Init code change to carry out the early ACPI initialization earlier. That should allow us to use ACPI during the timekeeping initialization and possibly to simplify the EFI initialization too. From Chun-Yi Lee. - Clenups of the inclusions of ACPI headers in many places all over from Lv Zheng and Rashika Kheria (work in progress). - New helper for ACPI _DSM execution and rework of the code in drivers that uses _DSM to execute it via the new helper. From Jiang Liu. - New Win8 OSI blacklist entries from Takashi Iwai. - Assorted ACPI fixes and cleanups from Al Stone, Emil Goode, Hanjun Guo, Lan Tianyu, Masanari Iida, Oliver Neukum, Prarit Bhargava, Rashika Kheria, Tang Chen, Zhang Rui. - intel_pstate driver updates, including proper Baytrail support, from Dirk Brandewie and intel_pstate documentation from Ramkumar Ramachandra. - Generic CPU boost ("turbo") support for cpufreq from Lukasz Majewski. - powernow-k6 cpufreq driver fixes from Mikulas Patocka. - cpufreq core fixes and cleanups from Viresh Kumar, Jane Li, Mark Brown. - Assorted cpufreq drivers fixes and cleanups from Anson Huang, John Tobias, Paul Bolle, Paul Walmsley, Sachin Kamat, Shawn Guo, Viresh Kumar. - cpuidle cleanups from Bartlomiej Zolnierkiewicz. - Support for hibernation APM events from Bin Shi. - Hibernation fix to avoid bringing up nonboot CPUs with ACPI EC disabled during thaw transitions from Bjørn Mork. - PM core fixes and cleanups from Ben Dooks, Leonardo Potenza, Ulf Hansson. - PNP subsystem fixes and cleanups from Dmitry Torokhov, Levente Kurusa, Rashika Kheria. - New tool for profiling system suspend from Todd E Brandt and a cpupower tool cleanup from One Thousand Gnomes" * tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (153 commits) thermal: exynos: boost: Automatic enable/disable of BOOST feature (at Exynos4412) cpufreq: exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Documentation: cpufreq / boost: Update BOOST documentation cpufreq: exynos: Extend Exynos cpufreq driver to support boost cpufreq / boost: Kconfig: Support for software-managed BOOST acpi-cpufreq: Adjust the code to use the common boost attribute cpufreq: Add boost frequency support in core intel_pstate: Add trace point to report internal state. cpufreq: introduce cpufreq_generic_get() routine ARM: SA1100: Create dummy clk_get_rate() to avoid build failures cpufreq: stats: create sysfs entries when cpufreq_stats is a module cpufreq: stats: free table and remove sysfs entry in a single routine cpufreq: stats: remove hotplug notifiers cpufreq: stats: handle cpufreq_unregister_driver() and suspend/resume properly cpufreq: speedstep: remove unused speedstep_get_state platform: introduce OF style 'modalias' support for platform bus PM / tools: new tool for suspend/resume performance optimization ACPI: fix module autoloading for ACPI enumerated devices ACPI: add module autoloading support for ACPI enumerated devices ACPI: fix create_modalias() return value handling ...
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/Makefile2
-rw-r--r--drivers/base/base.h1
-rw-r--r--drivers/base/container.c44
-rw-r--r--drivers/base/init.c1
-rw-r--r--drivers/base/platform.c16
-rw-r--r--drivers/base/power/clock_ops.c30
-rw-r--r--drivers/base/power/generic_ops.c4
7 files changed, 89 insertions, 9 deletions
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index 870ecfd503af..04b314e0fa51 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -4,7 +4,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \
4 driver.o class.o platform.o \ 4 driver.o class.o platform.o \
5 cpu.o firmware.o init.o map.o devres.o \ 5 cpu.o firmware.o init.o map.o devres.o \
6 attribute_container.o transport_class.o \ 6 attribute_container.o transport_class.o \
7 topology.o 7 topology.o container.o
8obj-$(CONFIG_DEVTMPFS) += devtmpfs.o 8obj-$(CONFIG_DEVTMPFS) += devtmpfs.o
9obj-$(CONFIG_DMA_CMA) += dma-contiguous.o 9obj-$(CONFIG_DMA_CMA) += dma-contiguous.o
10obj-y += power/ 10obj-y += power/
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 2cbc6774f4cd..24f424249d9b 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -100,6 +100,7 @@ static inline int hypervisor_init(void) { return 0; }
100#endif 100#endif
101extern int platform_bus_init(void); 101extern int platform_bus_init(void);
102extern void cpu_dev_init(void); 102extern void cpu_dev_init(void);
103extern void container_dev_init(void);
103 104
104struct kobject *virtual_device_parent(struct device *dev); 105struct kobject *virtual_device_parent(struct device *dev);
105 106
diff --git a/drivers/base/container.c b/drivers/base/container.c
new file mode 100644
index 000000000000..ecbfbe2e908f
--- /dev/null
+++ b/drivers/base/container.c
@@ -0,0 +1,44 @@
1/*
2 * System bus type for containers.
3 *
4 * Copyright (C) 2013, Intel Corporation
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/container.h>
13
14#include "base.h"
15
16#define CONTAINER_BUS_NAME "container"
17
18static int trivial_online(struct device *dev)
19{
20 return 0;
21}
22
23static int container_offline(struct device *dev)
24{
25 struct container_dev *cdev = to_container_dev(dev);
26
27 return cdev->offline ? cdev->offline(cdev) : 0;
28}
29
30struct bus_type container_subsys = {
31 .name = CONTAINER_BUS_NAME,
32 .dev_name = CONTAINER_BUS_NAME,
33 .online = trivial_online,
34 .offline = container_offline,
35};
36
37void __init container_dev_init(void)
38{
39 int ret;
40
41 ret = subsys_system_register(&container_subsys, NULL);
42 if (ret)
43 pr_err("%s() failed: %d\n", __func__, ret);
44}
diff --git a/drivers/base/init.c b/drivers/base/init.c
index c16f0b808a17..da033d3bab3c 100644
--- a/drivers/base/init.c
+++ b/drivers/base/init.c
@@ -33,4 +33,5 @@ void __init driver_init(void)
33 platform_bus_init(); 33 platform_bus_init();
34 cpu_dev_init(); 34 cpu_dev_init();
35 memory_dev_init(); 35 memory_dev_init();
36 container_dev_init();
36} 37}
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 3a94b799f166..bc78848dd59a 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -677,7 +677,17 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
677 char *buf) 677 char *buf)
678{ 678{
679 struct platform_device *pdev = to_platform_device(dev); 679 struct platform_device *pdev = to_platform_device(dev);
680 int len = snprintf(buf, PAGE_SIZE, "platform:%s\n", pdev->name); 680 int len;
681
682 len = of_device_get_modalias(dev, buf, PAGE_SIZE -1);
683 if (len != -ENODEV)
684 return len;
685
686 len = acpi_device_modalias(dev, buf, PAGE_SIZE -1);
687 if (len != -ENODEV)
688 return len;
689
690 len = snprintf(buf, PAGE_SIZE, "platform:%s\n", pdev->name);
681 691
682 return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; 692 return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
683} 693}
@@ -699,6 +709,10 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
699 if (rc != -ENODEV) 709 if (rc != -ENODEV)
700 return rc; 710 return rc;
701 711
712 rc = acpi_device_uevent_modalias(dev, env);
713 if (rc != -ENODEV)
714 return rc;
715
702 add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX, 716 add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX,
703 pdev->name); 717 pdev->name);
704 return 0; 718 return 0;
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index 9d8fde709390..e870bbe9ec4e 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -33,6 +33,21 @@ struct pm_clock_entry {
33}; 33};
34 34
35/** 35/**
36 * pm_clk_enable - Enable a clock, reporting any errors
37 * @dev: The device for the given clock
38 * @clk: The clock being enabled.
39 */
40static inline int __pm_clk_enable(struct device *dev, struct clk *clk)
41{
42 int ret = clk_enable(clk);
43 if (ret)
44 dev_err(dev, "%s: failed to enable clk %p, error %d\n",
45 __func__, clk, ret);
46
47 return ret;
48}
49
50/**
36 * pm_clk_acquire - Acquire a device clock. 51 * pm_clk_acquire - Acquire a device clock.
37 * @dev: Device whose clock is to be acquired. 52 * @dev: Device whose clock is to be acquired.
38 * @ce: PM clock entry corresponding to the clock. 53 * @ce: PM clock entry corresponding to the clock.
@@ -43,6 +58,7 @@ static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce)
43 if (IS_ERR(ce->clk)) { 58 if (IS_ERR(ce->clk)) {
44 ce->status = PCE_STATUS_ERROR; 59 ce->status = PCE_STATUS_ERROR;
45 } else { 60 } else {
61 clk_prepare(ce->clk);
46 ce->status = PCE_STATUS_ACQUIRED; 62 ce->status = PCE_STATUS_ACQUIRED;
47 dev_dbg(dev, "Clock %s managed by runtime PM.\n", ce->con_id); 63 dev_dbg(dev, "Clock %s managed by runtime PM.\n", ce->con_id);
48 } 64 }
@@ -99,10 +115,12 @@ static void __pm_clk_remove(struct pm_clock_entry *ce)
99 115
100 if (ce->status < PCE_STATUS_ERROR) { 116 if (ce->status < PCE_STATUS_ERROR) {
101 if (ce->status == PCE_STATUS_ENABLED) 117 if (ce->status == PCE_STATUS_ENABLED)
102 clk_disable_unprepare(ce->clk); 118 clk_disable(ce->clk);
103 119
104 if (ce->status >= PCE_STATUS_ACQUIRED) 120 if (ce->status >= PCE_STATUS_ACQUIRED) {
121 clk_unprepare(ce->clk);
105 clk_put(ce->clk); 122 clk_put(ce->clk);
123 }
106 } 124 }
107 125
108 kfree(ce->con_id); 126 kfree(ce->con_id);
@@ -249,6 +267,7 @@ int pm_clk_resume(struct device *dev)
249 struct pm_subsys_data *psd = dev_to_psd(dev); 267 struct pm_subsys_data *psd = dev_to_psd(dev);
250 struct pm_clock_entry *ce; 268 struct pm_clock_entry *ce;
251 unsigned long flags; 269 unsigned long flags;
270 int ret;
252 271
253 dev_dbg(dev, "%s()\n", __func__); 272 dev_dbg(dev, "%s()\n", __func__);
254 273
@@ -259,8 +278,9 @@ int pm_clk_resume(struct device *dev)
259 278
260 list_for_each_entry(ce, &psd->clock_list, node) { 279 list_for_each_entry(ce, &psd->clock_list, node) {
261 if (ce->status < PCE_STATUS_ERROR) { 280 if (ce->status < PCE_STATUS_ERROR) {
262 clk_enable(ce->clk); 281 ret = __pm_clk_enable(dev, ce->clk);
263 ce->status = PCE_STATUS_ENABLED; 282 if (!ret)
283 ce->status = PCE_STATUS_ENABLED;
264 } 284 }
265 } 285 }
266 286
@@ -376,7 +396,7 @@ int pm_clk_resume(struct device *dev)
376 spin_lock_irqsave(&psd->lock, flags); 396 spin_lock_irqsave(&psd->lock, flags);
377 397
378 list_for_each_entry(ce, &psd->clock_list, node) 398 list_for_each_entry(ce, &psd->clock_list, node)
379 clk_enable(ce->clk); 399 __pm_clk_enable(dev, ce->clk);
380 400
381 spin_unlock_irqrestore(&psd->lock, flags); 401 spin_unlock_irqrestore(&psd->lock, flags);
382 402
diff --git a/drivers/base/power/generic_ops.c b/drivers/base/power/generic_ops.c
index 5ee030a864f9..a2e55bfdf572 100644
--- a/drivers/base/power/generic_ops.c
+++ b/drivers/base/power/generic_ops.c
@@ -10,7 +10,7 @@
10#include <linux/pm_runtime.h> 10#include <linux/pm_runtime.h>
11#include <linux/export.h> 11#include <linux/export.h>
12 12
13#ifdef CONFIG_PM_RUNTIME 13#ifdef CONFIG_PM
14/** 14/**
15 * pm_generic_runtime_suspend - Generic runtime suspend callback for subsystems. 15 * pm_generic_runtime_suspend - Generic runtime suspend callback for subsystems.
16 * @dev: Device to suspend. 16 * @dev: Device to suspend.
@@ -48,7 +48,7 @@ int pm_generic_runtime_resume(struct device *dev)
48 return ret; 48 return ret;
49} 49}
50EXPORT_SYMBOL_GPL(pm_generic_runtime_resume); 50EXPORT_SYMBOL_GPL(pm_generic_runtime_resume);
51#endif /* CONFIG_PM_RUNTIME */ 51#endif /* CONFIG_PM */
52 52
53#ifdef CONFIG_PM_SLEEP 53#ifdef CONFIG_PM_SLEEP
54/** 54/**