• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifdef CONFIG_RK3368_SCPI_PROTOCOL
18 struct scpi_opp_entry {
19 	u32 freq_hz;
20 	u32 volt_mv;
21 } __packed;
22 
23 struct scpi_opp {
24 	struct scpi_opp_entry *opp;
25 	u32 latency; /* in usecs */
26 	int count;
27 } __packed;
28 
29 unsigned long scpi_clk_get_val(u16 clk_id);
30 int scpi_clk_set_val(u16 clk_id, unsigned long rate);
31 int scpi_dvfs_get_idx(u8 domain);
32 int scpi_dvfs_set_idx(u8 domain, u8 idx);
33 struct scpi_opp *scpi_dvfs_get_opps(u8 domain);
34 int scpi_get_sensor(char *name);
35 int scpi_get_sensor_value(u16 sensor, u32 *val);
36 int scpi_sys_set_jtagmux_on_off(u32 en);
37 int scpi_sys_set_mcu_state_suspend(void);
38 int scpi_sys_set_mcu_state_resume(void);
39 
40 int scpi_ddr_dclk_mode(u32 dclk_mode);
41 int scpi_ddr_init(u32 dram_speed_bin, u32 freq, u32 lcdc_type,
42 		  u32 addr_mcu_el3);
43 int scpi_ddr_set_clk_rate(u32 rate, u32 lcdc_type);
44 int scpi_ddr_send_timing(u32 *p, u32 size);
45 int scpi_ddr_round_rate(u32 m_hz);
46 int scpi_ddr_set_auto_self_refresh(u32 en);
47 int scpi_ddr_get_clk_rate(void);
48 int scpi_thermal_get_temperature(void);
49 int scpi_thermal_set_clk_cycle(u32 cycle);
50 #else
scpi_clk_get_val(u16 clk_id)51 static inline unsigned long scpi_clk_get_val(u16 clk_id)
52 {
53 	return -EPERM;
54 }
55 
scpi_clk_set_val(u16 clk_id,unsigned long rate)56 static inline int scpi_clk_set_val(u16 clk_id, unsigned long rate)
57 {
58 	return -EPERM;
59 }
60 
scpi_dvfs_get_idx(u8 domain)61 static inline int scpi_dvfs_get_idx(u8 domain)
62 {
63 	return -EPERM;
64 }
65 
scpi_dvfs_set_idx(u8 domain,u8 idx)66 static inline int scpi_dvfs_set_idx(u8 domain, u8 idx)
67 {
68 	return -EPERM;
69 }
70 
scpi_dvfs_get_opps(u8 domain)71 static inline struct scpi_opp *scpi_dvfs_get_opps(u8 domain)
72 {
73 	return ERR_PTR(-EPERM);
74 }
75 
scpi_get_sensor(char * name)76 static inline int scpi_get_sensor(char *name)
77 {
78 	return -EPERM;
79 }
80 
scpi_get_sensor_value(u16 sensor,u32 * val)81 static inline int scpi_get_sensor_value(u16 sensor, u32 *val)
82 {
83 	return -EPERM;
84 }
85 
scpi_sys_set_jtagmux_on_off(u32 en)86 static inline int scpi_sys_set_jtagmux_on_off(u32 en)
87 {
88 	return -EPERM;
89 }
90 
scpi_sys_set_mcu_state_suspend(void)91 static inline int scpi_sys_set_mcu_state_suspend(void)
92 {
93 	return -EPERM;
94 }
95 
scpi_sys_set_mcu_state_resume(void)96 static inline int scpi_sys_set_mcu_state_resume(void)
97 {
98 	return -EPERM;
99 }
100 
scpi_ddr_dclk_mode(u32 dclk_mode)101 static inline int scpi_ddr_dclk_mode(u32 dclk_mode)
102 {
103 	return -EPERM;
104 }
105 
scpi_ddr_init(u32 dram_speed_bin,u32 freq,u32 lcdc_type,u32 addr_mcu_el3)106 static inline int scpi_ddr_init(u32 dram_speed_bin, u32 freq, u32 lcdc_type,
107 				u32 addr_mcu_el3)
108 {
109 	return -EPERM;
110 }
111 
scpi_ddr_set_clk_rate(u32 rate,u32 lcdc_type)112 static inline int scpi_ddr_set_clk_rate(u32 rate, u32 lcdc_type)
113 {
114 	return -EPERM;
115 }
116 
scpi_ddr_send_timing(u32 * p,u32 size)117 static inline int scpi_ddr_send_timing(u32 *p, u32 size)
118 {
119 	return -EPERM;
120 }
121 
scpi_ddr_round_rate(u32 m_hz)122 static inline int scpi_ddr_round_rate(u32 m_hz)
123 {
124 	return -EPERM;
125 }
126 
scpi_ddr_set_auto_self_refresh(u32 en)127 static inline int scpi_ddr_set_auto_self_refresh(u32 en)
128 {
129 	return -EPERM;
130 }
131 
scpi_ddr_get_clk_rate(void)132 static inline int scpi_ddr_get_clk_rate(void)
133 {
134 	return -EPERM;
135 }
136 
scpi_thermal_get_temperature(void)137 static inline int scpi_thermal_get_temperature(void)
138 {
139 	return -EPERM;
140 }
141 
scpi_thermal_set_clk_cycle(u32 cycle)142 static inline int scpi_thermal_set_clk_cycle(u32 cycle)
143 {
144 	return -EPERM;
145 }
146 #endif
147 #endif
148