Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4854806imj; Wed, 13 Feb 2019 02:11:08 -0800 (PST) X-Google-Smtp-Source: AHgI3IYyyHJu0E0ut6W1Zt3D5PMehJA42SP2czJ0iOMYid5Mct+ht092iIdgh0cj5QsGIH+JKtsd X-Received: by 2002:a62:3c1:: with SMTP id 184mr8951001pfd.56.1550052668382; Wed, 13 Feb 2019 02:11:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550052668; cv=none; d=google.com; s=arc-20160816; b=zQKCL+T1stkWd7HwT4aE89e50d4uophs5EoJiS6fR3PKaZoKPfQ95L6LtZfxF9I9q6 Hi9AAlqXbpX7zj7TNJhPMJ59JQvwvF7CJ0Lmwkmb/oMf8li3giY7LJIfWn4KXJMZqTQG uWATMnYLbiiA6/D+bMQ1L0/AnBegbcwU+1JFp8Wi8Yt8Euj6w2gzQUChlOtcc+KyJXEf 366vEwEGKTJT98OllojVX1S+7vDlykrbiNqXyhdYlconzQHZm2Olxh0kzH0V9EXV08CL FD/c5onu+Ei4oIfs3KTwpbfWI7/sxIREDuXse1W96p3gIBSsll8bDphorNqgpETNGvpA 6oZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:references:message-id:date :subject:cc:to:from; bh=RDi7G3GApmW4VO46xxLS9qDd7jIgC4KLhtWe2oJQIU8=; b=k1LvYJgX0nYnCN/8/rweeCAisen4ZrpJNOIo1G3Hq+x07WAcYFj2Xjvex/7P5VZnY8 q2ZDbpp2npLm4vgcfn+NfXlVhOMG/XwcO3g6IAYF4NQXgfzt1eKAQtpjrffwt7ATLtLj 1DXcGExgdRm7DIay4DZ2X2cPurdCAMtJ+b2gYImYuay7khad9slErUrVe6pvdfep1zv+ OX5txdWmh9a9dCmUT0ReRZ0nbPD1ndYutiYpzhQGEBTNYZaTvQUJMcoAk0urIbrAY/+v xI2Svqnjxr3BD4w++ImetPEG+ExTOOQ1wyDTm44H/7wFePzpIOAOeZ+a3tOnEf0ConvS euYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20si7453628plo.360.2019.02.13.02.10.51; Wed, 13 Feb 2019 02:11:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388611AbfBMHly (ORCPT + 99 others); Wed, 13 Feb 2019 02:41:54 -0500 Received: from jax4mhob18.registeredsite.com ([64.69.218.106]:58458 "EHLO jax4mhob18.registeredsite.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728543AbfBMHly (ORCPT ); Wed, 13 Feb 2019 02:41:54 -0500 Received: from mailpod.hostingplatform.com ([10.30.71.206]) by jax4mhob18.registeredsite.com (8.14.4/8.14.4) with ESMTP id x1D7fp2K185975 (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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 1.9.1