From patchwork Wed Feb 13 07:41:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Looijmans X-Patchwork-Id: 10809283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 754481390 for ; Wed, 13 Feb 2019 07:41:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DC842C3D7 for ; Wed, 13 Feb 2019 07:41:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50D1F2C444; Wed, 13 Feb 2019 07:41:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF3962C3D7 for ; Wed, 13 Feb 2019 07:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731472AbfBMHly (ORCPT ); Wed, 13 Feb 2019 02:41:54 -0500 Received: from jax4mhob25.registeredsite.com ([64.69.218.113]:43490 "EHLO jax4mhob25.registeredsite.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728116AbfBMHly (ORCPT ); Wed, 13 Feb 2019 02:41:54 -0500 X-Greylist: delayed 62151 seconds by postgrey-1.27 at vger.kernel.org; Wed, 13 Feb 2019 02:41:53 EST Received: from mailpod.hostingplatform.com ([10.30.71.206]) by jax4mhob25.registeredsite.com (8.14.4/8.14.4) with ESMTP id x1D7fp0m032192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 13 Feb 2019 02:41:52 -0500 Received: (qmail 27927 invoked by uid 0); 13 Feb 2019 07:41:51 -0000 X-TCPREMOTEIP: 81.173.50.109 X-Authenticated-UID: mike@milosoftware.com Received: from unknown (HELO mikebuntu.TOPIC.LOCAL) (mike@milosoftware.com@81.173.50.109) by 0 with ESMTPA; 13 Feb 2019 07:41:51 -0000 From: Mike Looijmans To: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, Mike Looijmans Subject: [PATCH v2] iio/gyro/bmg160: Use millidegrees for temperature scale Date: Wed, 13 Feb 2019 08:41:47 +0100 Message-Id: <1550043707-13040-1-git-send-email-mike.looijmans@topic.nl> X-Mailer: git-send-email 1.9.1 References: <1549981549-19786-1-git-send-email-mike.looijmans@topic.nl> In-Reply-To: <1549981549-19786-1-git-send-email-mike.looijmans@topic.nl> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Standard unit for temperature is millidegrees Celcius, whereas this driver was reporting in degrees. Fix the scale factor in the driver. Signed-off-by: Mike Looijmans --- v2: Don't touch val2 when returning IIO_VAL_INT Only touch val when returning a value drivers/iio/gyro/bmg160_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c index 63ca316..92c07ab 100644 --- a/drivers/iio/gyro/bmg160_core.c +++ b/drivers/iio/gyro/bmg160_core.c @@ -582,11 +582,10 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: return bmg160_get_filter(data, val); case IIO_CHAN_INFO_SCALE: - *val = 0; switch (chan->type) { case IIO_TEMP: - *val2 = 500000; - return IIO_VAL_INT_PLUS_MICRO; + *val = 500; + return IIO_VAL_INT; case IIO_ANGL_VEL: { int i; @@ -594,6 +593,7 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) { if (bmg160_scale_table[i].dps_range == data->dps_range) { + *val = 0; *val2 = bmg160_scale_table[i].scale; return IIO_VAL_INT_PLUS_MICRO; }