From patchwork Tue Feb 4 05:54:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 3573941 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C16CD9F2E9 for ; Tue, 4 Feb 2014 05:54:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E740C2018A for ; Tue, 4 Feb 2014 05:54:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 218292017B for ; Tue, 4 Feb 2014 05:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751513AbaBDFy1 (ORCPT ); Tue, 4 Feb 2014 00:54:27 -0500 Received: from mail-la0-f45.google.com ([209.85.215.45]:41376 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbaBDFy1 (ORCPT ); Tue, 4 Feb 2014 00:54:27 -0500 Received: by mail-la0-f45.google.com with SMTP id b8so6070794lan.4 for ; Mon, 03 Feb 2014 21:54:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=RCvYxDOAcVgIhANqRIPEazEFWGrbwgLkIXVfAtXBCT0=; b=JYHbR0q/ToiHU/QNf1F1xoxdXnSNxKA79KTG3njWFUFxqf/nTHHp0khCU+PrjAILms M7jdWMW8mZJYLOFE4IFC7gVReDl+qhAQX7O3IRrdHzDGX2KE6NpMncQjuXKyFK2rnBqw wI3553OXU43VDkdozeFL8oHPHM0RPemQhYyt0ND2wEb433I2Be5ZIq7soxzEDicc7NJb yC11XscSL3QgNZ/Ov3+xfq3WvZn8cxGYHDVwt+XUvZ44xsnSpWBoslqfr/4ql+Q71/K0 0om/MKZoQhVgg26/u3rA/jYoa87nwXgjXLHlIKYD0Ks3rQfaaHvDOnGHl4f7ci85YTyn 0OKA== X-Gm-Message-State: ALoCoQkC8wDT4K9xC/UswEqzFEl54CmYwv8KThK09xDoLPee2U7fwlFcMLdtvy8euUSorVWEM4RU X-Received: by 10.112.134.38 with SMTP id ph6mr15838615lbb.16.1391493265770; Mon, 03 Feb 2014 21:54:25 -0800 (PST) Received: from buildbot.san.rr.com (cpe-76-167-68-231.san.res.rr.com. [76.167.68.231]) by mx.google.com with ESMTPSA id cu8sm23972071lbb.12.2014.02.03.21.54.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Feb 2014 21:54:24 -0800 (PST) From: Bjorn Andersson To: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] regulator: core: Make regulator object reflect configured voltage Date: Mon, 3 Feb 2014 21:54:28 -0800 Message-Id: <1391493268-3242-1-git-send-email-bjorn.andersson@sonymobile.com> 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 X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 In the case when a regulator is initialized from DT with equal min and max voltages the voltage is applied on initialization and future calls to regulator_set_voltage fails. This behavious is different than if the regulator is configured to be a span and therefor requires logic to handle this difference in the consumer driver. Eliminate this difference by populating the min_uV and max_uV of the newly created regulator from the constraints so that calles to regulator_set_voltage is considered no-ops and not a failure. Signed-off-by: Bjorn Andersson --- drivers/regulator/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d85f313..9c82d37 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1209,6 +1209,16 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, _regulator_is_enabled(rdev)) regulator->always_on = true; + /* + * Make the regulator reflect the configured voltage selected in + * machine_constraints_voltage() + */ + if (rdev->constraints->apply_uV && + rdev->constraints->min_uV == rdev->constraints->max_uV) { + regulator->min_uV = rdev->constraints->min_uV; + regulator->max_uV = rdev->constraints->min_uV; + } + mutex_unlock(&rdev->mutex); return regulator; overflow_err: