/* * auofb_ioctl.h * * Copyright 2009 Bookeen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ #ifndef AUOFB_IOCTL_H #define AUOFB_IOCTL_H #define AUO_FIRMWARE_VERSION 39 #pragma pack(1) typedef struct sAUOCommand_t { unsigned long cmd; unsigned short params[5]; unsigned long datalen; unsigned short *data; } sAUOCommand; #pragma pack() /* [MTR]: Epson_S1D13521 Like command interface for AUO TCON K1900 */ #define IOCTL_AUO_PREFIX ('A' << 8) #define IOCTL_AUO_SENDCOMMAND (IOCTL_AUO_PREFIX | 0x01) #define IOCTL_AUO_RESET (IOCTL_AUO_PREFIX | 0x02) #define IOCTL_AUO_SLEEP (IOCTL_AUO_PREFIX | 0x03) #define IOCTL_AUO_WAKEUP (IOCTL_AUO_PREFIX | 0x04) #define IOCTL_AUO_POWERON (IOCTL_AUO_PREFIX | 0x05) #define IOCTL_AUO_POWEROFF (IOCTL_AUO_PREFIX | 0x06) #define IOCTL_AUO_UPDATEFW (IOCTL_AUO_PREFIX | 0x07) #define IOCTL_AUO_PROGRESSBAR (IOCTL_AUO_PREFIX | 0x08) #define IOCTL_AUO_WAITBUSY (IOCTL_AUO_PREFIX | 0x09) /* Command definition * * 3322 2222 2222 1111 1111 1100 0000 0000 * * 1098 7654 3210 9876 5432 1098 7654 3210 * * --------------------------------------- * * RWD pppp CCCC CCCC CCCC CCCC * * * R = 'Read Command' (0 mean write, 1 mean read) * W = 'need_wait' * D = 'have_data' * p = 'nb_param' * C = "command" */ #define SET_AUO_COMMAND_EXT(command, nb_param, have_data, need_wait, read_write) \ ( ((need_wait & 0x01) << 29) |\ ((have_data & 0x01) << 28) |\ ((nb_param & 0x0F) << 20) |\ ((read_write & 0x01) << 30) |\ (command & 0xFFFF) ) #define SET_AUO_WRITE_COMMAND(command, nb_param, have_data, need_wait) SET_AUO_COMMAND_EXT(command, nb_param, have_data, need_wait, 0) #define SET_AUO_COMMAND SET_AUO_WRITE_COMMAND #define SET_AUO_READ_COMMAND(command, nb_param, have_data, need_wait) SET_AUO_COMMAND_EXT(command, nb_param, have_data, need_wait, 1) #if (AUO_FIRMWARE_VERSION >= 33) /* Command set for TCON firmware v33 and more */ /* Initialisation commands */ #define AUOCMD_INIT_SET SET_AUO_COMMAND(0x0000, 1, 0, 1) #define AUOCMD_TCON_RESET SET_AUO_COMMAND(0x0003, 1, 0, 0) #define AUOCMD_VCOM_FRAMERATE SET_AUO_COMMAND(0x0004, 1, 0, 0) /* Power management */ #define AUOCMD_STANDBY SET_AUO_COMMAND(0x0001, 1, 0, 1) #define AUOCMD_WAKEUP SET_AUO_COMMAND(0x0002, 0, 0, 0) /* Display commands */ #define AUOCMD_DISPLAY_START SET_AUO_COMMAND(0x1001, 4, 1, 1) #define AUOCMD_DISPLAY_STOP SET_AUO_COMMAND(0x1002, 0, 0, 1) #define AUOCMD_DISPLAY_REFRESH SET_AUO_COMMAND(0x1004, 0, 0, 1) #define AUOCMD_DISPLAY_RESET SET_AUO_COMMAND(0x1005, 0, 0, 1) #define AUOCMD_PRE_DISPLAY_START SET_AUO_COMMAND(0x100D, 0, 1, 1) #define AUOCMD_PRE_DISPLAY_STOP SET_AUO_COMMAND(0x100F, 0, 0, 1) /* LUT */ #define AUOCMD_LUT_START SET_AUO_WRITE_COMMAND(0x1003, 0, 1, 1) #define AUOCMD_LUT_STOP SET_AUO_WRITE_COMMAND(0x1009, 0, 0, 1) #define AUOCMD_LUT_READ SET_AUO_READ_COMMAND(0x4003, 0, 1, 1) /* Other commands */ #define AUOCMD_READ_FUNC SET_AUO_READ_COMMAND(0x4000, 0, 1, 1) #define AUOCMD_READ_STATUS SET_AUO_READ_COMMAND(0x4001, 0, 1, 0) #define AUOCMD_LUMINANCE_BAL SET_AUO_READ_COMMAND(0x5001, 0, 1, 1) /* Handwriting (MODE4) related commands */ #define AUOCMD_HANDW_PARAM_SET SET_AUO_WRITE_COMMAND(0x5002, 1, 0, 1) /*** TODO: We should add command parameters defined here */ #else #define AUOCMD_INIT_SET SET_AUO_COMMAND(0x0000, 1, 0, 1) #define AUOCMD_STANDBY SET_AUO_COMMAND(0x0001, 0, 0, 1) #define AUOCMD_WAKEUP SET_AUO_COMMAND(0x0002, 0, 0, 0) #define AUOCMD_DISPLAY_START SET_AUO_COMMAND(0x1001, 4, 1, 1) #define AUOCMD_DISPLAY_STOP SET_AUO_COMMAND(0x1002, 0, 0, 1) #define AUOCMD_DISPLAY_REFRESH SET_AUO_COMMAND(0x1004, 0, 0, 1) #define AUOCMD_DISPLAY_RESET SET_AUO_COMMAND(0x1005, 0, 0, 1) #endif #define AUO_DSPPARAM_FLASH (1 << 15) #define AUO_DSPPARAM_MODE_GRAYwFLASH (0x00 << 12) /* Mode 0: Gray 4bit With Flash */ #define AUO_DSPPARAM_MODE_GRAYnFLASH (0x01 << 12) /* Mode 1: Gray 4bit Without flash */ #define AUO_DSPPARAM_MODE_TEXT (0x02 << 12) /* Mode 2: Text mode 2bit */ #define AUO_DSPPARAM_MODE_HIGHSPEED (0x03 << 12) /* Mode 3: Highspeed mode 1bit */ #define AUO_DSPPARAM_MODE_HANDWRITE (0x04 << 12) /* Mode 4: Handwriting mode 1bit */ /* INIT_SET command parameters */ #define AUO_INITPARAM_OUT_DATA_ARR (0x01 << 5) /* Set to 0 (default) for normal, 1 for inverse byte order */ #define AUO_INITPARAM_RESOL_800x600 (0x00 << 2) /* Set to 800x600 (default) */ #define AUO_INITPARAM_RESOL_1024x768 (0x01 << 2) /* Set to 1024x768 */ #define AUO_INITPARAM_RESOL_600x800 (0x04 << 2) /* Set to 600x800 */ #define AUO_INITPARAM_RESOL_768x1024 (0x05 << 2) /* Set to 768x1024 */ #define AUO_INITPARAM_UD_FUNC (0x01 << 1) /* Set to 0 (default) to scan down, 1 to scan up */ #define AUO_INITPARAM_SHL_FUNC (0x01 << 0) /* Set to 0 to shift left, 1 (default) to scan right */ #define AUO_INITPARAM_IN_DATA_ARR (0x01 << 6) /* Set to 0 (default) for normal, 1 for inverse byte order */ #define AUO_INITPARAM_INV_DISPLAY (0x01 << 9) /* Set to 0 (default) for normal colors, 1 for inversed colors */ #define AUO_INITPARAM_ROTATION_000 (0x00 << 10) /* Set the rotation to 0° (0) */ #define AUO_INITPARAM_ROTATION_090 (0x01 << 10) /* Set the rotation to 90° (PI/2) */ #define AUO_INITPARAM_ROTATION_180 (0x02 << 10) /* Set the rotation to 180° (PI) */ #define AUO_INITPARAM_ROTATION_270 (0x03 << 10) /* Set the rotation to 270° (1.5*PI) */ #define AUO_INITPARAM_DATA_FILTER (0x01 << 12) /* Data filter (1: active, 0: inactive) */ #define AUO_INITPARAM_TEMP_AVERAGE (0x01 << 13) /* Temperature average (1: active, 0: inactive) */ /* Please, do not use these #define s */ #define GET_COMMAND_PARAM_NUM(command) ((command >> 20) & 0x0F) #define GET_COMMAND_HAVE_DATA(command) ((command >> 28) & 0x01) #define GET_COMMAND_NEED_WAIT(command) ((command >> 29) & 0x01) #define GET_COMMAND_READ_WRITE(command) ((command >> 30) & 0x01) #define AUOCMD_EQUAL(c,v) (((c) & 0xFFFF) == ((v) & 0xFFFF)) #endif /* AUOFB_IOCTL_H */