From patchwork Wed Aug 4 15:36:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 491680 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp1744454jap; Wed, 4 Aug 2021 08:36:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv37ezqQjc2dn/AvP7gaxI4GCVQlOn1yWkQ4skiJU5RjWmoTgYkhvpR9HSP1klkWtteBb6 X-Received: by 2002:a17:906:7f16:: with SMTP id d22mr26317078ejr.135.1628091399082; Wed, 04 Aug 2021 08:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628091399; cv=none; d=google.com; s=arc-20160816; b=FcSFYT731B2jIYYL9FA6EbaaqiXb2k6i6mehKOcQwo8G1dYZRqf3ffkNkQP8YQo1zy ILFJgl5rpzDoVRRf20FTA67n2xLqN0k8p4zfXKUOKksW1aljmUWzC1iCQSXPfKsFZCUa RYdS7dPLcxRc4Iacm0ceGoYOiMwYFKKd5kPo3+oqYPB1wccvBcgx74RA2u0rtxLpPDMV omy6bu0CXFRTeNWEzBuBhS8Ut2P6xgisP2zcWoRJu+SNyN/af0A2wS1U4HVM+oezbdtu IwREknweZ+4Q6jhg2GlokBxnEcd5/4Nf8u9chesSqOfkIc1maiViWLx5Naev+0RoRKjf CsPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Qj5hg+/X071K3Vl+DCzlvkxK2DWvvHHp1jaLOqDGaMc=; b=Bo5jCFaVaMtutfW+a8TopPz7oDnjoGaLPlr2347Kd1exa3LZUTLehMr9LY0buLj/EJ F42t/8rEVWSJurjZ+pklePrrQkI1CjnfQu+JXYBQG3QiPRsRS0OChP6DvYxyqGqlt2rl HXVoJBvP8W8QmgANIPVmYrwOKfRsivQb4GFaQpnI19lm2eoIbimjd/Cg9eYHAXzbmebx h5a2GbQKenrnrbqyqeiePDqP3K+M4ZavcKQL7ynL+2p09LAvYADrEnl0fywyQ59HQwum xRMOjjr6qfATDeeWSLI7WF2i43cvA0CfM1yyePQHoMPDOBnU0Lha7XfYwbCXX7YW+cUC P7Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p3DO1aCy; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id me18si2499859ejb.340.2021.08.04.08.36.38; Wed, 04 Aug 2021 08:36:39 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p3DO1aCy; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239128AbhHDPgu (ORCPT + 8 others); Wed, 4 Aug 2021 11:36:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239139AbhHDPgq (ORCPT ); Wed, 4 Aug 2021 11:36:46 -0400 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E664C061798 for ; Wed, 4 Aug 2021 08:36:33 -0700 (PDT) Received: by mail-il1-x12d.google.com with SMTP id r1so2036795iln.6 for ; Wed, 04 Aug 2021 08:36:33 -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 :mime-version:content-transfer-encoding; bh=Qj5hg+/X071K3Vl+DCzlvkxK2DWvvHHp1jaLOqDGaMc=; b=p3DO1aCy81oCCZ6k0rsXq2geBf1UsmLcb09uL/xh/3AqDk4MpjWo8/6txzU+r0RDp7 lUGvI14uMErll9NdUymXrDv+XbuDz+Ol4dTb4HKP6f9Yh/BfCgqmBTOUOpl3XrYBaFrm JfrjnqxYUsXU7pDMdviqwN+oqPpwFaXqIXOHbg3nDnDO1G3x28hP0wlNyzt8Lo3UVIi4 ZEurnEeTU0Lr1XtJo2N20aHp5zk+Mm0wfL9kNvf9iVx2H6LpxipJXJPGDdd9/s/OYwDv J8IRRHSSpVj3gwLAwYkVfWi/1W0DLG93GZvJVrAtaj6Krn+FY4DMInzY06bF9O89amID tA0w== 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:mime-version:content-transfer-encoding; bh=Qj5hg+/X071K3Vl+DCzlvkxK2DWvvHHp1jaLOqDGaMc=; b=EHFI7GZpIA2EIvshL186Rmhg01zlqmqjrJ1ZM/4d7Glq2K7nBMdqqD4zEYHBy6NbpO I03Ovi+HSmDmRcOsPTviuRKJ5uyKTuT6fxmH0v0mX15cEbIEijOGe+rmmrjQrpKR9lg4 J/tuk/DfboYA75F7peejpYePe71+LDySzki0RmidTHEA50319SKs5mrUFCgwBO+ie8D/ 6vBe01nBoe9ZWA+Ucmn9W9SSn8Otc7jg9u0+Zrf0YwnnIQjVnEIpjntRla+f8zirsbhc 1QmEv2tPxbx3g6m49uAOGx3mA7bn/lGjvKNRd3fVRXP0bxzpX/rsvcIC/eRCCUgqEPzr pTZg== X-Gm-Message-State: AOAM531zmpS2yfQgEqEDvp66lwpjSKhp/5j5m8Fl+v3aI4wQWK9CRd/W 2Z/AaTEIVrxqXhm0vVk67jqHLw== X-Received: by 2002:a92:cd41:: with SMTP id v1mr225635ilq.212.1628091393090; Wed, 04 Aug 2021 08:36:33 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id z11sm1687480ioh.14.2021.08.04.08.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 08:36:32 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/6] net: ipa: move IPA power operations to ipa_clock.c Date: Wed, 4 Aug 2021 10:36:24 -0500 Message-Id: <20210804153626.1549001-5-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210804153626.1549001-1-elder@linaro.org> References: <20210804153626.1549001-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Move ipa_suspend() and ipa_resume(), as well as the definition of the ipa_pm_ops structure into "ipa_clock.c". Make ipa_pm_ops public and declare it as extern in "ipa_clock.h". This is part of centralizing IPA power management functionality into "ipa_clock.c" (the file will eventually get a name change). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 62 +++++++++++++++++++++++++++++++++++++ drivers/net/ipa/ipa_clock.h | 3 ++ drivers/net/ipa/ipa_main.c | 59 ----------------------------------- 3 files changed, 65 insertions(+), 59 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index 849b6ec671a4d..475ea6318cdb2 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -9,9 +9,12 @@ #include #include #include +#include +#include #include "ipa.h" #include "ipa_clock.h" +#include "ipa_endpoint.h" #include "ipa_modem.h" #include "ipa_data.h" @@ -334,3 +337,62 @@ void ipa_clock_exit(struct ipa_clock *clock) kfree(clock); clk_put(clk); } + +/** + * ipa_suspend() - Power management system suspend callback + * @dev: IPA device structure + * + * Return: Always returns zero + * + * Called by the PM framework when a system suspend operation is invoked. + * Suspends endpoints and releases the clock reference held to keep + * the IPA clock running until this point. + */ +static int ipa_suspend(struct device *dev) +{ + struct ipa *ipa = dev_get_drvdata(dev); + + /* Endpoints aren't usable until setup is complete */ + if (ipa->setup_complete) { + __clear_bit(IPA_FLAG_RESUMED, ipa->flags); + ipa_endpoint_suspend(ipa); + gsi_suspend(&ipa->gsi); + } + + ipa_clock_put(ipa); + + return 0; +} + +/** + * ipa_resume() - Power management system resume callback + * @dev: IPA device structure + * + * Return: Always returns 0 + * + * Called by the PM framework when a system resume operation is invoked. + * Takes an IPA clock reference to keep the clock running until suspend, + * and resumes endpoints. + */ +static int ipa_resume(struct device *dev) +{ + struct ipa *ipa = dev_get_drvdata(dev); + + /* This clock reference will keep the IPA out of suspend + * until we get a power management suspend request. + */ + ipa_clock_get(ipa); + + /* Endpoints aren't usable until setup is complete */ + if (ipa->setup_complete) { + gsi_resume(&ipa->gsi); + ipa_endpoint_resume(ipa); + } + + return 0; +} + +const struct dev_pm_ops ipa_pm_ops = { + .suspend = ipa_suspend, + .resume = ipa_resume, +}; diff --git a/drivers/net/ipa/ipa_clock.h b/drivers/net/ipa/ipa_clock.h index 1fe634760e59d..2f0310d5709ca 100644 --- a/drivers/net/ipa/ipa_clock.h +++ b/drivers/net/ipa/ipa_clock.h @@ -11,6 +11,9 @@ struct device; struct ipa; struct ipa_clock_data; +/* IPA device power management function block */ +extern const struct dev_pm_ops ipa_pm_ops; + /** * ipa_clock_rate() - Return the current IPA core clock rate * @ipa: IPA structure diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index ae51109dea01b..28350b7c50c56 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -874,65 +874,6 @@ static void ipa_shutdown(struct platform_device *pdev) dev_err(&pdev->dev, "shutdown: remove returned %d\n", ret); } -/** - * ipa_suspend() - Power management system suspend callback - * @dev: IPA device structure - * - * Return: Always returns zero - * - * Called by the PM framework when a system suspend operation is invoked. - * Suspends endpoints and releases the clock reference held to keep - * the IPA clock running until this point. - */ -static int ipa_suspend(struct device *dev) -{ - struct ipa *ipa = dev_get_drvdata(dev); - - /* Endpoints aren't usable until setup is complete */ - if (ipa->setup_complete) { - __clear_bit(IPA_FLAG_RESUMED, ipa->flags); - ipa_endpoint_suspend(ipa); - gsi_suspend(&ipa->gsi); - } - - ipa_clock_put(ipa); - - return 0; -} - -/** - * ipa_resume() - Power management system resume callback - * @dev: IPA device structure - * - * Return: Always returns 0 - * - * Called by the PM framework when a system resume operation is invoked. - * Takes an IPA clock reference to keep the clock running until suspend, - * and resumes endpoints. - */ -static int ipa_resume(struct device *dev) -{ - struct ipa *ipa = dev_get_drvdata(dev); - - /* This clock reference will keep the IPA out of suspend - * until we get a power management suspend request. - */ - ipa_clock_get(ipa); - - /* Endpoints aren't usable until setup is complete */ - if (ipa->setup_complete) { - gsi_resume(&ipa->gsi); - ipa_endpoint_resume(ipa); - } - - return 0; -} - -static const struct dev_pm_ops ipa_pm_ops = { - .suspend = ipa_suspend, - .resume = ipa_resume, -}; - static const struct attribute_group *ipa_attribute_groups[] = { &ipa_attribute_group, &ipa_feature_attribute_group,