From: Mike Turquette <mturquette@gmail.com>
To: linux-omap@vger.kernel.org
Cc: Mike Turquette <mturquette@ti.com>
Subject: [PATCH 1/2] MFD: TWL4030: introduce remove_script function
Date: Wed, 3 Feb 2010 13:43:26 -0600 [thread overview]
Message-ID: <1265226207-22971-2-git-send-email-mturquette@ti.com> (raw)
In-Reply-To: <1265226207-22971-1-git-send-email-mturquette@ti.com>
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.
Signed-off-by: Mike Turquette <mturquette@ti.com>
---
drivers/mfd/twl4030-power.c | 50 +++++++++++++++++++++++++++++++++++++++++++
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 af6f60c..cf1042e 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -477,6 +477,56 @@ out:
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)
{
int err = 0;
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index f9202ad..fbe8554 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -534,6 +534,7 @@ struct twl4030_power_data {
};
extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
+extern int twl4030_remove_script(u8 flags);
struct twl4030_codec_audio_data {
unsigned int audio_mclk;
--
1.6.3.2
next prev parent reply other threads:[~2010-02-03 19:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 19:43 [RFC] OMAP3: PM: disable twl4030 sleep sequence before reboot Mike Turquette
2010-02-03 19:43 ` Mike Turquette [this message]
2010-02-03 19:43 ` [PATCH 2/2] OMAP3: PM: remove TWL4030 A2S script " Mike Turquette
2010-02-09 22:35 ` Tony Lindgren
2010-07-28 9:41 ` [PATCH] twl4030 reboot workaround Mikko Rapeli
2010-07-28 10:07 ` Gopinath, Thara
2010-07-29 6:07 ` Mikko Rapeli
2010-07-28 10:18 ` Peter 'p2' De Schrijver
2010-07-29 6:06 ` Mikko Rapeli
2010-07-28 15:47 ` Mike Turquette
2010-07-29 6:16 ` Mikko Rapeli
2010-07-29 6:41 ` [PATCH v2] " Mikko Rapeli
2010-07-29 19:10 ` Mike Rapoport
2010-07-30 5:48 ` Mikko Rapeli
2010-07-30 6:35 ` Gopinath, Thara
2010-07-30 18:39 ` Mike Turquette
2010-07-30 19:11 ` Gopinath, Thara
2010-08-01 6:31 ` Mike Rapoport
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1265226207-22971-2-git-send-email-mturquette@ti.com \
--to=mturquette@gmail.com \
--cc=linux-omap@vger.kernel.org \
--cc=mturquette@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).