Lines Matching +full:set +full:- +full:bit +full:- +full:to +full:- +full:deassert

4  * SPDX-License-Identifier: Apache-2.0
37 const struct tca954x_channel_config *channel_config = dev->config; in get_root_data_from_channel()
39 return channel_config->root->data; in get_root_data_from_channel()
45 const struct tca954x_channel_config *channel_config = dev->config; in get_root_config_from_channel()
47 return channel_config->root->config; in get_root_config_from_channel()
55 return i2c_configure(cfg->i2c.bus, dev_config); in tca954x_configure()
61 struct tca954x_root_data *data = dev->data; in tca954x_set_channel()
62 const struct tca954x_root_config *cfg = dev->config; in tca954x_set_channel()
65 if (data->selected_chan != select_mask) { in tca954x_set_channel()
66 res = i2c_write_dt(&cfg->i2c, &select_mask, 1); in tca954x_set_channel()
68 data->selected_chan = select_mask; in tca954x_set_channel()
70 LOG_DBG("tca954x: failed to set channel"); in tca954x_set_channel()
84 const struct tca954x_channel_config *down_cfg = dev->config; in tca954x_transfer()
87 res = k_mutex_lock(&data->lock, K_MSEC(5000)); in tca954x_transfer()
92 res = tca954x_set_channel(down_cfg->root, down_cfg->chan_mask); in tca954x_transfer()
97 res = i2c_transfer(config->i2c.bus, msgs, num_msgs, addr); in tca954x_transfer()
100 k_mutex_unlock(&data->lock); in tca954x_transfer()
106 struct tca954x_root_data *i2c_tca954x = dev->data; in tca954x_root_init()
107 const struct tca954x_root_config *config = dev->config; in tca954x_root_init()
109 if (!device_is_ready(config->i2c.bus)) { in tca954x_root_init()
110 LOG_ERR("I2C bus %s not ready", config->i2c.bus->name); in tca954x_root_init()
111 return -ENODEV; in tca954x_root_init()
115 if (config->reset_gpios.port) { in tca954x_root_init()
116 if (!gpio_is_ready_dt(&config->reset_gpios)) { in tca954x_root_init()
118 config->reset_gpios.port->name); in tca954x_root_init()
119 return -ENODEV; in tca954x_root_init()
122 if (gpio_pin_configure_dt(&config->reset_gpios, GPIO_OUTPUT)) { in tca954x_root_init()
123 LOG_ERR("%s: failed to configure RESET line", dev->name); in tca954x_root_init()
124 return -EIO; in tca954x_root_init()
127 /* Deassert reset line */ in tca954x_root_init()
128 gpio_pin_set_dt(&config->reset_gpios, 0); in tca954x_root_init()
131 i2c_tca954x->selected_chan = 0; in tca954x_root_init()
138 const struct tca954x_channel_config *chan_cfg = dev->config; in tca954x_channel_init()
142 if (!device_is_ready(chan_cfg->root)) { in tca954x_channel_init()
143 LOG_ERR("I2C mux root %s not ready", chan_cfg->root->name); in tca954x_channel_init()
144 return -ENODEV; in tca954x_channel_init()
147 if ((chan_cfg->chan_mask >= BIT(root_cfg->nchans) && !chan_cfg->has_enable) || in tca954x_channel_init()
148 (chan_cfg->chan_mask > (BIT(2) | (root_cfg->nchans - 1)) && chan_cfg->has_enable)) { in tca954x_channel_init()
149 LOG_ERR("Wrong DTS address provided for %s", dev->name); in tca954x_channel_init()
150 return -EINVAL; in tca954x_channel_init()
170 .chan_mask = has_enable_bit ? BIT(2) | DT_REG_ADDR(node_id) \
171 : BIT(DT_REG_ADDR(node_id)), \