From patchwork Tue Feb 28 09:39:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 6969 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8648623E4A for ; Tue, 28 Feb 2012 09:39:28 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4AC98A187E9 for ; Tue, 28 Feb 2012 09:39:28 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so953403iag.11 for ; Tue, 28 Feb 2012 01:39:28 -0800 (PST) Received: from mr.google.com ([10.50.170.41]) by 10.50.170.41 with SMTP id aj9mr21765919igc.0.1330421968147 (num_hops = 1); Tue, 28 Feb 2012 01:39:28 -0800 (PST) Received: by 10.50.170.41 with SMTP id aj9mr17622667igc.0.1330421968090; Tue, 28 Feb 2012 01:39:28 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.11.10 with SMTP id r10csp4275ibr; Tue, 28 Feb 2012 01:39:27 -0800 (PST) Received: by 10.236.153.104 with SMTP id e68mr2322820yhk.74.1330421965910; Tue, 28 Feb 2012 01:39:25 -0800 (PST) Received: from bear.ext.ti.com (bear.ext.ti.com. [192.94.94.41]) by mx.google.com with ESMTPS id y1si19013602yha.86.2012.02.28.01.39.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Feb 2012 01:39:25 -0800 (PST) Received-SPF: pass (google.com: domain of rnayak@ti.com designates 192.94.94.41 as permitted sender) client-ip=192.94.94.41; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rnayak@ti.com designates 192.94.94.41 as permitted sender) smtp.mail=rnayak@ti.com Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q1S9dNZ3023378; Tue, 28 Feb 2012 03:39:23 -0600 Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q1S9dKEK011495; Tue, 28 Feb 2012 15:09:20 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Tue, 28 Feb 2012 15:09:20 +0530 Received: from ula0131687.apr.dhcp.ti.com (ula0131687-172024136088.apr.dhcp.ti.com [172.24.136.88]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id q1S9dEGX004711; Tue, 28 Feb 2012 15:09:19 +0530 (IST) From: Rajendra Nayak To: , CC: , , , , , , , Tero Kristo , Rajendra Nayak , Samuel Ortiz , Kevin Hilman Subject: [PATCH 1/4] regulator: twl6030: add support for vdd1, vdd2 and vdd3 regulators Date: Tue, 28 Feb 2012 15:09:10 +0530 Message-ID: <1330421953-29517-2-git-send-email-rnayak@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1330421953-29517-1-git-send-email-rnayak@ti.com> References: <1330421953-29517-1-git-send-email-rnayak@ti.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkmxv37vYeOeQnZTWREkmpL1+CuL92fm5heH17cfr5HlzHAhiWZu06f7S0TGfx+hICSyv+i From: Tero Kristo vdd1 and vdd2 are now common regulators for twl4030 and twl6030. Also added vdd3 as a new regulator for twl6030. twl6030 vdd1...vdd3 smps regulator voltages can only be controlled through the smartreflex voltage channel, thus the support for the voltage_get and set is minimal and requires external controller. Signed-off-by: Tero Kristo Signed-off-by: Rajendra Nayak Cc: Mark Brown Cc: Liam Girdwood Cc: Samuel Ortiz Cc: Kevin Hilman Acked-by: Samuel Ortiz --- drivers/mfd/twl-core.c | 15 ++++++++++++++ drivers/regulator/twl-regulator.c | 39 +++++++++++++++++++++++++++++++++++++ include/linux/i2c/twl.h | 5 ++- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 6c13d9f..e1d3a64 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -951,6 +951,21 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) /* twl6030 regulators */ if (twl_has_regulator() && twl_class_is_6030() && !(features & TWL6025_SUBCLASS)) { + child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1, + features); + if (IS_ERR(child)) + return PTR_ERR(child); + + child = add_regulator(TWL6030_REG_VDD2, pdata->vdd2, + features); + if (IS_ERR(child)) + return PTR_ERR(child); + + child = add_regulator(TWL6030_REG_VDD3, pdata->vdd3, + features); + if (IS_ERR(child)) + return PTR_ERR(child); + child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc, features); if (IS_ERR(child)) diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index 7ff8bb2..8611282 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c @@ -561,6 +561,32 @@ static struct regulator_ops twl4030smps_ops = { .get_voltage = twl4030smps_get_voltage, }; +static int twl6030coresmps_set_voltage(struct regulator_dev *rdev, int min_uV, + int max_uV, unsigned *selector) +{ + struct twlreg_info *info = rdev_get_drvdata(rdev); + + if (info->set_voltage) + return info->set_voltage(info->data, min_uV); + + return -ENODEV; +} + +static int twl6030coresmps_get_voltage(struct regulator_dev *rdev) +{ + struct twlreg_info *info = rdev_get_drvdata(rdev); + + if (info->get_voltage) + return info->get_voltage(info->data); + + return -ENODEV; +} + +static struct regulator_ops twl6030coresmps_ops = { + .set_voltage = twl6030coresmps_set_voltage, + .get_voltage = twl6030coresmps_get_voltage, +}; + static int twl6030ldo_list_voltage(struct regulator_dev *rdev, unsigned index) { struct twlreg_info *info = rdev_get_drvdata(rdev); @@ -926,6 +952,16 @@ static struct regulator_ops twlsmps_ops = { }, \ } +#define TWL6030_ADJUSTABLE_SMPS(label) { \ + .desc = { \ + .name = #label, \ + .id = TWL6030_REG_##label, \ + .ops = &twl6030coresmps_ops, \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + }, \ + } + #define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \ .base = offset, \ .min_mV = min_mVolts, \ @@ -1027,6 +1063,9 @@ static struct twlreg_info twl_regs[] = { /* 6030 REG with base as PMC Slave Misc : 0x0030 */ /* Turnon-delay and remap configuration values for 6030 are not verified since the specification is not public */ + TWL6030_ADJUSTABLE_SMPS(VDD1), + TWL6030_ADJUSTABLE_SMPS(VDD2), + TWL6030_ADJUSTABLE_SMPS(VDD3), TWL6030_ADJUSTABLE_LDO(VAUX1_6030, 0x54, 1000, 3300), TWL6030_ADJUSTABLE_LDO(VAUX2_6030, 0x58, 1000, 3300), TWL6030_ADJUSTABLE_LDO(VAUX3_6030, 0x5c, 1000, 3300), diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 08a82d3..f66c031 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -712,6 +712,9 @@ struct twl4030_platform_data { struct regulator_init_data *vaux1; struct regulator_init_data *vaux2; struct regulator_init_data *vaux3; + struct regulator_init_data *vdd1; + struct regulator_init_data *vdd2; + struct regulator_init_data *vdd3; /* TWL4030 LDO regulators */ struct regulator_init_data *vpll1; struct regulator_init_data *vpll2; @@ -720,8 +723,6 @@ struct twl4030_platform_data { struct regulator_init_data *vsim; struct regulator_init_data *vaux4; struct regulator_init_data *vio; - struct regulator_init_data *vdd1; - struct regulator_init_data *vdd2; struct regulator_init_data *vintana1; struct regulator_init_data *vintana2; struct regulator_init_data *vintdig;