Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10566753pxu; Wed, 30 Dec 2020 06:03:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6XbvFRFVaYS7iEBbjIda/JIvDgWx8bzZSuzrC3pCt6LTTsen7kXIIbb1zHzJZh6ULEZ25 X-Received: by 2002:aa7:c444:: with SMTP id n4mr49361870edr.226.1609337026831; Wed, 30 Dec 2020 06:03:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609337026; cv=none; d=google.com; s=arc-20160816; b=Q5u6FEFrOdFdzgmpH1IftP9Gz0WM+JODTXcb9aMcN042ePD/mTd2uPgDPKUIxcqF8Z YPwcdQ4MWls66JTKn891dMIXecAL7KYw97lkwv4/K+Vi3nRVWM7TAlqHNaJem3qULgax reBFR8Z1csosqabESDD0Jsx46qjmRJDgdxRpMoGlPInxBufHwHVBYCaDAOMx/gWjEtbE X4u+E3u0l0oSZ+ULN4UunFqKOijNZXJnatO0ms+l0lJ2s2EeUA5QQehNRMgXITScDT5R cIUw9TPXp2vlbqvc5L8bKiAR2VO5VqkatWyDIqxIntXzrF2c5o+ZEpYYQ68d+I71Z3Cr 1r4Q== 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=kgbDtfqk5fP8ba7WjhXh9EaZlWvPtHxJW5owvXGnu28=; b=nPtA2ZQ+WXLNzzy8B1+wfPDpzl4dBWYslRvXT/BXX8IsIfzy9xGnmwmekXftpQqUMZ xJfZqEdt609sQkeXQ+4E9P2hgWYRMN7EU60/HWVSiSPkMpZluRuuava2ors+JZGa8Ssg aTdusI5pIGMxIYcQzH+Smy7MwnemMMVPKz3uEamTA81t7axwiO6pMUDta9MFTsaMBzdU OblozINFTiu5rhht3kNT/L/w5VY9DqPg0sexNn74KVDU0fpgKsUnLFTFz5o9nGA23rhq Im+Yl9RHCVHiJeV1C8AtaGiRvesgXL7p1BFiWrqCXs4CYVZjDpZLQWLrJjW4KDJqd4Iy dEZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UhvgoE4y; 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 b12si25488968edq.488.2020.12.30.06.03.24; Wed, 30 Dec 2020 06:03:46 -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=UhvgoE4y; 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 S1726873AbgL3OC6 (ORCPT + 99 others); Wed, 30 Dec 2020 09:02:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726547AbgL3OC5 (ORCPT ); Wed, 30 Dec 2020 09:02:57 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBFC9C061799; Wed, 30 Dec 2020 06:02:16 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id l11so37890711lfg.0; Wed, 30 Dec 2020 06:02:16 -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=kgbDtfqk5fP8ba7WjhXh9EaZlWvPtHxJW5owvXGnu28=; b=UhvgoE4yfbHePS8AaVrQlFt/hwDbTrDKwDFCbRhhHEgAe1Hv4O3OeOiKmqtsQSuVUt 2EzhCLUkVX94507wJTEO5Xcx1y+/WKL+HxJw3rG+NdjkqHYpTIHmHfAD6BDhG9cTHfw/ vI46uHG3aMxT/34J9JakJmRQGq2WI51algXfdeGu//jRDCGJYh6bFnl478JzLePw7j/B PkiZp4Mvwg7KwrUqwWlkYglwRdXL9EVQm3e922wabLwzAcaGgWzj9L4tsiCFYznbDjk8 mPEUkLquIXzerq6FYZOehyvFtuTnWM/jmFGV4sZIvKmT7wLr8MTGy18L+eHVf9I8UdGN c/Ng== 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=kgbDtfqk5fP8ba7WjhXh9EaZlWvPtHxJW5owvXGnu28=; b=e3qBoxKZGn4JF5yYU33YgPN84os2XX+j1PKDG21xo7us6kPXXpejhry/nLOZTSI75B u1B40/Igafrj+4VEjROKtx9/AMheU+oLzIHfZmqlUJ8q4VNPAIdAAtlHD4OTduaf5B3g 20BH0acXxhApEMHgYjsrTHjMcvlRJigP+K650awY3vlLq7/mszFl4r7OATXDDc9FDD40 Akz+3eKdf98Z6yonlLNrGRddFvNnR/bDWXxg8+BgoZZWAu2FORbDRS3uMoMV7OkjoN6L 6yU7WSJ+7HKtcm+8S72ZIvA7dJ5I5Ajg5AoFXtiKG883l+W/W9m7ifm01+kxH/fJCRFq cUSA== X-Gm-Message-State: AOAM531i+ycErGYsEpaoivzpCIC4vGjRKALo/QB9MEkVgPYQyrC/v8qX FpHsQgSN2KjMnixgDB/Aip0tUUQ5HhY= X-Received: by 2002:a2e:8910:: with SMTP id d16mr25849728lji.357.1609336933615; Wed, 30 Dec 2020 06:02:13 -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 o12sm5965987lfb.49.2020.12.30.06.02.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Dec 2020 06:02:12 -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> <20201230044637.jjyw5gwe73ovslbd@vireshk-i7> From: Dmitry Osipenko Message-ID: <7f2385d1-603d-28ab-34e8-3623635045f6@gmail.com> Date: Wed, 30 Dec 2020 17:02:11 +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: <20201230044637.jjyw5gwe73ovslbd@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 30.12.2020 07:46, Viresh Kumar пишет: > On 28-12-20, 17:03, Dmitry Osipenko wrote: >> 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. > > Ok. > I'll separate the OPP patches from this series and will prepare v3, thank you for the review!