Skip to content

Commit 972756f

Browse files
Dave Stevensonpopcornmix
Dave Stevenson
authored andcommitted
V4L2: Make video/still threshold a run-time param
Move the define for at what resolution the driver switches from a video mode capture to a stills mode capture to module parameters. Signed-off-by: Dave Stevenson <[email protected]>
1 parent 937190a commit 972756f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

drivers/media/platform/bcm2835/bcm2835-camera.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ int bcm2835_v4l2_debug;
5454
module_param_named(debug, bcm2835_v4l2_debug, int, 0644);
5555
MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2");
5656

57+
int max_video_width = MAX_VIDEO_MODE_WIDTH;
58+
int max_video_height = MAX_VIDEO_MODE_HEIGHT;
59+
module_param(max_video_width, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
60+
MODULE_PARM_DESC(max_video_width, "Threshold for video mode");
61+
module_param(max_video_height, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
62+
MODULE_PARM_DESC(max_video_height, "Threshold for video mode");
63+
5764
static struct bm2835_mmal_dev *gdev; /* global device data */
5865

5966
#define FPS_MIN 1
@@ -908,8 +915,8 @@ static int mmal_setup_components(struct bm2835_mmal_dev *dev,
908915
switch (mfmt->mmal_component) {
909916
case MMAL_COMPONENT_CAMERA:
910917
/* Make a further decision on port based on resolution */
911-
if (f->fmt.pix.width <= MAX_VIDEO_MODE_WIDTH
912-
&& f->fmt.pix.height <= MAX_VIDEO_MODE_HEIGHT)
918+
if (f->fmt.pix.width <= max_video_width
919+
&& f->fmt.pix.height <= max_video_height)
913920
camera_port = port =
914921
&dev->component[MMAL_COMPONENT_CAMERA]->
915922
output[MMAL_CAMERA_PORT_VIDEO];
@@ -1351,8 +1358,8 @@ static int set_camera_parameters(struct vchiq_mmal_instance *instance,
13511358
.max_stills_h = MAX_HEIGHT,
13521359
.stills_yuv422 = 1,
13531360
.one_shot_stills = 1,
1354-
.max_preview_video_w = 1920,
1355-
.max_preview_video_h = 1088,
1361+
.max_preview_video_w = max_video_width,
1362+
.max_preview_video_h = max_video_height,
13561363
.num_preview_video_frames = 3,
13571364
.stills_capture_circular_buffer_height = 0,
13581365
.fast_preview_resume = 0,
@@ -1581,8 +1588,9 @@ static int __init bm2835_mmal_init_device(struct bm2835_mmal_dev *dev,
15811588
if (ret < 0)
15821589
return ret;
15831590

1584-
v4l2_info(vfd->v4l2_dev, "V4L2 device registered as %s\n",
1585-
video_device_node_name(vfd));
1591+
v4l2_info(vfd->v4l2_dev,
1592+
"V4L2 device registered as %s - stills mode > %dx%d\n",
1593+
video_device_node_name(vfd), max_video_width, max_video_height);
15861594

15871595
return 0;
15881596
}

0 commit comments

Comments
 (0)