summaryrefslogtreecommitdiffstats
path: root/drivers/iio/trigger
diff options
context:
space:
mode:
authorFabrice Gasnier <fabrice.gasnier@st.com>2017-08-03 11:22:17 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2017-08-20 15:21:47 +0100
commita359bb2a55f384bb93349ddf9d30b20b37e02e8a (patch)
tree35143eabceeb0d608417a179bb07c2964d818afa /drivers/iio/trigger
parentfdd0d32eb95f135041236a6885d9006315aa9a1d (diff)
downloadlinux-a359bb2a55f384bb93349ddf9d30b20b37e02e8a.tar.bz2
iio: trigger: stm32-timer: fix get trigger mode
Fix reading trigger mode, when other bit-fields are set. SMCR register value must be masked to read SMS (slave mode selection) only. Fixes: 9eba381 ("iio: make stm32 trigger driver use INDIO_HARDWARE_TRIGGERED mode") Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/trigger')
-rw-r--r--drivers/iio/trigger/stm32-timer-trigger.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/trigger/stm32-timer-trigger.c b/drivers/iio/trigger/stm32-timer-trigger.c
index 14e6eb04bbb0..25ad6abfee22 100644
--- a/drivers/iio/trigger/stm32-timer-trigger.c
+++ b/drivers/iio/trigger/stm32-timer-trigger.c
@@ -485,7 +485,7 @@ static int stm32_get_trigger_mode(struct iio_dev *indio_dev,
regmap_read(priv->regmap, TIM_SMCR, &smcr);
- return smcr == TIM_SMCR_SMS ? 0 : -EINVAL;
+ return (smcr & TIM_SMCR_SMS) == TIM_SMCR_SMS ? 0 : -EINVAL;
}
static const struct iio_enum stm32_trigger_mode_enum = {