diff options
author | Mats Randgaard <mats.randgaard@cisco.com> | 2010-12-16 10:17:41 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-01-19 08:28:14 -0500 |
commit | 7036d6a73c88428764e4a12f30846279346f4382 (patch) | |
tree | 0ea31402abb806829a194e1bf9fc8b09e859a428 | |
parent | d2db8fee0d77f43f64e4e97ccc1558a9f59fab41 (diff) |
[media] vpif_cap/disp: Add debug functionality
The following functions are added to the drivers:
- vpif_g_chip_ident
- vpif_dbg_g_register
- vpif_dbg_s_register
- vpif_log_status
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>
-rw-r--r-- | drivers/media/video/davinci/vpif_capture.c | 83 | ||||
-rw-r--r-- | drivers/media/video/davinci/vpif_display.c | 86 |
2 files changed, 169 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 */ |
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index 412c65d54fe1..2d55e3e86a84 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <media/adv7343.h> | 38 | #include <media/adv7343.h> |
39 | #include <media/v4l2-device.h> | 39 | #include <media/v4l2-device.h> |
40 | #include <media/v4l2-ioctl.h> | 40 | #include <media/v4l2-ioctl.h> |
41 | #include <media/v4l2-chip-ident.h> | ||
41 | 42 | ||
42 | #include <mach/dm646x.h> | 43 | #include <mach/dm646x.h> |
43 | 44 | ||
@@ -1315,6 +1316,85 @@ static int vpif_s_priority(struct file *file, void *priv, enum v4l2_priority p) | |||
1315 | return v4l2_prio_change(&ch->prio, &fh->prio, p); | 1316 | return v4l2_prio_change(&ch->prio, &fh->prio, p); |
1316 | } | 1317 | } |
1317 | 1318 | ||
1319 | |||
1320 | /* | ||
1321 | * vpif_g_chip_ident() - Identify the chip | ||
1322 | * @file: file ptr | ||
1323 | * @priv: file handle | ||
1324 | * @chip: chip identity | ||
1325 | * | ||
1326 | * Returns zero or -EINVAL if read operations fails. | ||
1327 | */ | ||
1328 | static int vpif_g_chip_ident(struct file *file, void *priv, | ||
1329 | struct v4l2_dbg_chip_ident *chip) | ||
1330 | { | ||
1331 | chip->ident = V4L2_IDENT_NONE; | ||
1332 | chip->revision = 0; | ||
1333 | if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER && | ||
1334 | chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR) { | ||
1335 | vpif_dbg(2, debug, "match_type is invalid.\n"); | ||
1336 | return -EINVAL; | ||
1337 | } | ||
1338 | |||
1339 | return v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 0, core, | ||
1340 | g_chip_ident, chip); | ||
1341 | } | ||
1342 | |||
1343 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1344 | /* | ||
1345 | * vpif_dbg_g_register() - Read register | ||
1346 | * @file: file ptr | ||
1347 | * @priv: file handle | ||
1348 | * @reg: register to be read | ||
1349 | * | ||
1350 | * Debugging only | ||
1351 | * Returns zero or -EINVAL if read operations fails. | ||
1352 | */ | ||
1353 | static int vpif_dbg_g_register(struct file *file, void *priv, | ||
1354 | struct v4l2_dbg_register *reg){ | ||
1355 | struct vpif_fh *fh = priv; | ||
1356 | struct channel_obj *ch = fh->channel; | ||
1357 | struct video_obj *vid_ch = &ch->video; | ||
1358 | |||
1359 | return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], core, | ||
1360 | g_register, reg); | ||
1361 | } | ||
1362 | |||
1363 | /* | ||
1364 | * vpif_dbg_s_register() - Write to register | ||
1365 | * @file: file ptr | ||
1366 | * @priv: file handle | ||
1367 | * @reg: register to be modified | ||
1368 | * | ||
1369 | * Debugging only | ||
1370 | * Returns zero or -EINVAL if write operations fails. | ||
1371 | */ | ||
1372 | static int vpif_dbg_s_register(struct file *file, void *priv, | ||
1373 | struct v4l2_dbg_register *reg){ | ||
1374 | struct vpif_fh *fh = priv; | ||
1375 | struct channel_obj *ch = fh->channel; | ||
1376 | struct video_obj *vid_ch = &ch->video; | ||
1377 | |||
1378 | return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], core, | ||
1379 | s_register, reg); | ||
1380 | } | ||
1381 | #endif | ||
1382 | |||
1383 | /* | ||
1384 | * vpif_log_status() - Status information | ||
1385 | * @file: file ptr | ||
1386 | * @priv: file handle | ||
1387 | * | ||
1388 | * Returns zero. | ||
1389 | */ | ||
1390 | static int vpif_log_status(struct file *filep, void *priv) | ||
1391 | { | ||
1392 | /* status for sub devices */ | ||
1393 | v4l2_device_call_all(&vpif_obj.v4l2_dev, 0, core, log_status); | ||
1394 | |||
1395 | return 0; | ||
1396 | } | ||
1397 | |||
1318 | /* vpif display ioctl operations */ | 1398 | /* vpif display ioctl operations */ |
1319 | static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | 1399 | static const struct v4l2_ioctl_ops vpif_ioctl_ops = { |
1320 | .vidioc_querycap = vpif_querycap, | 1400 | .vidioc_querycap = vpif_querycap, |
@@ -1336,6 +1416,12 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = { | |||
1336 | .vidioc_s_output = vpif_s_output, | 1416 | .vidioc_s_output = vpif_s_output, |
1337 | .vidioc_g_output = vpif_g_output, | 1417 | .vidioc_g_output = vpif_g_output, |
1338 | .vidioc_cropcap = vpif_cropcap, | 1418 | .vidioc_cropcap = vpif_cropcap, |
1419 | .vidioc_g_chip_ident = vpif_g_chip_ident, | ||
1420 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1421 | .vidioc_g_register = vpif_dbg_g_register, | ||
1422 | .vidioc_s_register = vpif_dbg_s_register, | ||
1423 | #endif | ||
1424 | .vidioc_log_status = vpif_log_status, | ||
1339 | }; | 1425 | }; |
1340 | 1426 | ||
1341 | static const struct v4l2_file_operations vpif_fops = { | 1427 | static const struct v4l2_file_operations vpif_fops = { |