Merge tag 'trace-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[linux/fpc-iii.git] / drivers / video / fbdev / via / ioctl.c
blob8b7f7655385313a73e80d5406fafd41317e6eab7
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
4 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
6 */
8 #include "global.h"
10 int viafb_ioctl_get_viafb_info(u_long arg)
12 struct viafb_ioctl_info viainfo;
14 memset(&viainfo, 0, sizeof(struct viafb_ioctl_info));
16 viainfo.viafb_id = VIAID;
17 viainfo.vendor_id = PCI_VIA_VENDOR_ID;
19 switch (viaparinfo->chip_info->gfx_chip_name) {
20 case UNICHROME_CLE266:
21 viainfo.device_id = UNICHROME_CLE266_DID;
22 break;
24 case UNICHROME_K400:
25 viainfo.device_id = UNICHROME_K400_DID;
26 break;
28 case UNICHROME_K800:
29 viainfo.device_id = UNICHROME_K800_DID;
30 break;
32 case UNICHROME_PM800:
33 viainfo.device_id = UNICHROME_PM800_DID;
34 break;
36 case UNICHROME_CN700:
37 viainfo.device_id = UNICHROME_CN700_DID;
38 break;
40 case UNICHROME_CX700:
41 viainfo.device_id = UNICHROME_CX700_DID;
42 break;
44 case UNICHROME_K8M890:
45 viainfo.device_id = UNICHROME_K8M890_DID;
46 break;
48 case UNICHROME_P4M890:
49 viainfo.device_id = UNICHROME_P4M890_DID;
50 break;
52 case UNICHROME_P4M900:
53 viainfo.device_id = UNICHROME_P4M900_DID;
54 break;
57 viainfo.version = VERSION_MAJOR;
58 viainfo.revision = VERSION_MINOR;
60 if (copy_to_user((void __user *)arg, &viainfo, sizeof(viainfo)))
61 return -EFAULT;
63 return 0;
66 /* Hot-Plug Priority: DVI > CRT*/
67 int viafb_ioctl_hotplug(int hres, int vres, int bpp)
69 int DVIsense, status = 0;
70 DEBUG_MSG(KERN_INFO "viafb_ioctl_hotplug!!\n");
72 if (viaparinfo->chip_info->tmds_chip_info.tmds_chip_name !=
73 NON_TMDS_TRANSMITTER) {
74 DVIsense = viafb_dvi_sense();
76 if (DVIsense) {
77 DEBUG_MSG(KERN_INFO "DVI Attached...\n");
78 if (viafb_DeviceStatus != DVI_Device) {
79 viafb_DVI_ON = 1;
80 viafb_CRT_ON = 0;
81 viafb_LCD_ON = 0;
82 viafb_DeviceStatus = DVI_Device;
83 viafb_set_iga_path();
84 return viafb_DeviceStatus;
86 status = 1;
87 } else
88 DEBUG_MSG(KERN_INFO "DVI De-attached...\n");
91 if ((viafb_DeviceStatus != CRT_Device) && (status == 0)) {
92 viafb_CRT_ON = 1;
93 viafb_DVI_ON = 0;
94 viafb_LCD_ON = 0;
96 viafb_DeviceStatus = CRT_Device;
97 viafb_set_iga_path();
98 return viafb_DeviceStatus;
101 return 0;