public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* RE: Suspend/Resume support with Omap2fb
@ 2009-03-12 18:26 Hiremath, Vaibhav
  2009-03-13  8:30 ` Tomi Valkeinen
  0 siblings, 1 reply; 13+ messages in thread
From: Hiremath, Vaibhav @ 2009-03-12 18:26 UTC (permalink / raw)
  To: Hiremath, Vaibhav, tomi.valkeinen@nokia.com; +Cc: linux-omap@vger.kernel.org


Hi,

Finally I could able to find the root-cause, actually some of the previous observations miss-led me to dig into power management, suspend/resume path and clock structure. But after bit debugging and with the help of Sanjeev, we got the rid of it.

The issue is with DSS2 library, inside function "dpi_display_suspend". It calls dispc_enable_lcd_out(0), but doesn't wait till the frame-done interrupt. And due to this I was getting some abrupt behavior in suspend/resume path. 
Actually in the beginning I overlooked legacy frame-buffer driver, which handles this scenario perfectly.
 
For Display sub-system we have 2 interface clocks coming, L3_ICLK and L4_ICLK. Out of these, L4_ICLK goes to Display register access and L3_ICLK goes to DMA register. In our suspend call we are disabling clocks for L3_ICLK (we don't control L4_ICLK), and due to this L4_ICLK stays attached with GFX. You will only be able to find out this by looking to CM_CLKSTST_DSS.CLKACTIVITY_DSS, which is set 1 and indicates some interface clock is still active in DSS domain.

Below is the patch which will explain the change 


+#include <linux/completion.h>
+#include <linux/jiffies.h>

+static void dpi_display_isr(void *arg, unsigned int irqstatus)
+{
+       struct omap_display *display = (struct omap_display *)arg;
+
+       complete(&display->frame_done);
+}

static int dpi_display_suspend(struct omap_display *display)
 {
+       void *handle = NULL;
+
        if (display->state != OMAP_DSS_DISPLAY_ACTIVE)
                return -EINVAL;

        if (display->panel->suspend)
                display->panel->suspend(display);

+       /*
+        * Wait for frame done interrupt
+        */
+       handle = omap_dispc_register_isr(dpi_display_isr, display,
+                       DISPC_IRQ_FRAMEDONE);
+       if (!handle)
+               return -EINVAL;
+
+       init_completion(&display->frame_done);
+
        dispc_enable_lcd_out(0);
+       if (!wait_for_completion_timeout(&display->frame_done,
+                               msecs_to_jiffies(500))) {
+               printk("timeout waiting for FRAME DONE\n");
+       }

Still I need to test this thoroughly, I may hit some another issue (Already I am seeing some crashes also when off state is enabled). I will create consolidated patch for this and will submit to list.

Thanks,
Vaibhav Hiremath

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Suspend/Resume support with Omap2fb
@ 2009-03-11  6:55 Hiremath, Vaibhav
  2009-03-11  7:53 ` Tomi Valkeinen
  0 siblings, 1 reply; 13+ messages in thread
From: Hiremath, Vaibhav @ 2009-03-11  6:55 UTC (permalink / raw)
  To: linux-omap@vger.kernel.org

Hi,

I am using New Frame-Buffer driver which is based on DSS2 library submitted by Tomi, and I am trying to add full power management support. But things are not working out as expected, every time when I am issuing command "echo mem > /sys/power/state" the system doesn't go into off state. It always points to dss_prwdm, below are the steps I am following - 

	- Build the kernel with CPU_IDLE
	- Enable all the PM flags 

		# echo 1 > /sys/power/sleep_while_idle
		# echo 1 > /sys/power/clocks_off_while_idle
		# echo 1 > /sys/power/enable_off_mode

 	- From Linux prompt issue command 

		# echo mem > /sys/power/state

The log is - 
------------

root@arago:~# echo mem > /sys/power/state
<6>PM: Syncing filesystems ... PM: Syncing filesystems ... done.
done.
Freezing user space processes ... Freezing user space processes ... (elapsed 0.00 seconds) (elapsed 0.00 seconds) done.
done.
Freezing remaining freezable tasks ... Freezing remaining freezable tasks ... (elapsed 0.06 seconds) (elapsed 0.06 seconds) done.done.
Suspending console(s) (use no_console_suspend to debug)
Suspending console(s) (use no_console_suspend to debug)
<6>omap-backlight: suspending...
omapfb_suspend

omapfb_resume
<6>omap-backlight: resuming...
omap-backlight: suspending...
omapfb_suspend
Powerdomain (core_pwrdm) didn't enter target state 0
Powerdomain (dss_pwrdm) didn't enter target state 0
Powerdomain (per_pwrdm) didn't enter target state 0
Could not enter target state in pm_suspend
eth0: link down
omapfb_resume
omap-backlight: resuming...
Restarting tasks ... Restarting tasks ... done.
done.

root@arago:~#


Some analysis which I observed during debugging this issue - 

	- The root-cause is, DSS PowerDomain always shows it is in ON state (PWRDM_POWER_ON), and if I understand correctly this is only dependent on clocks. But I am making sure that DSS clocks are disabled. And with CPU_IDLE enabled I am going to complete OFF state. (/sys/devices/system/cpu/cpu0/cpuidle/state5/usage is incrementing).

	- If I compile out framebuffer driver and include DSS2 and V4L2 driver, everything works fine. I am not sure how "omapfb" is being tied with PowerDomain. Again I have seen references in arch/arm/mach-omap2/omapdev3xxx.h to the pdev_name = "omapfb", not sure how this is being used. 
 
I believe if system is hitting OFF state, then my enable/disable paths are proper, but really not sure about why "mem" is causing problem here.

Thanks,
Vaibhav Hiremath
Platform Support Products
Texas Instruments Inc
Ph: +91-80-25099927


Thanks,
Vaibhav Hiremath
Platform Support Products
Texas Instruments Inc
Ph: +91-80-25099927


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

end of thread, other threads:[~2009-03-13  9:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-12 18:26 Suspend/Resume support with Omap2fb Hiremath, Vaibhav
2009-03-13  8:30 ` Tomi Valkeinen
2009-03-13  9:10   ` Hiremath, Vaibhav
2009-03-13  9:13     ` Tomi Valkeinen
2009-03-13  9:17       ` Hiremath, Vaibhav
2009-03-13  9:26         ` Tomi Valkeinen
  -- strict thread matches above, loose matches on Subject: below --
2009-03-11  6:55 Hiremath, Vaibhav
2009-03-11  7:53 ` Tomi Valkeinen
2009-03-11  8:46   ` Hiremath, Vaibhav
2009-03-11  9:31     ` Tomi Valkeinen
2009-03-11 10:47       ` Hiremath, Vaibhav
2009-03-11 12:49         ` Tomi Valkeinen
2009-03-11 18:08           ` Hiremath, Vaibhav

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