printf: Remove unused 'bprintf'
[drm/drm-misc.git] / include / linux / interconnect.h
blob97ac253df62c13a758e6dfbc55f90b380ee6cffe
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (c) 2018-2019, Linaro Ltd.
4 * Author: Georgi Djakov <georgi.djakov@linaro.org>
5 */
7 #ifndef __LINUX_INTERCONNECT_H
8 #define __LINUX_INTERCONNECT_H
10 #include <linux/mutex.h>
11 #include <linux/types.h>
13 /* macros for converting to icc units */
14 #define Bps_to_icc(x) ((x) / 1000)
15 #define kBps_to_icc(x) (x)
16 #define MBps_to_icc(x) ((x) * 1000)
17 #define GBps_to_icc(x) ((x) * 1000 * 1000)
18 #define bps_to_icc(x) (1)
19 #define kbps_to_icc(x) ((x) / 8 + ((x) % 8 ? 1 : 0))
20 #define Mbps_to_icc(x) ((x) * 1000 / 8)
21 #define Gbps_to_icc(x) ((x) * 1000 * 1000 / 8)
23 struct icc_path;
24 struct device;
26 /**
27 * struct icc_bulk_data - Data used for bulk icc operations.
29 * @path: reference to the interconnect path (internal use)
30 * @name: the name from the "interconnect-names" DT property
31 * @avg_bw: average bandwidth in icc units
32 * @peak_bw: peak bandwidth in icc units
34 struct icc_bulk_data {
35 struct icc_path *path;
36 const char *name;
37 u32 avg_bw;
38 u32 peak_bw;
41 #if IS_ENABLED(CONFIG_INTERCONNECT)
43 struct icc_path *of_icc_get(struct device *dev, const char *name);
44 struct icc_path *devm_of_icc_get(struct device *dev, const char *name);
45 int devm_of_icc_bulk_get(struct device *dev, int num_paths, struct icc_bulk_data *paths);
46 struct icc_path *of_icc_get_by_index(struct device *dev, int idx);
47 void icc_put(struct icc_path *path);
48 int icc_enable(struct icc_path *path);
49 int icc_disable(struct icc_path *path);
50 int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw);
51 void icc_set_tag(struct icc_path *path, u32 tag);
52 const char *icc_get_name(struct icc_path *path);
53 int __must_check of_icc_bulk_get(struct device *dev, int num_paths,
54 struct icc_bulk_data *paths);
55 void icc_bulk_put(int num_paths, struct icc_bulk_data *paths);
56 int icc_bulk_set_bw(int num_paths, const struct icc_bulk_data *paths);
57 int icc_bulk_enable(int num_paths, const struct icc_bulk_data *paths);
58 void icc_bulk_disable(int num_paths, const struct icc_bulk_data *paths);
60 #else
62 static inline struct icc_path *of_icc_get(struct device *dev,
63 const char *name)
65 return NULL;
68 static inline struct icc_path *devm_of_icc_get(struct device *dev,
69 const char *name)
71 return NULL;
74 static inline struct icc_path *of_icc_get_by_index(struct device *dev, int idx)
76 return NULL;
79 static inline void icc_put(struct icc_path *path)
83 static inline int icc_enable(struct icc_path *path)
85 return 0;
88 static inline int icc_disable(struct icc_path *path)
90 return 0;
93 static inline int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw)
95 return 0;
98 static inline void icc_set_tag(struct icc_path *path, u32 tag)
102 static inline const char *icc_get_name(struct icc_path *path)
104 return NULL;
107 static inline int of_icc_bulk_get(struct device *dev, int num_paths, struct icc_bulk_data *paths)
109 return 0;
112 static inline int devm_of_icc_bulk_get(struct device *dev, int num_paths,
113 struct icc_bulk_data *paths)
115 return 0;
118 static inline void icc_bulk_put(int num_paths, struct icc_bulk_data *paths)
122 static inline int icc_bulk_set_bw(int num_paths, const struct icc_bulk_data *paths)
124 return 0;
127 static inline int icc_bulk_enable(int num_paths, const struct icc_bulk_data *paths)
129 return 0;
132 static inline void icc_bulk_disable(int num_paths, const struct icc_bulk_data *paths)
136 #endif /* CONFIG_INTERCONNECT */
138 #endif /* __LINUX_INTERCONNECT_H */