diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2013-05-31 10:37:18 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-12 20:53:33 -0400 |
commit | bc7584b0b7a99326d31195f81f7494efe9fe0c0f (patch) | |
tree | 0b45ab410e3f111c91128c6d51e1ac754d1c8de7 | |
parent | 045a1faca83cdaa54dd88f9a2875debdea5d79fa (diff) |
[media] exynos4-is: Add struct exynos_video_entity
This patch introduces common structure for the video entities
to handle all video nodes and media pipelines associated with
them in more generic way.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-capture.c | 43 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-core.h | 4 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-lite-reg.c | 2 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-lite.c | 20 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-lite.h | 4 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-reg.c | 7 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/media-dev.c | 4 | ||||
-rw-r--r-- | drivers/media/platform/exynos4-is/media-dev.h | 8 | ||||
-rw-r--r-- | include/media/s5p_fimc.h | 5 |
9 files changed, 55 insertions, 42 deletions
diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c index a8b9b06d96aa..b80ca59a099d 100644 --- a/drivers/media/platform/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/exynos4-is/fimc-capture.c | |||
@@ -320,6 +320,7 @@ static void buffer_queue(struct vb2_buffer *vb); | |||
320 | int fimc_capture_resume(struct fimc_dev *fimc) | 320 | int fimc_capture_resume(struct fimc_dev *fimc) |
321 | { | 321 | { |
322 | struct fimc_vid_cap *vid_cap = &fimc->vid_cap; | 322 | struct fimc_vid_cap *vid_cap = &fimc->vid_cap; |
323 | struct exynos_video_entity *ve = &vid_cap->ve; | ||
323 | struct fimc_vid_buffer *buf; | 324 | struct fimc_vid_buffer *buf; |
324 | int i; | 325 | int i; |
325 | 326 | ||
@@ -329,7 +330,7 @@ int fimc_capture_resume(struct fimc_dev *fimc) | |||
329 | INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q); | 330 | INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q); |
330 | vid_cap->buf_index = 0; | 331 | vid_cap->buf_index = 0; |
331 | fimc_pipeline_call(fimc, open, &fimc->pipeline, | 332 | fimc_pipeline_call(fimc, open, &fimc->pipeline, |
332 | &vid_cap->vfd.entity, false); | 333 | &ve->vdev.entity, false); |
333 | fimc_capture_hw_init(fimc); | 334 | fimc_capture_hw_init(fimc); |
334 | 335 | ||
335 | clear_bit(ST_CAPT_SUSPENDED, &fimc->state); | 336 | clear_bit(ST_CAPT_SUSPENDED, &fimc->state); |
@@ -397,7 +398,7 @@ static int buffer_prepare(struct vb2_buffer *vb) | |||
397 | unsigned long size = ctx->d_frame.payload[i]; | 398 | unsigned long size = ctx->d_frame.payload[i]; |
398 | 399 | ||
399 | if (vb2_plane_size(vb, i) < size) { | 400 | if (vb2_plane_size(vb, i) < size) { |
400 | v4l2_err(&ctx->fimc_dev->vid_cap.vfd, | 401 | v4l2_err(&ctx->fimc_dev->vid_cap.ve.vdev, |
401 | "User buffer too small (%ld < %ld)\n", | 402 | "User buffer too small (%ld < %ld)\n", |
402 | vb2_plane_size(vb, i), size); | 403 | vb2_plane_size(vb, i), size); |
403 | return -EINVAL; | 404 | return -EINVAL; |
@@ -415,6 +416,7 @@ static void buffer_queue(struct vb2_buffer *vb) | |||
415 | struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); | 416 | struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); |
416 | struct fimc_dev *fimc = ctx->fimc_dev; | 417 | struct fimc_dev *fimc = ctx->fimc_dev; |
417 | struct fimc_vid_cap *vid_cap = &fimc->vid_cap; | 418 | struct fimc_vid_cap *vid_cap = &fimc->vid_cap; |
419 | struct exynos_video_entity *ve = &vid_cap->ve; | ||
418 | unsigned long flags; | 420 | unsigned long flags; |
419 | int min_bufs; | 421 | int min_bufs; |
420 | 422 | ||
@@ -454,7 +456,7 @@ static void buffer_queue(struct vb2_buffer *vb) | |||
454 | 456 | ||
455 | ret = fimc_pipeline_call(fimc, set_stream, &fimc->pipeline, 1); | 457 | ret = fimc_pipeline_call(fimc, set_stream, &fimc->pipeline, 1); |
456 | if (ret < 0) | 458 | if (ret < 0) |
457 | v4l2_err(&vid_cap->vfd, "stream on failed: %d\n", ret); | 459 | v4l2_err(&ve->vdev, "stream on failed: %d\n", ret); |
458 | return; | 460 | return; |
459 | } | 461 | } |
460 | spin_unlock_irqrestore(&fimc->slock, flags); | 462 | spin_unlock_irqrestore(&fimc->slock, flags); |
@@ -503,11 +505,12 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc); | |||
503 | static int fimc_capture_open(struct file *file) | 505 | static int fimc_capture_open(struct file *file) |
504 | { | 506 | { |
505 | struct fimc_dev *fimc = video_drvdata(file); | 507 | struct fimc_dev *fimc = video_drvdata(file); |
508 | struct exynos_video_entity *ve = &fimc->vid_cap.ve; | ||
506 | int ret = -EBUSY; | 509 | int ret = -EBUSY; |
507 | 510 | ||
508 | dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); | 511 | dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); |
509 | 512 | ||
510 | fimc_md_graph_lock(fimc); | 513 | fimc_md_graph_lock(ve); |
511 | mutex_lock(&fimc->lock); | 514 | mutex_lock(&fimc->lock); |
512 | 515 | ||
513 | if (fimc_m2m_active(fimc)) | 516 | if (fimc_m2m_active(fimc)) |
@@ -526,7 +529,7 @@ static int fimc_capture_open(struct file *file) | |||
526 | 529 | ||
527 | if (v4l2_fh_is_singular_file(file)) { | 530 | if (v4l2_fh_is_singular_file(file)) { |
528 | ret = fimc_pipeline_call(fimc, open, &fimc->pipeline, | 531 | ret = fimc_pipeline_call(fimc, open, &fimc->pipeline, |
529 | &fimc->vid_cap.vfd.entity, true); | 532 | &fimc->vid_cap.ve.vdev.entity, true); |
530 | 533 | ||
531 | if (!ret && !fimc->vid_cap.user_subdev_api) | 534 | if (!ret && !fimc->vid_cap.user_subdev_api) |
532 | ret = fimc_capture_set_default_format(fimc); | 535 | ret = fimc_capture_set_default_format(fimc); |
@@ -544,7 +547,7 @@ static int fimc_capture_open(struct file *file) | |||
544 | } | 547 | } |
545 | unlock: | 548 | unlock: |
546 | mutex_unlock(&fimc->lock); | 549 | mutex_unlock(&fimc->lock); |
547 | fimc_md_graph_unlock(fimc); | 550 | fimc_md_graph_unlock(ve); |
548 | return ret; | 551 | return ret; |
549 | } | 552 | } |
550 | 553 | ||
@@ -560,7 +563,7 @@ static int fimc_capture_release(struct file *file) | |||
560 | 563 | ||
561 | if (v4l2_fh_is_singular_file(file)) { | 564 | if (v4l2_fh_is_singular_file(file)) { |
562 | if (vc->streaming) { | 565 | if (vc->streaming) { |
563 | media_entity_pipeline_stop(&vc->vfd.entity); | 566 | media_entity_pipeline_stop(&vc->ve.vdev.entity); |
564 | vc->streaming = false; | 567 | vc->streaming = false; |
565 | } | 568 | } |
566 | clear_bit(ST_CAPT_BUSY, &fimc->state); | 569 | clear_bit(ST_CAPT_BUSY, &fimc->state); |
@@ -935,11 +938,12 @@ static int fimc_cap_try_fmt_mplane(struct file *file, void *fh, | |||
935 | struct v4l2_pix_format_mplane *pix = &f->fmt.pix_mp; | 938 | struct v4l2_pix_format_mplane *pix = &f->fmt.pix_mp; |
936 | struct fimc_dev *fimc = video_drvdata(file); | 939 | struct fimc_dev *fimc = video_drvdata(file); |
937 | struct fimc_ctx *ctx = fimc->vid_cap.ctx; | 940 | struct fimc_ctx *ctx = fimc->vid_cap.ctx; |
941 | struct exynos_video_entity *ve = &fimc->vid_cap.ve; | ||
938 | struct v4l2_mbus_framefmt mf; | 942 | struct v4l2_mbus_framefmt mf; |
939 | struct fimc_fmt *ffmt = NULL; | 943 | struct fimc_fmt *ffmt = NULL; |
940 | int ret = 0; | 944 | int ret = 0; |
941 | 945 | ||
942 | fimc_md_graph_lock(fimc); | 946 | fimc_md_graph_lock(ve); |
943 | mutex_lock(&fimc->lock); | 947 | mutex_lock(&fimc->lock); |
944 | 948 | ||
945 | if (fimc_jpeg_fourcc(pix->pixelformat)) { | 949 | if (fimc_jpeg_fourcc(pix->pixelformat)) { |
@@ -975,7 +979,7 @@ static int fimc_cap_try_fmt_mplane(struct file *file, void *fh, | |||
975 | pix->plane_fmt, ffmt->memplanes, true); | 979 | pix->plane_fmt, ffmt->memplanes, true); |
976 | unlock: | 980 | unlock: |
977 | mutex_unlock(&fimc->lock); | 981 | mutex_unlock(&fimc->lock); |
978 | fimc_md_graph_unlock(fimc); | 982 | fimc_md_graph_unlock(ve); |
979 | 983 | ||
980 | return ret; | 984 | return ret; |
981 | } | 985 | } |
@@ -1076,7 +1080,7 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void *priv, | |||
1076 | struct fimc_dev *fimc = video_drvdata(file); | 1080 | struct fimc_dev *fimc = video_drvdata(file); |
1077 | int ret; | 1081 | int ret; |
1078 | 1082 | ||
1079 | fimc_md_graph_lock(fimc); | 1083 | fimc_md_graph_lock(&fimc->vid_cap.ve); |
1080 | mutex_lock(&fimc->lock); | 1084 | mutex_lock(&fimc->lock); |
1081 | /* | 1085 | /* |
1082 | * The graph is walked within __fimc_capture_set_format() to set | 1086 | * The graph is walked within __fimc_capture_set_format() to set |
@@ -1088,8 +1092,8 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void *priv, | |||
1088 | */ | 1092 | */ |
1089 | ret = __fimc_capture_set_format(fimc, f); | 1093 | ret = __fimc_capture_set_format(fimc, f); |
1090 | 1094 | ||
1095 | fimc_md_graph_unlock(&fimc->vid_cap.ve); | ||
1091 | mutex_unlock(&fimc->lock); | 1096 | mutex_unlock(&fimc->lock); |
1092 | fimc_md_graph_unlock(fimc); | ||
1093 | return ret; | 1097 | return ret; |
1094 | } | 1098 | } |
1095 | 1099 | ||
@@ -1209,7 +1213,7 @@ static int fimc_cap_streamon(struct file *file, void *priv, | |||
1209 | struct fimc_dev *fimc = video_drvdata(file); | 1213 | struct fimc_dev *fimc = video_drvdata(file); |
1210 | struct fimc_pipeline *p = &fimc->pipeline; | 1214 | struct fimc_pipeline *p = &fimc->pipeline; |
1211 | struct fimc_vid_cap *vc = &fimc->vid_cap; | 1215 | struct fimc_vid_cap *vc = &fimc->vid_cap; |
1212 | struct media_entity *entity = &vc->vfd.entity; | 1216 | struct media_entity *entity = &vc->ve.vdev.entity; |
1213 | struct fimc_source_info *si = NULL; | 1217 | struct fimc_source_info *si = NULL; |
1214 | struct v4l2_subdev *sd; | 1218 | struct v4l2_subdev *sd; |
1215 | int ret; | 1219 | int ret; |
@@ -1259,14 +1263,15 @@ static int fimc_cap_streamoff(struct file *file, void *priv, | |||
1259 | enum v4l2_buf_type type) | 1263 | enum v4l2_buf_type type) |
1260 | { | 1264 | { |
1261 | struct fimc_dev *fimc = video_drvdata(file); | 1265 | struct fimc_dev *fimc = video_drvdata(file); |
1266 | struct fimc_vid_cap *vc = &fimc->vid_cap; | ||
1262 | int ret; | 1267 | int ret; |
1263 | 1268 | ||
1264 | ret = vb2_ioctl_streamoff(file, priv, type); | 1269 | ret = vb2_ioctl_streamoff(file, priv, type); |
1265 | if (ret < 0) | 1270 | if (ret < 0) |
1266 | return ret; | 1271 | return ret; |
1267 | 1272 | ||
1268 | media_entity_pipeline_stop(&fimc->vid_cap.vfd.entity); | 1273 | media_entity_pipeline_stop(&vc->ve.vdev.entity); |
1269 | fimc->vid_cap.streaming = false; | 1274 | vc->streaming = false; |
1270 | return 0; | 1275 | return 0; |
1271 | } | 1276 | } |
1272 | 1277 | ||
@@ -1735,7 +1740,7 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc) | |||
1735 | static int fimc_register_capture_device(struct fimc_dev *fimc, | 1740 | static int fimc_register_capture_device(struct fimc_dev *fimc, |
1736 | struct v4l2_device *v4l2_dev) | 1741 | struct v4l2_device *v4l2_dev) |
1737 | { | 1742 | { |
1738 | struct video_device *vfd = &fimc->vid_cap.vfd; | 1743 | struct video_device *vfd = &fimc->vid_cap.ve.vdev; |
1739 | struct vb2_queue *q = &fimc->vid_cap.vbq; | 1744 | struct vb2_queue *q = &fimc->vid_cap.vbq; |
1740 | struct fimc_ctx *ctx; | 1745 | struct fimc_ctx *ctx; |
1741 | struct fimc_vid_cap *vid_cap; | 1746 | struct fimc_vid_cap *vid_cap; |
@@ -1840,15 +1845,17 @@ static int fimc_capture_subdev_registered(struct v4l2_subdev *sd) | |||
1840 | static void fimc_capture_subdev_unregistered(struct v4l2_subdev *sd) | 1845 | static void fimc_capture_subdev_unregistered(struct v4l2_subdev *sd) |
1841 | { | 1846 | { |
1842 | struct fimc_dev *fimc = v4l2_get_subdevdata(sd); | 1847 | struct fimc_dev *fimc = v4l2_get_subdevdata(sd); |
1848 | struct video_device *vdev; | ||
1843 | 1849 | ||
1844 | if (fimc == NULL) | 1850 | if (fimc == NULL) |
1845 | return; | 1851 | return; |
1846 | 1852 | ||
1847 | fimc_unregister_m2m_device(fimc); | 1853 | fimc_unregister_m2m_device(fimc); |
1854 | vdev = &fimc->vid_cap.ve.vdev; | ||
1848 | 1855 | ||
1849 | if (video_is_registered(&fimc->vid_cap.vfd)) { | 1856 | if (video_is_registered(vdev)) { |
1850 | video_unregister_device(&fimc->vid_cap.vfd); | 1857 | video_unregister_device(vdev); |
1851 | media_entity_cleanup(&fimc->vid_cap.vfd.entity); | 1858 | media_entity_cleanup(&vdev->entity); |
1852 | fimc->pipeline_ops = NULL; | 1859 | fimc->pipeline_ops = NULL; |
1853 | } | 1860 | } |
1854 | kfree(fimc->vid_cap.ctx); | 1861 | kfree(fimc->vid_cap.ctx); |
diff --git a/drivers/media/platform/exynos4-is/fimc-core.h b/drivers/media/platform/exynos4-is/fimc-core.h index 539a3f71c16a..dfecef6bfefe 100644 --- a/drivers/media/platform/exynos4-is/fimc-core.h +++ b/drivers/media/platform/exynos4-is/fimc-core.h | |||
@@ -283,8 +283,8 @@ struct fimc_m2m_device { | |||
283 | /** | 283 | /** |
284 | * struct fimc_vid_cap - camera capture device information | 284 | * struct fimc_vid_cap - camera capture device information |
285 | * @ctx: hardware context data | 285 | * @ctx: hardware context data |
286 | * @vfd: video device node for camera capture mode | ||
287 | * @subdev: subdev exposing the FIMC processing block | 286 | * @subdev: subdev exposing the FIMC processing block |
287 | * @ve: exynos video device entity structure | ||
288 | * @vd_pad: fimc video capture node pad | 288 | * @vd_pad: fimc video capture node pad |
289 | * @sd_pads: fimc video processing block pads | 289 | * @sd_pads: fimc video processing block pads |
290 | * @ci_fmt: image format at the FIMC camera input (and the scaler output) | 290 | * @ci_fmt: image format at the FIMC camera input (and the scaler output) |
@@ -305,8 +305,8 @@ struct fimc_m2m_device { | |||
305 | struct fimc_vid_cap { | 305 | struct fimc_vid_cap { |
306 | struct fimc_ctx *ctx; | 306 | struct fimc_ctx *ctx; |
307 | struct vb2_alloc_ctx *alloc_ctx; | 307 | struct vb2_alloc_ctx *alloc_ctx; |
308 | struct video_device vfd; | ||
309 | struct v4l2_subdev subdev; | 308 | struct v4l2_subdev subdev; |
309 | struct exynos_video_entity ve; | ||
310 | struct media_pad vd_pad; | 310 | struct media_pad vd_pad; |
311 | struct media_pad sd_pads[FIMC_SD_PADS_NUM]; | 311 | struct media_pad sd_pads[FIMC_SD_PADS_NUM]; |
312 | struct v4l2_mbus_framefmt ci_fmt; | 312 | struct v4l2_mbus_framefmt ci_fmt; |
diff --git a/drivers/media/platform/exynos4-is/fimc-lite-reg.c b/drivers/media/platform/exynos4-is/fimc-lite-reg.c index 8cc0d39a2fea..eb4f7635f5e0 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite-reg.c +++ b/drivers/media/platform/exynos4-is/fimc-lite-reg.c | |||
@@ -137,7 +137,7 @@ void flite_hw_set_source_format(struct fimc_lite *dev, struct flite_frame *f) | |||
137 | } | 137 | } |
138 | 138 | ||
139 | if (i == 0 && src_pixfmt_map[i][0] != pixelcode) { | 139 | if (i == 0 && src_pixfmt_map[i][0] != pixelcode) { |
140 | v4l2_err(&dev->vfd, | 140 | v4l2_err(&dev->ve.vdev, |
141 | "Unsupported pixel code, falling back to %#08x\n", | 141 | "Unsupported pixel code, falling back to %#08x\n", |
142 | src_pixfmt_map[i][0]); | 142 | src_pixfmt_map[i][0]); |
143 | } | 143 | } |
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index 6daa88531e6e..64198b84f673 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c | |||
@@ -392,7 +392,7 @@ static int buffer_prepare(struct vb2_buffer *vb) | |||
392 | unsigned long size = fimc->payload[i]; | 392 | unsigned long size = fimc->payload[i]; |
393 | 393 | ||
394 | if (vb2_plane_size(vb, i) < size) { | 394 | if (vb2_plane_size(vb, i) < size) { |
395 | v4l2_err(&fimc->vfd, | 395 | v4l2_err(&fimc->ve.vdev, |
396 | "User buffer too small (%ld < %ld)\n", | 396 | "User buffer too small (%ld < %ld)\n", |
397 | vb2_plane_size(vb, i), size); | 397 | vb2_plane_size(vb, i), size); |
398 | return -EINVAL; | 398 | return -EINVAL; |
@@ -458,7 +458,7 @@ static void fimc_lite_clear_event_counters(struct fimc_lite *fimc) | |||
458 | static int fimc_lite_open(struct file *file) | 458 | static int fimc_lite_open(struct file *file) |
459 | { | 459 | { |
460 | struct fimc_lite *fimc = video_drvdata(file); | 460 | struct fimc_lite *fimc = video_drvdata(file); |
461 | struct media_entity *me = &fimc->vfd.entity; | 461 | struct media_entity *me = &fimc->ve.vdev.entity; |
462 | int ret; | 462 | int ret; |
463 | 463 | ||
464 | mutex_lock(&me->parent->graph_mutex); | 464 | mutex_lock(&me->parent->graph_mutex); |
@@ -509,7 +509,7 @@ static int fimc_lite_release(struct file *file) | |||
509 | if (v4l2_fh_is_singular_file(file) && | 509 | if (v4l2_fh_is_singular_file(file) && |
510 | atomic_read(&fimc->out_path) == FIMC_IO_DMA) { | 510 | atomic_read(&fimc->out_path) == FIMC_IO_DMA) { |
511 | if (fimc->streaming) { | 511 | if (fimc->streaming) { |
512 | media_entity_pipeline_stop(&fimc->vfd.entity); | 512 | media_entity_pipeline_stop(&fimc->ve.vdev.entity); |
513 | fimc->streaming = false; | 513 | fimc->streaming = false; |
514 | } | 514 | } |
515 | clear_bit(ST_FLITE_IN_USE, &fimc->state); | 515 | clear_bit(ST_FLITE_IN_USE, &fimc->state); |
@@ -792,7 +792,7 @@ static int fimc_lite_streamon(struct file *file, void *priv, | |||
792 | enum v4l2_buf_type type) | 792 | enum v4l2_buf_type type) |
793 | { | 793 | { |
794 | struct fimc_lite *fimc = video_drvdata(file); | 794 | struct fimc_lite *fimc = video_drvdata(file); |
795 | struct media_entity *entity = &fimc->vfd.entity; | 795 | struct media_entity *entity = &fimc->ve.vdev.entity; |
796 | struct fimc_pipeline *p = &fimc->pipeline; | 796 | struct fimc_pipeline *p = &fimc->pipeline; |
797 | int ret; | 797 | int ret; |
798 | 798 | ||
@@ -830,7 +830,7 @@ static int fimc_lite_streamoff(struct file *file, void *priv, | |||
830 | if (ret < 0) | 830 | if (ret < 0) |
831 | return ret; | 831 | return ret; |
832 | 832 | ||
833 | media_entity_pipeline_stop(&fimc->vfd.entity); | 833 | media_entity_pipeline_stop(&fimc->ve.vdev.entity); |
834 | fimc->streaming = false; | 834 | fimc->streaming = false; |
835 | return 0; | 835 | return 0; |
836 | } | 836 | } |
@@ -1234,7 +1234,7 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd) | |||
1234 | { | 1234 | { |
1235 | struct fimc_lite *fimc = v4l2_get_subdevdata(sd); | 1235 | struct fimc_lite *fimc = v4l2_get_subdevdata(sd); |
1236 | struct vb2_queue *q = &fimc->vb_queue; | 1236 | struct vb2_queue *q = &fimc->vb_queue; |
1237 | struct video_device *vfd = &fimc->vfd; | 1237 | struct video_device *vfd = &fimc->ve.vdev; |
1238 | int ret; | 1238 | int ret; |
1239 | 1239 | ||
1240 | memset(vfd, 0, sizeof(*vfd)); | 1240 | memset(vfd, 0, sizeof(*vfd)); |
@@ -1298,9 +1298,9 @@ static void fimc_lite_subdev_unregistered(struct v4l2_subdev *sd) | |||
1298 | if (fimc == NULL) | 1298 | if (fimc == NULL) |
1299 | return; | 1299 | return; |
1300 | 1300 | ||
1301 | if (video_is_registered(&fimc->vfd)) { | 1301 | if (video_is_registered(&fimc->ve.vdev)) { |
1302 | video_unregister_device(&fimc->vfd); | 1302 | video_unregister_device(&fimc->ve.vdev); |
1303 | media_entity_cleanup(&fimc->vfd.entity); | 1303 | media_entity_cleanup(&fimc->ve.vdev.entity); |
1304 | fimc->pipeline_ops = NULL; | 1304 | fimc->pipeline_ops = NULL; |
1305 | } | 1305 | } |
1306 | } | 1306 | } |
@@ -1548,7 +1548,7 @@ static int fimc_lite_resume(struct device *dev) | |||
1548 | 1548 | ||
1549 | INIT_LIST_HEAD(&fimc->active_buf_q); | 1549 | INIT_LIST_HEAD(&fimc->active_buf_q); |
1550 | fimc_pipeline_call(fimc, open, &fimc->pipeline, | 1550 | fimc_pipeline_call(fimc, open, &fimc->pipeline, |
1551 | &fimc->vfd.entity, false); | 1551 | &fimc->ve.vdev.entity, false); |
1552 | fimc_lite_hw_init(fimc, atomic_read(&fimc->out_path) == FIMC_IO_ISP); | 1552 | fimc_lite_hw_init(fimc, atomic_read(&fimc->out_path) == FIMC_IO_ISP); |
1553 | clear_bit(ST_FLITE_SUSPENDED, &fimc->state); | 1553 | clear_bit(ST_FLITE_SUSPENDED, &fimc->state); |
1554 | 1554 | ||
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.h b/drivers/media/platform/exynos4-is/fimc-lite.h index 47da5e049247..fa3886a297ba 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.h +++ b/drivers/media/platform/exynos4-is/fimc-lite.h | |||
@@ -95,8 +95,8 @@ struct flite_buffer { | |||
95 | * struct fimc_lite - fimc lite structure | 95 | * struct fimc_lite - fimc lite structure |
96 | * @pdev: pointer to FIMC-LITE platform device | 96 | * @pdev: pointer to FIMC-LITE platform device |
97 | * @dd: SoC specific driver data structure | 97 | * @dd: SoC specific driver data structure |
98 | * @ve: exynos video device entity structure | ||
98 | * @v4l2_dev: pointer to top the level v4l2_device | 99 | * @v4l2_dev: pointer to top the level v4l2_device |
99 | * @vfd: video device node | ||
100 | * @fh: v4l2 file handle | 100 | * @fh: v4l2 file handle |
101 | * @alloc_ctx: videobuf2 memory allocator context | 101 | * @alloc_ctx: videobuf2 memory allocator context |
102 | * @subdev: FIMC-LITE subdev | 102 | * @subdev: FIMC-LITE subdev |
@@ -130,8 +130,8 @@ struct flite_buffer { | |||
130 | struct fimc_lite { | 130 | struct fimc_lite { |
131 | struct platform_device *pdev; | 131 | struct platform_device *pdev; |
132 | struct flite_drvdata *dd; | 132 | struct flite_drvdata *dd; |
133 | struct exynos_video_entity ve; | ||
133 | struct v4l2_device *v4l2_dev; | 134 | struct v4l2_device *v4l2_dev; |
134 | struct video_device vfd; | ||
135 | struct v4l2_fh fh; | 135 | struct v4l2_fh fh; |
136 | struct vb2_alloc_ctx *alloc_ctx; | 136 | struct vb2_alloc_ctx *alloc_ctx; |
137 | struct v4l2_subdev subdev; | 137 | struct v4l2_subdev subdev; |
diff --git a/drivers/media/platform/exynos4-is/fimc-reg.c b/drivers/media/platform/exynos4-is/fimc-reg.c index f079f36099de..1db8cb4c46ef 100644 --- a/drivers/media/platform/exynos4-is/fimc-reg.c +++ b/drivers/media/platform/exynos4-is/fimc-reg.c | |||
@@ -618,7 +618,7 @@ int fimc_hw_set_camera_source(struct fimc_dev *fimc, | |||
618 | } | 618 | } |
619 | 619 | ||
620 | if (i == ARRAY_SIZE(pix_desc)) { | 620 | if (i == ARRAY_SIZE(pix_desc)) { |
621 | v4l2_err(&vc->vfd, | 621 | v4l2_err(&vc->ve.vdev, |
622 | "Camera color format not supported: %d\n", | 622 | "Camera color format not supported: %d\n", |
623 | vc->ci_fmt.code); | 623 | vc->ci_fmt.code); |
624 | return -EINVAL; | 624 | return -EINVAL; |
@@ -698,7 +698,7 @@ int fimc_hw_set_camera_type(struct fimc_dev *fimc, | |||
698 | cfg |= FIMC_REG_CIGCTRL_CAM_JPEG; | 698 | cfg |= FIMC_REG_CIGCTRL_CAM_JPEG; |
699 | break; | 699 | break; |
700 | default: | 700 | default: |
701 | v4l2_err(&vid_cap->vfd, | 701 | v4l2_err(&vid_cap->ve.vdev, |
702 | "Not supported camera pixel format: %#x\n", | 702 | "Not supported camera pixel format: %#x\n", |
703 | vid_cap->ci_fmt.code); | 703 | vid_cap->ci_fmt.code); |
704 | return -EINVAL; | 704 | return -EINVAL; |
@@ -721,7 +721,8 @@ int fimc_hw_set_camera_type(struct fimc_dev *fimc, | |||
721 | WARN_ONCE(1, "ISP Writeback input is not supported\n"); | 721 | WARN_ONCE(1, "ISP Writeback input is not supported\n"); |
722 | break; | 722 | break; |
723 | default: | 723 | default: |
724 | v4l2_err(&vid_cap->vfd, "Invalid FIMC bus type selected: %d\n", | 724 | v4l2_err(&vid_cap->ve.vdev, |
725 | "Invalid FIMC bus type selected: %d\n", | ||
725 | source->fimc_bus_type); | 726 | source->fimc_bus_type); |
726 | return -EINVAL; | 727 | return -EINVAL; |
727 | } | 728 | } |
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 396e06e14a17..c20b2728d55b 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c | |||
@@ -929,7 +929,7 @@ static int __fimc_md_create_flite_source_links(struct fimc_md *fmd) | |||
929 | continue; | 929 | continue; |
930 | 930 | ||
931 | source = &fimc->subdev.entity; | 931 | source = &fimc->subdev.entity; |
932 | sink = &fimc->vfd.entity; | 932 | sink = &fimc->ve.vdev.entity; |
933 | /* FIMC-LITE's subdev and video node */ | 933 | /* FIMC-LITE's subdev and video node */ |
934 | ret = media_entity_create_link(source, FLITE_SD_PAD_SOURCE_DMA, | 934 | ret = media_entity_create_link(source, FLITE_SD_PAD_SOURCE_DMA, |
935 | sink, 0, 0); | 935 | sink, 0, 0); |
@@ -1066,7 +1066,7 @@ static int fimc_md_create_links(struct fimc_md *fmd) | |||
1066 | continue; | 1066 | continue; |
1067 | 1067 | ||
1068 | source = &fmd->fimc[i]->vid_cap.subdev.entity; | 1068 | source = &fmd->fimc[i]->vid_cap.subdev.entity; |
1069 | sink = &fmd->fimc[i]->vid_cap.vfd.entity; | 1069 | sink = &fmd->fimc[i]->vid_cap.ve.vdev.entity; |
1070 | 1070 | ||
1071 | ret = media_entity_create_link(source, FIMC_SD_PAD_SOURCE, | 1071 | ret = media_entity_create_link(source, FIMC_SD_PAD_SOURCE, |
1072 | sink, 0, flags); | 1072 | sink, 0, flags); |
diff --git a/drivers/media/platform/exynos4-is/media-dev.h b/drivers/media/platform/exynos4-is/media-dev.h index 44d86b61d660..3e9680c9de8b 100644 --- a/drivers/media/platform/exynos4-is/media-dev.h +++ b/drivers/media/platform/exynos4-is/media-dev.h | |||
@@ -127,14 +127,14 @@ static inline struct fimc_md *entity_to_fimc_mdev(struct media_entity *me) | |||
127 | container_of(me->parent, struct fimc_md, media_dev); | 127 | container_of(me->parent, struct fimc_md, media_dev); |
128 | } | 128 | } |
129 | 129 | ||
130 | static inline void fimc_md_graph_lock(struct fimc_dev *fimc) | 130 | static inline void fimc_md_graph_lock(struct exynos_video_entity *ve) |
131 | { | 131 | { |
132 | mutex_lock(&fimc->vid_cap.vfd.entity.parent->graph_mutex); | 132 | mutex_lock(&ve->vdev.entity.parent->graph_mutex); |
133 | } | 133 | } |
134 | 134 | ||
135 | static inline void fimc_md_graph_unlock(struct fimc_dev *fimc) | 135 | static inline void fimc_md_graph_unlock(struct exynos_video_entity *ve) |
136 | { | 136 | { |
137 | mutex_unlock(&fimc->vid_cap.vfd.entity.parent->graph_mutex); | 137 | mutex_unlock(&ve->vdev.entity.parent->graph_mutex); |
138 | } | 138 | } |
139 | 139 | ||
140 | int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on); | 140 | int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on); |
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h index f50969025ef3..f5313b402eb7 100644 --- a/include/media/s5p_fimc.h +++ b/include/media/s5p_fimc.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define S5P_FIMC_H_ | 13 | #define S5P_FIMC_H_ |
14 | 14 | ||
15 | #include <media/media-entity.h> | 15 | #include <media/media-entity.h> |
16 | #include <media/v4l2-dev.h> | ||
16 | #include <media/v4l2-mediabus.h> | 17 | #include <media/v4l2-mediabus.h> |
17 | 18 | ||
18 | /* | 19 | /* |
@@ -157,6 +158,10 @@ struct fimc_pipeline { | |||
157 | struct media_pipeline *m_pipeline; | 158 | struct media_pipeline *m_pipeline; |
158 | }; | 159 | }; |
159 | 160 | ||
161 | struct exynos_video_entity { | ||
162 | struct video_device vdev; | ||
163 | }; | ||
164 | |||
160 | /* | 165 | /* |
161 | * Media pipeline operations to be called from within the fimc(-lite) | 166 | * Media pipeline operations to be called from within the fimc(-lite) |
162 | * video node when it is the last entity of the pipeline. Implemented | 167 | * video node when it is the last entity of the pipeline. Implemented |