From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 18452C433E0 for ; Wed, 27 Jan 2021 16:01:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C28A3207D0 for ; Wed, 27 Jan 2021 16:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343898AbhA0QBR (ORCPT ); Wed, 27 Jan 2021 11:01:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235584AbhA0P71 (ORCPT ); Wed, 27 Jan 2021 10:59:27 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B95EFC061788; Wed, 27 Jan 2021 07:58:34 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id i187so3344274lfd.4; Wed, 27 Jan 2021 07:58:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=rkl23YYCAN7td3M2Yke0axkC0ziieHeFZsCxQDb5Nko=; b=Dn89ET8ROAPBM0aXpz6DrKWB044nV6zsg9xvTxnFSiXhXbThstKRIgu1kzB/eJg6r1 5DoC9PG8HZGwCW+1CKM3urc7UcQ0UBKiij+DQ7CcabslbIoWdT3dUvcLMASLpZnVtPPw qcdZqidFCDYhO1eb3UawlpVC2OAsIIRgDILTAP/oLucPcdjATOSz7lPpUgKsfkbblUjA RPeKoM84g8HKD7DIvCn6zbpa1Hr/sXKhn3KMa5otRlY+qBU+O4nz9zIpCHFyRHMhPbix O4To35jnsDnJzAhVdjgF120mB29D+jLegTUVsJq2E8WNFvPjZWeZBguCS8a2o4eJ/IjM G5Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rkl23YYCAN7td3M2Yke0axkC0ziieHeFZsCxQDb5Nko=; b=SCpkNuhXWrQtsAYNn4Zv3LRQcnylc+jMdOqI/9u2bIGE9kgQjYXgCjyf6Rty8vDLFx EaO9oCRjatG2CEqmntFvtmszmZ87j1pkEhRqCaInfvfiW+pSplIvdvf1ZtFqVKVdn0oZ mZmhqL3LrjVzj/rZdKG/IaZtZr9XmHvV9fA4y1O5nZM4y8oGXI9g5C+Yc30p8ZkLMftm kZrXWG1z5hvgz0n9a75uBh1pcrsTOzA5SYxp6QccXXBUZ86/P+nzUkZeAXffyn6N66wH /TqQXZhxpwbBdx6beFwXV8+cQ95UwE6L2LdmIrQOsJaKJvXXrXehdyihgfY+GCFINnmU mMgQ== X-Gm-Message-State: AOAM530Y77hXnSudIJmvOkMq6sWQ6cFn0gJ5n9zEKlL38eS7VEMvIwGT jVtT5wftnoX18RL9Ugl25XYmyWYjBUo= X-Google-Smtp-Source: ABdhPJz6ngq6hOfVFIs8rFg9oOmlF6bbI+gFeQqU00YqMM+2j/aEHNezEvyP8wmU2JpN4awGfS9+vA== X-Received: by 2002:a05:6512:2206:: with SMTP id h6mr5239788lfu.239.1611763113017; Wed, 27 Jan 2021 07:58:33 -0800 (PST) Received: from ?IPv6:2a00:1370:814d:ea25:a10:76ff:fe69:21b6? ([2a00:1370:814d:ea25:a10:76ff:fe69:21b6]) by smtp.googlemail.com with ESMTPSA id q190sm679199ljb.8.2021.01.27.07.58.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Jan 2021 07:58:32 -0800 (PST) Subject: Re: [PATCH V2 11/13] devfreq: tegra30: Migrate to dev_pm_opp_set_opp() To: Viresh Kumar , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Thierry Reding , Jonathan Hunter Cc: linux-pm@vger.kernel.org, Vincent Guittot , Rafael Wysocki , Stephen Boyd , Nishanth Menon , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <3345fd49f7987d022f4f61edb6c44f230f7354c4.1611227342.git.viresh.kumar@linaro.org> <20210127100234.vl2wwe7rjrrz4btz@vireshk-i7> From: Dmitry Osipenko Message-ID: Date: Wed, 27 Jan 2021 18:58:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.2 MIME-Version: 1.0 In-Reply-To: <20210127100234.vl2wwe7rjrrz4btz@vireshk-i7> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 27.01.2021 13:02, Viresh Kumar пишет: > On 27-01-21, 14:40, Viresh Kumar wrote: >> dev_pm_opp_set_bw() is getting removed and dev_pm_opp_set_opp() should >> be used instead. Migrate to the new API. >> >> We don't want the OPP core to manage the clk for this driver, migrate to >> dev_pm_opp_of_add_table_noclk() to make sure dev_pm_opp_set_opp() >> doesn't have any side effects. >> >> Signed-off-by: Viresh Kumar >> --- >> Dmitry, >> >> This is based over the patches sent here: >> >> https://lore.kernel.org/lkml/6c2160ff30a8f421563793020264cf9f533f293c.1611738228.git.viresh.kumar@linaro.org/ >> >> This should fix the problem you mentioned earlier. Will push this for >> linux-next unless you have any issues with it. >> >> drivers/devfreq/tegra30-devfreq.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c >> index 117cad7968ab..31f7dec5990b 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; >> @@ -849,7 +849,7 @@ static int tegra_devfreq_probe(struct platform_device *pdev) >> return err; >> } >> >> - err = dev_pm_opp_of_add_table(&pdev->dev); >> + err = dev_pm_opp_of_add_table_noclk(&pdev->dev); > > Plus this, somehow was left uncommited in my tree :( > > diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c > index 31f7dec5990b..ce83f883ca65 100644 > --- a/drivers/devfreq/tegra30-devfreq.c > +++ b/drivers/devfreq/tegra30-devfreq.c > @@ -849,7 +849,7 @@ static int tegra_devfreq_probe(struct platform_device *pdev) > return err; > } > > - err = dev_pm_opp_of_add_table_noclk(&pdev->dev); > + err = dev_pm_opp_of_add_table_noclk(&pdev->dev, 0); > if (err) { > dev_err(&pdev->dev, "Failed to add OPP table: %d\n", err); > goto put_hw; > Sadly this doesn't work because we missed that clk is assigned to opp_table when OPP table is allocated and not when it's added to device. Hence we're now set back to the dev_pm_opp_clear_clk() variant. What about to add a new OPP API which will allow OPP users to configure behaviour that user wants from OPP core in a generic way, something like this: struct opp_config { bool no_clk; ... }; devm_pm_opp_set_config(dev, struct opp_config); dev_pm_opp_set_config(dev, struct opp_config); dev_pm_opp_unset_config(dev); Or maybe even rename it dev_pm_opp_allocate_table(dev, struct opp_config), which will allow users to directly allocate OPP table instead of relying on the implicit allocations. Then there won't be a need for drivers to use a dummy devm_pm_opp_set_clkname(dev, NULL) just to allocate the table usable for dev_pm_opp_set_rate().