diff options
-rw-r--r-- | drivers/mfd/twl4030-power.c | 50 | ||||
-rw-r--r-- | include/linux/i2c/twl.h | 1 |
2 files changed, 51 insertions, 0 deletions
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 5b045ff4a2c2..7efa8789a3a2 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c | |||
@@ -461,6 +461,56 @@ out: | |||
461 | return err; | 461 | return err; |
462 | } | 462 | } |
463 | 463 | ||
464 | int 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 | |||
464 | void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts) | 514 | void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts) |
465 | { | 515 | { |
466 | int err = 0; | 516 | int err = 0; |
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 70d4caf48571..fb6784e86d5f 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h | |||
@@ -550,6 +550,7 @@ struct twl4030_power_data { | |||
550 | }; | 550 | }; |
551 | 551 | ||
552 | extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); | 552 | extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); |
553 | extern int twl4030_remove_script(u8 flags); | ||
553 | 554 | ||
554 | struct twl4030_codec_audio_data { | 555 | struct twl4030_codec_audio_data { |
555 | unsigned int audio_mclk; | 556 | unsigned int audio_mclk; |