[s3c24xx] glamo: Use dev_pm_ops instead of platform suspend/resume.
authorlars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 21 Jul 2009 21:14:16 +0000 (21:14 +0000)
committerlars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 21 Jul 2009 21:14:16 +0000 (21:14 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16952 3c298f89-4303-0410-b956-a3cf2f4a3e73

target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-core.c
target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c
target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-mci.c
target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-spi-gpio.c

index 60cfae8..0c6fc58 100644 (file)
@@ -43,9 +43,7 @@
 
 #include <asm/div64.h>
 
-#ifdef CONFIG_PM
 #include <linux/pm.h>
-#endif
 
 #include "glamo-regs.h"
 #include "glamo-core.h"
@@ -1281,37 +1279,42 @@ static int glamo_remove(struct platform_device *pdev)
 
 #ifdef CONFIG_PM
 
-static int glamo_suspend(struct platform_device *pdev, pm_message_t state)
+static int glamo_suspend(struct device *dev)
 {
-       struct glamo_core *glamo = dev_get_drvdata(&pdev->dev);
+       struct glamo_core *glamo = dev_get_drvdata(dev);
        glamo->suspending = 1;
        glamo_power(glamo, GLAMO_POWER_SUSPEND);
 
        return 0;
 }
 
-static int glamo_resume(struct platform_device *pdev)
+static int glamo_resume(struct device *dev)
 {
-       struct glamo_core *glamo = dev_get_drvdata(&pdev->dev);
+       struct glamo_core *glamo = dev_get_drvdata(dev);
        glamo_power(glamo, GLAMO_POWER_ON);
        glamo->suspending = 0;
 
        return 0;
 }
 
+static struct dev_pm_ops glamo_pm_ops = {
+       .suspend = glamo_suspend,
+       .resume  = glamo_resume,
+};
+
+#define GLAMO_PM_OPS (&glamo_pm_ops)
+
 #else
-#define glamo_suspend NULL
-#define glamo_resume  NULL
+#define GLAMO_PM_OPS NULL
 #endif
 
 static struct platform_driver glamo_driver = {
        .probe          = glamo_probe,
        .remove         = glamo_remove,
-       .suspend        = glamo_suspend,
-       .resume = glamo_resume,
        .driver         = {
                .name   = "glamo3362",
                .owner  = THIS_MODULE,
+               .pm     = GLAMO_PM_OPS,
        },
 };
 
index 5949172..3d13dd2 100644 (file)
@@ -953,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);
@@ -968,10 +968,10 @@ 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 glamo_fb_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,
@@ -979,8 +979,6 @@ static int glamofb_resume(struct platform_device *pdev)
        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);
@@ -990,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
        },
 };
 
index 37373f5..812e037 100644 (file)
@@ -139,9 +139,8 @@ static void glamo_reg_set_bit_mask(struct glamo_mci_host *glamo,
 
 static void glamo_mci_clock_disable(struct glamo_mci_host *host) {
        if (host->clk_enabled) {
-/*             glamo_engine_div_disable(host->pdata->core, GLAMO_ENGINE_MMC);*/
+               glamo_engine_div_disable(host->pdata->core, GLAMO_ENGINE_MMC);
                host->clk_enabled = 0;
-        printk("clk disabled\n");
        }
 }
 
@@ -151,7 +150,6 @@ static void glamo_mci_clock_enable(struct glamo_mci_host *host) {
        if (!host->clk_enabled) {
                glamo_engine_div_enable(host->pdata->core, GLAMO_ENGINE_MMC);
                host->clk_enabled = 1;
-        printk("clk enabled\n");
        }
 }
 
@@ -829,28 +827,28 @@ static int glamo_mci_remove(struct platform_device *pdev)
 
 #ifdef CONFIG_PM
 
-static int glamo_mci_suspend(struct platform_device *dev, pm_message_t state)
+static int glamo_mci_suspend(struct device *dev)
 {
-       struct mmc_host *mmc = platform_get_drvdata(dev);
+       struct mmc_host *mmc = dev_get_drvdata(dev);
        struct glamo_mci_host *host = mmc_priv(mmc);
        int ret;
 
        cancel_work_sync(&host->irq_work);
 
-       ret = mmc_suspend_host(mmc, state);
+       ret = mmc_suspend_host(mmc, PMSG_SUSPEND);
        glamo_mci_clock_enable(host);
 
        return ret;
 }
 
-static int glamo_mci_resume(struct platform_device *dev)
+static int glamo_mci_resume(struct device *dev)
 {
-       struct mmc_host *mmc = platform_get_drvdata(dev);
+       struct mmc_host *mmc = dev_get_drvdata(dev);
        struct glamo_mci_host *host = mmc_priv(mmc);
        int ret;
 
-    glamo_engine_enable(host->pdata->core, GLAMO_ENGINE_MMC);
-    glamo_engine_reset(host->pdata->core, GLAMO_ENGINE_MMC);
+       glamo_engine_enable(host->pdata->core, GLAMO_ENGINE_MMC);
+       glamo_engine_reset(host->pdata->core, GLAMO_ENGINE_MMC);
 
        glamo_reg_write(host, GLAMO_REG_MMC_WDATADS1,
                        (u16)(host->data_mem->start));
@@ -861,28 +859,34 @@ static int glamo_mci_resume(struct platform_device *dev)
                        (u16)(host->data_mem->start));
        glamo_reg_write(host, GLAMO_REG_MMC_RDATADS2,
                        (u16)(host->data_mem->start >> 16));
-    mdelay(5);
+       mdelay(5);
 
        ret = mmc_resume_host(host->mmc);
 /*     glamo_mci_clock_disable(host);*/
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(glamo_mci_resume);
+
+static struct dev_pm_ops glamo_mci_pm_ops = {
+       .suspend = glamo_mci_suspend,
+       .resume  = glamo_mci_resume,
+};
+#define GLAMO_MCI_PM_OPS (&glamo_mci_pm_ops)
 
 #else /* CONFIG_PM */
-#define glamo_mci_suspend NULL
-#define glamo_mci_resume NULL
+#define GLAMO_MCI_PM_OPS NULL
 #endif /* CONFIG_PM */
 
 
 static struct platform_driver glamo_mci_driver =
 {
-       .driver.name    = "glamo-mci",
-       .probe          = glamo_mci_probe,
-       .remove         = glamo_mci_remove,
-       .suspend        = glamo_mci_suspend,
-       .resume         = glamo_mci_resume,
+       .probe  = glamo_mci_probe,
+       .remove = glamo_mci_remove,
+       .driver = {
+               .name  = "glamo-mci",
+               .owner = THIS_MODULE,
+               .pm    = GLAMO_MCI_PM_OPS,
+       },
 };
 
 static int __init glamo_mci_init(void)
index de632c5..6316b85 100644 (file)
@@ -211,20 +211,16 @@ static int glamo_spigpio_remove(struct platform_device *pdev)
        return 0;
 }
 
-/*#define glamo_spigpio_suspend NULL
-#define glamo_spigpio_resume NULL
-*/
-
 
 #ifdef CONFIG_PM
-static int glamo_spigpio_suspend(struct platform_device *pdev, pm_message_t state)
+/*static int glamo_spigpio_suspend(struct device *dev)
 {
        return 0;
-}
+}*/
 
-static int glamo_spigpio_resume(struct platform_device *pdev)
+static int glamo_spigpio_resume(struct device *dev)
 {
-       struct glamo_spigpio *sp = platform_get_drvdata(pdev);
+       struct glamo_spigpio *sp = dev_get_drvdata(dev);
 
        if (!sp)
                return 0;
@@ -242,18 +238,25 @@ static int glamo_spigpio_resume(struct platform_device *pdev)
 
        return 0;
 }
+
+static struct dev_pm_ops glamo_spigpio_pm_ops = {
+/*     .suspend = glamo_spiogpio_suspend,*/
+       .resume_noirq = glamo_spigpio_resume,
+};
+
+#define GLAMO_SPIGPIO_PM_OPS (&glamo_spigpio_pm_ops)
+
+#else
+#define GLAMO_SPIGPIO_PM_OPS NULL
 #endif
 
 static struct platform_driver glamo_spi_drv = {
        .probe          = glamo_spigpio_probe,
        .remove         = glamo_spigpio_remove,
-#ifdef CONFIG_PM
-       .suspend_late   = glamo_spigpio_suspend,
-       .resume_early   = glamo_spigpio_resume,
-#endif
        .driver         = {
                .name   = "glamo-spi-gpio",
                .owner  = THIS_MODULE,
+               .pm     = GLAMO_SPIGPIO_PM_OPS,
        },
 };
 
This page took 0.037539 seconds and 4 git commands to generate.