diff mbox series

[17/18] media: allegro: activate v4l2-ctrls only for current codec

Message ID 20201203110106.2939463-18-m.tretter@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series media: allegro: add HEVC support | expand

Commit Message

Michael Tretter Dec. 3, 2020, 11:01 a.m. UTC
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>
---
 .../media/platform/allegro-dvt/allegro-core.c    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c
index 4eacad3d53cb..5ff4509be13d 100644
--- a/drivers/media/platform/allegro-dvt/allegro-core.c
+++ b/drivers/media/platform/allegro-dvt/allegro-core.c
@@ -2105,6 +2105,7 @@  static int allegro_create_channel(struct allegro_channel *channel)
 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;