Lines Matching +full:gpio +full:- +full:n
4 * SPDX-License-Identifier: Apache-2.0
9 #include <zephyr/drivers/gpio.h>
20 /* Reset GPIO */
22 /* Power GPIO */
38 const struct mipi_dbi_stm32_fmc_config *config = dev->config; in mipi_dbi_stm32_fmc_check_config()
39 struct mipi_dbi_stm32_fmc_data *data = dev->data; in mipi_dbi_stm32_fmc_check_config()
42 if (data->dbi_config == dbi_config) { in mipi_dbi_stm32_fmc_check_config()
46 if (dbi_config->mode != MIPI_DBI_MODE_8080_BUS_16_BIT) { in mipi_dbi_stm32_fmc_check_config()
47 LOG_ERR("Only support Intel 8080 16-bits"); in mipi_dbi_stm32_fmc_check_config()
48 return -ENOTSUP; in mipi_dbi_stm32_fmc_check_config()
51 if (config->fmc_memory_width != FMC_NORSRAM_MEM_BUS_WIDTH_16) { in mipi_dbi_stm32_fmc_check_config()
52 LOG_ERR("Only supports 16-bit bus width"); in mipi_dbi_stm32_fmc_check_config()
53 return -EINVAL; in mipi_dbi_stm32_fmc_check_config()
61 ((config->fmc_address_setup_time + 1) + (config->fmc_data_setup_time + 1)) * 1; in mipi_dbi_stm32_fmc_check_config()
63 if (hclk_freq / fmc_write_cycles > dbi_config->config.frequency) { in mipi_dbi_stm32_fmc_check_config()
65 return -EINVAL; in mipi_dbi_stm32_fmc_check_config()
68 data->dbi_config = dbi_config; in mipi_dbi_stm32_fmc_check_config()
76 const struct mipi_dbi_stm32_fmc_config *config = dev->config; in mipi_dbi_stm32_fmc_command_write()
85 sys_write16(cmd, config->register_addr); in mipi_dbi_stm32_fmc_command_write()
91 sys_write16((uint16_t)data_buf[i], config->data_addr); in mipi_dbi_stm32_fmc_command_write()
106 const struct mipi_dbi_stm32_fmc_config *config = dev->config; in mipi_dbi_stm32_fmc_write_display()
115 for (i = 0U; i < desc->buf_size; i += 2) { in mipi_dbi_stm32_fmc_write_display()
116 sys_write16(sys_get_le16(&framebuf[i]), config->data_addr); in mipi_dbi_stm32_fmc_write_display()
127 const struct mipi_dbi_stm32_fmc_config *config = dev->config; in mipi_dbi_stm32_fmc_reset()
130 if (config->reset.port == NULL) { in mipi_dbi_stm32_fmc_reset()
131 return -ENOTSUP; in mipi_dbi_stm32_fmc_reset()
134 ret = gpio_pin_set_dt(&config->reset, 1); in mipi_dbi_stm32_fmc_reset()
141 return gpio_pin_set_dt(&config->reset, 0); in mipi_dbi_stm32_fmc_reset()
146 const struct mipi_dbi_stm32_fmc_config *config = dev->config; in mipi_dbi_stm32_fmc_init()
148 if (config->reset.port) { in mipi_dbi_stm32_fmc_init()
149 if (!gpio_is_ready_dt(&config->reset)) { in mipi_dbi_stm32_fmc_init()
150 LOG_ERR("Reset GPIO device not ready"); in mipi_dbi_stm32_fmc_init()
151 return -ENODEV; in mipi_dbi_stm32_fmc_init()
154 if (gpio_pin_configure_dt(&config->reset, GPIO_OUTPUT_INACTIVE)) { in mipi_dbi_stm32_fmc_init()
156 return -EIO; in mipi_dbi_stm32_fmc_init()
160 if (config->power.port) { in mipi_dbi_stm32_fmc_init()
161 if (!gpio_is_ready_dt(&config->power)) { in mipi_dbi_stm32_fmc_init()
162 LOG_ERR("Power GPIO device not ready"); in mipi_dbi_stm32_fmc_init()
163 return -ENODEV; in mipi_dbi_stm32_fmc_init()
166 if (gpio_pin_configure_dt(&config->power, GPIO_OUTPUT)) { in mipi_dbi_stm32_fmc_init()
168 return -EIO; in mipi_dbi_stm32_fmc_init()
181 #define MIPI_DBI_FMC_GET_ADDRESS(n) _CONCAT(FMC_BANK1_, \ argument
182 UTIL_INC(DT_REG_ADDR_RAW(DT_INST_PARENT(n))))
184 #define MIPI_DBI_FMC_GET_DATA_ADDRESS(n) \ argument
185 MIPI_DBI_FMC_GET_ADDRESS(n) + (1 << (DT_INST_PROP(n, register_select_pin) + 1))
187 #define MIPI_DBI_STM32_FMC_INIT(n) \ argument
188 static const struct mipi_dbi_stm32_fmc_config mipi_dbi_stm32_fmc_config_##n = { \
189 .reset = GPIO_DT_SPEC_INST_GET_OR(n, reset_gpios, {}), \
190 .power = GPIO_DT_SPEC_INST_GET_OR(n, power_gpios, {}), \
191 .register_addr = MIPI_DBI_FMC_GET_ADDRESS(n), \
192 .data_addr = MIPI_DBI_FMC_GET_DATA_ADDRESS(n), \
193 .fmc_address_setup_time = DT_PROP_BY_IDX(DT_INST_PARENT(n), st_timing, 0), \
194 .fmc_data_setup_time = DT_PROP_BY_IDX(DT_INST_PARENT(n), st_timing, 2), \
195 .fmc_memory_width = DT_PROP_BY_IDX(DT_INST_PARENT(n), st_control, 2), \
198 static struct mipi_dbi_stm32_fmc_data mipi_dbi_stm32_fmc_data_##n; \
200 DEVICE_DT_INST_DEFINE(n, mipi_dbi_stm32_fmc_init, NULL, &mipi_dbi_stm32_fmc_data_##n, \
201 &mipi_dbi_stm32_fmc_config_##n, POST_KERNEL, \