Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp184714pxj; Tue, 15 Jun 2021 23:29:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi6fTNfc6v+VFORqcLEd2V3m+xOFGRROMB3wNj4JMfZmvQ+rX1/12hC4RZwNTdRRJGzge2 X-Received: by 2002:a17:906:8056:: with SMTP id x22mr3526888ejw.298.1623824987460; Tue, 15 Jun 2021 23:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623824987; cv=none; d=google.com; s=arc-20160816; b=oJLUy5dp6Yfv2arpeC12ybesM9gREgImvNOakZqHDpTjl+2I3B053WkDZoMzQUo/oy axTC2ZwH23EAaOHnJLBM2vCv6tG6uoI7XlOzCERk1Xdph71B5YPLn7WQoB7Hq4GIP4MD 3iNfHsxUcbtEBdUxPMCZ1N3/os2KddPZwtNdOS7G6ai21GhWRYg1A7RIJYEhXE+e73k3 rCGvvqb/54UN+F3dxhl+cSEJHv/5lsw34hM0aKhKyqn1L36Ob/PXqNLIGZsWIukNtpSP 0e25jxzD6/n1hMq2vo+LZXREYrxCM92OZwBpfWRQyTQQfVZc7Ud80+874Wmfc0qRwe3t jMdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=5xLP1A2Y8bJVbnozl56zTBiPTdrZwPIJB0fz7axLbRs=; b=VZFURyX6OHS3xAMiwAgL3bcVQI50IMKRcl3LGRbT82rG7Zi/6z/tkGA4vzJhse8IP3 KuFoIDGBaR5x9shm7YS2MeI5FKAwDnedY7z6B4W6GOaPf5Klsk9EgqBWDHN4Ta+LJJlT ThhlXvWYlYLJyKDM1SDohlBSkFSX43jMAHxBlaDyzbXeA8uCfM7Ms6X8cjLOlhRs/FhU MmrsOu1FToTf7ImOotiIUQevAPGhv1bp4vLh8wgLEtxzYffQyu5pdFOC19p4vQgP6NJE 9vD0FSxItbLulKTa++jZGHbXaKT0mVikmtMRm/Y7yXVM9TMiYLMqRTp00oK4nxRglVEZ 8G8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XBzVx1c1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o8si1586597ejj.94.2021.06.15.23.29.24; Tue, 15 Jun 2021 23:29:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@chromium.org header.s=google header.b=XBzVx1c1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230370AbhFPG21 (ORCPT + 99 others); Wed, 16 Jun 2021 02:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231381AbhFPG2Y (ORCPT ); Wed, 16 Jun 2021 02:28:24 -0400 Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B29AC06175F for ; Tue, 15 Jun 2021 23:26:17 -0700 (PDT) Received: by mail-il1-x12c.google.com with SMTP id x12so1390513ill.4 for ; Tue, 15 Jun 2021 23:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5xLP1A2Y8bJVbnozl56zTBiPTdrZwPIJB0fz7axLbRs=; b=XBzVx1c1DLb6ZOHvOj4si5MZ9wDSKBbbO3iW9lLx3RU72t6g0mNJFWOjhv/j8/ARKv NPeMHHhMA082I3PS03WSAbNp8MfSElP3XEmycpm2qaSJPz9zcKS9G4eJ3KrdRThMDu4R lYIiRQw6BRGRn4FPkmUAcdlpAYkn1J9gn5kxQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5xLP1A2Y8bJVbnozl56zTBiPTdrZwPIJB0fz7axLbRs=; b=NijN17WyhjjRdP8PUQBC5erwFuAl77IVaRyVyliEfK6zCdZAdQ0lKJhTPM9qFc2CqB MEMC76hw2PCIeDctZrhEs0BNs95j11Jh0ZB+Em8EYPSjB9XSUZgsXpzytiCoVo4UvETW fxBG28P5B7TOzlBvHJgjSb4cHCKCZrHE5ukZSN939jbxKyxvqP2V9Aaj1AdKSLLpQfGW CqjwqPUaLEW709C5kPHLM7SO+iAUuTBrHhMulsAnDLpT8SW8aZDJpU6u+NCv9xPAUO6W ml5EevN5/au0bmloFMGDXR9t6v3UQ1KGpzet+1w8hE9r7RLIx6UtQ3+9cuxULTqAkhp4 eoIg== X-Gm-Message-State: AOAM530mf7sGjuvU2aM5yw5F6QnUnJsLpyHU8qht/vyxJg6Nx4AJOzkK 2eba4fzo78YO19lLoyHl3UluTcRzUpXw/oGhy3Nm8qPZT1E= X-Received: by 2002:a92:7b07:: with SMTP id w7mr2444984ilc.308.1623824776960; Tue, 15 Jun 2021 23:26:16 -0700 (PDT) MIME-Version: 1.0 References: <20210616053335.4181780-1-hsinyi@chromium.org> <20210616055841.4m7y6nxnxbgw5rzi@vireshk-i7> In-Reply-To: <20210616055841.4m7y6nxnxbgw5rzi@vireshk-i7> From: Hsin-Yi Wang Date: Wed, 16 Jun 2021 14:25:51 +0800 Message-ID: Subject: Re: [PATCH] opp: of: Allow lazy-linking of required-opps to non genpd To: Viresh Kumar Cc: "Viresh Kumar )" , Chanwoo Choi , Nishanth Menon , Stephen Boyd , Linux PM , lkml , "andrew-sh . cheng" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 1:58 PM Viresh Kumar wrote: > > On 16-06-21, 13:33, Hsin-Yi Wang wrote: > > Don't limit required_opp_table to genpd only. One possible use case is > > cpufreq based devfreq governor, which can use required-opps property to > > derive devfreq from cpufreq. > > > > Suggested-by: Chanwoo Choi > > Signed-off-by: Hsin-Yi Wang > > --- > > This is tested with the non genpd case mt8183-cci with passive > > governor[1]. > > [1] https://patchwork.kernel.org/project/linux-mediatek/patch/1616499241-4906-2-git-send-email-andrew-sh.cheng@mediatek.com/ > > --- > > drivers/opp/of.c | 20 +------------------- > > 1 file changed, 1 insertion(+), 19 deletions(-) > > > > diff --git a/drivers/opp/of.c b/drivers/opp/of.c > > index aa75a1caf08a3..9573facce53a5 100644 > > --- a/drivers/opp/of.c > > +++ b/drivers/opp/of.c > > @@ -201,17 +201,6 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table, > > lazy = true; > > continue; > > } > > - > > - /* > > - * We only support genpd's OPPs in the "required-opps" for now, > > - * as we don't know how much about other cases. Error out if the > > - * required OPP doesn't belong to a genpd. > > - */ > > - if (!required_opp_tables[i]->is_genpd) { > > - dev_err(dev, "required-opp doesn't belong to genpd: %pOF\n", > > - required_np); > > - goto free_required_tables; > > - } > > } > > > > /* Let's do the linking later on */ > > @@ -379,13 +368,6 @@ static void lazy_link_required_opp_table(struct opp_table *new_table) > > struct dev_pm_opp *opp; > > int i, ret; > > > > - /* > > - * We only support genpd's OPPs in the "required-opps" for now, > > - * as we don't know much about other cases. > > - */ > > - if (!new_table->is_genpd) > > - return; > > - > > mutex_lock(&opp_table_lock); > > > > list_for_each_entry_safe(opp_table, temp, &lazy_opp_tables, lazy) { > > @@ -873,7 +855,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, > > return ERR_PTR(-ENOMEM); > > > > ret = _read_opp_key(new_opp, opp_table, np, &rate_not_available); > > - if (ret < 0 && !opp_table->is_genpd) { > > + if (ret < 0) { > > dev_err(dev, "%s: opp key field not found\n", __func__); > > goto free_opp; > > } > > How are you setting the required OPPs ? I mean when someone tries to > change frequency of a device which has some required-opps, who is > configuring those required OPPs ? > When cpufreq changes, the (cpufreq based) passive governor will calculate a target devfreq based on that, and the device governor (mt8183-cci-devfreq) will change the actual opp of the device. The required-opp is set in the cpufreq table: cpufreq_opp_table: opp_table0 { compatible = "operating-points-v2"; opp-shared; ... opp0_01 { opp-hz = /bits/ 64 <910000000>; opp-microvolt = <687500>; required-opps = <&opp2_01>; }; ... }; devfreq_opp_table: opp_table2 { compatible = "operating-points-v2"; opp-shared; ... opp2_01: opp-338000000 { opp-hz = /bits/ 64 <338000000>; opp-microvolt = <687500>; }; ... }; > -- > viresh