Lines Matching refs:meye

45 static struct meye meye;  variable
204 memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable)); in ptable_alloc()
206 meye.mchip_ptable_toc = dma_alloc_coherent(meye.mchip_dev, in ptable_alloc()
208 &meye.mchip_dmahandle, in ptable_alloc()
210 if (!meye.mchip_ptable_toc) { in ptable_alloc()
211 meye.mchip_dmahandle = 0; in ptable_alloc()
215 pt = meye.mchip_ptable_toc; in ptable_alloc()
217 meye.mchip_ptable[i] = dma_alloc_coherent(meye.mchip_dev, in ptable_alloc()
221 if (!meye.mchip_ptable[i]) { in ptable_alloc()
223 pt = meye.mchip_ptable_toc; in ptable_alloc()
225 dma_free_coherent(meye.mchip_dev, in ptable_alloc()
227 meye.mchip_ptable[j], *pt); in ptable_alloc()
230 dma_free_coherent(meye.mchip_dev, in ptable_alloc()
232 meye.mchip_ptable_toc, in ptable_alloc()
233 meye.mchip_dmahandle); in ptable_alloc()
234 meye.mchip_ptable_toc = 0; in ptable_alloc()
235 meye.mchip_dmahandle = 0; in ptable_alloc()
247 pt = meye.mchip_ptable_toc; in ptable_free()
249 if (meye.mchip_ptable[i]) in ptable_free()
250 dma_free_coherent(meye.mchip_dev, in ptable_free()
252 meye.mchip_ptable[i], *pt); in ptable_free()
256 if (meye.mchip_ptable_toc) in ptable_free()
257 dma_free_coherent(meye.mchip_dev, in ptable_free()
259 meye.mchip_ptable_toc, in ptable_free()
260 meye.mchip_dmahandle); in ptable_free()
262 memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable)); in ptable_free()
263 meye.mchip_ptable_toc = 0; in ptable_free()
264 meye.mchip_dmahandle = 0; in ptable_free()
272 memcpy(buf + i, meye.mchip_ptable[start++], PAGE_SIZE); in ptable_copy()
276 memcpy(buf + i, meye.mchip_ptable[start], size % PAGE_SIZE); in ptable_copy()
516 return meye.params.subsample ? 320 : 640; in mchip_hsize()
521 return meye.params.subsample ? 240 : 480; in mchip_vsize()
531 status = readl(meye.mchip_mmregs + MCHIP_MM_FIFO_STATUS); in mchip_sync()
545 status = readl(meye.mchip_mmregs + MCHIP_HIC_STATUS); in mchip_sync()
559 writel(v, meye.mchip_mmregs + reg); in mchip_set()
565 return readl(meye.mchip_mmregs + reg); in mchip_read()
578 mchip_set(MCHIP_MCC_R_SAMPLING, meye.params.subsample); in mchip_subsample()
588 mchip_set(MCHIP_HIC_S_RATE, meye.params.framerate); in mchip_set_framerate()
600 writel(tables[i], meye.mchip_mmregs + MCHIP_VRJ_TABLE_DATA); in mchip_load_tables()
602 tables = jpeg_quantisation_tables(&size, meye.params.quality); in mchip_load_tables()
604 writel(tables[i], meye.mchip_mmregs + MCHIP_VRJ_TABLE_DATA); in mchip_load_tables()
638 meye.mchip_fnum = 0; in mchip_dma_setup()
643 if (!meye.mchip_dmahandle) in mchip_dma_alloc()
651 if (meye.mchip_dmahandle) { in mchip_dma_free()
662 meye.mchip_mode = MCHIP_HIC_MODE_NOOP; in mchip_hic_stop()
689 v = mchip_read(MCHIP_MM_FIR(meye.mchip_fnum)); in mchip_get_frame()
695 mchip_set(MCHIP_MM_FIR(meye.mchip_fnum), 0); in mchip_free_frame()
696 meye.mchip_fnum++; in mchip_free_frame()
697 meye.mchip_fnum %= 4; in mchip_free_frame()
762 mchip_dma_setup(meye.mchip_dmahandle); in mchip_take_picture()
805 mchip_dma_setup(meye.mchip_dmahandle); in mchip_continuous_start()
807 meye.mchip_mode = MCHIP_HIC_MODE_CONT_OUT; in mchip_continuous_start()
865 mchip_dma_setup(meye.mchip_dmahandle); in mchip_cont_compression_start()
867 meye.mchip_mode = MCHIP_HIC_MODE_CONT_COMP; in mchip_cont_compression_start()
888 switch (meye.mchip_mode) { in meye_irq()
891 if (!meye_emptyq(&meye.grabq, NULL)) { in meye_irq()
892 int nr = meye_pullq(&meye.grabq); in meye_irq()
895 meye.grab_fbuffer + gbufsize * nr, in meye_irq()
897 meye.grab_buffer[nr].state = MEYE_BUF_DONE; in meye_irq()
898 wake_up_interruptible(&meye.grabq.proc_list); in meye_irq()
903 if (!meye_emptyq(&meye.grabq, &reqnr)) { in meye_irq()
907 meye.grab_fbuffer + gbufsize * reqnr, in meye_irq()
911 reqnr = meye_pullq(&meye.grabq); in meye_irq()
912 meye.grab_buffer[reqnr].size = size; in meye_irq()
913 meye.grab_buffer[reqnr].state = MEYE_BUF_DONE; in meye_irq()
914 wake_up_interruptible(&meye.grabq.proc_list); in meye_irq()
945 meye_initq(&meye.grabq); in meye_open()
947 meye.grab_buffer[i].state = MEYE_BUF_UNUSED; in meye_open()
965 strcpy(b->name,meye.video_dev->name); in meye_do_ioctl()
996 *p = meye.picture; in meye_do_ioctl()
1006 down(&meye.lock); in meye_do_ioctl()
1015 meye.picture = *p; in meye_do_ioctl()
1016 up(&meye.lock); in meye_do_ioctl()
1026 switch (meye.grab_buffer[*i].state) { in meye_do_ioctl()
1031 if (wait_event_interruptible(meye.grabq.proc_list, in meye_do_ioctl()
1032 (meye.grab_buffer[*i].state != MEYE_BUF_USING))) in meye_do_ioctl()
1036 meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; in meye_do_ioctl()
1051 if (!meye.grab_fbuffer) in meye_do_ioctl()
1053 if (meye.grab_buffer[vm->frame].state != MEYE_BUF_UNUSED) in meye_do_ioctl()
1056 down(&meye.lock); in meye_do_ioctl()
1058 if (meye.params.subsample) { in meye_do_ioctl()
1059 meye.params.subsample = 0; in meye_do_ioctl()
1064 if (!meye.params.subsample) { in meye_do_ioctl()
1065 meye.params.subsample = 1; in meye_do_ioctl()
1070 up(&meye.lock); in meye_do_ioctl()
1074 if (restart || meye.mchip_mode != MCHIP_HIC_MODE_CONT_OUT) in meye_do_ioctl()
1076 meye.grab_buffer[vm->frame].state = MEYE_BUF_USING; in meye_do_ioctl()
1077 meye_pushq(&meye.grabq, vm->frame); in meye_do_ioctl()
1078 up(&meye.lock); in meye_do_ioctl()
1096 *p = meye.params; in meye_do_ioctl()
1110 down(&meye.lock); in meye_do_ioctl()
1111 if (meye.params.subsample != jp->subsample || in meye_do_ioctl()
1112 meye.params.quality != jp->quality) in meye_do_ioctl()
1114 meye.params = *jp; in meye_do_ioctl()
1116 meye.params.sharpness); in meye_do_ioctl()
1118 meye.params.agc); in meye_do_ioctl()
1120 meye.params.picture); in meye_do_ioctl()
1121 up(&meye.lock); in meye_do_ioctl()
1128 if (!meye.grab_fbuffer) in meye_do_ioctl()
1137 if (meye.grab_buffer[*nb].state != MEYE_BUF_UNUSED) in meye_do_ioctl()
1139 down(&meye.lock); in meye_do_ioctl()
1140 if (meye.mchip_mode != MCHIP_HIC_MODE_CONT_COMP) in meye_do_ioctl()
1142 meye.grab_buffer[*nb].state = MEYE_BUF_USING; in meye_do_ioctl()
1143 meye_pushq(&meye.grabq, *nb); in meye_do_ioctl()
1144 up(&meye.lock); in meye_do_ioctl()
1154 switch (meye.grab_buffer[*i].state) { in meye_do_ioctl()
1159 if (wait_event_interruptible(meye.grabq.proc_list, in meye_do_ioctl()
1160 (meye.grab_buffer[*i].state != MEYE_BUF_USING))) in meye_do_ioctl()
1164 meye.grab_buffer[*i].state = MEYE_BUF_UNUSED; in meye_do_ioctl()
1166 *i = meye.grab_buffer[*i].size; in meye_do_ioctl()
1172 if (!meye.grab_fbuffer) in meye_do_ioctl()
1174 if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) in meye_do_ioctl()
1176 down(&meye.lock); in meye_do_ioctl()
1177 meye.grab_buffer[0].state = MEYE_BUF_USING; in meye_do_ioctl()
1180 meye.grab_fbuffer, in meye_do_ioctl()
1182 meye.grab_buffer[0].state = MEYE_BUF_DONE; in meye_do_ioctl()
1183 up(&meye.lock); in meye_do_ioctl()
1190 if (!meye.grab_fbuffer) in meye_do_ioctl()
1192 if (meye.grab_buffer[0].state != MEYE_BUF_UNUSED) in meye_do_ioctl()
1194 down(&meye.lock); in meye_do_ioctl()
1195 meye.grab_buffer[0].state = MEYE_BUF_USING; in meye_do_ioctl()
1199 *len = mchip_compress_frame(meye.grab_fbuffer, gbufsize); in meye_do_ioctl()
1201 meye.grab_buffer[0].state = MEYE_BUF_DONE; in meye_do_ioctl()
1202 up(&meye.lock); in meye_do_ioctl()
1225 down(&meye.lock); in meye_mmap()
1227 up(&meye.lock); in meye_mmap()
1230 if (!meye.grab_fbuffer) { in meye_mmap()
1232 meye.grab_fbuffer = rvmalloc(gbuffers*gbufsize); in meye_mmap()
1233 if (!meye.grab_fbuffer) { in meye_mmap()
1235 up(&meye.lock); in meye_mmap()
1239 pos = (unsigned long)meye.grab_fbuffer; in meye_mmap()
1244 up(&meye.lock); in meye_mmap()
1251 up(&meye.lock); in meye_mmap()
1277 pci_save_state(pdev, meye.pm_state); in meye_suspend()
1278 meye.pm_mchip_mode = meye.mchip_mode; in meye_suspend()
1286 pci_restore_state(pdev, meye.pm_state); in meye_resume()
1287 pci_write_config_word(meye.mchip_dev, MCHIP_PCI_SOFTRESET_SET, 1); in meye_resume()
1298 switch (meye.pm_mchip_mode) { in meye_resume()
1316 if (meye.mchip_dev != NULL) { in meye_probe()
1322 meye.mchip_dev = pcidev; in meye_probe()
1323 meye.video_dev = video_device_alloc(); in meye_probe()
1324 if (!meye.video_dev) { in meye_probe()
1329 memcpy(meye.video_dev, &meye_template, sizeof(meye_template)); in meye_probe()
1333 if ((ret = pci_enable_device(meye.mchip_dev))) { in meye_probe()
1338 meye.mchip_irq = pcidev->irq; in meye_probe()
1339 mchip_adr = pci_resource_start(meye.mchip_dev,0); in meye_probe()
1345 if (!request_mem_region(pci_resource_start(meye.mchip_dev, 0), in meye_probe()
1346 pci_resource_len(meye.mchip_dev, 0), in meye_probe()
1353 pci_read_config_byte(meye.mchip_dev, PCI_REVISION_ID, &revision); in meye_probe()
1355 pci_set_master(meye.mchip_dev); in meye_probe()
1357 pci_write_config_byte(meye.mchip_dev, PCI_CACHE_LINE_SIZE, 8); in meye_probe()
1358 pci_write_config_byte(meye.mchip_dev, PCI_LATENCY_TIMER, 64); in meye_probe()
1360 if ((ret = request_irq(meye.mchip_irq, meye_irq, in meye_probe()
1366 meye.mchip_mmregs = ioremap(mchip_adr, MCHIP_MM_REGS); in meye_probe()
1367 if (!meye.mchip_mmregs) { in meye_probe()
1374 pci_write_config_word(meye.mchip_dev, MCHIP_PCI_SOFTRESET_SET, 1); in meye_probe()
1388 if (video_register_device(meye.video_dev, VFL_TYPE_GRABBER, video_nr) < 0) { in meye_probe()
1399 revision, mchip_adr, meye.mchip_irq); in meye_probe()
1402 init_MUTEX(&meye.lock); in meye_probe()
1404 meye.picture.depth = 2; in meye_probe()
1405 meye.picture.palette = VIDEO_PALETTE_YUV422; in meye_probe()
1406 meye.picture.brightness = 32 << 10; in meye_probe()
1407 meye.picture.hue = 32 << 10; in meye_probe()
1408 meye.picture.colour = 32 << 10; in meye_probe()
1409 meye.picture.contrast = 32 << 10; in meye_probe()
1410 meye.picture.whiteness = 0; in meye_probe()
1411 meye.params.subsample = 0; in meye_probe()
1412 meye.params.quality = 7; in meye_probe()
1413 meye.params.sharpness = 32; in meye_probe()
1414 meye.params.agc = 48; in meye_probe()
1415 meye.params.picture = 0; in meye_probe()
1416 meye.params.framerate = 0; in meye_probe()
1427 iounmap(meye.mchip_mmregs); in meye_probe()
1429 free_irq(meye.mchip_irq, meye_irq); in meye_probe()
1431 release_mem_region(pci_resource_start(meye.mchip_dev, 0), in meye_probe()
1432 pci_resource_len(meye.mchip_dev, 0)); in meye_probe()
1434 pci_disable_device(meye.mchip_dev); in meye_probe()
1436 video_device_release(meye.video_dev); in meye_probe()
1437 meye.video_dev = NULL; in meye_probe()
1446 video_unregister_device(meye.video_dev); in meye_remove()
1455 free_irq(meye.mchip_irq, meye_irq); in meye_remove()
1457 iounmap(meye.mchip_mmregs); in meye_remove()
1459 release_mem_region(pci_resource_start(meye.mchip_dev, 0), in meye_remove()
1460 pci_resource_len(meye.mchip_dev, 0)); in meye_remove()
1462 pci_disable_device(meye.mchip_dev); in meye_remove()
1464 if (meye.grab_fbuffer) in meye_remove()
1465 rvfree(meye.grab_fbuffer, gbuffers*gbufsize); in meye_remove()