The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/ibm561.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /* $NetBSD: ibm561.c,v 1.1 2001/12/12 07:46:48 elric Exp $ */
    2 /* $OpenBSD: ibm561.c,v 1.5 2008/06/26 05:42:15 ray Exp $ */
    3 
    4 /*-
    5  * Copyright (c) 2001 The NetBSD Foundation, Inc.
    6  * All rights reserved.
    7  *
    8  * This code is derived from software contributed to The NetBSD Foundation
    9  * by Roland C. Dowdeswell of Ponte, Inc.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   30  * POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 #include <sys/param.h>
   34 #include <sys/systm.h>
   35 #include <sys/device.h>
   36 #include <sys/buf.h>
   37 #include <sys/kernel.h>
   38 #include <sys/malloc.h>
   39 
   40 #include <uvm/uvm_extern.h>
   41 
   42 #include <dev/pci/pcivar.h>
   43 #include <dev/ic/ibm561reg.h>
   44 #include <dev/ic/ibm561var.h>
   45 #include <dev/ic/ramdac.h>
   46 
   47 #include <dev/wscons/wsconsio.h>
   48 
   49 /*
   50  * Functions exported via the RAMDAC configuration table.
   51  */
   52 void    ibm561_init(struct ramdac_cookie *);
   53 int     ibm561_set_cmap(struct ramdac_cookie *,
   54             struct wsdisplay_cmap *);
   55 int     ibm561_get_cmap(struct ramdac_cookie *,
   56             struct wsdisplay_cmap *);
   57 int     ibm561_set_cursor(struct ramdac_cookie *,
   58             struct wsdisplay_cursor *);
   59 int     ibm561_get_cursor(struct ramdac_cookie *,
   60             struct wsdisplay_cursor *);
   61 int     ibm561_set_curpos(struct ramdac_cookie *,
   62             struct wsdisplay_curpos *);
   63 int     ibm561_get_curpos(struct ramdac_cookie *,
   64             struct wsdisplay_curpos *);
   65 int     ibm561_get_curmax(struct ramdac_cookie *,
   66             struct wsdisplay_curpos *);
   67 int     ibm561_set_dotclock(struct ramdac_cookie *,
   68             unsigned);
   69 
   70 /* XXX const */
   71 struct ramdac_funcs ibm561_funcsstruct = {
   72         "IBM561",
   73         ibm561_register,
   74         ibm561_init,
   75         ibm561_set_cmap,
   76         ibm561_get_cmap,
   77         ibm561_set_cursor,
   78         ibm561_get_cursor,
   79         ibm561_set_curpos,
   80         ibm561_get_curpos,
   81         ibm561_get_curmax,
   82         NULL,                   /* check_curcmap; not needed */
   83         NULL,                   /* set_curcmap; not needed */
   84         NULL,                   /* get_curcmap; not needed */
   85         ibm561_set_dotclock, 
   86 };
   87 
   88 /*
   89  * Private data.
   90  */
   91 struct ibm561data {
   92         void            *cookie;
   93 
   94         int             (*ramdac_sched_update)(void *, void (*)(void *));
   95         void            (*ramdac_wr)(void *, u_int, u_int8_t);
   96         u_int8_t        (*ramdac_rd)(void *, u_int);
   97 
   98 #define CHANGED_CURCMAP         0x0001  /* cursor cmap */
   99 #define CHANGED_CMAP            0x0002  /* color map */
  100 #define CHANGED_WTYPE           0x0004  /* window types */
  101 #define CHANGED_DOTCLOCK        0x0008  /* dot clock */
  102 #define CHANGED_ALL             0x000f  /* or of all above */
  103         u_int8_t        changed;
  104 
  105         /* dotclock parameters */
  106         u_int8_t        vco_div;
  107         u_int8_t        pll_ref;
  108         u_int8_t        div_dotclock;
  109 
  110         /* colormaps et al. */
  111         u_int8_t        curcmap_r[2];
  112         u_int8_t        curcmap_g[2];
  113         u_int8_t        curcmap_b[2];
  114 
  115         u_int8_t        cmap_r[IBM561_NCMAP_ENTRIES];
  116         u_int8_t        cmap_g[IBM561_NCMAP_ENTRIES];
  117         u_int8_t        cmap_b[IBM561_NCMAP_ENTRIES];
  118 
  119         u_int16_t       gamma_r[IBM561_NGAMMA_ENTRIES];
  120         u_int16_t       gamma_g[IBM561_NGAMMA_ENTRIES];
  121         u_int16_t       gamma_b[IBM561_NGAMMA_ENTRIES];
  122 
  123         u_int16_t       wtype[IBM561_NWTYPES];
  124 };
  125 
  126 /*
  127  * private functions
  128  */
  129 void    ibm561_update(void *);
  130 static void ibm561_load_cmap(struct ibm561data *);
  131 static void ibm561_load_dotclock(struct ibm561data *);
  132 static void ibm561_regbegin(struct ibm561data *, u_int16_t);
  133 static void ibm561_regcont(struct ibm561data *, u_int16_t, u_int8_t);
  134 static void ibm561_regcont10bit(struct ibm561data *, u_int16_t, u_int16_t);
  135 static void ibm561_regwr(struct ibm561data *, u_int16_t, u_int8_t);
  136 
  137 struct ramdac_funcs *
  138 ibm561_funcs(void)
  139 {
  140         return &ibm561_funcsstruct;
  141 }
  142 
  143 struct ibm561data ibm561_console_data;
  144 
  145 struct ramdac_cookie *
  146 ibm561_register(v, sched_update, wr, rd)
  147         void *v;
  148         int (*sched_update)(void *, void (*)(void *));
  149         void (*wr)(void *, u_int, u_int8_t);
  150         u_int8_t (*rd)(void *, u_int);
  151 {
  152         struct ibm561data *data;
  153 
  154         if (ibm561_console_data.cookie == NULL) {
  155                 data = malloc(sizeof *data, M_DEVBUF, M_WAITOK);
  156                 bzero(data, sizeof *data);
  157         } else
  158                 data = &ibm561_console_data;
  159         data->cookie = v;
  160         data->ramdac_sched_update = sched_update;
  161         data->ramdac_wr = wr;
  162         data->ramdac_rd = rd;
  163         return (struct ramdac_cookie *)data;
  164 }
  165 
  166 /*
  167  * This function exists solely to provide a means to init
  168  * the RAMDAC without first registering.  It is useful for
  169  * initializing the console early on.
  170  */
  171 
  172 void
  173 ibm561_cninit(v, sched_update, wr, rd, dotclock)
  174         void *v;
  175         int (*sched_update)(void *, void (*)(void *));
  176         void (*wr)(void *, u_int, u_int8_t);
  177         u_int8_t (*rd)(void *, u_int);
  178         u_int dotclock;
  179 {
  180         struct ibm561data *data = &ibm561_console_data;
  181         data->cookie = v;
  182         data->ramdac_sched_update = sched_update;
  183         data->ramdac_wr = wr;
  184         data->ramdac_rd = rd;
  185         ibm561_set_dotclock((struct ramdac_cookie *)data, dotclock);
  186         ibm561_init((struct ramdac_cookie *)data);
  187 }
  188 
  189 void
  190 ibm561_init(rc)
  191         struct ramdac_cookie *rc;
  192 {
  193         struct  ibm561data *data = (struct ibm561data *)rc;
  194         int     i;
  195 
  196         /* XXX this is _essential_ */
  197 
  198         ibm561_load_dotclock(data);
  199 
  200         /* XXXrcd: bunch of magic of which I have no current clue */
  201         ibm561_regwr(data, IBM561_CONFIG_REG1, 0x2a);
  202         ibm561_regwr(data, IBM561_CONFIG_REG3, 0x41);
  203         ibm561_regwr(data, IBM561_CONFIG_REG4, 0x20);
  204 
  205         /* initialize the card a bit */
  206         ibm561_regwr(data, IBM561_SYNC_CNTL, 0x1);
  207         ibm561_regwr(data, IBM561_CONFIG_REG2, 0x19);
  208 
  209         ibm561_regwr(data, IBM561_CONFIG_REG1, 0x2a);
  210         ibm561_regwr(data, IBM561_CONFIG_REG4, 0x20);
  211 
  212         ibm561_regbegin(data, IBM561_WAT_SEG_REG);
  213         ibm561_regcont(data, IBM561_CMD, 0x00);
  214         ibm561_regcont(data, IBM561_CMD, 0x00);
  215         ibm561_regcont(data, IBM561_CMD, 0x00);
  216         ibm561_regcont(data, IBM561_CMD, 0x00);
  217         ibm561_regbegin(data, IBM561_CHROMAKEY0);
  218         ibm561_regcont(data, IBM561_CMD, 0x00);
  219         ibm561_regcont(data, IBM561_CMD, 0x00);
  220         ibm561_regcont(data, IBM561_CMD, 0x00);
  221         ibm561_regcont(data, IBM561_CMD, 0x00);
  222 
  223         ibm561_regwr(data, IBM561_CURS_CNTL_REG, 0x00); /* XXX off? */
  224 
  225         /* cursor `hot spot' registers */
  226         ibm561_regbegin(data, IBM561_HOTSPOT_REG);
  227         ibm561_regcont(data, IBM561_CMD, 0x00);
  228         ibm561_regcont(data, IBM561_CMD, 0x00);
  229         ibm561_regcont(data, IBM561_CMD, 0xff);
  230         ibm561_regcont(data, IBM561_CMD, 0x00);
  231         ibm561_regcont(data, IBM561_CMD, 0xff);
  232         ibm561_regcont(data, IBM561_CMD, 0x00);
  233 
  234         /* VRAM Mask Registers (diagnostics) */
  235         ibm561_regbegin(data, IBM561_VRAM_MASK_REG);
  236         ibm561_regcont(data, IBM561_CMD, 0xff);
  237         ibm561_regcont(data, IBM561_CMD, 0xff);
  238         ibm561_regcont(data, IBM561_CMD, 0xff);
  239         ibm561_regcont(data, IBM561_CMD, 0xff);
  240         ibm561_regcont(data, IBM561_CMD, 0xff);
  241         ibm561_regcont(data, IBM561_CMD, 0xff);
  242         ibm561_regcont(data, IBM561_CMD, 0xff);
  243 
  244         /* let's set up some decent default colour maps and gammas */
  245         for (i=0; i < IBM561_NCMAP_ENTRIES; i++)
  246                 data->cmap_r[i] = data->cmap_g[i] = data->cmap_b[i] = 0xff;
  247         data->cmap_r[0]   = data->cmap_g[0]   = data->cmap_b[0]   = 0x00;
  248         data->cmap_r[256] = data->cmap_g[256] = data->cmap_b[256] = 0x00;
  249         data->cmap_r[512] = data->cmap_g[512] = data->cmap_b[512] = 0x00;
  250         data->cmap_r[768] = data->cmap_g[768] = data->cmap_b[768] = 0x00;
  251 
  252         data->gamma_r[0] = data->gamma_g[0] = data->gamma_b[0] = 0x00;
  253         for (i=0; i < IBM561_NGAMMA_ENTRIES; i++)
  254                 data->gamma_r[i] = data->gamma_g[i] = data->gamma_b[i] = 0xff;
  255 
  256         for (i=0; i < IBM561_NWTYPES; i++)
  257                 data->wtype[i] = 0x0036;
  258         data->wtype[1] = 0x0028;
  259 
  260         /* the last step: */
  261         data->changed = CHANGED_ALL;
  262         data->ramdac_sched_update(data->cookie, ibm561_update);
  263 }
  264 
  265 int
  266 ibm561_set_cmap(rc, cmapp)
  267         struct ramdac_cookie *rc;
  268         struct wsdisplay_cmap *cmapp;
  269 {
  270         struct ibm561data *data = (struct ibm561data *)rc;
  271         u_int count, index;
  272         int error;
  273         int s;
  274 
  275         index = cmapp->index;
  276         count = cmapp->count;
  277 
  278         if (index >= IBM561_NCMAP_ENTRIES ||
  279             count > IBM561_NCMAP_ENTRIES - index)
  280                 return (EINVAL);
  281 
  282         s = spltty();
  283         if ((error = copyin(cmapp->red, &data->cmap_r[index], count)) != 0) {
  284                 splx(s);
  285                 return (error);
  286         }
  287         if ((error = copyin(cmapp->green, &data->cmap_g[index], count)) != 0) {
  288                 splx(s);
  289                 return (error);
  290         }
  291         if ((error = copyin(cmapp->blue, &data->cmap_b[index], count)) != 0) {
  292                 splx(s);
  293                 return (error);
  294         }
  295         data->changed |= CHANGED_CMAP;
  296         data->ramdac_sched_update(data->cookie, ibm561_update);
  297         splx(s);
  298         return (0);
  299 }
  300 
  301 int
  302 ibm561_get_cmap(rc, cmapp)
  303         struct ramdac_cookie *rc;
  304         struct wsdisplay_cmap *cmapp;
  305 {
  306         struct ibm561data *data = (struct ibm561data *)rc;
  307         u_int count, index;
  308         int error;
  309 
  310         if (cmapp->index >= IBM561_NCMAP_ENTRIES ||
  311             cmapp->count > IBM561_NCMAP_ENTRIES - cmapp->index)
  312                 return (EINVAL);
  313         count = cmapp->count;
  314         index = cmapp->index;
  315         error = copyout(&data->cmap_r[index], cmapp->red, count);
  316         if (error)
  317                 return (error);
  318         error = copyout(&data->cmap_g[index], cmapp->green, count);
  319         if (error)
  320                 return (error);
  321         error = copyout(&data->cmap_b[index], cmapp->blue, count);
  322         return (error);
  323 }
  324 
  325 /*
  326  * XXX:
  327  *  I am leaving these functions returning EINVAL, as they are
  328  *  not strictly necessary for the correct functioning of the
  329  *  card and in fact are not used on the other TGA variants, except
  330  *  they are exported via ioctl(2) to userland, which does not in
  331  *  fact use them.
  332  */
  333 
  334 int
  335 ibm561_set_cursor(rc, cursorp)
  336         struct ramdac_cookie *rc;
  337         struct wsdisplay_cursor *cursorp;
  338 {
  339         return EINVAL;
  340 }
  341 
  342 int
  343 ibm561_get_cursor(rc, cursorp)
  344         struct ramdac_cookie *rc;
  345         struct wsdisplay_cursor *cursorp;
  346 {
  347         return EINVAL;
  348 }
  349 
  350 int
  351 ibm561_set_curpos(rc, curposp)
  352         struct ramdac_cookie *rc;
  353         struct wsdisplay_curpos *curposp;
  354 {
  355         return EINVAL;
  356 }
  357 
  358 int
  359 ibm561_get_curpos(rc, curposp)
  360         struct ramdac_cookie *rc;
  361         struct wsdisplay_curpos *curposp;
  362 {
  363         return EINVAL;
  364 }
  365 
  366 int
  367 ibm561_get_curmax(rc, curposp)
  368         struct ramdac_cookie *rc;
  369         struct wsdisplay_curpos *curposp;
  370 {
  371         return EINVAL;
  372 }
  373 
  374 int
  375 ibm561_set_dotclock(rc, dotclock)
  376         struct ramdac_cookie *rc;
  377         unsigned dotclock;
  378 {
  379         struct ibm561data *data = (struct ibm561data *)rc;
  380 
  381         /* XXXrcd:  a couple of these are a little hazy, vis a vis
  382          *          check 175MHz and 202MHz, which are wrong...
  383          */
  384         switch (dotclock) {
  385         case  25175000: data->vco_div = 0x3e; data->pll_ref = 0x09; break;
  386         case  31500000: data->vco_div = 0x17; data->pll_ref = 0x05; break;
  387         case  40000000: data->vco_div = 0x42; data->pll_ref = 0x06; break;
  388         case  50000000: data->vco_div = 0x45; data->pll_ref = 0x05; break;
  389         case  65000000: data->vco_div = 0xac; data->pll_ref = 0x0c; break;
  390         case  69000000: data->vco_div = 0xa9; data->pll_ref = 0x0b; break;
  391         case  74000000: data->vco_div = 0x9c; data->pll_ref = 0x09; break;
  392         case  75000000: data->vco_div = 0x93; data->pll_ref = 0x08; break;
  393         case 103994000: data->vco_div = 0x96; data->pll_ref = 0x06; break;
  394         case 108180000: data->vco_div = 0xb8; data->pll_ref = 0x08; break;
  395         case 110000000: data->vco_div = 0xba; data->pll_ref = 0x08; break;
  396         case 119840000: data->vco_div = 0x82; data->pll_ref = 0x04; break;
  397         case 130808000: data->vco_div = 0xc8; data->pll_ref = 0x08; break;
  398         case 135000000: data->vco_div = 0xc1; data->pll_ref = 0x07; break;
  399         case 175000000: data->vco_div = 0xe2; data->pll_ref = 0x07; break;
  400         case 202500000: data->vco_div = 0xe2; data->pll_ref = 0x07; break;
  401         default:
  402                 return EINVAL;
  403         }
  404 
  405         data->div_dotclock = 0xb0;
  406         data->changed |= CHANGED_DOTCLOCK;
  407         return 0;
  408 }
  409 
  410 /*
  411  * Internal Functions
  412  */
  413 
  414 void
  415 ibm561_update(vp)
  416         void *vp;
  417 {
  418         struct ibm561data *data = (struct ibm561data *)vp;
  419         int     i;
  420 
  421         /* XXX see comment above ibm561_cninit() */
  422         if (!data)
  423                 data = &ibm561_console_data;
  424 
  425         if (data->changed & CHANGED_WTYPE) {
  426                 ibm561_regbegin(data, IBM561_FB_WINTYPE);
  427                 for (i=0; i < IBM561_NWTYPES; i++)
  428                         ibm561_regcont10bit(data, IBM561_CMD_FB_WAT, data->wtype[i]);
  429 
  430                 /* XXXrcd:  quick hack here for AUX FB table */
  431                 ibm561_regbegin(data, IBM561_AUXFB_WINTYPE);
  432                 for (i=0; i < IBM561_NWTYPES; i++)
  433                         ibm561_regcont(data, IBM561_CMD, 0x04);
  434 
  435                 /* XXXrcd:  quick hack here for OL WAT table */
  436                 ibm561_regbegin(data, IBM561_OL_WINTYPE);
  437                 for (i=0; i < IBM561_NWTYPES; i++)
  438                         ibm561_regcont10bit(data, IBM561_CMD_FB_WAT, 0x0231);
  439 
  440                 /* XXXrcd:  quick hack here for AUX OL WAT table */
  441                 ibm561_regbegin(data, IBM561_AUXOL_WINTYPE);
  442                 for (i=0; i < IBM561_NWTYPES; i++)
  443                         ibm561_regcont(data, IBM561_CMD, 0x0c);
  444         }
  445 
  446         if (data->changed & CHANGED_CMAP)
  447                 ibm561_load_cmap(data);
  448 
  449         /* XXX:  I am not sure in what situations it is safe to
  450          *       change the dotclock---hope this is good.
  451          */
  452         if (data->changed & CHANGED_DOTCLOCK)
  453                 ibm561_load_dotclock(data);
  454 }
  455 
  456 static void
  457 ibm561_load_cmap(struct ibm561data *data)
  458 {
  459         int     i;
  460 
  461         ibm561_regbegin(data, IBM561_CMAP_TABLE);
  462         for (i=0; i < IBM561_NCMAP_ENTRIES; i++) {
  463                 ibm561_regcont(data, IBM561_CMD_CMAP, data->cmap_r[i]);
  464                 ibm561_regcont(data, IBM561_CMD_CMAP, data->cmap_g[i]);
  465                 ibm561_regcont(data, IBM561_CMD_CMAP, data->cmap_b[i]);
  466         }
  467 
  468         ibm561_regbegin(data, IBM561_RED_GAMMA_TABLE);
  469         for (i=0; i < 256; i++)
  470                 ibm561_regcont10bit(data, IBM561_CMD_GAMMA, data->gamma_r[i]);
  471 
  472         ibm561_regbegin(data, IBM561_GREEN_GAMMA_TABLE);
  473         for (i=1; i < 256; i++)
  474                 ibm561_regcont10bit(data, IBM561_CMD_GAMMA, data->gamma_g[i]);
  475 
  476         ibm561_regbegin(data, IBM561_BLUE_GAMMA_TABLE);
  477         for (i=1; i < 256; i++)
  478                 ibm561_regcont10bit(data, IBM561_CMD_GAMMA, data->gamma_b[i]);
  479 
  480 }
  481 
  482 static void
  483 ibm561_load_dotclock(struct ibm561data *data)
  484 {
  485         /* XXX
  486          * we should probably be more pro-active here, but it shouldn't
  487          * actually happen...
  488          */
  489         if (!data->vco_div || !data->pll_ref || ! data->div_dotclock) {
  490                 panic("ibm561_load_dotclock: called uninitialized");
  491         }
  492 
  493         ibm561_regwr(data, IBM561_PLL_VCO_DIV,  data->vco_div);
  494         ibm561_regwr(data, IBM561_PLL_REF_REG, data->pll_ref);
  495         ibm561_regwr(data, IBM561_DIV_DOTCLCK, data->div_dotclock);
  496 }
  497 
  498 static void
  499 ibm561_regcont10bit(struct ibm561data *data, u_int16_t reg, u_int16_t val)
  500 {
  501         data->ramdac_wr(data->cookie, IBM561_CMD_GAMMA, (val >> 2) & 0xff);
  502         data->ramdac_wr(data->cookie, IBM561_CMD_GAMMA, (val & 0x3) << 6);
  503 }
  504 
  505 static void
  506 ibm561_regbegin(struct ibm561data *data, u_int16_t reg)
  507 {
  508         data->ramdac_wr(data->cookie, IBM561_ADDR_LOW, reg & 0xff);
  509         data->ramdac_wr(data->cookie, IBM561_ADDR_HIGH, (reg >> 8) & 0xff);
  510 }
  511 
  512 static void
  513 ibm561_regcont(struct ibm561data *data, u_int16_t reg, u_int8_t val)
  514 {
  515         data->ramdac_wr(data->cookie, reg, val);
  516 }
  517 
  518 static void
  519 ibm561_regwr(struct ibm561data *data, u_int16_t reg, u_int8_t val)
  520 {
  521         ibm561_regbegin(data, reg);
  522         ibm561_regcont(data, IBM561_CMD, val);
  523 }

Cache object: 7a08bb7195f8156fec9159b45c37720b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.