ioctl.c 2.8 KB

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