diff options
author | Mats Randgaard <mats.randgaard@cisco.com> | 2010-12-16 10:17:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-01-19 08:28:17 -0500 |
commit | c027e165d2d901ecab485da5fee72ddce5da0297 (patch) | |
tree | ec04710c711f7b37fed3eccc040729652d97e0fe /drivers | |
parent | 40c8bcea6bc594c50abf3d3867bd49c8c039eb21 (diff) |
[media] vpif_cap/disp: Added support for DV timings
Added functions to set and get custom DV timings.
Signed-off-by: Mats Randgaard <mats.randgaard@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Vaibhav Hiremath <hvaibhav@ti.com>
Acked-by: Manjunath Hadli <manjunath.hadli@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/davinci/vpif_capture.c | 123 | ||||
-rw-r--r-- | drivers/media/video/davinci/vpif_capture.h | 1 | ||||
-rw-r--r-- | drivers/media/video/davinci/vpif_display.c | 190 | ||||
-rw-r--r-- | drivers/media/video/davinci/vpif_display.h | 1 |
4 files changed, 290 insertions, 25 deletions
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index 42f1cd60780..be2b9919937 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c | |||
@@ -1452,6 +1452,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1452 | 1452 | ||
1453 | ch->video.stdid = *std_id; | 1453 | ch->video.stdid = *std_id; |
1454 | ch->video.dv_preset = V4L2_DV_INVALID; | 1454 | ch->video.dv_preset = V4L2_DV_INVALID; |
1455 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1455 | 1456 | ||
1456 | /* Get the information about the standard */ | 1457 | /* Get the information about the standard */ |
1457 | if (vpif_update_std_info(ch)) { | 1458 | if (vpif_update_std_info(ch)) { |
@@ -1874,6 +1875,7 @@ static int vpif_s_dv_preset(struct file *file, void *priv, | |||
1874 | 1875 | ||
1875 | ch->video.dv_preset = preset->preset; | 1876 | ch->video.dv_preset = preset->preset; |
1876 | ch->video.stdid = V4L2_STD_UNKNOWN; | 1877 | ch->video.stdid = V4L2_STD_UNKNOWN; |
1878 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1877 | 1879 | ||
1878 | /* Get the information about the standard */ | 1880 | /* Get the information about the standard */ |
1879 | if (vpif_update_std_info(ch)) { | 1881 | if (vpif_update_std_info(ch)) { |
@@ -1908,6 +1910,125 @@ static int vpif_g_dv_preset(struct file *file, void *priv, | |||
1908 | return 0; | 1910 | return 0; |
1909 | } | 1911 | } |
1910 | 1912 | ||
1913 | /** | ||
1914 | * vpif_s_dv_timings() - S_DV_TIMINGS handler | ||
1915 | * @file: file ptr | ||
1916 | * @priv: file handle | ||
1917 | * @timings: digital video timings | ||
1918 | */ | ||
1919 | static int vpif_s_dv_timings(struct file *file, void *priv, | ||
1920 | struct v4l2_dv_timings *timings) | ||
1921 | { | ||
1922 | struct vpif_fh *fh = priv; | ||
1923 | struct channel_obj *ch = fh->channel; | ||
1924 | struct vpif_params *vpifparams = &ch->vpifparams; | ||
1925 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | ||
1926 | struct video_obj *vid_ch = &ch->video; | ||
1927 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
1928 | int ret; | ||
1929 | |||
1930 | if (timings->type != V4L2_DV_BT_656_1120) { | ||
1931 | vpif_dbg(2, debug, "Timing type not defined\n"); | ||
1932 | return -EINVAL; | ||
1933 | } | ||
1934 | |||
1935 | /* Configure subdevice timings, if any */ | ||
1936 | ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], | ||
1937 | video, s_dv_timings, timings); | ||
1938 | if (ret == -ENOIOCTLCMD) { | ||
1939 | vpif_dbg(2, debug, "Custom DV timings not supported by " | ||
1940 | "subdevice\n"); | ||
1941 | return -EINVAL; | ||
1942 | } | ||
1943 | if (ret < 0) { | ||
1944 | vpif_dbg(2, debug, "Error setting custom DV timings\n"); | ||
1945 | return ret; | ||
1946 | } | ||
1947 | |||
1948 | if (!(timings->bt.width && timings->bt.height && | ||
1949 | (timings->bt.hbackporch || | ||
1950 | timings->bt.hfrontporch || | ||
1951 | timings->bt.hsync) && | ||
1952 | timings->bt.vfrontporch && | ||
1953 | (timings->bt.vbackporch || | ||
1954 | timings->bt.vsync))) { | ||
1955 | vpif_dbg(2, debug, "Timings for width, height, " | ||
1956 | "horizontal back porch, horizontal sync, " | ||
1957 | "horizontal front porch, vertical back porch, " | ||
1958 | "vertical sync and vertical back porch " | ||
1959 | "must be defined\n"); | ||
1960 | return -EINVAL; | ||
1961 | } | ||
1962 | |||
1963 | *bt = timings->bt; | ||
1964 | |||
1965 | /* Configure video port timings */ | ||
1966 | |||
1967 | std_info->eav2sav = bt->hbackporch + bt->hfrontporch + | ||
1968 | bt->hsync - 8; | ||
1969 | std_info->sav2eav = bt->width; | ||
1970 | |||
1971 | std_info->l1 = 1; | ||
1972 | std_info->l3 = bt->vsync + bt->vbackporch + 1; | ||
1973 | |||
1974 | if (bt->interlaced) { | ||
1975 | if (bt->il_vbackporch || bt->il_vfrontporch || bt->il_vsync) { | ||
1976 | std_info->vsize = bt->height * 2 + | ||
1977 | bt->vfrontporch + bt->vsync + bt->vbackporch + | ||
1978 | bt->il_vfrontporch + bt->il_vsync + | ||
1979 | bt->il_vbackporch; | ||
1980 | std_info->l5 = std_info->vsize/2 - | ||
1981 | (bt->vfrontporch - 1); | ||
1982 | std_info->l7 = std_info->vsize/2 + 1; | ||
1983 | std_info->l9 = std_info->l7 + bt->il_vsync + | ||
1984 | bt->il_vbackporch + 1; | ||
1985 | std_info->l11 = std_info->vsize - | ||
1986 | (bt->il_vfrontporch - 1); | ||
1987 | } else { | ||
1988 | vpif_dbg(2, debug, "Required timing values for " | ||
1989 | "interlaced BT format missing\n"); | ||
1990 | return -EINVAL; | ||
1991 | } | ||
1992 | } else { | ||
1993 | std_info->vsize = bt->height + bt->vfrontporch + | ||
1994 | bt->vsync + bt->vbackporch; | ||
1995 | std_info->l5 = std_info->vsize - (bt->vfrontporch - 1); | ||
1996 | } | ||
1997 | strncpy(std_info->name, "Custom timings BT656/1120", VPIF_MAX_NAME); | ||
1998 | std_info->width = bt->width; | ||
1999 | std_info->height = bt->height; | ||
2000 | std_info->frm_fmt = bt->interlaced ? 0 : 1; | ||
2001 | std_info->ycmux_mode = 0; | ||
2002 | std_info->capture_format = 0; | ||
2003 | std_info->vbi_supported = 0; | ||
2004 | std_info->hd_sd = 1; | ||
2005 | std_info->stdid = 0; | ||
2006 | std_info->dv_preset = V4L2_DV_INVALID; | ||
2007 | |||
2008 | vid_ch->stdid = 0; | ||
2009 | vid_ch->dv_preset = V4L2_DV_INVALID; | ||
2010 | return 0; | ||
2011 | } | ||
2012 | |||
2013 | /** | ||
2014 | * vpif_g_dv_timings() - G_DV_TIMINGS handler | ||
2015 | * @file: file ptr | ||
2016 | * @priv: file handle | ||
2017 | * @timings: digital video timings | ||
2018 | */ | ||
2019 | static int vpif_g_dv_timings(struct file *file, void *priv, | ||
2020 | struct v4l2_dv_timings *timings) | ||
2021 | { | ||
2022 | struct vpif_fh *fh = priv; | ||
2023 | struct channel_obj *ch = fh->channel; | ||
2024 | struct video_obj *vid_ch = &ch->video; | ||
2025 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
2026 | |||
2027 | timings->bt = *bt; | ||
2028 | |||
2029 | return 0; | ||
2030 | } | ||
2031 | |||
1911 | /* | 2032 | /* |
1912 | * vpif_g_chip_ident() - Identify the chip | 2033 | * vpif_g_chip_ident() - Identify the chip |
1913 | * @file: file ptr | 2034 | * @file: file ptr |
@@ -2010,6 +2131,8 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | |||
2010 | .vidioc_s_dv_preset = vpif_s_dv_preset, | 2131 | .vidioc_s_dv_preset = vpif_s_dv_preset, |
2011 | .vidioc_g_dv_preset = vpif_g_dv_preset, | 2132 | .vidioc_g_dv_preset = vpif_g_dv_preset, |
2012 | .vidioc_query_dv_preset = vpif_query_dv_preset, | 2133 | .vidioc_query_dv_preset = vpif_query_dv_preset, |
2134 | .vidioc_s_dv_timings = vpif_s_dv_timings, | ||
2135 | .vidioc_g_dv_timings = vpif_g_dv_timings, | ||
2013 | .vidioc_g_chip_ident = vpif_g_chip_ident, | 2136 | .vidioc_g_chip_ident = vpif_g_chip_ident, |
2014 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 2137 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
2015 | .vidioc_g_register = vpif_dbg_g_register, | 2138 | .vidioc_g_register = vpif_dbg_g_register, |
diff --git a/drivers/media/video/davinci/vpif_capture.h b/drivers/media/video/davinci/vpif_capture.h index 3452a8aec02..7a4196dfdce 100644 --- a/drivers/media/video/davinci/vpif_capture.h +++ b/drivers/media/video/davinci/vpif_capture.h | |||
@@ -60,6 +60,7 @@ struct video_obj { | |||
60 | /* Currently selected or default standard */ | 60 | /* Currently selected or default standard */ |
61 | v4l2_std_id stdid; | 61 | v4l2_std_id stdid; |
62 | u32 dv_preset; | 62 | u32 dv_preset; |
63 | struct v4l2_bt_timings bt_timings; | ||
63 | /* This is to track the last input that is passed to application */ | 64 | /* This is to track the last input that is passed to application */ |
64 | u32 input_idx; | 65 | u32 input_idx; |
65 | }; | 66 | }; |
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index 759c5e855ac..44a885878eb 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c | |||
@@ -363,21 +363,17 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id) | |||
363 | return IRQ_HANDLED; | 363 | return IRQ_HANDLED; |
364 | } | 364 | } |
365 | 365 | ||
366 | static int vpif_get_std_info(struct channel_obj *ch) | 366 | static int vpif_update_std_info(struct channel_obj *ch) |
367 | { | 367 | { |
368 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | ||
369 | struct video_obj *vid_ch = &ch->video; | 368 | struct video_obj *vid_ch = &ch->video; |
370 | struct vpif_params *vpifparams = &ch->vpifparams; | 369 | struct vpif_params *vpifparams = &ch->vpifparams; |
371 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | 370 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; |
372 | const struct vpif_channel_config_params *config; | 371 | const struct vpif_channel_config_params *config; |
373 | 372 | ||
374 | int index; | 373 | int i; |
375 | |||
376 | if (!vid_ch->stdid && !vid_ch->dv_preset) | ||
377 | return -EINVAL; | ||
378 | 374 | ||
379 | for (index = 0; index < vpif_ch_params_count; index++) { | 375 | for (i = 0; i < vpif_ch_params_count; i++) { |
380 | config = &ch_params[index]; | 376 | config = &ch_params[i]; |
381 | if (config->hd_sd == 0) { | 377 | if (config->hd_sd == 0) { |
382 | vpif_dbg(2, debug, "SD format\n"); | 378 | vpif_dbg(2, debug, "SD format\n"); |
383 | if (config->stdid & vid_ch->stdid) { | 379 | if (config->stdid & vid_ch->stdid) { |
@@ -393,17 +389,37 @@ static int vpif_get_std_info(struct channel_obj *ch) | |||
393 | } | 389 | } |
394 | } | 390 | } |
395 | 391 | ||
396 | if (index == vpif_ch_params_count) | 392 | if (i == vpif_ch_params_count) { |
393 | vpif_dbg(1, debug, "Format not found\n"); | ||
394 | return -EINVAL; | ||
395 | } | ||
396 | |||
397 | return 0; | ||
398 | } | ||
399 | |||
400 | static int vpif_update_resolution(struct channel_obj *ch) | ||
401 | { | ||
402 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | ||
403 | struct video_obj *vid_ch = &ch->video; | ||
404 | struct vpif_params *vpifparams = &ch->vpifparams; | ||
405 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | ||
406 | |||
407 | if (!vid_ch->stdid && !vid_ch->dv_preset && !vid_ch->bt_timings.height) | ||
397 | return -EINVAL; | 408 | return -EINVAL; |
398 | 409 | ||
410 | if (vid_ch->stdid || vid_ch->dv_preset) { | ||
411 | if (vpif_update_std_info(ch)) | ||
412 | return -EINVAL; | ||
413 | } | ||
414 | |||
399 | common->fmt.fmt.pix.width = std_info->width; | 415 | common->fmt.fmt.pix.width = std_info->width; |
400 | common->fmt.fmt.pix.height = std_info->height; | 416 | common->fmt.fmt.pix.height = std_info->height; |
401 | vpif_dbg(1, debug, "Pixel details: Width = %d,Height = %d\n", | 417 | vpif_dbg(1, debug, "Pixel details: Width = %d,Height = %d\n", |
402 | common->fmt.fmt.pix.width, common->fmt.fmt.pix.height); | 418 | common->fmt.fmt.pix.width, common->fmt.fmt.pix.height); |
403 | 419 | ||
404 | /* Set height and width paramateres */ | 420 | /* Set height and width paramateres */ |
405 | ch->common[VPIF_VIDEO_INDEX].height = std_info->height; | 421 | common->height = std_info->height; |
406 | ch->common[VPIF_VIDEO_INDEX].width = std_info->width; | 422 | common->width = std_info->width; |
407 | 423 | ||
408 | return 0; | 424 | return 0; |
409 | } | 425 | } |
@@ -514,10 +530,8 @@ static int vpif_check_format(struct channel_obj *ch, | |||
514 | else | 530 | else |
515 | sizeimage = config_params.channel_bufsize[ch->channel_id]; | 531 | sizeimage = config_params.channel_bufsize[ch->channel_id]; |
516 | 532 | ||
517 | if (vpif_get_std_info(ch)) { | 533 | if (vpif_update_resolution(ch)) |
518 | vpif_err("Error getting the standard info\n"); | ||
519 | return -EINVAL; | 534 | return -EINVAL; |
520 | } | ||
521 | 535 | ||
522 | hpitch = pixfmt->bytesperline; | 536 | hpitch = pixfmt->bytesperline; |
523 | vpitch = sizeimage / (hpitch * 2); | 537 | vpitch = sizeimage / (hpitch * 2); |
@@ -715,6 +729,7 @@ static int vpif_g_fmt_vid_out(struct file *file, void *priv, | |||
715 | struct vpif_fh *fh = priv; | 729 | struct vpif_fh *fh = priv; |
716 | struct channel_obj *ch = fh->channel; | 730 | struct channel_obj *ch = fh->channel; |
717 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | 731 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; |
732 | int ret = 0; | ||
718 | 733 | ||
719 | /* Check the validity of the buffer type */ | 734 | /* Check the validity of the buffer type */ |
720 | if (common->fmt.type != fmt->type) | 735 | if (common->fmt.type != fmt->type) |
@@ -724,14 +739,14 @@ static int vpif_g_fmt_vid_out(struct file *file, void *priv, | |||
724 | if (mutex_lock_interruptible(&common->lock)) | 739 | if (mutex_lock_interruptible(&common->lock)) |
725 | return -ERESTARTSYS; | 740 | return -ERESTARTSYS; |
726 | 741 | ||
727 | if (vpif_get_std_info(ch)) { | 742 | if (vpif_update_resolution(ch)) |
728 | vpif_err("Error getting the standard info\n"); | 743 | ret = -EINVAL; |
729 | return -EINVAL; | 744 | else |
730 | } | 745 | *fmt = common->fmt; |
731 | 746 | ||
732 | *fmt = common->fmt; | ||
733 | mutex_unlock(&common->lock); | 747 | mutex_unlock(&common->lock); |
734 | return 0; | 748 | |
749 | return ret; | ||
735 | } | 750 | } |
736 | 751 | ||
737 | static int vpif_s_fmt_vid_out(struct file *file, void *priv, | 752 | static int vpif_s_fmt_vid_out(struct file *file, void *priv, |
@@ -992,10 +1007,13 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
992 | return -ERESTARTSYS; | 1007 | return -ERESTARTSYS; |
993 | 1008 | ||
994 | ch->video.stdid = *std_id; | 1009 | ch->video.stdid = *std_id; |
1010 | ch->video.dv_preset = V4L2_DV_INVALID; | ||
1011 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1012 | |||
995 | /* Get the information about the standard */ | 1013 | /* Get the information about the standard */ |
996 | if (vpif_get_std_info(ch)) { | 1014 | if (vpif_update_resolution(ch)) { |
997 | vpif_err("Error getting the standard info\n"); | 1015 | ret = -EINVAL; |
998 | return -EINVAL; | 1016 | goto s_std_exit; |
999 | } | 1017 | } |
1000 | 1018 | ||
1001 | if ((ch->vpifparams.std_info.width * | 1019 | if ((ch->vpifparams.std_info.width * |
@@ -1362,11 +1380,11 @@ static int vpif_s_dv_preset(struct file *file, void *priv, | |||
1362 | 1380 | ||
1363 | ch->video.dv_preset = preset->preset; | 1381 | ch->video.dv_preset = preset->preset; |
1364 | ch->video.stdid = V4L2_STD_UNKNOWN; | 1382 | ch->video.stdid = V4L2_STD_UNKNOWN; |
1383 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1365 | 1384 | ||
1366 | /* Get the information about the standard */ | 1385 | /* Get the information about the standard */ |
1367 | if (vpif_get_std_info(ch)) { | 1386 | if (vpif_update_resolution(ch)) { |
1368 | ret = -EINVAL; | 1387 | ret = -EINVAL; |
1369 | vpif_dbg(1, debug, "Error getting the standard info\n"); | ||
1370 | } else { | 1388 | } else { |
1371 | /* Configure the default format information */ | 1389 | /* Configure the default format information */ |
1372 | vpif_config_format(ch); | 1390 | vpif_config_format(ch); |
@@ -1395,6 +1413,126 @@ static int vpif_g_dv_preset(struct file *file, void *priv, | |||
1395 | 1413 | ||
1396 | return 0; | 1414 | return 0; |
1397 | } | 1415 | } |
1416 | /** | ||
1417 | * vpif_s_dv_timings() - S_DV_TIMINGS handler | ||
1418 | * @file: file ptr | ||
1419 | * @priv: file handle | ||
1420 | * @timings: digital video timings | ||
1421 | */ | ||
1422 | static int vpif_s_dv_timings(struct file *file, void *priv, | ||
1423 | struct v4l2_dv_timings *timings) | ||
1424 | { | ||
1425 | struct vpif_fh *fh = priv; | ||
1426 | struct channel_obj *ch = fh->channel; | ||
1427 | struct vpif_params *vpifparams = &ch->vpifparams; | ||
1428 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | ||
1429 | struct video_obj *vid_ch = &ch->video; | ||
1430 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
1431 | int ret; | ||
1432 | |||
1433 | if (timings->type != V4L2_DV_BT_656_1120) { | ||
1434 | vpif_dbg(2, debug, "Timing type not defined\n"); | ||
1435 | return -EINVAL; | ||
1436 | } | ||
1437 | |||
1438 | /* Configure subdevice timings, if any */ | ||
1439 | ret = v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], | ||
1440 | video, s_dv_timings, timings); | ||
1441 | if (ret == -ENOIOCTLCMD) { | ||
1442 | vpif_dbg(2, debug, "Custom DV timings not supported by " | ||
1443 | "subdevice\n"); | ||
1444 | return -EINVAL; | ||
1445 | } | ||
1446 | if (ret < 0) { | ||
1447 | vpif_dbg(2, debug, "Error setting custom DV timings\n"); | ||
1448 | return ret; | ||
1449 | } | ||
1450 | |||
1451 | if (!(timings->bt.width && timings->bt.height && | ||
1452 | (timings->bt.hbackporch || | ||
1453 | timings->bt.hfrontporch || | ||
1454 | timings->bt.hsync) && | ||
1455 | timings->bt.vfrontporch && | ||
1456 | (timings->bt.vbackporch || | ||
1457 | timings->bt.vsync))) { | ||
1458 | vpif_dbg(2, debug, "Timings for width, height, " | ||
1459 | "horizontal back porch, horizontal sync, " | ||
1460 | "horizontal front porch, vertical back porch, " | ||
1461 | "vertical sync and vertical back porch " | ||
1462 | "must be defined\n"); | ||
1463 | return -EINVAL; | ||
1464 | } | ||
1465 | |||
1466 | *bt = timings->bt; | ||
1467 | |||
1468 | /* Configure video port timings */ | ||
1469 | |||
1470 | std_info->eav2sav = bt->hbackporch + bt->hfrontporch + | ||
1471 | bt->hsync - 8; | ||
1472 | std_info->sav2eav = bt->width; | ||
1473 | |||
1474 | std_info->l1 = 1; | ||
1475 | std_info->l3 = bt->vsync + bt->vbackporch + 1; | ||
1476 | |||
1477 | if (bt->interlaced) { | ||
1478 | if (bt->il_vbackporch || bt->il_vfrontporch || bt->il_vsync) { | ||
1479 | std_info->vsize = bt->height * 2 + | ||
1480 | bt->vfrontporch + bt->vsync + bt->vbackporch + | ||
1481 | bt->il_vfrontporch + bt->il_vsync + | ||
1482 | bt->il_vbackporch; | ||
1483 | std_info->l5 = std_info->vsize/2 - | ||
1484 | (bt->vfrontporch - 1); | ||
1485 | std_info->l7 = std_info->vsize/2 + 1; | ||
1486 | std_info->l9 = std_info->l7 + bt->il_vsync + | ||
1487 | bt->il_vbackporch + 1; | ||
1488 | std_info->l11 = std_info->vsize - | ||
1489 | (bt->il_vfrontporch - 1); | ||
1490 | } else { | ||
1491 | vpif_dbg(2, debug, "Required timing values for " | ||
1492 | "interlaced BT format missing\n"); | ||
1493 | return -EINVAL; | ||
1494 | } | ||
1495 | } else { | ||
1496 | std_info->vsize = bt->height + bt->vfrontporch + | ||
1497 | bt->vsync + bt->vbackporch; | ||
1498 | std_info->l5 = std_info->vsize - (bt->vfrontporch - 1); | ||
1499 | } | ||
1500 | strncpy(std_info->name, "Custom timings BT656/1120", | ||
1501 | VPIF_MAX_NAME); | ||
1502 | std_info->width = bt->width; | ||
1503 | std_info->height = bt->height; | ||
1504 | std_info->frm_fmt = bt->interlaced ? 0 : 1; | ||
1505 | std_info->ycmux_mode = 0; | ||
1506 | std_info->capture_format = 0; | ||
1507 | std_info->vbi_supported = 0; | ||
1508 | std_info->hd_sd = 1; | ||
1509 | std_info->stdid = 0; | ||
1510 | std_info->dv_preset = V4L2_DV_INVALID; | ||
1511 | |||
1512 | vid_ch->stdid = 0; | ||
1513 | vid_ch->dv_preset = V4L2_DV_INVALID; | ||
1514 | |||
1515 | return 0; | ||
1516 | } | ||
1517 | |||
1518 | /** | ||
1519 | * vpif_g_dv_timings() - G_DV_TIMINGS handler | ||
1520 | * @file: file ptr | ||
1521 | * @priv: file handle | ||
1522 | * @timings: digital video timings | ||
1523 | */ | ||
1524 | static int vpif_g_dv_timings(struct file *file, void *priv, | ||
1525 | struct v4l2_dv_timings *timings) | ||
1526 | { | ||
1527 | struct vpif_fh *fh = priv; | ||
1528 | struct channel_obj *ch = fh->channel; | ||
1529 | struct video_obj *vid_ch = &ch->video; | ||
1530 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
1531 | |||
1532 | timings->bt = *bt; | ||
1533 | |||
1534 | return 0; | ||
1535 | } | ||
1398 | 1536 | ||
1399 | /* | 1537 | /* |
1400 | * vpif_g_chip_ident() - Identify the chip | 1538 | * vpif_g_chip_ident() - Identify the chip |
@@ -1498,6 +1636,8 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | |||
1498 | .vidioc_enum_dv_presets = vpif_enum_dv_presets, | 1636 | .vidioc_enum_dv_presets = vpif_enum_dv_presets, |
1499 | .vidioc_s_dv_preset = vpif_s_dv_preset, | 1637 | .vidioc_s_dv_preset = vpif_s_dv_preset, |
1500 | .vidioc_g_dv_preset = vpif_g_dv_preset, | 1638 | .vidioc_g_dv_preset = vpif_g_dv_preset, |
1639 | .vidioc_s_dv_timings = vpif_s_dv_timings, | ||
1640 | .vidioc_g_dv_timings = vpif_g_dv_timings, | ||
1501 | .vidioc_g_chip_ident = vpif_g_chip_ident, | 1641 | .vidioc_g_chip_ident = vpif_g_chip_ident, |
1502 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1642 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1503 | .vidioc_g_register = vpif_dbg_g_register, | 1643 | .vidioc_g_register = vpif_dbg_g_register, |
diff --git a/drivers/media/video/davinci/vpif_display.h b/drivers/media/video/davinci/vpif_display.h index 3d56b3e356a..b53aaa88307 100644 --- a/drivers/media/video/davinci/vpif_display.h +++ b/drivers/media/video/davinci/vpif_display.h | |||
@@ -68,6 +68,7 @@ struct video_obj { | |||
68 | v4l2_std_id stdid; /* Currently selected or default | 68 | v4l2_std_id stdid; /* Currently selected or default |
69 | * standard */ | 69 | * standard */ |
70 | u32 dv_preset; | 70 | u32 dv_preset; |
71 | struct v4l2_bt_timings bt_timings; | ||
71 | u32 output_id; /* Current output id */ | 72 | u32 output_id; /* Current output id */ |
72 | }; | 73 | }; |
73 | 74 | ||