aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/masters/w1-gpio.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index a411702413d6..6f8866d6a905 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)
74 if (err) 74 if (err)
75 goto free_gpio; 75 goto free_gpio;
76 76
77 if (pdata->enable_external_pullup)
78 pdata->enable_external_pullup(1);
79
77 platform_set_drvdata(pdev, master); 80 platform_set_drvdata(pdev, master);
78 81
79 return 0; 82 return 0;
@@ -91,6 +94,9 @@ static int __exit w1_gpio_remove(struct platform_device *pdev)
91 struct w1_bus_master *master = platform_get_drvdata(pdev); 94 struct w1_bus_master *master = platform_get_drvdata(pdev);
92 struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; 95 struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
93 96
97 if (pdata->enable_external_pullup)
98 pdata->enable_external_pullup(0);
99
94 w1_remove_master_device(master); 100 w1_remove_master_device(master);
95 gpio_free(pdata->pin); 101 gpio_free(pdata->pin);
96 kfree(master); 102 kfree(master);
@@ -98,12 +104,41 @@ static int __exit w1_gpio_remove(struct platform_device *pdev)
98 return 0; 104 return 0;
99} 105}
100 106
107#ifdef CONFIG_PM
108
109static int w1_gpio_suspend(struct platform_device *pdev, pm_message_t state)
110{
111 struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
112
113 if (pdata->enable_external_pullup)
114 pdata->enable_external_pullup(0);
115
116 return 0;
117}
118
119static int w1_gpio_resume(struct platform_device *pdev)
120{
121 struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
122
123 if (pdata->enable_external_pullup)
124 pdata->enable_external_pullup(1);
125
126 return 0;
127}
128
129#else
130#define w1_gpio_suspend NULL
131#define w1_gpio_resume NULL
132#endif
133
101static struct platform_driver w1_gpio_driver = { 134static struct platform_driver w1_gpio_driver = {
102 .driver = { 135 .driver = {
103 .name = "w1-gpio", 136 .name = "w1-gpio",
104 .owner = THIS_MODULE, 137 .owner = THIS_MODULE,
105 }, 138 },
106 .remove = __exit_p(w1_gpio_remove), 139 .remove = __exit_p(w1_gpio_remove),
140 .suspend = w1_gpio_suspend,
141 .resume = w1_gpio_resume,
107}; 142};
108 143
109static int __init w1_gpio_init(void) 144static int __init w1_gpio_init(void)