diff options
-rw-r--r-- | drivers/media/video/cafe_ccic.c | 176 | ||||
-rw-r--r-- | include/media/v4l2-chip-ident.h | 27 |
2 files changed, 61 insertions, 142 deletions
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 3363e501d6d7..2f4293771392 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/debugfs.h> | ||
37 | #include <linux/jiffies.h> | 36 | #include <linux/jiffies.h> |
38 | #include <linux/vmalloc.h> | 37 | #include <linux/vmalloc.h> |
39 | 38 | ||
@@ -182,10 +181,6 @@ struct cafe_camera | |||
182 | /* Misc */ | 181 | /* Misc */ |
183 | wait_queue_head_t smbus_wait; /* Waiting on i2c events */ | 182 | wait_queue_head_t smbus_wait; /* Waiting on i2c events */ |
184 | wait_queue_head_t iowait; /* Waiting on frame data */ | 183 | wait_queue_head_t iowait; /* Waiting on frame data */ |
185 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
186 | struct dentry *dfs_regs; | ||
187 | struct dentry *dfs_cam_regs; | ||
188 | #endif | ||
189 | }; | 184 | }; |
190 | 185 | ||
191 | /* | 186 | /* |
@@ -1646,6 +1641,47 @@ static int cafe_vidioc_s_parm(struct file *filp, void *priv, | |||
1646 | return ret; | 1641 | return ret; |
1647 | } | 1642 | } |
1648 | 1643 | ||
1644 | static int cafe_vidioc_g_chip_ident(struct file *file, void *priv, | ||
1645 | struct v4l2_dbg_chip_ident *chip) | ||
1646 | { | ||
1647 | struct cafe_camera *cam = priv; | ||
1648 | |||
1649 | chip->ident = V4L2_IDENT_NONE; | ||
1650 | chip->revision = 0; | ||
1651 | if (v4l2_chip_match_host(&chip->match)) { | ||
1652 | chip->ident = V4L2_IDENT_CAFE; | ||
1653 | return 0; | ||
1654 | } | ||
1655 | return sensor_call(cam, core, g_chip_ident, chip); | ||
1656 | } | ||
1657 | |||
1658 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1659 | static int cafe_vidioc_g_register(struct file *file, void *priv, | ||
1660 | struct v4l2_dbg_register *reg) | ||
1661 | { | ||
1662 | struct cafe_camera *cam = priv; | ||
1663 | |||
1664 | if (v4l2_chip_match_host(®->match)) { | ||
1665 | reg->val = cafe_reg_read(cam, reg->reg); | ||
1666 | reg->size = 4; | ||
1667 | return 0; | ||
1668 | } | ||
1669 | return sensor_call(cam, core, g_register, reg); | ||
1670 | } | ||
1671 | |||
1672 | static int cafe_vidioc_s_register(struct file *file, void *priv, | ||
1673 | struct v4l2_dbg_register *reg) | ||
1674 | { | ||
1675 | struct cafe_camera *cam = priv; | ||
1676 | |||
1677 | if (v4l2_chip_match_host(®->match)) { | ||
1678 | cafe_reg_write(cam, reg->reg, reg->val); | ||
1679 | return 0; | ||
1680 | } | ||
1681 | return sensor_call(cam, core, s_register, reg); | ||
1682 | } | ||
1683 | #endif | ||
1684 | |||
1649 | /* | 1685 | /* |
1650 | * This template device holds all of those v4l2 methods; we | 1686 | * This template device holds all of those v4l2 methods; we |
1651 | * clone it for specific real devices. | 1687 | * clone it for specific real devices. |
@@ -1682,6 +1718,11 @@ static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = { | |||
1682 | .vidioc_s_ctrl = cafe_vidioc_s_ctrl, | 1718 | .vidioc_s_ctrl = cafe_vidioc_s_ctrl, |
1683 | .vidioc_g_parm = cafe_vidioc_g_parm, | 1719 | .vidioc_g_parm = cafe_vidioc_g_parm, |
1684 | .vidioc_s_parm = cafe_vidioc_s_parm, | 1720 | .vidioc_s_parm = cafe_vidioc_s_parm, |
1721 | .vidioc_g_chip_ident = cafe_vidioc_g_chip_ident, | ||
1722 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1723 | .vidioc_g_register = cafe_vidioc_g_register, | ||
1724 | .vidioc_s_register = cafe_vidioc_s_register, | ||
1725 | #endif | ||
1685 | }; | 1726 | }; |
1686 | 1727 | ||
1687 | static struct video_device cafe_v4l_template = { | 1728 | static struct video_device cafe_v4l_template = { |
@@ -1849,127 +1890,6 @@ static irqreturn_t cafe_irq(int irq, void *data) | |||
1849 | 1890 | ||
1850 | 1891 | ||
1851 | /* -------------------------------------------------------------------------- */ | 1892 | /* -------------------------------------------------------------------------- */ |
1852 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
1853 | /* | ||
1854 | * Debugfs stuff. | ||
1855 | */ | ||
1856 | |||
1857 | static char cafe_debug_buf[1024]; | ||
1858 | static struct dentry *cafe_dfs_root; | ||
1859 | |||
1860 | static void cafe_dfs_setup(void) | ||
1861 | { | ||
1862 | cafe_dfs_root = debugfs_create_dir("cafe_ccic", NULL); | ||
1863 | if (IS_ERR(cafe_dfs_root)) { | ||
1864 | cafe_dfs_root = NULL; /* Never mind */ | ||
1865 | printk(KERN_NOTICE "cafe_ccic unable to set up debugfs\n"); | ||
1866 | } | ||
1867 | } | ||
1868 | |||
1869 | static void cafe_dfs_shutdown(void) | ||
1870 | { | ||
1871 | if (cafe_dfs_root) | ||
1872 | debugfs_remove(cafe_dfs_root); | ||
1873 | } | ||
1874 | |||
1875 | static int cafe_dfs_open(struct inode *inode, struct file *file) | ||
1876 | { | ||
1877 | file->private_data = inode->i_private; | ||
1878 | return 0; | ||
1879 | } | ||
1880 | |||
1881 | static ssize_t cafe_dfs_read_regs(struct file *file, | ||
1882 | char __user *buf, size_t count, loff_t *ppos) | ||
1883 | { | ||
1884 | struct cafe_camera *cam = file->private_data; | ||
1885 | char *s = cafe_debug_buf; | ||
1886 | int offset; | ||
1887 | |||
1888 | for (offset = 0; offset < 0x44; offset += 4) | ||
1889 | s += sprintf(s, "%02x: %08x\n", offset, | ||
1890 | cafe_reg_read(cam, offset)); | ||
1891 | for (offset = 0x88; offset <= 0x90; offset += 4) | ||
1892 | s += sprintf(s, "%02x: %08x\n", offset, | ||
1893 | cafe_reg_read(cam, offset)); | ||
1894 | for (offset = 0xb4; offset <= 0xbc; offset += 4) | ||
1895 | s += sprintf(s, "%02x: %08x\n", offset, | ||
1896 | cafe_reg_read(cam, offset)); | ||
1897 | for (offset = 0x3000; offset <= 0x300c; offset += 4) | ||
1898 | s += sprintf(s, "%04x: %08x\n", offset, | ||
1899 | cafe_reg_read(cam, offset)); | ||
1900 | return simple_read_from_buffer(buf, count, ppos, cafe_debug_buf, | ||
1901 | s - cafe_debug_buf); | ||
1902 | } | ||
1903 | |||
1904 | static const struct file_operations cafe_dfs_reg_ops = { | ||
1905 | .owner = THIS_MODULE, | ||
1906 | .read = cafe_dfs_read_regs, | ||
1907 | .open = cafe_dfs_open | ||
1908 | }; | ||
1909 | |||
1910 | static ssize_t cafe_dfs_read_cam(struct file *file, | ||
1911 | char __user *buf, size_t count, loff_t *ppos) | ||
1912 | { | ||
1913 | struct cafe_camera *cam = file->private_data; | ||
1914 | char *s = cafe_debug_buf; | ||
1915 | int offset; | ||
1916 | |||
1917 | if (! cam->sensor) | ||
1918 | return -EINVAL; | ||
1919 | for (offset = 0x0; offset < 0x8a; offset++) | ||
1920 | { | ||
1921 | u8 v; | ||
1922 | |||
1923 | cafe_smbus_read_data(cam, cam->sensor_addr, offset, &v); | ||
1924 | s += sprintf(s, "%02x: %02x\n", offset, v); | ||
1925 | } | ||
1926 | return simple_read_from_buffer(buf, count, ppos, cafe_debug_buf, | ||
1927 | s - cafe_debug_buf); | ||
1928 | } | ||
1929 | |||
1930 | static const struct file_operations cafe_dfs_cam_ops = { | ||
1931 | .owner = THIS_MODULE, | ||
1932 | .read = cafe_dfs_read_cam, | ||
1933 | .open = cafe_dfs_open | ||
1934 | }; | ||
1935 | |||
1936 | |||
1937 | |||
1938 | static void cafe_dfs_cam_setup(struct cafe_camera *cam) | ||
1939 | { | ||
1940 | char fname[40]; | ||
1941 | |||
1942 | if (!cafe_dfs_root) | ||
1943 | return; | ||
1944 | sprintf(fname, "regs-%d", cam->vdev.num); | ||
1945 | cam->dfs_regs = debugfs_create_file(fname, 0444, cafe_dfs_root, | ||
1946 | cam, &cafe_dfs_reg_ops); | ||
1947 | sprintf(fname, "cam-%d", cam->vdev.num); | ||
1948 | cam->dfs_cam_regs = debugfs_create_file(fname, 0444, cafe_dfs_root, | ||
1949 | cam, &cafe_dfs_cam_ops); | ||
1950 | } | ||
1951 | |||
1952 | |||
1953 | static void cafe_dfs_cam_shutdown(struct cafe_camera *cam) | ||
1954 | { | ||
1955 | if (! IS_ERR(cam->dfs_regs)) | ||
1956 | debugfs_remove(cam->dfs_regs); | ||
1957 | if (! IS_ERR(cam->dfs_cam_regs)) | ||
1958 | debugfs_remove(cam->dfs_cam_regs); | ||
1959 | } | ||
1960 | |||
1961 | #else | ||
1962 | |||
1963 | #define cafe_dfs_setup() | ||
1964 | #define cafe_dfs_shutdown() | ||
1965 | #define cafe_dfs_cam_setup(cam) | ||
1966 | #define cafe_dfs_cam_shutdown(cam) | ||
1967 | #endif /* CONFIG_VIDEO_ADV_DEBUG */ | ||
1968 | |||
1969 | |||
1970 | |||
1971 | |||
1972 | /* ------------------------------------------------------------------------*/ | ||
1973 | /* | 1893 | /* |
1974 | * PCI interface stuff. | 1894 | * PCI interface stuff. |
1975 | */ | 1895 | */ |
@@ -2070,7 +1990,6 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2070 | " will try again later."); | 1990 | " will try again later."); |
2071 | } | 1991 | } |
2072 | 1992 | ||
2073 | cafe_dfs_cam_setup(cam); | ||
2074 | mutex_unlock(&cam->s_mutex); | 1993 | mutex_unlock(&cam->s_mutex); |
2075 | return 0; | 1994 | return 0; |
2076 | 1995 | ||
@@ -2096,7 +2015,6 @@ out: | |||
2096 | static void cafe_shutdown(struct cafe_camera *cam) | 2015 | static void cafe_shutdown(struct cafe_camera *cam) |
2097 | { | 2016 | { |
2098 | /* FIXME: Make sure we take care of everything here */ | 2017 | /* FIXME: Make sure we take care of everything here */ |
2099 | cafe_dfs_cam_shutdown(cam); | ||
2100 | if (cam->n_sbufs > 0) | 2018 | if (cam->n_sbufs > 0) |
2101 | /* What if they are still mapped? Shouldn't be, but... */ | 2019 | /* What if they are still mapped? Shouldn't be, but... */ |
2102 | cafe_free_sio_buffers(cam); | 2020 | cafe_free_sio_buffers(cam); |
@@ -2216,7 +2134,6 @@ static int __init cafe_init(void) | |||
2216 | 2134 | ||
2217 | printk(KERN_NOTICE "Marvell M88ALP01 'CAFE' Camera Controller version %d\n", | 2135 | printk(KERN_NOTICE "Marvell M88ALP01 'CAFE' Camera Controller version %d\n", |
2218 | CAFE_VERSION); | 2136 | CAFE_VERSION); |
2219 | cafe_dfs_setup(); | ||
2220 | ret = pci_register_driver(&cafe_pci_driver); | 2137 | ret = pci_register_driver(&cafe_pci_driver); |
2221 | if (ret) { | 2138 | if (ret) { |
2222 | printk(KERN_ERR "Unable to register cafe_ccic driver\n"); | 2139 | printk(KERN_ERR "Unable to register cafe_ccic driver\n"); |
@@ -2232,7 +2149,6 @@ static int __init cafe_init(void) | |||
2232 | static void __exit cafe_exit(void) | 2149 | static void __exit cafe_exit(void) |
2233 | { | 2150 | { |
2234 | pci_unregister_driver(&cafe_pci_driver); | 2151 | pci_unregister_driver(&cafe_pci_driver); |
2235 | cafe_dfs_shutdown(); | ||
2236 | } | 2152 | } |
2237 | 2153 | ||
2238 | module_init(cafe_init); | 2154 | module_init(cafe_init); |
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index ca2aa6d7e386..1be461a29077 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h | |||
@@ -146,21 +146,12 @@ enum { | |||
146 | /* module tda9840: just ident 9840 */ | 146 | /* module tda9840: just ident 9840 */ |
147 | V4L2_IDENT_TDA9840 = 9840, | 147 | V4L2_IDENT_TDA9840 = 9840, |
148 | 148 | ||
149 | /* module cafe_ccic, just ident 8801 */ | ||
150 | V4L2_IDENT_CAFE = 8801, | ||
151 | |||
149 | /* module tw9910: just ident 9910 */ | 152 | /* module tw9910: just ident 9910 */ |
150 | V4L2_IDENT_TW9910 = 9910, | 153 | V4L2_IDENT_TW9910 = 9910, |
151 | 154 | ||
152 | /* module cs53132a: just ident 53132 */ | ||
153 | V4L2_IDENT_CS53l32A = 53132, | ||
154 | |||
155 | /* module upd64031a: just ident 64031 */ | ||
156 | V4L2_IDENT_UPD64031A = 64031, | ||
157 | |||
158 | /* module upd64083: just ident 64083 */ | ||
159 | V4L2_IDENT_UPD64083 = 64083, | ||
160 | |||
161 | /* module m52790: just ident 52790 */ | ||
162 | V4L2_IDENT_M52790 = 52790, | ||
163 | |||
164 | /* module msp3400: reserved range 34000-34999 and 44000-44999 */ | 155 | /* module msp3400: reserved range 34000-34999 and 44000-44999 */ |
165 | V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only | 156 | V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only |
166 | use internally (tveeprom.c). */ | 157 | use internally (tveeprom.c). */ |
@@ -237,6 +228,18 @@ enum { | |||
237 | V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ | 228 | V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ |
238 | V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ | 229 | V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ |
239 | V4L2_IDENT_MT9T031 = 45020, | 230 | V4L2_IDENT_MT9T031 = 45020, |
231 | |||
232 | /* module cs53132a: just ident 53132 */ | ||
233 | V4L2_IDENT_CS53l32A = 53132, | ||
234 | |||
235 | /* module upd64031a: just ident 64031 */ | ||
236 | V4L2_IDENT_UPD64031A = 64031, | ||
237 | |||
238 | /* module upd64083: just ident 64083 */ | ||
239 | V4L2_IDENT_UPD64083 = 64083, | ||
240 | |||
241 | /* module m52790: just ident 52790 */ | ||
242 | V4L2_IDENT_M52790 = 52790, | ||
240 | }; | 243 | }; |
241 | 244 | ||
242 | #endif | 245 | #endif |