Multiple Chipsets And Options

How to add an (S)VGA driver to XFree86 : The Driver Itself : Multiple Chipsets And Options
Previous: The Driver Itself
Next: Data Structures

## 6.1. Multiple Chipsets And Options

It is possible, and in fact desirable, to have a single driver support multiple chipsets from the same vendor. If there are multiple supported chipsets, then you would have a series of #define's for them, and a variable `SDCchipset', which would be used throughout the driver when distinctions must be made. See the Trident and PVGA1/WD drivers for examples (the Tseng ET3000 and ET4000 are counter-examples - these were implemented before the driver interface allowed for multiple chipsets, so this example should NOT be followed). Note that you should only distinguish versions when your driver needs to do things differently for them. For example, suppose the SDC driver supports the SDC-1a, SDC-1b, and SDC-2 chipsets. The -1a and -1b are essentially the same, but different from the -2 chipset. Your driver should support the -1 and -2 chipsets, and not distinguish between the -1a and -1b. This will simplify things for the end user.

In cases where you want to give the user control of driver behavior, or there are things that cannot be determined without user intervention, you should use ``option'' flags. Say that board vendors that use the SDC chipsets have the option of providing 8 or 16 clocks. There's no way you can determine this from the chipset probe, so you provide an option flag to let the user select the behavior from the XF86Config file. The option flags are defined in the file ``xf86_option.h''. You should look to see if there is already a flag that can be reused. If so, use it in your driver. If not, add a new #define, and define the string->symbol mapping in the table in that file. To see how option flags are used, look at the ET4000, PVGA1/WD, and Trident drivers.

How to add an (S)VGA driver to XFree86 : The Driver Itself : Multiple Chipsets And Options
Previous: The Driver Itself
Next: Data Structures