Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1811969rdb; Tue, 3 Oct 2023 01:24:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH51dt6X4rWvpUoQ8gI3j38VhrSJjEZQXZubdqfD0kpWPTgv28NcRXYCdhclYry55KhCJED X-Received: by 2002:a05:6358:4414:b0:141:51d:4d48 with SMTP id z20-20020a056358441400b00141051d4d48mr13966475rwc.17.1696321460418; Tue, 03 Oct 2023 01:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696321460; cv=none; d=google.com; s=arc-20160816; b=dyz4MGmz3cB/MzSNFTyVhEbu+EeumH3lHMWznj182OwCPQxESDwX0iHBqx3nN9QsRI WU5BF7pUli7aPeEmMCbGzEzFN3lGqD+uW7IBXSdQlHS2qEiwJkrUCz2YXkDPpihThFWm njCgNKbDKUTXTe/NiaX2x4Z194YBtE1mrsPccw95gieyd7X379iwjIf/RHkQYHD//J9l zqmlVmAxtyZqm5sZqmMzixoDH5BC8R9Ss+Rg366DD5/HnRvvQo9UNSd3kzPwO6FRqTfd 2+qSqVJCX+l1vy+Vy5c3F448Htt+C06FtuDDgCEFE3Tf5imFsem5KJMYiU5XTIVtHGuO R7Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=thmnWGackJ2kyq9MtKqHyc87CEf9Q0TEhF2e90bIrDA=; fh=so4n3fFovZjzfWbzifmLtJ4OU6JKcTtmthSKAvZkt3s=; b=F7bb12XXtG/U+GGxq64mO8PDIV9xbkhPQub4X5VgH7p/WoZx34gV4sEE8KVTy4uZh8 wy6mMHQEjPRUTSOEfe0Gch86wSQ/dGnwa2AZiAKm6kBQzwfMTUJqz9XL3TgfF/m7qsts noxi39asc37fnSZj8Kk3upnT7c8+dTtulJ8/pIVh9HcyVdc2clq3fvxESTqNMRbcAXkw xAXIC6dgk9bJr9hGCI4XJY6NemjpHSy+b/4Bf5ww65/0B8ogOpdt1jgL78r/hPI0qNsZ WFCakDZu5sFG2U23BQgDyjyOTZStk5vrMCXOocmKEvmluO6+p2qVJU6Fjhxhr3wyALcw KhHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LPH8u4/l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id cj22-20020a056a00299600b0068fca125aaasi999151pfb.232.2023.10.03.01.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LPH8u4/l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 12549801D282; Tue, 3 Oct 2023 01:24:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240052AbjJCIYH (ORCPT + 99 others); Tue, 3 Oct 2023 04:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239946AbjJCIX6 (ORCPT ); Tue, 3 Oct 2023 04:23:58 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDCCDC9 for ; Tue, 3 Oct 2023 01:23:25 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-578b4981526so390047a12.0 for ; Tue, 03 Oct 2023 01:23:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696321405; x=1696926205; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=thmnWGackJ2kyq9MtKqHyc87CEf9Q0TEhF2e90bIrDA=; b=LPH8u4/lLveFuwbih63P8nVkE9DDCv7sVF//AdO6Piuc41TaG+TaK6TrHFdqdGKJGt uFpOPICAdbc2+n7g5J6QBn9NUmdCXTdH+w4Up3ru5DoYDdZELsuTBNQXdldHxEc0Jg+o rmbsgD3Yl5mBL1GCvqz5hsLA77kFCUaqDAYlrN3BXLnTR6CESvG6FYB5x7uVanPKjkoa qItc92QXf98reNVxXDM7G9pQ39Zb+TavmejvFclAUXZgXQwGqBLUkBqStbL1dRUjc3Un JavF6XY9cP9M/wjYHByKkn/sR7gaOUeOflxwjYfR1jb3AHyrb31KoCev3EpOZD8fF4qn 07Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321405; x=1696926205; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=thmnWGackJ2kyq9MtKqHyc87CEf9Q0TEhF2e90bIrDA=; b=tfh2OaLpFpx+bYKjDvAeuUjjetvzTxHWrlOafv4TqCbnsAHSUO/HQbjYx2Cjh7CEOK hzDlVq4eOlUrt6IxKX64K18TFSsU4UPMceH2rm+qC+Q9rd2/pZ1O06PpT6D4kSGQJCTJ N/PA2wTY/QuvSxTfmNg0rYGG04zTULjjKDeVyqr8nXHo1estzYXO9yTwN94/GB/lDd0F RuNmScW3tl/ypVzxy9sLe83dyKAfoRQuoD/kuYSwTAKytCVbDJE7ymSGAf3w+Flc/YLZ 3oj/bFUx08uQDWiCHVxIxTjBdgaSreDWvAJxBjEXPk4w8WQ77IewNcbk31Bi56NDZK8x W49w== X-Gm-Message-State: AOJu0YyLjP3nqT+MSsEbr/A/Ha9DyDFir4qsZLsxqiuu/JGdNaUGmRFw 1QaTsDjsgpdgdf49to6lpkeBCQ== X-Received: by 2002:a05:6a20:dd9f:b0:156:851e:b167 with SMTP id kw31-20020a056a20dd9f00b00156851eb167mr10314153pzb.44.1696321405368; Tue, 03 Oct 2023 01:23:25 -0700 (PDT) Received: from localhost ([122.172.81.92]) by smtp.gmail.com with ESMTPSA id t7-20020a62ea07000000b006933b69f7afsm782412pfh.42.2023.10.03.01.23.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:23:24 -0700 (PDT) Date: Tue, 3 Oct 2023 13:53:22 +0530 From: Viresh Kumar To: Ulf Hansson Cc: Sudeep Holla , Cristian Marussi , Viresh Kumar , "Rafael J . Wysocki" , Nishanth Menon , Stephen Boyd , Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/9] OPP: Extend support for the opp-level beyond required-opps Message-ID: <20231003082322.cmok766jxzftsgrg@vireshk-i7> References: <20230925131715.138411-1-ulf.hansson@linaro.org> <20230925131715.138411-7-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 01:24:14 -0700 (PDT) On 25-09-23, 15:33, Ulf Hansson wrote: > On Mon, 25 Sept 2023 at 15:18, Ulf Hansson wrote: > > > > At this point the level (performance state) for an OPP is currently limited > > to be requested for a device that is attached to a PM domain. Moreover, > > the device needs to have the so called required-opps assigned to it, which > > are based upon OPP tables being described in DT. > > > > To extend the support beyond required-opps and DT, let's enable the level > > to be set for all OPPs. More precisely, if the requested OPP has a valid > > level let's try to request it through the device's optional PM domain, via > > calling dev_pm_domain_set_performance_state(). > > > > Signed-off-by: Ulf Hansson > > --- > > drivers/opp/core.c | 29 +++++++++++++++++++++++++++++ > > 1 file changed, 29 insertions(+) > > > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > > index 60dca60ac4af..afb73978cdcb 100644 > > --- a/drivers/opp/core.c > > +++ b/drivers/opp/core.c > > @@ -1107,6 +1107,22 @@ void _update_set_required_opps(struct opp_table *opp_table) > > opp_table->set_required_opps = _opp_set_required_opps_generic; > > } > > > > +static int _set_opp_level(struct device *dev, struct opp_table *opp_table, > > + struct dev_pm_opp *opp) > > +{ > > + int ret = 0; > > + > > + /* Request a new performance state through the device's PM domain. */ > > + if (opp && opp->level) { > > + ret = dev_pm_domain_set_performance_state(dev, opp->level); > > + if (ret) > > + dev_err(dev, "Failed to set performance state %u (%d)\n", > > + opp->level, ret); > > + } > > Okay, so reviewing my own code found a problem here. We need an "else" > here, that should request the performance state to be set to 0. > > I am not sending a new version at this point, but awaiting more feedback first. I am looking to add below to this patch, is that okay with you ? diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 7b505316bb1c..a113e9caaa5a 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1135,16 +1135,22 @@ void _update_set_required_opps(struct opp_table *opp_table) static int _set_opp_level(struct device *dev, struct opp_table *opp_table, struct dev_pm_opp *opp) { + unsigned int level = 0; int ret = 0; - /* Request a new performance state through the device's PM domain. */ - if (opp && opp->level) { - ret = dev_pm_domain_set_performance_state(dev, opp->level); - if (ret) - dev_err(dev, "Failed to set performance state %u (%d)\n", - opp->level, ret); + if (opp) { + if (!opp->level) + return 0; + + level = opp->level; } + /* Request a new performance state through the device's PM domain. */ + ret = dev_pm_genpd_set_performance_state(dev, level); + if (ret) + dev_err(dev, "Failed to set performance state %u (%d)\n", level, + ret); + return ret; } I am switching back to dev_pm_genpd_set_performance_state() as I won't be applying the power domain changes. I will then push out a branch and you can rebase your patches on top of it ? And then probably Sudeep or someone else can apply everything ? -- viresh