drivers/input/ft5x06.c: Remove cool logic to disable polling when there there is no client waiting for read data. That was a great idea to save CPU cycles when there is nothing reading from the touchscrren but, unfortunately, does not work with readers that open the driver in non-blocking mode. So I think we just have to eat the CPUs even when there is nothing waiting for touchscreen input.

This commit is contained in:
Gregory Nutt 2018-01-18 09:59:31 -06:00
parent ce7df1f961
commit 3fb0a50036
1 changed files with 6 additions and 34 deletions

View File

@ -364,15 +364,9 @@ static void ft5x06_data_worker(FAR void *arg)
}
#ifdef CONFIG_FT5X06_POLLMODE
/* Exit, re-starting the poll (unless there is no longer any task waiting
* for touch data).
*/
/* Exit, re-starting the poll. */
if (priv->nwaiters > 0)
{
(void)wd_start(priv->polltimer, priv->delay, ft5x06_poll_timeout, 1,
priv);
}
(void)wd_start(priv->polltimer, priv->delay, ft5x06_poll_timeout, 1, priv);
#else
/* Exit, re-enabling FT5x06 interrupts */
@ -398,14 +392,11 @@ static void ft5x06_poll_timeout(int argc, wdparm_t arg1, ...)
* required to protected the work queue.
*/
if (priv->nwaiters > 0)
DEBUGASSERT(priv->work.worker == NULL);
ret = work_queue(HPWORK, &priv->work, ft5x06_data_worker, priv, 0);
if (ret != 0)
{
DEBUGASSERT(priv->work.worker == NULL);
ret = work_queue(HPWORK, &priv->work, ft5x06_data_worker, priv, 0);
if (ret != 0)
{
ierr("ERROR: Failed to queue work: %d\n", ret);
}
ierr("ERROR: Failed to queue work: %d\n", ret);
}
}
#endif
@ -682,25 +673,6 @@ static ssize_t ft5x06_waitsample(FAR struct ft5x06_dev_s *priv,
priv->nwaiters++;
#ifdef CONFIG_FT5X06_POLLMODE
/* The poll timer is stopped when there are no waiters. So we may
* need to restart with at the maximum rate.
*/
if (priv->nwaiters == 1)
{
priv->delay = POLL_MINDELAY;
ret = wd_start(priv->polltimer, priv->delay, ft5x06_poll_timeout,
1, priv);
if (ret < 0)
{
ierr("ERROR: nxsem_wait failed: %d\n", ret);
goto errout;
}
}
#endif
/* Wait for a change in the FT5x06 state */
ret = nxsem_wait(&priv->waitsem);