mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 18:09:57 +00:00
iio: imu: inv_mpu6050: temperature only work with accel/gyro
Temperature sensor works correctly only when accel and/or gyro is turned on. Prevent polling value if they are not running. Anyway it doesn't make sense to use it without sensor engines on. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
4599cac846
commit
74a40e19f9
1 changed files with 5 additions and 0 deletions
|
@ -598,6 +598,11 @@ static int inv_mpu6050_read_channel_data(struct iio_dev *indio_dev,
|
|||
chan->channel2, val);
|
||||
break;
|
||||
case IIO_TEMP:
|
||||
/* temperature sensor work only with accel and/or gyro */
|
||||
if (!st->chip_config.accl_en && !st->chip_config.gyro_en) {
|
||||
result = -EBUSY;
|
||||
goto error_power_off;
|
||||
}
|
||||
if (!st->chip_config.temp_en) {
|
||||
result = inv_mpu6050_switch_engine(st, true,
|
||||
INV_MPU6050_SENSOR_TEMP);
|
||||
|
|
Loading…
Reference in a new issue