1*f7018c21STomi Valkeinen /* 2*f7018c21STomi Valkeinen * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved. 3*f7018c21STomi Valkeinen * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved. 4*f7018c21STomi Valkeinen 5*f7018c21STomi Valkeinen * This program is free software; you can redistribute it and/or 6*f7018c21STomi Valkeinen * modify it under the terms of the GNU General Public 7*f7018c21STomi Valkeinen * License as published by the Free Software Foundation; 8*f7018c21STomi Valkeinen * either version 2, or (at your option) any later version. 9*f7018c21STomi Valkeinen 10*f7018c21STomi Valkeinen * This program is distributed in the hope that it will be useful, 11*f7018c21STomi Valkeinen * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even 12*f7018c21STomi Valkeinen * the implied warranty of MERCHANTABILITY or FITNESS FOR 13*f7018c21STomi Valkeinen * A PARTICULAR PURPOSE.See the GNU General Public License 14*f7018c21STomi Valkeinen * for more details. 15*f7018c21STomi Valkeinen 16*f7018c21STomi Valkeinen * You should have received a copy of the GNU General Public License 17*f7018c21STomi Valkeinen * along with this program; if not, write to the Free Software 18*f7018c21STomi Valkeinen * Foundation, Inc., 19*f7018c21STomi Valkeinen * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20*f7018c21STomi Valkeinen */ 21*f7018c21STomi Valkeinen 22*f7018c21STomi Valkeinen #ifndef __IOCTL_H__ 23*f7018c21STomi Valkeinen #define __IOCTL_H__ 24*f7018c21STomi Valkeinen 25*f7018c21STomi Valkeinen #ifndef __user 26*f7018c21STomi Valkeinen #define __user 27*f7018c21STomi Valkeinen #endif 28*f7018c21STomi Valkeinen 29*f7018c21STomi Valkeinen /* VIAFB IOCTL definition */ 30*f7018c21STomi Valkeinen #define VIAFB_GET_INFO_SIZE 0x56494101 /* 'VIA\01' */ 31*f7018c21STomi Valkeinen #define VIAFB_GET_INFO 0x56494102 /* 'VIA\02' */ 32*f7018c21STomi Valkeinen #define VIAFB_HOTPLUG 0x56494103 /* 'VIA\03' */ 33*f7018c21STomi Valkeinen #define VIAFB_SET_HOTPLUG_FLAG 0x56494104 /* 'VIA\04' */ 34*f7018c21STomi Valkeinen #define VIAFB_GET_RESOLUTION 0x56494105 /* 'VIA\05' */ 35*f7018c21STomi Valkeinen #define VIAFB_GET_SAMM_INFO 0x56494107 /* 'VIA\07' */ 36*f7018c21STomi Valkeinen #define VIAFB_TURN_ON_OUTPUT_DEVICE 0x56494108 /* 'VIA\08' */ 37*f7018c21STomi Valkeinen #define VIAFB_TURN_OFF_OUTPUT_DEVICE 0x56494109 /* 'VIA\09' */ 38*f7018c21STomi Valkeinen #define VIAFB_GET_DEVICE 0x5649410B 39*f7018c21STomi Valkeinen #define VIAFB_GET_DRIVER_VERSION 0x56494112 /* 'VIA\12' */ 40*f7018c21STomi Valkeinen #define VIAFB_GET_CHIP_INFO 0x56494113 /* 'VIA\13' */ 41*f7018c21STomi Valkeinen #define VIAFB_GET_DEVICE_INFO 0x56494115 42*f7018c21STomi Valkeinen 43*f7018c21STomi Valkeinen #define VIAFB_GET_DEVICE_SUPPORT 0x56494118 44*f7018c21STomi Valkeinen #define VIAFB_GET_DEVICE_CONNECT 0x56494119 45*f7018c21STomi Valkeinen #define VIAFB_GET_PANEL_SUPPORT_EXPAND 0x5649411A 46*f7018c21STomi Valkeinen #define VIAFB_GET_DRIVER_NAME 0x56494122 47*f7018c21STomi Valkeinen #define VIAFB_GET_DEVICE_SUPPORT_STATE 0x56494123 48*f7018c21STomi Valkeinen #define VIAFB_GET_GAMMA_LUT 0x56494124 49*f7018c21STomi Valkeinen #define VIAFB_SET_GAMMA_LUT 0x56494125 50*f7018c21STomi Valkeinen #define VIAFB_GET_GAMMA_SUPPORT_STATE 0x56494126 51*f7018c21STomi Valkeinen #define VIAFB_SYNC_SURFACE 0x56494130 52*f7018c21STomi Valkeinen #define VIAFB_GET_DRIVER_CAPS 0x56494131 53*f7018c21STomi Valkeinen #define VIAFB_GET_IGA_SCALING_INFO 0x56494132 54*f7018c21STomi Valkeinen #define VIAFB_GET_PANEL_MAX_SIZE 0x56494133 55*f7018c21STomi Valkeinen #define VIAFB_GET_PANEL_MAX_POSITION 0x56494134 56*f7018c21STomi Valkeinen #define VIAFB_SET_PANEL_SIZE 0x56494135 57*f7018c21STomi Valkeinen #define VIAFB_SET_PANEL_POSITION 0x56494136 58*f7018c21STomi Valkeinen #define VIAFB_GET_PANEL_POSITION 0x56494137 59*f7018c21STomi Valkeinen #define VIAFB_GET_PANEL_SIZE 0x56494138 60*f7018c21STomi Valkeinen 61*f7018c21STomi Valkeinen #define None_Device 0x00 62*f7018c21STomi Valkeinen #define CRT_Device 0x01 63*f7018c21STomi Valkeinen #define LCD_Device 0x02 64*f7018c21STomi Valkeinen #define DVI_Device 0x08 65*f7018c21STomi Valkeinen #define CRT2_Device 0x10 66*f7018c21STomi Valkeinen #define LCD2_Device 0x40 67*f7018c21STomi Valkeinen 68*f7018c21STomi Valkeinen #define OP_LCD_CENTERING 0x01 69*f7018c21STomi Valkeinen #define OP_LCD_PANEL_ID 0x02 70*f7018c21STomi Valkeinen #define OP_LCD_MODE 0x03 71*f7018c21STomi Valkeinen 72*f7018c21STomi Valkeinen /*SAMM operation flag*/ 73*f7018c21STomi Valkeinen #define OP_SAMM 0x80 74*f7018c21STomi Valkeinen 75*f7018c21STomi Valkeinen #define LCD_PANEL_ID_MAXIMUM 23 76*f7018c21STomi Valkeinen 77*f7018c21STomi Valkeinen #define STATE_ON 0x1 78*f7018c21STomi Valkeinen #define STATE_OFF 0x0 79*f7018c21STomi Valkeinen #define STATE_DEFAULT 0xFFFF 80*f7018c21STomi Valkeinen 81*f7018c21STomi Valkeinen #define MAX_ACTIVE_DEV_NUM 2 82*f7018c21STomi Valkeinen 83*f7018c21STomi Valkeinen struct device_t { 84*f7018c21STomi Valkeinen unsigned short crt:1; 85*f7018c21STomi Valkeinen unsigned short dvi:1; 86*f7018c21STomi Valkeinen unsigned short lcd:1; 87*f7018c21STomi Valkeinen unsigned short samm:1; 88*f7018c21STomi Valkeinen unsigned short lcd_dsp_cent:1; 89*f7018c21STomi Valkeinen unsigned char lcd_mode:1; 90*f7018c21STomi Valkeinen unsigned short epia_dvi:1; 91*f7018c21STomi Valkeinen unsigned short lcd_dual_edge:1; 92*f7018c21STomi Valkeinen unsigned short lcd2:1; 93*f7018c21STomi Valkeinen 94*f7018c21STomi Valkeinen unsigned short primary_dev; 95*f7018c21STomi Valkeinen unsigned char lcd_panel_id; 96*f7018c21STomi Valkeinen unsigned short xres, yres; 97*f7018c21STomi Valkeinen unsigned short xres1, yres1; 98*f7018c21STomi Valkeinen unsigned short refresh; 99*f7018c21STomi Valkeinen unsigned short bpp; 100*f7018c21STomi Valkeinen unsigned short refresh1; 101*f7018c21STomi Valkeinen unsigned short bpp1; 102*f7018c21STomi Valkeinen unsigned short sequence; 103*f7018c21STomi Valkeinen unsigned short bus_width; 104*f7018c21STomi Valkeinen }; 105*f7018c21STomi Valkeinen 106*f7018c21STomi Valkeinen struct viafb_ioctl_info { 107*f7018c21STomi Valkeinen u32 viafb_id; /* for identifying viafb */ 108*f7018c21STomi Valkeinen #define VIAID 0x56494146 /* Identify myself with 'VIAF' */ 109*f7018c21STomi Valkeinen u16 vendor_id; 110*f7018c21STomi Valkeinen u16 device_id; 111*f7018c21STomi Valkeinen u8 version; 112*f7018c21STomi Valkeinen u8 revision; 113*f7018c21STomi Valkeinen u8 reserved[246]; /* for future use */ 114*f7018c21STomi Valkeinen }; 115*f7018c21STomi Valkeinen 116*f7018c21STomi Valkeinen struct viafb_ioctl_mode { 117*f7018c21STomi Valkeinen u32 xres; 118*f7018c21STomi Valkeinen u32 yres; 119*f7018c21STomi Valkeinen u32 refresh; 120*f7018c21STomi Valkeinen u32 bpp; 121*f7018c21STomi Valkeinen u32 xres_sec; 122*f7018c21STomi Valkeinen u32 yres_sec; 123*f7018c21STomi Valkeinen u32 virtual_xres_sec; 124*f7018c21STomi Valkeinen u32 virtual_yres_sec; 125*f7018c21STomi Valkeinen u32 refresh_sec; 126*f7018c21STomi Valkeinen u32 bpp_sec; 127*f7018c21STomi Valkeinen }; 128*f7018c21STomi Valkeinen struct viafb_ioctl_samm { 129*f7018c21STomi Valkeinen u32 samm_status; 130*f7018c21STomi Valkeinen u32 size_prim; 131*f7018c21STomi Valkeinen u32 size_sec; 132*f7018c21STomi Valkeinen u32 mem_base; 133*f7018c21STomi Valkeinen u32 offset_sec; 134*f7018c21STomi Valkeinen }; 135*f7018c21STomi Valkeinen 136*f7018c21STomi Valkeinen struct viafb_driver_version { 137*f7018c21STomi Valkeinen int iMajorNum; 138*f7018c21STomi Valkeinen int iKernelNum; 139*f7018c21STomi Valkeinen int iOSNum; 140*f7018c21STomi Valkeinen int iMinorNum; 141*f7018c21STomi Valkeinen }; 142*f7018c21STomi Valkeinen 143*f7018c21STomi Valkeinen struct viafb_ioctl_lcd_attribute { 144*f7018c21STomi Valkeinen unsigned int panel_id; 145*f7018c21STomi Valkeinen unsigned int display_center; 146*f7018c21STomi Valkeinen unsigned int lcd_mode; 147*f7018c21STomi Valkeinen }; 148*f7018c21STomi Valkeinen 149*f7018c21STomi Valkeinen struct viafb_ioctl_setting { 150*f7018c21STomi Valkeinen /* Enable or disable active devices */ 151*f7018c21STomi Valkeinen unsigned short device_flag; 152*f7018c21STomi Valkeinen /* Indicate which device should be turn on or turn off. */ 153*f7018c21STomi Valkeinen unsigned short device_status; 154*f7018c21STomi Valkeinen unsigned int reserved; 155*f7018c21STomi Valkeinen /* Indicate which LCD's attribute can be changed. */ 156*f7018c21STomi Valkeinen unsigned short lcd_operation_flag; 157*f7018c21STomi Valkeinen /* 1: SAMM ON 0: SAMM OFF */ 158*f7018c21STomi Valkeinen unsigned short samm_status; 159*f7018c21STomi Valkeinen /* horizontal resolution of first device */ 160*f7018c21STomi Valkeinen unsigned short first_dev_hor_res; 161*f7018c21STomi Valkeinen /* vertical resolution of first device */ 162*f7018c21STomi Valkeinen unsigned short first_dev_ver_res; 163*f7018c21STomi Valkeinen /* horizontal resolution of second device */ 164*f7018c21STomi Valkeinen unsigned short second_dev_hor_res; 165*f7018c21STomi Valkeinen /* vertical resolution of second device */ 166*f7018c21STomi Valkeinen unsigned short second_dev_ver_res; 167*f7018c21STomi Valkeinen /* refresh rate of first device */ 168*f7018c21STomi Valkeinen unsigned short first_dev_refresh; 169*f7018c21STomi Valkeinen /* bpp of first device */ 170*f7018c21STomi Valkeinen unsigned short first_dev_bpp; 171*f7018c21STomi Valkeinen /* refresh rate of second device */ 172*f7018c21STomi Valkeinen unsigned short second_dev_refresh; 173*f7018c21STomi Valkeinen /* bpp of second device */ 174*f7018c21STomi Valkeinen unsigned short second_dev_bpp; 175*f7018c21STomi Valkeinen /* Indicate which device are primary display device. */ 176*f7018c21STomi Valkeinen unsigned int primary_device; 177*f7018c21STomi Valkeinen unsigned int struct_reserved[35]; 178*f7018c21STomi Valkeinen struct viafb_ioctl_lcd_attribute lcd_attributes; 179*f7018c21STomi Valkeinen }; 180*f7018c21STomi Valkeinen 181*f7018c21STomi Valkeinen struct _UTFunctionCaps { 182*f7018c21STomi Valkeinen unsigned int dw3DScalingState; 183*f7018c21STomi Valkeinen unsigned int reserved[31]; 184*f7018c21STomi Valkeinen }; 185*f7018c21STomi Valkeinen 186*f7018c21STomi Valkeinen struct _POSITIONVALUE { 187*f7018c21STomi Valkeinen unsigned int dwX; 188*f7018c21STomi Valkeinen unsigned int dwY; 189*f7018c21STomi Valkeinen }; 190*f7018c21STomi Valkeinen 191*f7018c21STomi Valkeinen struct _panel_size_pos_info { 192*f7018c21STomi Valkeinen unsigned int device_type; 193*f7018c21STomi Valkeinen int x; 194*f7018c21STomi Valkeinen int y; 195*f7018c21STomi Valkeinen }; 196*f7018c21STomi Valkeinen 197*f7018c21STomi Valkeinen extern int viafb_LCD_ON; 198*f7018c21STomi Valkeinen extern int viafb_DVI_ON; 199*f7018c21STomi Valkeinen 200*f7018c21STomi Valkeinen int viafb_ioctl_get_viafb_info(u_long arg); 201*f7018c21STomi Valkeinen int viafb_ioctl_hotplug(int hres, int vres, int bpp); 202*f7018c21STomi Valkeinen 203*f7018c21STomi Valkeinen #endif /* __IOCTL_H__ */ 204