From patchwork Mon Aug 24 12:40:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 7064071 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 301519F358 for ; Mon, 24 Aug 2015 12:44:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 578A72060C for ; Mon, 24 Aug 2015 12:44:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6976E204AF for ; Mon, 24 Aug 2015 12:44:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZTr5d-0007pg-3V; Mon, 24 Aug 2015 12:43:05 +0000 Received: from mail-pd0-f173.google.com ([209.85.192.173]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZTr5X-0007Ws-MW for linux-arm-kernel@lists.infradead.org; Mon, 24 Aug 2015 12:43:00 +0000 Received: by pdbfa8 with SMTP id fa8so53311422pdb.1 for ; Mon, 24 Aug 2015 05:42:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wutXozEp0l94LrGBmkUSe89O9iNTBWFnhrJuwmAiAPQ=; b=Isd0TpPnxijx0HEnb78my52oJsj7dNWdDw5aWS1QLRRIwzW7eV5tU+DOfye4FVVZRx j0gE3sySuS250r9cmDS8GE12IQ6JJNLTYb6Ey+J/nrlUmMNMVKuhXj6+cUgcGEX9NXh1 iBbkCtE3L58GsQnIuEFRmAczsa+kwhEzo0PyKiRtlsxpSeHgUDvaW+ENMsCg9mxfrVJF czDE5/gQxJiYRfgLbGCwyqUUhGIAP7wvhoK6fhe2oCnyM6+BdtYkk4YnwYsqtv37VFyb 4NMnwQbN/jRWsT+ThZWhPptRjqADKu+/ppM8B2AZvvJB3diIinCDeqUGpl0rbLbd19m5 Ar+w== X-Gm-Message-State: ALoCoQlkRHviwLWBQUkyYgIeUGSu0UwYAzt7BfgsqWLeMSk2HDeOFmhthAF7ZOJcZynfZBIikIvp X-Received: by 10.70.91.45 with SMTP id cb13mr17843077pdb.138.1440420158500; Mon, 24 Aug 2015 05:42:38 -0700 (PDT) Received: from localhost.localdomain ([202.62.77.106]) by smtp.gmail.com with ESMTPSA id xf6sm17318223pbc.70.2015.08.24.05.42.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Aug 2015 05:42:37 -0700 (PDT) From: Vaibhav Hiremath To: linux-arm-kernel@lists.infradead.org Subject: [PATCH-v3 2/2] regulator: 88pm800: Add support for configuration of dual phase on BUCK1 Date: Mon, 24 Aug 2015 18:10:06 +0530 Message-Id: <1440420006-31556-3-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440420006-31556-1-git-send-email-vaibhav.hiremath@linaro.org> References: <1440420006-31556-1-git-send-email-vaibhav.hiremath@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150824_054259_798246_27C5CB14 X-CRM114-Status: GOOD ( 18.18 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, k.kozlowski@samsung.com, broonie@kernel.org, linux-kernel@vger.kernel.org, Vaibhav Hiremath , robh+dt@kernel.org, lee.jones@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 88PM860 device supports dual phase mode on BUCK1 output. In normal usecase, BUCK1A and BUCK1B operates independently with 3A capacity. And they both can work as a dual phase providing 6A capacity. This patch updates the regulator driver to read the respective DT property and enable dual-phase mode on BUCK1. Note that if dual phase mode is enabled, then BUCK1B will not be registered to the regulator framework and the current capacity of BUCK1(A) would be set to 6A [3A of BUCK1A + 3A of BUCK1B]. Signed-off-by: Vaibhav Hiremath Reviewed-by: Krzysztof Kozlowski --- drivers/regulator/88pm800.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/88pm80x.h | 3 +++ 2 files changed, 43 insertions(+) diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c index 365a154..7aca6d17 100644 --- a/drivers/regulator/88pm800.c +++ b/drivers/regulator/88pm800.c @@ -267,6 +267,37 @@ static struct pm800_regulator_info pm860_regulator_info[] = { PM800_LDO(ldo20, LDO20, LDO_ENA1_3, 3, 10000, ldo_volt_table2), }; +static int pm800_regulator_init(struct platform_device *pdev, + struct pm800_regulator_info *info) +{ + struct pm800_regulators *pm800_data = platform_get_drvdata(pdev); + struct pm80x_chip *chip = pm800_data->chip; + int ret = 0; + + /* Currently only supported on 88pm860 device */ + if (chip->type != CHIP_PM860) + return 0; + + if (of_property_read_bool(pdev->dev.of_node, + "marvell,88pm860-buck1-dualphase-en")) { + /* Update the constraint to [3A (BUCK1A) + 3A (BUCK1B)] */ + info[PM800_ID_BUCK1].max_ua = 6000000; + /* Remove BUCK1B from the list, as we are in dual phase mode */ + memset(&info[PM800_ID_BUCK1B], 0, sizeof(*info)); + /* Enable dual phase mode */ + ret = regmap_update_bits(chip->subchip->regmap_power, + PM860_BUCK1_MISC, + BUCK1_DUAL_PHASE_SEL, + BUCK1_DUAL_PHASE_SEL); + if (ret) { + dev_err(chip->dev, "failed to set dual-pase mode %d\n", ret); + return ret; + } + } + + return ret; +} + static int pm800_regulator_probe(struct platform_device *pdev) { struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -311,11 +342,20 @@ static int pm800_regulator_probe(struct platform_device *pdev) return -ENODEV; } + ret = pm800_regulator_init(pdev, info); + if (ret) { + dev_err(&pdev->dev, "failed to init 88pm800 regulator device\n"); + return ret; + } + config.dev = chip->dev; config.regmap = pm800_data->map; for (i = 0; i < PM800_ID_RG_MAX; i++) { struct regulator_dev *regulator; + if (!info[i].desc.name) + continue; + if (pdata && pdata->num_regulators) { init_data = pdata->regulators[i]; if (!init_data) diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index a92d173..122cfd2 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -295,6 +295,9 @@ enum { #define PM860_BUCK4_MISC2 (0x82) #define PM860_BUCK4_FULL_DRV BIT(2) +#define PM860_BUCK1_MISC 0x8E +#define BUCK1_DUAL_PHASE_SEL BIT(2) + struct pm80x_rtc_pdata { int vrtc; int rtc_wakeup;