aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/twl4030-power.c
diff options
context:
space:
mode:
authorBalaji T K <balajitk@ti.com>2009-12-13 15:23:33 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2009-12-13 15:23:33 -0500
commitfc7b92fca4e546184557f1c53f84ad57c66b7695 (patch)
treef15b37df7d34f525d877d33186b840947aa65b4d /drivers/mfd/twl4030-power.c
parentb07682b6056eb6701f8cb86aa5800e6f2ea7919b (diff)
mfd: Rename all twl4030_i2c*
This patch renames function names like twl4030_i2c_write_u8, twl4030_i2c_read_u8 to twl_i2c_write_u8, twl_i2c_read_u8 and also common variable in twl-core.c Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Balaji T K <balajitk@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/twl4030-power.c')
-rw-r--r--drivers/mfd/twl4030-power.c68
1 files changed, 34 insertions, 34 deletions
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;