From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756666AbbLDVtm (ORCPT ); Fri, 4 Dec 2015 16:49:42 -0500 Received: from mga09.intel.com ([134.134.136.24]:34225 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755166AbbLDVtj (ORCPT ); Fri, 4 Dec 2015 16:49:39 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,382,1444719600"; d="scan'208";a="854211176" From: Andy Shevchenko To: "Rafael J . Wysocki" , linux-acpi@vger.kernel.org, Vinod Koul , dmaengine@vger.kernel.org, Thomas Gleixner , Greg Kroah-Hartman , Jarkko Nikula , linux-kernel@vger.kernel.org, Mika Westerberg Cc: Andy Shevchenko Subject: [PATCH v3 7/9] dmaengine: dw: platform: power on device on shutdown Date: Fri, 4 Dec 2015 23:49:23 +0200 Message-Id: <1449265765-9393-8-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1449265765-9393-1-git-send-email-andriy.shevchenko@linux.intel.com> References: <1449265765-9393-1-git-send-email-andriy.shevchenko@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); } -- 2.6.2