mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 05:04:09 +08:00
Second set of IIO fixes for the 4.8 cycle.
We have a big rework of the kxsd9 driver queued up behind the fix below and a fix for a recent fix that was marked for stable. Hence this fix series is perhaps a little more urgent than average for IIO. * core - a fix for a fix in the last set. The recent fix for blocking ops when ! task running left a path (unlikely one) in which the function return value was not set - so initialise it to 0. - The IIO_TYPE_FRACTIONAL code previously didn't cope with negative fractions. Turned out a fix for this was in Analog's tree but hadn't made it upstream. * bmc150 - reset chip at init time. At least one board out there ends up coming up in an unstable state due to noise during power up. The reset does no harm on other boards. * kxsd9 - Fix a bug in the reported scaling due to failing to set the integer part to 0. * hid-sensors-pressure - Output was in the wrong units to comply with the IIO ABI. * tools - iio_generic_buffer: Fix the trigger-less mode by ensuring we don't fault out for having no trigger when we explicitly said we didn't want to have one. -----BEGIN PGP SIGNATURE----- iQIuBAABCAAYBQJX0GOMERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaI2rwQ AIA4M6uKqsdLLdmjT3bB1mGuXedGzwrvSObEvTGKEi/LDFreKsnqmjAlltuo7kwl RxBXOOwb9Is3HccGEsFFWBNaMEKaW0ZoH9n0dn7VdlGThloKxE57S386GUGKT0Xq tKNHbw7ITO+UIC1CvavmFsNk5Qe7AMiSNTnlBizcVrfdtbX91aqRe4X3fP8X1kFv zcE/sbip9tjKwrXTsZ5/D4FCAtKjkamouv3tZHsp/qwhUQ9AJwklw0pySVgi+Ou1 3xzFwVATrH5bMK0JGwKts7zaMRvrbaf4CRdHhSLUXqmSYCYiN7THFnb/xD1nbFAy AMsHDeXDs30cQD+Wiks9oNqf37EkcMBEsYpoFvoFE3xcVdX6NTs9ZRpGe+xizB1u yI+Howt9sb4CcdPBtpPb3ffKK9X2ccPT+q1J8OpNlwZH/yta4wogFt8eKZlvdPtc pHstwHUvv+s5EXYI8266DIkd9ErRI2+13v08rBwex1C8S0Xt5qQFOe/k7a5wzn2O /DNUQ/mfOXJinxbt1aBakn2PFoMjyNWEXua7haW3pbr+fpUsZTN/MT57p2W3E4Ak PfZxvHARW0MY3ShKpRmwzhrzmddGWZYb07xOtcoktHt2esV9MLUQLCUlDPaLk2H5 gUzvzEDQQJpyj+SmxAyEejeoZWMWIIW4dfoxBCU1iSF+ =Ob6a -----END PGP SIGNATURE----- Merge tag 'iio-fixes-for-4.8b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus Jonathan writes: Second set of IIO fixes for the 4.8 cycle. We have a big rework of the kxsd9 driver queued up behind the fix below and a fix for a recent fix that was marked for stable. Hence this fix series is perhaps a little more urgent than average for IIO. * core - a fix for a fix in the last set. The recent fix for blocking ops when ! task running left a path (unlikely one) in which the function return value was not set - so initialise it to 0. - The IIO_TYPE_FRACTIONAL code previously didn't cope with negative fractions. Turned out a fix for this was in Analog's tree but hadn't made it upstream. * bmc150 - reset chip at init time. At least one board out there ends up coming up in an unstable state due to noise during power up. The reset does no harm on other boards. * kxsd9 - Fix a bug in the reported scaling due to failing to set the integer part to 0. * hid-sensors-pressure - Output was in the wrong units to comply with the IIO ABI. * tools - iio_generic_buffer: Fix the trigger-less mode by ensuring we don't fault out for having no trigger when we explicitly said we didn't want to have one.
This commit is contained in:
commit
72d508ad48
@ -67,6 +67,9 @@
|
||||
#define BMC150_ACCEL_REG_PMU_BW 0x10
|
||||
#define BMC150_ACCEL_DEF_BW 125
|
||||
|
||||
#define BMC150_ACCEL_REG_RESET 0x14
|
||||
#define BMC150_ACCEL_RESET_VAL 0xB6
|
||||
|
||||
#define BMC150_ACCEL_REG_INT_MAP_0 0x19
|
||||
#define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE BIT(2)
|
||||
|
||||
@ -1497,6 +1500,14 @@ static int bmc150_accel_chip_init(struct bmc150_accel_data *data)
|
||||
int ret, i;
|
||||
unsigned int val;
|
||||
|
||||
/*
|
||||
* Reset chip to get it in a known good state. A delay of 1.8ms after
|
||||
* reset is required according to the data sheets of supported chips.
|
||||
*/
|
||||
regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
|
||||
BMC150_ACCEL_RESET_VAL);
|
||||
usleep_range(1800, 2500);
|
||||
|
||||
ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID, &val);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Error: Reading chip id\n");
|
||||
|
@ -166,6 +166,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev,
|
||||
ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
|
||||
if (ret < 0)
|
||||
goto error_ret;
|
||||
*val = 0;
|
||||
*val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK];
|
||||
ret = IIO_VAL_INT_PLUS_MICRO;
|
||||
break;
|
||||
|
@ -56,8 +56,8 @@ static struct {
|
||||
{HID_USAGE_SENSOR_ALS, 0, 1, 0},
|
||||
{HID_USAGE_SENSOR_ALS, HID_USAGE_SENSOR_UNITS_LUX, 1, 0},
|
||||
|
||||
{HID_USAGE_SENSOR_PRESSURE, 0, 100000, 0},
|
||||
{HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 1, 0},
|
||||
{HID_USAGE_SENSOR_PRESSURE, 0, 100, 0},
|
||||
{HID_USAGE_SENSOR_PRESSURE, HID_USAGE_SENSOR_UNITS_PASCAL, 0, 1000},
|
||||
};
|
||||
|
||||
static int pow_10(unsigned power)
|
||||
|
@ -110,7 +110,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
|
||||
DEFINE_WAIT_FUNC(wait, woken_wake_function);
|
||||
size_t datum_size;
|
||||
size_t to_wait;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (!indio_dev->info)
|
||||
return -ENODEV;
|
||||
@ -153,7 +153,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
|
||||
ret = rb->access->read_first_n(rb, n, buf);
|
||||
if (ret == 0 && (filp->f_flags & O_NONBLOCK))
|
||||
ret = -EAGAIN;
|
||||
} while (ret == 0);
|
||||
} while (ret == 0);
|
||||
remove_wait_queue(&rb->pollq, &wait);
|
||||
|
||||
return ret;
|
||||
|
@ -613,9 +613,8 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals)
|
||||
return sprintf(buf, "%d.%09u\n", vals[0], vals[1]);
|
||||
case IIO_VAL_FRACTIONAL:
|
||||
tmp = div_s64((s64)vals[0] * 1000000000LL, vals[1]);
|
||||
vals[1] = do_div(tmp, 1000000000LL);
|
||||
vals[0] = tmp;
|
||||
return sprintf(buf, "%d.%09u\n", vals[0], vals[1]);
|
||||
vals[0] = (int)div_s64_rem(tmp, 1000000000, &vals[1]);
|
||||
return sprintf(buf, "%d.%09u\n", vals[0], abs(vals[1]));
|
||||
case IIO_VAL_FRACTIONAL_LOG2:
|
||||
tmp = (s64)vals[0] * 1000000000LL >> vals[1];
|
||||
vals[1] = do_div(tmp, 1000000000LL);
|
||||
|
@ -456,7 +456,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (notrigger) {
|
||||
printf("trigger-less mode selected\n");
|
||||
} if (trig_num >= 0) {
|
||||
} else if (trig_num >= 0) {
|
||||
char *trig_dev_name;
|
||||
ret = asprintf(&trig_dev_name, "%strigger%d", iio_dir, trig_num);
|
||||
if (ret < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user