1 /* 2 * twl_core.c - driver for TWL4030/TWL5030/TWL60X0/TPS659x0 PM 3 * and audio CODEC devices 4 * 5 * Copyright (C) 2005-2006 Texas Instruments, Inc. 6 * 7 * Modifications to defer interrupt handling to a kernel thread: 8 * Copyright (C) 2006 MontaVista Software, Inc. 9 * 10 * Based on tlv320aic23.c: 11 * Copyright (c) by Kai Svahn <kai.svahn@nokia.com> 12 * 13 * Code cleanup and modifications to IRQ handler. 14 * by syed khasim <x0khasim@ti.com> 15 * 16 * This program is free software; you can redistribute it and/or modify 17 * it under the terms of the GNU General Public License as published by 18 * the Free Software Foundation; either version 2 of the License, or 19 * (at your option) any later version. 20 * 21 * This program is distributed in the hope that it will be useful, 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 * GNU General Public License for more details. 25 * 26 * You should have received a copy of the GNU General Public License 27 * along with this program; if not, write to the Free Software 28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 29 */ 30 31 #include <linux/init.h> 32 #include <linux/mutex.h> 33 #include <linux/module.h> 34 #include <linux/platform_device.h> 35 #include <linux/regmap.h> 36 #include <linux/clk.h> 37 #include <linux/err.h> 38 #include <linux/device.h> 39 #include <linux/of.h> 40 #include <linux/of_irq.h> 41 #include <linux/of_platform.h> 42 #include <linux/irq.h> 43 #include <linux/irqdomain.h> 44 45 #include <linux/regulator/machine.h> 46 47 #include <linux/i2c.h> 48 #include <linux/i2c/twl.h> 49 50 #include "twl-core.h" 51 52 /* 53 * The TWL4030 "Triton 2" is one of a family of a multi-function "Power 54 * Management and System Companion Device" chips originally designed for 55 * use in OMAP2 and OMAP 3 based systems. Its control interfaces use I2C, 56 * often at around 3 Mbit/sec, including for interrupt handling. 57 * 58 * This driver core provides genirq support for the interrupts emitted, 59 * by the various modules, and exports register access primitives. 60 * 61 * FIXME this driver currently requires use of the first interrupt line 62 * (and associated registers). 63 */ 64 65 #define DRIVER_NAME "twl" 66 67 /* Triton Core internal information (BEGIN) */ 68 69 /* Base Address defns for twl4030_map[] */ 70 71 /* subchip/slave 0 - USB ID */ 72 #define TWL4030_BASEADD_USB 0x0000 73 74 /* subchip/slave 1 - AUD ID */ 75 #define TWL4030_BASEADD_AUDIO_VOICE 0x0000 76 #define TWL4030_BASEADD_GPIO 0x0098 77 #define TWL4030_BASEADD_INTBR 0x0085 78 #define TWL4030_BASEADD_PIH 0x0080 79 #define TWL4030_BASEADD_TEST 0x004C 80 81 /* subchip/slave 2 - AUX ID */ 82 #define TWL4030_BASEADD_INTERRUPTS 0x00B9 83 #define TWL4030_BASEADD_LED 0x00EE 84 #define TWL4030_BASEADD_MADC 0x0000 85 #define TWL4030_BASEADD_MAIN_CHARGE 0x0074 86 #define TWL4030_BASEADD_PRECHARGE 0x00AA 87 #define TWL4030_BASEADD_PWM 0x00F8 88 #define TWL4030_BASEADD_KEYPAD 0x00D2 89 90 #define TWL5031_BASEADD_ACCESSORY 0x0074 /* Replaces Main Charge */ 91 #define TWL5031_BASEADD_INTERRUPTS 0x00B9 /* Different than TWL4030's 92 one */ 93 94 /* subchip/slave 3 - POWER ID */ 95 #define TWL4030_BASEADD_BACKUP 0x0014 96 #define TWL4030_BASEADD_INT 0x002E 97 #define TWL4030_BASEADD_PM_MASTER 0x0036 98 #define TWL4030_BASEADD_PM_RECEIVER 0x005B 99 #define TWL4030_BASEADD_RTC 0x001C 100 #define TWL4030_BASEADD_SECURED_REG 0x0000 101 102 /* Triton Core internal information (END) */ 103 104 105 /* subchip/slave 0 0x48 - POWER */ 106 #define TWL6030_BASEADD_RTC 0x0000 107 #define TWL6030_BASEADD_SECURED_REG 0x0017 108 #define TWL6030_BASEADD_PM_MASTER 0x001F 109 #define TWL6030_BASEADD_PM_SLAVE_MISC 0x0030 /* PM_RECEIVER */ 110 #define TWL6030_BASEADD_PM_MISC 0x00E2 111 #define TWL6030_BASEADD_PM_PUPD 0x00F0 112 113 /* subchip/slave 1 0x49 - FEATURE */ 114 #define TWL6030_BASEADD_USB 0x0000 115 #define TWL6030_BASEADD_GPADC_CTRL 0x002E 116 #define TWL6030_BASEADD_AUX 0x0090 117 #define TWL6030_BASEADD_PWM 0x00BA 118 #define TWL6030_BASEADD_GASGAUGE 0x00C0 119 #define TWL6030_BASEADD_PIH 0x00D0 120 #define TWL6030_BASEADD_CHARGER 0x00E0 121 #define TWL6032_BASEADD_CHARGER 0x00DA 122 #define TWL6030_BASEADD_LED 0x00F4 123 124 /* subchip/slave 2 0x4A - DFT */ 125 #define TWL6030_BASEADD_DIEID 0x00C0 126 127 /* subchip/slave 3 0x4B - AUDIO */ 128 #define TWL6030_BASEADD_AUDIO 0x0000 129 #define TWL6030_BASEADD_RSV 0x0000 130 #define TWL6030_BASEADD_ZERO 0x0000 131 132 /* Few power values */ 133 #define R_CFG_BOOT 0x05 134 135 /* some fields in R_CFG_BOOT */ 136 #define HFCLK_FREQ_19p2_MHZ (1 << 0) 137 #define HFCLK_FREQ_26_MHZ (2 << 0) 138 #define HFCLK_FREQ_38p4_MHZ (3 << 0) 139 #define HIGH_PERF_SQ (1 << 3) 140 #define CK32K_LOWPWR_EN (1 << 7) 141 142 /*----------------------------------------------------------------------*/ 143 144 /* Structure for each TWL4030/TWL6030 Slave */ 145 struct twl_client { 146 struct i2c_client *client; 147 struct regmap *regmap; 148 }; 149 150 /* mapping the module id to slave id and base address */ 151 struct twl_mapping { 152 unsigned char sid; /* Slave ID */ 153 unsigned char base; /* base address */ 154 }; 155 156 struct twl_private { 157 bool ready; /* The core driver is ready to be used */ 158 u32 twl_idcode; /* TWL IDCODE Register value */ 159 unsigned int twl_id; 160 161 struct twl_mapping *twl_map; 162 struct twl_client *twl_modules; 163 }; 164 165 static struct twl_private *twl_priv; 166 167 static struct twl_mapping twl4030_map[] = { 168 /* 169 * NOTE: don't change this table without updating the 170 * <linux/i2c/twl.h> defines for TWL4030_MODULE_* 171 * so they continue to match the order in this table. 172 */ 173 174 /* Common IPs */ 175 { 0, TWL4030_BASEADD_USB }, 176 { 1, TWL4030_BASEADD_PIH }, 177 { 2, TWL4030_BASEADD_MAIN_CHARGE }, 178 { 3, TWL4030_BASEADD_PM_MASTER }, 179 { 3, TWL4030_BASEADD_PM_RECEIVER }, 180 181 { 3, TWL4030_BASEADD_RTC }, 182 { 2, TWL4030_BASEADD_PWM }, 183 { 2, TWL4030_BASEADD_LED }, 184 { 3, TWL4030_BASEADD_SECURED_REG }, 185 186 /* TWL4030 specific IPs */ 187 { 1, TWL4030_BASEADD_AUDIO_VOICE }, 188 { 1, TWL4030_BASEADD_GPIO }, 189 { 1, TWL4030_BASEADD_INTBR }, 190 { 1, TWL4030_BASEADD_TEST }, 191 { 2, TWL4030_BASEADD_KEYPAD }, 192 193 { 2, TWL4030_BASEADD_MADC }, 194 { 2, TWL4030_BASEADD_INTERRUPTS }, 195 { 2, TWL4030_BASEADD_PRECHARGE }, 196 { 3, TWL4030_BASEADD_BACKUP }, 197 { 3, TWL4030_BASEADD_INT }, 198 199 { 2, TWL5031_BASEADD_ACCESSORY }, 200 { 2, TWL5031_BASEADD_INTERRUPTS }, 201 }; 202 203 static struct regmap_config twl4030_regmap_config[4] = { 204 { 205 /* Address 0x48 */ 206 .reg_bits = 8, 207 .val_bits = 8, 208 .max_register = 0xff, 209 }, 210 { 211 /* Address 0x49 */ 212 .reg_bits = 8, 213 .val_bits = 8, 214 .max_register = 0xff, 215 }, 216 { 217 /* Address 0x4a */ 218 .reg_bits = 8, 219 .val_bits = 8, 220 .max_register = 0xff, 221 }, 222 { 223 /* Address 0x4b */ 224 .reg_bits = 8, 225 .val_bits = 8, 226 .max_register = 0xff, 227 }, 228 }; 229 230 static struct twl_mapping twl6030_map[] = { 231 /* 232 * NOTE: don't change this table without updating the 233 * <linux/i2c/twl.h> defines for TWL4030_MODULE_* 234 * so they continue to match the order in this table. 235 */ 236 237 /* Common IPs */ 238 { 1, TWL6030_BASEADD_USB }, 239 { 1, TWL6030_BASEADD_PIH }, 240 { 1, TWL6030_BASEADD_CHARGER }, 241 { 0, TWL6030_BASEADD_PM_MASTER }, 242 { 0, TWL6030_BASEADD_PM_SLAVE_MISC }, 243 244 { 0, TWL6030_BASEADD_RTC }, 245 { 1, TWL6030_BASEADD_PWM }, 246 { 1, TWL6030_BASEADD_LED }, 247 { 0, TWL6030_BASEADD_SECURED_REG }, 248 249 /* TWL6030 specific IPs */ 250 { 0, TWL6030_BASEADD_ZERO }, 251 { 1, TWL6030_BASEADD_ZERO }, 252 { 2, TWL6030_BASEADD_ZERO }, 253 { 1, TWL6030_BASEADD_GPADC_CTRL }, 254 { 1, TWL6030_BASEADD_GASGAUGE }, 255 }; 256 257 static struct regmap_config twl6030_regmap_config[3] = { 258 { 259 /* Address 0x48 */ 260 .reg_bits = 8, 261 .val_bits = 8, 262 .max_register = 0xff, 263 }, 264 { 265 /* Address 0x49 */ 266 .reg_bits = 8, 267 .val_bits = 8, 268 .max_register = 0xff, 269 }, 270 { 271 /* Address 0x4a */ 272 .reg_bits = 8, 273 .val_bits = 8, 274 .max_register = 0xff, 275 }, 276 }; 277 278 /*----------------------------------------------------------------------*/ 279 280 static inline int twl_get_num_slaves(void) 281 { 282 if (twl_class_is_4030()) 283 return 4; /* TWL4030 class have four slave address */ 284 else 285 return 3; /* TWL6030 class have three slave address */ 286 } 287 288 static inline int twl_get_last_module(void) 289 { 290 if (twl_class_is_4030()) 291 return TWL4030_MODULE_LAST; 292 else 293 return TWL6030_MODULE_LAST; 294 } 295 296 /* Exported Functions */ 297 298 unsigned int twl_rev(void) 299 { 300 return twl_priv ? twl_priv->twl_id : 0; 301 } 302 EXPORT_SYMBOL(twl_rev); 303 304 /** 305 * twl_get_regmap - Get the regmap associated with the given module 306 * @mod_no: module number 307 * 308 * Returns the regmap pointer or NULL in case of failure. 309 */ 310 static struct regmap *twl_get_regmap(u8 mod_no) 311 { 312 int sid; 313 struct twl_client *twl; 314 315 if (unlikely(!twl_priv || !twl_priv->ready)) { 316 pr_err("%s: not initialized\n", DRIVER_NAME); 317 return NULL; 318 } 319 if (unlikely(mod_no >= twl_get_last_module())) { 320 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); 321 return NULL; 322 } 323 324 sid = twl_priv->twl_map[mod_no].sid; 325 twl = &twl_priv->twl_modules[sid]; 326 327 return twl->regmap; 328 } 329 330 /** 331 * twl_i2c_write - Writes a n bit register in TWL4030/TWL5030/TWL60X0 332 * @mod_no: module number 333 * @value: an array of num_bytes+1 containing data to write 334 * @reg: register address (just offset will do) 335 * @num_bytes: number of bytes to transfer 336 * 337 * Returns the result of operation - 0 is success 338 */ 339 int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) 340 { 341 struct regmap *regmap = twl_get_regmap(mod_no); 342 int ret; 343 344 if (!regmap) 345 return -EPERM; 346 347 ret = regmap_bulk_write(regmap, twl_priv->twl_map[mod_no].base + reg, 348 value, num_bytes); 349 350 if (ret) 351 pr_err("%s: Write failed (mod %d, reg 0x%02x count %d)\n", 352 DRIVER_NAME, mod_no, reg, num_bytes); 353 354 return ret; 355 } 356 EXPORT_SYMBOL(twl_i2c_write); 357 358 /** 359 * twl_i2c_read - Reads a n bit register in TWL4030/TWL5030/TWL60X0 360 * @mod_no: module number 361 * @value: an array of num_bytes containing data to be read 362 * @reg: register address (just offset will do) 363 * @num_bytes: number of bytes to transfer 364 * 365 * Returns result of operation - num_bytes is success else failure. 366 */ 367 int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) 368 { 369 struct regmap *regmap = twl_get_regmap(mod_no); 370 int ret; 371 372 if (!regmap) 373 return -EPERM; 374 375 ret = regmap_bulk_read(regmap, twl_priv->twl_map[mod_no].base + reg, 376 value, num_bytes); 377 378 if (ret) 379 pr_err("%s: Read failed (mod %d, reg 0x%02x count %d)\n", 380 DRIVER_NAME, mod_no, reg, num_bytes); 381 382 return ret; 383 } 384 EXPORT_SYMBOL(twl_i2c_read); 385 386 /*----------------------------------------------------------------------*/ 387 388 /** 389 * twl_read_idcode_register - API to read the IDCODE register. 390 * 391 * Unlocks the IDCODE register and read the 32 bit value. 392 */ 393 static int twl_read_idcode_register(void) 394 { 395 int err; 396 397 err = twl_i2c_write_u8(TWL4030_MODULE_INTBR, TWL_EEPROM_R_UNLOCK, 398 REG_UNLOCK_TEST_REG); 399 if (err) { 400 pr_err("TWL4030 Unable to unlock IDCODE registers -%d\n", err); 401 goto fail; 402 } 403 404 err = twl_i2c_read(TWL4030_MODULE_INTBR, (u8 *)(&twl_priv->twl_idcode), 405 REG_IDCODE_7_0, 4); 406 if (err) { 407 pr_err("TWL4030: unable to read IDCODE -%d\n", err); 408 goto fail; 409 } 410 411 err = twl_i2c_write_u8(TWL4030_MODULE_INTBR, 0x0, REG_UNLOCK_TEST_REG); 412 if (err) 413 pr_err("TWL4030 Unable to relock IDCODE registers -%d\n", err); 414 fail: 415 return err; 416 } 417 418 /** 419 * twl_get_type - API to get TWL Si type. 420 * 421 * Api to get the TWL Si type from IDCODE value. 422 */ 423 int twl_get_type(void) 424 { 425 return TWL_SIL_TYPE(twl_priv->twl_idcode); 426 } 427 EXPORT_SYMBOL_GPL(twl_get_type); 428 429 /** 430 * twl_get_version - API to get TWL Si version. 431 * 432 * Api to get the TWL Si version from IDCODE value. 433 */ 434 int twl_get_version(void) 435 { 436 return TWL_SIL_REV(twl_priv->twl_idcode); 437 } 438 EXPORT_SYMBOL_GPL(twl_get_version); 439 440 /** 441 * twl_get_hfclk_rate - API to get TWL external HFCLK clock rate. 442 * 443 * Api to get the TWL HFCLK rate based on BOOT_CFG register. 444 */ 445 int twl_get_hfclk_rate(void) 446 { 447 u8 ctrl; 448 int rate; 449 450 twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &ctrl, R_CFG_BOOT); 451 452 switch (ctrl & 0x3) { 453 case HFCLK_FREQ_19p2_MHZ: 454 rate = 19200000; 455 break; 456 case HFCLK_FREQ_26_MHZ: 457 rate = 26000000; 458 break; 459 case HFCLK_FREQ_38p4_MHZ: 460 rate = 38400000; 461 break; 462 default: 463 pr_err("TWL4030: HFCLK is not configured\n"); 464 rate = -EINVAL; 465 break; 466 } 467 468 return rate; 469 } 470 EXPORT_SYMBOL_GPL(twl_get_hfclk_rate); 471 472 static struct device * 473 add_numbered_child(unsigned mod_no, const char *name, int num, 474 void *pdata, unsigned pdata_len, 475 bool can_wakeup, int irq0, int irq1) 476 { 477 struct platform_device *pdev; 478 struct twl_client *twl; 479 int status, sid; 480 481 if (unlikely(mod_no >= twl_get_last_module())) { 482 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); 483 return ERR_PTR(-EPERM); 484 } 485 sid = twl_priv->twl_map[mod_no].sid; 486 twl = &twl_priv->twl_modules[sid]; 487 488 pdev = platform_device_alloc(name, num); 489 if (!pdev) { 490 dev_dbg(&twl->client->dev, "can't alloc dev\n"); 491 status = -ENOMEM; 492 goto err; 493 } 494 495 pdev->dev.parent = &twl->client->dev; 496 497 if (pdata) { 498 status = platform_device_add_data(pdev, pdata, pdata_len); 499 if (status < 0) { 500 dev_dbg(&pdev->dev, "can't add platform_data\n"); 501 goto err; 502 } 503 } 504 505 if (irq0) { 506 struct resource r[2] = { 507 { .start = irq0, .flags = IORESOURCE_IRQ, }, 508 { .start = irq1, .flags = IORESOURCE_IRQ, }, 509 }; 510 511 status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1); 512 if (status < 0) { 513 dev_dbg(&pdev->dev, "can't add irqs\n"); 514 goto err; 515 } 516 } 517 518 status = platform_device_add(pdev); 519 if (status == 0) 520 device_init_wakeup(&pdev->dev, can_wakeup); 521 522 err: 523 if (status < 0) { 524 platform_device_put(pdev); 525 dev_err(&twl->client->dev, "can't add %s dev\n", name); 526 return ERR_PTR(status); 527 } 528 return &pdev->dev; 529 } 530 531 static inline struct device *add_child(unsigned mod_no, const char *name, 532 void *pdata, unsigned pdata_len, 533 bool can_wakeup, int irq0, int irq1) 534 { 535 return add_numbered_child(mod_no, name, -1, pdata, pdata_len, 536 can_wakeup, irq0, irq1); 537 } 538 539 static struct device * 540 add_regulator_linked(int num, struct regulator_init_data *pdata, 541 struct regulator_consumer_supply *consumers, 542 unsigned num_consumers, unsigned long features) 543 { 544 struct twl_regulator_driver_data drv_data; 545 546 /* regulator framework demands init_data ... */ 547 if (!pdata) 548 return NULL; 549 550 if (consumers) { 551 pdata->consumer_supplies = consumers; 552 pdata->num_consumer_supplies = num_consumers; 553 } 554 555 if (pdata->driver_data) { 556 /* If we have existing drv_data, just add the flags */ 557 struct twl_regulator_driver_data *tmp; 558 tmp = pdata->driver_data; 559 tmp->features |= features; 560 } else { 561 /* add new driver data struct, used only during init */ 562 drv_data.features = features; 563 drv_data.set_voltage = NULL; 564 drv_data.get_voltage = NULL; 565 drv_data.data = NULL; 566 pdata->driver_data = &drv_data; 567 } 568 569 /* NOTE: we currently ignore regulator IRQs, e.g. for short circuits */ 570 return add_numbered_child(TWL_MODULE_PM_MASTER, "twl_reg", num, 571 pdata, sizeof(*pdata), false, 0, 0); 572 } 573 574 static struct device * 575 add_regulator(int num, struct regulator_init_data *pdata, 576 unsigned long features) 577 { 578 return add_regulator_linked(num, pdata, NULL, 0, features); 579 } 580 581 /* 582 * NOTE: We know the first 8 IRQs after pdata->base_irq are 583 * for the PIH, and the next are for the PWR_INT SIH, since 584 * that's how twl_init_irq() sets things up. 585 */ 586 587 static int 588 add_children(struct twl4030_platform_data *pdata, unsigned irq_base, 589 unsigned long features) 590 { 591 struct device *child; 592 593 if (IS_ENABLED(CONFIG_GPIO_TWL4030) && pdata->gpio) { 594 child = add_child(TWL4030_MODULE_GPIO, "twl4030_gpio", 595 pdata->gpio, sizeof(*pdata->gpio), 596 false, irq_base + GPIO_INTR_OFFSET, 0); 597 if (IS_ERR(child)) 598 return PTR_ERR(child); 599 } 600 601 if (IS_ENABLED(CONFIG_KEYBOARD_TWL4030) && pdata->keypad) { 602 child = add_child(TWL4030_MODULE_KEYPAD, "twl4030_keypad", 603 pdata->keypad, sizeof(*pdata->keypad), 604 true, irq_base + KEYPAD_INTR_OFFSET, 0); 605 if (IS_ERR(child)) 606 return PTR_ERR(child); 607 } 608 609 if (IS_ENABLED(CONFIG_TWL4030_MADC) && pdata->madc && 610 twl_class_is_4030()) { 611 child = add_child(TWL4030_MODULE_MADC, "twl4030_madc", 612 pdata->madc, sizeof(*pdata->madc), 613 true, irq_base + MADC_INTR_OFFSET, 0); 614 if (IS_ERR(child)) 615 return PTR_ERR(child); 616 } 617 618 if (IS_ENABLED(CONFIG_RTC_DRV_TWL4030)) { 619 /* 620 * REVISIT platform_data here currently might expose the 621 * "msecure" line ... but for now we just expect board 622 * setup to tell the chip "it's always ok to SET_TIME". 623 * Eventually, Linux might become more aware of such 624 * HW security concerns, and "least privilege". 625 */ 626 child = add_child(TWL_MODULE_RTC, "twl_rtc", NULL, 0, 627 true, irq_base + RTC_INTR_OFFSET, 0); 628 if (IS_ERR(child)) 629 return PTR_ERR(child); 630 } 631 632 if (IS_ENABLED(CONFIG_PWM_TWL)) { 633 child = add_child(TWL_MODULE_PWM, "twl-pwm", NULL, 0, 634 false, 0, 0); 635 if (IS_ERR(child)) 636 return PTR_ERR(child); 637 } 638 639 if (IS_ENABLED(CONFIG_PWM_TWL_LED)) { 640 child = add_child(TWL_MODULE_LED, "twl-pwmled", NULL, 0, 641 false, 0, 0); 642 if (IS_ERR(child)) 643 return PTR_ERR(child); 644 } 645 646 if (IS_ENABLED(CONFIG_TWL4030_USB) && pdata->usb && 647 twl_class_is_4030()) { 648 649 static struct regulator_consumer_supply usb1v5 = { 650 .supply = "usb1v5", 651 }; 652 static struct regulator_consumer_supply usb1v8 = { 653 .supply = "usb1v8", 654 }; 655 static struct regulator_consumer_supply usb3v1[] = { 656 { .supply = "usb3v1" }, 657 { .supply = "bci3v1" }, 658 }; 659 660 /* First add the regulators so that they can be used by transceiver */ 661 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030)) { 662 /* this is a template that gets copied */ 663 struct regulator_init_data usb_fixed = { 664 .constraints.valid_modes_mask = 665 REGULATOR_MODE_NORMAL 666 | REGULATOR_MODE_STANDBY, 667 .constraints.valid_ops_mask = 668 REGULATOR_CHANGE_MODE 669 | REGULATOR_CHANGE_STATUS, 670 }; 671 672 child = add_regulator_linked(TWL4030_REG_VUSB1V5, 673 &usb_fixed, &usb1v5, 1, 674 features); 675 if (IS_ERR(child)) 676 return PTR_ERR(child); 677 678 child = add_regulator_linked(TWL4030_REG_VUSB1V8, 679 &usb_fixed, &usb1v8, 1, 680 features); 681 if (IS_ERR(child)) 682 return PTR_ERR(child); 683 684 child = add_regulator_linked(TWL4030_REG_VUSB3V1, 685 &usb_fixed, usb3v1, 2, 686 features); 687 if (IS_ERR(child)) 688 return PTR_ERR(child); 689 690 } 691 692 child = add_child(TWL_MODULE_USB, "twl4030_usb", 693 pdata->usb, sizeof(*pdata->usb), true, 694 /* irq0 = USB_PRES, irq1 = USB */ 695 irq_base + USB_PRES_INTR_OFFSET, 696 irq_base + USB_INTR_OFFSET); 697 698 if (IS_ERR(child)) 699 return PTR_ERR(child); 700 701 /* we need to connect regulators to this transceiver */ 702 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && child) { 703 usb1v5.dev_name = dev_name(child); 704 usb1v8.dev_name = dev_name(child); 705 usb3v1[0].dev_name = dev_name(child); 706 } 707 } 708 if (IS_ENABLED(CONFIG_TWL6030_USB) && pdata->usb && 709 twl_class_is_6030()) { 710 711 static struct regulator_consumer_supply usb3v3; 712 int regulator; 713 714 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030)) { 715 /* this is a template that gets copied */ 716 struct regulator_init_data usb_fixed = { 717 .constraints.valid_modes_mask = 718 REGULATOR_MODE_NORMAL 719 | REGULATOR_MODE_STANDBY, 720 .constraints.valid_ops_mask = 721 REGULATOR_CHANGE_MODE 722 | REGULATOR_CHANGE_STATUS, 723 }; 724 725 if (features & TWL6032_SUBCLASS) { 726 usb3v3.supply = "ldousb"; 727 regulator = TWL6032_REG_LDOUSB; 728 } else { 729 usb3v3.supply = "vusb"; 730 regulator = TWL6030_REG_VUSB; 731 } 732 child = add_regulator_linked(regulator, &usb_fixed, 733 &usb3v3, 1, 734 features); 735 if (IS_ERR(child)) 736 return PTR_ERR(child); 737 } 738 739 pdata->usb->features = features; 740 741 child = add_child(TWL_MODULE_USB, "twl6030_usb", 742 pdata->usb, sizeof(*pdata->usb), true, 743 /* irq1 = VBUS_PRES, irq0 = USB ID */ 744 irq_base + USBOTG_INTR_OFFSET, 745 irq_base + USB_PRES_INTR_OFFSET); 746 747 if (IS_ERR(child)) 748 return PTR_ERR(child); 749 /* we need to connect regulators to this transceiver */ 750 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && child) 751 usb3v3.dev_name = dev_name(child); 752 } else if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && 753 twl_class_is_6030()) { 754 if (features & TWL6032_SUBCLASS) 755 child = add_regulator(TWL6032_REG_LDOUSB, 756 pdata->ldousb, features); 757 else 758 child = add_regulator(TWL6030_REG_VUSB, 759 pdata->vusb, features); 760 761 if (IS_ERR(child)) 762 return PTR_ERR(child); 763 } 764 765 if (IS_ENABLED(CONFIG_TWL4030_WATCHDOG) && twl_class_is_4030()) { 766 child = add_child(TWL_MODULE_PM_RECEIVER, "twl4030_wdt", NULL, 767 0, false, 0, 0); 768 if (IS_ERR(child)) 769 return PTR_ERR(child); 770 } 771 772 if (IS_ENABLED(CONFIG_INPUT_TWL4030_PWRBUTTON) && twl_class_is_4030()) { 773 child = add_child(TWL_MODULE_PM_MASTER, "twl4030_pwrbutton", 774 NULL, 0, true, irq_base + 8 + 0, 0); 775 if (IS_ERR(child)) 776 return PTR_ERR(child); 777 } 778 779 if (IS_ENABLED(CONFIG_MFD_TWL4030_AUDIO) && pdata->audio && 780 twl_class_is_4030()) { 781 child = add_child(TWL4030_MODULE_AUDIO_VOICE, "twl4030-audio", 782 pdata->audio, sizeof(*pdata->audio), 783 false, 0, 0); 784 if (IS_ERR(child)) 785 return PTR_ERR(child); 786 } 787 788 /* twl4030 regulators */ 789 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_4030()) { 790 child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1, 791 features); 792 if (IS_ERR(child)) 793 return PTR_ERR(child); 794 795 child = add_regulator(TWL4030_REG_VIO, pdata->vio, 796 features); 797 if (IS_ERR(child)) 798 return PTR_ERR(child); 799 800 child = add_regulator(TWL4030_REG_VDD1, pdata->vdd1, 801 features); 802 if (IS_ERR(child)) 803 return PTR_ERR(child); 804 805 child = add_regulator(TWL4030_REG_VDD2, pdata->vdd2, 806 features); 807 if (IS_ERR(child)) 808 return PTR_ERR(child); 809 810 child = add_regulator(TWL4030_REG_VMMC1, pdata->vmmc1, 811 features); 812 if (IS_ERR(child)) 813 return PTR_ERR(child); 814 815 child = add_regulator(TWL4030_REG_VDAC, pdata->vdac, 816 features); 817 if (IS_ERR(child)) 818 return PTR_ERR(child); 819 820 child = add_regulator((features & TWL4030_VAUX2) 821 ? TWL4030_REG_VAUX2_4030 822 : TWL4030_REG_VAUX2, 823 pdata->vaux2, features); 824 if (IS_ERR(child)) 825 return PTR_ERR(child); 826 827 child = add_regulator(TWL4030_REG_VINTANA1, pdata->vintana1, 828 features); 829 if (IS_ERR(child)) 830 return PTR_ERR(child); 831 832 child = add_regulator(TWL4030_REG_VINTANA2, pdata->vintana2, 833 features); 834 if (IS_ERR(child)) 835 return PTR_ERR(child); 836 837 child = add_regulator(TWL4030_REG_VINTDIG, pdata->vintdig, 838 features); 839 if (IS_ERR(child)) 840 return PTR_ERR(child); 841 } 842 843 /* maybe add LDOs that are omitted on cost-reduced parts */ 844 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && !(features & TPS_SUBSET) 845 && twl_class_is_4030()) { 846 child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2, 847 features); 848 if (IS_ERR(child)) 849 return PTR_ERR(child); 850 851 child = add_regulator(TWL4030_REG_VMMC2, pdata->vmmc2, 852 features); 853 if (IS_ERR(child)) 854 return PTR_ERR(child); 855 856 child = add_regulator(TWL4030_REG_VSIM, pdata->vsim, 857 features); 858 if (IS_ERR(child)) 859 return PTR_ERR(child); 860 861 child = add_regulator(TWL4030_REG_VAUX1, pdata->vaux1, 862 features); 863 if (IS_ERR(child)) 864 return PTR_ERR(child); 865 866 child = add_regulator(TWL4030_REG_VAUX3, pdata->vaux3, 867 features); 868 if (IS_ERR(child)) 869 return PTR_ERR(child); 870 871 child = add_regulator(TWL4030_REG_VAUX4, pdata->vaux4, 872 features); 873 if (IS_ERR(child)) 874 return PTR_ERR(child); 875 } 876 877 /* twl6030 regulators */ 878 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() && 879 !(features & TWL6032_SUBCLASS)) { 880 child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1, 881 features); 882 if (IS_ERR(child)) 883 return PTR_ERR(child); 884 885 child = add_regulator(TWL6030_REG_VDD2, pdata->vdd2, 886 features); 887 if (IS_ERR(child)) 888 return PTR_ERR(child); 889 890 child = add_regulator(TWL6030_REG_VDD3, pdata->vdd3, 891 features); 892 if (IS_ERR(child)) 893 return PTR_ERR(child); 894 895 child = add_regulator(TWL6030_REG_V1V8, pdata->v1v8, 896 features); 897 if (IS_ERR(child)) 898 return PTR_ERR(child); 899 900 child = add_regulator(TWL6030_REG_V2V1, pdata->v2v1, 901 features); 902 if (IS_ERR(child)) 903 return PTR_ERR(child); 904 905 child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc, 906 features); 907 if (IS_ERR(child)) 908 return PTR_ERR(child); 909 910 child = add_regulator(TWL6030_REG_VPP, pdata->vpp, 911 features); 912 if (IS_ERR(child)) 913 return PTR_ERR(child); 914 915 child = add_regulator(TWL6030_REG_VUSIM, pdata->vusim, 916 features); 917 if (IS_ERR(child)) 918 return PTR_ERR(child); 919 920 child = add_regulator(TWL6030_REG_VCXIO, pdata->vcxio, 921 features); 922 if (IS_ERR(child)) 923 return PTR_ERR(child); 924 925 child = add_regulator(TWL6030_REG_VDAC, pdata->vdac, 926 features); 927 if (IS_ERR(child)) 928 return PTR_ERR(child); 929 930 child = add_regulator(TWL6030_REG_VAUX1_6030, pdata->vaux1, 931 features); 932 if (IS_ERR(child)) 933 return PTR_ERR(child); 934 935 child = add_regulator(TWL6030_REG_VAUX2_6030, pdata->vaux2, 936 features); 937 if (IS_ERR(child)) 938 return PTR_ERR(child); 939 940 child = add_regulator(TWL6030_REG_VAUX3_6030, pdata->vaux3, 941 features); 942 if (IS_ERR(child)) 943 return PTR_ERR(child); 944 945 child = add_regulator(TWL6030_REG_CLK32KG, pdata->clk32kg, 946 features); 947 if (IS_ERR(child)) 948 return PTR_ERR(child); 949 } 950 951 /* 6030 and 6025 share this regulator */ 952 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030()) { 953 child = add_regulator(TWL6030_REG_VANA, pdata->vana, 954 features); 955 if (IS_ERR(child)) 956 return PTR_ERR(child); 957 } 958 959 /* twl6032 regulators */ 960 if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() && 961 (features & TWL6032_SUBCLASS)) { 962 child = add_regulator(TWL6032_REG_LDO5, pdata->ldo5, 963 features); 964 if (IS_ERR(child)) 965 return PTR_ERR(child); 966 967 child = add_regulator(TWL6032_REG_LDO1, pdata->ldo1, 968 features); 969 if (IS_ERR(child)) 970 return PTR_ERR(child); 971 972 child = add_regulator(TWL6032_REG_LDO7, pdata->ldo7, 973 features); 974 if (IS_ERR(child)) 975 return PTR_ERR(child); 976 977 child = add_regulator(TWL6032_REG_LDO6, pdata->ldo6, 978 features); 979 if (IS_ERR(child)) 980 return PTR_ERR(child); 981 982 child = add_regulator(TWL6032_REG_LDOLN, pdata->ldoln, 983 features); 984 if (IS_ERR(child)) 985 return PTR_ERR(child); 986 987 child = add_regulator(TWL6032_REG_LDO2, pdata->ldo2, 988 features); 989 if (IS_ERR(child)) 990 return PTR_ERR(child); 991 992 child = add_regulator(TWL6032_REG_LDO4, pdata->ldo4, 993 features); 994 if (IS_ERR(child)) 995 return PTR_ERR(child); 996 997 child = add_regulator(TWL6032_REG_LDO3, pdata->ldo3, 998 features); 999 if (IS_ERR(child)) 1000 return PTR_ERR(child); 1001 1002 child = add_regulator(TWL6032_REG_SMPS3, pdata->smps3, 1003 features); 1004 if (IS_ERR(child)) 1005 return PTR_ERR(child); 1006 1007 child = add_regulator(TWL6032_REG_SMPS4, pdata->smps4, 1008 features); 1009 if (IS_ERR(child)) 1010 return PTR_ERR(child); 1011 1012 child = add_regulator(TWL6032_REG_VIO, pdata->vio6025, 1013 features); 1014 if (IS_ERR(child)) 1015 return PTR_ERR(child); 1016 1017 } 1018 1019 if (IS_ENABLED(CONFIG_CHARGER_TWL4030) && pdata->bci && 1020 !(features & (TPS_SUBSET | TWL5031))) { 1021 child = add_child(TWL_MODULE_MAIN_CHARGE, "twl4030_bci", 1022 pdata->bci, sizeof(*pdata->bci), false, 1023 /* irq0 = CHG_PRES, irq1 = BCI */ 1024 irq_base + BCI_PRES_INTR_OFFSET, 1025 irq_base + BCI_INTR_OFFSET); 1026 if (IS_ERR(child)) 1027 return PTR_ERR(child); 1028 } 1029 1030 if (IS_ENABLED(CONFIG_TWL4030_POWER) && pdata->power) { 1031 child = add_child(TWL_MODULE_PM_MASTER, "twl4030_power", 1032 pdata->power, sizeof(*pdata->power), false, 1033 0, 0); 1034 if (IS_ERR(child)) 1035 return PTR_ERR(child); 1036 } 1037 1038 return 0; 1039 } 1040 1041 /*----------------------------------------------------------------------*/ 1042 1043 /* 1044 * These three functions initialize the on-chip clock framework, 1045 * letting it generate the right frequencies for USB, MADC, and 1046 * other purposes. 1047 */ 1048 static inline int __init protect_pm_master(void) 1049 { 1050 int e = 0; 1051 1052 e = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, 1053 TWL4030_PM_MASTER_PROTECT_KEY); 1054 return e; 1055 } 1056 1057 static inline int __init unprotect_pm_master(void) 1058 { 1059 int e = 0; 1060 1061 e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, 1062 TWL4030_PM_MASTER_PROTECT_KEY); 1063 e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2, 1064 TWL4030_PM_MASTER_PROTECT_KEY); 1065 1066 return e; 1067 } 1068 1069 static void clocks_init(struct device *dev, 1070 struct twl4030_clock_init_data *clock) 1071 { 1072 int e = 0; 1073 struct clk *osc; 1074 u32 rate; 1075 u8 ctrl = HFCLK_FREQ_26_MHZ; 1076 1077 osc = clk_get(dev, "fck"); 1078 if (IS_ERR(osc)) { 1079 printk(KERN_WARNING "Skipping twl internal clock init and " 1080 "using bootloader value (unknown osc rate)\n"); 1081 return; 1082 } 1083 1084 rate = clk_get_rate(osc); 1085 clk_put(osc); 1086 1087 switch (rate) { 1088 case 19200000: 1089 ctrl = HFCLK_FREQ_19p2_MHZ; 1090 break; 1091 case 26000000: 1092 ctrl = HFCLK_FREQ_26_MHZ; 1093 break; 1094 case 38400000: 1095 ctrl = HFCLK_FREQ_38p4_MHZ; 1096 break; 1097 } 1098 1099 ctrl |= HIGH_PERF_SQ; 1100 if (clock && clock->ck32k_lowpwr_enable) 1101 ctrl |= CK32K_LOWPWR_EN; 1102 1103 e |= unprotect_pm_master(); 1104 /* effect->MADC+USB ck en */ 1105 e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, ctrl, R_CFG_BOOT); 1106 e |= protect_pm_master(); 1107 1108 if (e < 0) 1109 pr_err("%s: clock init err [%d]\n", DRIVER_NAME, e); 1110 } 1111 1112 /*----------------------------------------------------------------------*/ 1113 1114 1115 static int twl_remove(struct i2c_client *client) 1116 { 1117 unsigned i, num_slaves; 1118 int status; 1119 1120 if (twl_class_is_4030()) 1121 status = twl4030_exit_irq(); 1122 else 1123 status = twl6030_exit_irq(); 1124 1125 if (status < 0) 1126 return status; 1127 1128 num_slaves = twl_get_num_slaves(); 1129 for (i = 0; i < num_slaves; i++) { 1130 struct twl_client *twl = &twl_priv->twl_modules[i]; 1131 1132 if (twl->client && twl->client != client) 1133 i2c_unregister_device(twl->client); 1134 twl->client = NULL; 1135 } 1136 twl_priv->ready = false; 1137 return 0; 1138 } 1139 1140 /* NOTE: This driver only handles a single twl4030/tps659x0 chip */ 1141 static int 1142 twl_probe(struct i2c_client *client, const struct i2c_device_id *id) 1143 { 1144 struct twl4030_platform_data *pdata = dev_get_platdata(&client->dev); 1145 struct device_node *node = client->dev.of_node; 1146 struct platform_device *pdev; 1147 struct regmap_config *twl_regmap_config; 1148 int irq_base = 0; 1149 int status; 1150 unsigned i, num_slaves; 1151 1152 if (!node && !pdata) { 1153 dev_err(&client->dev, "no platform data\n"); 1154 return -EINVAL; 1155 } 1156 1157 if (twl_priv) { 1158 dev_dbg(&client->dev, "only one instance of %s allowed\n", 1159 DRIVER_NAME); 1160 return -EBUSY; 1161 } 1162 1163 pdev = platform_device_alloc(DRIVER_NAME, -1); 1164 if (!pdev) { 1165 dev_err(&client->dev, "can't alloc pdev\n"); 1166 return -ENOMEM; 1167 } 1168 1169 status = platform_device_add(pdev); 1170 if (status) { 1171 platform_device_put(pdev); 1172 return status; 1173 } 1174 1175 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) { 1176 dev_dbg(&client->dev, "can't talk I2C?\n"); 1177 status = -EIO; 1178 goto free; 1179 } 1180 1181 twl_priv = devm_kzalloc(&client->dev, sizeof(struct twl_private), 1182 GFP_KERNEL); 1183 if (!twl_priv) { 1184 status = -ENOMEM; 1185 goto free; 1186 } 1187 1188 if ((id->driver_data) & TWL6030_CLASS) { 1189 twl_priv->twl_id = TWL6030_CLASS_ID; 1190 twl_priv->twl_map = &twl6030_map[0]; 1191 /* The charger base address is different in twl6032 */ 1192 if ((id->driver_data) & TWL6032_SUBCLASS) 1193 twl_priv->twl_map[TWL_MODULE_MAIN_CHARGE].base = 1194 TWL6032_BASEADD_CHARGER; 1195 twl_regmap_config = twl6030_regmap_config; 1196 } else { 1197 twl_priv->twl_id = TWL4030_CLASS_ID; 1198 twl_priv->twl_map = &twl4030_map[0]; 1199 twl_regmap_config = twl4030_regmap_config; 1200 } 1201 1202 num_slaves = twl_get_num_slaves(); 1203 twl_priv->twl_modules = devm_kzalloc(&client->dev, 1204 sizeof(struct twl_client) * num_slaves, 1205 GFP_KERNEL); 1206 if (!twl_priv->twl_modules) { 1207 status = -ENOMEM; 1208 goto free; 1209 } 1210 1211 for (i = 0; i < num_slaves; i++) { 1212 struct twl_client *twl = &twl_priv->twl_modules[i]; 1213 1214 if (i == 0) { 1215 twl->client = client; 1216 } else { 1217 twl->client = i2c_new_dummy(client->adapter, 1218 client->addr + i); 1219 if (!twl->client) { 1220 dev_err(&client->dev, 1221 "can't attach client %d\n", i); 1222 status = -ENOMEM; 1223 goto fail; 1224 } 1225 } 1226 1227 twl->regmap = devm_regmap_init_i2c(twl->client, 1228 &twl_regmap_config[i]); 1229 if (IS_ERR(twl->regmap)) { 1230 status = PTR_ERR(twl->regmap); 1231 dev_err(&client->dev, 1232 "Failed to allocate regmap %d, err: %d\n", i, 1233 status); 1234 goto fail; 1235 } 1236 } 1237 1238 twl_priv->ready = true; 1239 1240 /* setup clock framework */ 1241 clocks_init(&pdev->dev, pdata ? pdata->clock : NULL); 1242 1243 /* read TWL IDCODE Register */ 1244 if (twl_class_is_4030()) { 1245 status = twl_read_idcode_register(); 1246 WARN(status < 0, "Error: reading twl_idcode register value\n"); 1247 } 1248 1249 /* Maybe init the T2 Interrupt subsystem */ 1250 if (client->irq) { 1251 if (twl_class_is_4030()) { 1252 twl4030_init_chip_irq(id->name); 1253 irq_base = twl4030_init_irq(&client->dev, client->irq); 1254 } else { 1255 irq_base = twl6030_init_irq(&client->dev, client->irq); 1256 } 1257 1258 if (irq_base < 0) { 1259 status = irq_base; 1260 goto fail; 1261 } 1262 } 1263 1264 /* 1265 * Disable TWL4030/TWL5030 I2C Pull-up on I2C1 and I2C4(SR) interface. 1266 * Program I2C_SCL_CTRL_PU(bit 0)=0, I2C_SDA_CTRL_PU (bit 2)=0, 1267 * SR_I2C_SCL_CTRL_PU(bit 4)=0 and SR_I2C_SDA_CTRL_PU(bit 6)=0. 1268 */ 1269 if (twl_class_is_4030()) { 1270 u8 temp; 1271 1272 twl_i2c_read_u8(TWL4030_MODULE_INTBR, &temp, REG_GPPUPDCTR1); 1273 temp &= ~(SR_I2C_SDA_CTRL_PU | SR_I2C_SCL_CTRL_PU | \ 1274 I2C_SDA_CTRL_PU | I2C_SCL_CTRL_PU); 1275 twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1); 1276 } 1277 1278 if (node) 1279 status = of_platform_populate(node, NULL, NULL, &client->dev); 1280 else 1281 status = add_children(pdata, irq_base, id->driver_data); 1282 1283 fail: 1284 if (status < 0) 1285 twl_remove(client); 1286 free: 1287 if (status < 0) 1288 platform_device_unregister(pdev); 1289 1290 return status; 1291 } 1292 1293 static const struct i2c_device_id twl_ids[] = { 1294 { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */ 1295 { "twl5030", 0 }, /* T2 updated */ 1296 { "twl5031", TWL5031 }, /* TWL5030 updated */ 1297 { "tps65950", 0 }, /* catalog version of twl5030 */ 1298 { "tps65930", TPS_SUBSET }, /* fewer LDOs and DACs; no charger */ 1299 { "tps65920", TPS_SUBSET }, /* fewer LDOs; no codec or charger */ 1300 { "tps65921", TPS_SUBSET }, /* fewer LDOs; no codec, no LED 1301 and vibrator. Charger in USB module*/ 1302 { "twl6030", TWL6030_CLASS }, /* "Phoenix power chip" */ 1303 { "twl6032", TWL6030_CLASS | TWL6032_SUBCLASS }, /* "Phoenix lite" */ 1304 { /* end of list */ }, 1305 }; 1306 MODULE_DEVICE_TABLE(i2c, twl_ids); 1307 1308 /* One Client Driver , 4 Clients */ 1309 static struct i2c_driver twl_driver = { 1310 .driver.name = DRIVER_NAME, 1311 .id_table = twl_ids, 1312 .probe = twl_probe, 1313 .remove = twl_remove, 1314 }; 1315 1316 module_i2c_driver(twl_driver); 1317 1318 MODULE_AUTHOR("Texas Instruments, Inc."); 1319 MODULE_DESCRIPTION("I2C Core interface for TWL"); 1320 MODULE_LICENSE("GPL"); 1321