mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-09-21 03:43:03 +00:00
input: sensors: add sensors max delay time
Max delay is the delay between two sensor events corresponding to the lowest frequency that this sensor supports. When lower frequencies are requested through batch()/setDelay() the events will be generated at this frequency instead. It can be used by the framework or applications to estimate when the batch FIFO may be full. Change-Id: Ic8b4bd78061801a48b2774c648758c87b2e20bfc Signed-off-by: Daqing Chen <chendaqing@codeaurora.org>
This commit is contained in:
parent
4df29b7c87
commit
7163bcd619
|
@ -131,6 +131,7 @@ static struct sensors_classdev sensors_cdev = {
|
|||
.resolution = "0.6",
|
||||
.sensor_power = "0.35",
|
||||
.min_delay = 10000,
|
||||
.max_delay = 10000,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
.enabled = 0,
|
||||
|
|
|
@ -117,6 +117,7 @@ static struct sensors_classdev sensors_cdev = {
|
|||
.resolution = "0.15",
|
||||
.sensor_power = "0.35",
|
||||
.min_delay = 10000,
|
||||
.max_delay = 10000,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
.enabled = 0,
|
||||
|
|
|
@ -194,6 +194,7 @@ static struct sensors_classdev als_cdev = {
|
|||
.resolution = "1.0",
|
||||
.sensor_power = "0.35",
|
||||
.min_delay = 100000,
|
||||
.max_delay = 1375,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
.flags = 2,
|
||||
|
@ -216,6 +217,7 @@ static struct sensors_classdev ps_cdev = {
|
|||
.resolution = "1.0",
|
||||
.sensor_power = "0.35",
|
||||
.min_delay = 5000,
|
||||
.max_delay = 1280,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
.flags = 3,
|
||||
|
|
|
@ -1375,6 +1375,9 @@ static const struct interrupt_map_t int_map[] = {
|
|||
#define POLL_INTERVAL_MAX_MS 4000
|
||||
#define POLL_DEFAULT_INTERVAL_MS 200
|
||||
|
||||
/* Interrupt delay in msecs */
|
||||
#define BMA_INT_MAX_DELAY 64
|
||||
|
||||
#define MAX_RANGE_MAP 4
|
||||
|
||||
struct bma2x2_type_map_t {
|
||||
|
@ -1539,6 +1542,7 @@ static struct sensors_classdev sensors_cdev = {
|
|||
.resolution = "0.153125", /* 15.6mg */
|
||||
.sensor_power = "0.13", /* typical value */
|
||||
.min_delay = POLL_INTERVAL_MIN_MS * 1000, /* in microseconds */
|
||||
.max_delay = POLL_INTERVAL_MAX_MS,
|
||||
.max_latency = POLL_INTERVAL_MAX_MS,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
|
@ -7450,6 +7454,8 @@ static int bma2x2_probe(struct i2c_client *client,
|
|||
data->cdev.sensors_poll_delay = bma2x2_cdev_poll_delay;
|
||||
data->cdev.sensors_self_test = bma2x2_self_calibration_xyz;
|
||||
data->cdev.resolution = sensor_type_map[data->chip_type].resolution;
|
||||
if (pdata->use_int)
|
||||
data->cdev.max_delay = BMA_INT_MAX_DELAY;
|
||||
err = sensors_classdev_register(&client->dev, &data->cdev);
|
||||
if (err) {
|
||||
dev_err(&client->dev, "create class device file failed!\n");
|
||||
|
|
|
@ -230,6 +230,9 @@
|
|||
#define BATCH_MODE_NORMAL 0
|
||||
#define BATCH_MODE_WAKE_UPON_FIFO_FULL 2
|
||||
|
||||
/* interrput mode for sensor max delay ms */
|
||||
#define LIS_INT_MAX_DELAY 1000
|
||||
|
||||
enum {
|
||||
LIS3DH_BYPASS_MODE = 0,
|
||||
LIS3DH_FIFO_MODE,
|
||||
|
@ -2185,6 +2188,7 @@ static int lis3dh_acc_probe(struct i2c_client *client,
|
|||
acc->cdev.sensors_flush = lis3dh_acc_flush;
|
||||
acc->cdev.fifo_reserved_event_count = LIS3DH_FIFO_SIZE;
|
||||
acc->cdev.fifo_max_event_count = LIS3DH_FIFO_SIZE;
|
||||
acc->cdev.max_delay = LIS_INT_MAX_DELAY;
|
||||
}
|
||||
err = sensors_classdev_register(&client->dev, &acc->cdev);
|
||||
if (err) {
|
||||
|
|
|
@ -249,6 +249,7 @@ static struct sensors_classdev als_cdev = {
|
|||
.resolution = "1.0",
|
||||
.sensor_power = "0.25",
|
||||
.min_delay = 50000,
|
||||
.max_delay = 2000,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
.flags = 2,
|
||||
|
@ -268,6 +269,7 @@ static struct sensors_classdev ps_cdev = {
|
|||
.resolution = "1.0",
|
||||
.sensor_power = "0.25",
|
||||
.min_delay = 10000,
|
||||
.max_delay = 2000,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
.flags = 3,
|
||||
|
|
|
@ -131,6 +131,7 @@ static struct sensors_classdev sensors_cdev = {
|
|||
.resolution = "0.0488228125",
|
||||
.sensor_power = "0.35",
|
||||
.min_delay = 10000,
|
||||
.max_delay = 10000,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
.enabled = 0,
|
||||
|
|
|
@ -54,10 +54,12 @@
|
|||
#define MPU6050_ACCEL_MIN_POLL_INTERVAL_MS 10
|
||||
#define MPU6050_ACCEL_MAX_POLL_INTERVAL_MS 5000
|
||||
#define MPU6050_ACCEL_DEFAULT_POLL_INTERVAL_MS 200
|
||||
#define MPU6050_ACCEL_INT_MAX_DELAY 19
|
||||
|
||||
#define MPU6050_GYRO_MIN_POLL_INTERVAL_MS 10
|
||||
#define MPU6050_GYRO_MAX_POLL_INTERVAL_MS 5000
|
||||
#define MPU6050_GYRO_DEFAULT_POLL_INTERVAL_MS 200
|
||||
#define MPU6050_GYRO_INT_MAX_DELAY 18
|
||||
|
||||
#define MPU6050_RAW_ACCEL_DATA_LEN 6
|
||||
#define MPU6050_RAW_GYRO_DATA_LEN 6
|
||||
|
@ -2889,6 +2891,9 @@ static int mpu6050_probe(struct i2c_client *client,
|
|||
sensor->accel_cdev.fifo_max_event_count = MPU6050_MAX_EVENT_CNT;
|
||||
sensor->accel_cdev.sensors_set_latency = mpu6050_accel_cdev_set_latency;
|
||||
sensor->accel_cdev.sensors_flush = mpu6050_accel_cdev_flush;
|
||||
if ((sensor->pdata->use_int) &&
|
||||
gpio_is_valid(sensor->pdata->gpio_int))
|
||||
sensor->accel_cdev.max_delay = MPU6050_ACCEL_INT_MAX_DELAY;
|
||||
|
||||
ret = sensors_classdev_register(&client->dev, &sensor->accel_cdev);
|
||||
if (ret) {
|
||||
|
@ -2906,6 +2911,9 @@ static int mpu6050_probe(struct i2c_client *client,
|
|||
sensor->gyro_cdev.fifo_max_event_count = MPU6050_MAX_EVENT_CNT;
|
||||
sensor->gyro_cdev.sensors_set_latency = mpu6050_gyro_cdev_set_latency;
|
||||
sensor->gyro_cdev.sensors_flush = mpu6050_gyro_cdev_flush;
|
||||
if ((sensor->pdata->use_int) &&
|
||||
gpio_is_valid(sensor->pdata->gpio_int))
|
||||
sensor->gyro_cdev.max_delay = MPU6050_GYRO_INT_MAX_DELAY;
|
||||
|
||||
ret = sensors_classdev_register(&client->dev, &sensor->gyro_cdev);
|
||||
if (ret) {
|
||||
|
|
|
@ -293,6 +293,7 @@ static struct sensors_classdev sensors_light_cdev = {
|
|||
.resolution = "0.0125",
|
||||
.sensor_power = "0.20",
|
||||
.min_delay = 30000, /* in microseconds */
|
||||
.max_delay = 8393,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
.flags = 2,
|
||||
|
@ -315,6 +316,7 @@ static struct sensors_classdev sensors_proximity_cdev = {
|
|||
.resolution = "5.0",
|
||||
.sensor_power = "3",
|
||||
.min_delay = 30000, /* in microseconds */
|
||||
.max_delay = 8393,
|
||||
.fifo_reserved_event_count = 0,
|
||||
.fifo_max_event_count = 0,
|
||||
.flags = 3,
|
||||
|
|
Loading…
Reference in a new issue