rda_mipi_dsi.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef RDA_MIPI_DSI_H
  2. #define RDA_MIPI_DSI_H
  3. #include "rda_lcdc.h"
  4. struct rda_dsi_cmd
  5. {
  6. int dtype;
  7. int delay;
  8. int dlen;
  9. const char *payload;
  10. };
  11. enum mipi_mode
  12. {
  13. DSI_VIDEO_MODE,
  14. DSI_CMD_MODE,
  15. };
  16. enum dsi_tx_mode
  17. {
  18. DSI_CMD,
  19. DSI_PULSE,
  20. DSI_EVENT,
  21. DSI_BURST
  22. };
  23. enum dsi_cmd_mode
  24. {
  25. CMD_LP_MODE,
  26. CMD_HS_MODE
  27. };
  28. enum mipi_pixel_fmt
  29. {
  30. DSI_FMT_RGB565 = 0,
  31. DSI_FMT_RGB666,
  32. DSI_FMT_RGB666L,
  33. DSI_FMT_RGB888
  34. };
  35. #define DSI_HDR_SHORT_PKT (0 << 5) /*or 0x1*/
  36. #define DSI_HDR_LONG_PKT (0x2 << 5) /*or 0x3*/
  37. #define DSI_HDR_BTA (1 << 0)
  38. #define DSI_HDR_HS (1 << 1)
  39. #define DSI_HDR_CMD_REG (0x3 << 2)
  40. #define DSI_HDR_VC(vc) (((vc)&0x03) << 14)
  41. #define DSI_HDR_DTYPE(dtype) (((dtype)&0x03f) << 8)
  42. #define DSI_HDR_DATA2(data) (((data)&0x0ff) << 24)
  43. #define DSI_HDR_DATA1(data) (((data)&0x0ff) << 16)
  44. #define DSI_HDR_WC(wc) (((wc)&0x0ffff) << 16)
  45. #define DSI_LONG_PKT_DATA0(data) (((data)&0x0ff) << 0)
  46. #define DSI_LONG_PKT_DATA1(data) (((data)&0x0ff) << 8)
  47. #define DSI_LONG_PKT_DATA2(data) (((data)&0x0ff) << 16)
  48. #define DSI_LONG_PKT_DATA3(data) (((data)&0x0ff) << 24)
  49. /* dcs read/write */
  50. #define DTYPE_DCS_SWRITE 0x05 /* short write,with 0 parameter */
  51. /* mark */
  52. #define DTYPE_DCS_SWRITE_1_PARAM 0x15 /* short write,with 1 parameter */
  53. #define DTYPE_DCS_READ 0x06
  54. #define DTYPE_MAX_PKTSIZE 0x37
  55. #define DTYPE_DCS_LWRITE 0x39 /* long write */
  56. /* dcs response */
  57. #define DTYPE_ACK_ERR_RESP 0x02
  58. #define DTYPE_EOT_RESP 0x08 /* end of tx */
  59. #define DTYPE_GEN_READ1_RESP 0x11 /* 1 parameter, short */
  60. #define DTYPE_GEN_READ2_RESP 0x12 /* 2 parameter, short */
  61. #define DTYPE_GEN_LREAD_RESP 0x1a
  62. #define DTYPE_DCS_LREAD_RESP 0x1c
  63. #define DTYPE_DCS_READ1_RESP 0x21 /* 1 parameter, short */
  64. #define DTYPE_DCS_READ2_RESP 0x22 /* 2 parameter, short */
  65. void dsi_set_tx_mode(u8 mode);
  66. u8 dsi_get_tx_mode(void);
  67. void dsi_enable(bool on);
  68. void dsi_pll_on(bool enable);
  69. void dsi_op_mode(int mode);
  70. void dsi_swrite(const struct rda_dsi_cmd *cmd);
  71. void dsi_config(const struct lcd_panel_info *lcd);
  72. void set_dsi_ap_pll(const struct rda_dsi_phy_ctrl *pll_phy);
  73. void dsi_irq_clear(void);
  74. void dsi_irq_mask(u32 mask);
  75. u32 dsi_irq_status(void);
  76. int rda_dsi_read_data(u8 *data, u32 len);
  77. void dsi_lwrite(const struct rda_dsi_cmd *cmd);
  78. #endif