From patchwork Tue Sep 10 12:49:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 19885 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4EEF5260BE for ; Tue, 10 Sep 2013 12:50:22 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wd6sf27361409obb.11 for ; Tue, 10 Sep 2013 05:50:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=VFTWFNVFuYVV0M+8Rl+DwzNykvYGSw34Arf1BoMZNaU=; b=j+DBcXgPbYGRcwJznLDY0ivUsiZUjAMtELTRUYeWQh+fL1ayYJxNOFjxCe22lYPH/V D3jGV9kK48IkgI1MtYi2uLPCAYqB+cxofbQRwDG7pkEpZ25Yg2D/jx0zn5ObBuZ2WxlI udva7GKvlzr9oHUDn5uoFh6P6yASGeiQ3/8uJMmDXhsNM4fcT9nSoFa2xcQCIc1xzaYv yMxRpqWd2S87WfOHoy1tm7ZkrZ4H8mVt6r6zLPdmU/aBu/jGGuvX1HAVtks6sMNuPoI4 XZoOrAJmxxLdkA4hyFuqBz8PallwpS3VR4mJv3j7kFGpudlpu6m9HIYDG71NpC2ShFl0 l/fg== X-Received: by 10.182.107.197 with SMTP id he5mr4237371obb.19.1378817421752; Tue, 10 Sep 2013 05:50:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.28.10 with SMTP id x10ls2247450qeg.20.gmail; Tue, 10 Sep 2013 05:50:21 -0700 (PDT) X-Received: by 10.220.186.202 with SMTP id ct10mr23310251vcb.14.1378817421458; Tue, 10 Sep 2013 05:50:21 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id fb4si4404067veb.50.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:50:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id gd11so4868168vcb.5 for ; Tue, 10 Sep 2013 05:50:21 -0700 (PDT) X-Gm-Message-State: ALoCoQl4BS6njeklTGg0/735CqhmuYTHHCxo7/81n5OPeKDcP2EuR5vBn8z7fQDdnazhPCM+J2iQ X-Received: by 10.58.246.8 with SMTP id xs8mr23172614vec.9.1378817421366; Tue, 10 Sep 2013 05:50:21 -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.220.174.196 with SMTP id u4csp19412vcz; Tue, 10 Sep 2013 05:50:20 -0700 (PDT) X-Received: by 10.14.224.198 with SMTP id x46mr4002451eep.53.1378817417608; Tue, 10 Sep 2013 05:50:17 -0700 (PDT) Received: from mail-ea0-f174.google.com (mail-ea0-f174.google.com [209.85.215.174]) by mx.google.com with ESMTPS id p9si14837336eeu.174.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:50:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.174 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.215.174; Received: by mail-ea0-f174.google.com with SMTP id z15so3867642ead.33 for ; Tue, 10 Sep 2013 05:50:17 -0700 (PDT) X-Received: by 10.14.208.194 with SMTP id q42mr38854756eeo.31.1378817417057; Tue, 10 Sep 2013 05:50:17 -0700 (PDT) Received: from localhost.localdomain (cpc15-aztw25-2-0-cust493.aztw.cable.virginmedia.com. [92.233.57.238]) by mx.google.com with ESMTPSA id z12sm31123277eev.6.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:50:16 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, jic23@cam.ac.uk Cc: arnd@arndb.de, linus.walleij@linaro.org, denis.ciocca@st.com, linux-iio@vger.kernel.org, Lee Jones Subject: [PATCH 30/38] iio: pressure-core: st: Provide support for the Vdd_IO power supply Date: Tue, 10 Sep 2013 13:49:31 +0100 Message-Id: <1378817379-8238-31-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1378817379-8238-1-git-send-email-lee.jones@linaro.org> References: <1378817379-8238-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 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: , The power to some of the sensors are controlled by regulators. In most cases these are 'always on', but if not they will fail to work until the regulator is enabled using the relevant APIs. This patch allows for the Vdd_IO power supply to be specified by either platform data or Device Tree. Signed-off-by: Lee Jones --- drivers/iio/pressure/st_pressure_core.c | 13 ++++++++++++- include/linux/iio/common/st_sensors.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index d52b487..2db3b28 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c @@ -319,7 +319,7 @@ void st_press_power_enable(struct iio_dev *indio_dev) struct st_sensor_data *pdata = iio_priv(indio_dev); int err; - /* Regulators not mandatory, but if requested we should enable it. */ + /* Regulators not mandatory, but if requested we should enable them. */ pdata->vdd = devm_regulator_get_optional(&indio_dev->dev, "vdd"); if (!IS_ERR(pdata->vdd)) { err = regulator_enable(pdata->vdd); @@ -327,6 +327,14 @@ void st_press_power_enable(struct iio_dev *indio_dev) dev_warn(&indio_dev->dev, "Failed to enable specified Vdd supply\n"); } + + pdata->vdd_io = devm_regulator_get_optional(&indio_dev->dev, "vddio"); + if (!IS_ERR(pdata->vdd_io)) { + err = regulator_enable(pdata->vdd_io); + if (err != 0) + dev_warn(&indio_dev->dev, + "Failed to enable specified Vdd_IO supply\n"); + } } void st_press_power_disable(struct iio_dev *indio_dev) @@ -335,6 +343,9 @@ void st_press_power_disable(struct iio_dev *indio_dev) if (!IS_ERR(pdata->vdd)) regulator_disable(pdata->vdd); + + if (!IS_ERR(pdata->vdd_io)) + regulator_disable(pdata->vdd_io); } int st_press_common_probe(struct iio_dev *indio_dev, diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 968b84e..3c005eb 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h @@ -203,6 +203,7 @@ struct st_sensors { * @sensor: Pointer to the current sensor struct in use. * @current_fullscale: Maximum range of measure by the sensor. * @vdd: Pointer to sensor's Vdd power supply + * @vdd_io: Pointer to sensor's Vdd-IO power supply * @enabled: Status of the sensor (false->off, true->on). * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. * @buffer_data: Data used by buffer part. @@ -219,6 +220,7 @@ struct st_sensor_data { struct st_sensors *sensor; struct st_sensor_fullscale_avl *current_fullscale; struct regulator *vdd; + struct regulator *vdd_io; bool enabled; bool multiread_bit;