aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/twl4030-power.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-03-08 15:21:04 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-03-08 15:21:04 -0500
commit988addf82e4c03739375279de73929580a2d4a6a (patch)
tree989ae1cd4e264bbad80c65f04480486246e7b9f3 /drivers/mfd/twl4030-power.c
parent004c1c7096659d352b83047a7593e91d8a30e3c5 (diff)
parent25cf84cf377c0aae5dbcf937ea89bc7893db5176 (diff)
Merge branch 'origin' into devel-stable
Conflicts: arch/arm/mach-mx2/devices.c arch/arm/mach-mx2/devices.h sound/soc/pxa/pxa-ssp.c
Diffstat (limited to 'drivers/mfd/twl4030-power.c')
-rw-r--r--drivers/mfd/twl4030-power.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 0815292fdaf..7efa8789a3a 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -405,7 +405,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig)
405 405
406 if (rconfig->remap_sleep != TWL4030_RESCONFIG_UNDEF) { 406 if (rconfig->remap_sleep != TWL4030_RESCONFIG_UNDEF) {
407 remap &= ~SLEEP_STATE_MASK; 407 remap &= ~SLEEP_STATE_MASK;
408 remap |= rconfig->remap_off << SLEEP_STATE_SHIFT; 408 remap |= rconfig->remap_sleep << SLEEP_STATE_SHIFT;
409 } 409 }
410 410
411 err = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 411 err = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
@@ -461,6 +461,56 @@ out:
461 return err; 461 return err;
462} 462}
463 463
464int twl4030_remove_script(u8 flags)
465{
466 int err = 0;
467
468 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_1,
469 R_PROTECT_KEY);
470 if (err) {
471 pr_err("twl4030: unable to unlock PROTECT_KEY\n");
472 return err;
473 }
474
475 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_2,
476 R_PROTECT_KEY);
477 if (err) {
478 pr_err("twl4030: unable to unlock PROTECT_KEY\n");
479 return err;
480 }
481
482 if (flags & TWL4030_WRST_SCRIPT) {
483 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
484 R_SEQ_ADD_WARM);
485 if (err)
486 return err;
487 }
488 if (flags & TWL4030_WAKEUP12_SCRIPT) {
489 if (err)
490 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
491 R_SEQ_ADD_S2A12);
492 return err;
493 }
494 if (flags & TWL4030_WAKEUP3_SCRIPT) {
495 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
496 R_SEQ_ADD_S2A3);
497 if (err)
498 return err;
499 }
500 if (flags & TWL4030_SLEEP_SCRIPT) {
501 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
502 R_SEQ_ADD_A2S);
503 if (err)
504 return err;
505 }
506
507 err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
508 if (err)
509 pr_err("TWL4030 Unable to relock registers\n");
510
511 return err;
512}
513
464void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts) 514void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
465{ 515{
466 int err = 0; 516 int err = 0;