Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion drivers/gpio/gpio_sch.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ static void _gpio_pin_config(struct device *dev, u32_t pin, int flags)
_set_bit_gio(info->regs, pin, !(flags & GPIO_DIR_MASK));

if (flags & GPIO_INT) {
if (flags & GPIO_INT_ACTIVE_HIGH) {
if (flags & GPIO_INT_DOUBLE_EDGE) {
active_high = 1U;
active_low = 1U;
} else if (flags & GPIO_INT_ACTIVE_HIGH) {
active_high = 1U;
} else {
active_low = 1U;
Expand Down Expand Up @@ -128,6 +131,12 @@ static int gpio_sch_config(struct device *dev,
{
const struct gpio_sch_config *info = dev->config->config_info;

/* Do some sanity check first */
if (flags & (GPIO_INT | GPIO_INT_LEVEL)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcpleung @galak @tbursztyka I'm reasonably sure this doesn't do what you think it does, because GPIO_INT_LEVEL is zero. So I'm pretty sure you've made it so that you're exiting with -EINVAL if interrupts are enabled.

There were commits in #11880 which addressed several similar bugs (esp32 in particular is also broken).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for letting me know. I have submitted #13143 to fix this.

/* controller does not support level trigger */
return -EINVAL;
}

if (access_op == GPIO_ACCESS_BY_PIN) {
if (pin >= info->bits) {
return -EINVAL;
Expand Down