aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/s5p-mfc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 12:58:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 12:58:16 -0400
commit240c3c3424366c8109babd2a0fe80855de511b35 (patch)
tree72eb8652c8e513715efee1e254644b4b670333fd /drivers/media/platform/s5p-mfc
parent19b344efa35dbc253e2d10403dafe6aafda73c56 (diff)
parentdf90e2258950fd631cdbf322c1ee1f22068391aa (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media update from Mauro Carvalho Chehab: - OF documentation and patches at core and drivers, to be used by for embedded media systems - some I2C drivers used on go7007 were rewritten/promoted from staging: sony-btf-mpx, tw2804, tw9903, tw9906, wis-ov7640, wis-uda1342 - add fimc-is driver (Exynos) - add a new radio driver: radio-si476x - add a two new tuners: r820t and tuner_it913x - split camera code on em28xx driver and add more models - the cypress firmware load is used outside dvb usb drivers. So, move it to a common directory to make easier to re-use it - siano media driver updated to work with sms2270 devices - several work done in order to promote go7007 and solo6x1x out of staging (still, there are some pending issues) - several API compliance fixes at v4l2 drivers that don't behave as expected - as usual, lots of driver fixes, improvements, cleanups and new device addition at the existing drivers. * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (831 commits) [media] cx88: make core less verbose [media] em28xx: fix oops at em28xx_dvb_bus_ctrl() [media] s5c73m3: fix indentation of the help section in Kconfig [media] cx25821-alsa: get rid of a __must_check warning [media] cx25821-video: declare cx25821_vidioc_s_std as static [media] cx25821-video: remove maxw from cx25821_vidioc_try_fmt_vid_cap [media] r820t: Remove a warning for an unused value [media] dib0090: Fix a warning at dib0090_set_EFUSE [media] dib8000: fix a warning [media] dib8000: Fix sub-channel range [media] dib8000: store dtv_property_cache in a temp var [media] dib8000: warning fix: declare internal functions as static [media] r820t: quiet gcc warning on n_ring [media] r820t: memory leak in release() [media] r820t: precendence bug in r820t_xtal_check() [media] videodev2.h: Remove the unused old V4L1 buffer types [media] anysee: Grammar s/report the/report to/ [media] anysee: Initialize ret = 0 in anysee_frontend_attach() [media] media: videobuf2: fix the length check for mmap [media] em28xx: save isoc endpoint number for DVB only if endpoint has alt settings with xMaxPacketSize != 0 ...
Diffstat (limited to 'drivers/media/platform/s5p-mfc')
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc.c19
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c12
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c12
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_dec.c76
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c112
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c122
6 files changed, 222 insertions, 131 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 1cb6d57987c6..01f9ae0dadb0 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -243,12 +243,10 @@ static void s5p_mfc_handle_frame_copy_time(struct s5p_mfc_ctx *ctx)
243 src_buf = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); 243 src_buf = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
244 list_for_each_entry(dst_buf, &ctx->dst_queue, list) { 244 list_for_each_entry(dst_buf, &ctx->dst_queue, list) {
245 if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dec_y_addr) { 245 if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dec_y_addr) {
246 memcpy(&dst_buf->b->v4l2_buf.timecode, 246 dst_buf->b->v4l2_buf.timecode =
247 &src_buf->b->v4l2_buf.timecode, 247 src_buf->b->v4l2_buf.timecode;
248 sizeof(struct v4l2_timecode)); 248 dst_buf->b->v4l2_buf.timestamp =
249 memcpy(&dst_buf->b->v4l2_buf.timestamp, 249 src_buf->b->v4l2_buf.timestamp;
250 &src_buf->b->v4l2_buf.timestamp,
251 sizeof(struct timeval));
252 switch (frame_type) { 250 switch (frame_type) {
253 case S5P_FIMV_DECODE_FRAME_I_FRAME: 251 case S5P_FIMV_DECODE_FRAME_I_FRAME:
254 dst_buf->b->v4l2_buf.flags |= 252 dst_buf->b->v4l2_buf.flags |=
@@ -386,6 +384,8 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
386 } else { 384 } else {
387 mfc_debug(2, "MFC needs next buffer\n"); 385 mfc_debug(2, "MFC needs next buffer\n");
388 ctx->consumed_stream = 0; 386 ctx->consumed_stream = 0;
387 if (src_buf->flags & MFC_BUF_FLAG_EOS)
388 ctx->state = MFCINST_FINISHING;
389 list_del(&src_buf->list); 389 list_del(&src_buf->list);
390 ctx->src_queue_cnt--; 390 ctx->src_queue_cnt--;
391 if (s5p_mfc_hw_call(dev->mfc_ops, err_dec, err) > 0) 391 if (s5p_mfc_hw_call(dev->mfc_ops, err_dec, err) > 0)
@@ -804,6 +804,7 @@ static int s5p_mfc_open(struct file *file)
804 goto err_queue_init; 804 goto err_queue_init;
805 } 805 }
806 q->mem_ops = (struct vb2_mem_ops *)&vb2_dma_contig_memops; 806 q->mem_ops = (struct vb2_mem_ops *)&vb2_dma_contig_memops;
807 q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
807 ret = vb2_queue_init(q); 808 ret = vb2_queue_init(q);
808 if (ret) { 809 if (ret) {
809 mfc_err("Failed to initialize videobuf2 queue(capture)\n"); 810 mfc_err("Failed to initialize videobuf2 queue(capture)\n");
@@ -825,6 +826,7 @@ static int s5p_mfc_open(struct file *file)
825 goto err_queue_init; 826 goto err_queue_init;
826 } 827 }
827 q->mem_ops = (struct vb2_mem_ops *)&vb2_dma_contig_memops; 828 q->mem_ops = (struct vb2_mem_ops *)&vb2_dma_contig_memops;
829 q->timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_COPY;
828 ret = vb2_queue_init(q); 830 ret = vb2_queue_init(q);
829 if (ret) { 831 if (ret) {
830 mfc_err("Failed to initialize videobuf2 queue(output)\n"); 832 mfc_err("Failed to initialize videobuf2 queue(output)\n");
@@ -1016,7 +1018,7 @@ static void *mfc_get_drv_data(struct platform_device *pdev);
1016 1018
1017static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev) 1019static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev)
1018{ 1020{
1019 unsigned int mem_info[2]; 1021 unsigned int mem_info[2] = { };
1020 1022
1021 dev->mem_dev_l = devm_kzalloc(&dev->plat_dev->dev, 1023 dev->mem_dev_l = devm_kzalloc(&dev->plat_dev->dev,
1022 sizeof(struct device), GFP_KERNEL); 1024 sizeof(struct device), GFP_KERNEL);
@@ -1106,7 +1108,8 @@ static int s5p_mfc_probe(struct platform_device *pdev)
1106 } 1108 }
1107 1109
1108 if (pdev->dev.of_node) { 1110 if (pdev->dev.of_node) {
1109 if (s5p_mfc_alloc_memdevs(dev) < 0) 1111 ret = s5p_mfc_alloc_memdevs(dev);
1112 if (ret < 0)
1110 goto err_res; 1113 goto err_res;
1111 } else { 1114 } else {
1112 dev->mem_dev_l = device_find_child(&dev->plat_dev->dev, 1115 dev->mem_dev_l = device_find_child(&dev->plat_dev->dev,
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c
index 138778083c63..ad4f1df0a18e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c
@@ -16,7 +16,7 @@
16#include "s5p_mfc_debug.h" 16#include "s5p_mfc_debug.h"
17 17
18/* This function is used to send a command to the MFC */ 18/* This function is used to send a command to the MFC */
19int s5p_mfc_cmd_host2risc_v5(struct s5p_mfc_dev *dev, int cmd, 19static int s5p_mfc_cmd_host2risc_v5(struct s5p_mfc_dev *dev, int cmd,
20 struct s5p_mfc_cmd_args *args) 20 struct s5p_mfc_cmd_args *args)
21{ 21{
22 int cur_cmd; 22 int cur_cmd;
@@ -41,7 +41,7 @@ int s5p_mfc_cmd_host2risc_v5(struct s5p_mfc_dev *dev, int cmd,
41} 41}
42 42
43/* Initialize the MFC */ 43/* Initialize the MFC */
44int s5p_mfc_sys_init_cmd_v5(struct s5p_mfc_dev *dev) 44static int s5p_mfc_sys_init_cmd_v5(struct s5p_mfc_dev *dev)
45{ 45{
46 struct s5p_mfc_cmd_args h2r_args; 46 struct s5p_mfc_cmd_args h2r_args;
47 47
@@ -52,7 +52,7 @@ int s5p_mfc_sys_init_cmd_v5(struct s5p_mfc_dev *dev)
52} 52}
53 53
54/* Suspend the MFC hardware */ 54/* Suspend the MFC hardware */
55int s5p_mfc_sleep_cmd_v5(struct s5p_mfc_dev *dev) 55static int s5p_mfc_sleep_cmd_v5(struct s5p_mfc_dev *dev)
56{ 56{
57 struct s5p_mfc_cmd_args h2r_args; 57 struct s5p_mfc_cmd_args h2r_args;
58 58
@@ -61,7 +61,7 @@ int s5p_mfc_sleep_cmd_v5(struct s5p_mfc_dev *dev)
61} 61}
62 62
63/* Wake up the MFC hardware */ 63/* Wake up the MFC hardware */
64int s5p_mfc_wakeup_cmd_v5(struct s5p_mfc_dev *dev) 64static int s5p_mfc_wakeup_cmd_v5(struct s5p_mfc_dev *dev)
65{ 65{
66 struct s5p_mfc_cmd_args h2r_args; 66 struct s5p_mfc_cmd_args h2r_args;
67 67
@@ -71,7 +71,7 @@ int s5p_mfc_wakeup_cmd_v5(struct s5p_mfc_dev *dev)
71} 71}
72 72
73 73
74int s5p_mfc_open_inst_cmd_v5(struct s5p_mfc_ctx *ctx) 74static int s5p_mfc_open_inst_cmd_v5(struct s5p_mfc_ctx *ctx)
75{ 75{
76 struct s5p_mfc_dev *dev = ctx->dev; 76 struct s5p_mfc_dev *dev = ctx->dev;
77 struct s5p_mfc_cmd_args h2r_args; 77 struct s5p_mfc_cmd_args h2r_args;
@@ -124,7 +124,7 @@ int s5p_mfc_open_inst_cmd_v5(struct s5p_mfc_ctx *ctx)
124 return ret; 124 return ret;
125} 125}
126 126
127int s5p_mfc_close_inst_cmd_v5(struct s5p_mfc_ctx *ctx) 127static int s5p_mfc_close_inst_cmd_v5(struct s5p_mfc_ctx *ctx)
128{ 128{
129 struct s5p_mfc_dev *dev = ctx->dev; 129 struct s5p_mfc_dev *dev = ctx->dev;
130 struct s5p_mfc_cmd_args h2r_args; 130 struct s5p_mfc_cmd_args h2r_args;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
index 754bfbcb1c43..5708fc3d9b4d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
@@ -17,7 +17,7 @@
17#include "s5p_mfc_intr.h" 17#include "s5p_mfc_intr.h"
18#include "s5p_mfc_opr.h" 18#include "s5p_mfc_opr.h"
19 19
20int s5p_mfc_cmd_host2risc_v6(struct s5p_mfc_dev *dev, int cmd, 20static int s5p_mfc_cmd_host2risc_v6(struct s5p_mfc_dev *dev, int cmd,
21 struct s5p_mfc_cmd_args *args) 21 struct s5p_mfc_cmd_args *args)
22{ 22{
23 mfc_debug(2, "Issue the command: %d\n", cmd); 23 mfc_debug(2, "Issue the command: %d\n", cmd);
@@ -32,7 +32,7 @@ int s5p_mfc_cmd_host2risc_v6(struct s5p_mfc_dev *dev, int cmd,
32 return 0; 32 return 0;
33} 33}
34 34
35int s5p_mfc_sys_init_cmd_v6(struct s5p_mfc_dev *dev) 35static int s5p_mfc_sys_init_cmd_v6(struct s5p_mfc_dev *dev)
36{ 36{
37 struct s5p_mfc_cmd_args h2r_args; 37 struct s5p_mfc_cmd_args h2r_args;
38 struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv; 38 struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;
@@ -44,7 +44,7 @@ int s5p_mfc_sys_init_cmd_v6(struct s5p_mfc_dev *dev)
44 &h2r_args); 44 &h2r_args);
45} 45}
46 46
47int s5p_mfc_sleep_cmd_v6(struct s5p_mfc_dev *dev) 47static int s5p_mfc_sleep_cmd_v6(struct s5p_mfc_dev *dev)
48{ 48{
49 struct s5p_mfc_cmd_args h2r_args; 49 struct s5p_mfc_cmd_args h2r_args;
50 50
@@ -53,7 +53,7 @@ int s5p_mfc_sleep_cmd_v6(struct s5p_mfc_dev *dev)
53 &h2r_args); 53 &h2r_args);
54} 54}
55 55
56int s5p_mfc_wakeup_cmd_v6(struct s5p_mfc_dev *dev) 56static int s5p_mfc_wakeup_cmd_v6(struct s5p_mfc_dev *dev)
57{ 57{
58 struct s5p_mfc_cmd_args h2r_args; 58 struct s5p_mfc_cmd_args h2r_args;
59 59
@@ -63,7 +63,7 @@ int s5p_mfc_wakeup_cmd_v6(struct s5p_mfc_dev *dev)
63} 63}
64 64
65/* Open a new instance and get its number */ 65/* Open a new instance and get its number */
66int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx) 66static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
67{ 67{
68 struct s5p_mfc_dev *dev = ctx->dev; 68 struct s5p_mfc_dev *dev = ctx->dev;
69 struct s5p_mfc_cmd_args h2r_args; 69 struct s5p_mfc_cmd_args h2r_args;
@@ -121,7 +121,7 @@ int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
121} 121}
122 122
123/* Close instance */ 123/* Close instance */
124int s5p_mfc_close_inst_cmd_v6(struct s5p_mfc_ctx *ctx) 124static int s5p_mfc_close_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
125{ 125{
126 struct s5p_mfc_dev *dev = ctx->dev; 126 struct s5p_mfc_dev *dev = ctx->dev;
127 struct s5p_mfc_cmd_args h2r_args; 127 struct s5p_mfc_cmd_args h2r_args;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 4582473978ca..4af53bd2f182 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -22,6 +22,7 @@
22#include <linux/videodev2.h> 22#include <linux/videodev2.h>
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <media/v4l2-ctrls.h> 24#include <media/v4l2-ctrls.h>
25#include <media/v4l2-event.h>
25#include <media/videobuf2-core.h> 26#include <media/videobuf2-core.h>
26#include "s5p_mfc_common.h" 27#include "s5p_mfc_common.h"
27#include "s5p_mfc_debug.h" 28#include "s5p_mfc_debug.h"
@@ -623,17 +624,27 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
623/* Dequeue a buffer */ 624/* Dequeue a buffer */
624static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) 625static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
625{ 626{
627 const struct v4l2_event ev = {
628 .type = V4L2_EVENT_EOS
629 };
626 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); 630 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
631 int ret;
627 632
628 if (ctx->state == MFCINST_ERROR) { 633 if (ctx->state == MFCINST_ERROR) {
629 mfc_err("Call on DQBUF after unrecoverable error\n"); 634 mfc_err("Call on DQBUF after unrecoverable error\n");
630 return -EIO; 635 return -EIO;
631 } 636 }
632 if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) 637 if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
633 return vb2_dqbuf(&ctx->vq_src, buf, file->f_flags & O_NONBLOCK); 638 ret = vb2_dqbuf(&ctx->vq_src, buf, file->f_flags & O_NONBLOCK);
634 else if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) 639 else if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
635 return vb2_dqbuf(&ctx->vq_dst, buf, file->f_flags & O_NONBLOCK); 640 ret = vb2_dqbuf(&ctx->vq_dst, buf, file->f_flags & O_NONBLOCK);
636 return -EINVAL; 641 if (ret == 0 && ctx->state == MFCINST_FINISHED &&
642 list_empty(&ctx->vq_dst.done_list))
643 v4l2_event_queue_fh(&ctx->fh, &ev);
644 } else {
645 ret = -EINVAL;
646 }
647 return ret;
637} 648}
638 649
639/* Export DMA buffer */ 650/* Export DMA buffer */
@@ -809,6 +820,59 @@ static int vidioc_g_crop(struct file *file, void *priv,
809 return 0; 820 return 0;
810} 821}
811 822
823int vidioc_decoder_cmd(struct file *file, void *priv,
824 struct v4l2_decoder_cmd *cmd)
825{
826 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
827 struct s5p_mfc_dev *dev = ctx->dev;
828 struct s5p_mfc_buf *buf;
829 unsigned long flags;
830
831 switch (cmd->cmd) {
832 case V4L2_ENC_CMD_STOP:
833 if (cmd->flags != 0)
834 return -EINVAL;
835
836 if (!ctx->vq_src.streaming)
837 return -EINVAL;
838
839 spin_lock_irqsave(&dev->irqlock, flags);
840 if (list_empty(&ctx->src_queue)) {
841 mfc_err("EOS: empty src queue, entering finishing state");
842 ctx->state = MFCINST_FINISHING;
843 if (s5p_mfc_ctx_ready(ctx))
844 set_work_bit_irqsave(ctx);
845 spin_unlock_irqrestore(&dev->irqlock, flags);
846 s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
847 } else {
848 mfc_err("EOS: marking last buffer of stream");
849 buf = list_entry(ctx->src_queue.prev,
850 struct s5p_mfc_buf, list);
851 if (buf->flags & MFC_BUF_FLAG_USED)
852 ctx->state = MFCINST_FINISHING;
853 else
854 buf->flags |= MFC_BUF_FLAG_EOS;
855 spin_unlock_irqrestore(&dev->irqlock, flags);
856 }
857 break;
858 default:
859 return -EINVAL;
860 }
861 return 0;
862}
863
864static int vidioc_subscribe_event(struct v4l2_fh *fh,
865 const struct v4l2_event_subscription *sub)
866{
867 switch (sub->type) {
868 case V4L2_EVENT_EOS:
869 return v4l2_event_subscribe(fh, sub, 2, NULL);
870 default:
871 return -EINVAL;
872 }
873}
874
875
812/* v4l2_ioctl_ops */ 876/* v4l2_ioctl_ops */
813static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = { 877static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = {
814 .vidioc_querycap = vidioc_querycap, 878 .vidioc_querycap = vidioc_querycap,
@@ -830,6 +894,9 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = {
830 .vidioc_streamon = vidioc_streamon, 894 .vidioc_streamon = vidioc_streamon,
831 .vidioc_streamoff = vidioc_streamoff, 895 .vidioc_streamoff = vidioc_streamoff,
832 .vidioc_g_crop = vidioc_g_crop, 896 .vidioc_g_crop = vidioc_g_crop,
897 .vidioc_decoder_cmd = vidioc_decoder_cmd,
898 .vidioc_subscribe_event = vidioc_subscribe_event,
899 .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
833}; 900};
834 901
835static int s5p_mfc_queue_setup(struct vb2_queue *vq, 902static int s5p_mfc_queue_setup(struct vb2_queue *vq,
@@ -1147,3 +1214,4 @@ void s5p_mfc_dec_init(struct s5p_mfc_ctx *ctx)
1147 mfc_debug(2, "Default src_fmt is %x, dest_fmt is %x\n", 1214 mfc_debug(2, "Default src_fmt is %x, dest_fmt is %x\n",
1148 (unsigned int)ctx->src_fmt, (unsigned int)ctx->dst_fmt); 1215 (unsigned int)ctx->src_fmt, (unsigned int)ctx->dst_fmt);
1149} 1216}
1217
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
index f61dba837899..0af05a2d1cd4 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
@@ -34,7 +34,7 @@
34#define OFFSETB(x) (((x) - dev->bank2) >> MFC_OFFSET_SHIFT) 34#define OFFSETB(x) (((x) - dev->bank2) >> MFC_OFFSET_SHIFT)
35 35
36/* Allocate temporary buffers for decoding */ 36/* Allocate temporary buffers for decoding */
37int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) 37static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx)
38{ 38{
39 struct s5p_mfc_dev *dev = ctx->dev; 39 struct s5p_mfc_dev *dev = ctx->dev;
40 struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv; 40 struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;
@@ -55,13 +55,13 @@ int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx)
55 55
56 56
57/* Release temporary buffers for decoding */ 57/* Release temporary buffers for decoding */
58void s5p_mfc_release_dec_desc_buffer_v5(struct s5p_mfc_ctx *ctx) 58static void s5p_mfc_release_dec_desc_buffer_v5(struct s5p_mfc_ctx *ctx)
59{ 59{
60 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->dsc); 60 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->dsc);
61} 61}
62 62
63/* Allocate codec buffers */ 63/* Allocate codec buffers */
64int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) 64static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx)
65{ 65{
66 struct s5p_mfc_dev *dev = ctx->dev; 66 struct s5p_mfc_dev *dev = ctx->dev;
67 unsigned int enc_ref_y_size = 0; 67 unsigned int enc_ref_y_size = 0;
@@ -193,14 +193,14 @@ int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx)
193} 193}
194 194
195/* Release buffers allocated for codec */ 195/* Release buffers allocated for codec */
196void s5p_mfc_release_codec_buffers_v5(struct s5p_mfc_ctx *ctx) 196static void s5p_mfc_release_codec_buffers_v5(struct s5p_mfc_ctx *ctx)
197{ 197{
198 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1); 198 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1);
199 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_r, &ctx->bank2); 199 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_r, &ctx->bank2);
200} 200}
201 201
202/* Allocate memory for instance data buffer */ 202/* Allocate memory for instance data buffer */
203int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) 203static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx)
204{ 204{
205 struct s5p_mfc_dev *dev = ctx->dev; 205 struct s5p_mfc_dev *dev = ctx->dev;
206 struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv; 206 struct s5p_mfc_buf_size_v5 *buf_size = dev->variant->buf_size->priv;
@@ -241,20 +241,20 @@ int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx)
241} 241}
242 242
243/* Release instance buffer */ 243/* Release instance buffer */
244void s5p_mfc_release_instance_buffer_v5(struct s5p_mfc_ctx *ctx) 244static void s5p_mfc_release_instance_buffer_v5(struct s5p_mfc_ctx *ctx)
245{ 245{
246 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->ctx); 246 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->ctx);
247 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->shm); 247 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->shm);
248} 248}
249 249
250int s5p_mfc_alloc_dev_context_buffer_v5(struct s5p_mfc_dev *dev) 250static int s5p_mfc_alloc_dev_context_buffer_v5(struct s5p_mfc_dev *dev)
251{ 251{
252 /* NOP */ 252 /* NOP */
253 253
254 return 0; 254 return 0;
255} 255}
256 256
257void s5p_mfc_release_dev_context_buffer_v5(struct s5p_mfc_dev *dev) 257static void s5p_mfc_release_dev_context_buffer_v5(struct s5p_mfc_dev *dev)
258{ 258{
259 /* NOP */ 259 /* NOP */
260} 260}
@@ -273,7 +273,7 @@ static unsigned int s5p_mfc_read_info_v5(struct s5p_mfc_ctx *ctx,
273 return readl(ctx->shm.virt + ofs); 273 return readl(ctx->shm.virt + ofs);
274} 274}
275 275
276void s5p_mfc_dec_calc_dpb_size_v5(struct s5p_mfc_ctx *ctx) 276static void s5p_mfc_dec_calc_dpb_size_v5(struct s5p_mfc_ctx *ctx)
277{ 277{
278 unsigned int guard_width, guard_height; 278 unsigned int guard_width, guard_height;
279 279
@@ -315,7 +315,7 @@ void s5p_mfc_dec_calc_dpb_size_v5(struct s5p_mfc_ctx *ctx)
315 } 315 }
316} 316}
317 317
318void s5p_mfc_enc_calc_src_size_v5(struct s5p_mfc_ctx *ctx) 318static void s5p_mfc_enc_calc_src_size_v5(struct s5p_mfc_ctx *ctx)
319{ 319{
320 if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_NV12M) { 320 if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_NV12M) {
321 ctx->buf_width = ALIGN(ctx->img_width, S5P_FIMV_NV12M_HALIGN); 321 ctx->buf_width = ALIGN(ctx->img_width, S5P_FIMV_NV12M_HALIGN);
@@ -361,8 +361,9 @@ static void s5p_mfc_set_shared_buffer(struct s5p_mfc_ctx *ctx)
361} 361}
362 362
363/* Set registers for decoding stream buffer */ 363/* Set registers for decoding stream buffer */
364int s5p_mfc_set_dec_stream_buffer_v5(struct s5p_mfc_ctx *ctx, int buf_addr, 364static int s5p_mfc_set_dec_stream_buffer_v5(struct s5p_mfc_ctx *ctx,
365 unsigned int start_num_byte, unsigned int buf_size) 365 int buf_addr, unsigned int start_num_byte,
366 unsigned int buf_size)
366{ 367{
367 struct s5p_mfc_dev *dev = ctx->dev; 368 struct s5p_mfc_dev *dev = ctx->dev;
368 369
@@ -374,7 +375,7 @@ int s5p_mfc_set_dec_stream_buffer_v5(struct s5p_mfc_ctx *ctx, int buf_addr,
374} 375}
375 376
376/* Set decoding frame buffer */ 377/* Set decoding frame buffer */
377int s5p_mfc_set_dec_frame_buffer_v5(struct s5p_mfc_ctx *ctx) 378static int s5p_mfc_set_dec_frame_buffer_v5(struct s5p_mfc_ctx *ctx)
378{ 379{
379 unsigned int frame_size, i; 380 unsigned int frame_size, i;
380 unsigned int frame_size_ch, frame_size_mv; 381 unsigned int frame_size_ch, frame_size_mv;
@@ -506,7 +507,7 @@ int s5p_mfc_set_dec_frame_buffer_v5(struct s5p_mfc_ctx *ctx)
506} 507}
507 508
508/* Set registers for encoding stream buffer */ 509/* Set registers for encoding stream buffer */
509int s5p_mfc_set_enc_stream_buffer_v5(struct s5p_mfc_ctx *ctx, 510static int s5p_mfc_set_enc_stream_buffer_v5(struct s5p_mfc_ctx *ctx,
510 unsigned long addr, unsigned int size) 511 unsigned long addr, unsigned int size)
511{ 512{
512 struct s5p_mfc_dev *dev = ctx->dev; 513 struct s5p_mfc_dev *dev = ctx->dev;
@@ -516,7 +517,7 @@ int s5p_mfc_set_enc_stream_buffer_v5(struct s5p_mfc_ctx *ctx,
516 return 0; 517 return 0;
517} 518}
518 519
519void s5p_mfc_set_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx, 520static void s5p_mfc_set_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,
520 unsigned long y_addr, unsigned long c_addr) 521 unsigned long y_addr, unsigned long c_addr)
521{ 522{
522 struct s5p_mfc_dev *dev = ctx->dev; 523 struct s5p_mfc_dev *dev = ctx->dev;
@@ -525,7 +526,7 @@ void s5p_mfc_set_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,
525 mfc_write(dev, OFFSETB(c_addr), S5P_FIMV_ENC_SI_CH0_CUR_C_ADR); 526 mfc_write(dev, OFFSETB(c_addr), S5P_FIMV_ENC_SI_CH0_CUR_C_ADR);
526} 527}
527 528
528void s5p_mfc_get_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx, 529static void s5p_mfc_get_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,
529 unsigned long *y_addr, unsigned long *c_addr) 530 unsigned long *y_addr, unsigned long *c_addr)
530{ 531{
531 struct s5p_mfc_dev *dev = ctx->dev; 532 struct s5p_mfc_dev *dev = ctx->dev;
@@ -537,7 +538,7 @@ void s5p_mfc_get_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,
537} 538}
538 539
539/* Set encoding ref & codec buffer */ 540/* Set encoding ref & codec buffer */
540int s5p_mfc_set_enc_ref_buffer_v5(struct s5p_mfc_ctx *ctx) 541static int s5p_mfc_set_enc_ref_buffer_v5(struct s5p_mfc_ctx *ctx)
541{ 542{
542 struct s5p_mfc_dev *dev = ctx->dev; 543 struct s5p_mfc_dev *dev = ctx->dev;
543 size_t buf_addr1, buf_addr2; 544 size_t buf_addr1, buf_addr2;
@@ -1041,7 +1042,7 @@ static int s5p_mfc_set_enc_params_h263(struct s5p_mfc_ctx *ctx)
1041} 1042}
1042 1043
1043/* Initialize decoding */ 1044/* Initialize decoding */
1044int s5p_mfc_init_decode_v5(struct s5p_mfc_ctx *ctx) 1045static int s5p_mfc_init_decode_v5(struct s5p_mfc_ctx *ctx)
1045{ 1046{
1046 struct s5p_mfc_dev *dev = ctx->dev; 1047 struct s5p_mfc_dev *dev = ctx->dev;
1047 1048
@@ -1077,7 +1078,7 @@ static void s5p_mfc_set_flush(struct s5p_mfc_ctx *ctx, int flush)
1077} 1078}
1078 1079
1079/* Decode a single frame */ 1080/* Decode a single frame */
1080int s5p_mfc_decode_one_frame_v5(struct s5p_mfc_ctx *ctx, 1081static int s5p_mfc_decode_one_frame_v5(struct s5p_mfc_ctx *ctx,
1081 enum s5p_mfc_decode_arg last_frame) 1082 enum s5p_mfc_decode_arg last_frame)
1082{ 1083{
1083 struct s5p_mfc_dev *dev = ctx->dev; 1084 struct s5p_mfc_dev *dev = ctx->dev;
@@ -1106,7 +1107,7 @@ int s5p_mfc_decode_one_frame_v5(struct s5p_mfc_ctx *ctx,
1106 return 0; 1107 return 0;
1107} 1108}
1108 1109
1109int s5p_mfc_init_encode_v5(struct s5p_mfc_ctx *ctx) 1110static int s5p_mfc_init_encode_v5(struct s5p_mfc_ctx *ctx)
1110{ 1111{
1111 struct s5p_mfc_dev *dev = ctx->dev; 1112 struct s5p_mfc_dev *dev = ctx->dev;
1112 1113
@@ -1128,7 +1129,7 @@ int s5p_mfc_init_encode_v5(struct s5p_mfc_ctx *ctx)
1128} 1129}
1129 1130
1130/* Encode a single frame */ 1131/* Encode a single frame */
1131int s5p_mfc_encode_one_frame_v5(struct s5p_mfc_ctx *ctx) 1132static int s5p_mfc_encode_one_frame_v5(struct s5p_mfc_ctx *ctx)
1132{ 1133{
1133 struct s5p_mfc_dev *dev = ctx->dev; 1134 struct s5p_mfc_dev *dev = ctx->dev;
1134 int cmd; 1135 int cmd;
@@ -1187,6 +1188,15 @@ static int s5p_mfc_run_dec_frame(struct s5p_mfc_ctx *ctx, int last_frame)
1187 unsigned long flags; 1188 unsigned long flags;
1188 unsigned int index; 1189 unsigned int index;
1189 1190
1191 if (ctx->state == MFCINST_FINISHING) {
1192 last_frame = MFC_DEC_LAST_FRAME;
1193 s5p_mfc_set_dec_stream_buffer_v5(ctx, 0, 0, 0);
1194 dev->curr_ctx = ctx->num;
1195 s5p_mfc_clean_ctx_int_flags(ctx);
1196 s5p_mfc_decode_one_frame_v5(ctx, last_frame);
1197 return 0;
1198 }
1199
1190 spin_lock_irqsave(&dev->irqlock, flags); 1200 spin_lock_irqsave(&dev->irqlock, flags);
1191 /* Frames are being decoded */ 1201 /* Frames are being decoded */
1192 if (list_empty(&ctx->src_queue)) { 1202 if (list_empty(&ctx->src_queue)) {
@@ -1353,7 +1363,7 @@ static int s5p_mfc_run_init_dec_buffers(struct s5p_mfc_ctx *ctx)
1353} 1363}
1354 1364
1355/* Try running an operation on hardware */ 1365/* Try running an operation on hardware */
1356void s5p_mfc_try_run_v5(struct s5p_mfc_dev *dev) 1366static void s5p_mfc_try_run_v5(struct s5p_mfc_dev *dev)
1357{ 1367{
1358 struct s5p_mfc_ctx *ctx; 1368 struct s5p_mfc_ctx *ctx;
1359 int new_ctx; 1369 int new_ctx;
@@ -1469,7 +1479,7 @@ void s5p_mfc_try_run_v5(struct s5p_mfc_dev *dev)
1469} 1479}
1470 1480
1471 1481
1472void s5p_mfc_cleanup_queue_v5(struct list_head *lh, struct vb2_queue *vq) 1482static void s5p_mfc_cleanup_queue_v5(struct list_head *lh, struct vb2_queue *vq)
1473{ 1483{
1474 struct s5p_mfc_buf *b; 1484 struct s5p_mfc_buf *b;
1475 int i; 1485 int i;
@@ -1483,52 +1493,52 @@ void s5p_mfc_cleanup_queue_v5(struct list_head *lh, struct vb2_queue *vq)
1483 } 1493 }
1484} 1494}
1485 1495
1486void s5p_mfc_clear_int_flags_v5(struct s5p_mfc_dev *dev) 1496static void s5p_mfc_clear_int_flags_v5(struct s5p_mfc_dev *dev)
1487{ 1497{
1488 mfc_write(dev, 0, S5P_FIMV_RISC_HOST_INT); 1498 mfc_write(dev, 0, S5P_FIMV_RISC_HOST_INT);
1489 mfc_write(dev, 0, S5P_FIMV_RISC2HOST_CMD); 1499 mfc_write(dev, 0, S5P_FIMV_RISC2HOST_CMD);
1490 mfc_write(dev, 0xffff, S5P_FIMV_SI_RTN_CHID); 1500 mfc_write(dev, 0xffff, S5P_FIMV_SI_RTN_CHID);
1491} 1501}
1492 1502
1493int s5p_mfc_get_dspl_y_adr_v5(struct s5p_mfc_dev *dev) 1503static int s5p_mfc_get_dspl_y_adr_v5(struct s5p_mfc_dev *dev)
1494{ 1504{
1495 return mfc_read(dev, S5P_FIMV_SI_DISPLAY_Y_ADR) << MFC_OFFSET_SHIFT; 1505 return mfc_read(dev, S5P_FIMV_SI_DISPLAY_Y_ADR) << MFC_OFFSET_SHIFT;
1496} 1506}
1497 1507
1498int s5p_mfc_get_dec_y_adr_v5(struct s5p_mfc_dev *dev) 1508static int s5p_mfc_get_dec_y_adr_v5(struct s5p_mfc_dev *dev)
1499{ 1509{
1500 return mfc_read(dev, S5P_FIMV_SI_DECODE_Y_ADR) << MFC_OFFSET_SHIFT; 1510 return mfc_read(dev, S5P_FIMV_SI_DECODE_Y_ADR) << MFC_OFFSET_SHIFT;
1501} 1511}
1502 1512
1503int s5p_mfc_get_dspl_status_v5(struct s5p_mfc_dev *dev) 1513static int s5p_mfc_get_dspl_status_v5(struct s5p_mfc_dev *dev)
1504{ 1514{
1505 return mfc_read(dev, S5P_FIMV_SI_DISPLAY_STATUS); 1515 return mfc_read(dev, S5P_FIMV_SI_DISPLAY_STATUS);
1506} 1516}
1507 1517
1508int s5p_mfc_get_dec_status_v5(struct s5p_mfc_dev *dev) 1518static int s5p_mfc_get_dec_status_v5(struct s5p_mfc_dev *dev)
1509{ 1519{
1510 return mfc_read(dev, S5P_FIMV_SI_DECODE_STATUS); 1520 return mfc_read(dev, S5P_FIMV_SI_DECODE_STATUS);
1511} 1521}
1512 1522
1513int s5p_mfc_get_dec_frame_type_v5(struct s5p_mfc_dev *dev) 1523static int s5p_mfc_get_dec_frame_type_v5(struct s5p_mfc_dev *dev)
1514{ 1524{
1515 return mfc_read(dev, S5P_FIMV_DECODE_FRAME_TYPE) & 1525 return mfc_read(dev, S5P_FIMV_DECODE_FRAME_TYPE) &
1516 S5P_FIMV_DECODE_FRAME_MASK; 1526 S5P_FIMV_DECODE_FRAME_MASK;
1517} 1527}
1518 1528
1519int s5p_mfc_get_disp_frame_type_v5(struct s5p_mfc_ctx *ctx) 1529static int s5p_mfc_get_disp_frame_type_v5(struct s5p_mfc_ctx *ctx)
1520{ 1530{
1521 return (s5p_mfc_read_info_v5(ctx, DISP_PIC_FRAME_TYPE) >> 1531 return (s5p_mfc_read_info_v5(ctx, DISP_PIC_FRAME_TYPE) >>
1522 S5P_FIMV_SHARED_DISP_FRAME_TYPE_SHIFT) & 1532 S5P_FIMV_SHARED_DISP_FRAME_TYPE_SHIFT) &
1523 S5P_FIMV_DECODE_FRAME_MASK; 1533 S5P_FIMV_DECODE_FRAME_MASK;
1524} 1534}
1525 1535
1526int s5p_mfc_get_consumed_stream_v5(struct s5p_mfc_dev *dev) 1536static int s5p_mfc_get_consumed_stream_v5(struct s5p_mfc_dev *dev)
1527{ 1537{
1528 return mfc_read(dev, S5P_FIMV_SI_CONSUMED_BYTES); 1538 return mfc_read(dev, S5P_FIMV_SI_CONSUMED_BYTES);
1529} 1539}
1530 1540
1531int s5p_mfc_get_int_reason_v5(struct s5p_mfc_dev *dev) 1541static int s5p_mfc_get_int_reason_v5(struct s5p_mfc_dev *dev)
1532{ 1542{
1533 int reason; 1543 int reason;
1534 reason = mfc_read(dev, S5P_FIMV_RISC2HOST_CMD) & 1544 reason = mfc_read(dev, S5P_FIMV_RISC2HOST_CMD) &
@@ -1576,98 +1586,98 @@ int s5p_mfc_get_int_reason_v5(struct s5p_mfc_dev *dev)
1576 return reason; 1586 return reason;
1577} 1587}
1578 1588
1579int s5p_mfc_get_int_err_v5(struct s5p_mfc_dev *dev) 1589static int s5p_mfc_get_int_err_v5(struct s5p_mfc_dev *dev)
1580{ 1590{
1581 return mfc_read(dev, S5P_FIMV_RISC2HOST_ARG2); 1591 return mfc_read(dev, S5P_FIMV_RISC2HOST_ARG2);
1582} 1592}
1583 1593
1584int s5p_mfc_err_dec_v5(unsigned int err) 1594static int s5p_mfc_err_dec_v5(unsigned int err)
1585{ 1595{
1586 return (err & S5P_FIMV_ERR_DEC_MASK) >> S5P_FIMV_ERR_DEC_SHIFT; 1596 return (err & S5P_FIMV_ERR_DEC_MASK) >> S5P_FIMV_ERR_DEC_SHIFT;
1587} 1597}
1588 1598
1589int s5p_mfc_err_dspl_v5(unsigned int err) 1599static int s5p_mfc_err_dspl_v5(unsigned int err)
1590{ 1600{
1591 return (err & S5P_FIMV_ERR_DSPL_MASK) >> S5P_FIMV_ERR_DSPL_SHIFT; 1601 return (err & S5P_FIMV_ERR_DSPL_MASK) >> S5P_FIMV_ERR_DSPL_SHIFT;
1592} 1602}
1593 1603
1594int s5p_mfc_get_img_width_v5(struct s5p_mfc_dev *dev) 1604static int s5p_mfc_get_img_width_v5(struct s5p_mfc_dev *dev)
1595{ 1605{
1596 return mfc_read(dev, S5P_FIMV_SI_HRESOL); 1606 return mfc_read(dev, S5P_FIMV_SI_HRESOL);
1597} 1607}
1598 1608
1599int s5p_mfc_get_img_height_v5(struct s5p_mfc_dev *dev) 1609static int s5p_mfc_get_img_height_v5(struct s5p_mfc_dev *dev)
1600{ 1610{
1601 return mfc_read(dev, S5P_FIMV_SI_VRESOL); 1611 return mfc_read(dev, S5P_FIMV_SI_VRESOL);
1602} 1612}
1603 1613
1604int s5p_mfc_get_dpb_count_v5(struct s5p_mfc_dev *dev) 1614static int s5p_mfc_get_dpb_count_v5(struct s5p_mfc_dev *dev)
1605{ 1615{
1606 return mfc_read(dev, S5P_FIMV_SI_BUF_NUMBER); 1616 return mfc_read(dev, S5P_FIMV_SI_BUF_NUMBER);
1607} 1617}
1608 1618
1609int s5p_mfc_get_mv_count_v5(struct s5p_mfc_dev *dev) 1619static int s5p_mfc_get_mv_count_v5(struct s5p_mfc_dev *dev)
1610{ 1620{
1611 /* NOP */ 1621 /* NOP */
1612 return -1; 1622 return -1;
1613} 1623}
1614 1624
1615int s5p_mfc_get_inst_no_v5(struct s5p_mfc_dev *dev) 1625static int s5p_mfc_get_inst_no_v5(struct s5p_mfc_dev *dev)
1616{ 1626{
1617 return mfc_read(dev, S5P_FIMV_RISC2HOST_ARG1); 1627 return mfc_read(dev, S5P_FIMV_RISC2HOST_ARG1);
1618} 1628}
1619 1629
1620int s5p_mfc_get_enc_strm_size_v5(struct s5p_mfc_dev *dev) 1630static int s5p_mfc_get_enc_strm_size_v5(struct s5p_mfc_dev *dev)
1621{ 1631{
1622 return mfc_read(dev, S5P_FIMV_ENC_SI_STRM_SIZE); 1632 return mfc_read(dev, S5P_FIMV_ENC_SI_STRM_SIZE);
1623} 1633}
1624 1634
1625int s5p_mfc_get_enc_slice_type_v5(struct s5p_mfc_dev *dev) 1635static int s5p_mfc_get_enc_slice_type_v5(struct s5p_mfc_dev *dev)
1626{ 1636{
1627 return mfc_read(dev, S5P_FIMV_ENC_SI_SLICE_TYPE); 1637 return mfc_read(dev, S5P_FIMV_ENC_SI_SLICE_TYPE);
1628} 1638}
1629 1639
1630int s5p_mfc_get_enc_dpb_count_v5(struct s5p_mfc_dev *dev) 1640static int s5p_mfc_get_enc_dpb_count_v5(struct s5p_mfc_dev *dev)
1631{ 1641{
1632 return -1; 1642 return -1;
1633} 1643}
1634 1644
1635int s5p_mfc_get_enc_pic_count_v5(struct s5p_mfc_dev *dev) 1645static int s5p_mfc_get_enc_pic_count_v5(struct s5p_mfc_dev *dev)
1636{ 1646{
1637 return mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT); 1647 return mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT);
1638} 1648}
1639 1649
1640int s5p_mfc_get_sei_avail_status_v5(struct s5p_mfc_ctx *ctx) 1650static int s5p_mfc_get_sei_avail_status_v5(struct s5p_mfc_ctx *ctx)
1641{ 1651{
1642 return s5p_mfc_read_info_v5(ctx, FRAME_PACK_SEI_AVAIL); 1652 return s5p_mfc_read_info_v5(ctx, FRAME_PACK_SEI_AVAIL);
1643} 1653}
1644 1654
1645int s5p_mfc_get_mvc_num_views_v5(struct s5p_mfc_dev *dev) 1655static int s5p_mfc_get_mvc_num_views_v5(struct s5p_mfc_dev *dev)
1646{ 1656{
1647 return -1; 1657 return -1;
1648} 1658}
1649 1659
1650int s5p_mfc_get_mvc_view_id_v5(struct s5p_mfc_dev *dev) 1660static int s5p_mfc_get_mvc_view_id_v5(struct s5p_mfc_dev *dev)
1651{ 1661{
1652 return -1; 1662 return -1;
1653} 1663}
1654 1664
1655unsigned int s5p_mfc_get_pic_type_top_v5(struct s5p_mfc_ctx *ctx) 1665static unsigned int s5p_mfc_get_pic_type_top_v5(struct s5p_mfc_ctx *ctx)
1656{ 1666{
1657 return s5p_mfc_read_info_v5(ctx, PIC_TIME_TOP); 1667 return s5p_mfc_read_info_v5(ctx, PIC_TIME_TOP);
1658} 1668}
1659 1669
1660unsigned int s5p_mfc_get_pic_type_bot_v5(struct s5p_mfc_ctx *ctx) 1670static unsigned int s5p_mfc_get_pic_type_bot_v5(struct s5p_mfc_ctx *ctx)
1661{ 1671{
1662 return s5p_mfc_read_info_v5(ctx, PIC_TIME_BOT); 1672 return s5p_mfc_read_info_v5(ctx, PIC_TIME_BOT);
1663} 1673}
1664 1674
1665unsigned int s5p_mfc_get_crop_info_h_v5(struct s5p_mfc_ctx *ctx) 1675static unsigned int s5p_mfc_get_crop_info_h_v5(struct s5p_mfc_ctx *ctx)
1666{ 1676{
1667 return s5p_mfc_read_info_v5(ctx, CROP_INFO_H); 1677 return s5p_mfc_read_info_v5(ctx, CROP_INFO_H);
1668} 1678}
1669 1679
1670unsigned int s5p_mfc_get_crop_info_v_v5(struct s5p_mfc_ctx *ctx) 1680static unsigned int s5p_mfc_get_crop_info_v_v5(struct s5p_mfc_ctx *ctx)
1671{ 1681{
1672 return s5p_mfc_read_info_v5(ctx, CROP_INFO_V); 1682 return s5p_mfc_read_info_v5(ctx, CROP_INFO_V);
1673} 1683}
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 98a9c093a6b9..7e76fce2e524 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -49,7 +49,7 @@
49#define OFFSETB(x) (((x) - dev->port_b) >> S5P_FIMV_MEM_OFFSET) 49#define OFFSETB(x) (((x) - dev->port_b) >> S5P_FIMV_MEM_OFFSET)
50 50
51/* Allocate temporary buffers for decoding */ 51/* Allocate temporary buffers for decoding */
52int s5p_mfc_alloc_dec_temp_buffers_v6(struct s5p_mfc_ctx *ctx) 52static int s5p_mfc_alloc_dec_temp_buffers_v6(struct s5p_mfc_ctx *ctx)
53{ 53{
54 /* NOP */ 54 /* NOP */
55 55
@@ -57,19 +57,19 @@ int s5p_mfc_alloc_dec_temp_buffers_v6(struct s5p_mfc_ctx *ctx)
57} 57}
58 58
59/* Release temproary buffers for decoding */ 59/* Release temproary buffers for decoding */
60void s5p_mfc_release_dec_desc_buffer_v6(struct s5p_mfc_ctx *ctx) 60static void s5p_mfc_release_dec_desc_buffer_v6(struct s5p_mfc_ctx *ctx)
61{ 61{
62 /* NOP */ 62 /* NOP */
63} 63}
64 64
65int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev) 65static int s5p_mfc_get_dec_status_v6(struct s5p_mfc_dev *dev)
66{ 66{
67 /* NOP */ 67 /* NOP */
68 return -1; 68 return -1;
69} 69}
70 70
71/* Allocate codec buffers */ 71/* Allocate codec buffers */
72int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) 72static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
73{ 73{
74 struct s5p_mfc_dev *dev = ctx->dev; 74 struct s5p_mfc_dev *dev = ctx->dev;
75 unsigned int mb_width, mb_height; 75 unsigned int mb_width, mb_height;
@@ -203,13 +203,13 @@ int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
203} 203}
204 204
205/* Release buffers allocated for codec */ 205/* Release buffers allocated for codec */
206void s5p_mfc_release_codec_buffers_v6(struct s5p_mfc_ctx *ctx) 206static void s5p_mfc_release_codec_buffers_v6(struct s5p_mfc_ctx *ctx)
207{ 207{
208 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1); 208 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1);
209} 209}
210 210
211/* Allocate memory for instance data buffer */ 211/* Allocate memory for instance data buffer */
212int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) 212static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx)
213{ 213{
214 struct s5p_mfc_dev *dev = ctx->dev; 214 struct s5p_mfc_dev *dev = ctx->dev;
215 struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv; 215 struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;
@@ -258,13 +258,13 @@ int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx)
258} 258}
259 259
260/* Release instance buffer */ 260/* Release instance buffer */
261void s5p_mfc_release_instance_buffer_v6(struct s5p_mfc_ctx *ctx) 261static void s5p_mfc_release_instance_buffer_v6(struct s5p_mfc_ctx *ctx)
262{ 262{
263 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->ctx); 263 s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->ctx);
264} 264}
265 265
266/* Allocate context buffers for SYS_INIT */ 266/* Allocate context buffers for SYS_INIT */
267int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev) 267static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev)
268{ 268{
269 struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv; 269 struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;
270 int ret; 270 int ret;
@@ -287,7 +287,7 @@ int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev)
287} 287}
288 288
289/* Release context buffers for SYS_INIT */ 289/* Release context buffers for SYS_INIT */
290void s5p_mfc_release_dev_context_buffer_v6(struct s5p_mfc_dev *dev) 290static void s5p_mfc_release_dev_context_buffer_v6(struct s5p_mfc_dev *dev)
291{ 291{
292 s5p_mfc_release_priv_buf(dev->mem_dev_l, &dev->ctx_buf); 292 s5p_mfc_release_priv_buf(dev->mem_dev_l, &dev->ctx_buf);
293} 293}
@@ -306,7 +306,7 @@ static int calc_plane(int width, int height)
306 (mbY * S5P_FIMV_NUM_PIXELS_IN_MB_ROW_V6); 306 (mbY * S5P_FIMV_NUM_PIXELS_IN_MB_ROW_V6);
307} 307}
308 308
309void s5p_mfc_dec_calc_dpb_size_v6(struct s5p_mfc_ctx *ctx) 309static void s5p_mfc_dec_calc_dpb_size_v6(struct s5p_mfc_ctx *ctx)
310{ 310{
311 ctx->buf_width = ALIGN(ctx->img_width, S5P_FIMV_NV12MT_HALIGN_V6); 311 ctx->buf_width = ALIGN(ctx->img_width, S5P_FIMV_NV12MT_HALIGN_V6);
312 ctx->buf_height = ALIGN(ctx->img_height, S5P_FIMV_NV12MT_VALIGN_V6); 312 ctx->buf_height = ALIGN(ctx->img_height, S5P_FIMV_NV12MT_VALIGN_V6);
@@ -326,7 +326,7 @@ void s5p_mfc_dec_calc_dpb_size_v6(struct s5p_mfc_ctx *ctx)
326 } 326 }
327} 327}
328 328
329void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx) 329static void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx)
330{ 330{
331 unsigned int mb_width, mb_height; 331 unsigned int mb_width, mb_height;
332 332
@@ -339,8 +339,9 @@ void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx)
339} 339}
340 340
341/* Set registers for decoding stream buffer */ 341/* Set registers for decoding stream buffer */
342int s5p_mfc_set_dec_stream_buffer_v6(struct s5p_mfc_ctx *ctx, int buf_addr, 342static int s5p_mfc_set_dec_stream_buffer_v6(struct s5p_mfc_ctx *ctx,
343 unsigned int start_num_byte, unsigned int strm_size) 343 int buf_addr, unsigned int start_num_byte,
344 unsigned int strm_size)
344{ 345{
345 struct s5p_mfc_dev *dev = ctx->dev; 346 struct s5p_mfc_dev *dev = ctx->dev;
346 struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size; 347 struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;
@@ -359,7 +360,7 @@ int s5p_mfc_set_dec_stream_buffer_v6(struct s5p_mfc_ctx *ctx, int buf_addr,
359} 360}
360 361
361/* Set decoding frame buffer */ 362/* Set decoding frame buffer */
362int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx) 363static int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)
363{ 364{
364 unsigned int frame_size, i; 365 unsigned int frame_size, i;
365 unsigned int frame_size_ch, frame_size_mv; 366 unsigned int frame_size_ch, frame_size_mv;
@@ -440,7 +441,7 @@ int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)
440} 441}
441 442
442/* Set registers for encoding stream buffer */ 443/* Set registers for encoding stream buffer */
443int s5p_mfc_set_enc_stream_buffer_v6(struct s5p_mfc_ctx *ctx, 444static int s5p_mfc_set_enc_stream_buffer_v6(struct s5p_mfc_ctx *ctx,
444 unsigned long addr, unsigned int size) 445 unsigned long addr, unsigned int size)
445{ 446{
446 struct s5p_mfc_dev *dev = ctx->dev; 447 struct s5p_mfc_dev *dev = ctx->dev;
@@ -454,7 +455,7 @@ int s5p_mfc_set_enc_stream_buffer_v6(struct s5p_mfc_ctx *ctx,
454 return 0; 455 return 0;
455} 456}
456 457
457void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, 458static void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,
458 unsigned long y_addr, unsigned long c_addr) 459 unsigned long y_addr, unsigned long c_addr)
459{ 460{
460 struct s5p_mfc_dev *dev = ctx->dev; 461 struct s5p_mfc_dev *dev = ctx->dev;
@@ -466,7 +467,7 @@ void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,
466 mfc_debug(2, "enc src c buf addr: 0x%08lx", c_addr); 467 mfc_debug(2, "enc src c buf addr: 0x%08lx", c_addr);
467} 468}
468 469
469void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, 470static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,
470 unsigned long *y_addr, unsigned long *c_addr) 471 unsigned long *y_addr, unsigned long *c_addr)
471{ 472{
472 struct s5p_mfc_dev *dev = ctx->dev; 473 struct s5p_mfc_dev *dev = ctx->dev;
@@ -483,7 +484,7 @@ void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,
483} 484}
484 485
485/* Set encoding ref & codec buffer */ 486/* Set encoding ref & codec buffer */
486int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx) 487static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx)
487{ 488{
488 struct s5p_mfc_dev *dev = ctx->dev; 489 struct s5p_mfc_dev *dev = ctx->dev;
489 size_t buf_addr1; 490 size_t buf_addr1;
@@ -1147,7 +1148,7 @@ static int s5p_mfc_set_enc_params_h263(struct s5p_mfc_ctx *ctx)
1147} 1148}
1148 1149
1149/* Initialize decoding */ 1150/* Initialize decoding */
1150int s5p_mfc_init_decode_v6(struct s5p_mfc_ctx *ctx) 1151static int s5p_mfc_init_decode_v6(struct s5p_mfc_ctx *ctx)
1151{ 1152{
1152 struct s5p_mfc_dev *dev = ctx->dev; 1153 struct s5p_mfc_dev *dev = ctx->dev;
1153 unsigned int reg = 0; 1154 unsigned int reg = 0;
@@ -1215,7 +1216,7 @@ static inline void s5p_mfc_set_flush(struct s5p_mfc_ctx *ctx, int flush)
1215} 1216}
1216 1217
1217/* Decode a single frame */ 1218/* Decode a single frame */
1218int s5p_mfc_decode_one_frame_v6(struct s5p_mfc_ctx *ctx, 1219static int s5p_mfc_decode_one_frame_v6(struct s5p_mfc_ctx *ctx,
1219 enum s5p_mfc_decode_arg last_frame) 1220 enum s5p_mfc_decode_arg last_frame)
1220{ 1221{
1221 struct s5p_mfc_dev *dev = ctx->dev; 1222 struct s5p_mfc_dev *dev = ctx->dev;
@@ -1244,7 +1245,7 @@ int s5p_mfc_decode_one_frame_v6(struct s5p_mfc_ctx *ctx,
1244 return 0; 1245 return 0;
1245} 1246}
1246 1247
1247int s5p_mfc_init_encode_v6(struct s5p_mfc_ctx *ctx) 1248static int s5p_mfc_init_encode_v6(struct s5p_mfc_ctx *ctx)
1248{ 1249{
1249 struct s5p_mfc_dev *dev = ctx->dev; 1250 struct s5p_mfc_dev *dev = ctx->dev;
1250 1251
@@ -1267,7 +1268,7 @@ int s5p_mfc_init_encode_v6(struct s5p_mfc_ctx *ctx)
1267 return 0; 1268 return 0;
1268} 1269}
1269 1270
1270int s5p_mfc_h264_set_aso_slice_order_v6(struct s5p_mfc_ctx *ctx) 1271static int s5p_mfc_h264_set_aso_slice_order_v6(struct s5p_mfc_ctx *ctx)
1271{ 1272{
1272 struct s5p_mfc_dev *dev = ctx->dev; 1273 struct s5p_mfc_dev *dev = ctx->dev;
1273 struct s5p_mfc_enc_params *p = &ctx->enc_params; 1274 struct s5p_mfc_enc_params *p = &ctx->enc_params;
@@ -1283,7 +1284,7 @@ int s5p_mfc_h264_set_aso_slice_order_v6(struct s5p_mfc_ctx *ctx)
1283} 1284}
1284 1285
1285/* Encode a single frame */ 1286/* Encode a single frame */
1286int s5p_mfc_encode_one_frame_v6(struct s5p_mfc_ctx *ctx) 1287static int s5p_mfc_encode_one_frame_v6(struct s5p_mfc_ctx *ctx)
1287{ 1288{
1288 struct s5p_mfc_dev *dev = ctx->dev; 1289 struct s5p_mfc_dev *dev = ctx->dev;
1289 1290
@@ -1362,8 +1363,16 @@ static inline int s5p_mfc_run_dec_frame(struct s5p_mfc_ctx *ctx)
1362 unsigned long flags; 1363 unsigned long flags;
1363 int last_frame = 0; 1364 int last_frame = 0;
1364 1365
1365 spin_lock_irqsave(&dev->irqlock, flags); 1366 if (ctx->state == MFCINST_FINISHING) {
1367 last_frame = MFC_DEC_LAST_FRAME;
1368 s5p_mfc_set_dec_stream_buffer_v6(ctx, 0, 0, 0);
1369 dev->curr_ctx = ctx->num;
1370 s5p_mfc_clean_ctx_int_flags(ctx);
1371 s5p_mfc_decode_one_frame_v6(ctx, last_frame);
1372 return 0;
1373 }
1366 1374
1375 spin_lock_irqsave(&dev->irqlock, flags);
1367 /* Frames are being decoded */ 1376 /* Frames are being decoded */
1368 if (list_empty(&ctx->src_queue)) { 1377 if (list_empty(&ctx->src_queue)) {
1369 mfc_debug(2, "No src buffers.\n"); 1378 mfc_debug(2, "No src buffers.\n");
@@ -1540,7 +1549,7 @@ static inline int s5p_mfc_run_init_enc_buffers(struct s5p_mfc_ctx *ctx)
1540} 1549}
1541 1550
1542/* Try running an operation on hardware */ 1551/* Try running an operation on hardware */
1543void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev) 1552static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev)
1544{ 1553{
1545 struct s5p_mfc_ctx *ctx; 1554 struct s5p_mfc_ctx *ctx;
1546 int new_ctx; 1555 int new_ctx;
@@ -1663,7 +1672,7 @@ void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev)
1663} 1672}
1664 1673
1665 1674
1666void s5p_mfc_cleanup_queue_v6(struct list_head *lh, struct vb2_queue *vq) 1675static void s5p_mfc_cleanup_queue_v6(struct list_head *lh, struct vb2_queue *vq)
1667{ 1676{
1668 struct s5p_mfc_buf *b; 1677 struct s5p_mfc_buf *b;
1669 int i; 1678 int i;
@@ -1677,13 +1686,13 @@ void s5p_mfc_cleanup_queue_v6(struct list_head *lh, struct vb2_queue *vq)
1677 } 1686 }
1678} 1687}
1679 1688
1680void s5p_mfc_clear_int_flags_v6(struct s5p_mfc_dev *dev) 1689static void s5p_mfc_clear_int_flags_v6(struct s5p_mfc_dev *dev)
1681{ 1690{
1682 mfc_write(dev, 0, S5P_FIMV_RISC2HOST_CMD_V6); 1691 mfc_write(dev, 0, S5P_FIMV_RISC2HOST_CMD_V6);
1683 mfc_write(dev, 0, S5P_FIMV_RISC2HOST_INT_V6); 1692 mfc_write(dev, 0, S5P_FIMV_RISC2HOST_INT_V6);
1684} 1693}
1685 1694
1686void s5p_mfc_write_info_v6(struct s5p_mfc_ctx *ctx, unsigned int data, 1695static void s5p_mfc_write_info_v6(struct s5p_mfc_ctx *ctx, unsigned int data,
1687 unsigned int ofs) 1696 unsigned int ofs)
1688{ 1697{
1689 struct s5p_mfc_dev *dev = ctx->dev; 1698 struct s5p_mfc_dev *dev = ctx->dev;
@@ -1693,7 +1702,8 @@ void s5p_mfc_write_info_v6(struct s5p_mfc_ctx *ctx, unsigned int data,
1693 s5p_mfc_clock_off(); 1702 s5p_mfc_clock_off();
1694} 1703}
1695 1704
1696unsigned int s5p_mfc_read_info_v6(struct s5p_mfc_ctx *ctx, unsigned int ofs) 1705static unsigned int
1706s5p_mfc_read_info_v6(struct s5p_mfc_ctx *ctx, unsigned int ofs)
1697{ 1707{
1698 struct s5p_mfc_dev *dev = ctx->dev; 1708 struct s5p_mfc_dev *dev = ctx->dev;
1699 int ret; 1709 int ret;
@@ -1705,140 +1715,140 @@ unsigned int s5p_mfc_read_info_v6(struct s5p_mfc_ctx *ctx, unsigned int ofs)
1705 return ret; 1715 return ret;
1706} 1716}
1707 1717
1708int s5p_mfc_get_dspl_y_adr_v6(struct s5p_mfc_dev *dev) 1718static int s5p_mfc_get_dspl_y_adr_v6(struct s5p_mfc_dev *dev)
1709{ 1719{
1710 return mfc_read(dev, S5P_FIMV_D_DISPLAY_LUMA_ADDR_V6); 1720 return mfc_read(dev, S5P_FIMV_D_DISPLAY_LUMA_ADDR_V6);
1711} 1721}
1712 1722
1713int s5p_mfc_get_dec_y_adr_v6(struct s5p_mfc_dev *dev) 1723static int s5p_mfc_get_dec_y_adr_v6(struct s5p_mfc_dev *dev)
1714{ 1724{
1715 return mfc_read(dev, S5P_FIMV_D_DECODED_LUMA_ADDR_V6); 1725 return mfc_read(dev, S5P_FIMV_D_DECODED_LUMA_ADDR_V6);
1716} 1726}
1717 1727
1718int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev) 1728static int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev)
1719{ 1729{
1720 return mfc_read(dev, S5P_FIMV_D_DISPLAY_STATUS_V6); 1730 return mfc_read(dev, S5P_FIMV_D_DISPLAY_STATUS_V6);
1721} 1731}
1722 1732
1723int s5p_mfc_get_decoded_status_v6(struct s5p_mfc_dev *dev) 1733static int s5p_mfc_get_decoded_status_v6(struct s5p_mfc_dev *dev)
1724{ 1734{
1725 return mfc_read(dev, S5P_FIMV_D_DECODED_STATUS_V6); 1735 return mfc_read(dev, S5P_FIMV_D_DECODED_STATUS_V6);
1726} 1736}
1727 1737
1728int s5p_mfc_get_dec_frame_type_v6(struct s5p_mfc_dev *dev) 1738static int s5p_mfc_get_dec_frame_type_v6(struct s5p_mfc_dev *dev)
1729{ 1739{
1730 return mfc_read(dev, S5P_FIMV_D_DECODED_FRAME_TYPE_V6) & 1740 return mfc_read(dev, S5P_FIMV_D_DECODED_FRAME_TYPE_V6) &
1731 S5P_FIMV_DECODE_FRAME_MASK_V6; 1741 S5P_FIMV_DECODE_FRAME_MASK_V6;
1732} 1742}
1733 1743
1734int s5p_mfc_get_disp_frame_type_v6(struct s5p_mfc_ctx *ctx) 1744static int s5p_mfc_get_disp_frame_type_v6(struct s5p_mfc_ctx *ctx)
1735{ 1745{
1736 return mfc_read(ctx->dev, S5P_FIMV_D_DISPLAY_FRAME_TYPE_V6) & 1746 return mfc_read(ctx->dev, S5P_FIMV_D_DISPLAY_FRAME_TYPE_V6) &
1737 S5P_FIMV_DECODE_FRAME_MASK_V6; 1747 S5P_FIMV_DECODE_FRAME_MASK_V6;
1738} 1748}
1739 1749
1740int s5p_mfc_get_consumed_stream_v6(struct s5p_mfc_dev *dev) 1750static int s5p_mfc_get_consumed_stream_v6(struct s5p_mfc_dev *dev)
1741{ 1751{
1742 return mfc_read(dev, S5P_FIMV_D_DECODED_NAL_SIZE_V6); 1752 return mfc_read(dev, S5P_FIMV_D_DECODED_NAL_SIZE_V6);
1743} 1753}
1744 1754
1745int s5p_mfc_get_int_reason_v6(struct s5p_mfc_dev *dev) 1755static int s5p_mfc_get_int_reason_v6(struct s5p_mfc_dev *dev)
1746{ 1756{
1747 return mfc_read(dev, S5P_FIMV_RISC2HOST_CMD_V6) & 1757 return mfc_read(dev, S5P_FIMV_RISC2HOST_CMD_V6) &
1748 S5P_FIMV_RISC2HOST_CMD_MASK; 1758 S5P_FIMV_RISC2HOST_CMD_MASK;
1749} 1759}
1750 1760
1751int s5p_mfc_get_int_err_v6(struct s5p_mfc_dev *dev) 1761static int s5p_mfc_get_int_err_v6(struct s5p_mfc_dev *dev)
1752{ 1762{
1753 return mfc_read(dev, S5P_FIMV_ERROR_CODE_V6); 1763 return mfc_read(dev, S5P_FIMV_ERROR_CODE_V6);
1754} 1764}
1755 1765
1756int s5p_mfc_err_dec_v6(unsigned int err) 1766static int s5p_mfc_err_dec_v6(unsigned int err)
1757{ 1767{
1758 return (err & S5P_FIMV_ERR_DEC_MASK_V6) >> S5P_FIMV_ERR_DEC_SHIFT_V6; 1768 return (err & S5P_FIMV_ERR_DEC_MASK_V6) >> S5P_FIMV_ERR_DEC_SHIFT_V6;
1759} 1769}
1760 1770
1761int s5p_mfc_err_dspl_v6(unsigned int err) 1771static int s5p_mfc_err_dspl_v6(unsigned int err)
1762{ 1772{
1763 return (err & S5P_FIMV_ERR_DSPL_MASK_V6) >> S5P_FIMV_ERR_DSPL_SHIFT_V6; 1773 return (err & S5P_FIMV_ERR_DSPL_MASK_V6) >> S5P_FIMV_ERR_DSPL_SHIFT_V6;
1764} 1774}
1765 1775
1766int s5p_mfc_get_img_width_v6(struct s5p_mfc_dev *dev) 1776static int s5p_mfc_get_img_width_v6(struct s5p_mfc_dev *dev)
1767{ 1777{
1768 return mfc_read(dev, S5P_FIMV_D_DISPLAY_FRAME_WIDTH_V6); 1778 return mfc_read(dev, S5P_FIMV_D_DISPLAY_FRAME_WIDTH_V6);
1769} 1779}
1770 1780
1771int s5p_mfc_get_img_height_v6(struct s5p_mfc_dev *dev) 1781static int s5p_mfc_get_img_height_v6(struct s5p_mfc_dev *dev)
1772{ 1782{
1773 return mfc_read(dev, S5P_FIMV_D_DISPLAY_FRAME_HEIGHT_V6); 1783 return mfc_read(dev, S5P_FIMV_D_DISPLAY_FRAME_HEIGHT_V6);
1774} 1784}
1775 1785
1776int s5p_mfc_get_dpb_count_v6(struct s5p_mfc_dev *dev) 1786static int s5p_mfc_get_dpb_count_v6(struct s5p_mfc_dev *dev)
1777{ 1787{
1778 return mfc_read(dev, S5P_FIMV_D_MIN_NUM_DPB_V6); 1788 return mfc_read(dev, S5P_FIMV_D_MIN_NUM_DPB_V6);
1779} 1789}
1780 1790
1781int s5p_mfc_get_mv_count_v6(struct s5p_mfc_dev *dev) 1791static int s5p_mfc_get_mv_count_v6(struct s5p_mfc_dev *dev)
1782{ 1792{
1783 return mfc_read(dev, S5P_FIMV_D_MIN_NUM_MV_V6); 1793 return mfc_read(dev, S5P_FIMV_D_MIN_NUM_MV_V6);
1784} 1794}
1785 1795
1786int s5p_mfc_get_inst_no_v6(struct s5p_mfc_dev *dev) 1796static int s5p_mfc_get_inst_no_v6(struct s5p_mfc_dev *dev)
1787{ 1797{
1788 return mfc_read(dev, S5P_FIMV_RET_INSTANCE_ID_V6); 1798 return mfc_read(dev, S5P_FIMV_RET_INSTANCE_ID_V6);
1789} 1799}
1790 1800
1791int s5p_mfc_get_enc_dpb_count_v6(struct s5p_mfc_dev *dev) 1801static int s5p_mfc_get_enc_dpb_count_v6(struct s5p_mfc_dev *dev)
1792{ 1802{
1793 return mfc_read(dev, S5P_FIMV_E_NUM_DPB_V6); 1803 return mfc_read(dev, S5P_FIMV_E_NUM_DPB_V6);
1794} 1804}
1795 1805
1796int s5p_mfc_get_enc_strm_size_v6(struct s5p_mfc_dev *dev) 1806static int s5p_mfc_get_enc_strm_size_v6(struct s5p_mfc_dev *dev)
1797{ 1807{
1798 return mfc_read(dev, S5P_FIMV_E_STREAM_SIZE_V6); 1808 return mfc_read(dev, S5P_FIMV_E_STREAM_SIZE_V6);
1799} 1809}
1800 1810
1801int s5p_mfc_get_enc_slice_type_v6(struct s5p_mfc_dev *dev) 1811static int s5p_mfc_get_enc_slice_type_v6(struct s5p_mfc_dev *dev)
1802{ 1812{
1803 return mfc_read(dev, S5P_FIMV_E_SLICE_TYPE_V6); 1813 return mfc_read(dev, S5P_FIMV_E_SLICE_TYPE_V6);
1804} 1814}
1805 1815
1806int s5p_mfc_get_enc_pic_count_v6(struct s5p_mfc_dev *dev) 1816static int s5p_mfc_get_enc_pic_count_v6(struct s5p_mfc_dev *dev)
1807{ 1817{
1808 return mfc_read(dev, S5P_FIMV_E_PICTURE_COUNT_V6); 1818 return mfc_read(dev, S5P_FIMV_E_PICTURE_COUNT_V6);
1809} 1819}
1810 1820
1811int s5p_mfc_get_sei_avail_status_v6(struct s5p_mfc_ctx *ctx) 1821static int s5p_mfc_get_sei_avail_status_v6(struct s5p_mfc_ctx *ctx)
1812{ 1822{
1813 return mfc_read(ctx->dev, S5P_FIMV_D_FRAME_PACK_SEI_AVAIL_V6); 1823 return mfc_read(ctx->dev, S5P_FIMV_D_FRAME_PACK_SEI_AVAIL_V6);
1814} 1824}
1815 1825
1816int s5p_mfc_get_mvc_num_views_v6(struct s5p_mfc_dev *dev) 1826static int s5p_mfc_get_mvc_num_views_v6(struct s5p_mfc_dev *dev)
1817{ 1827{
1818 return mfc_read(dev, S5P_FIMV_D_MVC_NUM_VIEWS_V6); 1828 return mfc_read(dev, S5P_FIMV_D_MVC_NUM_VIEWS_V6);
1819} 1829}
1820 1830
1821int s5p_mfc_get_mvc_view_id_v6(struct s5p_mfc_dev *dev) 1831static int s5p_mfc_get_mvc_view_id_v6(struct s5p_mfc_dev *dev)
1822{ 1832{
1823 return mfc_read(dev, S5P_FIMV_D_MVC_VIEW_ID_V6); 1833 return mfc_read(dev, S5P_FIMV_D_MVC_VIEW_ID_V6);
1824} 1834}
1825 1835
1826unsigned int s5p_mfc_get_pic_type_top_v6(struct s5p_mfc_ctx *ctx) 1836static unsigned int s5p_mfc_get_pic_type_top_v6(struct s5p_mfc_ctx *ctx)
1827{ 1837{
1828 return s5p_mfc_read_info_v6(ctx, PIC_TIME_TOP_V6); 1838 return s5p_mfc_read_info_v6(ctx, PIC_TIME_TOP_V6);
1829} 1839}
1830 1840
1831unsigned int s5p_mfc_get_pic_type_bot_v6(struct s5p_mfc_ctx *ctx) 1841static unsigned int s5p_mfc_get_pic_type_bot_v6(struct s5p_mfc_ctx *ctx)
1832{ 1842{
1833 return s5p_mfc_read_info_v6(ctx, PIC_TIME_BOT_V6); 1843 return s5p_mfc_read_info_v6(ctx, PIC_TIME_BOT_V6);
1834} 1844}
1835 1845
1836unsigned int s5p_mfc_get_crop_info_h_v6(struct s5p_mfc_ctx *ctx) 1846static unsigned int s5p_mfc_get_crop_info_h_v6(struct s5p_mfc_ctx *ctx)
1837{ 1847{
1838 return s5p_mfc_read_info_v6(ctx, CROP_INFO_H_V6); 1848 return s5p_mfc_read_info_v6(ctx, CROP_INFO_H_V6);
1839} 1849}
1840 1850
1841unsigned int s5p_mfc_get_crop_info_v_v6(struct s5p_mfc_ctx *ctx) 1851static unsigned int s5p_mfc_get_crop_info_v_v6(struct s5p_mfc_ctx *ctx)
1842{ 1852{
1843 return s5p_mfc_read_info_v6(ctx, CROP_INFO_V_V6); 1853 return s5p_mfc_read_info_v6(ctx, CROP_INFO_V_V6);
1844} 1854}