diff options
author | Brian Duddie <bduddie@google.com> | 2016-11-21 17:49:01 -0800 |
---|---|---|
committer | Brian Duddie <bduddie@google.com> | 2016-11-21 17:49:01 -0800 |
commit | b2a6210fb0fdbd9b78646eec381c6412e76991ab (patch) | |
tree | a27d01f9a505780e140464de0427a4272dca0724 | |
parent | 66be7dc021bbe02d7f355edc3f4b73f400745afe (diff) | |
download | contexthub-b2a6210fb0fdbd9b78646eec381c6412e76991ab.tar.gz |
synaptics_s3708: Poll interrupt after arming LPWG
Poll the interrupt line that the touch controller uses to report a
pending event when we arm the low-power wake gesture (double-tap
detector). If it's active (low), post an event to read the status
register, which will reset the interrupt line and allow us to detect a
subsequent double-touch gesture via the ISR.
This fixes an issue where sometimes double-touch would fail to function
until the screen is toggled on and off. The cause was a pending touch
event leading to the interrupt line being held low prior to when the
sensor hub registered the ISR.
Bug: 32971126
Test: drag finger across screen and turn the screen off with the power
button to increase the likelihood of a pending touch event when
double-touch is enabled, then use logcat to verify that the failure
condition was triggered and solved by this change (reproducibility under
these conditions seems to be ~25%).
Change-Id: I375ff57e8240b392bbce2de96ceb99556d95e6fa
-rw-r--r-- | firmware/src/drivers/synaptics_s3708/synaptics_s3708.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/firmware/src/drivers/synaptics_s3708/synaptics_s3708.c b/firmware/src/drivers/synaptics_s3708/synaptics_s3708.c index 1706a660..af7c5259 100644 --- a/firmware/src/drivers/synaptics_s3708/synaptics_s3708.c +++ b/firmware/src/drivers/synaptics_s3708/synaptics_s3708.c @@ -104,6 +104,7 @@ enum TaskState { STATE_ENABLE_0, STATE_ENABLE_1, + STATE_ENABLE_2, STATE_DISABLE_0, STATE_INT_HANDLE_0, STATE_INT_HANDLE_1, @@ -438,7 +439,17 @@ static void processI2cResponse(struct I2cTransfer *xfer) if (mTask.retryCnt < HACK_RETRY_SKIP_COUNT) { setRetryTimer(); } else { - setReportingMode(S3708_REPORT_MODE_LPWG, STATE_IDLE); + setReportingMode(S3708_REPORT_MODE_LPWG, STATE_ENABLE_2); + } + break; + + case STATE_ENABLE_2: + // Poll the GPIO line to see if it is low/active (it might have been + // low when we enabled the ISR, e.g. due to a pending touch event). + // Only do this after arming the LPWG, so it happens after we know + // that we can talk to the touch controller. + if (!gpioGet(mTask.pin)) { + osEnqueuePrivateEvt(EVT_SENSOR_TOUCH_INTERRUPT, NULL, NULL, mTask.id); } break; |