From patchwork Fri Jun 7 16:11:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 17685 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CCEE62395F for ; Fri, 7 Jun 2013 16:12:00 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id l109sf4450283yhq.1 for ; Fri, 07 Jun 2013 09:12:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=W2T3C2GMd7zBfhSCLztcTrDtzP3lfzVbUIKEFPOa1uk=; b=FcGlJXJkqXm0Lu3DoMKKjnahxTlCnmLmarv5ZV+ntVnAdvwZjcVz9JVi2GTDUFSDtM 1E2fMkP93JENAWpM731W29cL/AU9AE/iDFSwR7WPcEPSLJvUZGD3X4hg8RKrVH+raqkZ OYp1n+LxQxVbsFOu8gSTjHG7IJxqyVGZ5/IGsGA5xcXQSOKHd+Izava3HxI5CnEOYwCi TZ61xLsmUxvQpzaYIyTf/NUD4RtjpI1C01hNdLBZCNxUXZ2aNBre50/4S2P6PBDBFX6C zO9ikQ43YP4toE8TCzNq0cWN9bEh3XoNg/cmePNtqmExO7MDlDiv1DpQGZM4wcLRrmXn 7RJA== X-Received: by 10.236.142.11 with SMTP id h11mr23193007yhj.55.1370621520540; Fri, 07 Jun 2013 09:12:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.63.34 with SMTP id d2ls1529555qes.66.gmail; Fri, 07 Jun 2013 09:12:00 -0700 (PDT) X-Received: by 10.220.205.67 with SMTP id fp3mr2349183vcb.43.1370621519602; Fri, 07 Jun 2013 09:11:59 -0700 (PDT) Received: from mail-ve0-x22c.google.com (mail-ve0-x22c.google.com [2607:f8b0:400c:c01::22c]) by mx.google.com with ESMTPS id ef7si43733560vdc.20.2013.06.07.09.11.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Jun 2013 09:11:59 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22c; Received: by mail-ve0-f172.google.com with SMTP id jz10so3184775veb.31 for ; Fri, 07 Jun 2013 09:11:59 -0700 (PDT) X-Received: by 10.52.157.138 with SMTP id wm10mr20374887vdb.57.1370621519477; Fri, 07 Jun 2013 09:11:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp120727vcb; Fri, 7 Jun 2013 09:11:58 -0700 (PDT) X-Received: by 10.14.219.136 with SMTP id m8mr24604715eep.86.1370621518330; Fri, 07 Jun 2013 09:11:58 -0700 (PDT) Received: from mail-ea0-x22a.google.com (mail-ea0-x22a.google.com [2a00:1450:4013:c01::22a]) by mx.google.com with ESMTPS id e5si14814316eeg.12.2013.06.07.09.11.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Jun 2013 09:11:58 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4013:c01::22a is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:4013:c01::22a; Received: by mail-ea0-f170.google.com with SMTP id h10so3825211eaj.1 for ; Fri, 07 Jun 2013 09:11:57 -0700 (PDT) X-Received: by 10.14.199.134 with SMTP id x6mr5739855een.114.1370621517761; Fri, 07 Jun 2013 09:11:57 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPSA id c5sm97260340eeu.8.2013.06.07.09.11.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Jun 2013 09:11:56 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, srinidhi.kasagar@stericsson.com, broonie@linaro.org, Lee Jones Subject: [PATCH 07/10] regulator: ab8500-ext: Provide a set_voltage call-back operation Date: Fri, 7 Jun 2013 17:11:25 +0100 Message-Id: <1370621488-18130-8-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1370621488-18130-1-git-send-email-lee.jones@linaro.org> References: <1370621488-18130-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQna3rRcY5LODFmEN057omeLbgfZXpHqEko8Vsly29+kwEJcGeO49K4yZL6oqop3Pn3sQt5b X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When registering regulators which have a single voltage through Device Tree, the framework insists that the specified voltage is actually set. Well in order to do that we need to provide this call-back, where we check that the value is sane and return without error. Not that the selector isn't populated, but in our case list_voltage doesn't actually use it, so we're good. Signed-off-by: Lee Jones --- drivers/regulator/ab8500-ext.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c index b4d4547..e4975bc 100644 --- a/drivers/regulator/ab8500-ext.c +++ b/drivers/regulator/ab8500-ext.c @@ -229,6 +229,28 @@ static unsigned int ab8500_ext_regulator_get_mode(struct regulator_dev *rdev) return ret; } +static int ab8500_ext_set_voltage(struct regulator_dev *rdev, int min_uV, + int max_uV, unsigned *selector) +{ + struct regulation_constraints *regu_constraints = rdev->constraints; + + if (!regu_constraints) { + dev_err(rdev_get_dev(rdev), "No regulator constraints\n"); + return -EINVAL; + } + + if (regu_constraints->min_uV == min_uV && + regu_constraints->max_uV == max_uV) + return 0; + + dev_err(rdev_get_dev(rdev), + "Requested min %duV max %duV != constrained min %duV max %duV\n", + min_uV, max_uV, + regu_constraints->min_uV, regu_constraints->max_uV); + + return -EINVAL; +} + static int ab8500_ext_list_voltage(struct regulator_dev *rdev, unsigned selector) { @@ -252,6 +274,7 @@ static struct regulator_ops ab8500_ext_regulator_ops = { .is_enabled = ab8500_ext_regulator_is_enabled, .set_mode = ab8500_ext_regulator_set_mode, .get_mode = ab8500_ext_regulator_get_mode, + .set_voltage = ab8500_ext_set_voltage, .list_voltage = ab8500_ext_list_voltage, };