Skip to content

display: st7789v: implement runtime display orientation#105973

Open
ArchitAnant wants to merge 1 commit intozephyrproject-rtos:mainfrom
ArchitAnant:feat/st7789v_rotate
Open

display: st7789v: implement runtime display orientation#105973
ArchitAnant wants to merge 1 commit intozephyrproject-rtos:mainfrom
ArchitAnant:feat/st7789v_rotate

Conversation

@ArchitAnant
Copy link
Copy Markdown
Contributor

Currently, the st7789v driver hardcodes the display orientation to DISPLAY_ORIENTATION_NORMAL and returns -ENOTSUP when a runtime orientation change is requested.

This patch implements the set_orientation() callback by dynamically configuring the MY, MX, and MV bits in the MADCTL (0x36) register based on the requested rotation.

To ensure color correctness, the base MADCTL configuration is preserved from the device tree configuration config->mdac while only the orientation bits are masked and overwritten.

Additionally, the get_capabilities() callback is updated to correctly report the current orientation state and swap the reported X and Y resolutions when the display is in a portrait-to-landscape rotation (90 or 270 degrees).

@sonarqubecloud
Copy link
Copy Markdown

@JarmouniA JarmouniA added this to the v4.5.0 milestone Apr 4, 2026
@JarmouniA
Copy link
Copy Markdown
Contributor

Needs a rebase following #107278

Currently, the st7789v driver hardcodes the display orientation to
DISPLAY_ORIENTATION_NORMAL and returns -ENOTSUP when a runtime
orientation change is requested.

This patch implements the set_orientation() callback by dynamically
configuring the MY, MX, and MV bits in the MADCTL (0x36) register
based on the requested rotation.

To ensure color correctness, the base MADCTL configuration is preserved
from the device tree configuration config->mdac while only the orientation
bits are masked and overwritten.

Additionally, the get_capabilities() callback is updated to correctly
report the current orientation state and swap the reported X and Y
resolutions when the display is in a portrait-to-landscape rotation
(90 or 270 degrees).

Signed-off-by: Archit Anant <architanant5@gmail.com>
@ArchitAnant ArchitAnant force-pushed the feat/st7789v_rotate branch from e163284 to 279b913 Compare April 23, 2026 16:20
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@JarmouniA JarmouniA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide photo(s) or video of testing with sample/drivers/display.

@ArchitAnant
Copy link
Copy Markdown
Contributor Author

Please provide photo(s) or video of testing with sample/drivers/display.

@JarmouniA
I have compile tested the code for fk750m1_vbt6 board with samples/drivers/display.

As I don't possess the hardware, I won't be able to test it on a physical display. However, I have verified the bitmasking logic for the MADCTL register against the ST7789V datasheet and the Linux Kernel implementation to ensure the rotation bits are correct. The build completes cleanly as shown below:

Screenshot 2026-04-25 at 11 54 43 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants