diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-11 17:23:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-11 17:23:48 -0400 |
commit | 2afe669acdcea66d95b94bbcdc1412210ea218d6 (patch) | |
tree | 5a2f20b683bc065375aa3a31c47718711f611c14 | |
parent | 61c3dae670436131647c2f05a9ba3571503b79ff (diff) | |
parent | 72d508ad488a63678396cf1039fc5a65e04caa9e (diff) |
Merge tag 'staging-4.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull IIO fixes from Greg KH:
"Here are a few small IIO fixes for 4.8-rc6.
Nothing major, full details are in the shortlog, all of these have
been in linux-next with no reported issues"
* tag 'staging-4.8-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
iio:core: fix IIO_VAL_FRACTIONAL sign handling
iio: ensure ret is initialized to zero before entering do loop
iio: accel: kxsd9: Fix scaling bug
iio: accel: bmc150: reset chip at init time
iio: fix pressure data output unit in hid-sensor-attributes
tools:iio:iio_generic_buffer: fix trigger-less mode
-rw-r--r-- | drivers/iio/accel/bmc150-accel-core.c | 11 | ||||
-rw-r--r-- | drivers/iio/accel/kxsd9.c | 1 | ||||
-rw-r--r-- | drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 4 | ||||
-rw-r--r-- | drivers/iio/industrialio-buffer.c | 4 | ||||
-rw-r--r-- | drivers/iio/industrialio-core.c | 5 | ||||
-rw-r--r-- | tools/iio/iio_generic_buffer.c | 2 |
6 files changed, 19 insertions, 8 deletions
diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c index bf17aae66145..59b380dbf27f 100644 --- a/drivers/iio/accel/bmc150-accel-core.c +++ b/drivers/iio/accel/bmc150-accel-core.c | |||
@@ -67,6 +67,9 @@ | |||
67 | #define BMC150_ACCEL_REG_PMU_BW 0x10 | 67 | #define BMC150_ACCEL_REG_PMU_BW 0x10 |
68 | #define BMC150_ACCEL_DEF_BW 125 | 68 | #define BMC150_ACCEL_DEF_BW 125 |
69 | 69 | ||
70 | #define BMC150_ACCEL_REG_RESET 0x14 | ||
71 | #define BMC150_ACCEL_RESET_VAL 0xB6 | ||
72 | |||
70 | #define BMC150_ACCEL_REG_INT_MAP_0 0x19 | 73 | #define BMC150_ACCEL_REG_INT_MAP_0 0x19 |
71 | #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE BIT(2) | 74 | #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE BIT(2) |
72 | 75 | ||
@@ -1497,6 +1500,14 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data) | |||
1497 | int ret, i; | 1500 | int ret, i; |
1498 | unsigned int val; | 1501 | unsigned int val; |
1499 | 1502 | ||
1503 | /* | ||
1504 | * Reset chip to get it in a known good state. A delay of 1.8ms after | ||
1505 | * reset is required according to the data sheets of supported chips. | ||
1506 | */ | ||
1507 | regmap_write(data->regmap, BMC150_ACCEL_REG_RESET, | ||
1508 | BMC150_ACCEL_RESET_VAL); | ||
1509 | usleep_range(1800, 2500); | ||
1510 | |||
1500 | ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val); | 1511 | ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val); |
1501 | if (ret < 0) { | 1512 | if (ret < 0) { |
1502 | dev_err(dev, "Error: Reading chip id\n"); | 1513 | dev_err(dev, "Error: Reading chip id\n"); |
diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c index da5fb67ecb34..9d72d4bcf5e9 100644 --- a/drivers/iio/accel/kxsd9.c +++ b/drivers/iio/accel/kxsd9.c | |||
@@ -166,6 +166,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, | |||
166 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); | 166 | ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); |
167 | if (ret < 0) | 167 | if (ret < 0) |
168 | goto error_ret; | 168 | goto error_ret; |
169 | *val = 0; | ||
169 | *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; | 170 | *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; |
170 | ret = IIO_VAL_INT_PLUS_MICRO; | 171 | ret = IIO_VAL_INT_PLUS_MICRO; |
171 | break; | 172 | break; |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c index e81f434760f4..dc33c1dd5191 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c | |||
@@ -56,8 +56,8 @@ static struct { | |||
56 | {HID_USAGE_SENSOR_ALS, 0, 1, 0}, | 56 | {HID_USAGE_SENSOR_ALS, 0, 1, 0}, |
57 | {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0}, | 57 | {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0}, |
58 | 58 | ||
59 | {HID_USAGE_SENSOR_PRESSURE, 0, 100000, 0}, | 59 | {HID_USAGE_SENSOR_PRESSURE, 0, 100, 0}, |
60 | {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 1, 0}, | 60 | {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000}, |
61 | }; | 61 | }; |
62 | 62 | ||
63 | static int pow_10(unsigned power) | 63 | static int pow_10(unsigned power) |
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 49bf9c59f117..158aaf44dd95 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c | |||
@@ -110,7 +110,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, | |||
110 | DEFINE_WAIT_FUNC(wait, woken_wake_function); | 110 | DEFINE_WAIT_FUNC(wait, woken_wake_function); |
111 | size_t datum_size; | 111 | size_t datum_size; |
112 | size_t to_wait; | 112 | size_t to_wait; |
113 | int ret; | 113 | int ret = 0; |
114 | 114 | ||
115 | if (!indio_dev->info) | 115 | if (!indio_dev->info) |
116 | return -ENODEV; | 116 | return -ENODEV; |
@@ -153,7 +153,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, | |||
153 | ret = rb->access->read_first_n(rb, n, buf); | 153 | ret = rb->access->read_first_n(rb, n, buf); |
154 | if (ret == 0 && (filp->f_flags & O_NONBLOCK)) | 154 | if (ret == 0 && (filp->f_flags & O_NONBLOCK)) |
155 | ret = -EAGAIN; | 155 | ret = -EAGAIN; |
156 | } while (ret == 0); | 156 | } while (ret == 0); |
157 | remove_wait_queue(&rb->pollq, &wait); | 157 | remove_wait_queue(&rb->pollq, &wait); |
158 | 158 | ||
159 | return ret; | 159 | return ret; |
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index f914d5d140e4..d2b889918c3e 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c | |||
@@ -613,9 +613,8 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals) | |||
613 | return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); | 613 | return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); |
614 | case IIO_VAL_FRACTIONAL: | 614 | case IIO_VAL_FRACTIONAL: |
615 | tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]); | 615 | tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]); |
616 | vals[1] = do_div(tmp, 1000000000LL); | 616 | vals[0] = (int)div_s64_rem(tmp, 1000000000, &vals[1]); |
617 | vals[0] = tmp; | 617 | return sprintf(buf, "%d.%09u\n", vals[0], abs(vals[1])); |
618 | return sprintf(buf, "%d.%09u\n", vals[0], vals[1]); | ||
619 | case IIO_VAL_FRACTIONAL_LOG2: | 618 | case IIO_VAL_FRACTIONAL_LOG2: |
620 | tmp = (s64)vals[0] * 1000000000LL >> vals[1]; | 619 | tmp = (s64)vals[0] * 1000000000LL >> vals[1]; |
621 | vals[1] = do_div(tmp, 1000000000LL); | 620 | vals[1] = do_div(tmp, 1000000000LL); |
diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c index ae68bf0e2d51..f39c0e9c0d5c 100644 --- a/tools/iio/iio_generic_buffer.c +++ b/tools/iio/iio_generic_buffer.c | |||
@@ -456,7 +456,7 @@ int main(int argc, char **argv) | |||
456 | 456 | ||
457 | if (notrigger) { | 457 | if (notrigger) { |
458 | printf("trigger-less mode selected\n"); | 458 | printf("trigger-less mode selected\n"); |
459 | } if (trig_num >= 0) { | 459 | } else if (trig_num >= 0) { |
460 | char *trig_dev_name; | 460 | char *trig_dev_name; |
461 | ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num); | 461 | ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num); |
462 | if (ret < 0) { | 462 | if (ret < 0) { |