#include <linux/device.h>
#include <linux/miscdevice.h>
#include <linux/slab.h>
+#include <linux/earlysuspend.h>
+#include <linux/delay.h>
#include "gc_hal_kernel_linux.h"
#include "gc_hal_driver.h"
#include <linux/platform_device.h>
#endif
#include <mach/rk29_iomap.h>
+#include <mach/cru.h>
MODULE_DESCRIPTION("Vivante Graphics Driver");
MODULE_LICENSE("GPL");
// enable ram clock gate
writel(readl(RK29_GRF_BASE+0xc0) & ~0x100000, RK29_GRF_BASE+0xc0);
+
+#if 1
+ printk("%s : gpu reset... ", __func__);
+ mdelay(2);
+ cru_set_soft_reset(SOFT_RST_GPU, true);
+ cru_set_soft_reset(SOFT_RST_DDR_GPU_PORT, true);
+ mdelay(1);
+ cru_set_soft_reset(SOFT_RST_DDR_GPU_PORT, false);
+ cru_set_soft_reset(SOFT_RST_GPU, false);
+ mdelay(2);
+ printk("done!\n");
+#endif
+
#endif
if (showArgs)
clk_hclk_gpu = clk_get(NULL, "hclk_gpu");
if(!IS_ERR(clk_hclk_gpu)) clk_disable(clk_hclk_gpu);
-
+
printk("done!\n");
#endif
}
#endif
+
+#if CONFIG_HAS_EARLYSUSPEND
+static void gpu_early_suspend(struct early_suspend *h)
+{
+ gceSTATUS status;
+
+ printk("Enter %s \n", __func__);
+
+ status = gckHARDWARE_SetPowerManagementState(galDevice->kernel->hardware, gcvPOWER_SUSPEND);
+
+ if (gcmIS_ERROR(status))
+ {
+ printk("%s fail!\n", __func__);
+ return;
+ }
+
+ printk("Exit %s \n", __func__);
+}
+
+static void gpu_early_resume(struct early_suspend *h)
+{
+ gceSTATUS status;
+
+ printk("Enter %s \n", __func__);
+
+ status = gckHARDWARE_SetPowerManagementState(galDevice->kernel->hardware, gcvPOWER_IDLE);
+
+ if (gcmIS_ERROR(status))
+ {
+ printk("%s fail!\n", __func__);
+ return;
+ }
+
+ printk("Exit %s \n", __func__);
+}
+
+struct early_suspend gpu_early_suspend_info = {
+ .suspend = gpu_early_suspend,
+ .resume = gpu_early_resume,
+ .level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1,
+};
+#endif
+
static int __devinit gpu_probe(struct platform_device *pdev)
{
int ret = -ENODEV;
add_timer(&gpu_timer);
#endif
+#if CONFIG_HAS_EARLYSUSPEND
+ register_early_suspend(&gpu_early_suspend_info);
+#endif
+
ret = drv_init();
if(!ret) {
platform_set_drvdata(pdev,galDevice);
printk("Exit %s \n", __func__);
}
+
static struct platform_driver gpu_driver = {
.probe = gpu_probe,
.remove = gpu_remove,
#include <linux/delay.h>
#include <mach/pmu.h>
-#include <mach/cru.h>
#if !USE_NEW_LINUX_SIGNAL
#define USER_SIGNAL_TABLE_LEN_INIT 64
//printk("---------- gckOS_SetGPUPower Clock=%d Power=%d \n", Clock, Power);
- mdelay(1);
if(Clock) {
printk("gpu: clk_enable... ");
clk_enable(clk_hclk_gpu);
clk_disable(clk_hclk_gpu);
printk("done!\n");
}
- mdelay(1);
if(Power) {
if(lastpower != Power) {
printk("gpu: power on... ");
pmu_set_power_domain(PD_GPU, true);
printk("done!\n");
-
- printk("gpu: reset... ");
- mdelay(1);
- cru_set_soft_reset(SOFT_RST_GPU, true);
- cru_set_soft_reset(SOFT_RST_DDR_GPU_PORT, true);
- mdelay(2);
- cru_set_soft_reset(SOFT_RST_DDR_GPU_PORT, false);
- cru_set_soft_reset(SOFT_RST_GPU, false);
- mdelay(1);
- cru_set_soft_reset(SOFT_RST_GPU, true);
- cru_set_soft_reset(SOFT_RST_DDR_GPU_PORT, true);
- mdelay(2);
- cru_set_soft_reset(SOFT_RST_DDR_GPU_PORT, false);
- cru_set_soft_reset(SOFT_RST_GPU, false);
- mdelay(1);
- printk("done!\n");
}
} else {
//printk("gpu: power off... ");