From patchwork Mon Dec 10 08:55:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13435 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E3CB423E1A for ; Mon, 10 Dec 2012 08:56:23 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id A3621A18908 for ; Mon, 10 Dec 2012 08:56:23 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so7717100ieb.11 for ; Mon, 10 Dec 2012 00:56:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=YR6X2HmrdtnnkOce1TnVOM+9X3mxD9nhFe6sznQ7ylQ=; b=B6e5MDS0Fnol79LsEVfpYEz96IyWtcueYHezxQOdeCaC/J/Wyfk1BS8VogLgR8ZlIJ oht0jaG02gYGHNJEvAFswNTVOSU5hH61OAX5x7Ze/Vb575ffYRqiY4iIh5dZ0vvNAFfz r1AqWPnHHpx/iRJ75kxAVR921emeD/oCz7N+gcboWy8KQsRbVWXDIA3zd53UOsbp+20v vPn8ktiNGEj1IHP/gfnOoVD6iRRuO5OJ3BzClDQAi72g15+hIRGhZCUXLihLB1FVZbaz rkFUS9ch4z7mfZQc0WC8j3T65xzp6cqBWeDv27zS1vVKZMk9q6+W0e4yD5MBKJb0TKR1 07mQ== Received: by 10.43.49.199 with SMTP id vb7mr10521966icb.6.1355129783083; Mon, 10 Dec 2012 00:56:23 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp54748igt; Mon, 10 Dec 2012 00:56:22 -0800 (PST) Received: by 10.180.73.80 with SMTP id j16mr9362135wiv.5.1355129782223; Mon, 10 Dec 2012 00:56:22 -0800 (PST) Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by mx.google.com with ESMTPS id k68si4268694weo.10.2012.12.10.00.56.21 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 00:56:22 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.177 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.177; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.177 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f177.google.com with SMTP id x48so1045730wey.36 for ; Mon, 10 Dec 2012 00:56:21 -0800 (PST) Received: by 10.180.99.227 with SMTP id et3mr9354751wib.6.1355129781752; Mon, 10 Dec 2012 00:56:21 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id fv2sm9173114wib.4.2012.12.10.00.56.20 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 00:56:21 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, ulf.hansson@linaro.org, Lee Jones , Mark Brown Subject: [PATCH 02/12] regulator: gpio-regulator: Only read GPIO [dis|en]able pin if not always-on Date: Mon, 10 Dec 2012 08:55:51 +0000 Message-Id: <1355129761-8088-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355129761-8088-1-git-send-email-lee.jones@linaro.org> References: <1355129761-8088-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnnOA22oRQylEIKah8lnrEZRU5kaXcaSsOWC/zHnonL1Tz/sEuldYpF7D2z0xVL6gPK7Ikb If a regulator is specified as always-on, then it can't have an enable/disable pin, as it can't be turned off. Cc: Mark Brown Signed-off-by: Lee Jones --- drivers/regulator/gpio-regulator.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 1a71be2..3afa46a 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -160,7 +160,14 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np) of_property_read_u32(np, "startup-delay-us", &config->startup_delay); - config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0); + if (!config->init_data->constraints.always_on) { + config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0); + if (config->enable_gpio < 0) { + dev_err(dev, "Couldn't get 'enable-gpio' (%d)\n", + config->enable_gpio); + return ERR_PTR(config->enable_gpio); + } + } /* Fetch GPIOs. */ for (i = 0; ; i++)