rk3368: mailbox: Added SCPI APIs for TSADC function.
authorFrank Wang <frank.wang@rock-chips.com>
Thu, 25 Jun 2015 10:17:46 +0000 (18:17 +0800)
committerDavid Wu <wdc@rock-chips.com>
Thu, 25 Jun 2015 10:25:49 +0000 (18:25 +0800)
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
drivers/mailbox/scpi_cmd.h
drivers/mailbox/scpi_protocol.c
include/linux/scpi_protocol.h

index 0f6b9345616ad788f8aca7a6c93d65e4e7aef5df..8d285672e645d56319c2e133546e8e112ad5a820 100644 (file)
@@ -97,3 +97,8 @@ enum scpi_std_cmd {
        SCPI_CMD_COUNT
 };
 
+enum scpi_thermal_cmd {
+       SCPI_THERMAL_GET_TSADC_DATA,
+       SCPI_THERMAL_COUNT
+};
+
index d906906fdbd71dc66f8705703281adf2a0e06f25..145397c1929585b2e6a01f0086349475b5437438 100644 (file)
@@ -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"},
        { },
index fb32c0b543bf0eba7a1dfcc9cbe8729f0e33daea..8dc47a2b3dc48bc567035725da29009f9bebccff 100644 (file)
@@ -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);