public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] OMAP: McBSP not working if CONFIG_PM_RUNTIME not set
@ 2011-06-07 19:18 Janusz Krzysztofik
  2011-06-07 21:17 ` Kevin Hilman
  0 siblings, 1 reply; 4+ messages in thread
From: Janusz Krzysztofik @ 2011-06-07 19:18 UTC (permalink / raw)
  To: linux-omap@vger.kernel.org; +Cc: linux-pm

Hi,

While solving this problem:
http://www.spinics.net/lists/linux-omap/msg52011.html,
I found that since commit e95496d4acadd0b72c4947be61e8d44700fdaae7, 
"OMAP: McBSP: Add pm runtime support", McBSP ports, or at least McBSP1 
on my Amstrad Delta, no longer work when CONFIG_PM_RUNTIME is not set. 
Even if I don't use such setup and always select CONFIG_PM_RUNTIME, I 
think current behaviour is wrong and should be corrected.

Before I come out with a patch, please advise if and how you think this 
should be solved. Should CONFIG_OMAP_MCBSP depend on CONFIG_PM_RUNTIME?
Or should it select CONFIG_PM_RUNTIME? Or maybe an old code which 
manipulated clocks directly should be restored for no CONFIG_PM_RUNTIME 
case? Or should arch/arm/mach-omap1/pm_bus.c be always built in and 
pm_runtime_clk_add_notifier() called from there in order to enable 
clocks on device initialization even if CONFIG_PM_RUNTIME is not set? Or 
still a better solution?

Thanks,
Janusz

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

* Re: [RFC] OMAP: McBSP not working if CONFIG_PM_RUNTIME not set
  2011-06-07 19:18 [RFC] OMAP: McBSP not working if CONFIG_PM_RUNTIME not set Janusz Krzysztofik
@ 2011-06-07 21:17 ` Kevin Hilman
  2011-06-07 22:16   ` Janusz Krzysztofik
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman @ 2011-06-07 21:17 UTC (permalink / raw)
  To: Janusz Krzysztofik; +Cc: linux-omap@vger.kernel.org, linux-pm

Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> writes:

> Hi,
>
> While solving this problem:
> http://www.spinics.net/lists/linux-omap/msg52011.html,
> I found that since commit e95496d4acadd0b72c4947be61e8d44700fdaae7, 
> "OMAP: McBSP: Add pm runtime support", McBSP ports, or at least McBSP1 
> on my Amstrad Delta, no longer work when CONFIG_PM_RUNTIME is not set. 
> Even if I don't use such setup and always select CONFIG_PM_RUNTIME, I 
> think current behaviour is wrong and should be corrected.
>
> Before I come out with a patch, please advise if and how you think this 
> should be solved. Should CONFIG_OMAP_MCBSP depend on CONFIG_PM_RUNTIME?
> Or should it select CONFIG_PM_RUNTIME? Or maybe an old code which 
> manipulated clocks directly should be restored for no CONFIG_PM_RUNTIME 
> case? Or should arch/arm/mach-omap1/pm_bus.c be always built in and 
> pm_runtime_clk_add_notifier() called from there in order to enable 
> clocks on device initialization even if CONFIG_PM_RUNTIME is not set? Or 
> still a better solution?

You're on the right track already.

Yes, the notifier init should be done even on the !PM_RUNTIME case so
that clocks are enabled when the device is added and disabled when the
device is removed.

Can you try the patch below (only compile tested)

If it works, and with your Tested-by, I'll queue this as a fix for
v3.0-rc.

Thanks,

Kevin


>From 971a6b1ba5cbca7b38fb14ae834b124c6e7bf9b5 Mon Sep 17 00:00:00 2001
From: Kevin Hilman <khilman@ti.com>
Date: Tue, 7 Jun 2011 14:13:33 -0700
Subject: [PATCH] OMAP1: PM: register notifiers with generic clock ops even when !PM_RUNTIME

When runtime PM is disabled, device clocks need to be enabled on
device add and disabled on device remove.  This currently is not
happening because in the !PM_RUNTIME case, no notifiers are registered
for OMAP1 devices.

Fix this by ensuring notifiers are registered, even in the !PM_RUNTIME case.

Reported-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap1/pm_bus.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
index fe31d93..334fb88 100644
--- a/arch/arm/mach-omap1/pm_bus.c
+++ b/arch/arm/mach-omap1/pm_bus.c
@@ -56,9 +56,13 @@ static struct dev_power_domain default_power_domain = {
 		USE_PLATFORM_PM_SLEEP_OPS
 	},
 };
+#define OMAP1_PWR_DOMAIN (&default_power_domain)
+#else
+#define OMAP1_PWR_DOMAIN NULL
+#endif /* CONFIG_PM_RUNTIME */
 
 static struct pm_clk_notifier_block platform_bus_notifier = {
-	.pwr_domain = &default_power_domain,
+	.pwr_domain = OMAP1_PWR_DOMAIN,
 	.con_ids = { "ick", "fck", NULL, },
 };
 
@@ -72,4 +76,4 @@ static int __init omap1_pm_runtime_init(void)
 	return 0;
 }
 core_initcall(omap1_pm_runtime_init);
-#endif /* CONFIG_PM_RUNTIME */
+
-- 
1.7.4


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

* Re: [RFC] OMAP: McBSP not working if CONFIG_PM_RUNTIME not set
  2011-06-07 21:17 ` Kevin Hilman
@ 2011-06-07 22:16   ` Janusz Krzysztofik
  2011-06-07 23:48     ` Kevin Hilman
  0 siblings, 1 reply; 4+ messages in thread
From: Janusz Krzysztofik @ 2011-06-07 22:16 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap@vger.kernel.org, linux-pm

On Tue 07 Jun 2011 at 23:17:49 Kevin Hilman wrote:
> Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> writes:
> > ... Or should
> > arch/arm/mach-omap1/pm_bus.c be always built in and
> > pm_runtime_clk_add_notifier() called from there in order to enable
> > clocks on device initialization even if CONFIG_PM_RUNTIME is not
> > set? Or still a better solution?
> 
> You're on the right track already.
> 
> Yes, the notifier init should be done even on the !PM_RUNTIME case so
> that clocks are enabled when the device is added and disabled when
> the device is removed.
> 
> Can you try the patch below (only compile tested)

It's OK, but kind of no-op unless something like below is also applied. 
With it appended to your patch, you can add my Tested-by or what-else-by 
you may find appropriate.

Thanks,
Janusz

---
--- git/arch/arm/mach-omap1/Makefile.orig	2011-06-06 18:06:57.000000000 +0200
+++ git/arch/arm/mach-omap1/Makefile	2011-06-07 23:40:11.000000000 +0200
@@ -4,14 +4,14 @@
 
 # Common support
 obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o
-obj-y += clock.o clock_data.o opp_data.o reset.o
+obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
 obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
 
 # Power Management
-obj-$(CONFIG_PM) += pm.o sleep.o pm_bus.o
+obj-$(CONFIG_PM) += pm.o sleep.o
 
 # DSP
 obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
--

> If it works, and with your Tested-by, I'll queue this as a fix for
> v3.0-rc.
> 
> Thanks,
> 
> Kevin
> 
> >From 971a6b1ba5cbca7b38fb14ae834b124c6e7bf9b5 Mon Sep 17 00:00:00
> >2001
> 
> From: Kevin Hilman <khilman@ti.com>
> Date: Tue, 7 Jun 2011 14:13:33 -0700
> Subject: [PATCH] OMAP1: PM: register notifiers with generic clock ops
> even when !PM_RUNTIME
> 
> When runtime PM is disabled, device clocks need to be enabled on
> device add and disabled on device remove.  This currently is not
> happening because in the !PM_RUNTIME case, no notifiers are
> registered for OMAP1 devices.
> 
> Fix this by ensuring notifiers are registered, even in the
> !PM_RUNTIME case.
> 
> Reported-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
> ---
>  arch/arm/mach-omap1/pm_bus.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap1/pm_bus.c
> b/arch/arm/mach-omap1/pm_bus.c index fe31d93..334fb88 100644
> --- a/arch/arm/mach-omap1/pm_bus.c
> +++ b/arch/arm/mach-omap1/pm_bus.c
> @@ -56,9 +56,13 @@ static struct dev_power_domain
> default_power_domain = { USE_PLATFORM_PM_SLEEP_OPS
>  	},
>  };
> +#define OMAP1_PWR_DOMAIN (&default_power_domain)
> +#else
> +#define OMAP1_PWR_DOMAIN NULL
> +#endif /* CONFIG_PM_RUNTIME */
> 
>  static struct pm_clk_notifier_block platform_bus_notifier = {
> -	.pwr_domain = &default_power_domain,
> +	.pwr_domain = OMAP1_PWR_DOMAIN,
>  	.con_ids = { "ick", "fck", NULL, },
>  };
> 
> @@ -72,4 +76,4 @@ static int __init omap1_pm_runtime_init(void)
>  	return 0;
>  }
>  core_initcall(omap1_pm_runtime_init);
> -#endif /* CONFIG_PM_RUNTIME */
> +

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

* Re: [RFC] OMAP: McBSP not working if CONFIG_PM_RUNTIME not set
  2011-06-07 22:16   ` Janusz Krzysztofik
@ 2011-06-07 23:48     ` Kevin Hilman
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2011-06-07 23:48 UTC (permalink / raw)
  To: Janusz Krzysztofik; +Cc: linux-omap@vger.kernel.org, linux-pm

Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> writes:

> On Tue 07 Jun 2011 at 23:17:49 Kevin Hilman wrote:
>> Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> writes:
>> > ... Or should
>> > arch/arm/mach-omap1/pm_bus.c be always built in and
>> > pm_runtime_clk_add_notifier() called from there in order to enable
>> > clocks on device initialization even if CONFIG_PM_RUNTIME is not
>> > set? Or still a better solution?
>> 
>> You're on the right track already.
>> 
>> Yes, the notifier init should be done even on the !PM_RUNTIME case so
>> that clocks are enabled when the device is added and disabled when
>> the device is removed.
>> 
>> Can you try the patch below (only compile tested)
>
> It's OK, but kind of no-op unless something like below is also applied. 

Indeed.

> With it appended to your patch, you can add my Tested-by or what-else-by 
> you may find appropriate.

Thanks, will fold your diff into the patch, add your Tested-by and
submit as a PM fix for v3.0.

Thanks,

Kevin

> Thanks,
> Janusz
>
> ---
> --- git/arch/arm/mach-omap1/Makefile.orig	2011-06-06 18:06:57.000000000 +0200
> +++ git/arch/arm/mach-omap1/Makefile	2011-06-07 23:40:11.000000000 +0200
> @@ -4,14 +4,14 @@
>  
>  # Common support
>  obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o
> -obj-y += clock.o clock_data.o opp_data.o reset.o
> +obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o
>  
>  obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
>  
>  obj-$(CONFIG_OMAP_32K_TIMER)	+= timer32k.o
>  
>  # Power Management
> -obj-$(CONFIG_PM) += pm.o sleep.o pm_bus.o
> +obj-$(CONFIG_PM) += pm.o sleep.o
>  
>  # DSP
>  obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
> --
>
>> If it works, and with your Tested-by, I'll queue this as a fix for
>> v3.0-rc.
>> 
>> Thanks,
>> 
>> Kevin
>> 
>> >From 971a6b1ba5cbca7b38fb14ae834b124c6e7bf9b5 Mon Sep 17 00:00:00
>> >2001
>> 
>> From: Kevin Hilman <khilman@ti.com>
>> Date: Tue, 7 Jun 2011 14:13:33 -0700
>> Subject: [PATCH] OMAP1: PM: register notifiers with generic clock ops
>> even when !PM_RUNTIME
>> 
>> When runtime PM is disabled, device clocks need to be enabled on
>> device add and disabled on device remove.  This currently is not
>> happening because in the !PM_RUNTIME case, no notifiers are
>> registered for OMAP1 devices.
>> 
>> Fix this by ensuring notifiers are registered, even in the
>> !PM_RUNTIME case.
>> 
>> Reported-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
>> Signed-off-by: Kevin Hilman <khilman@ti.com>
>> ---
>>  arch/arm/mach-omap1/pm_bus.c |    8 ++++++--
>>  1 files changed, 6 insertions(+), 2 deletions(-)
>> 
>> diff --git a/arch/arm/mach-omap1/pm_bus.c
>> b/arch/arm/mach-omap1/pm_bus.c index fe31d93..334fb88 100644
>> --- a/arch/arm/mach-omap1/pm_bus.c
>> +++ b/arch/arm/mach-omap1/pm_bus.c
>> @@ -56,9 +56,13 @@ static struct dev_power_domain
>> default_power_domain = { USE_PLATFORM_PM_SLEEP_OPS
>>  	},
>>  };
>> +#define OMAP1_PWR_DOMAIN (&default_power_domain)
>> +#else
>> +#define OMAP1_PWR_DOMAIN NULL
>> +#endif /* CONFIG_PM_RUNTIME */
>> 
>>  static struct pm_clk_notifier_block platform_bus_notifier = {
>> -	.pwr_domain = &default_power_domain,
>> +	.pwr_domain = OMAP1_PWR_DOMAIN,
>>  	.con_ids = { "ick", "fck", NULL, },
>>  };
>> 
>> @@ -72,4 +76,4 @@ static int __init omap1_pm_runtime_init(void)
>>  	return 0;
>>  }
>>  core_initcall(omap1_pm_runtime_init);
>> -#endif /* CONFIG_PM_RUNTIME */
>> +

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

end of thread, other threads:[~2011-06-07 23:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-07 19:18 [RFC] OMAP: McBSP not working if CONFIG_PM_RUNTIME not set Janusz Krzysztofik
2011-06-07 21:17 ` Kevin Hilman
2011-06-07 22:16   ` Janusz Krzysztofik
2011-06-07 23:48     ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox