From 56f35b1e6eb07e20dd18a66bf5a0f66c325bd67a Mon Sep 17 00:00:00 2001 From: Frank Wang Date: Thu, 25 Jun 2015 18:17:46 +0800 Subject: [PATCH] rk3368: mailbox: Added SCPI APIs for TSADC function. Signed-off-by: Frank Wang --- drivers/mailbox/scpi_cmd.h | 5 +++++ drivers/mailbox/scpi_protocol.c | 23 +++++++++++++++++++++++ include/linux/scpi_protocol.h | 1 + 3 files changed, 29 insertions(+) diff --git a/drivers/mailbox/scpi_cmd.h b/drivers/mailbox/scpi_cmd.h index 0f6b9345616a..8d285672e645 100644 --- a/drivers/mailbox/scpi_cmd.h +++ b/drivers/mailbox/scpi_cmd.h @@ -97,3 +97,8 @@ enum scpi_std_cmd { SCPI_CMD_COUNT }; +enum scpi_thermal_cmd { + SCPI_THERMAL_GET_TSADC_DATA, + SCPI_THERMAL_COUNT +}; + diff --git a/drivers/mailbox/scpi_protocol.c b/drivers/mailbox/scpi_protocol.c index d906906fdbd7..145397c19295 100644 --- a/drivers/mailbox/scpi_protocol.c +++ b/drivers/mailbox/scpi_protocol.c @@ -574,6 +574,29 @@ int scpi_ddr_get_clk_rate(void) } EXPORT_SYMBOL_GPL(scpi_ddr_get_clk_rate); +int scpi_thermal_get_temperature(void) +{ + struct scpi_data_buf sdata; + struct rockchip_mbox_msg mdata; + struct __packed1 { + u32 status; + } tx_buf; + + struct __packed2 { + u32 status; + u32 tsadc_data; + } rx_buf; + + tx_buf.status = 0; + SCPI_SETUP_DBUF(sdata, mdata, SCPI_CL_THERMAL, + SCPI_THERMAL_GET_TSADC_DATA, tx_buf, rx_buf); + if (scpi_execute_cmd(&sdata)) + return 0; + + return rx_buf.tsadc_data; +} +EXPORT_SYMBOL_GPL(scpi_thermal_get_temperature); + static struct of_device_id mobx_scpi_of_match[] = { { .compatible = "rockchip,mbox-scpi"}, { }, diff --git a/include/linux/scpi_protocol.h b/include/linux/scpi_protocol.h index fb32c0b543bf..8dc47a2b3dc4 100644 --- a/include/linux/scpi_protocol.h +++ b/include/linux/scpi_protocol.h @@ -47,4 +47,5 @@ int scpi_ddr_set_auto_self_refresh(u32 en); int scpi_ddr_bandwidth_get(struct ddr_bw_info *ddr_bw_ch0, struct ddr_bw_info *ddr_bw_ch1); int scpi_ddr_get_clk_rate(void); +int scpi_thermal_get_temperature(void); -- 2.34.1