From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4047C433DB for ; Tue, 22 Dec 2020 06:41:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 773D222B2D for ; Tue, 22 Dec 2020 06:41:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725985AbgLVGlO (ORCPT ); Tue, 22 Dec 2020 01:41:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgLVGlN (ORCPT ); Tue, 22 Dec 2020 01:41:13 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88A02C061793 for ; Mon, 21 Dec 2020 22:40:33 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id x1so2182303pgh.12 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=F2xfl1r1yVZXkPi0ppB24NnvUv8EEGOHun6GZNUmNva2yFumsZslYtjCxUD+lBhDNd RROybr2/CWeU8sCO/a1OcacpDFvQrpW2e/vQn8SiivpJGJ5wa5XFHhOfPmOlRq4PKekm 6sYxSfVkw5Ul/NaswNaKy5GhmpSxTI+I6qU91Ug8YvZeSxwp2ILRkGDiQ1Szu+1Ij1ym FL5rQXu+JROdm/P+mNz62MXNYnYthfrOxto0ZuwdjaNPXUneEs4kbItsfO9mke1CV5y6 lX6abLRyN7vOS0Bm0iZaT+jlQjVoKshmBUWAaBFkh58hGn2laLlxJbgnEaULGVylzntE 4WhQ== X-Gm-Message-State: AOAM5337T2+cajc4ZmrNdyJlfQMcucCBtJVQRrkJjPrOjhciAtt+na+l 0C7riSavdjiOaD6DfGp9Mdphsg== X-Google-Smtp-Source: ABdhPJy/vJr+NNSCt7f3w3qkCyZMIzMDucjtinh/w3AD+sfsU1ChxDwkeoH4189p2G8BBp09nYpz6Q== 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-tegra@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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0F6CC433DB for ; Tue, 22 Dec 2020 06:40:38 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A40022B2D for ; Tue, 22 Dec 2020 06:40:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A40022B2D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D0E088726D; Tue, 22 Dec 2020 06:40:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yq1UXD24BujI; Tue, 22 Dec 2020 06:40:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id CB19487257; Tue, 22 Dec 2020 06:40:35 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 8D1FE1BF343 for ; Tue, 22 Dec 2020 06:40:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8852487256 for ; Tue, 22 Dec 2020 06:40:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EIfI70i84ICt for ; Tue, 22 Dec 2020 06:40:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by hemlock.osuosl.org (Postfix) with ESMTPS id 4754E87252 for ; Tue, 22 Dec 2020 06:40:33 +0000 (UTC) Received: by mail-pg1-f172.google.com with SMTP id g18so7777367pgk.1 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=nWvnQpb3J9YhymH4PfcosKB5IuSZIE7WDVy8Lb6+w3Cf8KbQhW6tm85fXkn60vW6VG tLb3ByfXF5R0ijuXTucIDljO3yKuYj3O7TfqXHj3LK9vD5KILbQoOidHBnDTnYrVVro2 NPv38xZaaCGB+EKyT3aWWSbt/By63cbZyalnmI4K+0i7Nz7jXvBaq/onH36cbHoRo0GY uNSBLW4RxnSFebKb/sr8EaedMUvHnPlD5H0yggUuLqItKfgIcR977Go8ZcPZS3LZDBd1 wjXkGlSgZ18bRxTthA//y93NfpsBAkSwD6XLC78b5q9XAdpfVs0wrztiSKS0eoFs7zQq p7Qg== X-Gm-Message-State: AOAM531ZWQKMtzndPUCTKeYaJfm4F8jnMBplMcZWAJyF9RNq8rDSvxy/ cN22s5tuYTw2h0S6iUqo0A8ZOA== X-Google-Smtp-Source: ABdhPJy/vJr+NNSCt7f3w3qkCyZMIzMDucjtinh/w3AD+sfsU1ChxDwkeoH4189p2G8BBp09nYpz6Q== 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 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-Disposition: inline In-Reply-To: <20201217180638.22748-29-digetx@gmail.com> User-Agent: NeoMutt/20180716-391-311a52 X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Michael Turquette , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Thierry Reding , linux-clk@vger.kernel.org, devel@driverdev.osuosl.org, Kevin Hilman , Nicolas Chauvet , Viresh Kumar , Krzysztof Kozlowski , Jonathan Hunter , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , linux-tegra@vger.kernel.org, Mauro Carvalho Chehab , Stephen Boyd , Peter De Schrijver , "Rafael J. Wysocki" , Liam Girdwood , Mark Brown , Peter Geis Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" 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 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A03E4C433E0 for ; Tue, 22 Dec 2020 09:22:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 656A922B2B for ; Tue, 22 Dec 2020 09:22:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 656A922B2B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DDC66E862; Tue, 22 Dec 2020 09:21:52 +0000 (UTC) Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4D99B6E141 for ; Tue, 22 Dec 2020 06:40:33 +0000 (UTC) Received: by mail-pg1-x529.google.com with SMTP id n7so7775867pgg.2 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=b+RontaW5LZNMT7zx4fCyhu3mXV7H+fgyrToIxYEO6pISI0fonjsB7X1lZCY0H5xAr xReHy5whSKfAcetWqHxYnqciGpWn5iwkpPa1qibNEcMffTNjvxdWVHxCREb9ADAsulSV GG2EPCZCA3eLgdQp7WIuffawtXiYsFHyglUw1ybyjBhYKnLg940pemjMEuhaK4aTYE2L NIEFyaiWphxrbTGFtUbS81pP9/NXqqIkme+Hbwp52hyIVN52n+dlzySYvjBosxAAG5pN X2pH9A3r1aovsoDimTHsDJKErFAuN4E4664gTGfyrGk6hBvfaK6lVMgsfAP945YRUoMD BHMQ== X-Gm-Message-State: AOAM533ivNx69jltiZAmE6rJdXxB4pcdX6D60eHAlEF0dKM+sKT9ybII p4FKh8WzwPP9o9L8BaOWDAWcRQ== X-Google-Smtp-Source: ABdhPJy/vJr+NNSCt7f3w3qkCyZMIzMDucjtinh/w3AD+sfsU1ChxDwkeoH4189p2G8BBp09nYpz6Q== 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 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-Disposition: inline In-Reply-To: <20201217180638.22748-29-digetx@gmail.com> User-Agent: NeoMutt/20180716-391-311a52 X-Mailman-Approved-At: Tue, 22 Dec 2020 09:21:48 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Michael Turquette , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Thierry Reding , linux-clk@vger.kernel.org, devel@driverdev.osuosl.org, Kevin Hilman , Nicolas Chauvet , Viresh Kumar , Krzysztof Kozlowski , Jonathan Hunter , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , linux-tegra@vger.kernel.org, Mauro Carvalho Chehab , Stephen Boyd , Peter De Schrijver , "Rafael J. Wysocki" , Liam Girdwood , Mark Brown , Peter Geis Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel