twl4030-core.c 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257
  1. /*
  2. * twl4030_core.c - driver for TWL4030/TPS659x0 PM and audio CODEC devices
  3. *
  4. * Copyright (C) 2005-2006 Texas Instruments, Inc.
  5. *
  6. * Modifications to defer interrupt handling to a kernel thread:
  7. * Copyright (C) 2006 MontaVista Software, Inc.
  8. *
  9. * Based on tlv320aic23.c:
  10. * Copyright (c) by Kai Svahn <kai.svahn@nokia.com>
  11. *
  12. * Code cleanup and modifications to IRQ handler.
  13. * by syed khasim <x0khasim@ti.com>
  14. *
  15. * This program is free software; you can redistribute it and/or modify
  16. * it under the terms of the GNU General Public License as published by
  17. * the Free Software Foundation; either version 2 of the License, or
  18. * (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  28. */
  29. #include <linux/kernel_stat.h>
  30. #include <linux/init.h>
  31. #include <linux/mutex.h>
  32. #include <linux/interrupt.h>
  33. #include <linux/irq.h>
  34. #include <linux/random.h>
  35. #include <linux/kthread.h>
  36. #include <linux/platform_device.h>
  37. #include <linux/clk.h>
  38. #include <linux/i2c.h>
  39. #include <linux/i2c/twl4030.h>
  40. /*
  41. * The TWL4030 "Triton 2" is one of a family of a multi-function "Power
  42. * Management and System Companion Device" chips originally designed for
  43. * use in OMAP2 and OMAP 3 based systems. Its control interfaces use I2C,
  44. * often at around 3 Mbit/sec, including for interrupt handling.
  45. *
  46. * This driver core provides genirq support for the interrupts emitted,
  47. * by the various modules, and exports register access primitives.
  48. *
  49. * FIXME this driver currently requires use of the first interrupt line
  50. * (and associated registers).
  51. */
  52. #define DRIVER_NAME "twl4030"
  53. #if defined(CONFIG_TWL4030_BCI_BATTERY) || \
  54. defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
  55. #define twl_has_bci() true
  56. #else
  57. #define twl_has_bci() false
  58. #endif
  59. #if defined(CONFIG_KEYBOARD_TWL4030) || defined(CONFIG_KEYBOARD_TWL4030_MODULE)
  60. #define twl_has_keypad() true
  61. #else
  62. #define twl_has_keypad() false
  63. #endif
  64. #if defined(CONFIG_GPIO_TWL4030) || defined(CONFIG_GPIO_TWL4030_MODULE)
  65. #define twl_has_gpio() true
  66. #else
  67. #define twl_has_gpio() false
  68. #endif
  69. #if defined(CONFIG_TWL4030_MADC) || defined(CONFIG_TWL4030_MADC_MODULE)
  70. #define twl_has_madc() true
  71. #else
  72. #define twl_has_madc() false
  73. #endif
  74. #if defined(CONFIG_RTC_DRV_TWL4030) || defined(CONFIG_RTC_DRV_TWL4030_MODULE)
  75. #define twl_has_rtc() true
  76. #else
  77. #define twl_has_rtc() false
  78. #endif
  79. #if defined(CONFIG_TWL4030_USB) || defined(CONFIG_TWL4030_USB_MODULE)
  80. #define twl_has_usb() true
  81. #else
  82. #define twl_has_usb() false
  83. #endif
  84. static inline void activate_irq(int irq)
  85. {
  86. #ifdef CONFIG_ARM
  87. /* ARM requires an extra step to clear IRQ_NOREQUEST, which it
  88. * sets on behalf of every irq_chip. Also sets IRQ_NOPROBE.
  89. */
  90. set_irq_flags(irq, IRQF_VALID);
  91. #else
  92. /* same effect on other architectures */
  93. set_irq_noprobe(irq);
  94. #endif
  95. }
  96. /* Primary Interrupt Handler on TWL4030 Registers */
  97. /* Register Definitions */
  98. #define REG_PIH_ISR_P1 (0x1)
  99. #define REG_PIH_ISR_P2 (0x2)
  100. #define REG_PIH_SIR (0x3)
  101. /* Triton Core internal information (BEGIN) */
  102. /* Last - for index max*/
  103. #define TWL4030_MODULE_LAST TWL4030_MODULE_SECURED_REG
  104. #define TWL4030_NUM_SLAVES 4
  105. /* Base Address defns for twl4030_map[] */
  106. /* subchip/slave 0 - USB ID */
  107. #define TWL4030_BASEADD_USB 0x0000
  108. /* subchip/slave 1 - AUD ID */
  109. #define TWL4030_BASEADD_AUDIO_VOICE 0x0000
  110. #define TWL4030_BASEADD_GPIO 0x0098
  111. #define TWL4030_BASEADD_INTBR 0x0085
  112. #define TWL4030_BASEADD_PIH 0x0080
  113. #define TWL4030_BASEADD_TEST 0x004C
  114. /* subchip/slave 2 - AUX ID */
  115. #define TWL4030_BASEADD_INTERRUPTS 0x00B9
  116. #define TWL4030_BASEADD_LED 0x00EE
  117. #define TWL4030_BASEADD_MADC 0x0000
  118. #define TWL4030_BASEADD_MAIN_CHARGE 0x0074
  119. #define TWL4030_BASEADD_PRECHARGE 0x00AA
  120. #define TWL4030_BASEADD_PWM0 0x00F8
  121. #define TWL4030_BASEADD_PWM1 0x00FB
  122. #define TWL4030_BASEADD_PWMA 0x00EF
  123. #define TWL4030_BASEADD_PWMB 0x00F1
  124. #define TWL4030_BASEADD_KEYPAD 0x00D2
  125. /* subchip/slave 3 - POWER ID */
  126. #define TWL4030_BASEADD_BACKUP 0x0014
  127. #define TWL4030_BASEADD_INT 0x002E
  128. #define TWL4030_BASEADD_PM_MASTER 0x0036
  129. #define TWL4030_BASEADD_PM_RECEIVER 0x005B
  130. #define TWL4030_BASEADD_RTC 0x001C
  131. #define TWL4030_BASEADD_SECURED_REG 0x0000
  132. /* Triton Core internal information (END) */
  133. /* Few power values */
  134. #define R_CFG_BOOT 0x05
  135. #define R_PROTECT_KEY 0x0E
  136. /* access control values for R_PROTECT_KEY */
  137. #define KEY_UNLOCK1 0xce
  138. #define KEY_UNLOCK2 0xec
  139. #define KEY_LOCK 0x00
  140. /* some fields in R_CFG_BOOT */
  141. #define HFCLK_FREQ_19p2_MHZ (1 << 0)
  142. #define HFCLK_FREQ_26_MHZ (2 << 0)
  143. #define HFCLK_FREQ_38p4_MHZ (3 << 0)
  144. #define HIGH_PERF_SQ (1 << 3)
  145. /*----------------------------------------------------------------------*/
  146. /**
  147. * struct twl4030_mod_iregs - TWL module IMR/ISR regs to mask/clear at init
  148. * @mod_no: TWL4030 module number (e.g., TWL4030_MODULE_GPIO)
  149. * @sih_ctrl: address of module SIH_CTRL register
  150. * @reg_cnt: number of IMR/ISR regs
  151. * @imrs: pointer to array of TWL module interrupt mask register indices
  152. * @isrs: pointer to array of TWL module interrupt status register indices
  153. *
  154. * Ties together TWL4030 modules and lists of IMR/ISR registers to mask/clear
  155. * during twl_init_irq().
  156. */
  157. struct twl4030_mod_iregs {
  158. const u8 mod_no;
  159. const u8 sih_ctrl;
  160. const u8 reg_cnt;
  161. const u8 *imrs;
  162. const u8 *isrs;
  163. };
  164. /* TWL4030 INT module interrupt mask registers */
  165. static const u8 __initconst twl4030_int_imr_regs[] = {
  166. TWL4030_INT_PWR_IMR1,
  167. TWL4030_INT_PWR_IMR2,
  168. };
  169. /* TWL4030 INT module interrupt status registers */
  170. static const u8 __initconst twl4030_int_isr_regs[] = {
  171. TWL4030_INT_PWR_ISR1,
  172. TWL4030_INT_PWR_ISR2,
  173. };
  174. /* TWL4030 INTERRUPTS module interrupt mask registers */
  175. static const u8 __initconst twl4030_interrupts_imr_regs[] = {
  176. TWL4030_INTERRUPTS_BCIIMR1A,
  177. TWL4030_INTERRUPTS_BCIIMR1B,
  178. TWL4030_INTERRUPTS_BCIIMR2A,
  179. TWL4030_INTERRUPTS_BCIIMR2B,
  180. };
  181. /* TWL4030 INTERRUPTS module interrupt status registers */
  182. static const u8 __initconst twl4030_interrupts_isr_regs[] = {
  183. TWL4030_INTERRUPTS_BCIISR1A,
  184. TWL4030_INTERRUPTS_BCIISR1B,
  185. TWL4030_INTERRUPTS_BCIISR2A,
  186. TWL4030_INTERRUPTS_BCIISR2B,
  187. };
  188. /* TWL4030 MADC module interrupt mask registers */
  189. static const u8 __initconst twl4030_madc_imr_regs[] = {
  190. TWL4030_MADC_IMR1,
  191. TWL4030_MADC_IMR2,
  192. };
  193. /* TWL4030 MADC module interrupt status registers */
  194. static const u8 __initconst twl4030_madc_isr_regs[] = {
  195. TWL4030_MADC_ISR1,
  196. TWL4030_MADC_ISR2,
  197. };
  198. /* TWL4030 keypad module interrupt mask registers */
  199. static const u8 __initconst twl4030_keypad_imr_regs[] = {
  200. TWL4030_KEYPAD_KEYP_IMR1,
  201. TWL4030_KEYPAD_KEYP_IMR2,
  202. };
  203. /* TWL4030 keypad module interrupt status registers */
  204. static const u8 __initconst twl4030_keypad_isr_regs[] = {
  205. TWL4030_KEYPAD_KEYP_ISR1,
  206. TWL4030_KEYPAD_KEYP_ISR2,
  207. };
  208. /* TWL4030 GPIO module interrupt mask registers */
  209. static const u8 __initconst twl4030_gpio_imr_regs[] = {
  210. REG_GPIO_IMR1A,
  211. REG_GPIO_IMR1B,
  212. REG_GPIO_IMR2A,
  213. REG_GPIO_IMR2B,
  214. REG_GPIO_IMR3A,
  215. REG_GPIO_IMR3B,
  216. };
  217. /* TWL4030 GPIO module interrupt status registers */
  218. static const u8 __initconst twl4030_gpio_isr_regs[] = {
  219. REG_GPIO_ISR1A,
  220. REG_GPIO_ISR1B,
  221. REG_GPIO_ISR2A,
  222. REG_GPIO_ISR2B,
  223. REG_GPIO_ISR3A,
  224. REG_GPIO_ISR3B,
  225. };
  226. /* TWL4030 modules that have IMR/ISR registers that must be masked/cleared */
  227. static const struct twl4030_mod_iregs __initconst twl4030_mod_regs[] = {
  228. {
  229. .mod_no = TWL4030_MODULE_INT,
  230. .sih_ctrl = TWL4030_INT_PWR_SIH_CTRL,
  231. .reg_cnt = ARRAY_SIZE(twl4030_int_imr_regs),
  232. .imrs = twl4030_int_imr_regs,
  233. .isrs = twl4030_int_isr_regs,
  234. },
  235. {
  236. .mod_no = TWL4030_MODULE_INTERRUPTS,
  237. .sih_ctrl = TWL4030_INTERRUPTS_BCISIHCTRL,
  238. .reg_cnt = ARRAY_SIZE(twl4030_interrupts_imr_regs),
  239. .imrs = twl4030_interrupts_imr_regs,
  240. .isrs = twl4030_interrupts_isr_regs,
  241. },
  242. {
  243. .mod_no = TWL4030_MODULE_MADC,
  244. .sih_ctrl = TWL4030_MADC_SIH_CTRL,
  245. .reg_cnt = ARRAY_SIZE(twl4030_madc_imr_regs),
  246. .imrs = twl4030_madc_imr_regs,
  247. .isrs = twl4030_madc_isr_regs,
  248. },
  249. {
  250. .mod_no = TWL4030_MODULE_KEYPAD,
  251. .sih_ctrl = TWL4030_KEYPAD_KEYP_SIH_CTRL,
  252. .reg_cnt = ARRAY_SIZE(twl4030_keypad_imr_regs),
  253. .imrs = twl4030_keypad_imr_regs,
  254. .isrs = twl4030_keypad_isr_regs,
  255. },
  256. {
  257. .mod_no = TWL4030_MODULE_GPIO,
  258. .sih_ctrl = REG_GPIO_SIH_CTRL,
  259. .reg_cnt = ARRAY_SIZE(twl4030_gpio_imr_regs),
  260. .imrs = twl4030_gpio_imr_regs,
  261. .isrs = twl4030_gpio_isr_regs,
  262. },
  263. };
  264. /*----------------------------------------------------------------*/
  265. /* is driver active, bound to a chip? */
  266. static bool inuse;
  267. /* Structure for each TWL4030 Slave */
  268. struct twl4030_client {
  269. struct i2c_client *client;
  270. u8 address;
  271. /* max numb of i2c_msg required is for read =2 */
  272. struct i2c_msg xfer_msg[2];
  273. /* To lock access to xfer_msg */
  274. struct mutex xfer_lock;
  275. };
  276. static struct twl4030_client twl4030_modules[TWL4030_NUM_SLAVES];
  277. /* mapping the module id to slave id and base address */
  278. struct twl4030mapping {
  279. unsigned char sid; /* Slave ID */
  280. unsigned char base; /* base address */
  281. };
  282. static struct twl4030mapping twl4030_map[TWL4030_MODULE_LAST + 1] = {
  283. /*
  284. * NOTE: don't change this table without updating the
  285. * <linux/i2c/twl4030.h> defines for TWL4030_MODULE_*
  286. * so they continue to match the order in this table.
  287. */
  288. { 0, TWL4030_BASEADD_USB },
  289. { 1, TWL4030_BASEADD_AUDIO_VOICE },
  290. { 1, TWL4030_BASEADD_GPIO },
  291. { 1, TWL4030_BASEADD_INTBR },
  292. { 1, TWL4030_BASEADD_PIH },
  293. { 1, TWL4030_BASEADD_TEST },
  294. { 2, TWL4030_BASEADD_KEYPAD },
  295. { 2, TWL4030_BASEADD_MADC },
  296. { 2, TWL4030_BASEADD_INTERRUPTS },
  297. { 2, TWL4030_BASEADD_LED },
  298. { 2, TWL4030_BASEADD_MAIN_CHARGE },
  299. { 2, TWL4030_BASEADD_PRECHARGE },
  300. { 2, TWL4030_BASEADD_PWM0 },
  301. { 2, TWL4030_BASEADD_PWM1 },
  302. { 2, TWL4030_BASEADD_PWMA },
  303. { 2, TWL4030_BASEADD_PWMB },
  304. { 3, TWL4030_BASEADD_BACKUP },
  305. { 3, TWL4030_BASEADD_INT },
  306. { 3, TWL4030_BASEADD_PM_MASTER },
  307. { 3, TWL4030_BASEADD_PM_RECEIVER },
  308. { 3, TWL4030_BASEADD_RTC },
  309. { 3, TWL4030_BASEADD_SECURED_REG },
  310. };
  311. /*----------------------------------------------------------------------*/
  312. /*
  313. * TWL4030 doesn't have PIH mask, hence dummy function for mask
  314. * and unmask of the (eight) interrupts reported at that level ...
  315. * masking is only available from SIH (secondary) modules.
  316. */
  317. static void twl4030_i2c_ackirq(unsigned int irq)
  318. {
  319. }
  320. static void twl4030_i2c_disableint(unsigned int irq)
  321. {
  322. }
  323. static void twl4030_i2c_enableint(unsigned int irq)
  324. {
  325. }
  326. static struct irq_chip twl4030_irq_chip = {
  327. .name = "twl4030",
  328. .ack = twl4030_i2c_ackirq,
  329. .mask = twl4030_i2c_disableint,
  330. .unmask = twl4030_i2c_enableint,
  331. };
  332. /*----------------------------------------------------------------------*/
  333. /* Exported Functions */
  334. /**
  335. * twl4030_i2c_write - Writes a n bit register in TWL4030
  336. * @mod_no: module number
  337. * @value: an array of num_bytes+1 containing data to write
  338. * @reg: register address (just offset will do)
  339. * @num_bytes: number of bytes to transfer
  340. *
  341. * IMPORTANT: for 'value' parameter: Allocate value num_bytes+1 and
  342. * valid data starts at Offset 1.
  343. *
  344. * Returns the result of operation - 0 is success
  345. */
  346. int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, u8 num_bytes)
  347. {
  348. int ret;
  349. int sid;
  350. struct twl4030_client *twl;
  351. struct i2c_msg *msg;
  352. if (unlikely(mod_no > TWL4030_MODULE_LAST)) {
  353. pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
  354. return -EPERM;
  355. }
  356. sid = twl4030_map[mod_no].sid;
  357. twl = &twl4030_modules[sid];
  358. if (unlikely(!inuse)) {
  359. pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid);
  360. return -EPERM;
  361. }
  362. mutex_lock(&twl->xfer_lock);
  363. /*
  364. * [MSG1]: fill the register address data
  365. * fill the data Tx buffer
  366. */
  367. msg = &twl->xfer_msg[0];
  368. msg->addr = twl->address;
  369. msg->len = num_bytes + 1;
  370. msg->flags = 0;
  371. msg->buf = value;
  372. /* over write the first byte of buffer with the register address */
  373. *value = twl4030_map[mod_no].base + reg;
  374. ret = i2c_transfer(twl->client->adapter, twl->xfer_msg, 1);
  375. mutex_unlock(&twl->xfer_lock);
  376. /* i2cTransfer returns num messages.translate it pls.. */
  377. if (ret >= 0)
  378. ret = 0;
  379. return ret;
  380. }
  381. EXPORT_SYMBOL(twl4030_i2c_write);
  382. /**
  383. * twl4030_i2c_read - Reads a n bit register in TWL4030
  384. * @mod_no: module number
  385. * @value: an array of num_bytes containing data to be read
  386. * @reg: register address (just offset will do)
  387. * @num_bytes: number of bytes to transfer
  388. *
  389. * Returns result of operation - num_bytes is success else failure.
  390. */
  391. int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes)
  392. {
  393. int ret;
  394. u8 val;
  395. int sid;
  396. struct twl4030_client *twl;
  397. struct i2c_msg *msg;
  398. if (unlikely(mod_no > TWL4030_MODULE_LAST)) {
  399. pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
  400. return -EPERM;
  401. }
  402. sid = twl4030_map[mod_no].sid;
  403. twl = &twl4030_modules[sid];
  404. if (unlikely(!inuse)) {
  405. pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid);
  406. return -EPERM;
  407. }
  408. mutex_lock(&twl->xfer_lock);
  409. /* [MSG1] fill the register address data */
  410. msg = &twl->xfer_msg[0];
  411. msg->addr = twl->address;
  412. msg->len = 1;
  413. msg->flags = 0; /* Read the register value */
  414. val = twl4030_map[mod_no].base + reg;
  415. msg->buf = &val;
  416. /* [MSG2] fill the data rx buffer */
  417. msg = &twl->xfer_msg[1];
  418. msg->addr = twl->address;
  419. msg->flags = I2C_M_RD; /* Read the register value */
  420. msg->len = num_bytes; /* only n bytes */
  421. msg->buf = value;
  422. ret = i2c_transfer(twl->client->adapter, twl->xfer_msg, 2);
  423. mutex_unlock(&twl->xfer_lock);
  424. /* i2cTransfer returns num messages.translate it pls.. */
  425. if (ret >= 0)
  426. ret = 0;
  427. return ret;
  428. }
  429. EXPORT_SYMBOL(twl4030_i2c_read);
  430. /**
  431. * twl4030_i2c_write_u8 - Writes a 8 bit register in TWL4030
  432. * @mod_no: module number
  433. * @value: the value to be written 8 bit
  434. * @reg: register address (just offset will do)
  435. *
  436. * Returns result of operation - 0 is success
  437. */
  438. int twl4030_i2c_write_u8(u8 mod_no, u8 value, u8 reg)
  439. {
  440. /* 2 bytes offset 1 contains the data offset 0 is used by i2c_write */
  441. u8 temp_buffer[2] = { 0 };
  442. /* offset 1 contains the data */
  443. temp_buffer[1] = value;
  444. return twl4030_i2c_write(mod_no, temp_buffer, reg, 1);
  445. }
  446. EXPORT_SYMBOL(twl4030_i2c_write_u8);
  447. /**
  448. * twl4030_i2c_read_u8 - Reads a 8 bit register from TWL4030
  449. * @mod_no: module number
  450. * @value: the value read 8 bit
  451. * @reg: register address (just offset will do)
  452. *
  453. * Returns result of operation - 0 is success
  454. */
  455. int twl4030_i2c_read_u8(u8 mod_no, u8 *value, u8 reg)
  456. {
  457. return twl4030_i2c_read(mod_no, value, reg, 1);
  458. }
  459. EXPORT_SYMBOL(twl4030_i2c_read_u8);
  460. /*----------------------------------------------------------------------*/
  461. /*
  462. * do_twl4030_module_irq() is the desc->handle method for each of the twl4030
  463. * module interrupts that doesn't chain to another irq_chip (GPIO, power, etc).
  464. * It executes in kernel thread context. On entry, cpu interrupts are disabled.
  465. */
  466. static void do_twl4030_module_irq(unsigned int irq, irq_desc_t *desc)
  467. {
  468. struct irqaction *action;
  469. const unsigned int cpu = smp_processor_id();
  470. /*
  471. * Earlier this was desc->triggered = 1;
  472. */
  473. desc->status |= IRQ_LEVEL;
  474. /*
  475. * The desc->handle method would normally call the desc->chip->ack
  476. * method here, but we won't bother since our ack method is NULL.
  477. */
  478. if (!desc->depth) {
  479. kstat_cpu(cpu).irqs[irq]++;
  480. action = desc->action;
  481. if (action) {
  482. int ret;
  483. int status = 0;
  484. int retval = 0;
  485. local_irq_enable();
  486. do {
  487. /* Call the ISR with cpu interrupts enabled */
  488. ret = action->handler(irq, action->dev_id);
  489. if (ret == IRQ_HANDLED)
  490. status |= action->flags;
  491. retval |= ret;
  492. action = action->next;
  493. } while (action);
  494. if (status & IRQF_SAMPLE_RANDOM)
  495. add_interrupt_randomness(irq);
  496. local_irq_disable();
  497. if (retval != IRQ_HANDLED)
  498. printk(KERN_ERR "ISR for TWL4030 module"
  499. " irq %d can't handle interrupt\n",
  500. irq);
  501. /*
  502. * Here is where we should call the unmask method, but
  503. * again we won't bother since it is NULL.
  504. */
  505. } else
  506. printk(KERN_CRIT "TWL4030 module irq %d has no ISR"
  507. " but can't be masked!\n", irq);
  508. } else
  509. printk(KERN_CRIT "TWL4030 module irq %d is disabled but can't"
  510. " be masked!\n", irq);
  511. }
  512. static unsigned twl4030_irq_base;
  513. static struct completion irq_event;
  514. /*
  515. * This thread processes interrupts reported by the Primary Interrupt Handler.
  516. */
  517. static int twl4030_irq_thread(void *data)
  518. {
  519. long irq = (long)data;
  520. irq_desc_t *desc = irq_desc + irq;
  521. static unsigned i2c_errors;
  522. const static unsigned max_i2c_errors = 100;
  523. daemonize("twl4030-irq");
  524. current->flags |= PF_NOFREEZE;
  525. while (!kthread_should_stop()) {
  526. int ret;
  527. int module_irq;
  528. u8 pih_isr;
  529. /* Wait for IRQ, then read PIH irq status (also blocking) */
  530. wait_for_completion_interruptible(&irq_event);
  531. ret = twl4030_i2c_read_u8(TWL4030_MODULE_PIH, &pih_isr,
  532. REG_PIH_ISR_P1);
  533. if (ret) {
  534. pr_warning("%s: I2C error %d reading PIH ISR\n",
  535. DRIVER_NAME, ret);
  536. if (++i2c_errors >= max_i2c_errors) {
  537. printk(KERN_ERR "Maximum I2C error count"
  538. " exceeded. Terminating %s.\n",
  539. __func__);
  540. break;
  541. }
  542. complete(&irq_event);
  543. continue;
  544. }
  545. /* these handlers deal with the relevant SIH irq status */
  546. local_irq_disable();
  547. for (module_irq = twl4030_irq_base;
  548. pih_isr;
  549. pih_isr >>= 1, module_irq++) {
  550. if (pih_isr & 0x1) {
  551. irq_desc_t *d = irq_desc + module_irq;
  552. d->handle_irq(module_irq, d);
  553. }
  554. }
  555. local_irq_enable();
  556. desc->chip->unmask(irq);
  557. }
  558. return 0;
  559. }
  560. /*
  561. * do_twl4030_irq() is the desc->handle method for the twl4030 interrupt.
  562. * This is a chained interrupt, so there is no desc->action method for it.
  563. * Now we need to query the interrupt controller in the twl4030 to determine
  564. * which module is generating the interrupt request. However, we can't do i2c
  565. * transactions in interrupt context, so we must defer that work to a kernel
  566. * thread. All we do here is acknowledge and mask the interrupt and wakeup
  567. * the kernel thread.
  568. */
  569. static void do_twl4030_irq(unsigned int irq, irq_desc_t *desc)
  570. {
  571. const unsigned int cpu = smp_processor_id();
  572. /*
  573. * Earlier this was desc->triggered = 1;
  574. */
  575. desc->status |= IRQ_LEVEL;
  576. /*
  577. * Acknowledge, clear _AND_ disable the interrupt.
  578. */
  579. desc->chip->ack(irq);
  580. if (!desc->depth) {
  581. kstat_cpu(cpu).irqs[irq]++;
  582. complete(&irq_event);
  583. }
  584. }
  585. static struct task_struct * __init start_twl4030_irq_thread(long irq)
  586. {
  587. struct task_struct *thread;
  588. init_completion(&irq_event);
  589. thread = kthread_run(twl4030_irq_thread, (void *)irq,
  590. "twl4030 irq %ld", irq);
  591. if (!thread)
  592. pr_err("%s: could not create twl4030 irq %ld thread!\n",
  593. DRIVER_NAME, irq);
  594. return thread;
  595. }
  596. /*----------------------------------------------------------------------*/
  597. static int add_children(struct twl4030_platform_data *pdata)
  598. {
  599. struct platform_device *pdev = NULL;
  600. struct twl4030_client *twl = NULL;
  601. int status = 0;
  602. if (twl_has_bci() && pdata->bci) {
  603. twl = &twl4030_modules[3];
  604. pdev = platform_device_alloc("twl4030_bci", -1);
  605. if (!pdev) {
  606. pr_debug("%s: can't alloc bci dev\n", DRIVER_NAME);
  607. status = -ENOMEM;
  608. goto err;
  609. }
  610. if (status == 0) {
  611. pdev->dev.parent = &twl->client->dev;
  612. status = platform_device_add_data(pdev, pdata->bci,
  613. sizeof(*pdata->bci));
  614. if (status < 0) {
  615. dev_dbg(&twl->client->dev,
  616. "can't add bci data, %d\n",
  617. status);
  618. goto err;
  619. }
  620. }
  621. if (status == 0) {
  622. struct resource r = {
  623. .start = TWL4030_PWRIRQ_CHG_PRES,
  624. .flags = IORESOURCE_IRQ,
  625. };
  626. status = platform_device_add_resources(pdev, &r, 1);
  627. }
  628. if (status == 0)
  629. status = platform_device_add(pdev);
  630. if (status < 0) {
  631. platform_device_put(pdev);
  632. dev_dbg(&twl->client->dev,
  633. "can't create bci dev, %d\n",
  634. status);
  635. goto err;
  636. }
  637. }
  638. if (twl_has_gpio() && pdata->gpio) {
  639. twl = &twl4030_modules[1];
  640. pdev = platform_device_alloc("twl4030_gpio", -1);
  641. if (!pdev) {
  642. pr_debug("%s: can't alloc gpio dev\n", DRIVER_NAME);
  643. status = -ENOMEM;
  644. goto err;
  645. }
  646. /* more driver model init */
  647. if (status == 0) {
  648. pdev->dev.parent = &twl->client->dev;
  649. /* device_init_wakeup(&pdev->dev, 1); */
  650. status = platform_device_add_data(pdev, pdata->gpio,
  651. sizeof(*pdata->gpio));
  652. if (status < 0) {
  653. dev_dbg(&twl->client->dev,
  654. "can't add gpio data, %d\n",
  655. status);
  656. goto err;
  657. }
  658. }
  659. /* GPIO module IRQ */
  660. if (status == 0) {
  661. struct resource r = {
  662. .start = pdata->irq_base + 0,
  663. .flags = IORESOURCE_IRQ,
  664. };
  665. status = platform_device_add_resources(pdev, &r, 1);
  666. }
  667. if (status == 0)
  668. status = platform_device_add(pdev);
  669. if (status < 0) {
  670. platform_device_put(pdev);
  671. dev_dbg(&twl->client->dev,
  672. "can't create gpio dev, %d\n",
  673. status);
  674. goto err;
  675. }
  676. }
  677. if (twl_has_keypad() && pdata->keypad) {
  678. pdev = platform_device_alloc("twl4030_keypad", -1);
  679. if (pdev) {
  680. twl = &twl4030_modules[2];
  681. pdev->dev.parent = &twl->client->dev;
  682. device_init_wakeup(&pdev->dev, 1);
  683. status = platform_device_add_data(pdev, pdata->keypad,
  684. sizeof(*pdata->keypad));
  685. if (status < 0) {
  686. dev_dbg(&twl->client->dev,
  687. "can't add keypad data, %d\n",
  688. status);
  689. platform_device_put(pdev);
  690. goto err;
  691. }
  692. status = platform_device_add(pdev);
  693. if (status < 0) {
  694. platform_device_put(pdev);
  695. dev_dbg(&twl->client->dev,
  696. "can't create keypad dev, %d\n",
  697. status);
  698. goto err;
  699. }
  700. } else {
  701. pr_debug("%s: can't alloc keypad dev\n", DRIVER_NAME);
  702. status = -ENOMEM;
  703. goto err;
  704. }
  705. }
  706. if (twl_has_madc() && pdata->madc) {
  707. pdev = platform_device_alloc("twl4030_madc", -1);
  708. if (pdev) {
  709. twl = &twl4030_modules[2];
  710. pdev->dev.parent = &twl->client->dev;
  711. device_init_wakeup(&pdev->dev, 1);
  712. status = platform_device_add_data(pdev, pdata->madc,
  713. sizeof(*pdata->madc));
  714. if (status < 0) {
  715. platform_device_put(pdev);
  716. dev_dbg(&twl->client->dev,
  717. "can't add madc data, %d\n",
  718. status);
  719. goto err;
  720. }
  721. status = platform_device_add(pdev);
  722. if (status < 0) {
  723. platform_device_put(pdev);
  724. dev_dbg(&twl->client->dev,
  725. "can't create madc dev, %d\n",
  726. status);
  727. goto err;
  728. }
  729. } else {
  730. pr_debug("%s: can't alloc madc dev\n", DRIVER_NAME);
  731. status = -ENOMEM;
  732. goto err;
  733. }
  734. }
  735. if (twl_has_rtc()) {
  736. twl = &twl4030_modules[3];
  737. pdev = platform_device_alloc("twl4030_rtc", -1);
  738. if (!pdev) {
  739. pr_debug("%s: can't alloc rtc dev\n", DRIVER_NAME);
  740. status = -ENOMEM;
  741. } else {
  742. pdev->dev.parent = &twl->client->dev;
  743. device_init_wakeup(&pdev->dev, 1);
  744. }
  745. /*
  746. * REVISIT platform_data here currently might use of
  747. * "msecure" line ... but for now we just expect board
  748. * setup to tell the chip "we are secure" at all times.
  749. * Eventually, Linux might become more aware of such
  750. * HW security concerns, and "least privilege".
  751. */
  752. /* RTC module IRQ */
  753. if (status == 0) {
  754. struct resource r = {
  755. /* REVISIT don't hard-wire this stuff */
  756. .start = TWL4030_PWRIRQ_RTC,
  757. .flags = IORESOURCE_IRQ,
  758. };
  759. status = platform_device_add_resources(pdev, &r, 1);
  760. }
  761. if (status == 0)
  762. status = platform_device_add(pdev);
  763. if (status < 0) {
  764. platform_device_put(pdev);
  765. dev_dbg(&twl->client->dev,
  766. "can't create rtc dev, %d\n",
  767. status);
  768. goto err;
  769. }
  770. }
  771. if (twl_has_usb() && pdata->usb) {
  772. twl = &twl4030_modules[0];
  773. pdev = platform_device_alloc("twl4030_usb", -1);
  774. if (!pdev) {
  775. pr_debug("%s: can't alloc usb dev\n", DRIVER_NAME);
  776. status = -ENOMEM;
  777. goto err;
  778. }
  779. if (status == 0) {
  780. pdev->dev.parent = &twl->client->dev;
  781. device_init_wakeup(&pdev->dev, 1);
  782. status = platform_device_add_data(pdev, pdata->usb,
  783. sizeof(*pdata->usb));
  784. if (status < 0) {
  785. platform_device_put(pdev);
  786. dev_dbg(&twl->client->dev,
  787. "can't add usb data, %d\n",
  788. status);
  789. goto err;
  790. }
  791. }
  792. if (status == 0) {
  793. struct resource r = {
  794. .start = TWL4030_PWRIRQ_USB_PRES,
  795. .flags = IORESOURCE_IRQ,
  796. };
  797. status = platform_device_add_resources(pdev, &r, 1);
  798. }
  799. if (status == 0)
  800. status = platform_device_add(pdev);
  801. if (status < 0) {
  802. platform_device_put(pdev);
  803. dev_dbg(&twl->client->dev,
  804. "can't create usb dev, %d\n",
  805. status);
  806. }
  807. }
  808. err:
  809. if (status)
  810. pr_err("failed to add twl4030's children (status %d)\n", status);
  811. return status;
  812. }
  813. /*----------------------------------------------------------------------*/
  814. /*
  815. * These three functions initialize the on-chip clock framework,
  816. * letting it generate the right frequencies for USB, MADC, and
  817. * other purposes.
  818. */
  819. static inline int __init protect_pm_master(void)
  820. {
  821. int e = 0;
  822. e = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, KEY_LOCK,
  823. R_PROTECT_KEY);
  824. return e;
  825. }
  826. static inline int __init unprotect_pm_master(void)
  827. {
  828. int e = 0;
  829. e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, KEY_UNLOCK1,
  830. R_PROTECT_KEY);
  831. e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, KEY_UNLOCK2,
  832. R_PROTECT_KEY);
  833. return e;
  834. }
  835. static void __init clocks_init(void)
  836. {
  837. int e = 0;
  838. struct clk *osc;
  839. u32 rate;
  840. u8 ctrl = HFCLK_FREQ_26_MHZ;
  841. #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
  842. if (cpu_is_omap2430())
  843. osc = clk_get(NULL, "osc_ck");
  844. else
  845. osc = clk_get(NULL, "osc_sys_ck");
  846. #else
  847. /* REVISIT for non-OMAP systems, pass the clock rate from
  848. * board init code, using platform_data.
  849. */
  850. osc = ERR_PTR(-EIO);
  851. #endif
  852. if (IS_ERR(osc)) {
  853. printk(KERN_WARNING "Skipping twl4030 internal clock init and "
  854. "using bootloader value (unknown osc rate)\n");
  855. return;
  856. }
  857. rate = clk_get_rate(osc);
  858. clk_put(osc);
  859. switch (rate) {
  860. case 19200000:
  861. ctrl = HFCLK_FREQ_19p2_MHZ;
  862. break;
  863. case 26000000:
  864. ctrl = HFCLK_FREQ_26_MHZ;
  865. break;
  866. case 38400000:
  867. ctrl = HFCLK_FREQ_38p4_MHZ;
  868. break;
  869. }
  870. ctrl |= HIGH_PERF_SQ;
  871. e |= unprotect_pm_master();
  872. /* effect->MADC+USB ck en */
  873. e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, ctrl, R_CFG_BOOT);
  874. e |= protect_pm_master();
  875. if (e < 0)
  876. pr_err("%s: clock init err [%d]\n", DRIVER_NAME, e);
  877. }
  878. /*----------------------------------------------------------------------*/
  879. /**
  880. * twl4030_i2c_clear_isr - clear TWL4030 SIH ISR regs via read + write
  881. * @mod_no: TWL4030 module number
  882. * @reg: register index to clear
  883. * @cor: value of the <module>_SIH_CTRL.COR bit (1 or 0)
  884. *
  885. * Either reads (cor == 1) or writes (cor == 0) to a TWL4030 interrupt
  886. * status register to ensure that any prior interrupts are cleared.
  887. * Returns the status from the I2C read operation.
  888. */
  889. static int __init twl4030_i2c_clear_isr(u8 mod_no, u8 reg, u8 cor)
  890. {
  891. u8 tmp;
  892. return (cor) ? twl4030_i2c_read_u8(mod_no, &tmp, reg) :
  893. twl4030_i2c_write_u8(mod_no, 0xff, reg);
  894. }
  895. /**
  896. * twl4030_read_cor_bit - are TWL module ISRs cleared by reads or writes?
  897. * @mod_no: TWL4030 module number
  898. * @reg: register index to clear
  899. *
  900. * Returns 1 if the TWL4030 SIH interrupt status registers (ISRs) for
  901. * the specified TWL module are cleared by reads, or 0 if cleared by
  902. * writes.
  903. */
  904. static int twl4030_read_cor_bit(u8 mod_no, u8 reg)
  905. {
  906. u8 tmp = 0;
  907. WARN_ON(twl4030_i2c_read_u8(mod_no, &tmp, reg) < 0);
  908. tmp &= TWL4030_SIH_CTRL_COR_MASK;
  909. tmp >>= __ffs(TWL4030_SIH_CTRL_COR_MASK);
  910. return tmp;
  911. }
  912. /**
  913. * twl4030_mask_clear_intrs - mask and clear all TWL4030 interrupts
  914. * @t: pointer to twl4030_mod_iregs array
  915. * @t_sz: ARRAY_SIZE(t) (starting at 1)
  916. *
  917. * Mask all TWL4030 interrupt mask registers (IMRs) and clear all
  918. * interrupt status registers (ISRs). No return value, but will WARN if
  919. * any I2C operations fail.
  920. */
  921. static void __init twl4030_mask_clear_intrs(const struct twl4030_mod_iregs *t,
  922. const u8 t_sz)
  923. {
  924. int i, j;
  925. /*
  926. * N.B. - further efficiency is possible here. Eight I2C
  927. * operations on BCI and GPIO modules are avoidable if I2C
  928. * burst read/write transactions were implemented. Would
  929. * probably save about 1ms of boot time and a small amount of
  930. * power.
  931. */
  932. for (i = 0; i < t_sz; i++) {
  933. const struct twl4030_mod_iregs tmr = t[i];
  934. int cor;
  935. /* Are ISRs cleared by reads or writes? */
  936. cor = twl4030_read_cor_bit(tmr.mod_no, tmr.sih_ctrl);
  937. for (j = 0; j < tmr.reg_cnt; j++) {
  938. /* Mask interrupts at the TWL4030 */
  939. WARN_ON(twl4030_i2c_write_u8(tmr.mod_no, 0xff,
  940. tmr.imrs[j]) < 0);
  941. /* Clear TWL4030 ISRs */
  942. WARN_ON(twl4030_i2c_clear_isr(tmr.mod_no,
  943. tmr.isrs[j], cor) < 0);
  944. }
  945. }
  946. }
  947. static void twl_init_irq(int irq_num, unsigned irq_base, unsigned irq_end)
  948. {
  949. int i;
  950. /*
  951. * Mask and clear all TWL4030 interrupts since initially we do
  952. * not have any TWL4030 module interrupt handlers present
  953. */
  954. twl4030_mask_clear_intrs(twl4030_mod_regs,
  955. ARRAY_SIZE(twl4030_mod_regs));
  956. twl4030_irq_base = irq_base;
  957. /* install an irq handler for each of the PIH modules */
  958. for (i = irq_base; i < irq_end; i++) {
  959. set_irq_chip_and_handler(i, &twl4030_irq_chip,
  960. do_twl4030_module_irq);
  961. activate_irq(i);
  962. }
  963. /* install an irq handler to demultiplex the TWL4030 interrupt */
  964. set_irq_data(irq_num, start_twl4030_irq_thread(irq_num));
  965. set_irq_chained_handler(irq_num, do_twl4030_irq);
  966. }
  967. /*----------------------------------------------------------------------*/
  968. static int twl4030_remove(struct i2c_client *client)
  969. {
  970. unsigned i;
  971. /* FIXME undo twl_init_irq() */
  972. if (twl4030_irq_base) {
  973. dev_err(&client->dev, "can't yet clean up IRQs?\n");
  974. return -ENOSYS;
  975. }
  976. for (i = 0; i < TWL4030_NUM_SLAVES; i++) {
  977. struct twl4030_client *twl = &twl4030_modules[i];
  978. if (twl->client && twl->client != client)
  979. i2c_unregister_device(twl->client);
  980. twl4030_modules[i].client = NULL;
  981. }
  982. inuse = false;
  983. return 0;
  984. }
  985. /* NOTE: this driver only handles a single twl4030/tps659x0 chip */
  986. static int
  987. twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
  988. {
  989. int status;
  990. unsigned i;
  991. struct twl4030_platform_data *pdata = client->dev.platform_data;
  992. if (!pdata) {
  993. dev_dbg(&client->dev, "no platform data?\n");
  994. return -EINVAL;
  995. }
  996. if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) {
  997. dev_dbg(&client->dev, "can't talk I2C?\n");
  998. return -EIO;
  999. }
  1000. if (inuse || twl4030_irq_base) {
  1001. dev_dbg(&client->dev, "driver is already in use\n");
  1002. return -EBUSY;
  1003. }
  1004. for (i = 0; i < TWL4030_NUM_SLAVES; i++) {
  1005. struct twl4030_client *twl = &twl4030_modules[i];
  1006. twl->address = client->addr + i;
  1007. if (i == 0)
  1008. twl->client = client;
  1009. else {
  1010. twl->client = i2c_new_dummy(client->adapter,
  1011. twl->address);
  1012. if (!twl->client) {
  1013. dev_err(&twl->client->dev,
  1014. "can't attach client %d\n", i);
  1015. status = -ENOMEM;
  1016. goto fail;
  1017. }
  1018. strlcpy(twl->client->name, id->name,
  1019. sizeof(twl->client->name));
  1020. }
  1021. mutex_init(&twl->xfer_lock);
  1022. }
  1023. inuse = true;
  1024. /* setup clock framework */
  1025. clocks_init();
  1026. /* Maybe init the T2 Interrupt subsystem */
  1027. if (client->irq
  1028. && pdata->irq_base
  1029. && pdata->irq_end > pdata->irq_base) {
  1030. twl_init_irq(client->irq, pdata->irq_base, pdata->irq_end);
  1031. dev_info(&client->dev, "IRQ %d chains IRQs %d..%d\n",
  1032. client->irq, pdata->irq_base, pdata->irq_end - 1);
  1033. }
  1034. status = add_children(pdata);
  1035. fail:
  1036. if (status < 0)
  1037. twl4030_remove(client);
  1038. return status;
  1039. }
  1040. static const struct i2c_device_id twl4030_ids[] = {
  1041. { "twl4030", 0 }, /* "Triton 2" */
  1042. { "tps65950", 0 }, /* catalog version of twl4030 */
  1043. { "tps65930", 0 }, /* fewer LDOs and DACs; no charger */
  1044. { "tps65920", 0 }, /* fewer LDOs; no codec or charger */
  1045. { "twl5030", 0 }, /* T2 updated */
  1046. { /* end of list */ },
  1047. };
  1048. MODULE_DEVICE_TABLE(i2c, twl4030_ids);
  1049. /* One Client Driver , 4 Clients */
  1050. static struct i2c_driver twl4030_driver = {
  1051. .driver.name = DRIVER_NAME,
  1052. .id_table = twl4030_ids,
  1053. .probe = twl4030_probe,
  1054. .remove = twl4030_remove,
  1055. };
  1056. static int __init twl4030_init(void)
  1057. {
  1058. return i2c_add_driver(&twl4030_driver);
  1059. }
  1060. subsys_initcall(twl4030_init);
  1061. static void __exit twl4030_exit(void)
  1062. {
  1063. i2c_del_driver(&twl4030_driver);
  1064. }
  1065. module_exit(twl4030_exit);
  1066. MODULE_AUTHOR("Texas Instruments, Inc.");
  1067. MODULE_DESCRIPTION("I2C Core interface for TWL4030");
  1068. MODULE_LICENSE("GPL");