From patchwork Wed Jul 13 09:36:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 647790 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3rqDKm2Jg8z9s9Z; Wed, 13 Jul 2016 19:38:36 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1bNGci-0004IY-RW; Wed, 13 Jul 2016 09:38:32 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1bNGcY-0004HL-PV for kernel-team@lists.ubuntu.com; Wed, 13 Jul 2016 09:38:22 +0000 Received: from [222.130.140.104] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1bNGcY-0008FP-0D; Wed, 13 Jul 2016 09:38:22 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [Xenial PATCH 1/2] dmaengine: dw: platform: power on device on shutdown Date: Wed, 13 Jul 2016 17:36:12 +0800 Message-Id: <1468402573-5547-2-git-send-email-hui.wang@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468402573-5547-1-git-send-email-hui.wang@canonical.com> References: <1468402573-5547-1-git-send-email-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Andy Shevchenko BugLink: http://bugs.launchpad.net/bugs/1602579 We have to call dw_dma_disable() to stop any ongoing transfer. On some platforms we can't do that since DMA device is powered off. Moreover we have no possibility at that point to check if the platform is affected or not. That's why we call pm_runtime_get_sync() / pm_runtime_put() unconditionally. On the other hand we can't use pm_runtime_suspended() because runtime PM framework is not fully used by the driver. Signed-off-by: Andy Shevchenko Acked-by: Vinod Koul Signed-off-by: Rafael J. Wysocki (cherry picked from commit 3214658855c01a0dd62f02feb2ce79846524c6a0) Signed-off-by: Hui Wang --- drivers/dma/dw/platform.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c index 68a4815..d0734e9 100644 --- a/drivers/dma/dw/platform.c +++ b/drivers/dma/dw/platform.c @@ -239,7 +239,19 @@ static void dw_shutdown(struct platform_device *pdev) { struct dw_dma_chip *chip = platform_get_drvdata(pdev); + /* + * We have to call dw_dma_disable() to stop any ongoing transfer. On + * some platforms we can't do that since DMA device is powered off. + * Moreover we have no possibility to check if the platform is affected + * or not. That's why we call pm_runtime_get_sync() / pm_runtime_put() + * unconditionally. On the other hand we can't use + * pm_runtime_suspended() because runtime PM framework is not fully + * used by the driver. + */ + pm_runtime_get_sync(chip->dev); dw_dma_disable(chip); + pm_runtime_put_sync_suspend(chip->dev); + clk_disable_unprepare(chip->clk); }