aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/devfreq-event.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-10 18:09:41 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-10 18:09:41 -0500
commit872912352c5be930e9568e5f3b6d73107d9f278d (patch)
treeecc18608e200307588ac5130774518a54a292756 /include/linux/devfreq-event.h
parentc08f8467939e7d2eebcba7cf2330242c4f53f2f7 (diff)
parentb5e82233cab43c25fc0a1c28d9136a086db4aa52 (diff)
Merge tag 'pm+acpi-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management updates from Rafael Wysocki: "We have a few new features this time, including a new SFI-based cpufreq driver, a new devfreq driver for Tegra Activity Monitor, a new devfreq class for providing its governors with raw utilization data and a new ACPI driver for AMD SoCs. Still, the majority of changes here are reworks of existing code to make it more straightforward or to prepare it for implementing new features on top of it. The primary example is the rework of ACPI resources handling from Jiang Liu, Thomas Gleixner and Lv Zheng with support for IOAPIC hotplug implemented on top of it, but there is quite a number of changes of this kind in the cpufreq core, ACPICA, ACPI EC driver, ACPI processor driver and the generic power domains core code too. The most active developer is Viresh Kumar with his cpufreq changes. Specifics: - Rework of the core ACPI resources parsing code to fix issues in it and make using resource offsets more convenient and consolidation of some resource-handing code in a couple of places that have grown analagous data structures and code to cover the the same gap in the core (Jiang Liu, Thomas Gleixner, Lv Zheng). - ACPI-based IOAPIC hotplug support on top of the resources handling rework (Jiang Liu, Yinghai Lu). - ACPICA update to upstream release 20150204 including an interrupt handling rework that allows drivers to install raw handlers for ACPI GPEs which then become entirely responsible for the given GPE and the ACPICA core code won't touch it (Lv Zheng, David E Box, Octavian Purdila). - ACPI EC driver rework to fix several concurrency issues and other problems related to events handling on top of the ACPICA's new support for raw GPE handlers (Lv Zheng). - New ACPI driver for AMD SoCs analogous to the LPSS (Low-Power Subsystem) driver for Intel chips (Ken Xue). - Two minor fixes of the ACPI LPSS driver (Heikki Krogerus, Jarkko Nikula). - Two new blacklist entries for machines (Samsung 730U3E/740U3E and 510R) where the native backlight interface doesn't work correctly while the ACPI one does (Hans de Goede). - Rework of the ACPI processor driver's handling of idle states to make the code more straightforward and less bloated overall (Rafael J Wysocki). - Assorted minor fixes related to ACPI and SFI (Andreas Ruprecht, Andy Shevchenko, Hanjun Guo, Jan Beulich, Rafael J Wysocki, Yaowei Bai). - PCI core power management modification to avoid resuming (some) runtime-suspended devices during system suspend if they are in the right states already (Rafael J Wysocki). - New SFI-based cpufreq driver for Intel platforms using SFI (Srinidhi Kasagar). - cpufreq core fixes, cleanups and simplifications (Viresh Kumar, Doug Anderson, Wolfram Sang). - SkyLake CPU support and other updates for the intel_pstate driver (Kristen Carlson Accardi, Srinivas Pandruvada). - cpufreq-dt driver cleanup (Markus Elfring). - Init fix for the ARM big.LITTLE cpuidle driver (Sudeep Holla). - Generic power domains core code fixes and cleanups (Ulf Hansson). - Operating Performance Points (OPP) core code cleanups and kernel documentation update (Nishanth Menon). - New dabugfs interface to make the list of PM QoS constraints available to user space (Nishanth Menon). - New devfreq driver for Tegra Activity Monitor (Tomeu Vizoso). - New devfreq class (devfreq_event) to provide raw utilization data to devfreq governors (Chanwoo Choi). - Assorted minor fixes and cleanups related to power management (Andreas Ruprecht, Krzysztof Kozlowski, Rickard Strandqvist, Pavel Machek, Todd E Brandt, Wonhong Kwon). - turbostat updates (Len Brown) and cpupower Makefile improvement (Sriram Raghunathan)" * tag 'pm+acpi-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (151 commits) tools/power turbostat: relax dependency on APERF_MSR tools/power turbostat: relax dependency on invariant TSC Merge branch 'pci/host-generic' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci into acpi-resources tools/power turbostat: decode MSR_*_PERF_LIMIT_REASONS tools/power turbostat: relax dependency on root permission ACPI / video: Add disable_native_backlight quirk for Samsung 510R ACPI / PM: Remove unneeded nested #ifdef USB / PM: Remove unneeded #ifdef and associated dead code intel_pstate: provide option to only use intel_pstate with HWP ACPI / EC: Add GPE reference counting debugging messages ACPI / EC: Add query flushing support ACPI / EC: Refine command storm prevention support ACPI / EC: Add command flushing support. ACPI / EC: Introduce STARTED/STOPPED flags to replace BLOCKED flag ACPI: add AMD ACPI2Platform device support for x86 system ACPI / table: remove duplicate NULL check for the handler of acpi_table_parse() ACPI / EC: Update revision due to raw handler mode. ACPI / EC: Reduce ec_poll() by referencing the last register access timestamp. ACPI / EC: Fix several GPE handling issues by deploying ACPI_GPE_DISPATCH_RAW_HANDLER mode. ACPICA: Events: Enable APIs to allow interrupt/polling adaptive request based GPE handling model ...
Diffstat (limited to 'include/linux/devfreq-event.h')
-rw-r--r--include/linux/devfreq-event.h196
1 files changed, 196 insertions, 0 deletions
diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
new file mode 100644
index 000000000000..602fbbfcfeed
--- /dev/null
+++ b/include/linux/devfreq-event.h
@@ -0,0 +1,196 @@
1/*
2 * devfreq-event: a framework to provide raw data and events of devfreq devices
3 *
4 * Copyright (C) 2014 Samsung Electronics
5 * Author: Chanwoo Choi <cw00.choi@samsung.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#ifndef __LINUX_DEVFREQ_EVENT_H__
13#define __LINUX_DEVFREQ_EVENT_H__
14
15#include <linux/device.h>
16
17/**
18 * struct devfreq_event_dev - the devfreq-event device
19 *
20 * @node : Contain the devfreq-event device that have been registered.
21 * @dev : the device registered by devfreq-event class. dev.parent is
22 * the device using devfreq-event.
23 * @lock : a mutex to protect accessing devfreq-event.
24 * @enable_count: the number of enable function have been called.
25 * @desc : the description for devfreq-event device.
26 *
27 * This structure contains devfreq-event device information.
28 */
29struct devfreq_event_dev {
30 struct list_head node;
31
32 struct device dev;
33 struct mutex lock;
34 u32 enable_count;
35
36 const struct devfreq_event_desc *desc;
37};
38
39/**
40 * struct devfreq_event_data - the devfreq-event data
41 *
42 * @load_count : load count of devfreq-event device for the given period.
43 * @total_count : total count of devfreq-event device for the given period.
44 * each count may represent a clock cycle, a time unit
45 * (ns/us/...), or anything the device driver wants.
46 * Generally, utilization is load_count / total_count.
47 *
48 * This structure contains the data of devfreq-event device for polling period.
49 */
50struct devfreq_event_data {
51 unsigned long load_count;
52 unsigned long total_count;
53};
54
55/**
56 * struct devfreq_event_ops - the operations of devfreq-event device
57 *
58 * @enable : Enable the devfreq-event device.
59 * @disable : Disable the devfreq-event device.
60 * @reset : Reset all setting of the devfreq-event device.
61 * @set_event : Set the specific event type for the devfreq-event device.
62 * @get_event : Get the result of the devfreq-event devie with specific
63 * event type.
64 *
65 * This structure contains devfreq-event device operations which can be
66 * implemented by devfreq-event device drivers.
67 */
68struct devfreq_event_ops {
69 /* Optional functions */
70 int (*enable)(struct devfreq_event_dev *edev);
71 int (*disable)(struct devfreq_event_dev *edev);
72 int (*reset)(struct devfreq_event_dev *edev);
73
74 /* Mandatory functions */
75 int (*set_event)(struct devfreq_event_dev *edev);
76 int (*get_event)(struct devfreq_event_dev *edev,
77 struct devfreq_event_data *edata);
78};
79
80/**
81 * struct devfreq_event_desc - the descriptor of devfreq-event device
82 *
83 * @name : the name of devfreq-event device.
84 * @driver_data : the private data for devfreq-event driver.
85 * @ops : the operation to control devfreq-event device.
86 *
87 * Each devfreq-event device is described with a this structure.
88 * This structure contains the various data for devfreq-event device.
89 */
90struct devfreq_event_desc {
91 const char *name;
92 void *driver_data;
93
94 struct devfreq_event_ops *ops;
95};
96
97#if defined(CONFIG_PM_DEVFREQ_EVENT)
98extern int devfreq_event_enable_edev(struct devfreq_event_dev *edev);
99extern int devfreq_event_disable_edev(struct devfreq_event_dev *edev);
100extern bool devfreq_event_is_enabled(struct devfreq_event_dev *edev);
101extern int devfreq_event_set_event(struct devfreq_event_dev *edev);
102extern int devfreq_event_get_event(struct devfreq_event_dev *edev,
103 struct devfreq_event_data *edata);
104extern int devfreq_event_reset_event(struct devfreq_event_dev *edev);
105extern struct devfreq_event_dev *devfreq_event_get_edev_by_phandle(
106 struct device *dev, int index);
107extern int devfreq_event_get_edev_count(struct device *dev);
108extern struct devfreq_event_dev *devfreq_event_add_edev(struct device *dev,
109 struct devfreq_event_desc *desc);
110extern int devfreq_event_remove_edev(struct devfreq_event_dev *edev);
111extern struct devfreq_event_dev *devm_devfreq_event_add_edev(struct device *dev,
112 struct devfreq_event_desc *desc);
113extern void devm_devfreq_event_remove_edev(struct device *dev,
114 struct devfreq_event_dev *edev);
115static inline void *devfreq_event_get_drvdata(struct devfreq_event_dev *edev)
116{
117 return edev->desc->driver_data;
118}
119#else
120static inline int devfreq_event_enable_edev(struct devfreq_event_dev *edev)
121{
122 return -EINVAL;
123}
124
125static inline int devfreq_event_disable_edev(struct devfreq_event_dev *edev)
126{
127 return -EINVAL;
128}
129
130static inline bool devfreq_event_is_enabled(struct devfreq_event_dev *edev)
131{
132 return false;
133}
134
135static inline int devfreq_event_set_event(struct devfreq_event_dev *edev)
136{
137 return -EINVAL;
138}
139
140static inline int devfreq_event_get_event(struct devfreq_event_dev *edev,
141 struct devfreq_event_data *edata)
142{
143 return -EINVAL;
144}
145
146static inline int devfreq_event_reset_event(struct devfreq_event_dev *edev)
147{
148 return -EINVAL;
149}
150
151static inline void *devfreq_event_get_drvdata(struct devfreq_event_dev *edev)
152{
153 return ERR_PTR(-EINVAL);
154}
155
156static inline struct devfreq_event_dev *devfreq_event_get_edev_by_phandle(
157 struct device *dev, int index)
158{
159 return ERR_PTR(-EINVAL);
160}
161
162static inline int devfreq_event_get_edev_count(struct device *dev)
163{
164 return -EINVAL;
165}
166
167static inline struct devfreq_event_dev *devfreq_event_add_edev(struct device *dev,
168 struct devfreq_event_desc *desc)
169{
170 return ERR_PTR(-EINVAL);
171}
172
173static inline int devfreq_event_remove_edev(struct devfreq_event_dev *edev)
174{
175 return -EINVAL;
176}
177
178static inline struct devfreq_event_dev *devm_devfreq_event_add_edev(
179 struct device *dev,
180 struct devfreq_event_desc *desc)
181{
182 return ERR_PTR(-EINVAL);
183}
184
185static inline void devm_devfreq_event_remove_edev(struct device *dev,
186 struct devfreq_event_dev *edev)
187{
188}
189
190static inline void *devfreq_event_get_drvdata(struct devfreq_event_dev *edev)
191{
192 return NULL;
193}
194#endif /* CONFIG_PM_DEVFREQ_EVENT */
195
196#endif /* __LINUX_DEVFREQ_EVENT_H__ */