Lines Matching +full:enable +full:- +full:inverted
4 * SPDX-License-Identifier: Apache-2.0
22 …* https://www.infineon.com/dgdl/Infineon-TLE9104SH-DataSheet-v01_31-EN.pdf?fileId=5546d462766cbe86…
121 *destination &= ~GENMASK(pos + length - 1, pos); in tle9104_set_register_bits()
122 *destination |= FIELD_PREP(GENMASK(pos + length - 1, pos), value); in tle9104_set_register_bits()
127 return FIELD_GET(GENMASK(pos + length - 1, pos), value); in tle9104_get_register_bits()
135 parity--; in tle9104_calculate_parity()
159 const struct tle9104_config *config = dev->config; in tle9104_transceive_frame()
160 struct tle9104_data *data = dev->data; in tle9104_transceive_frame()
191 result = spi_transceive_dt(&config->bus, &tx, &rx); in tle9104_transceive_frame()
202 return -EIO; in tle9104_transceive_frame()
205 if (!data->cwd_ignore) { in tle9104_transceive_frame()
207 LOG_WRN("%s: communication fault reported by TLE9104", dev->name); in tle9104_transceive_frame()
211 *read_reg = FIELD_GET(GENMASK(TLE9104_FRAME_FAULTGLOBAL_POS - 1, TLE9104_FRAME_ADDRESS_POS), in tle9104_transceive_frame()
213 *read_data = FIELD_GET(GENMASK(TLE9104_FRAME_ADDRESS_POS - 1, TLE9104_FRAME_DATA_POS), in tle9104_transceive_frame()
230 const struct tle9104_config *config = dev->config; in tle9104_write_state_internal()
231 struct tle9104_data *data = dev->data; in tle9104_write_state_internal()
241 bool previous_value = (data->previous_state & mask) != 0; in tle9104_write_state_internal()
246 * meaning here is intentionally inverted, as this will then turn in tle9104_write_state_internal()
260 if (config->gpio_control[i].port == NULL) { in tle9104_write_state_internal()
265 result = gpio_pin_set_dt(&config->gpio_control[i], current_value); in tle9104_write_state_internal()
280 data->previous_state = state; in tle9104_write_state_internal()
287 struct tle9104_data *data = dev->data; in tle9104_write_state()
290 k_mutex_lock(&data->lock, K_FOREVER); in tle9104_write_state()
292 k_mutex_unlock(&data->lock); in tle9104_write_state()
319 return -EFAULT; in tle9104_get_diagnostics_internal()
329 return -EFAULT; in tle9104_get_diagnostics_internal()
339 return -EFAULT; in tle9104_get_diagnostics_internal()
365 struct tle9104_data *data = dev->data; in tle9104_get_diagnostics()
368 k_mutex_lock(&data->lock, K_FOREVER); in tle9104_get_diagnostics()
370 k_mutex_unlock(&data->lock); in tle9104_get_diagnostics()
404 struct tle9104_data *data = dev->data; in tle9104_clear_diagnostics()
407 k_mutex_lock(&data->lock, K_FOREVER); in tle9104_clear_diagnostics()
409 k_mutex_unlock(&data->lock); in tle9104_clear_diagnostics()
416 const struct tle9104_config *config = dev->config; in tle9104_init()
417 struct tle9104_data *data = dev->data; in tle9104_init()
424 LOG_DBG("initialize TLE9104 instance %s", dev->name); in tle9104_init()
426 data->cwd_ignore = true; in tle9104_init()
428 result = k_mutex_init(&data->lock); in tle9104_init()
434 if (!spi_is_ready_dt(&config->bus)) { in tle9104_init()
435 LOG_ERR("SPI bus %s is not ready", config->bus.bus->name); in tle9104_init()
436 return -ENODEV; in tle9104_init()
442 const struct gpio_dt_spec *current = config->gpio_control + i; in tle9104_init()
444 if (current->port == NULL) { in tle9104_init()
452 LOG_ERR("%s: control GPIO is not ready", dev->name); in tle9104_init()
453 return -ENODEV; in tle9104_init()
463 if (config->gpio_enable.port != NULL) { in tle9104_init()
464 if (!gpio_is_ready_dt(&config->gpio_enable)) { in tle9104_init()
465 LOG_ERR("%s: enable GPIO is not ready", dev->name); in tle9104_init()
466 return -ENODEV; in tle9104_init()
469 result = gpio_pin_configure_dt(&config->gpio_enable, GPIO_OUTPUT_ACTIVE); in tle9104_init()
471 LOG_ERR("failed to enable TLE9104"); in tle9104_init()
476 if (config->gpio_reset.port != NULL) { in tle9104_init()
477 if (!gpio_is_ready_dt(&config->gpio_reset)) { in tle9104_init()
478 LOG_ERR("%s: reset GPIO is not yet ready", dev->name); in tle9104_init()
479 return -ENODEV; in tle9104_init()
482 result = gpio_pin_configure_dt(&config->gpio_reset, GPIO_OUTPUT_ACTIVE); in tle9104_init()
489 gpio_pin_set_dt(&config->gpio_reset, 0); in tle9104_init()
506 return -EIO; in tle9104_init()
511 return -EIO; in tle9104_init()
522 return -EIO; in tle9104_init()
527 return -EIO; in tle9104_init()
534 if (config->parallel_mode_out12) { in tle9104_init()
539 if (config->parallel_mode_out34) { in tle9104_init()
553 config->diagnostic_filter_time); in tle9104_init()
561 LOG_ERR("unable to write OFF-diag configuration"); in tle9104_init()
568 config->overcurrent_shutdown_delay_time); in tle9104_init()
571 config->overcurrent_shutdown_threshold); in tle9104_init()
575 LOG_ERR("unable to write ON-diag configuration"); in tle9104_init()
580 /* enable outputs */ in tle9104_init()
589 data->cwd_ignore = false; in tle9104_init()