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