pm_opp_domain.h
2.99 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* OPP Domain header for providers of platform OPP domain drivers
*
* Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __LINUX_PM_OPP_DOMAIN__
#define __LINUX_PM_OPP_DOMAIN__
#define PM_OPPDM_VOLT_PRERATE BIT(0)
#define PM_OPPDM_VOLT_POSTRATE BIT(1)
#define PM_OPPDM_VOLT_ABORTRATE BIT(2)
/**
* struct pm_opp_domain_ops - Operations functions for opp domain device
* @oppdm_get: (optional) invoked when opp domain supply is obtained.
* @oppdm_put: (optional) invoked when opp domain supply is released.
* @oppdm_latency: (optional) compute and provide opp domain
* transition latency.
* @oppdm_do_transition: (mandatory) callback for notification
* @oppdm_is_supported_voltage: (optional) return whether or not voltage
* range is possible using the opp domain
*
* These functions provide hooks for platform OPP domain drivers to
* override the default operations of an OPP domain which only
* allow a single regulator per device for OPP transitions.
*/
struct pm_opp_domain_ops {
int (*oppdm_get)(struct device *oppdm_dev,
struct device *request_dev,
struct device_node *np,
const char *supply,
void **oppdm_data);
int (*oppdm_get_latency)(struct device *oppdm_dev, void *oppdm_data,
unsigned long old_uv,
unsigned long old_uv_min,
unsigned long old_uv_max,
unsigned long new_uv,
unsigned long new_uv_min,
unsigned long new_uv_max);
int (*oppdm_do_transition)(struct device *oppdm_dev,
void *oppdm_data,
unsigned long clk_notifier_flags,
int uv, int uv_min, int uv_max);
void (*oppdm_put)(struct device *oppdm_dev,
struct device *request_dev,
void *oppdm_data);
bool (*oppdm_is_supported_voltage)(struct device *oppdm_dev,
void *oppdm_data,
unsigned long uV_min,
unsigned long uV_max);
};
/**
* struct pm_oppdm_desc - Descriptor for the voltage domain
* @ops: operations for the voltage domain
* @flags: flags controlling the various operations
*/
struct pm_opp_domain_desc {
const struct pm_opp_domain_ops *ops;
u16 flags;
};
#ifdef CONFIG_PM_OPP
struct pm_opp_domain_dev
*devm_opp_domain_register(struct device *dev,
const struct pm_opp_domain_desc *desc);
void devm_opp_domain_unregister(struct pm_opp_domain_dev *oppdm_dev);
#else
static inline struct pm_opp_domain_dev
*devm_opp_domain_register(struct device *dev,
const struct pm_opp_domain_desc *desc)
{
return -ENODEV;
}
static inline
void devm_opp_domain_unregister(struct pm_opp_domain_dev *oppdm_dev)
{
}
#endif /* CONFIG_PM_OPP */
#endif /* __LINUX_PM_OPP_DOMAIN__ */