From patchwork Wed Sep 4 09:31:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 19747 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 13BA924869 for ; Wed, 4 Sep 2013 09:32:06 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf45533vbg.11 for ; Wed, 04 Sep 2013 02:32:05 -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=68i8ENur1TmUYBIyi3iblqNOOydVc4tf/T9ulrJlQV4=; b=fQLRbDG0CurDu6rdhycoKbrJEqQHwJJDLucrpTDoIORlf7rD62fjbUJBBKUAc5JN2t eUlpi39E7ZQmR0pTrdOZTY1vQkvL5SMNiGD7InGHXr3BXy0qEaeXn2VPLFOy2tgI5h+8 ex1CP8wnDITYBuBS1UTDLlC7DCSSrTOE7XEwSbv1Otx+ltgFVxKTsdhDuo3q9whhTUO7 pt2E+lD9Ztk/Kz3pskj+CK6qhnmvq5aQ1Y++v1OgnOc15AG9SIDcQ3DeJdN/qJQTFUF1 DqZ90yFGDn/ad9CTtEHHbXAb6FkK6B8q5vVdvYIb4OiNbQ6Qe16umEXx11mDVYM5vN6q SVLw== X-Received: by 10.224.21.1 with SMTP id h1mr2124761qab.3.1378287125885; Wed, 04 Sep 2013 02:32:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.110.9 with SMTP id hw9ls63340qeb.16.gmail; Wed, 04 Sep 2013 02:32:05 -0700 (PDT) X-Received: by 10.58.119.233 with SMTP id kx9mr1788706veb.3.1378287125736; Wed, 04 Sep 2013 02:32:05 -0700 (PDT) Received: from mail-vb0-f43.google.com (mail-vb0-f43.google.com [209.85.212.43]) by mx.google.com with ESMTPS id de6si5628998vcb.109.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 02:32:05 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.43 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.43; Received: by mail-vb0-f43.google.com with SMTP id h11so39228vbh.16 for ; Wed, 04 Sep 2013 02:32:05 -0700 (PDT) X-Gm-Message-State: ALoCoQlLFQWPedJhxKKe47p2ouLpc46u7jyI3Yh1Xrui1QKJecpfpJeC8KjvubzKMebCzteS6bfp X-Received: by 10.52.180.229 with SMTP id dr5mr1506279vdc.20.1378287125646; Wed, 04 Sep 2013 02:32:05 -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 u4csp223884vcz; Wed, 4 Sep 2013 02:32:04 -0700 (PDT) X-Received: by 10.15.27.133 with SMTP id p5mr1708030eeu.65.1378287124386; Wed, 04 Sep 2013 02:32:04 -0700 (PDT) Received: from mail-ea0-f181.google.com (mail-ea0-f181.google.com [209.85.215.181]) by mx.google.com with ESMTPS id h8si18315964eeo.306.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 02:32:04 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.181 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.215.181; Received: by mail-ea0-f181.google.com with SMTP id d10so33902eaj.40 for ; Wed, 04 Sep 2013 02:32:03 -0700 (PDT) X-Received: by 10.15.83.2 with SMTP id b2mr3329863eez.28.1378287123899; Wed, 04 Sep 2013 02:32:03 -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 p5sm38475700eeg.5.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Sep 2013 02:32:03 -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 07/11] iio: sensors-core: st: Allow full-scale to be an optional feature Date: Wed, 4 Sep 2013 10:31:39 +0100 Message-Id: <1378287103-21765-8-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1378287103-21765-1-git-send-email-lee.jones@linaro.org> References: <1378287103-21765-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.212.43 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: , Some chips either don't support it or fail to provide adequate documentation, so sometimes it's impossible to enable the feature even if it is supported. Signed-off-by: Lee Jones --- drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++---- drivers/iio/pressure/st_pressure_core.c | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 865b178..fc9acb7 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -209,10 +209,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev) if (err < 0) goto init_error; - err = st_sensors_set_fullscale(indio_dev, - sdata->current_fullscale->num); - if (err < 0) - goto init_error; + if (sdata->current_fullscale) { + err = st_sensors_set_fullscale(indio_dev, + sdata->current_fullscale->num); + if (err < 0) + goto init_error; + } else + dev_info(&indio_dev->dev, "Full-scale not possible\n"); err = st_sensors_set_odr(indio_dev, sdata->odr); if (err < 0) diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index 7ba9299..423ed6a 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c @@ -239,8 +239,10 @@ int st_press_common_probe(struct iio_dev *indio_dev) indio_dev->channels = pdata->sensor->ch; indio_dev->num_channels = ARRAY_SIZE(st_press_lsp331ap_channels); - pdata->current_fullscale = (struct st_sensor_fullscale_avl *) - &pdata->sensor->fs.fs_avl[0]; + if (pdata->sensor->fs.addr != 0) + pdata->current_fullscale = (struct st_sensor_fullscale_avl *) + &pdata->sensor->fs.fs_avl[0]; + pdata->odr = pdata->sensor->odr.odr_avl[0].hz; err = st_sensors_init_sensor(indio_dev);