]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/w1/masters/w1-gpio.c
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[mv-sheeva.git] / drivers / w1 / masters / w1-gpio.c
index a411702413d687af44676cf37e3e4c7720c64f82..fcbe742188a50e93b15105e6ccfa77d7a53663a6 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
 #include <linux/w1-gpio.h>
 
 #include "../w1.h"
@@ -74,6 +75,9 @@ static int __init w1_gpio_probe(struct platform_device *pdev)
        if (err)
                goto free_gpio;
 
+       if (pdata->enable_external_pullup)
+               pdata->enable_external_pullup(1);
+
        platform_set_drvdata(pdev, master);
 
        return 0;
@@ -91,6 +95,9 @@ static int __exit w1_gpio_remove(struct platform_device *pdev)
        struct w1_bus_master *master = platform_get_drvdata(pdev);
        struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
 
+       if (pdata->enable_external_pullup)
+               pdata->enable_external_pullup(0);
+
        w1_remove_master_device(master);
        gpio_free(pdata->pin);
        kfree(master);
@@ -98,12 +105,41 @@ static int __exit w1_gpio_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM
+
+static int w1_gpio_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
+
+       if (pdata->enable_external_pullup)
+               pdata->enable_external_pullup(0);
+
+       return 0;
+}
+
+static int w1_gpio_resume(struct platform_device *pdev)
+{
+       struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
+
+       if (pdata->enable_external_pullup)
+               pdata->enable_external_pullup(1);
+
+       return 0;
+}
+
+#else
+#define w1_gpio_suspend        NULL
+#define w1_gpio_resume NULL
+#endif
+
 static struct platform_driver w1_gpio_driver = {
        .driver = {
                .name   = "w1-gpio",
                .owner  = THIS_MODULE,
        },
        .remove = __exit_p(w1_gpio_remove),
+       .suspend = w1_gpio_suspend,
+       .resume = w1_gpio_resume,
 };
 
 static int __init w1_gpio_init(void)