ASoC: Intel: Skylake: Limit large_config_get to single frame
authorCezary Rojewski <cezary.rojewski@intel.com>
Thu, 8 Aug 2019 18:15:48 +0000 (20:15 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 8 Aug 2019 20:22:24 +0000 (21:22 +0100)
Reply for the very first LARGE_CONFIG_GET request contains total size of
payload to be retrieved by host.
From then on, each subsequent reply carries buffer offset instead. As
looping is not covered by any real-life example, remove it and cleanup
the function for followup overhaul.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20190808181549.12521-2-cezary.rojewski@intel.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/skylake/skl-sst-ipc.c

index a2b69a02aab2422eedb726c02f5421bf728c920d..196c80dadb1f6909bb89662632abae9621b7ccd4 100644 (file)
@@ -973,8 +973,7 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
 {
        struct skl_ipc_header header = {0};
        struct sst_ipc_message request = {0}, reply = {0};
-       int ret = 0;
-       size_t sz_remaining, rx_size, data_offset;
+       int ret;
 
        header.primary = IPC_MSG_TARGET(IPC_MOD_MSG);
        header.primary |= IPC_MSG_DIR(IPC_MSG_REQUEST);
@@ -987,34 +986,12 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
        header.extension |= IPC_FINAL_BLOCK(1);
        header.extension |= IPC_INITIAL_BLOCK(1);
 
-       sz_remaining = msg->param_data_size;
-       data_offset = 0;
-
-       while (sz_remaining != 0) {
-               rx_size = sz_remaining > SKL_ADSP_W1_SZ
-                               ? SKL_ADSP_W1_SZ : sz_remaining;
-               if (rx_size == sz_remaining)
-                       header.extension |= IPC_FINAL_BLOCK(1);
-
-               request.header = *(u64 *)(&header);
-               reply.data = ((char *)param) + data_offset;
-               reply.size = msg->param_data_size;
-               ret = sst_ipc_tx_message_wait(ipc, request, &reply);
-               if (ret < 0) {
-                       dev_err(ipc->dev,
-                               "ipc: get large config fail, err: %d\n", ret);
-                       return ret;
-               }
-               sz_remaining -= rx_size;
-               data_offset = msg->param_data_size - sz_remaining;
-
-               /* clear the fields */
-               header.extension &= IPC_INITIAL_BLOCK_CLEAR;
-               header.extension &= IPC_DATA_OFFSET_SZ_CLEAR;
-               /* fill the fields */
-               header.extension |= IPC_INITIAL_BLOCK(1);
-               header.extension |= IPC_DATA_OFFSET_SZ(data_offset);
-       }
+       request.header = *(u64 *)(&header);
+       reply.data = param;
+       reply.size = msg->param_data_size;
+       ret = sst_ipc_tx_message_wait(ipc, request, &reply);
+       if (ret < 0)
+               dev_err(ipc->dev, "ipc: get large config fail, err: %d\n", ret);
 
        return ret;
 }