aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/davinci/vpif_capture.c
diff options
context:
space:
mode:
authorMats Randgaard <mats.randgaard@cisco.com>2010-12-16 10:17:43 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-01-19 08:28:16 -0500
commit40c8bcea6bc594c50abf3d3867bd49c8c039eb21 (patch)
tree8472b31720934b42520d19dc16ec4fe2bc247737 /drivers/media/video/davinci/vpif_capture.c
parentaa4444063505983c5971bc8fb832385dfba16b41 (diff)
[media] vpif_cap/disp: Add support for DV presets
- Added functions to set/get/query/enum DV presets for vpif_caputre and vpif_display. - The format specification table is extended with all the DV formats supported by TVP7002. Signed-off-by: Mats Randgaard <mats.randgaard@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Manjunath Hadli <manjunath.hadli@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/davinci/vpif_capture.c')
-rw-r--r--drivers/media/video/davinci/vpif_capture.c124
1 files changed, 121 insertions, 3 deletions
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c
index 0a7ebb0e151a..42f1cd60780b 100644
--- a/drivers/media/video/davinci/vpif_capture.c
+++ b/drivers/media/video/davinci/vpif_capture.c
@@ -432,9 +432,18 @@ static int vpif_update_std_info(struct channel_obj *ch)
432 432
433 for (index = 0; index < vpif_ch_params_count; index++) { 433 for (index = 0; index < vpif_ch_params_count; index++) {
434 config = &ch_params[index]; 434 config = &ch_params[index];
435 if (config->stdid & vid_ch->stdid) { 435 if (config->hd_sd == 0) {
436 memcpy(std_info, config, sizeof(*config)); 436 vpif_dbg(2, debug, "SD format\n");
437 break; 437 if (config->stdid & vid_ch->stdid) {
438 memcpy(std_info, config, sizeof(*config));
439 break;
440 }
441 } else {
442 vpif_dbg(2, debug, "HD format\n");
443 if (config->dv_preset == vid_ch->dv_preset) {
444 memcpy(std_info, config, sizeof(*config));
445 break;
446 }
438 } 447 }
439 } 448 }
440 449
@@ -1442,6 +1451,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id)
1442 return -ERESTARTSYS; 1451 return -ERESTARTSYS;
1443 1452
1444 ch->video.stdid = *std_id; 1453 ch->video.stdid = *std_id;
1454 ch->video.dv_preset = V4L2_DV_INVALID;
1445 1455
1446 /* Get the information about the standard */ 1456 /* Get the information about the standard */
1447 if (vpif_update_std_info(ch)) { 1457 if (vpif_update_std_info(ch)) {
@@ -1794,6 +1804,110 @@ static int vpif_cropcap(struct file *file, void *priv,
1794 return 0; 1804 return 0;
1795} 1805}
1796 1806
1807/**
1808 * vpif_enum_dv_presets() - ENUM_DV_PRESETS handler
1809 * @file: file ptr
1810 * @priv: file handle
1811 * @preset: input preset
1812 */
1813static int vpif_enum_dv_presets(struct file *file, void *priv,
1814 struct v4l2_dv_enum_preset *preset)
1815{
1816 struct vpif_fh *fh = priv;
1817 struct channel_obj *ch = fh->channel;
1818
1819 return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index],
1820 video, enum_dv_presets, preset);
1821}
1822
1823/**
1824 * vpif_query_dv_presets() - QUERY_DV_PRESET handler
1825 * @file: file ptr
1826 * @priv: file handle
1827 * @preset: input preset
1828 */
1829static int vpif_query_dv_preset(struct file *file, void *priv,
1830 struct v4l2_dv_preset *preset)
1831{
1832 struct vpif_fh *fh = priv;
1833 struct channel_obj *ch = fh->channel;
1834
1835 return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index],
1836 video, query_dv_preset, preset);
1837}
1838/**
1839 * vpif_s_dv_presets() - S_DV_PRESETS handler
1840 * @file: file ptr
1841 * @priv: file handle
1842 * @preset: input preset
1843 */
1844static int vpif_s_dv_preset(struct file *file, void *priv,
1845 struct v4l2_dv_preset *preset)
1846{
1847 struct vpif_fh *fh = priv;
1848 struct channel_obj *ch = fh->channel;
1849 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1850 int ret = 0;
1851
1852 if (common->started) {
1853 vpif_dbg(1, debug, "streaming in progress\n");
1854 return -EBUSY;
1855 }
1856
1857 if ((VPIF_CHANNEL0_VIDEO == ch->channel_id) ||
1858 (VPIF_CHANNEL1_VIDEO == ch->channel_id)) {
1859 if (!fh->initialized) {
1860 vpif_dbg(1, debug, "Channel Busy\n");
1861 return -EBUSY;
1862 }
1863 }
1864
1865 ret = v4l2_prio_check(&ch->prio, fh->prio);
1866 if (ret)
1867 return ret;
1868
1869 fh->initialized = 1;
1870
1871 /* Call encoder subdevice function to set the standard */
1872 if (mutex_lock_interruptible(&common->lock))
1873 return -ERESTARTSYS;
1874
1875 ch->video.dv_preset = preset->preset;
1876 ch->video.stdid = V4L2_STD_UNKNOWN;
1877
1878 /* Get the information about the standard */
1879 if (vpif_update_std_info(ch)) {
1880 vpif_dbg(1, debug, "Error getting the standard info\n");
1881 ret = -EINVAL;
1882 } else {
1883 /* Configure the default format information */
1884 vpif_config_format(ch);
1885
1886 ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index],
1887 video, s_dv_preset, preset);
1888 }
1889
1890 mutex_unlock(&common->lock);
1891
1892 return ret;
1893}
1894/**
1895 * vpif_g_dv_presets() - G_DV_PRESETS handler
1896 * @file: file ptr
1897 * @priv: file handle
1898 * @preset: input preset
1899 */
1900static int vpif_g_dv_preset(struct file *file, void *priv,
1901 struct v4l2_dv_preset *preset)
1902{
1903 struct vpif_fh *fh = priv;
1904 struct channel_obj *ch = fh->channel;
1905
1906 preset->preset = ch->video.dv_preset;
1907
1908 return 0;
1909}
1910
1797/* 1911/*
1798 * vpif_g_chip_ident() - Identify the chip 1912 * vpif_g_chip_ident() - Identify the chip
1799 * @file: file ptr 1913 * @file: file ptr
@@ -1892,6 +2006,10 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
1892 .vidioc_streamon = vpif_streamon, 2006 .vidioc_streamon = vpif_streamon,
1893 .vidioc_streamoff = vpif_streamoff, 2007 .vidioc_streamoff = vpif_streamoff,
1894 .vidioc_cropcap = vpif_cropcap, 2008 .vidioc_cropcap = vpif_cropcap,
2009 .vidioc_enum_dv_presets = vpif_enum_dv_presets,
2010 .vidioc_s_dv_preset = vpif_s_dv_preset,
2011 .vidioc_g_dv_preset = vpif_g_dv_preset,
2012 .vidioc_query_dv_preset = vpif_query_dv_preset,
1895 .vidioc_g_chip_ident = vpif_g_chip_ident, 2013 .vidioc_g_chip_ident = vpif_g_chip_ident,
1896#ifdef CONFIG_VIDEO_ADV_DEBUG 2014#ifdef CONFIG_VIDEO_ADV_DEBUG
1897 .vidioc_g_register = vpif_dbg_g_register, 2015 .vidioc_g_register = vpif_dbg_g_register,