auofb_ioctl.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * auofb_ioctl.h
  3. *
  4. * Copyright 2009 Bookeen <devs@bookeen.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  18. * MA 02110-1301, USA.
  19. */
  20. #ifndef AUOFB_IOCTL_H
  21. #define AUOFB_IOCTL_H
  22. #define AUO_FIRMWARE_VERSION 39
  23. #pragma pack(1)
  24. typedef struct sAUOCommand_t
  25. {
  26. unsigned long cmd;
  27. unsigned short params[5];
  28. unsigned long datalen;
  29. unsigned short *data;
  30. } sAUOCommand;
  31. #pragma pack()
  32. /* [MTR]: Epson_S1D13521 Like command interface for AUO TCON K1900 */
  33. #define IOCTL_AUO_PREFIX ('A' << 8)
  34. #define IOCTL_AUO_SENDCOMMAND (IOCTL_AUO_PREFIX | 0x01)
  35. #define IOCTL_AUO_RESET (IOCTL_AUO_PREFIX | 0x02)
  36. #define IOCTL_AUO_SLEEP (IOCTL_AUO_PREFIX | 0x03)
  37. #define IOCTL_AUO_WAKEUP (IOCTL_AUO_PREFIX | 0x04)
  38. #define IOCTL_AUO_POWERON (IOCTL_AUO_PREFIX | 0x05)
  39. #define IOCTL_AUO_POWEROFF (IOCTL_AUO_PREFIX | 0x06)
  40. #define IOCTL_AUO_UPDATEFW (IOCTL_AUO_PREFIX | 0x07)
  41. #define IOCTL_AUO_PROGRESSBAR (IOCTL_AUO_PREFIX | 0x08)
  42. #define IOCTL_AUO_WAITBUSY (IOCTL_AUO_PREFIX | 0x09)
  43. /* Command definition *
  44. * 3322 2222 2222 1111 1111 1100 0000 0000 *
  45. * 1098 7654 3210 9876 5432 1098 7654 3210 *
  46. * --------------------------------------- *
  47. * RWD pppp CCCC CCCC CCCC CCCC *
  48. *
  49. * R = 'Read Command' (0 mean write, 1 mean read)
  50. * W = 'need_wait'
  51. * D = 'have_data'
  52. * p = 'nb_param'
  53. * C = "command"
  54. */
  55. #define SET_AUO_COMMAND_EXT(command, nb_param, have_data, need_wait, read_write) \
  56. ( ((need_wait & 0x01) << 29) |\
  57. ((have_data & 0x01) << 28) |\
  58. ((nb_param & 0x0F) << 20) |\
  59. ((read_write & 0x01) << 30) |\
  60. (command & 0xFFFF) )
  61. #define SET_AUO_WRITE_COMMAND(command, nb_param, have_data, need_wait) SET_AUO_COMMAND_EXT(command, nb_param, have_data, need_wait, 0)
  62. #define SET_AUO_COMMAND SET_AUO_WRITE_COMMAND
  63. #define SET_AUO_READ_COMMAND(command, nb_param, have_data, need_wait) SET_AUO_COMMAND_EXT(command, nb_param, have_data, need_wait, 1)
  64. #if (AUO_FIRMWARE_VERSION >= 33) /* Command set for TCON firmware v33 and more */
  65. /* Initialisation commands */
  66. #define AUOCMD_INIT_SET SET_AUO_COMMAND(0x0000, 1, 0, 1)
  67. #define AUOCMD_TCON_RESET SET_AUO_COMMAND(0x0003, 1, 0, 0)
  68. #define AUOCMD_VCOM_FRAMERATE SET_AUO_COMMAND(0x0004, 1, 0, 0)
  69. /* Power management */
  70. #define AUOCMD_STANDBY SET_AUO_COMMAND(0x0001, 1, 0, 1)
  71. #define AUOCMD_WAKEUP SET_AUO_COMMAND(0x0002, 0, 0, 0)
  72. /* Display commands */
  73. #define AUOCMD_DISPLAY_START SET_AUO_COMMAND(0x1001, 4, 1, 1)
  74. #define AUOCMD_DISPLAY_STOP SET_AUO_COMMAND(0x1002, 0, 0, 1)
  75. #define AUOCMD_DISPLAY_REFRESH SET_AUO_COMMAND(0x1004, 0, 0, 1)
  76. #define AUOCMD_DISPLAY_RESET SET_AUO_COMMAND(0x1005, 0, 0, 1)
  77. #define AUOCMD_PRE_DISPLAY_START SET_AUO_COMMAND(0x100D, 0, 1, 1)
  78. #define AUOCMD_PRE_DISPLAY_STOP SET_AUO_COMMAND(0x100F, 0, 0, 1)
  79. /* LUT */
  80. #define AUOCMD_LUT_START SET_AUO_WRITE_COMMAND(0x1003, 0, 1, 1)
  81. #define AUOCMD_LUT_STOP SET_AUO_WRITE_COMMAND(0x1009, 0, 0, 1)
  82. #define AUOCMD_LUT_READ SET_AUO_READ_COMMAND(0x4003, 0, 1, 1)
  83. /* Other commands */
  84. #define AUOCMD_READ_FUNC SET_AUO_READ_COMMAND(0x4000, 0, 1, 1)
  85. #define AUOCMD_READ_STATUS SET_AUO_READ_COMMAND(0x4001, 0, 1, 0)
  86. #define AUOCMD_LUMINANCE_BAL SET_AUO_READ_COMMAND(0x5001, 0, 1, 1)
  87. /* Handwriting (MODE4) related commands */
  88. #define AUOCMD_HANDW_PARAM_SET SET_AUO_WRITE_COMMAND(0x5002, 1, 0, 1)
  89. /*** TODO: We should add command parameters defined here */
  90. #else
  91. #define AUOCMD_INIT_SET SET_AUO_COMMAND(0x0000, 1, 0, 1)
  92. #define AUOCMD_STANDBY SET_AUO_COMMAND(0x0001, 0, 0, 1)
  93. #define AUOCMD_WAKEUP SET_AUO_COMMAND(0x0002, 0, 0, 0)
  94. #define AUOCMD_DISPLAY_START SET_AUO_COMMAND(0x1001, 4, 1, 1)
  95. #define AUOCMD_DISPLAY_STOP SET_AUO_COMMAND(0x1002, 0, 0, 1)
  96. #define AUOCMD_DISPLAY_REFRESH SET_AUO_COMMAND(0x1004, 0, 0, 1)
  97. #define AUOCMD_DISPLAY_RESET SET_AUO_COMMAND(0x1005, 0, 0, 1)
  98. #endif
  99. #define AUO_DSPPARAM_FLASH (1 << 15)
  100. #define AUO_DSPPARAM_MODE_GRAYwFLASH (0x00 << 12) /* Mode 0: Gray 4bit With Flash */
  101. #define AUO_DSPPARAM_MODE_GRAYnFLASH (0x01 << 12) /* Mode 1: Gray 4bit Without flash */
  102. #define AUO_DSPPARAM_MODE_TEXT (0x02 << 12) /* Mode 2: Text mode 2bit */
  103. #define AUO_DSPPARAM_MODE_HIGHSPEED (0x03 << 12) /* Mode 3: Highspeed mode 1bit */
  104. #define AUO_DSPPARAM_MODE_HANDWRITE (0x04 << 12) /* Mode 4: Handwriting mode 1bit */
  105. /* INIT_SET command parameters */
  106. #define AUO_INITPARAM_OUT_DATA_ARR (0x01 << 5) /* Set to 0 (default) for normal, 1 for inverse byte order */
  107. #define AUO_INITPARAM_RESOL_800x600 (0x00 << 2) /* Set to 800x600 (default) */
  108. #define AUO_INITPARAM_RESOL_1024x768 (0x01 << 2) /* Set to 1024x768 */
  109. #define AUO_INITPARAM_RESOL_600x800 (0x04 << 2) /* Set to 600x800 */
  110. #define AUO_INITPARAM_RESOL_768x1024 (0x05 << 2) /* Set to 768x1024 */
  111. #define AUO_INITPARAM_UD_FUNC (0x01 << 1) /* Set to 0 (default) to scan down, 1 to scan up */
  112. #define AUO_INITPARAM_SHL_FUNC (0x01 << 0) /* Set to 0 to shift left, 1 (default) to scan right */
  113. #define AUO_INITPARAM_IN_DATA_ARR (0x01 << 6) /* Set to 0 (default) for normal, 1 for inverse byte order */
  114. #define AUO_INITPARAM_INV_DISPLAY (0x01 << 9) /* Set to 0 (default) for normal colors, 1 for inversed colors */
  115. #define AUO_INITPARAM_ROTATION_000 (0x00 << 10) /* Set the rotation to 0° (0) */
  116. #define AUO_INITPARAM_ROTATION_090 (0x01 << 10) /* Set the rotation to 90° (PI/2) */
  117. #define AUO_INITPARAM_ROTATION_180 (0x02 << 10) /* Set the rotation to 180° (PI) */
  118. #define AUO_INITPARAM_ROTATION_270 (0x03 << 10) /* Set the rotation to 270° (1.5*PI) */
  119. #define AUO_INITPARAM_DATA_FILTER (0x01 << 12) /* Data filter (1: active, 0: inactive) */
  120. #define AUO_INITPARAM_TEMP_AVERAGE (0x01 << 13) /* Temperature average (1: active, 0: inactive) */
  121. /* Please, do not use these #define s */
  122. #define GET_COMMAND_PARAM_NUM(command) ((command >> 20) & 0x0F)
  123. #define GET_COMMAND_HAVE_DATA(command) ((command >> 28) & 0x01)
  124. #define GET_COMMAND_NEED_WAIT(command) ((command >> 29) & 0x01)
  125. #define GET_COMMAND_READ_WRITE(command) ((command >> 30) & 0x01)
  126. #define AUOCMD_EQUAL(c,v) (((c) & 0xFFFF) == ((v) & 0xFFFF))
  127. #endif /* AUOFB_IOCTL_H */