-
Notifications
You must be signed in to change notification settings - Fork 8.3k
[RFC] drivers: mipi_dbi: add support for mipi_dbi_configure_te #81246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
211389e
4622fb4
f4d6bc2
7ab4386
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,30 @@ extern "C" { | |
| #define MIPI_DBI_CONFIG_DT_INST(inst, operation_, delay_) \ | ||
| MIPI_DBI_CONFIG_DT(DT_DRV_INST(inst), operation_, delay_) | ||
|
|
||
| /** | ||
| * @brief Get the MIPI DBI TE mode from devicetree | ||
| * | ||
| * Gets the MIPI DBI TE mode from a devicetree property. | ||
| * @param node_id Devicetree node identifier for the MIPI DBI device with the | ||
| * TE mode property | ||
| * @param edge_prop Property name for the TE mode that should be read from | ||
| * devicetree | ||
| */ | ||
| #define MIPI_DBI_TE_MODE_DT(node_id, edge_prop) \ | ||
| DT_STRING_UPPER_TOKEN(node_id, edge_prop) | ||
|
|
||
| /** | ||
| * @brief Get the MIPI DBI TE mode for device instance | ||
| * | ||
| * Gets the MIPI DBI TE mode from a devicetree property. Equivalent to | ||
| * MIPI_DBI_TE_MODE_DT(DT_DRV_INST(inst), edge_mode). | ||
| * @param inst Instance of the device to get the TE mode for | ||
| * @param edge_prop Property name for the TE mode that should be read from | ||
| * devicetree | ||
| */ | ||
| #define MIPI_DBI_TE_MODE_DT_INST(inst, edge_prop) \ | ||
| DT_STRING_UPPER_TOKEN(DT_DRV_INST(inst), edge_prop) | ||
|
|
||
| /** | ||
| * @brief MIPI DBI controller configuration | ||
| * | ||
|
|
@@ -141,6 +165,9 @@ __subsystem struct mipi_dbi_driver_api { | |
| int (*reset)(const struct device *dev, k_timeout_t delay); | ||
| int (*release)(const struct device *dev, | ||
| const struct mipi_dbi_config *config); | ||
| int (*configure_te)(const struct device *dev, | ||
| uint8_t edge, | ||
| k_timeout_t delay); | ||
| }; | ||
|
|
||
| /** | ||
|
|
@@ -293,6 +320,45 @@ static inline int mipi_dbi_release(const struct device *dev, | |
| return api->release(dev, config); | ||
| } | ||
|
|
||
| /** | ||
| * @brief Configures MIPI DBI tearing effect signal | ||
| * | ||
| * Many displays provide a tearing effect signal, which can be configured | ||
| * to pulse at each vsync interval or each hsync interval. This signal can be | ||
| * used by the MCU to determine when to transmit a new frame so that the | ||
| * read pointer of the display never overlaps with the write pointer from the | ||
| * MCU. This function configures the MIPI DBI controller to delay transmitting | ||
| * display frames until the selected tearing effect signal edge occurs. | ||
| * | ||
| * The delay will occur on the on each call to @ref mipi_dbi_write_display | ||
| * where the ``frame_incomplete`` flag was set within the buffer descriptor | ||
| * provided with the prior call, as this indicates the buffer being written | ||
| * in this call is the first buffer of a new frame. | ||
| * | ||
| * Note that most display controllers will need to enable the TE signal | ||
| * using vendor specific commands before the MIPI DBI controller can react | ||
| * to it. | ||
| * | ||
| * @param dev mipi dbi controller | ||
| * @param edge which edge of the TE signal to start transmitting on | ||
| * @param delay_us how many microseconds after TE edge to start transmission | ||
|
||
| * @retval -EIO I/O error | ||
| * @retval -ENOSYS not implemented | ||
| * @retval -ENOTSUP not supported | ||
| */ | ||
| static inline int mipi_dbi_configure_te(const struct device *dev, | ||
| uint8_t edge, | ||
| uint32_t delay_us) | ||
| { | ||
| const struct mipi_dbi_driver_api *api = | ||
| (const struct mipi_dbi_driver_api *)dev->api; | ||
|
|
||
| if (api->configure_te == NULL) { | ||
| return -ENOSYS; | ||
| } | ||
| return api->configure_te(dev, edge, K_USEC(delay_us)); | ||
| } | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little confused here; the way this
ifstatement is written, if every single frame isframe_incomplete = false, then thete_syncwill only be active every otherwritecall. Is that intended?I feel like the
elseshould be removed, and theif (!desc->frame_incomplete)should be an independent separate block that gets always executed regardless of the previousifblock.Feel free to correct my thoughts if I'm mistaken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I think you are right here. We always want the next call after one with
frame_incomplete = falseto trigger a TE wait. I'll update this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated