Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB: meye: remove last V4L1 remnants from the code and add v4l2_device

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
51270617 c1f2b0f2

+55 -47
+1 -1
drivers/media/video/Kconfig
··· 740 740 741 741 config VIDEO_MEYE 742 742 tristate "Sony Vaio Picturebook Motion Eye Video For Linux" 743 - depends on PCI && SONY_LAPTOP && VIDEO_V4L1 743 + depends on PCI && SONY_LAPTOP && VIDEO_V4L2 744 744 ---help--- 745 745 This is the video4linux driver for the Motion Eye camera found 746 746 in the Vaio Picturebook laptops. Please read the material in
+41 -37
drivers/media/video/meye.c
··· 30 30 #include <linux/pci.h> 31 31 #include <linux/sched.h> 32 32 #include <linux/init.h> 33 - #include <linux/videodev.h> 34 33 #include <linux/gfp.h> 34 + #include <linux/videodev2.h> 35 35 #include <media/v4l2-common.h> 36 + #include <media/v4l2-device.h> 36 37 #include <media/v4l2-ioctl.h> 37 38 #include <asm/uaccess.h> 38 39 #include <asm/io.h> ··· 1169 1168 case V4L2_CID_BRIGHTNESS: 1170 1169 sony_pic_camera_command( 1171 1170 SONY_PIC_COMMAND_SETCAMERABRIGHTNESS, c->value); 1172 - meye.picture.brightness = c->value << 10; 1171 + meye.brightness = c->value << 10; 1173 1172 break; 1174 1173 case V4L2_CID_HUE: 1175 1174 sony_pic_camera_command( 1176 1175 SONY_PIC_COMMAND_SETCAMERAHUE, c->value); 1177 - meye.picture.hue = c->value << 10; 1176 + meye.hue = c->value << 10; 1178 1177 break; 1179 1178 case V4L2_CID_CONTRAST: 1180 1179 sony_pic_camera_command( 1181 1180 SONY_PIC_COMMAND_SETCAMERACONTRAST, c->value); 1182 - meye.picture.contrast = c->value << 10; 1181 + meye.contrast = c->value << 10; 1183 1182 break; 1184 1183 case V4L2_CID_SATURATION: 1185 1184 sony_pic_camera_command( 1186 1185 SONY_PIC_COMMAND_SETCAMERACOLOR, c->value); 1187 - meye.picture.colour = c->value << 10; 1186 + meye.colour = c->value << 10; 1188 1187 break; 1189 1188 case V4L2_CID_AGC: 1190 1189 sony_pic_camera_command( ··· 1222 1221 mutex_lock(&meye.lock); 1223 1222 switch (c->id) { 1224 1223 case V4L2_CID_BRIGHTNESS: 1225 - c->value = meye.picture.brightness >> 10; 1224 + c->value = meye.brightness >> 10; 1226 1225 break; 1227 1226 case V4L2_CID_HUE: 1228 - c->value = meye.picture.hue >> 10; 1227 + c->value = meye.hue >> 10; 1229 1228 break; 1230 1229 case V4L2_CID_CONTRAST: 1231 - c->value = meye.picture.contrast >> 10; 1230 + c->value = meye.contrast >> 10; 1232 1231 break; 1233 1232 case V4L2_CID_SATURATION: 1234 - c->value = meye.picture.colour >> 10; 1233 + c->value = meye.colour >> 10; 1235 1234 break; 1236 1235 case V4L2_CID_AGC: 1237 1236 c->value = meye.params.agc; ··· 1730 1729 static int __devinit meye_probe(struct pci_dev *pcidev, 1731 1730 const struct pci_device_id *ent) 1732 1731 { 1732 + struct v4l2_device *v4l2_dev = &meye.v4l2_dev; 1733 1733 int ret = -EBUSY; 1734 1734 unsigned long mchip_adr; 1735 1735 ··· 1739 1737 goto outnotdev; 1740 1738 } 1741 1739 1740 + ret = v4l2_device_register(&pcidev->dev, v4l2_dev); 1741 + if (ret < 0) { 1742 + v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); 1743 + return ret; 1744 + } 1742 1745 ret = -ENOMEM; 1743 1746 meye.mchip_dev = pcidev; 1744 - meye.video_dev = video_device_alloc(); 1745 - if (!meye.video_dev) { 1746 - printk(KERN_ERR "meye: video_device_alloc() failed!\n"); 1747 + meye.vdev = video_device_alloc(); 1748 + if (!meye.vdev) { 1749 + v4l2_err(v4l2_dev, "video_device_alloc() failed!\n"); 1747 1750 goto outnotdev; 1748 1751 } 1749 1752 1750 1753 meye.grab_temp = vmalloc(MCHIP_NB_PAGES_MJPEG * PAGE_SIZE); 1751 1754 if (!meye.grab_temp) { 1752 - printk(KERN_ERR "meye: grab buffer allocation failed\n"); 1755 + v4l2_err(v4l2_dev, "grab buffer allocation failed\n"); 1753 1756 goto outvmalloc; 1754 1757 } 1755 1758 1756 1759 spin_lock_init(&meye.grabq_lock); 1757 1760 if (kfifo_alloc(&meye.grabq, sizeof(int) * MEYE_MAX_BUFNBRS, 1758 1761 GFP_KERNEL)) { 1759 - printk(KERN_ERR "meye: fifo allocation failed\n"); 1762 + v4l2_err(v4l2_dev, "fifo allocation failed\n"); 1760 1763 goto outkfifoalloc1; 1761 1764 } 1762 1765 spin_lock_init(&meye.doneq_lock); 1763 1766 if (kfifo_alloc(&meye.doneq, sizeof(int) * MEYE_MAX_BUFNBRS, 1764 1767 GFP_KERNEL)) { 1765 - printk(KERN_ERR "meye: fifo allocation failed\n"); 1768 + v4l2_err(v4l2_dev, "fifo allocation failed\n"); 1766 1769 goto outkfifoalloc2; 1767 1770 } 1768 1771 1769 - memcpy(meye.video_dev, &meye_template, sizeof(meye_template)); 1770 - meye.video_dev->parent = &meye.mchip_dev->dev; 1772 + memcpy(meye.vdev, &meye_template, sizeof(meye_template)); 1773 + meye.vdev->v4l2_dev = &meye.v4l2_dev; 1771 1774 1772 1775 ret = -EIO; 1773 1776 if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) { 1774 - printk(KERN_ERR "meye: unable to power on the camera\n"); 1775 - printk(KERN_ERR "meye: did you enable the camera in " 1777 + v4l2_err(v4l2_dev, "meye: unable to power on the camera\n"); 1778 + v4l2_err(v4l2_dev, "meye: did you enable the camera in " 1776 1779 "sonypi using the module options ?\n"); 1777 1780 goto outsonypienable; 1778 1781 } 1779 1782 1780 1783 if ((ret = pci_enable_device(meye.mchip_dev))) { 1781 - printk(KERN_ERR "meye: pci_enable_device failed\n"); 1784 + v4l2_err(v4l2_dev, "meye: pci_enable_device failed\n"); 1782 1785 goto outenabledev; 1783 1786 } 1784 1787 1785 1788 mchip_adr = pci_resource_start(meye.mchip_dev,0); 1786 1789 if (!mchip_adr) { 1787 - printk(KERN_ERR "meye: mchip has no device base address\n"); 1790 + v4l2_err(v4l2_dev, "meye: mchip has no device base address\n"); 1788 1791 goto outregions; 1789 1792 } 1790 1793 if (!request_mem_region(pci_resource_start(meye.mchip_dev, 0), 1791 1794 pci_resource_len(meye.mchip_dev, 0), 1792 1795 "meye")) { 1793 - printk(KERN_ERR "meye: request_mem_region failed\n"); 1796 + v4l2_err(v4l2_dev, "meye: request_mem_region failed\n"); 1794 1797 goto outregions; 1795 1798 } 1796 1799 meye.mchip_mmregs = ioremap(mchip_adr, MCHIP_MM_REGS); 1797 1800 if (!meye.mchip_mmregs) { 1798 - printk(KERN_ERR "meye: ioremap failed\n"); 1801 + v4l2_err(v4l2_dev, "meye: ioremap failed\n"); 1799 1802 goto outremap; 1800 1803 } 1801 1804 1802 1805 meye.mchip_irq = pcidev->irq; 1803 1806 if (request_irq(meye.mchip_irq, meye_irq, 1804 1807 IRQF_DISABLED | IRQF_SHARED, "meye", meye_irq)) { 1805 - printk(KERN_ERR "meye: request_irq failed\n"); 1808 + v4l2_err(v4l2_dev, "request_irq failed\n"); 1806 1809 goto outreqirq; 1807 1810 } 1808 1811 ··· 1831 1824 msleep(1); 1832 1825 mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK); 1833 1826 1834 - if (video_register_device(meye.video_dev, VFL_TYPE_GRABBER, 1827 + if (video_register_device(meye.vdev, VFL_TYPE_GRABBER, 1835 1828 video_nr) < 0) { 1836 - printk(KERN_ERR "meye: video_register_device failed\n"); 1829 + v4l2_err(v4l2_dev, "video_register_device failed\n"); 1837 1830 goto outvideoreg; 1838 1831 } 1839 1832 1840 1833 mutex_init(&meye.lock); 1841 1834 init_waitqueue_head(&meye.proc_list); 1842 - meye.picture.depth = 16; 1843 - meye.picture.palette = VIDEO_PALETTE_YUV422; 1844 - meye.picture.brightness = 32 << 10; 1845 - meye.picture.hue = 32 << 10; 1846 - meye.picture.colour = 32 << 10; 1847 - meye.picture.contrast = 32 << 10; 1848 - meye.picture.whiteness = 0; 1835 + meye.brightness = 32 << 10; 1836 + meye.hue = 32 << 10; 1837 + meye.colour = 32 << 10; 1838 + meye.contrast = 32 << 10; 1849 1839 meye.params.subsample = 0; 1850 1840 meye.params.quality = 8; 1851 1841 meye.params.sharpness = 32; ··· 1858 1854 sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE, 0); 1859 1855 sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC, 48); 1860 1856 1861 - printk(KERN_INFO "meye: Motion Eye Camera Driver v%s.\n", 1857 + v4l2_info(v4l2_dev, "Motion Eye Camera Driver v%s.\n", 1862 1858 MEYE_DRIVER_VERSION); 1863 - printk(KERN_INFO "meye: mchip KL5A72002 rev. %d, base %lx, irq %d\n", 1859 + v4l2_info(v4l2_dev, "mchip KL5A72002 rev. %d, base %lx, irq %d\n", 1864 1860 meye.mchip_dev->revision, mchip_adr, meye.mchip_irq); 1865 1861 1866 1862 return 0; ··· 1883 1879 outkfifoalloc1: 1884 1880 vfree(meye.grab_temp); 1885 1881 outvmalloc: 1886 - video_device_release(meye.video_dev); 1882 + video_device_release(meye.vdev); 1887 1883 outnotdev: 1888 1884 return ret; 1889 1885 } 1890 1886 1891 1887 static void __devexit meye_remove(struct pci_dev *pcidev) 1892 1888 { 1893 - video_unregister_device(meye.video_dev); 1889 + video_unregister_device(meye.vdev); 1894 1890 1895 1891 mchip_hic_stop(); 1896 1892
+7 -3
drivers/media/video/meye.h
··· 31 31 #define _MEYE_PRIV_H_ 32 32 33 33 #define MEYE_DRIVER_MAJORVERSION 1 34 - #define MEYE_DRIVER_MINORVERSION 13 34 + #define MEYE_DRIVER_MINORVERSION 14 35 35 36 36 #define MEYE_DRIVER_VERSION __stringify(MEYE_DRIVER_MAJORVERSION) "." \ 37 37 __stringify(MEYE_DRIVER_MINORVERSION) ··· 289 289 290 290 /* Motion Eye device structure */ 291 291 struct meye { 292 + struct v4l2_device v4l2_dev; /* Main v4l2_device struct */ 292 293 struct pci_dev *mchip_dev; /* pci device */ 293 294 u8 mchip_irq; /* irq */ 294 295 u8 mchip_mode; /* actual mchip mode: HIC_MODE... */ ··· 309 308 struct kfifo doneq; /* queue for grabbed buffers */ 310 309 spinlock_t doneq_lock; /* lock protecting the queue */ 311 310 wait_queue_head_t proc_list; /* wait queue */ 312 - struct video_device *video_dev; /* video device parameters */ 313 - struct video_picture picture; /* video picture parameters */ 311 + struct video_device *vdev; /* video device parameters */ 312 + u16 brightness; 313 + u16 hue; 314 + u16 contrast; 315 + u16 colour; 314 316 struct meye_params params; /* additional parameters */ 315 317 unsigned long in_use; /* set to 1 if the device is in use */ 316 318 #ifdef CONFIG_PM
+6 -6
include/linux/meye.h
··· 44 44 }; 45 45 46 46 /* query the extended parameters */ 47 - #define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct meye_params) 47 + #define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params) 48 48 /* set the extended parameters */ 49 - #define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOCPRIVATE+1, struct meye_params) 49 + #define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params) 50 50 /* queue a buffer for mjpeg capture */ 51 - #define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+2, int) 51 + #define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+2, int) 52 52 /* sync a previously queued mjpeg buffer */ 53 - #define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOCPRIVATE+3, int) 53 + #define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOC_PRIVATE+3, int) 54 54 /* get a still uncompressed snapshot */ 55 - #define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOCPRIVATE+4) 55 + #define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOC_PRIVATE+4) 56 56 /* get a jpeg compressed snapshot */ 57 - #define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOCPRIVATE+5, int) 57 + #define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOC_PRIVATE+5, int) 58 58 59 59 /* V4L2 private controls */ 60 60 #define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE