blob: 1cc83faa6111455f17f2181d134762af2d705efb [file] [log] [blame]
David Dai04ce4202016-09-26 16:24:13 -07001/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _ARCH_ARM_MACH_MSM_BUS_RULES_H
14#define _ARCH_ARM_MACH_MSM_BUS_RULES_H
15
16#include <linux/types.h>
17#include <linux/list.h>
18#include <linux/notifier.h>
19#include <dt-bindings/msm/msm-bus-rule-ops.h>
20
21#define MAX_NODES (5)
22
23struct rule_update_path_info {
24 u32 id;
25 u64 ab;
26 u64 ib;
27 u64 clk;
28 bool added;
29 struct list_head link;
30};
31
32struct rule_apply_rcm_info {
33 u32 id;
34 u64 lim_bw;
35 int throttle;
36 bool after_clk_commit;
37 struct list_head link;
38};
39
40struct bus_rule_type {
41 int num_src;
42 int *src_id;
43 int src_field;
44 int op;
45 u64 thresh;
46 int num_dst;
47 int *dst_node;
48 u64 dst_bw;
49 int mode;
50 void *client_data;
51};
52
53void msm_rule_register(int num_rules, struct bus_rule_type *rule,
54 struct notifier_block *nb);
55void msm_rule_unregister(int num_rules, struct bus_rule_type *rule,
56 struct notifier_block *nb);
57bool msm_rule_update(struct bus_rule_type *old_rule,
58 struct bus_rule_type *new_rule,
59 struct notifier_block *nb);
60void msm_rule_evaluate_rules(int node);
61void print_rules_buf(char *buf, int count);
62bool msm_rule_are_rules_registered(void);
63#endif /* _ARCH_ARM_MACH_MSM_BUS_RULES_H */