media: allegro: activate v4l2-ctrls only for current codec

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>
This commit is contained in:
Michael Tretter 2020-12-03 12:01:05 +01:00 committed by Mauro Carvalho Chehab
parent be7f41f2f1
commit 99b05ce74c

View file

@ -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;