mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
media: atomisp: set per-device's default mode
[ Upstream commit2c45e343c5] The atomisp driver originally used the s_parm command to initialize the run_mode type to the driver. So, before start setting up the streaming, s_parm should be called. So, even having 5 "normal" video devices, one meant to be used for each type, the run_mode was actually selected when s_parm is called. Without setting the run mode, applications that don't call VIDIOC_SET_PARM with a custom atomisp parameters won't work, as the pipeline won't be set: atomisp-isp2 0000:00:03.0: can't create streams atomisp-isp2 0000:00:03.0: __get_frame_info 1600x1200 (padded to 0) returned -22 However, commit8a7c5594c0("media: v4l2-ioctl: clear fields in s_parm") broke support for it, with a good reason, as drivers shoudn't be extending the API for their own purposes. So, as an step to allow generic apps to use this driver, put the device's run_mode in preview after open. After this patch, using v4l2grab starts to work on preview mode (/dev/video2): $ v4l2grab -f YUYV -x 1600 -y 1200 -d /dev/video2 -n 1 -u $ feh out000.pnm So, let's just setup the default run_mode that each video devnode should assume, setting it at open() time. Reported-by: Tsuchiya Yuto <kitakar@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ac08140677
commit
51ef6582a2
|
|
@ -877,6 +877,11 @@ static int atomisp_open(struct file *file)
|
||||||
else
|
else
|
||||||
pipe->users++;
|
pipe->users++;
|
||||||
rt_mutex_unlock(&isp->mutex);
|
rt_mutex_unlock(&isp->mutex);
|
||||||
|
|
||||||
|
/* Ensure that a mode is set */
|
||||||
|
if (asd)
|
||||||
|
v4l2_ctrl_s_ctrl(asd->run_mode, pipe->default_run_mode);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
css_error:
|
css_error:
|
||||||
|
|
|
||||||
|
|
@ -1178,23 +1178,28 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)
|
||||||
|
|
||||||
atomisp_init_acc_pipe(asd, &asd->video_acc);
|
atomisp_init_acc_pipe(asd, &asd->video_acc);
|
||||||
|
|
||||||
ret = atomisp_video_init(&asd->video_in, "MEMORY");
|
ret = atomisp_video_init(&asd->video_in, "MEMORY",
|
||||||
|
ATOMISP_RUN_MODE_SDV);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = atomisp_video_init(&asd->video_out_capture, "CAPTURE");
|
ret = atomisp_video_init(&asd->video_out_capture, "CAPTURE",
|
||||||
|
ATOMISP_RUN_MODE_STILL_CAPTURE);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = atomisp_video_init(&asd->video_out_vf, "VIEWFINDER");
|
ret = atomisp_video_init(&asd->video_out_vf, "VIEWFINDER",
|
||||||
|
ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = atomisp_video_init(&asd->video_out_preview, "PREVIEW");
|
ret = atomisp_video_init(&asd->video_out_preview, "PREVIEW",
|
||||||
|
ATOMISP_RUN_MODE_PREVIEW);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = atomisp_video_init(&asd->video_out_video_capture, "VIDEO");
|
ret = atomisp_video_init(&asd->video_out_video_capture, "VIDEO",
|
||||||
|
ATOMISP_RUN_MODE_VIDEO);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,9 @@ struct atomisp_video_pipe {
|
||||||
/* the link list to store per_frame parameters */
|
/* the link list to store per_frame parameters */
|
||||||
struct list_head per_frame_params;
|
struct list_head per_frame_params;
|
||||||
|
|
||||||
|
/* Store here the initial run mode */
|
||||||
|
unsigned int default_run_mode;
|
||||||
|
|
||||||
unsigned int buffers_in_css;
|
unsigned int buffers_in_css;
|
||||||
|
|
||||||
/* irq_lock is used to protect video buffer state change operations and
|
/* irq_lock is used to protect video buffer state change operations and
|
||||||
|
|
|
||||||
|
|
@ -447,7 +447,8 @@ const struct atomisp_dfs_config dfs_config_cht_soc = {
|
||||||
.dfs_table_size = ARRAY_SIZE(dfs_rules_cht_soc),
|
.dfs_table_size = ARRAY_SIZE(dfs_rules_cht_soc),
|
||||||
};
|
};
|
||||||
|
|
||||||
int atomisp_video_init(struct atomisp_video_pipe *video, const char *name)
|
int atomisp_video_init(struct atomisp_video_pipe *video, const char *name,
|
||||||
|
unsigned int run_mode)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
const char *direction;
|
const char *direction;
|
||||||
|
|
@ -478,6 +479,7 @@ int atomisp_video_init(struct atomisp_video_pipe *video, const char *name)
|
||||||
"ATOMISP ISP %s %s", name, direction);
|
"ATOMISP ISP %s %s", name, direction);
|
||||||
video->vdev.release = video_device_release_empty;
|
video->vdev.release = video_device_release_empty;
|
||||||
video_set_drvdata(&video->vdev, video->isp);
|
video_set_drvdata(&video->vdev, video->isp);
|
||||||
|
video->default_run_mode = run_mode;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ struct v4l2_device;
|
||||||
struct atomisp_device;
|
struct atomisp_device;
|
||||||
struct firmware;
|
struct firmware;
|
||||||
|
|
||||||
int atomisp_video_init(struct atomisp_video_pipe *video, const char *name);
|
int atomisp_video_init(struct atomisp_video_pipe *video, const char *name,
|
||||||
|
unsigned int run_mode);
|
||||||
void atomisp_acc_init(struct atomisp_acc_pipe *video, const char *name);
|
void atomisp_acc_init(struct atomisp_acc_pipe *video, const char *name);
|
||||||
void atomisp_video_unregister(struct atomisp_video_pipe *video);
|
void atomisp_video_unregister(struct atomisp_video_pipe *video);
|
||||||
void atomisp_acc_unregister(struct atomisp_acc_pipe *video);
|
void atomisp_acc_unregister(struct atomisp_acc_pipe *video);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user