Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03af03ad authored by Karol Wrona's avatar Karol Wrona Committed by Jonathan Cameron
Browse files

iio: Add new operating mode for non triggered sw buffers



There was a need for non triggered software buffer type.  It can be used when
triggered model does not fit and INDIO_BUFFER_HARDWARE causes confusion because
the data stream can be obtained not directly form hardware backend.

Suggested-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarKarol Wrona <k.wrona@samsung.com>
Reviewed-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent ab80496a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -639,6 +639,8 @@ static int __iio_update_buffers(struct iio_dev *indio_dev,
		indio_dev->currentmode = INDIO_BUFFER_TRIGGERED;
	} else if (indio_dev->modes & INDIO_BUFFER_HARDWARE) {
		indio_dev->currentmode = INDIO_BUFFER_HARDWARE;
	} else if (indio_dev->modes & INDIO_BUFFER_SOFTWARE) {
		indio_dev->currentmode = INDIO_BUFFER_SOFTWARE;
	} else { /* Should never be reached */
		ret = -EINVAL;
		goto error_run_postdisable;
+4 −2
Original line number Diff line number Diff line
@@ -286,10 +286,11 @@ static inline s64 iio_get_time_ns(void)
/* Device operating modes */
#define INDIO_DIRECT_MODE		0x01
#define INDIO_BUFFER_TRIGGERED		0x02
#define INDIO_BUFFER_SOFTWARE		0x04
#define INDIO_BUFFER_HARDWARE		0x08

#define INDIO_ALL_BUFFER_MODES					\
	(INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
	(INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE)

#define INDIO_MAX_RAW_ELEMENTS		4

@@ -593,7 +594,8 @@ void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig);
static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
{
	return indio_dev->currentmode
		& (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
		& (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE |
		   INDIO_BUFFER_SOFTWARE);
}

/**