From: Mirela Rabulea Date: Thu, 18 Apr 2019 17:02:24 +0000 (+0300) Subject: MLK-21458: mxc-jpeg: Implement V4L2_ENC_CMD_STOP X-Git-Tag: rel_imx_4.19.35_1.1.0~691 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=b82f5925dbb616f78fa8c35cb482eb7561349442;p=linux.git MLK-21458: mxc-jpeg: Implement V4L2_ENC_CMD_STOP Implementation is similar with V4L2_DEC_CMD_STOP, but cannot unify them, due to different structures. Also added the other V4L2_*_CMD_* commands to the switch, but as "not implemented" for now. Signed-off-by: Mirela Rabulea Reviewed-by: Robert Chiras --- diff --git a/drivers/media/platform/imx8/mxc-jpeg.c b/drivers/media/platform/imx8/mxc-jpeg.c index dda8662e46a0..fe09324d92b7 100644 --- a/drivers/media/platform/imx8/mxc-jpeg.c +++ b/drivers/media/platform/imx8/mxc-jpeg.c @@ -661,13 +661,16 @@ end: } static int mxc_jpeg_decoder_cmd(struct file *file, void *priv, - struct v4l2_decoder_cmd *cmd) + struct v4l2_decoder_cmd *cmd) { struct v4l2_fh *fh = file->private_data; struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(fh); struct device *dev = ctx->mxc_jpeg->dev; switch (cmd->cmd) { + case V4L2_DEC_CMD_START: + dev_dbg(dev, "V4L2_DEC_CMD_START not implemented"); + break; case V4L2_DEC_CMD_STOP: dev_dbg(dev, "Received V4L2_DEC_CMD_STOP"); if (v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx) == 0) { @@ -678,6 +681,45 @@ static int mxc_jpeg_decoder_cmd(struct file *file, void *priv, ctx->stopping = 1; } return 0; + case V4L2_DEC_CMD_PAUSE: + dev_dbg(dev, "V4L2_DEC_CMD_PAUSE not implemented"); + break; + case V4L2_DEC_CMD_RESUME: + dev_dbg(dev, "V4L2_DEC_CMD_RESUME not implemented"); + break; + default: + return -EINVAL; + } + return 0; +} + +static int mxc_jpeg_encoder_cmd(struct file *file, void *priv, + struct v4l2_encoder_cmd *cmd) +{ + struct v4l2_fh *fh = file->private_data; + struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(fh); + struct device *dev = ctx->mxc_jpeg->dev; + + switch (cmd->cmd) { + case V4L2_ENC_CMD_START: + dev_dbg(dev, "V4L2_ENC_CMD_START not implemented"); + break; + case V4L2_ENC_CMD_STOP: + dev_dbg(dev, "Received V4L2_ENC_CMD_STOP"); + if (v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx) == 0) { + /* No more src bufs, notify app EOS */ + notify_eos(ctx); + } else { + /* will send EOS later*/ + ctx->stopping = 1; + } + return 0; + case V4L2_ENC_CMD_PAUSE: + dev_dbg(dev, "V4L2_ENC_CMD_PAUSE not implemented"); + break; + case V4L2_ENC_CMD_RESUME: + dev_dbg(dev, "V4L2_ENC_CMD_RESUME not implemented"); + break; default: return -EINVAL; } @@ -1583,6 +1625,7 @@ static const struct v4l2_ioctl_ops mxc_jpeg_ioctl_ops = { .vidioc_subscribe_event = mxc_jpeg_subscribe_event, .vidioc_decoder_cmd = mxc_jpeg_decoder_cmd, + .vidioc_encoder_cmd = mxc_jpeg_encoder_cmd, .vidioc_qbuf = mxc_jpeg_qbuf, .vidioc_dqbuf = mxc_jpeg_dqbuf,