panel_sh8601z0.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (c) 2020 Actions Technology Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef PANEL_SH8601Z0_DRIVER_H__
  7. #define PANEL_SH8601Z0_DRIVER_H__
  8. #define DDIC_CMD_NOP 0x00 /* No Operation */
  9. #define DDIC_CMD_SWRESET 0x01 /* Software Reset */
  10. #define DDIC_CMD_RDDID 0x04 /* Read Display ID */
  11. #define DDIC_CMD_RDNUMED 0x05 /* Read Number of Errors on DSI */
  12. #define DDIC_CMD_RDDPM 0x0A /* Read Display Power Mode */
  13. #define DDIC_CMD_RDDMADCTL 0x0B /* Read Display MADCTL */
  14. #define DDIC_CMD_RDDCOLMOD 0x0C /* Read Display Pixel Format */
  15. #define DDIC_CMD_RDDIM 0x0D /* Read Display Image Mode */
  16. #define DDIC_CMD_RDDSM 0x0E /* Read Display Signal Mode */
  17. #define DDIC_CMD_RDDSDR 0x0F /* Read Display Self-Diagnostic Result */
  18. #define DDIC_CMD_SLPIN 0x10 /* Sleep In */
  19. #define DDIC_CMD_SLPOUT 0x11 /* Sleep Out */
  20. #define DDIC_CMD_PTLON 0x12 /* Partial Display Mode On */
  21. #define DDIC_CMD_NORON 0x13 /* Normal Display Mode On */
  22. #define DDIC_CMD_INVOFF 0x20 /* Display Inversion Off */
  23. #define DDIC_CMD_INVON 0x21 /* Display Inversion On */
  24. #define DDIC_CMD_ALLPOFF 0x22 /* All Pixel Off */
  25. #define DDIC_CMD_ALLPON 0x23 /* All Pixel On */
  26. #define DDIC_CMD_DISPOFF 0x28 /* Display Off */
  27. #define DDIC_CMD_DISPON 0x29 /* Display On */
  28. #define DDIC_CMD_CASET 0x2A /* Column Address Set */
  29. #define DDIC_CMD_PASET 0x2B /* Page Address Set */
  30. #define DDIC_CMD_RAMWR 0x2C /* Memory Write Start */
  31. #define DDIC_CMD_PTLAR 0x30 /* Partial Area Row Set */
  32. #define DDIC_CMD_PTLAC 0x31 /* Partial Area Column Set */
  33. #define DDIC_CMD_TEOFF 0x34 /* Tearing Effect OFF */
  34. #define DDIC_CMD_TEON 0x35 /* Tearing Effect ON */
  35. #define DDIC_CMD_MADCTL 0x36 /* Memory Data Access Control */
  36. #define DDIC_CMD_IDMOFF 0x38 /* Idle Mode Off */
  37. #define DDIC_CMD_IDMON 0x39 /* Idle Mode On */
  38. #define DDIC_CMD_COLMOD 0x3A /* Control Interface Pixel Format */
  39. #define DDIC_CMD_RAMWRC 0x3C /* Memory Write Continue */
  40. #define DDIC_CMD_TESCAN 0x44 /* Set Tear Scan Line */
  41. #define DDIC_CMD_RDSCAN 0x45 /* Read Scan Line Number */
  42. #define DDIC_CMD_SPI_RDOFF 0x46 /* SPI Read Off */
  43. #define DDIC_CMD_SPI_RDON 0x47 /* SPI Read On */
  44. #define DDIC_CMD_AODOFF 0x48 /* AOD Mode Off */
  45. #define DDIC_CMD_AODON 0x49 /* AOD Mode On */
  46. #define DDIC_CMD_AOD_WRDISBV 0x4A /* Write Display Brightness Value in AOD Mode */
  47. #define DDIC_CMD_AOD_RDDISBV 0x4B /* Read Display Brightness Value in AOD Mode */
  48. #define DDIC_CMD_DSTB 0x4F /* Deep Standby Control */
  49. #define DDIC_CMD_WRDISBV 0x51 /* Write Display Brightness Value */
  50. #define DDIC_CMD_RDDISBV 0x52 /* Read Display Brightness Value */
  51. #define DDIC_CMD_WRCTRLD1 0x53 /* Write CTRL Display 1 */
  52. #define DDIC_CMD_RDCTRLD1 0x54 /* Read CTRL Display 1 */
  53. #define DDIC_CMD_WRCTRLD2 0x55 /* Write CTRL Display 2 */
  54. #define DDIC_CMD_RDCTRLD2 0x56 /* Read CTRL Display 2 */
  55. #define DDIC_CMD_WR_CE 0x58 /* Write CE (Color Enhancement) */
  56. #define DDIC_CMD_RD_CE 0x59 /* Read CE (Color Enhancement) */
  57. #define DDIC_CMD_HBM_WRDISBV 0x63 /* Write Display Brightness Value in HBM Mode */
  58. #define DDIC_CMD_HBM_RDDISBV 0x64 /* Read Display Brightness Value in HBM Mode */
  59. #define DDIC_CMD_HBMCTL 0x66 /* HBM Control */
  60. #define DDIC_CMD_COLSET0 0x70 /* SPI 1-1-1 Pixel Format Set */
  61. #define DDIC_CMD_COLSET1 0x71 /* SPI 1-1-1 Pixel Format Set */
  62. #define DDIC_CMD_COLSET2 0x72 /* SPI 1-1-1 Pixel Format Set */
  63. #define DDIC_CMD_COLSET3 0x73 /* SPI 1-1-1 Pixel Format Set */
  64. #define DDIC_CMD_COLSET4 0x74 /* SPI 1-1-1 Pixel Format Set */
  65. #define DDIC_CMD_COLSET5 0x75 /* SPI 1-1-1 Pixel Format Set */
  66. #define DDIC_CMD_COLSET6 0x76 /* SPI 1-1-1 Pixel Format Set */
  67. #define DDIC_CMD_COLSET7 0x77 /* SPI 1-1-1 Pixel Format Set */
  68. #define DDIC_CMD_COLSET8 0x78 /* SPI 1-1-1 Pixel Format Set */
  69. #define DDIC_CMD_COLSET9 0x79 /* SPI 1-1-1 Pixel Format Set */
  70. #define DDIC_CMD_COLSET10 0x7A /* SPI 1-1-1 Pixel Format Set */
  71. #define DDIC_CMD_COLSET11 0x7B /* SPI 1-1-1 Pixel Format Set */
  72. #define DDIC_CMD_COLSET12 0x7C /* SPI 1-1-1 Pixel Format Set */
  73. #define DDIC_CMD_COLSET13 0x7D /* SPI 1-1-1 Pixel Format Set */
  74. #define DDIC_CMD_COLSET14 0x7E /* SPI 1-1-1 Pixel Format Set */
  75. #define DDIC_CMD_COLSET15 0x7F /* SPI 1-1-1 Pixel Format Set */
  76. #define DDIC_CMD_COLOPT 0x80 /* SPI 1-1-1/256 Pixel Format Option */
  77. #define DDIC_CMD_RDDDBS 0xA1 /* Read DDB Start */
  78. #define DDIC_CMD_RDDDBC 0xA8 /* Read DDB Continue */
  79. #define DDIC_CMD_RDFCS 0xAA /* Read First Checksum */
  80. #define DDIC_CMD_RDCCS 0xAF /* Read Continue Checksum */
  81. #define DDIC_CMD_SPI_MODE 0xC4 /* SPI Mode Control */
  82. #define DDIC_CMD_RDID1 0xDA /* Read ID1 */
  83. #define DDIC_CMD_RDID2 0xDB /* Read ID2 */
  84. #define DDIC_CMD_RDID3 0xDC /* Read ID3 */
  85. #define DDIC_QSPI_CMD_RD(cmd) ((0x03 << 24) | ((uint32_t)(cmd) << 8))
  86. #define DDIC_QSPI_CMD_WR(cmd) ((0x02 << 24) | ((uint32_t)(cmd) << 8))
  87. #define DDIC_QSPI_CMD_RAMWR(cmd) ((0x32 << 24) | ((uint32_t)(cmd) << 8))
  88. #if 0
  89. #define DDIC_CMD_DELAY 0xFF
  90. typedef struct panel_regcfg {
  91. uint8_t cmd; /* (write) command */
  92. uint8_t len; /* parameter length or delay milliseconds */
  93. uint8_t dat[4]; /* parameter list */
  94. } panel_regcfg_t;
  95. static inline void panel_apply_config(
  96. const struct device *lcdc_dev, panel_regcfg_t *cfg, int num)
  97. {
  98. for (; num > 0; num--, cfg++) {
  99. if (cfg->cmd == DDIC_CMD_DELAY) {
  100. k_msleep(cfg->len);
  101. } else {
  102. display_controller_write_config(lcdc_dev,
  103. DDIC_QSPI_CMD_WR(cfg->cmd), cfg->dat, cfg->len);
  104. }
  105. }
  106. }
  107. #endif
  108. #endif /* PANEL_SH8601Z0_DRIVER_H__ */