From e1ca4604620a4cba46d905ce8fde8ebe0e4c26c1 Mon Sep 17 00:00:00 2001 From: David Wu Date: Tue, 4 Aug 2015 18:17:27 +0800 Subject: [PATCH] rk3368: scpi: add interface set cycle for tsadc Signed-off-by: David Wu --- drivers/mailbox/scpi_cmd.h | 1 + drivers/mailbox/scpi_protocol.c | 20 ++++++++++++++++++++ include/linux/scpi_protocol.h | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/mailbox/scpi_cmd.h b/drivers/mailbox/scpi_cmd.h index 8d285672e645..a15ef87b547a 100644 --- a/drivers/mailbox/scpi_cmd.h +++ b/drivers/mailbox/scpi_cmd.h @@ -99,6 +99,7 @@ enum scpi_std_cmd { enum scpi_thermal_cmd { SCPI_THERMAL_GET_TSADC_DATA, + SCPI_THERMAL_SET_TSADC_CYCLE, SCPI_THERMAL_COUNT }; diff --git a/drivers/mailbox/scpi_protocol.c b/drivers/mailbox/scpi_protocol.c index 145397c19295..10cefa0bb2fc 100644 --- a/drivers/mailbox/scpi_protocol.c +++ b/drivers/mailbox/scpi_protocol.c @@ -597,6 +597,26 @@ int scpi_thermal_get_temperature(void) } EXPORT_SYMBOL_GPL(scpi_thermal_get_temperature); +int scpi_thermal_set_clk_cycle(u32 cycle) +{ + struct scpi_data_buf sdata; + struct rockchip_mbox_msg mdata; + struct __packed1 { + u32 clk_cycle; + } tx_buf; + + struct __packed2 { + u32 status; + } rx_buf; + + tx_buf.clk_cycle = cycle; + SCPI_SETUP_DBUF(sdata, mdata, SCPI_CL_THERMAL, + SCPI_THERMAL_SET_TSADC_CYCLE, tx_buf, rx_buf); + + return scpi_execute_cmd(&sdata); +} +EXPORT_SYMBOL_GPL(scpi_thermal_set_clk_cycle); + 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 8dc47a2b3dc4..dfa665ab034f 100644 --- a/include/linux/scpi_protocol.h +++ b/include/linux/scpi_protocol.h @@ -48,4 +48,4 @@ 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); - +int scpi_thermal_set_clk_cycle(u32 cycle); -- 2.34.1