linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mikko Perttunen <cyndis@kapsi.fi>
To: Thierry Reding <thierry.reding@gmail.com>,
	Sumit Gupta <sumitg@nvidia.com>
Cc: linux-pm@vger.kernel.org, viresh.kumar@linaro.org,
	rjw@rjwysocki.net, linux-kernel@vger.kernel.org,
	jonathanh@nvidia.com, talho@nvidia.com, bbasu@nvidia.com,
	catalin.marinas@arm.com, linux-tegra@vger.kernel.org,
	mperttunen@nvidia.com, will@kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [TEGRA194_CPUFREQ Patch 1/3] firmware: tegra: adding function to get BPMP data
Date: Wed, 4 Dec 2019 10:45:24 +0200	[thread overview]
Message-ID: <9404232d-84ce-a117-89dd-f2d8de80993e@kapsi.fi> (raw)
In-Reply-To: <20191203174229.GA1721849@ulmo>

The difference here is that whereas on Tegra186 the frequency is managed 
through a specific memory-mapped device, on Tegra194 the frequency is 
managed through a CPU MSR leaving no "specific" node for this property 
apart from the cpu nodes itself.

Now, my original patchset (which this series is based on) did add 
nvidia,bpmp properties on the CPU DT nodes itself and query BPMP based 
on that. A change is still required for that since tegra_bpmp_get() 
currently takes a 'struct device *' which we don't have for a CPU DT node.

Mikko

On 3.12.2019 19.42, Thierry Reding wrote:
> On Tue, Dec 03, 2019 at 11:02:26PM +0530, Sumit Gupta wrote:
>> Adding new function of_tegra_bpmp_get() to get BPMP data.
>> This function can be used by other drivers like cpufreq to
>> get BPMP data without adding any property in respective
>> drivers DT node.
> 
> What's wrong with adding the property in the DT node? We already do that
> for Tegra186's CPU frequency driver, so it makes sense to continue that
> for Tegra194.
> 
> Thierry
> 
>> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
>> ---
>>   drivers/firmware/tegra/bpmp.c | 38 ++++++++++++++++++++++++++++++++++++++
>>   include/soc/tegra/bpmp.h      |  5 +++++
>>   2 files changed, 43 insertions(+)
>>
>> diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
>> index 6741fcd..9c3d7f1 100644
>> --- a/drivers/firmware/tegra/bpmp.c
>> +++ b/drivers/firmware/tegra/bpmp.c
>> @@ -38,6 +38,44 @@ channel_to_ops(struct tegra_bpmp_channel *channel)
>>   	return bpmp->soc->ops;
>>   }
>>   
>> +struct tegra_bpmp *of_tegra_bpmp_get(void)
>> +{
>> +	struct platform_device *pdev;
>> +	struct device_node *bpmp_dev;
>> +	struct tegra_bpmp *bpmp;
>> +
>> +	/* Check for bpmp device status in DT */
>> +	bpmp_dev = of_find_compatible_node(NULL, NULL, "nvidia,tegra186-bpmp");
>> +	if (!bpmp_dev) {
>> +		bpmp = ERR_PTR(-ENODEV);
>> +		goto err_out;
>> +	}
>> +	if (!of_device_is_available(bpmp_dev)) {
>> +		bpmp = ERR_PTR(-ENODEV);
>> +		goto err_put;
>> +	}
>> +
>> +	pdev = of_find_device_by_node(bpmp_dev);
>> +	if (!pdev) {
>> +		bpmp = ERR_PTR(-ENODEV);
>> +		goto err_put;
>> +	}
>> +
>> +	bpmp = platform_get_drvdata(pdev);
>> +	if (!bpmp) {
>> +		bpmp = ERR_PTR(-EPROBE_DEFER);
>> +		put_device(&pdev->dev);
>> +		goto err_put;
>> +	}
>> +
>> +	return bpmp;
>> +err_put:
>> +	of_node_put(bpmp_dev);
>> +err_out:
>> +	return bpmp;
>> +}
>> +EXPORT_SYMBOL_GPL(of_tegra_bpmp_get);
>> +
>>   struct tegra_bpmp *tegra_bpmp_get(struct device *dev)
>>   {
>>   	struct platform_device *pdev;
>> diff --git a/include/soc/tegra/bpmp.h b/include/soc/tegra/bpmp.h
>> index f2604e9..21402d9 100644
>> --- a/include/soc/tegra/bpmp.h
>> +++ b/include/soc/tegra/bpmp.h
>> @@ -107,6 +107,7 @@ struct tegra_bpmp_message {
>>   };
>>   
>>   #if IS_ENABLED(CONFIG_TEGRA_BPMP)
>> +struct tegra_bpmp *of_tegra_bpmp_get(void);
>>   struct tegra_bpmp *tegra_bpmp_get(struct device *dev);
>>   void tegra_bpmp_put(struct tegra_bpmp *bpmp);
>>   int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp,
>> @@ -122,6 +123,10 @@ void tegra_bpmp_free_mrq(struct tegra_bpmp *bpmp, unsigned int mrq,
>>   			 void *data);
>>   bool tegra_bpmp_mrq_is_supported(struct tegra_bpmp *bpmp, unsigned int mrq);
>>   #else
>> +static inline struct tegra_bpmp *of_tegra_bpmp_get(void)
>> +{
>> +	return ERR_PTR(-ENOTSUPP);
>> +}
>>   static inline struct tegra_bpmp *tegra_bpmp_get(struct device *dev)
>>   {
>>   	return ERR_PTR(-ENOTSUPP);
>> -- 
>> 2.7.4
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-12-04  8:45 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 17:32 [TEGRA194_CPUFREQ Patch 1/3] firmware: tegra: adding function to get BPMP data Sumit Gupta
2019-12-03 17:32 ` [TEGRA194_CPUFREQ Patch 2/3] cpufreq: Add Tegra194 cpufreq driver Sumit Gupta
2019-12-04  5:40   ` Viresh Kumar
2019-12-04 10:55     ` sumitg
2019-12-04 11:27       ` Viresh Kumar
2019-12-04 13:57         ` Dmitry Osipenko
2019-12-05  2:51           ` Viresh Kumar
2019-12-05 12:55             ` Dmitry Osipenko
2020-03-25 23:59         ` sumitg
2019-12-04 13:59   ` Dmitry Osipenko
2019-12-05 14:15   ` Dmitry Osipenko
2020-03-26 11:50   ` Viresh Kumar
2020-04-04 18:38     ` sumitg
2020-04-06  2:55       ` Viresh Kumar
2020-04-07 18:18         ` sumitg
2020-04-08  5:53           ` Viresh Kumar
2020-04-08 11:24             ` sumitg
2020-04-09  7:44               ` Viresh Kumar
2020-04-09 11:21                 ` Sumit Gupta
2020-04-13  6:21                   ` Viresh Kumar
2020-04-13 12:20                     ` Sumit Gupta
2020-04-14  5:45                       ` Viresh Kumar
2020-04-15 11:25                         ` Sumit Gupta
2020-04-16  3:37                           ` Viresh Kumar
2020-04-16  7:06                             ` Sumit Gupta
2019-12-03 17:32 ` [TEGRA194_CPUFREQ Patch 3/3] arm64: defconfig: Enable CONFIG_ARM_TEGRA194_CPUFREQ Sumit Gupta
2019-12-03 17:42 ` [TEGRA194_CPUFREQ Patch 1/3] firmware: tegra: adding function to get BPMP data Thierry Reding
2019-12-04  8:45   ` Mikko Perttunen [this message]
2019-12-04  9:17     ` Viresh Kumar
2019-12-04  9:33       ` Thierry Reding
2019-12-04  9:51         ` Viresh Kumar
2020-04-07 10:05           ` Thierry Reding
2020-04-27  7:18             ` Thierry Reding
2020-04-29  8:21               ` Sumit Gupta
2020-05-06 16:58               ` Thierry Reding
2020-05-20 14:43             ` Rob Herring
2020-05-20 15:38               ` Thierry Reding
2020-05-20 16:21                 ` Rob Herring
2019-12-04 10:21       ` Mikko Perttunen
2019-12-04 10:26         ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9404232d-84ce-a117-89dd-f2d8de80993e@kapsi.fi \
    --to=cyndis@kapsi.fi \
    --cc=bbasu@nvidia.com \
    --cc=catalin.marinas@arm.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=rjw@rjwysocki.net \
    --cc=sumitg@nvidia.com \
    --cc=talho@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=viresh.kumar@linaro.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).