aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSinan Kaya <okaya@codeaurora.org>2016-10-06 15:33:14 -0400
committerVinod Koul <vinod.koul@intel.com>2016-10-18 11:03:33 -0400
commit7dcec7577ddbc5677deb5204a8cb8837c32a68cf (patch)
treee1948bb90c449dac19b45670a7bd99083969bdf2
parent1001354ca34179f3db924eb66672442a173147dc (diff)
dmaengine: qcom_hidma: prevent disable in error
When an error is observed, we try to disable the channel and prevent further accesses from the client. Depending on the type of error, transitioning into disabled state might not be possible. Adding a check to make sure that HW is in enabled/running state before the disable transition happens. Signed-off-by: Sinan Kaya <okaya@codeaurora.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/qcom/hidma_ll.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c
index 3224f24c577b..c3a66c9b0ab7 100644
--- a/drivers/dma/qcom/hidma_ll.c
+++ b/drivers/dma/qcom/hidma_ll.c
@@ -564,19 +564,8 @@ int hidma_ll_disable(struct hidma_lldev *lldev)
564 u32 val; 564 u32 val;
565 int ret; 565 int ret;
566 566
567 val = readl(lldev->evca + HIDMA_EVCA_CTRLSTS_REG); 567 /* The channel needs to be in working state */
568 lldev->evch_state = HIDMA_CH_STATE(val); 568 if (!hidma_ll_isenabled(lldev))
569 val = readl(lldev->trca + HIDMA_TRCA_CTRLSTS_REG);
570 lldev->trch_state = HIDMA_CH_STATE(val);
571
572 /* already suspended by this OS */
573 if ((lldev->trch_state == HIDMA_CH_SUSPENDED) ||
574 (lldev->evch_state == HIDMA_CH_SUSPENDED))
575 return 0;
576
577 /* already stopped by the manager */
578 if ((lldev->trch_state == HIDMA_CH_STOPPED) ||
579 (lldev->evch_state == HIDMA_CH_STOPPED))
580 return 0; 569 return 0;
581 570
582 val = readl(lldev->trca + HIDMA_TRCA_CTRLSTS_REG); 571 val = readl(lldev->trca + HIDMA_TRCA_CTRLSTS_REG);