Skip to content

Commit b028965

Browse files
drivers: led: ht16k33: update to use new GPIO API
Update the IRQ GPIO handling code of the HT16K33 LED driver to use the new GPIO API. Signed-off-by: Henrik Brix Andersen <[email protected]>
1 parent 1528a04 commit b028965

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

drivers/led/ht16k33.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,20 @@ static int ht16k33_init(struct device *dev)
391391
}
392392

393393
err = gpio_pin_configure(irq_dev, config->irq_pin,
394-
GPIO_DIR_IN | GPIO_INT |
395-
GPIO_INT_EDGE | config->irq_flags);
394+
GPIO_INPUT | config->irq_flags);
396395
if (err) {
397396
LOG_ERR("Failed to configure IRQ pin (err %d)", err);
398397
return -EINVAL;
399398
}
400399

400+
err = gpio_pin_interrupt_configure(irq_dev, config->irq_pin,
401+
GPIO_INT_EDGE_FALLING);
402+
if (err) {
403+
LOG_ERR("Failed to configure IRQ pin flags (err %d)",
404+
err);
405+
return -EINVAL;
406+
}
407+
401408
gpio_init_callback(&data->irq_cb, &ht16k33_irq_callback,
402409
BIT(config->irq_pin));
403410

@@ -408,12 +415,7 @@ static int ht16k33_init(struct device *dev)
408415
}
409416

410417
/* Enable interrupt pin */
411-
cmd[0] = HT16K33_CMD_ROW_INT_SET;
412-
if (config->irq_flags & GPIO_INT_ACTIVE_HIGH) {
413-
cmd[0] |= HT16K33_OPT_INT_HIGH;
414-
} else {
415-
cmd[0] |= HT16K33_OPT_INT_LOW;
416-
}
418+
cmd[0] = HT16K33_CMD_ROW_INT_SET | HT16K33_OPT_INT_LOW;
417419
if (i2c_write(data->i2c, cmd, 1, config->i2c_addr)) {
418420
LOG_ERR("Enabling HT16K33 IRQ output failed");
419421
return -EIO;

0 commit comments

Comments
 (0)