History

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

Linus Torvalds committed 10 years ago

Commit 2afe6692 parents 61c3dae 72d508a6 files · +19 −8Browse files

Unified · Split

6 files
  1. drivers/iio/accel/bmc150-accel-core.c +11 −0
  2. drivers/iio/accel/kxsd9.c +1 −0
  3. drivers/iio/common/hid-sensors/hid-sensor-attributes.c +2 −2
  4. drivers/iio/industrialio-buffer.c +2 −2
  5. drivers/iio/industrialio-core.c +2 −3
  6. tools/iio/iio_generic_buffer.c +1 −1
drivers/iio/accel/bmc150-accel-core.c+11−0
@@ -67,6 +67,9 @@ · 66 unmodified lines
6767 #define BMC150_ACCEL_REG_PMU_BW 0x10
6868 #define BMC150_ACCEL_DEF_BW 125
6969
70+#define BMC150_ACCEL_REG_RESET 0x14
71+#define BMC150_ACCEL_RESET_VAL 0xB6
72+
7073 #define BMC150_ACCEL_REG_INT_MAP_0 0x19
7174 #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE BIT(2)
7275
@@ -1497,6 +1500,14 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data) · 1424 unmodified lines
14971500 int ret, i;
14981501 unsigned int val;
14991502
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+
15001511 ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val);
15011512 if (ret < 0) {
15021513 dev_err(dev, "Error: Reading chip id\n");
drivers/iio/accel/kxsd9.c+1−0
@@ -166,6 +166,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, · 165 unmodified lines
166166 ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
167167 if (ret < 0)
168168 goto error_ret;
169+ *val = 0;
169170 *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK];
170171 ret = IIO_VAL_INT_PLUS_MICRO;
171172 break;
drivers/iio/common/hid-sensors/hid-sensor-attributes.c+2−2
@@ -56,8 +56,8 @@ static struct { · 55 unmodified lines
5656 {HID_USAGE_SENSOR_ALS, 0, 1, 0},
5757 {HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0},
5858
59− {HID_USAGE_SENSOR_PRESSURE, 0, 100000, 0},
60− {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 1, 0},
59+ {HID_USAGE_SENSOR_PRESSURE, 0, 100, 0},
60+ {HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000},
6161 };
6262
6363 static int pow_10(unsigned power)
drivers/iio/industrialio-buffer.c+2−2
@@ -110,7 +110,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, · 109 unmodified lines
110110 DEFINE_WAIT_FUNC(wait, woken_wake_function);
111111 size_t datum_size;
112112 size_t to_wait;
113− int ret;
113+ int ret = 0;
114114
115115 if (!indio_dev->info)
116116 return -ENODEV;
@@ -153,7 +153,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, · 36 unmodified lines
153153 ret = rb->access->read_first_n(rb, n, buf);
154154 if (ret == 0 && (filp->f_flags & O_NONBLOCK))
155155 ret = -EAGAIN;
156− } while (ret == 0);
156+ } while (ret == 0);
157157 remove_wait_queue(&rb->pollq, &wait);
158158
159159 return ret;
drivers/iio/industrialio-core.c+2−3
@@ -613,9 +613,8 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals) · 612 unmodified lines
613613 return sprintf(buf, "%d.%09u\n", vals[0], vals[1]);
614614 case IIO_VAL_FRACTIONAL:
615615 tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]);
616− vals[1] = do_div(tmp, 1000000000LL);
617− vals[0] = tmp;
618− return sprintf(buf, "%d.%09u\n", vals[0], vals[1]);
616+ vals[0] = (int)div_s64_rem(tmp, 1000000000, &vals[1]);
617+ return sprintf(buf, "%d.%09u\n", vals[0], abs(vals[1]));
619618 case IIO_VAL_FRACTIONAL_LOG2:
620619 tmp = (s64)vals[0] * 1000000000LL >> vals[1];
621620 vals[1] = do_div(tmp, 1000000000LL);
tools/iio/iio_generic_buffer.c+1−1
@@ -456,7 +456,7 @@ int main(int argc, char **argv) · 455 unmodified lines
456456
457457 if (notrigger) {
458458 printf("trigger-less mode selected\n");
459− } if (trig_num >= 0) {
459+ } else if (trig_num >= 0) {
460460 char *trig_dev_name;
461461 ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num);
462462 if (ret < 0) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t