From patchwork Thu Jan 21 11:17:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5678C433DB for ; Thu, 21 Jan 2021 11:21:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 706C4238E1 for ; Thu, 21 Jan 2021 11:21:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 706C4238E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=t3vYVtmex36Xc91SFvP1jss3dYhN6kMNOAjUMS8n+2M=; b=uX6hDsOQvR+OWVZ8Uhq+vfXiJ 83vz2E/+fGoGRLxrtbHgWWKdaUjaK65Qn1ES7nVtIasFRfnzHhHVfYsIM0bQfPCr2l1keIsgPaIeQ ieaBgGJ+oSjLlhaA7yFfano4DRlICvxQyXGBCkb0LXMk9T/mwInu06bC1euMvw5qD6UzmbEqlLePE lziedDY2W2dBLbfs+EevQrxb8iiwxKyHgR6FMnSk1uDOtafPCLFGYCRoLNNU9vNnI4HAIFWmEbQdz aOtXjiJrQ+INRk2rZugr+HFVY4GXFquOB2dOnNkXM4/VNPzHDt6VkwsI15nbTOSh/11GuHbGYi792 CaLUc9p0g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzG-0004wM-1x; Thu, 21 Jan 2021 11:18:50 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzD-0004vR-7u for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:18:47 +0000 Received: by mail-pg1-x533.google.com with SMTP id z21so1162155pgj.4 for ; Thu, 21 Jan 2021 03:18:46 -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 :mime-version:content-transfer-encoding; bh=DAtjI7/BPs0IoV2iaS54lmWpFTE0HbF0Es/G22rWt3g=; b=ZpmS5LN1rts74B7Ode0O1RTIMsoc8Gi0J/g/qdh4T4B+Pl5+6gDcpGtwEy3pxwaa1n KJMIk8ywsFR4wtEZeD3cynSaQbttOpg++x8NwKSnz5NE2yMDL+xniSZ2kjT0faYRi5pL M+Ww1NxEYcW6YGEkuuNHvtUhb0dRL8IgsIE9SQlSprdhSHMaSGscj1dOZ0pc7bkhMeRY 40VDRsunRhdrZp8VxhHfj0mrnlOz/vOMk0C1DUU9eLTtmhKiclL+GWz1UIm6g+zTmw1Y u2QUTm7Kird1vwS6WBpw7kK7Uo1YQ75ztHo2FgLS8AEfwPTzQ4+ugUeRvnqx9lyoBgi/ jm/Q== 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=DAtjI7/BPs0IoV2iaS54lmWpFTE0HbF0Es/G22rWt3g=; b=LCRXm/2cZlbzrnV/OdEo25NmXYsU6nbLduRI0GjJ3DGQTrtzeaNULCyG1Q5eTBscFQ ASz4LzXbKICgPkc/qPXfCm2LXp+aPr8s7DF3v76LvJK/OrE1dCFMoAY2mitwpJ9CHTlr 4NlntVrLgV8uNIuaiPnpdwzo7OK+GcI4OgKflH1p+nbpv//PCSNzyAYzDpeM/5P6pHd5 qykmU3enxRqCk9P/Q1uD48I2t8EHCIu9UzHQP+FNIr1+UeGaUQVyRwdX+5M8BG5PGjTm HVAJzdH3RKEPQQix70DKmxHQqcYvhsIv7FyIDdnJ4QqIRccoucw4eVBfJYpLQ2KluZC0 QA5A== X-Gm-Message-State: AOAM532ctPUkOh5m89WBTU4cerwlfkHqxMLDVMMfI36hm7FhwYGI4jMl +QV67rKuR4eypL/yiuW0IFNxew== X-Google-Smtp-Source: ABdhPJyts296w7aWmAZLnK+2Ns297gN4vfmOwF34Q5MA6SM/rmkzGZINgd1d7pMVUGniT2QI9Kk1mQ== X-Received: by 2002:a05:6a00:a8d:b029:1ba:71d1:fe3c with SMTP id b13-20020a056a000a8db02901ba71d1fe3cmr9122927pfl.51.1611227909301; Thu, 21 Jan 2021 03:18:29 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id u1sm5595280pjr.51.2021.01.21.03.18.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:18:28 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH 01/13] opp: Rename _opp_set_rate_zero() Date: Thu, 21 Jan 2021 16:47:41 +0530 Message-Id: X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061847_282796_5B96162A X-CRM114-Status: GOOD ( 14.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This routine has nothing to do with frequency, it just disables all the resources previously enabled. Rename it to match its purpose. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index aea0b9d7203c..9ec8e42981d0 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -943,7 +943,7 @@ int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp) } EXPORT_SYMBOL_GPL(dev_pm_opp_set_bw); -static int _opp_set_rate_zero(struct device *dev, struct opp_table *opp_table) +static int _disable_opp_table(struct device *dev, struct opp_table *opp_table) { int ret; @@ -997,7 +997,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) } if (unlikely(!target_freq)) { - ret = _opp_set_rate_zero(dev, opp_table); + ret = _disable_opp_table(dev, opp_table); goto put_opp_table; } From patchwork Thu Jan 21 11:17:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0722AC433E0 for ; Thu, 21 Jan 2021 11:21:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9698B238E1 for ; Thu, 21 Jan 2021 11:21:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9698B238E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=w5AGxnG2+fJ+HtB87ewkVwZa+5cQQxRQrRBOW7ENU0o=; b=U7Abd64cd0ZSUZu/pjx+30/hS z4X6W2RtkGmvESqx03PYrvKvWnnON47ZHbJ149VBwS3DjHo06aKnHZV5u1dlAxGh0shCLR3JJKE9z oJKLqw9TSlMo1gF5xeie5jl+rCxMbewN30baD4APh6c3TLICQYdpK6gbs1VkK/uCQrO6epI7qSBu3 gwIVS3GYc+TJNeolQLLxF3c7PvrQCkp3162Co7Z+fDulbbDS8KQnIA81oiylTg0o6lsA13iTYtBSi JoQjEoEf1kDwDd9UvrWbIEge1JCs35G8haqAAPEBqkzr7f6z3so62GyYWfiFhOjW1gRt+2s9M8673 7tw7jgyVQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzK-0004yV-Ot; Thu, 21 Jan 2021 11:18:54 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzG-0004wH-CD for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:18:51 +0000 Received: by mail-pl1-x633.google.com with SMTP id be12so1114974plb.4 for ; Thu, 21 Jan 2021 03:18:49 -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 :mime-version:content-transfer-encoding; bh=t5BvkMjuaVY08gUJbMK2zLQ+31ycbwXJT/Kur/3Z95w=; b=F1sJbjeFjLx44rMNM9VXJT1VmL0MJFDwx3vGHr2mL8qHmnto11WjN8OD6D0Tyl/3vP yxjF81dLQrtt3ea+reaI7O2lR4kp3WgLQ2E6yT65oolB8vJLDeETZLwZ8AT+H4p8KKFM eVMKCCkc3lJqxoLslpyYIPktsJtfe5IAPrM3JkeG+gRiiPJgp7Ea+eeujptT99yVRHvE 3w0lz9qDfeIR6CqQj7nyk17ZQYSS2gaCG++MImOdhNGYBOSZMr3IFxb3hxWFMP1rpLwi t0cbvWkGBBmFxH5Ts7PPu2urw4C14l638fkduz4HQve/esYKhJsb+KyPYqvVC6MIXtUr 81tQ== 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=t5BvkMjuaVY08gUJbMK2zLQ+31ycbwXJT/Kur/3Z95w=; b=JMtmOzpdFnjOFZC7OXzggWw4lftfYzN+JqpzI7NklzDo3lyZru1sdnEvU2j8UmIVIs Wn9L+lmv+oQWat+b9nAHTbNkIMO2FgnCoVMWZT+dfzg1mD7Hvr1UgM0484dhzraliovu 9pNLkUDuKI5MPYh8PC8tQMkqifmnGYFvlv1t9mSU2bqDp0PeiD/DbdEaqRuxxap6PZWw SCIQOf5st98X0rfWchZ9x1hAPm9lnaEGrWRYFW5awjnzQx60DdxYJLk794eTCI3/AgVW xQrT36z0fmnaSjce/1ZusNzczK/cOjwwfjEogQOTgI9febKTEgetifMOMqG1ji1sSmS2 EUOw== X-Gm-Message-State: AOAM531tvrSMeUW85CDQ9sQSB/pOL3R/Q3X6tL4zX45+b5AVg6ow8C2g KLhtaIO0D0eVLLfH2fNxHLFMIg== X-Google-Smtp-Source: ABdhPJz7q/I5ANoKOSZSRSNYadjp4zVir7HUG9/UL0WMu7ayW5Oc9Bj7FnQUI7AdPHyZwNvg7ZPdOg== X-Received: by 2002:a17:90a:9eb:: with SMTP id 98mr4799013pjo.40.1611227927908; Thu, 21 Jan 2021 03:18:47 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id d22sm5661965pjv.11.2021.01.21.03.18.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:18:47 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH 02/13] opp: No need to check clk for errors Date: Thu, 21 Jan 2021 16:47:42 +0530 Message-Id: <26fe0df01647061cee8278af64a86610d65711f6.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061850_457098_976465DA X-CRM114-Status: GOOD ( 15.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clock is not optional for users who call into dev_pm_opp_set_rate(). Remove the unnecessary checks. While at it also drop the local variable for clk and use opp_table->clk instead. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 9ec8e42981d0..cb5b67ccf5cf 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -987,7 +987,6 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) struct opp_table *opp_table; unsigned long freq, old_freq, temp_freq; struct dev_pm_opp *old_opp, *opp; - struct clk *clk; int ret; opp_table = _find_opp_table(dev); @@ -1001,19 +1000,11 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) goto put_opp_table; } - clk = opp_table->clk; - if (IS_ERR(clk)) { - dev_err(dev, "%s: No clock available for the device\n", - __func__); - ret = PTR_ERR(clk); - goto put_opp_table; - } - - freq = clk_round_rate(clk, target_freq); + freq = clk_round_rate(opp_table->clk, target_freq); if ((long)freq <= 0) freq = target_freq; - old_freq = clk_get_rate(clk); + old_freq = clk_get_rate(opp_table->clk); /* Return early if nothing to do */ if (opp_table->enabled && old_freq == freq) { @@ -1031,7 +1022,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) * equivalent to a clk_set_rate() */ if (!_get_opp_count(opp_table)) { - ret = _generic_set_opp_clk_only(dev, clk, freq); + ret = _generic_set_opp_clk_only(dev, opp_table->clk, freq); goto put_opp_table; } @@ -1071,7 +1062,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) opp->supplies); } else { /* Only frequency scaling */ - ret = _generic_set_opp_clk_only(dev, clk, freq); + ret = _generic_set_opp_clk_only(dev, opp_table->clk, freq); } /* Scaling down? Configure required OPPs after frequency */ From patchwork Thu Jan 21 11:17:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76F9FC433E0 for ; Thu, 21 Jan 2021 11:21:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23CA2238E1 for ; Thu, 21 Jan 2021 11:21:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23CA2238E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=awD7LrXaa2OwTvnhdea2/k7YpOwbQc/mYzq1C46SOto=; b=Ed09QWwBJpjxVHxwfcAkG3xrN VQRVLNNT7JSKXMeY1msSNHOKVii1BbEA3glr66GXP45IrkmM2mqRvXAE+bHT5wR35QPUtmsn/4LwO qslLMBHx6wBEqHPID3IRkKQdM5to6BqLdt5Yl9y6uEkG+YMiQCr5xMxYyVTGyJq6tP6y8YwoTF+AK 0GejHhHarmQX8aeOUroz+suD6IXzW+TLUKhzqpfdZRd6bpcH1kjdNn6hS2UP0hZYwEvVI3ah+X7xS 73KYvctricI5GKo03n+1asJhVKSdPbvQIAFkrwt2nv4sREzJeaaRBcATvZ1m6HclG0yYVnzvABkjt Q/ShhxFYw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzR-00050P-2R; Thu, 21 Jan 2021 11:19:01 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzK-0004xu-8C for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:18:55 +0000 Received: by mail-pj1-x102d.google.com with SMTP id u4so1449002pjn.4 for ; Thu, 21 Jan 2021 03:18:53 -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 :mime-version:content-transfer-encoding; bh=YF247aIKbCY2/r4PGlk3GxBCCQW3KMMZcpJEZOc5/Q0=; b=q4aQO8etJergPAghmEtuVxVLdykQPpd3HcPHMD6EQfoX4tjuP7MhEF6K18XC4Inuvs RKy9SstcZSdr5meQkznW9PfhKeD+22MQjTjs4PHJH9L58N3mnjyCGPezVaH7gzv1IJhs bT8Lesss5bsMcmN703omHfIN795Q3hMsxgr9GzjVPd43t1fDQ4eATXjN6CiHR+qCOpzC 8WvFnYva6RL0BKdBzgnMwkV+jxxe4VLJOt1F2Jbz//EiJliXk3CRa8qY5cwHxmXPFaho DxRROl7t7RugdR/omHIBFABHDp6JPTYdUWtoOf4Stb2KFicJr+1c4y7rqExGmMRTsAS4 tcaA== 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=YF247aIKbCY2/r4PGlk3GxBCCQW3KMMZcpJEZOc5/Q0=; b=WBhkq6bM7LTKC5N6yHrlnkAyBSa37cq25c17LBizOuS++8XJUCCJ+kS/u8CUSjYYJk 2VzUd+MuhTQ2l2kDKQVI0bYyN3gw/3ErzT7bEcFG6LTpBBQ3PoRdfu2QAYwAUhpXJcbq bhuA6XVaraVP/ZXV+0wfQyPo4b/7Qsy/WTSxlSZbH7gjSLt1hRRc0N7S1DdGntPaFzDE mbNd1tL+ZINZSd9pNqXDrsbQzf47v9dBZEBhWvAuxdwDrMmvWl3zz1KHBpzZMziLoh69 ANR7veACJGzCxD7LrdjntWsSYqN3LHs0TIRi/PWBeOvIFurcxmr6RdAZDqvyWEJxVSpt aqgA== X-Gm-Message-State: AOAM530iukjyXkOyDFp8vx7AMNHyPCKFj7Xq6zKrW2Y/NTq4GNBiKesf 92meN1gC0Jib3occB0GaVXtsyw== X-Google-Smtp-Source: ABdhPJwfrY+H9LpE/xzRxcE/UG1SyICoTj1JCeeOTMnUNb06bH1CDejbbABKsIFbSOnrOGELyi32/w== X-Received: by 2002:a17:902:c509:b029:de:c3c7:9433 with SMTP id o9-20020a170902c509b02900dec3c79433mr14234653plx.71.1611227931401; Thu, 21 Jan 2021 03:18:51 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id z13sm5392343pgf.89.2021.01.21.03.18.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:18:50 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH 03/13] opp: Keep track of currently programmed OPP Date: Thu, 21 Jan 2021 16:47:43 +0530 Message-Id: <96b57316a2a307a5cc5ff7302b3cd0084123a2ed.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061854_333025_633389F1 X-CRM114-Status: GOOD ( 25.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The dev_pm_opp_set_rate() helper needs to know the currently programmed OPP to make few decisions and currently we try to find it on every invocation of this routine. Lets start keeping track of the current_opp programmed for the devices of the opp table, that will be quite useful going forward. If we fail to find the current OPP, we pick the first one available in the list, as the list is in ascending order of frequencies, level, or bandwidth and that's the best guess we can make anyway. Note that we used to do the frequency comparison a bit early in dev_pm_opp_set_rate() previously, and now instead we check the target opp, which shall be more accurate anyway. We need to make sure that current_opp's memory doesn't get freed while it is being used and so we keep a reference of it until the time it is used. Now that current_opp will always be set, we can drop some unnecessary checks as well. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 83 +++++++++++++++++++++++++++++----------------- drivers/opp/opp.h | 2 ++ 2 files changed, 55 insertions(+), 30 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index cb5b67ccf5cf..4ee598344e6a 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -788,8 +788,7 @@ static int _generic_set_opp_regulator(struct opp_table *opp_table, __func__, old_freq); restore_voltage: /* This shouldn't harm even if the voltages weren't updated earlier */ - if (old_supply) - _set_opp_voltage(dev, reg, old_supply); + _set_opp_voltage(dev, reg, old_supply); return ret; } @@ -839,10 +838,7 @@ static int _set_opp_custom(const struct opp_table *opp_table, data->old_opp.rate = old_freq; size = sizeof(*old_supply) * opp_table->regulator_count; - if (!old_supply) - memset(data->old_opp.supplies, 0, size); - else - memcpy(data->old_opp.supplies, old_supply, size); + memcpy(data->old_opp.supplies, old_supply, size); data->new_opp.rate = freq; memcpy(data->new_opp.supplies, new_supply, size); @@ -943,6 +939,31 @@ int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp) } EXPORT_SYMBOL_GPL(dev_pm_opp_set_bw); +static void _find_current_opp(struct device *dev, struct opp_table *opp_table) +{ + struct dev_pm_opp *opp = ERR_PTR(-ENODEV); + unsigned long freq; + + if (!IS_ERR(opp_table->clk)) { + freq = clk_get_rate(opp_table->clk); + opp = _find_freq_ceil(opp_table, &freq); + } + + /* + * Unable to find the current OPP ? Pick the first from the list since + * it is in ascending order, otherwise rest of the code will need to + * make special checks to validate current_opp. + */ + if (IS_ERR(opp)) { + mutex_lock(&opp_table->lock); + opp = list_first_entry(&opp_table->opp_list, struct dev_pm_opp, node); + dev_pm_opp_get(opp); + mutex_unlock(&opp_table->lock); + } + + opp_table->current_opp = opp; +} + static int _disable_opp_table(struct device *dev, struct opp_table *opp_table) { int ret; @@ -1004,16 +1025,6 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) if ((long)freq <= 0) freq = target_freq; - old_freq = clk_get_rate(opp_table->clk); - - /* Return early if nothing to do */ - if (opp_table->enabled && old_freq == freq) { - dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n", - __func__, freq); - ret = 0; - goto put_opp_table; - } - /* * For IO devices which require an OPP on some platforms/SoCs * while just needing to scale the clock on some others @@ -1026,12 +1037,9 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) goto put_opp_table; } - temp_freq = old_freq; - old_opp = _find_freq_ceil(opp_table, &temp_freq); - if (IS_ERR(old_opp)) { - dev_err(dev, "%s: failed to find current OPP for freq %lu (%ld)\n", - __func__, old_freq, PTR_ERR(old_opp)); - } + /* Find the currently set OPP if we don't know already */ + if (unlikely(!opp_table->current_opp)) + _find_current_opp(dev, opp_table); temp_freq = freq; opp = _find_freq_ceil(opp_table, &temp_freq); @@ -1039,7 +1047,17 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) ret = PTR_ERR(opp); dev_err(dev, "%s: failed to find OPP for freq %lu (%d)\n", __func__, freq, ret); - goto put_old_opp; + goto put_opp_table; + } + + old_opp = opp_table->current_opp; + old_freq = old_opp->rate; + + /* Return early if nothing to do */ + if (opp_table->enabled && old_opp == opp) { + dev_dbg(dev, "%s: OPPs are same, nothing to do\n", __func__); + ret = 0; + goto put_opp; } dev_dbg(dev, "%s: switching OPP: %lu Hz --> %lu Hz\n", __func__, @@ -1054,11 +1072,10 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) if (opp_table->set_opp) { ret = _set_opp_custom(opp_table, dev, old_freq, freq, - IS_ERR(old_opp) ? NULL : old_opp->supplies, - opp->supplies); + old_opp->supplies, opp->supplies); } else if (opp_table->regulators) { ret = _generic_set_opp_regulator(opp_table, dev, old_freq, freq, - IS_ERR(old_opp) ? NULL : old_opp->supplies, + old_opp->supplies, opp->supplies); } else { /* Only frequency scaling */ @@ -1074,15 +1091,18 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) if (!ret) { ret = _set_opp_bw(opp_table, opp, dev, false); - if (!ret) + if (!ret) { opp_table->enabled = true; + dev_pm_opp_put(old_opp); + + /* Make sure current_opp doesn't get freed */ + dev_pm_opp_get(opp); + opp_table->current_opp = opp; + } } put_opp: dev_pm_opp_put(opp); -put_old_opp: - if (!IS_ERR(old_opp)) - dev_pm_opp_put(old_opp); put_opp_table: dev_pm_opp_put_opp_table(opp_table); return ret; @@ -1276,6 +1296,9 @@ static void _opp_table_kref_release(struct kref *kref) list_del(&opp_table->node); mutex_unlock(&opp_table_lock); + if (opp_table->current_opp) + dev_pm_opp_put(opp_table->current_opp); + _of_clear_opp_table(opp_table); /* Release clk */ diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 4408cfcb0f31..359fd89d5770 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -135,6 +135,7 @@ enum opp_table_access { * @clock_latency_ns_max: Max clock latency in nanoseconds. * @parsed_static_opps: Count of devices for which OPPs are initialized from DT. * @shared_opp: OPP is shared between multiple devices. + * @current_opp: Currently configured OPP for the table. * @suspend_opp: Pointer to OPP to be used during device suspend. * @genpd_virt_dev_lock: Mutex protecting the genpd virtual device pointers. * @genpd_virt_devs: List of virtual devices for multiple genpd support. @@ -183,6 +184,7 @@ struct opp_table { unsigned int parsed_static_opps; enum opp_table_access shared_opp; + struct dev_pm_opp *current_opp; struct dev_pm_opp *suspend_opp; struct mutex genpd_virt_dev_lock; From patchwork Thu Jan 21 11:17:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05F7EC433E6 for ; Thu, 21 Jan 2021 11:21:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4B85238E1 for ; Thu, 21 Jan 2021 11:21:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4B85238E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dQVjgZzS76IVc1S9eWohWyrwV1XzcWH2ZtlRwo9ppTA=; b=WFYnpe1/gBks+8CFE0KEkZ0v3 M5Ndaum3DHddpPTvcjPiHKbQIfMI+JxZVKv8sw/C7UcObZ7UxwY1bwQUFLiQdQV37uQ/B9nCricoZ q88Jas71uShGr819Smjg3LXpL3g8952Ir51NIFuiRJ2IIkRj2HRiKmP0Dp3uJNX2jYkh7NXXiKGac /G2ZgnbpVwki31pv7XTIpmIFk0xCs/pi2kAyEGlguDZo8L/crvG5BHjgdYhx9VrezkAAmYQdsQWp6 cplSiE0yvIgNRkwhA9eVUSNzfpLXwbEXxuawVhmAOmX53hx0LKIxAOsf7CZpHPIBwH+9Wlba9qAPc kuw14J3ug==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzY-00052w-5d; Thu, 21 Jan 2021 11:19:08 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzN-0004yk-4O for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:18:58 +0000 Received: by mail-pj1-x1034.google.com with SMTP id p15so1443768pjv.3 for ; Thu, 21 Jan 2021 03:18:56 -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 :mime-version:content-transfer-encoding; bh=yGSozZ62BYCUnvHz15lG2EnbQmWJ88vlwijLJGHrCgo=; b=jMznsEDClSg4+xGGHd4ynKf8aBhP9BTp/c1fcRIW0bwCmouHvmrSfMLRDtlokUPLPV 7uZ6cisbhC2/bCQhc1Sf8gCz0qzy7gUIZQPY641HZOSD9Ne58dPVd1v3P52FQQFJDQ5r BIEh2MsMfTZXAeF2tHcy4OjrZF5MSsSSxlisois1xZMV8twzKfyA/YgxLL7chity4eV6 HqMTn0S0YphcvWIdJERsciBUfz3VyFW4wXWKZaGZwJW8ZeXt2D84zqcdL5KTQc00Owqp EKOGoSCDNRgLk8dZXgxqPtahXM2N2MsO9eo7nghpRuI4W7dDgRIhCNczCqPqveO8WmTe iNTA== 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=yGSozZ62BYCUnvHz15lG2EnbQmWJ88vlwijLJGHrCgo=; b=WdXMgUO2FuhNUPzpGVi6UlTdhit9bd1BD+R7Jq0JicmxpgH24tEXmQlP1u0cpdLeqy OkXlwRpC4iOM+3fXp2NJGzOi94G5fOAIOwzCuqGMoRlYqXxX4MqB2tTmqQ3PgfnUSmxT WRRXadwi4hak+MhPKwOMgw3Xodjn3qETKxS2j48j/g+NwfP47xINk+VbGe2QurGNmy+h uySZ1Zi5lwGZg9ZeZftMby6qkG5tmDVqCJBNEiZpTq9AvyM7rgIN50wutP7By+Lhl/g0 D0Z3LIeDqM51ly9B0BdB+a0Q35GLE0ZnUe0RL9sY3wo9ygLLeTZrNpS7YdEUaURz43E6 S3NQ== X-Gm-Message-State: AOAM531mocgrFk1dItxM8QA56BJTbmfEdJjCwzp0xzI37JEZbQGeApMI Wg87BrNxuXemDhmoyc/9oszHrg== X-Google-Smtp-Source: ABdhPJxCDceYWRati28gRyR2MZg5jIN0/VdJ4+0q1+AusUpULOSN9NiaiWRtWjYKJucbY9Swc+dQTw== X-Received: by 2002:a17:90a:2947:: with SMTP id x7mr11321170pjf.157.1611227934689; Thu, 21 Jan 2021 03:18:54 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id g5sm5980697pfb.194.2021.01.21.03.18.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:18:54 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH 04/13] opp: Split _set_opp() out of dev_pm_opp_set_rate() Date: Thu, 21 Jan 2021 16:47:44 +0530 Message-Id: X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061857_214334_6B34D25A X-CRM114-Status: GOOD ( 23.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The _set_opp() helper will be used for devices which don't change their frequency (like power domains, etc.) later on, prepare for that by breaking the generic part out of dev_pm_opp_set_rate(). Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 126 +++++++++++++++++++++++++-------------------- 1 file changed, 71 insertions(+), 55 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 4ee598344e6a..5313dc322bdd 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -992,72 +992,27 @@ static int _disable_opp_table(struct device *dev, struct opp_table *opp_table) return ret; } -/** - * dev_pm_opp_set_rate() - Configure new OPP based on frequency - * @dev: device for which we do this operation - * @target_freq: frequency to achieve - * - * This configures the power-supplies to the levels specified by the OPP - * corresponding to the target_freq, and programs the clock to a value <= - * target_freq, as rounded by clk_round_rate(). Device wanting to run at fmax - * provided by the opp, should have already rounded to the target OPP's - * frequency. - */ -int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) +static int _set_opp(struct device *dev, struct opp_table *opp_table, + struct dev_pm_opp *opp, unsigned long freq) { - struct opp_table *opp_table; - unsigned long freq, old_freq, temp_freq; - struct dev_pm_opp *old_opp, *opp; + struct dev_pm_opp *old_opp; + unsigned long old_freq; int ret; - opp_table = _find_opp_table(dev); - if (IS_ERR(opp_table)) { - dev_err(dev, "%s: device opp doesn't exist\n", __func__); - return PTR_ERR(opp_table); - } - - if (unlikely(!target_freq)) { - ret = _disable_opp_table(dev, opp_table); - goto put_opp_table; - } - - freq = clk_round_rate(opp_table->clk, target_freq); - if ((long)freq <= 0) - freq = target_freq; - - /* - * For IO devices which require an OPP on some platforms/SoCs - * while just needing to scale the clock on some others - * we look for empty OPP tables with just a clock handle and - * scale only the clk. This makes dev_pm_opp_set_rate() - * equivalent to a clk_set_rate() - */ - if (!_get_opp_count(opp_table)) { - ret = _generic_set_opp_clk_only(dev, opp_table->clk, freq); - goto put_opp_table; - } + if (unlikely(!opp)) + return _disable_opp_table(dev, opp_table); /* Find the currently set OPP if we don't know already */ if (unlikely(!opp_table->current_opp)) _find_current_opp(dev, opp_table); - temp_freq = freq; - opp = _find_freq_ceil(opp_table, &temp_freq); - if (IS_ERR(opp)) { - ret = PTR_ERR(opp); - dev_err(dev, "%s: failed to find OPP for freq %lu (%d)\n", - __func__, freq, ret); - goto put_opp_table; - } - old_opp = opp_table->current_opp; old_freq = old_opp->rate; /* Return early if nothing to do */ if (opp_table->enabled && old_opp == opp) { dev_dbg(dev, "%s: OPPs are same, nothing to do\n", __func__); - ret = 0; - goto put_opp; + return 0; } dev_dbg(dev, "%s: switching OPP: %lu Hz --> %lu Hz\n", __func__, @@ -1067,7 +1022,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) if (freq >= old_freq) { ret = _set_required_opps(dev, opp_table, opp, true); if (ret) - goto put_opp; + return ret; } if (opp_table->set_opp) { @@ -1101,8 +1056,69 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) } } -put_opp: - dev_pm_opp_put(opp); + return ret; +} + +/** + * dev_pm_opp_set_rate() - Configure new OPP based on frequency + * @dev: device for which we do this operation + * @target_freq: frequency to achieve + * + * This configures the power-supplies to the levels specified by the OPP + * corresponding to the target_freq, and programs the clock to a value <= + * target_freq, as rounded by clk_round_rate(). Device wanting to run at fmax + * provided by the opp, should have already rounded to the target OPP's + * frequency. + */ +int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) +{ + struct opp_table *opp_table; + unsigned long freq = 0, temp_freq; + struct dev_pm_opp *opp = NULL; + int ret; + + opp_table = _find_opp_table(dev); + if (IS_ERR(opp_table)) { + dev_err(dev, "%s: device's opp table doesn't exist\n", __func__); + return PTR_ERR(opp_table); + } + + if (target_freq) { + /* + * For IO devices which require an OPP on some platforms/SoCs + * while just needing to scale the clock on some others + * we look for empty OPP tables with just a clock handle and + * scale only the clk. This makes dev_pm_opp_set_rate() + * equivalent to a clk_set_rate() + */ + if (!_get_opp_count(opp_table)) { + ret = _generic_set_opp_clk_only(dev, opp_table->clk, target_freq); + goto put_opp_table; + } + + freq = clk_round_rate(opp_table->clk, target_freq); + if ((long)freq <= 0) + freq = target_freq; + + /* + * The clock driver may support finer resolution of the + * frequencies than the OPP table, don't update the frequency we + * pass to clk_set_rate() here. + */ + temp_freq = freq; + opp = _find_freq_ceil(opp_table, &temp_freq); + if (IS_ERR(opp)) { + ret = PTR_ERR(opp); + dev_err(dev, "%s: failed to find OPP for freq %lu (%d)\n", + __func__, freq, ret); + goto put_opp_table; + } + } + + ret = _set_opp(dev, opp_table, opp, freq); + + if (opp) + dev_pm_opp_put(opp); put_opp_table: dev_pm_opp_put_opp_table(opp_table); return ret; From patchwork Thu Jan 21 11:17:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06C8EC433E0 for ; Thu, 21 Jan 2021 11:21:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 628C0238E2 for ; Thu, 21 Jan 2021 11:21:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 628C0238E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=A6wMUcEprOmw+v42mhxMD1fC3LxaRSa/E1IzeNrkeoA=; b=br7xPFkKIqLWlu+mVmeF5zv/T n1y0LHSBRsxgIZ4lETdkdEVuh5WDybyQLwS9OCIz9ujOm9S+4OJjwJ7BnjY+1qyjgXttMpo9Jhxhc tBMdfHfWO4ns2idk9xavg+m17/rO42OhXsHKelAj4Pee0rIQjzIX/483snzXOxpgANerLlVZzDXW/ fLvvQtR0ahniZ+i35nWYKvrLNejBaxbGkq2LxOy9RM2kNeerxrjiMEIPCH5bs/8c/BRox9/zTudt2 raukXSIv3Cxi+U5P+ERpVlcyL09nLx2XCWPsMqc2iolRs4YIzxT322OAmhdehasKlK7+hJg+kImsr XJf+8HMCg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Xzc-00054g-4Z; Thu, 21 Jan 2021 11:19:12 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzQ-0004zg-73 for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:01 +0000 Received: by mail-pl1-x631.google.com with SMTP id be12so1115191plb.4 for ; Thu, 21 Jan 2021 03:18:59 -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 :mime-version:content-transfer-encoding; bh=3q4F6fqDBoI1WPbxX2i+8B6qqJAH4SxSEXz0WavjCuM=; b=KPZnAalZ+8zh6lvLMEBZSaMYyoeR8ZqD+umfJrUDLFjwJNX85Vj//MjvUfsCfe4VG6 zKZO18Ju7We5Q6IR7a/brqg4Yzjak5tSdoj+mMXoDEVoXWX08XLn+sjhivh9BE3dRwSX QXCJqmndJOHaPcru83M8zwkDEUVdie1rf6cTkwbUa78Mgj/6MxJ2LSWxrWdqSYThvKOq r17YUw9fmG7ac37k3QCpx4YN2oOBIfW0hoD3VuDM1g9/1ugSVV76bn6Ob28gVnq8QBZy /+UdVCvOpk7f/0TsQnrR49jopuOeRInCBYSPualUNh3IcWLrI+PCvaztx4uXMBcNPCir Zf3g== 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=3q4F6fqDBoI1WPbxX2i+8B6qqJAH4SxSEXz0WavjCuM=; b=Kqs+LINfvJ2ltTvo58doIqVACOWOKw2QsM9kZ21cuRD6DCQr8kHmtX/IWuVnUUlHlO OZiCuPqOCEKLmfOv8lSVP1s92On+VOxLohv5lhpBtIEZqZc/lMbyV9Ln32GDgPm2PkZg fWFYHGmolmCufXGM/hWtCbaHf2m0ClO38Dr9F7D4JfZMsf0Zei4Gb4oPY3g5gVDEG+r9 OI5AQmmZwE0J8kYq9nRlGuMphAeEP116mCbmy3A1OB8h9w/ciS0695DM4ZjvwinBUjSx MwLacBcnVz8PWKoVk6Vcc3MYv+NuvDpCgtsOV7UckrsNuHRskf0r66UJi+1zNym3Ombl ggUw== X-Gm-Message-State: AOAM531qEsGrXnfLRBA9N39eFvHFQ/rmL5kUhxP/WmR7AuEzNIteIBwq SbLXU75ixX7fxk5aMNCLtpOx6w== X-Google-Smtp-Source: ABdhPJz22P2tWFOkcUwHY7BKv4TTjLUXRNax4HNk+svmsc6qCNBAsLI0X0TzxbDx9sH5y/pVn2KIZg== X-Received: by 2002:a17:90a:ea02:: with SMTP id w2mr11249229pjy.228.1611227937583; Thu, 21 Jan 2021 03:18:57 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id c5sm5779986pjo.4.2021.01.21.03.18.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:18:57 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH 05/13] opp: Allow _set_opp() to work for non-freq devices Date: Thu, 21 Jan 2021 16:47:45 +0530 Message-Id: <2f0956ab1ed075bc8551f68921791ecbc6032f83.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061900_273987_CDC71F68 X-CRM114-Status: GOOD ( 16.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The _set_opp() helper will be used for devices which don't change frequency (like power domains, etc.) later on, prepare for that by not relying on frequency for making decisions here. While at it, also update the debug print to contain all relevant information. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 5313dc322bdd..64424dbd23c1 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -997,7 +997,7 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, { struct dev_pm_opp *old_opp; unsigned long old_freq; - int ret; + int scaling_down, ret; if (unlikely(!opp)) return _disable_opp_table(dev, opp_table); @@ -1015,11 +1015,17 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, return 0; } - dev_dbg(dev, "%s: switching OPP: %lu Hz --> %lu Hz\n", __func__, - old_freq, freq); + dev_dbg(dev, "%s: switching OPP: Freq %lu -> %lu Hz, Level %u -> %u, Bw %u -> %u\n", + __func__, old_freq, freq, old_opp->level, opp->level, + old_opp->bandwidth ? old_opp->bandwidth[0].peak : 0, + opp->bandwidth ? opp->bandwidth[0].peak : 0); + + scaling_down = _opp_compare_key(old_opp, opp); + if (scaling_down == -1) + scaling_down = 0; /* Scaling up? Configure required OPPs before frequency */ - if (freq >= old_freq) { + if (!scaling_down) { ret = _set_required_opps(dev, opp_table, opp, true); if (ret) return ret; @@ -1038,7 +1044,7 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, } /* Scaling down? Configure required OPPs after frequency */ - if (!ret && freq < old_freq) { + if (!ret && scaling_down) { ret = _set_required_opps(dev, opp_table, opp, false); if (ret) dev_err(dev, "Failed to set required opps: %d\n", ret); From patchwork Thu Jan 21 11:17:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AA06C433DB for ; Thu, 21 Jan 2021 11:22:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F30C2238E3 for ; Thu, 21 Jan 2021 11:22:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F30C2238E3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FH0fSbDYL9iw57NJbnfLJJ6YEfmr+q+07gctEoHbvHA=; b=KjkhaRa4hBwCLO0geMORYZ1y7 A8J6Gie3SK1QWhxrvjG645JRknAoD5SAZZAa9RJJTjk6zfYXxYdfIuxL4bNK8kgETrodR0+ZBEXpg yGIwhYSb8+3R4AlwueewYEK1fx+fACHzOdFXnkxhDd1oA5vYaH3jWSSDDSxXVNVmz8Lrl4Pp1NY2I pwPCSJb76F6849BxpwmdctBNK45YUCKAuMGJoPaAdpzeSVbhufd7EffuLAHAD3/BxIO7apE9e3gH0 /cWHUEEkzgs2EYUZ0XFtSAMw/7bjuEBxDdWXKDgXJpnvJT6IbdDTylSze//04f9qEAEmrp8AbKmrO 5X8Xgcjpg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Xzo-00058H-59; Thu, 21 Jan 2021 11:19:24 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzT-00050m-D6 for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:05 +0000 Received: by mail-pl1-x632.google.com with SMTP id r4so1085223pls.11 for ; Thu, 21 Jan 2021 03:19: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 :mime-version:content-transfer-encoding; bh=xAKTZkyycba98JIw9o5yBKGTgq6RnpydF9Cba6DEkjM=; b=IE5cB3XUcMOfllNnwGT/K8+FysNlnl6CN4kmfCqtdtbsK6nqdVZB37NlyY+ocle3C1 BJSbgqiGQ1RcwE/02b9qpjDCWn+//56RBxiUS9lahW8NTBSWgTBU14p8ehtxYGrcFw3J m/iaGhrrFw77+W7wq4k/oNokc2iEHPCcYeFueag/GTYWb6dV+LWnlQ/5a/f/SvRNvuAa 3mjYP0rSx6c28PV2w4lAxljy/w3tDI4ULO6U74GbojEyPdXiDKRg6rLHLaz5qqU53StK n7sGL3faxA9KaPvLiYX4EdAkbRVZqJB3aSLBngSk/QRb7gStOyskUpFzy1eTnLGF7TZj /vew== 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=xAKTZkyycba98JIw9o5yBKGTgq6RnpydF9Cba6DEkjM=; b=HhCrJDJ69T2Rlk3JX1gpxC+NvhU4tZ8ZVocGxAvdZY8lZWLK5GbSjKLdP4aP0RyJgs e+CXlKaD767P3JzAGxvOonHRXH1PA7svbUcKl7lo8af02vLohrPoEsL6X4l6L3U3ucAz to+cH6BbcfcUbU916bvlsZ/smRfLJPenPb38tsLdcgeCsOAkYwVZy3LM48f5JClAqbCG 1GTNbxtPBqhwn1eutFiw5au6hHWr1XYq9zJ6ZVi2WYzpOdut8+YLp2HWt34Jlm+8tveB EomNcOn9SYUDukXn1WBR9hGwlshaY5RgHVpNYVabZeYTrtxN0p143bDqr44LTbC2BMPd 9ZVA== X-Gm-Message-State: AOAM530LIIpcAYKsUrscvpkfv8u8u0v3Zuctezu3NmxkDtwAoIyp/iVA EMYjS24PIFwzcb0iGV7hV++EKw== X-Google-Smtp-Source: ABdhPJzh80hJitJKGsChrc0Eudj2IFABV8NGgEDM/wNUy0FrILeXFQbCYrIaBzthFQDqE04LoZxRUw== X-Received: by 2002:a17:90a:fd0b:: with SMTP id cv11mr11277904pjb.26.1611227940577; Thu, 21 Jan 2021 03:19:00 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id l12sm2255450pjg.54.2021.01.21.03.18.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:19:00 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH 06/13] opp: Allow _generic_set_opp_regulator() to work for non-freq devices Date: Thu, 21 Jan 2021 16:47:46 +0530 Message-Id: <8f2d26305f38b52ebc46f2b0d4620e1e578fa2f2.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061903_733790_79B77A4E X-CRM114-Status: GOOD ( 17.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The _generic_set_opp_regulator() helper will be used for devices which don't change frequency (like power domains, etc.) later on, prepare for that by not relying on frequency for making decisions here. While at it, update its parameters to pass only what is necessary. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 64424dbd23c1..a96ffd9051b1 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -737,12 +737,12 @@ static inline int _generic_set_opp_clk_only(struct device *dev, struct clk *clk, static int _generic_set_opp_regulator(struct opp_table *opp_table, struct device *dev, - unsigned long old_freq, + struct dev_pm_opp *opp, unsigned long freq, - struct dev_pm_opp_supply *old_supply, - struct dev_pm_opp_supply *new_supply) + int scaling_down) { struct regulator *reg = opp_table->regulators[0]; + struct dev_pm_opp *old_opp = opp_table->current_opp; int ret; /* This function only supports single regulator per device */ @@ -752,8 +752,8 @@ static int _generic_set_opp_regulator(struct opp_table *opp_table, } /* Scaling up? Scale voltage before frequency */ - if (freq >= old_freq) { - ret = _set_opp_voltage(dev, reg, new_supply); + if (!scaling_down) { + ret = _set_opp_voltage(dev, reg, opp->supplies); if (ret) goto restore_voltage; } @@ -764,8 +764,8 @@ static int _generic_set_opp_regulator(struct opp_table *opp_table, goto restore_voltage; /* Scaling down? Scale voltage after frequency */ - if (freq < old_freq) { - ret = _set_opp_voltage(dev, reg, new_supply); + if (scaling_down) { + ret = _set_opp_voltage(dev, reg, opp->supplies); if (ret) goto restore_freq; } @@ -783,12 +783,12 @@ static int _generic_set_opp_regulator(struct opp_table *opp_table, return 0; restore_freq: - if (_generic_set_opp_clk_only(dev, opp_table->clk, old_freq)) + if (_generic_set_opp_clk_only(dev, opp_table->clk, old_opp->rate)) dev_err(dev, "%s: failed to restore old-freq (%lu Hz)\n", - __func__, old_freq); + __func__, old_opp->rate); restore_voltage: /* This shouldn't harm even if the voltages weren't updated earlier */ - _set_opp_voltage(dev, reg, old_supply); + _set_opp_voltage(dev, reg, old_opp->supplies); return ret; } @@ -1035,9 +1035,8 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, ret = _set_opp_custom(opp_table, dev, old_freq, freq, old_opp->supplies, opp->supplies); } else if (opp_table->regulators) { - ret = _generic_set_opp_regulator(opp_table, dev, old_freq, freq, - old_opp->supplies, - opp->supplies); + ret = _generic_set_opp_regulator(opp_table, dev, opp, freq, + scaling_down); } else { /* Only frequency scaling */ ret = _generic_set_opp_clk_only(dev, opp_table->clk, freq); From patchwork Thu Jan 21 11:17:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6CD8C433E0 for ; Thu, 21 Jan 2021 11:22:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B45E238E1 for ; Thu, 21 Jan 2021 11:22:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B45E238E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=W7xPwkWjVGAOSvlJGqZ++GVxv8+/6+JczdrmIEi/yQ0=; b=G25Nj9LY7BQLuM7vnm2cWpDAh tNUN50gTJgHTCZq0F8bAZYAOJHuPgbAvu9IE3LBWVomJKFq/5REgg9buQtemS2yrlOxF5oAPrm1xs 6Km5auNUC93RHvevtFdKTNeiZLZPUFQD4fvtvS2usBVBLxyOBZM5TYfcfw4c3/Yxij2q7PSKVl4Px PGncVoXXjN24FKKvqfqC+KNqHrRpVz4tiqO7OUx/MkLv39mCjI+YyMVOOca5j1RXEAdcEmbSl4H4L mjEKe5FD3c8C4pC4xP4tll/tVQ/rrE2PNKmiDqDSvPacumd362WJQwAc3I7d+NpONoFn7i8HK1WD6 31LcMsuKw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Y0C-0005H3-Ej; Thu, 21 Jan 2021 11:19:48 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzW-00051s-7I for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:07 +0000 Received: by mail-pg1-x535.google.com with SMTP id q7so1157610pgm.5 for ; Thu, 21 Jan 2021 03:19:05 -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 :mime-version:content-transfer-encoding; bh=CYbzCFVCi3fEgZJohV5hqu59RAY6Et7w7QbAOId9XrY=; b=lMZb9UiNz5IoKRjlVfTRbe5AbsFjgYug6+3rBQBORQMTS2UMUtLozNugVAnuXzVu8y EYEMj8NSmofsA6xXlvjPMTlIYrPcpAfABG+1v1OmZz7r9X5YWSkh16Cxrsokim45C5sJ tUjvk+6bmsgYppq/z+2OjYh9iv2r6nSz0qXHsQ+GHP9yy0kYl4kID2DhPeeyCjK4vjlb Icdu8T9ko+aqp872q9wMRgxdPOSbnY8xrtxNYrFWzjrxlAklUobL0Gl0pA9p1ggkdKGE zQrS52KKBl/kFz3wQD/xWCCxYLYBNGWJvjbTLdPsvcwnxS60d3h0uiITwge2NEyNxN4s 6jvA== 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=CYbzCFVCi3fEgZJohV5hqu59RAY6Et7w7QbAOId9XrY=; b=SxM0yeSuvkLKAnM244OBMduY0iZCaDvTAmKdGqk4/wAPuNFscJoUCLAIrSg7fXwcFB QKwAS4tqPS3wbZ1kYAU/htRalYXnROzt2Rae7ZtMDLuggV+6JCTwTg79906T+7Jlri7G 3hUt0wVFTZzpdMySEhqWB7X5lmtXbr24D3T2yYn42uymJ4nuwjL3tljZovFhfgAnGV6A +PEpEIBGhBhHu8fOi9ROzYhMBEGNGGk6oF5/Obp7ME/PnRgN4lWIBBjJROL1ykjVfMgP GjuBHFLcBo8dADTkH5yR4Y+21cfoRB0eDBzX3LrzUwgPHoZ2rcAfhvqGOP473lCgC1OB u6sQ== X-Gm-Message-State: AOAM533NYTLBqxr2OCw+aklQir9USiDtsD4s/0gAtYK9EEijcW7ucaJ7 ZeGLupOGUumnH95mC/jHLt4l6Q== X-Google-Smtp-Source: ABdhPJyEgpWlB1DXX6+xj9reAgkGRUJ/18nmuXm2a77WwY0rHW9XG4b7O5gR3XoNa+V5ylK4UmmqzA== X-Received: by 2002:a63:d42:: with SMTP id 2mr8226764pgn.236.1611227943683; Thu, 21 Jan 2021 03:19:03 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id w21sm4497087pff.220.2021.01.21.03.19.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:19:03 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH 07/13] opp: Allow _generic_set_opp_clk_only() to work for non-freq devices Date: Thu, 21 Jan 2021 16:47:47 +0530 Message-Id: <1585f6c21ea8aee64fe4da0bf72b36ea4d74a779.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061906_323382_4634DCF9 X-CRM114-Status: GOOD ( 15.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to avoid conditional statements at the caller site, this patch updates _generic_set_opp_clk_only() to work for devices that don't change frequency (like power domains, etc.). Return 0 if the clk pointer passed to this routine is not valid. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index a96ffd9051b1..6b09d468d37a 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -726,6 +726,10 @@ static inline int _generic_set_opp_clk_only(struct device *dev, struct clk *clk, { int ret; + /* We may reach here for devices which don't change frequency */ + if (unlikely(!clk)) + return 0; + ret = clk_set_rate(clk, freq); if (ret) { dev_err(dev, "%s: failed to set clock rate: %d\n", __func__, From patchwork Thu Jan 21 11:17:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B07F4C433E6 for ; Thu, 21 Jan 2021 11:22:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E4B5238E1 for ; Thu, 21 Jan 2021 11:22:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E4B5238E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fpbrA7XGbStKxkf7N9IKe+LkT5TpFzO7ZWmz4Zym/5o=; b=N96vPcIDqFnVWbVuUK8fB/Yka DiAKutx4pJg7sO/dcD5LwPGMAk2nFhtDgBhHzJKzF94HyRtrmAB3nkFKty7cheQ8QEEWiPYWLt63+ 9SL9LfeaZVG4IR6oRWYrswVUBG1Q7vS8PXN2BDswjROoPCKMGbbwOrPY4KT29FyJRLN/RUpKHLJGS mZEa2IrcySrsj29vzarfAbNOlDeDQ7OlCtk+iOwjcfmC+SfxbM1ZEiGGrUz2dM9kFqlLE8OGTrhaP lkUHT8tqVF52ubNnac71ICw8SfY2Vp5Yhwiqu/Y89GtzzyiqPlB8L3TB5Tou26iHtUCSuMclB+Ugw AolSFs8Og==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Y0d-0005QN-A9; Thu, 21 Jan 2021 11:20:15 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzZ-000530-0d for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:10 +0000 Received: by mail-pf1-x429.google.com with SMTP id m6so1324615pfk.1 for ; Thu, 21 Jan 2021 03:19:08 -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 :mime-version:content-transfer-encoding; bh=QsvG3t6xFRgx0s76cOQVzbYkqHL9lM3bJ086HXut2lo=; b=W8sAOHZXGjGsUHf8lA5IP8zqppO9iNNGBAO/qkfocVkFGmZSsW/naH1YNTl0xP/gTa gY50hBXssIxtuU2G59zExSMtcwVt7utDVVzmh6u9fjrD+gxfwmaw+ao5wN7cr/pBoIw3 oRUkfsAVRcuJw664wy7zI0ZnVC2itA4TtpRfrtC0Gl5gtFhl4IOvROR/LH20rudx7rlv gWtqNMLBkoXlXYJmuXSwOzf/XejjXh9qiAA0ZlrkJH/afNscVDAJM3rbqNgElgUCPqRm UBPCokJYgpbAq0qwbubfijtQgJxq9EDuL0R+iegFbZcUTi60rDsqp0znC1i8ZppPwSnH /QqA== 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=QsvG3t6xFRgx0s76cOQVzbYkqHL9lM3bJ086HXut2lo=; b=b1q6VTpdVs5tDUJ+t2jODc6K5yGDDbBqzFhA+z4A5o8sD1PN+MgAvGCLnn38r35AHz rE7bvyThcpeKpLWjEwxyRIAwTXO6CpImXwzzGd234R52uV6SUgWv1z6jFbUUmHHO19jl EKhyKaKWQzdu+tuG/rs55fiynI4/mlRt6fxgdS0+SjIanNR5CBfu9QSdU8YvDIqqNi63 u9LwJb8xbN6/vLFTOB089D0iKhePF3CY2qtAABkHMUESbhrYBgUgWxxbHANRL5Z4133q YADJLsMzcAfT0trL70tBCcA70oHayxa2qil1ER19is1rcPP3+qFEtGt5PJTwPjdo9PD4 iRqw== X-Gm-Message-State: AOAM5334WquwsuZ0ZRycFBgrGq7+DeVZeDrUmtGQ4/mNAcdiE0SmGmr6 oRz58IpK/goV6b7k5GE57Pd9IA== X-Google-Smtp-Source: ABdhPJy5sX9QMNxrrbhz8F+SIc0A20khl+IXc6z8UY/zsrD3/92c9hrmIh3MhaQyDhyT3bApnJ9r9g== X-Received: by 2002:a65:6542:: with SMTP id a2mr13920489pgw.148.1611227946652; Thu, 21 Jan 2021 03:19:06 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id gk2sm5826702pjb.6.2021.01.21.03.19.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:19:06 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH 08/13] opp: Update parameters of _set_opp_custom() Date: Thu, 21 Jan 2021 16:47:48 +0530 Message-Id: <296a3a64a673ed3eb261a6fc06f4dfd90dbca479.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061909_110833_FE74ACA9 X-CRM114-Status: GOOD ( 16.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Drop the unnecessary parameters and follow the pattern from _generic_set_opp_regulator(). While at it, also remove the local variable old_freq. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 6b09d468d37a..3500cc9de66b 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -826,11 +826,10 @@ static int _set_opp_bw(const struct opp_table *opp_table, } static int _set_opp_custom(const struct opp_table *opp_table, - struct device *dev, unsigned long old_freq, - unsigned long freq, - struct dev_pm_opp_supply *old_supply, - struct dev_pm_opp_supply *new_supply) + struct device *dev, struct dev_pm_opp *opp, + unsigned long freq) { + struct dev_pm_opp *old_opp = opp_table->current_opp; struct dev_pm_set_opp_data *data; int size; @@ -840,12 +839,12 @@ static int _set_opp_custom(const struct opp_table *opp_table, data->clk = opp_table->clk; data->dev = dev; - data->old_opp.rate = old_freq; - size = sizeof(*old_supply) * opp_table->regulator_count; - memcpy(data->old_opp.supplies, old_supply, size); + data->old_opp.rate = old_opp->rate; + size = sizeof(*old_opp->supplies) * opp_table->regulator_count; + memcpy(data->old_opp.supplies, old_opp->supplies, size); data->new_opp.rate = freq; - memcpy(data->new_opp.supplies, new_supply, size); + memcpy(data->new_opp.supplies, opp->supplies, size); return opp_table->set_opp(data); } @@ -1000,7 +999,6 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, struct dev_pm_opp *opp, unsigned long freq) { struct dev_pm_opp *old_opp; - unsigned long old_freq; int scaling_down, ret; if (unlikely(!opp)) @@ -1011,7 +1009,6 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, _find_current_opp(dev, opp_table); old_opp = opp_table->current_opp; - old_freq = old_opp->rate; /* Return early if nothing to do */ if (opp_table->enabled && old_opp == opp) { @@ -1020,7 +1017,7 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, } dev_dbg(dev, "%s: switching OPP: Freq %lu -> %lu Hz, Level %u -> %u, Bw %u -> %u\n", - __func__, old_freq, freq, old_opp->level, opp->level, + __func__, old_opp->rate, freq, old_opp->level, opp->level, old_opp->bandwidth ? old_opp->bandwidth[0].peak : 0, opp->bandwidth ? opp->bandwidth[0].peak : 0); @@ -1036,8 +1033,7 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, } if (opp_table->set_opp) { - ret = _set_opp_custom(opp_table, dev, old_freq, freq, - old_opp->supplies, opp->supplies); + ret = _set_opp_custom(opp_table, dev, opp, freq); } else if (opp_table->regulators) { ret = _generic_set_opp_regulator(opp_table, dev, opp, freq, scaling_down); From patchwork Thu Jan 21 11:17:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F826C433E9 for ; Thu, 21 Jan 2021 11:22:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E98D238E2 for ; Thu, 21 Jan 2021 11:22:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E98D238E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iJob32qN3U6XDWzPtuuhcNh1BpG63Bpdz/vfhefBqc8=; b=B5pCkahoBur6QiZ00N2CIWzxF ezInfJlN6lrI6V2eJl4tR88CTVqiK3hXmBZf4FiwhGCVQqF9zEcxhBQRy7zJNcB7OiBSZQWYsMa8T IdWszc/y8Vtdn8WL2QYaWmsjJ0XgbjNbBCzj8Ww0NxLIInRp9dCvqUymL5mVLVR4ayGTW1l/oD2Db 28PbXIzVCY4/2M8odIfHoorIpH/mVE5Fvq1V7PJT2qdPm+eXAfZqdANaCFKG3+FccyK2KeSDSyMmQ OlzBLF3fSK4S3t10S0Rl5bmz771kIgaJzWoyQPCUZI6T6o+ixYvOXyy/xc8owj0lEcABFN0qzat96 UOCq5lFig==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Y0k-0005Uk-7p; Thu, 21 Jan 2021 11:20:22 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Xzc-00054H-5v for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:13 +0000 Received: by mail-pg1-x529.google.com with SMTP id n25so1182387pgb.0 for ; Thu, 21 Jan 2021 03:19:11 -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 :mime-version:content-transfer-encoding; bh=ztcbVczwcxvX+Nme8Zu1bVyHZiwA0aS5UzQfgwSCEM4=; b=uvEyLQq53T//ZW0fW9IuJXmQ0IpdbzBOHOZkvCWGZ4qs23KbdM1qBbTqsBvRapbFjQ GFTzRYWISYJfZppc2Zk7RHboU5zZ4TVr9NOy3uFsFZN3WNsrlkPVDczNsuKmY3q5BE+B WJn2+aBHGJLNiN6/ELjw0OPDd33iZ3H6kAA4chYfT/sr2Gd/6TnwEmeW8lfDuPWeru/u C7NgP8XEQydN5j4ZOwOQDckF78X8cApKr6rG9CXIybnq9UjECRHrVggyvlYqLI+ZC7T7 3ywLOkm13JVjMF9xUIgRTuNR6fYT/JHPI2hQ8dokW8N1jPAkvjp3iKDDfY80HBbwF3Xp Or9Q== 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=ztcbVczwcxvX+Nme8Zu1bVyHZiwA0aS5UzQfgwSCEM4=; b=b6QLAmcrriftPCxu3AwQwyT6/TOAZTV+sHoy4VeujKGw/bLH+KqKr/JQAdFbf7hotC V5iPR84ul39zJX1v+voCUDSgRy8f1ZdoW8DpPbXgbibs87QbtH/xn5oj8pzvjs1XD4nM 4Qe+FbfFRGq61BYk/pPaK4OaU7kl7oBwnqmNxE83Ehb820JMnKVgUpHenFlEfNMnDlvB AhbImIjmEVzADuzQyujbFL2VMaNUEVN7ph91WaaQMUaAtULNnpNcPQFfT8sFaWNm3Qhu pr7Q4M3kbFbB7elzQdpvpJywIUILORLNGSiXAfAHwZNRGccmrCSloUueU5O//GM/iwzf XK1w== X-Gm-Message-State: AOAM531UxE4RwasiZlkHkBfPiyCE1ViCpIniLTbElN6a5tJlgg0xuFrF yxpPSfaEr3qbchsVLukRqgLgJQ== X-Google-Smtp-Source: ABdhPJz5dsmD2BduPt5SpiKRdA3AKAE60DsVpNwYRtx4HLW3+yCJkDvh+JXODFHsTDqqF3ffOKvzYw== X-Received: by 2002:a63:d446:: with SMTP id i6mr14020045pgj.446.1611227949698; Thu, 21 Jan 2021 03:19:09 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id u189sm5203484pfb.51.2021.01.21.03.19.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:19:09 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Subject: [PATCH 09/13] opp: Implement dev_pm_opp_set_opp() Date: Thu, 21 Jan 2021 16:47:49 +0530 Message-Id: <7d62f63ac64e59ee3327789ff1bc9cebc2da6944.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061912_275357_E5377C0A X-CRM114-Status: GOOD ( 17.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The new helper dev_pm_opp_set_opp() can be used for configuring the devices for a particular OPP and can be used by different type of devices, even the ones which don't change frequency (like power domains). Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 28 ++++++++++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 3500cc9de66b..5a367ef02b92 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1130,6 +1130,34 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) } EXPORT_SYMBOL_GPL(dev_pm_opp_set_rate); +/** + * dev_pm_opp_set_opp() - Configure device for OPP + * @dev: device for which we do this operation + * @opp: OPP to set to + * + * This configures the device based on the properties of the OPP passed to this + * routine. + * + * Return: 0 on success, a negative error number otherwise. + */ +int dev_pm_opp_set_opp(struct device *dev, struct dev_pm_opp *opp) +{ + struct opp_table *opp_table; + int ret; + + opp_table = _find_opp_table(dev); + if (IS_ERR(opp_table)) { + dev_err(dev, "%s: device opp doesn't exist\n", __func__); + return PTR_ERR(opp_table); + } + + ret = _set_opp(dev, opp_table, opp, opp->rate); + dev_pm_opp_put_opp_table(opp_table); + + return ret; +} +EXPORT_SYMBOL_GPL(dev_pm_opp_set_opp); + /* OPP-dev Helpers */ static void _remove_opp_dev(struct opp_device *opp_dev, struct opp_table *opp_table) diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index f8e9a8e3eb59..2d8a706f8d00 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -158,6 +158,7 @@ void dev_pm_opp_detach_genpd(struct opp_table *opp_table); struct opp_table *devm_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs); int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate); int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); +int dev_pm_opp_set_opp(struct device *dev, struct dev_pm_opp *opp); int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp); int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask); int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); @@ -376,6 +377,11 @@ static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_f return -ENOTSUPP; } +static inline int dev_pm_opp_set_opp(struct device *dev, struct dev_pm_opp *opp) +{ + return -ENOTSUPP; +} + static inline int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp) { return -EOPNOTSUPP; From patchwork Thu Jan 21 11:17:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0E50C433DB for ; Thu, 21 Jan 2021 11:23:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 40DF1238E1 for ; Thu, 21 Jan 2021 11:23:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40DF1238E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TMw0MbtWEhxUQinFaRbYjXeyTkAc+mbk5bgft/oORWw=; b=ln62cjBxb5FYD4o1iOBcjTrCn rD1vtL5KFyzErnrKRbNMkCePiBpZnhgYyfu2iOIVkQivuZ9C4GhryUp0cD1zcZv4afvC/p9m9T86l Kvu/+xCx1YS/4YWT4M80FArJ+ScOJhMFOh1UCdT0HjLxpET9SFBSFQ+xjhoGCa+AkgdAXI/XmIw1F c/N/mIHSLnkP3DzQD3wmMEdPq6qr8w2gMI+SnqXWnEHSVtIpr3IaYc0BOoxhX6dxJkPWQ1nmS8tKE EQiWWdBlNBjTuPD1r2xKDpyqeQgZQKnXimIish2jD4nRLZiCVByM49Tf3178G/VgZ8TnqF9ciXa0M adSSjJ5DQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Y0x-0005Zv-TR; Thu, 21 Jan 2021 11:20:36 +0000 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Xze-00055V-PM for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:16 +0000 Received: by mail-pj1-x102b.google.com with SMTP id m5so1445672pjv.5 for ; Thu, 21 Jan 2021 03:19:14 -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 :mime-version:content-transfer-encoding; bh=jQe2wetugU1pRDNoKc4LJOQOkvxp53VsnbiI6RDAfCk=; b=JWhI8jHACexdhKZNQAB1k51Ex/gbBkuWtH4b7zMRmysDqXvSdtCk6gcqxtwhoC5lIf nlR6DkSOZnJL4r0XDi8JDy0lYfZKXQrzUKPm1HY31puRm3boWLqQAxaOgLMGiVuVStDd uIF6RYV1mDZ+GATOjv4zbSw8OjxDRRXYlTiakQgfcmprBexc9p5d5Awrkut673Bj1yZt OuWYzZ3b+q4rFTbTDdO/JhfOa38uQLNYS4HkYy/Rq3znUWIO/1glthWAlFBnrHG/UvWM G2q8Z1UyJu0RnmG0fKq0oQ9Hpv2eSuTGnzuTBS+kW2v9C4eZe8BBs7GQUA4Vm970BeRI AD6g== 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=jQe2wetugU1pRDNoKc4LJOQOkvxp53VsnbiI6RDAfCk=; b=YbZ1h0qRbi085SfA/Me3xgocc4Vu4rSDZX98nztg0+WM4inArMqBIfDgb3BJNPYFb5 9OgQhTX7toA+Qaw1XTLgHZOZE+S5MzqS0a4peWpB7SXbaexAwm3yCAJkTeThusM18uPP mtY+My8DZEw/FW1r8SYbvreGOwaqO+pMbmvTKTfM8iRIaj8iGhdTmBfKrDzM23OtEvel Y/4VeqNNYCbCDsWDvTbDIXwKl/hxxeQeu09SVJcBHBynXgQkxt9nMyiS1F4PsGR97BBH rebPpEJSCxEf7fGOChnzAuYM6fsTRaa0aE66sFN0kKLvZoDa/q1ls2hZ+8dNK1mi8WwA odGQ== X-Gm-Message-State: AOAM5309aCaZxwVEE/XN/d1jLi/cAcjClmIxn17hVSIX19pPFEiUhEXm T/JefwS6OXXFnN/t1XZiYRU4FQ== X-Google-Smtp-Source: ABdhPJwNGwquTz5sTXjGQEvngNm64YXcGIcif0MXJgKVuRrhGd2tEwCjRjeCSGHJBffSlK3NCPp/8w== X-Received: by 2002:a17:902:e8cf:b029:de:a91c:5ec9 with SMTP id v15-20020a170902e8cfb02900dea91c5ec9mr14575866plg.27.1611227952607; Thu, 21 Jan 2021 03:19:12 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id z13sm5393490pgf.89.2021.01.21.03.19.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:19:12 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Andy Gross , Bjorn Andersson , "Rafael J. Wysocki" , Viresh Kumar Subject: [PATCH 10/13] cpufreq: qcom: Migrate to dev_pm_opp_set_opp() Date: Thu, 21 Jan 2021 16:47:50 +0530 Message-Id: X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061914_865448_AE1E535C X-CRM114-Status: GOOD ( 14.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishanth Menon , Vincent Guittot , linux-pm@vger.kernel.org, Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dev_pm_opp_set_bw() is getting removed and dev_pm_opp_set_opp() should be used instead. Migrate to the new API. Signed-off-by: Viresh Kumar --- drivers/cpufreq/qcom-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 9ed5341dc515..7df18903b66c 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -54,7 +54,7 @@ static int qcom_cpufreq_set_bw(struct cpufreq_policy *policy, if (IS_ERR(opp)) return PTR_ERR(opp); - ret = dev_pm_opp_set_bw(dev, opp); + ret = dev_pm_opp_set_opp(dev, opp); dev_pm_opp_put(opp); return ret; } From patchwork Thu Jan 21 11:17:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE444C433E0 for ; Thu, 21 Jan 2021 11:23:51 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 747ED238D7 for ; Thu, 21 Jan 2021 11:23:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 747ED238D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ukf81mdOtnXGwImcyZQ5p6beA8pCgMESuWzM3GJ05tA=; b=mXDWC9J4E0cREu3YuA4xCfBNp EvYqx8zBdJhpFU9GnWNz3lJUOhTs91dDMDeIPlxpb30P9Z5duzw4Ok7sKzaO3eAtShzUawdwHgZIY E9/M5R8VqN1mNngvdH2aoltpVbLScRXXLvPZikWNfd3ZKJVJRHhgZoHMyQxU/bMJRYjF4EmIZm1/8 1IXjXj3TlvOFRjJXfGCBcI9K+ESmHMxc7C7MykVxbBmqfg9mHXgzYKkvOgbMEqJD/wWyVgkOjQMe7 LSzwh7a7U5RRoL7c09yq01TsrxUTqMdHn+rZBCg3rpKY8ylQIz65BTsL1GLE/js2bcW69BatjWLwP OvykQUzVg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Y1D-0005gv-3U; Thu, 21 Jan 2021 11:20:51 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Xzh-000576-JC for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:21 +0000 Received: by mail-pl1-x635.google.com with SMTP id r4so1085550pls.11 for ; Thu, 21 Jan 2021 03:19:17 -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 :mime-version:content-transfer-encoding; bh=sc4RKhDP//JPOMDhY7YCUQxeEMkiC/uPecJg02H/C7o=; b=l+IAUYm7EFFo4t2J9K9y1homcgzoofuLPhJewoVATAFKtJg6FXyHwS2xW0rpFUTRHV 0VKWEJvRNqSxZWuzsLNt/c0JLq2Cpa0y6HOD3slSw3e3u01OJT4ei9LtHA+9mAS4E+e0 ZrW068O3VrMsNGnFvp6u2l0/u9WAI8YevpehexN1DMnm1c3YG//LXbjknAvqtN/oOpFH EZ1gSzViZvXX1doq/J5KOHLewT76zw0MOY/tM6Mvx2FezcifiP/0cHUjZ5pGAhTd2XYC UIlHo2ZP06GzddxHR81p+DeIXuMc4gRZzrAoMDgmg0JP7gIK5KRDPPgZxZUKYZhtePem HQ0Q== 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=sc4RKhDP//JPOMDhY7YCUQxeEMkiC/uPecJg02H/C7o=; b=g19AzmGWzMa5CrGRz2H+XNGllH5PBIzOFUBU80GXvv7rZKzzwHHPhy1l5Hc5AsaRO8 d9b/n/yZMnORBtUdS5sYAK+dIJBE+4keZD5b4g/jrd0mEJtb31XYqct+jAlqNPPfaP3N F4vdWE2XiCoi2A4tchsjykx0OmjFxLlTlFk92XgcSWegoN89ZdV4iMGqIfbFW6mETJnL wcGtIys9ycJjrvF27Tw3Y9wbgK+r1i+kL1NhYhFsefeubzTaRoEmDGhmSMgN42q+ViuS 8JvLM5spW090+U3xzsmjaoloH2gH9wxCIXAHCLgdtdxjcSH3+8oE19EFnZncpiucB08J Cr7w== X-Gm-Message-State: AOAM531e24xf1rHNjLtOKJKwu1y4HQxAgNUKY6tOY5ZzI3gXIRd4DrWz mdbI29Th/BnXWZOuamXU84K7mQ== X-Google-Smtp-Source: ABdhPJyINtEI3nSzz0ay/vase6wWA+XDS1j1/V24hIEgbqObHoCTROQExJ2ifEGydCT5glp9WAX8vw== X-Received: by 2002:a17:90a:ad48:: with SMTP id w8mr11326968pjv.48.1611227955542; Thu, 21 Jan 2021 03:19:15 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id ge16sm5827745pjb.41.2021.01.21.03.19.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:19:14 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Thierry Reding , Jonathan Hunter Subject: [PATCH 11/13] devfreq: tegra30: Migrate to dev_pm_opp_set_opp() Date: Thu, 21 Jan 2021 16:47:51 +0530 Message-Id: <3345fd49f7987d022f4f61edb6c44f230f7354c4.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061917_715221_D6C473D5 X-CRM114-Status: GOOD ( 15.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishanth Menon , Vincent Guittot , linux-pm@vger.kernel.org, Stephen Boyd , Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dev_pm_opp_set_bw() is getting removed and dev_pm_opp_set_opp() should be used instead. Migrate to the new API. Signed-off-by: Viresh Kumar --- drivers/devfreq/tegra30-devfreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c index 117cad7968ab..d2477d7d1f66 100644 --- a/drivers/devfreq/tegra30-devfreq.c +++ b/drivers/devfreq/tegra30-devfreq.c @@ -647,7 +647,7 @@ static int tegra_devfreq_target(struct device *dev, unsigned long *freq, return PTR_ERR(opp); } - ret = dev_pm_opp_set_bw(dev, opp); + ret = dev_pm_opp_set_opp(dev, opp); dev_pm_opp_put(opp); return ret; From patchwork Thu Jan 21 11:17:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD5F4C433E0 for ; Thu, 21 Jan 2021 11:23:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 314EC238E1 for ; Thu, 21 Jan 2021 11:23:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 314EC238E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WEH7zGflDebwJ7fuHMDm7WdukjW7UTi4sdb8zCiSXq0=; b=UzP1optqu8qbSOgPsMKw3HMxk EIkhFwv34XzBT4yFCpT6l4CGgqRU8OXRvsSR1zUW/lp9631TouPGt9I1nu3q6EHisQk/htrtY7RCo srJ1h3YADisBxKlE+ygA9XW7SsRfns5henmEsJKwVkFb3EtAntSeP7tl0t5jNt4okN2zwXOS/v9Ob ipqNSrtyOurQNArKWdiYbUy6ZQFdGnvL4kLP9KX+A9ppTY1Bj20+l6Bq27vm5LNI82dFXZ602UHOW gwS2/Ij4JrfBwkbWyV/OC+/C8lIOXB+mc3iZa1lLBzGQpJgSPvn4P0ap0AxzNVjlLt4lUkX9lqgt9 YPSjsumqw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Y1h-0005tW-ML; Thu, 21 Jan 2021 11:21:21 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Xzk-00057y-T8 for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:25 +0000 Received: by mail-pg1-x52b.google.com with SMTP id q7so1157990pgm.5 for ; Thu, 21 Jan 2021 03:19:20 -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 :mime-version:content-transfer-encoding; bh=lxCu1KRXdVN3L+OkUbo1cLFCc74qHBWwsGsHoVvYmGQ=; b=a87cJbhAisItlTCiddZHPHEtszqt8a4bVO1biv2X4xyyxixy0vT9T72gtaa3iyj1/S 0BYSnHb7hnb7XQ1rwlEu5cBS3rWsXlBuzJ4FCOmHrteZ986iw9RUbu7t7crDd55rb+q0 KYQl0KVBN5AykV+JO3HcTaywDinFAvXk5RBBj+bYE7h3h/GJhlpuhndjXEI073NQmGYd F8sCiXjYnLCSEiHzao8Cj5NEiGNRRhnEQY8ln7F6+OXeYTrLLExrly2aWRCNqMuVgIyM o+ZW521aJNq2QMtttfOcvWZ9gEK/aMtc7HonSr2L7N/XYDiInAo5mzdEK+TIZbY9C/Xa SMRg== 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=lxCu1KRXdVN3L+OkUbo1cLFCc74qHBWwsGsHoVvYmGQ=; b=WDQ01LeYn3fJiAdxkplRRJzaDUp4IrWKLo3hKcDNetc1t8fcgvNl6IcUwABLyDjpLz vDA1B1ZiU5FjFJwFWoGt9mnVkiPwB0G6c0ZpBoSJGjycKajpAMQZzfPLyFi+jiy1p34U 0K2azzvoHqyf+Yjsxw9CfWsyAA9fXnbRmRcQHA98Lhlwh1/kBkInu4QdWYBbkB17f1ox d6Lkv9pyRmaEg4onWu6Md9SmTH1pesu8LoFYAq3r93IR1eS5XLBVXjwThE+1Pm92Of2t WpSqMDKQ6T11f4oacIxQB6jr3UFxqzJPx3LWdgifQZNxAq5GNWPaBVzdvVwKU//+9ztD Y7Lw== X-Gm-Message-State: AOAM530HVsR11JTOd243lWIsm/y3Udr6THXL5gjNRXb2fjh3X6m+x1O6 FiOSz0JRgJgKIG2v3SjRPQtA8A== X-Google-Smtp-Source: ABdhPJxRoJPh+zCGLlNXEzcomeslehl5ItANfOXfCWt+o9vxW4dTT0mgqMj6QlfqpWP4MwpTT0cTAw== X-Received: by 2002:a65:4083:: with SMTP id t3mr14089089pgp.150.1611227958549; Thu, 21 Jan 2021 03:19:18 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id f36sm6098298pjk.52.2021.01.21.03.19.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:19:17 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Rob Clark , Sean Paul Subject: [PATCH 12/13] drm: msm: Migrate to dev_pm_opp_set_opp() Date: Thu, 21 Jan 2021 16:47:52 +0530 Message-Id: <8d10f850eead0e91b1a0e20bd2ae449f4f4f8bb3.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061921_007914_02A8F1F3 X-CRM114-Status: GOOD ( 13.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishanth Menon , Vincent Guittot , linux-pm@vger.kernel.org, Stephen Boyd , Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Sibi Sankar , linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dev_pm_opp_set_bw() is getting removed and dev_pm_opp_set_opp() should be used instead. Migrate to the new API. Signed-off-by: Viresh Kumar --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index e6703ae98760..05e0ef58fe32 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -134,7 +134,7 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp) if (!gmu->legacy) { a6xx_hfi_set_freq(gmu, perf_index); - dev_pm_opp_set_bw(&gpu->pdev->dev, opp); + dev_pm_opp_set_opp(&gpu->pdev->dev, opp); pm_runtime_put(gmu->dev); return; } @@ -158,7 +158,7 @@ void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp) if (ret) dev_err(gmu->dev, "GMU set GPU frequency error: %d\n", ret); - dev_pm_opp_set_bw(&gpu->pdev->dev, opp); + dev_pm_opp_set_opp(&gpu->pdev->dev, opp); pm_runtime_put(gmu->dev); } @@ -866,7 +866,7 @@ static void a6xx_gmu_set_initial_bw(struct msm_gpu *gpu, struct a6xx_gmu *gmu) if (IS_ERR_OR_NULL(gpu_opp)) return; - dev_pm_opp_set_bw(&gpu->pdev->dev, gpu_opp); + dev_pm_opp_set_opp(&gpu->pdev->dev, gpu_opp); dev_pm_opp_put(gpu_opp); } @@ -1072,7 +1072,7 @@ int a6xx_gmu_stop(struct a6xx_gpu *a6xx_gpu) a6xx_gmu_shutdown(gmu); /* Remove the bus vote */ - dev_pm_opp_set_bw(&gpu->pdev->dev, NULL); + dev_pm_opp_set_opp(&gpu->pdev->dev, NULL); /* * Make sure the GX domain is off before turning off the GMU (CX) From patchwork Thu Jan 21 11:17:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D9ACC433DB for ; Thu, 21 Jan 2021 11:24:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B536238D7 for ; Thu, 21 Jan 2021 11:24:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B536238D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ViynShB9FJDtGgujoGnFVGtR7GXHFtxBHAMbWA6tGJU=; b=rMjbP5PeKheqog8zOOXZCfzh+ zZDKstqE+CfxcXakBcpykGoRR+T5GjhcrFpDinatbp+nZVeA4O+cbbN7JvSyj9j+FgCEXhfWHIjoy eITPzdVuUWimFw8wABL84gb+krodo+dQN6cNsOElLCKkBLZsCt/yknECf0mUYZR10uEf3eZWzzRtp eLQgackb9B+RsKj28QxMDegAKSev3h/+ODmxYeWl9GIw5noZMXDmoWx0vPbsJxgE/pWfnvNgrtKRM Xv9auE+B1aGnlMso/vwIH0XVXxfMwxopx0jicsGwDgjjUMffixAaAiNDwcJuHXMx7CV6xATWW58/C HbCy+86PA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Y1z-00063s-JT; Thu, 21 Jan 2021 11:21:39 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Xzo-00059M-3E for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:29 +0000 Received: by mail-pj1-x1030.google.com with SMTP id p15so1444649pjv.3 for ; Thu, 21 Jan 2021 03:19:23 -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 :mime-version:content-transfer-encoding; bh=tpbd5REqcbcRMd0xcpf9T6/Cw9coNwWGEmGNqj2MIho=; b=cQ5rRy39r5+ufO+3BswxSSkFJ7+Jpm6N1g2Hni+fnN4oxrLV9pPReJ1frk5GKLuUml f+U1YMG533Xe2z8g69+kCFjMwktlTruBmh0C3cLNfwpeEOXXKu5j6AvKTUX4JExQxbtp IycMCPFvd8AB6R3DAEhE4y+LNhWYguX9xhl/bhiDNtGU+hPTm95rvzqFxoYTUl7ZArFg xQqneH2veT3wjgjuoC5folDhjA+5nktphXldfMpVgci8UVrjbj0twVuNKYpnkOxc6p2n ZODeYkUs9DjKiBV3Z+V9zOrDpDgz4n3CnatGQIqOezN3qBCn3geZ7pFlKDH83G2zIuov Gdcg== 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=tpbd5REqcbcRMd0xcpf9T6/Cw9coNwWGEmGNqj2MIho=; b=FDvc3BvCmxIKTVTmq1rKvnb4d2rWq74zkPATZ7vapQYkmKYropFTiE/gh0MG858TJH ZdGzSWbi4jwpKB4CoJqfiRbniZJScpTtj+iODE278Fz5gsmUtHDka1Zzyqgt7th11YBm fxrt8m1gAmp7sOdgu9vdnJnTz48sV1iVXigwmddJc79l/I6YRRsvjduzkTco/QASqCFn 996id9O9T37VGtX0yXpMQ5xwKfvq13HIVwrJK71rGLZ5FnBiATBd3dsTlNprDhEwT1nY PQdLX35IJUTMBu5bn9iHJPZkutOB6SJXSGjFbQHbm92fr9wvUevQI2Zt7y3CTowvNOyR fbPA== X-Gm-Message-State: AOAM533s3WSXd7DBpaXnnc9F3aqGeFkpPPd1MApp6M2nt9uZwazaeJiQ ZJsK6ofPKvunbsBnBaYjVrPolA== X-Google-Smtp-Source: ABdhPJwFngayl7Kb87/6CN0WzGWc0iYnvTw6xgMXD3fCZ+Ox7Ja9cmNj8T9QjiUNNOF7BbJad6fLcA== X-Received: by 2002:a17:902:a412:b029:db:cf5a:8427 with SMTP id p18-20020a170902a412b02900dbcf5a8427mr14517166plq.48.1611227961615; Thu, 21 Jan 2021 03:19:21 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id fs21sm5401300pjb.30.2021.01.21.03.19.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:19:21 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Subject: [PATCH 13/13] opp: Remove dev_pm_opp_set_bw() Date: Thu, 21 Jan 2021 16:47:53 +0530 Message-Id: <45684bf5b7b9004808d412f8d749c536970fe165.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061924_183534_1C3E88F7 X-CRM114-Status: GOOD ( 20.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org All the users have migrated to dev_pm_opp_set_opp() now, get rid of the duplicate API, dev_pm_opp_set_bw(), which only performs a part of the new API. While at it, remove the unnecessary parameter to _set_opp_bw(). Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 41 +++++------------------------------------ include/linux/pm_opp.h | 6 ------ 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 5a367ef02b92..d8ca15d96ce9 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -798,7 +798,7 @@ static int _generic_set_opp_regulator(struct opp_table *opp_table, } static int _set_opp_bw(const struct opp_table *opp_table, - struct dev_pm_opp *opp, struct device *dev, bool remove) + struct dev_pm_opp *opp, struct device *dev) { u32 avg, peak; int i, ret; @@ -807,7 +807,7 @@ static int _set_opp_bw(const struct opp_table *opp_table, return 0; for (i = 0; i < opp_table->path_count; i++) { - if (remove) { + if (!opp) { avg = 0; peak = 0; } else { @@ -817,7 +817,7 @@ static int _set_opp_bw(const struct opp_table *opp_table, ret = icc_set_bw(opp_table->paths[i], avg, peak); if (ret) { dev_err(dev, "Failed to %s bandwidth[%d]: %d\n", - remove ? "remove" : "set", i, ret); + opp ? "set" : "remove", i, ret); return ret; } } @@ -911,37 +911,6 @@ static int _set_required_opps(struct device *dev, return ret; } -/** - * dev_pm_opp_set_bw() - sets bandwidth levels corresponding to an opp - * @dev: device for which we do this operation - * @opp: opp based on which the bandwidth levels are to be configured - * - * This configures the bandwidth to the levels specified by the OPP. However - * if the OPP specified is NULL the bandwidth levels are cleared out. - * - * Return: 0 on success or a negative error value. - */ -int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp) -{ - struct opp_table *opp_table; - int ret; - - opp_table = _find_opp_table(dev); - if (IS_ERR(opp_table)) { - dev_err(dev, "%s: device opp table doesn't exist\n", __func__); - return PTR_ERR(opp_table); - } - - if (opp) - ret = _set_opp_bw(opp_table, opp, dev, false); - else - ret = _set_opp_bw(opp_table, NULL, dev, true); - - dev_pm_opp_put_opp_table(opp_table); - return ret; -} -EXPORT_SYMBOL_GPL(dev_pm_opp_set_bw); - static void _find_current_opp(struct device *dev, struct opp_table *opp_table) { struct dev_pm_opp *opp = ERR_PTR(-ENODEV); @@ -982,7 +951,7 @@ static int _disable_opp_table(struct device *dev, struct opp_table *opp_table) if (!_get_opp_count(opp_table)) return 0; - ret = _set_opp_bw(opp_table, NULL, dev, true); + ret = _set_opp_bw(opp_table, NULL, dev); if (ret) return ret; @@ -1050,7 +1019,7 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, } if (!ret) { - ret = _set_opp_bw(opp_table, opp, dev, false); + ret = _set_opp_bw(opp_table, opp, dev); if (!ret) { opp_table->enabled = true; dev_pm_opp_put(old_opp); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 2d8a706f8d00..891276b46e97 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -159,7 +159,6 @@ struct opp_table *devm_pm_opp_attach_genpd(struct device *dev, const char **name int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate); int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq); int dev_pm_opp_set_opp(struct device *dev, struct dev_pm_opp *opp); -int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp); int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask); int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); void dev_pm_opp_remove_table(struct device *dev); @@ -382,11 +381,6 @@ static inline int dev_pm_opp_set_opp(struct device *dev, struct dev_pm_opp *opp) return -ENOTSUPP; } -static inline int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp) -{ - return -EOPNOTSUPP; -} - static inline int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask) { return -ENOTSUPP;