diff options
Diffstat (limited to 'drivers/media/video/davinci/vpif_capture.c')
-rw-r--r-- | drivers/media/video/davinci/vpif_capture.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index 193abab6b355..9446dbc476fd 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <media/v4l2-device.h> | 38 | #include <media/v4l2-device.h> |
39 | #include <media/v4l2-ioctl.h> | 39 | #include <media/v4l2-ioctl.h> |
40 | #include <media/v4l2-chip-ident.h> | ||
40 | 41 | ||
41 | #include "vpif_capture.h" | 42 | #include "vpif_capture.h" |
42 | #include "vpif.h" | 43 | #include "vpif.h" |
@@ -1807,6 +1808,82 @@ static int vpif_cropcap(struct file *file, void *priv, | |||
1807 | return 0; | 1808 | return 0; |
1808 | } | 1809 | } |
1809 | 1810 | ||
1811 | /* | ||
1812 | * vpif_g_chip_ident() - Identify the chip | ||
1813 | * @file: file ptr | ||
1814 | * @priv: file handle | ||
1815 | * @chip: chip identity | ||
1816 | * | ||
1817 | * Returns zero or -EINVAL if read operations fails. | ||
1818 | */ | ||
1819 | static int vpif_g_chip_ident(struct file *file, void *priv, | ||
1820 | struct v4l2_dbg_chip_ident *chip) | ||
1821 | { | ||
1822 | chip->ident = V4L2_IDENT_NONE; | ||
1823 | chip->revision = 0; | ||
1824 | if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER && | ||
1825 | chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR) { | ||
1826 | vpif_dbg(2, debug, "match_type is invalid.\n"); | ||
1827 | return -EINVAL; | ||
1828 | } | ||
1829 | |||
1830 | return v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 0, core, | ||
1831 | g_chip_ident, chip); | ||
1832 | } | ||
1833 | |||
1834 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1835 | /* | ||
1836 | * vpif_dbg_g_register() - Read register | ||
1837 | * @file: file ptr | ||
1838 | * @priv: file handle | ||
1839 | * @reg: register to be read | ||
1840 | * | ||
1841 | * Debugging only | ||
1842 | * Returns zero or -EINVAL if read operations fails. | ||
1843 | */ | ||
1844 | static int vpif_dbg_g_register(struct file *file, void *priv, | ||
1845 | struct v4l2_dbg_register *reg){ | ||
1846 | struct vpif_fh *fh = priv; | ||
1847 | struct channel_obj *ch = fh->channel; | ||
1848 | |||
1849 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], core, | ||
1850 | g_register, reg); | ||
1851 | } | ||
1852 | |||
1853 | /* | ||
1854 | * vpif_dbg_s_register() - Write to register | ||
1855 | * @file: file ptr | ||
1856 | * @priv: file handle | ||
1857 | * @reg: register to be modified | ||
1858 | * | ||
1859 | * Debugging only | ||
1860 | * Returns zero or -EINVAL if write operations fails. | ||
1861 | */ | ||
1862 | static int vpif_dbg_s_register(struct file *file, void *priv, | ||
1863 | struct v4l2_dbg_register *reg){ | ||
1864 | struct vpif_fh *fh = priv; | ||
1865 | struct channel_obj *ch = fh->channel; | ||
1866 | |||
1867 | return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], core, | ||
1868 | s_register, reg); | ||
1869 | } | ||
1870 | #endif | ||
1871 | |||
1872 | /* | ||
1873 | * vpif_log_status() - Status information | ||
1874 | * @file: file ptr | ||
1875 | * @priv: file handle | ||
1876 | * | ||
1877 | * Returns zero. | ||
1878 | */ | ||
1879 | static int vpif_log_status(struct file *filep, void *priv) | ||
1880 | { | ||
1881 | /* status for sub devices */ | ||
1882 | v4l2_device_call_all(&vpif_obj.v4l2_dev, 0, core, log_status); | ||
1883 | |||
1884 | return 0; | ||
1885 | } | ||
1886 | |||
1810 | /* vpif capture ioctl operations */ | 1887 | /* vpif capture ioctl operations */ |
1811 | static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | 1888 | static const struct v4l2_ioctl_ops vpif_ioctl_ops = { |
1812 | .vidioc_querycap = vpif_querycap, | 1889 | .vidioc_querycap = vpif_querycap, |
@@ -1829,6 +1906,12 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | |||
1829 | .vidioc_streamon = vpif_streamon, | 1906 | .vidioc_streamon = vpif_streamon, |
1830 | .vidioc_streamoff = vpif_streamoff, | 1907 | .vidioc_streamoff = vpif_streamoff, |
1831 | .vidioc_cropcap = vpif_cropcap, | 1908 | .vidioc_cropcap = vpif_cropcap, |
1909 | .vidioc_g_chip_ident = vpif_g_chip_ident, | ||
1910 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1911 | .vidioc_g_register = vpif_dbg_g_register, | ||
1912 | .vidioc_s_register = vpif_dbg_s_register, | ||
1913 | #endif | ||
1914 | .vidioc_log_status = vpif_log_status, | ||
1832 | }; | 1915 | }; |
1833 | 1916 | ||
1834 | /* vpif file operations */ | 1917 | /* vpif file operations */ |