msm: mpq8064: Add Video processing driver block for VCAP
Adding VP portion to MSM VCAP. VP is used for deinterlacing video.
Change-Id: I888e841cf4d65cf1e5b0316db16923c914469235
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
diff --git a/include/media/vcap_fmt.h b/include/media/vcap_fmt.h
index e69f9b0..51b45ac 100644
--- a/include/media/vcap_fmt.h
+++ b/include/media/vcap_fmt.h
@@ -70,6 +70,7 @@
enum vcap_type type;
union {
struct v4l2_format_vc_ext timing;
+ struct v4l2_pix_format pix;
/* Once VP is created there will be another type in here */
} u;
};
diff --git a/include/media/vcap_v4l2.h b/include/media/vcap_v4l2.h
index 57f9703..374e681 100644
--- a/include/media/vcap_v4l2.h
+++ b/include/media/vcap_v4l2.h
@@ -14,6 +14,7 @@
#ifndef VCAP_V4L2_H
#define VCAP_V4L2_H
+#define TOP_FIELD_FIX
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/videodev2.h>
@@ -28,6 +29,12 @@
#include <media/vcap_fmt.h>
#include <mach/board.h>
+#define writel_iowmb(val, addr) \
+ do { \
+ __iowmb(); \
+ writel_relaxed(val, addr); \
+ } while (0)
+
struct vcap_client_data;
enum rdy_buf {
@@ -37,11 +44,34 @@
VC_BUF1N2 = 0x11 << 1,
};
+enum vp_state {
+ VP_UNKNOWN = 0,
+ VP_FRAME1,
+ VP_FRAME2,
+ VP_FRAME3,
+ VP_NORMAL,
+};
+
+enum nr_buf_pos {
+ BUF_NOT_IN_USE = 0,
+ NRT2_BUF,
+ T1_BUF,
+ T0_BUF,
+ TM1_BUF,
+};
+
struct vcap_buf_info {
unsigned long vaddr;
unsigned long size;
};
+enum vcap_op_mode {
+ UNKNOWN_VCAP_OP = 0,
+ VC_VCAP_OP,
+ VP_VCAP_OP,
+ VC_AND_VP_VCAP_OP,
+};
+
struct vcap_action {
struct list_head active;
@@ -61,13 +91,50 @@
int ini_jiffies;
};
+struct nr_buffer {
+ void *vaddr;
+ unsigned long paddr;
+ enum nr_buf_pos nr_pos;
+};
+
+struct vp_action {
+ struct list_head in_active;
+ struct list_head out_active;
+
+ /* Buffer index */
+ enum vp_state vp_state;
+#ifdef TOP_FIELD_FIX
+ bool top_field;
+#endif
+
+ /* Buffers inside vc */
+ struct vcap_buffer *bufTm1;
+ struct vcap_buffer *bufT0;
+ struct vcap_buffer *bufT1;
+ struct vcap_buffer *bufT2;
+ struct vcap_buffer *bufNRT2;
+
+ struct vcap_buffer *bufOut;
+
+ void *bufMotion;
+ struct nr_buffer bufNR;
+ bool nr_enabled;
+};
+
+struct vp_work_t {
+ struct work_struct work;
+ struct vcap_client_data *cd;
+ uint32_t irq;
+};
+
struct vcap_dev {
struct v4l2_device v4l2_dev;
struct video_device *vfd;
struct ion_client *ion_client;
- struct resource *vcapirq;
+ struct resource *vcirq;
+ struct resource *vpirq;
struct resource *vcapmem;
struct resource *vcapio;
@@ -87,15 +154,20 @@
struct vcap_client_data *vp_client;
atomic_t vc_enabled;
+ atomic_t vp_enabled;
+
atomic_t vc_resource;
atomic_t vp_resource;
+
+ struct workqueue_struct *vcap_wq;
+ struct vp_work_t vp_work;
+ struct vp_work_t vc_to_vp_work;
+ struct vp_work_t vp_to_vc_work;
};
struct vp_format_data {
unsigned int width, height;
- unsigned int pixelformat;
- enum v4l2_field field;
-
+ unsigned int pixfmt;
};
struct vcap_buffer {
@@ -107,18 +179,23 @@
};
struct vcap_client_data {
+ bool set_cap, set_decode, set_vp_o;
struct vcap_dev *dev;
struct vb2_queue vc_vidq;
- /*struct vb2_queue vb__vidq;*/
- /*struct vb2_queue vb_cap_vidq;*/
+ struct vb2_queue vp_in_vidq;
+ struct vb2_queue vp_out_vidq;
+
+ enum vcap_op_mode op_mode;
struct v4l2_format_vc_ext vc_format;
enum v4l2_buf_type vp_buf_type_field;
- struct vp_format_data vp_format;
+ struct vp_format_data vp_in_fmt;
+ struct vp_format_data vp_out_fmt;
struct vcap_action vid_vc_action;
+ struct vp_action vid_vp_action;
struct workqueue_struct *vcap_work_q;
struct ion_handle *vc_ion_handle;
@@ -126,7 +203,20 @@
uint32_t hold_vp;
spinlock_t cap_slock;
+ bool streaming;
};
+struct vcap_hacked_vals {
+ uint32_t value;
+ uint32_t offset;
+};
+
+extern struct vcap_hacked_vals hacked_buf[];
+
#endif
+int free_ion_handle(struct vcap_dev *dev, struct vb2_queue *q,
+ struct v4l2_buffer *b);
+
+int get_phys_addr(struct vcap_dev *dev, struct vb2_queue *q,
+ struct v4l2_buffer *b);
#endif