Merge 'ib-jz47xx-battery-prereq' into psy-next
Merge immutable branch containing the IIO changes required for the new Ingenic JZ47xx battery fuel gauge driver. Signed-off-by: Sebastian Reichel <sre@kernel.org>
This commit is contained in:
commit
ec8242de40
|
@ -733,11 +733,11 @@ static int iio_channel_read_avail(struct iio_channel *chan,
|
|||
vals, type, length, info);
|
||||
}
|
||||
|
||||
int iio_read_avail_channel_raw(struct iio_channel *chan,
|
||||
const int **vals, int *length)
|
||||
int iio_read_avail_channel_attribute(struct iio_channel *chan,
|
||||
const int **vals, int *type, int *length,
|
||||
enum iio_chan_info_enum attribute)
|
||||
{
|
||||
int ret;
|
||||
int type;
|
||||
|
||||
mutex_lock(&chan->indio_dev->info_exist_lock);
|
||||
if (!chan->indio_dev->info) {
|
||||
|
@ -745,11 +745,23 @@ int iio_read_avail_channel_raw(struct iio_channel *chan,
|
|||
goto err_unlock;
|
||||
}
|
||||
|
||||
ret = iio_channel_read_avail(chan,
|
||||
vals, &type, length, IIO_CHAN_INFO_RAW);
|
||||
ret = iio_channel_read_avail(chan, vals, type, length, attribute);
|
||||
err_unlock:
|
||||
mutex_unlock(&chan->indio_dev->info_exist_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(iio_read_avail_channel_attribute);
|
||||
|
||||
int iio_read_avail_channel_raw(struct iio_channel *chan,
|
||||
const int **vals, int *length)
|
||||
{
|
||||
int ret;
|
||||
int type;
|
||||
|
||||
ret = iio_read_avail_channel_attribute(chan, vals, &type, length,
|
||||
IIO_CHAN_INFO_RAW);
|
||||
|
||||
if (ret >= 0 && type != IIO_VAL_INT)
|
||||
/* raw values are assumed to be IIO_VAL_INT */
|
||||
ret = -EINVAL;
|
||||
|
|
|
@ -290,6 +290,20 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val);
|
|||
int iio_read_avail_channel_raw(struct iio_channel *chan,
|
||||
const int **vals, int *length);
|
||||
|
||||
/**
|
||||
* iio_read_avail_channel_attribute() - read available channel attribute values
|
||||
* @chan: The channel being queried.
|
||||
* @vals: Available values read back.
|
||||
* @type: Type of values read back.
|
||||
* @length: Number of entries in vals.
|
||||
* @attribute: info attribute to be read back.
|
||||
*
|
||||
* Returns an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST.
|
||||
*/
|
||||
int iio_read_avail_channel_attribute(struct iio_channel *chan,
|
||||
const int **vals, int *type, int *length,
|
||||
enum iio_chan_info_enum attribute);
|
||||
|
||||
/**
|
||||
* iio_get_channel_type() - get the type of a channel
|
||||
* @channel: The channel being queried.
|
||||
|
|
Loading…
Reference in New Issue