Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ioctl.c
Go to the documentation of this file.
1 /*
2  * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
3  * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4 
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.
9 
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.
15 
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.
20  */
21 
22 #include "global.h"
23 
25 {
26  struct viafb_ioctl_info viainfo;
27 
28  memset(&viainfo, 0, sizeof(struct viafb_ioctl_info));
29 
30  viainfo.viafb_id = VIAID;
31  viainfo.vendor_id = PCI_VIA_VENDOR_ID;
32 
33  switch (viaparinfo->chip_info->gfx_chip_name) {
34  case UNICHROME_CLE266:
36  break;
37 
38  case UNICHROME_K400:
39  viainfo.device_id = UNICHROME_K400_DID;
40  break;
41 
42  case UNICHROME_K800:
43  viainfo.device_id = UNICHROME_K800_DID;
44  break;
45 
46  case UNICHROME_PM800:
48  break;
49 
50  case UNICHROME_CN700:
52  break;
53 
54  case UNICHROME_CX700:
56  break;
57 
58  case UNICHROME_K8M890:
60  break;
61 
62  case UNICHROME_P4M890:
64  break;
65 
66  case UNICHROME_P4M900:
68  break;
69  }
70 
71  viainfo.version = VERSION_MAJOR;
72  viainfo.revision = VERSION_MINOR;
73 
74  if (copy_to_user((void __user *)arg, &viainfo, sizeof(viainfo)))
75  return -EFAULT;
76 
77  return 0;
78 }
79 
80 /* Hot-Plug Priority: DVI > CRT*/
81 int viafb_ioctl_hotplug(int hres, int vres, int bpp)
82 {
83  int DVIsense, status = 0;
84  DEBUG_MSG(KERN_INFO "viafb_ioctl_hotplug!!\n");
85 
86  if (viaparinfo->chip_info->tmds_chip_info.tmds_chip_name !=
88  DVIsense = viafb_dvi_sense();
89 
90  if (DVIsense) {
91  DEBUG_MSG(KERN_INFO "DVI Attached...\n");
93  viafb_DVI_ON = 1;
94  viafb_CRT_ON = 0;
95  viafb_LCD_ON = 0;
98  return viafb_DeviceStatus;
99  }
100  status = 1;
101  } else
102  DEBUG_MSG(KERN_INFO "DVI De-attached...\n");
103  }
104 
105  if ((viafb_DeviceStatus != CRT_Device) && (status == 0)) {
106  viafb_CRT_ON = 1;
107  viafb_DVI_ON = 0;
108  viafb_LCD_ON = 0;
109 
112  return viafb_DeviceStatus;
113  }
114 
115  return 0;
116 }