| .. | .. |
|---|
| 920 | 920 | |
|---|
| 921 | 921 | if (!dev->active_sensor || |
|---|
| 922 | 922 | (dev->active_sensor && |
|---|
| 923 | | - dev->active_sensor->mbus.type != V4L2_MBUS_CSI2)) { |
|---|
| 923 | + dev->active_sensor->mbus.type != V4L2_MBUS_CSI2_DPHY)) { |
|---|
| 924 | 924 | if (stream->id == RKISP1_STREAM_RAW) |
|---|
| 925 | 925 | v4l2_err(&dev->v4l2_dev, |
|---|
| 926 | 926 | "only mipi sensor support raw path\n"); |
|---|
| .. | .. |
|---|
| 1381 | 1381 | stream->out_fmt.plane_fmt[1].sizeimage, |
|---|
| 1382 | 1382 | stream->out_fmt.plane_fmt[2].sizeimage); |
|---|
| 1383 | 1383 | if (dev->active_sensor && |
|---|
| 1384 | | - dev->active_sensor->mbus.type == V4L2_MBUS_CSI2 && |
|---|
| 1384 | + dev->active_sensor->mbus.type == V4L2_MBUS_CSI2_DPHY && |
|---|
| 1385 | 1385 | (dev->isp_ver == ISP_V12 || |
|---|
| 1386 | 1386 | dev->isp_ver == ISP_V13)) { |
|---|
| 1387 | 1387 | u32 in_size; |
|---|
| .. | .. |
|---|
| 1412 | 1412 | dummy_buf->vaddr, dummy_buf->dma_addr); |
|---|
| 1413 | 1413 | } |
|---|
| 1414 | 1414 | |
|---|
| 1415 | | -static void destroy_buf_queue(struct rkisp1_stream *stream, |
|---|
| 1416 | | - enum vb2_buffer_state state) |
|---|
| 1415 | +static void rkisp1_stop_streaming(struct vb2_queue *queue) |
|---|
| 1417 | 1416 | { |
|---|
| 1417 | + struct rkisp1_stream *stream = queue->drv_priv; |
|---|
| 1418 | + struct rkisp1_vdev_node *node = &stream->vnode; |
|---|
| 1419 | + struct rkisp1_device *dev = stream->ispdev; |
|---|
| 1420 | + struct v4l2_device *v4l2_dev = &dev->v4l2_dev; |
|---|
| 1418 | 1421 | struct rkisp1_buffer *buf; |
|---|
| 1419 | 1422 | unsigned long lock_flags = 0; |
|---|
| 1423 | + int ret; |
|---|
| 1420 | 1424 | |
|---|
| 1425 | + rkisp1_stream_stop(stream); |
|---|
| 1426 | + /* call to the other devices */ |
|---|
| 1427 | + media_pipeline_stop(&node->vdev.entity); |
|---|
| 1428 | + ret = dev->pipe.set_stream(&dev->pipe, false); |
|---|
| 1429 | + if (ret < 0) |
|---|
| 1430 | + v4l2_err(v4l2_dev, "pipeline stream-off failed error:%d\n", |
|---|
| 1431 | + ret); |
|---|
| 1432 | + |
|---|
| 1433 | + /* release buffers */ |
|---|
| 1421 | 1434 | spin_lock_irqsave(&stream->vbq_lock, lock_flags); |
|---|
| 1422 | 1435 | if (stream->curr_buf) { |
|---|
| 1423 | 1436 | list_add_tail(&stream->curr_buf->queue, &stream->buf_queue); |
|---|
| .. | .. |
|---|
| 1433 | 1446 | buf = list_first_entry(&stream->buf_queue, |
|---|
| 1434 | 1447 | struct rkisp1_buffer, queue); |
|---|
| 1435 | 1448 | list_del(&buf->queue); |
|---|
| 1436 | | - vb2_buffer_done(&buf->vb.vb2_buf, state); |
|---|
| 1449 | + vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR); |
|---|
| 1437 | 1450 | } |
|---|
| 1438 | 1451 | spin_unlock_irqrestore(&stream->vbq_lock, lock_flags); |
|---|
| 1439 | | -} |
|---|
| 1440 | | - |
|---|
| 1441 | | -static void rkisp1_stop_streaming(struct vb2_queue *queue) |
|---|
| 1442 | | -{ |
|---|
| 1443 | | - struct rkisp1_stream *stream = queue->drv_priv; |
|---|
| 1444 | | - struct rkisp1_vdev_node *node = &stream->vnode; |
|---|
| 1445 | | - struct rkisp1_device *dev = stream->ispdev; |
|---|
| 1446 | | - struct v4l2_device *v4l2_dev = &dev->v4l2_dev; |
|---|
| 1447 | | - int ret; |
|---|
| 1448 | | - |
|---|
| 1449 | | - rkisp1_stream_stop(stream); |
|---|
| 1450 | | - /* call to the other devices */ |
|---|
| 1451 | | - media_pipeline_stop(&node->vdev.entity); |
|---|
| 1452 | | - ret = dev->pipe.set_stream(&dev->pipe, false); |
|---|
| 1453 | | - if (ret < 0) |
|---|
| 1454 | | - v4l2_err(v4l2_dev, "pipeline stream-off failed error:%d\n", |
|---|
| 1455 | | - ret); |
|---|
| 1456 | | - |
|---|
| 1457 | | - /* release buffers */ |
|---|
| 1458 | | - destroy_buf_queue(stream, VB2_BUF_STATE_ERROR); |
|---|
| 1459 | 1452 | |
|---|
| 1460 | 1453 | ret = dev->pipe.close(&dev->pipe); |
|---|
| 1461 | 1454 | if (ret < 0) |
|---|
| .. | .. |
|---|
| 1506 | 1499 | struct rkisp1_device *dev = stream->ispdev; |
|---|
| 1507 | 1500 | struct v4l2_device *v4l2_dev = &dev->v4l2_dev; |
|---|
| 1508 | 1501 | int ret; |
|---|
| 1502 | + unsigned int i; |
|---|
| 1509 | 1503 | |
|---|
| 1510 | 1504 | if (WARN_ON(stream->streaming)) |
|---|
| 1511 | 1505 | return -EBUSY; |
|---|
| .. | .. |
|---|
| 1575 | 1569 | destroy_dummy_buf: |
|---|
| 1576 | 1570 | rkisp1_destroy_dummy_buf(stream); |
|---|
| 1577 | 1571 | buffer_done: |
|---|
| 1578 | | - destroy_buf_queue(stream, VB2_BUF_STATE_QUEUED); |
|---|
| 1579 | | - stream->streaming = false; |
|---|
| 1572 | + for (i = 0; i < queue->num_buffers; ++i) { |
|---|
| 1573 | + struct vb2_buffer *vb; |
|---|
| 1574 | + |
|---|
| 1575 | + vb = queue->bufs[i]; |
|---|
| 1576 | + if (vb->state == VB2_BUF_STATE_ACTIVE) |
|---|
| 1577 | + vb2_buffer_done(vb, VB2_BUF_STATE_QUEUED); |
|---|
| 1578 | + } |
|---|
| 1579 | + |
|---|
| 1580 | 1580 | return ret; |
|---|
| 1581 | 1581 | } |
|---|
| 1582 | 1582 | |
|---|
| .. | .. |
|---|
| 1739 | 1739 | ret = v4l2_fh_open(filp); |
|---|
| 1740 | 1740 | if (!ret) { |
|---|
| 1741 | 1741 | atomic_inc(&dev->open_cnt); |
|---|
| 1742 | | - ret = v4l2_pipeline_pm_use(&stream->vnode.vdev.entity, 1); |
|---|
| 1742 | + ret = v4l2_pipeline_pm_get(&stream->vnode.vdev.entity); |
|---|
| 1743 | 1743 | if (ret < 0) |
|---|
| 1744 | 1744 | vb2_fop_release(filp); |
|---|
| 1745 | 1745 | } |
|---|
| .. | .. |
|---|
| 1755 | 1755 | |
|---|
| 1756 | 1756 | ret = vb2_fop_release(file); |
|---|
| 1757 | 1757 | if (!ret) { |
|---|
| 1758 | | - ret = v4l2_pipeline_pm_use(&stream->vnode.vdev.entity, 0); |
|---|
| 1758 | + ret = v4l2_pipeline_pm_get(&stream->vnode.vdev.entity); |
|---|
| 1759 | 1759 | if (ret < 0) |
|---|
| 1760 | 1760 | v4l2_err(&dev->v4l2_dev, |
|---|
| 1761 | 1761 | "set pipeline power failed %d\n", ret); |
|---|
| .. | .. |
|---|
| 2075 | 2075 | .vidioc_streamoff = vb2_ioctl_streamoff, |
|---|
| 2076 | 2076 | .vidioc_enum_input = rkisp1_enum_input, |
|---|
| 2077 | 2077 | .vidioc_try_fmt_vid_cap_mplane = rkisp1_try_fmt_vid_cap_mplane, |
|---|
| 2078 | | - .vidioc_enum_fmt_vid_cap_mplane = rkisp1_enum_fmt_vid_cap_mplane, |
|---|
| 2078 | + .vidioc_enum_fmt_vid_cap = rkisp1_enum_fmt_vid_cap_mplane, |
|---|
| 2079 | 2079 | .vidioc_s_fmt_vid_cap_mplane = rkisp1_s_fmt_vid_cap_mplane, |
|---|
| 2080 | 2080 | .vidioc_g_fmt_vid_cap_mplane = rkisp1_g_fmt_vid_cap_mplane, |
|---|
| 2081 | 2081 | .vidioc_s_selection = rkisp1_s_selection, |
|---|
| .. | .. |
|---|
| 2162 | 2162 | V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); |
|---|
| 2163 | 2163 | vdev->queue = &node->buf_queue; |
|---|
| 2164 | 2164 | |
|---|
| 2165 | | - ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); |
|---|
| 2165 | + ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); |
|---|
| 2166 | 2166 | if (ret < 0) { |
|---|
| 2167 | 2167 | v4l2_err(v4l2_dev, |
|---|
| 2168 | 2168 | "video_register_device failed with error %d\n", ret); |
|---|