msm8974-common: sensors: Disable batching
* Set FIFO values to 0 for all sensors to disable batching. * Only change the delay for batch calls. Change-Id: I8e8384e63a24122e02f3c6c7e09311561c180c17
This commit is contained in:
parent
3b6f6bb075
commit
dce39f8a86
1 changed files with 17 additions and 3 deletions
|
@ -554,12 +554,12 @@ static int device__poll(struct sensors_poll_device_t *dev, sensors_event_t* data
|
||||||
static int device__batch(struct sensors_poll_device_1 *dev, int handle,
|
static int device__batch(struct sensors_poll_device_1 *dev, int handle,
|
||||||
int flags, int64_t period_ns, int64_t timeout) {
|
int flags, int64_t period_ns, int64_t timeout) {
|
||||||
sensors_poll_context_t* ctx = (sensors_poll_context_t*) dev;
|
sensors_poll_context_t* ctx = (sensors_poll_context_t*) dev;
|
||||||
return ctx->batch(handle, flags, period_ns, timeout);
|
ctx->setDelay(handle, period_ns);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int device__flush(struct sensors_poll_device_1 *dev, int handle) {
|
static int device__flush(struct sensors_poll_device_1 *dev, int handle) {
|
||||||
sensors_poll_context_t* ctx = (sensors_poll_context_t*) dev;
|
return -EINVAL;
|
||||||
return ctx->flush(handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int device__inject_sensor_data(struct sensors_poll_device_1 *dev,
|
static int device__inject_sensor_data(struct sensors_poll_device_1 *dev,
|
||||||
|
@ -681,6 +681,19 @@ static void lazy_init_modules() {
|
||||||
pthread_mutex_unlock(&init_modules_mutex);
|
pthread_mutex_unlock(&init_modules_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fix the fields of the sensor to be compliant with the API version
|
||||||
|
* reported by the wrapper.
|
||||||
|
*/
|
||||||
|
static void fix_sensor_fields(sensor_t& sensor) {
|
||||||
|
/*
|
||||||
|
* Because batching and flushing don't work modify the
|
||||||
|
* sensor fields to not report any fifo counts.
|
||||||
|
*/
|
||||||
|
sensor.fifoReservedEventCount = 0;
|
||||||
|
sensor.fifoMaxEventCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lazy-initializes global_sensors_count, global_sensors_list, and module_sensor_handles.
|
* Lazy-initializes global_sensors_count, global_sensors_list, and module_sensor_handles.
|
||||||
*/
|
*/
|
||||||
|
@ -746,6 +759,7 @@ static void lazy_init_sensors_list() {
|
||||||
ALOGV("module_index %d, local_handle %d, global_handle %d",
|
ALOGV("module_index %d, local_handle %d, global_handle %d",
|
||||||
module_index, local_handle, global_handle);
|
module_index, local_handle, global_handle);
|
||||||
|
|
||||||
|
fix_sensor_fields(mutable_sensor_list[mutable_sensor_index]);
|
||||||
mutable_sensor_index++;
|
mutable_sensor_index++;
|
||||||
}
|
}
|
||||||
module_index++;
|
module_index++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue