mailbox: rk3368: add mailbox and scpi function
[firefly-linux-kernel-4.4.55.git] / include / linux / rockchip / scpi.h
1 /*
2  * SCPI Message Protocol driver header
3  *
4  * Copyright (C) 2014 ARM Ltd.
5  * Copyright (C) 2014, Fuzhou Rockchip Electronics Co., Ltd
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms and conditions of the GNU General Public License,
9  * version 2, as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #include <linux/types.h>
20 #include <linux/rockchip/common.h>
21
22 #ifdef CONFIG_RK3368_SCPI_PROTOCOL
23 struct scpi_opp_entry {
24         u32 freq_hz;
25         u32 volt_mv;
26 } __packed;
27
28 struct scpi_opp {
29         struct scpi_opp_entry *opp;
30         u32 latency; /* in usecs */
31         int count;
32 } __packed;
33
34 unsigned long scpi_clk_get_val(u16 clk_id);
35 int scpi_clk_set_val(u16 clk_id, unsigned long rate);
36 int scpi_dvfs_get_idx(u8 domain);
37 int scpi_dvfs_set_idx(u8 domain, u8 idx);
38 struct scpi_opp *scpi_dvfs_get_opps(u8 domain);
39 int scpi_get_sensor(char *name);
40 int scpi_get_sensor_value(u16 sensor, u32 *val);
41 int scpi_sys_set_jtagmux_on_off(u32 en);
42 int scpi_sys_set_mcu_state_suspend(void);
43 int scpi_sys_set_mcu_state_resume(void);
44
45 int scpi_ddr_init(u32 dram_speed_bin, u32 freq, u32 lcdc_type,
46                   u32 addr_mcu_el3);
47 int scpi_ddr_set_clk_rate(u32 rate, u32 lcdc_type);
48 int scpi_ddr_send_timing(u32 *p, u32 size);
49 int scpi_ddr_round_rate(u32 m_hz);
50 int scpi_ddr_set_auto_self_refresh(u32 en);
51 int scpi_ddr_bandwidth_get(struct ddr_bw_info *ddr_bw_ch0,
52                            struct ddr_bw_info *ddr_bw_ch1);
53 int scpi_ddr_get_clk_rate(void);
54 int scpi_thermal_get_temperature(void);
55 int scpi_thermal_set_clk_cycle(u32 cycle);
56 #else
57 static inline unsigned long scpi_clk_get_val(u16 clk_id)
58 {
59         return -EPERM;
60 }
61
62 static inline int scpi_clk_set_val(u16 clk_id, unsigned long rate)
63 {
64         return -EPERM;
65 }
66
67 static inline int scpi_dvfs_get_idx(u8 domain)
68 {
69         return -EPERM;
70 }
71
72 static inline int scpi_dvfs_set_idx(u8 domain, u8 idx)
73 {
74         return -EPERM;
75 }
76
77 static inline struct scpi_opp *scpi_dvfs_get_opps(u8 domain)
78 {
79         return ERR_PTR(-EPERM);
80 }
81
82 static inline int scpi_get_sensor(char *name)
83 {
84         return -EPERM;
85 }
86
87 static inline int scpi_get_sensor_value(u16 sensor, u32 *val)
88 {
89         return -EPERM;
90 }
91
92 static int scpi_sys_set_jtagmux_on_off(u32 en)
93 {
94         return -EPERM;
95 }
96
97 static inline int scpi_sys_set_mcu_state_suspend(void)
98 {
99         return -EPERM;
100 }
101
102 static inline int scpi_sys_set_mcu_state_resume(void)
103 {
104         return -EPERM;
105 }
106
107 static inline int scpi_ddr_init(u32 dram_speed_bin, u32 freq, u32 lcdc_type,
108                                 u32 addr_mcu_el3)
109 {
110         return -EPERM;
111 }
112
113 static inline int scpi_ddr_set_clk_rate(u32 rate, u32 lcdc_type)
114 {
115         return -EPERM;
116 }
117
118 static inline int scpi_ddr_send_timing(u32 *p, u32 size)
119 {
120         return -EPERM;
121 }
122
123 static inline int scpi_ddr_round_rate(u32 m_hz)
124 {
125         return -EPERM;
126 }
127
128 static inline int scpi_ddr_set_auto_self_refresh(u32 en)
129 {
130         return -EPERM;
131 }
132
133 static inline int scpi_ddr_bandwidth_get(struct ddr_bw_info *ddr_bw_ch0,
134                                          struct ddr_bw_info *ddr_bw_ch1)
135 {
136         return -EPERM;
137 }
138
139 static inline int scpi_ddr_get_clk_rate(void)
140 {
141         return -EPERM;
142 }
143
144 static inline int scpi_thermal_get_temperature(void)
145 {
146         return -EPERM;
147 }
148
149 static inline int scpi_thermal_set_clk_cycle(u32 cycle)
150 {
151         return -EPERM;
152 }
153 #endif