/***
 *** SVGA clockchip programming functions for SVGATextMode
 *** Written by Koen Gadeyne (kmg@barco.be)
 ***
 ***/

#ifndef _CLOCKCHIP_H
#define _CLOCKCHIP_H

#include "parse_clock.h"

typedef unsigned char byte;
typedef int Bool;  /* for XFREE clock chip code */

#include "XFREE/xfree_compat.h"
#include "XFREE/common_hw/xf86_HWlib.h"

/*
 * Supported ClockChips
 */
 
#define NUM_CLKCHIPS       14

#define CLKCHIP_NONE        -1
#define CLKCHIP_ICD2061A     0
#define CLKCHIP_ICS9161A     1
#define CLKCHIP_DCS2834      2
#define CLKCHIP_SC11412      3
#define CLKCHIP_S3GENDAC     4
#define CLKCHIP_S3_SDAC      5
#define CLKCHIP_TI3025       6
#define CLKCHIP_ICS2595      7
#define CLKCHIP_ICS5300      8
#define CLKCHIP_ICS5342      9
#define CLKCHIP_CH8391       10
#define CLKCHIP_S3TRIO       11
#define CLKCHIP_CIRRUS       12
#define CLKCHIP_ICS5341      13

#define CLKCHIP_STRINGS      { "icd2061a" , "ics9161a" , "dcs2834" , "sc11412" , "s3gendac" , "s3_sdac",\
                               "ti3025" , "ics2595" , "ics5300" , "ics5342" , "ch8391" , "S3Trio" ,\
                               "Cirrus" , "ics5341" }

/* allowed clockchips per chipset (in bit mask format) */
#define CLOCKCHIPS_ALLOWED   { 0,   /* VGA */\
                              1<<CLKCHIP_ICD2061A | 1<<CLKCHIP_ICS9161A | 1<<CLKCHIP_DCS2834 | 1<<CLKCHIP_SC11412\
                               | 1<<CLKCHIP_S3GENDAC | 1<<CLKCHIP_S3_SDAC | 1<<CLKCHIP_TI3025 | 1<<CLKCHIP_ICS2595\
                               | 1<<CLKCHIP_ICS5300 | 1<<CLKCHIP_ICS5342 | 1<<CLKCHIP_CH8391 | 1<<CLKCHIP_S3TRIO,   /* S3 */\
                              1<<CLKCHIP_CIRRUS,   /* Cirrus */\
                              1<<CLKCHIP_ICS5341,  /* ET4000 */\
                              0,   /* TVGA8900 */\
                              0,   /* TVGA9000 */\
                              0,   /* PAVGA1 */\
                              0,   /* WDC90C0X */\
                              0,   /* WDC90C1X */\
                              0,   /* WDC90C2X */\
                              0,   /* WDC90C3X */\
                              0,   /* ATI */\
                              0,   /* ATIMACH32 */\
                              0    /* VIDEO7 */\
                            }

void set_clockchip_clock(int chipset, int clockchip, long freq, int optmask);

void set_clockchip_Mclock(int chipset, int clockchip, long freq, int optmask);

#endif

