Skip to content

Commit 02c34cc

Browse files
committed
Merge tag 'iio-for-4.5c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: Third set of new stuff for IIO in the 4.5 cycle. New driver features - us5182 * Add interrupt support and rising / falling threshold events. Cleanups / fixes to new stuff / minor additions * Expose the IIO value formatting function for drivers to make use of internally. - ina2xx * Fix wrong channel order * Fix incorrect reporting of endianness * Adding documentation of ABI unique to this device - mma8452 * Drop an unused register description * Use an enum for the channel index to aid readability - sca3000 * Use standard NULL comparison style - us5182 * fix an inconsistency in status of enable (a bug with no real effect until above patches are applied) * refactor the read_raw function to improve maintainability / readability.
2 parents 35ea984 + e8aab48 commit 02c34cc

File tree

7 files changed

+414
-103
lines changed

7 files changed

+414
-103
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
What: /sys/bus/iio/devices/iio:deviceX/in_allow_async_readout
2+
Date: December 2015
3+
KernelVersion: 4.4
4+
5+
Description:
6+
By default (value '0'), the capture thread checks for the Conversion
7+
Ready Flag to being set prior to committing a new value to the sample
8+
buffer. This synchronizes the in-chip conversion rate with the
9+
in-driver readout rate at the cost of an additional register read.
10+
11+
Writing '1' will remove the polling for the Conversion Ready Flags to
12+
save the additional i2c transaction, which will improve the bandwidth
13+
available for reading data. However, samples can be occasionally skipped
14+
or repeated, depending on the beat between the capture and conversion
15+
rates.
16+
17+
What: /sys/bus/iio/devices/iio:deviceX/in_shunt_resistor
18+
Date: December 2015
19+
KernelVersion: 4.4
20+
21+
Description:
22+
The value of the shunt resistor may be known only at runtime fom an
23+
eeprom content read by a client application. This attribute allows to
24+
set its value in ohms.

drivers/iio/accel/mma8452.c

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
#define MMA8452_FF_MT_COUNT 0x18
5959
#define MMA8452_TRANSIENT_CFG 0x1d
6060
#define MMA8452_TRANSIENT_CFG_HPF_BYP BIT(0)
61-
#define MMA8452_TRANSIENT_CFG_CHAN(chan) BIT(chan + 1)
6261
#define MMA8452_TRANSIENT_CFG_ELE BIT(4)
6362
#define MMA8452_TRANSIENT_SRC 0x1e
6463
#define MMA8452_TRANSIENT_SRC_XTRANSE BIT(1)
@@ -144,6 +143,13 @@ struct mma_chip_info {
144143
u8 ev_count;
145144
};
146145

146+
enum {
147+
idx_x,
148+
idx_y,
149+
idx_z,
150+
idx_ts,
151+
};
152+
147153
static int mma8452_drdy(struct mma8452_data *data)
148154
{
149155
int tries = 150;
@@ -817,31 +823,31 @@ static struct attribute_group mma8452_event_attribute_group = {
817823
}
818824

819825
static const struct iio_chan_spec mma8452_channels[] = {
820-
MMA8452_CHANNEL(X, 0, 12),
821-
MMA8452_CHANNEL(Y, 1, 12),
822-
MMA8452_CHANNEL(Z, 2, 12),
823-
IIO_CHAN_SOFT_TIMESTAMP(3),
826+
MMA8452_CHANNEL(X, idx_x, 12),
827+
MMA8452_CHANNEL(Y, idx_y, 12),
828+
MMA8452_CHANNEL(Z, idx_z, 12),
829+
IIO_CHAN_SOFT_TIMESTAMP(idx_ts),
824830
};
825831

826832
static const struct iio_chan_spec mma8453_channels[] = {
827-
MMA8452_CHANNEL(X, 0, 10),
828-
MMA8452_CHANNEL(Y, 1, 10),
829-
MMA8452_CHANNEL(Z, 2, 10),
830-
IIO_CHAN_SOFT_TIMESTAMP(3),
833+
MMA8452_CHANNEL(X, idx_x, 10),
834+
MMA8452_CHANNEL(Y, idx_y, 10),
835+
MMA8452_CHANNEL(Z, idx_z, 10),
836+
IIO_CHAN_SOFT_TIMESTAMP(idx_ts),
831837
};
832838

833839
static const struct iio_chan_spec mma8652_channels[] = {
834-
MMA8652_CHANNEL(X, 0, 12),
835-
MMA8652_CHANNEL(Y, 1, 12),
836-
MMA8652_CHANNEL(Z, 2, 12),
837-
IIO_CHAN_SOFT_TIMESTAMP(3),
840+
MMA8652_CHANNEL(X, idx_x, 12),
841+
MMA8652_CHANNEL(Y, idx_y, 12),
842+
MMA8652_CHANNEL(Z, idx_z, 12),
843+
IIO_CHAN_SOFT_TIMESTAMP(idx_ts),
838844
};
839845

840846
static const struct iio_chan_spec mma8653_channels[] = {
841-
MMA8652_CHANNEL(X, 0, 10),
842-
MMA8652_CHANNEL(Y, 1, 10),
843-
MMA8652_CHANNEL(Z, 2, 10),
844-
IIO_CHAN_SOFT_TIMESTAMP(3),
847+
MMA8652_CHANNEL(X, idx_x, 10),
848+
MMA8652_CHANNEL(Y, idx_y, 10),
849+
MMA8652_CHANNEL(Z, idx_z, 10),
850+
IIO_CHAN_SOFT_TIMESTAMP(idx_ts),
845851
};
846852

847853
enum {

drivers/iio/adc/ina2xx-adc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ static ssize_t ina2xx_shunt_resistor_store(struct device *dev,
400400
.sign = 'u', \
401401
.realbits = 16, \
402402
.storagebits = 16, \
403-
.endianness = IIO_LE, \
403+
.endianness = IIO_CPU, \
404404
} \
405405
}
406406

@@ -428,8 +428,8 @@ static ssize_t ina2xx_shunt_resistor_store(struct device *dev,
428428
static const struct iio_chan_spec ina2xx_channels[] = {
429429
INA2XX_CHAN_VOLTAGE(0, INA2XX_SHUNT_VOLTAGE),
430430
INA2XX_CHAN_VOLTAGE(1, INA2XX_BUS_VOLTAGE),
431-
INA2XX_CHAN(IIO_CURRENT, 2, INA2XX_CURRENT),
432-
INA2XX_CHAN(IIO_POWER, 3, INA2XX_POWER),
431+
INA2XX_CHAN(IIO_POWER, 2, INA2XX_POWER),
432+
INA2XX_CHAN(IIO_CURRENT, 3, INA2XX_CURRENT),
433433
IIO_CHAN_SOFT_TIMESTAMP(4),
434434
};
435435

drivers/iio/industrialio-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals)
470470
return 0;
471471
}
472472
}
473+
EXPORT_SYMBOL_GPL(iio_format_value);
473474

474475
static ssize_t iio_read_channel_info(struct device *dev,
475476
struct device_attribute *attr,

0 commit comments

Comments
 (0)