diff mbox

ARM: tegra: fuse: add fuctions to read speedo id and process id

Message ID 1363660405-10668-1-git-send-email-dahuang@nvidia.com
State Rejected, archived
Headers show

Commit Message

Danny Huang March 19, 2013, 2:33 a.m. UTC
Add functions to read the speedo and process id of both cpu and soc.
There might be some drivers need the information as well.

Signed-off-by: Danny Huang <dahuang@nvidia.com>
---
 arch/arm/mach-tegra/fuse.c | 24 ++++++++++++++++++++++++
 include/linux/tegra-soc.h  |  6 +++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

Comments

Stephen Warren March 19, 2013, 6:05 p.m. UTC | #1
On 03/18/2013 08:33 PM, Danny Huang wrote:
> Add functions to read the speedo and process id of both cpu and soc.
> There might be some drivers need the information as well.

What code wants to use these functions? It'd be best to submit this
patch with that code, so that something actually uses the functions, and
they don't look like dead code.

In the past, functions similar to this used to exist. However, they were
removed and replaced by direct access to the underlying variables. Do we
actually need functions for this, or can code simply read from the
variables instead?
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Danny Huang March 20, 2013, 1:39 a.m. UTC | #2
On Wed, 2013-03-20 at 02:05 +0800, Stephen Warren wrote:
> On 03/18/2013 08:33 PM, Danny Huang wrote:
> > Add functions to read the speedo and process id of both cpu and soc.
> > There might be some drivers need the information as well.
> 
> What code wants to use these functions? It'd be best to submit this
> patch with that code, so that something actually uses the functions, and
> they don't look like dead code.

There are some developing drivers that are located in drivers folder
needs those information. I think that they can't include a header file
in mach-tegra folder. Hence I'd like to provide them such functions for
their development.
Is there any better way to do this?

> 
> In the past, functions similar to this used to exist. However, they were
> removed and replaced by direct access to the underlying variables. Do we
> actually need functions for this, or can code simply read from the
> variables instead?

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Warren March 20, 2013, 1:50 a.m. UTC | #3
On 03/19/2013 07:39 PM, Danny Huang wrote:
> On Wed, 2013-03-20 at 02:05 +0800, Stephen Warren wrote:
>> On 03/18/2013 08:33 PM, Danny Huang wrote:
>>> Add functions to read the speedo and process id of both cpu and soc.
>>> There might be some drivers need the information as well.
>>
>> What code wants to use these functions? It'd be best to submit this
>> patch with that code, so that something actually uses the functions, and
>> they don't look like dead code.
> 
> There are some developing drivers that are located in drivers folder
> needs those information.

Which drivers?

> I think that they can't include a header file in mach-tegra folder

True.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Danny Huang March 20, 2013, 2:20 a.m. UTC | #4
On Wed, 2013-03-20 at 09:50 +0800, Stephen Warren wrote:
> On 03/19/2013 07:39 PM, Danny Huang wrote:
> > On Wed, 2013-03-20 at 02:05 +0800, Stephen Warren wrote:
> >> On 03/18/2013 08:33 PM, Danny Huang wrote:
> >>> Add functions to read the speedo and process id of both cpu and soc.
> >>> There might be some drivers need the information as well.
> >>
> >> What code wants to use these functions? It'd be best to submit this
> >> patch with that code, so that something actually uses the functions, and
> >> they don't look like dead code.
> > 
> > There are some developing drivers that are located in drivers folder
> > needs those information.
> 
> Which drivers?

Per my understanding, there is a dvfs development that is trying to use
the devfreq framework.

> 
> > I think that they can't include a header file in mach-tegra folder
> 
> True.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index f7db078..f0e356e 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -2,6 +2,7 @@ 
  * arch/arm/mach-tegra/fuse.c
  *
  * Copyright (C) 2010 Google, Inc.
+ * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
  *
  * Author:
  *	Colin Cross <ccross@android.com>
@@ -161,3 +162,26 @@  unsigned long long tegra_chip_uid(void)
 	return (hi << 32ull) | lo;
 }
 EXPORT_SYMBOL(tegra_chip_uid);
+
+int tegra_get_cpu_process_id(void)
+{
+	return tegra_cpu_process_id;
+}
+
+int tegra_get_core_process_id(void)
+{
+	return tegra_core_process_id;
+}
+
+int tegra_get_cpu_speedo_id(void)
+{
+	if (tegra_chip_id == TEGRA20)
+		return -EINVAL;
+
+	return tegra_cpu_speedo_id;
+}
+
+int tegra_get_soc_speedo_id(void)
+{
+	return tegra_soc_speedo_id;
+}
diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h
index 95f611d..b3e4b74 100644
--- a/include/linux/tegra-soc.h
+++ b/include/linux/tegra-soc.h
@@ -1,5 +1,5 @@ 
 /*
- * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2012,2013, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -18,5 +18,9 @@ 
 #define __LINUX_TEGRA_SOC_H_
 
 u32 tegra_read_chipid(void);
+int tegra_get_cpu_process_id(void);
+int tegra_get_core_process_id(void);
+int tegra_get_cpu_speedo_id(void);
+int tegra_get_soc_speedo_id(void);
 
 #endif /* __LINUX_TEGRA_SOC_H_ */