diff options
Diffstat (limited to 'drivers/w1/masters')
-rw-r--r-- | drivers/w1/masters/Kconfig | 6 | ||||
-rw-r--r-- | drivers/w1/masters/w1-gpio.c | 35 |
2 files changed, 38 insertions, 3 deletions
diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig index 96d2f8e4c27..3195fb8b7d9 100644 --- a/drivers/w1/masters/Kconfig +++ b/drivers/w1/masters/Kconfig @@ -12,7 +12,7 @@ config W1_MASTER_MATROX using Matrox's G400 GPIO pins. This support is also available as a module. If so, the module - will be called matrox_w1.ko. + will be called matrox_w1. config W1_MASTER_DS2490 tristate "DS2490 USB <-> W1 transport layer for 1-wire" @@ -22,7 +22,7 @@ config W1_MASTER_DS2490 for example DS9490*. This support is also available as a module. If so, the module - will be called ds2490.ko. + will be called ds2490. config W1_MASTER_DS2482 tristate "Maxim DS2482 I2C to 1-Wire bridge" @@ -56,7 +56,7 @@ config W1_MASTER_GPIO GPIO pins. This driver uses the GPIO API to control the wire. This support is also available as a module. If so, the module - will be called w1-gpio.ko. + will be called w1-gpio. config HDQ_MASTER_OMAP tristate "OMAP HDQ driver" diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index a411702413d..6f8866d6a90 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c @@ -74,6 +74,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 +94,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 +104,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) |