mirror of https://gitee.com/openkylin/linux.git
[media] v4l2: use new V4L2_DV_BT_BLANKING/FRAME defines
Use the new defines to calculate the full blanking and frame sizes. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Scott Jiang <scott.jiang.linux@gmail.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
7f68127fa1
commit
eacf8f9aa8
|
@ -445,10 +445,8 @@ static int ad9389b_log_status(struct v4l2_subdev *sd)
|
||||||
}
|
}
|
||||||
if (state->dv_timings.type == V4L2_DV_BT_656_1120) {
|
if (state->dv_timings.type == V4L2_DV_BT_656_1120) {
|
||||||
struct v4l2_bt_timings *bt = bt = &state->dv_timings.bt;
|
struct v4l2_bt_timings *bt = bt = &state->dv_timings.bt;
|
||||||
u32 frame_width = bt->width + bt->hfrontporch +
|
u32 frame_width = V4L2_DV_BT_FRAME_WIDTH(bt);
|
||||||
bt->hsync + bt->hbackporch;
|
u32 frame_height = V4L2_DV_BT_FRAME_HEIGHT(bt);
|
||||||
u32 frame_height = bt->height + bt->vfrontporch +
|
|
||||||
bt->vsync + bt->vbackporch;
|
|
||||||
u32 frame_size = frame_width * frame_height;
|
u32 frame_size = frame_width * frame_height;
|
||||||
|
|
||||||
v4l2_info(sd, "timings: %ux%u%s%u (%ux%u). Pix freq. = %u Hz. Polarities = 0x%x\n",
|
v4l2_info(sd, "timings: %ux%u%s%u (%ux%u). Pix freq. = %u Hz. Polarities = 0x%x\n",
|
||||||
|
|
|
@ -261,22 +261,22 @@ static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
|
||||||
|
|
||||||
static inline unsigned hblanking(const struct v4l2_bt_timings *t)
|
static inline unsigned hblanking(const struct v4l2_bt_timings *t)
|
||||||
{
|
{
|
||||||
return t->hfrontporch + t->hsync + t->hbackporch;
|
return V4L2_DV_BT_BLANKING_WIDTH(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned htotal(const struct v4l2_bt_timings *t)
|
static inline unsigned htotal(const struct v4l2_bt_timings *t)
|
||||||
{
|
{
|
||||||
return t->width + t->hfrontporch + t->hsync + t->hbackporch;
|
return V4L2_DV_BT_FRAME_WIDTH(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned vblanking(const struct v4l2_bt_timings *t)
|
static inline unsigned vblanking(const struct v4l2_bt_timings *t)
|
||||||
{
|
{
|
||||||
return t->vfrontporch + t->vsync + t->vbackporch;
|
return V4L2_DV_BT_BLANKING_HEIGHT(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned vtotal(const struct v4l2_bt_timings *t)
|
static inline unsigned vtotal(const struct v4l2_bt_timings *t)
|
||||||
{
|
{
|
||||||
return t->height + t->vfrontporch + t->vsync + t->vbackporch;
|
return V4L2_DV_BT_FRAME_HEIGHT(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
|
@ -291,10 +291,8 @@ static int ths7303_log_status(struct v4l2_subdev *sd)
|
||||||
struct v4l2_bt_timings *bt = bt = &state->bt;
|
struct v4l2_bt_timings *bt = bt = &state->bt;
|
||||||
u32 frame_width, frame_height;
|
u32 frame_width, frame_height;
|
||||||
|
|
||||||
frame_width = bt->width + bt->hfrontporch +
|
frame_width = V4L2_DV_BT_FRAME_WIDTH(bt);
|
||||||
bt->hsync + bt->hbackporch;
|
frame_height = V4L2_DV_BT_FRAME_HEIGHT(bt);
|
||||||
frame_height = bt->height + bt->vfrontporch +
|
|
||||||
bt->vsync + bt->vbackporch;
|
|
||||||
v4l2_info(sd,
|
v4l2_info(sd,
|
||||||
"timings: %dx%d%s%d (%dx%d). Pix freq. = %d Hz. Polarities = 0x%x\n",
|
"timings: %dx%d%s%d (%dx%d). Pix freq. = %d Hz. Polarities = 0x%x\n",
|
||||||
bt->width, bt->height, bt->interlaced ? "i" : "p",
|
bt->width, bt->height, bt->interlaced ? "i" : "p",
|
||||||
|
|
|
@ -65,22 +65,22 @@ static inline struct ths8200_state *to_state(struct v4l2_subdev *sd)
|
||||||
|
|
||||||
static inline unsigned hblanking(const struct v4l2_bt_timings *t)
|
static inline unsigned hblanking(const struct v4l2_bt_timings *t)
|
||||||
{
|
{
|
||||||
return t->hfrontporch + t->hsync + t->hbackporch;
|
return V4L2_DV_BT_BLANKING_WIDTH(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned htotal(const struct v4l2_bt_timings *t)
|
static inline unsigned htotal(const struct v4l2_bt_timings *t)
|
||||||
{
|
{
|
||||||
return t->width + t->hfrontporch + t->hsync + t->hbackporch;
|
return V4L2_DV_BT_FRAME_WIDTH(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned vblanking(const struct v4l2_bt_timings *t)
|
static inline unsigned vblanking(const struct v4l2_bt_timings *t)
|
||||||
{
|
{
|
||||||
return t->vfrontporch + t->vsync + t->vbackporch;
|
return V4L2_DV_BT_BLANKING_HEIGHT(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned vtotal(const struct v4l2_bt_timings *t)
|
static inline unsigned vtotal(const struct v4l2_bt_timings *t)
|
||||||
{
|
{
|
||||||
return t->height + t->vfrontporch + t->vsync + t->vbackporch;
|
return V4L2_DV_BT_FRAME_HEIGHT(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ths8200_read(struct v4l2_subdev *sd, u8 reg)
|
static int ths8200_read(struct v4l2_subdev *sd, u8 reg)
|
||||||
|
|
|
@ -388,13 +388,8 @@ static int bcap_start_streaming(struct vb2_queue *vq, unsigned int count)
|
||||||
|
|
||||||
params.hdelay = bt->hsync + bt->hbackporch;
|
params.hdelay = bt->hsync + bt->hbackporch;
|
||||||
params.vdelay = bt->vsync + bt->vbackporch;
|
params.vdelay = bt->vsync + bt->vbackporch;
|
||||||
params.line = bt->hfrontporch + bt->hsync
|
params.line = V4L2_DV_BT_FRAME_WIDTH(bt);
|
||||||
+ bt->hbackporch + bt->width;
|
params.frame = V4L2_DV_BT_FRAME_HEIGHT(bt);
|
||||||
params.frame = bt->vfrontporch + bt->vsync
|
|
||||||
+ bt->vbackporch + bt->height;
|
|
||||||
if (bt->interlaced)
|
|
||||||
params.frame += bt->il_vfrontporch + bt->il_vsync
|
|
||||||
+ bt->il_vbackporch;
|
|
||||||
} else if (bcap_dev->cfg->inputs[bcap_dev->cur_input].capabilities
|
} else if (bcap_dev->cfg->inputs[bcap_dev->cur_input].capabilities
|
||||||
& V4L2_IN_CAP_STD) {
|
& V4L2_IN_CAP_STD) {
|
||||||
params.hdelay = 0;
|
params.hdelay = 0;
|
||||||
|
|
|
@ -690,10 +690,8 @@ static int vidioc_query_dv_timings(struct file *file, void *_fh,
|
||||||
unsigned vsize;
|
unsigned vsize;
|
||||||
unsigned fps;
|
unsigned fps;
|
||||||
|
|
||||||
hsize = bt->hfrontporch + bt->hsync + bt->hbackporch + bt->width;
|
hsize = V4L2_DV_BT_FRAME_WIDTH(bt);
|
||||||
vsize = bt->vfrontporch + bt->vsync + bt->vbackporch +
|
vsize = V4L2_DV_BT_FRAME_HEIGHT(bt);
|
||||||
bt->il_vfrontporch + bt->il_vsync + bt->il_vbackporch +
|
|
||||||
bt->height;
|
|
||||||
fps = (unsigned)bt->pixelclock / (hsize * vsize);
|
fps = (unsigned)bt->pixelclock / (hsize * vsize);
|
||||||
if (bt->width != vid_info.width ||
|
if (bt->width != vid_info.width ||
|
||||||
bt->height != vid_info.height ||
|
bt->height != vid_info.height ||
|
||||||
|
|
Loading…
Reference in New Issue