Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5541252pxu; Tue, 22 Dec 2020 21:58:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBtIxP36f3DlTOH1pAzXiO57QD/iHw3ktM7W4veqzpfTYThotsPBmgaPFwgBycOzTCukTu X-Received: by 2002:a17:906:fb0e:: with SMTP id lz14mr23391148ejb.232.1608703134776; Tue, 22 Dec 2020 21:58:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608703134; cv=none; d=google.com; s=arc-20160816; b=sf8e5Y+W/Pa3Mog+IQdFOTccB5o81uE38YRySCtt1XO0OojHraD32sc/C+JRiioYN2 T4Kg/JTzsBkK5N/ojC4/wOh8sOhBdp9E8BFHEi2ZfsjuDnkWSc3uV61fRo1L9BMYQw7L gVgjCPbx9o6iHsv+9U4aiz4POkdjmLbOz4es7/72eM4mJMhky853bCZdPLUo0jzbP0yB WwqIF2bNJjSZi9ws3RX1H4Vvsu9nPU46OJVeaub7QCfleFFFVs+7csGpdl9hJ4WT4UD5 D5KXcae0ECX41TIoqv6yW8zGJmMpC4pOwT1fe57kzuAhPnk3WZWcNOrgbaYxJ/VAjfTS DkGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=lJW5Pmu0e9Bh/oQqoiiF+Gb9g3MgQRYVOM3hqkPUzNs=; b=jyhjyF59TloTxyBfw67WDMdP9rjR9rm76rB6/563YkyRfvmgg0d8rxW0Ff/gS8qNlG 7sFND+gY00wlrfYy3Ig40CZsoN4hTlp0oThSZOgjDgWroQi3ADaFV+Ipd7BTh+TsqRVU Z3w7Wrza+/cz1c5hI2RlbdxmxYa2osQfKRf430ufQ6y1ZsxwKsadQIo7lS7NGrOKluto 3PUty+siz2vtmeIWM8a8kyw3S/U9sTBe0xV5Y+td20EoaNlTaQuwGViVWzW/8+T7G6SS R+HQPbzsWLVZbNmSd62J/+slsWKDlRo6hQs9LQzgJzIg5qY+slVOqRYPpOPz9Z/hQGlQ dihA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W5YJc6Ei; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x91si13574785ede.370.2020.12.22.21.58.32; Tue, 22 Dec 2020 21:58:54 -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=@linaro.org header.s=google header.b=W5YJc6Ei; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727160AbgLWF6A (ORCPT + 99 others); Wed, 23 Dec 2020 00:58:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbgLWF57 (ORCPT ); Wed, 23 Dec 2020 00:57:59 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36EF5C0613D3 for ; Tue, 22 Dec 2020 21:57:19 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id s15so4173604plr.9 for ; Tue, 22 Dec 2020 21:57:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=lJW5Pmu0e9Bh/oQqoiiF+Gb9g3MgQRYVOM3hqkPUzNs=; b=W5YJc6EiiWk23cUCGsgoEZThjaHKBFlEG4O2cgRcXu+x5+1ODHw6d3bAyttpAh4Npy yhDhQA4+L+oz4wy8QflysfNhX4OfzqA0qNs/SHpKza5WXKgrPbKjAZqXsxt3M6+5uj5+ VPzhmEJIKzlbozEEPWm1XL8KIXiyyOKO2HmVu9XxWuzA1/dlfxbwhMlk6o4r2lNa/tYB koUJs3PACOOeP10gRbtLplfNUPU/AAwjZHrgwyo0byxhHtSGWR9eYNFuLyVygLLz+QCX 6yGQiSn1spMfKd1SRklgKWo8kYn0YWbHteDUGgx/252nlqC2vuCSM8Grhs1IDDtLRYP5 ah0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=lJW5Pmu0e9Bh/oQqoiiF+Gb9g3MgQRYVOM3hqkPUzNs=; b=PRG1iaQuNZlC6nXer1v74kEkvWuv9jx35Cb4V0Dlde25IxFRR58vHQFHCHvlTEAjtI LNlXCe4cqUdud6c5VlHG0aSo+5ZXuwiNI2M8cQYiy3o2x44ZZxBaObGF1wrPt6bTS3d3 u9iKAIo8L6z3Ue4gY450M9LjXPoD+VK07k6ieW8oEGvpeGlA3L3cxuYjkPS6hc1kwi5g sIKPM3iBN92HrX355F8s9QMSspX8Rk6toGD5YdbLPnw60rBeyYJdOTNAzwRBKZzni5Mh F2ZL5nKwvke/Pw6eqWGY/uVmuYm+7rAs8gItM2fX85FThU21xv9CvbKVpoRnHdCFtDH/ 6bQw== X-Gm-Message-State: AOAM532ufct16bOJnkGA3AFEKD/aLOqQwnAyvJZ1+Bn1WwAKJOK8wAhE fLiOeOfzgecqt0R9gzUqusumFQ== X-Received: by 2002:a17:90a:cb84:: with SMTP id a4mr25789987pju.50.1608703038680; Tue, 22 Dec 2020 21:57:18 -0800 (PST) Received: from localhost ([122.172.20.109]) by smtp.gmail.com with ESMTPSA id w7sm22839140pgr.48.2020.12.22.21.57.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Dec 2020 21:57:17 -0800 (PST) Date: Wed, 23 Dec 2020 11:27:15 +0530 From: Viresh Kumar To: Dmitry Osipenko 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 Subject: Re: [PATCH v2 28/48] soc/tegra: Introduce core power domain driver Message-ID: <20201223055715.2n5eba7fohrwpgr5@vireshk-i7> References: <20201217180638.22748-1-digetx@gmail.com> <20201217180638.22748-29-digetx@gmail.com> <20201222064029.duuzcsj53rt7xzvt@vireshk-i7> <3a5c00e5-2cdd-35ce-2714-d4ffbf9d516a@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3a5c00e5-2cdd-35ce-2714-d4ffbf9d516a@gmail.com> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22-12-20, 22:39, Dmitry Osipenko wrote: > 22.12.2020 22:21, Dmitry Osipenko пишет: > >>> + if (IS_ERR(opp)) { > >>> + dev_err(&genpd->dev, "failed to find OPP for level %u: %pe\n", > >>> + level, opp); > >>> + return PTR_ERR(opp); > >>> + } > >>> + > >>> + err = dev_pm_opp_set_voltage(&genpd->dev, opp); > >> IIUC, you implemented this callback because you want to use the voltage triplet > >> present in the OPP table ? > >> > >> And so you are setting the regulator ("power") later in this patch ? > > yes > > > >> I am not in favor of implementing this routine, as it just adds a wrapper above > >> the regulator API. What you should be doing rather is get the regulator by > >> yourself here (instead of depending on the OPP core). And then you can do > >> dev_pm_opp_get_voltage() here and set the voltage yourself. You may want to > >> implement a version supporting triplet here though for the same. > >> > >> And you won't require the sync version of the API as well then. > >> > > That's what I initially did for this driver. I don't mind to revert back > > to the initial variant in v3, it appeared to me that it will be nicer > > and cleaner to have OPP API managing everything here. > > I forgot one important detail (why the initial variant wasn't good).. > OPP entries that have unsupportable voltages should be filtered out and > OPP core performs the filtering only if regulator is assigned to the OPP > table. > > If regulator is assigned to the OPP table, then we need to use OPP API > for driving the regulator, hence that's why I added > dev_pm_opp_sync_regulators() and dev_pm_opp_set_voltage(). > > Perhaps it should be possible to add dev_pm_opp_get_regulator() that What's wrong with getting the regulator in the driver as well ? Apart from the OPP core ? > will return the OPP table regulator in order to allow driver to use the > regulator directly. But I'm not sure whether this is a much better > option than the opp_sync_regulators() and opp_set_voltage() APIs. set_voltage() is still fine as there is some data that the OPP core has, but sync_regulator() has nothing to do with OPP core. And this may lead to more wrapper helpers in the OPP core, which I am afraid of. And so even if it is not the best, I would like the OPP core to provide the data and not get into this. Ofcourse there is an exception to this, opp_set_rate. -- viresh