Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4741590pxu; Mon, 21 Dec 2020 22:42:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiUapa2oQfEsjMWT0cZkprnm+CosOen76Q1GPX0kgSDHOEx5cTziEA7zkwGh+kqhQBw01f X-Received: by 2002:a50:f299:: with SMTP id f25mr18836193edm.133.1608619338618; Mon, 21 Dec 2020 22:42:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608619338; cv=none; d=google.com; s=arc-20160816; b=r1kniTnI3zMrUcLbMdm7Ve9EpSKm97LGeOA1CwlHspNDddbfCpFKRhzqg1qz61+1BC WzgujT/r3/osk8t/HTmO8QSYoM5tNBKCHqMyJi8KY7puDABDO8uaKjcljsBbxL+5DCpJ 6YBr9JqRUpCHEKu0I6wC5xmSfj4MWAC9n2sECXhUpKkdzjr76LPuqaCMnONzNFnn5e0N LF4zo70wyCK3PsYtXr6u1O+6EWZVi9eLKRbcezdjsZTyO8lqNxhCEPn7CPOGgT5cbfhU pxIHARuz1C7/7KhguTQ569/8AzA9Vwe0rzKi+pzLJXJI312BbWJ8bvT0w+MbWhTufXMf WTPg== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=58if8R3c+oDYrkVVIdvCMuB/HRUSZCNfm9pXzo2Jxis=; b=LKzPNVJe643yZaCMvBQkTyBy69Xmo2HZ4CW9Qiu6fp6Tm/4POAxUQCN/gfnRkf46Bg Zf4bAqeE+BQlHLJAiE+radGAHWS78/RFWrMHUYxDATJfJTaHb+anAC3ipWQ+kgEcSjwU AZ6slKlzZrzoidHFg+oT3l0q6feFX5ESWDIAKilYvN9R3p44FqZcJnrd8qbSBDAk3zGn 6Qwf0m1UATG5NBT6IxReFHBXDdx0gKJUMeqj1LAQu6lHzqT5ZX9b3S3DEgnFqAqWp9HH C5G77ZVwiBTEUKid3JADFLKGwH0yGHwy+J6pXKi0cln0+fynOSYSlLupll2U0byp9syG TuQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xrayxzNV; 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 md13si10377146ejb.324.2020.12.21.22.41.56; Mon, 21 Dec 2020 22:42:18 -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=xrayxzNV; 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 S1726017AbgLVGlO (ORCPT + 99 others); Tue, 22 Dec 2020 01:41:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbgLVGlN (ORCPT ); Tue, 22 Dec 2020 01:41:13 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FF8AC0617A6 for ; Mon, 21 Dec 2020 22:40:33 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id p18so7757865pgm.11 for ; Mon, 21 Dec 2020 22:40:33 -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:in-reply-to:user-agent; bh=58if8R3c+oDYrkVVIdvCMuB/HRUSZCNfm9pXzo2Jxis=; b=xrayxzNVWoBOOUTllKsBsgUMpNC6xjZxfZRPwCLEzoXU/sg5+VOejq6aNdvm2F+h2l oH0+TkshTv1ugzupTG92EKZ/M+hvjdg0PJI86pwt4TR1v8JqJdT8Pz61vnx9sJ5e5IhD 0EmBrUKXKuIbpIgXqOaGOBgmjNnR7tKFoe67MoGdHqq/3HpwUSPXpkKjhoVhd8YJ7Eol V682sF5RTwD5LSJkgu7VcNMjDxbWuqm/SMYLAkqsFi0U43LQmIqScaYNgn8+0Pf4UE6X FlNsocE3fBXkr36MtWwlASa3aY1opWbBf4DS7Gh+PnwPpww69IKJ7asp4rk18Z4vqVBQ ibyw== 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:in-reply-to:user-agent; bh=58if8R3c+oDYrkVVIdvCMuB/HRUSZCNfm9pXzo2Jxis=; b=NtKNduhi+67KDNSjT+B4ndO/9S85hAZEzLx4MVaYUXgErITtkrGGdC+UnuP18Xy+ZM lP3QZfITrT70xO1xu9OsBb7NRXneAxdmni6hIksfHXf1cUBugyfq0RjPMY10Fo8kH1Rz yDIVTAuZXI1aKQAshEQZUEGi1RFervRMJJIgYTk6EpSjjG0axJYgxWBf9yX+cW1PPtp+ 7rn5PzXftcl/RhUtyhn7qewLy5cFA4Di77O3Aq15gB4Ta/iboX+Hi7MkDRwmkWwWYQbT Ot+ZZeBDOHGe0el4tSk/4EzAOuwEhwE7Ae4t8pbBnCHBE3NJ7pW88inWIgeyGhddvMoJ XuTw== X-Gm-Message-State: AOAM532jwI8lRLmLDDQtJ521Z6TCh2650VIizJTXqa2eqAw7nkh+nBKJ bc8tIZSBeOjvxMlQukpHlSs+Yw== X-Received: by 2002:a63:1f10:: with SMTP id f16mr14879515pgf.111.1608619232743; Mon, 21 Dec 2020 22:40:32 -0800 (PST) Received: from localhost ([122.172.20.109]) by smtp.gmail.com with ESMTPSA id 197sm19176671pgg.43.2020.12.21.22.40.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2020 22:40:31 -0800 (PST) Date: Tue, 22 Dec 2020 12:10:29 +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: <20201222064029.duuzcsj53rt7xzvt@vireshk-i7> References: <20201217180638.22748-1-digetx@gmail.com> <20201217180638.22748-29-digetx@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201217180638.22748-29-digetx@gmail.com> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17-12-20, 21:06, Dmitry Osipenko wrote: > +++ b/drivers/soc/tegra/core-power-domain.c > @@ -0,0 +1,125 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * NVIDIA Tegra SoC Core Power Domain Driver > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +static struct lock_class_key tegra_core_domain_lock_class; > +static bool tegra_core_domain_state_synced; > + > +static int tegra_genpd_set_performance_state(struct generic_pm_domain *genpd, > + unsigned int level) > +{ > + struct dev_pm_opp *opp; > + int err; > + > + opp = dev_pm_opp_find_level_ceil(&genpd->dev, &level); We don't need ceil or floor versions for level, but rather _exact() version. Or maybe just call it dev_pm_opp_find_level(). > + 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 ? 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. -- viresh