Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753312AbcC3OXR (ORCPT ); Wed, 30 Mar 2016 10:23:17 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:34237 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752078AbcC3OXQ (ORCPT ); Wed, 30 Mar 2016 10:23:16 -0400 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1152 Lines: 34 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(+) 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) {