2 * Driver for Regulator part of Palmas PMIC Chips
4 * Copyright 2011-2012 Texas Instruments Inc.
6 * Author: Graeme Gregory <gg@slimlogic.co.uk>
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.
15 #include <linux/kernel.h>
16 #include <linux/module.h>
17 #include <linux/init.h>
18 #include <linux/err.h>
19 #include <linux/platform_device.h>
20 #include <linux/regulator/driver.h>
21 #include <linux/regulator/machine.h>
22 #include <linux/slab.h>
23 #include <linux/regmap.h>
24 #include <linux/mfd/palmas.h>
26 #include <linux/of_platform.h>
27 #include <linux/regulator/of_regulator.h>
36 static const struct regs_info palmas_regs_info[] = {
39 .vsel_addr = PALMAS_SMPS12_VOLTAGE,
40 .ctrl_addr = PALMAS_SMPS12_CTRL,
41 .tstep_addr = PALMAS_SMPS12_TSTEP,
45 .vsel_addr = PALMAS_SMPS12_VOLTAGE,
46 .ctrl_addr = PALMAS_SMPS12_CTRL,
47 .tstep_addr = PALMAS_SMPS12_TSTEP,
51 .vsel_addr = PALMAS_SMPS3_VOLTAGE,
52 .ctrl_addr = PALMAS_SMPS3_CTRL,
56 .vsel_addr = PALMAS_SMPS45_VOLTAGE,
57 .ctrl_addr = PALMAS_SMPS45_CTRL,
58 .tstep_addr = PALMAS_SMPS45_TSTEP,
62 .vsel_addr = PALMAS_SMPS45_VOLTAGE,
63 .ctrl_addr = PALMAS_SMPS45_CTRL,
64 .tstep_addr = PALMAS_SMPS45_TSTEP,
68 .vsel_addr = PALMAS_SMPS6_VOLTAGE,
69 .ctrl_addr = PALMAS_SMPS6_CTRL,
70 .tstep_addr = PALMAS_SMPS6_TSTEP,
74 .vsel_addr = PALMAS_SMPS7_VOLTAGE,
75 .ctrl_addr = PALMAS_SMPS7_CTRL,
79 .vsel_addr = PALMAS_SMPS8_VOLTAGE,
80 .ctrl_addr = PALMAS_SMPS8_CTRL,
81 .tstep_addr = PALMAS_SMPS8_TSTEP,
85 .vsel_addr = PALMAS_SMPS9_VOLTAGE,
86 .ctrl_addr = PALMAS_SMPS9_CTRL,
93 .vsel_addr = PALMAS_LDO1_VOLTAGE,
94 .ctrl_addr = PALMAS_LDO1_CTRL,
98 .vsel_addr = PALMAS_LDO2_VOLTAGE,
99 .ctrl_addr = PALMAS_LDO2_CTRL,
103 .vsel_addr = PALMAS_LDO3_VOLTAGE,
104 .ctrl_addr = PALMAS_LDO3_CTRL,
108 .vsel_addr = PALMAS_LDO4_VOLTAGE,
109 .ctrl_addr = PALMAS_LDO4_CTRL,
113 .vsel_addr = PALMAS_LDO5_VOLTAGE,
114 .ctrl_addr = PALMAS_LDO5_CTRL,
118 .vsel_addr = PALMAS_LDO6_VOLTAGE,
119 .ctrl_addr = PALMAS_LDO6_CTRL,
123 .vsel_addr = PALMAS_LDO7_VOLTAGE,
124 .ctrl_addr = PALMAS_LDO7_CTRL,
128 .vsel_addr = PALMAS_LDO8_VOLTAGE,
129 .ctrl_addr = PALMAS_LDO8_CTRL,
133 .vsel_addr = PALMAS_LDO9_VOLTAGE,
134 .ctrl_addr = PALMAS_LDO9_CTRL,
138 .vsel_addr = PALMAS_LDOLN_VOLTAGE,
139 .ctrl_addr = PALMAS_LDOLN_CTRL,
143 .vsel_addr = PALMAS_LDOUSB_VOLTAGE,
144 .ctrl_addr = PALMAS_LDOUSB_CTRL,
148 #define SMPS_CTRL_MODE_OFF 0x00
149 #define SMPS_CTRL_MODE_ON 0x01
150 #define SMPS_CTRL_MODE_ECO 0x02
151 #define SMPS_CTRL_MODE_PWM 0x03
153 /* These values are derived from the data sheet. And are the number of steps
154 * where there is a voltage change, the ranges at beginning and end of register
155 * max/min values where there are no change are ommitted.
157 * So they are basically (maxV-minV)/stepV
159 #define PALMAS_SMPS_NUM_VOLTAGES 116
160 #define PALMAS_SMPS10_NUM_VOLTAGES 2
161 #define PALMAS_LDO_NUM_VOLTAGES 50
163 #define SMPS10_VSEL (1<<3)
164 #define SMPS10_BOOST_EN (1<<2)
165 #define SMPS10_BYPASS_EN (1<<1)
166 #define SMPS10_SWITCH_EN (1<<0)
168 #define REGULATOR_SLAVE 0
170 static int palmas_smps_read(struct palmas *palmas, unsigned int reg,
175 addr = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, reg);
177 return regmap_read(palmas->regmap[REGULATOR_SLAVE], addr, dest);
180 static int palmas_smps_write(struct palmas *palmas, unsigned int reg,
185 addr = PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, reg);
187 return regmap_write(palmas->regmap[REGULATOR_SLAVE], addr, value);
190 static int palmas_ldo_read(struct palmas *palmas, unsigned int reg,
195 addr = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE, reg);
197 return regmap_read(palmas->regmap[REGULATOR_SLAVE], addr, dest);
200 static int palmas_ldo_write(struct palmas *palmas, unsigned int reg,
205 addr = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE, reg);
207 return regmap_write(palmas->regmap[REGULATOR_SLAVE], addr, value);
210 static int palmas_is_enabled_smps(struct regulator_dev *dev)
212 struct palmas_pmic *pmic = rdev_get_drvdata(dev);
213 int id = rdev_get_id(dev);
216 palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®);
218 reg &= PALMAS_SMPS12_CTRL_STATUS_MASK;
219 reg >>= PALMAS_SMPS12_CTRL_STATUS_SHIFT;
224 static int palmas_enable_smps(struct regulator_dev *dev)
226 struct palmas_pmic *pmic = rdev_get_drvdata(dev);
227 int id = rdev_get_id(dev);
230 palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®);
232 reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK;
233 reg |= SMPS_CTRL_MODE_ON;
235 palmas_smps_write(pmic->palmas, palmas_regs_info[id].ctrl_addr, reg);
240 static int palmas_disable_smps(struct regulator_dev *dev)
242 struct palmas_pmic *pmic = rdev_get_drvdata(dev);
243 int id = rdev_get_id(dev);
246 palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®);
248 reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK;
250 palmas_smps_write(pmic->palmas, palmas_regs_info[id].ctrl_addr, reg);
256 static int palmas_set_mode_smps(struct regulator_dev *dev, unsigned int mode)
258 struct palmas_pmic *pmic = rdev_get_drvdata(dev);
259 int id = rdev_get_id(dev);
262 palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®);
263 reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK;
266 case REGULATOR_MODE_NORMAL:
267 reg |= SMPS_CTRL_MODE_ON;
269 case REGULATOR_MODE_IDLE:
270 reg |= SMPS_CTRL_MODE_ECO;
272 case REGULATOR_MODE_FAST:
273 reg |= SMPS_CTRL_MODE_PWM;
278 palmas_smps_write(pmic->palmas, palmas_regs_info[id].ctrl_addr, reg);
283 static unsigned int palmas_get_mode_smps(struct regulator_dev *dev)
285 struct palmas_pmic *pmic = rdev_get_drvdata(dev);
286 int id = rdev_get_id(dev);
289 palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®);
290 reg &= PALMAS_SMPS12_CTRL_STATUS_MASK;
291 reg >>= PALMAS_SMPS12_CTRL_STATUS_SHIFT;
294 case SMPS_CTRL_MODE_ON:
295 return REGULATOR_MODE_NORMAL;
296 case SMPS_CTRL_MODE_ECO:
297 return REGULATOR_MODE_IDLE;
298 case SMPS_CTRL_MODE_PWM:
299 return REGULATOR_MODE_FAST;
305 static int palmas_list_voltage_smps(struct regulator_dev *dev,
308 struct palmas_pmic *pmic = rdev_get_drvdata(dev);
309 int id = rdev_get_id(dev);
315 /* Read the multiplier set in VSEL register to return
316 * the correct voltage.
321 /* Voltage is (0.49V + (selector * 0.01V)) * RANGE
322 * as defined in data sheet. RANGE is either x1 or x2
324 return (490000 + (selector * 10000)) * mult;
327 static int palmas_get_voltage_smps_sel(struct regulator_dev *dev)
329 struct palmas_pmic *pmic = rdev_get_drvdata(dev);
330 int id = rdev_get_id(dev);
335 addr = palmas_regs_info[id].vsel_addr;
337 palmas_smps_read(pmic->palmas, addr, ®);
339 selector = reg & PALMAS_SMPS12_VOLTAGE_VSEL_MASK;
341 /* Adjust selector to match list_voltage ranges */
342 if ((selector > 0) && (selector < 6))
353 static int palmas_set_voltage_smps_sel(struct regulator_dev *dev,
356 struct palmas_pmic *pmic = rdev_get_drvdata(dev);
357 int id = rdev_get_id(dev);
358 unsigned int reg = 0;
361 addr = palmas_regs_info[id].vsel_addr;
363 /* Make sure we don't change the value of RANGE */
365 reg |= PALMAS_SMPS12_VOLTAGE_RANGE;
367 /* Adjust the linux selector into range used in VSEL register */
371 palmas_smps_write(pmic->palmas, addr, reg);
376 static int palmas_map_voltage_smps(struct regulator_dev *rdev,
377 int min_uV, int max_uV)
379 struct palmas_pmic *pmic = rdev_get_drvdata(rdev);
380 int id = rdev_get_id(rdev);
386 if (pmic->range[id]) { /* RANGE is x2 */
387 if (min_uV < 1000000)
389 ret = DIV_ROUND_UP(min_uV - 1000000, 20000) + 1;
390 } else { /* RANGE is x1 */
393 ret = DIV_ROUND_UP(min_uV - 500000, 10000) + 1;
396 /* Map back into a voltage to verify we're still in bounds */
397 voltage = palmas_list_voltage_smps(rdev, ret);
398 if (voltage < min_uV || voltage > max_uV)
404 static struct regulator_ops palmas_ops_smps = {
405 .is_enabled = palmas_is_enabled_smps,
406 .enable = palmas_enable_smps,
407 .disable = palmas_disable_smps,
408 .set_mode = palmas_set_mode_smps,
409 .get_mode = palmas_get_mode_smps,
410 .get_voltage_sel = palmas_get_voltage_smps_sel,
411 .set_voltage_sel = palmas_set_voltage_smps_sel,
412 .list_voltage = palmas_list_voltage_smps,
413 .map_voltage = palmas_map_voltage_smps,
416 static struct regulator_ops palmas_ops_smps10 = {
417 .is_enabled = regulator_is_enabled_regmap,
418 .enable = regulator_enable_regmap,
419 .disable = regulator_disable_regmap,
420 .get_voltage_sel = regulator_get_voltage_sel_regmap,
421 .set_voltage_sel = regulator_set_voltage_sel_regmap,
422 .list_voltage = regulator_list_voltage_linear,
423 .map_voltage = regulator_map_voltage_linear,
426 static int palmas_is_enabled_ldo(struct regulator_dev *dev)
428 struct palmas_pmic *pmic = rdev_get_drvdata(dev);
429 int id = rdev_get_id(dev);
432 palmas_ldo_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, ®);
434 reg &= PALMAS_LDO1_CTRL_STATUS;
439 static int palmas_list_voltage_ldo(struct regulator_dev *dev,
445 /* voltage is 0.85V + (selector * 0.05v) */
446 return 850000 + (selector * 50000);
449 static int palmas_map_voltage_ldo(struct regulator_dev *rdev,
450 int min_uV, int max_uV)
459 ret = DIV_ROUND_UP(min_uV - 900000, 50000) + 1;
461 /* Map back into a voltage to verify we're still in bounds */
462 voltage = palmas_list_voltage_ldo(rdev, ret);
463 if (voltage < min_uV || voltage > max_uV)
469 static struct regulator_ops palmas_ops_ldo = {
470 .is_enabled = palmas_is_enabled_ldo,
471 .enable = regulator_enable_regmap,
472 .disable = regulator_disable_regmap,
473 .get_voltage_sel = regulator_get_voltage_sel_regmap,
474 .set_voltage_sel = regulator_set_voltage_sel_regmap,
475 .list_voltage = palmas_list_voltage_ldo,
476 .map_voltage = palmas_map_voltage_ldo,
480 * setup the hardware based sleep configuration of the SMPS/LDO regulators
481 * from the platform data. This is different to the software based control
482 * supported by the regulator framework as it is controlled by toggling
483 * pins on the PMIC such as PREQ, SYSEN, ...
485 static int palmas_smps_init(struct palmas *palmas, int id,
486 struct palmas_reg_init *reg_init)
492 addr = palmas_regs_info[id].ctrl_addr;
494 ret = palmas_smps_read(palmas, addr, ®);
499 case PALMAS_REG_SMPS10:
500 if (reg_init->mode_sleep) {
501 reg &= ~PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK;
502 reg |= reg_init->mode_sleep <<
503 PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT;
507 if (reg_init->warm_reset)
508 reg |= PALMAS_SMPS12_CTRL_WR_S;
510 if (reg_init->roof_floor)
511 reg |= PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN;
513 if (reg_init->mode_sleep) {
514 reg &= ~PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK;
515 reg |= reg_init->mode_sleep <<
516 PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT;
520 ret = palmas_smps_write(palmas, addr, reg);
524 if (palmas_regs_info[id].tstep_addr && reg_init->tstep) {
525 addr = palmas_regs_info[id].tstep_addr;
527 reg = reg_init->tstep & PALMAS_SMPS12_TSTEP_TSTEP_MASK;
529 ret = palmas_smps_write(palmas, addr, reg);
534 if (palmas_regs_info[id].vsel_addr && reg_init->vsel) {
535 addr = palmas_regs_info[id].vsel_addr;
537 reg = reg_init->vsel;
539 ret = palmas_smps_write(palmas, addr, reg);
548 static int palmas_ldo_init(struct palmas *palmas, int id,
549 struct palmas_reg_init *reg_init)
555 addr = palmas_regs_info[id].ctrl_addr;
557 ret = palmas_ldo_read(palmas, addr, ®);
561 if (reg_init->warm_reset)
562 reg |= PALMAS_LDO1_CTRL_WR_S;
564 if (reg_init->mode_sleep)
565 reg |= PALMAS_LDO1_CTRL_MODE_SLEEP;
567 ret = palmas_ldo_write(palmas, addr, reg);
574 static struct of_regulator_match palmas_matches[] = {
575 { .name = "smps12", },
576 { .name = "smps123", },
577 { .name = "smps3", },
578 { .name = "smps45", },
579 { .name = "smps457", },
580 { .name = "smps6", },
581 { .name = "smps7", },
582 { .name = "smps8", },
583 { .name = "smps9", },
584 { .name = "smps10", },
594 { .name = "ldoln", },
595 { .name = "ldousb", },
598 static void __devinit palmas_dt_to_pdata(struct device *dev,
599 struct device_node *node,
600 struct palmas_pmic_platform_data *pdata)
602 struct device_node *regulators;
606 regulators = of_find_node_by_name(node, "regulators");
608 dev_info(dev, "regulator node not found\n");
612 ret = of_regulator_match(dev, regulators, palmas_matches,
615 dev_err(dev, "Error parsing regulator init data: %d\n", ret);
619 for (idx = 0; idx < PALMAS_NUM_REGS; idx++) {
620 if (!palmas_matches[idx].init_data ||
621 !palmas_matches[idx].of_node)
624 pdata->reg_data[idx] = palmas_matches[idx].init_data;
626 pdata->reg_init[idx] = devm_kzalloc(dev,
627 sizeof(struct palmas_reg_init), GFP_KERNEL);
629 ret = of_property_read_u32(palmas_matches[idx].of_node,
630 "ti,warm_reset", &prop);
632 pdata->reg_init[idx]->warm_reset = prop;
634 ret = of_property_read_u32(palmas_matches[idx].of_node,
635 "ti,roof_floor", &prop);
637 pdata->reg_init[idx]->roof_floor = prop;
639 ret = of_property_read_u32(palmas_matches[idx].of_node,
640 "ti,mode_sleep", &prop);
642 pdata->reg_init[idx]->mode_sleep = prop;
644 ret = of_property_read_u32(palmas_matches[idx].of_node,
645 "ti,warm_reset", &prop);
647 pdata->reg_init[idx]->warm_reset = prop;
649 ret = of_property_read_u32(palmas_matches[idx].of_node,
652 pdata->reg_init[idx]->tstep = prop;
654 ret = of_property_read_u32(palmas_matches[idx].of_node,
657 pdata->reg_init[idx]->vsel = prop;
660 ret = of_property_read_u32(node, "ti,ldo6_vibrator", &prop);
662 pdata->ldo6_vibrator = prop;
666 static __devinit int palmas_probe(struct platform_device *pdev)
668 struct palmas *palmas = dev_get_drvdata(pdev->dev.parent);
669 struct palmas_pmic_platform_data *pdata = pdev->dev.platform_data;
670 struct device_node *node = pdev->dev.of_node;
671 struct regulator_dev *rdev;
672 struct regulator_config config = { };
673 struct palmas_pmic *pmic;
674 struct palmas_reg_init *reg_init;
676 unsigned int addr, reg;
678 if (node && !pdata) {
679 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
684 palmas_dt_to_pdata(&pdev->dev, node, pdata);
687 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
691 pmic->dev = &pdev->dev;
692 pmic->palmas = palmas;
694 platform_set_drvdata(pdev, pmic);
696 ret = palmas_smps_read(palmas, PALMAS_SMPS_CTRL, ®);
700 if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN)
703 if (reg & PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN)
706 config.regmap = palmas->regmap[REGULATOR_SLAVE];
707 config.dev = &pdev->dev;
708 config.driver_data = pmic;
710 for (id = 0; id < PALMAS_REG_LDO1; id++) {
713 * Miss out regulators which are not available due
714 * to slaving configurations.
717 case PALMAS_REG_SMPS12:
718 case PALMAS_REG_SMPS3:
722 case PALMAS_REG_SMPS123:
726 case PALMAS_REG_SMPS45:
727 case PALMAS_REG_SMPS7:
731 case PALMAS_REG_SMPS457:
736 /* Register the regulators */
737 pmic->desc[id].name = palmas_regs_info[id].name;
738 pmic->desc[id].id = id;
741 case PALMAS_REG_SMPS10:
742 pmic->desc[id].n_voltages = PALMAS_SMPS10_NUM_VOLTAGES;
743 pmic->desc[id].ops = &palmas_ops_smps10;
744 pmic->desc[id].vsel_reg =
745 PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
747 pmic->desc[id].vsel_mask = SMPS10_VSEL;
748 pmic->desc[id].enable_reg =
749 PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
750 PALMAS_SMPS10_STATUS);
751 pmic->desc[id].enable_mask = SMPS10_BOOST_EN;
752 pmic->desc[id].min_uV = 3750000;
753 pmic->desc[id].uV_step = 1250000;
756 pmic->desc[id].ops = &palmas_ops_smps;
757 pmic->desc[id].n_voltages = PALMAS_SMPS_NUM_VOLTAGES;
760 pmic->desc[id].type = REGULATOR_VOLTAGE;
761 pmic->desc[id].owner = THIS_MODULE;
763 /* Initialise sleep/init values from platform data */
765 reg_init = pdata->reg_init[id];
767 ret = palmas_smps_init(palmas, id, reg_init);
769 goto err_unregister_regulator;
774 * read and store the RANGE bit for later use
775 * This must be done before regulator is probed otherwise
776 * we error in probe with unsuportable ranges.
778 if (id != PALMAS_REG_SMPS10) {
779 addr = palmas_regs_info[id].vsel_addr;
781 ret = palmas_smps_read(pmic->palmas, addr, ®);
783 goto err_unregister_regulator;
784 if (reg & PALMAS_SMPS12_VOLTAGE_RANGE)
789 config.init_data = pdata->reg_data[id];
791 config.init_data = NULL;
793 config.of_node = palmas_matches[id].of_node;
795 rdev = regulator_register(&pmic->desc[id], &config);
798 "failed to register %s regulator\n",
801 goto err_unregister_regulator;
804 /* Save regulator for cleanup */
805 pmic->rdev[id] = rdev;
808 /* Start this loop from the id left from previous loop */
809 for (; id < PALMAS_NUM_REGS; id++) {
811 /* Miss out regulators which are not available due
812 * to alternate functions.
815 /* Register the regulators */
816 pmic->desc[id].name = palmas_regs_info[id].name;
817 pmic->desc[id].id = id;
818 pmic->desc[id].n_voltages = PALMAS_LDO_NUM_VOLTAGES;
820 pmic->desc[id].ops = &palmas_ops_ldo;
822 pmic->desc[id].type = REGULATOR_VOLTAGE;
823 pmic->desc[id].owner = THIS_MODULE;
824 pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE,
825 palmas_regs_info[id].vsel_addr);
826 pmic->desc[id].vsel_mask = PALMAS_LDO1_VOLTAGE_VSEL_MASK;
827 pmic->desc[id].enable_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE,
828 palmas_regs_info[id].ctrl_addr);
829 pmic->desc[id].enable_mask = PALMAS_LDO1_CTRL_MODE_ACTIVE;
832 config.init_data = pdata->reg_data[id];
834 config.init_data = NULL;
836 config.of_node = palmas_matches[id].of_node;
838 rdev = regulator_register(&pmic->desc[id], &config);
841 "failed to register %s regulator\n",
844 goto err_unregister_regulator;
847 /* Save regulator for cleanup */
848 pmic->rdev[id] = rdev;
850 /* Initialise sleep/init values from platform data */
852 reg_init = pdata->reg_init[id];
854 ret = palmas_ldo_init(palmas, id, reg_init);
856 regulator_unregister(pmic->rdev[id]);
857 goto err_unregister_regulator;
865 err_unregister_regulator:
867 regulator_unregister(pmic->rdev[id]);
871 static int __devexit palmas_remove(struct platform_device *pdev)
873 struct palmas_pmic *pmic = platform_get_drvdata(pdev);
876 for (id = 0; id < PALMAS_NUM_REGS; id++)
877 regulator_unregister(pmic->rdev[id]);
881 static struct of_device_id __devinitdata of_palmas_match_tbl[] = {
882 { .compatible = "ti,palmas-pmic", },
886 static struct platform_driver palmas_driver = {
888 .name = "palmas-pmic",
889 .of_match_table = of_palmas_match_tbl,
890 .owner = THIS_MODULE,
892 .probe = palmas_probe,
893 .remove = __devexit_p(palmas_remove),
896 static int __init palmas_init(void)
898 return platform_driver_register(&palmas_driver);
900 subsys_initcall(palmas_init);
902 static void __exit palmas_exit(void)
904 platform_driver_unregister(&palmas_driver);
906 module_exit(palmas_exit);
908 MODULE_AUTHOR("Graeme Gregory <gg@slimlogic.co.uk>");
909 MODULE_DESCRIPTION("Palmas voltage regulator driver");
910 MODULE_LICENSE("GPL");
911 MODULE_ALIAS("platform:palmas-pmic");
912 MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);