Loading...
1/*
2 * Watchdog driver for the wm831x PMICs
3 *
4 * Copyright (C) 2009 Wolfson Microelectronics
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation
9 */
10
11#include <linux/module.h>
12#include <linux/moduleparam.h>
13#include <linux/types.h>
14#include <linux/kernel.h>
15#include <linux/fs.h>
16#include <linux/miscdevice.h>
17#include <linux/platform_device.h>
18#include <linux/watchdog.h>
19#include <linux/uaccess.h>
20#include <linux/gpio.h>
21
22#include <linux/mfd/wm831x/core.h>
23#include <linux/mfd/wm831x/pdata.h>
24#include <linux/mfd/wm831x/watchdog.h>
25
26static int nowayout = WATCHDOG_NOWAYOUT;
27module_param(nowayout, int, 0);
28MODULE_PARM_DESC(nowayout,
29 "Watchdog cannot be stopped once started (default="
30 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
31
32static unsigned long wm831x_wdt_users;
33static struct miscdevice wm831x_wdt_miscdev;
34static int wm831x_wdt_expect_close;
35static DEFINE_MUTEX(wdt_mutex);
36static struct wm831x *wm831x;
37static unsigned int update_gpio;
38static unsigned int update_state;
39
40/* We can't use the sub-second values here but they're included
41 * for completeness. */
42static struct {
43 int time; /* Seconds */
44 u16 val; /* WDOG_TO value */
45} wm831x_wdt_cfgs[] = {
46 { 1, 2 },
47 { 2, 3 },
48 { 4, 4 },
49 { 8, 5 },
50 { 16, 6 },
51 { 32, 7 },
52 { 33, 7 }, /* Actually 32.768s so include both, others round down */
53};
54
55static int wm831x_wdt_set_timeout(struct wm831x *wm831x, u16 value)
56{
57 int ret;
58
59 mutex_lock(&wdt_mutex);
60
61 ret = wm831x_reg_unlock(wm831x);
62 if (ret == 0) {
63 ret = wm831x_set_bits(wm831x, WM831X_WATCHDOG,
64 WM831X_WDOG_TO_MASK, value);
65 wm831x_reg_lock(wm831x);
66 } else {
67 dev_err(wm831x->dev, "Failed to unlock security key: %d\n",
68 ret);
69 }
70
71 mutex_unlock(&wdt_mutex);
72
73 return ret;
74}
75
76static int wm831x_wdt_start(struct wm831x *wm831x)
77{
78 int ret;
79
80 mutex_lock(&wdt_mutex);
81
82 ret = wm831x_reg_unlock(wm831x);
83 if (ret == 0) {
84 ret = wm831x_set_bits(wm831x, WM831X_WATCHDOG,
85 WM831X_WDOG_ENA, WM831X_WDOG_ENA);
86 wm831x_reg_lock(wm831x);
87 } else {
88 dev_err(wm831x->dev, "Failed to unlock security key: %d\n",
89 ret);
90 }
91
92 mutex_unlock(&wdt_mutex);
93
94 return ret;
95}
96
97static int wm831x_wdt_stop(struct wm831x *wm831x)
98{
99 int ret;
100
101 mutex_lock(&wdt_mutex);
102
103 ret = wm831x_reg_unlock(wm831x);
104 if (ret == 0) {
105 ret = wm831x_set_bits(wm831x, WM831X_WATCHDOG,
106 WM831X_WDOG_ENA, 0);
107 wm831x_reg_lock(wm831x);
108 } else {
109 dev_err(wm831x->dev, "Failed to unlock security key: %d\n",
110 ret);
111 }
112
113 mutex_unlock(&wdt_mutex);
114
115 return ret;
116}
117
118static int wm831x_wdt_kick(struct wm831x *wm831x)
119{
120 int ret;
121 u16 reg;
122
123 mutex_lock(&wdt_mutex);
124
125 if (update_gpio) {
126 gpio_set_value_cansleep(update_gpio, update_state);
127 update_state = !update_state;
128 ret = 0;
129 goto out;
130 }
131
132
133 reg = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
134
135 if (!(reg & WM831X_WDOG_RST_SRC)) {
136 dev_err(wm831x->dev, "Hardware watchdog update unsupported\n");
137 ret = -EINVAL;
138 goto out;
139 }
140
141 reg |= WM831X_WDOG_RESET;
142
143 ret = wm831x_reg_unlock(wm831x);
144 if (ret == 0) {
145 ret = wm831x_reg_write(wm831x, WM831X_WATCHDOG, reg);
146 wm831x_reg_lock(wm831x);
147 } else {
148 dev_err(wm831x->dev, "Failed to unlock security key: %d\n",
149 ret);
150 }
151
152out:
153 mutex_unlock(&wdt_mutex);
154
155 return ret;
156}
157
158static int wm831x_wdt_open(struct inode *inode, struct file *file)
159{
160 int ret;
161
162 if (!wm831x)
163 return -ENODEV;
164
165 if (test_and_set_bit(0, &wm831x_wdt_users))
166 return -EBUSY;
167
168 ret = wm831x_wdt_start(wm831x);
169 if (ret != 0)
170 return ret;
171
172 return nonseekable_open(inode, file);
173}
174
175static int wm831x_wdt_release(struct inode *inode, struct file *file)
176{
177 if (wm831x_wdt_expect_close)
178 wm831x_wdt_stop(wm831x);
179 else {
180 dev_warn(wm831x->dev, "Watchdog device closed uncleanly\n");
181 wm831x_wdt_kick(wm831x);
182 }
183
184 clear_bit(0, &wm831x_wdt_users);
185
186 return 0;
187}
188
189static ssize_t wm831x_wdt_write(struct file *file,
190 const char __user *data, size_t count,
191 loff_t *ppos)
192{
193 size_t i;
194
195 if (count) {
196 wm831x_wdt_kick(wm831x);
197
198 if (!nowayout) {
199 /* In case it was set long ago */
200 wm831x_wdt_expect_close = 0;
201
202 /* scan to see whether or not we got the magic
203 character */
204 for (i = 0; i != count; i++) {
205 char c;
206 if (get_user(c, data + i))
207 return -EFAULT;
208 if (c == 'V')
209 wm831x_wdt_expect_close = 42;
210 }
211 }
212 }
213 return count;
214}
215
216static const struct watchdog_info ident = {
217 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
218 .identity = "WM831x Watchdog",
219};
220
221static long wm831x_wdt_ioctl(struct file *file, unsigned int cmd,
222 unsigned long arg)
223{
224 int ret = -ENOTTY, time, i;
225 void __user *argp = (void __user *)arg;
226 int __user *p = argp;
227 u16 reg;
228
229 switch (cmd) {
230 case WDIOC_GETSUPPORT:
231 ret = copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
232 break;
233
234 case WDIOC_GETSTATUS:
235 case WDIOC_GETBOOTSTATUS:
236 ret = put_user(0, p);
237 break;
238
239 case WDIOC_SETOPTIONS:
240 {
241 int options;
242
243 if (get_user(options, p))
244 return -EFAULT;
245
246 ret = -EINVAL;
247
248 /* Setting both simultaneously means at least one must fail */
249 if (options == WDIOS_DISABLECARD)
250 ret = wm831x_wdt_start(wm831x);
251
252 if (options == WDIOS_ENABLECARD)
253 ret = wm831x_wdt_stop(wm831x);
254 break;
255 }
256
257 case WDIOC_KEEPALIVE:
258 ret = wm831x_wdt_kick(wm831x);
259 break;
260
261 case WDIOC_SETTIMEOUT:
262 ret = get_user(time, p);
263 if (ret)
264 break;
265
266 if (time == 0) {
267 if (nowayout)
268 ret = -EINVAL;
269 else
270 wm831x_wdt_stop(wm831x);
271 break;
272 }
273
274 for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++)
275 if (wm831x_wdt_cfgs[i].time == time)
276 break;
277 if (i == ARRAY_SIZE(wm831x_wdt_cfgs))
278 ret = -EINVAL;
279 else
280 ret = wm831x_wdt_set_timeout(wm831x,
281 wm831x_wdt_cfgs[i].val);
282 break;
283
284 case WDIOC_GETTIMEOUT:
285 reg = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
286 reg &= WM831X_WDOG_TO_MASK;
287 for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++)
288 if (wm831x_wdt_cfgs[i].val == reg)
289 break;
290 if (i == ARRAY_SIZE(wm831x_wdt_cfgs)) {
291 dev_warn(wm831x->dev,
292 "Unknown watchdog configuration: %x\n", reg);
293 ret = -EINVAL;
294 } else
295 ret = put_user(wm831x_wdt_cfgs[i].time, p);
296
297 }
298
299 return ret;
300}
301
302static const struct file_operations wm831x_wdt_fops = {
303 .owner = THIS_MODULE,
304 .llseek = no_llseek,
305 .write = wm831x_wdt_write,
306 .unlocked_ioctl = wm831x_wdt_ioctl,
307 .open = wm831x_wdt_open,
308 .release = wm831x_wdt_release,
309};
310
311static struct miscdevice wm831x_wdt_miscdev = {
312 .minor = WATCHDOG_MINOR,
313 .name = "watchdog",
314 .fops = &wm831x_wdt_fops,
315};
316
317static int __devinit wm831x_wdt_probe(struct platform_device *pdev)
318{
319 struct wm831x_pdata *chip_pdata;
320 struct wm831x_watchdog_pdata *pdata;
321 int reg, ret;
322
323 if (wm831x) {
324 dev_err(&pdev->dev, "wm831x watchdog already registered\n");
325 return -EBUSY;
326 }
327
328 wm831x = dev_get_drvdata(pdev->dev.parent);
329
330 ret = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
331 if (ret < 0) {
332 dev_err(wm831x->dev, "Failed to read watchdog status: %d\n",
333 ret);
334 goto err;
335 }
336 reg = ret;
337
338 if (reg & WM831X_WDOG_DEBUG)
339 dev_warn(wm831x->dev, "Watchdog is paused\n");
340
341 /* Apply any configuration */
342 if (pdev->dev.parent->platform_data) {
343 chip_pdata = pdev->dev.parent->platform_data;
344 pdata = chip_pdata->watchdog;
345 } else {
346 pdata = NULL;
347 }
348
349 if (pdata) {
350 reg &= ~(WM831X_WDOG_SECACT_MASK | WM831X_WDOG_PRIMACT_MASK |
351 WM831X_WDOG_RST_SRC);
352
353 reg |= pdata->primary << WM831X_WDOG_PRIMACT_SHIFT;
354 reg |= pdata->secondary << WM831X_WDOG_SECACT_SHIFT;
355 reg |= pdata->software << WM831X_WDOG_RST_SRC_SHIFT;
356
357 if (pdata->update_gpio) {
358 ret = gpio_request(pdata->update_gpio,
359 "Watchdog update");
360 if (ret < 0) {
361 dev_err(wm831x->dev,
362 "Failed to request update GPIO: %d\n",
363 ret);
364 goto err;
365 }
366
367 ret = gpio_direction_output(pdata->update_gpio, 0);
368 if (ret != 0) {
369 dev_err(wm831x->dev,
370 "gpio_direction_output returned: %d\n",
371 ret);
372 goto err_gpio;
373 }
374
375 update_gpio = pdata->update_gpio;
376
377 /* Make sure the watchdog takes hardware updates */
378 reg |= WM831X_WDOG_RST_SRC;
379 }
380
381 ret = wm831x_reg_unlock(wm831x);
382 if (ret == 0) {
383 ret = wm831x_reg_write(wm831x, WM831X_WATCHDOG, reg);
384 wm831x_reg_lock(wm831x);
385 } else {
386 dev_err(wm831x->dev,
387 "Failed to unlock security key: %d\n", ret);
388 goto err_gpio;
389 }
390 }
391
392 wm831x_wdt_miscdev.parent = &pdev->dev;
393
394 ret = misc_register(&wm831x_wdt_miscdev);
395 if (ret != 0) {
396 dev_err(wm831x->dev, "Failed to register miscdev: %d\n", ret);
397 goto err_gpio;
398 }
399
400 return 0;
401
402err_gpio:
403 if (update_gpio) {
404 gpio_free(update_gpio);
405 update_gpio = 0;
406 }
407err:
408 return ret;
409}
410
411static int __devexit wm831x_wdt_remove(struct platform_device *pdev)
412{
413 if (update_gpio) {
414 gpio_free(update_gpio);
415 update_gpio = 0;
416 }
417
418 misc_deregister(&wm831x_wdt_miscdev);
419
420 return 0;
421}
422
423static struct platform_driver wm831x_wdt_driver = {
424 .probe = wm831x_wdt_probe,
425 .remove = __devexit_p(wm831x_wdt_remove),
426 .driver = {
427 .name = "wm831x-watchdog",
428 },
429};
430
431static int __init wm831x_wdt_init(void)
432{
433 return platform_driver_register(&wm831x_wdt_driver);
434}
435module_init(wm831x_wdt_init);
436
437static void __exit wm831x_wdt_exit(void)
438{
439 platform_driver_unregister(&wm831x_wdt_driver);
440}
441module_exit(wm831x_wdt_exit);
442
443MODULE_AUTHOR("Mark Brown");
444MODULE_DESCRIPTION("WM831x Watchdog");
445MODULE_LICENSE("GPL");
446MODULE_ALIAS("platform:wm831x-watchdog");
1/*
2 * Watchdog driver for the wm831x PMICs
3 *
4 * Copyright (C) 2009 Wolfson Microelectronics
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation
9 */
10
11#include <linux/module.h>
12#include <linux/moduleparam.h>
13#include <linux/types.h>
14#include <linux/kernel.h>
15#include <linux/slab.h>
16#include <linux/platform_device.h>
17#include <linux/watchdog.h>
18#include <linux/uaccess.h>
19#include <linux/gpio.h>
20
21#include <linux/mfd/wm831x/core.h>
22#include <linux/mfd/wm831x/pdata.h>
23#include <linux/mfd/wm831x/watchdog.h>
24
25static bool nowayout = WATCHDOG_NOWAYOUT;
26module_param(nowayout, bool, 0);
27MODULE_PARM_DESC(nowayout,
28 "Watchdog cannot be stopped once started (default="
29 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
30
31struct wm831x_wdt_drvdata {
32 struct watchdog_device wdt;
33 struct wm831x *wm831x;
34 struct mutex lock;
35 int update_gpio;
36 int update_state;
37};
38
39/* We can't use the sub-second values here but they're included
40 * for completeness. */
41static struct {
42 unsigned int time; /* Seconds */
43 u16 val; /* WDOG_TO value */
44} wm831x_wdt_cfgs[] = {
45 { 1, 2 },
46 { 2, 3 },
47 { 4, 4 },
48 { 8, 5 },
49 { 16, 6 },
50 { 32, 7 },
51 { 33, 7 }, /* Actually 32.768s so include both, others round down */
52};
53
54static int wm831x_wdt_start(struct watchdog_device *wdt_dev)
55{
56 struct wm831x_wdt_drvdata *driver_data = watchdog_get_drvdata(wdt_dev);
57 struct wm831x *wm831x = driver_data->wm831x;
58 int ret;
59
60 mutex_lock(&driver_data->lock);
61
62 ret = wm831x_reg_unlock(wm831x);
63 if (ret == 0) {
64 ret = wm831x_set_bits(wm831x, WM831X_WATCHDOG,
65 WM831X_WDOG_ENA, WM831X_WDOG_ENA);
66 wm831x_reg_lock(wm831x);
67 } else {
68 dev_err(wm831x->dev, "Failed to unlock security key: %d\n",
69 ret);
70 }
71
72 mutex_unlock(&driver_data->lock);
73
74 return ret;
75}
76
77static int wm831x_wdt_stop(struct watchdog_device *wdt_dev)
78{
79 struct wm831x_wdt_drvdata *driver_data = watchdog_get_drvdata(wdt_dev);
80 struct wm831x *wm831x = driver_data->wm831x;
81 int ret;
82
83 mutex_lock(&driver_data->lock);
84
85 ret = wm831x_reg_unlock(wm831x);
86 if (ret == 0) {
87 ret = wm831x_set_bits(wm831x, WM831X_WATCHDOG,
88 WM831X_WDOG_ENA, 0);
89 wm831x_reg_lock(wm831x);
90 } else {
91 dev_err(wm831x->dev, "Failed to unlock security key: %d\n",
92 ret);
93 }
94
95 mutex_unlock(&driver_data->lock);
96
97 return ret;
98}
99
100static int wm831x_wdt_ping(struct watchdog_device *wdt_dev)
101{
102 struct wm831x_wdt_drvdata *driver_data = watchdog_get_drvdata(wdt_dev);
103 struct wm831x *wm831x = driver_data->wm831x;
104 int ret;
105 u16 reg;
106
107 mutex_lock(&driver_data->lock);
108
109 if (driver_data->update_gpio) {
110 gpio_set_value_cansleep(driver_data->update_gpio,
111 driver_data->update_state);
112 driver_data->update_state = !driver_data->update_state;
113 ret = 0;
114 goto out;
115 }
116
117 reg = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
118
119 if (!(reg & WM831X_WDOG_RST_SRC)) {
120 dev_err(wm831x->dev, "Hardware watchdog update unsupported\n");
121 ret = -EINVAL;
122 goto out;
123 }
124
125 reg |= WM831X_WDOG_RESET;
126
127 ret = wm831x_reg_unlock(wm831x);
128 if (ret == 0) {
129 ret = wm831x_reg_write(wm831x, WM831X_WATCHDOG, reg);
130 wm831x_reg_lock(wm831x);
131 } else {
132 dev_err(wm831x->dev, "Failed to unlock security key: %d\n",
133 ret);
134 }
135
136out:
137 mutex_unlock(&driver_data->lock);
138
139 return ret;
140}
141
142static int wm831x_wdt_set_timeout(struct watchdog_device *wdt_dev,
143 unsigned int timeout)
144{
145 struct wm831x_wdt_drvdata *driver_data = watchdog_get_drvdata(wdt_dev);
146 struct wm831x *wm831x = driver_data->wm831x;
147 int ret, i;
148
149 for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++)
150 if (wm831x_wdt_cfgs[i].time == timeout)
151 break;
152 if (i == ARRAY_SIZE(wm831x_wdt_cfgs))
153 return -EINVAL;
154
155 ret = wm831x_reg_unlock(wm831x);
156 if (ret == 0) {
157 ret = wm831x_set_bits(wm831x, WM831X_WATCHDOG,
158 WM831X_WDOG_TO_MASK,
159 wm831x_wdt_cfgs[i].val);
160 wm831x_reg_lock(wm831x);
161 } else {
162 dev_err(wm831x->dev, "Failed to unlock security key: %d\n",
163 ret);
164 }
165
166 wdt_dev->timeout = timeout;
167
168 return ret;
169}
170
171static const struct watchdog_info wm831x_wdt_info = {
172 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
173 .identity = "WM831x Watchdog",
174};
175
176static const struct watchdog_ops wm831x_wdt_ops = {
177 .owner = THIS_MODULE,
178 .start = wm831x_wdt_start,
179 .stop = wm831x_wdt_stop,
180 .ping = wm831x_wdt_ping,
181 .set_timeout = wm831x_wdt_set_timeout,
182};
183
184static int __devinit wm831x_wdt_probe(struct platform_device *pdev)
185{
186 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
187 struct wm831x_pdata *chip_pdata;
188 struct wm831x_watchdog_pdata *pdata;
189 struct wm831x_wdt_drvdata *driver_data;
190 struct watchdog_device *wm831x_wdt;
191 int reg, ret, i;
192
193 ret = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
194 if (ret < 0) {
195 dev_err(wm831x->dev, "Failed to read watchdog status: %d\n",
196 ret);
197 goto err;
198 }
199 reg = ret;
200
201 if (reg & WM831X_WDOG_DEBUG)
202 dev_warn(wm831x->dev, "Watchdog is paused\n");
203
204 driver_data = devm_kzalloc(&pdev->dev, sizeof(*driver_data),
205 GFP_KERNEL);
206 if (!driver_data) {
207 dev_err(wm831x->dev, "Unable to alloacate watchdog device\n");
208 ret = -ENOMEM;
209 goto err;
210 }
211
212 mutex_init(&driver_data->lock);
213 driver_data->wm831x = wm831x;
214
215 wm831x_wdt = &driver_data->wdt;
216
217 wm831x_wdt->info = &wm831x_wdt_info;
218 wm831x_wdt->ops = &wm831x_wdt_ops;
219 watchdog_set_nowayout(wm831x_wdt, nowayout);
220 watchdog_set_drvdata(wm831x_wdt, driver_data);
221
222 reg = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
223 reg &= WM831X_WDOG_TO_MASK;
224 for (i = 0; i < ARRAY_SIZE(wm831x_wdt_cfgs); i++)
225 if (wm831x_wdt_cfgs[i].val == reg)
226 break;
227 if (i == ARRAY_SIZE(wm831x_wdt_cfgs))
228 dev_warn(wm831x->dev,
229 "Unknown watchdog timeout: %x\n", reg);
230 else
231 wm831x_wdt->timeout = wm831x_wdt_cfgs[i].time;
232
233 /* Apply any configuration */
234 if (pdev->dev.parent->platform_data) {
235 chip_pdata = pdev->dev.parent->platform_data;
236 pdata = chip_pdata->watchdog;
237 } else {
238 pdata = NULL;
239 }
240
241 if (pdata) {
242 reg &= ~(WM831X_WDOG_SECACT_MASK | WM831X_WDOG_PRIMACT_MASK |
243 WM831X_WDOG_RST_SRC);
244
245 reg |= pdata->primary << WM831X_WDOG_PRIMACT_SHIFT;
246 reg |= pdata->secondary << WM831X_WDOG_SECACT_SHIFT;
247 reg |= pdata->software << WM831X_WDOG_RST_SRC_SHIFT;
248
249 if (pdata->update_gpio) {
250 ret = gpio_request_one(pdata->update_gpio,
251 GPIOF_DIR_OUT | GPIOF_INIT_LOW,
252 "Watchdog update");
253 if (ret < 0) {
254 dev_err(wm831x->dev,
255 "Failed to request update GPIO: %d\n",
256 ret);
257 goto err;
258 }
259
260 driver_data->update_gpio = pdata->update_gpio;
261
262 /* Make sure the watchdog takes hardware updates */
263 reg |= WM831X_WDOG_RST_SRC;
264 }
265
266 ret = wm831x_reg_unlock(wm831x);
267 if (ret == 0) {
268 ret = wm831x_reg_write(wm831x, WM831X_WATCHDOG, reg);
269 wm831x_reg_lock(wm831x);
270 } else {
271 dev_err(wm831x->dev,
272 "Failed to unlock security key: %d\n", ret);
273 goto err_gpio;
274 }
275 }
276
277 ret = watchdog_register_device(&driver_data->wdt);
278 if (ret != 0) {
279 dev_err(wm831x->dev, "watchdog_register_device() failed: %d\n",
280 ret);
281 goto err_gpio;
282 }
283
284 dev_set_drvdata(&pdev->dev, driver_data);
285
286 return 0;
287
288err_gpio:
289 if (driver_data->update_gpio)
290 gpio_free(driver_data->update_gpio);
291err:
292 return ret;
293}
294
295static int __devexit wm831x_wdt_remove(struct platform_device *pdev)
296{
297 struct wm831x_wdt_drvdata *driver_data = dev_get_drvdata(&pdev->dev);
298
299 watchdog_unregister_device(&driver_data->wdt);
300
301 if (driver_data->update_gpio)
302 gpio_free(driver_data->update_gpio);
303
304 return 0;
305}
306
307static struct platform_driver wm831x_wdt_driver = {
308 .probe = wm831x_wdt_probe,
309 .remove = __devexit_p(wm831x_wdt_remove),
310 .driver = {
311 .name = "wm831x-watchdog",
312 },
313};
314
315module_platform_driver(wm831x_wdt_driver);
316
317MODULE_AUTHOR("Mark Brown");
318MODULE_DESCRIPTION("WM831x Watchdog");
319MODULE_LICENSE("GPL");
320MODULE_ALIAS("platform:wm831x-watchdog");