aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/twl4030-gpio.c18
-rw-r--r--drivers/input/keyboard/twl4030_keypad.c4
-rw-r--r--drivers/input/misc/twl4030-pwrbutton.c2
-rw-r--r--drivers/mfd/twl-core.c136
-rw-r--r--drivers/mfd/twl4030-irq.c18
-rw-r--r--drivers/mfd/twl4030-power.c68
-rw-r--r--drivers/regulator/twl-regulator.c8
-rw-r--r--drivers/rtc/rtc-twl.c14
-rw-r--r--drivers/usb/otg/twl4030-usb.c36
-rw-r--r--drivers/video/omap/lcd_2430sdp.c2
-rw-r--r--drivers/watchdog/twl4030_wdt.c2
-rw-r--r--include/linux/i2c/twl.h31
-rw-r--r--sound/soc/codecs/twl4030.c8
13 files changed, 187 insertions, 160 deletions
diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c
index a320d7bfe67c..7fe881e2bdfb 100644
--- a/drivers/gpio/twl4030-gpio.c
+++ b/drivers/gpio/twl4030-gpio.c
@@ -80,7 +80,7 @@ static unsigned int gpio_usage_count;
80 */ 80 */
81static inline int gpio_twl4030_write(u8 address, u8 data) 81static inline int gpio_twl4030_write(u8 address, u8 data)
82{ 82{
83 return twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, data, address); 83 return twl_i2c_write_u8(TWL4030_MODULE_GPIO, data, address);
84} 84}
85 85
86/*----------------------------------------------------------------------*/ 86/*----------------------------------------------------------------------*/
@@ -117,7 +117,7 @@ static inline int gpio_twl4030_read(u8 address)
117 u8 data; 117 u8 data;
118 int ret = 0; 118 int ret = 0;
119 119
120 ret = twl4030_i2c_read_u8(TWL4030_MODULE_GPIO, &data, address); 120 ret = twl_i2c_read_u8(TWL4030_MODULE_GPIO, &data, address);
121 return (ret < 0) ? ret : data; 121 return (ret < 0) ? ret : data;
122} 122}
123 123
@@ -142,7 +142,7 @@ static void twl4030_led_set_value(int led, int value)
142 cached_leden &= ~mask; 142 cached_leden &= ~mask;
143 else 143 else
144 cached_leden |= mask; 144 cached_leden |= mask;
145 status = twl4030_i2c_write_u8(TWL4030_MODULE_LED, cached_leden, 145 status = twl_i2c_write_u8(TWL4030_MODULE_LED, cached_leden,
146 TWL4030_LED_LEDEN); 146 TWL4030_LED_LEDEN);
147 mutex_unlock(&gpio_lock); 147 mutex_unlock(&gpio_lock);
148} 148}
@@ -223,23 +223,23 @@ static int twl_request(struct gpio_chip *chip, unsigned offset)
223 } 223 }
224 224
225 /* initialize PWM to always-drive */ 225 /* initialize PWM to always-drive */
226 status = twl4030_i2c_write_u8(module, 0x7f, 226 status = twl_i2c_write_u8(module, 0x7f,
227 TWL4030_PWMx_PWMxOFF); 227 TWL4030_PWMx_PWMxOFF);
228 if (status < 0) 228 if (status < 0)
229 goto done; 229 goto done;
230 status = twl4030_i2c_write_u8(module, 0x7f, 230 status = twl_i2c_write_u8(module, 0x7f,
231 TWL4030_PWMx_PWMxON); 231 TWL4030_PWMx_PWMxON);
232 if (status < 0) 232 if (status < 0)
233 goto done; 233 goto done;
234 234
235 /* init LED to not-driven (high) */ 235 /* init LED to not-driven (high) */
236 module = TWL4030_MODULE_LED; 236 module = TWL4030_MODULE_LED;
237 status = twl4030_i2c_read_u8(module, &cached_leden, 237 status = twl_i2c_read_u8(module, &cached_leden,
238 TWL4030_LED_LEDEN); 238 TWL4030_LED_LEDEN);
239 if (status < 0) 239 if (status < 0)
240 goto done; 240 goto done;
241 cached_leden &= ~ledclr_mask; 241 cached_leden &= ~ledclr_mask;
242 status = twl4030_i2c_write_u8(module, cached_leden, 242 status = twl_i2c_write_u8(module, cached_leden,
243 TWL4030_LED_LEDEN); 243 TWL4030_LED_LEDEN);
244 if (status < 0) 244 if (status < 0)
245 goto done; 245 goto done;
@@ -370,7 +370,7 @@ static int __devinit gpio_twl4030_pulls(u32 ups, u32 downs)
370 message[i] = bit_mask; 370 message[i] = bit_mask;
371 } 371 }
372 372
373 return twl4030_i2c_write(TWL4030_MODULE_GPIO, message, 373 return twl_i2c_write(TWL4030_MODULE_GPIO, message,
374 REG_GPIOPUPDCTR1, 5); 374 REG_GPIOPUPDCTR1, 5);
375} 375}
376 376
@@ -387,7 +387,7 @@ static int __devinit gpio_twl4030_debounce(u32 debounce, u8 mmc_cd)
387 debounce >>= 8; 387 debounce >>= 8;
388 message[3] = (debounce & 0x03); 388 message[3] = (debounce & 0x03);
389 389
390 return twl4030_i2c_write(TWL4030_MODULE_GPIO, message, 390 return twl_i2c_write(TWL4030_MODULE_GPIO, message,
391 REG_GPIO_DEBEN1, 3); 391 REG_GPIO_DEBEN1, 3);
392} 392}
393 393
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index 1d1536a2fe46..eeaa7acb9cfc 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -133,7 +133,7 @@ struct twl4030_keypad {
133static int twl4030_kpread(struct twl4030_keypad *kp, 133static int twl4030_kpread(struct twl4030_keypad *kp,
134 u8 *data, u32 reg, u8 num_bytes) 134 u8 *data, u32 reg, u8 num_bytes)
135{ 135{
136 int ret = twl4030_i2c_read(TWL4030_MODULE_KEYPAD, data, reg, num_bytes); 136 int ret = twl_i2c_read(TWL4030_MODULE_KEYPAD, data, reg, num_bytes);
137 137
138 if (ret < 0) 138 if (ret < 0)
139 dev_warn(kp->dbg_dev, 139 dev_warn(kp->dbg_dev,
@@ -145,7 +145,7 @@ static int twl4030_kpread(struct twl4030_keypad *kp,
145 145
146static int twl4030_kpwrite_u8(struct twl4030_keypad *kp, u8 data, u32 reg) 146static int twl4030_kpwrite_u8(struct twl4030_keypad *kp, u8 data, u32 reg)
147{ 147{
148 int ret = twl4030_i2c_write_u8(TWL4030_MODULE_KEYPAD, data, reg); 148 int ret = twl_i2c_write_u8(TWL4030_MODULE_KEYPAD, data, reg);
149 149
150 if (ret < 0) 150 if (ret < 0)
151 dev_warn(kp->dbg_dev, 151 dev_warn(kp->dbg_dev,
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index a73b889fff79..bdde5c889035 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -49,7 +49,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
49 local_irq_enable(); 49 local_irq_enable();
50#endif 50#endif
51 51
52 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value, 52 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value,
53 STS_HW_CONDITIONS); 53 STS_HW_CONDITIONS);
54 if (!err) { 54 if (!err) {
55 input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); 55 input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 44714f5cf495..9021f44de2a4 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * twl4030_core.c - driver for TWL4030/TPS659x0 PM and audio CODEC devices 2 * twl_core.c - driver for TWL4030/TWL5030/TWL60X0/TPS659x0 PM
3 * and audio CODEC devices
3 * 4 *
4 * Copyright (C) 2005-2006 Texas Instruments, Inc. 5 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5 * 6 *
@@ -55,7 +56,7 @@
55 * (and associated registers). 56 * (and associated registers).
56 */ 57 */
57 58
58#define DRIVER_NAME "twl4030" 59#define DRIVER_NAME "twl"
59 60
60#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ 61#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
61 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) 62 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
@@ -125,7 +126,7 @@
125/* Last - for index max*/ 126/* Last - for index max*/
126#define TWL4030_MODULE_LAST TWL4030_MODULE_SECURED_REG 127#define TWL4030_MODULE_LAST TWL4030_MODULE_SECURED_REG
127 128
128#define TWL4030_NUM_SLAVES 4 129#define TWL_NUM_SLAVES 4
129 130
130#if defined(CONFIG_INPUT_TWL4030_PWRBUTTON) \ 131#if defined(CONFIG_INPUT_TWL4030_PWRBUTTON) \
131 || defined(CONFIG_INPUT_TWL4030_PWBUTTON_MODULE) 132 || defined(CONFIG_INPUT_TWL4030_PWBUTTON_MODULE)
@@ -134,6 +135,13 @@
134#define twl_has_pwrbutton() false 135#define twl_has_pwrbutton() false
135#endif 136#endif
136 137
138#define SUB_CHIP_ID0 0
139#define SUB_CHIP_ID1 1
140#define SUB_CHIP_ID2 2
141#define SUB_CHIP_ID3 3
142
143#define TWL_MODULE_LAST TWL4030_MODULE_LAST
144
137/* Base Address defns for twl4030_map[] */ 145/* Base Address defns for twl4030_map[] */
138 146
139/* subchip/slave 0 - USB ID */ 147/* subchip/slave 0 - USB ID */
@@ -201,7 +209,7 @@
201static bool inuse; 209static bool inuse;
202 210
203/* Structure for each TWL4030 Slave */ 211/* Structure for each TWL4030 Slave */
204struct twl4030_client { 212struct twl_client {
205 struct i2c_client *client; 213 struct i2c_client *client;
206 u8 address; 214 u8 address;
207 215
@@ -212,16 +220,16 @@ struct twl4030_client {
212 struct mutex xfer_lock; 220 struct mutex xfer_lock;
213}; 221};
214 222
215static struct twl4030_client twl4030_modules[TWL4030_NUM_SLAVES]; 223static struct twl_client twl_modules[TWL_NUM_SLAVES];
216 224
217 225
218/* mapping the module id to slave id and base address */ 226/* mapping the module id to slave id and base address */
219struct twl4030mapping { 227struct twl_mapping {
220 unsigned char sid; /* Slave ID */ 228 unsigned char sid; /* Slave ID */
221 unsigned char base; /* base address */ 229 unsigned char base; /* base address */
222}; 230};
223 231
224static struct twl4030mapping twl4030_map[TWL4030_MODULE_LAST + 1] = { 232static struct twl_mapping twl4030_map[TWL4030_MODULE_LAST + 1] = {
225 /* 233 /*
226 * NOTE: don't change this table without updating the 234 * NOTE: don't change this table without updating the
227 * <linux/i2c/twl4030.h> defines for TWL4030_MODULE_* 235 * <linux/i2c/twl4030.h> defines for TWL4030_MODULE_*
@@ -262,7 +270,7 @@ static struct twl4030mapping twl4030_map[TWL4030_MODULE_LAST + 1] = {
262/* Exported Functions */ 270/* Exported Functions */
263 271
264/** 272/**
265 * twl4030_i2c_write - Writes a n bit register in TWL4030 273 * twl_i2c_write - Writes a n bit register in TWL4030/TWL5030/TWL60X0
266 * @mod_no: module number 274 * @mod_no: module number
267 * @value: an array of num_bytes+1 containing data to write 275 * @value: an array of num_bytes+1 containing data to write
268 * @reg: register address (just offset will do) 276 * @reg: register address (just offset will do)
@@ -273,19 +281,19 @@ static struct twl4030mapping twl4030_map[TWL4030_MODULE_LAST + 1] = {
273 * 281 *
274 * Returns the result of operation - 0 is success 282 * Returns the result of operation - 0 is success
275 */ 283 */
276int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) 284int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
277{ 285{
278 int ret; 286 int ret;
279 int sid; 287 int sid;
280 struct twl4030_client *twl; 288 struct twl_client *twl;
281 struct i2c_msg *msg; 289 struct i2c_msg *msg;
282 290
283 if (unlikely(mod_no > TWL4030_MODULE_LAST)) { 291 if (unlikely(mod_no > TWL_MODULE_LAST)) {
284 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); 292 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
285 return -EPERM; 293 return -EPERM;
286 } 294 }
287 sid = twl4030_map[mod_no].sid; 295 sid = twl4030_map[mod_no].sid;
288 twl = &twl4030_modules[sid]; 296 twl = &twl_modules[sid];
289 297
290 if (unlikely(!inuse)) { 298 if (unlikely(!inuse)) {
291 pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid); 299 pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid);
@@ -318,10 +326,10 @@ int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
318 return 0; 326 return 0;
319 } 327 }
320} 328}
321EXPORT_SYMBOL(twl4030_i2c_write); 329EXPORT_SYMBOL(twl_i2c_write);
322 330
323/** 331/**
324 * twl4030_i2c_read - Reads a n bit register in TWL4030 332 * twl_i2c_read - Reads a n bit register in TWL4030/TWL5030/TWL60X0
325 * @mod_no: module number 333 * @mod_no: module number
326 * @value: an array of num_bytes containing data to be read 334 * @value: an array of num_bytes containing data to be read
327 * @reg: register address (just offset will do) 335 * @reg: register address (just offset will do)
@@ -329,20 +337,20 @@ EXPORT_SYMBOL(twl4030_i2c_write);
329 * 337 *
330 * Returns result of operation - num_bytes is success else failure. 338 * Returns result of operation - num_bytes is success else failure.
331 */ 339 */
332int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) 340int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
333{ 341{
334 int ret; 342 int ret;
335 u8 val; 343 u8 val;
336 int sid; 344 int sid;
337 struct twl4030_client *twl; 345 struct twl_client *twl;
338 struct i2c_msg *msg; 346 struct i2c_msg *msg;
339 347
340 if (unlikely(mod_no > TWL4030_MODULE_LAST)) { 348 if (unlikely(mod_no > TWL_MODULE_LAST)) {
341 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); 349 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
342 return -EPERM; 350 return -EPERM;
343 } 351 }
344 sid = twl4030_map[mod_no].sid; 352 sid = twl4030_map[mod_no].sid;
345 twl = &twl4030_modules[sid]; 353 twl = &twl_modules[sid];
346 354
347 if (unlikely(!inuse)) { 355 if (unlikely(!inuse)) {
348 pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid); 356 pr_err("%s: client %d is not initialized\n", DRIVER_NAME, sid);
@@ -377,40 +385,40 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
377 return 0; 385 return 0;
378 } 386 }
379} 387}
380EXPORT_SYMBOL(twl4030_i2c_read); 388EXPORT_SYMBOL(twl_i2c_read);
381 389
382/** 390/**
383 * twl4030_i2c_write_u8 - Writes a 8 bit register in TWL4030 391 * twl_i2c_write_u8 - Writes a 8 bit register in TWL4030/TWL5030/TWL60X0
384 * @mod_no: module number 392 * @mod_no: module number
385 * @value: the value to be written 8 bit 393 * @value: the value to be written 8 bit
386 * @reg: register address (just offset will do) 394 * @reg: register address (just offset will do)
387 * 395 *
388 * Returns result of operation - 0 is success 396 * Returns result of operation - 0 is success
389 */ 397 */
390int twl4030_i2c_write_u8(u8 mod_no, u8 value, u8 reg) 398int twl_i2c_write_u8(u8 mod_no, u8 value, u8 reg)
391{ 399{
392 400
393 /* 2 bytes offset 1 contains the data offset 0 is used by i2c_write */ 401 /* 2 bytes offset 1 contains the data offset 0 is used by i2c_write */
394 u8 temp_buffer[2] = { 0 }; 402 u8 temp_buffer[2] = { 0 };
395 /* offset 1 contains the data */ 403 /* offset 1 contains the data */
396 temp_buffer[1] = value; 404 temp_buffer[1] = value;
397 return twl4030_i2c_write(mod_no, temp_buffer, reg, 1); 405 return twl_i2c_write(mod_no, temp_buffer, reg, 1);
398} 406}
399EXPORT_SYMBOL(twl4030_i2c_write_u8); 407EXPORT_SYMBOL(twl_i2c_write_u8);
400 408
401/** 409/**
402 * twl4030_i2c_read_u8 - Reads a 8 bit register from TWL4030 410 * twl_i2c_read_u8 - Reads a 8 bit register from TWL4030/TWL5030/TWL60X0
403 * @mod_no: module number 411 * @mod_no: module number
404 * @value: the value read 8 bit 412 * @value: the value read 8 bit
405 * @reg: register address (just offset will do) 413 * @reg: register address (just offset will do)
406 * 414 *
407 * Returns result of operation - 0 is success 415 * Returns result of operation - 0 is success
408 */ 416 */
409int twl4030_i2c_read_u8(u8 mod_no, u8 *value, u8 reg) 417int twl_i2c_read_u8(u8 mod_no, u8 *value, u8 reg)
410{ 418{
411 return twl4030_i2c_read(mod_no, value, reg, 1); 419 return twl_i2c_read(mod_no, value, reg, 1);
412} 420}
413EXPORT_SYMBOL(twl4030_i2c_read_u8); 421EXPORT_SYMBOL(twl_i2c_read_u8);
414 422
415/*----------------------------------------------------------------------*/ 423/*----------------------------------------------------------------------*/
416 424
@@ -420,7 +428,7 @@ add_numbered_child(unsigned chip, const char *name, int num,
420 bool can_wakeup, int irq0, int irq1) 428 bool can_wakeup, int irq0, int irq1)
421{ 429{
422 struct platform_device *pdev; 430 struct platform_device *pdev;
423 struct twl4030_client *twl = &twl4030_modules[chip]; 431 struct twl_client *twl = &twl_modules[chip];
424 int status; 432 int status;
425 433
426 pdev = platform_device_alloc(name, num); 434 pdev = platform_device_alloc(name, num);
@@ -515,23 +523,24 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
515 pdata->bci, sizeof(*pdata->bci), 523 pdata->bci, sizeof(*pdata->bci),
516 false, 524 false,
517 /* irq0 = CHG_PRES, irq1 = BCI */ 525 /* irq0 = CHG_PRES, irq1 = BCI */
518 pdata->irq_base + 8 + 1, pdata->irq_base + 2); 526 pdata->irq_base + BCI_PRES_INTR_OFFSET,
527 pdata->irq_base + BCI_INTR_OFFSET);
519 if (IS_ERR(child)) 528 if (IS_ERR(child))
520 return PTR_ERR(child); 529 return PTR_ERR(child);
521 } 530 }
522 531
523 if (twl_has_gpio() && pdata->gpio) { 532 if (twl_has_gpio() && pdata->gpio) {
524 child = add_child(1, "twl4030_gpio", 533 child = add_child(SUB_CHIP_ID1, "twl4030_gpio",
525 pdata->gpio, sizeof(*pdata->gpio), 534 pdata->gpio, sizeof(*pdata->gpio),
526 false, pdata->irq_base + 0, 0); 535 false, pdata->irq_base + GPIO_INTR_OFFSET, 0);
527 if (IS_ERR(child)) 536 if (IS_ERR(child))
528 return PTR_ERR(child); 537 return PTR_ERR(child);
529 } 538 }
530 539
531 if (twl_has_keypad() && pdata->keypad) { 540 if (twl_has_keypad() && pdata->keypad) {
532 child = add_child(2, "twl4030_keypad", 541 child = add_child(SUB_CHIP_ID2, "twl4030_keypad",
533 pdata->keypad, sizeof(*pdata->keypad), 542 pdata->keypad, sizeof(*pdata->keypad),
534 true, pdata->irq_base + 1, 0); 543 true, pdata->irq_base + KEYPAD_INTR_OFFSET, 0);
535 if (IS_ERR(child)) 544 if (IS_ERR(child))
536 return PTR_ERR(child); 545 return PTR_ERR(child);
537 } 546 }
@@ -539,7 +548,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
539 if (twl_has_madc() && pdata->madc) { 548 if (twl_has_madc() && pdata->madc) {
540 child = add_child(2, "twl4030_madc", 549 child = add_child(2, "twl4030_madc",
541 pdata->madc, sizeof(*pdata->madc), 550 pdata->madc, sizeof(*pdata->madc),
542 true, pdata->irq_base + 3, 0); 551 true, pdata->irq_base + MADC_INTR_OFFSET, 0);
543 if (IS_ERR(child)) 552 if (IS_ERR(child))
544 return PTR_ERR(child); 553 return PTR_ERR(child);
545 } 554 }
@@ -554,7 +563,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
554 */ 563 */
555 child = add_child(3, "twl4030_rtc", 564 child = add_child(3, "twl4030_rtc",
556 NULL, 0, 565 NULL, 0,
557 true, pdata->irq_base + 8 + 3, 0); 566 true, pdata->irq_base + RTC_INTR_OFFSET, 0);
558 if (IS_ERR(child)) 567 if (IS_ERR(child))
559 return PTR_ERR(child); 568 return PTR_ERR(child);
560 } 569 }
@@ -604,7 +613,8 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features)
604 pdata->usb, sizeof(*pdata->usb), 613 pdata->usb, sizeof(*pdata->usb),
605 true, 614 true,
606 /* irq0 = USB_PRES, irq1 = USB */ 615 /* irq0 = USB_PRES, irq1 = USB */
607 pdata->irq_base + 8 + 2, pdata->irq_base + 4); 616 pdata->irq_base + USB_PRES_INTR_OFFSET,
617 pdata->irq_base + USB_INTR_OFFSET);
608 618
609 if (IS_ERR(child)) 619 if (IS_ERR(child))
610 return PTR_ERR(child); 620 return PTR_ERR(child);
@@ -724,7 +734,7 @@ static inline int __init protect_pm_master(void)
724{ 734{
725 int e = 0; 735 int e = 0;
726 736
727 e = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, KEY_LOCK, 737 e = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_LOCK,
728 R_PROTECT_KEY); 738 R_PROTECT_KEY);
729 return e; 739 return e;
730} 740}
@@ -733,9 +743,9 @@ static inline int __init unprotect_pm_master(void)
733{ 743{
734 int e = 0; 744 int e = 0;
735 745
736 e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, KEY_UNLOCK1, 746 e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_UNLOCK1,
737 R_PROTECT_KEY); 747 R_PROTECT_KEY);
738 e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, KEY_UNLOCK2, 748 e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_UNLOCK2,
739 R_PROTECT_KEY); 749 R_PROTECT_KEY);
740 return e; 750 return e;
741} 751}
@@ -755,7 +765,7 @@ static void clocks_init(struct device *dev,
755 osc = clk_get(dev, "osc_sys_ck"); 765 osc = clk_get(dev, "osc_sys_ck");
756 766
757 if (IS_ERR(osc)) { 767 if (IS_ERR(osc)) {
758 printk(KERN_WARNING "Skipping twl4030 internal clock init and " 768 printk(KERN_WARNING "Skipping twl internal clock init and "
759 "using bootloader value (unknown osc rate)\n"); 769 "using bootloader value (unknown osc rate)\n");
760 return; 770 return;
761 } 771 }
@@ -769,7 +779,7 @@ static void clocks_init(struct device *dev,
769 */ 779 */
770 osc = ERR_PTR(-EIO); 780 osc = ERR_PTR(-EIO);
771 781
772 printk(KERN_WARNING "Skipping twl4030 internal clock init and " 782 printk(KERN_WARNING "Skipping twl internal clock init and "
773 "using bootloader value (unknown osc rate)\n"); 783 "using bootloader value (unknown osc rate)\n");
774 784
775 return; 785 return;
@@ -793,7 +803,7 @@ static void clocks_init(struct device *dev,
793 803
794 e |= unprotect_pm_master(); 804 e |= unprotect_pm_master();
795 /* effect->MADC+USB ck en */ 805 /* effect->MADC+USB ck en */
796 e |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, ctrl, R_CFG_BOOT); 806 e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, ctrl, R_CFG_BOOT);
797 e |= protect_pm_master(); 807 e |= protect_pm_master();
798 808
799 if (e < 0) 809 if (e < 0)
@@ -806,7 +816,7 @@ int twl_init_irq(int irq_num, unsigned irq_base, unsigned irq_end);
806int twl_exit_irq(void); 816int twl_exit_irq(void);
807int twl_init_chip_irq(const char *chip); 817int twl_init_chip_irq(const char *chip);
808 818
809static int twl4030_remove(struct i2c_client *client) 819static int twl_remove(struct i2c_client *client)
810{ 820{
811 unsigned i; 821 unsigned i;
812 int status; 822 int status;
@@ -815,12 +825,12 @@ static int twl4030_remove(struct i2c_client *client)
815 if (status < 0) 825 if (status < 0)
816 return status; 826 return status;
817 827
818 for (i = 0; i < TWL4030_NUM_SLAVES; i++) { 828 for (i = 0; i < TWL_NUM_SLAVES; i++) {
819 struct twl4030_client *twl = &twl4030_modules[i]; 829 struct twl_client *twl = &twl_modules[i];
820 830
821 if (twl->client && twl->client != client) 831 if (twl->client && twl->client != client)
822 i2c_unregister_device(twl->client); 832 i2c_unregister_device(twl->client);
823 twl4030_modules[i].client = NULL; 833 twl_modules[i].client = NULL;
824 } 834 }
825 inuse = false; 835 inuse = false;
826 return 0; 836 return 0;
@@ -828,7 +838,7 @@ static int twl4030_remove(struct i2c_client *client)
828 838
829/* NOTE: this driver only handles a single twl4030/tps659x0 chip */ 839/* NOTE: this driver only handles a single twl4030/tps659x0 chip */
830static int __init 840static int __init
831twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id) 841twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
832{ 842{
833 int status; 843 int status;
834 unsigned i; 844 unsigned i;
@@ -849,8 +859,8 @@ twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
849 return -EBUSY; 859 return -EBUSY;
850 } 860 }
851 861
852 for (i = 0; i < TWL4030_NUM_SLAVES; i++) { 862 for (i = 0; i < TWL_NUM_SLAVES; i++) {
853 struct twl4030_client *twl = &twl4030_modules[i]; 863 struct twl_client *twl = &twl_modules[i];
854 864
855 twl->address = client->addr + i; 865 twl->address = client->addr + i;
856 if (i == 0) 866 if (i == 0)
@@ -889,11 +899,11 @@ twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
889 status = add_children(pdata, id->driver_data); 899 status = add_children(pdata, id->driver_data);
890fail: 900fail:
891 if (status < 0) 901 if (status < 0)
892 twl4030_remove(client); 902 twl_remove(client);
893 return status; 903 return status;
894} 904}
895 905
896static const struct i2c_device_id twl4030_ids[] = { 906static const struct i2c_device_id twl_ids[] = {
897 { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */ 907 { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */
898 { "twl5030", 0 }, /* T2 updated */ 908 { "twl5030", 0 }, /* T2 updated */
899 { "twl5031", TWL5031 }, /* TWL5030 updated */ 909 { "twl5031", TWL5031 }, /* TWL5030 updated */
@@ -902,28 +912,28 @@ static const struct i2c_device_id twl4030_ids[] = {
902 { "tps65920", TPS_SUBSET }, /* fewer LDOs; no codec or charger */ 912 { "tps65920", TPS_SUBSET }, /* fewer LDOs; no codec or charger */
903 { /* end of list */ }, 913 { /* end of list */ },
904}; 914};
905MODULE_DEVICE_TABLE(i2c, twl4030_ids); 915MODULE_DEVICE_TABLE(i2c, twl_ids);
906 916
907/* One Client Driver , 4 Clients */ 917/* One Client Driver , 4 Clients */
908static struct i2c_driver twl4030_driver = { 918static struct i2c_driver twl_driver = {
909 .driver.name = DRIVER_NAME, 919 .driver.name = DRIVER_NAME,
910 .id_table = twl4030_ids, 920 .id_table = twl_ids,
911 .probe = twl4030_probe, 921 .probe = twl_probe,
912 .remove = twl4030_remove, 922 .remove = twl_remove,
913}; 923};
914 924
915static int __init twl4030_init(void) 925static int __init twl_init(void)
916{ 926{
917 return i2c_add_driver(&twl4030_driver); 927 return i2c_add_driver(&twl_driver);
918} 928}
919subsys_initcall(twl4030_init); 929subsys_initcall(twl_init);
920 930
921static void __exit twl4030_exit(void) 931static void __exit twl_exit(void)
922{ 932{
923 i2c_del_driver(&twl4030_driver); 933 i2c_del_driver(&twl_driver);
924} 934}
925module_exit(twl4030_exit); 935module_exit(twl_exit);
926 936
927MODULE_AUTHOR("Texas Instruments, Inc."); 937MODULE_AUTHOR("Texas Instruments, Inc.");
928MODULE_DESCRIPTION("I2C Core interface for TWL4030"); 938MODULE_DESCRIPTION("I2C Core interface for TWL");
929MODULE_LICENSE("GPL"); 939MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index c4528db549c6..5a62cf916987 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -296,7 +296,7 @@ static int twl4030_irq_thread(void *data)
296 /* Wait for IRQ, then read PIH irq status (also blocking) */ 296 /* Wait for IRQ, then read PIH irq status (also blocking) */
297 wait_for_completion_interruptible(&irq_event); 297 wait_for_completion_interruptible(&irq_event);
298 298
299 ret = twl4030_i2c_read_u8(TWL4030_MODULE_PIH, &pih_isr, 299 ret = twl_i2c_read_u8(TWL4030_MODULE_PIH, &pih_isr,
300 REG_PIH_ISR_P1); 300 REG_PIH_ISR_P1);
301 if (ret) { 301 if (ret) {
302 pr_warning("twl4030: I2C error %d reading PIH ISR\n", 302 pr_warning("twl4030: I2C error %d reading PIH ISR\n",
@@ -396,7 +396,7 @@ static int twl4030_init_sih_modules(unsigned line)
396 if (sih->irq_lines <= line) 396 if (sih->irq_lines <= line)
397 continue; 397 continue;
398 398
399 status = twl4030_i2c_write(sih->module, buf, 399 status = twl_i2c_write(sih->module, buf,
400 sih->mask[line].imr_offset, sih->bytes_ixr); 400 sih->mask[line].imr_offset, sih->bytes_ixr);
401 if (status < 0) 401 if (status < 0)
402 pr_err("twl4030: err %d initializing %s %s\n", 402 pr_err("twl4030: err %d initializing %s %s\n",
@@ -410,7 +410,7 @@ static int twl4030_init_sih_modules(unsigned line)
410 * And for PWR_INT it's not documented... 410 * And for PWR_INT it's not documented...
411 */ 411 */
412 if (sih->set_cor) { 412 if (sih->set_cor) {
413 status = twl4030_i2c_write_u8(sih->module, 413 status = twl_i2c_write_u8(sih->module,
414 TWL4030_SIH_CTRL_COR_MASK, 414 TWL4030_SIH_CTRL_COR_MASK,
415 sih->control_offset); 415 sih->control_offset);
416 if (status < 0) 416 if (status < 0)
@@ -438,14 +438,14 @@ static int twl4030_init_sih_modules(unsigned line)
438 * uncommon with PWR_INT.PWRON. 438 * uncommon with PWR_INT.PWRON.
439 */ 439 */
440 for (j = 0; j < 2; j++) { 440 for (j = 0; j < 2; j++) {
441 status = twl4030_i2c_read(sih->module, rxbuf, 441 status = twl_i2c_read(sih->module, rxbuf,
442 sih->mask[line].isr_offset, sih->bytes_ixr); 442 sih->mask[line].isr_offset, sih->bytes_ixr);
443 if (status < 0) 443 if (status < 0)
444 pr_err("twl4030: err %d initializing %s %s\n", 444 pr_err("twl4030: err %d initializing %s %s\n",
445 status, sih->name, "ISR"); 445 status, sih->name, "ISR");
446 446
447 if (!sih->set_cor) 447 if (!sih->set_cor)
448 status = twl4030_i2c_write(sih->module, buf, 448 status = twl_i2c_write(sih->module, buf,
449 sih->mask[line].isr_offset, 449 sih->mask[line].isr_offset,
450 sih->bytes_ixr); 450 sih->bytes_ixr);
451 /* else COR=1 means read sufficed. 451 /* else COR=1 means read sufficed.
@@ -514,7 +514,7 @@ static void twl4030_sih_do_mask(struct work_struct *work)
514 return; 514 return;
515 515
516 /* write the whole mask ... simpler than subsetting it */ 516 /* write the whole mask ... simpler than subsetting it */
517 status = twl4030_i2c_write(sih->module, imr.bytes, 517 status = twl_i2c_write(sih->module, imr.bytes,
518 sih->mask[irq_line].imr_offset, sih->bytes_ixr); 518 sih->mask[irq_line].imr_offset, sih->bytes_ixr);
519 if (status) 519 if (status)
520 pr_err("twl4030: %s, %s --> %d\n", __func__, 520 pr_err("twl4030: %s, %s --> %d\n", __func__,
@@ -545,7 +545,7 @@ static void twl4030_sih_do_edge(struct work_struct *work)
545 * any processor on the other IRQ line, EDR registers are 545 * any processor on the other IRQ line, EDR registers are
546 * shared. 546 * shared.
547 */ 547 */
548 status = twl4030_i2c_read(sih->module, bytes + 1, 548 status = twl_i2c_read(sih->module, bytes + 1,
549 sih->edr_offset, sih->bytes_edr); 549 sih->edr_offset, sih->bytes_edr);
550 if (status) { 550 if (status) {
551 pr_err("twl4030: %s, %s --> %d\n", __func__, 551 pr_err("twl4030: %s, %s --> %d\n", __func__,
@@ -579,7 +579,7 @@ static void twl4030_sih_do_edge(struct work_struct *work)
579 } 579 }
580 580
581 /* Write */ 581 /* Write */
582 status = twl4030_i2c_write(sih->module, bytes, 582 status = twl_i2c_write(sih->module, bytes,
583 sih->edr_offset, sih->bytes_edr); 583 sih->edr_offset, sih->bytes_edr);
584 if (status) 584 if (status)
585 pr_err("twl4030: %s, %s --> %d\n", __func__, 585 pr_err("twl4030: %s, %s --> %d\n", __func__,
@@ -664,7 +664,7 @@ static inline int sih_read_isr(const struct sih *sih)
664 /* FIXME need retry-on-error ... */ 664 /* FIXME need retry-on-error ... */
665 665
666 isr.word = 0; 666 isr.word = 0;
667 status = twl4030_i2c_read(sih->module, isr.bytes, 667 status = twl_i2c_read(sih->module, isr.bytes,
668 sih->mask[irq_line].isr_offset, sih->bytes_ixr); 668 sih->mask[irq_line].isr_offset, sih->bytes_ixr);
669 669
670 return (status < 0) ? status : le32_to_cpu(isr.word); 670 return (status < 0) ? status : le32_to_cpu(isr.word);
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 424b255d6f92..0815292fdafc 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -131,11 +131,11 @@ static int __init twl4030_write_script_byte(u8 address, u8 byte)
131{ 131{
132 int err; 132 int err;
133 133
134 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address, 134 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address,
135 R_MEMORY_ADDRESS); 135 R_MEMORY_ADDRESS);
136 if (err) 136 if (err)
137 goto out; 137 goto out;
138 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, byte, 138 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, byte,
139 R_MEMORY_DATA); 139 R_MEMORY_DATA);
140out: 140out:
141 return err; 141 return err;
@@ -192,18 +192,18 @@ static int __init twl4030_config_wakeup3_sequence(u8 address)
192 u8 data; 192 u8 data;
193 193
194 /* Set SLEEP to ACTIVE SEQ address for P3 */ 194 /* Set SLEEP to ACTIVE SEQ address for P3 */
195 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address, 195 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address,
196 R_SEQ_ADD_S2A3); 196 R_SEQ_ADD_S2A3);
197 if (err) 197 if (err)
198 goto out; 198 goto out;
199 199
200 /* P3 LVL_WAKEUP should be on LEVEL */ 200 /* P3 LVL_WAKEUP should be on LEVEL */
201 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &data, 201 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &data,
202 R_P3_SW_EVENTS); 202 R_P3_SW_EVENTS);
203 if (err) 203 if (err)
204 goto out; 204 goto out;
205 data |= LVL_WAKEUP; 205 data |= LVL_WAKEUP;
206 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, data, 206 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, data,
207 R_P3_SW_EVENTS); 207 R_P3_SW_EVENTS);
208out: 208out:
209 if (err) 209 if (err)
@@ -217,42 +217,42 @@ static int __init twl4030_config_wakeup12_sequence(u8 address)
217 u8 data; 217 u8 data;
218 218
219 /* Set SLEEP to ACTIVE SEQ address for P1 and P2 */ 219 /* Set SLEEP to ACTIVE SEQ address for P1 and P2 */
220 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address, 220 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address,
221 R_SEQ_ADD_S2A12); 221 R_SEQ_ADD_S2A12);
222 if (err) 222 if (err)
223 goto out; 223 goto out;
224 224
225 /* P1/P2 LVL_WAKEUP should be on LEVEL */ 225 /* P1/P2 LVL_WAKEUP should be on LEVEL */
226 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &data, 226 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &data,
227 R_P1_SW_EVENTS); 227 R_P1_SW_EVENTS);
228 if (err) 228 if (err)
229 goto out; 229 goto out;
230 230
231 data |= LVL_WAKEUP; 231 data |= LVL_WAKEUP;
232 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, data, 232 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, data,
233 R_P1_SW_EVENTS); 233 R_P1_SW_EVENTS);
234 if (err) 234 if (err)
235 goto out; 235 goto out;
236 236
237 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &data, 237 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &data,
238 R_P2_SW_EVENTS); 238 R_P2_SW_EVENTS);
239 if (err) 239 if (err)
240 goto out; 240 goto out;
241 241
242 data |= LVL_WAKEUP; 242 data |= LVL_WAKEUP;
243 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, data, 243 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, data,
244 R_P2_SW_EVENTS); 244 R_P2_SW_EVENTS);
245 if (err) 245 if (err)
246 goto out; 246 goto out;
247 247
248 if (machine_is_omap_3430sdp() || machine_is_omap_ldp()) { 248 if (machine_is_omap_3430sdp() || machine_is_omap_ldp()) {
249 /* Disabling AC charger effect on sleep-active transitions */ 249 /* Disabling AC charger effect on sleep-active transitions */
250 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &data, 250 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &data,
251 R_CFG_P1_TRANSITION); 251 R_CFG_P1_TRANSITION);
252 if (err) 252 if (err)
253 goto out; 253 goto out;
254 data &= ~(1<<1); 254 data &= ~(1<<1);
255 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, data , 255 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, data ,
256 R_CFG_P1_TRANSITION); 256 R_CFG_P1_TRANSITION);
257 if (err) 257 if (err)
258 goto out; 258 goto out;
@@ -270,7 +270,7 @@ static int __init twl4030_config_sleep_sequence(u8 address)
270 int err; 270 int err;
271 271
272 /* Set ACTIVE to SLEEP SEQ address in T2 memory*/ 272 /* Set ACTIVE to SLEEP SEQ address in T2 memory*/
273 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address, 273 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address,
274 R_SEQ_ADD_A2S); 274 R_SEQ_ADD_A2S);
275 275
276 if (err) 276 if (err)
@@ -285,41 +285,41 @@ static int __init twl4030_config_warmreset_sequence(u8 address)
285 u8 rd_data; 285 u8 rd_data;
286 286
287 /* Set WARM RESET SEQ address for P1 */ 287 /* Set WARM RESET SEQ address for P1 */
288 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address, 288 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, address,
289 R_SEQ_ADD_WARM); 289 R_SEQ_ADD_WARM);
290 if (err) 290 if (err)
291 goto out; 291 goto out;
292 292
293 /* P1/P2/P3 enable WARMRESET */ 293 /* P1/P2/P3 enable WARMRESET */
294 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &rd_data, 294 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &rd_data,
295 R_P1_SW_EVENTS); 295 R_P1_SW_EVENTS);
296 if (err) 296 if (err)
297 goto out; 297 goto out;
298 298
299 rd_data |= ENABLE_WARMRESET; 299 rd_data |= ENABLE_WARMRESET;
300 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, rd_data, 300 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, rd_data,
301 R_P1_SW_EVENTS); 301 R_P1_SW_EVENTS);
302 if (err) 302 if (err)
303 goto out; 303 goto out;
304 304
305 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &rd_data, 305 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &rd_data,
306 R_P2_SW_EVENTS); 306 R_P2_SW_EVENTS);
307 if (err) 307 if (err)
308 goto out; 308 goto out;
309 309
310 rd_data |= ENABLE_WARMRESET; 310 rd_data |= ENABLE_WARMRESET;
311 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, rd_data, 311 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, rd_data,
312 R_P2_SW_EVENTS); 312 R_P2_SW_EVENTS);
313 if (err) 313 if (err)
314 goto out; 314 goto out;
315 315
316 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &rd_data, 316 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &rd_data,
317 R_P3_SW_EVENTS); 317 R_P3_SW_EVENTS);
318 if (err) 318 if (err)
319 goto out; 319 goto out;
320 320
321 rd_data |= ENABLE_WARMRESET; 321 rd_data |= ENABLE_WARMRESET;
322 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, rd_data, 322 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, rd_data,
323 R_P3_SW_EVENTS); 323 R_P3_SW_EVENTS);
324out: 324out:
325 if (err) 325 if (err)
@@ -344,8 +344,8 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
344 rconfig_addr = res_config_addrs[rconfig->resource]; 344 rconfig_addr = res_config_addrs[rconfig->resource];
345 345
346 /* Set resource group */ 346 /* Set resource group */
347 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &grp, 347 err = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &grp,
348 rconfig_addr + DEV_GRP_OFFSET); 348 rconfig_addr + DEV_GRP_OFFSET);
349 if (err) { 349 if (err) {
350 pr_err("TWL4030 Resource %d group could not be read\n", 350 pr_err("TWL4030 Resource %d group could not be read\n",
351 rconfig->resource); 351 rconfig->resource);
@@ -355,8 +355,8 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
355 if (rconfig->devgroup != TWL4030_RESCONFIG_UNDEF) { 355 if (rconfig->devgroup != TWL4030_RESCONFIG_UNDEF) {
356 grp &= ~DEV_GRP_MASK; 356 grp &= ~DEV_GRP_MASK;
357 grp |= rconfig->devgroup << DEV_GRP_SHIFT; 357 grp |= rconfig->devgroup << DEV_GRP_SHIFT;
358 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 358 err = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
359 grp, rconfig_addr + DEV_GRP_OFFSET); 359 grp, rconfig_addr + DEV_GRP_OFFSET);
360 if (err < 0) { 360 if (err < 0) {
361 pr_err("TWL4030 failed to program devgroup\n"); 361 pr_err("TWL4030 failed to program devgroup\n");
362 return err; 362 return err;
@@ -364,7 +364,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
364 } 364 }
365 365
366 /* Set resource types */ 366 /* Set resource types */
367 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &type, 367 err = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &type,
368 rconfig_addr + TYPE_OFFSET); 368 rconfig_addr + TYPE_OFFSET);
369 if (err < 0) { 369 if (err < 0) {
370 pr_err("TWL4030 Resource %d type could not be read\n", 370 pr_err("TWL4030 Resource %d type could not be read\n",
@@ -382,7 +382,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
382 type |= rconfig->type2 << TYPE2_SHIFT; 382 type |= rconfig->type2 << TYPE2_SHIFT;
383 } 383 }
384 384
385 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 385 err = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
386 type, rconfig_addr + TYPE_OFFSET); 386 type, rconfig_addr + TYPE_OFFSET);
387 if (err < 0) { 387 if (err < 0) {
388 pr_err("TWL4030 failed to program resource type\n"); 388 pr_err("TWL4030 failed to program resource type\n");
@@ -390,8 +390,8 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
390 } 390 }
391 391
392 /* Set remap states */ 392 /* Set remap states */
393 err = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &remap, 393 err = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &remap,
394 rconfig_addr + REMAP_OFFSET); 394 rconfig_addr + REMAP_OFFSET);
395 if (err < 0) { 395 if (err < 0) {
396 pr_err("TWL4030 Resource %d remap could not be read\n", 396 pr_err("TWL4030 Resource %d remap could not be read\n",
397 rconfig->resource); 397 rconfig->resource);
@@ -408,9 +408,9 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
408 remap |= rconfig->remap_off << SLEEP_STATE_SHIFT; 408 remap |= rconfig->remap_off << SLEEP_STATE_SHIFT;
409 } 409 }
410 410
411 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 411 err = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
412 remap, 412 remap,
413 rconfig_addr + REMAP_OFFSET); 413 rconfig_addr + REMAP_OFFSET);
414 if (err < 0) { 414 if (err < 0) {
415 pr_err("TWL4030 failed to program remap\n"); 415 pr_err("TWL4030 failed to program remap\n");
416 return err; 416 return err;
@@ -468,12 +468,12 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
468 struct twl4030_resconfig *resconfig; 468 struct twl4030_resconfig *resconfig;
469 u8 address = twl4030_start_script_address; 469 u8 address = twl4030_start_script_address;
470 470
471 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_1, 471 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_1,
472 R_PROTECT_KEY); 472 R_PROTECT_KEY);
473 if (err) 473 if (err)
474 goto unlock; 474 goto unlock;
475 475
476 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_2, 476 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_2,
477 R_PROTECT_KEY); 477 R_PROTECT_KEY);
478 if (err) 478 if (err)
479 goto unlock; 479 goto unlock;
@@ -496,7 +496,7 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
496 } 496 }
497 } 497 }
498 498
499 err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY); 499 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
500 if (err) 500 if (err)
501 pr_err("TWL4030 Unable to relock registers\n"); 501 pr_err("TWL4030 Unable to relock registers\n");
502 return; 502 return;
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index c8a6e583d773..8cc46e99ccca 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -64,7 +64,7 @@ twl4030reg_read(struct twlreg_info *info, unsigned offset)
64 u8 value; 64 u8 value;
65 int status; 65 int status;
66 66
67 status = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, 67 status = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER,
68 &value, info->base + offset); 68 &value, info->base + offset);
69 return (status < 0) ? status : value; 69 return (status < 0) ? status : value;
70} 70}
@@ -72,7 +72,7 @@ twl4030reg_read(struct twlreg_info *info, unsigned offset)
72static inline int 72static inline int
73twl4030reg_write(struct twlreg_info *info, unsigned offset, u8 value) 73twl4030reg_write(struct twlreg_info *info, unsigned offset, u8 value)
74{ 74{
75 return twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 75 return twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
76 value, info->base + offset); 76 value, info->base + offset);
77} 77}
78 78
@@ -171,12 +171,12 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
171 if (!(status & (P3_GRP | P2_GRP | P1_GRP))) 171 if (!(status & (P3_GRP | P2_GRP | P1_GRP)))
172 return -EACCES; 172 return -EACCES;
173 173
174 status = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 174 status = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
175 message >> 8, 0x15 /* PB_WORD_MSB */ ); 175 message >> 8, 0x15 /* PB_WORD_MSB */ );
176 if (status >= 0) 176 if (status >= 0)
177 return status; 177 return status;
178 178
179 return twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 179 return twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
180 message, 0x16 /* PB_WORD_LSB */ ); 180 message, 0x16 /* PB_WORD_LSB */ );
181} 181}
182 182
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 93565be12fae..6119712cc8de 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -92,7 +92,7 @@ static int twl4030_rtc_read_u8(u8 *data, u8 reg)
92{ 92{
93 int ret; 93 int ret;
94 94
95 ret = twl4030_i2c_read_u8(TWL4030_MODULE_RTC, data, reg); 95 ret = twl_i2c_read_u8(TWL4030_MODULE_RTC, data, reg);
96 if (ret < 0) 96 if (ret < 0)
97 pr_err("twl4030_rtc: Could not read TWL4030" 97 pr_err("twl4030_rtc: Could not read TWL4030"
98 "register %X - error %d\n", reg, ret); 98 "register %X - error %d\n", reg, ret);
@@ -106,7 +106,7 @@ static int twl4030_rtc_write_u8(u8 data, u8 reg)
106{ 106{
107 int ret; 107 int ret;
108 108
109 ret = twl4030_i2c_write_u8(TWL4030_MODULE_RTC, data, reg); 109 ret = twl_i2c_write_u8(TWL4030_MODULE_RTC, data, reg);
110 if (ret < 0) 110 if (ret < 0)
111 pr_err("twl4030_rtc: Could not write TWL4030" 111 pr_err("twl4030_rtc: Could not write TWL4030"
112 "register %X - error %d\n", reg, ret); 112 "register %X - error %d\n", reg, ret);
@@ -201,7 +201,7 @@ static int twl4030_rtc_read_time(struct device *dev, struct rtc_time *tm)
201 if (ret < 0) 201 if (ret < 0)
202 return ret; 202 return ret;
203 203
204 ret = twl4030_i2c_read(TWL4030_MODULE_RTC, rtc_data, 204 ret = twl_i2c_read(TWL4030_MODULE_RTC, rtc_data,
205 REG_SECONDS_REG, ALL_TIME_REGS); 205 REG_SECONDS_REG, ALL_TIME_REGS);
206 206
207 if (ret < 0) { 207 if (ret < 0) {
@@ -243,7 +243,7 @@ static int twl4030_rtc_set_time(struct device *dev, struct rtc_time *tm)
243 goto out; 243 goto out;
244 244
245 /* update all the time registers in one shot */ 245 /* update all the time registers in one shot */
246 ret = twl4030_i2c_write(TWL4030_MODULE_RTC, rtc_data, 246 ret = twl_i2c_write(TWL4030_MODULE_RTC, rtc_data,
247 REG_SECONDS_REG, ALL_TIME_REGS); 247 REG_SECONDS_REG, ALL_TIME_REGS);
248 if (ret < 0) { 248 if (ret < 0) {
249 dev_err(dev, "rtc_set_time error %d\n", ret); 249 dev_err(dev, "rtc_set_time error %d\n", ret);
@@ -266,7 +266,7 @@ static int twl4030_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
266 unsigned char rtc_data[ALL_TIME_REGS + 1]; 266 unsigned char rtc_data[ALL_TIME_REGS + 1];
267 int ret; 267 int ret;
268 268
269 ret = twl4030_i2c_read(TWL4030_MODULE_RTC, rtc_data, 269 ret = twl_i2c_read(TWL4030_MODULE_RTC, rtc_data,
270 REG_ALARM_SECONDS_REG, ALL_TIME_REGS); 270 REG_ALARM_SECONDS_REG, ALL_TIME_REGS);
271 if (ret < 0) { 271 if (ret < 0) {
272 dev_err(dev, "rtc_read_alarm error %d\n", ret); 272 dev_err(dev, "rtc_read_alarm error %d\n", ret);
@@ -305,7 +305,7 @@ static int twl4030_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
305 alarm_data[6] = bin2bcd(alm->time.tm_year - 100); 305 alarm_data[6] = bin2bcd(alm->time.tm_year - 100);
306 306
307 /* update all the alarm registers in one shot */ 307 /* update all the alarm registers in one shot */
308 ret = twl4030_i2c_write(TWL4030_MODULE_RTC, alarm_data, 308 ret = twl_i2c_write(TWL4030_MODULE_RTC, alarm_data,
309 REG_ALARM_SECONDS_REG, ALL_TIME_REGS); 309 REG_ALARM_SECONDS_REG, ALL_TIME_REGS);
310 if (ret) { 310 if (ret) {
311 dev_err(dev, "rtc_set_alarm error %d\n", ret); 311 dev_err(dev, "rtc_set_alarm error %d\n", ret);
@@ -363,7 +363,7 @@ static irqreturn_t twl4030_rtc_interrupt(int irq, void *rtc)
363 * risk wrongly clearing status for some other IRQ (losing 363 * risk wrongly clearing status for some other IRQ (losing
364 * the interrupt). Be smarter about handling RTC_UF ... 364 * the interrupt). Be smarter about handling RTC_UF ...
365 */ 365 */
366 res = twl4030_i2c_read_u8(TWL4030_MODULE_INT, 366 res = twl_i2c_read_u8(TWL4030_MODULE_INT,
367 &rd_reg, TWL4030_INT_PWR_ISR1); 367 &rd_reg, TWL4030_INT_PWR_ISR1);
368 if (res) 368 if (res)
369 goto out; 369 goto out;
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 3acbdb82bcf9..2be9f2fa41f9 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -276,16 +276,16 @@ static int twl4030_i2c_write_u8_verify(struct twl4030_usb *twl,
276{ 276{
277 u8 check; 277 u8 check;
278 278
279 if ((twl4030_i2c_write_u8(module, data, address) >= 0) && 279 if ((twl_i2c_write_u8(module, data, address) >= 0) &&
280 (twl4030_i2c_read_u8(module, &check, address) >= 0) && 280 (twl_i2c_read_u8(module, &check, address) >= 0) &&
281 (check == data)) 281 (check == data))
282 return 0; 282 return 0;
283 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n", 283 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
284 1, module, address, check, data); 284 1, module, address, check, data);
285 285
286 /* Failed once: Try again */ 286 /* Failed once: Try again */
287 if ((twl4030_i2c_write_u8(module, data, address) >= 0) && 287 if ((twl_i2c_write_u8(module, data, address) >= 0) &&
288 (twl4030_i2c_read_u8(module, &check, address) >= 0) && 288 (twl_i2c_read_u8(module, &check, address) >= 0) &&
289 (check == data)) 289 (check == data))
290 return 0; 290 return 0;
291 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n", 291 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
@@ -303,7 +303,7 @@ static inline int twl4030_usb_write(struct twl4030_usb *twl,
303{ 303{
304 int ret = 0; 304 int ret = 0;
305 305
306 ret = twl4030_i2c_write_u8(TWL4030_MODULE_USB, data, address); 306 ret = twl_i2c_write_u8(TWL4030_MODULE_USB, data, address);
307 if (ret < 0) 307 if (ret < 0)
308 dev_dbg(twl->dev, 308 dev_dbg(twl->dev,
309 "TWL4030:USB:Write[0x%x] Error %d\n", address, ret); 309 "TWL4030:USB:Write[0x%x] Error %d\n", address, ret);
@@ -315,7 +315,7 @@ static inline int twl4030_readb(struct twl4030_usb *twl, u8 module, u8 address)
315 u8 data; 315 u8 data;
316 int ret = 0; 316 int ret = 0;
317 317
318 ret = twl4030_i2c_read_u8(module, &data, address); 318 ret = twl_i2c_read_u8(module, &data, address);
319 if (ret >= 0) 319 if (ret >= 0)
320 ret = data; 320 ret = data;
321 else 321 else
@@ -462,7 +462,7 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on)
462 * SLEEP. We work around this by clearing the bit after usv3v1 462 * SLEEP. We work around this by clearing the bit after usv3v1
463 * is re-activated. This ensures that VUSB3V1 is really active. 463 * is re-activated. This ensures that VUSB3V1 is really active.
464 */ 464 */
465 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, 465 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0,
466 VUSB_DEDICATED2); 466 VUSB_DEDICATED2);
467 regulator_enable(twl->usb1v5); 467 regulator_enable(twl->usb1v5);
468 pwr &= ~PHY_PWR_PHYPWD; 468 pwr &= ~PHY_PWR_PHYPWD;
@@ -505,44 +505,44 @@ static void twl4030_phy_resume(struct twl4030_usb *twl)
505static int twl4030_usb_ldo_init(struct twl4030_usb *twl) 505static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
506{ 506{
507 /* Enable writing to power configuration registers */ 507 /* Enable writing to power configuration registers */
508 twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY); 508 twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY);
509 twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY); 509 twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY);
510 510
511 /* put VUSB3V1 LDO in active state */ 511 /* put VUSB3V1 LDO in active state */
512 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2); 512 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);
513 513
514 /* input to VUSB3V1 LDO is from VBAT, not VBUS */ 514 /* input to VUSB3V1 LDO is from VBAT, not VBUS */
515 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1); 515 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1);
516 516
517 /* Initialize 3.1V regulator */ 517 /* Initialize 3.1V regulator */
518 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_DEV_GRP); 518 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_DEV_GRP);
519 519
520 twl->usb3v1 = regulator_get(twl->dev, "usb3v1"); 520 twl->usb3v1 = regulator_get(twl->dev, "usb3v1");
521 if (IS_ERR(twl->usb3v1)) 521 if (IS_ERR(twl->usb3v1))
522 return -ENODEV; 522 return -ENODEV;
523 523
524 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE); 524 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE);
525 525
526 /* Initialize 1.5V regulator */ 526 /* Initialize 1.5V regulator */
527 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_DEV_GRP); 527 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_DEV_GRP);
528 528
529 twl->usb1v5 = regulator_get(twl->dev, "usb1v5"); 529 twl->usb1v5 = regulator_get(twl->dev, "usb1v5");
530 if (IS_ERR(twl->usb1v5)) 530 if (IS_ERR(twl->usb1v5))
531 goto fail1; 531 goto fail1;
532 532
533 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE); 533 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE);
534 534
535 /* Initialize 1.8V regulator */ 535 /* Initialize 1.8V regulator */
536 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_DEV_GRP); 536 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_DEV_GRP);
537 537
538 twl->usb1v8 = regulator_get(twl->dev, "usb1v8"); 538 twl->usb1v8 = regulator_get(twl->dev, "usb1v8");
539 if (IS_ERR(twl->usb1v8)) 539 if (IS_ERR(twl->usb1v8))
540 goto fail2; 540 goto fail2;
541 541
542 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE); 542 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE);
543 543
544 /* disable access to power configuration registers */ 544 /* disable access to power configuration registers */
545 twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, PROTECT_KEY); 545 twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, PROTECT_KEY);
546 546
547 return 0; 547 return 0;
548 548
diff --git a/drivers/video/omap/lcd_2430sdp.c b/drivers/video/omap/lcd_2430sdp.c
index 3764a36d9142..e3eccc9af78e 100644
--- a/drivers/video/omap/lcd_2430sdp.c
+++ b/drivers/video/omap/lcd_2430sdp.c
@@ -52,7 +52,7 @@ static unsigned enable_gpio;
52#define TWL4030_VPLL2_DEV_GRP 0x33 52#define TWL4030_VPLL2_DEV_GRP 0x33
53#define TWL4030_VPLL2_DEDICATED 0x36 53#define TWL4030_VPLL2_DEDICATED 0x36
54 54
55#define t2_out(c, r, v) twl4030_i2c_write_u8(c, r, v) 55#define t2_out(c, r, v) twl_i2c_write_u8(c, r, v)
56 56
57 57
58static int sdp2430_panel_init(struct lcd_panel *panel, 58static int sdp2430_panel_init(struct lcd_panel *panel,
diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c
index 20968b2aadef..8162a40d1522 100644
--- a/drivers/watchdog/twl4030_wdt.c
+++ b/drivers/watchdog/twl4030_wdt.c
@@ -48,7 +48,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
48 48
49static int twl4030_wdt_write(unsigned char val) 49static int twl4030_wdt_write(unsigned char val)
50{ 50{
51 return twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, val, 51 return twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, val,
52 TWL4030_WATCHDOG_CFG_REG_OFFS); 52 TWL4030_WATCHDOG_CFG_REG_OFFS);
53} 53}
54 54
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index a50bcf8a4048..0f812f5aa723 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -22,8 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#ifndef __TWL4030_H_ 25#ifndef __TWL_H_
26#define __TWL4030_H_ 26#define __TWL_H_
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/input/matrix_keypad.h> 29#include <linux/input/matrix_keypad.h>
@@ -72,20 +72,37 @@
72#define TWL4030_MODULE_RTC 0x16 72#define TWL4030_MODULE_RTC 0x16
73#define TWL4030_MODULE_SECURED_REG 0x17 73#define TWL4030_MODULE_SECURED_REG 0x17
74 74
75#define TWL_MODULE_USB TWL4030_MODULE_USB
76#define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE
77#define TWL_MODULE_PIH TWL4030_MODULE_PIH
78#define TWL_MODULE_MADC TWL4030_MODULE_MADC
79#define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE
80#define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER
81#define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER
82#define TWL_MODULE_RTC TWL4030_MODULE_RTC
83
84#define GPIO_INTR_OFFSET 0
85#define KEYPAD_INTR_OFFSET 1
86#define BCI_INTR_OFFSET 2
87#define MADC_INTR_OFFSET 3
88#define USB_INTR_OFFSET 4
89#define BCI_PRES_INTR_OFFSET 9
90#define USB_PRES_INTR_OFFSET 10
91#define RTC_INTR_OFFSET 11
75/* 92/*
76 * Read and write single 8-bit registers 93 * Read and write single 8-bit registers
77 */ 94 */
78int twl4030_i2c_write_u8(u8 mod_no, u8 val, u8 reg); 95int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
79int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); 96int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
80 97
81/* 98/*
82 * Read and write several 8-bit registers at once. 99 * Read and write several 8-bit registers at once.
83 * 100 *
84 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 101 * IMPORTANT: For twl_i2c_write(), allocate num_bytes + 1
85 * for the value, and populate your data starting at offset 1. 102 * for the value, and populate your data starting at offset 1.
86 */ 103 */
87int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 104int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
88int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 105int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
89 106
90/*----------------------------------------------------------------------*/ 107/*----------------------------------------------------------------------*/
91 108
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index c3a6ceb542cb..2a27f7b56726 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -175,7 +175,7 @@ static int twl4030_write(struct snd_soc_codec *codec,
175{ 175{
176 twl4030_write_reg_cache(codec, reg, value); 176 twl4030_write_reg_cache(codec, reg, value);
177 if (likely(reg < TWL4030_REG_SW_SHADOW)) 177 if (likely(reg < TWL4030_REG_SW_SHADOW))
178 return twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, value, 178 return twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, value,
179 reg); 179 reg);
180 else 180 else
181 return 0; 181 return 0;
@@ -261,7 +261,7 @@ static void twl4030_power_up(struct snd_soc_codec *codec)
261 do { 261 do {
262 /* this takes a little while, so don't slam i2c */ 262 /* this takes a little while, so don't slam i2c */
263 udelay(2000); 263 udelay(2000);
264 twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte, 264 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte,
265 TWL4030_REG_ANAMICL); 265 TWL4030_REG_ANAMICL);
266 } while ((i++ < 100) && 266 } while ((i++ < 100) &&
267 ((byte & TWL4030_CNCL_OFFSET_START) == 267 ((byte & TWL4030_CNCL_OFFSET_START) ==
@@ -542,7 +542,7 @@ static int pin_name##pga_event(struct snd_soc_dapm_widget *w, \
542 break; \ 542 break; \
543 case SND_SOC_DAPM_POST_PMD: \ 543 case SND_SOC_DAPM_POST_PMD: \
544 reg_val = twl4030_read_reg_cache(w->codec, reg); \ 544 reg_val = twl4030_read_reg_cache(w->codec, reg); \
545 twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, \ 545 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, \
546 reg_val & (~mask), \ 546 reg_val & (~mask), \
547 reg); \ 547 reg); \
548 break; \ 548 break; \
@@ -679,7 +679,7 @@ static void headset_ramp(struct snd_soc_codec *codec, int ramp)
679 mdelay((ramp_base[(hs_pop & TWL4030_RAMP_DELAY) >> 2] / 679 mdelay((ramp_base[(hs_pop & TWL4030_RAMP_DELAY) >> 2] /
680 twl4030->sysclk) + 1); 680 twl4030->sysclk) + 1);
681 /* Bypass the reg_cache to mute the headset */ 681 /* Bypass the reg_cache to mute the headset */
682 twl4030_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, 682 twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE,
683 hs_gain & (~0x0f), 683 hs_gain & (~0x0f),
684 TWL4030_REG_HS_GAIN_SET); 684 TWL4030_REG_HS_GAIN_SET);
685 685