From d3f6158acb67c7ec8346616f44f1ed8a4a429117 Mon Sep 17 00:00:00 2001 From: Aiyoujun Date: Fri, 15 May 2015 18:35:16 +0800 Subject: [PATCH] mailbox: rockchip: modify the default time out value of scpi command from immediate to a const define. If you would use another timeout value with your command, you shoul do it as below: SCPI_SETUP_DBUF(sdata, mdata, SCPI_CL_CLOCKS, SCPI_CMD_GET_CLOCK_VALUE, clk_id, buf); sdata.timeout_ms = YOUR_CMD_DEFAULT_TIMEOUT_MS; Signed-off-by: Aiyoujun --- drivers/mailbox/scpi_protocol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/scpi_protocol.c b/drivers/mailbox/scpi_protocol.c index 8313912ea8b9..d906906fdbd7 100644 --- a/drivers/mailbox/scpi_protocol.c +++ b/drivers/mailbox/scpi_protocol.c @@ -41,6 +41,7 @@ ((((cmd) & CMD_ID_MASK) << CMD_ID_SHIFT) | \ (((sender) & CMD_SENDER_ID_MASK) << CMD_SENDER_ID_SHIFT) | \ (((txsz) & CMD_DATA_SIZE_MASK) << CMD_DATA_SIZE_SHIFT)) +#define SCPI_CMD_DEFAULT_TIMEOUT_MS 1000 #define MAX_DVFS_DOMAINS 3 #define MAX_DVFS_OPPS 8 @@ -51,6 +52,7 @@ struct scpi_data_buf { int client_id; struct rockchip_mbox_msg *data; struct completion complete; + int timeout_ms; }; static int high_priority_cmds[] = { @@ -112,6 +114,7 @@ static int send_scpi_cmd(struct scpi_data_buf *scpi_buf, bool high_priority) struct rockchip_mbox_msg *data = scpi_buf->data; u32 status; int ret; + int timeout = msecs_to_jiffies(scpi_buf->timeout_ms); if (!the_scpi_device) { pr_err("Scpi initializes unsuccessfully\n"); @@ -134,8 +137,7 @@ static int send_scpi_cmd(struct scpi_data_buf *scpi_buf, bool high_priority) goto free_channel; } - ret = wait_for_completion_timeout(&scpi_buf->complete, - msecs_to_jiffies(1000)); + ret = wait_for_completion_timeout(&scpi_buf->complete, timeout); if (ret == 0) { status = SCPI_ERR_TIMEOUT; goto free_channel; @@ -159,6 +161,7 @@ do { \ pdata->rx_size = sizeof(_rx_buf); \ scpi_buf.client_id = _client_id; \ scpi_buf.data = pdata; \ + scpi_buf.timeout_ms = SCPI_CMD_DEFAULT_TIMEOUT_MS; \ } while (0) static int scpi_execute_cmd(struct scpi_data_buf *scpi_buf) -- 2.34.1