mfd: Introduce remove_script function for twl4030
New function twl4030_remove_script(u8 flags) takes a script type as defined in twl.h and prevents any script already loaded in that position from running. This is accomplished by programming SEQ_ADD_* to 0x3f, the END_OF_SCRIPT value, where SEQ_ADD_* is determined by flags. (Future) users of this function include OMAP board files for machines facing a race condition between sleep and warm reset. Signed-off-by: Mike Turquette <mturquette@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
3d8ca8c0b9
commit
11a441ce82
2 changed files with 51 additions and 0 deletions
|
@ -461,6 +461,56 @@ static int __init load_twl4030_script(struct twl4030_script *tscript,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int twl4030_remove_script(u8 flags)
|
||||||
|
{
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_1,
|
||||||
|
R_PROTECT_KEY);
|
||||||
|
if (err) {
|
||||||
|
pr_err("twl4030: unable to unlock PROTECT_KEY\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_2,
|
||||||
|
R_PROTECT_KEY);
|
||||||
|
if (err) {
|
||||||
|
pr_err("twl4030: unable to unlock PROTECT_KEY\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & TWL4030_WRST_SCRIPT) {
|
||||||
|
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
|
||||||
|
R_SEQ_ADD_WARM);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
if (flags & TWL4030_WAKEUP12_SCRIPT) {
|
||||||
|
if (err)
|
||||||
|
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
|
||||||
|
R_SEQ_ADD_S2A12);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
if (flags & TWL4030_WAKEUP3_SCRIPT) {
|
||||||
|
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
|
||||||
|
R_SEQ_ADD_S2A3);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
if (flags & TWL4030_SLEEP_SCRIPT) {
|
||||||
|
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, END_OF_SCRIPT,
|
||||||
|
R_SEQ_ADD_A2S);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
|
||||||
|
if (err)
|
||||||
|
pr_err("TWL4030 Unable to relock registers\n");
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
|
void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
|
@ -550,6 +550,7 @@ struct twl4030_power_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
|
extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
|
||||||
|
extern int twl4030_remove_script(u8 flags);
|
||||||
|
|
||||||
struct twl4030_codec_audio_data {
|
struct twl4030_codec_audio_data {
|
||||||
unsigned int audio_mclk;
|
unsigned int audio_mclk;
|
||||||
|
|
Loading…
Reference in a new issue