diff options
author | Frank Wang <frank.wang@rock-chips.com> | 2015-06-25 18:17:46 +0800 |
---|---|---|
committer | David Wu <wdc@rock-chips.com> | 2015-06-25 18:25:49 +0800 |
commit | 56f35b1e6eb07e20dd18a66bf5a0f66c325bd67a (patch) | |
tree | 72bdf503278bbc1c2db45c456c8b8977866ce310 /drivers/mailbox | |
parent | cdc3acdb78a64d3507acc1689972c2d1bc69a0a9 (diff) |
rk3368: mailbox: Added SCPI APIs for TSADC function.
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r-- | drivers/mailbox/scpi_cmd.h | 5 | ||||
-rw-r--r-- | drivers/mailbox/scpi_protocol.c | 23 |
2 files changed, 28 insertions, 0 deletions
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"}, { }, |