From patchwork Wed Feb 6 10:53:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14616 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 C7AED2423C for ; Wed, 6 Feb 2013 10:56:02 +0000 (UTC) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by fiordland.canonical.com (Postfix) with ESMTP id 76E73A187D8 for ; Wed, 6 Feb 2013 10:56:02 +0000 (UTC) Received: by mail-vb0-f49.google.com with SMTP id s24so736903vbi.36 for ; Wed, 06 Feb 2013 02:56:02 -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=r0FaSuiYpm08xChn9C9hREEYXqqvNhXgrE4sO2pMjN4=; b=GvGlcU1vcJ4+ccxMEItC5aMsO9aJk39zyrsfItSHEYvBEmvMJW901c4QYxLeDlLWBB 6NXztRX2LtqcYDtKT4siKneTc0Cvp2gztppiWzgCHql3cmHmHKDvMWrIgEek/cPSMh59 cV3w7/Eu6eCwyoP9AC96cEdhQehy7mjr7+EuCzWwXkHq+EsU4IMYww04hSZ+nTyIeekI FRvzzIinGwJtPchI55xcO5X20z02eNJmHQC4pkP1BIDejPXgPc1Yz+FFs17nsC2QDo0d seeqBHjW/lp8GWxGdO9eG7qYdbNaxSfRoXPCXTDjygSpi70YqZwdF2jiXs0xE5YaAm2V kFAg== X-Received: by 10.220.151.141 with SMTP id c13mr32111036vcw.64.1360148161944; Wed, 06 Feb 2013 02:56:01 -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 zo8csp13006vec; Wed, 6 Feb 2013 02:55:58 -0800 (PST) X-Received: by 10.194.71.244 with SMTP id y20mr48717879wju.19.1360148114138; Wed, 06 Feb 2013 02:55:14 -0800 (PST) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by mx.google.com with ESMTPS id f1si8554679wjq.85.2013.02.06.02.55.13 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Feb 2013 02:55:14 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.175 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.175; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.175 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-wi0-f175.google.com with SMTP id l13so4871240wie.14 for ; Wed, 06 Feb 2013 02:55:13 -0800 (PST) X-Received: by 10.194.60.195 with SMTP id j3mr2149647wjr.33.1360148113771; Wed, 06 Feb 2013 02:55:13 -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 be1sm2406649wib.10.2013.02.06.02.55.13 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Feb 2013 02:55:13 -0800 (PST) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: broonie@opensource.wolfsonmicro.com, linus.walleij@linaro.org, Lee Jones Subject: [PATCH 37/49] regulator: ab8500: Add voltage selection for AUDIO and ANA on AB8505 Date: Wed, 6 Feb 2013 10:53:59 +0000 Message-Id: <1360148051-7560-38-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1360148051-7560-1-git-send-email-lee.jones@linaro.org> References: <1360148051-7560-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQkOfdSP+7kvvKpkzFiNgOu+SGYBRvuHhlOv4hFLl4sd0hL074cZSW1dLD6CCVIgn0wak8JP 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 20c3270..9643bcc 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -162,6 +162,28 @@ static const int fixed_3300000_voltage[] = { 3300000, }; +static const int ldo_vana_voltages[] = { + 1050000, + 1075000, + 1100000, + 1125000, + 1150000, + 1175000, + 1200000, + 1225000, +}; + +static const 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, @@ -840,17 +872,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 = { @@ -903,12 +941,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, @@ -917,6 +955,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), }, };