/linux-4.4.14/drivers/media/platform/soc_camera/ |
H A D | mx2_camera.c | 382 static void mx27_update_emma_buf(struct mx2_camera_dev *pcdev, mx27_update_emma_buf() argument 385 struct mx2_fmt_cfg *prp = pcdev->emma_prp; mx27_update_emma_buf() 388 writel(phys, pcdev->base_emma + mx27_update_emma_buf() 391 writel(phys, pcdev->base_emma + mx27_update_emma_buf() 394 u32 imgsize = pcdev->soc_host.icd->user_height * mx27_update_emma_buf() 395 pcdev->soc_host.icd->user_width; mx27_update_emma_buf() 397 writel(phys + imgsize, pcdev->base_emma + mx27_update_emma_buf() 399 writel(phys + ((5 * imgsize) / 4), pcdev->base_emma + mx27_update_emma_buf() 405 static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev) mx2_camera_deactivate() argument 407 clk_disable_unprepare(pcdev->clk_csi_ahb); mx2_camera_deactivate() 408 clk_disable_unprepare(pcdev->clk_csi_per); mx2_camera_deactivate() 409 writel(0, pcdev->base_csi + CSICR1); mx2_camera_deactivate() 410 writel(0, pcdev->base_emma + PRP_CNTL); mx2_camera_deactivate() 433 struct mx2_camera_dev *pcdev = ici->priv; mx2_camera_clock_start() local 437 ret = clk_prepare_enable(pcdev->clk_csi_ahb); mx2_camera_clock_start() 441 ret = clk_prepare_enable(pcdev->clk_csi_per); mx2_camera_clock_start() 448 pcdev->csicr1 = csicr1; mx2_camera_clock_start() 449 writel(pcdev->csicr1, pcdev->base_csi + CSICR1); mx2_camera_clock_start() 451 pcdev->frame_count = 0; mx2_camera_clock_start() 456 clk_disable_unprepare(pcdev->clk_csi_ahb); mx2_camera_clock_start() 463 struct mx2_camera_dev *pcdev = ici->priv; mx2_camera_clock_stop() local 465 mx2_camera_deactivate(pcdev); mx2_camera_clock_stop() 479 struct mx2_camera_dev *pcdev = ici->priv; mx2_videobuf_setup() local 487 alloc_ctxs[0] = pcdev->alloc_ctx; mx2_videobuf_setup() 538 struct mx2_camera_dev *pcdev = ici->priv; mx2_videobuf_queue() local 545 spin_lock_irqsave(&pcdev->lock, flags); mx2_videobuf_queue() 547 list_add_tail(&buf->internal.queue, &pcdev->capture); mx2_videobuf_queue() 549 spin_unlock_irqrestore(&pcdev->lock, flags); mx2_videobuf_queue() 557 struct mx2_camera_dev *pcdev = ici->priv; mx27_camera_emma_buf_init() local 558 struct mx2_fmt_cfg *prp = pcdev->emma_prp; mx27_camera_emma_buf_init() 560 writel((pcdev->s_width << 16) | pcdev->s_height, mx27_camera_emma_buf_init() 561 pcdev->base_emma + PRP_SRC_FRAME_SIZE); mx27_camera_emma_buf_init() 563 pcdev->base_emma + PRP_SRC_PIXEL_FORMAT_CNTL); mx27_camera_emma_buf_init() 566 pcdev->base_emma + PRP_CH1_OUT_IMAGE_SIZE); mx27_camera_emma_buf_init() 568 pcdev->base_emma + PRP_DEST_CH1_LINE_STRIDE); mx27_camera_emma_buf_init() 570 pcdev->base_emma + PRP_CH1_PIXEL_FORMAT_CNTL); mx27_camera_emma_buf_init() 573 pcdev->base_emma + PRP_CH2_OUT_IMAGE_SIZE); mx27_camera_emma_buf_init() 577 writel(prp->cfg.irq_flags, pcdev->base_emma + PRP_INTR_CNTL); mx27_camera_emma_buf_init() 580 static void mx2_prp_resize_commit(struct mx2_camera_dev *pcdev) mx2_prp_resize_commit() argument 585 unsigned char *s = pcdev->resizing[dir].s; mx2_prp_resize_commit() 586 int len = pcdev->resizing[dir].len; mx2_prp_resize_commit() 609 if (pcdev->resizing[dir].algo == RESIZE_ALGO_BILINEAR) mx2_prp_resize_commit() 612 if (pcdev->emma_prp->cfg.channel == 1) { mx2_prp_resize_commit() 614 writel(coeff[0], pcdev->base_emma + mx2_prp_resize_commit() 616 writel(coeff[1], pcdev->base_emma + mx2_prp_resize_commit() 618 writel(valid, pcdev->base_emma + mx2_prp_resize_commit() 621 writel(coeff[0], pcdev->base_emma + mx2_prp_resize_commit() 623 writel(coeff[1], pcdev->base_emma + mx2_prp_resize_commit() 625 writel(valid, pcdev->base_emma + mx2_prp_resize_commit() 630 writel(coeff[0], pcdev->base_emma + mx2_prp_resize_commit() 632 writel(coeff[1], pcdev->base_emma + mx2_prp_resize_commit() 634 writel(valid, pcdev->base_emma + mx2_prp_resize_commit() 637 writel(coeff[0], pcdev->base_emma + mx2_prp_resize_commit() 639 writel(coeff[1], pcdev->base_emma + mx2_prp_resize_commit() 641 writel(valid, pcdev->base_emma + mx2_prp_resize_commit() 653 struct mx2_camera_dev *pcdev = ici->priv; mx2_start_streaming() local 654 struct mx2_fmt_cfg *prp = pcdev->emma_prp; mx2_start_streaming() 664 spin_lock_irqsave(&pcdev->lock, flags); mx2_start_streaming() 666 buf = list_first_entry(&pcdev->capture, struct mx2_buffer, mx2_start_streaming() 672 mx27_update_emma_buf(pcdev, phys, buf->internal.bufnum); mx2_start_streaming() 673 list_move_tail(pcdev->capture.next, &pcdev->active_bufs); mx2_start_streaming() 675 buf = list_first_entry(&pcdev->capture, struct mx2_buffer, mx2_start_streaming() 681 mx27_update_emma_buf(pcdev, phys, buf->internal.bufnum); mx2_start_streaming() 682 list_move_tail(pcdev->capture.next, &pcdev->active_bufs); mx2_start_streaming() 687 spin_unlock_irqrestore(&pcdev->lock, flags); mx2_start_streaming() 698 pcdev->discard_size = icd->user_height * bytesperline; mx2_start_streaming() 699 pcdev->discard_buffer = dma_alloc_coherent(ici->v4l2_dev.dev, mx2_start_streaming() 700 pcdev->discard_size, mx2_start_streaming() 701 &pcdev->discard_buffer_dma, GFP_ATOMIC); mx2_start_streaming() 702 if (!pcdev->discard_buffer) { mx2_start_streaming() 703 spin_unlock_irqrestore(&pcdev->lock, flags); mx2_start_streaming() 707 pcdev->buf_discard[0].discard = true; mx2_start_streaming() 708 list_add_tail(&pcdev->buf_discard[0].queue, mx2_start_streaming() 709 &pcdev->discard); mx2_start_streaming() 711 pcdev->buf_discard[1].discard = true; mx2_start_streaming() 712 list_add_tail(&pcdev->buf_discard[1].queue, mx2_start_streaming() 713 &pcdev->discard); mx2_start_streaming() 715 mx2_prp_resize_commit(pcdev); mx2_start_streaming() 728 pcdev->base_emma + PRP_CNTL); mx2_start_streaming() 737 pcdev->base_emma + PRP_CNTL); mx2_start_streaming() 739 spin_unlock_irqrestore(&pcdev->lock, flags); mx2_start_streaming() 749 struct mx2_camera_dev *pcdev = ici->priv; mx2_stop_streaming() local 750 struct mx2_fmt_cfg *prp = pcdev->emma_prp; mx2_stop_streaming() 755 spin_lock_irqsave(&pcdev->lock, flags); mx2_stop_streaming() 757 cntl = readl(pcdev->base_emma + PRP_CNTL); mx2_stop_streaming() 760 pcdev->base_emma + PRP_CNTL); mx2_stop_streaming() 763 pcdev->base_emma + PRP_CNTL); mx2_stop_streaming() 765 INIT_LIST_HEAD(&pcdev->capture); mx2_stop_streaming() 766 INIT_LIST_HEAD(&pcdev->active_bufs); mx2_stop_streaming() 767 INIT_LIST_HEAD(&pcdev->discard); mx2_stop_streaming() 769 b = pcdev->discard_buffer; mx2_stop_streaming() 770 pcdev->discard_buffer = NULL; mx2_stop_streaming() 772 spin_unlock_irqrestore(&pcdev->lock, flags); mx2_stop_streaming() 775 pcdev->discard_size, b, pcdev->discard_buffer_dma); mx2_stop_streaming() 810 static int mx27_camera_emma_prp_reset(struct mx2_camera_dev *pcdev) mx27_camera_emma_prp_reset() argument 814 readl(pcdev->base_emma + PRP_CNTL); mx27_camera_emma_prp_reset() 815 writel(PRP_CNTL_SWRST, pcdev->base_emma + PRP_CNTL); mx27_camera_emma_prp_reset() 817 if (!(readl(pcdev->base_emma + PRP_CNTL) & PRP_CNTL_SWRST)) mx27_camera_emma_prp_reset() 830 struct mx2_camera_dev *pcdev = ici->priv; mx2_camera_set_bus_param() local 835 u32 csicr1 = pcdev->csicr1; mx2_camera_set_bus_param() 854 if (pcdev->platform_flags & MX2_CAMERA_HSYNC_HIGH) mx2_camera_set_bus_param() 862 if (pcdev->platform_flags & MX2_CAMERA_PCLK_SAMPLE_RISING) mx2_camera_set_bus_param() 876 csicr1 = (csicr1 & ~CSICR1_FMT_MASK) | pcdev->emma_prp->cfg.csicr1; mx2_camera_set_bus_param() 884 if (pcdev->platform_flags & MX2_CAMERA_EXT_VSYNC) mx2_camera_set_bus_param() 886 if (pcdev->platform_flags & MX2_CAMERA_CCIR) mx2_camera_set_bus_param() 888 if (pcdev->platform_flags & MX2_CAMERA_CCIR_INTERLACE) mx2_camera_set_bus_param() 890 if (pcdev->platform_flags & MX2_CAMERA_GATED_CLOCK) mx2_camera_set_bus_param() 892 if (pcdev->platform_flags & MX2_CAMERA_INV_DATA) mx2_camera_set_bus_param() 895 pcdev->csicr1 = csicr1; mx2_camera_set_bus_param() 902 ret = mx27_camera_emma_prp_reset(pcdev); mx2_camera_set_bus_param() 906 writel(pcdev->csicr1, pcdev->base_csi + CSICR1); mx2_camera_set_bus_param() 1007 static int mx2_emmaprp_resize(struct mx2_camera_dev *pcdev, mx2_emmaprp_resize() argument 1119 memcpy(&pcdev->resizing[dir], &tmprsz, sizeof(tmprsz)); mx2_emmaprp_resize() 1128 struct mx2_camera_dev *pcdev = ici->priv; mx2_camera_set_fmt() local 1159 pcdev->s_width = mf->width; mx2_camera_set_fmt() 1160 pcdev->s_height = mf->height; mx2_camera_set_fmt() 1162 __func__, pcdev->s_width, pcdev->s_height); mx2_camera_set_fmt() 1164 pcdev->emma_prp = mx27_emma_prp_get_format(xlate->code, mx2_camera_set_fmt() 1167 memset(pcdev->resizing, 0, sizeof(pcdev->resizing)); mx2_camera_set_fmt() 1169 pcdev->emma_prp->cfg.in_fmt == PRP_CNTL_DATA_IN_YUV422) { mx2_camera_set_fmt() 1170 if (mx2_emmaprp_resize(pcdev, mf, pix, true) < 0) mx2_camera_set_fmt() 1202 struct mx2_camera_dev *pcdev = ici->priv; mx2_camera_try_fmt() local 1233 __func__, pcdev->s_width, pcdev->s_height); mx2_camera_try_fmt() 1241 if (mx2_emmaprp_resize(pcdev, mf, pix, false) < 0) mx2_camera_try_fmt() 1303 static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev, mx27_camera_frame_done_emma() argument 1307 struct mx2_fmt_cfg *prp = pcdev->emma_prp; mx27_camera_frame_done_emma() 1315 ibuf = list_first_entry(&pcdev->active_bufs, struct mx2_buf_internal, mx27_camera_frame_done_emma() 1325 list_move_tail(pcdev->active_bufs.next, &pcdev->discard); mx27_camera_frame_done_emma() 1334 if (readl(pcdev->base_emma + PRP_DEST_RGB1_PTR + mx27_camera_frame_done_emma() 1336 dev_err(pcdev->dev, "%lx != %x\n", phys, mx27_camera_frame_done_emma() 1337 readl(pcdev->base_emma + mx27_camera_frame_done_emma() 1341 if (readl(pcdev->base_emma + PRP_DEST_Y_PTR - mx27_camera_frame_done_emma() 1343 dev_err(pcdev->dev, "%lx != %x\n", phys, mx27_camera_frame_done_emma() 1344 readl(pcdev->base_emma + mx27_camera_frame_done_emma() 1349 dev_dbg(pcdev->dev, "%s (vb=0x%p) 0x%p %lu\n", __func__, vb, mx27_camera_frame_done_emma() 1355 vbuf->sequence = pcdev->frame_count; mx27_camera_frame_done_emma() 1362 pcdev->frame_count++; mx27_camera_frame_done_emma() 1364 if (list_empty(&pcdev->capture)) { mx27_camera_frame_done_emma() 1365 if (list_empty(&pcdev->discard)) { mx27_camera_frame_done_emma() 1366 dev_warn(pcdev->dev, "%s: trying to access empty discard list\n", mx27_camera_frame_done_emma() 1371 ibuf = list_first_entry(&pcdev->discard, mx27_camera_frame_done_emma() 1375 list_move_tail(pcdev->discard.next, &pcdev->active_bufs); mx27_camera_frame_done_emma() 1376 mx27_update_emma_buf(pcdev, pcdev->discard_buffer_dma, bufnum); mx27_camera_frame_done_emma() 1380 buf = list_first_entry(&pcdev->capture, struct mx2_buffer, mx27_camera_frame_done_emma() 1385 list_move_tail(pcdev->capture.next, &pcdev->active_bufs); mx27_camera_frame_done_emma() 1390 mx27_update_emma_buf(pcdev, phys, bufnum); mx27_camera_frame_done_emma() 1395 struct mx2_camera_dev *pcdev = data; mx27_camera_emma_irq() local 1396 unsigned int status = readl(pcdev->base_emma + PRP_INTRSTATUS); mx27_camera_emma_irq() 1399 spin_lock(&pcdev->lock); mx27_camera_emma_irq() 1401 if (list_empty(&pcdev->active_bufs)) { mx27_camera_emma_irq() 1402 dev_warn(pcdev->dev, "%s: called while active list is empty\n", mx27_camera_emma_irq() 1406 spin_unlock(&pcdev->lock); mx27_camera_emma_irq() 1412 u32 cntl = readl(pcdev->base_emma + PRP_CNTL); mx27_camera_emma_irq() 1414 pcdev->base_emma + PRP_CNTL); mx27_camera_emma_irq() 1415 writel(cntl, pcdev->base_emma + PRP_CNTL); mx27_camera_emma_irq() 1417 ibuf = list_first_entry(&pcdev->active_bufs, mx27_camera_emma_irq() 1419 mx27_camera_frame_done_emma(pcdev, mx27_camera_emma_irq() 1429 ibuf = list_first_entry(&pcdev->active_bufs, mx27_camera_emma_irq() 1431 mx27_camera_frame_done_emma(pcdev, ibuf->bufnum, false); mx27_camera_emma_irq() 1434 mx27_camera_frame_done_emma(pcdev, 0, false); mx27_camera_emma_irq() 1436 mx27_camera_frame_done_emma(pcdev, 1, false); mx27_camera_emma_irq() 1439 spin_unlock(&pcdev->lock); mx27_camera_emma_irq() 1440 writel(status, pcdev->base_emma + PRP_INTRSTATUS); mx27_camera_emma_irq() 1447 struct mx2_camera_dev *pcdev = platform_get_drvdata(pdev); mx27_camera_emma_init() local 1455 dev_err(pcdev->dev, "no EMMA resources\n"); mx27_camera_emma_init() 1460 pcdev->base_emma = devm_ioremap_resource(pcdev->dev, res_emma); mx27_camera_emma_init() 1461 if (IS_ERR(pcdev->base_emma)) { mx27_camera_emma_init() 1462 err = PTR_ERR(pcdev->base_emma); mx27_camera_emma_init() 1466 err = devm_request_irq(pcdev->dev, irq_emma, mx27_camera_emma_irq, 0, mx27_camera_emma_init() 1467 MX2_CAM_DRV_NAME, pcdev); mx27_camera_emma_init() 1469 dev_err(pcdev->dev, "Camera EMMA interrupt register failed\n"); mx27_camera_emma_init() 1473 pcdev->clk_emma_ipg = devm_clk_get(pcdev->dev, "emma-ipg"); mx27_camera_emma_init() 1474 if (IS_ERR(pcdev->clk_emma_ipg)) { mx27_camera_emma_init() 1475 err = PTR_ERR(pcdev->clk_emma_ipg); mx27_camera_emma_init() 1479 clk_prepare_enable(pcdev->clk_emma_ipg); mx27_camera_emma_init() 1481 pcdev->clk_emma_ahb = devm_clk_get(pcdev->dev, "emma-ahb"); mx27_camera_emma_init() 1482 if (IS_ERR(pcdev->clk_emma_ahb)) { mx27_camera_emma_init() 1483 err = PTR_ERR(pcdev->clk_emma_ahb); mx27_camera_emma_init() 1487 clk_prepare_enable(pcdev->clk_emma_ahb); mx27_camera_emma_init() 1489 err = mx27_camera_emma_prp_reset(pcdev); mx27_camera_emma_init() 1496 clk_disable_unprepare(pcdev->clk_emma_ahb); mx27_camera_emma_init() 1498 clk_disable_unprepare(pcdev->clk_emma_ipg); mx27_camera_emma_init() 1505 struct mx2_camera_dev *pcdev; mx2_camera_probe() local 1520 pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); mx2_camera_probe() 1521 if (!pcdev) { mx2_camera_probe() 1522 dev_err(&pdev->dev, "Could not allocate pcdev\n"); mx2_camera_probe() 1527 pcdev->clk_csi_ahb = devm_clk_get(&pdev->dev, "ahb"); mx2_camera_probe() 1528 if (IS_ERR(pcdev->clk_csi_ahb)) { mx2_camera_probe() 1530 err = PTR_ERR(pcdev->clk_csi_ahb); mx2_camera_probe() 1534 pcdev->clk_csi_per = devm_clk_get(&pdev->dev, "per"); mx2_camera_probe() 1535 if (IS_ERR(pcdev->clk_csi_per)) { mx2_camera_probe() 1537 err = PTR_ERR(pcdev->clk_csi_per); mx2_camera_probe() 1541 pcdev->pdata = pdev->dev.platform_data; mx2_camera_probe() 1542 if (pcdev->pdata) { mx2_camera_probe() 1545 pcdev->platform_flags = pcdev->pdata->flags; mx2_camera_probe() 1547 rate = clk_round_rate(pcdev->clk_csi_per, mx2_camera_probe() 1548 pcdev->pdata->clk * 2); mx2_camera_probe() 1553 err = clk_set_rate(pcdev->clk_csi_per, rate); mx2_camera_probe() 1558 INIT_LIST_HEAD(&pcdev->capture); mx2_camera_probe() 1559 INIT_LIST_HEAD(&pcdev->active_bufs); mx2_camera_probe() 1560 INIT_LIST_HEAD(&pcdev->discard); mx2_camera_probe() 1561 spin_lock_init(&pcdev->lock); mx2_camera_probe() 1563 pcdev->base_csi = devm_ioremap_resource(&pdev->dev, res_csi); mx2_camera_probe() 1564 if (IS_ERR(pcdev->base_csi)) { mx2_camera_probe() 1565 err = PTR_ERR(pcdev->base_csi); mx2_camera_probe() 1569 pcdev->dev = &pdev->dev; mx2_camera_probe() 1570 platform_set_drvdata(pdev, pcdev); mx2_camera_probe() 1582 pcdev->soc_host.drv_name = MX2_CAM_DRV_NAME, mx2_camera_probe() 1583 pcdev->soc_host.ops = &mx2_soc_camera_host_ops, mx2_camera_probe() 1584 pcdev->soc_host.priv = pcdev; mx2_camera_probe() 1585 pcdev->soc_host.v4l2_dev.dev = &pdev->dev; mx2_camera_probe() 1586 pcdev->soc_host.nr = pdev->id; mx2_camera_probe() 1588 pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); mx2_camera_probe() 1589 if (IS_ERR(pcdev->alloc_ctx)) { mx2_camera_probe() 1590 err = PTR_ERR(pcdev->alloc_ctx); mx2_camera_probe() 1593 err = soc_camera_host_register(&pcdev->soc_host); mx2_camera_probe() 1598 clk_get_rate(pcdev->clk_csi_per)); mx2_camera_probe() 1603 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); mx2_camera_probe() 1605 clk_disable_unprepare(pcdev->clk_emma_ipg); mx2_camera_probe() 1606 clk_disable_unprepare(pcdev->clk_emma_ahb); mx2_camera_probe() 1614 struct mx2_camera_dev *pcdev = container_of(soc_host, mx2_camera_remove() local 1617 soc_camera_host_unregister(&pcdev->soc_host); mx2_camera_remove() 1619 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); mx2_camera_remove() 1621 clk_disable_unprepare(pcdev->clk_emma_ipg); mx2_camera_remove() 1622 clk_disable_unprepare(pcdev->clk_emma_ahb); mx2_camera_remove()
|
H A D | omap1_camera.c | 183 static void cam_write(struct omap1_cam_dev *pcdev, u16 reg, u32 val) cam_write() argument 185 pcdev->reg_cache[reg / sizeof(u32)] = val; cam_write() 186 __raw_writel(val, pcdev->base + reg); cam_write() 189 static u32 cam_read(struct omap1_cam_dev *pcdev, u16 reg, bool from_cache) cam_read() argument 191 return !from_cache ? __raw_readl(pcdev->base + reg) : cam_read() 192 pcdev->reg_cache[reg / sizeof(u32)]; cam_read() 195 #define CAM_READ(pcdev, reg) \ 196 cam_read(pcdev, REG_##reg, false) 197 #define CAM_WRITE(pcdev, reg, val) \ 198 cam_write(pcdev, REG_##reg, val) 199 #define CAM_READ_CACHE(pcdev, reg) \ 200 cam_read(pcdev, REG_##reg, true) 210 struct omap1_cam_dev *pcdev = ici->priv; omap1_videobuf_setup() local 214 if (!*count || *count < OMAP1_CAMERA_MIN_BUF_COUNT(pcdev->vb_mode)) omap1_videobuf_setup() 215 *count = OMAP1_CAMERA_MIN_BUF_COUNT(pcdev->vb_mode); omap1_videobuf_setup() 255 struct omap1_cam_dev *pcdev = ici->priv; omap1_videobuf_prepare() local 292 free_buffer(vq, buf, pcdev->vb_mode); omap1_videobuf_prepare() 345 static struct omap1_cam_buf *prepare_next_vb(struct omap1_cam_dev *pcdev) prepare_next_vb() argument 350 * If there is already a buffer pointed out by the pcdev->ready, prepare_next_vb() 353 buf = pcdev->ready; prepare_next_vb() 355 if (list_empty(&pcdev->capture)) prepare_next_vb() 357 buf = list_entry(pcdev->capture.next, prepare_next_vb() 360 pcdev->ready = buf; prepare_next_vb() 364 if (pcdev->vb_mode == OMAP1_CAM_DMA_CONTIG) { prepare_next_vb() 370 set_dma_dest_params(pcdev->dma_ch, buf, pcdev->vb_mode); prepare_next_vb() 426 static void start_capture(struct omap1_cam_dev *pcdev) start_capture() argument 428 struct omap1_cam_buf *buf = pcdev->active; start_capture() 429 u32 ctrlclock = CAM_READ_CACHE(pcdev, CTRLCLOCK); start_capture() 430 u32 mode = CAM_READ_CACHE(pcdev, MODE) & ~EN_V_DOWN; start_capture() 443 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock & ~LCLK_EN); start_capture() 445 CAM_WRITE(pcdev, MODE, mode | RAZ_FIFO); start_capture() 447 omap_start_dma(pcdev->dma_ch); start_capture() 449 if (pcdev->vb_mode == OMAP1_CAM_DMA_SG) { start_capture() 455 try_next_sgbuf(pcdev->dma_ch, buf); start_capture() 459 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock | LCLK_EN); start_capture() 461 CAM_WRITE(pcdev, MODE, mode); start_capture() 464 static void suspend_capture(struct omap1_cam_dev *pcdev) suspend_capture() argument 466 u32 ctrlclock = CAM_READ_CACHE(pcdev, CTRLCLOCK); suspend_capture() 468 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock & ~LCLK_EN); suspend_capture() 469 omap_stop_dma(pcdev->dma_ch); suspend_capture() 472 static void disable_capture(struct omap1_cam_dev *pcdev) disable_capture() argument 474 u32 mode = CAM_READ_CACHE(pcdev, MODE); disable_capture() 476 CAM_WRITE(pcdev, MODE, mode & ~(IRQ_MASK | DMA)); disable_capture() 484 struct omap1_cam_dev *pcdev = ici->priv; omap1_videobuf_queue() local 488 list_add_tail(&vb->queue, &pcdev->capture); omap1_videobuf_queue() 491 if (pcdev->active) { omap1_videobuf_queue() 493 * Capture in progress, so don't touch pcdev->ready even if omap1_videobuf_queue() 503 WARN_ON(pcdev->ready); omap1_videobuf_queue() 505 buf = prepare_next_vb(pcdev); omap1_videobuf_queue() 509 pcdev->active = buf; omap1_videobuf_queue() 510 pcdev->ready = NULL; omap1_videobuf_queue() 514 mode = CAM_READ_CACHE(pcdev, MODE) & ~THRESHOLD_MASK; omap1_videobuf_queue() 515 mode |= THRESHOLD_LEVEL(pcdev->vb_mode) << THRESHOLD_SHIFT; omap1_videobuf_queue() 516 CAM_WRITE(pcdev, MODE, mode | EN_FIFO_FULL | DMA); omap1_videobuf_queue() 518 if (pcdev->vb_mode == OMAP1_CAM_DMA_SG) { omap1_videobuf_queue() 524 try_next_sgbuf(pcdev->dma_ch, buf); omap1_videobuf_queue() 527 start_capture(pcdev); omap1_videobuf_queue() 538 struct omap1_cam_dev *pcdev = ici->priv; omap1_videobuf_release() local 558 free_buffer(vq, buf, pcdev->vb_mode); omap1_videobuf_release() 561 static void videobuf_done(struct omap1_cam_dev *pcdev, videobuf_done() argument 564 struct omap1_cam_buf *buf = pcdev->active; videobuf_done() 566 struct device *dev = pcdev->soc_host.icd->parent; videobuf_done() 569 suspend_capture(pcdev); videobuf_done() 570 disable_capture(pcdev); videobuf_done() 575 suspend_capture(pcdev); videobuf_done() 579 if (!pcdev->ready && result != VIDEOBUF_ERROR) { videobuf_done() 591 suspend_capture(pcdev); videobuf_done() 600 buf = pcdev->ready; videobuf_done() 601 pcdev->active = buf; videobuf_done() 602 pcdev->ready = NULL; videobuf_done() 611 prepare_next_vb(pcdev); videobuf_done() 613 buf = pcdev->ready; videobuf_done() 614 pcdev->active = buf; videobuf_done() 615 pcdev->ready = NULL; videobuf_done() 617 } else if (pcdev->ready) { videobuf_done() 621 * pcdev->ready buffer. We can either accept this fact videobuf_done() 627 pcdev->active = pcdev->ready; videobuf_done() 629 if (pcdev->vb_mode == OMAP1_CAM_DMA_SG) { videobuf_done() 632 * are putting back into the pcdev->ready is marked videobuf_done() 637 pcdev->ready = buf; videobuf_done() 639 buf = pcdev->active; videobuf_done() 645 if (pcdev->vb_mode == OMAP1_CAM_DMA_CONTIG) { videobuf_done() 663 suspend_capture(pcdev); videobuf_done() 671 disable_capture(pcdev); videobuf_done() 675 if (pcdev->vb_mode == OMAP1_CAM_DMA_CONTIG) { videobuf_done() 695 try_next_sgbuf(pcdev->dma_ch, buf); videobuf_done() 701 start_capture(pcdev); videobuf_done() 714 prepare_next_vb(pcdev); videobuf_done() 719 struct omap1_cam_dev *pcdev = data; dma_isr() local 720 struct omap1_cam_buf *buf = pcdev->active; dma_isr() 723 spin_lock_irqsave(&pcdev->lock, flags); dma_isr() 726 suspend_capture(pcdev); dma_isr() 727 disable_capture(pcdev); dma_isr() 731 if (pcdev->vb_mode == OMAP1_CAM_DMA_CONTIG) { dma_isr() 739 CAM_WRITE(pcdev, MODE, dma_isr() 740 CAM_READ_CACHE(pcdev, MODE) & ~EN_V_DOWN); dma_isr() 741 videobuf_done(pcdev, VIDEOBUF_DONE); dma_isr() 754 try_next_sgbuf(pcdev->dma_ch, buf); dma_isr() 773 buf = prepare_next_vb(pcdev); dma_isr() 777 try_next_sgbuf(pcdev->dma_ch, buf); dma_isr() 782 videobuf_done(pcdev, buf->result); dma_isr() 786 spin_unlock_irqrestore(&pcdev->lock, flags); dma_isr() 791 struct omap1_cam_dev *pcdev = data; cam_isr() local 792 struct device *dev = pcdev->soc_host.icd->parent; cam_isr() 793 struct omap1_cam_buf *buf = pcdev->active; cam_isr() 797 it_status = CAM_READ(pcdev, IT_STATUS); cam_isr() 801 spin_lock_irqsave(&pcdev->lock, flags); cam_isr() 806 suspend_capture(pcdev); cam_isr() 807 disable_capture(pcdev); cam_isr() 816 if (pcdev->vb_mode == OMAP1_CAM_DMA_CONTIG) { cam_isr() 841 if (pcdev->vb_mode == OMAP1_CAM_DMA_CONTIG) { cam_isr() 846 mode = CAM_READ_CACHE(pcdev, MODE); cam_isr() 853 mode = CAM_READ_CACHE(pcdev, MODE) & ~EN_V_UP; cam_isr() 860 CAM_WRITE(pcdev, MODE, mode); cam_isr() 869 videobuf_done(pcdev, VIDEOBUF_ERROR); cam_isr() 871 spin_unlock_irqrestore(&pcdev->lock, flags); cam_isr() 887 static void sensor_reset(struct omap1_cam_dev *pcdev, bool reset) sensor_reset() argument 890 if (pcdev->pflags & OMAP1_CAMERA_RST_HIGH) sensor_reset() 891 CAM_WRITE(pcdev, GPIO, reset); sensor_reset() 892 else if (pcdev->pflags & OMAP1_CAMERA_RST_LOW) sensor_reset() 893 CAM_WRITE(pcdev, GPIO, !reset); sensor_reset() 916 struct omap1_cam_dev *pcdev = ici->priv; omap1_cam_clock_start() local 919 clk_enable(pcdev->clk); omap1_cam_clock_start() 922 ctrlclock = CAM_READ(pcdev, CTRLCLOCK); omap1_cam_clock_start() 924 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock); omap1_cam_clock_start() 927 switch (pcdev->camexclk) { omap1_cam_clock_start() 945 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock & ~DPLL_EN); omap1_cam_clock_start() 949 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock); omap1_cam_clock_start() 951 sensor_reset(pcdev, false); omap1_cam_clock_start() 958 struct omap1_cam_dev *pcdev = ici->priv; omap1_cam_clock_stop() local 961 suspend_capture(pcdev); omap1_cam_clock_stop() 962 disable_capture(pcdev); omap1_cam_clock_stop() 964 sensor_reset(pcdev, true); omap1_cam_clock_stop() 967 ctrlclock = CAM_READ_CACHE(pcdev, CTRLCLOCK); omap1_cam_clock_stop() 969 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock); omap1_cam_clock_stop() 972 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock); omap1_cam_clock_stop() 973 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock | MCLK_EN); omap1_cam_clock_stop() 975 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock & ~MCLK_EN); omap1_cam_clock_stop() 977 clk_disable(pcdev->clk); omap1_cam_clock_stop() 1160 #define subdev_call_with_sense(pcdev, dev, icd, sd, op, function, args...) \ 1163 .master_clock = pcdev->camexclk, \ 1168 if (pcdev->pdata) \ 1169 sense.pixel_clock_max = pcdev->pdata->lclk_khz_max * 1000; \ 1185 static int set_format(struct omap1_cam_dev *pcdev, struct device *dev, set_format() argument 1192 int ret = subdev_call_with_sense(pcdev, dev, icd, sd, pad, set_fmt, NULL, format); set_format() 1211 if (!is_dma_aligned(bytes_per_line, mf->height, pcdev->vb_mode)) { set_format() 1227 struct omap1_cam_dev *pcdev = ici->priv; omap1_cam_set_crop() local 1234 ret = subdev_call_with_sense(pcdev, dev, icd, sd, video, s_crop, crop); omap1_cam_set_crop() 1247 ret = dma_align(&mf->width, &mf->height, xlate->host_fmt, pcdev->vb_mode, omap1_cam_set_crop() 1258 ret = set_format(pcdev, dev, icd, sd, &fmt, xlate); omap1_cam_set_crop() 1278 struct omap1_cam_dev *pcdev = ici->priv; omap1_cam_set_fmt() local 1299 ret = dma_align(&mf->width, &mf->height, xlate->host_fmt, pcdev->vb_mode, omap1_cam_set_fmt() 1308 ret = set_format(pcdev, dev, icd, sd, &format, xlate); omap1_cam_set_fmt() 1376 struct omap1_cam_dev *pcdev = ici->priv; omap1_cam_mmap_mapper() local 1379 ret = pcdev->mmap_mapper(q, buf, vma); omap1_cam_mmap_mapper() 1391 struct omap1_cam_dev *pcdev = ici->priv; omap1_cam_init_videobuf() local 1395 icd->parent, &pcdev->lock, omap1_cam_init_videobuf() 1400 icd->parent, &pcdev->lock, omap1_cam_init_videobuf() 1405 pcdev->vb_mode = sg_mode ? OMAP1_CAM_DMA_SG : OMAP1_CAM_DMA_CONTIG; omap1_cam_init_videobuf() 1413 pcdev->mmap_mapper = q->int_ops->mmap_mapper; omap1_cam_init_videobuf() 1455 struct omap1_cam_dev *pcdev = ici->priv; omap1_cam_set_bus_param() local 1482 if (!pcdev->pdata || omap1_cam_set_bus_param() 1483 pcdev->pdata->flags & OMAP1_CAMERA_LCLK_RISING) omap1_cam_set_bus_param() 1497 ctrlclock = CAM_READ_CACHE(pcdev, CTRLCLOCK); omap1_cam_set_bus_param() 1499 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock & ~LCLK_EN); omap1_cam_set_bus_param() 1508 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock & ~LCLK_EN); omap1_cam_set_bus_param() 1511 CAM_WRITE(pcdev, CTRLCLOCK, ctrlclock); omap1_cam_set_bus_param() 1517 mode = CAM_READ(pcdev, MODE) & ~(RAZ_FIFO | IRQ_MASK | DMA); omap1_cam_set_bus_param() 1520 CAM_WRITE(pcdev, MODE, mode & ~ORDERCAMD); omap1_cam_set_bus_param() 1523 CAM_WRITE(pcdev, MODE, mode | ORDERCAMD); omap1_cam_set_bus_param() 1565 struct omap1_cam_dev *pcdev; omap1_cam_probe() local 1585 pcdev = kzalloc(sizeof(*pcdev) + resource_size(res), GFP_KERNEL); omap1_cam_probe() 1586 if (!pcdev) { omap1_cam_probe() 1587 dev_err(&pdev->dev, "Could not allocate pcdev\n"); omap1_cam_probe() 1592 pcdev->res = res; omap1_cam_probe() 1593 pcdev->clk = clk; omap1_cam_probe() 1595 pcdev->pdata = pdev->dev.platform_data; omap1_cam_probe() 1596 if (pcdev->pdata) { omap1_cam_probe() 1597 pcdev->pflags = pcdev->pdata->flags; omap1_cam_probe() 1598 pcdev->camexclk = pcdev->pdata->camexclk_khz * 1000; omap1_cam_probe() 1601 switch (pcdev->camexclk) { omap1_cam_probe() 1609 /* pcdev->camexclk != 0 => pcdev->pdata != NULL */ omap1_cam_probe() 1614 pcdev->pdata->camexclk_khz); omap1_cam_probe() 1615 pcdev->camexclk = 0; omap1_cam_probe() 1620 INIT_LIST_HEAD(&pcdev->capture); omap1_cam_probe() 1621 spin_lock_init(&pcdev->lock); omap1_cam_probe() 1636 pcdev->irq = irq; omap1_cam_probe() 1637 pcdev->base = base; omap1_cam_probe() 1639 sensor_reset(pcdev, true); omap1_cam_probe() 1642 dma_isr, (void *)pcdev, &pcdev->dma_ch); omap1_cam_probe() 1648 dev_dbg(&pdev->dev, "got DMA channel %d\n", pcdev->dma_ch); omap1_cam_probe() 1651 omap_set_dma_src_params(pcdev->dma_ch, OMAP_DMA_PORT_TIPB, omap1_cam_probe() 1654 omap_set_dma_dest_burst_mode(pcdev->dma_ch, OMAP_DMA_DATA_BURST_4); omap1_cam_probe() 1656 omap_dma_link_lch(pcdev->dma_ch, pcdev->dma_ch); omap1_cam_probe() 1658 err = request_irq(pcdev->irq, cam_isr, 0, DRIVER_NAME, pcdev); omap1_cam_probe() 1664 pcdev->soc_host.drv_name = DRIVER_NAME; omap1_cam_probe() 1665 pcdev->soc_host.ops = &omap1_host_ops; omap1_cam_probe() 1666 pcdev->soc_host.priv = pcdev; omap1_cam_probe() 1667 pcdev->soc_host.v4l2_dev.dev = &pdev->dev; omap1_cam_probe() 1668 pcdev->soc_host.nr = pdev->id; omap1_cam_probe() 1670 err = soc_camera_host_register(&pcdev->soc_host); omap1_cam_probe() 1679 free_irq(pcdev->irq, pcdev); omap1_cam_probe() 1681 omap_free_dma(pcdev->dma_ch); omap1_cam_probe() 1687 kfree(pcdev); omap1_cam_probe() 1697 struct omap1_cam_dev *pcdev = container_of(soc_host, omap1_cam_remove() local 1701 free_irq(pcdev->irq, pcdev); omap1_cam_remove() 1703 omap_free_dma(pcdev->dma_ch); omap1_cam_remove() 1707 iounmap(pcdev->base); omap1_cam_remove() 1709 res = pcdev->res; omap1_cam_remove() 1712 clk_put(pcdev->clk); omap1_cam_remove() 1714 kfree(pcdev); omap1_cam_remove()
|
H A D | pxa_camera.c | 315 * @pcdev: pxa camera device 329 static int pxa_init_dma_channel(struct pxa_camera_dev *pcdev, pxa_init_dma_channel() argument 336 struct device *dev = pcdev->soc_host.v4l2_dev.dev; pxa_init_dma_channel() 369 pxa_dma->sg_cpu[i].dsadr = pcdev->res->start + cibr; pxa_init_dma_channel() 410 static void pxa_videobuf_set_actdma(struct pxa_camera_dev *pcdev, pxa_videobuf_set_actdma() argument 414 if (pcdev->channels == 3) pxa_videobuf_set_actdma() 429 struct pxa_camera_dev *pcdev = ici->priv; pxa_videobuf_prepare() local 430 struct device *dev = pcdev->soc_host.v4l2_dev.dev; pxa_videobuf_prepare() 484 if (pcdev->channels == 3) { pxa_videobuf_prepare() 494 ret = pxa_init_dma_channel(pcdev, buf, dma, 0, CIBR0, size_y, pxa_videobuf_prepare() 503 ret = pxa_init_dma_channel(pcdev, buf, dma, 1, CIBR1, pxa_videobuf_prepare() 512 ret = pxa_init_dma_channel(pcdev, buf, dma, 2, CIBR2, pxa_videobuf_prepare() 523 pxa_videobuf_set_actdma(pcdev, buf); pxa_videobuf_prepare() 542 * @pcdev: pxa camera device 547 static void pxa_dma_start_channels(struct pxa_camera_dev *pcdev) pxa_dma_start_channels() argument 552 active = pcdev->active; pxa_dma_start_channels() 554 for (i = 0; i < pcdev->channels; i++) { pxa_dma_start_channels() 555 dev_dbg(pcdev->soc_host.v4l2_dev.dev, pxa_dma_start_channels() 558 DDADR(pcdev->dma_chans[i]) = active->dmas[i].sg_dma; pxa_dma_start_channels() 559 DCSR(pcdev->dma_chans[i]) = DCSR_RUN; pxa_dma_start_channels() 563 static void pxa_dma_stop_channels(struct pxa_camera_dev *pcdev) pxa_dma_stop_channels() argument 567 for (i = 0; i < pcdev->channels; i++) { pxa_dma_stop_channels() 568 dev_dbg(pcdev->soc_host.v4l2_dev.dev, pxa_dma_stop_channels() 570 DCSR(pcdev->dma_chans[i]) = 0; pxa_dma_stop_channels() 574 static void pxa_dma_add_tail_buf(struct pxa_camera_dev *pcdev, pxa_dma_add_tail_buf() argument 580 for (i = 0; i < pcdev->channels; i++) { pxa_dma_add_tail_buf() 584 if (pcdev->sg_tail[i]) pxa_dma_add_tail_buf() 586 pcdev->sg_tail[i]->ddadr = buf->dmas[i].sg_dma; pxa_dma_add_tail_buf() 589 pcdev->sg_tail[i] = buf_last_desc; pxa_dma_add_tail_buf() 595 * @pcdev: camera device 601 static void pxa_camera_start_capture(struct pxa_camera_dev *pcdev) pxa_camera_start_capture() argument 605 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s\n", __func__); pxa_camera_start_capture() 607 cicr0 = __raw_readl(pcdev->base + CICR0) | CICR0_ENB; pxa_camera_start_capture() 609 __raw_writel(cicr0, pcdev->base + CICR0); pxa_camera_start_capture() 612 static void pxa_camera_stop_capture(struct pxa_camera_dev *pcdev) pxa_camera_stop_capture() argument 616 pxa_dma_stop_channels(pcdev); pxa_camera_stop_capture() 618 cicr0 = __raw_readl(pcdev->base + CICR0) & ~CICR0_ENB; pxa_camera_stop_capture() 619 __raw_writel(cicr0, pcdev->base + CICR0); pxa_camera_stop_capture() 621 pcdev->active = NULL; pxa_camera_stop_capture() 622 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s\n", __func__); pxa_camera_stop_capture() 625 /* Called under spinlock_irqsave(&pcdev->lock, ...) */ pxa_videobuf_queue() 631 struct pxa_camera_dev *pcdev = ici->priv; pxa_videobuf_queue() local 635 __func__, vb, vb->baddr, vb->bsize, pcdev->active); pxa_videobuf_queue() 637 list_add_tail(&vb->queue, &pcdev->capture); pxa_videobuf_queue() 640 pxa_dma_add_tail_buf(pcdev, buf); pxa_videobuf_queue() 642 if (!pcdev->active) pxa_videobuf_queue() 643 pxa_camera_start_capture(pcdev); pxa_videobuf_queue() 676 static void pxa_camera_wakeup(struct pxa_camera_dev *pcdev, pxa_camera_wakeup() argument 688 dev_dbg(pcdev->soc_host.v4l2_dev.dev, "%s dequeud buffer (vb=0x%p)\n", pxa_camera_wakeup() 691 if (list_empty(&pcdev->capture)) { pxa_camera_wakeup() 692 pxa_camera_stop_capture(pcdev); pxa_camera_wakeup() 693 for (i = 0; i < pcdev->channels; i++) pxa_camera_wakeup() 694 pcdev->sg_tail[i] = NULL; pxa_camera_wakeup() 698 pcdev->active = list_entry(pcdev->capture.next, pxa_camera_wakeup() 704 * @pcdev: camera device 711 * - a videobuffer is queued on the pcdev->capture list 718 static void pxa_camera_check_link_miss(struct pxa_camera_dev *pcdev) pxa_camera_check_link_miss() argument 722 for (i = 0; i < pcdev->channels; i++) pxa_camera_check_link_miss() 723 if (DDADR(pcdev->dma_chans[i]) != DDADR_STOP) pxa_camera_check_link_miss() 725 dev_dbg(pcdev->soc_host.v4l2_dev.dev, pxa_camera_check_link_miss() 727 __func__, pcdev->active, is_dma_stopped); pxa_camera_check_link_miss() 728 if (pcdev->active && is_dma_stopped) pxa_camera_check_link_miss() 729 pxa_camera_start_capture(pcdev); pxa_camera_check_link_miss() 732 static void pxa_camera_dma_irq(int channel, struct pxa_camera_dev *pcdev, pxa_camera_dma_irq() argument 735 struct device *dev = pcdev->soc_host.v4l2_dev.dev; pxa_camera_dma_irq() 741 spin_lock_irqsave(&pcdev->lock, flags); pxa_camera_dma_irq() 746 camera_status = __raw_readl(pcdev->base + CISR); pxa_camera_dma_irq() 748 if (pcdev->channels == 3) pxa_camera_dma_irq() 763 * pcdev->active should not be NULL in DMA irq handler. pxa_camera_dma_irq() 769 * capture and restart it (and thus set pcdev->active to NULL). But the pxa_camera_dma_irq() 774 if (!pcdev->active) pxa_camera_dma_irq() 777 vb = &pcdev->active->vb; pxa_camera_dma_irq() 791 !list_is_last(pcdev->capture.next, &pcdev->capture)) { pxa_camera_dma_irq() 794 pxa_camera_stop_capture(pcdev); pxa_camera_dma_irq() 795 pxa_camera_start_capture(pcdev); pxa_camera_dma_irq() 800 pxa_camera_wakeup(pcdev, vb, buf); pxa_camera_dma_irq() 801 pxa_camera_check_link_miss(pcdev); pxa_camera_dma_irq() 806 spin_unlock_irqrestore(&pcdev->lock, flags); pxa_camera_dma_irq() 811 struct pxa_camera_dev *pcdev = data; pxa_camera_dma_irq_y() local 812 pxa_camera_dma_irq(channel, pcdev, DMA_Y); pxa_camera_dma_irq_y() 817 struct pxa_camera_dev *pcdev = data; pxa_camera_dma_irq_u() local 818 pxa_camera_dma_irq(channel, pcdev, DMA_U); pxa_camera_dma_irq_u() 823 struct pxa_camera_dev *pcdev = data; pxa_camera_dma_irq_v() local 824 pxa_camera_dma_irq(channel, pcdev, DMA_V); pxa_camera_dma_irq_v() 838 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_init_videobuf() local 844 videobuf_queue_sg_init(q, &pxa_videobuf_ops, NULL, &pcdev->lock, pxa_camera_init_videobuf() 850 struct pxa_camera_dev *pcdev) mclk_get_divisor() 852 unsigned long mclk = pcdev->mclk; mclk_get_divisor() 857 lcdclk = clk_get_rate(pcdev->clk); mclk_get_divisor() 858 pcdev->ciclk = lcdclk; mclk_get_divisor() 870 if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) mclk_get_divisor() 871 pcdev->mclk = lcdclk / (2 * (div + 1)); mclk_get_divisor() 879 static void recalculate_fifo_timeout(struct pxa_camera_dev *pcdev, recalculate_fifo_timeout() argument 883 u32 ciclk_per_pixel = pcdev->ciclk / pclk + 1; recalculate_fifo_timeout() 885 __raw_writel(ciclk_per_pixel, pcdev->base + CITOR); recalculate_fifo_timeout() 888 static void pxa_camera_activate(struct pxa_camera_dev *pcdev) pxa_camera_activate() argument 893 __raw_writel(0x3ff, pcdev->base + CICR0); pxa_camera_activate() 895 if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) pxa_camera_activate() 897 if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) pxa_camera_activate() 899 if (pcdev->platform_flags & PXA_CAMERA_PCP) pxa_camera_activate() 901 if (pcdev->platform_flags & PXA_CAMERA_HSP) pxa_camera_activate() 903 if (pcdev->platform_flags & PXA_CAMERA_VSP) pxa_camera_activate() 906 __raw_writel(pcdev->mclk_divisor | cicr4, pcdev->base + CICR4); pxa_camera_activate() 908 if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) pxa_camera_activate() 910 recalculate_fifo_timeout(pcdev, pcdev->mclk); pxa_camera_activate() 913 recalculate_fifo_timeout(pcdev, 13000000); pxa_camera_activate() 915 clk_prepare_enable(pcdev->clk); pxa_camera_activate() 918 static void pxa_camera_deactivate(struct pxa_camera_dev *pcdev) pxa_camera_deactivate() argument 920 clk_disable_unprepare(pcdev->clk); pxa_camera_deactivate() 925 struct pxa_camera_dev *pcdev = data; pxa_camera_irq() local 930 status = __raw_readl(pcdev->base + CISR); pxa_camera_irq() 931 dev_dbg(pcdev->soc_host.v4l2_dev.dev, pxa_camera_irq() 937 __raw_writel(status, pcdev->base + CISR); pxa_camera_irq() 941 cifr = __raw_readl(pcdev->base + CIFR) | CIFR_RESET_F; pxa_camera_irq() 942 __raw_writel(cifr, pcdev->base + CIFR); pxa_camera_irq() 944 pcdev->active = list_first_entry(&pcdev->capture, pxa_camera_irq() 946 vb = &pcdev->active->vb; pxa_camera_irq() 948 pxa_videobuf_set_actdma(pcdev, buf); pxa_camera_irq() 950 pxa_dma_start_channels(pcdev); pxa_camera_irq() 952 cicr0 = __raw_readl(pcdev->base + CICR0) | CICR0_EOFM; pxa_camera_irq() 953 __raw_writel(cicr0, pcdev->base + CICR0); pxa_camera_irq() 980 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_clock_start() local 982 pxa_camera_activate(pcdev); pxa_camera_clock_start() 990 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_clock_stop() local 993 __raw_writel(0x3ff, pcdev->base + CICR0); pxa_camera_clock_stop() 996 DCSR(pcdev->dma_chans[0]) = 0; pxa_camera_clock_stop() 997 DCSR(pcdev->dma_chans[1]) = 0; pxa_camera_clock_stop() 998 DCSR(pcdev->dma_chans[2]) = 0; pxa_camera_clock_stop() 1000 pxa_camera_deactivate(pcdev); pxa_camera_clock_stop() 1003 static int test_platform_param(struct pxa_camera_dev *pcdev, test_platform_param() argument 1011 *flags = (pcdev->platform_flags & PXA_CAMERA_MASTER ? test_platform_param() 1022 if ((1 << (buswidth - 1)) & pcdev->width_flags) test_platform_param() 1032 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_setup_cicr() local 1064 if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) pxa_camera_setup_cicr() 1066 if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) pxa_camera_setup_cicr() 1075 cicr0 = __raw_readl(pcdev->base + CICR0); pxa_camera_setup_cicr() 1077 __raw_writel(cicr0 & ~CICR0_ENB, pcdev->base + CICR0); pxa_camera_setup_cicr() 1083 pcdev->channels = 3; pxa_camera_setup_cicr() 1110 cicr4 |= pcdev->mclk_divisor; pxa_camera_setup_cicr() 1112 __raw_writel(cicr1, pcdev->base + CICR1); pxa_camera_setup_cicr() 1113 __raw_writel(cicr2, pcdev->base + CICR2); pxa_camera_setup_cicr() 1114 __raw_writel(cicr3, pcdev->base + CICR3); pxa_camera_setup_cicr() 1115 __raw_writel(cicr4, pcdev->base + CICR4); pxa_camera_setup_cicr() 1118 cicr0 = (cicr0 & CICR0_ENB) | (pcdev->platform_flags & PXA_CAMERA_MASTER ? pxa_camera_setup_cicr() 1121 __raw_writel(cicr0, pcdev->base + CICR0); pxa_camera_setup_cicr() 1128 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_set_bus_param() local 1135 ret = test_platform_param(pcdev, icd->current_fmt->host_fmt->bits_per_sample, pxa_camera_set_bus_param() 1156 pcdev->channels = 1; pxa_camera_set_bus_param() 1161 if (pcdev->platform_flags & PXA_CAMERA_HSP) pxa_camera_set_bus_param() 1169 if (pcdev->platform_flags & PXA_CAMERA_VSP) pxa_camera_set_bus_param() 1177 if (pcdev->platform_flags & PXA_CAMERA_PCP) pxa_camera_set_bus_param() 1203 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_try_bus_param() local 1206 int ret = test_platform_param(pcdev, buswidth, &bus_flags); pxa_camera_try_bus_param() 1346 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_set_crop() local 1349 .master_clock = pcdev->mclk, pxa_camera_set_crop() 1350 .pixel_clock_max = pcdev->ciclk / 4, pxa_camera_set_crop() 1361 if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) pxa_camera_set_crop() 1404 recalculate_fifo_timeout(pcdev, sense.pixel_clock); pxa_camera_set_crop() 1420 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_set_fmt() local 1424 .master_clock = pcdev->mclk, pxa_camera_set_fmt() 1425 .pixel_clock_max = pcdev->ciclk / 4, pxa_camera_set_fmt() 1441 if (pcdev->platform_flags & PXA_CAMERA_PCLK_EN) pxa_camera_set_fmt() 1473 recalculate_fifo_timeout(pcdev, sense.pixel_clock); pxa_camera_set_fmt() 1601 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_suspend() local 1604 pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR0); pxa_camera_suspend() 1605 pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR1); pxa_camera_suspend() 1606 pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR2); pxa_camera_suspend() 1607 pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR3); pxa_camera_suspend() 1608 pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR4); pxa_camera_suspend() 1610 if (pcdev->soc_host.icd) { pxa_camera_suspend() 1611 struct v4l2_subdev *sd = soc_camera_to_subdev(pcdev->soc_host.icd); pxa_camera_suspend() 1623 struct pxa_camera_dev *pcdev = ici->priv; pxa_camera_resume() local 1626 DRCMR(68) = pcdev->dma_chans[0] | DRCMR_MAPVLD; pxa_camera_resume() 1627 DRCMR(69) = pcdev->dma_chans[1] | DRCMR_MAPVLD; pxa_camera_resume() 1628 DRCMR(70) = pcdev->dma_chans[2] | DRCMR_MAPVLD; pxa_camera_resume() 1630 __raw_writel(pcdev->save_cicr[i++] & ~CICR0_ENB, pcdev->base + CICR0); pxa_camera_resume() 1631 __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR1); pxa_camera_resume() 1632 __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR2); pxa_camera_resume() 1633 __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR3); pxa_camera_resume() 1634 __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR4); pxa_camera_resume() 1636 if (pcdev->soc_host.icd) { pxa_camera_resume() 1637 struct v4l2_subdev *sd = soc_camera_to_subdev(pcdev->soc_host.icd); pxa_camera_resume() 1644 if (!ret && pcdev->active) pxa_camera_resume() 1645 pxa_camera_start_capture(pcdev); pxa_camera_resume() 1669 struct pxa_camera_dev *pcdev) pxa_camera_pdata_from_dt() 1677 pcdev->platform_flags |= PXA_CAMERA_MCLK_EN; pxa_camera_pdata_from_dt() 1678 pcdev->mclk = mclk_rate; pxa_camera_pdata_from_dt() 1695 pcdev->platform_flags |= PXA_CAMERA_DATAWIDTH_4; pxa_camera_pdata_from_dt() 1698 pcdev->platform_flags |= PXA_CAMERA_DATAWIDTH_5; pxa_camera_pdata_from_dt() 1701 pcdev->platform_flags |= PXA_CAMERA_DATAWIDTH_8; pxa_camera_pdata_from_dt() 1704 pcdev->platform_flags |= PXA_CAMERA_DATAWIDTH_9; pxa_camera_pdata_from_dt() 1707 pcdev->platform_flags |= PXA_CAMERA_DATAWIDTH_10; pxa_camera_pdata_from_dt() 1714 pcdev->platform_flags |= PXA_CAMERA_MASTER; pxa_camera_pdata_from_dt() 1716 pcdev->platform_flags |= PXA_CAMERA_HSP; pxa_camera_pdata_from_dt() 1718 pcdev->platform_flags |= PXA_CAMERA_VSP; pxa_camera_pdata_from_dt() 1720 pcdev->platform_flags |= PXA_CAMERA_PCLK_EN | PXA_CAMERA_PCP; pxa_camera_pdata_from_dt() 1722 pcdev->platform_flags |= PXA_CAMERA_PCLK_EN; pxa_camera_pdata_from_dt() 1732 struct pxa_camera_dev *pcdev; pxa_camera_probe() local 1743 pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); pxa_camera_probe() 1744 if (!pcdev) { pxa_camera_probe() 1745 dev_err(&pdev->dev, "Could not allocate pcdev\n"); pxa_camera_probe() 1749 pcdev->clk = devm_clk_get(&pdev->dev, NULL); pxa_camera_probe() 1750 if (IS_ERR(pcdev->clk)) pxa_camera_probe() 1751 return PTR_ERR(pcdev->clk); pxa_camera_probe() 1753 pcdev->res = res; pxa_camera_probe() 1755 pcdev->pdata = pdev->dev.platform_data; pxa_camera_probe() 1756 if (&pdev->dev.of_node && !pcdev->pdata) { pxa_camera_probe() 1757 err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev); pxa_camera_probe() 1759 pcdev->platform_flags = pcdev->pdata->flags; pxa_camera_probe() 1760 pcdev->mclk = pcdev->pdata->mclk_10khz * 10000; pxa_camera_probe() 1765 if (!(pcdev->platform_flags & (PXA_CAMERA_DATAWIDTH_8 | pxa_camera_probe() 1773 pcdev->platform_flags |= PXA_CAMERA_DATAWIDTH_10; pxa_camera_probe() 1775 if (pcdev->platform_flags & PXA_CAMERA_DATAWIDTH_8) pxa_camera_probe() 1776 pcdev->width_flags = 1 << 7; pxa_camera_probe() 1777 if (pcdev->platform_flags & PXA_CAMERA_DATAWIDTH_9) pxa_camera_probe() 1778 pcdev->width_flags |= 1 << 8; pxa_camera_probe() 1779 if (pcdev->platform_flags & PXA_CAMERA_DATAWIDTH_10) pxa_camera_probe() 1780 pcdev->width_flags |= 1 << 9; pxa_camera_probe() 1781 if (!pcdev->mclk) { pxa_camera_probe() 1785 pcdev->mclk = 20000000; pxa_camera_probe() 1788 pcdev->mclk_divisor = mclk_get_divisor(pdev, pcdev); pxa_camera_probe() 1790 INIT_LIST_HEAD(&pcdev->capture); pxa_camera_probe() 1791 spin_lock_init(&pcdev->lock); pxa_camera_probe() 1800 pcdev->irq = irq; pxa_camera_probe() 1801 pcdev->base = base; pxa_camera_probe() 1805 pxa_camera_dma_irq_y, pcdev); pxa_camera_probe() 1810 pcdev->dma_chans[0] = err; pxa_camera_probe() 1811 dev_dbg(&pdev->dev, "got DMA channel %d\n", pcdev->dma_chans[0]); pxa_camera_probe() 1814 pxa_camera_dma_irq_u, pcdev); pxa_camera_probe() 1819 pcdev->dma_chans[1] = err; pxa_camera_probe() 1820 dev_dbg(&pdev->dev, "got DMA channel (U) %d\n", pcdev->dma_chans[1]); pxa_camera_probe() 1823 pxa_camera_dma_irq_v, pcdev); pxa_camera_probe() 1828 pcdev->dma_chans[2] = err; pxa_camera_probe() 1829 dev_dbg(&pdev->dev, "got DMA channel (V) %d\n", pcdev->dma_chans[2]); pxa_camera_probe() 1831 DRCMR(68) = pcdev->dma_chans[0] | DRCMR_MAPVLD; pxa_camera_probe() 1832 DRCMR(69) = pcdev->dma_chans[1] | DRCMR_MAPVLD; pxa_camera_probe() 1833 DRCMR(70) = pcdev->dma_chans[2] | DRCMR_MAPVLD; pxa_camera_probe() 1836 err = devm_request_irq(&pdev->dev, pcdev->irq, pxa_camera_irq, 0, pxa_camera_probe() 1837 PXA_CAM_DRV_NAME, pcdev); pxa_camera_probe() 1843 pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; pxa_camera_probe() 1844 pcdev->soc_host.ops = &pxa_soc_camera_host_ops; pxa_camera_probe() 1845 pcdev->soc_host.priv = pcdev; pxa_camera_probe() 1846 pcdev->soc_host.v4l2_dev.dev = &pdev->dev; pxa_camera_probe() 1847 pcdev->soc_host.nr = pdev->id; pxa_camera_probe() 1849 err = soc_camera_host_register(&pcdev->soc_host); pxa_camera_probe() 1856 pxa_free_dma(pcdev->dma_chans[2]); pxa_camera_probe() 1858 pxa_free_dma(pcdev->dma_chans[1]); pxa_camera_probe() 1860 pxa_free_dma(pcdev->dma_chans[0]); pxa_camera_probe() 1867 struct pxa_camera_dev *pcdev = container_of(soc_host, pxa_camera_remove() local 1870 pxa_free_dma(pcdev->dma_chans[0]); pxa_camera_remove() 1871 pxa_free_dma(pcdev->dma_chans[1]); pxa_camera_remove() 1872 pxa_free_dma(pcdev->dma_chans[2]); pxa_camera_remove() 849 mclk_get_divisor(struct platform_device *pdev, struct pxa_camera_dev *pcdev) mclk_get_divisor() argument 1668 pxa_camera_pdata_from_dt(struct device *dev, struct pxa_camera_dev *pcdev) pxa_camera_pdata_from_dt() argument
|
H A D | sh_mobile_ceu_camera.c | 171 static int sh_mobile_ceu_soft_reset(struct sh_mobile_ceu_dev *pcdev) sh_mobile_ceu_soft_reset() argument 175 ceu_write(pcdev, CAPSR, 1 << 16); /* reset */ sh_mobile_ceu_soft_reset() 179 if (!(ceu_read(pcdev, CSTSR) & 1)) { sh_mobile_ceu_soft_reset() 188 if (!(ceu_read(pcdev, CAPSR) & (1 << 16))) { sh_mobile_ceu_soft_reset() 196 dev_warn(pcdev->ici.v4l2_dev.dev, "soft reset time out\n"); sh_mobile_ceu_soft_reset() 221 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_videobuf_setup() local 250 alloc_ctxs[0] = pcdev->alloc_ctx; sh_mobile_ceu_videobuf_setup() 253 pcdev->sequence = 0; sh_mobile_ceu_videobuf_setup() 259 if (pcdev->video_limit && !*num_planes) { sh_mobile_ceu_videobuf_setup() 262 if (size + pcdev->buf_total > pcdev->video_limit) sh_mobile_ceu_videobuf_setup() 263 *count = (pcdev->video_limit - pcdev->buf_total) / sh_mobile_ceu_videobuf_setup() 286 static int sh_mobile_ceu_capture(struct sh_mobile_ceu_dev *pcdev) sh_mobile_ceu_capture() argument 288 struct soc_camera_device *icd = pcdev->ici.icd; sh_mobile_ceu_capture() 301 ceu_write(pcdev, CEIER, ceu_read(pcdev, CEIER) & ~CEU_CEIER_MASK); sh_mobile_ceu_capture() 302 status = ceu_read(pcdev, CETCR); sh_mobile_ceu_capture() 303 ceu_write(pcdev, CETCR, ~status & CEU_CETCR_MAGIC); sh_mobile_ceu_capture() 304 if (!pcdev->frozen) sh_mobile_ceu_capture() 305 ceu_write(pcdev, CEIER, ceu_read(pcdev, CEIER) | CEU_CEIER_MASK); sh_mobile_ceu_capture() 306 ceu_write(pcdev, CAPCR, ceu_read(pcdev, CAPCR) & ~CEU_CAPCR_CTNCP); sh_mobile_ceu_capture() 307 ceu_write(pcdev, CETCR, CEU_CETCR_MAGIC ^ CEU_CETCR_IGRW); sh_mobile_ceu_capture() 315 sh_mobile_ceu_soft_reset(pcdev); sh_mobile_ceu_capture() 319 if (pcdev->frozen) { sh_mobile_ceu_capture() 320 complete(&pcdev->complete); sh_mobile_ceu_capture() 324 if (!pcdev->active) sh_mobile_ceu_capture() 327 if (V4L2_FIELD_INTERLACED_BT == pcdev->field) { sh_mobile_ceu_capture() 340 vb2_dma_contig_plane_dma_addr(&pcdev->active->vb2_buf, 0); sh_mobile_ceu_capture() 353 ceu_write(pcdev, top1, phys_addr_top); sh_mobile_ceu_capture() 354 if (V4L2_FIELD_NONE != pcdev->field) { sh_mobile_ceu_capture() 356 ceu_write(pcdev, bottom1, phys_addr_bottom); sh_mobile_ceu_capture() 361 ceu_write(pcdev, top2, phys_addr_top); sh_mobile_ceu_capture() 362 if (V4L2_FIELD_NONE != pcdev->field) { sh_mobile_ceu_capture() 364 ceu_write(pcdev, bottom2, phys_addr_bottom); sh_mobile_ceu_capture() 368 ceu_write(pcdev, CAPSR, 0x1); /* start capture */ sh_mobile_ceu_capture() 390 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_videobuf_queue() local 416 spin_lock_irq(&pcdev->lock); sh_mobile_ceu_videobuf_queue() 417 list_add_tail(&buf->queue, &pcdev->capture); sh_mobile_ceu_videobuf_queue() 419 if (!pcdev->active) { sh_mobile_ceu_videobuf_queue() 425 pcdev->active = vbuf; sh_mobile_ceu_videobuf_queue() 426 sh_mobile_ceu_capture(pcdev); sh_mobile_ceu_videobuf_queue() 428 spin_unlock_irq(&pcdev->lock); sh_mobile_ceu_videobuf_queue() 443 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_videobuf_release() local 445 spin_lock_irq(&pcdev->lock); sh_mobile_ceu_videobuf_release() 447 if (pcdev->active == vbuf) { sh_mobile_ceu_videobuf_release() 449 ceu_write(pcdev, CAPSR, 1 << 16); sh_mobile_ceu_videobuf_release() 450 pcdev->active = NULL; sh_mobile_ceu_videobuf_release() 460 pcdev->buf_total -= PAGE_ALIGN(vb2_plane_size(vb, 0)); sh_mobile_ceu_videobuf_release() 462 pcdev->buf_total); sh_mobile_ceu_videobuf_release() 464 spin_unlock_irq(&pcdev->lock); sh_mobile_ceu_videobuf_release() 473 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_videobuf_init() local 475 pcdev->buf_total += PAGE_ALIGN(vb2_plane_size(vb, 0)); sh_mobile_ceu_videobuf_init() 477 pcdev->buf_total); sh_mobile_ceu_videobuf_init() 488 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_stop_streaming() local 491 spin_lock_irq(&pcdev->lock); sh_mobile_ceu_stop_streaming() 493 pcdev->active = NULL; sh_mobile_ceu_stop_streaming() 495 list_for_each_safe(buf_head, tmp, &pcdev->capture) sh_mobile_ceu_stop_streaming() 498 spin_unlock_irq(&pcdev->lock); sh_mobile_ceu_stop_streaming() 500 sh_mobile_ceu_soft_reset(pcdev); sh_mobile_ceu_stop_streaming() 516 struct sh_mobile_ceu_dev *pcdev = data; sh_mobile_ceu_irq() local 520 spin_lock(&pcdev->lock); sh_mobile_ceu_irq() 522 vbuf = pcdev->active; sh_mobile_ceu_irq() 529 if (!list_empty(&pcdev->capture)) sh_mobile_ceu_irq() 530 pcdev->active = &list_entry(pcdev->capture.next, sh_mobile_ceu_irq() 533 pcdev->active = NULL; sh_mobile_ceu_irq() 535 ret = sh_mobile_ceu_capture(pcdev); sh_mobile_ceu_irq() 538 vbuf->field = pcdev->field; sh_mobile_ceu_irq() 539 vbuf->sequence = pcdev->sequence++; sh_mobile_ceu_irq() 545 spin_unlock(&pcdev->lock); sh_mobile_ceu_irq() 550 static struct v4l2_subdev *find_csi2(struct sh_mobile_ceu_dev *pcdev) find_csi2() argument 554 if (pcdev->csi2_sd) find_csi2() 555 return pcdev->csi2_sd; find_csi2() 557 if (pcdev->csi2_asd) { find_csi2() 559 v4l2_device_for_each_subdev(sd, &pcdev->ici.v4l2_dev) find_csi2() 561 pcdev->csi2_sd = sd; find_csi2() 569 static struct v4l2_subdev *csi2_subdev(struct sh_mobile_ceu_dev *pcdev, csi2_subdev() argument 572 struct v4l2_subdev *sd = pcdev->csi2_sd; csi2_subdev() 580 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_add_device() local 581 struct v4l2_subdev *csi2_sd = find_csi2(pcdev); sh_mobile_ceu_add_device() 610 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_remove_device() local 611 struct v4l2_subdev *csi2_sd = find_csi2(pcdev); sh_mobile_ceu_remove_device() 623 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_clock_start() local 627 pcdev->buf_total = 0; sh_mobile_ceu_clock_start() 629 sh_mobile_ceu_soft_reset(pcdev); sh_mobile_ceu_clock_start() 637 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_clock_stop() local 640 ceu_write(pcdev, CEIER, 0); sh_mobile_ceu_clock_stop() 641 sh_mobile_ceu_soft_reset(pcdev); sh_mobile_ceu_clock_stop() 644 spin_lock_irq(&pcdev->lock); sh_mobile_ceu_clock_stop() 645 if (pcdev->active) { sh_mobile_ceu_clock_stop() 646 list_del_init(&to_ceu_vb(pcdev->active)->queue); sh_mobile_ceu_clock_stop() 647 vb2_buffer_done(&pcdev->active->vb2_buf, VB2_BUF_STATE_ERROR); sh_mobile_ceu_clock_stop() 648 pcdev->active = NULL; sh_mobile_ceu_clock_stop() 650 spin_unlock_irq(&pcdev->lock); sh_mobile_ceu_clock_stop() 690 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_set_rect() local 705 if (pcdev->image_mode) { sh_mobile_ceu_set_rect() 707 if (!pcdev->is_16bit) { sh_mobile_ceu_set_rect() 730 if (V4L2_FIELD_NONE != pcdev->field) { sh_mobile_ceu_set_rect() 738 if (csi2_subdev(pcdev, icd)) { sh_mobile_ceu_set_rect() 751 ceu_write(pcdev, CAMOR, camor); sh_mobile_ceu_set_rect() 752 ceu_write(pcdev, CAPWR, (in_height << 16) | in_width); sh_mobile_ceu_set_rect() 754 ceu_write(pcdev, CFSZR, (height << 16) | width); sh_mobile_ceu_set_rect() 755 ceu_write(pcdev, CDWDR, cdwdr_width); sh_mobile_ceu_set_rect() 758 static u32 capture_save_reset(struct sh_mobile_ceu_dev *pcdev) capture_save_reset() argument 760 u32 capsr = ceu_read(pcdev, CAPSR); capture_save_reset() 761 ceu_write(pcdev, CAPSR, 1 << 16); /* reset, stop capture */ capture_save_reset() 765 static void capture_restore(struct sh_mobile_ceu_dev *pcdev, u32 capsr) capture_restore() argument 773 while ((ceu_read(pcdev, CSTSR) & 1) && time_before(jiffies, timeout)) capture_restore() 777 dev_err(pcdev->ici.v4l2_dev.dev, capture_restore() 783 while (ceu_read(pcdev, CAPSR) & (1 << 16)) capture_restore() 788 ceu_write(pcdev, CAPSR, capsr); capture_restore() 792 static struct v4l2_subdev *find_bus_subdev(struct sh_mobile_ceu_dev *pcdev, find_bus_subdev() argument 795 return csi2_subdev(pcdev, icd) ? : soc_camera_to_subdev(icd); find_bus_subdev() 810 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_set_bus_param() local 811 struct v4l2_subdev *sd = find_bus_subdev(pcdev, icd); sh_mobile_ceu_set_bus_param() 815 u32 capsr = capture_save_reset(pcdev); sh_mobile_ceu_set_bus_param() 836 if (pcdev->flags & SH_CEU_FLAG_HSYNC_LOW) sh_mobile_ceu_set_bus_param() 844 if (pcdev->flags & SH_CEU_FLAG_VSYNC_LOW) sh_mobile_ceu_set_bus_param() 856 pcdev->is_16bit = 1; sh_mobile_ceu_set_bus_param() 858 pcdev->is_16bit = 0; sh_mobile_ceu_set_bus_param() 860 ceu_write(pcdev, CRCNTR, 0); sh_mobile_ceu_set_bus_param() 861 ceu_write(pcdev, CRCMPR, 0); sh_mobile_ceu_set_bus_param() 899 if (csi2_subdev(pcdev, icd)) /* CSI2 mode */ sh_mobile_ceu_set_bus_param() 901 else if (pcdev->is_16bit) sh_mobile_ceu_set_bus_param() 903 else if (pcdev->flags & SH_CEU_FLAG_LOWER_8BIT) sh_mobile_ceu_set_bus_param() 906 ceu_write(pcdev, CAMCR, value); sh_mobile_ceu_set_bus_param() 908 ceu_write(pcdev, CAPCR, 0x00300000); sh_mobile_ceu_set_bus_param() 910 switch (pcdev->field) { sh_mobile_ceu_set_bus_param() 921 ceu_write(pcdev, CAIFR, value); sh_mobile_ceu_set_bus_param() 926 dev_geo(icd->parent, "CFLCR 0x%x\n", pcdev->cflcr); sh_mobile_ceu_set_bus_param() 927 ceu_write(pcdev, CFLCR, pcdev->cflcr); sh_mobile_ceu_set_bus_param() 944 ceu_write(pcdev, CDOCR, value); sh_mobile_ceu_set_bus_param() 945 ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */ sh_mobile_ceu_set_bus_param() 947 capture_restore(pcdev, capsr); sh_mobile_ceu_set_bus_param() 957 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_try_bus_param() local 958 struct v4l2_subdev *sd = find_bus_subdev(pcdev, icd); sh_mobile_ceu_try_bus_param() 1030 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_s_ctrl() local 1039 ceu_write(pcdev, CLFCR, !ctrl->val); sh_mobile_ceu_s_ctrl() 1058 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_get_formats() local 1079 if (!csi2_subdev(pcdev, icd)) { sh_mobile_ceu_get_formats() 1119 while ((mf->width > pcdev->max_width || sh_mobile_ceu_get_formats() 1120 mf->height > pcdev->max_height) && shift < 4) { sh_mobile_ceu_get_formats() 1229 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_set_crop() local 1248 capsr = capture_save_reset(pcdev); sh_mobile_ceu_set_crop() 1249 dev_dbg(dev, "CAPSR 0x%x, CFLCR 0x%x\n", capsr, pcdev->cflcr); sh_mobile_ceu_set_crop() 1271 if (mf->width > pcdev->max_width || mf->height > pcdev->max_height) sh_mobile_ceu_set_crop() 1316 if (pcdev->image_mode) { sh_mobile_ceu_set_crop() 1335 if (cflcr != pcdev->cflcr) { sh_mobile_ceu_set_crop() 1336 pcdev->cflcr = cflcr; sh_mobile_ceu_set_crop() 1337 ceu_write(pcdev, CFLCR, cflcr); sh_mobile_ceu_set_crop() 1356 if (pcdev->active) sh_mobile_ceu_set_crop() 1358 capture_restore(pcdev, capsr); sh_mobile_ceu_set_crop() 1381 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_set_fmt() local 1387 unsigned int ceu_sub_width = pcdev->max_width, sh_mobile_ceu_set_fmt() 1388 ceu_sub_height = pcdev->max_height; sh_mobile_ceu_set_fmt() 1479 pcdev->cflcr = scale_h | (scale_v << 16); sh_mobile_ceu_set_fmt() 1493 pcdev->field = field; sh_mobile_ceu_set_fmt() 1494 pcdev->image_mode = image_mode; sh_mobile_ceu_set_fmt() 1509 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_try_fmt() local 1538 v4l_bound_align_image(&pix->width, 2, pcdev->max_width, 2, sh_mobile_ceu_try_fmt() 1539 &pix->height, 4, pcdev->max_height, 2, 0); sh_mobile_ceu_try_fmt() 1574 mf->width = pcdev->max_width; sh_mobile_ceu_try_fmt() 1575 mf->height = pcdev->max_height; sh_mobile_ceu_try_fmt() 1617 struct sh_mobile_ceu_dev *pcdev = ici->priv; sh_mobile_ceu_set_livecrop() local 1622 pcdev->frozen = 1; sh_mobile_ceu_set_livecrop() 1624 ret = wait_for_completion_interruptible(&pcdev->complete); sh_mobile_ceu_set_livecrop() 1643 .field = pcdev->field, sh_mobile_ceu_set_livecrop() 1659 pcdev->frozen = 0; sh_mobile_ceu_set_livecrop() 1660 spin_lock_irq(&pcdev->lock); sh_mobile_ceu_set_livecrop() 1661 sh_mobile_ceu_capture(pcdev); sh_mobile_ceu_set_livecrop() 1662 spin_unlock_irq(&pcdev->lock); sh_mobile_ceu_set_livecrop() 1749 struct sh_mobile_ceu_dev *pcdev; sh_mobile_ceu_probe() local 1767 pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); sh_mobile_ceu_probe() 1768 if (!pcdev) { sh_mobile_ceu_probe() 1769 dev_err(&pdev->dev, "Could not allocate pcdev\n"); sh_mobile_ceu_probe() 1773 INIT_LIST_HEAD(&pcdev->capture); sh_mobile_ceu_probe() 1774 spin_lock_init(&pcdev->lock); sh_mobile_ceu_probe() 1775 init_completion(&pcdev->complete); sh_mobile_ceu_probe() 1777 pcdev->pdata = pdev->dev.platform_data; sh_mobile_ceu_probe() 1778 if (!pcdev->pdata && !pdev->dev.of_node) { sh_mobile_ceu_probe() 1784 if (pcdev->pdata) { sh_mobile_ceu_probe() 1785 pcdev->max_width = pcdev->pdata->max_width; sh_mobile_ceu_probe() 1786 pcdev->max_height = pcdev->pdata->max_height; sh_mobile_ceu_probe() 1787 pcdev->flags = pcdev->pdata->flags; sh_mobile_ceu_probe() 1789 pcdev->field = V4L2_FIELD_NONE; sh_mobile_ceu_probe() 1791 if (!pcdev->max_width) { sh_mobile_ceu_probe() 1795 pcdev->max_width = v; sh_mobile_ceu_probe() 1797 if (!pcdev->max_width) sh_mobile_ceu_probe() 1798 pcdev->max_width = 2560; sh_mobile_ceu_probe() 1800 if (!pcdev->max_height) { sh_mobile_ceu_probe() 1804 pcdev->max_height = v; sh_mobile_ceu_probe() 1806 if (!pcdev->max_height) sh_mobile_ceu_probe() 1807 pcdev->max_height = 1920; sh_mobile_ceu_probe() 1814 pcdev->irq = irq; sh_mobile_ceu_probe() 1815 pcdev->base = base; sh_mobile_ceu_probe() 1816 pcdev->video_limit = 0; /* only enabled if second resource exists */ sh_mobile_ceu_probe() 1830 pcdev->video_limit = resource_size(res); sh_mobile_ceu_probe() 1834 err = devm_request_irq(&pdev->dev, pcdev->irq, sh_mobile_ceu_irq, sh_mobile_ceu_probe() 1835 0, dev_name(&pdev->dev), pcdev); sh_mobile_ceu_probe() 1845 pcdev->ici.priv = pcdev; sh_mobile_ceu_probe() 1846 pcdev->ici.v4l2_dev.dev = &pdev->dev; sh_mobile_ceu_probe() 1847 pcdev->ici.nr = pdev->id; sh_mobile_ceu_probe() 1848 pcdev->ici.drv_name = dev_name(&pdev->dev); sh_mobile_ceu_probe() 1849 pcdev->ici.ops = &sh_mobile_ceu_host_ops; sh_mobile_ceu_probe() 1850 pcdev->ici.capabilities = SOCAM_HOST_CAP_STRIDE; sh_mobile_ceu_probe() 1852 pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); sh_mobile_ceu_probe() 1853 if (IS_ERR(pcdev->alloc_ctx)) { sh_mobile_ceu_probe() 1854 err = PTR_ERR(pcdev->alloc_ctx); sh_mobile_ceu_probe() 1858 if (pcdev->pdata && pcdev->pdata->asd_sizes) { sh_mobile_ceu_probe() 1867 asd = pcdev->pdata->asd; sh_mobile_ceu_probe() 1868 for (j = 0; pcdev->pdata->asd_sizes[j]; j++) { sh_mobile_ceu_probe() 1869 for (i = 0; i < pcdev->pdata->asd_sizes[j]; i++, asd++) { sh_mobile_ceu_probe() 1875 pcdev->csi2_asd = *asd; sh_mobile_ceu_probe() 1879 if (pcdev->csi2_asd) sh_mobile_ceu_probe() 1883 pcdev->ici.asd = pcdev->pdata->asd; sh_mobile_ceu_probe() 1884 pcdev->ici.asd_sizes = pcdev->pdata->asd_sizes; sh_mobile_ceu_probe() 1888 csi2 = pcdev->pdata ? pcdev->pdata->csi2 : NULL; sh_mobile_ceu_probe() 1905 pcdev->csi2_pdev = csi2_pdev; sh_mobile_ceu_probe() 1954 pcdev->csi2_sd = platform_get_drvdata(csi2_pdev); sh_mobile_ceu_probe() 1957 err = soc_camera_host_register(&pcdev->ici); sh_mobile_ceu_probe() 1962 err = v4l2_device_register_subdev(&pcdev->ici.v4l2_dev, sh_mobile_ceu_probe() 1963 pcdev->csi2_sd); sh_mobile_ceu_probe() 1969 module_put(pcdev->csi2_sd->owner); sh_mobile_ceu_probe() 1975 soc_camera_host_unregister(&pcdev->ici); sh_mobile_ceu_probe() 1978 module_put(pcdev->csi2_pdev->dev.driver->owner); sh_mobile_ceu_probe() 1980 platform_device_del(pcdev->csi2_pdev); sh_mobile_ceu_probe() 1982 pcdev->csi2_pdev->resource = NULL; sh_mobile_ceu_probe() 1983 platform_device_put(pcdev->csi2_pdev); sh_mobile_ceu_probe() 1986 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); sh_mobile_ceu_probe() 1998 struct sh_mobile_ceu_dev *pcdev = container_of(soc_host, sh_mobile_ceu_remove() local 2000 struct platform_device *csi2_pdev = pcdev->csi2_pdev; sh_mobile_ceu_remove() 2006 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); sh_mobile_ceu_remove()
|
/linux-4.4.14/drivers/media/platform/ |
H A D | mx2_emmaprp.c | 245 struct emmaprp_dev *pcdev = ctx->dev; emmaprp_job_abort() local 249 dprintk(pcdev, "Aborting task\n"); emmaprp_job_abort() 251 v4l2_m2m_job_finish(pcdev->m2m_dev, ctx->m2m_ctx); emmaprp_job_abort() 257 struct emmaprp_dev *pcdev = ctx->dev; emmaprp_lock() local 258 mutex_lock(&pcdev->dev_mutex); emmaprp_lock() 264 struct emmaprp_dev *pcdev = ctx->dev; emmaprp_unlock() local 265 mutex_unlock(&pcdev->dev_mutex); emmaprp_unlock() 268 static inline void emmaprp_dump_regs(struct emmaprp_dev *pcdev) emmaprp_dump_regs() argument 270 dprintk(pcdev, emmaprp_dump_regs() 279 readl(pcdev->base_emma + PRP_SOURCE_Y_PTR), emmaprp_dump_regs() 280 readl(pcdev->base_emma + PRP_SRC_FRAME_SIZE), emmaprp_dump_regs() 281 readl(pcdev->base_emma + PRP_DEST_Y_PTR), emmaprp_dump_regs() 282 readl(pcdev->base_emma + PRP_DEST_CR_PTR), emmaprp_dump_regs() 283 readl(pcdev->base_emma + PRP_DEST_CB_PTR), emmaprp_dump_regs() 284 readl(pcdev->base_emma + PRP_CH2_OUT_IMAGE_SIZE), emmaprp_dump_regs() 285 readl(pcdev->base_emma + PRP_CNTL)); emmaprp_dump_regs() 293 struct emmaprp_dev *pcdev = ctx->dev; emmaprp_device_run() local 315 v4l2_err(&pcdev->v4l2_dev, emmaprp_device_run() 321 writel(p_in, pcdev->base_emma + PRP_SOURCE_Y_PTR); emmaprp_device_run() 323 pcdev->base_emma + PRP_SRC_FRAME_SIZE); emmaprp_device_run() 326 writel(p_out, pcdev->base_emma + PRP_DEST_Y_PTR); emmaprp_device_run() 327 writel(p_out + d_size, pcdev->base_emma + PRP_DEST_CB_PTR); emmaprp_device_run() 329 pcdev->base_emma + PRP_DEST_CR_PTR); emmaprp_device_run() 331 pcdev->base_emma + PRP_CH2_OUT_IMAGE_SIZE); emmaprp_device_run() 334 tmp = readl(pcdev->base_emma + PRP_INTR_CNTL); emmaprp_device_run() 338 pcdev->base_emma + PRP_INTR_CNTL); emmaprp_device_run() 340 emmaprp_dump_regs(pcdev); emmaprp_device_run() 343 tmp = readl(pcdev->base_emma + PRP_CNTL); emmaprp_device_run() 347 pcdev->base_emma + PRP_CNTL); emmaprp_device_run() 352 struct emmaprp_dev *pcdev = data; emmaprp_irq() local 359 irqst = readl(pcdev->base_emma + PRP_INTRSTATUS); emmaprp_irq() 360 writel(irqst, pcdev->base_emma + PRP_INTRSTATUS); emmaprp_irq() 361 dprintk(pcdev, "irqst = 0x%08x\n", irqst); emmaprp_irq() 363 curr_ctx = v4l2_m2m_get_curr_priv(pcdev->m2m_dev); emmaprp_irq() 373 writel(PRP_CNTL_SWRST, pcdev->base_emma + PRP_CNTL); emmaprp_irq() 386 spin_lock_irqsave(&pcdev->irqlock, flags); emmaprp_irq() 389 spin_unlock_irqrestore(&pcdev->irqlock, flags); emmaprp_irq() 393 v4l2_m2m_job_finish(pcdev->m2m_dev, curr_ctx->m2m_ctx); emmaprp_irq() 790 struct emmaprp_dev *pcdev = video_drvdata(file); emmaprp_open() local 798 ctx->dev = pcdev; emmaprp_open() 800 if (mutex_lock_interruptible(&pcdev->dev_mutex)) { emmaprp_open() 805 ctx->m2m_ctx = v4l2_m2m_ctx_init(pcdev->m2m_dev, ctx, &queue_init); emmaprp_open() 810 mutex_unlock(&pcdev->dev_mutex); emmaprp_open() 815 clk_prepare_enable(pcdev->clk_emma_ipg); emmaprp_open() 816 clk_prepare_enable(pcdev->clk_emma_ahb); emmaprp_open() 819 mutex_unlock(&pcdev->dev_mutex); emmaprp_open() 821 dprintk(pcdev, "Created instance %p, m2m_ctx: %p\n", ctx, ctx->m2m_ctx); emmaprp_open() 828 struct emmaprp_dev *pcdev = video_drvdata(file); emmaprp_release() local 831 dprintk(pcdev, "Releasing instance %p\n", ctx); emmaprp_release() 833 mutex_lock(&pcdev->dev_mutex); emmaprp_release() 834 clk_disable_unprepare(pcdev->clk_emma_ahb); emmaprp_release() 835 clk_disable_unprepare(pcdev->clk_emma_ipg); emmaprp_release() 837 mutex_unlock(&pcdev->dev_mutex); emmaprp_release() 846 struct emmaprp_dev *pcdev = video_drvdata(file); emmaprp_poll() local 850 mutex_lock(&pcdev->dev_mutex); emmaprp_poll() 852 mutex_unlock(&pcdev->dev_mutex); emmaprp_poll() 858 struct emmaprp_dev *pcdev = video_drvdata(file); emmaprp_mmap() local 862 if (mutex_lock_interruptible(&pcdev->dev_mutex)) emmaprp_mmap() 865 mutex_unlock(&pcdev->dev_mutex); emmaprp_mmap() 896 struct emmaprp_dev *pcdev; emmaprp_probe() local 901 pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); emmaprp_probe() 902 if (!pcdev) emmaprp_probe() 905 spin_lock_init(&pcdev->irqlock); emmaprp_probe() 907 pcdev->clk_emma_ipg = devm_clk_get(&pdev->dev, "ipg"); emmaprp_probe() 908 if (IS_ERR(pcdev->clk_emma_ipg)) { emmaprp_probe() 909 return PTR_ERR(pcdev->clk_emma_ipg); emmaprp_probe() 912 pcdev->clk_emma_ahb = devm_clk_get(&pdev->dev, "ahb"); emmaprp_probe() 913 if (IS_ERR(pcdev->clk_emma_ahb)) emmaprp_probe() 914 return PTR_ERR(pcdev->clk_emma_ahb); emmaprp_probe() 917 pcdev->base_emma = devm_ioremap_resource(&pdev->dev, res); emmaprp_probe() 918 if (IS_ERR(pcdev->base_emma)) emmaprp_probe() 919 return PTR_ERR(pcdev->base_emma); emmaprp_probe() 921 ret = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev); emmaprp_probe() 925 mutex_init(&pcdev->dev_mutex); emmaprp_probe() 929 v4l2_err(&pcdev->v4l2_dev, "Failed to allocate video device\n"); emmaprp_probe() 935 vfd->lock = &pcdev->dev_mutex; emmaprp_probe() 936 vfd->v4l2_dev = &pcdev->v4l2_dev; emmaprp_probe() 938 video_set_drvdata(vfd, pcdev); emmaprp_probe() 940 pcdev->vfd = vfd; emmaprp_probe() 941 v4l2_info(&pcdev->v4l2_dev, EMMAPRP_MODULE_NAME emmaprp_probe() 944 platform_set_drvdata(pdev, pcdev); emmaprp_probe() 948 dev_name(&pdev->dev), pcdev); emmaprp_probe() 952 pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); emmaprp_probe() 953 if (IS_ERR(pcdev->alloc_ctx)) { emmaprp_probe() 954 v4l2_err(&pcdev->v4l2_dev, "Failed to alloc vb2 context\n"); emmaprp_probe() 955 ret = PTR_ERR(pcdev->alloc_ctx); emmaprp_probe() 959 pcdev->m2m_dev = v4l2_m2m_init(&m2m_ops); emmaprp_probe() 960 if (IS_ERR(pcdev->m2m_dev)) { emmaprp_probe() 961 v4l2_err(&pcdev->v4l2_dev, "Failed to init mem2mem device\n"); emmaprp_probe() 962 ret = PTR_ERR(pcdev->m2m_dev); emmaprp_probe() 968 v4l2_err(&pcdev->v4l2_dev, "Failed to register video device\n"); emmaprp_probe() 976 v4l2_m2m_release(pcdev->m2m_dev); emmaprp_probe() 978 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); emmaprp_probe() 982 v4l2_device_unregister(&pcdev->v4l2_dev); emmaprp_probe() 984 mutex_destroy(&pcdev->dev_mutex); emmaprp_probe() 991 struct emmaprp_dev *pcdev = platform_get_drvdata(pdev); emmaprp_remove() local 993 v4l2_info(&pcdev->v4l2_dev, "Removing " EMMAPRP_MODULE_NAME); emmaprp_remove() 995 video_unregister_device(pcdev->vfd); emmaprp_remove() 996 v4l2_m2m_release(pcdev->m2m_dev); emmaprp_remove() 997 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); emmaprp_remove() 998 v4l2_device_unregister(&pcdev->v4l2_dev); emmaprp_remove() 999 mutex_destroy(&pcdev->dev_mutex); emmaprp_remove()
|
H A D | m2m-deinterlace.c | 159 struct deinterlace_dev *pcdev = ctx->dev; deinterlace_job_ready() local 164 dprintk(pcdev, "Task ready\n"); deinterlace_job_ready() 168 dprintk(pcdev, "Task not ready to run\n"); deinterlace_job_ready() 176 struct deinterlace_dev *pcdev = ctx->dev; deinterlace_job_abort() local 180 dprintk(pcdev, "Aborting task\n"); deinterlace_job_abort() 182 v4l2_m2m_job_finish(pcdev->m2m_dev, ctx->m2m_ctx); deinterlace_job_abort() 188 struct deinterlace_dev *pcdev = ctx->dev; deinterlace_lock() local 189 mutex_lock(&pcdev->dev_mutex); deinterlace_lock() 195 struct deinterlace_dev *pcdev = ctx->dev; deinterlace_unlock() local 196 mutex_unlock(&pcdev->dev_mutex); deinterlace_unlock() 202 struct deinterlace_dev *pcdev = curr_ctx->dev; dma_callback() local 205 atomic_set(&pcdev->busy, 0); dma_callback() 219 v4l2_m2m_job_finish(pcdev->m2m_dev, curr_ctx->m2m_ctx); dma_callback() 221 dprintk(pcdev, "dma transfers completed.\n"); dma_callback() 229 struct deinterlace_dev *pcdev = ctx->dev; deinterlace_issue_dma() local 230 struct dma_chan *chan = pcdev->dma_chan; deinterlace_issue_dma() 250 v4l2_err(&pcdev->v4l2_dev, deinterlace_issue_dma() 352 v4l2_warn(&pcdev->v4l2_dev, "DMA interleaved prep error\n"); deinterlace_issue_dma() 363 v4l2_warn(&pcdev->v4l2_dev, deinterlace_issue_dma() 909 struct deinterlace_dev *pcdev = video_drvdata(file); deinterlace_open() local 917 ctx->dev = pcdev; deinterlace_open() 919 ctx->m2m_ctx = v4l2_m2m_ctx_init(pcdev->m2m_dev, ctx, &queue_init); deinterlace_open() 936 dprintk(pcdev, "Created instance %p, m2m_ctx: %p\n", ctx, ctx->m2m_ctx); deinterlace_open() 943 struct deinterlace_dev *pcdev = video_drvdata(file); deinterlace_release() local 946 dprintk(pcdev, "Releasing instance %p\n", ctx); deinterlace_release() 1003 struct deinterlace_dev *pcdev; deinterlace_probe() local 1008 pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL); deinterlace_probe() 1009 if (!pcdev) deinterlace_probe() 1012 spin_lock_init(&pcdev->irqlock); deinterlace_probe() 1016 pcdev->dma_chan = dma_request_channel(mask, NULL, pcdev); deinterlace_probe() 1017 if (!pcdev->dma_chan) deinterlace_probe() 1020 if (!dma_has_cap(DMA_INTERLEAVE, pcdev->dma_chan->device->cap_mask)) { deinterlace_probe() 1021 v4l2_err(&pcdev->v4l2_dev, "DMA does not support INTERLEAVE\n"); deinterlace_probe() 1025 ret = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev); deinterlace_probe() 1029 atomic_set(&pcdev->busy, 0); deinterlace_probe() 1030 mutex_init(&pcdev->dev_mutex); deinterlace_probe() 1032 vfd = &pcdev->vfd; deinterlace_probe() 1034 vfd->lock = &pcdev->dev_mutex; deinterlace_probe() 1035 vfd->v4l2_dev = &pcdev->v4l2_dev; deinterlace_probe() 1039 v4l2_err(&pcdev->v4l2_dev, "Failed to register video device\n"); deinterlace_probe() 1043 video_set_drvdata(vfd, pcdev); deinterlace_probe() 1045 v4l2_info(&pcdev->v4l2_dev, MEM2MEM_TEST_MODULE_NAME deinterlace_probe() 1048 platform_set_drvdata(pdev, pcdev); deinterlace_probe() 1050 pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); deinterlace_probe() 1051 if (IS_ERR(pcdev->alloc_ctx)) { deinterlace_probe() 1052 v4l2_err(&pcdev->v4l2_dev, "Failed to alloc vb2 context\n"); deinterlace_probe() 1053 ret = PTR_ERR(pcdev->alloc_ctx); deinterlace_probe() 1057 pcdev->m2m_dev = v4l2_m2m_init(&m2m_ops); deinterlace_probe() 1058 if (IS_ERR(pcdev->m2m_dev)) { deinterlace_probe() 1059 v4l2_err(&pcdev->v4l2_dev, "Failed to init mem2mem device\n"); deinterlace_probe() 1060 ret = PTR_ERR(pcdev->m2m_dev); deinterlace_probe() 1067 video_unregister_device(&pcdev->vfd); deinterlace_probe() 1069 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); deinterlace_probe() 1071 v4l2_device_unregister(&pcdev->v4l2_dev); deinterlace_probe() 1073 dma_release_channel(pcdev->dma_chan); deinterlace_probe() 1080 struct deinterlace_dev *pcdev = platform_get_drvdata(pdev); deinterlace_remove() local 1082 v4l2_info(&pcdev->v4l2_dev, "Removing " MEM2MEM_TEST_MODULE_NAME); deinterlace_remove() 1083 v4l2_m2m_release(pcdev->m2m_dev); deinterlace_remove() 1084 video_unregister_device(&pcdev->vfd); deinterlace_remove() 1085 v4l2_device_unregister(&pcdev->v4l2_dev); deinterlace_remove() 1086 vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); deinterlace_remove() 1087 dma_release_channel(pcdev->dma_chan); deinterlace_remove()
|
/linux-4.4.14/drivers/amba/ |
H A D | bus.c | 44 struct amba_device *pcdev = to_amba_device(dev); amba_match() local 48 if (pcdev->driver_override) amba_match() 49 return !strcmp(pcdev->driver_override, drv->name); amba_match() 51 return amba_lookup(pcdrv->id_table, pcdev) != NULL; amba_match() 56 struct amba_device *pcdev = to_amba_device(dev); amba_uevent() local 59 retval = add_uevent_var(env, "AMBA_ID=%08x", pcdev->periphid); amba_uevent() 63 retval = add_uevent_var(env, "MODALIAS=amba:d%08X", pcdev->periphid); amba_uevent() 142 struct amba_device *pcdev = to_amba_device(dev); amba_pm_runtime_suspend() local 147 clk_disable(pcdev->pclk); amba_pm_runtime_suspend() 149 clk_disable_unprepare(pcdev->pclk); amba_pm_runtime_suspend() 157 struct amba_device *pcdev = to_amba_device(dev); amba_pm_runtime_resume() local 162 ret = clk_enable(pcdev->pclk); amba_pm_runtime_resume() 164 ret = clk_prepare_enable(pcdev->pclk); amba_pm_runtime_resume() 207 static int amba_get_enable_pclk(struct amba_device *pcdev) amba_get_enable_pclk() argument 211 pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk"); amba_get_enable_pclk() 212 if (IS_ERR(pcdev->pclk)) amba_get_enable_pclk() 213 return PTR_ERR(pcdev->pclk); amba_get_enable_pclk() 215 ret = clk_prepare_enable(pcdev->pclk); amba_get_enable_pclk() 217 clk_put(pcdev->pclk); amba_get_enable_pclk() 222 static void amba_put_disable_pclk(struct amba_device *pcdev) amba_put_disable_pclk() argument 224 clk_disable_unprepare(pcdev->pclk); amba_put_disable_pclk() 225 clk_put(pcdev->pclk); amba_put_disable_pclk() 234 struct amba_device *pcdev = to_amba_device(dev); amba_probe() local 236 const struct amba_id *id = amba_lookup(pcdrv->id_table, pcdev); amba_probe() 244 ret = amba_get_enable_pclk(pcdev); amba_probe() 254 ret = pcdrv->probe(pcdev, id); amba_probe() 262 amba_put_disable_pclk(pcdev); amba_probe() 271 struct amba_device *pcdev = to_amba_device(dev); amba_remove() local 276 ret = drv->remove(pcdev); amba_remove() 284 amba_put_disable_pclk(pcdev); amba_remove() 590 struct amba_device *pcdev = to_amba_device(dev); amba_find_match() local 593 r = (pcdev->periphid & d->mask) == d->id; amba_find_match() 601 d->dev = pcdev; amba_find_match()
|
/linux-4.4.14/drivers/pinctrl/meson/ |
H A D | pinctrl-meson.c | 140 static int meson_get_groups_count(struct pinctrl_dev *pcdev) meson_get_groups_count() argument 142 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_get_groups_count() 147 static const char *meson_get_group_name(struct pinctrl_dev *pcdev, meson_get_group_name() argument 150 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_get_group_name() 155 static int meson_get_group_pins(struct pinctrl_dev *pcdev, unsigned selector, meson_get_group_pins() argument 158 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_get_group_pins() 166 static void meson_pin_dbg_show(struct pinctrl_dev *pcdev, struct seq_file *s, meson_pin_dbg_show() argument 169 seq_printf(s, " %s", dev_name(pcdev->dev)); meson_pin_dbg_show() 216 static int meson_pmx_set_mux(struct pinctrl_dev *pcdev, unsigned func_num, meson_pmx_set_mux() argument 219 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_pmx_set_mux() 243 static int meson_pmx_request_gpio(struct pinctrl_dev *pcdev, meson_pmx_request_gpio() argument 247 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_pmx_request_gpio() 254 static int meson_pmx_get_funcs_count(struct pinctrl_dev *pcdev) meson_pmx_get_funcs_count() argument 256 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_pmx_get_funcs_count() 261 static const char *meson_pmx_get_func_name(struct pinctrl_dev *pcdev, meson_pmx_get_func_name() argument 264 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_pmx_get_func_name() 269 static int meson_pmx_get_groups(struct pinctrl_dev *pcdev, unsigned selector, meson_pmx_get_groups() argument 273 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_pmx_get_groups() 289 static int meson_pinconf_set(struct pinctrl_dev *pcdev, unsigned int pin, meson_pinconf_set() argument 292 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_pinconf_set() 393 static int meson_pinconf_get(struct pinctrl_dev *pcdev, unsigned int pin, meson_pinconf_get() argument 396 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_pinconf_get() 419 static int meson_pinconf_group_set(struct pinctrl_dev *pcdev, meson_pinconf_group_set() argument 423 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); meson_pinconf_group_set() 430 meson_pinconf_set(pcdev, group->pins[i], configs, meson_pinconf_group_set() 437 static int meson_pinconf_group_get(struct pinctrl_dev *pcdev, meson_pinconf_group_get() argument 740 pc->pcdev = pinctrl_register(&pc->desc, pc->dev, pc); meson_pinctrl_probe() 741 if (IS_ERR(pc->pcdev)) { meson_pinctrl_probe() 743 return PTR_ERR(pc->pcdev); meson_pinctrl_probe() 748 pinctrl_unregister(pc->pcdev); meson_pinctrl_probe()
|
H A D | pinctrl-meson.h | 152 struct pinctrl_dev *pcdev; member in struct:meson_pinctrl
|
/linux-4.4.14/drivers/pinctrl/ |
H A D | pinctrl-digicolor.c | 147 static int dc_pmx_request_gpio(struct pinctrl_dev *pcdev, dc_pmx_request_gpio() argument 151 struct dc_pinmap *pmap = pinctrl_dev_get_drvdata(pcdev); dc_pmx_request_gpio()
|
/linux-4.4.14/drivers/dma/ |
H A D | pl330.c | 2741 struct amba_device *pcdev = to_amba_device(dev); pl330_suspend() local 2747 amba_pclk_disable(pcdev); pl330_suspend() 2749 amba_pclk_unprepare(pcdev); pl330_suspend() 2756 struct amba_device *pcdev = to_amba_device(dev); pl330_resume() local 2759 ret = amba_pclk_prepare(pcdev); pl330_resume() 2764 ret = amba_pclk_enable(pcdev); pl330_resume()
|
/linux-4.4.14/drivers/media/platform/coda/ |
H A D | coda-common.c | 1065 struct coda_dev *pcdev = ctx->dev; coda_lock() local 1067 mutex_lock(&pcdev->dev_mutex); coda_lock() 1073 struct coda_dev *pcdev = ctx->dev; coda_unlock() local 1075 mutex_unlock(&pcdev->dev_mutex); coda_unlock()
|