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=-6.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 7252DC433E6 for ; Mon, 28 Dec 2020 15:17:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 43EB2207A1 for ; Mon, 28 Dec 2020 15:17:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438316AbgL1PRi (ORCPT ); Mon, 28 Dec 2020 10:17:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437278AbgL1OEH (ORCPT ); Mon, 28 Dec 2020 09:04:07 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBA96C06179B; Mon, 28 Dec 2020 06:03:26 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id b26so24049748lff.9; Mon, 28 Dec 2020 06:03:26 -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=4qvAPOSnb3gCPzAXuw8OIJYZA27uuHy18ix0nvJW1CU=; b=bl3r2U9yXYFzTcL+MMt8/u3WC03Tv2y9aGpfMDF+N5t5SOd8te41chnr2P+tYXgxap qwi67ZrMGeBXFF6i2U1/h8fpFscRnAJlA+bG6BE++9jg1sJirjaO75C7ygUTfOp9iHPc Yars2YYOMCQH/+4lrFdWgHgHubxtlUGfSVWkGmuTDRDCNETQoRFqyJm1yOemv2j+fOXU 5/WBa1SGMKBukcACZnAJkY1bpWqyZu0kDtPBWL8qeKDNz7QV8CxI3OuE7812UUrxl/Ya aAvrf8QxKJLq4+dD8I+H5iaFUT2AaRAEOFTZRmLcbpirb4b1hMFAXt64Gu5605ULqSGz 0zSA== 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=4qvAPOSnb3gCPzAXuw8OIJYZA27uuHy18ix0nvJW1CU=; b=na61UGSU/DZ0aenfWKJYKOyIzvSAOVDZiPphjqKuOeplwGhHkrph8xmMg/IZuyCQL5 hSGAWhJnZcSSoOf3Bql9CR9O3aL1Z5P73a7Wh8UUAECogRSe4BsWwM6b/I21U6qEAxy/ lRCrRg76Qf2RTEUzzbfw0o2C2jlcS+WGwSQNrOr2pMbcNyXff2wB7e9m5EQ96qFm8vFa HbfWYnlmuJ9Ra2A7iDKOucMrj+cmrKdI9MXglVP1Yi3J3RDXJaz4Y+zFXWch7Wbet0vj QcHmNgVXUu5iqG6K+JqKuFOd5mTPDS22jaLMoMASXxwOD3uX+5ZitXGkpQdokxUZRNSo v8CQ== X-Gm-Message-State: AOAM531MIWHKrI2gdOXoPt8jjktN5MgdJUjd5RnmPmBssS0GUpbaIMXS cyq2Mu57A0isWLm/5Vo5dKKBWfGWEIQ= X-Google-Smtp-Source: ABdhPJzUpl1/di7tj7MASZGrGRvUabOdas4lVkZNDhVFRvZuxbYB/Sicx781pXRzuHaMyLMY0tnsEQ== X-Received: by 2002:a19:ccc9:: with SMTP id c192mr12718066lfg.98.1609164205141; Mon, 28 Dec 2020 06:03:25 -0800 (PST) Received: from [192.168.2.145] (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.googlemail.com with ESMTPSA id d23sm5324052lfl.115.2020.12.28.06.03.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Dec 2020 06:03:24 -0800 (PST) Subject: Re: [PATCH v2 11/48] opp: Add dev_pm_opp_find_level_ceil() To: Viresh Kumar Cc: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Mauro Carvalho Chehab , Rob Herring , Peter Geis , Nicolas Chauvet , Krzysztof Kozlowski , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Michael Turquette , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, linux-clk@vger.kernel.org References: <20201217180638.22748-1-digetx@gmail.com> <20201217180638.22748-12-digetx@gmail.com> <20201222064253.x7vsurh7q5k7qzb5@vireshk-i7> <20201223041931.klnppy4fu3sdgtsz@vireshk-i7> <20201224064339.zngidobhstnlu2a3@vireshk-i7> <780db190-d93d-3bca-4819-790010f82c62@gmail.com> <20201228062254.ui727ka2ftijov4m@vireshk-i7> From: Dmitry Osipenko Message-ID: Date: Mon, 28 Dec 2020 17:03:23 +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: <20201228062254.ui727ka2ftijov4m@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 28.12.2020 09:22, Viresh Kumar пишет: > On 24-12-20, 16:00, Dmitry Osipenko wrote: >> In a device driver I want to set PD to the lowest performance state by >> removing the performance vote when dev_pm_opp_set_rate(dev, 0) is >> invoked by the driver. >> >> The OPP core already does this, but if OPP levels don't start from 0 in >> a device-tree for PD, then it currently doesn't work since there is a >> need to get a rounded-up performance state because >> dev_pm_opp_set_voltage() takes OPP entry for the argument (patches 9 and >> 28). >> >> The PD powering off and performance-changes are separate from each other >> in the GENPD core. The GENPD core automatically turns off domain when >> all devices within the domain are suspended by system-suspend or RPM. >> >> The performance state of a power domain is controlled solely by a device >> driver. GENPD core only aggregates the performance requests, it doesn't >> change the performance state of a domain by itself when device is >> suspended or resumed, IIUC this is intentional. And I want to put domain >> into lowest performance state when device is suspended. > > Right, so if you really want to just drop the performance vote, then with a > value of 0 for the performance state the call will reach to your genpd's > callback ->set_performance_state(). Just as dev_pm_opp_set_rate() accepts the > frequency to be 0, I would expect dev_pm_opp_set_rate() to accept opp argument > as NULL and in that case set voltage to 0 and do regulator_disable() as well. > Won't that work better than going for the lowest voltage ? > We can make dev_pm_opp_set_voltage() to accept OPP=NULL in order to disable the regulator, like it's done for dev_pm_opp_set_rate(dev, 0). Although, I don't need this kind of behaviour for the Tegra PD driver, and thus, would prefer to leave this for somebody else to implement in the future, once it will be really needed. Still we need the dev_pm_opp_find_level_ceil() because level=0 means that we want to set PD to the lowest (minimal) performance state, i.e. it doesn't necessarily mean that we want to set the voltage to 0 and disable the PD entirely. GENPD has a separate controls for on/off.