X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/f35d974a507da20526ff3af8a9bcf5362f64e428..49662300d85d67ae95f60752f3391fa17aae5ea8:/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c diff --git a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c index 90a6541e6..3d13dd26c 100644 --- a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c +++ b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c @@ -22,23 +22,15 @@ #include #include -#include #include #include -#include #include #include #include -#include -#include -#include -#include -#include #include -#include #include #include -#include +#include #include @@ -69,7 +61,7 @@ struct glamofb_handle { struct resource *reg; struct resource *fb_res; char __iomem *base; - struct glamofb_platform_data *mach_info; + struct glamo_fb_platform_data *mach_info; char __iomem *cursor_addr; int cursor_on; u_int32_t pseudo_pal[16]; @@ -80,7 +72,7 @@ struct glamofb_handle { }; static void glamo_output_enable(struct glamofb_handle *gfb) { - struct glamo_core *gcore = gfb->mach_info->glamo; + struct glamo_core *gcore = gfb->mach_info->core; if (gfb->output_enabled) return; @@ -97,7 +89,7 @@ static void glamo_output_enable(struct glamofb_handle *gfb) { } static void glamo_output_disable(struct glamofb_handle *gfb) { - struct glamo_core *gcore = gfb->mach_info->glamo; + struct glamo_core *gcore = gfb->mach_info->core; if (!gfb->output_enabled) return; @@ -166,8 +158,8 @@ static int glamofb_run_script(struct glamofb_handle *glamo, { int i; - if (glamo->mach_info->glamo->suspending) { - dev_err(&glamo->mach_info->glamo->pdev->dev, + if (glamo->mach_info->core->suspending) { + dev_err(&glamo->mach_info->core->pdev->dev, "IGNORING glamofb_run_script while " "suspended\n"); return -EBUSY; @@ -192,8 +184,8 @@ static int glamofb_check_var(struct fb_var_screeninfo *var, { struct glamofb_handle *glamo = info->par; - if (glamo->mach_info->glamo->suspending) { - dev_err(&glamo->mach_info->glamo->pdev->dev, + if (glamo->mach_info->core->suspending) { + dev_err(&glamo->mach_info->core->pdev->dev, "IGNORING glamofb_check_var while " "suspended\n"); return -EBUSY; @@ -280,8 +272,8 @@ static void __rotate_lcd(struct glamofb_handle *glamo, __u32 rotation) { int glamo_rot; - if (glamo->mach_info->glamo->suspending) { - dev_err(&glamo->mach_info->glamo->pdev->dev, + if (glamo->mach_info->core->suspending) { + dev_err(&glamo->mach_info->core->pdev->dev, "IGNORING rotate_lcd while " "suspended\n"); return; @@ -316,7 +308,7 @@ static void __rotate_lcd(struct glamofb_handle *glamo, __u32 rotation) static void glamofb_program_mode(struct glamofb_handle* gfb) { int sync, bp, disp, fp, total; unsigned long flags; - struct glamo_core *gcore = gfb->mach_info->glamo; + struct glamo_core *gcore = gfb->mach_info->core; struct fb_var_screeninfo *var = &gfb->fb->var; dev_dbg(&gcore->pdev->dev, @@ -329,7 +321,7 @@ static void glamofb_program_mode(struct glamofb_handle* gfb) { if (var->pixclock) glamo_engine_reclock(gcore, GLAMO_ENGINE_LCD, - gfb->fb->var.pixclock); + (1000000000UL / gfb->fb->var.pixclock) * 1000); reg_set_bit_mask(gfb, GLAMO_REG_LCD_WIDTH, @@ -402,7 +394,7 @@ static int glamofb_pan_display(struct fb_var_screeninfo *var, static struct fb_videomode *glamofb_find_mode(struct fb_info *info, struct fb_var_screeninfo *var) { struct glamofb_handle *glamo = info->par; - struct glamofb_platform_data *mach_info = glamo->mach_info; + struct glamo_fb_platform_data *mach_info = glamo->mach_info; struct fb_videomode *mode; int i; @@ -421,8 +413,8 @@ static int glamofb_set_par(struct fb_info *info) struct fb_var_screeninfo *var = &info->var; struct fb_videomode *mode; - if (glamo->mach_info->glamo->suspending) { - dev_err(&glamo->mach_info->glamo->pdev->dev, + if (glamo->mach_info->core->suspending) { + dev_err(&glamo->mach_info->core->pdev->dev, "IGNORING glamofb_set_par while " "suspended\n"); return -EBUSY; @@ -501,8 +493,8 @@ static int glamofb_setcolreg(unsigned regno, struct glamofb_handle *glamo = info->par; unsigned int val; - if (glamo->mach_info->glamo->suspending) { - dev_err(&glamo->mach_info->glamo->pdev->dev, + if (glamo->mach_info->core->suspending) { + dev_err(&glamo->mach_info->core->pdev->dev, "IGNORING glamofb_set_par while " "suspended\n"); return -EBUSY; @@ -533,7 +525,7 @@ static int glamofb_setcolreg(unsigned regno, static int glamofb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) { struct glamofb_handle *gfb = (struct glamofb_handle*)info->par; - struct glamo_core *gcore = gfb->mach_info->glamo; + struct glamo_core *gcore = gfb->mach_info->core; int retval = -ENOTTY; switch (cmd) { @@ -695,8 +687,8 @@ int glamofb_cmd_mode(struct glamofb_handle *gfb, int on) { int timeout = 2000000; - if (gfb->mach_info->glamo->suspending) { - dev_err(&gfb->mach_info->glamo->pdev->dev, + if (gfb->mach_info->core->suspending) { + dev_err(&gfb->mach_info->core->pdev->dev, "IGNORING glamofb_cmd_mode while " "suspended\n"); return -EBUSY; @@ -759,8 +751,8 @@ int glamofb_cmd_write(struct glamofb_handle *gfb, u_int16_t val) { int timeout = 200000; - if (gfb->mach_info->glamo->suspending) { - dev_err(&gfb->mach_info->glamo->pdev->dev, + if (gfb->mach_info->core->suspending) { + dev_err(&gfb->mach_info->core->pdev->dev, "IGNORING glamofb_cmd_write while " "suspended\n"); return -EBUSY; @@ -815,7 +807,7 @@ static int __init glamofb_probe(struct platform_device *pdev) int rc = -EIO; struct fb_info *fbinfo; struct glamofb_handle *glamofb; - struct glamofb_platform_data *mach_info = pdev->dev.platform_data; + struct glamo_fb_platform_data *mach_info = pdev->dev.platform_data; printk(KERN_INFO "SMEDIA Glamo frame buffer driver (C) 2007 " "Openmoko, Inc.\n"); @@ -909,8 +901,8 @@ static int __init glamofb_probe(struct platform_device *pdev) fbinfo->var.accel_flags = 0; fbinfo->var.vmode = FB_VMODE_NONINTERLACED; - glamo_engine_enable(mach_info->glamo, GLAMO_ENGINE_LCD); - glamo_engine_reset(mach_info->glamo, GLAMO_ENGINE_LCD); + glamo_engine_enable(mach_info->core, GLAMO_ENGINE_LCD); + glamo_engine_reset(mach_info->core, GLAMO_ENGINE_LCD); glamofb->output_enabled = 1; glamofb->mode_set = 1; @@ -961,9 +953,9 @@ static int glamofb_remove(struct platform_device *pdev) #ifdef CONFIG_PM -static int glamofb_suspend(struct platform_device *pdev, pm_message_t state) +static int glamofb_suspend(struct device *dev) { - struct glamofb_handle *gfb = platform_get_drvdata(pdev); + struct glamofb_handle *gfb = dev_get_drvdata(dev); /* we need to stop anything touching our framebuffer */ fb_set_suspend(gfb->fb, 1); @@ -976,19 +968,17 @@ static int glamofb_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int glamofb_resume(struct platform_device *pdev) +static int glamofb_resume(struct device *dev) { - struct glamofb_handle *gfb = platform_get_drvdata(pdev); - struct glamofb_platform_data *mach_info = pdev->dev.platform_data; + struct glamofb_handle *gfb = dev_get_drvdata(dev); + struct glamo_fb_platform_data *mach_info = dev->platform_data; /* OK let's allow framebuffer ops again */ /* gfb->fb->screen_base = ioremap(gfb->fb_res->start, resource_size(gfb->fb_res)); */ - glamo_engine_enable(mach_info->glamo, GLAMO_ENGINE_LCD); - glamo_engine_reset(mach_info->glamo, GLAMO_ENGINE_LCD); + glamo_engine_enable(mach_info->core, GLAMO_ENGINE_LCD); + glamo_engine_reset(mach_info->core, GLAMO_ENGINE_LCD); - printk(KERN_ERR"spin_lock_init\n"); - spin_lock_init(&gfb->lock_cmd); glamofb_init_regs(gfb); #ifdef CONFIG_MFD_GLAMO_HWACCEL glamofb_cursor_onoff(gfb, 1); @@ -998,19 +988,25 @@ static int glamofb_resume(struct platform_device *pdev) return 0; } + +static struct dev_pm_ops glamofb_pm_ops = { + .suspend = glamofb_suspend, + .resume = glamofb_resume, +}; + +#define GLAMOFB_PM_OPS (&glamofb_pm_ops) + #else -#define glamofb_suspend NULL -#define glamofb_resume NULL +#define GLAMOFB_PM_OPS NULL #endif static struct platform_driver glamofb_driver = { .probe = glamofb_probe, .remove = glamofb_remove, - .suspend = glamofb_suspend, - .resume = glamofb_resume, .driver = { .name = "glamo-fb", .owner = THIS_MODULE, + .pm = GLAMOFB_PM_OPS }, };