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