Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1521805pxb; Fri, 1 Oct 2021 12:29:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXuLCHUCq5t8DSK7cxcdOWN5nhTGSRZ5fnH9yrjAFGX68uuhxyEw3GSkVelmqOMoJOdSLh X-Received: by 2002:a17:906:c249:: with SMTP id bl9mr8144230ejb.225.1633116544054; Fri, 01 Oct 2021 12:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633116544; cv=none; d=google.com; s=arc-20160816; b=gR/kxqngDO/vUangagfulwIrWU8TAoBmpXItFifzvi5L6H4dc6mB7wA/yt240Ymsww lN/nxP8FNjVdWJPpLkJztKqA6x9egg6OOUZmIeJ+C9vf/hwngYC3hVab52stHERfHq6H RpVTWtthqNoQWlhuP66Txq5Pyy+YQ8X3KcP4wjbyKc0by8tteN4gAg4waqL4V/YQtpQF 4IpBx8+5sBFWRn+iTzAPBeYZkQfwhY3EVnRXY4eEAVPt6IXRYm3Maki088t5F2asYMgu oOiq3gx+Iq6pu9DFkmKQiYRnOZmIbgwuKDhYJOzefyOnyeExhugy6gOdSFNGkv7kHb1q +8Rw== 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=niNmxAk0ssHAm3Elvv3RJuw0kSncCioQpK+Dv1hLMfQ=; b=T7zI9hRXdJMmsKIeUDcXlCzTBc/j9zz6q05FqIaUnvbem/5BWatmAJOsIdK7c2pJEg e+RKEHU2WlnDYGwRWXXjqHlL1zTMYV3E30fJwrvEQqODkzohqfJGQqVSQLKTR3b/UeD2 d66VzbPIPu3MBVVID139mpLCi8Kl2Q6u536qRmJhONDdLtTe+OCPzzcRJBggS2DP1Pqo N2rvpzLgo6bEn89dqdxeLOZZBTbBptuBCg0cdAqxL2/GGg4gByP3CkhNwr4eTuOt4/dh H2K9Qq0NmmzuXDBaoU24REK4VbXhz/0V1IK1azoWfVp2H9JVS0ZIU7cBSI95u5DSVODA rJGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ompAaqfU; 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 gb11si14319446ejc.197.2021.10.01.12.28.37; Fri, 01 Oct 2021 12:29:04 -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=@gmail.com header.s=20210112 header.b=ompAaqfU; 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 S1354618AbhJATRS (ORCPT + 99 others); Fri, 1 Oct 2021 15:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231897AbhJATRR (ORCPT ); Fri, 1 Oct 2021 15:17:17 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CBDEC061775; Fri, 1 Oct 2021 12:15:32 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id g41so42283748lfv.1; Fri, 01 Oct 2021 12:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=niNmxAk0ssHAm3Elvv3RJuw0kSncCioQpK+Dv1hLMfQ=; b=ompAaqfUP2nwflwfZymbIWdbQcFcOFoC+2uqB/pw0Y1WeA0ZFgZBrXXroc1D9iZE/3 r+IPUa14hP8aLxdvlyxUGLG/sRpD1eVdY6HINGphhODSA8qi/WKmBF/Y4qJmjtqG9i5c QteCTEwJ3FXZQIQOvZg/gr4YarMpWJqOQByuYB3PUiBYUJEXrfcuahtdb4hIBH9fyTNN mNv1yfewQHiWqoHrX0awqEd0Tl6wD/YvrU5uk1BErj6tECORNnLLUEEmHb+sWMY3uVV3 Di3gYCH1EFMU7aOskMvk2sJ93QZxwOrUh/JeZf7kFffGHX478Gg8fj5Vh9nZ5d15M/9/ cQ9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=niNmxAk0ssHAm3Elvv3RJuw0kSncCioQpK+Dv1hLMfQ=; b=jgiltYdEn9VV6EpxeD3Cc9Ww0mRwmqcceWht5OiYSwz2br8hlK+/uiFnDGiVpx+bEg bbmUrJO7YWE6BSyyDCkBn5uovhjOuiN1v0GYhTDOONcGrH7ZD4Rp0LZdwPJra9BY2bAj tF8trH6Ut8GDSRJ+Uf/TES9vHatzHZRGCEgH7RVo/kiPLt+u7J15hD3esmma2BOCoWSo Kura87ogU+bWGoqJxeqixAOcMowu25ZSt8y9saAknWf8vwq9nYYv9kkvykoffv9U6nDf RlqZn8NKHcIw2jb+eRroFsfDiPEnt76oOeXA3AXucTjZ32GPFDrtaeSx15TWAms83L3R uk+w== X-Gm-Message-State: AOAM531yEm8Wt7gzw65anzwhic/CpnA5wvmhYwNH4rdhLFTSNZrCwmfq d92qTPMYHjolrwHJbqjny6o= X-Received: by 2002:a2e:4e11:: with SMTP id c17mr13093513ljb.19.1633115730771; Fri, 01 Oct 2021 12:15:30 -0700 (PDT) Received: from [192.168.2.145] (79-139-163-198.dynamic.spd-mgts.ru. [79.139.163.198]) by smtp.googlemail.com with ESMTPSA id d6sm820684lfi.137.2021.10.01.12.15.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Oct 2021 12:15:30 -0700 (PDT) Subject: Re: [PATCH v13 02/35] soc/tegra: Add devm_tegra_core_dev_init_opp_table_common() To: Ulf Hansson , Viresh Kumar Cc: Thierry Reding , Jonathan Hunter , Stephen Boyd , Peter De Schrijver , Mikko Perttunen , Peter Chen , Lee Jones , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Nishanth Menon , Adrian Hunter , Michael Turquette , Linux Kernel Mailing List , linux-tegra , Linux PM , Linux USB List , linux-staging@lists.linux.dev, linux-pwm@vger.kernel.org, linux-mmc , dri-devel , DTML , linux-clk , Mark Brown , Vignesh Raghavendra , Richard Weinberger , Miquel Raynal , Lucas Stach , Stefan Agner , Mauro Carvalho Chehab , David Heidelberg References: <20210926224058.1252-1-digetx@gmail.com> <20210926224058.1252-3-digetx@gmail.com> From: Dmitry Osipenko Message-ID: Date: Fri, 1 Oct 2021 22:15:29 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: 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 01.10.2021 15:50, Ulf Hansson пишет: > On Mon, 27 Sept 2021 at 00:42, Dmitry Osipenko wrote: >> >> Only couple drivers need to get the -ENODEV error code and majority of >> drivers need to explicitly initialize the performance state. Add new >> common helper which sets up OPP table for these drivers. >> >> Signed-off-by: Dmitry Osipenko >> --- >> include/soc/tegra/common.h | 24 ++++++++++++++++++++++++ >> 1 file changed, 24 insertions(+) >> >> diff --git a/include/soc/tegra/common.h b/include/soc/tegra/common.h >> index af41ad80ec21..5b4a042f60fb 100644 >> --- a/include/soc/tegra/common.h >> +++ b/include/soc/tegra/common.h >> @@ -39,4 +39,28 @@ devm_tegra_core_dev_init_opp_table(struct device *dev, >> } >> #endif >> >> +/* >> + * This function should be invoked with the enabled runtime PM of the device >> + * in order to initialize performance state properly. Most of Tegra devices >> + * are assumed to be suspended at a probe time and GENPD require RPM to be >> + * enabled to set up the rpm-resume state, otherwise device is active and >> + * performance state is applied immediately. Note that it will initialize >> + * OPP bandwidth if it's wired in a device-tree for this device, which is >> + * undesirable for a suspended device. >> + */ >> +static inline int >> +devm_tegra_core_dev_init_opp_table_common(struct device *dev) >> +{ >> + struct tegra_core_opp_params opp_params = {}; >> + int err; >> + >> + opp_params.init_state = true; >> + >> + err = devm_tegra_core_dev_init_opp_table(dev, &opp_params); >> + if (err != -ENODEV) >> + return err; >> + >> + return 0; >> +} > > Just want to share a few thoughts around these functions. > > So, I assume it's fine to call > devm_tegra_core_dev_init_opp_table_common() or > devm_tegra_core_dev_init_opp_table() from consumer drivers during > ->probe(), as long as those drivers are tegra specific, which I assume > all are in the series!? That is correct, all drivers are tegra-specific in this series. External devices are attached to the internal SoC devices and this series is about the SoC power management. > My point is, a cross SoC consumer driver that needs to initiate OPP > tables can get rather messy, if it would need to make one specific > function call per SoC. > > That said, I hope we can tackle this as a separate/future problem, so > the series can get merged as is. Yes, as we already have seen, it's not an easy problem to make PD core to handle it in a generic way. If there will be a similar demand from other SoCs, then we may try to solve that problem again.