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: 367810 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp471881jam; Thu, 21 Jan 2021 03:22:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5R2W1NyYmXX4/1cyI5NaxxHNEfpBVir0uqgiLFPLu4PYfUOrtLl+axKNtdxVxXBVLUi/t X-Received: by 2002:a17:906:7a42:: with SMTP id i2mr3979455ejo.27.1611228127131; Thu, 21 Jan 2021 03:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611228127; cv=none; d=google.com; s=arc-20160816; b=SdWdgTrcD4LcKHV84wBcpETubhNmmiNEhr1wJV1oLvbyTKZ7t9sXYF5LunZYwHjVpB 1rqdgpI1xHHBnfmnIT/ZXsuM3ba9Lql4TZCQeMHPUwuNftDX6kdeG46QwxrHzGP82Hxr 4sTtrKAGaCm4Rd2QLOB+Sj9hiDioF6v0SE5ROcb3h+vJHbjS6nVdX8kBgkP1aYVpVvGq pMyadJLzZCk6OBkFcDRhZLG27SSfZUak6RUpb+k2DLPnwGAp/OZ03YGQcu72SN+41jzm VvnP8O6BjGLq2VJp2LvEgaMBC8dq42IJuimQzmS2qERJKgDC48L3P8yRq7tVdhV6MLsB 6V+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DAtjI7/BPs0IoV2iaS54lmWpFTE0HbF0Es/G22rWt3g=; b=NbkOBjqfaFEgwJcBtkxCRqZGA/8g7mNP9884uCzFcz57B3vW1NxWW+86nGsmwJFv8F ND/V45BmP9jrWEWdZ0XDCPyBw+xMqQUVv3GlPX1iMeEVHup2KfjzZ6fOe9qH2MS9DHxg AJpuXA2QCAzv7mJEZW1JLMWUZqCsJNVEuO+tNIIZcbS1OzM+IHFt79ttJOK6yyjb1QKh pziC+3g2gDZF/bXKdx33BCF1nr0xWGIILeK66Wn/QozSL/s1zcELB53QE89Vbj2CTMgN f2TmoTFmmsIrCgvUg80srUBXkEwRDp23D6NuOjk/ShsKe51wdVJJ/LksOb/jQw3YK/GB tczQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZpmS5LN1; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si1753700ejq.244.2021.01.21.03.22.06; Thu, 21 Jan 2021 03:22:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZpmS5LN1; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729177AbhAULUn (ORCPT + 7 others); Thu, 21 Jan 2021 06:20:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726959AbhAULUk (ORCPT ); Thu, 21 Jan 2021 06:20:40 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72923C0613D6 for ; Thu, 21 Jan 2021 03:18:45 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id p18so1137020pgm.11 for ; Thu, 21 Jan 2021 03:18:45 -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=ijPQyDlKQjPRtAGZnzgIeTPIuozm6GO4mI2J9X92BkLIDdDdLlzCOaQ6BQWi7cWXzC XNM3ZTqQGBZClAXRtbHLn1e+RLpIp9I9jAdCuBhZxcMUTrJoNJVevwHrRKtc63jDFblX AZ3+5O2Ae+lVVgzePcdtngyTsbw7EkSyLalYupFUioKU0VC1voNQOGwVpGF9V/3WQC4/ DekORWZbNus3CI4Ltw81qQnDzBctCQ3GPaUE0zWOSku5QgGv58iF1OUvsw1h/XQzBdzp rLcQko8dXEAP8G6bQsi/J96VbZJtY/v/439ek1n+0GMtpmWniEY9RV6g6CDeXQPtihCx 0Grw== X-Gm-Message-State: AOAM531zfKpP3XsKZDc9Wl5WHKSftf8HQEX507m5bfbNRHycRqkPEJ60 ECxgRBIy9J65IAoHShmcBu4Arg== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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: 367811 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp471889jam; Thu, 21 Jan 2021 03:22:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzF1SRtT7VT5Kr6eBeed5V1WV3zwkmdsmkMG6P4bgsx9kp3x6C5zzJLQEAE+Q5NL5uxXJ3g X-Received: by 2002:a17:907:b01:: with SMTP id h1mr8769870ejl.450.1611228127525; Thu, 21 Jan 2021 03:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611228127; cv=none; d=google.com; s=arc-20160816; b=bZeZQVc/4Enx4cA+savtrzEGiK2nMa2RUC3p4ZXyMgP/br6DBzury6rMadek4PWdR/ uilYD9AMK8BFVZTK+sFQyZNsRysqQLRLa4RVKwcn1hUcl0anMTqBWbeFBI4+ITZ6e2O2 e7pi8myIHnMJzcFRiID3pvKPb38YS8rDrXw/939/snc75fZXshet9tIJutUpzToCEXH2 ZyAsTzFPUhQlcqyunrgNde0mkqLF1Og7NUsvAv8cz+KASDW61ca5WGkjKdFEauU2Ykv1 /HP7lCThX//naOzcoIIuFv95SOF5LRGldGukY0DEGCVd191rJi46sunLRAKV4gwb0vPi dcAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t5BvkMjuaVY08gUJbMK2zLQ+31ycbwXJT/Kur/3Z95w=; b=qZNd4oqCK2h9kUYTIH1IzMl1aWLKr5ZcEmp2zCeOuH+UaYJStsisquUROvM5eNvyUW JsC4EXth2pvDXhyLZb+Stg8zQGJxW8/FlXQ0MffpQ5hx3QqSFJT3D+qD2Z5KNSfywVAY vMo9Qe6N7TBEJPBAPTxbK/ErUUbhwzY6KYiHGT68yqNv/NTjDlkX2HyOUXVsVlpbTU3J yPpTSjioiF2eg1ddjrKKVuMwhi047DwrYlJtuq3BLoMs6HM967cz1EH04ooH5sX6T5Wn F0Nl/dPi4kNDOLH3E52zF1BYMtMjz3eJSyb6mPMaYCXSZdBj+ohiyDYUYEQTO9MQbWkt vQFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F1sJbjeF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si1753700ejq.244.2021.01.21.03.22.07; Thu, 21 Jan 2021 03:22:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F1sJbjeF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729908AbhAULUp (ORCPT + 7 others); Thu, 21 Jan 2021 06:20:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728846AbhAULUn (ORCPT ); Thu, 21 Jan 2021 06:20:43 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6184CC061793 for ; Thu, 21 Jan 2021 03:18:48 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id y8so1097787plp.8 for ; Thu, 21 Jan 2021 03:18:48 -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=gqbFlJtBRRVDsJ3Oy6LfxIlVwNOGIAzrmS1DnP9sd6iroI8F++tQhKlqh4Z9GaK+zT x3D750cZzfskAQo/YHSKuHAunQ7j78M7R3wiCLCB363myOhSYmRi9eKzjunTHbm1ZR2r 9YpRa+t/WRT8nKubIJTTLW5N81TX0ubxAOF6UCHf9zK8EA8biVkZPD+ZM1+vZ3Ip9yPc 2kTe40podliXwxCfOrJq8TNVoXeYhXfcudzWWRFjcpDJG/EJip3J5LDnurCFr44JkT4p +lunT/3IBl+l57znNk25u7DUUwWJDsso5VqbkBHlkVKdrBFK4kdktkGqGLLmVbEjx8Vn 6Y6A== X-Gm-Message-State: AOAM531YTxTFihx6HSDIm5W6WChbnpmqf8di1g9UvD6JcILPK+kdswEI VtvFHUDuL6yElUnkJieaJ3BUSA== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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: 367829 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp499401jam; Thu, 21 Jan 2021 03:59:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwh4MV5Y6xoPVlWEy3fkjG7sHgqG2axP1yfget+fb80O8/WSvtYSbF7aBMUJuxfN2IMpb/1 X-Received: by 2002:a17:906:1701:: with SMTP id c1mr8873628eje.395.1611230367625; Thu, 21 Jan 2021 03:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611230367; cv=none; d=google.com; s=arc-20160816; b=y+JFEmCf2Vln30dImzeIvLwXm2xIJbo+hLQZJDrSRGJI77XtOejh0r2ZW+RH/o4ujZ TdRL+JE230nA/jOcyR4dtNPdV7yuOm158Q2HoWaCu2u7lUTyQi3YgRkP7akoIPA6ItoV O0fEJf8hmHJXGe+TvLPA3IgeBQpK/BmUu6jYcsxpMCPQpYLUapCo0SgUHWvN7E7DrgAE y/CiBxWRCoVBAGdKBDjtyI8LcysnvBmWCmENmMHPV6Gy9ooahKL+FzLunrq028CgHeCn /xKH4KAYWttLfnhRcAv93aFd22QtwC9RblWYOQov2fPkJO9NrruizykALZ2SITMWblD9 soFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YF247aIKbCY2/r4PGlk3GxBCCQW3KMMZcpJEZOc5/Q0=; b=yEqVDm703GdyYx7UAP9NsaDVDH8BR93rbkYoBOY3nkRygE+Dxv/2ixBrREqbBOYtXp Mv3mdssOB/oA62doaYqIevF+UA9bE3vsr7789ulaMxO4j6PzWVvHJrSp9H3ECNsxWGBy Sk/3f1g/ISyrK+g9HdJ/WMgymF6+FsphfTZ3/cn6zXdaGbh2WV6/3tZk2Aqax6yIgjux bIEIO5Hmhz+dWa7y5yzInMNhASgBoT3YSJjkiTSfD1Q1FF4cZU+UCzVseKdb6IlK95r+ ebgjha/lFK51zhKDU9uxspQTpsl75r4n7TrDcQU7OFu8OZ9aravbIArLrzBs0GfSivjY XD8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q4aQO8et; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc2si1720885ejb.569.2021.01.21.03.59.27; Thu, 21 Jan 2021 03:59:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q4aQO8et; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730032AbhAUL6J (ORCPT + 7 others); Thu, 21 Jan 2021 06:58:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726959AbhAULUp (ORCPT ); Thu, 21 Jan 2021 06:20:45 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BF79C061794 for ; Thu, 21 Jan 2021 03:18:52 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id x20so1455715pjh.3 for ; Thu, 21 Jan 2021 03:18:52 -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=EcSbPH5lSWjlthIekLhiLgQ4GfuCj2vby5ennTLPhwTjcypFyWucLE1pQXOmAr3zcY aA0tDHoU45MUS6LJ/vWW0/oOVDs7r1lY7j91H0d5QtCVnSs8WPAZrpHjiNnl2qq1wKFp nS/NouHt7ceJXmSV5e6efmOZK8CRD1p9vAwsDdAOWI7M5fOyaqM2klOtDL1mVmjgJYyY g4U890r6j6+DGMZC3l2ad7hr47MxK3lQTNC9IXO5WpLvzFatR8YjRVKd1u/wf7S4qf4X eC9bqihA1I2J6A8gc6WTvlpySEPerwN3vlccHjJN1VBMK3Ocb+0G91k5WfZYC9LxMqfL R27w== X-Gm-Message-State: AOAM530Y52AjlsJ1usJ3kH1eydlMF44MZysIpIj9dsfbMnbAo+ABJsvw D2Os3YNqNxbRwfLIO1i+Xj5ecQ== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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: 367830 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp499409jam; Thu, 21 Jan 2021 03:59:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/3sX+RWZBbgTihtfIhYeO3p4tAUPnlqINoVZU+ELSGhZPJ+pBaQ7IkAdccBihkF/ksnTO X-Received: by 2002:aa7:c983:: with SMTP id c3mr10749631edt.327.1611230368025; Thu, 21 Jan 2021 03:59:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611230368; cv=none; d=google.com; s=arc-20160816; b=U0VvSEFZdLHr2RsFsRAiOyCirZijUg+MCnrf4Tvb5mGY1vX/epbIBKgLKm/w6pQXPW anTYR8F4yErXCHzb7+NC2R4vFkgUY6wODSwl4NCJV8lRE+nAHNIMaqXx4Uw4SPR5CZzC OTlChrdgZEaeZotftS/bYFa8Q1eTQu2carS3rvtj6WIhRW/NCm+XZ4lb/OkOXuV0D+1Y zXwuEOiw+5ncCeETFLX3eEau4f/T+PS68NQR3wS6OVsy+sbOeU4OHMs7HAqFbCruf5GO Ri3rKRhuFWFbIqS6D57z+DwKOwF9PDwq+VO0N5zzEU+cn0sggn54gcCtPuEPWFX2ElTI VLyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yGSozZ62BYCUnvHz15lG2EnbQmWJ88vlwijLJGHrCgo=; b=SqmYUBkBpkwAXK+ci9eyBxNiKKNQmVGjqeDQX/TrelcPeDfQBcp98lbu3fDtQmTvnH YzLPmvW+WrE/rtKcCTX3kQy5yW4yTUpAwu0Dp9YfCCW56wtWuGWm56knQyiRx5RaihKL aiRqD78R7WRVH8y6i6VOw5T8lbgR33EJ0UEEwJ5sqf72o2unmmeHObwofeAlOrDIP7kL mvzlu9r85ltiUKV5kLTtZxkXjze3cmEjt59pVYuBnTWE/APbfbCyFZyNUl53X3qYeY+k gIXSp9mDXG9SPk8RRftFeqfT99G/1Z8+IPkk++sIVFZA0WFZSNzFRMTLi0d7VEigVcv0 8k7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jMznsEDC; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc2si1720885ejb.569.2021.01.21.03.59.27; Thu, 21 Jan 2021 03:59:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jMznsEDC; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730660AbhAUL6I (ORCPT + 7 others); Thu, 21 Jan 2021 06:58:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729820AbhAULUp (ORCPT ); Thu, 21 Jan 2021 06:20:45 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30BF5C061798 for ; Thu, 21 Jan 2021 03:18:55 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id be12so1115138plb.4 for ; Thu, 21 Jan 2021 03:18:55 -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=Ij0IynPHyPEfb67kUA/hjhinZzWKmWju0Ta2EWljmxjEZkijMrkGuZuqbn1hbXSA2p Kx09HKFMBvmt9qs8VJB7gdFRPGMdIvSqGpGiGdht9vsgFPaMUdogx6pMKl+ztUWyd9PE GFlkNQZMrHGOVH+IcL05q8gesbuM3TfQSPHC4zRuoJtHQi3R4UFm1L6DPc6m3BvcRLu2 ELDSbsZJvouLr2fBzyckvIzZXJaCSPBHpRR7Eu9Mq2E9k8aqhA1I1qVsDeL2TBkrRbwL r9iDk3LUszJLq5Eiz1bAE5ugChteO1Y7iZsJwLGdYc08Sz8zqFuE/HmGVTDWky5+//eJ wIfA== X-Gm-Message-State: AOAM530dRGw3b1BCX8KJI2rbiOqbzvawWr4JlQg4yifNFTz1q/PaAQrd 9IcpoyB36Hp5l7/parOEo+6Y/A== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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: 367828 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp498377jam; Thu, 21 Jan 2021 03:57:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxieyT44BCdBhkyZJ7/OqmUl2Dv/v3kG1nNV174dpaVCp+49CcVZycOi1U4/C2r2HdgPmok X-Received: by 2002:a17:906:e106:: with SMTP id gj6mr8555835ejb.337.1611230278728; Thu, 21 Jan 2021 03:57:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611230278; cv=none; d=google.com; s=arc-20160816; b=G0yRGum7oPvY/xAt7iSNFxeah7cTXpIJmbQsTJE/ygacA8ETZrZh6qlKkX7WltBR6f Mh7+8Qf9v3T6ex+j5mM4bpRhjgeeQ0fab/OBCb1dCW75/0nCu1gR4DgfkL0k89VmWT+s nm1pTZbalSFLmwC1syaUteaxurRLCpMXfHA4S+3sxlQ5v+XtOVEpns0MA150UuJAZY6X mGVt2UorvipInBpxhY2T7HBHRV917s91gLTT/QMjLAqfqE0JGS97s+M0DETNj2fmd/G+ 6dBXV2EURdwsDE+pnppdevDLzxfpGeI4LXXADjXE2uPm1SPZBYyhR1u9+yIaYYEiw5SE 8ayg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3q4F6fqDBoI1WPbxX2i+8B6qqJAH4SxSEXz0WavjCuM=; b=c2pdfdXo8f/76iitdwL61CmhNq5z5TzBTDD726FQGC/mCt6jk4S+k8MG5aaKP0zwBs qpTlSITPXLTYMO8+W6mi83PeCwJthYX5wkh8H4mP008ta3l3GUoauzRVIXYHYzpXq/BK kgxjx9qI8LQPqryl9hBFJesaxXwrnQZpm2lhnexXFWVhVoAAHXHfkQbYK2hwYmior5qA pZcmV4ffH2kWGBAHpzW9sXCZBI+Pwt7HfkUunXCj7aJ0P8YD1/aN8tdKKwcXKOybgsZ2 I5PwV5lJWh6KUyA0PREp0hSP2qzL7GxEgnTLAYKYoCJzxLG111A+JBbcHXExVUxCH1rt U82g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KPZnAalZ; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k14si1708239ejp.175.2021.01.21.03.57.58; Thu, 21 Jan 2021 03:57:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KPZnAalZ; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730547AbhAUL5r (ORCPT + 7 others); Thu, 21 Jan 2021 06:57:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729917AbhAULUp (ORCPT ); Thu, 21 Jan 2021 06:20:45 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ECFDC061796 for ; Thu, 21 Jan 2021 03:18:58 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id 31so1087606plb.10 for ; Thu, 21 Jan 2021 03:18:58 -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=AYt45uzkvGdiZbZgGnNp6dXFNYzzPcsaxuvkgB7tbhxQ2EBsauKFwUbmA2p16DT9sV IyWo3L/mhO2q6ouRPBMaHETUdESt6Gfo5KD52hD73tL0E9VR6xa6iepgqmgpEWA2w7dI GJmVF48OHl+2T+mAYpKflbpgnYGL2YIC6fabEx7Mmc/PFtpKnmQ5SWeO/ldC9qWhB5m5 vZ/8JCfmhzgKSpS8LcR2gOJ5Q90rF7AFadRvRTyEMSwlQ0V0fv8pZTbPlhuDU6ADWHCL L73VXf/SmGLGvH8vko0KRyjgWGyKXt8bJOVuS9MafVgrQmb445T8mPttesTkFuU0DQy6 no0A== X-Gm-Message-State: AOAM532WLY6GYU/yUOaNIM5xUrv7XNCrAgeqHXbkqrGr9gkjdqcGUACu LVI9ltVuhNSOGe726YQJeOfgnA== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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: 367819 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp491017jam; Thu, 21 Jan 2021 03:47:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3psPsoALqP2dQhqFPswugZvTUIsQOOx1luNcOQEBComfU7tqCay7o6M7FUlMwkvG2uXW+ X-Received: by 2002:a05:6402:22b7:: with SMTP id cx23mr10893208edb.313.1611229673100; Thu, 21 Jan 2021 03:47:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611229673; cv=none; d=google.com; s=arc-20160816; b=lhANQ7C7Wjwwt376B91Tod8qq0LykqE1dw5gFOqyACstXQb9uHVmJW8dzxZAY3Nj/c /WI3lnRaUxujPMKSjovO/sLpStatJE/xM+Eu6+jCudN8oe+cn8zCkkZGny4PualKo6It UJk6lVF0Y0yT27dDicrBTpVUkch3gtgYwwNjFlLN4WseX6aj9FDHsUk/EDTPq1gtXKkG WoJyXIIOGN95c0DnPlKHGmaJzDy8YsRpAp198jTuq1doS695oeyU6Cq5K9Rc8EArHjM/ vqDzjMs2IOokgoLJxxMbiOaI/9wUnYlhukMmjHBDJPAVUmVEVZRs340kpV0Qt9FoR3Ca 5YAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xAKTZkyycba98JIw9o5yBKGTgq6RnpydF9Cba6DEkjM=; b=EivOAOtrlYqZ/OCpzwITG3EZAyfOgwvaRxm8j1qMnN42aEU8AHfplyP20CRZBhLD/x AGi7cOy3URKFh8o/ygp7SAPIRHErDcf3ej2NkI3Ho2Ug1zk9ey6l6AMGPK2m1ho3XTUL osl9o0S9jVqN87WfRhgWOGXXxYMCnYSRJv9of0pb8FI1EBTyxS7lP9Za+rT0hy9UDx2g MqRANpvgeyt0wKdwdbiQSMml0JX2YBw6o8XogezPD3IByO/Oc0nWYKYkMaH55Uw32G5v 4mzhcDNVw45emtI6ZSH5Sa7ZP+NECJV3aGAhuuq82LxNEMJ8HNoH9ebyebh9uDruKLi6 H0XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IE5cB3XU; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si1683299ejb.499.2021.01.21.03.47.52; Thu, 21 Jan 2021 03:47:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IE5cB3XU; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730076AbhAULrd (ORCPT + 7 others); Thu, 21 Jan 2021 06:47:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730071AbhAULVW (ORCPT ); Thu, 21 Jan 2021 06:21:22 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41D92C06179C for ; Thu, 21 Jan 2021 03:19:01 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id u4so1449253pjn.4 for ; Thu, 21 Jan 2021 03:19:01 -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=U4LZHWSGg0QPPmiMPH87/2OkD9gqu/1r4bejSRcYu2uTNsGfG9tWaE1j1p5T2DlbEw rxzpNdRyqz+KP5DoMuvuYNlWc6ug/2rSt0AzX4+1SXETojmL4n3KqDLy6JcJKHBMZacD i0bLRb887KGIoynRFgGjHCn1IfkJrsWP8UPyRvMAU1XYFwe6zqnWhfzsRZOAoMWzWqqX kTkEeP+uXaGJ/CKPpOMYSYKiloDmLkfhDHKGDhAqzzZiiHQgQX57jAliXs8x3OIrx8SK S3m740Q4KOi9nwjKuzAKXFnVIkLc6LEzoyQBDoe24KwnS520U3AhHgVv0fof3xwYpqdT qZvA== X-Gm-Message-State: AOAM533bILU421BQ1Fm2kr+g0P4ISIFxH6MST7haIv5bcW2YmWRJjUf3 Wf7is+NUzDWKt2O4ZggrJPWq4Q== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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: 367818 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp490926jam; Thu, 21 Jan 2021 03:47:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcQN1xos3ImSpEctwpXR1OicskEVSVff/trm7hzRTVVpggpyMSWuQxExJWFQp7HoMebbu5 X-Received: by 2002:a17:906:58c8:: with SMTP id e8mr8914705ejs.475.1611229663636; Thu, 21 Jan 2021 03:47:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611229663; cv=none; d=google.com; s=arc-20160816; b=kw08eC/0VcbEaCLJo8yxkt6GnYStoRph1lraQWAdII61ZIwFHsJ67u+Xq3BzRet0YH 5jd99tmsk4NZkt4DSGD0SQpIWnK1sCIbexovcv2KWHWA0xQX8BAIPJx8+JNG2KRrYobp igNDYLe7H2fTbtOHU/qiNacD2rqjka3+E9cfDXr0dXXkryMmh2HQfJJRaUOP9d2AgDif BQ4hppjwzz+sF5VIXVC4el6McIYWtun2RLCj2B6wbDXKF16mAEcp9i944+PGTp5iZ9xe Wld53aZQoBVvYr7SUTgiC9StQgz7NFyCkEM0r2LINzcvToL7Ge8lV9I/3u7HT2I1OONh PEpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CYbzCFVCi3fEgZJohV5hqu59RAY6Et7w7QbAOId9XrY=; b=RHl22dTbgizhaiHQcvMtzxwvMW41OOXGIDCi4FgW6dazJl5KLrMqxj1OFzMyjiXs8P 8WUN/q679IqtwGnYJGW5/Wwrz6cA4ms65xkN0Hc+no+XJOlPbEfprUbvjf6pN9e2ywAU f2iW+wP8ATlggdyjOIrL3Ppt2irz1Lc/tkKj6xghJP6VIbxZFLBRC1I/2xQKiwjt+q+F gi/cyNQAKL7B/Vc7ay+UZDDURZjM2a7SGQWDOj23uXcaGy2vjcpFfu9SjkrMSB8Tiqy3 Zdj+fiwv7wvzEtWgnWjjHC30Mj/fXKhmiurpwseHW13D+FwAyPvnY8CpjtfGXz/1ARvV RlVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lMZb9UiN; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si1683299ejb.499.2021.01.21.03.47.43; Thu, 21 Jan 2021 03:47:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lMZb9UiN; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730147AbhAULr2 (ORCPT + 7 others); Thu, 21 Jan 2021 06:47:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730076AbhAULVX (ORCPT ); Thu, 21 Jan 2021 06:21:23 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27548C06179F for ; Thu, 21 Jan 2021 03:19:04 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id c132so1166535pga.3 for ; Thu, 21 Jan 2021 03:19:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :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=RHsda/T8lVJigRUInunsCkeUMXJUn7ZFF74HgfK5rsN109Rq7bJow6ncggTvJivUC7 3XQWEllzlvhDxSXVHbUEewv+D6q44aw7anUR08X5nDL/chyhTr7ScymTmzNh6z0OTVid 6qlXo+Xlc6YCbTQODulPhCbH++zYDN3jqD5Nr+zQLx2TQTQB34E3UmIwVcgi0gisOyre 1y1ksTDeHbIkaK2PHq6Jet33FgM7zz2e0kGQtt7j3W/He/Uw0L+2Px7UyPHAQRjUaU+A ESXd+sbElp35wkpyW7ytsBfcP73uF1mNS6TEgI/duus2T+JC7hPZcWvEiZoMzJ7TDO7o Og3A== X-Gm-Message-State: AOAM532Hnr8pK8+QpUn4C245P9iw9E7Zcsvsz0lN6ZMHd3P1M40+jUww txpbeRW/JZeu+3JZdiGQPWZoJQ== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(+) -- 2.25.0.rc1.19.g042ed3e048af 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: 367817 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp490898jam; Thu, 21 Jan 2021 03:47:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXLjh8ey4cdd0kWJvZCIObPFrbC8WRjigMIgOeUforGmLMZfDnrXkL02YJ3oGkf8sVDgG5 X-Received: by 2002:a17:907:7252:: with SMTP id ds18mr4263666ejc.239.1611229659955; Thu, 21 Jan 2021 03:47:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611229659; cv=none; d=google.com; s=arc-20160816; b=fNGn7QTfS6bMM9eC9T4c/5wf0N4ZWdrPAsXotNE5pZibP8AjRECkYv5ffLXD1ConNK KzCGzUz30Ai/jKk8XuApUwFGq19PpLP2hbATMKe/STfvZkQnxWYjVIWtjfLicU4rrotO bENlA5pJ+sRqSVgVqtn7Ag6LpHyffIS/TintEoI6P9wyVs0Jzh6AJGB+CxYWBTEZHEQ+ LOMEscKuIiMQ9y1Awykq9wDtBFZdi+AIhiLwiVOeo+c6p3CqpPoYRKLaQ36lHXLxnD/J ZGH5RpSCGo7P7TPZmKKKCpQUYdrY7GGJVKuZUNYf6Vwz9hVmOd1xV+gvloX3d4RM6sGf T7AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QsvG3t6xFRgx0s76cOQVzbYkqHL9lM3bJ086HXut2lo=; b=w+rJEP6QUAcpVaH7G1G2V44SNwSIA1VWk4ZFRTjs0WJJyxD3iKPAyzaaTy3GYc9ak0 syNoHmShYcFKKb4dNgyQqx2faFwBwRwrL0yiWIWY4Zuk4lgU+Lc5+C0SUDqrLFjDVaz7 sHcfr2bm+pP7kqBF9iUx7b9sJEpb4sAjDE8tLohXVL4pC5sTeq8eFEP3Xp9fj5JKaymm yyTNwsolUWYdp2nUylxnfHW0Ezb8A0o+j2SjZBGE+CmxH5r/s80iuwT4sCMFmLtdRjEf ReWGhLWlQzM/Eh9M7ymyERuchjlOfj+aP+lnp3dZT4c24tBMmdaIjftyj/htM91abSFc bmTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W8sAOHZX; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si1683299ejb.499.2021.01.21.03.47.39; Thu, 21 Jan 2021 03:47:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W8sAOHZX; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730494AbhAULrH (ORCPT + 7 others); Thu, 21 Jan 2021 06:47:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730223AbhAULVe (ORCPT ); Thu, 21 Jan 2021 06:21:34 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23C42C0617A1 for ; Thu, 21 Jan 2021 03:19:07 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id w18so1302910pfu.9 for ; Thu, 21 Jan 2021 03:19:07 -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=cKqX6LzbRNUn2S3TGyJ5kjauaIydodz+Pi0HjjqPn+hXlwZYeSGnOT5Nt8GPFyXBm3 pNqgUXXUnh1zuecZCRZanakqelXcGsH+w26LoGab3iiPeJowU4BUiJ3cBHL+3IVA7hzr xzdujxLV5NYKLjpIMtr9UAaMYma/MIn95u8i5dTtbk4cFtAUNQsQbJ3DA7nAcXnJGJUb CKerYwDcD2HOUC99tjre/uTSGV7z0iWozm5Sd0EhcyRYt4+21ADIbdxIA6ZASlXhYDS+ TqKH6Ey1/AecleD4Lw0jhfbGdrSGkyrJed2AmKC/Yqerc+ixZICSDS3PxzF3I3Y9h0Bx jH/g== X-Gm-Message-State: AOAM530xOKwH4DeOIbL5BLWmFHF6pdnK/yZ7BTU6Q5xEgr0IfL+acNOp CYQoxiqCJkgw92mIaFZZtKWqfw== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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: 367812 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp471908jam; Thu, 21 Jan 2021 03:22:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUoQAp2i7qbIN2aJgW79CpVUxVzY1Z1xWBv0gRDY27dIgJva9qyb4bPQAXgDA3gXMXcG3Q X-Received: by 2002:a05:6402:79a:: with SMTP id d26mr7074929edy.266.1611228129690; Thu, 21 Jan 2021 03:22:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611228129; cv=none; d=google.com; s=arc-20160816; b=WhEksIQglQRsP5CVFxSAkOYb7ETlDmhx9Q6q/tJp83DVDKy9dbIZRexvGQDV1JiCKu cMpRlRAcnJWrwMLqb65334PsFWrKWelhqHqzb162ditomrAtcZtTNmsj5I17Rj/2mt9s ZikIcFIx9uW4wmDQjqyMei4HmfljUGA4tMi5lc7SOB3lcCvjiTm3XqPPy6cbiXQVbWue F3rwtOaAjAq+ffbiCZwRfKDFcLMA0cgsANVVFJ90bDWxZQbp3XUDedGwSt8EIyvvcgbI eFFZPYjSVzn8Gn+NhmRKFEy60qTvERIAuBq50BWcZ7vM7M3uElvXc27B5I/YCXjuiJw3 wFIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ztcbVczwcxvX+Nme8Zu1bVyHZiwA0aS5UzQfgwSCEM4=; b=vwd3w4Tjiy1/5sZfo4Qf93UI76lJxuH7EXXgELFW7D7hX6jEcJ6ICcJbLBh3dxbJmc 9TOtSH07DORsvilxjohZoeomBL+3gcRKXbxoqaomKt7fuTpfAKmXSdYZDanuCIu5h6Qr 2aFT+A+qYljjqgzfODO/ct0iDvrqS7+UGCqv8Cv84kU9OFUtYPgBQtXOXYvK/uiLGly1 lkg5CLNYwCaVPKVZwDu9TmwRfmvxnqxoOj4BhX1xbcPv7+vCRu6CuSWls6XL2CBr4T+u nG4yanwSkO1BfsOFXT0YN8pUMi4IWX9BSml81sftgyZAn87hKvQgLE2mRGX/jEd/TnJU 2YGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uvEyLQq5; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si1753700ejq.244.2021.01.21.03.22.09; Thu, 21 Jan 2021 03:22:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uvEyLQq5; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729925AbhAULVQ (ORCPT + 7 others); Thu, 21 Jan 2021 06:21:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728983AbhAULVA (ORCPT ); Thu, 21 Jan 2021 06:21:00 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F8A2C0617A2 for ; Thu, 21 Jan 2021 03:19:10 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id v19so1132993pgj.12 for ; Thu, 21 Jan 2021 03:19:10 -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=XY2WpXdeAJFqSDrR5LecaDLFgGXTKv7zZ4fMT6+ZBRen5H6rdj6qzd6yv8U8CBbx6F zuee4/8/pl/eU7mo34FSYXRE0bWXA5tI29ciPL7edL7PgWkgnFJa27sPuODVvA+G599p H3kxyG6dB39xTxXqek7ZlRoG74mBl9RNT1HWfSBsi7B5NmCzYnvNOOsQA3hQL5MJZ2eS 5GLzb1e8y42D+7KILx87MXqcmFuA37sYlY60ndVCLZvzpjziwrPTk+UZUVJ8vYKdUpBH K8mFT2NNhLwCG0DvL3L4k/oyLPBq6MSUMwlU+BiorMfXBn+hVzVz0xFMNcBJs3vFdjMc mhfQ== X-Gm-Message-State: AOAM532ZWH8dZVllz63ly/l/7l0te2jSKkg4QuIHZFgr8YyfcYBZgWoi kpugOCfjDUElAzVwhE91ihvdpA== 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" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(+) -- 2.25.0.rc1.19.g042ed3e048af 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: 367814 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp472312jam; Thu, 21 Jan 2021 03:22:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAlm/Ytybm3JedRq6O9aiMurMl1locbtm8qtlww4HprzpoppXTNeVhgk1zRn60KknOkoNh X-Received: by 2002:a17:907:b01:: with SMTP id h1mr8771225ejl.450.1611228161773; Thu, 21 Jan 2021 03:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611228161; cv=none; d=google.com; s=arc-20160816; b=gBW8kFQ7qsqnxfcWZO2wSUnprraPUpB1E4uH4ft8R7ZMmbkYvnqwq8bOloiVturOep Rys/lsdcqffxL+WrhMN6SwKP/dfHdeiM0pdME9G+lfnfjEPBpRCglgsuOarrrbGFSxxY 7JhVqA8LQ1yNccMLNfP+G5bSQinMFg8WZRLFhhSBpN5yJiGBqxXJyN4khu/TO28sfpGs bjQgiyj0Z49mSiUXlZwwnZI6uP959dKcWDxgW7Tugo0dwKqHqV/DwNp3jq4XgcGedh18 8c1WXVKn1EGrg5fivqACF2GLN45fKG283D1qI2bYeGjrlwM63SjhDoiNq1/n3KhPDi76 CjkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jQe2wetugU1pRDNoKc4LJOQOkvxp53VsnbiI6RDAfCk=; b=iMiHVL3DcEFODTh1/7OUt4XEs44aAq+wWhnjzIRx+8JiCPaRbqxGHR9iG6zWyLxw3/ w673hIaJe8sejn2PYgm/LtX/DFoXDe1W/LITGRlDrjlZ+4vbhcTDkNhPcq+luverb8wj R5hhawNIenkjZi5ZLo/rvNQrMhMRG6/2/oRI7KI4TtMkxd1h3fC2TVB+QBvSAzPk68CW /WvG+FUmv5Zk+qWPghZQ8Skp6we2Gpg0KttL2Bv8AwmulJiw9oEHWp2YSN7M3XS/1vk+ CS8gksC4TEwg97g2MWqSQjcH48V053+kOagvnGGgSXZ2A/1+f00bOIQS6zhCxXVwrn3n mSlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JWhI8jHA; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si1753700ejq.244.2021.01.21.03.22.41; Thu, 21 Jan 2021 03:22:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JWhI8jHA; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730227AbhAULWf (ORCPT + 7 others); Thu, 21 Jan 2021 06:22:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730199AbhAULVe (ORCPT ); Thu, 21 Jan 2021 06:21:34 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F073C0617A5 for ; Thu, 21 Jan 2021 03:19:13 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id t6so1129168plq.1 for ; Thu, 21 Jan 2021 03:19:13 -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=NXZ5fMMhEG2wrU+eaBtHgdbKbYyF/aeCjL2S2ddlSZZxLRQdVPDQEYp/lASjYpjh+B hZVwD+vMZz6mNvVUd+aXf5DAlM0S6z85K198gqexCJtxwPVcwsR43kKSz285u8qeU7s6 q/pJZTBGUiyJZJwfg+xh0+21qk4ECTWOt8bLx87RHAMdQc/CvRDj2RVKYOSa1EUO67bz jQGmkNXad+jd5E1/5Czco3NU5IiGwyqsEOUgHQ8sXWqWPmBj+iKThu7WgUQ5uiyHD/ff 3Tvgo0Oi6iN29Jh8CrOXosDR7qhWUDM0K9NpuD/gMXiv/Bs7SRACdozKLdRcvep7YrHp xhDw== X-Gm-Message-State: AOAM532UOeTSc9UgzCtbbaKri4n1i76Mwha1uypLCbYyR8C9zcddSbX/ /BacBse6Ep5GNrefwloVz0yWag== 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 Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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: 367813 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp471916jam; Thu, 21 Jan 2021 03:22:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzksLwkDLD1ezfrZ6a5p4nG8NKrKrqQSuxjnrzoAa4qZaRWkyBJD3SrlbgJzackRUHV1evD X-Received: by 2002:a17:906:f98e:: with SMTP id li14mr9129561ejb.415.1611228130219; Thu, 21 Jan 2021 03:22:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611228130; cv=none; d=google.com; s=arc-20160816; b=SaDys34Fv88qJu0uEQ8hi/N5c49yvR+yIr+gRX4q69eVx3BJMLL2KA7L8agbOmy2i2 o72CVtmzaHGjPnLGlipWAEO0ytLk4xyxcVcmr/6XNvR2OLYdIWIgh9+PJhjJUQtAkVop X9x2SdUNQnf+UyVkExFZ8uYYza2UxhG8yilv8hXioikZWC4dCIOrGOlj8pRHsOQRz9oQ G2ejnSv/vUueK5mzw0r7qknylSY6vwJ4JWGxvhJCZeS0xjHYbdc50Q8fqyiQMRysoTm+ x0e+IvzxWqZCYzmh0fVB7Jm2KYzauu/ltGBuP+j+AAN9yh2hYMPG1itxR3Ajsuyn1JAC 54kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sc4RKhDP//JPOMDhY7YCUQxeEMkiC/uPecJg02H/C7o=; b=htFywIhg9UTEkQErWCRgekZbmAHB5AfmeFvy9lx8UVp30mE5URhDlVjsWoFtIRi8xU tbdsPfYSK7e1rNOpWXjPmNhjhF28o7H4k4mrDx2Ul+AzU0Fd1V8tbvgE2C/GtAzmNL4D zRn+tJ7LXW3AWK8hW5LK+avwW1d+0b4cTNgd9c68LJxFbThZ0s7UiRcha25A894MCYhe NFtusAfo/BzBedtoT3WAzuq2bdM/U2WOFVlXExmykVrAn0lfk0eW3GmGRcycwekvM0Ib 10z+eHWA82Eatz54Ey2v52i6fcYEabxlGROSfE47ki0aOK+GJ5gWasls6uZ47tctVElx NHew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l+IAUYm7; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si1753700ejq.244.2021.01.21.03.22.09; Thu, 21 Jan 2021 03:22:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l+IAUYm7; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729924AbhAULVe (ORCPT + 7 others); Thu, 21 Jan 2021 06:21:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729923AbhAULVN (ORCPT ); Thu, 21 Jan 2021 06:21:13 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05213C0617A7 for ; Thu, 21 Jan 2021 03:19:16 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id b8so1133442plx.0 for ; Thu, 21 Jan 2021 03:19:16 -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=lVJDvLohhI1HPUi0o5QJ1UyWqrE8Bvknfk7VMvhfIuP2AcBEy8UG9hTgVnd+zK0p24 Oc0ZmKkwuZ3HcdGhmSyXZqEQwT5j0R+V/SmVszgjnioqAIP18r5g1Fo3B29HGCz0GqWP oY3urELMiC0svLePc0JyPn+vHcodECN3vTC+RTigjv/lOLIyKD/DZLA7fyXPlGeZn4Hg KLPdB9NnF0g5rhhT2mbLoQ7rKBrPKkSVdf5AgRNQnz8PxL670N5BCqm6HWwyB/PtM9JX 80qWJpMJioctF1w63d+gyIwgvJ0Gxp8BWBuUdjMq28PUUbp1AQIxLH0IIlc1PIm9qhde jQ7w== X-Gm-Message-State: AOAM532itKeftlXfhKq/pDQBNqp8tApoG3fXbwEK1tBipQMPHko/aQJh 8AbKnD2t4XoCVCVN8iziWgAm9A== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Stephen Boyd , Nishanth Menon , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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: 368351 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 8C93CC433E0 for ; Thu, 21 Jan 2021 11:47:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E4E5238E2 for ; Thu, 21 Jan 2021 11:47:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730084AbhAULVX (ORCPT ); Thu, 21 Jan 2021 06:21:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729924AbhAULVN (ORCPT ); Thu, 21 Jan 2021 06:21:13 -0500 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0F22C0617B1 for ; Thu, 21 Jan 2021 03:19:18 -0800 (PST) Received: by mail-pg1-x534.google.com with SMTP id c132so1166897pga.3 for ; Thu, 21 Jan 2021 03:19:18 -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=UqyYkoejCmHebJtXKFyJlsA7NESsFiCX57Bn8el+ojxreEOzjaPKFlDnsBUftzB5MO Ur+IfDTqU05RMvhop0ccXpIDzTAMJEuUUxCuy/kJ0e9gjidPTz7+tJPcVrdrb/4uJ83P ID7YcvmepzNbOtAcgqU4yl1l+aAF81TDSSWzGgYpPHp6Kq/WomiibInYqBzTrDBNTCcL /CtDgvbaOk8o+EWDwY10Mlg1ZKtMq4ghQINqykWkA9QjzQxnBlumeQvsvhsF7pA3A65v cFwdKlXo+75mDLv3yFVSWxPN6xGAEovi/oSttmeUSgO3Sv3fs+jKYdNrBfAk9yMQIkZR CF4w== X-Gm-Message-State: AOAM532/PX0ixJHyZIBjAF1j3jtKwcz5sF7j4UCm1QTBdX6g/uC3cpqO pNxBhDTjVERmo/6WJKQXmRsu5w== 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 Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Stephen Boyd , Nishanth Menon , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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: 367820 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp492272jam; Thu, 21 Jan 2021 03:49:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzS7C9Sz+4831fXYHmbmz5SXqdts7LvwSKb1XrkwIH9KIGjWug+nCDMcIMkGoEvSCdDgfAz X-Received: by 2002:a17:907:7289:: with SMTP id dt9mr8985678ejc.446.1611229760509; Thu, 21 Jan 2021 03:49:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611229760; cv=none; d=google.com; s=arc-20160816; b=tbnhbJQ4NatDULgiR1oMaZofMeqfeAZZhczjiLF7ZX4j5roDspepY0Ev8IDUx3bdSV Qv+qkmt65O23YkVsnoafbcJa1R8LBAjXT69n73NU4yYMHZ1UQc795hHoX6doP3/NE6Zp 1+NAeE/7vP0aJNMw1kqj6BF9Pr13SDR+UoE0apAj/0E/3wdHmaCgCo8uKJ62KnQY37MA tWamSP1MkEZPhl61omyrH8rAOKyv0wsvhCP199d32PtBr96DcL3XGxZzY3r56YXu7zXs W4N70xq3zXfZMynq5mqnchR9uxITOPsTvPuYBUH2GUiamPs1f9kHw4ETU0hod6bGR+a/ limg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tpbd5REqcbcRMd0xcpf9T6/Cw9coNwWGEmGNqj2MIho=; b=MBlTSJAdA91hTK5DYJmKVfpBcRsFH6XiWA8oacOtA2VT/INwK5xV2FaxGA9RvRl+UO 2nXKxrhRDP/3Op5oqot2akx2MZTZXrjqxthxq9ef59UBJbcTbMKVc8VjnpnT6L8vPalB L47R2umFHzoTOIpcfhvHmTdFcFv5f2FRRvKtn8nyb0uuSBT0/yd/1jg6j0mBN5Pp1p7C ot9kWeu9R+55JpCI9EqRuBLdvXWv9iXAzWVUzyKwZZ6uHgG7H4Ol4qu9YWapozPXN2Fm jqunQ/h+rXcOzSagrWarJmz6Dd6fspff4oBcprTs2QHUuws1eulCrCIo2QH2ohrX/ChH 8jMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cQ5rRy39; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by17si2095042edb.1.2021.01.21.03.49.20; Thu, 21 Jan 2021 03:49:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cQ5rRy39; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729740AbhAULsK (ORCPT + 7 others); Thu, 21 Jan 2021 06:48:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729851AbhAULVM (ORCPT ); Thu, 21 Jan 2021 06:21:12 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1549EC0617BA for ; Thu, 21 Jan 2021 03:19:22 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id g15so1461707pjd.2 for ; Thu, 21 Jan 2021 03:19:22 -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=h8n2E/YzKlgpKigSS47hNDjdjUGgDFCQEx7b6EF5c96u4V7ELdmnXSDvJc3HruJSUx Ls68BPm4GZASjUrlAO7/2qxYiR8kiYx7udOdvQlB8ccrg5lIV61FZjh2oafde7EnLVqL YhJywppGWIgsjjaJeoou1kC1xxmQnl0Pf9rgUfzvDzfqYXv8xHiQRXqlyqi4nv4eC0Ku PAdXJiKyA5hs9krGHQbCKOmwJOQCTI0yJghRiarmmPQSAWpYYYwdQUUKIMevqE82Z32y PMM2Ngg3ToIE+kG6gT2Wj/B2lnK9rlmfNDAgzyiKxd0cEhxzLi9l6VJwkON4jiPppeYa OlJA== X-Gm-Message-State: AOAM532f0tAI53mKe7r8XgzH0FcFd83gOQ9PrpvZzTscXDK/7ih23F4Y 1m4krdyz33eHvhqvRKyg25tOEQ== 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" Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Sibi Sankar , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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(-) -- 2.25.0.rc1.19.g042ed3e048af 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;