summaryrefslogtreecommitdiff
path: root/drivers/iio/imu
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-03 15:29:12 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-03 15:29:12 +0200
commitedf5e79422a9dd98fb896606124edd8407d97d70 (patch)
treef7d2921071b0e1858a484c66bbc643b40e3b62e2 /drivers/iio/imu
parenta2e99e97393187a72b827b2e9880b9e4516b0893 (diff)
parent2ccc15036d812e75f334c0fb813104ef765a2c77 (diff)
Merge tag 'iio-for-4.12c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Third set of new device support, cleanups and features for IIO in the 4.12 cycle Somewhat dominated in patch numbers of last of the outreachy application window related patches (they are still coming, despite window being closed which is good to see!) Good set of new drivers as well. New device support * ASPEED ADC - new driver * cpcap PMIC ADC - new driver * hid-humidity - driver for HID compatible humidity sensors. * ltc2497 ADC - new driver * mpu6050 - bring bindings up to date and add trivial support for 9250 * rockchip-saradc - update bindings to cover rk3328 * vl6180 light, proximity and time of flight sensor. - new driver Features * meson-saradc - add calibration Cleanup and minor fixes * ad5504 - constify attribute_group structure - drop casting of void * * ad7150 - replace some shifts of 1 by BIT macro usage * ad7152 - blank lines between function definitions * ad7280a - octal permissions. * ad7606 - replace use of core mlock mutex with a local lock * ad7746 - replace some shifts of 1 by BIT macro usage - function parameter alignment - drop some excessive brackets (introduced in last pull request) * ad7753 - white space cleanup * ad7754 - includes in alphabetical order and groupped appropriately. - change from missuse of internal mlock mutex to using the buffer lock to also protect values during frequency update. * ad779x - constify attribute_group structures * ad9832 - octal permissions * adis16060 - remove use of core mlock mutex in favour of adding a local _spi_write_then_read which can use the local buffer protection lock. - fix naming of above function. * adis16203 - remove locking during reads of calibbias that doesn't protect anything not protected elsewhere. * adis16209 - remove unnecessary braces in single statement if * adis16240 - remove unnecessary braces in single statement if * adt7136 - drop excess blank lines and put some in between functions. * ams-iaq - replace comma with semi colon. Not actual bug, just unusual syntax. * apds9960 - constify attribute group structure * as3935 - constify attribute group structure * bm1750 - constify attribute group structure * cros_ec - devm version of triggered buffer setup to simplify code. * exynos - drop casting of void * * hdc100x - constify attribute_group structure * hid-accel - fix wrong scale for newly introduced gravity sensor. * hts221 - drop casting of void * * hx711 - constify attribute_group structure * imx7d_adc - drop casting of void * * lm35333 - constify attribute_group structure * lsm6dsx - drop casting of void * - hold ODR configuration until enabling to avoid a race condition. * max1027 - drop casting of void * * max11100 - fix a comma where semicolon was intended (no actual bug, just odd) * max1363 - constify attribute_group structure * ms sensors - drop casting of void * * rockchip_saradc - drop casting of void * * sun4i-gpadc - fix missing dependency on THERMAL or presence of stubs (issue only introduced in pervious set) - drop casting of void * * tsl2x7x - fix wrong standard deviation calc. Note these aren't actually used for anything at the moment so bug didn't really matter. - constify attribute group structure. * vf610adc - drop casting of void * * vz89x - replace comma with semicolon. Not actual bug, just odd syntax. * zpa2326 - drop casting of void *
Diffstat (limited to 'drivers/iio/imu')
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_core.c6
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c5
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h2
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c1
-rw-r--r--drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c4
-rw-r--r--drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c41
6 files changed, 42 insertions, 17 deletions
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index b9fcbf18aa99..96dabbd2f004 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -114,6 +114,12 @@ static const struct inv_mpu6050_hw hw_info[] = {
.config = &chip_config_6050,
},
{
+ .whoami = INV_MPU9250_WHOAMI_VALUE,
+ .name = "MPU9250",
+ .reg = &reg_set_6500,
+ .config = &chip_config_6050,
+ },
+ {
.whoami = INV_ICM20608_WHOAMI_VALUE,
.name = "ICM20608",
.reg = &reg_set_6500,
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
index a8e6330cb906..64b5f5b92200 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
@@ -178,6 +178,7 @@ static const struct i2c_device_id inv_mpu_id[] = {
{"mpu6050", INV_MPU6050},
{"mpu6500", INV_MPU6500},
{"mpu9150", INV_MPU9150},
+ {"mpu9250", INV_MPU9250},
{"icm20608", INV_ICM20608},
{}
};
@@ -198,6 +199,10 @@ static const struct of_device_id inv_of_match[] = {
.data = (void *)INV_MPU9150
},
{
+ .compatible = "invensense,mpu9250",
+ .data = (void *)INV_MPU9250
+ },
+ {
.compatible = "invensense,icm20608",
.data = (void *)INV_ICM20608
},
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
index f0e8c5dd9fae..ef13de7a2c20 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
@@ -70,6 +70,7 @@ enum inv_devices {
INV_MPU6500,
INV_MPU6000,
INV_MPU9150,
+ INV_MPU9250,
INV_ICM20608,
INV_NUM_PARTS
};
@@ -226,6 +227,7 @@ struct inv_mpu6050_state {
#define INV_MPU6050_WHOAMI_VALUE 0x68
#define INV_MPU6500_WHOAMI_VALUE 0x70
#define INV_MPU9150_WHOAMI_VALUE 0x68
+#define INV_MPU9250_WHOAMI_VALUE 0x71
#define INV_ICM20608_WHOAMI_VALUE 0xAF
/* scan element definition */
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
index 6e6476dfa188..74506e5ac0db 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
@@ -82,6 +82,7 @@ static const struct spi_device_id inv_mpu_id[] = {
{"mpu6000", INV_MPU6000},
{"mpu6500", INV_MPU6500},
{"mpu9150", INV_MPU9150},
+ {"mpu9250", INV_MPU9250},
{"icm20608", INV_ICM20608},
{}
};
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index e95982590373..c8e5cfd0ef0b 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -364,7 +364,7 @@ static int st_lsm6dsx_update_fifo(struct iio_dev *iio_dev, bool enable)
static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
{
- struct st_lsm6dsx_hw *hw = (struct st_lsm6dsx_hw *)private;
+ struct st_lsm6dsx_hw *hw = private;
struct st_lsm6dsx_sensor *sensor;
int i;
@@ -388,7 +388,7 @@ static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)
{
- struct st_lsm6dsx_hw *hw = (struct st_lsm6dsx_hw *)private;
+ struct st_lsm6dsx_hw *hw = private;
int count;
mutex_lock(&hw->fifo_lock);
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index c4332232ad71..f80a3d4ff977 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -308,32 +308,40 @@ static int st_lsm6dsx_set_full_scale(struct st_lsm6dsx_sensor *sensor,
return 0;
}
-static int st_lsm6dsx_set_odr(struct st_lsm6dsx_sensor *sensor, u16 odr)
+static int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u16 odr,
+ u8 *val)
{
- enum st_lsm6dsx_sensor_id id = sensor->id;
- int i, err;
- u8 val;
+ int i;
for (i = 0; i < ST_LSM6DSX_ODR_LIST_SIZE; i++)
- if (st_lsm6dsx_odr_table[id].odr_avl[i].hz == odr)
+ if (st_lsm6dsx_odr_table[sensor->id].odr_avl[i].hz == odr)
break;
if (i == ST_LSM6DSX_ODR_LIST_SIZE)
return -EINVAL;
- val = st_lsm6dsx_odr_table[id].odr_avl[i].val;
- err = st_lsm6dsx_write_with_mask(sensor->hw,
- st_lsm6dsx_odr_table[id].reg.addr,
- st_lsm6dsx_odr_table[id].reg.mask,
- val);
- if (err < 0)
- return err;
-
+ *val = st_lsm6dsx_odr_table[sensor->id].odr_avl[i].val;
sensor->odr = odr;
return 0;
}
+static int st_lsm6dsx_set_odr(struct st_lsm6dsx_sensor *sensor, u16 odr)
+{
+ enum st_lsm6dsx_sensor_id id = sensor->id;
+ int err;
+ u8 val;
+
+ err = st_lsm6dsx_check_odr(sensor, odr, &val);
+ if (err < 0)
+ return err;
+
+ return st_lsm6dsx_write_with_mask(sensor->hw,
+ st_lsm6dsx_odr_table[id].reg.addr,
+ st_lsm6dsx_odr_table[id].reg.mask,
+ val);
+}
+
int st_lsm6dsx_sensor_enable(struct st_lsm6dsx_sensor *sensor)
{
int err;
@@ -436,9 +444,12 @@ static int st_lsm6dsx_write_raw(struct iio_dev *iio_dev,
case IIO_CHAN_INFO_SCALE:
err = st_lsm6dsx_set_full_scale(sensor, val2);
break;
- case IIO_CHAN_INFO_SAMP_FREQ:
- err = st_lsm6dsx_set_odr(sensor, val);
+ case IIO_CHAN_INFO_SAMP_FREQ: {
+ u8 data;
+
+ err = st_lsm6dsx_check_odr(sensor, val, &data);
break;
+ }
default:
err = -EINVAL;
break;