#include <linux/slab.h>
#include <linux/earlysuspend.h>
#include <linux/delay.h>
+#include <linux/workqueue.h>
#include "gc_hal_kernel_linux.h"
#include "gc_hal_driver.h"
}
#endif
+#if gcdENABLE_DELAY_EARLY_SUSPEND
+struct delayed_work suspend_work;
+void real_suspend(struct work_struct *work)
+{
+ gceSTATUS status;
+
+ status = gckHARDWARE_SetPowerManagementState(galDevice->kernel->hardware, gcvPOWER_OFF);
+
+ if (gcmIS_ERROR(status))
+ {
+ printk("%s fail!\n", __func__);
+ return;
+ }
+}
+#endif
+
int drv_open(struct inode *inode, struct file* filp)
{
gcsHAL_PRIVATE_DATA_PTR private;
#if CONFIG_HAS_EARLYSUSPEND
static void gpu_early_suspend(struct early_suspend *h)
{
+#if gcdENABLE_DELAY_EARLY_SUSPEND
+ schedule_delayed_work(&suspend_work, 5*HZ);
+#else
gceSTATUS status;
status = gckHARDWARE_SetPowerManagementState(galDevice->kernel->hardware, gcvPOWER_OFF);
printk("%s fail!\n", __func__);
return;
}
+#endif
}
static void gpu_early_resume(struct early_suspend *h)
{
gceSTATUS status;
-
+
+#if gcdENABLE_DELAY_EARLY_SUSPEND
+ cancel_delayed_work_sync(&suspend_work);
+#endif
status = gckHARDWARE_SetPowerManagementState(galDevice->kernel->hardware, gcvPOWER_ON);
if (gcmIS_ERROR(status))
register_early_suspend(&gpu_early_suspend_info);
#endif
+#if gcdENABLE_DELAY_EARLY_SUSPEND
+ INIT_DELAYED_WORK(&suspend_work, real_suspend);
+#endif
+
ret = drv_init();
if(!ret) {
platform_set_drvdata(pdev,galDevice);
static int __devinit gpu_remove(struct platform_device *pdev)
{
+#if gcdENABLE_DELAY_EARLY_SUSPEND
+ cancel_delayed_work_sync(&suspend_work);
+#endif
drv_exit();
-
return 0;
}
{
gceSTATUS status;
gckGALDEVICE device;
-
+
+#if gcdENABLE_DELAY_EARLY_SUSPEND
+ cancel_delayed_work_sync(&suspend_work);
+#endif
device = platform_get_drvdata(dev);
status = gckHARDWARE_SetPowerManagementState(device->kernel->hardware, gcvPOWER_OFF);
static void __devinit gpu_shutdown(struct platform_device *dev)
{
+#if gcdENABLE_DELAY_EARLY_SUSPEND
+ cancel_delayed_work_sync(&suspend_work);
+#endif
drv_exit();
}