From patchwork Wed Mar 30 14:23:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 64704 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2626217lbc; Wed, 30 Mar 2016 07:23:17 -0700 (PDT) X-Received: by 10.98.65.14 with SMTP id o14mr13440711pfa.151.1459347797573; Wed, 30 Mar 2016 07:23:17 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14si6816783pfi.166.2016.03.30.07.23.17; Wed, 30 Mar 2016 07:23:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752055AbcC3OXQ (ORCPT + 8 others); Wed, 30 Mar 2016 10:23:16 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:34234 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751217AbcC3OXQ (ORCPT ); Wed, 30 Mar 2016 10:23:16 -0400 Received: by mail-wm0-f46.google.com with SMTP id p65so185678106wmp.1 for ; Wed, 30 Mar 2016 07:23:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0SYu+FgaqAB9Fc2vA7kJP2UHwfyaPLvPIvp0BBHtLps=; b=UopF6FHk8Eq1XsCXP0VnkUb4KVE7Htu8XBzrnv35o+gb7zb03b0Bxyt4Jnbj1zdKVE oCMiAXgiV3qRNEtCX+agr3YNrSXzykkNkK7XSJiFxPr9a/64fZB514oErmxaxojkf9o1 MThXfUxKSBJPKXRWd/fjSD5ucDdKXyJz/L66I= 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; bh=0SYu+FgaqAB9Fc2vA7kJP2UHwfyaPLvPIvp0BBHtLps=; b=cEU4//kI8+5qbf17CO/LRQ+mucE92mHkd9r46u1Xkdzn4Bs4OWKpYxWkbCVJ3YDofO cZMnHA/1fIsivHWRswIce3tE5oRAME3ff6jjaFE23MeYgqyh/n7Sz7fNjxImrOoMvptp TzD79KJeaLIg5VNsCI8nUR/D+/E22dwgRdKywOBDhkRuq/WBzpICDweV0/8SVr5xn+rY YckW2sslys9k0Nnc/f+Tjg7pi4ly2fdJDme4zX9XbKhFdshvVDSZudLHumqqh4/kkVL4 4ULMp0agF6IPizphz7Ss9ToU3LflUxnNdRrd9c/xDoj7iQrGAcnYPQyIMhd4/FR6saeQ DnTA== X-Gm-Message-State: AD7BkJLwA3I7NAmH4e4f7Aq6CfLLa7aEvcyOpbn0nOJ3LolFmvJn7U6doAxLimf4nfN1iRkC X-Received: by 10.28.137.139 with SMTP id l133mr11084031wmd.1.1459347794570; Wed, 30 Mar 2016 07:23:14 -0700 (PDT) Received: from mms.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id i5sm4229777wjx.15.2016.03.30.07.23.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Mar 2016 07:23:13 -0700 (PDT) From: Georgi Djakov To: broonie@kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, stephen.boyd@linaro.org, georgi.djakov@linaro.org Subject: [PATCH] regulator: Support ramp-up delay for drivers with get_voltage() Date: Wed, 30 Mar 2016 17:23:12 +0300 Message-Id: <1459347792-13515-1-git-send-email-georgi.djakov@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently a ramp-up delay is supported only for drivers which have an implementation of both set_voltage_time_sel() and get_voltage_sel(). But some drivers use get_voltage() instead of get_voltage_sel(). Allow the regulator core to support ramp-up delays for drivers which use get_voltage(). Signed-off-by: Georgi Djakov --- drivers/regulator/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 74e8a7a3b3e8..39806b4d580a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2772,6 +2772,17 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev, old_selector = rdev->desc->ops->get_voltage_sel(rdev); if (old_selector < 0) return old_selector; + + } else if (_regulator_is_enabled(rdev) && + rdev->desc->ops->set_voltage_time_sel && + rdev->desc->ops->get_voltage) { + int uV = rdev->desc->ops->get_voltage(rdev); + + if (uV > 0) { + old_selector = regulator_map_voltage(rdev, uV, uV); + if (old_selector < 0) + return old_selector; + } } if (rdev->desc->ops->set_voltage) {