diff options
author | Lad, Prabhakar <prabhakar.csengg@gmail.com> | 2014-05-16 09:33:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-23 18:29:29 -0400 |
commit | c66238f363b3c39c6aaa85d9c938a3d17eb9a352 (patch) | |
tree | 38237a929b3daadff7bea2874c66004b0874824a | |
parent | dbe2840a3eaa9d33cc5ca2c5a9691b41820bbd3b (diff) |
[media] media: davinic: vpif_capture: drop started member from struct common_obj
the started member was indicating whether streaming was started
or not, this can be determined by vb2 offering, this patch replaces
the started member from struct common_obj with appropriate vb2 calls.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/platform/davinci/vpif_capture.c | 36 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_capture.h | 2 |
2 files changed, 14 insertions, 24 deletions
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 6b66f55d09a0..b89877941661 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c | |||
@@ -73,6 +73,9 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode); | |||
73 | 73 | ||
74 | static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] = { {1, 1} }; | 74 | static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] = { {1, 1} }; |
75 | 75 | ||
76 | /* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */ | ||
77 | static int ycmux_mode; | ||
78 | |||
76 | static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb) | 79 | static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb) |
77 | { | 80 | { |
78 | return container_of(vb, struct vpif_cap_buffer, vb); | 81 | return container_of(vb, struct vpif_cap_buffer, vb); |
@@ -194,9 +197,8 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
194 | 197 | ||
195 | spin_lock_irqsave(&common->irqlock, flags); | 198 | spin_lock_irqsave(&common->irqlock, flags); |
196 | 199 | ||
197 | /* Initialize field_id and started member */ | 200 | /* Initialize field_id */ |
198 | ch->field_id = 0; | 201 | ch->field_id = 0; |
199 | common->started = 1; | ||
200 | 202 | ||
201 | /* configure 1 or 2 channel mode */ | 203 | /* configure 1 or 2 channel mode */ |
202 | if (vpif_config_data->setup_input_channel_mode) { | 204 | if (vpif_config_data->setup_input_channel_mode) { |
@@ -216,13 +218,12 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
216 | 218 | ||
217 | /* Call vpif_set_params function to set the parameters and addresses */ | 219 | /* Call vpif_set_params function to set the parameters and addresses */ |
218 | ret = vpif_set_video_params(vpif, ch->channel_id); | 220 | ret = vpif_set_video_params(vpif, ch->channel_id); |
219 | |||
220 | if (ret < 0) { | 221 | if (ret < 0) { |
221 | vpif_dbg(1, debug, "can't set video params\n"); | 222 | vpif_dbg(1, debug, "can't set video params\n"); |
222 | goto err; | 223 | goto err; |
223 | } | 224 | } |
224 | 225 | ||
225 | common->started = ret; | 226 | ycmux_mode = ret; |
226 | vpif_config_addr(ch, ret); | 227 | vpif_config_addr(ch, ret); |
227 | 228 | ||
228 | /* Get the next frame from the buffer queue */ | 229 | /* Get the next frame from the buffer queue */ |
@@ -252,7 +253,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) | |||
252 | enable_channel0(1); | 253 | enable_channel0(1); |
253 | } | 254 | } |
254 | if (VPIF_CHANNEL1_VIDEO == ch->channel_id || | 255 | if (VPIF_CHANNEL1_VIDEO == ch->channel_id || |
255 | common->started == 2) { | 256 | ycmux_mode == 2) { |
256 | channel1_intr_assert(); | 257 | channel1_intr_assert(); |
257 | channel1_intr_enable(1); | 258 | channel1_intr_enable(1); |
258 | enable_channel1(1); | 259 | enable_channel1(1); |
@@ -291,11 +292,12 @@ static void vpif_stop_streaming(struct vb2_queue *vq) | |||
291 | channel0_intr_enable(0); | 292 | channel0_intr_enable(0); |
292 | } | 293 | } |
293 | if (VPIF_CHANNEL1_VIDEO == ch->channel_id || | 294 | if (VPIF_CHANNEL1_VIDEO == ch->channel_id || |
294 | 2 == common->started) { | 295 | ycmux_mode == 2) { |
295 | enable_channel1(0); | 296 | enable_channel1(0); |
296 | channel1_intr_enable(0); | 297 | channel1_intr_enable(0); |
297 | } | 298 | } |
298 | common->started = 0; | 299 | |
300 | ycmux_mode = 0; | ||
299 | 301 | ||
300 | ret = v4l2_subdev_call(ch->sd, video, s_stream, 0); | 302 | ret = v4l2_subdev_call(ch->sd, video, s_stream, 0); |
301 | if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) | 303 | if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV) |
@@ -404,9 +406,6 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id) | |||
404 | for (i = 0; i < VPIF_NUMBER_OF_OBJECTS; i++) { | 406 | for (i = 0; i < VPIF_NUMBER_OF_OBJECTS; i++) { |
405 | common = &ch->common[i]; | 407 | common = &ch->common[i]; |
406 | /* skip If streaming is not started in this channel */ | 408 | /* skip If streaming is not started in this channel */ |
407 | if (0 == common->started) | ||
408 | continue; | ||
409 | |||
410 | /* Check the field format */ | 409 | /* Check the field format */ |
411 | if (1 == ch->vpifparams.std_info.frm_fmt) { | 410 | if (1 == ch->vpifparams.std_info.frm_fmt) { |
412 | /* Progressive mode */ | 411 | /* Progressive mode */ |
@@ -910,10 +909,8 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id) | |||
910 | 909 | ||
911 | vpif_dbg(2, debug, "vpif_s_std\n"); | 910 | vpif_dbg(2, debug, "vpif_s_std\n"); |
912 | 911 | ||
913 | if (common->started) { | 912 | if (vb2_is_busy(&common->buffer_queue)) |
914 | vpif_err("streaming in progress\n"); | ||
915 | return -EBUSY; | 913 | return -EBUSY; |
916 | } | ||
917 | 914 | ||
918 | /* Call encoder subdevice function to set the standard */ | 915 | /* Call encoder subdevice function to set the standard */ |
919 | ch->video.stdid = std_id; | 916 | ch->video.stdid = std_id; |
@@ -998,10 +995,8 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index) | |||
998 | if (index >= chan_cfg->input_count) | 995 | if (index >= chan_cfg->input_count) |
999 | return -EINVAL; | 996 | return -EINVAL; |
1000 | 997 | ||
1001 | if (common->started) { | 998 | if (vb2_is_busy(&common->buffer_queue)) |
1002 | vpif_err("Streaming in progress\n"); | ||
1003 | return -EBUSY; | 999 | return -EBUSY; |
1004 | } | ||
1005 | 1000 | ||
1006 | return vpif_set_input(config, ch, index); | 1001 | return vpif_set_input(config, ch, index); |
1007 | } | 1002 | } |
@@ -1092,11 +1087,8 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv, | |||
1092 | 1087 | ||
1093 | vpif_dbg(2, debug, "%s\n", __func__); | 1088 | vpif_dbg(2, debug, "%s\n", __func__); |
1094 | 1089 | ||
1095 | /* If streaming is started, return error */ | 1090 | if (vb2_is_busy(&common->buffer_queue)) |
1096 | if (common->started) { | ||
1097 | vpif_dbg(1, debug, "Streaming is started\n"); | ||
1098 | return -EBUSY; | 1091 | return -EBUSY; |
1099 | } | ||
1100 | 1092 | ||
1101 | pixfmt = &fmt->fmt.pix; | 1093 | pixfmt = &fmt->fmt.pix; |
1102 | /* Check for valid field format */ | 1094 | /* Check for valid field format */ |
@@ -1707,7 +1699,7 @@ static int vpif_suspend(struct device *dev) | |||
1707 | channel0_intr_enable(0); | 1699 | channel0_intr_enable(0); |
1708 | } | 1700 | } |
1709 | if (ch->channel_id == VPIF_CHANNEL1_VIDEO || | 1701 | if (ch->channel_id == VPIF_CHANNEL1_VIDEO || |
1710 | common->started == 2) { | 1702 | ycmux_mode == 2) { |
1711 | enable_channel1(0); | 1703 | enable_channel1(0); |
1712 | channel1_intr_enable(0); | 1704 | channel1_intr_enable(0); |
1713 | } | 1705 | } |
@@ -1739,7 +1731,7 @@ static int vpif_resume(struct device *dev) | |||
1739 | channel0_intr_enable(1); | 1731 | channel0_intr_enable(1); |
1740 | } | 1732 | } |
1741 | if (ch->channel_id == VPIF_CHANNEL1_VIDEO || | 1733 | if (ch->channel_id == VPIF_CHANNEL1_VIDEO || |
1742 | common->started == 2) { | 1734 | ycmux_mode == 2) { |
1743 | enable_channel1(1); | 1735 | enable_channel1(1); |
1744 | channel1_intr_enable(1); | 1736 | channel1_intr_enable(1); |
1745 | } | 1737 | } |
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h index 9b7dd06bfb0a..4960504a5108 100644 --- a/drivers/media/platform/davinci/vpif_capture.h +++ b/drivers/media/platform/davinci/vpif_capture.h | |||
@@ -77,8 +77,6 @@ struct common_obj { | |||
77 | struct mutex lock; | 77 | struct mutex lock; |
78 | /* number of users performing IO */ | 78 | /* number of users performing IO */ |
79 | u32 io_usrs; | 79 | u32 io_usrs; |
80 | /* Indicates whether streaming started */ | ||
81 | u8 started; | ||
82 | /* Function pointer to set the addresses */ | 80 | /* Function pointer to set the addresses */ |
83 | void (*set_addr) (unsigned long, unsigned long, unsigned long, | 81 | void (*set_addr) (unsigned long, unsigned long, unsigned long, |
84 | unsigned long); | 82 | unsigned long); |