blob: 6d31123f4d6e11889f9376742aba9f36f7c7b502 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* Copyright (c) 2012 NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef _LINUX_EDP_H
#define _LINUX_EDP_H
#include <linux/kernel.h>
#include <linux/errno.h>
#define EDP_NAME_LEN 16
struct edp_manager {
const char name[EDP_NAME_LEN];
const unsigned int imax;
/* internal */
struct list_head link;
struct list_head clients;
bool registered;
};
/*
* @states: EDP state array holding the IMAX for each state.
* This must be sorted in descending order.
* @num_states: length of the above array
* @e0_index: index of the E0 state in the above array
* Note that each EDP client is tied to a single EDP manager
*/
struct edp_client {
const char name[EDP_NAME_LEN];
const unsigned int *const states;
const unsigned int num_states;
const unsigned int e0_index;
/* internal */
struct list_head link;
struct edp_manager *manager;
};
#ifdef CONFIG_EDP_FRAMEWORK
extern int edp_register_manager(struct edp_manager *mgr);
extern int edp_unregister_manager(struct edp_manager *mgr);
extern struct edp_manager *edp_get_manager(const char *name);
extern int edp_register_client(struct edp_manager *mgr,
struct edp_client *client);
extern int edp_unregister_client(struct edp_client *client);
#else
static inline int edp_register_manager(struct edp_manager *mgr)
{ return -ENODEV; }
static inline int edp_unregister_manager(struct edp_manager *mgr)
{ return -ENODEV; }
static inline struct edp_manager *edp_get_manager(const char *name)
{ return NULL; }
static inline int edp_register_client(struct edp_manager *mgr,
struct edp_client *client)
{ return -ENODEV; }
static inline int edp_unregister_client(struct edp_client *client)
{ return -ENODEV; }
#endif
#endif
|