Georgi Djakov | 11f1cec | 2019-01-16 18:10:56 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Copyright (c) 2018-2019, Linaro Ltd. |
| 4 | * Author: Georgi Djakov <georgi.djakov@linaro.org> |
| 5 | */ |
| 6 | |
| 7 | #ifndef __LINUX_INTERCONNECT_H |
| 8 | #define __LINUX_INTERCONNECT_H |
| 9 | |
| 10 | #include <linux/mutex.h> |
| 11 | #include <linux/types.h> |
| 12 | |
| 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) |
| 22 | |
| 23 | struct icc_path; |
| 24 | struct device; |
| 25 | |
| 26 | #if IS_ENABLED(CONFIG_INTERCONNECT) |
| 27 | |
| 28 | struct icc_path *icc_get(struct device *dev, const int src_id, |
| 29 | const int dst_id); |
| 30 | void icc_put(struct icc_path *path); |
| 31 | int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw); |
| 32 | |
| 33 | #else |
| 34 | |
| 35 | static inline struct icc_path *icc_get(struct device *dev, const int src_id, |
| 36 | const int dst_id) |
| 37 | { |
| 38 | return NULL; |
| 39 | } |
| 40 | |
| 41 | static inline void icc_put(struct icc_path *path) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | static inline int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) |
| 46 | { |
| 47 | return 0; |
| 48 | } |
| 49 | |
| 50 | #endif /* CONFIG_INTERCONNECT */ |
| 51 | |
| 52 | #endif /* __LINUX_INTERCONNECT_H */ |