--- margi2/margi.c 2002/02/04 16:20:20 1.20 +++ margi2/margi.c 2002/02/08 16:12:15 1.21 @@ -1070,6 +1070,31 @@ while ((last_ret=CardServices(last_fn=(f #define CFG_CHECK(fn, args...) \ if (CardServices(fn, args) != 0) goto next_entry +static void margi_init(struct cvdv_cards *card) +{ + if (0xdd == read_indexed_register(card, IIO_ID)) { + printk("L64014 Version %d in mode %d detected\n", + (read_indexed_register(card, IIO_MODE) & 248) >> 3, + read_indexed_register(card, IIO_MODE) & 7); + write_indexed_register(card, IIO_GPIO_CONTROL, 0x07); + + L64014Init(card); + + // default: color bars + VideoSetBackground(card, 1, 0, 0, 0); // black + SetVideoSystem(card); + + /*enable L64014 IRQ */ + write_indexed_register(card, IIO_IRQ_CONTROL, + IRQ_POL | IRQ_EN | VSYNC_EN); +// write_indexed_register(card, IIO_IRQ_CONTROL, 0x24); + + OSDOpen(card, 50, 50, 150, 150, 2, 1); + OSDTest(card); + } + +} + static void margi_config(dev_link_t * link) { client_handle_t handle = link->handle; @@ -1308,28 +1333,9 @@ static void margi_config(dev_link_t * li printk("\n"); link->state &= ~DEV_CONFIG_PENDING; - if (0xdd == read_indexed_register(card, IIO_ID)) { - printk("L64014 Version %d in mode %d detected\n", - (read_indexed_register(card, IIO_MODE) & 248) >> 3, - read_indexed_register(card, IIO_MODE) & 7); - write_indexed_register(card, IIO_GPIO_CONTROL, 0x07); - - L64014Init(card); + minorlist[minor] = card; // fast access for the char driver - // default: color bars - VideoSetBackground(card, 1, 0, 0, 0); // black - SetVideoSystem(card); - minorlist[minor] = card; // fast access for the char driver - - - /*enable L64014 IRQ */ - write_indexed_register(card, IIO_IRQ_CONTROL, - IRQ_POL | IRQ_EN | VSYNC_EN); -// write_indexed_register(card, IIO_IRQ_CONTROL, 0x24); - - OSDOpen(card, 50, 50, 150, 150, 2, 1); - OSDTest(card); - } + margi_init(card); return; cs_failed: @@ -1455,6 +1461,7 @@ static int margi_event(event_t event, in if (link->state & DEV_CONFIG) CardServices(RequestConfiguration, link->handle, &link->conf); + margi_init(&dev->card); dev->stop = 0; /* In a normal driver, additional code may go here to restore