提交 1b575689 编写于 作者: M Mauro Carvalho Chehab 提交者: Zheng Zengkai

media: atomisp: fix enum formats logic

stable inclusion
from stable-v5.10.94
commit fc2b95e7aeae0acc90f700e67d51f89cc988ea63
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=fc2b95e7aeae0acc90f700e67d51f89cc988ea63

--------------------------------

[ Upstream commit fae46cb0 ]

Changeset 374d62e7 ("media: v4l2-subdev: Verify v4l2_subdev_call() pad config argument")
added an extra verification for a pads parameter for enum mbus
format code.

Such change broke atomisp, because now the V4L2 core
refuses to enum MBUS formats if the state is empty.

So, add .which field in order to select the active formats,
in order to make it work again.

While here, improve error messages.

Fixes: 374d62e7 ("media: v4l2-subdev: Verify v4l2_subdev_call() pad config argument")
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 c48f6873
...@@ -773,7 +773,10 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, ...@@ -773,7 +773,10 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh,
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_device *isp = video_get_drvdata(vdev);
struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
struct v4l2_subdev_mbus_code_enum code = { 0 }; struct v4l2_subdev_mbus_code_enum code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_subdev *camera;
unsigned int i, fi = 0; unsigned int i, fi = 0;
int rval; int rval;
...@@ -783,14 +786,20 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, ...@@ -783,14 +786,20 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh,
return -EINVAL; return -EINVAL;
} }
camera = isp->inputs[asd->input_curr].camera;
if(!camera) {
dev_err(isp->dev, "%s(): camera is NULL, device is %s\n",
__func__, vdev->name);
return -EINVAL;
}
rt_mutex_lock(&isp->mutex); rt_mutex_lock(&isp->mutex);
rval = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, pad,
enum_mbus_code, NULL, &code); rval = v4l2_subdev_call(camera, pad, enum_mbus_code, NULL, &code);
if (rval == -ENOIOCTLCMD) { if (rval == -ENOIOCTLCMD) {
dev_warn(isp->dev, dev_warn(isp->dev,
"enum_mbus_code pad op not supported. Please fix your sensor driver!\n"); "enum_mbus_code pad op not supported by %s. Please fix your sensor driver!\n",
// rval = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, camera->name);
// video, enum_mbus_fmt, 0, &code.code);
} }
rt_mutex_unlock(&isp->mutex); rt_mutex_unlock(&isp->mutex);
...@@ -820,6 +829,8 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, ...@@ -820,6 +829,8 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh,
f->pixelformat = format->pixelformat; f->pixelformat = format->pixelformat;
return 0; return 0;
} }
dev_err(isp->dev, "%s(): format for code %x not found.\n",
__func__, code.code);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册