gpio:add feature for gpio wakeup
1.add pin type to cfg gpio as wake up source 2.add IOEXPANDER_OPTION_WAKEUPCFG for set wake up option Signed-off-by: dulibo1 <dulibo1@xiaomi.com> Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
parent
2ec6c6e1fc
commit
1179802cfe
@ -113,6 +113,33 @@ static const uint32_t g_gplh_inttype[GPIO_NPINTYPES] =
|
|||||||
IOEXPANDER_VAL_RISING, /* GPIO_INTERRUPT_RISING_PIN */
|
IOEXPANDER_VAL_RISING, /* GPIO_INTERRUPT_RISING_PIN */
|
||||||
IOEXPANDER_VAL_FALLING, /* GPIO_INTERRUPT_FALLING_PIN */
|
IOEXPANDER_VAL_FALLING, /* GPIO_INTERRUPT_FALLING_PIN */
|
||||||
IOEXPANDER_VAL_BOTH, /* GPIO_INTERRUPT_BOTH_PIN */
|
IOEXPANDER_VAL_BOTH, /* GPIO_INTERRUPT_BOTH_PIN */
|
||||||
|
CONFIG_GPIO_LOWER_HALF_INTTYPE, /* GPIO_INTERRUPT_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_VAL_HIGH, /* GPIO_INTERRUPT_HIGH_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_VAL_LOW, /* GPIO_INTERRUPT_LOW_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_VAL_RISING, /* GPIO_INTERRUPT_RISING_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_VAL_FALLING, /* GPIO_INTERRUPT_FALLING_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_VAL_BOTH, /* GPIO_INTERRUPT_BOTH_PIN_WAKEUP */
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t g_gplh_wakeuptype[GPIO_NPINTYPES] =
|
||||||
|
{
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_INPUT_PIN */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_INPUT_PIN_PULLUP */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_INPUT_PIN_PULLDOWN */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_OUTPUT_PIN */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_OUTPUT_PIN_OPENDRAIN */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_INTERRUPT_PIN */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_INTERRUPT_HIGH_PIN */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_INTERRUPT_LOW_PIN */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_INTERRUPT_RISING_PIN */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_INTERRUPT_FALLING_PIN */
|
||||||
|
IOEXPANDER_WAKEUP_DISABLE, /* GPIO_INTERRUPT_BOTH_PIN */
|
||||||
|
IOEXPANDER_WAKEUP_ENABLE, /* GPIO_INTERRUPT_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_WAKEUP_ENABLE, /* GPIO_INTERRUPT_HIGH_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_WAKEUP_ENABLE, /* GPIO_INTERRUPT_LOW_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_WAKEUP_ENABLE, /* GPIO_INTERRUPT_RISING_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_WAKEUP_ENABLE, /* GPIO_INTERRUPT_FALLING_PIN_WAKEUP */
|
||||||
|
IOEXPANDER_WAKEUP_ENABLE, /* GPIO_INTERRUPT_BOTH_PIN_WAKEUP */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -357,6 +384,9 @@ static int gplh_setpintype(FAR struct gpio_dev_s *gpio,
|
|||||||
|
|
||||||
IOEXP_SETOPTION(ioe, pin, IOEXPANDER_OPTION_INTCFG,
|
IOEXP_SETOPTION(ioe, pin, IOEXPANDER_OPTION_INTCFG,
|
||||||
(FAR void *)(uintptr_t)g_gplh_inttype[pintype]);
|
(FAR void *)(uintptr_t)g_gplh_inttype[pintype]);
|
||||||
|
|
||||||
|
IOEXP_SETOPTION(ioe, pin, IOEXPANDER_OPTION_WAKEUPCFG,
|
||||||
|
(FAR void *)(uintptr_t)g_gplh_wakeuptype[pintype]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpio->gp_pintype = pintype;
|
gpio->gp_pintype = pintype;
|
||||||
|
@ -100,6 +100,12 @@ enum gpio_pintype_e
|
|||||||
GPIO_INTERRUPT_RISING_PIN,
|
GPIO_INTERRUPT_RISING_PIN,
|
||||||
GPIO_INTERRUPT_FALLING_PIN,
|
GPIO_INTERRUPT_FALLING_PIN,
|
||||||
GPIO_INTERRUPT_BOTH_PIN,
|
GPIO_INTERRUPT_BOTH_PIN,
|
||||||
|
GPIO_INTERRUPT_PIN_WAKEUP,
|
||||||
|
GPIO_INTERRUPT_HIGH_PIN_WAKEUP,
|
||||||
|
GPIO_INTERRUPT_LOW_PIN_WAKEUP,
|
||||||
|
GPIO_INTERRUPT_RISING_PIN_WAKEUP,
|
||||||
|
GPIO_INTERRUPT_FALLING_PIN_WAKEUP,
|
||||||
|
GPIO_INTERRUPT_BOTH_PIN_WAKEUP,
|
||||||
GPIO_NPINTYPES
|
GPIO_NPINTYPES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,6 +77,10 @@
|
|||||||
* structure to expander driver.
|
* structure to expander driver.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define IOEXPANDER_OPTION_WAKEUPCFG 5 /* Configure interrupt for a pin to wake up the Soc */
|
||||||
|
#define IOEXPANDER_WAKEUP_DISABLE 0 /* Do not cfg the pin as wake up source */
|
||||||
|
#define IOEXPANDER_WAKEUP_ENABLE 1 /* Cfg the pin as wake up source */
|
||||||
|
|
||||||
/* Access macros ************************************************************/
|
/* Access macros ************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user