/*
* sisusb - usb kernel driver for SiS315(E) based USB2VGA dongles
*
* Display mode initializing code
*
* Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
*
* If distributed as part of the Linux kernel, this code is licensed under the
* terms of the GPL v2.
*
* Otherwise, the following license terms apply:
*
* * Redistribution and use in source and binary forms, with or without
* * modification, are permitted provided that the following conditions
* * are met:
* * 1) Redistributions of source code must retain the above copyright
* * notice, this list of conditions and the following disclaimer.
* * 2) Redistributions in binary form must reproduce the above copyright
* * notice, this list of conditions and the following disclaimer in the
* * documentation and/or other materials provided with the distribution.
* * 3) The name of the author may not be used to endorse or promote products
* * derived from this software without specific prior written permission.
* *
* * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
*/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/kref.h>
#include "sisusb.h"
#ifdef INCL_SISUSB_CON
#include "sisusb_init.h"
/*********************************************/
/* POINTER INITIALIZATION */
/*********************************************/
static void
SiSUSB_InitPtr(struct SiS_Private *SiS_Pr)
{
SiS_Pr->SiS_ModeResInfo = SiSUSB_ModeResInfo;
SiS_Pr->SiS_StandTable = SiSUSB_StandTable;
SiS_Pr->SiS_SModeIDTable = SiSUSB_SModeIDTable;
SiS_Pr->SiS_EModeIDTable = SiSUSB_EModeIDTable;
SiS_Pr->SiS_RefIndex = SiSUSB_RefIndex;
SiS_Pr->SiS_CRT1Table = SiSUSB_CRT1Table;
SiS_Pr->SiS_VCLKData = SiSUSB_VCLKData;
}
/*********************************************/
/* HELPER: Get ModeID */
/*********************************************/
unsigned short
SiSUSB_GetModeID(int HDisplay, int VDisplay, int Depth)
{
unsigned short ModeIndex = 0;
switch (HDisplay)
{
case 320:
if (VDisplay == 200)
ModeIndex = ModeIndex_320x200[Depth];
else if (VDisplay == 240)
ModeIndex = ModeIndex_320x240[Depth];
break;
case 400:
if (VDisplay == 300)
ModeIndex = ModeIndex_400x300[Depth];
break;
case 512:
if (VDisplay == 384)
ModeIndex = ModeIndex_512x384[Depth];
break;
case 640:
if (VDisplay == 480)
ModeIndex = ModeIndex_640x480[Depth];
else if (VDisplay == 400)
ModeIndex = ModeIndex_640x400[Depth];
break;
case 720:
if (VDisplay == 480)
ModeIndex = ModeIndex_720x480[Depth];
else if (VDisplay == 576)
ModeIndex = ModeIndex_720x576[Depth];
break;
case 768:
if (VDisplay == 576)
ModeIndex = ModeIndex_768x576[Depth];
break;
case 800:
if (VDisplay == 600)
ModeIndex = ModeIndex_800x600[Depth];
else if (VDisplay == 480)
ModeIndex = ModeIndex_800x480[Depth];
break;
case 848:
if (VDisplay == 480)
ModeIndex = ModeIndex_848x480[Depth];
break;
case 856:
if (VDisplay == 480)
ModeIndex = ModeIndex_856x480[Depth];
break;
case 960:
if (VDisplay == 540)
ModeIndex = ModeIndex_960x540[Depth];
else if (VDisplay == 600)
ModeIndex = ModeIndex_960x600[Depth];
break;
case 1024:
if (VDisplay == 576)
ModeIndex = ModeIndex_1024x576[Depth];
else if (VDisplay == 768)
ModeIndex = ModeIndex_1024x768[Depth];
break;
case 1152:
if (VDisplay == 864)
ModeIndex = ModeIndex_1152x864[Depth];
break;
case 1280:
switch (VDisplay) {
case 720:
ModeIndex = ModeIndex_1280x720[Depth];
break;
case 768:
ModeIndex = ModeIndex_1280x768[Depth];
break;
case 1024:
ModeIndex