Lines Matching +full:lock +full:- +full:mode

4  * SPDX-License-Identifier: Apache-2.0
36 struct k_mutex lock; member
41 const struct tle9104_gpio_config *config = dev->config; in tle9104_gpio_pin_configure()
42 struct tle9104_gpio_data *data = dev->data; in tle9104_gpio_pin_configure()
47 return -EWOULDBLOCK; in tle9104_gpio_pin_configure()
52 return -EINVAL; in tle9104_gpio_pin_configure()
57 return -ENOTSUP; in tle9104_gpio_pin_configure()
62 return -ENOTSUP; in tle9104_gpio_pin_configure()
67 return -ENOTSUP; in tle9104_gpio_pin_configure()
72 return -ENOTSUP; in tle9104_gpio_pin_configure()
77 return -ENOTSUP; in tle9104_gpio_pin_configure()
82 return -ENOTSUP; in tle9104_gpio_pin_configure()
85 if (config->parallel_mode_out12 && pin == 1) { in tle9104_gpio_pin_configure()
86 LOG_ERR("cannot configure OUT2 if parallel mode is enabled for OUT1 and OUT2"); in tle9104_gpio_pin_configure()
87 return -EINVAL; in tle9104_gpio_pin_configure()
90 if (config->parallel_mode_out34 && pin == 3) { in tle9104_gpio_pin_configure()
91 LOG_ERR("cannot configure OUT4 if parallel mode is enabled for OUT3 and OUT4"); in tle9104_gpio_pin_configure()
92 return -EINVAL; in tle9104_gpio_pin_configure()
95 k_mutex_lock(&data->lock, K_FOREVER); in tle9104_gpio_pin_configure()
98 WRITE_BIT(data->state, pin, 0); in tle9104_gpio_pin_configure()
100 WRITE_BIT(data->state, pin, 1); in tle9104_gpio_pin_configure()
103 WRITE_BIT(data->configured, pin, 1); in tle9104_gpio_pin_configure()
104 result = tle9104_write_state(config->parent, data->state); in tle9104_gpio_pin_configure()
105 k_mutex_unlock(&data->lock); in tle9104_gpio_pin_configure()
116 return -ENOTSUP; in tle9104_gpio_port_get_raw()
121 const struct tle9104_gpio_config *config = dev->config; in tle9104_gpio_port_set_masked_raw()
122 struct tle9104_gpio_data *data = dev->data; in tle9104_gpio_port_set_masked_raw()
125 if (config->parallel_mode_out12 && (BIT(1) & mask) != 0) { in tle9104_gpio_port_set_masked_raw()
126 LOG_ERR("cannot set OUT2 if parallel mode is enabled for OUT1 and OUT2"); in tle9104_gpio_port_set_masked_raw()
127 return -EINVAL; in tle9104_gpio_port_set_masked_raw()
130 if (config->parallel_mode_out34 && (BIT(3) & mask) != 0) { in tle9104_gpio_port_set_masked_raw()
131 LOG_ERR("cannot set OUT4 if parallel mode is enabled for OUT3 and OUT4"); in tle9104_gpio_port_set_masked_raw()
132 return -EINVAL; in tle9104_gpio_port_set_masked_raw()
137 return -EWOULDBLOCK; in tle9104_gpio_port_set_masked_raw()
140 k_mutex_lock(&data->lock, K_FOREVER); in tle9104_gpio_port_set_masked_raw()
141 data->state = (data->state & ~mask) | (mask & value); in tle9104_gpio_port_set_masked_raw()
142 result = tle9104_write_state(config->parent, data->state); in tle9104_gpio_port_set_masked_raw()
143 k_mutex_unlock(&data->lock); in tle9104_gpio_port_set_masked_raw()
160 const struct tle9104_gpio_config *config = dev->config; in tle9104_gpio_port_toggle_bits()
161 struct tle9104_gpio_data *data = dev->data; in tle9104_gpio_port_toggle_bits()
164 if (config->parallel_mode_out12 && (BIT(1) & mask) != 0) { in tle9104_gpio_port_toggle_bits()
165 LOG_ERR("cannot toggle OUT2 if parallel mode is enabled for OUT1 and OUT2"); in tle9104_gpio_port_toggle_bits()
166 return -EINVAL; in tle9104_gpio_port_toggle_bits()
169 if (config->parallel_mode_out34 && (BIT(3) & mask) != 0) { in tle9104_gpio_port_toggle_bits()
170 LOG_ERR("cannot toggle OUT4 if parallel mode is enabled for OUT3 and OUT4"); in tle9104_gpio_port_toggle_bits()
171 return -EINVAL; in tle9104_gpio_port_toggle_bits()
176 return -EWOULDBLOCK; in tle9104_gpio_port_toggle_bits()
179 k_mutex_lock(&data->lock, K_FOREVER); in tle9104_gpio_port_toggle_bits()
180 data->state ^= mask; in tle9104_gpio_port_toggle_bits()
181 result = tle9104_write_state(config->parent, data->state); in tle9104_gpio_port_toggle_bits()
182 k_mutex_unlock(&data->lock); in tle9104_gpio_port_toggle_bits()
188 enum gpio_int_mode mode, enum gpio_int_trig trig) in tle9104_gpio_pin_interrupt_configure() argument
192 ARG_UNUSED(mode); in tle9104_gpio_pin_interrupt_configure()
194 return -ENOTSUP; in tle9104_gpio_pin_interrupt_configure()
209 const struct tle9104_gpio_config *config = dev->config; in tle9104_gpio_init()
210 struct tle9104_gpio_data *data = dev->data; in tle9104_gpio_init()
213 LOG_DBG("initialize TLE9104 GPIO instance %s", dev->name); in tle9104_gpio_init()
215 if (!device_is_ready(config->parent)) { in tle9104_gpio_init()
216 LOG_ERR("%s: parent MFD is not ready", dev->name); in tle9104_gpio_init()
217 return -EINVAL; in tle9104_gpio_init()
220 result = k_mutex_init(&data->lock); in tle9104_gpio_init()