From patchwork Mon Sep 16 16:02:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 20364 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4011228E98 for ; Mon, 16 Sep 2013 16:02:56 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id e13sf4469780vbg.8 for ; Mon, 16 Sep 2013 09:02:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=DUaD9dcpNu8D2LykkbXKw5Bfmw0Az5T6/MQ7bEITyWE=; b=W78YvCCo/8CY8zhcKjw6/CgR1CX1bcdAP2/ZWy6oZenorPuuF75h6uqwModyfPySjG wFZtbrJQFy5SH1OxO5Z3v5xi0Inf4szctZl9wmpDnuKWwkhGTQbEjYHNlL3ayOtHo1NA SfX0I6jXxrcbLycHkOujW7d1iCZDYi8qAuvndeGdhg3FmaDsStMLT7tcvyxb+KK7lApG xJrA8P5AR1CxURpgWn30lvx/Z3d2iHm8wMKkMbjNkEGb0bXo/vWr546Ikhn4nGeNbnTl nwFjaAhO6olmyV/qRV4MccXXnudmYqA4qX3IOzAmqdyTzhesLBUITDNG5qOcbr3CMxTQ M0sQ== X-Gm-Message-State: ALoCoQlFIerRo4oZu17Umua6LaWIBoYlurjsHZlhHDtvICJfmFQnpqz16zUxsRoPdhi1IC/ED4it X-Received: by 10.236.41.100 with SMTP id g64mr11058854yhb.31.1379347375987; Mon, 16 Sep 2013 09:02:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.104.84 with SMTP id gc20ls2335515qeb.96.gmail; Mon, 16 Sep 2013 09:02:55 -0700 (PDT) X-Received: by 10.52.118.41 with SMTP id kj9mr4363vdb.44.1379347375880; Mon, 16 Sep 2013 09:02:55 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id dj3si7260626vcb.119.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 09:02:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db12so3091900veb.36 for ; Mon, 16 Sep 2013 09:02:55 -0700 (PDT) X-Received: by 10.220.10.194 with SMTP id q2mr27312840vcq.2.1379347375802; Mon, 16 Sep 2013 09:02:55 -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 u4csp104949vcz; Mon, 16 Sep 2013 09:02:55 -0700 (PDT) X-Received: by 10.14.198.197 with SMTP id v45mr4026065een.52.1379347374556; Mon, 16 Sep 2013 09:02:54 -0700 (PDT) Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com [209.85.215.177]) by mx.google.com with ESMTPS id 7si16798200eeu.218.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 09:02:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.177 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.215.177; Received: by mail-ea0-f177.google.com with SMTP id f15so2100099eak.22 for ; Mon, 16 Sep 2013 09:02:54 -0700 (PDT) X-Received: by 10.14.183.2 with SMTP id p2mr5046230eem.44.1379347373943; Mon, 16 Sep 2013 09:02:53 -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 z12sm43061275eev.6.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 09:02:53 -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 17/20] iio: pressure-core: st: Provide support for the Vdd_IO power supply Date: Mon, 16 Sep 2013 17:02:23 +0100 Message-Id: <1379347346-823-18-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1379347346-823-1-git-send-email-lee.jones@linaro.org> References: <1379347346-823-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.128.177 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 c801c80..e3f3888 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;