-
Notifications
You must be signed in to change notification settings - Fork 8.2k
drivers: display: Add 3wire mode support in st7735 controller #69417
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
drivers: display: Add 3wire mode support in st7735 controller #69417
Conversation
|
Hello @ozersa, and thank you very much for your first pull request to the Zephyr project! |
800fe5d to
213d042
Compare
drivers/display/display_st7735r.c
Outdated
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.
Some additional tab added in some lines to make next commit more clear.
Don't do this. Each commit should be able to pass code style checks
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.
Thanks Maureen for feedback.
Sure.
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.
This property should be moved to dts/bindings/spi/spi-device.yaml and renamed to spi-3wire to be consistent with the Linux kernel.
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.
Today I see st7789v driver, in this driver this option implicitly handled by gpio command.
And MIPI DIB API also does not need additional parameter to select 3/4 wire mode. Please see: mipi_dbi/Kconfig.spi
So it might be better if we totally remove this additional parameter.
Anyway if you think it will be better please let me know.
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.
This can be implemented using the MIPI DBI API, which already implements support for SPI 3 wire mode: https://docs.zephyrproject.org/latest/hardware/peripherals/mipi_dbi.html.
Instead of implementing 3 wire support in the driver, can you instead update this driver to use the MIPI DBI API? That should enable 3 wire support to be added relatively easily
Just a note- although the code the 3 wire support is present in the MIPI DBI SPI mode driver, I don't have a 3 wire mode display to test support with. If you run into issues with the implementation please let me know, I'd be happy to help get this moved over
display_st7735r.c/.h files are reformatted with clang-format to clearly demonstrate additions on next commits. There is no any additional update. Signed-off-by: Sadik Ozer <[email protected]>
213d042 to
bff1e6a
Compare
Thanks for the feedback, I just get a chance to revisit this Please see my updated here: 2e754db Also today I see st7789v driver which handle 3/4 wire mode in the driver, please see: https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/display/display_st7789v.c#L71 Does it make sense we follow st7789v.c format and then in future convert them to MIPI DBI API? |
|
@danieldegrasse @MaureenHelm does it make sense if we follow st7789v.c format and in future update both st7735 and st7789v to use mipi dib driver? |
I'll be honest- this is exactly why I want to convert drivers like this. I unfortunately don't have a 3 wire display to test with, but we need to prove out support for the MIPI DBI 3 wire mode. If we need to make changes to the MIPI DBI driver implementation to get things working with 3 wire mode, PRs like this will catch that. If I converted this driver to use the MIPI DBI API, would you be willing to help test 3 wire support with your display? |
This commit update st7735 display driver to it works with MIPI driver Signed-off-by: Sadik Ozer <[email protected]>
3wire mode requires 9bits, and if data being bigger than 8bits len shall be 2. Signed-off-by: Sadik Ozer <[email protected]>
bff1e6a to
a134e23
Compare
As I mentioned, I have already converted driver to mipi dbi after your first comment, it works with 8bit mode (4wire). but not work for 3wrire mode, seems stop clocking after some bytes, I do not know how should handle spi_release_dt(...) function which exist in old version of st7735r.c driver. I believe this is the reason of the failure for 3wire mode. I am going to check SPI line with logic analyzer. |
Thank you- I really appreciate you looking at this. I took a look at converting this display as well: #70583. I've added the ability to specify the mode in devicetree with that PR- perhaps you could try using 3 wire mode with that change? I added some code to handle |
|
Thanks for the update, today I tried to test it, I cherry picked your commits from nxp fork, but encounter confliction between multiple zephyr forks, |
|
Superseded by #70583 |
st7735 display controller can driver display both over 3wire or 4wire mode.
Existing st7725r.c display controller only supports 4wire mode. This commit add 3wire mode support in the controller.
Both 3wire and 4wire mode tested with MAX32672EVKIT which has CFAF128128B1-0145T display on board.