Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9129335pxu; Mon, 28 Dec 2020 07:20:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfkf1+cLelI8qvUN7g65+t5Ahnzef04u6ym0O8vgX1gmCZR15qYFMqrp7BpXRy1WpmlX1L X-Received: by 2002:a05:6402:1ad1:: with SMTP id ba17mr41658757edb.51.1609168815907; Mon, 28 Dec 2020 07:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168815; cv=none; d=google.com; s=arc-20160816; b=Bw9exaj90iBtFxoJwWOUDpJicM6PKEO7QTA3KTNrMNz2RVUfHUtcHucwJRslB7/r16 e9ZPz70FAQto46ySwlN4c7pRa3MlLIQKg1gsfgJBQj1lOIbER58SDlqiDcAmxIX8GJWi mp9g9/iv4WFrITwJ1slsnYttidH88yWyUvzbdbyQobD/xJAH8+VpXmttYxzHUZG7NqGQ 2pxzLCWIMB1cTulifM6592C+QGbZHFxOIgu9HDfx8N89srbXf4+GielsErRFq0EJm1gs F31qWsZclNd1o5LQRzgAoFB+/EX5l46sPWISkY7oq0X4T6PfBclfB0c12o/XOnyS9XNu PNQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=4qvAPOSnb3gCPzAXuw8OIJYZA27uuHy18ix0nvJW1CU=; b=o56QQMFhXzYr3BLEdyn/Shu3iWxSI130cHHx1fK9SCVP5RkIWf5C3ERGWiG/gV0LE+ fO5TBKaGCh3wb3paICbGkhVSugaajToPKJuWvP7QeEZV4R+tCViWBjVRy6zllvJ0etTn wWXjGlOiYH9Nk0PUTg3L6lHliPhxZDg0H4xSqhub5qzCmKjkXEy2371IkPFnaVtqwZ8/ 6Xpv8xAdXsjdM1/HYXkXHbIJoVf6fkk9eZEGJa2PY+TvAtbsJprI9dYHMzo85C+V4Kza hngInfMJcuQE32zmt0fpsfMETczFN1wO+Soir480W9W4nklxE/mM9jLSqOZQ6hMM/N+Z 5GKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bl3r2U9y; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr10si18061114ejc.306.2020.12.28.07.19.51; Mon, 28 Dec 2020 07:20:15 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=bl3r2U9y; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437336AbgL1PRg (ORCPT + 99 others); Mon, 28 Dec 2020 10:17:36 -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-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.