Merge branch 'asoc-5.2' into asoc-5.3
[sfrench/cifs-2.6.git] / sound / soc / sof / intel / byt.c
index 7bf9143d3106737f751b01b06eb0fa3616275f70..107d711efc3f05fb24b8c202287ab0eaf7b7a80f 100644 (file)
@@ -265,17 +265,20 @@ static void byt_get_registers(struct snd_sof_dev *sdev,
                              struct sof_ipc_panic_info *panic_info,
                              u32 *stack, size_t stack_words)
 {
+       u32 offset = sdev->dsp_oops_offset;
+
        /* first read regsisters */
-       sof_mailbox_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));
+       sof_mailbox_read(sdev, offset, xoops, sizeof(*xoops));
+
+       /* note: variable AR register array is not read */
 
        /* then get panic info */
-       sof_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops),
-                        panic_info, sizeof(*panic_info));
+       offset += xoops->arch_hdr.totalsize;
+       sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
 
        /* then get the stack */
-       sof_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops) +
-                          sizeof(*panic_info), stack,
-                          stack_words * sizeof(u32));
+       offset += sizeof(*panic_info);
+       sof_mailbox_read(sdev, offset, stack, stack_words * sizeof(u32));
 }
 
 static void byt_dump(struct snd_sof_dev *sdev, u32 flags)
@@ -329,6 +332,9 @@ static irqreturn_t byt_irq_thread(int irq, void *context)
                                                   SHIM_IMRX,
                                                   SHIM_IMRX_DONE,
                                                   SHIM_IMRX_DONE);
+
+               spin_lock_irq(&sdev->ipc_lock);
+
                /*
                 * handle immediate reply from DSP core. If the msg is
                 * found, set done bit in cmd_done which is called at the
@@ -340,6 +346,8 @@ static irqreturn_t byt_irq_thread(int irq, void *context)
                snd_sof_ipc_reply(sdev, ipcx);
 
                byt_dsp_done(sdev);
+
+               spin_unlock_irq(&sdev->ipc_lock);
        }
 
        /* new message from DSP */
@@ -368,13 +376,10 @@ static irqreturn_t byt_irq_thread(int irq, void *context)
 
 static int byt_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
 {
-       u64 cmd = msg->header;
-
        /* send the message */
        sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data,
                          msg->msg_size);
-       snd_sof_dsp_write64(sdev, BYT_DSP_BAR, SHIM_IPCX,
-                           cmd | SHIM_BYT_IPCX_BUSY);
+       snd_sof_dsp_write64(sdev, BYT_DSP_BAR, SHIM_IPCX, SHIM_BYT_IPCX_BUSY);
 
        return 0;
 }
@@ -383,7 +388,6 @@ static void byt_get_reply(struct snd_sof_dev *sdev)
 {
        struct snd_sof_ipc_msg *msg = sdev->msg;
        struct sof_ipc_reply reply;
-       unsigned long flags;
        int ret = 0;
 
        /*
@@ -399,8 +403,6 @@ static void byt_get_reply(struct snd_sof_dev *sdev)
        /* get reply */
        sof_mailbox_read(sdev, sdev->host_box.offset, &reply, sizeof(reply));
 
-       spin_lock_irqsave(&sdev->ipc_lock, flags);
-
        if (reply.error < 0) {
                memcpy(msg->reply_data, &reply, sizeof(reply));
                ret = reply.error;
@@ -419,8 +421,6 @@ static void byt_get_reply(struct snd_sof_dev *sdev)
        }
 
        msg->reply_error = ret;
-
-       spin_unlock_irqrestore(&sdev->ipc_lock, flags);
 }
 
 static void byt_host_done(struct snd_sof_dev *sdev)