From patchwork Fri Sep 2 14:40:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manuel Lauss X-Patchwork-Id: 1122412 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p82EfC4b005374 for ; Fri, 2 Sep 2011 14:41:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752553Ab1IBOlP (ORCPT ); Fri, 2 Sep 2011 10:41:15 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:33488 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752391Ab1IBOlO (ORCPT ); Fri, 2 Sep 2011 10:41:14 -0400 Received: by eyx24 with SMTP id 24so2339818eyx.19 for ; Fri, 02 Sep 2011 07:41:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=UNuY3iK5pgNxkJa5+xmE4/I8w1M7kaCeQtDn3GwqzFg=; b=pW6BeyT7MSFaH8ebMHWTfMvoXMCGGPVZSfTYS1WiouFfZYnQArcUVZk8mt1KE1avCq WWl0MKsk9XExhV/G+xw8xnwGj0HaQw/sLGN4fevCo0pqHJRSf+lg2UuaXSpIMGzYPnXC yl0sHz04Wc1Rtz5vZQ27RD8hxgCu+SmCvIhyE= Received: by 10.223.37.81 with SMTP id w17mr1834184fad.91.1314974472959; Fri, 02 Sep 2011 07:41:12 -0700 (PDT) Received: from localhost.localdomain (188-22-147-179.adsl.highway.telekom.at [188.22.147.179]) by mx.google.com with ESMTPS id e4sm931401fag.25.2011.09.02.07.41.11 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 02 Sep 2011 07:41:12 -0700 (PDT) From: Manuel Lauss To: linux-fbdev@vger.kernel.org, Florian Tobias Schandinat Cc: Manuel Lauss Subject: [PATCH 2/6] au1200fb: fixup PM Date: Fri, 2 Sep 2011 16:40:47 +0200 Message-Id: <1314974451-8535-3-git-send-email-manuel.lauss@googlemail.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1314974451-8535-1-git-send-email-manuel.lauss@googlemail.com> References: <1314974451-8535-1-git-send-email-manuel.lauss@googlemail.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 02 Sep 2011 14:41:15 +0000 (UTC) Remove last traces of the unused custom Alchemy PM code, implement suspend/resume callbacks. Signed-off-by: Manuel Lauss --- drivers/video/au1200fb.c | 154 ++++++++++++---------------------------------- 1 files changed, 39 insertions(+), 115 deletions(-) diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index 442d005..480ecb1 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c @@ -46,10 +46,6 @@ #include #include "au1200fb.h" -#ifdef CONFIG_PM -#include -#endif - #ifndef CONFIG_FB_AU1200_DEVS #define CONFIG_FB_AU1200_DEVS 4 #endif @@ -205,12 +201,6 @@ struct window_settings { extern int board_au1200fb_panel_init (void); extern int board_au1200fb_panel_shutdown (void); -#ifdef CONFIG_PM -int au1200fb_pm_callback(au1xxx_power_dev_t *dev, - au1xxx_request_t request, void *data); -au1xxx_power_dev_t *LCD_pm_dev; -#endif - /* * Default window configurations */ @@ -652,25 +642,6 @@ static struct panel_settings known_lcd_panels[] = /********************************************************************/ -#ifdef CONFIG_PM -static int set_brightness(unsigned int brightness) -{ - unsigned int hi1, divider; - - /* limit brightness pwm duty to >= 30/1600 */ - if (brightness < 30) { - brightness = 30; - } - divider = (lcd->pwmdiv & 0x3FFFF) + 1; - hi1 = (lcd->pwmhi >> 16) + 1; - hi1 = (((brightness & 0xFF) + 1) * divider >> 8); - lcd->pwmhi &= 0xFFFF; - lcd->pwmhi |= (hi1 << 16); - - return brightness; -} -#endif /* CONFIG_PM */ - static int winbpp (unsigned int winctrl1) { int bits = 0; @@ -1248,10 +1219,6 @@ static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) unsigned long start=0, off; struct au1200fb_device *fbdev = info->par; -#ifdef CONFIG_PM - au1xxx_pm_access(LCD_pm_dev); -#endif - if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { return -EINVAL; } @@ -1461,10 +1428,6 @@ static int au1200fb_ioctl(struct fb_info *info, unsigned int cmd, int plane; int val; -#ifdef CONFIG_PM - au1xxx_pm_access(LCD_pm_dev); -#endif - plane = fbinfo2index(info); print_dbg("au1200fb: ioctl %d on plane %d\n", cmd, plane); @@ -1622,7 +1585,7 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev) /* AU1200 LCD controller device driver */ -static int au1200fb_drv_probe(struct platform_device *dev) +static int __devinit au1200fb_drv_probe(struct platform_device *dev) { struct au1200fb_device *fbdev; struct fb_info *fbi = NULL; @@ -1633,6 +1596,9 @@ static int au1200fb_drv_probe(struct platform_device *dev) ret = 0; fbdev = NULL; + /* Kickstart the panel */ + au1200_setpanel(panel); + for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) { bpp = winbpp(win->w[plane].mode_winctrl1); if (win->w[plane].xres == 0) @@ -1724,15 +1690,12 @@ failed: return ret; } -static int au1200fb_drv_remove(struct platform_device *dev) +static int __devexit au1200fb_drv_remove(struct platform_device *dev) { struct au1200fb_device *fbdev; struct fb_info *fbi; int plane; - if (!dev) - return -ENODEV; - /* Turn off the panel */ au1200_setpanel(NULL); @@ -1760,31 +1723,53 @@ static int au1200fb_drv_remove(struct platform_device *dev) } #ifdef CONFIG_PM -static int au1200fb_drv_suspend(struct platform_device *dev, - pm_message_t state) +static int au1200fb_drv_suspend(struct device *dev) { - /* TODO */ + au1200_setpanel(NULL); + + lcd->outmask = 0; + au_sync(); + return 0; } -static int au1200fb_drv_resume(struct platform_device *dev) +static int au1200fb_drv_resume(struct device *dev) { - /* TODO */ + struct fb_info *fbi; + int i; + + /* Kickstart the panel */ + au1200_setpanel(panel); + + for (i = 0; i < CONFIG_FB_AU1200_DEVS; i++) { + fbi = _au1200fb_infos[i]; + au1200fb_fb_set_par(fbi); + } + return 0; } + +static const struct dev_pm_ops au1200fb_pmops = { + .suspend = au1200fb_drv_suspend, + .resume = au1200fb_drv_resume, + .freeze = au1200fb_drv_suspend, + .thaw = au1200fb_drv_resume, +}; + +#define AU1200FB_PMOPS (&au1200fb_pmops) + +#else +#define AU1200FB_PMOPS NULL #endif /* CONFIG_PM */ static struct platform_driver au1200fb_driver = { .driver = { - .name = "au1200-lcd", - .owner = THIS_MODULE, + .name = "au1200-lcd", + .owner = THIS_MODULE, + .pm = AU1200FB_PMOPS, }, .probe = au1200fb_drv_probe, - .remove = au1200fb_drv_remove, -#ifdef CONFIG_PM - .suspend = au1200fb_drv_suspend, - .resume = au1200fb_drv_resume, -#endif + .remove = __devexit_p(au1200fb_drv_remove), }; /*-------------------------------------------------------------------------*/ @@ -1847,56 +1832,6 @@ static void au1200fb_setup(void) } } -#ifdef CONFIG_PM -static int au1200fb_pm_callback(au1xxx_power_dev_t *dev, - au1xxx_request_t request, void *data) { - int retval = -1; - unsigned int d = 0; - unsigned int brightness = 0; - - if (request == AU1XXX_PM_SLEEP) { - board_au1200fb_panel_shutdown(); - } - else if (request == AU1XXX_PM_WAKEUP) { - if(dev->prev_state == SLEEP_STATE) - { - int plane; - au1200_setpanel(panel); - for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) { - struct au1200fb_device *fbdev; - fbdev = &_au1200fb_devices[plane]; - au1200fb_fb_set_par(&fbdev->fb_info); - } - } - - d = *((unsigned int*)data); - if(d <=10) brightness = 26; - else if(d<=20) brightness = 51; - else if(d<=30) brightness = 77; - else if(d<=40) brightness = 102; - else if(d<=50) brightness = 128; - else if(d<=60) brightness = 153; - else if(d<=70) brightness = 179; - else if(d<=80) brightness = 204; - else if(d<=90) brightness = 230; - else brightness = 255; - set_brightness(brightness); - } else if (request == AU1XXX_PM_GETSTATUS) { - return dev->cur_state; - } else if (request == AU1XXX_PM_ACCESS) { - if (dev->cur_state != SLEEP_STATE) - return retval; - else { - au1200_setpanel(panel); - } - } else if (request == AU1XXX_PM_IDLE) { - } else if (request == AU1XXX_PM_CLEANUP) { - } - - return retval; -} -#endif - static int __init au1200fb_init(void) { print_info("" DRIVER_DESC ""); @@ -1911,17 +1846,6 @@ static int __init au1200fb_init(void) printk(DRIVER_NAME ": Panel %d %s\n", panel_index, panel->name); printk(DRIVER_NAME ": Win %d %s\n", window_index, win->name); - /* Kickstart the panel, the framebuffers/windows come soon enough */ - au1200_setpanel(panel); - - #ifdef CONFIG_PM - LCD_pm_dev = new_au1xxx_power_device("LCD", &au1200fb_pm_callback, NULL); - if ( LCD_pm_dev == NULL) - printk(KERN_INFO "Unable to create a power management device entry for the au1200fb.\n"); - else - printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n"); - #endif - return platform_driver_register(&au1200fb_driver); }