From patchwork Mon Sep 9 10:10:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 19830 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 49AFC25A57 for ; Mon, 9 Sep 2013 10:10:35 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf6919677vbg.7 for ; Mon, 09 Sep 2013 03:10:35 -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=1drdk54AXw4P7xad4ShpRgV4z/otDyTBLT9NznKYYP8=; b=b3RKt+hH4cbjXUrDMYCIiLbAnL+X4XIn6Tp9UztXr5QcIqIoCHg8Bk5fvQTCkwrj21 gOiCSu8Zyr20rBlbjOdWABT3eGyggZkPZw61/uNZcWwE1qu1ozGBXhelsGRdUUnOV6Ws w77TZoUoHknXo9kX4THrj+DcCwI0SrgRjOpBu8wQtGbx3PJ0UP4k4OgEXXfTPoUTlKvf +ieIC3CBPW+SD/3qBYhmwRaJpjulOEjFbw6BsVxaAocYh+gjVXXzYPNBHFU8/bElsAfK x2DvT0TrOa+6A5iRfhgDdxP6IIUikGRF+ivK3a6eQyvLD832kUNdRgYM3lougI+JsCl+ Oqlw== X-Received: by 10.236.111.73 with SMTP id v49mr2008028yhg.46.1378721435139; Mon, 09 Sep 2013 03:10:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.42 with SMTP id r10ls1796913qen.86.gmail; Mon, 09 Sep 2013 03:10:35 -0700 (PDT) X-Received: by 10.220.186.202 with SMTP id ct10mr17195597vcb.14.1378721435037; Mon, 09 Sep 2013 03:10:35 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id tj1si2974696vdc.1.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 03:10:35 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 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.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so4105906veb.30 for ; Mon, 09 Sep 2013 03:10:35 -0700 (PDT) X-Gm-Message-State: ALoCoQmHoCijr7RaMC/Wtz4ZQDKj58iF67X9b9OhxjQpSlhCu1s3cqGS3MjEVzIsSjESB+xzAUNO X-Received: by 10.58.118.130 with SMTP id km2mr16607946veb.0.1378721434945; Mon, 09 Sep 2013 03:10:34 -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 u4csp78977vcz; Mon, 9 Sep 2013 03:10:34 -0700 (PDT) X-Received: by 10.14.107.137 with SMTP id o9mr55957eeg.86.1378721433416; Mon, 09 Sep 2013 03:10:33 -0700 (PDT) Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51]) by mx.google.com with ESMTPS id f46si9567336eeo.99.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 03:10:33 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.51 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.83.51; Received: by mail-ee0-f51.google.com with SMTP id c1so3043134eek.10 for ; Mon, 09 Sep 2013 03:10:32 -0700 (PDT) X-Received: by 10.14.184.3 with SMTP id r3mr2826447eem.49.1378721432787; Mon, 09 Sep 2013 03:10:32 -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 m54sm20768068eex.2.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 03:10:32 -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 11/14] iio: pressure-core: st: Provide support for the Vdd_IO power supply Date: Mon, 9 Sep 2013 11:10:07 +0100 Message-Id: <1378721410-30937-12-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1378721410-30937-1-git-send-email-lee.jones@linaro.org> References: <1378721410-30937-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.171 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 f11cffc..330701c 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;