From patchwork Wed Feb 3 19:43:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 76789 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o13JiHit016827 for ; Wed, 3 Feb 2010 19:44:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932622Ab0BCTn4 (ORCPT ); Wed, 3 Feb 2010 14:43:56 -0500 Received: from mail-gx0-f224.google.com ([209.85.217.224]:54384 "EHLO mail-gx0-f224.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932473Ab0BCTny (ORCPT ); Wed, 3 Feb 2010 14:43:54 -0500 Received: by gxk24 with SMTP id 24so2170974gxk.1 for ; Wed, 03 Feb 2010 11:43:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=iTK6c7yTZHAj44Fuy6HMvnXriGgMXcfkw8BMvTqGO8o=; b=BEolY4PmabgVSHZ/qkC5wcdK/XoAkHQCFKi+EHS9k3wF/XTxvKcAxrKP/C2c3EtaAR rQ3GsSoLKf/wyrIqeA3naNrb/8ivIxZ/CtnzZ3X+ttNEW3/q2foU/K0w7chVV8ewwMv5 bPQnbtafN3uR/XNEj58yKflqCTUU36aANnFHg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=JNSTE9DLBIMUJmV/vFaZboGxhQ7s6cueJ2WiVvL8hkOcOH74ZQFMzJJZK6r6cQMFa0 T/j5tYoR1v1hykpyfqSbFx/gspQPtW2WMCRnzazhO8fHSPGnJqpGvS12eAJulw/osjkB mg2c1Inq/bGgfh8zXjDCm1lg+YSFv9HK8MiJs= Received: by 10.90.18.27 with SMTP id 27mr384502agr.20.1265226233725; Wed, 03 Feb 2010 11:43:53 -0800 (PST) Received: from localhost.localdomain (adsl-99-57-147-167.dsl.rcsntx.sbcglobal.net [99.57.147.167]) by mx.google.com with ESMTPS id 8sm2643079ywg.19.2010.02.03.11.43.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Feb 2010 11:43:52 -0800 (PST) From: Mike Turquette To: linux-omap@vger.kernel.org Cc: Mike Turquette Subject: [PATCH 1/2] MFD: TWL4030: introduce remove_script function Date: Wed, 3 Feb 2010 13:43:26 -0600 Message-Id: <1265226207-22971-2-git-send-email-mturquette@ti.com> X-Mailer: git-send-email 1.6.3.2 In-Reply-To: <1265226207-22971-1-git-send-email-mturquette@ti.com> References: <1265226207-22971-1-git-send-email-mturquette@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Feb 2010 19:44:18 +0000 (UTC) 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;