From patchwork Thu Mar 21 15:59:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 2315011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 3F807400E6 for ; Thu, 21 Mar 2013 16:29:22 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIiJT-0006yZ-Nd; Thu, 21 Mar 2013 16:26:00 +0000 Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIhvS-0001NN-8M for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2013 16:01:17 +0000 Received: by mail-we0-f175.google.com with SMTP id t11so343630wey.34 for ; Thu, 21 Mar 2013 09:01:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=B1+qIzsfIzdScPme4r7qN5UtwVG13c/Ci/0lITaC7Po=; b=NWR86oKT50p0WAC0XR0YvNzL/xhFMgwkWR9kbUJaDjUUGmTffI0mKoRSN/RS1+kPIi wu7bjj0lVeX16pYw0mDdolddZTRKwd8T9b9aLjQlGql+yhxlByS3FYrcvWGvhIuuaINj glvRX/UNxIcCNH8vtEDlVhJOGBzrQI383lKK8sa91PZ5Huez0RUMtWVbj21fjkXYTX+k 0kciQtuxqmY5PXKhaKQKdGUhK0ZzTxQ/23INX+bJ49Ax65Y8PWg3pSbj/GE+YP6sVIlZ R+3yzlkEmKETAolakHKz3pniAxkylIf2IdaOl9HqN8N4Ld1b5m5fw9KdBHyL/0kMku5A leoA== X-Received: by 10.194.119.68 with SMTP id ks4mr18321469wjb.3.1363881666602; Thu, 21 Mar 2013 09:01:06 -0700 (PDT) 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 h10sm6110847wic.8.2013.03.21.09.01.04 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Mar 2013 09:01:05 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, broonie@opensource.wolfsonmicro.com Subject: [PATCH 32/46] regulator: ab8500: Add voltage selection for AUDIO and ANA on AB8505 Date: Thu, 21 Mar 2013 15:59:29 +0000 Message-Id: <1363881583-15234-33-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1363881583-15234-1-git-send-email-lee.jones@linaro.org> References: <1363881583-15234-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmSBtexv6fubkEH3mNJ1zM3baCYKd3wU0whNxWwlFLGHCQCnRbcqvxhGrZJcHmOgy45CTTJ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130321_120111_075072_D384B554 X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Lee Jones , linus.walleij@stericsson.com, arnd@arndb.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Signed-off-by: Lee Jones --- drivers/regulator/ab8500.c | 55 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index c1e1cf9..84393a6 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -162,6 +162,28 @@ static const unsigned int fixed_3300000_voltage[] = { 3300000, }; +static const unsigned int ldo_vana_voltages[] = { + 1050000, + 1075000, + 1100000, + 1125000, + 1150000, + 1175000, + 1200000, + 1225000, +}; + +static const unsigned int ldo_vaudio_voltages[] = { + 2000000, + 2100000, + 2200000, + 2300000, + 2400000, + 2500000, + 2600000, + 2600000, /* Duplicated in Vaudio and IsoUicc Control register. */ +}; + static int ab8500_regulator_enable(struct regulator_dev *rdev) { int ret; @@ -413,6 +435,16 @@ static struct regulator_ops ab8500_regulator_volt_mode_ops = { .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel, }; +static struct regulator_ops ab8500_regulator_volt_ops = { + .enable = ab8500_regulator_enable, + .disable = ab8500_regulator_disable, + .is_enabled = ab8500_regulator_is_enabled, + .get_voltage_sel = ab8500_regulator_get_voltage_sel, + .set_voltage_sel = ab8500_regulator_set_voltage_sel, + .list_voltage = regulator_list_voltage_table, + .set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel, +}; + static struct regulator_ops ab8500_regulator_mode_ops = { .enable = ab8500_regulator_enable, .disable = ab8500_regulator_disable, @@ -841,17 +873,23 @@ static struct ab8500_regulator_info [AB8505_LDO_AUDIO] = { .desc = { .name = "LDO-AUDIO", - .ops = &ab8500_regulator_ops, + .ops = &ab8500_regulator_volt_ops, .type = REGULATOR_VOLTAGE, .id = AB8505_LDO_AUDIO, .owner = THIS_MODULE, - .n_voltages = 1, - .volt_table = fixed_2000000_voltage, + .n_voltages = ARRAY_SIZE(ldo_vaudio_voltages), + .volt_table = ldo_vaudio_voltages, }, .update_bank = 0x03, .update_reg = 0x83, .update_mask = 0x02, .update_val = 0x02, + .voltage_bank = 0x01, + .voltage_reg = 0x57, + .voltage_mask = 0x7, + .voltage_shift = 4, + .voltages = ldo_vaudio_voltages, + .voltages_len = ARRAY_SIZE(ldo_vaudio_voltages), }, [AB8505_LDO_ANAMIC1] = { .desc = { @@ -904,12 +942,12 @@ static struct ab8500_regulator_info [AB8505_LDO_ANA] = { .desc = { .name = "LDO-ANA", - .ops = &ab8500_regulator_mode_ops, + .ops = &ab8500_regulator_volt_mode_ops, .type = REGULATOR_VOLTAGE, .id = AB8505_LDO_ANA, .owner = THIS_MODULE, - .n_voltages = 1, - .volt_table = fixed_1200000_voltage, + .n_voltages = ARRAY_SIZE(ldo_vana_voltages), + .volt_table = ldo_vana_voltages, }, .load_lp_uA = 1000, .update_bank = 0x04, @@ -918,6 +956,11 @@ static struct ab8500_regulator_info .update_val = 0x04, .update_val_idle = 0x0c, .update_val_normal = 0x04, + .voltage_bank = 0x04, + .voltage_reg = 0x29, + .voltage_mask = 0x7, + .voltages = ldo_vana_voltages, + .voltages_len = ARRAY_SIZE(ldo_vana_voltages), }, };