Lines Matching +full:alert +full:- +full:config

4  * SPDX-License-Identifier: Apache-2.0
21 /* Driver config */
23 /* Multi-function device, parent to the NCT38xx GPIO controller */
28 /* Alert handler */
44 const struct gpio_nct38xx_config *const config = dev->config; in nct38xx_gpio_alert_handler() local
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()
53 uint16_t alert, alert_mask = 0; in nct38xx_init_interrupt() local
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()
69 /* Clear alert */ 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()
74 alert &= alert_mask; in nct38xx_init_interrupt()
75 if (alert) { in nct38xx_init_interrupt()
76 if (i2c_burst_write_dt(data->i2c_dev, NCT38XX_REG_ALERT, (uint8_t *)&alert, in nct38xx_init_interrupt()
77 sizeof(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() local
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()