diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-17 11:08:36 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-17 11:08:36 -0500 |
| commit | 22a80593598736e33080c6877be6ae99ec091e02 (patch) | |
| tree | 9cc8a0c1b982aa7194ff46a5b176fb4cae87051a | |
| parent | 5a865c0606eb44d5d12cabb429751c83712183de (diff) | |
| parent | 6f17c65240e35ae99319c659c74d54100a832f45 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6: (27 commits)
regulator: wm831x_reg_read() failure unnoticed in wm831x_aldo_get_mode()
twl-regulator: Fix reg_disable functionality for 4030 and 6030
twl-regulator: Add turnon delay to reg_enable
twl-regulator: Restore REMAP configuration in regulator probe
twl-regulator: Add turnon-delay and REMAP config to twlreg_info struct
twl-regulator: Define critical regulators as always_on
twl-regulator: Add all twl4030 regulators to twlreg_info
regulator: mc13783-regulator: correct the probing time.
regulator: Fix unbalanced disables/enables in regulator_bulk_{enable,disable} error path
regulator: core.c: Small coding style cleanup (indentation fixup)
drivers/regulator: use PTR_ERR to get error code
regulator: consumer.h - fix build when consumer.h is #included first.
regulator/mc13783: various cleanups
regulator/mc13783: rename source file to match other drivers
Fix some AB3100 regulator issues
regulator: keep index within bounds in da9034_get_ldo12_voltage()
regulator: Ensure val is initialised in 88pm8607 choose_voltage()
regulator: Remove duplicate consts from ab3100
regulator: Handle regulators without suspend mode configuration
regulator: Factor out regulator name pretty printing
...
| -rw-r--r-- | drivers/regulator/88pm8607.c | 685 | ||||
| -rw-r--r-- | drivers/regulator/Kconfig | 13 | ||||
| -rw-r--r-- | drivers/regulator/Makefile | 4 | ||||
| -rw-r--r-- | drivers/regulator/ab3100.c | 33 | ||||
| -rw-r--r-- | drivers/regulator/core.c | 248 | ||||
| -rw-r--r-- | drivers/regulator/da903x.c | 2 | ||||
| -rw-r--r-- | drivers/regulator/lp3971.c | 4 | ||||
| -rw-r--r-- | drivers/regulator/max8660.c | 510 | ||||
| -rw-r--r-- | drivers/regulator/mc13783-regulator.c | 245 | ||||
| -rw-r--r-- | drivers/regulator/mc13783.c | 410 | ||||
| -rw-r--r-- | drivers/regulator/twl-regulator.c | 147 | ||||
| -rw-r--r-- | drivers/regulator/wm831x-dcdc.c | 207 | ||||
| -rw-r--r-- | drivers/regulator/wm831x-ldo.c | 2 | ||||
| -rw-r--r-- | include/linux/mfd/wm831x/pdata.h | 17 | ||||
| -rw-r--r-- | include/linux/regulator/consumer.h | 2 | ||||
| -rw-r--r-- | include/linux/regulator/machine.h | 6 | ||||
| -rw-r--r-- | include/linux/regulator/max8660.h | 57 |
17 files changed, 1981 insertions, 611 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c new file mode 100644 index 000000000000..04719551381b --- /dev/null +++ b/drivers/regulator/88pm8607.c | |||
| @@ -0,0 +1,685 @@ | |||
| 1 | /* | ||
| 2 | * Regulators driver for Marvell 88PM8607 | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Marvell International Ltd. | ||
| 5 | * Haojian Zhuang <haojian.zhuang@marvell.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #include <linux/kernel.h> | ||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/err.h> | ||
| 14 | #include <linux/platform_device.h> | ||
| 15 | #include <linux/regulator/driver.h> | ||
| 16 | #include <linux/regulator/machine.h> | ||
| 17 | #include <linux/mfd/88pm8607.h> | ||
| 18 | |||
| 19 | struct pm8607_regulator_info { | ||
| 20 | struct regulator_desc desc; | ||
| 21 | struct pm8607_chip *chip; | ||
| 22 | struct regulator_dev *regulator; | ||
| 23 | |||
| 24 | int min_uV; | ||
| 25 | int max_uV; | ||
| 26 | int step_uV; | ||
| 27 | int vol_reg; | ||
| 28 | int vol_shift; | ||
| 29 | int vol_nbits; | ||
| 30 | int update_reg; | ||
| 31 | int update_bit; | ||
| 32 | int enable_reg; | ||
| 33 | int enable_bit; | ||
| 34 | int slope_double; | ||
| 35 | }; | ||
| 36 | |||
| 37 | static inline int check_range(struct pm8607_regulator_info *info, | ||
| 38 | int min_uV, int max_uV) | ||
| 39 | { | ||
| 40 | if (max_uV < info->min_uV || min_uV > info->max_uV || min_uV > max_uV) | ||
| 41 | return -EINVAL; | ||
| 42 | |||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) | ||
| 47 | { | ||
| 48 | struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); | ||
| 49 | uint8_t chip_id = info->chip->chip_id; | ||
| 50 | int ret = -EINVAL; | ||
| 51 | |||
| 52 | switch (info->desc.id) { | ||
| 53 | case PM8607_ID_BUCK1: | ||
| 54 | ret = (index < 0x1d) ? (index * 25000 + 800000) : | ||
| 55 | ((index < 0x20) ? 1500000 : | ||
| 56 | ((index < 0x40) ? ((index - 0x20) * 25000) : | ||
| 57 | -EINVAL)); | ||
| 58 | break; | ||
| 59 | case PM8607_ID_BUCK3: | ||
| 60 | ret = (index < 0x3d) ? (index * 25000) : | ||
| 61 | ((index < 0x40) ? 1500000 : -EINVAL); | ||
| 62 | if (ret < 0) | ||
| 63 | break; | ||
| 64 | if (info->slope_double) | ||
| 65 | ret <<= 1; | ||
| 66 | break; | ||
| 67 | case PM8607_ID_LDO1: | ||
| 68 | ret = (index == 0) ? 1800000 : | ||
| 69 | ((index == 1) ? 1200000 : | ||
| 70 | ((index == 2) ? 2800000 : -EINVAL)); | ||
| 71 | break; | ||
| 72 | case PM8607_ID_LDO5: | ||
| 73 | ret = (index == 0) ? 2900000 : | ||
| 74 | ((index == 1) ? 3000000 : | ||
| 75 | ((index == 2) ? 3100000 : 3300000)); | ||
| 76 | break; | ||
| 77 | case PM8607_ID_LDO7: | ||
| 78 | case PM8607_ID_LDO8: | ||
| 79 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
| 80 | ((index < 8) ? (index * 50000 + 2550000) : | ||
| 81 | -EINVAL); | ||
| 82 | break; | ||
| 83 | case PM8607_ID_LDO12: | ||
| 84 | ret = (index < 2) ? (index * 100000 + 1800000) : | ||
| 85 | ((index < 7) ? (index * 100000 + 2500000) : | ||
| 86 | ((index == 7) ? 3300000 : 1200000)); | ||
| 87 | break; | ||
| 88 | case PM8607_ID_LDO2: | ||
| 89 | case PM8607_ID_LDO3: | ||
| 90 | case PM8607_ID_LDO9: | ||
| 91 | switch (chip_id) { | ||
| 92 | case PM8607_CHIP_A0: | ||
| 93 | case PM8607_CHIP_A1: | ||
| 94 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
| 95 | ((index < 8) ? (index * 50000 + 2550000) : | ||
| 96 | -EINVAL); | ||
| 97 | break; | ||
| 98 | case PM8607_CHIP_B0: | ||
| 99 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
| 100 | ((index < 7) ? (index * 50000 + 2550000) : | ||
| 101 | 3300000); | ||
| 102 | break; | ||
| 103 | } | ||
| 104 | break; | ||
| 105 | case PM8607_ID_LDO4: | ||
| 106 | switch (chip_id) { | ||
| 107 | case PM8607_CHIP_A0: | ||
| 108 | case PM8607_CHIP_A1: | ||
| 109 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
| 110 | ((index < 8) ? (index * 50000 + 2550000) : | ||
| 111 | -EINVAL); | ||
| 112 | break; | ||
| 113 | case PM8607_CHIP_B0: | ||
| 114 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
| 115 | ((index < 6) ? (index * 50000 + 2550000) : | ||
| 116 | ((index == 6) ? 2900000 : 3300000)); | ||
| 117 | break; | ||
| 118 | } | ||
| 119 | break; | ||
| 120 | case PM8607_ID_LDO6: | ||
| 121 | switch (chip_id) { | ||
| 122 | case PM8607_CHIP_A0: | ||
| 123 | case PM8607_CHIP_A1: | ||
| 124 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
| 125 | ((index < 8) ? (index * 50000 + 2450000) : | ||
| 126 | -EINVAL); | ||
| 127 | break; | ||
| 128 | case PM8607_CHIP_B0: | ||
| 129 | ret = (index < 2) ? (index * 50000 + 1800000) : | ||
| 130 | ((index < 7) ? (index * 50000 + 2500000) : | ||
| 131 | 3300000); | ||
| 132 | break; | ||
| 133 | } | ||
| 134 | break; | ||
| 135 | case PM8607_ID_LDO10: | ||
| 136 | switch (chip_id) { | ||
| 137 | case PM8607_CHIP_A0: | ||
| 138 | case PM8607_CHIP_A1: | ||
| 139 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
| 140 | ((index < 8) ? (index * 50000 + 2550000) : | ||
| 141 | 1200000); | ||
| 142 | break; | ||
| 143 | case PM8607_CHIP_B0: | ||
| 144 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
| 145 | ((index < 7) ? (index * 50000 + 2550000) : | ||
| 146 | ((index == 7) ? 3300000 : 1200000)); | ||
| 147 | break; | ||
| 148 | } | ||
| 149 | break; | ||
| 150 | case PM8607_ID_LDO14: | ||
| 151 | switch (chip_id) { | ||
| 152 | case PM8607_CHIP_A0: | ||
| 153 | case PM8607_CHIP_A1: | ||
| 154 | ret = (index < 3) ? (index * 50000 + 1800000) : | ||
| 155 | ((index < 8) ? (index * 50000 + 2550000) : | ||
| 156 | -EINVAL); | ||
| 157 | break; | ||
| 158 | case PM8607_CHIP_B0: | ||
| 159 | ret = (index < 2) ? (index * 50000 + 1800000) : | ||
| 160 | ((index < 7) ? (index * 50000 + 2600000) : | ||
| 161 | 3300000); | ||
