2 * wm831x-ldo.c -- LDO driver for the WM831x series
4 * Copyright 2009 Wolfson Microelectronics PLC.
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
14 #include <linux/module.h>
15 #include <linux/moduleparam.h>
16 #include <linux/init.h>
17 #include <linux/bitops.h>
18 #include <linux/err.h>
19 #include <linux/i2c.h>
20 #include <linux/platform_device.h>
21 #include <linux/regulator/driver.h>
22 #include <linux/slab.h>
24 #include <linux/mfd/wm831x/core.h>
25 #include <linux/mfd/wm831x/regulator.h>
26 #include <linux/mfd/wm831x/pdata.h>
28 #define WM831X_LDO_MAX_NAME 6
30 #define WM831X_LDO_CONTROL 0
31 #define WM831X_LDO_ON_CONTROL 1
32 #define WM831X_LDO_SLEEP_CONTROL 2
34 #define WM831X_ALIVE_LDO_ON_CONTROL 0
35 #define WM831X_ALIVE_LDO_SLEEP_CONTROL 1
38 char name[WM831X_LDO_MAX_NAME];
39 struct regulator_desc desc;
41 struct wm831x *wm831x;
42 struct regulator_dev *regulator;
49 static int wm831x_ldo_is_enabled(struct regulator_dev *rdev)
51 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
52 struct wm831x *wm831x = ldo->wm831x;
53 int mask = 1 << rdev_get_id(rdev);
56 reg = wm831x_reg_read(wm831x, WM831X_LDO_ENABLE);
66 static int wm831x_ldo_enable(struct regulator_dev *rdev)
68 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
69 struct wm831x *wm831x = ldo->wm831x;
70 int mask = 1 << rdev_get_id(rdev);
72 return wm831x_set_bits(wm831x, WM831X_LDO_ENABLE, mask, mask);
75 static int wm831x_ldo_disable(struct regulator_dev *rdev)
77 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
78 struct wm831x *wm831x = ldo->wm831x;
79 int mask = 1 << rdev_get_id(rdev);
81 return wm831x_set_bits(wm831x, WM831X_LDO_ENABLE, mask, 0);
84 static irqreturn_t wm831x_ldo_uv_irq(int irq, void *data)
86 struct wm831x_ldo *ldo = data;
88 regulator_notifier_call_chain(ldo->regulator,
89 REGULATOR_EVENT_UNDER_VOLTAGE,
96 * General purpose LDOs
99 #define WM831X_GP_LDO_SELECTOR_LOW 0xe
100 #define WM831X_GP_LDO_MAX_SELECTOR 0x1f
102 static int wm831x_gp_ldo_list_voltage(struct regulator_dev *rdev,
103 unsigned int selector)
105 /* 0.9-1.6V in 50mV steps */
106 if (selector <= WM831X_GP_LDO_SELECTOR_LOW)
107 return 900000 + (selector * 50000);
108 /* 1.7-3.3V in 50mV steps */
109 if (selector <= WM831X_GP_LDO_MAX_SELECTOR)
110 return 1600000 + ((selector - WM831X_GP_LDO_SELECTOR_LOW)
115 static int wm831x_gp_ldo_set_voltage_int(struct regulator_dev *rdev, int reg,
116 int min_uV, int max_uV,
119 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
120 struct wm831x *wm831x = ldo->wm831x;
125 else if (min_uV < 1700000)
126 vsel = ((min_uV - 900000) / 50000);
128 vsel = ((min_uV - 1700000) / 100000)
129 + WM831X_GP_LDO_SELECTOR_LOW + 1;
131 ret = wm831x_gp_ldo_list_voltage(rdev, vsel);
134 if (ret < min_uV || ret > max_uV)
139 return wm831x_set_bits(wm831x, reg, WM831X_LDO1_ON_VSEL_MASK, vsel);
142 static int wm831x_gp_ldo_set_voltage(struct regulator_dev *rdev,
143 int min_uV, int max_uV,
146 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
147 int reg = ldo->base + WM831X_LDO_ON_CONTROL;
149 return wm831x_gp_ldo_set_voltage_int(rdev, reg, min_uV, max_uV,
153 static int wm831x_gp_ldo_set_suspend_voltage(struct regulator_dev *rdev,
156 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
157 int reg = ldo->base + WM831X_LDO_SLEEP_CONTROL;
158 unsigned int selector;
160 return wm831x_gp_ldo_set_voltage_int(rdev, reg, uV, uV, &selector);
163 static int wm831x_gp_ldo_get_voltage_sel(struct regulator_dev *rdev)
165 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
166 struct wm831x *wm831x = ldo->wm831x;
167 int reg = ldo->base + WM831X_LDO_ON_CONTROL;
170 ret = wm831x_reg_read(wm831x, reg);
174 ret &= WM831X_LDO1_ON_VSEL_MASK;
179 static unsigned int wm831x_gp_ldo_get_mode(struct regulator_dev *rdev)
181 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
182 struct wm831x *wm831x = ldo->wm831x;
183 int ctrl_reg = ldo->base + WM831X_LDO_CONTROL;
184 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
187 ret = wm831x_reg_read(wm831x, on_reg);
191 if (!(ret & WM831X_LDO1_ON_MODE))
192 return REGULATOR_MODE_NORMAL;
194 ret = wm831x_reg_read(wm831x, ctrl_reg);
198 if (ret & WM831X_LDO1_LP_MODE)
199 return REGULATOR_MODE_STANDBY;
201 return REGULATOR_MODE_IDLE;
204 static int wm831x_gp_ldo_set_mode(struct regulator_dev *rdev,
207 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
208 struct wm831x *wm831x = ldo->wm831x;
209 int ctrl_reg = ldo->base + WM831X_LDO_CONTROL;
210 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
215 case REGULATOR_MODE_NORMAL:
216 ret = wm831x_set_bits(wm831x, on_reg,
217 WM831X_LDO1_ON_MODE, 0);
222 case REGULATOR_MODE_IDLE:
223 ret = wm831x_set_bits(wm831x, ctrl_reg,
224 WM831X_LDO1_LP_MODE, 0);
228 ret = wm831x_set_bits(wm831x, on_reg,
230 WM831X_LDO1_ON_MODE);
235 case REGULATOR_MODE_STANDBY:
236 ret = wm831x_set_bits(wm831x, ctrl_reg,
238 WM831X_LDO1_LP_MODE);
242 ret = wm831x_set_bits(wm831x, on_reg,
244 WM831X_LDO1_ON_MODE);
256 static int wm831x_gp_ldo_get_status(struct regulator_dev *rdev)
258 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
259 struct wm831x *wm831x = ldo->wm831x;
260 int mask = 1 << rdev_get_id(rdev);
263 /* Is the regulator on? */
264 ret = wm831x_reg_read(wm831x, WM831X_LDO_STATUS);
268 return REGULATOR_STATUS_OFF;
270 /* Is it reporting under voltage? */
271 ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);
273 return REGULATOR_STATUS_ERROR;
275 ret = wm831x_gp_ldo_get_mode(rdev);
279 return regulator_mode_to_status(ret);
282 static unsigned int wm831x_gp_ldo_get_optimum_mode(struct regulator_dev *rdev,
284 int output_uV, int load_uA)
287 return REGULATOR_MODE_STANDBY;
289 return REGULATOR_MODE_IDLE;
290 return REGULATOR_MODE_NORMAL;
294 static struct regulator_ops wm831x_gp_ldo_ops = {
295 .list_voltage = wm831x_gp_ldo_list_voltage,
296 .get_voltage_sel = wm831x_gp_ldo_get_voltage_sel,
297 .set_voltage = wm831x_gp_ldo_set_voltage,
298 .set_suspend_voltage = wm831x_gp_ldo_set_suspend_voltage,
299 .get_mode = wm831x_gp_ldo_get_mode,
300 .set_mode = wm831x_gp_ldo_set_mode,
301 .get_status = wm831x_gp_ldo_get_status,
302 .get_optimum_mode = wm831x_gp_ldo_get_optimum_mode,
304 .is_enabled = wm831x_ldo_is_enabled,
305 .enable = wm831x_ldo_enable,
306 .disable = wm831x_ldo_disable,
309 static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
311 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
312 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
313 int id = pdev->id % ARRAY_SIZE(pdata->ldo);
314 struct wm831x_ldo *ldo;
315 struct resource *res;
318 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
320 if (pdata == NULL || pdata->ldo[id] == NULL)
323 ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL);
325 dev_err(&pdev->dev, "Unable to allocate private data\n");
329 ldo->wm831x = wm831x;
331 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
333 dev_err(&pdev->dev, "No I/O resource\n");
337 ldo->base = res->start;
339 snprintf(ldo->name, sizeof(ldo->name), "LDO%d", id + 1);
340 ldo->desc.name = ldo->name;
342 ldo->desc.type = REGULATOR_VOLTAGE;
343 ldo->desc.n_voltages = WM831X_GP_LDO_MAX_SELECTOR + 1;
344 ldo->desc.ops = &wm831x_gp_ldo_ops;
345 ldo->desc.owner = THIS_MODULE;
347 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev,
348 pdata->ldo[id], ldo);
349 if (IS_ERR(ldo->regulator)) {
350 ret = PTR_ERR(ldo->regulator);
351 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
356 irq = platform_get_irq_byname(pdev, "UV");
357 ret = request_threaded_irq(irq, NULL, wm831x_ldo_uv_irq,
358 IRQF_TRIGGER_RISING, ldo->name,
361 dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n",
366 platform_set_drvdata(pdev, ldo);
371 regulator_unregister(ldo->regulator);
377 static __devexit int wm831x_gp_ldo_remove(struct platform_device *pdev)
379 struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
381 platform_set_drvdata(pdev, NULL);
383 free_irq(platform_get_irq_byname(pdev, "UV"), ldo);
384 regulator_unregister(ldo->regulator);
390 static struct platform_driver wm831x_gp_ldo_driver = {
391 .probe = wm831x_gp_ldo_probe,
392 .remove = __devexit_p(wm831x_gp_ldo_remove),
394 .name = "wm831x-ldo",
395 .owner = THIS_MODULE,
404 #define WM831X_ALDO_SELECTOR_LOW 0xc
405 #define WM831X_ALDO_MAX_SELECTOR 0x1f
407 static int wm831x_aldo_list_voltage(struct regulator_dev *rdev,
408 unsigned int selector)
410 /* 1-1.6V in 50mV steps */
411 if (selector <= WM831X_ALDO_SELECTOR_LOW)
412 return 1000000 + (selector * 50000);
413 /* 1.7-3.5V in 50mV steps */
414 if (selector <= WM831X_ALDO_MAX_SELECTOR)
415 return 1600000 + ((selector - WM831X_ALDO_SELECTOR_LOW)
420 static int wm831x_aldo_set_voltage_int(struct regulator_dev *rdev, int reg,
421 int min_uV, int max_uV,
424 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
425 struct wm831x *wm831x = ldo->wm831x;
428 if (min_uV < 1000000)
430 else if (min_uV < 1700000)
431 vsel = ((min_uV - 1000000) / 50000);
433 vsel = ((min_uV - 1700000) / 100000)
434 + WM831X_ALDO_SELECTOR_LOW + 1;
436 ret = wm831x_aldo_list_voltage(rdev, vsel);
439 if (ret < min_uV || ret > max_uV)
444 return wm831x_set_bits(wm831x, reg, WM831X_LDO7_ON_VSEL_MASK, vsel);
447 static int wm831x_aldo_set_voltage(struct regulator_dev *rdev,
448 int min_uV, int max_uV, unsigned *selector)
450 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
451 int reg = ldo->base + WM831X_LDO_ON_CONTROL;
453 return wm831x_aldo_set_voltage_int(rdev, reg, min_uV, max_uV,
457 static int wm831x_aldo_set_suspend_voltage(struct regulator_dev *rdev,
460 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
461 int reg = ldo->base + WM831X_LDO_SLEEP_CONTROL;
462 unsigned int selector;
464 return wm831x_aldo_set_voltage_int(rdev, reg, uV, uV, &selector);
467 static int wm831x_aldo_get_voltage_sel(struct regulator_dev *rdev)
469 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
470 struct wm831x *wm831x = ldo->wm831x;
471 int reg = ldo->base + WM831X_LDO_ON_CONTROL;
474 ret = wm831x_reg_read(wm831x, reg);
478 ret &= WM831X_LDO7_ON_VSEL_MASK;
483 static unsigned int wm831x_aldo_get_mode(struct regulator_dev *rdev)
485 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
486 struct wm831x *wm831x = ldo->wm831x;
487 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
490 ret = wm831x_reg_read(wm831x, on_reg);
494 if (ret & WM831X_LDO7_ON_MODE)
495 return REGULATOR_MODE_IDLE;
497 return REGULATOR_MODE_NORMAL;
500 static int wm831x_aldo_set_mode(struct regulator_dev *rdev,
503 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
504 struct wm831x *wm831x = ldo->wm831x;
505 int ctrl_reg = ldo->base + WM831X_LDO_CONTROL;
506 int on_reg = ldo->base + WM831X_LDO_ON_CONTROL;
511 case REGULATOR_MODE_NORMAL:
512 ret = wm831x_set_bits(wm831x, on_reg,
513 WM831X_LDO7_ON_MODE, 0);
518 case REGULATOR_MODE_IDLE:
519 ret = wm831x_set_bits(wm831x, ctrl_reg,
521 WM831X_LDO7_ON_MODE);
533 static int wm831x_aldo_get_status(struct regulator_dev *rdev)
535 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
536 struct wm831x *wm831x = ldo->wm831x;
537 int mask = 1 << rdev_get_id(rdev);
540 /* Is the regulator on? */
541 ret = wm831x_reg_read(wm831x, WM831X_LDO_STATUS);
545 return REGULATOR_STATUS_OFF;
547 /* Is it reporting under voltage? */
548 ret = wm831x_reg_read(wm831x, WM831X_LDO_UV_STATUS);
550 return REGULATOR_STATUS_ERROR;
552 ret = wm831x_aldo_get_mode(rdev);
556 return regulator_mode_to_status(ret);
559 static struct regulator_ops wm831x_aldo_ops = {
560 .list_voltage = wm831x_aldo_list_voltage,
561 .get_voltage_sel = wm831x_aldo_get_voltage_sel,
562 .set_voltage = wm831x_aldo_set_voltage,
563 .set_suspend_voltage = wm831x_aldo_set_suspend_voltage,
564 .get_mode = wm831x_aldo_get_mode,
565 .set_mode = wm831x_aldo_set_mode,
566 .get_status = wm831x_aldo_get_status,
568 .is_enabled = wm831x_ldo_is_enabled,
569 .enable = wm831x_ldo_enable,
570 .disable = wm831x_ldo_disable,
573 static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
575 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
576 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
577 int id = pdev->id % ARRAY_SIZE(pdata->ldo);
578 struct wm831x_ldo *ldo;
579 struct resource *res;
582 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
584 if (pdata == NULL || pdata->ldo[id] == NULL)
587 ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL);
589 dev_err(&pdev->dev, "Unable to allocate private data\n");
593 ldo->wm831x = wm831x;
595 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
597 dev_err(&pdev->dev, "No I/O resource\n");
601 ldo->base = res->start;
603 snprintf(ldo->name, sizeof(ldo->name), "LDO%d", id + 1);
604 ldo->desc.name = ldo->name;
606 ldo->desc.type = REGULATOR_VOLTAGE;
607 ldo->desc.n_voltages = WM831X_ALDO_MAX_SELECTOR + 1;
608 ldo->desc.ops = &wm831x_aldo_ops;
609 ldo->desc.owner = THIS_MODULE;
611 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev,
612 pdata->ldo[id], ldo);
613 if (IS_ERR(ldo->regulator)) {
614 ret = PTR_ERR(ldo->regulator);
615 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
620 irq = platform_get_irq_byname(pdev, "UV");
621 ret = request_threaded_irq(irq, NULL, wm831x_ldo_uv_irq,
622 IRQF_TRIGGER_RISING, ldo->name, ldo);
624 dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n",
629 platform_set_drvdata(pdev, ldo);
634 regulator_unregister(ldo->regulator);
640 static __devexit int wm831x_aldo_remove(struct platform_device *pdev)
642 struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
644 free_irq(platform_get_irq_byname(pdev, "UV"), ldo);
645 regulator_unregister(ldo->regulator);
651 static struct platform_driver wm831x_aldo_driver = {
652 .probe = wm831x_aldo_probe,
653 .remove = __devexit_p(wm831x_aldo_remove),
655 .name = "wm831x-aldo",
656 .owner = THIS_MODULE,
664 #define WM831X_ALIVE_LDO_MAX_SELECTOR 0xf
666 static int wm831x_alive_ldo_list_voltage(struct regulator_dev *rdev,
667 unsigned int selector)
669 /* 0.8-1.55V in 50mV steps */
670 if (selector <= WM831X_ALIVE_LDO_MAX_SELECTOR)
671 return 800000 + (selector * 50000);
675 static int wm831x_alive_ldo_set_voltage_int(struct regulator_dev *rdev,
677 int min_uV, int max_uV,
680 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
681 struct wm831x *wm831x = ldo->wm831x;
684 vsel = (min_uV - 800000) / 50000;
686 ret = wm831x_alive_ldo_list_voltage(rdev, vsel);
689 if (ret < min_uV || ret > max_uV)
694 return wm831x_set_bits(wm831x, reg, WM831X_LDO11_ON_VSEL_MASK, vsel);
697 static int wm831x_alive_ldo_set_voltage(struct regulator_dev *rdev,
698 int min_uV, int max_uV,
701 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
702 int reg = ldo->base + WM831X_ALIVE_LDO_ON_CONTROL;
704 return wm831x_alive_ldo_set_voltage_int(rdev, reg, min_uV, max_uV,
708 static int wm831x_alive_ldo_set_suspend_voltage(struct regulator_dev *rdev,
711 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
712 int reg = ldo->base + WM831X_ALIVE_LDO_SLEEP_CONTROL;
715 return wm831x_alive_ldo_set_voltage_int(rdev, reg, uV, uV, &selector);
718 static int wm831x_alive_ldo_get_voltage_sel(struct regulator_dev *rdev)
720 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
721 struct wm831x *wm831x = ldo->wm831x;
722 int reg = ldo->base + WM831X_ALIVE_LDO_ON_CONTROL;
725 ret = wm831x_reg_read(wm831x, reg);
729 ret &= WM831X_LDO11_ON_VSEL_MASK;
734 static int wm831x_alive_ldo_get_status(struct regulator_dev *rdev)
736 struct wm831x_ldo *ldo = rdev_get_drvdata(rdev);
737 struct wm831x *wm831x = ldo->wm831x;
738 int mask = 1 << rdev_get_id(rdev);
741 /* Is the regulator on? */
742 ret = wm831x_reg_read(wm831x, WM831X_LDO_STATUS);
746 return REGULATOR_STATUS_ON;
748 return REGULATOR_STATUS_OFF;
751 static struct regulator_ops wm831x_alive_ldo_ops = {
752 .list_voltage = wm831x_alive_ldo_list_voltage,
753 .get_voltage_sel = wm831x_alive_ldo_get_voltage_sel,
754 .set_voltage = wm831x_alive_ldo_set_voltage,
755 .set_suspend_voltage = wm831x_alive_ldo_set_suspend_voltage,
756 .get_status = wm831x_alive_ldo_get_status,
758 .is_enabled = wm831x_ldo_is_enabled,
759 .enable = wm831x_ldo_enable,
760 .disable = wm831x_ldo_disable,
763 static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
765 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
766 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
767 int id = pdev->id % ARRAY_SIZE(pdata->ldo);
768 struct wm831x_ldo *ldo;
769 struct resource *res;
772 dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
774 if (pdata == NULL || pdata->ldo[id] == NULL)
777 ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL);
779 dev_err(&pdev->dev, "Unable to allocate private data\n");
783 ldo->wm831x = wm831x;
785 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
787 dev_err(&pdev->dev, "No I/O resource\n");
791 ldo->base = res->start;
793 snprintf(ldo->name, sizeof(ldo->name), "LDO%d", id + 1);
794 ldo->desc.name = ldo->name;
796 ldo->desc.type = REGULATOR_VOLTAGE;
797 ldo->desc.n_voltages = WM831X_ALIVE_LDO_MAX_SELECTOR + 1;
798 ldo->desc.ops = &wm831x_alive_ldo_ops;
799 ldo->desc.owner = THIS_MODULE;
801 ldo->regulator = regulator_register(&ldo->desc, &pdev->dev,
802 pdata->ldo[id], ldo);
803 if (IS_ERR(ldo->regulator)) {
804 ret = PTR_ERR(ldo->regulator);
805 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
810 platform_set_drvdata(pdev, ldo);
819 static __devexit int wm831x_alive_ldo_remove(struct platform_device *pdev)
821 struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
823 regulator_unregister(ldo->regulator);
829 static struct platform_driver wm831x_alive_ldo_driver = {
830 .probe = wm831x_alive_ldo_probe,
831 .remove = __devexit_p(wm831x_alive_ldo_remove),
833 .name = "wm831x-alive-ldo",
834 .owner = THIS_MODULE,
838 static int __init wm831x_ldo_init(void)
842 ret = platform_driver_register(&wm831x_gp_ldo_driver);
844 pr_err("Failed to register WM831x GP LDO driver: %d\n", ret);
846 ret = platform_driver_register(&wm831x_aldo_driver);
848 pr_err("Failed to register WM831x ALDO driver: %d\n", ret);
850 ret = platform_driver_register(&wm831x_alive_ldo_driver);
852 pr_err("Failed to register WM831x alive LDO driver: %d\n",
857 subsys_initcall(wm831x_ldo_init);
859 static void __exit wm831x_ldo_exit(void)
861 platform_driver_unregister(&wm831x_alive_ldo_driver);
862 platform_driver_unregister(&wm831x_aldo_driver);
863 platform_driver_unregister(&wm831x_gp_ldo_driver);
865 module_exit(wm831x_ldo_exit);
867 /* Module information */
868 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
869 MODULE_DESCRIPTION("WM831x LDO driver");
870 MODULE_LICENSE("GPL");
871 MODULE_ALIAS("platform:wm831x-ldo");
872 MODULE_ALIAS("platform:wm831x-aldo");
873 MODULE_ALIAS("platform:wm831x-aliveldo");