Linux 2.6.33-rc6
[cris-mirror.git] / drivers / video / via / ioctl.c
blobda03c074e32aad8b909c4b11c57a4c5a9f9d9285
1 /*
2 * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation;
8 * either version 2, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
12 * the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE.See the GNU General Public License
14 * for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "global.h"
24 int viafb_ioctl_get_viafb_info(u_long arg)
26 struct viafb_ioctl_info viainfo;
28 viainfo.viafb_id = VIAID;
29 viainfo.vendor_id = PCI_VIA_VENDOR_ID;
31 switch (viaparinfo->chip_info->gfx_chip_name) {
32 case UNICHROME_CLE266:
33 viainfo.device_id = UNICHROME_CLE266_DID;
34 break;
36 case UNICHROME_K400:
37 viainfo.device_id = UNICHROME_K400_DID;
38 break;
40 case UNICHROME_K800:
41 viainfo.device_id = UNICHROME_K800_DID;
42 break;
44 case UNICHROME_PM800:
45 viainfo.device_id = UNICHROME_PM800_DID;
46 break;
48 case UNICHROME_CN700:
49 viainfo.device_id = UNICHROME_CN700_DID;
50 break;
52 case UNICHROME_CX700:
53 viainfo.device_id = UNICHROME_CX700_DID;
54 break;
56 case UNICHROME_K8M890:
57 viainfo.device_id = UNICHROME_K8M890_DID;
58 break;
60 case UNICHROME_P4M890:
61 viainfo.device_id = UNICHROME_P4M890_DID;
62 break;
64 case UNICHROME_P4M900:
65 viainfo.device_id = UNICHROME_P4M900_DID;
66 break;
69 viainfo.version = VERSION_MAJOR;
70 viainfo.revision = VERSION_MINOR;
72 if (copy_to_user((void __user *)arg, &viainfo, sizeof(viainfo)))
73 return -EFAULT;
75 return 0;
78 /* Hot-Plug Priority: DVI > CRT*/
79 int viafb_ioctl_hotplug(int hres, int vres, int bpp)
81 int DVIsense, status = 0;
82 DEBUG_MSG(KERN_INFO "viafb_ioctl_hotplug!!\n");
84 if (viaparinfo->chip_info->tmds_chip_info.tmds_chip_name !=
85 NON_TMDS_TRANSMITTER) {
86 DVIsense = viafb_dvi_sense();
88 if (DVIsense) {
89 DEBUG_MSG(KERN_INFO "DVI Attached...\n");
90 if (viafb_DeviceStatus != DVI_Device) {
91 viafb_DVI_ON = 1;
92 viafb_CRT_ON = 0;
93 viafb_LCD_ON = 0;
94 viafb_DeviceStatus = DVI_Device;
95 return viafb_DeviceStatus;
97 status = 1;
98 } else
99 DEBUG_MSG(KERN_INFO "DVI De-attached...\n");
102 if ((viafb_DeviceStatus != CRT_Device) && (status == 0)) {
103 viafb_CRT_ON = 1;
104 viafb_DVI_ON = 0;
105 viafb_LCD_ON = 0;
107 viafb_DeviceStatus = CRT_Device;
108 return viafb_DeviceStatus;
111 return 0;