From patchwork Wed Oct 27 16:10:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 286042 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 o9RGBDuB012502 for ; Wed, 27 Oct 2010 16:11:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761148Ab0J0QLK (ORCPT ); Wed, 27 Oct 2010 12:11:10 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:38076 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759864Ab0J0QLJ (ORCPT ); Wed, 27 Oct 2010 12:11:09 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o9RGB4JI001587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Oct 2010 11:11:06 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o9RGAwKN009583; Wed, 27 Oct 2010 21:41:01 +0530 (IST) From: Thara Gopinath To: linux-omap@vger.kernel.org Cc: paul@pwsan.com, khilman@deeprootsystems.com, b-cousson@ti.com, vishwanath.bs@ti.com, sawant@ti.com, Thara Gopinath Subject: [PATCH v4 6/9] OMAP3: PM: Adding T2 enabling of smartreflex support Date: Wed, 27 Oct 2010 21:40:53 +0530 Message-Id: <1288195856-11011-7-git-send-email-thara@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1288195856-11011-1-git-send-email-thara@ti.com> References: <1288195856-11011-1-git-send-email-thara@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 (demeter1.kernel.org [140.211.167.41]); Wed, 27 Oct 2010 16:11:14 +0000 (UTC) diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 720e099..677b903 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -1009,8 +1009,11 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) clocks_init(&client->dev, pdata->clock); /* load power event scripts */ - if (twl_has_power() && pdata->power) - twl4030_power_init(pdata->power); + if (twl_has_power()) { + twl4030_power_sr_init(); + if (pdata->power) + twl4030_power_init(pdata->power); + } /* Maybe init the T2 Interrupt subsystem */ if (client->irq diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index 7efa878..0e897a7 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c @@ -31,6 +31,8 @@ #include +#include + static u8 twl4030_start_script_address = 0x2b; #define PWR_P1_SW_EVENTS 0x10 @@ -63,6 +65,10 @@ static u8 twl4030_start_script_address = 0x2b; #define R_MEMORY_ADDRESS PHY_TO_OFF_PM_MASTER(0x59) #define R_MEMORY_DATA PHY_TO_OFF_PM_MASTER(0x5a) +/* Smartreflex Control */ +#define R_DCDC_GLOBAL_CFG PHY_TO_OFF_PM_RECEIVER(0x61) +#define CFG_ENABLE_SRFLX 0x08 + #define R_PROTECT_KEY 0x0E #define R_KEY_1 0xC0 #define R_KEY_2 0x0C @@ -511,6 +517,29 @@ int twl4030_remove_script(u8 flags) return err; } +/* API to enable smrtreflex on Triton side */ +static void twl4030_smartreflex_init(void) +{ + int ret = 0; + u8 read_val; + + ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &read_val, + R_DCDC_GLOBAL_CFG); + read_val |= CFG_ENABLE_SRFLX; + ret |= twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, read_val, + R_DCDC_GLOBAL_CFG); +} + +struct omap_sr_pmic_data twl4030_sr_data = { + .sr_pmic_init = twl4030_smartreflex_init, +}; + +void __init twl4030_power_sr_init() +{ + /* Register the SR init API with the Smartreflex driver */ + omap_sr_register_pmic(&twl4030_sr_data); +} + 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 6de90bf..b02011e 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -550,6 +550,7 @@ struct twl4030_power_data { }; extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); +extern void twl4030_power_sr_init(void); extern int twl4030_remove_script(u8 flags); struct twl4030_codec_audio_data {