From patchwork Mon Feb 4 11:53:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14470 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 CC92723F96 for ; Mon, 4 Feb 2013 11:56:28 +0000 (UTC) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by fiordland.canonical.com (Postfix) with ESMTP id 6AF96A1877A for ; Mon, 4 Feb 2013 11:56:28 +0000 (UTC) Received: by mail-ve0-f178.google.com with SMTP id db10so4557466veb.23 for ; Mon, 04 Feb 2013 03:56:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=9mHaHW6d6MDDgKhuxk/l+/dHjpqk2l/L610gfNFAtik=; b=LrM1gUIUu4uqLVKYk/NlfdRISurDKtz9QGSJqpaRCtfJvv3jQiSf97BYcbHgHPZLq5 A/GalRT3fLhCirfMAg/mFqh788yu3YIXf+ndHTq24pA1t1jZ/vAoK0klNUd1ktLg+Hnq rx4qsA8fLQz9mCVVCJxsoDF+XzFsNzxTexrvDutIhOTNybhwqFJHtjzzJvvrl6pjk5YC /zt7lktVEKqGKj+O0Di+A3Wdtxj60NQpBfkC1YqBBir21hdc0OMN8nPhEqqiC1KOs9+2 CPZeg5X47TMZIhJzGMTIOETY9bFE6OVohzmCjmomjtfh0bTDjXioEbJXbihbvCJeY6Q9 8PLw== X-Received: by 10.52.24.98 with SMTP id t2mr15769734vdf.69.1359978987855; Mon, 04 Feb 2013 03:56:27 -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.58.252.8 with SMTP id zo8csp83051vec; Mon, 4 Feb 2013 03:56:27 -0800 (PST) X-Received: by 10.194.156.170 with SMTP id wf10mr16462968wjb.25.1359978986746; Mon, 04 Feb 2013 03:56:26 -0800 (PST) Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by mx.google.com with ESMTPS id y18si5707480wjr.254.2013.02.04.03.56.26 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Feb 2013 03:56:26 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.51 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.51; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.51 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wg0-f51.google.com with SMTP id 8so4547076wgl.6 for ; Mon, 04 Feb 2013 03:56:26 -0800 (PST) X-Received: by 10.180.92.129 with SMTP id cm1mr9933550wib.10.1359978986328; Mon, 04 Feb 2013 03:56:26 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id j9sm12937128wia.5.2013.02.04.03.56.24 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Feb 2013 03:56:25 -0800 (PST) From: Lee Jones To: linux-kernel@vger.kernel.org, broonie@opensource.wolfsonmicro.com Cc: Lee Jones , Bengt Jonsson Subject: [PATCH 21/73] regulator: ab8500-ext: Add VextSupply2 regulator Date: Mon, 4 Feb 2013 11:53:36 +0000 Message-Id: <1359978868-28736-22-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1359978868-28736-1-git-send-email-lee.jones@linaro.org> References: <1359978868-28736-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQlqOBJ5+CeTmFhUS4YtlTPMaxdG2910OnKeJbieuGznNfmj6RCH/ROQw+x6po0ftIb9sa7V Remove suspend-force settings of VextSupply2 and add VextSupply2 in the external regulator driver. Signed-off-by: Bengt Jonsson Signed-off-by: Lee Jones --- arch/arm/mach-ux500/board-mop500-regulators.c | 63 ++++++++++++++++++++++++- drivers/regulator/ab8500-ext.c | 18 +++++++ include/linux/regulator/ab8500.h | 1 + 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c index 38b70d7..5fd8a59 100644 --- a/arch/arm/mach-ux500/board-mop500-regulators.c +++ b/arch/arm/mach-ux500/board-mop500-regulators.c @@ -280,12 +280,12 @@ static struct ab8500_regulator_reg_init ab8500_reg_init[] = { INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00), /* * VextSupply1Regu = force LP - * VextSupply2Regu = HW control + * VextSupply2Regu = force OFF * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP) * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 */ - INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x1b), + INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13), /* * Vaux1Regu = force HP * Vaux2Regu = force off @@ -453,6 +453,11 @@ static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = { REGULATOR_SUPPLY("vinvsim", "sim-detect.0"), }; +/* extended configuration for VextSupply2, only used for HREFP_V20 boards */ +static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = { + .hwreq = true, +}; + /* * AB8500 external regulators */ @@ -468,6 +473,14 @@ static struct regulator_init_data ab8500_ext_regulators[] = { .always_on = 1, }, }, + /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */ + [AB8500_EXT_SUPPLY2] = { + .constraints = { + .name = "ab8500-ext-supply2", + .min_uV = 1360000, + .max_uV = 1360000, + }, + }, /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */ [AB8500_EXT_SUPPLY3] = { .constraints = { @@ -492,6 +505,24 @@ struct ab8500_regulator_platform_data ab8500_regulator_plat_data = { .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators), }; +static void ab8500_modify_reg_init(int id, u8 mask, u8 value) +{ + int i; + + for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) { + if (ab8500_reg_init[i].id == id) { + u8 initval = ab8500_reg_init[i].value; + initval = (initval & ~mask) | (value & mask); + ab8500_reg_init[i].value = initval; + + BUG_ON(mask & ~ab8500_reg_init[i].mask); + return; + } + } + + BUG_ON(1); +} + void mop500_regulator_init(void) { struct regulator_init_data *regulator; @@ -506,4 +537,32 @@ void mop500_regulator_init(void) regulator->constraints.state_mem.disabled = 1; regulator->constraints.state_standby.disabled = 1; } + + /* + * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for + * all HREFP_V20 boards) + */ + if (cpu_is_u8500v20()) { + /* VextSupply2RequestCtrl = HP/OFF depending on VxRequest */ + ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01); + + /* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */ + ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2, + 0x20, 0x20); + + /* VextSupply2 = force HP at initialization */ + ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04); + + /* enable VextSupply2 during platform active */ + regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; + regulator->constraints.always_on = 1; + + /* disable VextSupply2 in suspend */ + regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; + regulator->constraints.state_mem.disabled = 1; + regulator->constraints.state_standby.disabled = 1; + + /* enable VextSupply2 HW control (used in suspend) */ + regulator->driver_data = (void *)&ab8500_ext_supply2; + } } diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c index a8fe1cb..3af40fd 100644 --- a/drivers/regulator/ab8500-ext.c +++ b/drivers/regulator/ab8500-ext.c @@ -318,6 +318,24 @@ static struct ab8500_ext_regulator_info .update_val_lp = 0x03, .update_val_hw = 0x02, }, + [AB8500_EXT_SUPPLY2] = { + .desc = { + .name = "VEXTSUPPLY2", + .ops = &ab8500_ext_regulator_ops, + .type = REGULATOR_VOLTAGE, + .id = AB8500_EXT_SUPPLY2, + .owner = THIS_MODULE, + .n_voltages = 1, + }, + .fixed_uV = 1360000, + .update_bank = 0x04, + .update_reg = 0x08, + .update_mask = 0x0c, + .update_val = 0x04, + .update_val_hp = 0x04, + .update_val_lp = 0x0c, + .update_val_hw = 0x08, + }, [AB8500_EXT_SUPPLY3] = { .desc = { .name = "VEXTSUPPLY3", diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h index 33308ff..0a58db2 100644 --- a/include/linux/regulator/ab8500.h +++ b/include/linux/regulator/ab8500.h @@ -161,6 +161,7 @@ struct ab8500_ext_regulator_cfg { enum ab8500_ext_regulator_id { AB8500_EXT_SUPPLY1, + AB8500_EXT_SUPPLY2, AB8500_EXT_SUPPLY3, AB8500_NUM_EXT_REGULATORS, };