linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: tegra: export clock names for debugging
@ 2014-06-26 15:48 Peter De Schrijver
  2014-06-26 15:52 ` Stephen Warren
       [not found] ` <1403797705-26910-1-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Peter De Schrijver @ 2014-06-26 15:48 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Prashant Gaikwad,
	Mike Turquette, Stephen Warren, Thierry Reding,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

When writing a module for testing or debugging purposes, there is no way to
get hold of clk handles. This patch solves this by exposing all valid clocks
as clkdev's for the virtual device tegra-clk-debug.

Signed-off-by: Peter De Schrijver <pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/clk/tegra/clk.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
index c0a7d77..3315fca 100644
--- a/drivers/clk/tegra/clk.c
+++ b/drivers/clk/tegra/clk.c
@@ -277,6 +277,12 @@ void __init tegra_register_devclks(struct tegra_devclk *dev_clks, int num)
 	for (i = 0; i < num; i++, dev_clks++)
 		clk_register_clkdev(clks[dev_clks->dt_id], dev_clks->con_id,
 				dev_clks->dev_id);
+
+	for (i = 0; i < clk_num; i++) {
+		if (!IS_ERR(clks[i]) || !clks[i])
+			clk_register_clkdev(clks[i], __clk_get_name(clks[i]),
+				"tegra-clk-debug");
+	}
 }
 
 struct clk ** __init tegra_lookup_dt_id(int clk_id,
-- 
1.7.7.rc0.72.g4b5ea.dirty

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: tegra: export clock names for debugging
  2014-06-26 15:48 [PATCH] clk: tegra: export clock names for debugging Peter De Schrijver
@ 2014-06-26 15:52 ` Stephen Warren
       [not found]   ` <53AC41B0.40307-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
       [not found] ` <1403797705-26910-1-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2014-06-26 15:52 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: linux-arm-kernel, linux-tegra, Prashant Gaikwad, Mike Turquette,
	Thierry Reding, linux-kernel

On 06/26/2014 09:48 AM, Peter De Schrijver wrote:
> When writing a module for testing or debugging purposes, there is no way to
> get hold of clk handles. This patch solves this by exposing all valid clocks
> as clkdev's for the virtual device tegra-clk-debug.

This is to support clk_get_sys()?

I guess this seems fine, so feel free to apply it, but I slightly wonder
why not just include this change as part of the presumably local and
never-to-be-upstreamed test/dev module?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: tegra: export clock names for debugging
       [not found] ` <1403797705-26910-1-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2014-06-26 18:32   ` Sergei Shtylyov
  0 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2014-06-26 18:32 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: Prashant Gaikwad, Mike Turquette, Stephen Warren,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Thierry Reding,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hello.

On 06/26/2014 07:48 PM, Peter De Schrijver wrote:

> When writing a module for testing or debugging purposes, there is no way to
> get hold of clk handles. This patch solves this by exposing all valid clocks
> as clkdev's for the virtual device tegra-clk-debug.

> Signed-off-by: Peter De Schrijver <pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
>   drivers/clk/tegra/clk.c |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)

> diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
> index c0a7d77..3315fca 100644
> --- a/drivers/clk/tegra/clk.c
> +++ b/drivers/clk/tegra/clk.c
> @@ -277,6 +277,12 @@ void __init tegra_register_devclks(struct tegra_devclk *dev_clks, int num)
>   	for (i = 0; i < num; i++, dev_clks++)
>   		clk_register_clkdev(clks[dev_clks->dt_id], dev_clks->con_id,
>   				dev_clks->dev_id);
> +
> +	for (i = 0; i < clk_num; i++) {
> +		if (!IS_ERR(clks[i]) || !clks[i])

    Are you sure it should be || here, not &&? The following code doesn't seem 
to make much sense this way... Perhaps you meant !IS_ERR_OR_NULL(clks[i])?

> +			clk_register_clkdev(clks[i], __clk_get_name(clks[i]),
> +				"tegra-clk-debug");
> +	}
>   }

WBR, Sergei

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: tegra: export clock names for debugging
       [not found]   ` <53AC41B0.40307-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
@ 2014-06-27 12:19     ` Peter De Schrijver
       [not found]       ` <20140627121954.GR3679-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Peter De Schrijver @ 2014-06-27 12:19 UTC (permalink / raw)
  To: Stephen Warren
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Prashant Gaikwad, Mike Turquette, Thierry Reding,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Thu, Jun 26, 2014 at 05:52:16PM +0200, Stephen Warren wrote:
> On 06/26/2014 09:48 AM, Peter De Schrijver wrote:
> > When writing a module for testing or debugging purposes, there is no way to
> > get hold of clk handles. This patch solves this by exposing all valid clocks
> > as clkdev's for the virtual device tegra-clk-debug.
> 
> This is to support clk_get_sys()?
> 

Yes.

> I guess this seems fine, so feel free to apply it, but I slightly wonder
> why not just include this change as part of the presumably local and
> never-to-be-upstreamed test/dev module?

The idea is to allow local debug modules to get hold of the struct clk *. I
don't think that's possible without using clk_get_sys()?

Cheers,

Peter.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] clk: tegra: export clock names for debugging
       [not found]       ` <20140627121954.GR3679-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
@ 2014-06-27 15:59         ` Stephen Warren
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Warren @ 2014-06-27 15:59 UTC (permalink / raw)
  To: Peter De Schrijver
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Prashant Gaikwad, Mike Turquette, Thierry Reding,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On 06/27/2014 06:19 AM, Peter De Schrijver wrote:
> On Thu, Jun 26, 2014 at 05:52:16PM +0200, Stephen Warren wrote:
>> On 06/26/2014 09:48 AM, Peter De Schrijver wrote:
>>> When writing a module for testing or debugging purposes, there is no way to
>>> get hold of clk handles. This patch solves this by exposing all valid clocks
>>> as clkdev's for the virtual device tegra-clk-debug.
>>
>> This is to support clk_get_sys()?
>>
> 
> Yes.
> 
>> I guess this seems fine, so feel free to apply it, but I slightly wonder
>> why not just include this change as part of the presumably local and
>> never-to-be-upstreamed test/dev module?
> 
> The idea is to allow local debug modules to get hold of the struct clk *. I
> don't think that's possible without using clk_get_sys()?

Well, for a debug hack you can always just add extra clock entries into
some DT node and so avoid clk_get_sys:-)

My point wasn't so much about not using clk_get_sys in a debug driver,
but more that if this patch is only required to support non-upstreamed
debug code, perhaps this patch should stay downstream along with that
non-upstreamed debug code. That said, I'm not really objecting to it,
just making a minor comment.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-27 15:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-26 15:48 [PATCH] clk: tegra: export clock names for debugging Peter De Schrijver
2014-06-26 15:52 ` Stephen Warren
     [not found]   ` <53AC41B0.40307-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-06-27 12:19     ` Peter De Schrijver
     [not found]       ` <20140627121954.GR3679-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2014-06-27 15:59         ` Stephen Warren
     [not found] ` <1403797705-26910-1-git-send-email-pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-06-26 18:32   ` Sergei Shtylyov

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).