From patchwork Thu Aug 13 04:28:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 247666 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp955472ilo; Wed, 12 Aug 2020 21:29:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9txYsFoO6KSPwk4b69oNO5dBT51Bm3pfA2EIJ0wWz02jgB7Psc/oDK5S82legwPIyQz2a X-Received: by 2002:a17:906:b6d5:: with SMTP id ec21mr2913900ejb.396.1597292953959; Wed, 12 Aug 2020 21:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597292953; cv=none; d=google.com; s=arc-20160816; b=k1IWA7Xx/KfZF8O93j0ue+q2x04gVvHIVN1Iujyr69fflHq8aeh6Pu6RXWTXbZzri8 Lc4/HmUZ2f+Gz3rus04IrCzwKjLjMGDo9KsnS3wt4cHXCPaOkcRbMMZKeE3aZXdYA81j KxB/5H4enGbJ7xJCcoduVjqgmCljTH8s0/W6TrgzX0hAoWhILBI0lckTlbOljq4/oUuF gT1mPrd1Lysb+ZeePdMOWB/W+zSo+37EKQGUhe8N38QI/nBNzS/MW46enB1RG76oekqj ugh7nOOB5jmqYomchvLxnPxX5ok+57GqPCpj4JcKIPsVmHciAQrFylsd8tjKxX8pEAxa +cAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Ir/TwzXKrJIx51xeXWtP2nIBfHcRYk10KeY/pHei49E=; b=dfljeVXNtB8UDCYCDQTN9vo9OKu91WWthJ20qJKhV9LdkhLVjOhYXo7Aq8H//lPNHg 5/tPd0R0MTfNPd5z99ctMF29xWVldS6bgK7cgN0yxHD9b4h+G/eGWIxNFe2DuNmUZdjA wnI3AC7NVA48lUGeHeOmmk4GAKAkcM5e762UyCsIVMyOB5Nd5i6CuZXgeCDErkXVwsFP AUKnJbc+39GB2yX6VSpgOhkh9AwUgP+3snndrQ4xPGf3wB9WIkXAIVyB2UDIS6oI74Ko 9YQ4CiGu8xcRzapXd1QXh2TMPWdlxi3jS8MUZniwmRyH9jTMovAHqiur6V8h9hTIUnOz 3zDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cw5cxSfF; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 cb1si2671448edb.88.2020.08.12.21.29.13; Wed, 12 Aug 2020 21:29:13 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=cw5cxSfF; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S1726144AbgHME3M (ORCPT + 15 others); Thu, 13 Aug 2020 00:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726107AbgHME3L (ORCPT ); Thu, 13 Aug 2020 00:29:11 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32790C061383 for ; Wed, 12 Aug 2020 21:29:11 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id y10so504026plr.11 for ; Wed, 12 Aug 2020 21:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ir/TwzXKrJIx51xeXWtP2nIBfHcRYk10KeY/pHei49E=; b=cw5cxSfF05qeFRq/yk4IykzVTQKt+ejdPbbRjGsyg/WGZhkFrKF00uBXuRFmqkBWBm 98GqMuTdvn6Mtq462o7lNv0ssoRrhq5Zaqd+sPVDqifRhHFQMCB7ldDQtH38zcb8oicr c2TPJLMk56kk3nZFMw06Qc7bs3wnqYZw2wGnPNJ8QvhGJX/pLIktodr7y8ETRFwa+rK3 gFgwLS1CCmHfM7ZsfQNhSuuwymXv1An9GAZonvlgOcr/gen2W33MQX/ksR3PoVLxwTT3 5UugXjZLpAx8CUMMcrMtOtNVHhOAxRHoz+oBziu8uolZhrZ8iksDpxLOThUGpPgMo7ql +sww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ir/TwzXKrJIx51xeXWtP2nIBfHcRYk10KeY/pHei49E=; b=oRO+NrNYDeGboNX3iyXLPbLvtgnKKM2b/PZ0yCpoER2Ym998OsVuE7rHTLUnzcZBvd izs5sJA0dZER3YC1DXbvuu8RT063xEjyxicyhA1qi3oPSBGu4ao4Idm14IozG6xFnLQj PCW6Df34awNtrc3R4okUxKsqldmvyvxcDCnRHzWxnHcFkhHoPf4XJdwHyvZUD4bj/F6V EU/grbsV2y5YkUe7NR3lgwXQsdA6dhApjOWUsNTBg/cBWl1uZcBBdrts76FZ8zaFqqF5 6cY94tBJztIl7ZZw6FpQnJ9GaafOqXQs8L8Rp3w7Q6OJFiBbJCTrVNYLrk0te6H2k0pQ XJtg== X-Gm-Message-State: AOAM530BiQw6EKupamwyZHNb7WwzsJvfbWh4V7NI2WU7Mau/7V5yusO7 rZm02gyFeqkScADvhHgfjbFCew== X-Received: by 2002:a17:902:8b8b:: with SMTP id ay11mr2405922plb.241.1597292950502; Wed, 12 Aug 2020 21:29:10 -0700 (PDT) Received: from localhost ([171.79.32.211]) by smtp.gmail.com with ESMTPSA id w7sm4008522pfi.164.2020.08.12.21.29.08 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Aug 2020 21:29:09 -0700 (PDT) From: Viresh Kumar To: Viresh Kumar , Nishanth Menon , Stephen Boyd , Rajendra Nayak Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , mka@chromium.org, sibis@codeaurora.org, "v5 . 3+" , Sajida Bhanu , Stephen Boyd , linux-kernel@vger.kernel.org Subject: [PATCH V2 1/4] opp: Enable resources again if they were disabled earlier Date: Thu, 13 Aug 2020 09:58:58 +0530 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: <1597043179-17903-1-git-send-email-rnayak@codeaurora.org> References: <1597043179-17903-1-git-send-email-rnayak@codeaurora.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rajendra Nayak dev_pm_opp_set_rate() can now be called with freq = 0 in order to either drop performance or bandwidth votes or to disable regulators on platforms which support them. In such cases, a subsequent call to dev_pm_opp_set_rate() with the same frequency ends up returning early because 'old_freq == freq' Instead make it fall through and put back the dropped performance and bandwidth votes and/or enable back the regulators. Cc: v5.3+ # v5.3+ Fixes: cd7ea582 ("opp: Make dev_pm_opp_set_rate() handle freq = 0 to drop performance votes") Reported-by: Sajida Bhanu Reviewed-by: Sibi Sankar Reported-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke Signed-off-by: Rajendra Nayak [ Viresh: Don't skip clk_set_rate() and massaged changelog ] Signed-off-by: Viresh Kumar --- Hi Rajendra, I wasn't able to test this stuff, please give it a try. I have simplified your patch and cleaned up a bunch of stuff as well. drivers/opp/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.14.1 diff --git a/drivers/opp/core.c b/drivers/opp/core.c index bdb028c7793d..9668ea04cc80 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -934,10 +934,13 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) /* Return early if nothing to do */ if (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; + if (!opp_table->required_opp_tables && !opp_table->regulators && + !opp_table->paths) { + dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n", + __func__, freq); + ret = 0; + goto put_opp_table; + } } /*