From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>,
Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH 3.14 08/29] iio: adis16480: Fix scale factors
Date: Sat, 19 Sep 2015 10:27:30 -0700 [thread overview]
Message-ID: <20150919171918.524703809@linuxfoundation.org> (raw)
In-Reply-To: <20150919171918.169368855@linuxfoundation.org>
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <lars@metafoo.de>
commit 7abad1063deb0f77d275c61f58863ec319c58c5c upstream.
The different devices support by the adis16480 driver have slightly
different scales for the gyroscope and accelerometer channels.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/iio/imu/adis16480.c | 39 +++++++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 6 deletions(-)
--- a/drivers/iio/imu/adis16480.c
+++ b/drivers/iio/imu/adis16480.c
@@ -110,6 +110,10 @@
struct adis16480_chip_info {
unsigned int num_channels;
const struct iio_chan_spec *channels;
+ unsigned int gyro_max_val;
+ unsigned int gyro_max_scale;
+ unsigned int accel_max_val;
+ unsigned int accel_max_scale;
};
struct adis16480 {
@@ -533,19 +537,21 @@ static int adis16480_set_filter_freq(str
static int adis16480_read_raw(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, int *val, int *val2, long info)
{
+ struct adis16480 *st = iio_priv(indio_dev);
+
switch (info) {
case IIO_CHAN_INFO_RAW:
return adis_single_conversion(indio_dev, chan, 0, val);
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_ANGL_VEL:
- *val = 0;
- *val2 = IIO_DEGREE_TO_RAD(20000); /* 0.02 degree/sec */
- return IIO_VAL_INT_PLUS_MICRO;
+ *val = st->chip_info->gyro_max_scale;
+ *val2 = st->chip_info->gyro_max_val;
+ return IIO_VAL_FRACTIONAL;
case IIO_ACCEL:
- *val = 0;
- *val2 = IIO_G_TO_M_S_2(800); /* 0.8 mg */
- return IIO_VAL_INT_PLUS_MICRO;
+ *val = st->chip_info->accel_max_scale;
+ *val2 = st->chip_info->accel_max_val;
+ return IIO_VAL_FRACTIONAL;
case IIO_MAGN:
*val = 0;
*val2 = 100; /* 0.0001 gauss */
@@ -702,18 +708,39 @@ static const struct adis16480_chip_info
[ADIS16375] = {
.channels = adis16485_channels,
.num_channels = ARRAY_SIZE(adis16485_channels),
+ /*
+ * storing the value in rad/degree and the scale in degree
+ * gives us the result in rad and better precession than
+ * storing the scale directly in rad.
+ */
+ .gyro_max_val = IIO_RAD_TO_DEGREE(22887),
+ .gyro_max_scale = 300,
+ .accel_max_val = IIO_M_S_2_TO_G(21973),
+ .accel_max_scale = 18,
},
[ADIS16480] = {
.channels = adis16480_channels,
.num_channels = ARRAY_SIZE(adis16480_channels),
+ .gyro_max_val = IIO_RAD_TO_DEGREE(22500),
+ .gyro_max_scale = 450,
+ .accel_max_val = IIO_M_S_2_TO_G(12500),
+ .accel_max_scale = 5,
},
[ADIS16485] = {
.channels = adis16485_channels,
.num_channels = ARRAY_SIZE(adis16485_channels),
+ .gyro_max_val = IIO_RAD_TO_DEGREE(22500),
+ .gyro_max_scale = 450,
+ .accel_max_val = IIO_M_S_2_TO_G(20000),
+ .accel_max_scale = 5,
},
[ADIS16488] = {
.channels = adis16480_channels,
.num_channels = ARRAY_SIZE(adis16480_channels),
+ .gyro_max_val = IIO_RAD_TO_DEGREE(22500),
+ .gyro_max_scale = 450,
+ .accel_max_val = IIO_M_S_2_TO_G(22500),
+ .accel_max_scale = 18,
},
};
next prev parent reply other threads:[~2015-09-19 17:28 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-19 17:27 [PATCH 3.14 00/29] 3.14.53-stable review Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 01/29] DRM - radeon: Dont link train DisplayPort on HPD until we get the dpcd Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 02/29] drm/qxl: validate monitors config modes Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 03/29] s390/sclp: fix compile error Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 04/29] iio: bmg160: IIO_BUFFER and IIO_TRIGGERED_BUFFER are required Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 05/29] iio: event: Remove negative error code from iio_event_poll Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 06/29] iio: industrialio-buffer: Fix iio_buffer_poll return value Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 07/29] iio: Add inverse unit conversion macros Greg Kroah-Hartman
2015-09-19 17:27 ` Greg Kroah-Hartman [this message]
2015-09-19 17:27 ` [PATCH 3.14 09/29] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230 Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 10/29] clk: versatile: off by one in clk_sp810_timerclken_of_get() Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 11/29] PCI: Fix TI816X class code quirk Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 12/29] USB: symbolserial: Use usb_get_serial_port_data Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 13/29] USB: ftdi_sio: Added custom PID for CustomWare products Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 14/29] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 15/29] usb: host: ehci-sys: delete useless bus_to_hcd conversion Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 16/29] serial: 8250: dont bind to SMSC IrCC IR port Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 17/29] crypto: ghash-clmulni: specify context size for ghash async algorithm Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 18/29] HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 19/29] KVM: MMU: fix validation of mmio page fault Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 20/29] xtensa: fix threadptr reload on return to userspace Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 21/29] xtensa: fix kernel register spilling Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 22/29] devres: fix devres_get() Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 23/29] Doc: ABI: testing: configfs-usb-gadget-loopback Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 24/29] Doc: ABI: testing: configfs-usb-gadget-sourcesink Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 25/29] auxdisplay: ks0108: fix refcount Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 26/29] of/address: Dont loop forever in of_find_matching_node_by_address() Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 27/29] ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 28/29] drivercore: Fix unregistration path of platform devices Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.14 29/29] hpfs: update ctime and mtime on directory modification Greg Kroah-Hartman
2015-09-20 0:19 ` [PATCH 3.14 00/29] 3.14.53-stable review Guenter Roeck
2015-09-21 1:44 ` Greg Kroah-Hartman
2015-09-21 7:08 ` Sudip Mukherjee
2015-09-21 16:24 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150919171918.524703809@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).