aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/s5p-fimc/fimc-core.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/s5p-fimc/fimc-core.h')
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.h48
1 files changed, 19 insertions, 29 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h
index 4f047d35f8a..590fbf23079 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.h
+++ b/drivers/media/video/s5p-fimc/fimc-core.h
@@ -16,7 +16,8 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/videodev2.h> 18#include <linux/videodev2.h>
19#include <media/videobuf-core.h> 19#include <linux/io.h>
20#include <media/videobuf2-core.h>
20#include <media/v4l2-device.h> 21#include <media/v4l2-device.h>
21#include <media/v4l2-mem2mem.h> 22#include <media/v4l2-mem2mem.h>
22#include <media/v4l2-mediabus.h> 23#include <media/v4l2-mediabus.h>
@@ -70,13 +71,6 @@ enum fimc_dev_flags {
70#define fimc_capture_streaming(dev) \ 71#define fimc_capture_streaming(dev) \
71 test_bit(ST_CAPT_STREAM, &(dev)->state) 72 test_bit(ST_CAPT_STREAM, &(dev)->state)
72 73
73#define fimc_buf_finish(dev, vid_buf) do { \
74 spin_lock(&(dev)->irqlock); \
75 (vid_buf)->vb.state = VIDEOBUF_DONE; \
76 spin_unlock(&(dev)->irqlock); \
77 wake_up(&(vid_buf)->vb.done); \
78} while (0)
79
80enum fimc_datapath { 74enum fimc_datapath {
81 FIMC_CAMERA, 75 FIMC_CAMERA,
82 FIMC_DMA, 76 FIMC_DMA,
@@ -260,7 +254,8 @@ struct fimc_addr {
260 * @index: buffer index for the output DMA engine 254 * @index: buffer index for the output DMA engine
261 */ 255 */
262struct fimc_vid_buffer { 256struct fimc_vid_buffer {
263 struct videobuf_buffer vb; 257 struct vb2_buffer vb;
258 struct list_head list;
264 struct fimc_addr paddr; 259 struct fimc_addr paddr;
265 int index; 260 int index;
266}; 261};
@@ -331,13 +326,14 @@ struct fimc_m2m_device {
331 */ 326 */
332struct fimc_vid_cap { 327struct fimc_vid_cap {
333 struct fimc_ctx *ctx; 328 struct fimc_ctx *ctx;
329 struct vb2_alloc_ctx *alloc_ctx;
334 struct video_device *vfd; 330 struct video_device *vfd;
335 struct v4l2_device v4l2_dev; 331 struct v4l2_device v4l2_dev;
336 struct v4l2_subdev *sd; 332 struct v4l2_subdev *sd;;
337 struct v4l2_mbus_framefmt fmt; 333 struct v4l2_mbus_framefmt fmt;
338 struct list_head pending_buf_q; 334 struct list_head pending_buf_q;
339 struct list_head active_buf_q; 335 struct list_head active_buf_q;
340 struct videobuf_queue vbq; 336 struct vb2_queue vbq;
341 int active_buf_cnt; 337 int active_buf_cnt;
342 int buf_index; 338 int buf_index;
343 unsigned int frame_count; 339 unsigned int frame_count;
@@ -417,7 +413,6 @@ struct fimc_ctx;
417 * @regs: the mapped hardware registers 413 * @regs: the mapped hardware registers
418 * @regs_res: the resource claimed for IO registers 414 * @regs_res: the resource claimed for IO registers
419 * @irq: interrupt number of the FIMC subdevice 415 * @irq: interrupt number of the FIMC subdevice
420 * @irqlock: spinlock protecting videobuffer queue
421 * @irq_queue: 416 * @irq_queue:
422 * @m2m: memory-to-memory V4L2 device information 417 * @m2m: memory-to-memory V4L2 device information
423 * @vid_cap: camera capture device information 418 * @vid_cap: camera capture device information
@@ -434,11 +429,11 @@ struct fimc_dev {
434 void __iomem *regs; 429 void __iomem *regs;
435 struct resource *regs_res; 430 struct resource *regs_res;
436 int irq; 431 int irq;
437 spinlock_t irqlock;
438 wait_queue_head_t irq_queue; 432 wait_queue_head_t irq_queue;
439 struct fimc_m2m_device m2m; 433 struct fimc_m2m_device m2m;
440 struct fimc_vid_cap vid_cap; 434 struct fimc_vid_cap vid_cap;
441 unsigned long state; 435 unsigned long state;
436 struct vb2_alloc_ctx *alloc_ctx;
442}; 437};
443 438
444/** 439/**
@@ -482,8 +477,6 @@ struct fimc_ctx {
482 struct v4l2_m2m_ctx *m2m_ctx; 477 struct v4l2_m2m_ctx *m2m_ctx;
483}; 478};
484 479
485extern struct videobuf_queue_ops fimc_qops;
486
487static inline int tiled_fmt(struct fimc_fmt *fmt) 480static inline int tiled_fmt(struct fimc_fmt *fmt)
488{ 481{
489 return 0; 482 return 0;
@@ -622,7 +615,7 @@ struct fimc_fmt *find_mbus_format(struct v4l2_mbus_framefmt *f,
622int fimc_check_scaler_ratio(struct v4l2_rect *r, struct fimc_frame *f); 615int fimc_check_scaler_ratio(struct v4l2_rect *r, struct fimc_frame *f);
623int fimc_set_scaler_info(struct fimc_ctx *ctx); 616int fimc_set_scaler_info(struct fimc_ctx *ctx);
624int fimc_prepare_config(struct fimc_ctx *ctx, u32 flags); 617int fimc_prepare_config(struct fimc_ctx *ctx, u32 flags);
625int fimc_prepare_addr(struct fimc_ctx *ctx, struct fimc_vid_buffer *buf, 618int fimc_prepare_addr(struct fimc_ctx *ctx, struct vb2_buffer *vb,
626 struct fimc_frame *frame, struct fimc_addr *paddr); 619 struct fimc_frame *frame, struct fimc_addr *paddr);
627 620
628/* -----------------------------------------------------*/ 621/* -----------------------------------------------------*/
@@ -649,28 +642,27 @@ static inline void fimc_deactivate_capture(struct fimc_dev *fimc)
649} 642}
650 643
651/* 644/*
652 * Add video buffer to the active buffers queue. 645 * Add buf to the capture active buffers queue.
653 * The caller holds irqlock spinlock. 646 * Locking: Need to be called with fimc_dev::slock held.
654 */ 647 */
655static inline void active_queue_add(struct fimc_vid_cap *vid_cap, 648static inline void active_queue_add(struct fimc_vid_cap *vid_cap,
656 struct fimc_vid_buffer *buf) 649 struct fimc_vid_buffer *buf)
657{ 650{
658 buf->vb.state = VIDEOBUF_ACTIVE; 651 list_add_tail(&buf->list, &vid_cap->active_buf_q);
659 list_add_tail(&buf->vb.queue, &vid_cap->active_buf_q);
660 vid_cap->active_buf_cnt++; 652 vid_cap->active_buf_cnt++;
661} 653}
662 654
663/* 655/*
664 * Pop a video buffer from the capture active buffers queue 656 * Pop a video buffer from the capture active buffers queue
665 * Locking: Need to be called with dev->slock held. 657 * Locking: Need to be called with fimc_dev::slock held.
666 */ 658 */
667static inline struct fimc_vid_buffer * 659static inline struct fimc_vid_buffer *
668active_queue_pop(struct fimc_vid_cap *vid_cap) 660active_queue_pop(struct fimc_vid_cap *vid_cap)
669{ 661{
670 struct fimc_vid_buffer *buf; 662 struct fimc_vid_buffer *buf;
671 buf = list_entry(vid_cap->active_buf_q.next, 663 buf = list_entry(vid_cap->active_buf_q.next,
672 struct fimc_vid_buffer, vb.queue); 664 struct fimc_vid_buffer, list);
673 list_del(&buf->vb.queue); 665 list_del(&buf->list);
674 vid_cap->active_buf_cnt--; 666 vid_cap->active_buf_cnt--;
675 return buf; 667 return buf;
676} 668}
@@ -679,8 +671,7 @@ active_queue_pop(struct fimc_vid_cap *vid_cap)
679static inline void fimc_pending_queue_add(struct fimc_vid_cap *vid_cap, 671static inline void fimc_pending_queue_add(struct fimc_vid_cap *vid_cap,
680 struct fimc_vid_buffer *buf) 672 struct fimc_vid_buffer *buf)
681{ 673{
682 buf->vb.state = VIDEOBUF_QUEUED; 674 list_add_tail(&buf->list, &vid_cap->pending_buf_q);
683 list_add_tail(&buf->vb.queue, &vid_cap->pending_buf_q);
684} 675}
685 676
686/* Add video buffer to the capture pending buffers queue */ 677/* Add video buffer to the capture pending buffers queue */
@@ -689,10 +680,9 @@ pending_queue_pop(struct fimc_vid_cap *vid_cap)
689{ 680{
690 struct fimc_vid_buffer *buf; 681 struct fimc_vid_buffer *buf;
691 buf = list_entry(vid_cap->pending_buf_q.next, 682 buf = list_entry(vid_cap->pending_buf_q.next,
692 struct fimc_vid_buffer, vb.queue); 683 struct fimc_vid_buffer, list);
693 list_del(&buf->vb.queue); 684 list_del(&buf->list);
694 return buf; 685 return buf;
695} 686}
696 687
697
698#endif /* FIMC_CORE_H_ */ 688#endif /* FIMC_CORE_H_ */