Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 1 | /* |
| 2 | * MFD driver for TWL6040 audio device |
| 3 | * |
| 4 | * Authors: Misael Lopez Cruz <misael.lopez@ti.com> |
| 5 | * Jorge Eduardo Candelaria <jorge.candelaria@ti.com> |
| 6 | * Peter Ujfalusi <peter.ujfalusi@ti.com> |
| 7 | * |
| 8 | * Copyright: (C) 2011 Texas Instruments, Inc. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 22 | * 02110-1301 USA |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #include <linux/module.h> |
| 27 | #include <linux/types.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/kernel.h> |
Peter Ujfalusi | 5af7df6 | 2012-05-02 16:54:42 +0300 | [diff] [blame] | 30 | #include <linux/err.h> |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 31 | #include <linux/platform_device.h> |
Peter Ujfalusi | 37e13ce | 2012-05-16 14:11:58 +0300 | [diff] [blame] | 32 | #include <linux/of.h> |
| 33 | #include <linux/of_irq.h> |
| 34 | #include <linux/of_gpio.h> |
| 35 | #include <linux/of_platform.h> |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 36 | #include <linux/gpio.h> |
| 37 | #include <linux/delay.h> |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 38 | #include <linux/i2c.h> |
| 39 | #include <linux/regmap.h> |
| 40 | #include <linux/err.h> |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 41 | #include <linux/mfd/core.h> |
| 42 | #include <linux/mfd/twl6040.h> |
Peter Ujfalusi | 5af7df6 | 2012-05-02 16:54:42 +0300 | [diff] [blame] | 43 | #include <linux/regulator/consumer.h> |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 44 | |
Peter Ujfalusi | 31b402e | 2011-10-12 11:57:54 +0300 | [diff] [blame] | 45 | #define VIBRACTRL_MEMBER(reg) ((reg == TWL6040_REG_VIBCTLL) ? 0 : 1) |
Peter Ujfalusi | 5af7df6 | 2012-05-02 16:54:42 +0300 | [diff] [blame] | 46 | #define TWL6040_NUM_SUPPLIES (2) |
Peter Ujfalusi | 31b402e | 2011-10-12 11:57:54 +0300 | [diff] [blame] | 47 | |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 48 | int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) |
| 49 | { |
| 50 | int ret; |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 51 | unsigned int val; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 52 | |
| 53 | mutex_lock(&twl6040->io_mutex); |
Peter Ujfalusi | 31b402e | 2011-10-12 11:57:54 +0300 | [diff] [blame] | 54 | /* Vibra control registers from cache */ |
| 55 | if (unlikely(reg == TWL6040_REG_VIBCTLL || |
| 56 | reg == TWL6040_REG_VIBCTLR)) { |
| 57 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; |
| 58 | } else { |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 59 | ret = regmap_read(twl6040->regmap, reg, &val); |
Peter Ujfalusi | 31b402e | 2011-10-12 11:57:54 +0300 | [diff] [blame] | 60 | if (ret < 0) { |
| 61 | mutex_unlock(&twl6040->io_mutex); |
| 62 | return ret; |
| 63 | } |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 64 | } |
| 65 | mutex_unlock(&twl6040->io_mutex); |
| 66 | |
| 67 | return val; |
| 68 | } |
| 69 | EXPORT_SYMBOL(twl6040_reg_read); |
| 70 | |
| 71 | int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val) |
| 72 | { |
| 73 | int ret; |
| 74 | |
| 75 | mutex_lock(&twl6040->io_mutex); |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 76 | ret = regmap_write(twl6040->regmap, reg, val); |
Peter Ujfalusi | 31b402e | 2011-10-12 11:57:54 +0300 | [diff] [blame] | 77 | /* Cache the vibra control registers */ |
| 78 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) |
| 79 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 80 | mutex_unlock(&twl6040->io_mutex); |
| 81 | |
| 82 | return ret; |
| 83 | } |
| 84 | EXPORT_SYMBOL(twl6040_reg_write); |
| 85 | |
| 86 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
| 87 | { |
| 88 | int ret; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 89 | |
| 90 | mutex_lock(&twl6040->io_mutex); |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 91 | ret = regmap_update_bits(twl6040->regmap, reg, mask, mask); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 92 | mutex_unlock(&twl6040->io_mutex); |
| 93 | return ret; |
| 94 | } |
| 95 | EXPORT_SYMBOL(twl6040_set_bits); |
| 96 | |
| 97 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
| 98 | { |
| 99 | int ret; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 100 | |
| 101 | mutex_lock(&twl6040->io_mutex); |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 102 | ret = regmap_update_bits(twl6040->regmap, reg, mask, 0); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 103 | mutex_unlock(&twl6040->io_mutex); |
| 104 | return ret; |
| 105 | } |
| 106 | EXPORT_SYMBOL(twl6040_clear_bits); |
| 107 | |
| 108 | /* twl6040 codec manual power-up sequence */ |
| 109 | static int twl6040_power_up(struct twl6040 *twl6040) |
| 110 | { |
| 111 | u8 ldoctl, ncpctl, lppllctl; |
| 112 | int ret; |
| 113 | |
| 114 | /* enable high-side LDO, reference system and internal oscillator */ |
| 115 | ldoctl = TWL6040_HSLDOENA | TWL6040_REFENA | TWL6040_OSCENA; |
| 116 | ret = twl6040_reg_write(twl6040, TWL6040_REG_LDOCTL, ldoctl); |
| 117 | if (ret) |
| 118 | return ret; |
| 119 | usleep_range(10000, 10500); |
| 120 | |
| 121 | /* enable negative charge pump */ |
| 122 | ncpctl = TWL6040_NCPENA; |
| 123 | ret = twl6040_reg_write(twl6040, TWL6040_REG_NCPCTL, ncpctl); |
| 124 | if (ret) |
| 125 | goto ncp_err; |
| 126 | usleep_range(1000, 1500); |
| 127 | |
| 128 | /* enable low-side LDO */ |
| 129 | ldoctl |= TWL6040_LSLDOENA; |
| 130 | ret = twl6040_reg_write(twl6040, TWL6040_REG_LDOCTL, ldoctl); |
| 131 | if (ret) |
| 132 | goto lsldo_err; |
| 133 | usleep_range(1000, 1500); |
| 134 | |
| 135 | /* enable low-power PLL */ |
| 136 | lppllctl = TWL6040_LPLLENA; |
| 137 | ret = twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); |
| 138 | if (ret) |
| 139 | goto lppll_err; |
| 140 | usleep_range(5000, 5500); |
| 141 | |
| 142 | /* disable internal oscillator */ |
| 143 | ldoctl &= ~TWL6040_OSCENA; |
| 144 | ret = twl6040_reg_write(twl6040, TWL6040_REG_LDOCTL, ldoctl); |
| 145 | if (ret) |
| 146 | goto osc_err; |
| 147 | |
| 148 | return 0; |
| 149 | |
| 150 | osc_err: |
| 151 | lppllctl &= ~TWL6040_LPLLENA; |
| 152 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); |
| 153 | lppll_err: |
| 154 | ldoctl &= ~TWL6040_LSLDOENA; |
| 155 | twl6040_reg_write(twl6040, TWL6040_REG_LDOCTL, ldoctl); |
| 156 | lsldo_err: |
| 157 | ncpctl &= ~TWL6040_NCPENA; |
| 158 | twl6040_reg_write(twl6040, TWL6040_REG_NCPCTL, ncpctl); |
| 159 | ncp_err: |
| 160 | ldoctl &= ~(TWL6040_HSLDOENA | TWL6040_REFENA | TWL6040_OSCENA); |
| 161 | twl6040_reg_write(twl6040, TWL6040_REG_LDOCTL, ldoctl); |
| 162 | |
| 163 | return ret; |
| 164 | } |
| 165 | |
| 166 | /* twl6040 manual power-down sequence */ |
| 167 | static void twl6040_power_down(struct twl6040 *twl6040) |
| 168 | { |
| 169 | u8 ncpctl, ldoctl, lppllctl; |
| 170 | |
| 171 | ncpctl = twl6040_reg_read(twl6040, TWL6040_REG_NCPCTL); |
| 172 | ldoctl = twl6040_reg_read(twl6040, TWL6040_REG_LDOCTL); |
| 173 | lppllctl = twl6040_reg_read(twl6040, TWL6040_REG_LPPLLCTL); |
| 174 | |
| 175 | /* enable internal oscillator */ |
| 176 | ldoctl |= TWL6040_OSCENA; |
| 177 | twl6040_reg_write(twl6040, TWL6040_REG_LDOCTL, ldoctl); |
| 178 | usleep_range(1000, 1500); |
| 179 | |
| 180 | /* disable low-power PLL */ |
| 181 | lppllctl &= ~TWL6040_LPLLENA; |
| 182 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); |
| 183 | |
| 184 | /* disable low-side LDO */ |
| 185 | ldoctl &= ~TWL6040_LSLDOENA; |
| 186 | twl6040_reg_write(twl6040, TWL6040_REG_LDOCTL, ldoctl); |
| 187 | |
| 188 | /* disable negative charge pump */ |
| 189 | ncpctl &= ~TWL6040_NCPENA; |
| 190 | twl6040_reg_write(twl6040, TWL6040_REG_NCPCTL, ncpctl); |
| 191 | |
| 192 | /* disable high-side LDO, reference system and internal oscillator */ |
| 193 | ldoctl &= ~(TWL6040_HSLDOENA | TWL6040_REFENA | TWL6040_OSCENA); |
| 194 | twl6040_reg_write(twl6040, TWL6040_REG_LDOCTL, ldoctl); |
| 195 | } |
| 196 | |
| 197 | static irqreturn_t twl6040_naudint_handler(int irq, void *data) |
| 198 | { |
| 199 | struct twl6040 *twl6040 = data; |
| 200 | u8 intid, status; |
| 201 | |
| 202 | intid = twl6040_reg_read(twl6040, TWL6040_REG_INTID); |
| 203 | |
| 204 | if (intid & TWL6040_READYINT) |
| 205 | complete(&twl6040->ready); |
| 206 | |
| 207 | if (intid & TWL6040_THINT) { |
| 208 | status = twl6040_reg_read(twl6040, TWL6040_REG_STATUS); |
| 209 | if (status & TWL6040_TSHUTDET) { |
Peter Ujfalusi | 2d7c957 | 2011-09-15 15:39:23 +0300 | [diff] [blame] | 210 | dev_warn(twl6040->dev, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 211 | "Thermal shutdown, powering-off"); |
| 212 | twl6040_power(twl6040, 0); |
| 213 | } else { |
Peter Ujfalusi | 2d7c957 | 2011-09-15 15:39:23 +0300 | [diff] [blame] | 214 | dev_warn(twl6040->dev, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 215 | "Leaving thermal shutdown, powering-on"); |
| 216 | twl6040_power(twl6040, 1); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | return IRQ_HANDLED; |
| 221 | } |
| 222 | |
| 223 | static int twl6040_power_up_completion(struct twl6040 *twl6040, |
| 224 | int naudint) |
| 225 | { |
| 226 | int time_left; |
| 227 | u8 intid; |
| 228 | |
| 229 | time_left = wait_for_completion_timeout(&twl6040->ready, |
| 230 | msecs_to_jiffies(144)); |
| 231 | if (!time_left) { |
| 232 | intid = twl6040_reg_read(twl6040, TWL6040_REG_INTID); |
| 233 | if (!(intid & TWL6040_READYINT)) { |
Peter Ujfalusi | 2d7c957 | 2011-09-15 15:39:23 +0300 | [diff] [blame] | 234 | dev_err(twl6040->dev, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 235 | "timeout waiting for READYINT\n"); |
| 236 | return -ETIMEDOUT; |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | return 0; |
| 241 | } |
| 242 | |
| 243 | int twl6040_power(struct twl6040 *twl6040, int on) |
| 244 | { |
| 245 | int audpwron = twl6040->audpwron; |
| 246 | int naudint = twl6040->irq; |
| 247 | int ret = 0; |
| 248 | |
| 249 | mutex_lock(&twl6040->mutex); |
| 250 | |
| 251 | if (on) { |
| 252 | /* already powered-up */ |
| 253 | if (twl6040->power_count++) |
| 254 | goto out; |
| 255 | |
| 256 | if (gpio_is_valid(audpwron)) { |
| 257 | /* use AUDPWRON line */ |
| 258 | gpio_set_value(audpwron, 1); |
| 259 | /* wait for power-up completion */ |
| 260 | ret = twl6040_power_up_completion(twl6040, naudint); |
| 261 | if (ret) { |
Peter Ujfalusi | 2d7c957 | 2011-09-15 15:39:23 +0300 | [diff] [blame] | 262 | dev_err(twl6040->dev, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 263 | "automatic power-down failed\n"); |
| 264 | twl6040->power_count = 0; |
| 265 | goto out; |
| 266 | } |
| 267 | } else { |
| 268 | /* use manual power-up sequence */ |
| 269 | ret = twl6040_power_up(twl6040); |
| 270 | if (ret) { |
Peter Ujfalusi | 2d7c957 | 2011-09-15 15:39:23 +0300 | [diff] [blame] | 271 | dev_err(twl6040->dev, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 272 | "manual power-up failed\n"); |
| 273 | twl6040->power_count = 0; |
| 274 | goto out; |
| 275 | } |
| 276 | } |
Peter Ujfalusi | cfb7a33 | 2011-07-04 10:28:28 +0300 | [diff] [blame] | 277 | /* Default PLL configuration after power up */ |
| 278 | twl6040->pll = TWL6040_SYSCLK_SEL_LPPLL; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 279 | twl6040->sysclk = 19200000; |
Peter Ujfalusi | f8447d6 | 2012-01-14 20:58:43 +0100 | [diff] [blame] | 280 | twl6040->mclk = 32768; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 281 | } else { |
| 282 | /* already powered-down */ |
| 283 | if (!twl6040->power_count) { |
Peter Ujfalusi | 2d7c957 | 2011-09-15 15:39:23 +0300 | [diff] [blame] | 284 | dev_err(twl6040->dev, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 285 | "device is already powered-off\n"); |
| 286 | ret = -EPERM; |
| 287 | goto out; |
| 288 | } |
| 289 | |
| 290 | if (--twl6040->power_count) |
| 291 | goto out; |
| 292 | |
| 293 | if (gpio_is_valid(audpwron)) { |
| 294 | /* use AUDPWRON line */ |
| 295 | gpio_set_value(audpwron, 0); |
| 296 | |
| 297 | /* power-down sequence latency */ |
| 298 | usleep_range(500, 700); |
| 299 | } else { |
| 300 | /* use manual power-down sequence */ |
| 301 | twl6040_power_down(twl6040); |
| 302 | } |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 303 | twl6040->sysclk = 0; |
Peter Ujfalusi | f8447d6 | 2012-01-14 20:58:43 +0100 | [diff] [blame] | 304 | twl6040->mclk = 0; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | out: |
| 308 | mutex_unlock(&twl6040->mutex); |
| 309 | return ret; |
| 310 | } |
| 311 | EXPORT_SYMBOL(twl6040_power); |
| 312 | |
Peter Ujfalusi | cfb7a33 | 2011-07-04 10:28:28 +0300 | [diff] [blame] | 313 | int twl6040_set_pll(struct twl6040 *twl6040, int pll_id, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 314 | unsigned int freq_in, unsigned int freq_out) |
| 315 | { |
| 316 | u8 hppllctl, lppllctl; |
| 317 | int ret = 0; |
| 318 | |
| 319 | mutex_lock(&twl6040->mutex); |
| 320 | |
| 321 | hppllctl = twl6040_reg_read(twl6040, TWL6040_REG_HPPLLCTL); |
| 322 | lppllctl = twl6040_reg_read(twl6040, TWL6040_REG_LPPLLCTL); |
| 323 | |
Peter Ujfalusi | 2bd05db | 2012-01-14 20:58:44 +0100 | [diff] [blame] | 324 | /* Force full reconfiguration when switching between PLL */ |
| 325 | if (pll_id != twl6040->pll) { |
| 326 | twl6040->sysclk = 0; |
| 327 | twl6040->mclk = 0; |
| 328 | } |
| 329 | |
Peter Ujfalusi | cfb7a33 | 2011-07-04 10:28:28 +0300 | [diff] [blame] | 330 | switch (pll_id) { |
| 331 | case TWL6040_SYSCLK_SEL_LPPLL: |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 332 | /* low-power PLL divider */ |
Peter Ujfalusi | 2bd05db | 2012-01-14 20:58:44 +0100 | [diff] [blame] | 333 | /* Change the sysclk configuration only if it has been canged */ |
| 334 | if (twl6040->sysclk != freq_out) { |
| 335 | switch (freq_out) { |
| 336 | case 17640000: |
| 337 | lppllctl |= TWL6040_LPLLFIN; |
| 338 | break; |
| 339 | case 19200000: |
| 340 | lppllctl &= ~TWL6040_LPLLFIN; |
| 341 | break; |
| 342 | default: |
| 343 | dev_err(twl6040->dev, |
| 344 | "freq_out %d not supported\n", |
| 345 | freq_out); |
| 346 | ret = -EINVAL; |
| 347 | goto pll_out; |
| 348 | } |
| 349 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, |
| 350 | lppllctl); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 351 | } |
Peter Ujfalusi | 2bd05db | 2012-01-14 20:58:44 +0100 | [diff] [blame] | 352 | |
| 353 | /* The PLL in use has not been change, we can exit */ |
| 354 | if (twl6040->pll == pll_id) |
| 355 | break; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 356 | |
| 357 | switch (freq_in) { |
| 358 | case 32768: |
| 359 | lppllctl |= TWL6040_LPLLENA; |
| 360 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, |
| 361 | lppllctl); |
| 362 | mdelay(5); |
| 363 | lppllctl &= ~TWL6040_HPLLSEL; |
| 364 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, |
| 365 | lppllctl); |
| 366 | hppllctl &= ~TWL6040_HPLLENA; |
| 367 | twl6040_reg_write(twl6040, TWL6040_REG_HPPLLCTL, |
| 368 | hppllctl); |
| 369 | break; |
| 370 | default: |
Peter Ujfalusi | 2d7c957 | 2011-09-15 15:39:23 +0300 | [diff] [blame] | 371 | dev_err(twl6040->dev, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 372 | "freq_in %d not supported\n", freq_in); |
| 373 | ret = -EINVAL; |
| 374 | goto pll_out; |
| 375 | } |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 376 | break; |
Peter Ujfalusi | cfb7a33 | 2011-07-04 10:28:28 +0300 | [diff] [blame] | 377 | case TWL6040_SYSCLK_SEL_HPPLL: |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 378 | /* high-performance PLL can provide only 19.2 MHz */ |
| 379 | if (freq_out != 19200000) { |
Peter Ujfalusi | 2d7c957 | 2011-09-15 15:39:23 +0300 | [diff] [blame] | 380 | dev_err(twl6040->dev, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 381 | "freq_out %d not supported\n", freq_out); |
| 382 | ret = -EINVAL; |
| 383 | goto pll_out; |
| 384 | } |
| 385 | |
Peter Ujfalusi | 2bd05db | 2012-01-14 20:58:44 +0100 | [diff] [blame] | 386 | if (twl6040->mclk != freq_in) { |
| 387 | hppllctl &= ~TWL6040_MCLK_MSK; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 388 | |
Peter Ujfalusi | 2bd05db | 2012-01-14 20:58:44 +0100 | [diff] [blame] | 389 | switch (freq_in) { |
| 390 | case 12000000: |
| 391 | /* PLL enabled, active mode */ |
| 392 | hppllctl |= TWL6040_MCLK_12000KHZ | |
| 393 | TWL6040_HPLLENA; |
| 394 | break; |
| 395 | case 19200000: |
| 396 | /* |
| 397 | * PLL disabled |
| 398 | * (enable PLL if MCLK jitter quality |
| 399 | * doesn't meet specification) |
| 400 | */ |
| 401 | hppllctl |= TWL6040_MCLK_19200KHZ; |
| 402 | break; |
| 403 | case 26000000: |
| 404 | /* PLL enabled, active mode */ |
| 405 | hppllctl |= TWL6040_MCLK_26000KHZ | |
| 406 | TWL6040_HPLLENA; |
| 407 | break; |
| 408 | case 38400000: |
| 409 | /* PLL enabled, active mode */ |
| 410 | hppllctl |= TWL6040_MCLK_38400KHZ | |
| 411 | TWL6040_HPLLENA; |
| 412 | break; |
| 413 | default: |
| 414 | dev_err(twl6040->dev, |
| 415 | "freq_in %d not supported\n", freq_in); |
| 416 | ret = -EINVAL; |
| 417 | goto pll_out; |
| 418 | } |
| 419 | |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 420 | /* |
Peter Ujfalusi | 2bd05db | 2012-01-14 20:58:44 +0100 | [diff] [blame] | 421 | * enable clock slicer to ensure input waveform is |
| 422 | * square |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 423 | */ |
Peter Ujfalusi | 2bd05db | 2012-01-14 20:58:44 +0100 | [diff] [blame] | 424 | hppllctl |= TWL6040_HPLLSQRENA; |
| 425 | |
| 426 | twl6040_reg_write(twl6040, TWL6040_REG_HPPLLCTL, |
| 427 | hppllctl); |
| 428 | usleep_range(500, 700); |
| 429 | lppllctl |= TWL6040_HPLLSEL; |
| 430 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, |
| 431 | lppllctl); |
| 432 | lppllctl &= ~TWL6040_LPLLENA; |
| 433 | twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, |
| 434 | lppllctl); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 435 | } |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 436 | break; |
| 437 | default: |
Peter Ujfalusi | 2d7c957 | 2011-09-15 15:39:23 +0300 | [diff] [blame] | 438 | dev_err(twl6040->dev, "unknown pll id %d\n", pll_id); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 439 | ret = -EINVAL; |
| 440 | goto pll_out; |
| 441 | } |
| 442 | |
| 443 | twl6040->sysclk = freq_out; |
Peter Ujfalusi | f8447d6 | 2012-01-14 20:58:43 +0100 | [diff] [blame] | 444 | twl6040->mclk = freq_in; |
Peter Ujfalusi | cfb7a33 | 2011-07-04 10:28:28 +0300 | [diff] [blame] | 445 | twl6040->pll = pll_id; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 446 | |
| 447 | pll_out: |
| 448 | mutex_unlock(&twl6040->mutex); |
| 449 | return ret; |
| 450 | } |
| 451 | EXPORT_SYMBOL(twl6040_set_pll); |
| 452 | |
Peter Ujfalusi | cfb7a33 | 2011-07-04 10:28:28 +0300 | [diff] [blame] | 453 | int twl6040_get_pll(struct twl6040 *twl6040) |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 454 | { |
Peter Ujfalusi | cfb7a33 | 2011-07-04 10:28:28 +0300 | [diff] [blame] | 455 | if (twl6040->power_count) |
| 456 | return twl6040->pll; |
| 457 | else |
| 458 | return -ENODEV; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 459 | } |
| 460 | EXPORT_SYMBOL(twl6040_get_pll); |
| 461 | |
| 462 | unsigned int twl6040_get_sysclk(struct twl6040 *twl6040) |
| 463 | { |
| 464 | return twl6040->sysclk; |
| 465 | } |
| 466 | EXPORT_SYMBOL(twl6040_get_sysclk); |
| 467 | |
Peter Ujfalusi | 70601ec | 2011-10-12 11:57:55 +0300 | [diff] [blame] | 468 | /* Get the combined status of the vibra control register */ |
| 469 | int twl6040_get_vibralr_status(struct twl6040 *twl6040) |
| 470 | { |
| 471 | u8 status; |
| 472 | |
| 473 | status = twl6040->vibra_ctrl_cache[0] | twl6040->vibra_ctrl_cache[1]; |
| 474 | status &= (TWL6040_VIBENA | TWL6040_VIBSEL); |
| 475 | |
| 476 | return status; |
| 477 | } |
| 478 | EXPORT_SYMBOL(twl6040_get_vibralr_status); |
| 479 | |
Peter Ujfalusi | 0f962ae | 2011-07-05 11:40:33 +0300 | [diff] [blame] | 480 | static struct resource twl6040_vibra_rsrc[] = { |
| 481 | { |
| 482 | .flags = IORESOURCE_IRQ, |
| 483 | }, |
| 484 | }; |
| 485 | |
| 486 | static struct resource twl6040_codec_rsrc[] = { |
| 487 | { |
| 488 | .flags = IORESOURCE_IRQ, |
| 489 | }, |
| 490 | }; |
| 491 | |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 492 | static bool twl6040_readable_reg(struct device *dev, unsigned int reg) |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 493 | { |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 494 | /* Register 0 is not readable */ |
| 495 | if (!reg) |
| 496 | return false; |
| 497 | return true; |
| 498 | } |
| 499 | |
| 500 | static struct regmap_config twl6040_regmap_config = { |
| 501 | .reg_bits = 8, |
| 502 | .val_bits = 8, |
| 503 | .max_register = TWL6040_REG_STATUS, /* 0x2e */ |
| 504 | |
| 505 | .readable_reg = twl6040_readable_reg, |
| 506 | }; |
| 507 | |
| 508 | static int __devinit twl6040_probe(struct i2c_client *client, |
| 509 | const struct i2c_device_id *id) |
| 510 | { |
| 511 | struct twl6040_platform_data *pdata = client->dev.platform_data; |
Peter Ujfalusi | 37e13ce | 2012-05-16 14:11:58 +0300 | [diff] [blame] | 512 | struct device_node *node = client->dev.of_node; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 513 | struct twl6040 *twl6040; |
| 514 | struct mfd_cell *cell = NULL; |
Peter Ujfalusi | 1f01d60 | 2012-05-16 14:11:57 +0300 | [diff] [blame] | 515 | int irq, ret, children = 0; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 516 | |
Peter Ujfalusi | 37e13ce | 2012-05-16 14:11:58 +0300 | [diff] [blame] | 517 | if (!pdata && !node) { |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 518 | dev_err(&client->dev, "Platform data is missing\n"); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 519 | return -EINVAL; |
| 520 | } |
| 521 | |
Peter Ujfalusi | d20e1d2 | 2011-07-04 20:15:19 +0300 | [diff] [blame] | 522 | /* In order to operate correctly we need valid interrupt config */ |
Peter Ujfalusi | 6712419 | 2012-05-16 14:11:56 +0300 | [diff] [blame] | 523 | if (!client->irq) { |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 524 | dev_err(&client->dev, "Invalid IRQ configuration\n"); |
Peter Ujfalusi | d20e1d2 | 2011-07-04 20:15:19 +0300 | [diff] [blame] | 525 | return -EINVAL; |
| 526 | } |
| 527 | |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 528 | twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040), |
| 529 | GFP_KERNEL); |
| 530 | if (!twl6040) { |
| 531 | ret = -ENOMEM; |
| 532 | goto err; |
| 533 | } |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 534 | |
Axel Lin | bbf6adc | 2012-04-25 10:09:46 +0800 | [diff] [blame] | 535 | twl6040->regmap = devm_regmap_init_i2c(client, &twl6040_regmap_config); |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 536 | if (IS_ERR(twl6040->regmap)) { |
| 537 | ret = PTR_ERR(twl6040->regmap); |
| 538 | goto err; |
| 539 | } |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 540 | |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 541 | i2c_set_clientdata(client, twl6040); |
| 542 | |
Peter Ujfalusi | 5af7df6 | 2012-05-02 16:54:42 +0300 | [diff] [blame] | 543 | twl6040->supplies[0].supply = "vio"; |
| 544 | twl6040->supplies[1].supply = "v2v1"; |
| 545 | ret = regulator_bulk_get(&client->dev, TWL6040_NUM_SUPPLIES, |
| 546 | twl6040->supplies); |
| 547 | if (ret != 0) { |
| 548 | dev_err(&client->dev, "Failed to get supplies: %d\n", ret); |
| 549 | goto regulator_get_err; |
| 550 | } |
| 551 | |
| 552 | ret = regulator_bulk_enable(TWL6040_NUM_SUPPLIES, twl6040->supplies); |
| 553 | if (ret != 0) { |
| 554 | dev_err(&client->dev, "Failed to enable supplies: %d\n", ret); |
| 555 | goto power_err; |
| 556 | } |
| 557 | |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 558 | twl6040->dev = &client->dev; |
| 559 | twl6040->irq = client->irq; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 560 | |
| 561 | mutex_init(&twl6040->mutex); |
| 562 | mutex_init(&twl6040->io_mutex); |
| 563 | init_completion(&twl6040->ready); |
| 564 | |
| 565 | twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV); |
| 566 | |
Peter Ujfalusi | 77f63e0 | 2011-09-15 15:39:26 +0300 | [diff] [blame] | 567 | /* ERRATA: Automatic power-up is not possible in ES1.0 */ |
Peter Ujfalusi | 37e13ce | 2012-05-16 14:11:58 +0300 | [diff] [blame] | 568 | if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0) { |
| 569 | if (pdata) |
| 570 | twl6040->audpwron = pdata->audpwron_gpio; |
| 571 | else |
| 572 | twl6040->audpwron = of_get_named_gpio(node, |
| 573 | "ti,audpwron-gpio", 0); |
| 574 | } else |
Peter Ujfalusi | 77f63e0 | 2011-09-15 15:39:26 +0300 | [diff] [blame] | 575 | twl6040->audpwron = -EINVAL; |
| 576 | |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 577 | if (gpio_is_valid(twl6040->audpwron)) { |
Axel Lin | b04edb9 | 2011-12-01 09:55:07 +0800 | [diff] [blame] | 578 | ret = gpio_request_one(twl6040->audpwron, GPIOF_OUT_INIT_LOW, |
| 579 | "audpwron"); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 580 | if (ret) |
Peter Ujfalusi | 5af7df6 | 2012-05-02 16:54:42 +0300 | [diff] [blame] | 581 | goto gpio_err; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 582 | } |
| 583 | |
Peter Ujfalusi | d20e1d2 | 2011-07-04 20:15:19 +0300 | [diff] [blame] | 584 | /* codec interrupt */ |
| 585 | ret = twl6040_irq_init(twl6040); |
| 586 | if (ret) |
Peter Ujfalusi | 5af7df6 | 2012-05-02 16:54:42 +0300 | [diff] [blame] | 587 | goto irq_init_err; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 588 | |
Peter Ujfalusi | 1b7c472 | 2011-07-04 20:16:23 +0300 | [diff] [blame] | 589 | ret = request_threaded_irq(twl6040->irq_base + TWL6040_IRQ_READY, |
| 590 | NULL, twl6040_naudint_handler, 0, |
| 591 | "twl6040_irq_ready", twl6040); |
Peter Ujfalusi | d20e1d2 | 2011-07-04 20:15:19 +0300 | [diff] [blame] | 592 | if (ret) { |
| 593 | dev_err(twl6040->dev, "READY IRQ request failed: %d\n", |
| 594 | ret); |
| 595 | goto irq_err; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | /* dual-access registers controlled by I2C only */ |
| 599 | twl6040_set_bits(twl6040, TWL6040_REG_ACCCTL, TWL6040_I2CSEL); |
| 600 | |
Peter Ujfalusi | 1f01d60 | 2012-05-16 14:11:57 +0300 | [diff] [blame] | 601 | /* |
| 602 | * The main functionality of twl6040 to provide audio on OMAP4+ systems. |
| 603 | * We can add the ASoC codec child whenever this driver has been loaded. |
| 604 | * The ASoC codec can work without pdata, pass the platform_data only if |
| 605 | * it has been provided. |
| 606 | */ |
| 607 | irq = twl6040->irq_base + TWL6040_IRQ_PLUG; |
| 608 | cell = &twl6040->cells[children]; |
| 609 | cell->name = "twl6040-codec"; |
| 610 | twl6040_codec_rsrc[0].start = irq; |
| 611 | twl6040_codec_rsrc[0].end = irq; |
| 612 | cell->resources = twl6040_codec_rsrc; |
| 613 | cell->num_resources = ARRAY_SIZE(twl6040_codec_rsrc); |
Peter Ujfalusi | 37e13ce | 2012-05-16 14:11:58 +0300 | [diff] [blame] | 614 | if (pdata && pdata->codec) { |
Peter Ujfalusi | 6c44863 | 2011-06-01 13:05:10 +0300 | [diff] [blame] | 615 | cell->platform_data = pdata->codec; |
| 616 | cell->pdata_size = sizeof(*pdata->codec); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 617 | } |
Peter Ujfalusi | 1f01d60 | 2012-05-16 14:11:57 +0300 | [diff] [blame] | 618 | children++; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 619 | |
Peter Ujfalusi | 37e13ce | 2012-05-16 14:11:58 +0300 | [diff] [blame] | 620 | if ((pdata && pdata->vibra) || of_find_node_by_name(node, "vibra")) { |
Peter Ujfalusi | 1f01d60 | 2012-05-16 14:11:57 +0300 | [diff] [blame] | 621 | irq = twl6040->irq_base + TWL6040_IRQ_VIB; |
Peter Ujfalusi | 0f962ae | 2011-07-05 11:40:33 +0300 | [diff] [blame] | 622 | |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 623 | cell = &twl6040->cells[children]; |
| 624 | cell->name = "twl6040-vibra"; |
Peter Ujfalusi | 0f962ae | 2011-07-05 11:40:33 +0300 | [diff] [blame] | 625 | twl6040_vibra_rsrc[0].start = irq; |
| 626 | twl6040_vibra_rsrc[0].end = irq; |
| 627 | cell->resources = twl6040_vibra_rsrc; |
| 628 | cell->num_resources = ARRAY_SIZE(twl6040_vibra_rsrc); |
| 629 | |
Peter Ujfalusi | 37e13ce | 2012-05-16 14:11:58 +0300 | [diff] [blame] | 630 | if (pdata && pdata->vibra) { |
| 631 | cell->platform_data = pdata->vibra; |
| 632 | cell->pdata_size = sizeof(*pdata->vibra); |
| 633 | } |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 634 | children++; |
| 635 | } |
| 636 | |
Peter Ujfalusi | 1f01d60 | 2012-05-16 14:11:57 +0300 | [diff] [blame] | 637 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children, |
| 638 | NULL, 0); |
| 639 | if (ret) |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 640 | goto mfd_err; |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 641 | |
| 642 | return 0; |
| 643 | |
| 644 | mfd_err: |
Peter Ujfalusi | 1b7c472 | 2011-07-04 20:16:23 +0300 | [diff] [blame] | 645 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 646 | irq_err: |
Peter Ujfalusi | d20e1d2 | 2011-07-04 20:15:19 +0300 | [diff] [blame] | 647 | twl6040_irq_exit(twl6040); |
Peter Ujfalusi | 5af7df6 | 2012-05-02 16:54:42 +0300 | [diff] [blame] | 648 | irq_init_err: |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 649 | if (gpio_is_valid(twl6040->audpwron)) |
| 650 | gpio_free(twl6040->audpwron); |
Peter Ujfalusi | 5af7df6 | 2012-05-02 16:54:42 +0300 | [diff] [blame] | 651 | gpio_err: |
| 652 | regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies); |
| 653 | power_err: |
| 654 | regulator_bulk_free(TWL6040_NUM_SUPPLIES, twl6040->supplies); |
| 655 | regulator_get_err: |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 656 | i2c_set_clientdata(client, NULL); |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 657 | err: |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 658 | return ret; |
| 659 | } |
| 660 | |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 661 | static int __devexit twl6040_remove(struct i2c_client *client) |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 662 | { |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 663 | struct twl6040 *twl6040 = i2c_get_clientdata(client); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 664 | |
| 665 | if (twl6040->power_count) |
| 666 | twl6040_power(twl6040, 0); |
| 667 | |
| 668 | if (gpio_is_valid(twl6040->audpwron)) |
| 669 | gpio_free(twl6040->audpwron); |
| 670 | |
Peter Ujfalusi | 1b7c472 | 2011-07-04 20:16:23 +0300 | [diff] [blame] | 671 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); |
Peter Ujfalusi | d20e1d2 | 2011-07-04 20:15:19 +0300 | [diff] [blame] | 672 | twl6040_irq_exit(twl6040); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 673 | |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 674 | mfd_remove_devices(&client->dev); |
| 675 | i2c_set_clientdata(client, NULL); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 676 | |
Peter Ujfalusi | 5af7df6 | 2012-05-02 16:54:42 +0300 | [diff] [blame] | 677 | regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies); |
| 678 | regulator_bulk_free(TWL6040_NUM_SUPPLIES, twl6040->supplies); |
| 679 | |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 680 | return 0; |
| 681 | } |
| 682 | |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 683 | static const struct i2c_device_id twl6040_i2c_id[] = { |
| 684 | { "twl6040", 0, }, |
| 685 | { }, |
| 686 | }; |
| 687 | MODULE_DEVICE_TABLE(i2c, twl6040_i2c_id); |
| 688 | |
| 689 | static struct i2c_driver twl6040_driver = { |
| 690 | .driver = { |
| 691 | .name = "twl6040", |
| 692 | .owner = THIS_MODULE, |
| 693 | }, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 694 | .probe = twl6040_probe, |
| 695 | .remove = __devexit_p(twl6040_remove), |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 696 | .id_table = twl6040_i2c_id, |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 697 | }; |
| 698 | |
Peter Ujfalusi | 8eaeb93 | 2012-04-03 11:56:51 +0300 | [diff] [blame] | 699 | module_i2c_driver(twl6040_driver); |
Misael Lopez Cruz | f19b282 | 2011-04-27 02:14:07 -0500 | [diff] [blame] | 700 | |
| 701 | MODULE_DESCRIPTION("TWL6040 MFD"); |
| 702 | MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); |
| 703 | MODULE_AUTHOR("Jorge Eduardo Candelaria <jorge.candelaria@ti.com>"); |
| 704 | MODULE_LICENSE("GPL"); |
| 705 | MODULE_ALIAS("platform:twl6040"); |