0003-rotated-screen-90-degrees-CW.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From 538e97d56bae968580ac046389243383b7559ab9 Mon Sep 17 00:00:00 2001
  2. From: Michel Stempin <michel.stempin@wanadoo.fr>
  3. Date: Tue, 19 Mar 2019 22:26:56 +0100
  4. Subject: [PATCH 9/9] rotated screen 90 degrees CW
  5. Signed-off-by: Michel Stempin <michel.stempin@wanadoo.fr>
  6. ---
  7. arch/arm/boot/dts/sun8i-v3s-licheepi-zero.dts | 2 +-
  8. drivers/staging/fbtft/fb_st7789v.c | 13 ++++++++++---
  9. drivers/staging/fbtft/fbtft-core.c | 8 +++++++-
  10. 3 files changed, 18 insertions(+), 5 deletions(-)
  11. diff --git a/drivers/staging/fbtft/fb_st7789v.c b/drivers/staging/fbtft/fb_st7789v.c
  12. index 69f52af..e966993 100644
  13. --- a/drivers/staging/fbtft/fb_st7789v.c
  14. +++ b/drivers/staging/fbtft/fb_st7789v.c
  15. @@ -150,9 +150,6 @@ static int init_display(struct fbtft_par *par)
  16. */
  17. write_reg(par, PWCTRL1, 0xA4, 0xA1);
  18. - /* Ystart at 80 , Yend at 240 */
  19. - write_reg(par, 0x2B, 0x00, 0x50, 0x00, 0xF0);
  20. -
  21. /* Display Inversion of colors */
  22. write_reg(par, 0x21);
  23. @@ -190,6 +187,16 @@ static int set_var(struct fbtft_par *par)
  24. return -EINVAL;
  25. }
  26. write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, madctl_par);
  27. +
  28. + // All offset operations are done after in fbtft_set_addr_win, not here
  29. + /* Ystart at 0 , Yend at 239 */
  30. + //write_reg(par, 0x2B, 0x00, 0x50, 0x00, 0xEF);
  31. + write_reg(par, 0x2B, 0x00, 0x00, 0x00, 0xEF);
  32. + //write_reg(par, 0x2B, 0x00, 0x50, 0x01, 0x3F);
  33. + /* Xstart at 80 , Xend at 319 */
  34. + write_reg(par, 0x2A, 0x00, 0x50, 0x01, 0x3F);
  35. + //write_reg(par, 0x2A, 0x00, 0x50, 0x00, 0xEF);
  36. +
  37. return 0;
  38. }
  39. diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
  40. index 6d0363d..fbb0934 100644
  41. --- a/drivers/staging/fbtft/fbtft-core.c
  42. +++ b/drivers/staging/fbtft/fbtft-core.c
  43. @@ -391,9 +391,15 @@ static void fbtft_update_display(struct fbtft_par *par, unsigned int start_line,
  44. fbtft_par_dbg(DEBUG_UPDATE_DISPLAY, par, "%s(start_line=%u, end_line=%u)\n",
  45. __func__, start_line, end_line);
  46. - if (par->fbtftops.set_addr_win)
  47. + // Carefull removing this. this will work only if the full screen is updated at once
  48. + /*if (par->fbtftops.set_addr_win){
  49. par->fbtftops.set_addr_win(par, 0, start_line,
  50. par->info->var.xres - 1, end_line);
  51. + }*/
  52. + if (par->fbtftops.set_addr_win){
  53. + par->fbtftops.set_addr_win(par, 80, start_line,
  54. + 320 - 1, end_line);
  55. + }
  56. offset = start_line * par->info->fix.line_length;
  57. len = (end_line - start_line + 1) * par->info->fix.line_length;
  58. --
  59. 2.7.4