@@ -390,20 +390,21 @@ static int hda_dma_enable_unlock(struct dma_chan_data *channel)
390390
391391 hda_dma_get_dbg_vals (channel , HDA_DBG_PRE , HDA_DBG_BOTH );
392392
393- /* enable the channel */
394- dma_chan_reg_update_bits (channel , DGCS , DGCS_GEN | DGCS_FIFORDY ,
395- DGCS_GEN | DGCS_FIFORDY );
396-
397393 /* full buffer is copied at startup */
398394 hda_chan = dma_chan_get_data (channel );
399395 hda_chan -> desc_avail = channel -> desc_count ;
400396
397+ /* enable the channel */
401398 if (channel -> direction == DMA_DIR_HMEM_TO_LMEM ||
402399 channel -> direction == DMA_DIR_LMEM_TO_HMEM ) {
400+ dma_chan_reg_update_bits (channel , DGCS , DGCS_GEN | DGCS_FIFORDY ,
401+ DGCS_FIFORDY | DGCS_GEN );
403402 pm_runtime_get (PM_RUNTIME_HOST_DMA_L1 , 0 );
404403 ret = hda_dma_host_start (channel );
405404 if (ret < 0 )
406405 return ret ;
406+ } else {
407+ dma_chan_reg_update_bits (channel , DGCS , DGCS_GEN , DGCS_GEN );
407408 }
408409
409410 /* start link output transfer now */
@@ -613,12 +614,15 @@ static int hda_dma_stop(struct dma_chan_data *channel)
613614 tr_dbg (& hdma_tr , "hda-dmac: %d channel %d -> stop" ,
614615 channel -> dma -> plat_data .id , channel -> index );
615616
617+ /* disable the channel */
616618 if (channel -> direction == DMA_DIR_HMEM_TO_LMEM ||
617- channel -> direction == DMA_DIR_LMEM_TO_HMEM )
619+ channel -> direction == DMA_DIR_LMEM_TO_HMEM ) {
618620 hda_dma_host_stop (channel );
619621
620- /* disable the channel */
621- dma_chan_reg_update_bits (channel , DGCS , DGCS_GEN | DGCS_FIFORDY , 0 );
622+ dma_chan_reg_update_bits (channel , DGCS , DGCS_FIFORDY | DGCS_GEN , 0 );
623+ } else {
624+ dma_chan_reg_update_bits (channel , DGCS , DGCS_GEN , 0 );
625+ }
622626 channel -> status = COMP_STATE_PREPARE ;
623627 hda_chan = dma_chan_get_data (channel );
624628 hda_chan -> state = 0 ;
@@ -756,8 +760,8 @@ static int hda_dma_set_config(struct dma_chan_data *channel,
756760 config -> src_width <= 2 ))
757761 dgcs |= DGCS_SCS ;
758762
759- /* set DGCS.FIFORDY for output dma */
760- if (config -> direction == DMA_DIR_MEM_TO_DEV || config -> direction == DMA_DIR_LMEM_TO_HMEM )
763+ /* set DGCS.FIFORDY for input/ output host DMA only. It is not relevant for link DMA's */
764+ if (config -> direction == DMA_DIR_HMEM_TO_LMEM || config -> direction == DMA_DIR_LMEM_TO_HMEM )
761765 dgcs |= DGCS_FIFORDY ;
762766
763767 dma_chan_reg_write (channel , DGCS , dgcs );
0 commit comments