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: 52632 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id E372D22DD4 for ; Mon, 24 Aug 2015 12:42:50 +0000 (UTC) Received: by labia3 with SMTP id ia3sf15295062lab.3 for ; Mon, 24 Aug 2015 05:42:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=wh6+yc7XxKAECF3yqwYT6V92IlcJo05E+5l2kdI5+eo=; b=Yc8NfZw7MPQBGAuxKX6JOGcHg2IQvGGoUe0zFMgAvJlnhJxzsvN0l2rJItay3AJfYd W6dcDUQkc8g/5C47zoDZpCD5EEORsJFZj0+rxKxL322IiDSA6cm/05YwJu7myjeABJDt xQenEVtzTW5btrqRWrfmNRlQU2Rcy74gox0Wo+5KK4j++o3/LWm70OSS83S7GfeE7Sxd BbhqtExPOfdjKu1W+pRS2P7Y4zc4x4+YbargxdxINwe3PlDqkj7urwM89IYjYILsLaMU LZjo1EZ0k4T3Z2riqeRyFYZOY643fdPoGb9PbcTqX25XE1vbBH8oTlTDuwlgrR2ILakn X6ZA== X-Gm-Message-State: ALoCoQnivHlA21+NRM9XyiOKXAwvG4EaqdwKMYF6anB6vwxE21pQN5YveDV05eCscD8g5fnRZEHN X-Received: by 10.152.28.100 with SMTP id a4mr6752477lah.4.1440420169692; Mon, 24 Aug 2015 05:42:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.138 with SMTP id s10ls192015las.25.gmail; Mon, 24 Aug 2015 05:42:49 -0700 (PDT) X-Received: by 10.152.206.73 with SMTP id lm9mr20382746lac.0.1440420169547; Mon, 24 Aug 2015 05:42:49 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id 7si12994968law.133.2015.08.24.05.42.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Aug 2015 05:42:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbtg9 with SMTP id tg9so79285805lbb.1 for ; Mon, 24 Aug 2015 05:42:49 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr20514742lbc.32.1440420169451; Mon, 24 Aug 2015 05:42:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.162.200 with SMTP id yc8csp2445514lbb; Mon, 24 Aug 2015 05:42:48 -0700 (PDT) X-Received: by 10.70.32.97 with SMTP id h1mr23850057pdi.91.1440420166137; Mon, 24 Aug 2015 05:42:46 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yc5si27224148pbc.27.2015.08.24.05.42.45; Mon, 24 Aug 2015 05:42:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933177AbbHXMmk (ORCPT + 8 others); Mon, 24 Aug 2015 08:42:40 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:32849 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932521AbbHXMmj (ORCPT ); Mon, 24 Aug 2015 08:42:39 -0400 Received: by pdrh1 with SMTP id h1so54165811pdr.0 for ; Mon, 24 Aug 2015 05:42:38 -0700 (PDT) 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 Cc: robh+dt@kernel.org, devicetree@vger.kernel.org, k.kozlowski@samsung.com, lee.jones@linaro.org, broonie@kernel.org, linux-kernel@vger.kernel.org, Vaibhav Hiremath 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> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vaibhav.hiremath@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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;