Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adis16480: fix devices that do not support sleep mode

Not all devices supported by this driver support being put to sleep
mode. For those devices, when calling 'adis16480_stop_device()' on the
unbind path, we where actually writing in the SYNC_SCALE register.

Fixes: 80cbc848c4fa0 ("iio: imu: adis16480: Add support for ADIS16490")
Fixes: 82e7a1b250170 ("iio: imu: adis16480: Add support for ADIS1649x family of devices")
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210903141423.517028-6-nuno.sa@analog.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Nuno Sá and committed by
Jonathan Cameron
ea1945c2 c2980c64

+11 -3
+11 -3
drivers/iio/imu/adis16480.c
··· 144 144 unsigned int max_dec_rate; 145 145 const unsigned int *filter_freqs; 146 146 bool has_pps_clk_mode; 147 + bool has_sleep_cnt; 147 148 const struct adis_data adis_data; 148 149 }; 149 150 ··· 940 939 .temp_scale = 5650, /* 5.65 milli degree Celsius */ 941 940 .int_clk = 2460000, 942 941 .max_dec_rate = 2048, 942 + .has_sleep_cnt = true, 943 943 .filter_freqs = adis16480_def_filter_freqs, 944 944 .adis_data = ADIS16480_DATA(16375, &adis16485_timeouts, 0), 945 945 }, ··· 954 952 .temp_scale = 5650, /* 5.65 milli degree Celsius */ 955 953 .int_clk = 2460000, 956 954 .max_dec_rate = 2048, 955 + .has_sleep_cnt = true, 957 956 .filter_freqs = adis16480_def_filter_freqs, 958 957 .adis_data = ADIS16480_DATA(16480, &adis16480_timeouts, 0), 959 958 }, ··· 968 965 .temp_scale = 5650, /* 5.65 milli degree Celsius */ 969 966 .int_clk = 2460000, 970 967 .max_dec_rate = 2048, 968 + .has_sleep_cnt = true, 971 969 .filter_freqs = adis16480_def_filter_freqs, 972 970 .adis_data = ADIS16480_DATA(16485, &adis16485_timeouts, 0), 973 971 }, ··· 982 978 .temp_scale = 5650, /* 5.65 milli degree Celsius */ 983 979 .int_clk = 2460000, 984 980 .max_dec_rate = 2048, 981 + .has_sleep_cnt = true, 985 982 .filter_freqs = adis16480_def_filter_freqs, 986 983 .adis_data = ADIS16480_DATA(16488, &adis16485_timeouts, 0), 987 984 }, ··· 1430 1425 if (ret) 1431 1426 return ret; 1432 1427 1433 - ret = devm_add_action_or_reset(&spi->dev, adis16480_stop, indio_dev); 1434 - if (ret) 1435 - return ret; 1428 + if (st->chip_info->has_sleep_cnt) { 1429 + ret = devm_add_action_or_reset(&spi->dev, adis16480_stop, 1430 + indio_dev); 1431 + if (ret) 1432 + return ret; 1433 + } 1436 1434 1437 1435 ret = adis16480_config_irq_pin(spi->dev.of_node, st); 1438 1436 if (ret)