Skip to contentSkip to conversation

iio: gyro: fxas21002c: restrict available_scan_masks to all angular velocity channels

PATCH New Jonathan Cameron 1 participant 1 message Oct 23 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 29/39 iio: gyro: fxas21002c: restrict available_scan_masks to all angular velocity channels

fxas21002c_trigger_handler() always performs a single bulk read of all three angular velocity channels, regardless of which channels are actually enabled in indio_dev->active_scan_mask. Restrict available_scan_masks to the one valid combination of all three channels, so the IIO core demux can provide to buffer consumers only the channels they actually requested.

Fixes a0701b6263ae ("iio: gyro: add core driver for fxas21002c")
---
 drivers/iio/gyro/fxas21002c_core.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/iio/gyro/fxas21002c_core.c +6 -0
index a88670207cec..6ef3ba2bd1f8 100644
@@ -714,6 +714,11 @@ static const struct iio_chan_spec fxas21002c_channels[] = {
 	FXAS21002C_CHANNEL(Z),
 };
 
+static const unsigned long fxas21002c_scan_masks[] = {
+	BIT(CHANNEL_SCAN_INDEX_X) | BIT(CHANNEL_SCAN_INDEX_Y) | BIT(CHANNEL_SCAN_INDEX_Z),
+	0
+};
+
 static const struct iio_info fxas21002c_info = {
 	.attrs			= &fxas21002c_attrs_group,
 	.read_raw		= &fxas21002c_read_raw,
@@ -969,6 +974,7 @@ int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq,
 
 	indio_dev->channels = fxas21002c_channels;
 	indio_dev->num_channels = ARRAY_SIZE(fxas21002c_channels);
+	indio_dev->available_scan_masks = fxas21002c_scan_masks;
 	indio_dev->name = name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = &fxas21002c_info;
Signature · 1 line
2.43.0