Lines Matching +full:clock +full:- +full:lane
4 * SPDX-License-Identifier: Apache-2.0
71 const struct mcux_mipi_dsi_config *config = dev->config; in dsi_mcux_dma_cb()
72 struct mcux_mipi_dsi_data *data = dev->data; in dsi_mcux_dma_cb()
79 DSI_DisableInterrupts(config->base, kDSI_InterruptGroup1ApbTxDone | in dsi_mcux_dma_cb()
81 DSI_GetAndClearInterruptStatus(config->base, &int_flags1, &int_flags2); in dsi_mcux_dma_cb()
82 k_sem_give(&data->transfer_sem); in dsi_mcux_dma_cb()
99 const struct mcux_mipi_dsi_config *config = dev->config; in dsi_mcux_tx_color()
100 struct mcux_mipi_dsi_data *data = dev->data; in dsi_mcux_tx_color()
105 return -ENOTSUP; /* DMA can only transfer on virtual channel 0 */ in dsi_mcux_tx_color()
109 data->smartdma_params.p_buffer = msg->tx_buf; in dsi_mcux_tx_color()
110 data->smartdma_params.buffersize = msg->tx_len; in dsi_mcux_tx_color()
114 dma_cfg.head_block = (struct dma_block_config *)&data->smartdma_params; in dsi_mcux_tx_color()
116 dma_cfg.dma_slot = data->dma_slot; in dsi_mcux_tx_color()
118 ret = dma_config(config->smart_dma, 0, &dma_cfg); in dsi_mcux_tx_color()
130 DSI_EnableInterrupts(config->base, kDSI_InterruptGroup1ApbTxDone | in dsi_mcux_tx_color()
133 ret = dma_start(config->smart_dma, 0); in dsi_mcux_tx_color()
139 k_sem_take(&data->transfer_sem, K_FOREVER); in dsi_mcux_tx_color()
140 return msg->tx_len; in dsi_mcux_tx_color()
151 k_sem_give(&data->transfer_sem); in dsi_transfer_complete()
159 const struct mcux_mipi_dsi_config *config = dev->config; in dsi_mcux_tx_color()
160 struct mcux_mipi_dsi_data *data = dev->data; in dsi_mcux_tx_color()
164 .txData = msg->tx_buf, in dsi_mcux_tx_color()
165 .rxDataSize = (uint16_t)msg->rx_len, in dsi_mcux_tx_color()
166 .rxData = msg->rx_buf, in dsi_mcux_tx_color()
168 .dscCmd = msg->cmd, in dsi_mcux_tx_color()
171 .flags = (msg->flags & MIPI_DSI_MSG_USE_LPM) ? 0 : kDSI_TransferUseHighSpeed, in dsi_mcux_tx_color()
180 xfer.txDataSize = MIN(msg->tx_len, (DSI_TX_MAX_PAYLOAD_BYTE - 6)); in dsi_mcux_tx_color()
193 /* Send TX data using non-blocking DSI API */ in dsi_mcux_tx_color()
194 status = DSI_TransferNonBlocking(config->base, in dsi_mcux_tx_color()
195 &data->mipi_handle, &xfer); in dsi_mcux_tx_color()
197 k_sem_take(&data->transfer_sem, K_FOREVER); in dsi_mcux_tx_color()
200 return -EIO; in dsi_mcux_tx_color()
208 const struct mcux_mipi_dsi_config *config = dev->config; in mipi_dsi_isr()
209 struct mcux_mipi_dsi_data *data = dev->data; in mipi_dsi_isr()
211 DSI_TransferHandleIRQ(config->base, &data->mipi_handle); in mipi_dsi_isr()
221 const struct mcux_mipi_dsi_config *config = dev->config; in dsi_mcux_attach()
230 dsi_config.numLanes = mdev->data_lanes; in dsi_mcux_attach()
231 dsi_config.autoInsertEoTp = config->auto_insert_eotp; in dsi_mcux_attach()
232 dsi_config.enableNonContinuousHsClk = config->noncontinuous_hs_clk; in dsi_mcux_attach()
237 DSI_Init(config->base, &dsi_config); in dsi_mcux_attach()
246 /* Gate inputmux clock to save power */ in dsi_mcux_attach()
249 if (!device_is_ready(config->smart_dma)) { in dsi_mcux_attach()
250 return -ENODEV; in dsi_mcux_attach()
253 struct mcux_mipi_dsi_data *data = dev->data; in dsi_mcux_attach()
255 switch (mdev->pixfmt) { in dsi_mcux_attach()
257 data->dma_slot = kSMARTDMA_MIPI_RGB888_DMA; in dsi_mcux_attach()
258 data->smartdma_params.disablePixelByteSwap = true; in dsi_mcux_attach()
261 data->dma_slot = kSMARTDMA_MIPI_RGB565_DMA; in dsi_mcux_attach()
263 data->smartdma_params.disablePixelByteSwap = false; in dsi_mcux_attach()
265 data->smartdma_params.disablePixelByteSwap = true; in dsi_mcux_attach()
270 mdev->pixfmt); in dsi_mcux_attach()
271 return -ENODEV; in dsi_mcux_attach()
274 data->smartdma_params.smartdma_stack = data->smartdma_stack; in dsi_mcux_attach()
276 dma_smartdma_install_fw(config->smart_dma, in dsi_mcux_attach()
280 struct mcux_mipi_dsi_data *data = dev->data; in dsi_mcux_attach()
283 if (DSI_TransferCreateHandle(config->base, &data->mipi_handle, in dsi_mcux_attach()
285 return -ENODEV; in dsi_mcux_attach()
289 /* Get the DPHY bit clock frequency */ in dsi_mcux_attach()
290 if (clock_control_get_rate(config->bit_clk_dev, in dsi_mcux_attach()
291 config->bit_clk_subsys, in dsi_mcux_attach()
293 return -EINVAL; in dsi_mcux_attach()
295 /* Get the DPHY ESC clock frequency */ in dsi_mcux_attach()
296 if (clock_control_get_rate(config->esc_clk_dev, in dsi_mcux_attach()
297 config->esc_clk_subsys, in dsi_mcux_attach()
299 return -EINVAL; in dsi_mcux_attach()
301 /* Get the Pixel clock frequency */ in dsi_mcux_attach()
302 if (clock_control_get_rate(config->pixel_clk_dev, in dsi_mcux_attach()
303 config->pixel_clk_subsys, in dsi_mcux_attach()
305 return -EINVAL; in dsi_mcux_attach()
308 switch (config->dpi_config.pixelPacket) { in dsi_mcux_attach()
321 return -EINVAL; /* Invalid bit width enum value? */ in dsi_mcux_attach()
325 * The DPHY bit clock must be fast enough to send out the pixels, it should be in dsi_mcux_attach()
328 * (Pixel clock * bit per output pixel) / number of MIPI data lane in dsi_mcux_attach()
330 if (((dsi_pixel_clk_freq * bit_width) / mdev->data_lanes) > dphy_bit_clk_freq) { in dsi_mcux_attach()
331 return -EINVAL; in dsi_mcux_attach()
336 if (config->dphy_ref_freq != 0) { in dsi_mcux_attach()
337 dphy_bit_clk_freq = DSI_InitDphy(config->base, in dsi_mcux_attach()
338 &dphy_config, config->dphy_ref_freq); in dsi_mcux_attach()
340 /* DPHY PLL is not present, ref clock is unused */ in dsi_mcux_attach()
341 DSI_InitDphy(config->base, &dphy_config, 0); in dsi_mcux_attach()
350 if (mdev->mode_flags & MIPI_DSI_MODE_VIDEO) { in dsi_mcux_attach()
352 DSI_SetDpiConfig(config->base, &config->dpi_config, mdev->data_lanes, in dsi_mcux_attach()
364 const struct mcux_mipi_dsi_config *config = dev->config; in dsi_mcux_detach()
367 DSI_DeinitDphy(config->base); in dsi_mcux_detach()
369 config->base->PD_DPHY = 0x1; in dsi_mcux_detach()
371 DSI_Deinit(config->base); in dsi_mcux_detach()
372 /* Call IMX RT clock function to gate clocks and power at SOC level */ in dsi_mcux_detach()
382 const struct mcux_mipi_dsi_config *config = dev->config; in dsi_mcux_transfer()
388 dsi_xfer.txDataSize = msg->tx_len; in dsi_mcux_transfer()
389 dsi_xfer.txData = msg->tx_buf; in dsi_mcux_transfer()
390 dsi_xfer.rxDataSize = msg->rx_len; in dsi_mcux_transfer()
391 dsi_xfer.rxData = msg->rx_buf; in dsi_mcux_transfer()
393 dsi_xfer.flags = (msg->flags & MIPI_DSI_MSG_USE_LPM) ? 0 : kDSI_TransferUseHighSpeed; in dsi_mcux_transfer()
395 switch (msg->type) { in dsi_mcux_transfer()
398 return -ENOTSUP; in dsi_mcux_transfer()
401 dsi_xfer.dscCmd = msg->cmd; in dsi_mcux_transfer()
406 dsi_xfer.dscCmd = msg->cmd; in dsi_mcux_transfer()
411 dsi_xfer.dscCmd = msg->cmd; in dsi_mcux_transfer()
413 if (msg->flags & MCUX_DSI_2L_FB_DATA) { in dsi_mcux_transfer()
415 * Special case- transfer framebuffer data using in dsi_mcux_transfer()
422 return -EIO; in dsi_mcux_transfer()
445 return -ENOTSUP; in dsi_mcux_transfer()
447 LOG_ERR("Unsupported message type (%d)", msg->type); in dsi_mcux_transfer()
448 return -ENOTSUP; in dsi_mcux_transfer()
451 status = DSI_TransferBlocking(config->base, &dsi_xfer); in dsi_mcux_transfer()
454 return -EIO; in dsi_mcux_transfer()
457 if (msg->rx_len != 0) { in dsi_mcux_transfer()
459 return msg->rx_len; in dsi_mcux_transfer()
463 return msg->tx_len; in dsi_mcux_transfer()
475 const struct mcux_mipi_dsi_config *config = dev->config; in mcux_mipi_dsi_init()
476 struct mcux_mipi_dsi_data *data = dev->data; in mcux_mipi_dsi_init()
480 config->irq_config_func(dev); in mcux_mipi_dsi_init()
483 k_sem_init(&data->transfer_sem, 0, 1); in mcux_mipi_dsi_init()
485 if (!device_is_ready(config->bit_clk_dev) || in mcux_mipi_dsi_init()
486 !device_is_ready(config->esc_clk_dev) || in mcux_mipi_dsi_init()
487 !device_is_ready(config->pixel_clk_dev)) { in mcux_mipi_dsi_init()
488 return -ENODEV; in mcux_mipi_dsi_init()