These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / sound / soc / intel / haswell / sst-haswell-ipc.c
index 324eceb..b27f25f 100644 (file)
@@ -302,6 +302,10 @@ struct sst_hsw {
        struct sst_hsw_ipc_dx_reply dx;
        void *dx_context;
        dma_addr_t dx_context_paddr;
+       enum sst_hsw_device_id dx_dev;
+       enum sst_hsw_device_mclk dx_mclk;
+       enum sst_hsw_device_mode dx_mode;
+       u32 dx_clock_divider;
 
        /* boot */
        wait_queue_head_t boot_wait;
@@ -1400,10 +1404,10 @@ int sst_hsw_device_set_config(struct sst_hsw *hsw,
 
        trace_ipc_request("set device config", dev);
 
-       config.ssp_interface = dev;
-       config.clock_frequency = mclk;
-       config.mode = mode;
-       config.clock_divider = clock_divider;
+       hsw->dx_dev = config.ssp_interface = dev;
+       hsw->dx_mclk = config.clock_frequency = mclk;
+       hsw->dx_mode = config.mode = mode;
+       hsw->dx_clock_divider = config.clock_divider = clock_divider;
        if (mode == SST_HSW_DEVICE_TDM_CLOCK_MASTER)
                config.channels = 4;
        else
@@ -1704,10 +1708,10 @@ int sst_hsw_dsp_runtime_resume(struct sst_hsw *hsw)
                return -EIO;
        }
 
-       /* Set ADSP SSP port settings */
-       ret = sst_hsw_device_set_config(hsw, SST_HSW_DEVICE_SSP_0,
-                                       SST_HSW_DEVICE_MCLK_FREQ_24_MHZ,
-                                       SST_HSW_DEVICE_CLOCK_MASTER, 9);
+       /* Set ADSP SSP port settings - sadly the FW does not store SSP port
+          settings as part of the PM context. */
+       ret = sst_hsw_device_set_config(hsw, hsw->dx_dev, hsw->dx_mclk,
+                                       hsw->dx_mode, hsw->dx_clock_divider);
        if (ret < 0)
                dev_err(dev, "error: SSP re-initialization failed\n");
 
@@ -2098,6 +2102,14 @@ static u64 hsw_reply_msg_match(u64 header, u64 *mask)
        return header;
 }
 
+static bool hsw_is_dsp_busy(struct sst_dsp *dsp)
+{
+       u64 ipcx;
+
+       ipcx = sst_dsp_shim_read_unlocked(dsp, SST_IPCX);
+       return (ipcx & (SST_IPCX_BUSY | SST_IPCX_DONE));
+}
+
 int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata)
 {
        struct sst_hsw_ipc_fw_version version;
@@ -2111,12 +2123,18 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata)
        if (hsw == NULL)
                return -ENOMEM;
 
+       hsw->dev = dev;
+
        ipc = &hsw->ipc;
        ipc->dev = dev;
        ipc->ops.tx_msg = hsw_tx_msg;
        ipc->ops.shim_dbg = hsw_shim_dbg;
        ipc->ops.tx_data_copy = hsw_tx_data_copy;
        ipc->ops.reply_msg_match = hsw_reply_msg_match;
+       ipc->ops.is_dsp_busy = hsw_is_dsp_busy;
+
+       ipc->tx_data_max_size = IPC_MAX_MAILBOX_BYTES;
+       ipc->rx_data_max_size = IPC_MAX_MAILBOX_BYTES;
 
        ret = sst_ipc_init(ipc);
        if (ret != 0)