Blame view

kernel/linux-rt-4.4.41/drivers/base/power/opp/domain.h 2.86 KB
5113f6f70   김현기   kernel add
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
  /*
   * Generic OPP Domain Private
   *
   * Copyright (C) 2016 Texas Instruments Incorporated.
   *	Dave Gerlach
   *
   * 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.
   */
  
  #ifndef __DRIVER_OPP_DOMAIN_H__
  #define __DRIVER_OPP_DOMAIN_H__
  
  #include <linux/clk.h>
  #include <linux/err.h>
  #include <linux/pm_opp.h>
  
  struct pm_opp_domain_desc;
  
  /**
   * struct pm_opp_domain_dev - internal representation of opp domain devices
   * @dev:	voltage domain device
   * @node:	list to remaining voltage domain devices
   * @node:	mutex to control data structure modifications and serialize ops
   */
  struct pm_opp_domain_dev {
  	const struct pm_opp_domain_desc *desc;
  	struct device *dev;
  	struct list_head node;
  };
  
  /**
   * struct pm_opp_domain - Structure to maintain opp domain info
   * @dev:        device for which we scale clk and supply
   * @clk:        clk which we must scale
   * @reg:        regulator, if any, which is used for scaling voltage
   * @data: opp_domain driver specific data
   */
  struct pm_opp_domain {
  	struct device *dev;
  	struct clk *clk;
  	struct regulator *reg;
  	struct pm_opp_domain_dev *oppdm_dev;
  	void *data;
  };
  
  #if defined(CONFIG_PM_OPP)
  int dev_pm_opp_domain_set_rate(struct pm_opp_domain *pod,
  			       unsigned long target_freq);
  
  struct pm_opp_domain *dev_pm_opp_domain_get(struct device *dev);
  int dev_pm_opp_domain_put(struct pm_opp_domain *pod);
  
  int dev_pm_opp_domain_get_supply(struct pm_opp_domain *pod,
  				 const char *supply);
  void dev_pm_opp_domain_put_supply(struct pm_opp_domain *pod);
  
  int dev_pm_opp_domain_get_latency(struct pm_opp_domain *pod, int old_uV,
  				  int old_uV_min, int old_uV_max, int new_uV,
  				  int new_uV_min, int new_uV_max);
  bool dev_pm_opp_domain_opp_supported_by_supply(struct pm_opp_domain *pod,
  					       unsigned long uV_min,
  					       unsigned long uV_max);
  #else
  static inline int dev_pm_opp_domain_set_rate(struct pm_opp_domain *pod,
  					     unsigned long target_freq)
  {
  	return -ENODEV;
  }
  
  static inline struct pm_opp_domain *dev_pm_opp_domain_get(struct device *dev,
  							  const char *supply)
  {
  	return NULL;
  }
  
  static inline void dev_pm_opp_domain_put(struct pm_opp_domain *pod)
  {
  }
  
  static inline int dev_pm_opp_domain_get_supply(struct pm_opp_domain *pod,
  					       const char *supply)
  {
  	return -ENODEV;
  }
  
  static inline void dev_pm_opp_domain_put_supply(struct pm_opp_domain *pod)
  {
  }
  
  static inline int dev_pm_opp_domain_get_latency(struct pm_opp_domain *pod,
  						int old_uV, int old_uV_min,
  						int old_uV_max, int new_uV,
  						int new_uV_min, int new_uV_max)
  
  {
  	return -ENODEV;
  }
  
  static inline
  bool dev_pm_opp_domain_opp_supported_by_supply(struct pm_opp_domain *pod,
  					       unsigned long uV_min,
  					       unsigned long uV_max)
  {
  	return false;
  }
  #endif /* CONFIG_PM_OPP */
  #endif /* __DRIVER_OPP_DOMAIN_H__ */