~ubuntu-branches/debian/experimental/linux-tools/experimental

« back to all changes in this revision

Viewing changes to include/linux/opp.h

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings
  • Date: 2014-02-02 16:57:49 UTC
  • mfrom: (1.1.10) (0.1.21 sid)
  • Revision ID: package-import@ubuntu.com-20140202165749-tw94o9t1t0a8txk6
Tags: 3.13-1~exp2
Merge changes from sid up to 3.12.6-3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Generic OPP Interface
3
 
 *
4
 
 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
5
 
 *      Nishanth Menon
6
 
 *      Romit Dasgupta
7
 
 *      Kevin Hilman
8
 
 *
9
 
 * This program is free software; you can redistribute it and/or modify
10
 
 * it under the terms of the GNU General Public License version 2 as
11
 
 * published by the Free Software Foundation.
12
 
 */
13
 
 
14
 
#ifndef __LINUX_OPP_H__
15
 
#define __LINUX_OPP_H__
16
 
 
17
 
#include <linux/err.h>
18
 
#include <linux/cpufreq.h>
19
 
#include <linux/notifier.h>
20
 
 
21
 
struct opp;
22
 
struct device;
23
 
 
24
 
enum opp_event {
25
 
        OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
26
 
};
27
 
 
28
 
#if defined(CONFIG_PM_OPP)
29
 
 
30
 
unsigned long opp_get_voltage(struct opp *opp);
31
 
 
32
 
unsigned long opp_get_freq(struct opp *opp);
33
 
 
34
 
int opp_get_opp_count(struct device *dev);
35
 
 
36
 
struct opp *opp_find_freq_exact(struct device *dev, unsigned long freq,
37
 
                                bool available);
38
 
 
39
 
struct opp *opp_find_freq_floor(struct device *dev, unsigned long *freq);
40
 
 
41
 
struct opp *opp_find_freq_ceil(struct device *dev, unsigned long *freq);
42
 
 
43
 
int opp_add(struct device *dev, unsigned long freq, unsigned long u_volt);
44
 
 
45
 
int opp_enable(struct device *dev, unsigned long freq);
46
 
 
47
 
int opp_disable(struct device *dev, unsigned long freq);
48
 
 
49
 
struct srcu_notifier_head *opp_get_notifier(struct device *dev);
50
 
#else
51
 
static inline unsigned long opp_get_voltage(struct opp *opp)
52
 
{
53
 
        return 0;
54
 
}
55
 
 
56
 
static inline unsigned long opp_get_freq(struct opp *opp)
57
 
{
58
 
        return 0;
59
 
}
60
 
 
61
 
static inline int opp_get_opp_count(struct device *dev)
62
 
{
63
 
        return 0;
64
 
}
65
 
 
66
 
static inline struct opp *opp_find_freq_exact(struct device *dev,
67
 
                                        unsigned long freq, bool available)
68
 
{
69
 
        return ERR_PTR(-EINVAL);
70
 
}
71
 
 
72
 
static inline struct opp *opp_find_freq_floor(struct device *dev,
73
 
                                        unsigned long *freq)
74
 
{
75
 
        return ERR_PTR(-EINVAL);
76
 
}
77
 
 
78
 
static inline struct opp *opp_find_freq_ceil(struct device *dev,
79
 
                                        unsigned long *freq)
80
 
{
81
 
        return ERR_PTR(-EINVAL);
82
 
}
83
 
 
84
 
static inline int opp_add(struct device *dev, unsigned long freq,
85
 
                                        unsigned long u_volt)
86
 
{
87
 
        return -EINVAL;
88
 
}
89
 
 
90
 
static inline int opp_enable(struct device *dev, unsigned long freq)
91
 
{
92
 
        return 0;
93
 
}
94
 
 
95
 
static inline int opp_disable(struct device *dev, unsigned long freq)
96
 
{
97
 
        return 0;
98
 
}
99
 
 
100
 
static inline struct srcu_notifier_head *opp_get_notifier(struct device *dev)
101
 
{
102
 
        return ERR_PTR(-EINVAL);
103
 
}
104
 
#endif          /* CONFIG_PM_OPP */
105
 
 
106
 
#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
107
 
int of_init_opp_table(struct device *dev);
108
 
#else
109
 
static inline int of_init_opp_table(struct device *dev)
110
 
{
111
 
        return -EINVAL;
112
 
}
113
 
#endif
114
 
 
115
 
#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
116
 
int opp_init_cpufreq_table(struct device *dev,
117
 
                            struct cpufreq_frequency_table **table);
118
 
void opp_free_cpufreq_table(struct device *dev,
119
 
                                struct cpufreq_frequency_table **table);
120
 
#else
121
 
static inline int opp_init_cpufreq_table(struct device *dev,
122
 
                            struct cpufreq_frequency_table **table)
123
 
{
124
 
        return -EINVAL;
125
 
}
126
 
 
127
 
static inline
128
 
void opp_free_cpufreq_table(struct device *dev,
129
 
                                struct cpufreq_frequency_table **table)
130
 
{
131
 
}
132
 
#endif          /* CONFIG_CPU_FREQ */
133
 
 
134
 
#endif          /* __LINUX_OPP_H__ */