From patchwork Fri Sep 11 14:14:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 53477 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id A388B22B26 for ; Fri, 11 Sep 2015 14:16:09 +0000 (UTC) Received: by lbbti1 with SMTP id ti1sf24924919lbb.3 for ; Fri, 11 Sep 2015 07:16:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=sOyJSb3dciYfRdPFVPJftWsdtMaKAw6V4Lt74MbY9PQ=; b=WfflOxpVoQ/ZIrwfahMGQYh3k7wV8ETQ5bgMif7qBRqUKOKA9SGxI0KbNmfLGC/Whv bLeOeVxDfZgAUQAWfRjpJ5HXLVEscJxivTe/gHWQ3ubDHSBV9iwtuFQ8/I6nNakNafQE vaymMk8lRBmUNuRqs/WKIUse6AjX5o8gsyBHawtVB2jEIqY7PLWVgue6Sx8EpejK6OP/ BSSRyza9ZIJHDiQw0Ae42P9Kn2m/x59gUyeXIgOOSdXOcugB7qTp9kwbBJXKtQP8EGCt Sw3/JrMCGZetZqxwkjQORj0HFyejqq9B4xde2k83Yh9gTmGo8H/KqFDGxJOBmFpLImk+ maHQ== X-Gm-Message-State: ALoCoQkHim8XnN5tkZlyDcNQfoD1EISgJUPdz9Ud6c8HHSDxbjQHyKD7VlKwxIcIL+6oRuDpMeag X-Received: by 10.112.198.33 with SMTP id iz1mr11046351lbc.8.1441980968679; Fri, 11 Sep 2015 07:16:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.193 with SMTP id s1ls87668laj.62.gmail; Fri, 11 Sep 2015 07:16:08 -0700 (PDT) X-Received: by 10.152.6.201 with SMTP id d9mr10206580laa.66.1441980968514; Fri, 11 Sep 2015 07:16:08 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id so9si361442lbb.137.2015.09.11.07.16.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2015 07:16:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lanb10 with SMTP id b10so48600678lan.3 for ; Fri, 11 Sep 2015 07:16:08 -0700 (PDT) X-Received: by 10.152.23.199 with SMTP id o7mr29258laf.76.1441980968090; Fri, 11 Sep 2015 07:16:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1627635lbq; Fri, 11 Sep 2015 07:16:07 -0700 (PDT) X-Received: by 10.68.69.70 with SMTP id c6mr96636627pbu.28.1441980966855; Fri, 11 Sep 2015 07:16:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tc9si714888pbc.232.2015.09.11.07.16.05; Fri, 11 Sep 2015 07:16:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753337AbbIKOQE (ORCPT + 7 others); Fri, 11 Sep 2015 10:16:04 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:37622 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753075AbbIKOOr (ORCPT ); Fri, 11 Sep 2015 10:14:47 -0400 Received: by wicfx3 with SMTP id fx3so59913074wic.0 for ; Fri, 11 Sep 2015 07:14:46 -0700 (PDT) X-Received: by 10.180.87.71 with SMTP id v7mr4755609wiz.21.1441980886004; Fri, 11 Sep 2015 07:14:46 -0700 (PDT) Received: from localhost.localdomain (cpc14-aztw22-2-0-cust189.18-1.cable.virginm.net. [82.45.1.190]) by smtp.gmail.com with ESMTPSA id i6sm577236wje.33.2015.09.11.07.14.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Sep 2015 07:14:45 -0700 (PDT) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com, maxime.coquelin@st.com, patrice.chotard@st.com, vinod.koul@intel.com Cc: peter.griffin@linaro.org, lee.jones@linaro.org, robh+dt@kernel.org, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, Ludovic Barre Subject: [PATCH v2 6/9] dmaengine: st_fdma: Add fdma suspend and resume callbacks. Date: Fri, 11 Sep 2015 15:14:28 +0100 Message-Id: <1441980871-24475-7-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441980871-24475-1-git-send-email-peter.griffin@linaro.org> References: <1441980871-24475-1-git-send-email-peter.griffin@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.griffin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch adds the functions to gate the xp70 clock on suspend and resume. Signed-off-by: Ludovic Barre Signed-off-by: Peter Griffin --- drivers/dma/st_fdma.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c index 4288e79..de3afefb 100644 --- a/drivers/dma/st_fdma.c +++ b/drivers/dma/st_fdma.c @@ -1127,10 +1127,56 @@ static int st_fdma_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int st_fdma_pm_suspend(struct device *dev) +{ + struct st_fdma_dev *fdev = dev_get_drvdata(dev); + int ret; + + if (atomic_read(&fdev->fw_loaded)) { + ret = st_fdma_disable(fdev); + if (ret & FDMA_EN_RUN) { + dev_warn(fdev->dev, "Failed to disable channels"); + return -EBUSY; + } + } + + st_fdma_clk_disable(fdev); + + return 0; +} + +static int st_fdma_pm_resume(struct device *dev) +{ + struct st_fdma_dev *fdev = dev_get_drvdata(dev); + int ret; + + ret = st_fdma_clk_enable(fdev); + if (ret) { + dev_err(fdev->dev, "Failed to enable clocks\n"); + goto out; + } + + ret = st_fdma_get_fw(fdev); +out: + return ret; +} + +static const struct dev_pm_ops st_fdma_pm = { + .suspend_late = st_fdma_pm_suspend, + .resume_early = st_fdma_pm_resume, +}; + +#define ST_FDMA_PM (&st_fdma_pm) +#else +#define ST_FDMA_PM NULL +#endif + static struct platform_driver st_fdma_platform_driver = { .driver = { .name = "st-fdma", .of_match_table = st_fdma_match, + .pm = ST_FDMA_PM, }, .probe = st_fdma_probe, .remove = st_fdma_remove,