media: allegro: activate v4l2-ctrls only for current codec
authorMichael Tretter <m.tretter@pengutronix.de>
Thu, 3 Dec 2020 11:01:05 +0000 (12:01 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 27 Jan 2021 15:14:08 +0000 (16:14 +0100)
These controls are specific to H.264 and shall only be activated, if the
coded format is H.264.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/allegro-dvt/allegro-core.c

index bb024cff4c7c512e5f08e94f6718b36298deec08..f3a656ab2b06a6c6492722c674bbab4fafc78ef3 100644 (file)
@@ -2105,6 +2105,7 @@ err:
 static void allegro_channel_adjust(struct allegro_channel *channel)
 {
        struct allegro_dev *dev = channel->dev;
+       u32 codec = channel->codec;
        struct v4l2_ctrl *ctrl;
        s64 min;
        s64 max;
@@ -2140,6 +2141,21 @@ static void allegro_channel_adjust(struct allegro_channel *channel)
                                 ctrl->step, ctrl->default_value);
        v4l2_ctrl_unlock(ctrl);
 
+       v4l2_ctrl_activate(channel->mpeg_video_h264_profile,
+                          codec == V4L2_PIX_FMT_H264);
+       v4l2_ctrl_activate(channel->mpeg_video_h264_level,
+                          codec == V4L2_PIX_FMT_H264);
+       v4l2_ctrl_activate(channel->mpeg_video_h264_i_frame_qp,
+                          codec == V4L2_PIX_FMT_H264);
+       v4l2_ctrl_activate(channel->mpeg_video_h264_max_qp,
+                          codec == V4L2_PIX_FMT_H264);
+       v4l2_ctrl_activate(channel->mpeg_video_h264_min_qp,
+                          codec == V4L2_PIX_FMT_H264);
+       v4l2_ctrl_activate(channel->mpeg_video_h264_p_frame_qp,
+                          codec == V4L2_PIX_FMT_H264);
+       v4l2_ctrl_activate(channel->mpeg_video_h264_b_frame_qp,
+                          codec == V4L2_PIX_FMT_H264);
+
        channel->log2_max_frame_num = LOG2_MAX_FRAME_NUM;
        channel->temporal_mvp_enable = true;