Commit 722b979e authored by Arun Kumar K's avatar Arun Kumar K Committed by Mauro Carvalho Chehab

[media] s5p-mfc: Rename IS_MFCV6 macro

The MFC v6 specific code holds good for MFC v7 also as
the v7 version is a superset of v6 and the HW interface
remains more or less similar. This patch renames the macro
IS_MFCV6() to IS_MFCV6_PLUS() so that it can be used
for v7 also.
Signed-off-by: default avatarArun Kumar K <arun.kk@samsung.com>
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 3dc7cc24
...@@ -20,7 +20,7 @@ static struct s5p_mfc_hw_cmds *s5p_mfc_cmds; ...@@ -20,7 +20,7 @@ static struct s5p_mfc_hw_cmds *s5p_mfc_cmds;
void s5p_mfc_init_hw_cmds(struct s5p_mfc_dev *dev) void s5p_mfc_init_hw_cmds(struct s5p_mfc_dev *dev)
{ {
if (IS_MFCV6(dev)) if (IS_MFCV6_PLUS(dev))
s5p_mfc_cmds = s5p_mfc_init_hw_cmds_v6(); s5p_mfc_cmds = s5p_mfc_init_hw_cmds_v6();
else else
s5p_mfc_cmds = s5p_mfc_init_hw_cmds_v5(); s5p_mfc_cmds = s5p_mfc_init_hw_cmds_v5();
......
...@@ -683,6 +683,6 @@ void set_work_bit_irqsave(struct s5p_mfc_ctx *ctx); ...@@ -683,6 +683,6 @@ void set_work_bit_irqsave(struct s5p_mfc_ctx *ctx);
#define HAS_PORTNUM(dev) (dev ? (dev->variant ? \ #define HAS_PORTNUM(dev) (dev ? (dev->variant ? \
(dev->variant->port_num ? 1 : 0) : 0) : 0) (dev->variant->port_num ? 1 : 0) : 0) : 0)
#define IS_TWOPORT(dev) (dev->variant->port_num == 2 ? 1 : 0) #define IS_TWOPORT(dev) (dev->variant->port_num == 2 ? 1 : 0)
#define IS_MFCV6(dev) (dev->variant->version >= 0x60 ? 1 : 0) #define IS_MFCV6_PLUS(dev) (dev->variant->version >= 0x60 ? 1 : 0)
#endif /* S5P_MFC_COMMON_H_ */ #endif /* S5P_MFC_COMMON_H_ */
...@@ -164,7 +164,7 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev) ...@@ -164,7 +164,7 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev)
mfc_debug_enter(); mfc_debug_enter();
if (IS_MFCV6(dev)) { if (IS_MFCV6_PLUS(dev)) {
/* Reset IP */ /* Reset IP */
/* except RISC, reset */ /* except RISC, reset */
mfc_write(dev, 0xFEE, S5P_FIMV_MFC_RESET_V6); mfc_write(dev, 0xFEE, S5P_FIMV_MFC_RESET_V6);
...@@ -213,7 +213,7 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev) ...@@ -213,7 +213,7 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev)
static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev *dev) static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev *dev)
{ {
if (IS_MFCV6(dev)) { if (IS_MFCV6_PLUS(dev)) {
mfc_write(dev, dev->bank1, S5P_FIMV_RISC_BASE_ADDRESS_V6); mfc_write(dev, dev->bank1, S5P_FIMV_RISC_BASE_ADDRESS_V6);
mfc_debug(2, "Base Address : %08x\n", dev->bank1); mfc_debug(2, "Base Address : %08x\n", dev->bank1);
} else { } else {
...@@ -226,7 +226,7 @@ static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev *dev) ...@@ -226,7 +226,7 @@ static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev *dev)
static inline void s5p_mfc_clear_cmds(struct s5p_mfc_dev *dev) static inline void s5p_mfc_clear_cmds(struct s5p_mfc_dev *dev)
{ {
if (IS_MFCV6(dev)) { if (IS_MFCV6_PLUS(dev)) {
/* Zero initialization should be done before RESET. /* Zero initialization should be done before RESET.
* Nothing to do here. */ * Nothing to do here. */
} else { } else {
...@@ -264,7 +264,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev) ...@@ -264,7 +264,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev)
s5p_mfc_clear_cmds(dev); s5p_mfc_clear_cmds(dev);
/* 3. Release reset signal to the RISC */ /* 3. Release reset signal to the RISC */
s5p_mfc_clean_dev_int_flags(dev); s5p_mfc_clean_dev_int_flags(dev);
if (IS_MFCV6(dev)) if (IS_MFCV6_PLUS(dev))
mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6); mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6);
else else
mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET); mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET);
...@@ -301,7 +301,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev) ...@@ -301,7 +301,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev)
s5p_mfc_clock_off(); s5p_mfc_clock_off();
return -EIO; return -EIO;
} }
if (IS_MFCV6(dev)) if (IS_MFCV6_PLUS(dev))
ver = mfc_read(dev, S5P_FIMV_FW_VERSION_V6); ver = mfc_read(dev, S5P_FIMV_FW_VERSION_V6);
else else
ver = mfc_read(dev, S5P_FIMV_FW_VERSION); ver = mfc_read(dev, S5P_FIMV_FW_VERSION);
...@@ -380,7 +380,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) ...@@ -380,7 +380,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev)
return ret; return ret;
} }
/* 4. Release reset signal to the RISC */ /* 4. Release reset signal to the RISC */
if (IS_MFCV6(dev)) if (IS_MFCV6_PLUS(dev))
mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6); mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6);
else else
mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET); mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET);
......
...@@ -382,7 +382,7 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) ...@@ -382,7 +382,7 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
mfc_err("Unsupported format for source.\n"); mfc_err("Unsupported format for source.\n");
return -EINVAL; return -EINVAL;
} }
if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { if (!IS_MFCV6_PLUS(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) {
mfc_err("Not supported format.\n"); mfc_err("Not supported format.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -392,10 +392,11 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) ...@@ -392,10 +392,11 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
mfc_err("Unsupported format for destination.\n"); mfc_err("Unsupported format for destination.\n");
return -EINVAL; return -EINVAL;
} }
if (IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { if (IS_MFCV6_PLUS(dev) &&
(fmt->fourcc == V4L2_PIX_FMT_NV12MT)) {
mfc_err("Not supported format.\n"); mfc_err("Not supported format.\n");
return -EINVAL; return -EINVAL;
} else if (!IS_MFCV6(dev) && } else if (!IS_MFCV6_PLUS(dev) &&
(fmt->fourcc != V4L2_PIX_FMT_NV12MT)) { (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) {
mfc_err("Not supported format.\n"); mfc_err("Not supported format.\n");
return -EINVAL; return -EINVAL;
...@@ -430,10 +431,11 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) ...@@ -430,10 +431,11 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
mfc_err("Unsupported format for source.\n"); mfc_err("Unsupported format for source.\n");
return -EINVAL; return -EINVAL;
} }
if (!IS_MFCV6(dev) && (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) { if (!IS_MFCV6_PLUS(dev) &&
(fmt->fourcc != V4L2_PIX_FMT_NV12MT)) {
mfc_err("Not supported format.\n"); mfc_err("Not supported format.\n");
return -EINVAL; return -EINVAL;
} else if (IS_MFCV6(dev) && } else if (IS_MFCV6_PLUS(dev) &&
(fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) {
mfc_err("Not supported format.\n"); mfc_err("Not supported format.\n");
return -EINVAL; return -EINVAL;
...@@ -457,7 +459,7 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) ...@@ -457,7 +459,7 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { if (!IS_MFCV6_PLUS(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) {
mfc_err("Not supported format.\n"); mfc_err("Not supported format.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -942,7 +944,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, ...@@ -942,7 +944,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
psize[0] = ctx->luma_size; psize[0] = ctx->luma_size;
psize[1] = ctx->chroma_size; psize[1] = ctx->chroma_size;
if (IS_MFCV6(dev)) if (IS_MFCV6_PLUS(dev))
allocators[0] = allocators[0] =
ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX]; ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX];
else else
...@@ -1067,7 +1069,7 @@ static int s5p_mfc_stop_streaming(struct vb2_queue *q) ...@@ -1067,7 +1069,7 @@ static int s5p_mfc_stop_streaming(struct vb2_queue *q)
ctx->dpb_flush_flag = 1; ctx->dpb_flush_flag = 1;
ctx->dec_dst_flag = 0; ctx->dec_dst_flag = 0;
spin_unlock_irqrestore(&dev->irqlock, flags); spin_unlock_irqrestore(&dev->irqlock, flags);
if (IS_MFCV6(dev) && (ctx->state == MFCINST_RUNNING)) { if (IS_MFCV6_PLUS(dev) && (ctx->state == MFCINST_RUNNING)) {
ctx->state = MFCINST_FLUSH; ctx->state = MFCINST_FLUSH;
set_work_bit_irqsave(ctx); set_work_bit_irqsave(ctx);
s5p_mfc_clean_ctx_int_flags(ctx); s5p_mfc_clean_ctx_int_flags(ctx);
......
...@@ -663,7 +663,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) ...@@ -663,7 +663,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)
spin_unlock_irqrestore(&dev->irqlock, flags); spin_unlock_irqrestore(&dev->irqlock, flags);
} }
if (!IS_MFCV6(dev)) { if (!IS_MFCV6_PLUS(dev)) {
ctx->state = MFCINST_RUNNING; ctx->state = MFCINST_RUNNING;
if (s5p_mfc_ctx_ready(ctx)) if (s5p_mfc_ctx_ready(ctx))
set_work_bit_irqsave(ctx); set_work_bit_irqsave(ctx);
...@@ -993,11 +993,11 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) ...@@ -993,11 +993,11 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
return -EINVAL; return -EINVAL;
} }
if (!IS_MFCV6(dev) && if (!IS_MFCV6_PLUS(dev) &&
(fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)) { (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)) {
mfc_err("Not supported format.\n"); mfc_err("Not supported format.\n");
return -EINVAL; return -EINVAL;
} else if (IS_MFCV6(dev) && } else if (IS_MFCV6_PLUS(dev) &&
(fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) {
mfc_err("Not supported format.\n"); mfc_err("Not supported format.\n");
return -EINVAL; return -EINVAL;
...@@ -1072,7 +1072,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, ...@@ -1072,7 +1072,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
return -EINVAL; return -EINVAL;
} }
if (IS_MFCV6(dev)) { if (IS_MFCV6_PLUS(dev)) {
/* Check for min encoder buffers */ /* Check for min encoder buffers */
if (ctx->pb_count && if (ctx->pb_count &&
(reqbufs->count < ctx->pb_count)) { (reqbufs->count < ctx->pb_count)) {
...@@ -1353,7 +1353,7 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -1353,7 +1353,7 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
S5P_FIMV_ENC_PROFILE_H264_BASELINE; S5P_FIMV_ENC_PROFILE_H264_BASELINE;
break; break;
case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE: case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE:
if (IS_MFCV6(dev)) if (IS_MFCV6_PLUS(dev))
p->codec.h264.profile = p->codec.h264.profile =
S5P_FIMV_ENC_PROFILE_H264_CONSTRAINED_BASELINE; S5P_FIMV_ENC_PROFILE_H264_CONSTRAINED_BASELINE;
else else
...@@ -1662,9 +1662,10 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, ...@@ -1662,9 +1662,10 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
*buf_count = 1; *buf_count = 1;
if (*buf_count > MFC_MAX_BUFFERS) if (*buf_count > MFC_MAX_BUFFERS)
*buf_count = MFC_MAX_BUFFERS; *buf_count = MFC_MAX_BUFFERS;
psize[0] = ctx->luma_size; psize[0] = ctx->luma_size;
psize[1] = ctx->chroma_size; psize[1] = ctx->chroma_size;
if (IS_MFCV6(dev)) { if (IS_MFCV6_PLUS(dev)) {
allocators[0] = allocators[0] =
ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX]; ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX];
allocators[1] = allocators[1] =
...@@ -1773,7 +1774,8 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count) ...@@ -1773,7 +1774,8 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count)
struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv); struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
struct s5p_mfc_dev *dev = ctx->dev; struct s5p_mfc_dev *dev = ctx->dev;
if (IS_MFCV6(dev) && (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) { if (IS_MFCV6_PLUS(dev) &&
(q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) {
if ((ctx->state == MFCINST_GOT_INST) && if ((ctx->state == MFCINST_GOT_INST) &&
(dev->curr_ctx == ctx->num) && dev->hw_lock) { (dev->curr_ctx == ctx->num) && dev->hw_lock) {
......
...@@ -21,7 +21,7 @@ static struct s5p_mfc_hw_ops *s5p_mfc_ops; ...@@ -21,7 +21,7 @@ static struct s5p_mfc_hw_ops *s5p_mfc_ops;
void s5p_mfc_init_hw_ops(struct s5p_mfc_dev *dev) void s5p_mfc_init_hw_ops(struct s5p_mfc_dev *dev)
{ {
if (IS_MFCV6(dev)) { if (IS_MFCV6_PLUS(dev)) {
s5p_mfc_ops = s5p_mfc_init_hw_ops_v6(); s5p_mfc_ops = s5p_mfc_init_hw_ops_v6();
dev->warn_start = S5P_FIMV_ERR_WARNINGS_START_V6; dev->warn_start = S5P_FIMV_ERR_WARNINGS_START_V6;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment