From patchwork Wed Feb 16 11:45:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 566621 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1GBixwJ019501 for ; Wed, 16 Feb 2011 11:45:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758809Ab1BPLo6 (ORCPT ); Wed, 16 Feb 2011 06:44:58 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:63543 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755241Ab1BPLo5 (ORCPT ); Wed, 16 Feb 2011 06:44:57 -0500 Received: by ewy5 with SMTP id 5so344727ewy.19 for ; Wed, 16 Feb 2011 03:44:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding; bh=dkmTP76CtTNIVc/onWUlF6XLN03QgbeuhYPnVHt0KgU=; b=ZsufwxXEU5fYowgtJFMswNnsH29xrdjWh6hd/M19cTCeHWsUMkw7DTRa4CHPU4BFX2 WySm+eezTD56LT+UFM7JVTpIZV9y4QyipxRb7lo6W2kAqsK5/0x+HfWGUzmv4iEBhAxw ziOrAAdyssxzac+CiFS000M9/VTgJLaqHOyoo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=bF7fw6ZzW87k8zkBthvLev5ZLGe7t7jqRPODrgB1VmJbWW/5nb9aaBFCiF05aP0mM1 p1qVimRCY2MYjwgBFluSMgJHiBkCo2AGkpsJAlkbVT5kXTjITYl5d02gA12afC9ATNqJ gvteqbntWzrEa68FNWlDWFo6e4lGWfRzHTcsc= Received: by 10.213.32.208 with SMTP id e16mr522546ebd.35.1297856696384; Wed, 16 Feb 2011 03:44:56 -0800 (PST) Received: from mylly64 ([194.136.136.46]) by mx.google.com with ESMTPS id q52sm4550051eei.21.2011.02.16.03.44.54 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Feb 2011 03:44:54 -0800 (PST) Date: Wed, 16 Feb 2011 13:45:23 +0200 From: Jarkko Nikula To: "Gulati, Shweta" Cc: linux-omap@vger.kernel.org, Thara Gopinath , Nishanth Menon , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH V4] OMAP3: PM: Set/clear T2 bit for Smartreflex on TWL Message-Id: <20110216134523.ba5d3917.jhnikula@gmail.com> In-Reply-To: References: <1297756738-2696-1-git-send-email-shweta.gulati@ti.com> <20110215171652.601c9c68.jhnikula@gmail.com> <20110215172931.3a6e45a8.jhnikula@gmail.com> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 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.6 (demeter1.kernel.org [140.211.167.41]); Wed, 16 Feb 2011 11:45:00 +0000 (UTC) diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 16422de0..e767b0f 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c @@ -92,6 +92,9 @@ static u8 twl4030_start_script_address = 0x2b; #define OFF_STATE_SHIFT 4 #define OFF_STATE_MASK (0xf << OFF_STATE_SHIFT) +#define TWL4030_DCDC_GLOBAL_CFG PHY_TO_OFF_PM_RECEIVER(0x61) +#define SMARTREFLEX_ENABLE BIT(3) + static u8 res_config_addrs[] = { [RES_VAUX1] = 0x17, [RES_VAUX2] = 0x1b, @@ -510,6 +513,22 @@ int twl4030_remove_script(u8 flags) return err; } +int __init twl4030_sr_enable(void) +{ + u8 temp; + int ret; + + ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &temp, + TWL4030_DCDC_GLOBAL_CFG); + if (ret) + return ret; + + temp |= SMARTREFLEX_ENABLE; + + return twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, temp, + TWL4030_DCDC_GLOBAL_CFG); +} + void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts) { int err = 0; @@ -549,8 +568,15 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts) err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, TWL4030_PM_MASTER_PROTECT_KEY); - if (err) + if (err) { pr_err("TWL4030 Unable to relock registers\n"); + return; + } + + if (twl4030_scripts->sr_enable) + err = twl4030_sr_enable(); + if (err) + pr_err("TWL4030 Unable to set smartreflex. %d\n", err); return; unlock: diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 61b9609..1f64e3e 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -630,6 +630,7 @@ struct twl4030_power_data { struct twl4030_script **scripts; unsigned num; struct twl4030_resconfig *resource_config; + bool sr_enable; /* Smartreflex enable state */ #define TWL4030_RESCONFIG_UNDEF ((u8)-1) };