Commit 90354d00 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:light Add IIO_CHAN_INFO_RAW/PROCESSED entries to all drivers.

Precursor to making value read / write attribute optional.
Note that minimal change route taken here. The read_raw callbacks
in both drivers could do fewer checks to identify the channel than
they now do.
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a5d016d4
...@@ -383,7 +383,8 @@ static int isl29018_read_raw(struct iio_dev *indio_dev, ...@@ -383,7 +383,8 @@ static int isl29018_read_raw(struct iio_dev *indio_dev,
mutex_lock(&chip->lock); mutex_lock(&chip->lock);
switch (mask) { switch (mask) {
case 0: case IIO_CHAN_INFO_RAW:
case IIO_CHAN_INFO_PROCESSED:
switch (chan->type) { switch (chan->type) {
case IIO_LIGHT: case IIO_LIGHT:
ret = isl29018_read_lux(client, val); ret = isl29018_read_lux(client, val);
...@@ -420,14 +421,17 @@ static const struct iio_chan_spec isl29018_channels[] = { ...@@ -420,14 +421,17 @@ static const struct iio_chan_spec isl29018_channels[] = {
.indexed = 1, .indexed = 1,
.channel = 0, .channel = 0,
.processed_val = IIO_PROCESSED, .processed_val = IIO_PROCESSED,
.info_mask = IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT, .info_mask = IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT |
IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT,
}, { }, {
.type = IIO_INTENSITY, .type = IIO_INTENSITY,
.modified = 1, .modified = 1,
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT,
.channel2 = IIO_MOD_LIGHT_IR, .channel2 = IIO_MOD_LIGHT_IR,
}, { }, {
/* Unindexed in current ABI. But perhaps it should be. */ /* Unindexed in current ABI. But perhaps it should be. */
.type = IIO_PROXIMITY, .type = IIO_PROXIMITY,
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT,
} }
}; };
......
...@@ -485,7 +485,8 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev, ...@@ -485,7 +485,8 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
mutex_lock(&chip->lock); mutex_lock(&chip->lock);
switch (m) { switch (m) {
case 0: case IIO_CHAN_INFO_RAW:
case IIO_CHAN_INFO_PROCESSED:
switch (chan->type) { switch (chan->type) {
case IIO_LIGHT: case IIO_LIGHT:
ret = tsl2563_get_adc(chip); ret = tsl2563_get_adc(chip);
...@@ -535,12 +536,14 @@ static const struct iio_chan_spec tsl2563_channels[] = { ...@@ -535,12 +536,14 @@ static const struct iio_chan_spec tsl2563_channels[] = {
.type = IIO_LIGHT, .type = IIO_LIGHT,
.indexed = 1, .indexed = 1,
.processed_val = 1, .processed_val = 1,
.info_mask = IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT,
.channel = 0, .channel = 0,
}, { }, {
.type = IIO_INTENSITY, .type = IIO_INTENSITY,
.modified = 1, .modified = 1,
.channel2 = IIO_MOD_LIGHT_BOTH, .channel2 = IIO_MOD_LIGHT_BOTH,
.info_mask = IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT,
.event_mask = (IIO_EV_BIT(IIO_EV_TYPE_THRESH, .event_mask = (IIO_EV_BIT(IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING) | IIO_EV_DIR_RISING) |
IIO_EV_BIT(IIO_EV_TYPE_THRESH, IIO_EV_BIT(IIO_EV_TYPE_THRESH,
...@@ -549,7 +552,8 @@ static const struct iio_chan_spec tsl2563_channels[] = { ...@@ -549,7 +552,8 @@ static const struct iio_chan_spec tsl2563_channels[] = {
.type = IIO_INTENSITY, .type = IIO_INTENSITY,
.modified = 1, .modified = 1,
.channel2 = IIO_MOD_LIGHT_IR, .channel2 = IIO_MOD_LIGHT_IR,
.info_mask = IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT,
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment