diff options
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/davinci/vpif.c | 16 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif.h | 4 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_capture.c | 116 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_capture.h | 3 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_display.c | 104 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_display.h | 3 |
6 files changed, 46 insertions, 200 deletions
diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 9bd3caa34a3e..cff3c0ab501f 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/err.h> | 27 | #include <linux/err.h> |
28 | #include <linux/v4l2-dv-timings.h> | ||
29 | |||
28 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
29 | 31 | ||
30 | #include "vpif.h" | 32 | #include "vpif.h" |
@@ -65,7 +67,7 @@ const struct vpif_channel_config_params ch_params[] = { | |||
65 | .capture_format = 0, | 67 | .capture_format = 0, |
66 | .vbi_supported = 0, | 68 | .vbi_supported = 0, |
67 | .hd_sd = 1, | 69 | .hd_sd = 1, |
68 | .dv_preset = V4L2_DV_480P59_94, | 70 | .dv_timings = V4L2_DV_BT_CEA_720X480P59_94, |
69 | }, | 71 | }, |
70 | { | 72 | { |
71 | .name = "576p50", | 73 | .name = "576p50", |
@@ -82,7 +84,7 @@ const struct vpif_channel_config_params ch_params[] = { | |||
82 | .capture_format = 0, | 84 | .capture_format = 0, |
83 | .vbi_supported = 0, | 85 | .vbi_supported = 0, |
84 | .hd_sd = 1, | 86 | .hd_sd = 1, |
85 | .dv_preset = V4L2_DV_576P50, | 87 | .dv_timings = V4L2_DV_BT_CEA_720X576P50, |
86 | }, | 88 | }, |
87 | { | 89 | { |
88 | .name = "720p50", | 90 | .name = "720p50", |
@@ -99,7 +101,7 @@ const struct vpif_channel_config_params ch_params[] = { | |||
99 | .capture_format = 0, | 101 | .capture_format = 0, |
100 | .vbi_supported = 0, | 102 | .vbi_supported = 0, |
101 | .hd_sd = 1, | 103 | .hd_sd = 1, |
102 | .dv_preset = V4L2_DV_720P50, | 104 | .dv_timings = V4L2_DV_BT_CEA_1280X720P50, |
103 | }, | 105 | }, |
104 | { | 106 | { |
105 | .name = "720p60", | 107 | .name = "720p60", |
@@ -116,7 +118,7 @@ const struct vpif_channel_config_params ch_params[] = { | |||
116 | .capture_format = 0, | 118 | .capture_format = 0, |
117 | .vbi_supported = 0, | 119 | .vbi_supported = 0, |
118 | .hd_sd = 1, | 120 | .hd_sd = 1, |
119 | .dv_preset = V4L2_DV_720P60, | 121 | .dv_timings = V4L2_DV_BT_CEA_1280X720P60, |
120 | }, | 122 | }, |
121 | { | 123 | { |
122 | .name = "1080I50", | 124 | .name = "1080I50", |
@@ -136,7 +138,7 @@ const struct vpif_channel_config_params ch_params[] = { | |||
136 | .capture_format = 0, | 138 | .capture_format = 0, |
137 | .vbi_supported = 0, | 139 | .vbi_supported = 0, |
138 | .hd_sd = 1, | 140 | .hd_sd = 1, |
139 | .dv_preset = V4L2_DV_1080I50, | 141 | .dv_timings = V4L2_DV_BT_CEA_1920X1080I50, |
140 | }, | 142 | }, |
141 | { | 143 | { |
142 | .name = "1080I60", | 144 | .name = "1080I60", |
@@ -156,7 +158,7 @@ const struct vpif_channel_config_params ch_params[] = { | |||
156 | .capture_format = 0, | 158 | .capture_format = 0, |
157 | .vbi_supported = 0, | 159 | .vbi_supported = 0, |
158 | .hd_sd = 1, | 160 | .hd_sd = 1, |
159 | .dv_preset = V4L2_DV_1080I60, | 161 | .dv_timings = V4L2_DV_BT_CEA_1920X1080I60, |
160 | }, | 162 | }, |
161 | { | 163 | { |
162 | .name = "1080p60", | 164 | .name = "1080p60", |
@@ -173,7 +175,7 @@ const struct vpif_channel_config_params ch_params[] = { | |||
173 | .capture_format = 0, | 175 | .capture_format = 0, |
174 | .vbi_supported = 0, | 176 | .vbi_supported = 0, |
175 | .hd_sd = 1, | 177 | .hd_sd = 1, |
176 | .dv_preset = V4L2_DV_1080P60, | 178 | .dv_timings = V4L2_DV_BT_CEA_1920X1080P60, |
177 | }, | 179 | }, |
178 | 180 | ||
179 | /* SDTV formats */ | 181 | /* SDTV formats */ |
diff --git a/drivers/media/platform/davinci/vpif.h b/drivers/media/platform/davinci/vpif.h index c2ce4d97c279..a1ab6a0f4e9e 100644 --- a/drivers/media/platform/davinci/vpif.h +++ b/drivers/media/platform/davinci/vpif.h | |||
@@ -533,7 +533,7 @@ static inline void channel2_clipping_enable(int enable) | |||
533 | } | 533 | } |
534 | } | 534 | } |
535 | 535 | ||
536 | /* function to enable clipping (for both active and blanking regions) on ch 2 */ | 536 | /* function to enable clipping (for both active and blanking regions) on ch 3 */ |
537 | static inline void channel3_clipping_enable(int enable) | 537 | static inline void channel3_clipping_enable(int enable) |
538 | { | 538 | { |
539 | if (enable) { | 539 | if (enable) { |
@@ -634,7 +634,7 @@ struct vpif_channel_config_params { | |||
634 | * supports capturing vbi or not */ | 634 | * supports capturing vbi or not */ |
635 | u8 hd_sd; /* HDTV (1) or SDTV (0) format */ | 635 | u8 hd_sd; /* HDTV (1) or SDTV (0) format */ |
636 | v4l2_std_id stdid; /* SDTV format */ | 636 | v4l2_std_id stdid; /* SDTV format */ |
637 | u32 dv_preset; /* HDTV format */ | 637 | struct v4l2_dv_timings dv_timings; /* HDTV format */ |
638 | }; | 638 | }; |
639 | 639 | ||
640 | extern const unsigned int vpif_ch_params_count; | 640 | extern const unsigned int vpif_ch_params_count; |
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 1b625b065c32..13aa46dc2f33 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c | |||
@@ -551,7 +551,8 @@ static int vpif_update_std_info(struct channel_obj *ch) | |||
551 | } | 551 | } |
552 | } else { | 552 | } else { |
553 | vpif_dbg(2, debug, "HD format\n"); | 553 | vpif_dbg(2, debug, "HD format\n"); |
554 | if (config->dv_preset == vid_ch->dv_preset) { | 554 | if (!memcmp(&config->dv_timings, &vid_ch->dv_timings, |
555 | sizeof(vid_ch->dv_timings))) { | ||
555 | memcpy(std_info, config, sizeof(*config)); | 556 | memcpy(std_info, config, sizeof(*config)); |
556 | break; | 557 | break; |
557 | } | 558 | } |
@@ -1384,8 +1385,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1384 | 1385 | ||
1385 | /* Call encoder subdevice function to set the standard */ | 1386 | /* Call encoder subdevice function to set the standard */ |
1386 | ch->video.stdid = *std_id; | 1387 | ch->video.stdid = *std_id; |
1387 | ch->video.dv_preset = V4L2_DV_INVALID; | 1388 | memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings)); |
1388 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1389 | 1389 | ||
1390 | /* Get the information about the standard */ | 1390 | /* Get the information about the standard */ |
1391 | if (vpif_update_std_info(ch)) { | 1391 | if (vpif_update_std_info(ch)) { |
@@ -1719,108 +1719,37 @@ static int vpif_cropcap(struct file *file, void *priv, | |||
1719 | } | 1719 | } |
1720 | 1720 | ||
1721 | /** | 1721 | /** |
1722 | * vpif_enum_dv_presets() - ENUM_DV_PRESETS handler | 1722 | * vpif_enum_dv_timings() - ENUM_DV_TIMINGS handler |
1723 | * @file: file ptr | 1723 | * @file: file ptr |
1724 | * @priv: file handle | 1724 | * @priv: file handle |
1725 | * @preset: input preset | 1725 | * @timings: input timings |
1726 | */ | 1726 | */ |
1727 | static int vpif_enum_dv_presets(struct file *file, void *priv, | 1727 | static int |
1728 | struct v4l2_dv_enum_preset *preset) | 1728 | vpif_enum_dv_timings(struct file *file, void *priv, |
1729 | struct v4l2_enum_dv_timings *timings) | ||
1729 | { | 1730 | { |
1730 | struct vpif_fh *fh = priv; | 1731 | struct vpif_fh *fh = priv; |
1731 | struct channel_obj *ch = fh->channel; | 1732 | struct channel_obj *ch = fh->channel; |
1732 | 1733 | ||
1733 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], | 1734 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], |
1734 | video, enum_dv_presets, preset); | 1735 | video, enum_dv_timings, timings); |
1735 | } | 1736 | } |
1736 | 1737 | ||
1737 | /** | 1738 | /** |
1738 | * vpif_query_dv_presets() - QUERY_DV_PRESET handler | 1739 | * vpif_query_dv_timings() - QUERY_DV_TIMINGS handler |
1739 | * @file: file ptr | 1740 | * @file: file ptr |
1740 | * @priv: file handle | 1741 | * @priv: file handle |
1741 | * @preset: input preset | 1742 | * @timings: input timings |
1742 | */ | 1743 | */ |
1743 | static int vpif_query_dv_preset(struct file *file, void *priv, | 1744 | static int |
1744 | struct v4l2_dv_preset *preset) | 1745 | vpif_query_dv_timings(struct file *file, void *priv, |
1746 | struct v4l2_dv_timings *timings) | ||
1745 | { | 1747 | { |
1746 | struct vpif_fh *fh = priv; | 1748 | struct vpif_fh *fh = priv; |
1747 | struct channel_obj *ch = fh->channel; | 1749 | struct channel_obj *ch = fh->channel; |
1748 | 1750 | ||
1749 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], | 1751 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], |
1750 | video, query_dv_preset, preset); | 1752 | video, query_dv_timings, timings); |
1751 | } | ||
1752 | /** | ||
1753 | * vpif_s_dv_presets() - S_DV_PRESETS handler | ||
1754 | * @file: file ptr | ||
1755 | * @priv: file handle | ||
1756 | * @preset: input preset | ||
1757 | */ | ||
1758 | static int vpif_s_dv_preset(struct file *file, void *priv, | ||
1759 | struct v4l2_dv_preset *preset) | ||
1760 | { | ||
1761 | struct vpif_fh *fh = priv; | ||
1762 | struct channel_obj *ch = fh->channel; | ||
1763 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | ||
1764 | int ret = 0; | ||
1765 | |||
1766 | if (common->started) { | ||
1767 | vpif_dbg(1, debug, "streaming in progress\n"); | ||
1768 | return -EBUSY; | ||
1769 | } | ||
1770 | |||
1771 | if ((VPIF_CHANNEL0_VIDEO == ch->channel_id) || | ||
1772 | (VPIF_CHANNEL1_VIDEO == ch->channel_id)) { | ||
1773 | if (!fh->initialized) { | ||
1774 | vpif_dbg(1, debug, "Channel Busy\n"); | ||
1775 | return -EBUSY; | ||
1776 | } | ||
1777 | } | ||
1778 | |||
1779 | ret = v4l2_prio_check(&ch->prio, fh->prio); | ||
1780 | if (ret) | ||
1781 | return ret; | ||
1782 | |||
1783 | fh->initialized = 1; | ||
1784 | |||
1785 | /* Call encoder subdevice function to set the standard */ | ||
1786 | if (mutex_lock_interruptible(&common->lock)) | ||
1787 | return -ERESTARTSYS; | ||
1788 | |||
1789 | ch->video.dv_preset = preset->preset; | ||
1790 | ch->video.stdid = V4L2_STD_UNKNOWN; | ||
1791 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1792 | |||
1793 | /* Get the information about the standard */ | ||
1794 | if (vpif_update_std_info(ch)) { | ||
1795 | vpif_dbg(1, debug, "Error getting the standard info\n"); | ||
1796 | ret = -EINVAL; | ||
1797 | } else { | ||
1798 | /* Configure the default format information */ | ||
1799 | vpif_config_format(ch); | ||
1800 | |||
1801 | ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], | ||
1802 | video, s_dv_preset, preset); | ||
1803 | } | ||
1804 | |||
1805 | mutex_unlock(&common->lock); | ||
1806 | |||
1807 | return ret; | ||
1808 | } | ||
1809 | /** | ||
1810 | * vpif_g_dv_presets() - G_DV_PRESETS handler | ||
1811 | * @file: file ptr | ||
1812 | * @priv: file handle | ||
1813 | * @preset: input preset | ||
1814 | */ | ||
1815 | static int vpif_g_dv_preset(struct file *file, void *priv, | ||
1816 | struct v4l2_dv_preset *preset) | ||
1817 | { | ||
1818 | struct vpif_fh *fh = priv; | ||
1819 | struct channel_obj *ch = fh->channel; | ||
1820 | |||
1821 | preset->preset = ch->video.dv_preset; | ||
1822 | |||
1823 | return 0; | ||
1824 | } | 1753 | } |
1825 | 1754 | ||
1826 | /** | 1755 | /** |
@@ -1837,7 +1766,7 @@ static int vpif_s_dv_timings(struct file *file, void *priv, | |||
1837 | struct vpif_params *vpifparams = &ch->vpifparams; | 1766 | struct vpif_params *vpifparams = &ch->vpifparams; |
1838 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | 1767 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; |
1839 | struct video_obj *vid_ch = &ch->video; | 1768 | struct video_obj *vid_ch = &ch->video; |
1840 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | 1769 | struct v4l2_bt_timings *bt = &vid_ch->dv_timings.bt; |
1841 | int ret; | 1770 | int ret; |
1842 | 1771 | ||
1843 | if (timings->type != V4L2_DV_BT_656_1120) { | 1772 | if (timings->type != V4L2_DV_BT_656_1120) { |
@@ -1873,7 +1802,7 @@ static int vpif_s_dv_timings(struct file *file, void *priv, | |||
1873 | return -EINVAL; | 1802 | return -EINVAL; |
1874 | } | 1803 | } |
1875 | 1804 | ||
1876 | *bt = timings->bt; | 1805 | vid_ch->dv_timings = *timings; |
1877 | 1806 | ||
1878 | /* Configure video port timings */ | 1807 | /* Configure video port timings */ |
1879 | 1808 | ||
@@ -1916,10 +1845,8 @@ static int vpif_s_dv_timings(struct file *file, void *priv, | |||
1916 | std_info->vbi_supported = 0; | 1845 | std_info->vbi_supported = 0; |
1917 | std_info->hd_sd = 1; | 1846 | std_info->hd_sd = 1; |
1918 | std_info->stdid = 0; | 1847 | std_info->stdid = 0; |
1919 | std_info->dv_preset = V4L2_DV_INVALID; | ||
1920 | 1848 | ||
1921 | vid_ch->stdid = 0; | 1849 | vid_ch->stdid = 0; |
1922 | vid_ch->dv_preset = V4L2_DV_INVALID; | ||
1923 | return 0; | 1850 | return 0; |
1924 | } | 1851 | } |
1925 | 1852 | ||
@@ -1935,9 +1862,8 @@ static int vpif_g_dv_timings(struct file *file, void *priv, | |||
1935 | struct vpif_fh *fh = priv; | 1862 | struct vpif_fh *fh = priv; |
1936 | struct channel_obj *ch = fh->channel; | 1863 | struct channel_obj *ch = fh->channel; |
1937 | struct video_obj *vid_ch = &ch->video; | 1864 | struct video_obj *vid_ch = &ch->video; |
1938 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
1939 | 1865 | ||
1940 | timings->bt = *bt; | 1866 | *timings = vid_ch->dv_timings; |
1941 | 1867 | ||
1942 | return 0; | 1868 | return 0; |
1943 | } | 1869 | } |
@@ -2040,10 +1966,8 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | |||
2040 | .vidioc_streamon = vpif_streamon, | 1966 | .vidioc_streamon = vpif_streamon, |
2041 | .vidioc_streamoff = vpif_streamoff, | 1967 | .vidioc_streamoff = vpif_streamoff, |
2042 | .vidioc_cropcap = vpif_cropcap, | 1968 | .vidioc_cropcap = vpif_cropcap, |
2043 | .vidioc_enum_dv_presets = vpif_enum_dv_presets, | 1969 | .vidioc_enum_dv_timings = vpif_enum_dv_timings, |
2044 | .vidioc_s_dv_preset = vpif_s_dv_preset, | 1970 | .vidioc_query_dv_timings = vpif_query_dv_timings, |
2045 | .vidioc_g_dv_preset = vpif_g_dv_preset, | ||
2046 | .vidioc_query_dv_preset = vpif_query_dv_preset, | ||
2047 | .vidioc_s_dv_timings = vpif_s_dv_timings, | 1971 | .vidioc_s_dv_timings = vpif_s_dv_timings, |
2048 | .vidioc_g_dv_timings = vpif_g_dv_timings, | 1972 | .vidioc_g_dv_timings = vpif_g_dv_timings, |
2049 | .vidioc_g_chip_ident = vpif_g_chip_ident, | 1973 | .vidioc_g_chip_ident = vpif_g_chip_ident, |
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h index 3511510f43ee..aa6d3daffda8 100644 --- a/drivers/media/platform/davinci/vpif_capture.h +++ b/drivers/media/platform/davinci/vpif_capture.h | |||
@@ -54,8 +54,7 @@ struct video_obj { | |||
54 | enum v4l2_field buf_field; | 54 | enum v4l2_field buf_field; |
55 | /* Currently selected or default standard */ | 55 | /* Currently selected or default standard */ |
56 | v4l2_std_id stdid; | 56 | v4l2_std_id stdid; |
57 | u32 dv_preset; | 57 | struct v4l2_dv_timings dv_timings; |
58 | struct v4l2_bt_timings bt_timings; | ||
59 | /* This is to track the last input that is passed to application */ | 58 | /* This is to track the last input that is passed to application */ |
60 | u32 input_idx; | 59 | u32 input_idx; |
61 | }; | 60 | }; |
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index ff6e43293ce4..8003c56487bb 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c | |||
@@ -499,12 +499,6 @@ static int vpif_update_std_info(struct channel_obj *ch) | |||
499 | memcpy(std_info, config, sizeof(*config)); | 499 | memcpy(std_info, config, sizeof(*config)); |
500 | break; | 500 | break; |
501 | } | 501 | } |
502 | } else { | ||
503 | vpif_dbg(2, debug, "HD format\n"); | ||
504 | if (config->dv_preset == vid_ch->dv_preset) { | ||
505 | memcpy(std_info, config, sizeof(*config)); | ||
506 | break; | ||
507 | } | ||
508 | } | 502 | } |
509 | } | 503 | } |
510 | 504 | ||
@@ -523,10 +517,10 @@ static int vpif_update_resolution(struct channel_obj *ch) | |||
523 | struct vpif_params *vpifparams = &ch->vpifparams; | 517 | struct vpif_params *vpifparams = &ch->vpifparams; |
524 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | 518 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; |
525 | 519 | ||
526 | if (!vid_ch->stdid && !vid_ch->dv_preset && !vid_ch->bt_timings.height) | 520 | if (!vid_ch->stdid && !vid_ch->dv_timings.bt.height) |
527 | return -EINVAL; | 521 | return -EINVAL; |
528 | 522 | ||
529 | if (vid_ch->stdid || vid_ch->dv_preset) { | 523 | if (vid_ch->stdid) { |
530 | if (vpif_update_std_info(ch)) | 524 | if (vpif_update_std_info(ch)) |
531 | return -EINVAL; | 525 | return -EINVAL; |
532 | } | 526 | } |
@@ -1055,9 +1049,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
1055 | 1049 | ||
1056 | /* Call encoder subdevice function to set the standard */ | 1050 | /* Call encoder subdevice function to set the standard */ |
1057 | ch->video.stdid = *std_id; | 1051 | ch->video.stdid = *std_id; |
1058 | ch->video.dv_preset = V4L2_DV_INVALID; | 1052 | memset(&ch->video.dv_timings, 0, sizeof(ch->video.dv_timings)); |
1059 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1060 | |||
1061 | /* Get the information about the standard */ | 1053 | /* Get the information about the standard */ |
1062 | if (vpif_update_resolution(ch)) | 1054 | if (vpif_update_resolution(ch)) |
1063 | return -EINVAL; | 1055 | return -EINVAL; |
@@ -1287,88 +1279,24 @@ static int vpif_s_priority(struct file *file, void *priv, enum v4l2_priority p) | |||
1287 | } | 1279 | } |
1288 | 1280 | ||
1289 | /** | 1281 | /** |
1290 | * vpif_enum_dv_presets() - ENUM_DV_PRESETS handler | 1282 | * vpif_enum_dv_timings() - ENUM_DV_TIMINGS handler |
1291 | * @file: file ptr | 1283 | * @file: file ptr |
1292 | * @priv: file handle | 1284 | * @priv: file handle |
1293 | * @preset: input preset | 1285 | * @timings: input timings |
1294 | */ | 1286 | */ |
1295 | static int vpif_enum_dv_presets(struct file *file, void *priv, | 1287 | static int |
1296 | struct v4l2_dv_enum_preset *preset) | 1288 | vpif_enum_dv_timings(struct file *file, void *priv, |
1289 | struct v4l2_enum_dv_timings *timings) | ||
1297 | { | 1290 | { |
1298 | struct vpif_fh *fh = priv; | 1291 | struct vpif_fh *fh = priv; |
1299 | struct channel_obj *ch = fh->channel; | 1292 | struct channel_obj *ch = fh->channel; |
1300 | struct video_obj *vid_ch = &ch->video; | 1293 | struct video_obj *vid_ch = &ch->video; |
1301 | 1294 | ||
1302 | return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], | 1295 | return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], |
1303 | video, enum_dv_presets, preset); | 1296 | video, enum_dv_timings, timings); |
1304 | } | 1297 | } |
1305 | 1298 | ||
1306 | /** | 1299 | /** |
1307 | * vpif_s_dv_presets() - S_DV_PRESETS handler | ||
1308 | * @file: file ptr | ||
1309 | * @priv: file handle | ||
1310 | * @preset: input preset | ||
1311 | */ | ||
1312 | static int vpif_s_dv_preset(struct file *file, void *priv, | ||
1313 | struct v4l2_dv_preset *preset) | ||
1314 | { | ||
1315 | struct vpif_fh *fh = priv; | ||
1316 | struct channel_obj *ch = fh->channel; | ||
1317 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | ||
1318 | struct video_obj *vid_ch = &ch->video; | ||
1319 | int ret = 0; | ||
1320 | |||
1321 | if (common->started) { | ||
1322 | vpif_dbg(1, debug, "streaming in progress\n"); | ||
1323 | return -EBUSY; | ||
1324 | } | ||
1325 | |||
1326 | ret = v4l2_prio_check(&ch->prio, fh->prio); | ||
1327 | if (ret != 0) | ||
1328 | return ret; | ||
1329 | |||
1330 | fh->initialized = 1; | ||
1331 | |||
1332 | /* Call encoder subdevice function to set the standard */ | ||
1333 | if (mutex_lock_interruptible(&common->lock)) | ||
1334 | return -ERESTARTSYS; | ||
1335 | |||
1336 | ch->video.dv_preset = preset->preset; | ||
1337 | ch->video.stdid = V4L2_STD_UNKNOWN; | ||
1338 | memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings)); | ||
1339 | |||
1340 | /* Get the information about the standard */ | ||
1341 | if (vpif_update_resolution(ch)) { | ||
1342 | ret = -EINVAL; | ||
1343 | } else { | ||
1344 | /* Configure the default format information */ | ||
1345 | vpif_config_format(ch); | ||
1346 | |||
1347 | ret = v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], | ||
1348 | video, s_dv_preset, preset); | ||
1349 | } | ||
1350 | |||
1351 | mutex_unlock(&common->lock); | ||
1352 | |||
1353 | return ret; | ||
1354 | } | ||
1355 | /** | ||
1356 | * vpif_g_dv_presets() - G_DV_PRESETS handler | ||
1357 | * @file: file ptr | ||
1358 | * @priv: file handle | ||
1359 | * @preset: input preset | ||
1360 | */ | ||
1361 | static int vpif_g_dv_preset(struct file *file, void *priv, | ||
1362 | struct v4l2_dv_preset *preset) | ||
1363 | { | ||
1364 | struct vpif_fh *fh = priv; | ||
1365 | struct channel_obj *ch = fh->channel; | ||
1366 | |||
1367 | preset->preset = ch->video.dv_preset; | ||
1368 | |||
1369 | return 0; | ||
1370 | } | ||
1371 | /** | ||
1372 | * vpif_s_dv_timings() - S_DV_TIMINGS handler | 1300 | * vpif_s_dv_timings() - S_DV_TIMINGS handler |
1373 | * @file: file ptr | 1301 | * @file: file ptr |
1374 | * @priv: file handle | 1302 | * @priv: file handle |
@@ -1382,7 +1310,7 @@ static int vpif_s_dv_timings(struct file *file, void *priv, | |||
1382 | struct vpif_params *vpifparams = &ch->vpifparams; | 1310 | struct vpif_params *vpifparams = &ch->vpifparams; |
1383 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; | 1311 | struct vpif_channel_config_params *std_info = &vpifparams->std_info; |
1384 | struct video_obj *vid_ch = &ch->video; | 1312 | struct video_obj *vid_ch = &ch->video; |
1385 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | 1313 | struct v4l2_bt_timings *bt = &vid_ch->dv_timings.bt; |
1386 | int ret; | 1314 | int ret; |
1387 | 1315 | ||
1388 | if (timings->type != V4L2_DV_BT_656_1120) { | 1316 | if (timings->type != V4L2_DV_BT_656_1120) { |
@@ -1418,7 +1346,7 @@ static int vpif_s_dv_timings(struct file *file, void *priv, | |||
1418 | return -EINVAL; | 1346 | return -EINVAL; |
1419 | } | 1347 | } |
1420 | 1348 | ||
1421 | *bt = timings->bt; | 1349 | vid_ch->dv_timings = *timings; |
1422 | 1350 | ||
1423 | /* Configure video port timings */ | 1351 | /* Configure video port timings */ |
1424 | 1352 | ||
@@ -1462,10 +1390,7 @@ static int vpif_s_dv_timings(struct file *file, void *priv, | |||
1462 | std_info->vbi_supported = 0; | 1390 | std_info->vbi_supported = 0; |
1463 | std_info->hd_sd = 1; | 1391 | std_info->hd_sd = 1; |
1464 | std_info->stdid = 0; | 1392 | std_info->stdid = 0; |
1465 | std_info->dv_preset = V4L2_DV_INVALID; | ||
1466 | |||
1467 | vid_ch->stdid = 0; | 1393 | vid_ch->stdid = 0; |
1468 | vid_ch->dv_preset = V4L2_DV_INVALID; | ||
1469 | 1394 | ||
1470 | return 0; | 1395 | return 0; |
1471 | } | 1396 | } |
@@ -1482,9 +1407,8 @@ static int vpif_g_dv_timings(struct file *file, void *priv, | |||
1482 | struct vpif_fh *fh = priv; | 1407 | struct vpif_fh *fh = priv; |
1483 | struct channel_obj *ch = fh->channel; | 1408 | struct channel_obj *ch = fh->channel; |
1484 | struct video_obj *vid_ch = &ch->video; | 1409 | struct video_obj *vid_ch = &ch->video; |
1485 | struct v4l2_bt_timings *bt = &vid_ch->bt_timings; | ||
1486 | 1410 | ||
1487 | timings->bt = *bt; | 1411 | *timings = vid_ch->dv_timings; |
1488 | 1412 | ||
1489 | return 0; | 1413 | return 0; |
1490 | } | 1414 | } |
@@ -1588,9 +1512,7 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | |||
1588 | .vidioc_s_output = vpif_s_output, | 1512 | .vidioc_s_output = vpif_s_output, |
1589 | .vidioc_g_output = vpif_g_output, | 1513 | .vidioc_g_output = vpif_g_output, |
1590 | .vidioc_cropcap = vpif_cropcap, | 1514 | .vidioc_cropcap = vpif_cropcap, |
1591 | .vidioc_enum_dv_presets = vpif_enum_dv_presets, | 1515 | .vidioc_enum_dv_timings = vpif_enum_dv_timings, |
1592 | .vidioc_s_dv_preset = vpif_s_dv_preset, | ||
1593 | .vidioc_g_dv_preset = vpif_g_dv_preset, | ||
1594 | .vidioc_s_dv_timings = vpif_s_dv_timings, | 1516 | .vidioc_s_dv_timings = vpif_s_dv_timings, |
1595 | .vidioc_g_dv_timings = vpif_g_dv_timings, | 1517 | .vidioc_g_dv_timings = vpif_g_dv_timings, |
1596 | .vidioc_g_chip_ident = vpif_g_chip_ident, | 1518 | .vidioc_g_chip_ident = vpif_g_chip_ident, |
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h index 8967ffb44058..1263de6d3fae 100644 --- a/drivers/media/platform/davinci/vpif_display.h +++ b/drivers/media/platform/davinci/vpif_display.h | |||
@@ -62,8 +62,7 @@ struct video_obj { | |||
62 | * most recent displayed frame only */ | 62 | * most recent displayed frame only */ |
63 | v4l2_std_id stdid; /* Currently selected or default | 63 | v4l2_std_id stdid; /* Currently selected or default |
64 | * standard */ | 64 | * standard */ |
65 | u32 dv_preset; | 65 | struct v4l2_dv_timings dv_timings; |
66 | struct v4l2_bt_timings bt_timings; | ||
67 | u32 output_id; /* Current output id */ | 66 | u32 output_id; /* Current output id */ |
68 | }; | 67 | }; |
69 | 68 | ||