SCPI_ERR_MAX
};
+static int scpi_freq_map_table[] = {
+ 0,
+ 0,
+ 1200,
+ 1300,
+ 1400,
+ 1500,
+ 1600,
+ 1700,
+ 1800,
+ 1900,
+ 2000,
+ 2100,
+ 2200,
+ 2300,
+ 2400,
+ 0
+};
+static int scpi_volt_map_table[] = {
+ 0,
+ 0,
+ 900,
+ 910,
+ 920,
+ 930,
+ 940,
+ 950,
+ 960,
+ 970,
+ 980,
+ 990,
+ 1000,
+ 1010,
+ 1020,
+ 0
+};
struct scpi_data_buf {
int client_id;
return buf.eth_calc;
}
EXPORT_SYMBOL_GPL(scpi_get_ethernet_calc);
+
+int scpi_get_cpuinfo(enum scpi_get_pfm_type type, u32 *freq, u32 *vol)
+{
+ struct scpi_data_buf sdata;
+ struct mhu_data_buf mdata;
+ u8 index = 0;
+ int ret;
+
+ struct __packed {
+ u32 status;
+ u8 pfm_info[4];
+ } buf;
+
+ SCPI_SETUP_DBUF(sdata, mdata, SCPI_CL_NONE,
+ SCPI_CMD_GET_CPUINFO, index, buf);
+ if (scpi_execute_cmd(&sdata))
+ return -EPERM;
+
+ switch (type) {
+ case SCPI_CPUINFO_VERSION:
+ ret = buf.pfm_info[0];
+ break;
+ case SCPI_CPUINFO_CLUSTER0:
+ index = (buf.pfm_info[1] >> 4) & 0xf;
+ *freq = scpi_freq_map_table[index];
+ index = buf.pfm_info[1] & 0xf;
+ *vol = scpi_volt_map_table[index];
+ ret = 0;
+ break;
+ case SCPI_CPUINFO_CLUSTER1:
+ index = (buf.pfm_info[2] >> 4) & 0xf;
+ *freq = scpi_freq_map_table[index];
+ index = buf.pfm_info[2] & 0xf;
+ *vol = scpi_volt_map_table[index];
+ ret = 0;
+ break;
+ case SCPI_CPUINFO_SLT:
+ index = (buf.pfm_info[3] >> 4) & 0xf;
+ *freq = scpi_freq_map_table[index];
+ index = buf.pfm_info[3] & 0xf;
+ *vol = scpi_volt_map_table[index];
+ ret = 0;
+ break;
+ default:
+ *freq = 0;
+ *vol = 0;
+ ret = -1;
+ break;
+ };
+ return ret;
+}
+EXPORT_SYMBOL_GPL(scpi_get_cpuinfo);
SCPI_CMD_WAKEUP_REASON_GET = 0x30,
SCPI_CMD_WAKEUP_REASON_CLR = 0X31,
SCPI_CMD_GET_ETHERNET_CALC = 0x32,
+ SCPI_CMD_GET_CPUINFO = 0x33,
SCPI_CMD_GET_CEC1 = 0xB4,
SCPI_CMD_GET_CEC2 = 0xB5,
SCPI_CMD_COUNT
};
+enum scpi_get_pfm_type {
+ SCPI_CPUINFO_CLUSTER0,
+ SCPI_CPUINFO_CLUSTER1,
+ SCPI_CPUINFO_VERSION,
+ SCPI_CPUINFO_SLT,
+ SCPI_CPUINFO_NUMS
+};
+
struct scpi_opp_entry {
u32 freq_hz;
u32 volt_mv;
struct scpi_opp_entry *opp;
} __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_clr_wakeup_reason(void);
int scpi_get_cec_val(enum scpi_std_cmd index, u32 *p_cec);
u8 scpi_get_ethernet_calc(void);
+int scpi_get_cpuinfo(enum scpi_get_pfm_type type, u32 *freq, u32 *vol);
#endif /*_SCPI_PROTOCOL_H_*/