From patchwork Tue Sep 10 12:49:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 19873 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 17D85246A4 for ; Tue, 10 Sep 2013 12:50:10 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id h1sf29718344oag.9 for ; Tue, 10 Sep 2013 05:50:09 -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=eb51RsSaGN2gWfWMfmqDKstLZOXWDTr5MXBebI7SSZ8=; b=Rp30H3p+aibVek5yoa7Qdgj0GG0a4n2nvR+trRS7L8PE96e0RH/T32sg6f9I600mLB KVhXDPrjZ/Gn9ebMxcAQMpMMBUE2xIQFWpdFROD7xOI0rey1RO2XfljDZGlP0gYNTAUB UR8R+JjfQ6kcb/H46+TJv1xqMqpKGd1Yqwi5u8o3xBrEhRSI41I/JW5XFLfE19iRTSpG JkNEyzOwXETvk/Gx9P93iKwuXTB3zgvBcB7fEzEW2ISk6CpfPsK0RJdkX2tNPUgn2TwF JCn+Ift+wF/jiqPodkrTC2BIZRExwU6BMDHel3JCD7eEm7A4HocoVYfs0MUHRNjTiKLi H5CA== X-Received: by 10.182.107.197 with SMTP id he5mr4236864obb.19.1378817409711; Tue, 10 Sep 2013 05:50:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.84.201 with SMTP id b9ls2139177qez.62.gmail; Tue, 10 Sep 2013 05:50:09 -0700 (PDT) X-Received: by 10.52.98.7 with SMTP id ee7mr333222vdb.37.1378817409381; Tue, 10 Sep 2013 05:50:09 -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 rp4si4405885vcb.36.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:50:09 -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 db12so4417506veb.36 for ; Tue, 10 Sep 2013 05:50:09 -0700 (PDT) X-Gm-Message-State: ALoCoQk2kvXsecNiVnRcMYY9zuOGD7Cq5F1cC9g4mnGhuQ77PPl1ntwxoh0i6EVGELImnQtFOaNb X-Received: by 10.52.230.233 with SMTP id tb9mr18841291vdc.17.1378817409288; Tue, 10 Sep 2013 05:50:09 -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 u4csp19396vcz; Tue, 10 Sep 2013 05:50:08 -0700 (PDT) X-Received: by 10.14.4.1 with SMTP id 1mr39241054eei.21.1378817405970; Tue, 10 Sep 2013 05:50:05 -0700 (PDT) Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by mx.google.com with ESMTPS id 41si14866426eee.47.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:50:05 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.49 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.83.49; Received: by mail-ee0-f49.google.com with SMTP id d41so3867512eek.36 for ; Tue, 10 Sep 2013 05:50:05 -0700 (PDT) X-Received: by 10.15.91.3 with SMTP id r3mr39203812eez.4.1378817405341; Tue, 10 Sep 2013 05:50:05 -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:04 -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 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature Date: Tue, 10 Sep 2013 13:49:19 +0100 Message-Id: <1378817379-8238-19-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.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: , 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 965ee22..eb261a5 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c @@ -235,10 +235,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 ceebd3c..16cfbc5 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c @@ -226,8 +226,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_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; if (!plat_data)