123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- #ifndef __LINUX_INTERCONNECT_PROVIDER_H
- #define __LINUX_INTERCONNECT_PROVIDER_H
- #include <linux/interconnect.h>
- #define icc_units_to_bps(bw) ((bw) * 1000ULL)
- struct icc_node;
- struct of_phandle_args;
- struct icc_node_data {
- struct icc_node *node;
- u32 tag;
- };
- struct icc_onecell_data {
- unsigned int num_nodes;
- struct icc_node *nodes[];
- };
- struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec,
- void *data);
- struct icc_provider {
- struct list_head provider_list;
- struct list_head nodes;
- int (*set)(struct icc_node *src, struct icc_node *dst);
- int (*aggregate)(struct icc_node *node, u32 tag, u32 avg_bw,
- u32 peak_bw, u32 *agg_avg, u32 *agg_peak);
- void (*pre_aggregate)(struct icc_node *node);
- int (*get_bw)(struct icc_node *node, u32 *avg, u32 *peak);
- struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data);
- struct icc_node_data* (*xlate_extended)(struct of_phandle_args *spec, void *data);
- struct device *dev;
- int users;
- bool inter_set;
- void *data;
- };
- struct icc_node {
- int id;
- const char *name;
- struct icc_node **links;
- size_t num_links;
- struct icc_provider *provider;
- struct list_head node_list;
- struct list_head search_list;
- struct icc_node *reverse;
- u8 is_traversed:1;
- struct hlist_head req_list;
- u32 avg_bw;
- u32 peak_bw;
- u32 init_avg;
- u32 init_peak;
- void *data;
- };
- #if IS_ENABLED(CONFIG_INTERCONNECT)
- int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
- u32 peak_bw, u32 *agg_avg, u32 *agg_peak);
- struct icc_node *icc_node_create(int id);
- void icc_node_destroy(int id);
- int icc_link_create(struct icc_node *node, const int dst_id);
- int icc_link_destroy(struct icc_node *src, struct icc_node *dst);
- void icc_node_add(struct icc_node *node, struct icc_provider *provider);
- void icc_node_del(struct icc_node *node);
- int icc_nodes_remove(struct icc_provider *provider);
- void icc_provider_init(struct icc_provider *provider);
- int icc_provider_register(struct icc_provider *provider);
- void icc_provider_deregister(struct icc_provider *provider);
- int icc_provider_add(struct icc_provider *provider);
- void icc_provider_del(struct icc_provider *provider);
- struct icc_node_data *of_icc_get_from_provider(struct of_phandle_args *spec);
- void icc_sync_state(struct device *dev);
- #else
- static inline int icc_std_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
- u32 peak_bw, u32 *agg_avg, u32 *agg_peak)
- {
- return -ENOTSUPP;
- }
- static inline struct icc_node *icc_node_create(int id)
- {
- return ERR_PTR(-ENOTSUPP);
- }
- static inline void icc_node_destroy(int id)
- {
- }
- static inline int icc_link_create(struct icc_node *node, const int dst_id)
- {
- return -ENOTSUPP;
- }
- static inline int icc_link_destroy(struct icc_node *src, struct icc_node *dst)
- {
- return -ENOTSUPP;
- }
- static inline void icc_node_add(struct icc_node *node, struct icc_provider *provider)
- {
- }
- static inline void icc_node_del(struct icc_node *node)
- {
- }
- static inline int icc_nodes_remove(struct icc_provider *provider)
- {
- return -ENOTSUPP;
- }
- static inline void icc_provider_init(struct icc_provider *provider) { }
- static inline int icc_provider_register(struct icc_provider *provider)
- {
- return -ENOTSUPP;
- }
- static inline void icc_provider_deregister(struct icc_provider *provider) { }
- static inline int icc_provider_add(struct icc_provider *provider)
- {
- return -ENOTSUPP;
- }
- static inline void icc_provider_del(struct icc_provider *provider)
- {
- }
- static inline struct icc_node_data *of_icc_get_from_provider(struct of_phandle_args *spec)
- {
- return ERR_PTR(-ENOTSUPP);
- }
- #endif
- #endif
|