Lines Matching +full:pullup +full:- +full:mask

4  * SPDX-License-Identifier: Apache-2.0
47 const struct gpio_it8801_config *config = dev->config; in ioex_check_is_not_valid()
49 if (BIT(pin) & ~(config->pin_mask)) { in ioex_check_is_not_valid()
50 LOG_ERR("GPIO port%d-%d is not support", config->reg_ipsr, pin); in ioex_check_is_not_valid()
51 return -ENOTSUP; in ioex_check_is_not_valid()
59 const struct gpio_it8801_config *config = dev->config; in gpio_it8801_configure()
61 uint8_t reg_gpcr = config->reg_gpcr + pin; in gpio_it8801_configure()
62 uint8_t mask = BIT(pin); in gpio_it8801_configure() local
67 return -ENOTSUP; in gpio_it8801_configure()
71 return -ENOTSUP; in gpio_it8801_configure()
74 ret = i2c_reg_read_byte_dt(&config->i2c_dev, reg_gpcr, &control); in gpio_it8801_configure()
89 new_value = mask; in gpio_it8801_configure()
95 ret = i2c_reg_update_byte_dt(&config->i2c_dev, config->reg_sovr, mask, new_value); in gpio_it8801_configure()
102 /* Select open drain 0:push-pull 1:open-drain */ in gpio_it8801_configure()
113 /* Handle pullup / pulldown */ in gpio_it8801_configure()
125 ret = i2c_reg_write_byte_dt(&config->i2c_dev, reg_gpcr, control); in gpio_it8801_configure()
137 const struct gpio_it8801_config *config = dev->config; in gpio_it8801_get_config()
140 uint8_t reg_gpcr = config->reg_gpcr + pin; in gpio_it8801_get_config()
141 uint8_t mask = BIT(pin); in gpio_it8801_get_config() local
145 return -ENOTSUP; in gpio_it8801_get_config()
148 ret = i2c_reg_read_byte_dt(&config->i2c_dev, reg_gpcr, &control); in gpio_it8801_get_config()
158 /* Get GPIO type, 0:push-pull 1:open-drain */ in gpio_it8801_get_config()
163 ret = i2c_reg_read_byte_dt(&config->i2c_dev, config->reg_ipsr, &value); in gpio_it8801_get_config()
170 if (value & mask) { in gpio_it8801_get_config()
179 /* pullup / pulldown */ in gpio_it8801_get_config()
194 const struct gpio_it8801_config *config = dev->config; in gpio_it8801_port_get_raw()
199 ret = i2c_reg_read_byte_dt(&config->i2c_dev, config->reg_ipsr, &val); in gpio_it8801_port_get_raw()
201 LOG_ERR("Failed to get port mask (ret %d)", ret); in gpio_it8801_port_get_raw()
210 static int gpio_it8801_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask, in gpio_it8801_port_set_masked_raw() argument
213 const struct gpio_it8801_config *config = dev->config; in gpio_it8801_port_set_masked_raw()
216 ret = i2c_reg_update_byte_dt(&config->i2c_dev, config->reg_sovr, mask, value); in gpio_it8801_port_set_masked_raw()
218 LOG_ERR("Failed to set port mask (ret %d)", ret); in gpio_it8801_port_set_masked_raw()
227 const struct gpio_it8801_config *config = dev->config; in gpio_it8801_port_set_bits_raw()
231 ret = i2c_reg_update_byte_dt(&config->i2c_dev, config->reg_sovr, pins, pins); in gpio_it8801_port_set_bits_raw()
242 const struct gpio_it8801_config *config = dev->config; in gpio_it8801_port_clear_bits_raw()
246 ret = i2c_reg_update_byte_dt(&config->i2c_dev, config->reg_sovr, pins, 0); in gpio_it8801_port_clear_bits_raw()
257 const struct gpio_it8801_config *config = dev->config; in gpio_it8801_port_toggle_bits()
261 ret = i2c_reg_read_byte_dt(&config->i2c_dev, config->reg_sovr, &val); in gpio_it8801_port_toggle_bits()
268 ret = i2c_reg_write_byte_dt(&config->i2c_dev, config->reg_sovr, new_val); in gpio_it8801_port_toggle_bits()
281 struct gpio_it8801_data *data = dev->data; in gpio_it8801_manage_callback()
284 ret = gpio_manage_callback(&data->callbacks, callback, set); in gpio_it8801_manage_callback()
291 const struct gpio_it8801_config *config = dev->config; in it8801_gpio_alert_handler()
292 struct gpio_it8801_data *data = dev->data; in it8801_gpio_alert_handler()
296 ret = i2c_reg_read_byte_dt(&config->i2c_dev, config->reg_gpisr, &isr_val); in it8801_gpio_alert_handler()
302 ret = i2c_reg_read_byte_dt(&config->i2c_dev, config->reg_gpier, &ier_val); in it8801_gpio_alert_handler()
310 ret = i2c_reg_write_byte_dt(&config->i2c_dev, config->reg_gpisr, isr_val); in it8801_gpio_alert_handler()
316 gpio_fire_callbacks(&data->callbacks, dev, isr_val); in it8801_gpio_alert_handler()
323 const struct gpio_it8801_config *config = dev->config; in gpio_it8801_pin_interrupt_configure()
324 struct gpio_it8801_data *data = dev->data; in gpio_it8801_pin_interrupt_configure()
326 uint8_t reg_gpcr = config->reg_gpcr + pin; in gpio_it8801_pin_interrupt_configure()
328 uint8_t mask = BIT(pin); in gpio_it8801_pin_interrupt_configure() local
331 return -ENOTSUP; in gpio_it8801_pin_interrupt_configure()
335 ret = i2c_reg_update_byte_dt(&config->i2c_dev, config->reg_gpier, mask, 0); in gpio_it8801_pin_interrupt_configure()
346 ret = i2c_reg_update_byte_dt(&config->i2c_dev, reg_gpcr, IT8801_GPIODIR, 0); in gpio_it8801_pin_interrupt_configure()
353 ret = i2c_reg_update_byte_dt(&config->i2c_dev, reg_gpcr, GENMASK(4, 3), 0); in gpio_it8801_pin_interrupt_configure()
359 ret = i2c_reg_read_byte_dt(&config->i2c_dev, reg_gpcr, &control); in gpio_it8801_pin_interrupt_configure()
375 return -EINVAL; in gpio_it8801_pin_interrupt_configure()
387 ret = i2c_reg_write_byte_dt(&config->i2c_dev, reg_gpcr, control); in gpio_it8801_pin_interrupt_configure()
394 ret = i2c_reg_update_byte_dt(&config->i2c_dev, config->reg_gpisr, mask, mask); in gpio_it8801_pin_interrupt_configure()
401 ret = i2c_reg_update_byte_dt(&config->i2c_dev, config->reg_gpier, mask, mask); in gpio_it8801_pin_interrupt_configure()
408 ret = i2c_reg_write_byte_dt(&config->i2c_dev, IT8801_REG_GIECR, IT8801_REG_MASK_GGPIOIE); in gpio_it8801_pin_interrupt_configure()
411 data->it8801_gpio_callback.cb = it8801_gpio_alert_handler; in gpio_it8801_pin_interrupt_configure()
412 data->it8801_gpio_callback.dev = dev; in gpio_it8801_pin_interrupt_configure()
413 mfd_it8801_register_interrupt_callback(config->mfd, &data->it8801_gpio_callback); in gpio_it8801_pin_interrupt_configure()
434 const struct gpio_it8801_config *config = dev->config; in gpio_it8801_init()
436 /* Verify multi-function parent is ready */ in gpio_it8801_init()
437 if (!device_is_ready(config->mfd)) { in gpio_it8801_init()
438 LOG_ERR("(gpio)%s is not ready", config->mfd->name); in gpio_it8801_init()
439 return -ENODEV; in gpio_it8801_init()