From patchwork Thu Apr 21 11:04:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 66359 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp73090qge; Thu, 21 Apr 2016 04:05:00 -0700 (PDT) X-Received: by 10.66.164.39 with SMTP id yn7mr19624477pab.107.1461236697649; Thu, 21 Apr 2016 04:04:57 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si148170pfa.119.2016.04.21.04.04.57; Thu, 21 Apr 2016 04:04:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752196AbcDULEy (ORCPT + 29 others); Thu, 21 Apr 2016 07:04:54 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:34913 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752145AbcDULEu (ORCPT ); Thu, 21 Apr 2016 07:04:50 -0400 Received: by mail-wm0-f51.google.com with SMTP id e201so82477272wme.0 for ; Thu, 21 Apr 2016 04:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PDXUORL/7KoLDOcBHpMOwks7CsRY5b8yHHcFzIoEWTE=; b=dr3xDxGacbsbcN7oZSdXQiY1ibAAYsyWGSfGjftHLsksPjphL3pHbZcH2sdGpayLp3 l0zjpclLgp98i12xJRtVRSaR6qpwkp3ruBV3KKPzpZBxKvD8iBunhwontRkFsGruZh1F ZfkpXuWSMB+7pN/Twij+wt3ghQv7u4v6P47kc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PDXUORL/7KoLDOcBHpMOwks7CsRY5b8yHHcFzIoEWTE=; b=bM4OFIrsMHTjpER7e227Agcaq3TUQRAOv+SMgmqITMXqtwx8MxQp16DoaZzacOP24W A7yc5N3ZJpRqoi5KpLE75RpEB5tQGX74yHEarS/aPhZxN5jD2JiWD1FxEAvCJ7VpWrH5 bRTGyZxloqAhzmlmRBH2tyQ464YVwP/0iIDRa6qcNiocDN4tC9ApYEwqdIhRAeE97x5W yMWbasDjXH82wlC74kNIWhypsPV6m64SNDdtWPz5YD3cix9dmKy+yLYVznat8/fR4W7H FU81izsZIwDpId5I+ikx9qHeKmTueh10oTHVlNG8grMiskQ9kJxvpObhsD38CdH6d79O Q9Cw== X-Gm-Message-State: AOPr4FXy0774ODLmosr+ktk9QTcb+XfLftulf883ZkisJuEq/ZiezlZuzqyRA4B/A70sHXbR X-Received: by 10.194.144.10 with SMTP id si10mr13390834wjb.180.1461236689089; Thu, 21 Apr 2016 04:04:49 -0700 (PDT) Received: from localhost.localdomain (cpc84787-aztw28-2-0-cust15.18-1.cable.virginm.net. [82.37.140.16]) by smtp.gmail.com with ESMTPSA id v143sm9184279wmv.4.2016.04.21.04.04.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Apr 2016 04:04:48 -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, dmaengine@vger.kernel.org, devicetree@vger.kernel.org, arnd@arndb.de, broonie@kernel.org, ludovic.barre@st.com Subject: [PATCH 05/18] dmaengine: st_fdma: Add fdma suspend and resume callbacks. Date: Thu, 21 Apr 2016 12:04:22 +0100 Message-Id: <1461236675-10176-6-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461236675-10176-1-git-send-email-peter.griffin@linaro.org> References: <1461236675-10176-1-git-send-email-peter.griffin@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) -- 1.9.1 diff --git a/drivers/dma/st_fdma.c b/drivers/dma/st_fdma.c index 5fcaf10..48a66c9 100644 --- a/drivers/dma/st_fdma.c +++ b/drivers/dma/st_fdma.c @@ -1132,10 +1132,51 @@ 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; +} +#endif + +static const struct dev_pm_ops st_fdma_pm = { + SET_RUNTIME_PM_OPS(st_fdma_pm_suspend, st_fdma_pm_resume, NULL) +}; + 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,