@@ -95,6 +95,8 @@ static const struct snd_sof_debugfs_map cht_debugfs[] = {
95
95
{"shim" , BYT_DSP_BAR , SHIM_OFFSET , SHIM_SIZE },
96
96
};
97
97
98
+ static int byt_cmd_done (struct snd_sof_dev * sdev , int dir );
99
+
98
100
/*
99
101
* Register IO
100
102
*/
@@ -376,16 +378,15 @@ static irqreturn_t byt_irq_thread(int irq, void *context)
376
378
377
379
/* reply message from DSP */
378
380
if (ipcx & SHIM_BYT_IPCX_DONE ) {
379
- /* Handle Immediate reply from DSP Core */
380
- snd_sof_ipc_reply (sdev , ipcx );
381
-
382
- /* clear DONE bit - tell DSP we have completed */
383
- snd_sof_dsp_update_bits64_unlocked (sdev , BYT_DSP_BAR , SHIM_IPCX ,
384
- SHIM_BYT_IPCX_DONE , 0 );
385
-
386
- /* unmask Done interrupt */
387
- snd_sof_dsp_update_bits64_unlocked (sdev , BYT_DSP_BAR , SHIM_IMRX ,
388
- SHIM_IMRX_DONE , 0 );
381
+ /*
382
+ * handle immediate reply from DSP core. If the msg is
383
+ * found, set done bit in cmd_done which is called at the
384
+ * end of message processing function, else set it here
385
+ * because the done bit can't be set in cmd_done function
386
+ * which is triggered by msg
387
+ */
388
+ if (snd_sof_ipc_reply (sdev , ipcx ))
389
+ byt_cmd_done (sdev , SOF_IPC_DSP_REPLY );
389
390
}
390
391
391
392
/* new message from DSP */
@@ -405,10 +406,11 @@ static irqreturn_t byt_irq_thread(int irq, void *context)
405
406
406
407
static int byt_is_ready (struct snd_sof_dev * sdev )
407
408
{
408
- u64 imrx ;
409
+ u64 imrx , ipcx ;
409
410
410
411
imrx = snd_sof_dsp_read64 (sdev , BYT_DSP_BAR , SHIM_IMRX );
411
- if (imrx & SHIM_IMRX_DONE )
412
+ ipcx = snd_sof_dsp_read64 (sdev , BYT_DSP_BAR , SHIM_IPCX );
413
+ if ((imrx & SHIM_IMRX_DONE ) || (ipcx & SHIM_BYT_IPCX_DONE ))
412
414
return 0 ;
413
415
414
416
return 1 ;
@@ -458,17 +460,27 @@ static int byt_get_reply(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
458
460
return ret ;
459
461
}
460
462
461
- static int byt_cmd_done (struct snd_sof_dev * sdev )
463
+ static int byt_cmd_done (struct snd_sof_dev * sdev , int dir )
462
464
{
463
- /* clear BUSY bit and set DONE bit - accept new messages */
464
- snd_sof_dsp_update_bits64_unlocked (sdev , BYT_DSP_BAR , SHIM_IPCD ,
465
- SHIM_BYT_IPCD_BUSY |
466
- SHIM_BYT_IPCD_DONE ,
467
- SHIM_BYT_IPCD_DONE );
465
+ if (dir == SOF_IPC_HOST_REPLY ) {
466
+ /* clear BUSY bit and set DONE bit - accept new messages */
467
+ snd_sof_dsp_update_bits64_unlocked (sdev , BYT_DSP_BAR , SHIM_IPCD ,
468
+ SHIM_BYT_IPCD_BUSY |
469
+ SHIM_BYT_IPCD_DONE ,
470
+ SHIM_BYT_IPCD_DONE );
468
471
469
- /* unmask busy interrupt */
470
- snd_sof_dsp_update_bits64_unlocked (sdev , BYT_DSP_BAR , SHIM_IMRX ,
471
- SHIM_IMRX_BUSY , 0 );
472
+ /* unmask busy interrupt */
473
+ snd_sof_dsp_update_bits64_unlocked (sdev , BYT_DSP_BAR , SHIM_IMRX ,
474
+ SHIM_IMRX_BUSY , 0 );
475
+ } else {
476
+ /* clear DONE bit - tell DSP we have completed */
477
+ snd_sof_dsp_update_bits64_unlocked (sdev , BYT_DSP_BAR , SHIM_IPCX ,
478
+ SHIM_BYT_IPCX_DONE , 0 );
479
+
480
+ /* unmask Done interrupt */
481
+ snd_sof_dsp_update_bits64_unlocked (sdev , BYT_DSP_BAR , SHIM_IMRX ,
482
+ SHIM_IMRX_DONE , 0 );
483
+ }
472
484
473
485
return 0 ;
474
486
}
0 commit comments