1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 2 /* 3 * Copyright (c) 2018-2019, Linaro Ltd. 3 * Copyright (c) 2018-2019, Linaro Ltd. 4 * Author: Georgi Djakov <georgi.djakov@linaro 4 * Author: Georgi Djakov <georgi.djakov@linaro.org> 5 */ 5 */ 6 6 7 #ifndef __LINUX_INTERCONNECT_H 7 #ifndef __LINUX_INTERCONNECT_H 8 #define __LINUX_INTERCONNECT_H 8 #define __LINUX_INTERCONNECT_H 9 9 10 #include <linux/mutex.h> 10 #include <linux/mutex.h> 11 #include <linux/types.h> 11 #include <linux/types.h> 12 12 13 /* macros for converting to icc units */ 13 /* macros for converting to icc units */ 14 #define Bps_to_icc(x) ((x) / 1000) 14 #define Bps_to_icc(x) ((x) / 1000) 15 #define kBps_to_icc(x) (x) 15 #define kBps_to_icc(x) (x) 16 #define MBps_to_icc(x) ((x) * 1000) 16 #define MBps_to_icc(x) ((x) * 1000) 17 #define GBps_to_icc(x) ((x) * 1000 * 1000) 17 #define GBps_to_icc(x) ((x) * 1000 * 1000) 18 #define bps_to_icc(x) (1) 18 #define bps_to_icc(x) (1) 19 #define kbps_to_icc(x) ((x) / 8 + ((x) % 8 ? 19 #define kbps_to_icc(x) ((x) / 8 + ((x) % 8 ? 1 : 0)) 20 #define Mbps_to_icc(x) ((x) * 1000 / 8) 20 #define Mbps_to_icc(x) ((x) * 1000 / 8) 21 #define Gbps_to_icc(x) ((x) * 1000 * 1000 / 8 21 #define Gbps_to_icc(x) ((x) * 1000 * 1000 / 8) 22 22 23 struct icc_path; 23 struct icc_path; 24 struct device; 24 struct device; 25 25 26 /** << 27 * struct icc_bulk_data - Data used for bulk i << 28 * << 29 * @path: reference to the interconnect path ( << 30 * @name: the name from the "interconnect-name << 31 * @avg_bw: average bandwidth in icc units << 32 * @peak_bw: peak bandwidth in icc units << 33 */ << 34 struct icc_bulk_data { << 35 struct icc_path *path; << 36 const char *name; << 37 u32 avg_bw; << 38 u32 peak_bw; << 39 }; << 40 << 41 #if IS_ENABLED(CONFIG_INTERCONNECT) 26 #if IS_ENABLED(CONFIG_INTERCONNECT) 42 27 >> 28 struct icc_path *icc_get(struct device *dev, const int src_id, >> 29 const int dst_id); 43 struct icc_path *of_icc_get(struct device *dev 30 struct icc_path *of_icc_get(struct device *dev, const char *name); 44 struct icc_path *devm_of_icc_get(struct device << 45 int devm_of_icc_bulk_get(struct device *dev, i << 46 struct icc_path *of_icc_get_by_index(struct de << 47 void icc_put(struct icc_path *path); 31 void icc_put(struct icc_path *path); 48 int icc_enable(struct icc_path *path); 32 int icc_enable(struct icc_path *path); 49 int icc_disable(struct icc_path *path); 33 int icc_disable(struct icc_path *path); 50 int icc_set_bw(struct icc_path *path, u32 avg_ 34 int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw); 51 void icc_set_tag(struct icc_path *path, u32 ta 35 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 << 54 struct icc_bu << 55 void icc_bulk_put(int num_paths, struct icc_bu << 56 int icc_bulk_set_bw(int num_paths, const struc << 57 int icc_bulk_enable(int num_paths, const struc << 58 void icc_bulk_disable(int num_paths, const str << 59 36 60 #else 37 #else 61 38 62 static inline struct icc_path *of_icc_get(stru !! 39 static inline struct icc_path *icc_get(struct device *dev, const int src_id, 63 cons !! 40 const int dst_id) 64 { 41 { 65 return NULL; 42 return NULL; 66 } 43 } 67 44 68 static inline struct icc_path *devm_of_icc_get !! 45 static inline struct icc_path *of_icc_get(struct device *dev, 69 !! 46 const char *name) 70 { << 71 return NULL; << 72 } << 73 << 74 static inline struct icc_path *of_icc_get_by_i << 75 { 47 { 76 return NULL; 48 return NULL; 77 } 49 } 78 50 79 static inline void icc_put(struct icc_path *pa 51 static inline void icc_put(struct icc_path *path) 80 { 52 { 81 } 53 } 82 54 83 static inline int icc_enable(struct icc_path * 55 static inline int icc_enable(struct icc_path *path) 84 { 56 { 85 return 0; 57 return 0; 86 } 58 } 87 59 88 static inline int icc_disable(struct icc_path 60 static inline int icc_disable(struct icc_path *path) 89 { 61 { 90 return 0; 62 return 0; 91 } 63 } 92 64 93 static inline int icc_set_bw(struct icc_path * 65 static inline int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) 94 { 66 { 95 return 0; 67 return 0; 96 } 68 } 97 69 98 static inline void icc_set_tag(struct icc_path 70 static inline void icc_set_tag(struct icc_path *path, u32 tag) 99 { << 100 } << 101 << 102 static inline const char *icc_get_name(struct << 103 { << 104 return NULL; << 105 } << 106 << 107 static inline int of_icc_bulk_get(struct devic << 108 { << 109 return 0; << 110 } << 111 << 112 static inline int devm_of_icc_bulk_get(struct << 113 struct << 114 { << 115 return 0; << 116 } << 117 << 118 static inline void icc_bulk_put(int num_paths, << 119 { << 120 } << 121 << 122 static inline int icc_bulk_set_bw(int num_path << 123 { << 124 return 0; << 125 } << 126 << 127 static inline int icc_bulk_enable(int num_path << 128 { << 129 return 0; << 130 } << 131 << 132 static inline void icc_bulk_disable(int num_pa << 133 { 71 { 134 } 72 } 135 73 136 #endif /* CONFIG_INTERCONNECT */ 74 #endif /* CONFIG_INTERCONNECT */ 137 75 138 #endif /* __LINUX_INTERCONNECT_H */ 76 #endif /* __LINUX_INTERCONNECT_H */ 139 77
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.