[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>
This commit is contained in:
parent
dbe2840a3e
commit
c66238f363
2 changed files with 14 additions and 24 deletions
|
@ -73,6 +73,9 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode);
|
||||||
|
|
||||||
static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] = { {1, 1} };
|
static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] = { {1, 1} };
|
||||||
|
|
||||||
|
/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
|
||||||
|
static int ycmux_mode;
|
||||||
|
|
||||||
static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb)
|
static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb)
|
||||||
{
|
{
|
||||||
return container_of(vb, struct vpif_cap_buffer, vb);
|
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)
|
||||||
|
|
||||||
spin_lock_irqsave(&common->irqlock, flags);
|
spin_lock_irqsave(&common->irqlock, flags);
|
||||||
|
|
||||||
/* Initialize field_id and started member */
|
/* Initialize field_id */
|
||||||
ch->field_id = 0;
|
ch->field_id = 0;
|
||||||
common->started = 1;
|
|
||||||
|
|
||||||
/* configure 1 or 2 channel mode */
|
/* configure 1 or 2 channel mode */
|
||||||
if (vpif_config_data->setup_input_channel_mode) {
|
if (vpif_config_data->setup_input_channel_mode) {
|
||||||
|
@ -216,13 +218,12 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
|
||||||
|
|
||||||
/* Call vpif_set_params function to set the parameters and addresses */
|
/* Call vpif_set_params function to set the parameters and addresses */
|
||||||
ret = vpif_set_video_params(vpif, ch->channel_id);
|
ret = vpif_set_video_params(vpif, ch->channel_id);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
vpif_dbg(1, debug, "can't set video params\n");
|
vpif_dbg(1, debug, "can't set video params\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
common->started = ret;
|
ycmux_mode = ret;
|
||||||
vpif_config_addr(ch, ret);
|
vpif_config_addr(ch, ret);
|
||||||
|
|
||||||
/* Get the next frame from the buffer queue */
|
/* Get the next frame from the buffer queue */
|
||||||
|
@ -252,7 +253,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
|
||||||
enable_channel0(1);
|
enable_channel0(1);
|
||||||
}
|
}
|
||||||
if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
|
if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
|
||||||
common->started == 2) {
|
ycmux_mode == 2) {
|
||||||
channel1_intr_assert();
|
channel1_intr_assert();
|
||||||
channel1_intr_enable(1);
|
channel1_intr_enable(1);
|
||||||
enable_channel1(1);
|
enable_channel1(1);
|
||||||
|
@ -291,11 +292,12 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
|
||||||
channel0_intr_enable(0);
|
channel0_intr_enable(0);
|
||||||
}
|
}
|
||||||
if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
|
if (VPIF_CHANNEL1_VIDEO == ch->channel_id ||
|
||||||
2 == common->started) {
|
ycmux_mode == 2) {
|
||||||
enable_channel1(0);
|
enable_channel1(0);
|
||||||
channel1_intr_enable(0);
|
channel1_intr_enable(0);
|
||||||
}
|
}
|
||||||
common->started = 0;
|
|
||||||
|
ycmux_mode = 0;
|
||||||
|
|
||||||
ret = v4l2_subdev_call(ch->sd, video, s_stream, 0);
|
ret = v4l2_subdev_call(ch->sd, video, s_stream, 0);
|
||||||
if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV)
|
if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV)
|
||||||
|
@ -404,9 +406,6 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
|
||||||
for (i = 0; i < VPIF_NUMBER_OF_OBJECTS; i++) {
|
for (i = 0; i < VPIF_NUMBER_OF_OBJECTS; i++) {
|
||||||
common = &ch->common[i];
|
common = &ch->common[i];
|
||||||
/* skip If streaming is not started in this channel */
|
/* skip If streaming is not started in this channel */
|
||||||
if (0 == common->started)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Check the field format */
|
/* Check the field format */
|
||||||
if (1 == ch->vpifparams.std_info.frm_fmt) {
|
if (1 == ch->vpifparams.std_info.frm_fmt) {
|
||||||
/* Progressive mode */
|
/* Progressive mode */
|
||||||
|
@ -910,10 +909,8 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id)
|
||||||
|
|
||||||
vpif_dbg(2, debug, "vpif_s_std\n");
|
vpif_dbg(2, debug, "vpif_s_std\n");
|
||||||
|
|
||||||
if (common->started) {
|
if (vb2_is_busy(&common->buffer_queue))
|
||||||
vpif_err("streaming in progress\n");
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
|
|
||||||
/* Call encoder subdevice function to set the standard */
|
/* Call encoder subdevice function to set the standard */
|
||||||
ch->video.stdid = std_id;
|
ch->video.stdid = std_id;
|
||||||
|
@ -998,10 +995,8 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
|
||||||
if (index >= chan_cfg->input_count)
|
if (index >= chan_cfg->input_count)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (common->started) {
|
if (vb2_is_busy(&common->buffer_queue))
|
||||||
vpif_err("Streaming in progress\n");
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
|
|
||||||
return vpif_set_input(config, ch, index);
|
return vpif_set_input(config, ch, index);
|
||||||
}
|
}
|
||||||
|
@ -1092,11 +1087,8 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv,
|
||||||
|
|
||||||
vpif_dbg(2, debug, "%s\n", __func__);
|
vpif_dbg(2, debug, "%s\n", __func__);
|
||||||
|
|
||||||
/* If streaming is started, return error */
|
if (vb2_is_busy(&common->buffer_queue))
|
||||||
if (common->started) {
|
|
||||||
vpif_dbg(1, debug, "Streaming is started\n");
|
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
|
|
||||||
pixfmt = &fmt->fmt.pix;
|
pixfmt = &fmt->fmt.pix;
|
||||||
/* Check for valid field format */
|
/* Check for valid field format */
|
||||||
|
@ -1707,7 +1699,7 @@ static int vpif_suspend(struct device *dev)
|
||||||
channel0_intr_enable(0);
|
channel0_intr_enable(0);
|
||||||
}
|
}
|
||||||
if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
|
if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
|
||||||
common->started == 2) {
|
ycmux_mode == 2) {
|
||||||
enable_channel1(0);
|
enable_channel1(0);
|
||||||
channel1_intr_enable(0);
|
channel1_intr_enable(0);
|
||||||
}
|
}
|
||||||
|
@ -1739,7 +1731,7 @@ static int vpif_resume(struct device *dev)
|
||||||
channel0_intr_enable(1);
|
channel0_intr_enable(1);
|
||||||
}
|
}
|
||||||
if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
|
if (ch->channel_id == VPIF_CHANNEL1_VIDEO ||
|
||||||
common->started == 2) {
|
ycmux_mode == 2) {
|
||||||
enable_channel1(1);
|
enable_channel1(1);
|
||||||
channel1_intr_enable(1);
|
channel1_intr_enable(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,6 @@ struct common_obj {
|
||||||
struct mutex lock;
|
struct mutex lock;
|
||||||
/* number of users performing IO */
|
/* number of users performing IO */
|
||||||
u32 io_usrs;
|
u32 io_usrs;
|
||||||
/* Indicates whether streaming started */
|
|
||||||
u8 started;
|
|
||||||
/* Function pointer to set the addresses */
|
/* Function pointer to set the addresses */
|
||||||
void (*set_addr) (unsigned long, unsigned long, unsigned long,
|
void (*set_addr) (unsigned long, unsigned long, unsigned long,
|
||||||
unsigned long);
|
unsigned long);
|
||||||
|
|
Loading…
Add table
Reference in a new issue