From patchwork Wed Jan 17 09:38:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10168851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 19E39603ED for ; Wed, 17 Jan 2018 09:38:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09A302838B for ; Wed, 17 Jan 2018 09:38:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F207928477; Wed, 17 Jan 2018 09:38:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B0142838B for ; Wed, 17 Jan 2018 09:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752311AbeAQJij (ORCPT ); Wed, 17 Jan 2018 04:38:39 -0500 Received: from laurent.telenet-ops.be ([195.130.137.89]:40888 "EHLO laurent.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752251AbeAQJii (ORCPT ); Wed, 17 Jan 2018 04:38:38 -0500 Received: from ayla.of.borg ([84.195.106.246]) by laurent.telenet-ops.be with bizsmtp id zMec1w0085JzmfG01Mecg2; Wed, 17 Jan 2018 10:38:36 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1ebkB1-0006GG-VK; Wed, 17 Jan 2018 10:38:35 +0100 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1ebkB1-0004Pk-OJ; Wed, 17 Jan 2018 10:38:35 +0100 From: Geert Uytterhoeven To: Vinod Koul , Dan Williams , Ulf Hansson , "Rafael J . Wysocki" Cc: dmaengine@vger.kernel.org, linux-pm@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] dmaengine: rcar-dmac: Make DMAC reinit during system resume explicit Date: Wed, 17 Jan 2018 10:38:28 +0100 Message-Id: <1516181908-16930-1-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current (empty) system sleep callbacks rely on the PM core to force a runtime resume to reinitialize the DMAC registers during system resume. Without a reinitialization, e.g. SCIF DMA will hang silently after a system resume on R-Car Gen3. Make this explicit by using pm_runtime_force_{suspend,resume}() as the system sleep callbacks instead. Use SET_LATE_SYSTEM_SLEEP_PM_OPS() as DMA engines must be initialized before all DMA slave devices. Suggested-by: Ulf Hansson Signed-off-by: Geert Uytterhoeven Reviewed-by: Ulf Hansson Acked-By: Vinod Koul --- This is a dependency for "[PATCH 1/2] PM / genpd: Stop/start devices without pm_runtime_force_suspend/resume()" (https://www.spinics.net/lists/kernel/msg2696802.html), so perhaps it makes most sense if Rafael takes it through the PM tree? Thanks! --- drivers/dma/sh/rcar-dmac.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index fb06b193ad252086..06e4e604eebb79f6 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1657,22 +1657,6 @@ static struct dma_chan *rcar_dmac_of_xlate(struct of_phandle_args *dma_spec, * Power management */ -#ifdef CONFIG_PM_SLEEP -static int rcar_dmac_sleep_suspend(struct device *dev) -{ - /* - * TODO: Wait for the current transfer to complete and stop the device. - */ - return 0; -} - -static int rcar_dmac_sleep_resume(struct device *dev) -{ - /* TODO: Resume transfers, if any. */ - return 0; -} -#endif - #ifdef CONFIG_PM static int rcar_dmac_runtime_suspend(struct device *dev) { @@ -1688,7 +1672,13 @@ static int rcar_dmac_runtime_resume(struct device *dev) #endif static const struct dev_pm_ops rcar_dmac_pm = { - SET_SYSTEM_SLEEP_PM_OPS(rcar_dmac_sleep_suspend, rcar_dmac_sleep_resume) + /* + * TODO for system sleep/resume: + * - Wait for the current transfer to complete and stop the device, + * - Resume transfers, if any. + */ + SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) SET_RUNTIME_PM_OPS(rcar_dmac_runtime_suspend, rcar_dmac_runtime_resume, NULL) };