Lines Matching +full:nct38xx +full:- +full:gpio
4 * SPDX-License-Identifier: Apache-2.0
10 #include <zephyr/drivers/gpio.h>
11 #include <zephyr/drivers/gpio/gpio_nct38xx.h>
12 #include <zephyr/drivers/mfd/nct38xx.h>
23 /* Multi-function device, parent to the NCT38xx GPIO controller */
25 /* GPIO ports */
34 /* NCT38XX device */
36 /* lock NCT38xx register access */
44 const struct gpio_nct38xx_config *const config = dev->config; in nct38xx_gpio_alert_handler()
46 for (int i = 0; i < config->sub_gpio_port_num; i++) { in nct38xx_gpio_alert_handler()
47 gpio_nct38xx_dispatch_port_isr(config->sub_gpio_dev[i]); in nct38xx_gpio_alert_handler()
55 struct gpio_nct38xx_data *data = dev->data; in nct38xx_init_interrupt()
57 k_sem_take(data->lock, K_FOREVER); in nct38xx_init_interrupt()
60 if (i2c_burst_write_dt(data->i2c_dev, NCT38XX_REG_ALERT_MASK, (uint8_t *)&alert_mask, in nct38xx_init_interrupt()
62 ret = -EIO; in nct38xx_init_interrupt()
66 /* Enable vendor-defined alert for GPIO. */ in nct38xx_init_interrupt()
70 if (i2c_burst_read_dt(data->i2c_dev, NCT38XX_REG_ALERT, (uint8_t *)&alert, sizeof(alert))) { in nct38xx_init_interrupt()
71 ret = -EIO; in nct38xx_init_interrupt()
76 if (i2c_burst_write_dt(data->i2c_dev, NCT38XX_REG_ALERT, (uint8_t *)&alert, in nct38xx_init_interrupt()
78 ret = -EIO; in nct38xx_init_interrupt()
83 if (i2c_burst_write_dt(data->i2c_dev, NCT38XX_REG_ALERT_MASK, (uint8_t *)&alert_mask, in nct38xx_init_interrupt()
85 ret = -EIO; in nct38xx_init_interrupt()
90 k_sem_give(data->lock); in nct38xx_init_interrupt()
96 const struct gpio_nct38xx_config *const config = dev->config; in nct38xx_gpio_init()
97 struct gpio_nct38xx_data *data = dev->data; in nct38xx_gpio_init()
99 /* Verify multi-function parent is ready */ in nct38xx_gpio_init()
100 if (!device_is_ready(config->mfd)) { in nct38xx_gpio_init()
101 LOG_ERR("%s device not ready", config->mfd->name); in nct38xx_gpio_init()
102 return -ENODEV; in nct38xx_gpio_init()
105 data->lock = mfd_nct38xx_get_lock_reference(config->mfd); in nct38xx_gpio_init()
106 data->i2c_dev = mfd_nct38xx_get_i2c_dt_spec(config->mfd); in nct38xx_gpio_init()
133 /* The nct38xx MFD parent must be initialized before this driver */