From patchwork Thu Dec 5 14:37:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11274883 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 617C117EF for ; Thu, 5 Dec 2019 14:38:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 400482464F for ; Thu, 5 Dec 2019 14:38:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sxN67uP4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729540AbfLEOiE (ORCPT ); Thu, 5 Dec 2019 09:38:04 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:47040 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729531AbfLEOiE (ORCPT ); Thu, 5 Dec 2019 09:38:04 -0500 Received: by mail-lj1-f194.google.com with SMTP id z17so3791249ljk.13 for ; Thu, 05 Dec 2019 06:38:02 -0800 (PST) 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=LSrF1PZUXbppNkp6LXsmHrupmqPqLYDRsBF1XZV1SZg=; b=sxN67uP4loA2uHVs+iOAju81idbHAz9JP72QF6fKvTGIBFrU1Ua8i01zaU68+uf3r/ urNNV+Iz+exbXJ5FVf9/xL0wwVLxJjGMy26aTWthtKyBHeJBU5QpIlUOCXNIsTUcs+RI jiB7cRjBt+fPB+dm138tcJkjdDnnJQTJjor5aPFh5cLcVvaKvYoGabS5xUxT+xqe+XTR CiEWOrrv5UtBchNW0igsiGTTUPyx54CeEfWEr0YP0OE4UKZUp8E4o3mG9k61O8F4hSOG z2rSjx62rxmpyyqczRq84KZH7KyFgTOoApJxXSdZnwHiaqZKTxbYqLxQHf+MS3yi9UWl 126g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LSrF1PZUXbppNkp6LXsmHrupmqPqLYDRsBF1XZV1SZg=; b=UKkNObSJr5WqoGCS+XzV6fSmJMnUBgjCV7hXkNfVGuVCdOSsYNJ5krTA+2rlLrnWDj zMkennQCiMfxVEGRhxPPYFGCSowVQQAUlKrghk0+OMU7TbcedijSQybbAFnZaniSjVf8 bcLadYxhcS0vH9SntgMJoyl05e2POR3kojsyiz6E7vypHhAnq3WzCfqXEtOOJbkLM25y TVLEZaCAR9CtEGvwSlNOLn5QAyvC3gwP1OykbsV9/Z/oR0NtxH5ENBGVnwYcRd5aTORI 8+SCZpsmuLm401F9C+q61lajX+SJMxKNAOHKibrJ+tt1icPgDIVwo5zg9sSEOTBuHjta JvJg== X-Gm-Message-State: APjAAAV0tzmXpg+/zXPWb9eStaaVlYOjin1upYarfYbo2ZCbcWl12cHb 99r1iAEHS9sCh3C7P9++S7CFsw== X-Google-Smtp-Source: APXvYqwS24lod+spv8JCEF1FwqJCKBEO1ZzNkv2x+NXiSPtPs2deTNm4TBwRmXyfhjEheQuZ3E/lQg== X-Received: by 2002:a05:651c:112d:: with SMTP id e13mr4993155ljo.99.1575556682219; Thu, 05 Dec 2019 06:38:02 -0800 (PST) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id q10sm5091294ljj.60.2019.12.05.06.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 06:38:01 -0800 (PST) From: Ulf Hansson To: Vinod Koul , dmaengine@vger.kernel.org Cc: Marek Szyprowski , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Ulf Hansson Subject: [PATCH 1/2] dmaengine: pl330: Drop boilerplate code for suspend/resume Date: Thu, 5 Dec 2019 15:37:45 +0100 Message-Id: <20191205143746.24873-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205143746.24873-1-ulf.hansson@linaro.org> References: <20191205143746.24873-1-ulf.hansson@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Let's drop the boilerplate code in the system suspend/resume callbacks and convert to use pm_runtime_force_suspend|resume(). This change also has a nice side effect, as pm_runtime_force_resume() may decide to leave the device in low power state, when that is feasible, thus avoiding to waste both time and energy during system resume. Signed-off-by: Ulf Hansson Tested-by: Marek Szyprowski --- drivers/dma/pl330.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 6cce9ef61b29..8e01da157518 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2961,12 +2961,7 @@ static int __maybe_unused pl330_suspend(struct device *dev) { struct amba_device *pcdev = to_amba_device(dev); - pm_runtime_disable(dev); - - if (!pm_runtime_status_suspended(dev)) { - /* amba did not disable the clock */ - amba_pclk_disable(pcdev); - } + pm_runtime_force_suspend(dev); amba_pclk_unprepare(pcdev); return 0; @@ -2981,10 +2976,7 @@ static int __maybe_unused pl330_resume(struct device *dev) if (ret) return ret; - if (!pm_runtime_status_suspended(dev)) - ret = amba_pclk_enable(pcdev); - - pm_runtime_enable(dev); + pm_runtime_force_resume(dev); return ret; } From patchwork Thu Dec 5 14:37:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 11274885 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E006930 for ; Thu, 5 Dec 2019 14:38:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2CBF32464F for ; Thu, 5 Dec 2019 14:38:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rEnJa1eg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729530AbfLEOiF (ORCPT ); Thu, 5 Dec 2019 09:38:05 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:32872 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729406AbfLEOiF (ORCPT ); Thu, 5 Dec 2019 09:38:05 -0500 Received: by mail-lj1-f194.google.com with SMTP id 21so3898201ljr.0 for ; Thu, 05 Dec 2019 06:38:04 -0800 (PST) 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=yV3GhPFmJytkxtEGQExTIppqC25xkrzPKeo9NSW2jNs=; b=rEnJa1egaaC2TNAcUXrNmliNqPwcGsDByFWAWwyIoE8s7yMfeadjXObeaSnewLqqTR 6K8eNGbAQYDEIdX7O7ksSwrSkmijvlbJpdvWlEDdQzcS4sUppx7yRjcuBRm3Fn34ogiQ fiEzd81IK2TeJEHvNgiDrHrOD2Shx4icapMGWypOZMBRO8nWrGie1Q4hcuKb3324rS/P sbEn93MkptyWC+hqRKGk75Rh+Nv2qXIiyo+j4fJtEV/x1qkYub2GL6KWK4OOQoDqx4mz fjDzulI7WD0qKMZgjuCxwTNev8gs/GQIk4m/SxDB7DGq/ufNtwBTgp/GzIL7hq6wg/lj r3mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yV3GhPFmJytkxtEGQExTIppqC25xkrzPKeo9NSW2jNs=; b=AT/lWSmF/Ro/kw48eR4N77T0tTMVNBcHqBttH42Mn8EYql0tGOy6/uQwx4lNnANqhU 0vd7Li73b7nI/EGZfmJ5Us7CBIaHV4gRQQF8aPMFd5nPGvTfj5badEosOxGtmqTZ1d25 Nz34rIi62K6XQStyHRgD9Gjm7dx8kIUYmLWObR+ORmvf28VwLnxZxM4d2270qtp2v4/J 5RM4kwZiVe0o7Gt3tyKNmZPLc8FRHdCU8I87+3nTDWFtnbLvUDHC9ZA0XAyMAomE2dkk QQp5CNdD5ZAbEAh7XXdhS6Vv+e5SUNtMQFp8gPHWnUzbQgWLkJB7YYXd50eNbO1f7oai /QBA== X-Gm-Message-State: APjAAAVETQbjCUWt0OAHEmXN46f1bhtPqsb3FKwpvTUJ3EOtydlOqlNX GSbJBtLubf+XkNlxX0aKXdMjyQ== X-Google-Smtp-Source: APXvYqxpjsbqgz0brAMyxbLOAnsZnvOdw6fvFP4gA9g80ZYWL7pNAQmuXVdBtC8GlmBSytntjAah8w== X-Received: by 2002:a2e:b4cb:: with SMTP id r11mr2586523ljm.68.1575556683734; Thu, 05 Dec 2019 06:38:03 -0800 (PST) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id q10sm5091294ljj.60.2019.12.05.06.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 06:38:02 -0800 (PST) From: Ulf Hansson To: Vinod Koul , dmaengine@vger.kernel.org Cc: Marek Szyprowski , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Ulf Hansson Subject: [PATCH 2/2] dmaengine: pl330: Convert to the *_late and *_early system sleep callbacks Date: Thu, 5 Dec 2019 15:37:46 +0100 Message-Id: <20191205143746.24873-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205143746.24873-1-ulf.hansson@linaro.org> References: <20191205143746.24873-1-ulf.hansson@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org It has turned out that it's in general a good idea for dmaengines to allow DMA requests during the entire dpm_suspend() phase. Therefore, convert the pl330 driver into using SET_LATE_SYSTEM_SLEEP_PM_OPS. Signed-off-by: Ulf Hansson Tested-by: Marek Szyprowski --- drivers/dma/pl330.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 8e01da157518..88b884cbb7c1 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2981,7 +2981,9 @@ static int __maybe_unused pl330_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(pl330_pm, pl330_suspend, pl330_resume); +static const struct dev_pm_ops pl330_pm = { + SET_LATE_SYSTEM_SLEEP_PM_OPS(pl330_suspend, pl330_resume) +}; static int pl330_probe(struct amba_device *adev, const struct amba_id *id)