From patchwork Mon Sep 9 10:10:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 19825 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7D17725A57 for ; Mon, 9 Sep 2013 10:10:30 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id db12sf6023960veb.2 for ; Mon, 09 Sep 2013 03:10:30 -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=lSzfNMEQSXWOkeLylipCMGCj4N4fBJtL9rZHredgEks=; b=eLloQEhRVOuQgp9zINYxQ7HroqdC3oISiodlxEycMe397xsb7P/28KF4l13N47JsJe 39r+84zCfA+I8xA+IojT+ctxM+HpcK6n46pnyHxNdF4em46NT1EFfR9W8tNPrg+wuEqU 9Al4twnXib2duZZdNzfypk6u4uEvxWL24eO4bN+cekPn57kOgPttcWG7ezPfP0bPFDBT K1NDkF33Gq+5xkyAeyEB2ZhRbZTvC/jdiPy58QxvtKDRypi8SPkj17Ppw8BxFAWKqkCL PVHvwOpI5/FRvrveD5R5V+Km77p3SLRlbFIdgIO65TCzL+FxFG5vge4UR0WTxzL0AqFU 41tw== X-Received: by 10.236.223.130 with SMTP id v2mr6140646yhp.34.1378721430290; Mon, 09 Sep 2013 03:10:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.30.35 with SMTP id p3ls1804384qeh.97.gmail; Mon, 09 Sep 2013 03:10:30 -0700 (PDT) X-Received: by 10.52.230.74 with SMTP id sw10mr13503505vdc.6.1378721430196; Mon, 09 Sep 2013 03:10:30 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id gq10si2963148vdc.69.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 03:10:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 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.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so3211075veb.40 for ; Mon, 09 Sep 2013 03:10:30 -0700 (PDT) X-Gm-Message-State: ALoCoQlR/q1hOwCOusj0lINqpFDzNdjs2jBMEFxiDX0JWD6zqQGsAOfcaagP8JmBz4LuUm19OHHw X-Received: by 10.52.118.73 with SMTP id kk9mr14024176vdb.13.1378721430110; Mon, 09 Sep 2013 03:10:30 -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 u4csp78971vcz; Mon, 9 Sep 2013 03:10:29 -0700 (PDT) X-Received: by 10.14.223.1 with SMTP id u1mr29301360eep.10.1378721428965; Mon, 09 Sep 2013 03:10:28 -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 x42si9534895eel.236.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 03:10:28 -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 z15so3027399ead.33 for ; Mon, 09 Sep 2013 03:10:28 -0700 (PDT) X-Received: by 10.14.99.193 with SMTP id x41mr2226747eef.52.1378721428383; Mon, 09 Sep 2013 03:10:28 -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:28 -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 06/14] iio: sensors-core: st: Allow full-scale to be an optional feature Date: Mon, 9 Sep 2013 11:10:02 +0100 Message-Id: <1378721410-30937-7-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.181 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 fd7e4d1..506b02d 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c @@ -247,8 +247,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_lps331ap_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)