HID: qvr: wait event interruptible timeout change

To improve read calibration data latency use a minimum
but enough timeout value. To improve consistency in
controlling IMU stream use a different value.

Change-Id: Iff196d055f0202e642de218020605f7797e3ae4a
Signed-off-by: Rohit Bandi <rohitbandi@codeaurora.org>
This commit is contained in:
Rohit Bandi 2019-10-21 11:34:21 -07:00 • committed by Gerrit - the friendly Code Review server
commit 2c6da39016

View file

@ -45,7 +45,8 @@
#include "hid-ids.h"
#include "hid-qvr.h"
#define WAIT_EVENT_INT_TOUT 20
#define TIME_OUT_START_STOP_MS 500
#define TIME_OUT_READ_WRITE_MS 20
#define QVR_START_IMU _IO('q', 1)
#define QVR_STOP_IMU _IO('q', 2)
@ -126,7 +127,7 @@ static int read_calibration_len(void)
ret = wait_event_interruptible_timeout(wq,
sensor->calib_data_len != -1,
msecs_to_jiffies(WAIT_EVENT_INT_TOUT));
msecs_to_jiffies(TIME_OUT_READ_WRITE_MS));
if (ret == 0) {
kfree(hid_buf);
return -ETIME;
@ -171,7 +172,7 @@ static uint8_t *read_calibration_data(void)
HID_REQ_SET_REPORT);
ret = wait_event_interruptible_timeout(wq,
sensor->calib_data_recv == 1,
msecs_to_jiffies(WAIT_EVENT_INT_TOUT));
msecs_to_jiffies(TIME_OUT_READ_WRITE_MS));
if (ret == 0) {
pr_err("%s:get calibration data timeout\n", __func__);
kfree(hid_buf);
@ -219,7 +220,7 @@ static int control_imu_stream(bool status)
HID_FEATURE_REPORT,
HID_REQ_SET_REPORT);
ret = wait_event_interruptible_timeout(wq, sensor->ext_ack == 1,
msecs_to_jiffies(WAIT_EVENT_INT_TOUT));
msecs_to_jiffies(TIME_OUT_START_STOP_MS));
if (ret && status) {
pr_debug("qvr: falling back - start IMU stream failed\n");
hid_buf[0] = QVR_HID_REPORT_ID_CAL;