drivers/input/ft5x06: Fix a misconception.. WAKE is an output, not an input.

This commit is contained in:
Gregory Nutt 2017-12-18 06:36:44 -06:00
parent 30070b06df
commit c014400895
4 changed files with 53 additions and 63 deletions

View File

@ -63,11 +63,11 @@
****************************************************************************/
static int lpc54_ft5x06_attach(FAR const struct ft5x06_config_s *config,
enum ft5x06_irqsource_e irqsrc, xcpt_t isr, FAR void *arg);
xcpt_t isr, FAR void *arg);
static void lpc54_ft5x06_enable(FAR const struct ft5x06_config_s *config,
enum ft5x06_irqsource_e irqsrc, bool enable);
static void lpc54_ft5x06_clear(FAR const struct ft5x06_config_s *config,
enum ft5x06_irqsource_e irqsrc);
bool enable);
static void lpc54_ft5x06_clear(FAR const struct ft5x06_config_s *config);
static void lpc54_ft5x06_wakeup(FAR const struct ft5x06_config_s *config);
static void lpc54_ft5x06_nreset(FAR const struct ft5x06_config_s *config,
bool state);
@ -82,6 +82,7 @@ static const struct ft5x06_config_s g_ft5x06_config =
.attach = lpc54_ft5x06_attach,
.enable = lpc54_ft5x06_enable,
.clear = lpc54_ft5x06_clear,
.wakeup = lpc54_ft5x06_wakeup,
.nreset = lpc54_ft5x06_nreset
};
@ -100,17 +101,9 @@ static uint8_t g_ft5x06_irq;
****************************************************************************/
static int lpc54_ft5x06_attach(FAR const struct ft5x06_config_s *config,
enum ft5x06_irqsource_e irqsrc, xcpt_t isr,
FAR void *arg)
xcpt_t isr, FAR void *arg)
{
if (irqsrc == FT5X06_DATA_SOURCE)
{
return irq_attach(g_ft5x06_irq, isr, arg);
}
else
{
return -ENOSYS;
}
return irq_attach(g_ft5x06_irq, isr, arg);
}
/****************************************************************************
@ -122,12 +115,16 @@ static int lpc54_ft5x06_attach(FAR const struct ft5x06_config_s *config,
****************************************************************************/
static void lpc54_ft5x06_enable(FAR const struct ft5x06_config_s *config,
enum ft5x06_irqsource_e irqsrc, bool enable)
bool enable)
{
if (irqsrc == FT5X06_DATA_SOURCE)
if (enable)
{
up_enable_irq(g_ft5x06_irq);
}
else
{
up_disable_irq(g_ft5x06_irq);
}
}
/****************************************************************************
@ -138,13 +135,23 @@ static void lpc54_ft5x06_enable(FAR const struct ft5x06_config_s *config,
*
****************************************************************************/
static void lpc54_ft5x06_clear(FAR const struct ft5x06_config_s *config,
enum ft5x06_irqsource_e irqsrc)
static void lpc54_ft5x06_clear(FAR const struct ft5x06_config_s *config)
{
if (irqsrc == FT5X06_DATA_SOURCE)
{
(void)lpc54_gpio_ackedge(g_ft5x06_irq);
}
(void)lpc54_gpio_ackedge(g_ft5x06_irq);
}
/****************************************************************************
* Name: lpc54_ft5x06_wakeup
*
* Description:
* Issue WAKE interrupt to FT5x06 to change the FT5x06 from Hibernate to
* Active mode.
*
****************************************************************************/
static void lpc54_ft5x06_wakeup(FAR const struct ft5x06_config_s *config)
{
/* We do not have access to the WAKE pin in the implementation */
}
/****************************************************************************

View File

@ -299,7 +299,7 @@ static void ft5x06_data_worker(FAR void *arg)
/* Exit, re-enabling FT5x06 interrupts */
config->enable(config, FT5X06_DATA_SOURCE, true);
config->enable(config, true);
nxsem_post(&priv->devsem);
}
@ -322,7 +322,7 @@ static int ft5x06_data_interrupt(int irq, FAR void *context, FAR void *arg)
/* Disable further interrupts */
config->enable(config, FT5X06_DATA_SOURCE, false);
config->enable(config, false);
/* Transfer processing to the worker thread. Since FT5x06 interrupts are
* disabled while the work is pending, no special action should be required
@ -338,7 +338,7 @@ static int ft5x06_data_interrupt(int irq, FAR void *context, FAR void *arg)
/* Clear any pending interrupts and return success */
config->clear(config, FT5X06_DATA_SOURCE);
config->clear(config);
return OK;
}
@ -384,6 +384,8 @@ static ssize_t ft5x06_sample(FAR struct ft5x06_dev_s *priv, FAR char *buffer,
return 0; /* No touches read. */
}
DEBUGASSERT(ntouches <= FT5x06_MAX_TOUCHES);
/* User data buffer points (sink) */
sample = (FAR struct touch_sample_s *)buffer;
@ -523,8 +525,8 @@ static int ft5x06_bringup(FAR struct ft5x06_dev_s *priv)
/* Enable FT5x06 interrupts */
config->clear(config, FT5X06_DATA_SOURCE);
config->enable(config, FT5X06_DATA_SOURCE, true);
config->clear(config);
config->enable(config, true);
return OK;
}
@ -536,17 +538,14 @@ static void ft5x06_shutdown(FAR struct ft5x06_dev_s *priv)
{
FAR const struct ft5x06_config_s *config = priv->config;
/* Make sure that interrupts are disabled */
/* Make sure that the FT5x06 interrupt is disabled */
config->clear(config, FT5X06_DATA_SOURCE);
config->enable(config, FT5X06_DATA_SOURCE, false);
config->clear(config, FT5X06_WAKE_SOURCE);
config->enable(config, FT5X06_WAKE_SOURCE, false);
config->clear(config);
config->enable(config, false);
/* Attach the interrupt handler */
(void)config->attach(config, FT5X06_DATA_SOURCE, NULL, NULL);
(void)config->attach(config, NULL, NULL);
}
/****************************************************************************
@ -957,17 +956,14 @@ int ft5x06_register(FAR struct i2c_master_s *i2c,
nxsem_setprotocol(&priv->waitsem, SEM_PRIO_NONE);
/* Make sure that interrupts are disabled */
/* Make sure that the FT5x06 interrupt interrupt is disabled */
config->clear(config, FT5X06_DATA_SOURCE);
config->enable(config, FT5X06_DATA_SOURCE, false);
config->clear(config, FT5X06_WAKE_SOURCE);
config->enable(config, FT5X06_WAKE_SOURCE, false);
config->clear(config);
config->enable(config, false);
/* Attach the interrupt handler */
ret = config->attach(config, FT5X06_DATA_SOURCE, ft5x06_data_interrupt,
ret = config->attach(config, ft5x06_data_interrupt,
priv);
if (ret < 0)
{

View File

@ -776,6 +776,7 @@ static FAR void *pcf8574_attach(FAR struct ioexpander_dev_s *dev,
* 0 on success, else a negative error code
*
****************************************************************************/
#ifdef CONFIG_PCF8574_INT_ENABLE
static int pcf8574_detach(FAR struct ioexpander_dev_s *dev, FAR void *handle)
{

View File

@ -85,22 +85,6 @@
/****************************************************************************
* Public Types
****************************************************************************/
/* The FT5x08 provides two interrupts pins:
*
* INT -A n interrupt signal to inform the host processor that touch data
* is ready for ready to be read.
* WAKE - An interrupt signal for the host to change FT5x06 from Hibernate
* to Active mode.
*
* A value from this enumeration must be passed to each interrupt-related
* interface method to distinguish the interrupt sources.
*/
enum ft5x06_irqsource_e
{
FT5X06_DATA_SOURCE = 0,
FT5X06_WAKE_SOURCE,
};
/* A reference to a structure of this type must be passed to the FT5X06
* driver. This structure provides information about the configuration
@ -126,15 +110,17 @@ struct ft5x06_config_s
* attach - Attach an FT5x06 interrupt handler to a GPIO interrupt
* enable - Enable or disable a GPIO interrupt
* clear - Acknowledge/clear any pending GPIO interrupt
* wakeup - Issue WAKE interrupt to FT5x06 to change the FT5x06 from
* Hibernate to Active mode.
* nreset - Control the chip reset pin (active low)
*/
int (*attach)(FAR const struct ft5x06_config_s *config,
enum ft5x06_irqsource_e irqsrc, xcpt_t isr, FAR void *arg);
void (*enable)(FAR const struct ft5x06_config_s *config,
enum ft5x06_irqsource_e irqsrc, bool enable);
void (*clear)(FAR const struct ft5x06_config_s *config,
enum ft5x06_irqsource_e irqsrc);
int (*attach)(FAR const struct ft5x06_config_s *config, xcpt_t isr,
FAR void *arg);
void (*enable)(FAR const struct ft5x06_config_s *config, bool enable);
void (*clear)(FAR const struct ft5x06_config_s *config);
void (*wakeup)(FAR const struct ft5x06_config_s *config);
void (*nreset)(FAR const struct ft5x06_config_s *config,
bool state);
};