mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
Staging/IIO fixes for 4.11-rc6
Here are a number of small IIO and staging driver fixes for 4.11-rc6. Nothing big here, just iio fixes for reported issues, and an ashmem fix for a very old bug that has been reported by a number of Android vendors. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWOnsZA8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+ymb4ACfSnGU4ndDTKoyTaJ7B/ZO/RF5lZUAni9d3kYF 3Ztp0ssmF8PBNvQhyIs0 =aeZf -----END PGP SIGNATURE----- Merge tag 'staging-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging/IIO driver rfixes from Greg KH: "Here are a number of small IIO and staging driver fixes for 4.11-rc6. Nothing big here, just iio fixes for reported issues, and an ashmem fix for a very old bug that has been reported by a number of Android vendors" * tag 'staging-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: staging: android: ashmem: lseek failed due to no FMODE_LSEEK. iio: hid-sensor-attributes: Fix sensor property setting failure. iio: accel: hid-sensor-accel-3d: Fix duplicate scan index error iio: core: Fix IIO_VAL_FRACTIONAL_LOG2 for negative values iio: st_pressure: initialize lps22hb bootime iio: bmg160: reset chip when probing iio: cros_ec_sensors: Fix return value to get raw and calibbias data.
This commit is contained in:
commit
62e1fd08ed
@ -370,10 +370,12 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
|
|||||||
name = "accel_3d";
|
name = "accel_3d";
|
||||||
channel_spec = accel_3d_channels;
|
channel_spec = accel_3d_channels;
|
||||||
channel_size = sizeof(accel_3d_channels);
|
channel_size = sizeof(accel_3d_channels);
|
||||||
|
indio_dev->num_channels = ARRAY_SIZE(accel_3d_channels);
|
||||||
} else {
|
} else {
|
||||||
name = "gravity";
|
name = "gravity";
|
||||||
channel_spec = gravity_channels;
|
channel_spec = gravity_channels;
|
||||||
channel_size = sizeof(gravity_channels);
|
channel_size = sizeof(gravity_channels);
|
||||||
|
indio_dev->num_channels = ARRAY_SIZE(gravity_channels);
|
||||||
}
|
}
|
||||||
ret = hid_sensor_parse_common_attributes(hsdev, hsdev->usage,
|
ret = hid_sensor_parse_common_attributes(hsdev, hsdev->usage,
|
||||||
&accel_state->common_attributes);
|
&accel_state->common_attributes);
|
||||||
@ -395,7 +397,6 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
|
|||||||
goto error_free_dev_mem;
|
goto error_free_dev_mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
indio_dev->num_channels = ARRAY_SIZE(accel_3d_channels);
|
|
||||||
indio_dev->dev.parent = &pdev->dev;
|
indio_dev->dev.parent = &pdev->dev;
|
||||||
indio_dev->info = &accel_3d_info;
|
indio_dev->info = &accel_3d_info;
|
||||||
indio_dev->name = name;
|
indio_dev->name = name;
|
||||||
|
@ -61,7 +61,7 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev,
|
|||||||
ret = st->core.read_ec_sensors_data(indio_dev, 1 << idx, &data);
|
ret = st->core.read_ec_sensors_data(indio_dev, 1 << idx, &data);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
break;
|
break;
|
||||||
|
ret = IIO_VAL_INT;
|
||||||
*val = data;
|
*val = data;
|
||||||
break;
|
break;
|
||||||
case IIO_CHAN_INFO_CALIBBIAS:
|
case IIO_CHAN_INFO_CALIBBIAS:
|
||||||
@ -76,7 +76,7 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev,
|
|||||||
for (i = CROS_EC_SENSOR_X; i < CROS_EC_SENSOR_MAX_AXIS; i++)
|
for (i = CROS_EC_SENSOR_X; i < CROS_EC_SENSOR_MAX_AXIS; i++)
|
||||||
st->core.calib[i] =
|
st->core.calib[i] =
|
||||||
st->core.resp->sensor_offset.offset[i];
|
st->core.resp->sensor_offset.offset[i];
|
||||||
|
ret = IIO_VAL_INT;
|
||||||
*val = st->core.calib[idx];
|
*val = st->core.calib[idx];
|
||||||
break;
|
break;
|
||||||
case IIO_CHAN_INFO_SCALE:
|
case IIO_CHAN_INFO_SCALE:
|
||||||
|
@ -379,6 +379,8 @@ int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
|
|||||||
{
|
{
|
||||||
|
|
||||||
struct hid_sensor_hub_attribute_info timestamp;
|
struct hid_sensor_hub_attribute_info timestamp;
|
||||||
|
s32 value;
|
||||||
|
int ret;
|
||||||
|
|
||||||
hid_sensor_get_reporting_interval(hsdev, usage_id, st);
|
hid_sensor_get_reporting_interval(hsdev, usage_id, st);
|
||||||
|
|
||||||
@ -417,6 +419,14 @@ int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
|
|||||||
st->sensitivity.index, st->sensitivity.report_id,
|
st->sensitivity.index, st->sensitivity.report_id,
|
||||||
timestamp.index, timestamp.report_id);
|
timestamp.index, timestamp.report_id);
|
||||||
|
|
||||||
|
ret = sensor_hub_get_feature(hsdev,
|
||||||
|
st->power_state.report_id,
|
||||||
|
st->power_state.index, sizeof(value), &value);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
if (value < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(hid_sensor_parse_common_attributes);
|
EXPORT_SYMBOL(hid_sensor_parse_common_attributes);
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <linux/iio/trigger_consumer.h>
|
#include <linux/iio/trigger_consumer.h>
|
||||||
#include <linux/iio/triggered_buffer.h>
|
#include <linux/iio/triggered_buffer.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
#include "bmg160.h"
|
#include "bmg160.h"
|
||||||
|
|
||||||
#define BMG160_IRQ_NAME "bmg160_event"
|
#define BMG160_IRQ_NAME "bmg160_event"
|
||||||
@ -52,6 +53,9 @@
|
|||||||
#define BMG160_DEF_BW 100
|
#define BMG160_DEF_BW 100
|
||||||
#define BMG160_REG_PMU_BW_RES BIT(7)
|
#define BMG160_REG_PMU_BW_RES BIT(7)
|
||||||
|
|
||||||
|
#define BMG160_GYRO_REG_RESET 0x14
|
||||||
|
#define BMG160_GYRO_RESET_VAL 0xb6
|
||||||
|
|
||||||
#define BMG160_REG_INT_MAP_0 0x17
|
#define BMG160_REG_INT_MAP_0 0x17
|
||||||
#define BMG160_INT_MAP_0_BIT_ANY BIT(1)
|
#define BMG160_INT_MAP_0_BIT_ANY BIT(1)
|
||||||
|
|
||||||
@ -236,6 +240,14 @@ static int bmg160_chip_init(struct bmg160_data *data)
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reset chip to get it in a known good state. A delay of 30ms after
|
||||||
|
* reset is required according to the datasheet.
|
||||||
|
*/
|
||||||
|
regmap_write(data->regmap, BMG160_GYRO_REG_RESET,
|
||||||
|
BMG160_GYRO_RESET_VAL);
|
||||||
|
usleep_range(30000, 30700);
|
||||||
|
|
||||||
ret = regmap_read(data->regmap, BMG160_REG_CHIP_ID, &val);
|
ret = regmap_read(data->regmap, BMG160_REG_CHIP_ID, &val);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "Error reading reg_chip_id\n");
|
dev_err(dev, "Error reading reg_chip_id\n");
|
||||||
|
@ -610,10 +610,9 @@ static ssize_t __iio_format_value(char *buf, size_t len, unsigned int type,
|
|||||||
tmp0 = (int)div_s64_rem(tmp, 1000000000, &tmp1);
|
tmp0 = (int)div_s64_rem(tmp, 1000000000, &tmp1);
|
||||||
return snprintf(buf, len, "%d.%09u", tmp0, abs(tmp1));
|
return snprintf(buf, len, "%d.%09u", tmp0, abs(tmp1));
|
||||||
case IIO_VAL_FRACTIONAL_LOG2:
|
case IIO_VAL_FRACTIONAL_LOG2:
|
||||||
tmp = (s64)vals[0] * 1000000000LL >> vals[1];
|
tmp = shift_right((s64)vals[0] * 1000000000LL, vals[1]);
|
||||||
tmp1 = do_div(tmp, 1000000000LL);
|
tmp0 = (int)div_s64_rem(tmp, 1000000000LL, &tmp1);
|
||||||
tmp0 = tmp;
|
return snprintf(buf, len, "%d.%09u", tmp0, abs(tmp1));
|
||||||
return snprintf(buf, len, "%d.%09u", tmp0, tmp1);
|
|
||||||
case IIO_VAL_INT_MULTIPLE:
|
case IIO_VAL_INT_MULTIPLE:
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -457,6 +457,7 @@ static const struct st_sensor_settings st_press_sensors_settings[] = {
|
|||||||
.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
|
.addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
|
||||||
},
|
},
|
||||||
.multi_read_bit = true,
|
.multi_read_bit = true,
|
||||||
|
.bootime = 2,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -409,6 +409,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
|
|||||||
ret = PTR_ERR(vmfile);
|
ret = PTR_ERR(vmfile);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
vmfile->f_mode |= FMODE_LSEEK;
|
||||||
asma->file = vmfile;
|
asma->file = vmfile;
|
||||||
}
|
}
|
||||||
get_file(asma->file);
|
get_file(asma->file);
|
||||||
|
Loading…
Reference in New Issue
Block a user