Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 1 | /* |
| 2 | * tps6507x-regulator.c |
| 3 | * |
| 4 | * Regulator driver for TPS65073 PMIC |
| 5 | * |
| 6 | * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/ |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation version 2. |
| 11 | * |
| 12 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind, |
| 13 | * whether express or implied; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | */ |
| 17 | |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/module.h> |
| 20 | #include <linux/init.h> |
| 21 | #include <linux/err.h> |
| 22 | #include <linux/platform_device.h> |
| 23 | #include <linux/regulator/driver.h> |
| 24 | #include <linux/regulator/machine.h> |
| 25 | #include <linux/i2c.h> |
| 26 | #include <linux/delay.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 27 | #include <linux/slab.h> |
Todd Fischer | d183fcc | 2010-04-05 20:23:56 -0600 | [diff] [blame] | 28 | #include <linux/mfd/tps6507x.h> |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 29 | |
| 30 | /* DCDC's */ |
| 31 | #define TPS6507X_DCDC_1 0 |
| 32 | #define TPS6507X_DCDC_2 1 |
| 33 | #define TPS6507X_DCDC_3 2 |
| 34 | /* LDOs */ |
| 35 | #define TPS6507X_LDO_1 3 |
| 36 | #define TPS6507X_LDO_2 4 |
| 37 | |
| 38 | #define TPS6507X_MAX_REG_ID TPS6507X_LDO_2 |
| 39 | |
| 40 | /* Number of step-down converters available */ |
| 41 | #define TPS6507X_NUM_DCDC 3 |
| 42 | /* Number of LDO voltage regulators available */ |
| 43 | #define TPS6507X_NUM_LDO 2 |
| 44 | /* Number of total regulators available */ |
| 45 | #define TPS6507X_NUM_REGULATOR (TPS6507X_NUM_DCDC + TPS6507X_NUM_LDO) |
| 46 | |
| 47 | /* Supported voltage values for regulators (in milliVolts) */ |
| 48 | static const u16 VDCDCx_VSEL_table[] = { |
| 49 | 725, 750, 775, 800, |
| 50 | 825, 850, 875, 900, |
| 51 | 925, 950, 975, 1000, |
| 52 | 1025, 1050, 1075, 1100, |
| 53 | 1125, 1150, 1175, 1200, |
| 54 | 1225, 1250, 1275, 1300, |
| 55 | 1325, 1350, 1375, 1400, |
| 56 | 1425, 1450, 1475, 1500, |
| 57 | 1550, 1600, 1650, 1700, |
| 58 | 1750, 1800, 1850, 1900, |
| 59 | 1950, 2000, 2050, 2100, |
| 60 | 2150, 2200, 2250, 2300, |
| 61 | 2350, 2400, 2450, 2500, |
| 62 | 2550, 2600, 2650, 2700, |
| 63 | 2750, 2800, 2850, 2900, |
| 64 | 3000, 3100, 3200, 3300, |
| 65 | }; |
| 66 | |
| 67 | static const u16 LDO1_VSEL_table[] = { |
| 68 | 1000, 1100, 1200, 1250, |
| 69 | 1300, 1350, 1400, 1500, |
| 70 | 1600, 1800, 2500, 2750, |
| 71 | 2800, 3000, 3100, 3300, |
| 72 | }; |
| 73 | |
| 74 | static const u16 LDO2_VSEL_table[] = { |
| 75 | 725, 750, 775, 800, |
| 76 | 825, 850, 875, 900, |
| 77 | 925, 950, 975, 1000, |
| 78 | 1025, 1050, 1075, 1100, |
| 79 | 1125, 1150, 1175, 1200, |
| 80 | 1225, 1250, 1275, 1300, |
| 81 | 1325, 1350, 1375, 1400, |
| 82 | 1425, 1450, 1475, 1500, |
| 83 | 1550, 1600, 1650, 1700, |
| 84 | 1750, 1800, 1850, 1900, |
| 85 | 1950, 2000, 2050, 2100, |
| 86 | 2150, 2200, 2250, 2300, |
| 87 | 2350, 2400, 2450, 2500, |
| 88 | 2550, 2600, 2650, 2700, |
| 89 | 2750, 2800, 2850, 2900, |
| 90 | 3000, 3100, 3200, 3300, |
| 91 | }; |
| 92 | |
| 93 | static unsigned int num_voltages[] = {ARRAY_SIZE(VDCDCx_VSEL_table), |
| 94 | ARRAY_SIZE(VDCDCx_VSEL_table), |
| 95 | ARRAY_SIZE(VDCDCx_VSEL_table), |
| 96 | ARRAY_SIZE(LDO1_VSEL_table), |
| 97 | ARRAY_SIZE(LDO2_VSEL_table)}; |
| 98 | |
| 99 | struct tps_info { |
| 100 | const char *name; |
| 101 | unsigned min_uV; |
| 102 | unsigned max_uV; |
| 103 | u8 table_len; |
| 104 | const u16 *table; |
| 105 | }; |
| 106 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 107 | struct tps6507x_pmic { |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 108 | struct regulator_desc desc[TPS6507X_NUM_REGULATOR]; |
| 109 | struct i2c_client *client; |
| 110 | struct regulator_dev *rdev[TPS6507X_NUM_REGULATOR]; |
| 111 | const struct tps_info *info[TPS6507X_NUM_REGULATOR]; |
| 112 | struct mutex io_lock; |
| 113 | }; |
| 114 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 115 | static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 116 | { |
| 117 | return i2c_smbus_read_byte_data(tps->client, reg); |
| 118 | } |
| 119 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 120 | static inline int tps6507x_pmic_write(struct tps6507x_pmic *tps, u8 reg, u8 val) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 121 | { |
| 122 | return i2c_smbus_write_byte_data(tps->client, reg, val); |
| 123 | } |
| 124 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 125 | static int tps6507x_pmic_set_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 126 | { |
| 127 | int err, data; |
| 128 | |
| 129 | mutex_lock(&tps->io_lock); |
| 130 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 131 | data = tps6507x_pmic_read(tps, reg); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 132 | if (data < 0) { |
| 133 | dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg); |
| 134 | err = data; |
| 135 | goto out; |
| 136 | } |
| 137 | |
| 138 | data |= mask; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 139 | err = tps6507x_pmic_write(tps, reg, data); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 140 | if (err) |
| 141 | dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg); |
| 142 | |
| 143 | out: |
| 144 | mutex_unlock(&tps->io_lock); |
| 145 | return err; |
| 146 | } |
| 147 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 148 | static int tps6507x_pmic_clear_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 149 | { |
| 150 | int err, data; |
| 151 | |
| 152 | mutex_lock(&tps->io_lock); |
| 153 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 154 | data = tps6507x_pmic_read(tps, reg); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 155 | if (data < 0) { |
| 156 | dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg); |
| 157 | err = data; |
| 158 | goto out; |
| 159 | } |
| 160 | |
| 161 | data &= ~mask; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 162 | err = tps6507x_pmic_write(tps, reg, data); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 163 | if (err) |
| 164 | dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg); |
| 165 | |
| 166 | out: |
| 167 | mutex_unlock(&tps->io_lock); |
| 168 | return err; |
| 169 | } |
| 170 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 171 | static int tps6507x_pmic_reg_read(struct tps6507x_pmic *tps, u8 reg) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 172 | { |
| 173 | int data; |
| 174 | |
| 175 | mutex_lock(&tps->io_lock); |
| 176 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 177 | data = tps6507x_pmic_read(tps, reg); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 178 | if (data < 0) |
| 179 | dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg); |
| 180 | |
| 181 | mutex_unlock(&tps->io_lock); |
| 182 | return data; |
| 183 | } |
| 184 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 185 | static int tps6507x_pmic_reg_write(struct tps6507x_pmic *tps, u8 reg, u8 val) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 186 | { |
| 187 | int err; |
| 188 | |
| 189 | mutex_lock(&tps->io_lock); |
| 190 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 191 | err = tps6507x_pmic_write(tps, reg, val); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 192 | if (err < 0) |
| 193 | dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg); |
| 194 | |
| 195 | mutex_unlock(&tps->io_lock); |
| 196 | return err; |
| 197 | } |
| 198 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 199 | static int tps6507x_pmic_dcdc_is_enabled(struct regulator_dev *dev) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 200 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 201 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 202 | int data, dcdc = rdev_get_id(dev); |
| 203 | u8 shift; |
| 204 | |
| 205 | if (dcdc < TPS6507X_DCDC_1 || dcdc > TPS6507X_DCDC_3) |
| 206 | return -EINVAL; |
| 207 | |
| 208 | shift = TPS6507X_MAX_REG_ID - dcdc; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 209 | data = tps6507x_pmic_reg_read(tps, TPS6507X_REG_CON_CTRL1); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 210 | |
| 211 | if (data < 0) |
| 212 | return data; |
| 213 | else |
| 214 | return (data & 1<<shift) ? 1 : 0; |
| 215 | } |
| 216 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 217 | static int tps6507x_pmic_ldo_is_enabled(struct regulator_dev *dev) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 218 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 219 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 220 | int data, ldo = rdev_get_id(dev); |
| 221 | u8 shift; |
| 222 | |
| 223 | if (ldo < TPS6507X_LDO_1 || ldo > TPS6507X_LDO_2) |
| 224 | return -EINVAL; |
| 225 | |
| 226 | shift = TPS6507X_MAX_REG_ID - ldo; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 227 | data = tps6507x_pmic_reg_read(tps, TPS6507X_REG_CON_CTRL1); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 228 | |
| 229 | if (data < 0) |
| 230 | return data; |
| 231 | else |
| 232 | return (data & 1<<shift) ? 1 : 0; |
| 233 | } |
| 234 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 235 | static int tps6507x_pmic_dcdc_enable(struct regulator_dev *dev) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 236 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 237 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 238 | int dcdc = rdev_get_id(dev); |
| 239 | u8 shift; |
| 240 | |
| 241 | if (dcdc < TPS6507X_DCDC_1 || dcdc > TPS6507X_DCDC_3) |
| 242 | return -EINVAL; |
| 243 | |
| 244 | shift = TPS6507X_MAX_REG_ID - dcdc; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 245 | return tps6507x_pmic_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 246 | } |
| 247 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 248 | static int tps6507x_pmic_dcdc_disable(struct regulator_dev *dev) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 249 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 250 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 251 | int dcdc = rdev_get_id(dev); |
| 252 | u8 shift; |
| 253 | |
| 254 | if (dcdc < TPS6507X_DCDC_1 || dcdc > TPS6507X_DCDC_3) |
| 255 | return -EINVAL; |
| 256 | |
| 257 | shift = TPS6507X_MAX_REG_ID - dcdc; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 258 | return tps6507x_pmic_clear_bits(tps, TPS6507X_REG_CON_CTRL1, |
| 259 | 1 << shift); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 260 | } |
| 261 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 262 | static int tps6507x_pmic_ldo_enable(struct regulator_dev *dev) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 263 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 264 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 265 | int ldo = rdev_get_id(dev); |
| 266 | u8 shift; |
| 267 | |
| 268 | if (ldo < TPS6507X_LDO_1 || ldo > TPS6507X_LDO_2) |
| 269 | return -EINVAL; |
| 270 | |
| 271 | shift = TPS6507X_MAX_REG_ID - ldo; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 272 | return tps6507x_pmic_set_bits(tps, TPS6507X_REG_CON_CTRL1, 1 << shift); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 273 | } |
| 274 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 275 | static int tps6507x_pmic_ldo_disable(struct regulator_dev *dev) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 276 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 277 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 278 | int ldo = rdev_get_id(dev); |
| 279 | u8 shift; |
| 280 | |
| 281 | if (ldo < TPS6507X_LDO_1 || ldo > TPS6507X_LDO_2) |
| 282 | return -EINVAL; |
| 283 | |
| 284 | shift = TPS6507X_MAX_REG_ID - ldo; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 285 | return tps6507x_pmic_clear_bits(tps, TPS6507X_REG_CON_CTRL1, |
| 286 | 1 << shift); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 287 | } |
| 288 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 289 | static int tps6507x_pmic_dcdc_get_voltage(struct regulator_dev *dev) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 290 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 291 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 292 | int data, dcdc = rdev_get_id(dev); |
| 293 | u8 reg; |
| 294 | |
| 295 | switch (dcdc) { |
| 296 | case TPS6507X_DCDC_1: |
| 297 | reg = TPS6507X_REG_DEFDCDC1; |
| 298 | break; |
| 299 | case TPS6507X_DCDC_2: |
| 300 | reg = TPS6507X_REG_DEFDCDC2_LOW; |
| 301 | break; |
| 302 | case TPS6507X_DCDC_3: |
| 303 | reg = TPS6507X_REG_DEFDCDC3_LOW; |
| 304 | break; |
| 305 | default: |
| 306 | return -EINVAL; |
| 307 | } |
| 308 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 309 | data = tps6507x_pmic_reg_read(tps, reg); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 310 | if (data < 0) |
| 311 | return data; |
| 312 | |
| 313 | data &= TPS6507X_DEFDCDCX_DCDC_MASK; |
| 314 | return tps->info[dcdc]->table[data] * 1000; |
| 315 | } |
| 316 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 317 | static int tps6507x_pmic_dcdc_set_voltage(struct regulator_dev *dev, |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 318 | int min_uV, int max_uV) |
| 319 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 320 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 321 | int data, vsel, dcdc = rdev_get_id(dev); |
| 322 | u8 reg; |
| 323 | |
| 324 | switch (dcdc) { |
| 325 | case TPS6507X_DCDC_1: |
| 326 | reg = TPS6507X_REG_DEFDCDC1; |
| 327 | break; |
| 328 | case TPS6507X_DCDC_2: |
| 329 | reg = TPS6507X_REG_DEFDCDC2_LOW; |
| 330 | break; |
| 331 | case TPS6507X_DCDC_3: |
| 332 | reg = TPS6507X_REG_DEFDCDC3_LOW; |
| 333 | break; |
| 334 | default: |
| 335 | return -EINVAL; |
| 336 | } |
| 337 | |
| 338 | if (min_uV < tps->info[dcdc]->min_uV |
| 339 | || min_uV > tps->info[dcdc]->max_uV) |
| 340 | return -EINVAL; |
| 341 | if (max_uV < tps->info[dcdc]->min_uV |
| 342 | || max_uV > tps->info[dcdc]->max_uV) |
| 343 | return -EINVAL; |
| 344 | |
| 345 | for (vsel = 0; vsel < tps->info[dcdc]->table_len; vsel++) { |
| 346 | int mV = tps->info[dcdc]->table[vsel]; |
| 347 | int uV = mV * 1000; |
| 348 | |
| 349 | /* Break at the first in-range value */ |
| 350 | if (min_uV <= uV && uV <= max_uV) |
| 351 | break; |
| 352 | } |
| 353 | |
| 354 | /* write to the register in case we found a match */ |
| 355 | if (vsel == tps->info[dcdc]->table_len) |
| 356 | return -EINVAL; |
| 357 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 358 | data = tps6507x_pmic_reg_read(tps, reg); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 359 | if (data < 0) |
| 360 | return data; |
| 361 | |
| 362 | data &= ~TPS6507X_DEFDCDCX_DCDC_MASK; |
| 363 | data |= vsel; |
| 364 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 365 | return tps6507x_pmic_reg_write(tps, reg, data); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 366 | } |
| 367 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 368 | static int tps6507x_pmic_ldo_get_voltage(struct regulator_dev *dev) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 369 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 370 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 371 | int data, ldo = rdev_get_id(dev); |
| 372 | u8 reg, mask; |
| 373 | |
| 374 | if (ldo < TPS6507X_LDO_1 || ldo > TPS6507X_LDO_2) |
| 375 | return -EINVAL; |
| 376 | else { |
| 377 | reg = (ldo == TPS6507X_LDO_1 ? |
| 378 | TPS6507X_REG_LDO_CTRL1 : TPS6507X_REG_DEFLDO2); |
| 379 | mask = (ldo == TPS6507X_LDO_1 ? |
| 380 | TPS6507X_REG_LDO_CTRL1_LDO1_MASK : |
| 381 | TPS6507X_REG_DEFLDO2_LDO2_MASK); |
| 382 | } |
| 383 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 384 | data = tps6507x_pmic_reg_read(tps, reg); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 385 | if (data < 0) |
| 386 | return data; |
| 387 | |
| 388 | data &= mask; |
| 389 | return tps->info[ldo]->table[data] * 1000; |
| 390 | } |
| 391 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 392 | static int tps6507x_pmic_ldo_set_voltage(struct regulator_dev *dev, |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 393 | int min_uV, int max_uV) |
| 394 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 395 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 396 | int data, vsel, ldo = rdev_get_id(dev); |
| 397 | u8 reg, mask; |
| 398 | |
| 399 | if (ldo < TPS6507X_LDO_1 || ldo > TPS6507X_LDO_2) |
| 400 | return -EINVAL; |
| 401 | else { |
| 402 | reg = (ldo == TPS6507X_LDO_1 ? |
| 403 | TPS6507X_REG_LDO_CTRL1 : TPS6507X_REG_DEFLDO2); |
| 404 | mask = (ldo == TPS6507X_LDO_1 ? |
| 405 | TPS6507X_REG_LDO_CTRL1_LDO1_MASK : |
| 406 | TPS6507X_REG_DEFLDO2_LDO2_MASK); |
| 407 | } |
| 408 | |
| 409 | if (min_uV < tps->info[ldo]->min_uV || min_uV > tps->info[ldo]->max_uV) |
| 410 | return -EINVAL; |
| 411 | if (max_uV < tps->info[ldo]->min_uV || max_uV > tps->info[ldo]->max_uV) |
| 412 | return -EINVAL; |
| 413 | |
| 414 | for (vsel = 0; vsel < tps->info[ldo]->table_len; vsel++) { |
| 415 | int mV = tps->info[ldo]->table[vsel]; |
| 416 | int uV = mV * 1000; |
| 417 | |
| 418 | /* Break at the first in-range value */ |
| 419 | if (min_uV <= uV && uV <= max_uV) |
| 420 | break; |
| 421 | } |
| 422 | |
| 423 | if (vsel == tps->info[ldo]->table_len) |
| 424 | return -EINVAL; |
| 425 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 426 | data = tps6507x_pmic_reg_read(tps, reg); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 427 | if (data < 0) |
| 428 | return data; |
| 429 | |
| 430 | data &= ~mask; |
| 431 | data |= vsel; |
| 432 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 433 | return tps6507x_pmic_reg_write(tps, reg, data); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 434 | } |
| 435 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 436 | static int tps6507x_pmic_dcdc_list_voltage(struct regulator_dev *dev, |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 437 | unsigned selector) |
| 438 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 439 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 440 | int dcdc = rdev_get_id(dev); |
| 441 | |
| 442 | if (dcdc < TPS6507X_DCDC_1 || dcdc > TPS6507X_DCDC_3) |
| 443 | return -EINVAL; |
| 444 | |
| 445 | if (selector >= tps->info[dcdc]->table_len) |
| 446 | return -EINVAL; |
| 447 | else |
| 448 | return tps->info[dcdc]->table[selector] * 1000; |
| 449 | } |
| 450 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 451 | static int tps6507x_pmic_ldo_list_voltage(struct regulator_dev *dev, |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 452 | unsigned selector) |
| 453 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 454 | struct tps6507x_pmic *tps = rdev_get_drvdata(dev); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 455 | int ldo = rdev_get_id(dev); |
| 456 | |
| 457 | if (ldo < TPS6507X_LDO_1 || ldo > TPS6507X_LDO_2) |
| 458 | return -EINVAL; |
| 459 | |
| 460 | if (selector >= tps->info[ldo]->table_len) |
| 461 | return -EINVAL; |
| 462 | else |
| 463 | return tps->info[ldo]->table[selector] * 1000; |
| 464 | } |
| 465 | |
| 466 | /* Operations permitted on VDCDCx */ |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 467 | static struct regulator_ops tps6507x_pmic_dcdc_ops = { |
| 468 | .is_enabled = tps6507x_pmic_dcdc_is_enabled, |
| 469 | .enable = tps6507x_pmic_dcdc_enable, |
| 470 | .disable = tps6507x_pmic_dcdc_disable, |
| 471 | .get_voltage = tps6507x_pmic_dcdc_get_voltage, |
| 472 | .set_voltage = tps6507x_pmic_dcdc_set_voltage, |
| 473 | .list_voltage = tps6507x_pmic_dcdc_list_voltage, |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 474 | }; |
| 475 | |
| 476 | /* Operations permitted on LDOx */ |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 477 | static struct regulator_ops tps6507x_pmic_ldo_ops = { |
| 478 | .is_enabled = tps6507x_pmic_ldo_is_enabled, |
| 479 | .enable = tps6507x_pmic_ldo_enable, |
| 480 | .disable = tps6507x_pmic_ldo_disable, |
| 481 | .get_voltage = tps6507x_pmic_ldo_get_voltage, |
| 482 | .set_voltage = tps6507x_pmic_ldo_set_voltage, |
| 483 | .list_voltage = tps6507x_pmic_ldo_list_voltage, |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 484 | }; |
| 485 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 486 | static int __devinit tps6507x_pmic_probe(struct i2c_client *client, |
Dmitry Torokhov | 56c2349 | 2010-02-23 23:38:12 -0800 | [diff] [blame] | 487 | const struct i2c_device_id *id) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 488 | { |
| 489 | static int desc_id; |
| 490 | const struct tps_info *info = (void *)id->driver_data; |
| 491 | struct regulator_init_data *init_data; |
| 492 | struct regulator_dev *rdev; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 493 | struct tps6507x_pmic *tps; |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 494 | struct tps6507x_board *tps_board; |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 495 | int i; |
Dmitry Torokhov | 56c2349 | 2010-02-23 23:38:12 -0800 | [diff] [blame] | 496 | int error; |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 497 | |
| 498 | if (!i2c_check_functionality(client->adapter, |
| 499 | I2C_FUNC_SMBUS_BYTE_DATA)) |
| 500 | return -EIO; |
| 501 | |
| 502 | /** |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 503 | * tps_board points to pmic related constants |
| 504 | * coming from the board-evm file. |
| 505 | */ |
| 506 | |
| 507 | tps_board = dev_get_platdata(&client->dev); |
| 508 | if (!tps_board) |
| 509 | return -EINVAL; |
| 510 | |
| 511 | /** |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 512 | * init_data points to array of regulator_init structures |
| 513 | * coming from the board-evm file. |
| 514 | */ |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 515 | init_data = tps_board->tps6507x_pmic_init_data; |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 516 | if (!init_data) |
Todd Fischer | 0bc20bb | 2010-04-05 20:23:57 -0600 | [diff] [blame] | 517 | return -EINVAL; |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 518 | |
| 519 | tps = kzalloc(sizeof(*tps), GFP_KERNEL); |
| 520 | if (!tps) |
| 521 | return -ENOMEM; |
| 522 | |
| 523 | mutex_init(&tps->io_lock); |
| 524 | |
| 525 | /* common for all regulators */ |
| 526 | tps->client = client; |
| 527 | |
| 528 | for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) { |
| 529 | /* Register the regulators */ |
| 530 | tps->info[i] = info; |
| 531 | tps->desc[i].name = info->name; |
| 532 | tps->desc[i].id = desc_id++; |
| 533 | tps->desc[i].n_voltages = num_voltages[i]; |
| 534 | tps->desc[i].ops = (i > TPS6507X_DCDC_3 ? |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 535 | &tps6507x_pmic_ldo_ops : &tps6507x_pmic_dcdc_ops); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 536 | tps->desc[i].type = REGULATOR_VOLTAGE; |
| 537 | tps->desc[i].owner = THIS_MODULE; |
| 538 | |
| 539 | rdev = regulator_register(&tps->desc[i], |
| 540 | &client->dev, init_data, tps); |
| 541 | if (IS_ERR(rdev)) { |
| 542 | dev_err(&client->dev, "failed to register %s\n", |
| 543 | id->name); |
Dmitry Torokhov | 56c2349 | 2010-02-23 23:38:12 -0800 | [diff] [blame] | 544 | error = PTR_ERR(rdev); |
| 545 | goto fail; |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | /* Save regulator for cleanup */ |
| 549 | tps->rdev[i] = rdev; |
| 550 | } |
| 551 | |
| 552 | i2c_set_clientdata(client, tps); |
| 553 | |
| 554 | return 0; |
Dmitry Torokhov | 56c2349 | 2010-02-23 23:38:12 -0800 | [diff] [blame] | 555 | |
| 556 | fail: |
| 557 | while (--i >= 0) |
| 558 | regulator_unregister(tps->rdev[i]); |
| 559 | |
| 560 | kfree(tps); |
| 561 | return error; |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 562 | } |
| 563 | |
| 564 | /** |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 565 | * tps6507x_remove - TPS6507x driver i2c remove handler |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 566 | * @client: i2c driver client device structure |
| 567 | * |
| 568 | * Unregister TPS driver as an i2c client device driver |
| 569 | */ |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 570 | static int __devexit tps6507x_pmic_remove(struct i2c_client *client) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 571 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 572 | struct tps6507x_pmic *tps = i2c_get_clientdata(client); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 573 | int i; |
| 574 | |
Dmitry Torokhov | 56c2349 | 2010-02-23 23:38:12 -0800 | [diff] [blame] | 575 | /* clear the client data in i2c */ |
| 576 | i2c_set_clientdata(client, NULL); |
| 577 | |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 578 | for (i = 0; i < TPS6507X_NUM_REGULATOR; i++) |
| 579 | regulator_unregister(tps->rdev[i]); |
| 580 | |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 581 | kfree(tps); |
| 582 | |
| 583 | return 0; |
| 584 | } |
| 585 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 586 | static const struct tps_info tps6507x_pmic_regs[] = { |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 587 | { |
| 588 | .name = "VDCDC1", |
| 589 | .min_uV = 725000, |
| 590 | .max_uV = 3300000, |
| 591 | .table_len = ARRAY_SIZE(VDCDCx_VSEL_table), |
| 592 | .table = VDCDCx_VSEL_table, |
| 593 | }, |
| 594 | { |
| 595 | .name = "VDCDC2", |
| 596 | .min_uV = 725000, |
| 597 | .max_uV = 3300000, |
| 598 | .table_len = ARRAY_SIZE(VDCDCx_VSEL_table), |
| 599 | .table = VDCDCx_VSEL_table, |
| 600 | }, |
| 601 | { |
| 602 | .name = "VDCDC3", |
| 603 | .min_uV = 725000, |
| 604 | .max_uV = 3300000, |
| 605 | .table_len = ARRAY_SIZE(VDCDCx_VSEL_table), |
| 606 | .table = VDCDCx_VSEL_table, |
| 607 | }, |
| 608 | { |
| 609 | .name = "LDO1", |
| 610 | .min_uV = 1000000, |
| 611 | .max_uV = 3300000, |
| 612 | .table_len = ARRAY_SIZE(LDO1_VSEL_table), |
| 613 | .table = LDO1_VSEL_table, |
| 614 | }, |
| 615 | { |
| 616 | .name = "LDO2", |
| 617 | .min_uV = 725000, |
| 618 | .max_uV = 3300000, |
| 619 | .table_len = ARRAY_SIZE(LDO2_VSEL_table), |
| 620 | .table = LDO2_VSEL_table, |
| 621 | }, |
| 622 | }; |
| 623 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 624 | static const struct i2c_device_id tps6507x_pmic_id[] = { |
Liam Girdwood | 9e108d3 | 2009-08-24 10:31:34 +0100 | [diff] [blame] | 625 | {.name = "tps6507x", |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 626 | .driver_data = (unsigned long) tps6507x_pmic_regs,}, |
Liam Girdwood | 9e108d3 | 2009-08-24 10:31:34 +0100 | [diff] [blame] | 627 | { }, |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 628 | }; |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 629 | MODULE_DEVICE_TABLE(i2c, tps6507x_pmic_id); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 630 | |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 631 | static struct i2c_driver tps6507x_i2c_driver = { |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 632 | .driver = { |
| 633 | .name = "tps6507x", |
| 634 | .owner = THIS_MODULE, |
| 635 | }, |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 636 | .probe = tps6507x_pmic_probe, |
| 637 | .remove = __devexit_p(tps6507x_pmic_remove), |
| 638 | .id_table = tps6507x_pmic_id, |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 639 | }; |
| 640 | |
| 641 | /** |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 642 | * tps6507x_pmic_init |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 643 | * |
| 644 | * Module init function |
| 645 | */ |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 646 | static int __init tps6507x_pmic_init(void) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 647 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 648 | return i2c_add_driver(&tps6507x_i2c_driver); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 649 | } |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 650 | subsys_initcall(tps6507x_pmic_init); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 651 | |
| 652 | /** |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 653 | * tps6507x_pmic_cleanup |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 654 | * |
| 655 | * Module exit function |
| 656 | */ |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 657 | static void __exit tps6507x_pmic_cleanup(void) |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 658 | { |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 659 | i2c_del_driver(&tps6507x_i2c_driver); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 660 | } |
Todd Fischer | 4ce5ba5 | 2010-04-05 20:23:58 -0600 | [diff] [blame^] | 661 | module_exit(tps6507x_pmic_cleanup); |
Anuj Aggarwal | 3fa5b8e | 2009-08-21 00:39:39 +0530 | [diff] [blame] | 662 | |
| 663 | MODULE_AUTHOR("Texas Instruments"); |
| 664 | MODULE_DESCRIPTION("TPS6507x voltage regulator driver"); |
Liam Girdwood | 9e108d3 | 2009-08-24 10:31:34 +0100 | [diff] [blame] | 665 | MODULE_LICENSE("GPL v2"); |