diff options
Diffstat (limited to 'drivers/media/video/cx2341x.c')
-rw-r--r-- | drivers/media/video/cx2341x.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c index 904bba0dbc4d..62304255dcae 100644 --- a/drivers/media/video/cx2341x.c +++ b/drivers/media/video/cx2341x.c | |||
@@ -190,17 +190,21 @@ static int cx2341x_get_ctrl(struct cx2341x_mpeg_params *params, | |||
190 | 190 | ||
191 | /* Map the control ID to the correct field in the cx2341x_mpeg_params | 191 | /* Map the control ID to the correct field in the cx2341x_mpeg_params |
192 | struct. Return -EINVAL if the ID is unknown, else return 0. */ | 192 | struct. Return -EINVAL if the ID is unknown, else return 0. */ |
193 | static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params, | 193 | static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params, int busy, |
194 | struct v4l2_ext_control *ctrl) | 194 | struct v4l2_ext_control *ctrl) |
195 | { | 195 | { |
196 | switch (ctrl->id) { | 196 | switch (ctrl->id) { |
197 | case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: | 197 | case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: |
198 | if (busy) | ||
199 | return -EBUSY; | ||
198 | params->audio_sampling_freq = ctrl->value; | 200 | params->audio_sampling_freq = ctrl->value; |
199 | break; | 201 | break; |
200 | case V4L2_CID_MPEG_AUDIO_ENCODING: | 202 | case V4L2_CID_MPEG_AUDIO_ENCODING: |
201 | params->audio_encoding = ctrl->value; | 203 | params->audio_encoding = ctrl->value; |
202 | break; | 204 | break; |
203 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: | 205 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: |
206 | if (busy) | ||
207 | return -EBUSY; | ||
204 | params->audio_l2_bitrate = ctrl->value; | 208 | params->audio_l2_bitrate = ctrl->value; |
205 | break; | 209 | break; |
206 | case V4L2_CID_MPEG_AUDIO_MODE: | 210 | case V4L2_CID_MPEG_AUDIO_MODE: |
@@ -245,6 +249,8 @@ static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params, | |||
245 | params->video_gop_closure = ctrl->value; | 249 | params->video_gop_closure = ctrl->value; |
246 | break; | 250 | break; |
247 | case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: | 251 | case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: |
252 | if (busy) | ||
253 | return -EBUSY; | ||
248 | /* MPEG-1 only allows CBR */ | 254 | /* MPEG-1 only allows CBR */ |
249 | if (params->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1 && | 255 | if (params->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1 && |
250 | ctrl->value != V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) | 256 | ctrl->value != V4L2_MPEG_VIDEO_BITRATE_MODE_CBR) |
@@ -252,9 +258,13 @@ static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params, | |||
252 | params->video_bitrate_mode = ctrl->value; | 258 | params->video_bitrate_mode = ctrl->value; |
253 | break; | 259 | break; |
254 | case V4L2_CID_MPEG_VIDEO_BITRATE: | 260 | case V4L2_CID_MPEG_VIDEO_BITRATE: |
261 | if (busy) | ||
262 | return -EBUSY; | ||
255 | params->video_bitrate = ctrl->value; | 263 | params->video_bitrate = ctrl->value; |
256 | break; | 264 | break; |
257 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: | 265 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: |
266 | if (busy) | ||
267 | return -EBUSY; | ||
258 | params->video_bitrate_peak = ctrl->value; | 268 | params->video_bitrate_peak = ctrl->value; |
259 | break; | 269 | break; |
260 | case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: | 270 | case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: |
@@ -267,6 +277,8 @@ static int cx2341x_set_ctrl(struct cx2341x_mpeg_params *params, | |||
267 | params->video_mute_yuv = ctrl->value; | 277 | params->video_mute_yuv = ctrl->value; |
268 | break; | 278 | break; |
269 | case V4L2_CID_MPEG_STREAM_TYPE: | 279 | case V4L2_CID_MPEG_STREAM_TYPE: |
280 | if (busy) | ||
281 | return -EBUSY; | ||
270 | params->stream_type = ctrl->value; | 282 | params->stream_type = ctrl->value; |
271 | params->video_encoding = | 283 | params->video_encoding = |
272 | (params->stream_type == V4L2_MPEG_STREAM_TYPE_MPEG1_SS || | 284 | (params->stream_type == V4L2_MPEG_STREAM_TYPE_MPEG1_SS || |
@@ -631,7 +643,7 @@ static void cx2341x_calc_audio_properties(struct cx2341x_mpeg_params *params) | |||
631 | (params->audio_crc << 14); | 643 | (params->audio_crc << 14); |
632 | } | 644 | } |
633 | 645 | ||
634 | int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, | 646 | int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, |
635 | struct v4l2_ext_controls *ctrls, unsigned int cmd) | 647 | struct v4l2_ext_controls *ctrls, unsigned int cmd) |
636 | { | 648 | { |
637 | int err = 0; | 649 | int err = 0; |
@@ -663,7 +675,7 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, | |||
663 | err = v4l2_ctrl_check(ctrl, &qctrl, menu_items); | 675 | err = v4l2_ctrl_check(ctrl, &qctrl, menu_items); |
664 | if (err) | 676 | if (err) |
665 | break; | 677 | break; |
666 | err = cx2341x_set_ctrl(params, ctrl); | 678 | err = cx2341x_set_ctrl(params, busy, ctrl); |
667 | if (err) | 679 | if (err) |
668 | break; | 680 | break; |
669 | } | 681 | } |