Lines Matching full:pd
128 struct dt3155_priv *pd = vb2_get_drv_priv(vq); in dt3155_queue_setup() local
129 unsigned size = pd->width * pd->height; in dt3155_queue_setup()
140 struct dt3155_priv *pd = vb2_get_drv_priv(vb->vb2_queue); in dt3155_buf_prepare() local
142 vb2_set_plane_payload(vb, 0, pd->width * pd->height); in dt3155_buf_prepare()
148 struct dt3155_priv *pd = vb2_get_drv_priv(q); in dt3155_start_streaming() local
149 struct vb2_buffer *vb = &pd->curr_buf->vb2_buf; in dt3155_start_streaming()
152 pd->sequence = 0; in dt3155_start_streaming()
154 iowrite32(dma_addr, pd->regs + EVEN_DMA_START); in dt3155_start_streaming()
155 iowrite32(dma_addr + pd->width, pd->regs + ODD_DMA_START); in dt3155_start_streaming()
156 iowrite32(pd->width, pd->regs + EVEN_DMA_STRIDE); in dt3155_start_streaming()
157 iowrite32(pd->width, pd->regs + ODD_DMA_STRIDE); in dt3155_start_streaming()
160 FLD_END_EVEN | FLD_END_ODD, pd->regs + INT_CSR); in dt3155_start_streaming()
163 pd->regs + CSR1); in dt3155_start_streaming()
164 wait_i2c_reg(pd->regs); in dt3155_start_streaming()
165 write_i2c_reg(pd->regs, CONFIG, pd->config); in dt3155_start_streaming()
166 write_i2c_reg(pd->regs, EVEN_CSR, CSR_ERROR | CSR_DONE); in dt3155_start_streaming()
167 write_i2c_reg(pd->regs, ODD_CSR, CSR_ERROR | CSR_DONE); in dt3155_start_streaming()
170 write_i2c_reg(pd->regs, CSR2, pd->csr2 | BUSY_EVEN | BUSY_ODD); in dt3155_start_streaming()
176 struct dt3155_priv *pd = vb2_get_drv_priv(q); in dt3155_stop_streaming() local
179 spin_lock_irq(&pd->lock); in dt3155_stop_streaming()
181 write_i2c_reg_nowait(pd->regs, CSR2, pd->csr2); in dt3155_stop_streaming()
183 FLD_DN_ODD | FLD_DN_EVEN, pd->regs + CSR1); in dt3155_stop_streaming()
185 iowrite32(FLD_START | FLD_END_EVEN | FLD_END_ODD, pd->regs + INT_CSR); in dt3155_stop_streaming()
186 spin_unlock_irq(&pd->lock); in dt3155_stop_streaming()
195 spin_lock_irq(&pd->lock); in dt3155_stop_streaming()
196 if (pd->curr_buf) { in dt3155_stop_streaming()
197 vb2_buffer_done(&pd->curr_buf->vb2_buf, VB2_BUF_STATE_ERROR); in dt3155_stop_streaming()
198 pd->curr_buf = NULL; in dt3155_stop_streaming()
201 while (!list_empty(&pd->dmaq)) { in dt3155_stop_streaming()
202 vb = list_first_entry(&pd->dmaq, typeof(*vb), done_entry); in dt3155_stop_streaming()
206 spin_unlock_irq(&pd->lock); in dt3155_stop_streaming()
212 struct dt3155_priv *pd = vb2_get_drv_priv(vb->vb2_queue); in dt3155_buf_queue() local
214 /* pd->vidq.streaming = 1 when dt3155_buf_queue() is invoked */ in dt3155_buf_queue()
215 spin_lock_irq(&pd->lock); in dt3155_buf_queue()
216 if (pd->curr_buf) in dt3155_buf_queue()
217 list_add_tail(&vb->done_entry, &pd->dmaq); in dt3155_buf_queue()
219 pd->curr_buf = vbuf; in dt3155_buf_queue()
220 spin_unlock_irq(&pd->lock); in dt3155_buf_queue()
309 struct dt3155_priv *pd = video_drvdata(filp); in dt3155_fmt_vid_cap() local
311 f->fmt.pix.width = pd->width; in dt3155_fmt_vid_cap()
312 f->fmt.pix.height = pd->height; in dt3155_fmt_vid_cap()
323 struct dt3155_priv *pd = video_drvdata(filp); in dt3155_g_std() local
325 *norm = pd->std; in dt3155_g_std()
331 struct dt3155_priv *pd = video_drvdata(filp); in dt3155_s_std() local
333 if (pd->std == norm) in dt3155_s_std()
335 if (vb2_is_busy(&pd->vidq)) in dt3155_s_std()
337 pd->std = norm; in dt3155_s_std()
338 if (pd->std & V4L2_STD_525_60) { in dt3155_s_std()
339 pd->csr2 = VT_60HZ; in dt3155_s_std()
340 pd->width = 640; in dt3155_s_std()
341 pd->height = 480; in dt3155_s_std()
343 pd->csr2 = VT_50HZ; in dt3155_s_std()
344 pd->width = 768; in dt3155_s_std()
345 pd->height = 576; in dt3155_s_std()
368 struct dt3155_priv *pd = video_drvdata(filp); in dt3155_g_input() local
370 *i = pd->input; in dt3155_g_input()
376 struct dt3155_priv *pd = video_drvdata(filp); in dt3155_s_input() local
380 pd->input = i; in dt3155_s_input()
381 write_i2c_reg(pd->regs, AD_ADDR, AD_CMD_REG); in dt3155_s_input()
382 write_i2c_reg(pd->regs, AD_CMD, (i << 6) | (i << 4) | SYNC_LVL_3); in dt3155_s_input()
407 static int dt3155_init_board(struct dt3155_priv *pd) in dt3155_init_board() argument
409 struct pci_dev *pdev = pd->pdev; in dt3155_init_board()
417 FLD_DN_ODD | FLD_DN_EVEN, pd->regs + CSR1); in dt3155_init_board()
421 iowrite32(FIFO_EN | SRST, pd->regs + CSR1); in dt3155_init_board()
422 iowrite32(0xEEEEEE01, pd->regs + EVEN_PIXEL_FMT); in dt3155_init_board()
423 iowrite32(0xEEEEEE01, pd->regs + ODD_PIXEL_FMT); in dt3155_init_board()
424 iowrite32(0x00000020, pd->regs + FIFO_TRIGGER); in dt3155_init_board()
425 iowrite32(0x00000103, pd->regs + XFER_MODE); in dt3155_init_board()
426 iowrite32(0, pd->regs + RETRY_WAIT_CNT); in dt3155_init_board()
427 iowrite32(0, pd->regs + INT_CSR); in dt3155_init_board()
428 iowrite32(1, pd->regs + EVEN_FLD_MASK); in dt3155_init_board()
429 iowrite32(1, pd->regs + ODD_FLD_MASK); in dt3155_init_board()
430 iowrite32(0, pd->regs + MASK_LENGTH); in dt3155_init_board()
431 iowrite32(0x0005007C, pd->regs + FIFO_FLAG_CNT); in dt3155_init_board()
432 iowrite32(0x01010101, pd->regs + IIC_CLK_DUR); in dt3155_init_board()
435 read_i2c_reg(pd->regs, DT_ID, &tmp); in dt3155_init_board()
440 write_i2c_reg(pd->regs, AD_ADDR, 0); in dt3155_init_board()
442 write_i2c_reg(pd->regs, AD_LUT, i); in dt3155_init_board()
446 write_i2c_reg(pd->regs, AD_ADDR, AD_CMD_REG); in dt3155_init_board()
447 write_i2c_reg(pd->regs, AD_CMD, VIDEO_CNL_1 | SYNC_CNL_1 | SYNC_LVL_3); in dt3155_init_board()
448 write_i2c_reg(pd->regs, AD_ADDR, AD_POS_REF); in dt3155_init_board()
449 write_i2c_reg(pd->regs, AD_CMD, 34); in dt3155_init_board()
450 write_i2c_reg(pd->regs, AD_ADDR, AD_NEG_REF); in dt3155_init_board()
451 write_i2c_reg(pd->regs, AD_CMD, 0); in dt3155_init_board()
454 write_i2c_reg(pd->regs, CONFIG, pd->config | PM_LUT_PGM); in dt3155_init_board()
456 write_i2c_reg(pd->regs, PM_LUT_ADDR, i); in dt3155_init_board()
457 write_i2c_reg(pd->regs, PM_LUT_DATA, i); in dt3155_init_board()
459 write_i2c_reg(pd->regs, CONFIG, pd->config | PM_LUT_PGM | PM_LUT_SEL); in dt3155_init_board()
461 write_i2c_reg(pd->regs, PM_LUT_ADDR, i); in dt3155_init_board()
462 write_i2c_reg(pd->regs, PM_LUT_DATA, i); in dt3155_init_board()
464 write_i2c_reg(pd->regs, CONFIG, pd->config); /* ACQ_MODE_EVEN */ in dt3155_init_board()
467 write_i2c_reg(pd->regs, AD_ADDR, AD_CMD_REG); in dt3155_init_board()
468 write_i2c_reg(pd->regs, AD_CMD, VIDEO_CNL_1 | SYNC_CNL_1 | SYNC_LVL_3); in dt3155_init_board()
472 pd->regs + INT_CSR); in dt3155_init_board()
491 struct dt3155_priv *pd; in dt3155_probe() local
496 pd = devm_kzalloc(&pdev->dev, sizeof(*pd), GFP_KERNEL); in dt3155_probe()
497 if (!pd) in dt3155_probe()
500 err = v4l2_device_register(&pdev->dev, &pd->v4l2_dev); in dt3155_probe()
503 pd->vdev = dt3155_vdev; in dt3155_probe()
504 pd->vdev.v4l2_dev = &pd->v4l2_dev; in dt3155_probe()
505 video_set_drvdata(&pd->vdev, pd); /* for use in video_fops */ in dt3155_probe()
506 pd->pdev = pdev; in dt3155_probe()
507 pd->std = V4L2_STD_625_50; in dt3155_probe()
508 pd->csr2 = VT_50HZ; in dt3155_probe()
509 pd->width = 768; in dt3155_probe()
510 pd->height = 576; in dt3155_probe()
511 INIT_LIST_HEAD(&pd->dmaq); in dt3155_probe()
512 mutex_init(&pd->mux); in dt3155_probe()
513 pd->vdev.lock = &pd->mux; /* for locking v4l2_file_operations */ in dt3155_probe()
514 pd->vidq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in dt3155_probe()
515 pd->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; in dt3155_probe()
516 pd->vidq.io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ; in dt3155_probe()
517 pd->vidq.ops = &q_ops; in dt3155_probe()
518 pd->vidq.mem_ops = &vb2_dma_contig_memops; in dt3155_probe()
519 pd->vidq.drv_priv = pd; in dt3155_probe()
520 pd->vidq.min_queued_buffers = 2; in dt3155_probe()
521 pd->vidq.gfp_flags = GFP_DMA32; in dt3155_probe()
522 pd->vidq.lock = &pd->mux; /* for locking v4l2_file_operations */ in dt3155_probe()
523 pd->vidq.dev = &pdev->dev; in dt3155_probe()
524 pd->vdev.queue = &pd->vidq; in dt3155_probe()
525 err = vb2_queue_init(&pd->vidq); in dt3155_probe()
528 spin_lock_init(&pd->lock); in dt3155_probe()
529 pd->config = ACQ_MODE_EVEN; in dt3155_probe()
536 pd->regs = pci_iomap(pdev, 0, pci_resource_len(pd->pdev, 0)); in dt3155_probe()
537 if (!pd->regs) { in dt3155_probe()
541 err = dt3155_init_board(pd); in dt3155_probe()
544 err = request_irq(pd->pdev->irq, dt3155_irq_handler_even, in dt3155_probe()
545 IRQF_SHARED, DT3155_NAME, pd); in dt3155_probe()
548 err = video_register_device(&pd->vdev, VFL_TYPE_VIDEO, -1); in dt3155_probe()
551 dev_info(&pdev->dev, "/dev/video%i is ready\n", pd->vdev.minor); in dt3155_probe()
555 free_irq(pd->pdev->irq, pd); in dt3155_probe()
557 pci_iounmap(pdev, pd->regs); in dt3155_probe()
563 v4l2_device_unregister(&pd->v4l2_dev); in dt3155_probe()
570 struct dt3155_priv *pd = container_of(v4l2_dev, struct dt3155_priv, in dt3155_remove() local
573 vb2_video_unregister_device(&pd->vdev); in dt3155_remove()
574 free_irq(pd->pdev->irq, pd); in dt3155_remove()
575 v4l2_device_unregister(&pd->v4l2_dev); in dt3155_remove()
576 pci_iounmap(pdev, pd->regs); in dt3155_remove()