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

Commit 1344779c authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "iio: support writing processed values to IIO channels" into msm-4.8

parents 1f7a4ceb d5c5b3f3
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -746,3 +746,21 @@ int iio_write_channel_raw(struct iio_channel *chan, int val)
	return ret;
}
EXPORT_SYMBOL_GPL(iio_write_channel_raw);

int iio_write_channel_processed(struct iio_channel *chan, int val)
{
	int ret;

	mutex_lock(&chan->indio_dev->info_exist_lock);
	if (chan->indio_dev->info == NULL) {
		ret = -ENODEV;
		goto err_unlock;
	}

	ret = iio_channel_write(chan, val, 0, IIO_CHAN_INFO_PROCESSED);
err_unlock:
	mutex_unlock(&chan->indio_dev->info_exist_lock);

	return ret;
}
EXPORT_SYMBOL_GPL(iio_write_channel_processed);
+10 −0
Original line number Diff line number Diff line
@@ -225,6 +225,16 @@ int iio_read_channel_processed(struct iio_channel *chan, int *val);
 */
int iio_write_channel_raw(struct iio_channel *chan, int val);

/**
 * iio_write_channel_processed() - write to a given channel
 * @chan:		The channel being queried.
 * @val:		Value being written.
 *
 * Note processed writes to iio channels are converted to raw
 * values before being written.
 */
int iio_write_channel_processed(struct iio_channel *chan, int val);

/**
 * iio_get_channel_type() - get the type of a channel
 * @channel:		The channel being queried.