mfd: wm8350-i2c: Make sure the i2c regmap functions are compiled
[linux/fpc-iii.git] / drivers / media / platform / vsp1 / vsp1_video.h
blob47b7a8ab5e2f41a1916e06b3723a8c2283a4bd70
1 /*
2 * vsp1_video.h -- R-Car VSP1 Video Node
4 * Copyright (C) 2013 Renesas Corporation
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 #ifndef __VSP1_VIDEO_H__
14 #define __VSP1_VIDEO_H__
16 #include <linux/list.h>
17 #include <linux/spinlock.h>
18 #include <linux/wait.h>
20 #include <media/media-entity.h>
21 #include <media/videobuf2-core.h>
23 struct vsp1_video;
26 * struct vsp1_format_info - VSP1 video format description
27 * @mbus: media bus format code
28 * @fourcc: V4L2 pixel format FCC identifier
29 * @planes: number of planes
30 * @bpp: bits per pixel
31 * @hwfmt: VSP1 hardware format
32 * @swap_yc: the Y and C components are swapped (Y comes before C)
33 * @swap_uv: the U and V components are swapped (V comes before U)
34 * @hsub: horizontal subsampling factor
35 * @vsub: vertical subsampling factor
37 struct vsp1_format_info {
38 u32 fourcc;
39 unsigned int mbus;
40 unsigned int hwfmt;
41 unsigned int swap;
42 unsigned int planes;
43 unsigned int bpp[3];
44 bool swap_yc;
45 bool swap_uv;
46 unsigned int hsub;
47 unsigned int vsub;
50 enum vsp1_pipeline_state {
51 VSP1_PIPELINE_STOPPED,
52 VSP1_PIPELINE_RUNNING,
53 VSP1_PIPELINE_STOPPING,
57 * struct vsp1_pipeline - A VSP1 hardware pipeline
58 * @media: the media pipeline
59 * @irqlock: protects the pipeline state
60 * @lock: protects the pipeline use count and stream count
62 struct vsp1_pipeline {
63 struct media_pipeline pipe;
65 spinlock_t irqlock;
66 enum vsp1_pipeline_state state;
67 wait_queue_head_t wq;
69 struct mutex lock;
70 unsigned int use_count;
71 unsigned int stream_count;
72 unsigned int buffers_ready;
74 unsigned int num_video;
75 unsigned int num_inputs;
76 struct vsp1_rwpf *inputs[VPS1_MAX_RPF];
77 struct vsp1_rwpf *output;
78 struct vsp1_entity *lif;
80 struct list_head entities;
83 static inline struct vsp1_pipeline *to_vsp1_pipeline(struct media_entity *e)
85 if (likely(e->pipe))
86 return container_of(e->pipe, struct vsp1_pipeline, pipe);
87 else
88 return NULL;
91 struct vsp1_video_buffer {
92 struct vb2_buffer buf;
93 struct list_head queue;
95 dma_addr_t addr[3];
96 unsigned int length[3];
99 static inline struct vsp1_video_buffer *
100 to_vsp1_video_buffer(struct vb2_buffer *vb)
102 return container_of(vb, struct vsp1_video_buffer, buf);
105 struct vsp1_video_operations {
106 void (*queue)(struct vsp1_video *video, struct vsp1_video_buffer *buf);
109 struct vsp1_video {
110 struct vsp1_device *vsp1;
111 struct vsp1_entity *rwpf;
113 const struct vsp1_video_operations *ops;
115 struct video_device video;
116 enum v4l2_buf_type type;
117 struct media_pad pad;
119 struct mutex lock;
120 struct v4l2_pix_format_mplane format;
121 const struct vsp1_format_info *fmtinfo;
123 struct vsp1_pipeline pipe;
124 unsigned int pipe_index;
126 struct vb2_queue queue;
127 void *alloc_ctx;
128 spinlock_t irqlock;
129 struct list_head irqqueue;
130 unsigned int sequence;
133 static inline struct vsp1_video *to_vsp1_video(struct video_device *vdev)
135 return container_of(vdev, struct vsp1_video, video);
138 int vsp1_video_init(struct vsp1_video *video, struct vsp1_entity *rwpf);
139 void vsp1_video_cleanup(struct vsp1_video *video);
141 void vsp1_pipeline_frame_end(struct vsp1_pipeline *pipe);
143 #endif /* __VSP1_VIDEO_H__ */