diff options
Diffstat (limited to 'drivers/media/video/usbvision/usbvision-video.c')
-rw-r--r-- | drivers/media/video/usbvision/usbvision-video.c | 173 |
1 files changed, 21 insertions, 152 deletions
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 6fc14557d623..216704170a4c 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -76,6 +76,7 @@ | |||
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | #include "usbvision.h" | 78 | #include "usbvision.h" |
79 | #include "usbvision-cards.h" | ||
79 | 80 | ||
80 | #define DRIVER_AUTHOR "Joerg Heckenbach <joerg@heckenbach-aw.de>, Dwaine Garden <DwaineGarden@rogers.com>" | 81 | #define DRIVER_AUTHOR "Joerg Heckenbach <joerg@heckenbach-aw.de>, Dwaine Garden <DwaineGarden@rogers.com>" |
81 | #define DRIVER_NAME "usbvision" | 82 | #define DRIVER_NAME "usbvision" |
@@ -150,7 +151,6 @@ static int PowerOnAtOpen = 1; // Set the default device to power on at startu | |||
150 | static int video_nr = -1; // Sequential Number of Video Device | 151 | static int video_nr = -1; // Sequential Number of Video Device |
151 | static int radio_nr = -1; // Sequential Number of Radio Device | 152 | static int radio_nr = -1; // Sequential Number of Radio Device |
152 | static int vbi_nr = -1; // Sequential Number of VBI Device | 153 | static int vbi_nr = -1; // Sequential Number of VBI Device |
153 | static char *CustomDevice=NULL; // Set as nothing.... | ||
154 | 154 | ||
155 | // Grab parameters for the device driver | 155 | // Grab parameters for the device driver |
156 | 156 | ||
@@ -161,7 +161,6 @@ module_param(PowerOnAtOpen, int, 0444); | |||
161 | module_param(video_nr, int, 0444); | 161 | module_param(video_nr, int, 0444); |
162 | module_param(radio_nr, int, 0444); | 162 | module_param(radio_nr, int, 0444); |
163 | module_param(vbi_nr, int, 0444); | 163 | module_param(vbi_nr, int, 0444); |
164 | module_param(CustomDevice, charp, 0444); | ||
165 | #else // Old Style | 164 | #else // Old Style |
166 | MODULE_PARAM(isocMode, "i"); | 165 | MODULE_PARAM(isocMode, "i"); |
167 | MODULE_PARM(video_debug, "i"); // Grab the Debug Mode of the device driver | 166 | MODULE_PARM(video_debug, "i"); // Grab the Debug Mode of the device driver |
@@ -171,7 +170,6 @@ MODULE_PARM(SwitchSVideoInput, "i"); // To help people with Black and White ou | |||
171 | MODULE_PARM(video_nr, "i"); // video_nr option allows to specify a certain /dev/videoX device (like /dev/video0 or /dev/video1 ...) | 170 | MODULE_PARM(video_nr, "i"); // video_nr option allows to specify a certain /dev/videoX device (like /dev/video0 or /dev/video1 ...) |
172 | MODULE_PARM(radio_nr, "i"); // radio_nr option allows to specify a certain /dev/radioX device (like /dev/radio0 or /dev/radio1 ...) | 171 | MODULE_PARM(radio_nr, "i"); // radio_nr option allows to specify a certain /dev/radioX device (like /dev/radio0 or /dev/radio1 ...) |
173 | MODULE_PARM(vbi_nr, "i"); // vbi_nr option allows to specify a certain /dev/vbiX device (like /dev/vbi0 or /dev/vbi1 ...) | 172 | MODULE_PARM(vbi_nr, "i"); // vbi_nr option allows to specify a certain /dev/vbiX device (like /dev/vbi0 or /dev/vbi1 ...) |
174 | MODULE_PARM(CustomDevice, "s"); // .... CustomDevice | ||
175 | #endif | 173 | #endif |
176 | 174 | ||
177 | MODULE_PARM_DESC(isocMode, " Set the default format for ISOC endpoint. Default: 0x60 (Compression On)"); | 175 | MODULE_PARM_DESC(isocMode, " Set the default format for ISOC endpoint. Default: 0x60 (Compression On)"); |
@@ -180,7 +178,6 @@ MODULE_PARM_DESC(PowerOnAtOpen, " Set the default device to power on when device | |||
180 | MODULE_PARM_DESC(video_nr, "Set video device number (/dev/videoX). Default: -1 (autodetect)"); | 178 | MODULE_PARM_DESC(video_nr, "Set video device number (/dev/videoX). Default: -1 (autodetect)"); |
181 | MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)"); | 179 | MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)"); |
182 | MODULE_PARM_DESC(vbi_nr, "Set vbi device number (/dev/vbiX). Default: -1 (autodetect)"); | 180 | MODULE_PARM_DESC(vbi_nr, "Set vbi device number (/dev/vbiX). Default: -1 (autodetect)"); |
183 | MODULE_PARM_DESC(CustomDevice, " Define the fine tuning parameters for the device. Default: null"); | ||
184 | 181 | ||
185 | 182 | ||
186 | // Misc stuff | 183 | // Misc stuff |
@@ -409,7 +406,7 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) | |||
409 | down(&usbvision->lock); | 406 | down(&usbvision->lock); |
410 | if (usbvision->power == 0) { | 407 | if (usbvision->power == 0) { |
411 | usbvision_power_on(usbvision); | 408 | usbvision_power_on(usbvision); |
412 | usbvision_init_i2c(usbvision); | 409 | usbvision_i2c_register(usbvision); |
413 | } | 410 | } |
414 | 411 | ||
415 | /* Send init sequence only once, it's large! */ | 412 | /* Send init sequence only once, it's large! */ |
@@ -431,7 +428,7 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) | |||
431 | } | 428 | } |
432 | else { | 429 | else { |
433 | if (PowerOnAtOpen) { | 430 | if (PowerOnAtOpen) { |
434 | usbvision_i2c_usb_del_bus(&usbvision->i2c_adap); | 431 | usbvision_i2c_unregister(usbvision); |
435 | usbvision_power_off(usbvision); | 432 | usbvision_power_off(usbvision); |
436 | usbvision->initialized = 0; | 433 | usbvision->initialized = 0; |
437 | } | 434 | } |
@@ -1239,7 +1236,7 @@ static int usbvision_radio_open(struct inode *inode, struct file *file) | |||
1239 | usbvision_reset_powerOffTimer(usbvision); | 1236 | usbvision_reset_powerOffTimer(usbvision); |
1240 | if (usbvision->power == 0) { | 1237 | if (usbvision->power == 0) { |
1241 | usbvision_power_on(usbvision); | 1238 | usbvision_power_on(usbvision); |
1242 | usbvision_init_i2c(usbvision); | 1239 | usbvision_i2c_register(usbvision); |
1243 | } | 1240 | } |
1244 | } | 1241 | } |
1245 | 1242 | ||
@@ -1261,7 +1258,7 @@ static int usbvision_radio_open(struct inode *inode, struct file *file) | |||
1261 | 1258 | ||
1262 | if (errCode) { | 1259 | if (errCode) { |
1263 | if (PowerOnAtOpen) { | 1260 | if (PowerOnAtOpen) { |
1264 | usbvision_i2c_usb_del_bus(&usbvision->i2c_adap); | 1261 | usbvision_i2c_unregister(usbvision); |
1265 | usbvision_power_off(usbvision); | 1262 | usbvision_power_off(usbvision); |
1266 | usbvision->initialized = 0; | 1263 | usbvision->initialized = 0; |
1267 | } | 1264 | } |
@@ -1744,8 +1741,8 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision) | |||
1744 | model = usbvision->DevModel; | 1741 | model = usbvision->DevModel; |
1745 | usbvision->palette = usbvision_v4l2_format[2]; // V4L2_PIX_FMT_RGB24; | 1742 | usbvision->palette = usbvision_v4l2_format[2]; // V4L2_PIX_FMT_RGB24; |
1746 | 1743 | ||
1747 | if (usbvision_device_data[usbvision->DevModel].Vin_Reg2 >= 0) { | 1744 | if (usbvision_device_data[usbvision->DevModel].Vin_Reg2_override) { |
1748 | usbvision->Vin_Reg2_Preset = usbvision_device_data[usbvision->DevModel].Vin_Reg2 & 0xff; | 1745 | usbvision->Vin_Reg2_Preset = usbvision_device_data[usbvision->DevModel].Vin_Reg2; |
1749 | } else { | 1746 | } else { |
1750 | usbvision->Vin_Reg2_Preset = 0; | 1747 | usbvision->Vin_Reg2_Preset = 0; |
1751 | } | 1748 | } |
@@ -1764,7 +1761,7 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision) | |||
1764 | usbvision_audio_off(usbvision); //first switch off audio | 1761 | usbvision_audio_off(usbvision); //first switch off audio |
1765 | if (!PowerOnAtOpen) { | 1762 | if (!PowerOnAtOpen) { |
1766 | usbvision_power_on(usbvision); //and then power up the noisy tuner | 1763 | usbvision_power_on(usbvision); //and then power up the noisy tuner |
1767 | usbvision_init_i2c(usbvision); | 1764 | usbvision_i2c_register(usbvision); |
1768 | } | 1765 | } |
1769 | } | 1766 | } |
1770 | 1767 | ||
@@ -1775,7 +1772,8 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision) | |||
1775 | * if it looks like USBVISION video device | 1772 | * if it looks like USBVISION video device |
1776 | * | 1773 | * |
1777 | */ | 1774 | */ |
1778 | static int __devinit usbvision_probe(struct usb_interface *intf, const struct usb_device_id *devid) | 1775 | static int __devinit usbvision_probe(struct usb_interface *intf, |
1776 | const struct usb_device_id *devid) | ||
1779 | { | 1777 | { |
1780 | struct usb_device *dev = usb_get_dev(interface_to_usbdev(intf)); | 1778 | struct usb_device *dev = usb_get_dev(interface_to_usbdev(intf)); |
1781 | struct usb_interface *uif; | 1779 | struct usb_interface *uif; |
@@ -1786,25 +1784,17 @@ static int __devinit usbvision_probe(struct usb_interface *intf, const struct us | |||
1786 | int model,i; | 1784 | int model,i; |
1787 | 1785 | ||
1788 | PDEBUG(DBG_PROBE, "VID=%#04x, PID=%#04x, ifnum=%u", | 1786 | PDEBUG(DBG_PROBE, "VID=%#04x, PID=%#04x, ifnum=%u", |
1789 | dev->descriptor.idVendor, dev->descriptor.idProduct, ifnum); | 1787 | dev->descriptor.idVendor, |
1788 | dev->descriptor.idProduct, ifnum); | ||
1790 | 1789 | ||
1791 | /* Is it an USBVISION video dev? */ | 1790 | model = devid->driver_info; |
1792 | model = 0; | 1791 | if ( (model<0) || (model>=usbvision_device_data_size) ) { |
1793 | for(model = 0; usbvision_device_data[model].idVendor; model++) { | 1792 | PDEBUG(DBG_PROBE, "model out of bounds %d",model); |
1794 | if (le16_to_cpu(dev->descriptor.idVendor) != usbvision_device_data[model].idVendor) { | 1793 | return -ENODEV; |
1795 | continue; | ||
1796 | } | ||
1797 | if (le16_to_cpu(dev->descriptor.idProduct) != usbvision_device_data[model].idProduct) { | ||
1798 | continue; | ||
1799 | } | ||
1800 | |||
1801 | printk(KERN_INFO "%s: %s found\n", __FUNCTION__, usbvision_device_data[model].ModelString); | ||
1802 | break; | ||
1803 | } | 1794 | } |
1795 | printk(KERN_INFO "%s: %s found\n", __FUNCTION__, | ||
1796 | usbvision_device_data[model].ModelString); | ||
1804 | 1797 | ||
1805 | if (usbvision_device_data[model].idVendor == 0) { | ||
1806 | return -ENODEV; //no matching device | ||
1807 | } | ||
1808 | if (usbvision_device_data[model].Interface >= 0) { | 1798 | if (usbvision_device_data[model].Interface >= 0) { |
1809 | interface = &dev->actconfig->interface[usbvision_device_data[model].Interface]->altsetting[0]; | 1799 | interface = &dev->actconfig->interface[usbvision_device_data[model].Interface]->altsetting[0]; |
1810 | } | 1800 | } |
@@ -1822,16 +1812,15 @@ static int __devinit usbvision_probe(struct usb_interface *intf, const struct us | |||
1822 | return -ENODEV; | 1812 | return -ENODEV; |
1823 | } | 1813 | } |
1824 | 1814 | ||
1825 | usb_get_dev(dev); | ||
1826 | |||
1827 | if ((usbvision = usbvision_alloc(dev)) == NULL) { | 1815 | if ((usbvision = usbvision_alloc(dev)) == NULL) { |
1828 | err("%s: couldn't allocate USBVision struct", __FUNCTION__); | 1816 | err("%s: couldn't allocate USBVision struct", __FUNCTION__); |
1829 | return -ENOMEM; | 1817 | return -ENOMEM; |
1830 | } | 1818 | } |
1819 | |||
1831 | if (dev->descriptor.bNumConfigurations > 1) { | 1820 | if (dev->descriptor.bNumConfigurations > 1) { |
1832 | usbvision->bridgeType = BRIDGE_NT1004; | 1821 | usbvision->bridgeType = BRIDGE_NT1004; |
1833 | } | 1822 | } |
1834 | else if (usbvision_device_data[model].ModelString == "Dazzle Fusion Model DVC-90 Rev 1 (SECAM)") { | 1823 | else if (model == DAZZLE_DVC_90_REV_1_SECAM) { |
1835 | usbvision->bridgeType = BRIDGE_NT1005; | 1824 | usbvision->bridgeType = BRIDGE_NT1005; |
1836 | } | 1825 | } |
1837 | else { | 1826 | else { |
@@ -1920,7 +1909,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf) | |||
1920 | usbvision_stop_isoc(usbvision); | 1909 | usbvision_stop_isoc(usbvision); |
1921 | 1910 | ||
1922 | if (usbvision->power) { | 1911 | if (usbvision->power) { |
1923 | usbvision_i2c_usb_del_bus(&usbvision->i2c_adap); | 1912 | usbvision_i2c_unregister(usbvision); |
1924 | usbvision_power_off(usbvision); | 1913 | usbvision_power_off(usbvision); |
1925 | } | 1914 | } |
1926 | usbvision->remove_pending = 1; // Now all ISO data will be ignored | 1915 | usbvision->remove_pending = 1; // Now all ISO data will be ignored |
@@ -1951,124 +1940,6 @@ static struct usb_driver usbvision_driver = { | |||
1951 | }; | 1940 | }; |
1952 | 1941 | ||
1953 | /* | 1942 | /* |
1954 | * customdevice_process() | ||
1955 | * | ||
1956 | * This procedure preprocesses CustomDevice parameter if any | ||
1957 | * | ||
1958 | */ | ||
1959 | static void customdevice_process(void) | ||
1960 | { | ||
1961 | usbvision_device_data[0]=usbvision_device_data[1]; | ||
1962 | usbvision_table[0]=usbvision_table[1]; | ||
1963 | |||
1964 | if(CustomDevice) | ||
1965 | { | ||
1966 | char *parse=CustomDevice; | ||
1967 | |||
1968 | PDEBUG(DBG_PROBE, "CustomDevide=%s", CustomDevice); | ||
1969 | |||
1970 | /*format is CustomDevice="0x0573 0x4D31 0 7113 3 PAL 1 1 1 5 -1 -1 -1 -1 -1" | ||
1971 | usbvision_device_data[0].idVendor; | ||
1972 | usbvision_device_data[0].idProduct; | ||
1973 | usbvision_device_data[0].Interface; | ||
1974 | usbvision_device_data[0].Codec; | ||
1975 | usbvision_device_data[0].VideoChannels; | ||
1976 | usbvision_device_data[0].VideoNorm; | ||
1977 | usbvision_device_data[0].AudioChannels; | ||
1978 | usbvision_device_data[0].Radio; | ||
1979 | usbvision_device_data[0].Tuner; | ||
1980 | usbvision_device_data[0].TunerType; | ||
1981 | usbvision_device_data[0].Vin_Reg1; | ||
1982 | usbvision_device_data[0].Vin_Reg2; | ||
1983 | usbvision_device_data[0].X_Offset; | ||
1984 | usbvision_device_data[0].Y_Offset; | ||
1985 | usbvision_device_data[0].Dvi_yuv; | ||
1986 | usbvision_device_data[0].ModelString; | ||
1987 | */ | ||
1988 | |||
1989 | rmspace(parse); | ||
1990 | usbvision_device_data[0].ModelString="USBVISION Custom Device"; | ||
1991 | |||
1992 | parse+=2; | ||
1993 | sscanf(parse,"%x",&usbvision_device_data[0].idVendor); | ||
1994 | goto2next(parse); | ||
1995 | PDEBUG(DBG_PROBE, "idVendor=0x%.4X", usbvision_device_data[0].idVendor); | ||
1996 | parse+=2; | ||
1997 | sscanf(parse,"%x",&usbvision_device_data[0].idProduct); | ||
1998 | goto2next(parse); | ||
1999 | PDEBUG(DBG_PROBE, "idProduct=0x%.4X", usbvision_device_data[0].idProduct); | ||
2000 | sscanf(parse,"%d",&usbvision_device_data[0].Interface); | ||
2001 | goto2next(parse); | ||
2002 | PDEBUG(DBG_PROBE, "Interface=%d", usbvision_device_data[0].Interface); | ||
2003 | sscanf(parse,"%d",&usbvision_device_data[0].Codec); | ||
2004 | goto2next(parse); | ||
2005 | PDEBUG(DBG_PROBE, "Codec=%d", usbvision_device_data[0].Codec); | ||
2006 | sscanf(parse,"%d",&usbvision_device_data[0].VideoChannels); | ||
2007 | goto2next(parse); | ||
2008 | PDEBUG(DBG_PROBE, "VideoChannels=%d", usbvision_device_data[0].VideoChannels); | ||
2009 | |||
2010 | switch(*parse) | ||
2011 | { | ||
2012 | case 'P': | ||
2013 | PDEBUG(DBG_PROBE, "VideoNorm=PAL"); | ||
2014 | usbvision_device_data[0].VideoNorm=V4L2_STD_PAL; | ||
2015 | break; | ||
2016 | |||
2017 | case 'S': | ||
2018 | PDEBUG(DBG_PROBE, "VideoNorm=SECAM"); | ||
2019 | usbvision_device_data[0].VideoNorm=V4L2_STD_SECAM; | ||
2020 | break; | ||
2021 | |||
2022 | case 'N': | ||
2023 | PDEBUG(DBG_PROBE, "VideoNorm=NTSC"); | ||
2024 | usbvision_device_data[0].VideoNorm=V4L2_STD_NTSC; | ||
2025 | break; | ||
2026 | |||
2027 | default: | ||
2028 | PDEBUG(DBG_PROBE, "VideoNorm=PAL (by default)"); | ||
2029 | usbvision_device_data[0].VideoNorm=V4L2_STD_PAL; | ||
2030 | break; | ||
2031 | } | ||
2032 | goto2next(parse); | ||
2033 | |||
2034 | sscanf(parse,"%d",&usbvision_device_data[0].AudioChannels); | ||
2035 | goto2next(parse); | ||
2036 | PDEBUG(DBG_PROBE, "AudioChannels=%d", usbvision_device_data[0].AudioChannels); | ||
2037 | sscanf(parse,"%d",&usbvision_device_data[0].Radio); | ||
2038 | goto2next(parse); | ||
2039 | PDEBUG(DBG_PROBE, "Radio=%d", usbvision_device_data[0].Radio); | ||
2040 | sscanf(parse,"%d",&usbvision_device_data[0].Tuner); | ||
2041 | goto2next(parse); | ||
2042 | PDEBUG(DBG_PROBE, "Tuner=%d", usbvision_device_data[0].Tuner); | ||
2043 | sscanf(parse,"%d",&usbvision_device_data[0].TunerType); | ||
2044 | goto2next(parse); | ||
2045 | PDEBUG(DBG_PROBE, "TunerType=%d", usbvision_device_data[0].TunerType); | ||
2046 | sscanf(parse,"%d",&usbvision_device_data[0].Vin_Reg1); | ||
2047 | goto2next(parse); | ||
2048 | PDEBUG(DBG_PROBE, "Vin_Reg1=%d", usbvision_device_data[0].Vin_Reg1); | ||
2049 | sscanf(parse,"%d",&usbvision_device_data[0].Vin_Reg2); | ||
2050 | goto2next(parse); | ||
2051 | PDEBUG(DBG_PROBE, "Vin_Reg2=%d", usbvision_device_data[0].Vin_Reg2); | ||
2052 | sscanf(parse,"%d",&usbvision_device_data[0].X_Offset); | ||
2053 | goto2next(parse); | ||
2054 | PDEBUG(DBG_PROBE, "X_Offset=%d", usbvision_device_data[0].X_Offset); | ||
2055 | sscanf(parse,"%d",&usbvision_device_data[0].Y_Offset); | ||
2056 | goto2next(parse); | ||
2057 | PDEBUG(DBG_PROBE, "Y_Offset=%d", usbvision_device_data[0].Y_Offset); | ||
2058 | sscanf(parse,"%d",&usbvision_device_data[0].Dvi_yuv); | ||
2059 | PDEBUG(DBG_PROBE, "Dvi_yuv=%d", usbvision_device_data[0].Dvi_yuv); | ||
2060 | |||
2061 | //add to usbvision_table also | ||
2062 | usbvision_table[0].match_flags=USB_DEVICE_ID_MATCH_DEVICE; | ||
2063 | usbvision_table[0].idVendor=usbvision_device_data[0].idVendor; | ||
2064 | usbvision_table[0].idProduct=usbvision_device_data[0].idProduct; | ||
2065 | |||
2066 | } | ||
2067 | } | ||
2068 | |||
2069 | |||
2070 | |||
2071 | /* | ||
2072 | * usbvision_init() | 1943 | * usbvision_init() |
2073 | * | 1944 | * |
2074 | * This code is run to initialize the driver. | 1945 | * This code is run to initialize the driver. |
@@ -2092,8 +1963,6 @@ static int __init usbvision_init(void) | |||
2092 | usbvision_v4l2_format[7].supported = 0; // V4L2_PIX_FMT_YUV422P | 1963 | usbvision_v4l2_format[7].supported = 0; // V4L2_PIX_FMT_YUV422P |
2093 | } | 1964 | } |
2094 | 1965 | ||
2095 | customdevice_process(); | ||
2096 | |||
2097 | errCode = usb_register(&usbvision_driver); | 1966 | errCode = usb_register(&usbvision_driver); |
2098 | 1967 | ||
2099 | if (errCode == 0) { | 1968 | if (errCode == 0) { |