Merge branch 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6

* 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (87 commits)
V4L/DVB: ivtv: Timing tweaks and code re-order to try and improve stability
V4L/DVB: ivtv: Avoid accidental video standard change
V4L/DVB: ivtvfb : Module load / unload fixes
V4L/DVB: cx2341x: Report correct temporal setting for log-status
V4L/DVB: cx18, cx23885, v4l2 doc, MAINTAINERS: Update Andy Walls' email address
V4L/DVB: drivers/media: Eliminate a NULL pointer dereference
V4L/DVB: dvb-core: Fix ULE decapsulation bug
V4L/DVB: Bug fix: make IR work again for dm1105
V4L/DVB: media/IR: nec-decoder needs to select BITREV
V4L/DVB: video/saa7134: change dprintk() to i2cdprintk()
V4L/DVB: video/saa7134: remove duplicate break
V4L/DVB: IR/imon: add auto-config for 0xffdc rf device
V4L/DVB: IR/imon: clean up usage of bools
V4L/DVB: em28xx: remove unneeded null checks
V4L/DVB: ngene: remove unused #include <linux/version.h>
V4L/DVB: ak881x needs slab.h
V4L/DVB: FusionHDTV: Use quick reads for I2C IR device probing
V4L/DVB: Technotrend S2-3200 ships with a TT 1500 remote
V4L/DVB: drivers/media: Use kzalloc
V4L/DVB: m920x: Select simple tuner
...

+2131 -1608
+1 -1
Documentation/DocBook/v4l/v4l2.xml
··· 58 58 </contrib> 59 59 <affiliation> 60 60 <address> 61 - <email>awalls@radix.net</email> 61 + <email>awalls@md.metrocast.net</email> 62 62 </address> 63 63 </affiliation> 64 64 </author>
+4 -2
Documentation/DocBook/v4l/vidioc-query-dv-preset.xml
··· 53 53 automatically, similar to sensing the video standard. To do so, applications 54 54 call <constant> VIDIOC_QUERY_DV_PRESET</constant> with a pointer to a 55 55 &v4l2-dv-preset; type. Once the hardware detects a preset, that preset is 56 - returned in the preset field of &v4l2-dv-preset;. When detection is not 57 - possible or fails, the value V4L2_DV_INVALID is returned.</para> 56 + returned in the preset field of &v4l2-dv-preset;. If the preset could not be 57 + detected because there was no signal, or the signal was unreliable, or the 58 + signal did not map to a supported preset, then the value V4L2_DV_INVALID is 59 + returned.</para> 58 60 </refsect1> 59 61 60 62 <refsect1>
+3 -2
Documentation/video4linux/CARDLIST.saa7134
··· 176 176 175 -> Leadtek Winfast DTV1000S [107d:6655] 177 177 176 -> Beholder BeholdTV 505 RDS [0000:5051] 178 178 177 -> Hawell HW-404M7 179 - 179 -> Beholder BeholdTV H7 [5ace:7190] 180 - 180 -> Beholder BeholdTV A7 [5ace:7090] 179 + 178 -> Beholder BeholdTV H7 [5ace:7190] 180 + 179 -> Beholder BeholdTV A7 [5ace:7090] 181 + 180 -> Avermedia M733A [1461:4155,1461:4255]
+1
Documentation/video4linux/gspca.txt
··· 290 290 sonixj 0c45:6040 Speed NVC 350K 291 291 sonixj 0c45:607c Sonix sn9c102p Hv7131R 292 292 sonixj 0c45:60c0 Sangha Sn535 293 + sonixj 0c45:60ce USB-PC-Camera-168 (TALK-5067) 293 294 sonixj 0c45:60ec SN9C105+MO4000 294 295 sonixj 0c45:60fb Surfer NoName 295 296 sonixj 0c45:60fc LG-LIC300
+2 -2
MAINTAINERS
··· 1731 1731 F: sound/pci/cs5535audio/ 1732 1732 1733 1733 CX18 VIDEO4LINUX DRIVER 1734 - M: Andy Walls <awalls@radix.net> 1734 + M: Andy Walls <awalls@md.metrocast.net> 1735 1735 L: ivtv-devel@ivtvdriver.org (moderated for non-subscribers) 1736 1736 L: linux-media@vger.kernel.org 1737 1737 T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git ··· 3165 3165 F: drivers/hwmon/it87.c 3166 3166 3167 3167 IVTV VIDEO4LINUX DRIVER 3168 - M: Andy Walls <awalls@radix.net> 3168 + M: Andy Walls <awalls@md.metrocast.net> 3169 3169 L: ivtv-devel@ivtvdriver.org (moderated for non-subscribers) 3170 3170 L: linux-media@vger.kernel.org 3171 3171 T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+2
drivers/media/IR/Kconfig
··· 13 13 config IR_NEC_DECODER 14 14 tristate "Enable IR raw decoder for the NEC protocol" 15 15 depends on IR_CORE 16 + select BITREVERSE 16 17 default y 17 18 18 19 ---help--- ··· 23 22 config IR_RC5_DECODER 24 23 tristate "Enable IR raw decoder for the RC-5 protocol" 25 24 depends on IR_CORE 25 + select BITREVERSE 26 26 default y 27 27 28 28 ---help---
+41 -34
drivers/media/IR/imon.c
··· 94 94 95 95 bool display_supported; /* not all controllers do */ 96 96 bool display_isopen; /* display port has been opened */ 97 + bool rf_device; /* true if iMON 2.4G LT/DT RF device */ 97 98 bool rf_isassociating; /* RF remote associating */ 98 99 bool dev_present_intf0; /* USB device presence, interface 0 */ 99 100 bool dev_present_intf1; /* USB device presence, interface 1 */ ··· 386 385 err("%s: display port is already open", __func__); 387 386 retval = -EBUSY; 388 387 } else { 389 - ictx->display_isopen = 1; 388 + ictx->display_isopen = true; 390 389 file->private_data = ictx; 391 390 dev_dbg(ictx->dev, "display port opened\n"); 392 391 } ··· 423 422 err("%s: display is not open", __func__); 424 423 retval = -EIO; 425 424 } else { 426 - ictx->display_isopen = 0; 425 + ictx->display_isopen = false; 427 426 dev_dbg(ictx->dev, "display port closed\n"); 428 427 if (!ictx->dev_present_intf0) { 429 428 /* ··· 492 491 } 493 492 494 493 init_completion(&ictx->tx.finished); 495 - ictx->tx.busy = 1; 494 + ictx->tx.busy = true; 496 495 smp_rmb(); /* ensure later readers know we're busy */ 497 496 498 497 retval = usb_submit_urb(ictx->tx_urb, GFP_KERNEL); 499 498 if (retval) { 500 - ictx->tx.busy = 0; 499 + ictx->tx.busy = false; 501 500 smp_rmb(); /* ensure later readers know we're not busy */ 502 501 err("%s: error submitting urb(%d)", __func__, retval); 503 502 } else { ··· 683 682 return -ENODEV; 684 683 685 684 mutex_lock(&ictx->lock); 686 - ictx->rf_isassociating = 1; 685 + ictx->rf_isassociating = true; 687 686 send_associate_24g(ictx); 688 687 mutex_unlock(&ictx->lock); 689 688 ··· 951 950 ictx->tx.status = urb->status; 952 951 953 952 /* notify waiters that write has finished */ 954 - ictx->tx.busy = 0; 953 + ictx->tx.busy = false; 955 954 smp_rmb(); /* ensure later readers know we're not busy */ 956 955 complete(&ictx->tx.finished); 957 956 } ··· 1216 1215 { 1217 1216 char rel_x = 0x00, rel_y = 0x00; 1218 1217 u8 right_shift = 1; 1219 - bool mouse_input = 1; 1218 + bool mouse_input = true; 1220 1219 int dir = 0; 1221 1220 1222 1221 /* newer iMON device PAD or mouse button */ ··· 1247 1246 } else if (ictx->kc == KEY_CHANNELDOWN && (buf[2] & 0x40) != 0x40) { 1248 1247 dir = -1; 1249 1248 } else 1250 - mouse_input = 0; 1249 + mouse_input = false; 1251 1250 1252 1251 if (mouse_input) { 1253 1252 dev_dbg(ictx->dev, "sending mouse data via input subsystem\n"); ··· 1451 1450 unsigned char *buf = urb->transfer_buffer; 1452 1451 struct device *dev = ictx->dev; 1453 1452 u32 kc; 1454 - bool norelease = 0; 1453 + bool norelease = false; 1455 1454 int i; 1456 1455 u64 temp_key; 1457 1456 u64 panel_key = 0; ··· 1466 1465 idev = ictx->idev; 1467 1466 1468 1467 /* filter out junk data on the older 0xffdc imon devices */ 1469 - if ((buf[0] == 0xff) && (buf[7] == 0xff)) 1468 + if ((buf[0] == 0xff) && (buf[1] == 0xff) && (buf[2] == 0xff)) 1470 1469 return; 1471 1470 1472 1471 /* Figure out what key was pressed */ ··· 1518 1517 !(buf[1] & 0x1 || buf[1] >> 2 & 0x1))) { 1519 1518 len = 8; 1520 1519 imon_pad_to_keys(ictx, buf); 1521 - norelease = 1; 1520 + norelease = true; 1522 1521 } 1523 1522 1524 1523 if (debug) { ··· 1581 1580 (buf[6] == 0x5E && buf[7] == 0xDF))) { /* DT */ 1582 1581 dev_warn(dev, "%s: remote associated refid=%02X\n", 1583 1582 __func__, buf[1]); 1584 - ictx->rf_isassociating = 0; 1583 + ictx->rf_isassociating = false; 1585 1584 } 1586 1585 } 1587 1586 ··· 1791 1790 int ifnum = iface_desc->desc.bInterfaceNumber; 1792 1791 int num_endpts = iface_desc->desc.bNumEndpoints; 1793 1792 int i, ep_dir, ep_type; 1794 - bool ir_ep_found = 0; 1795 - bool display_ep_found = 0; 1796 - bool tx_control = 0; 1793 + bool ir_ep_found = false; 1794 + bool display_ep_found = false; 1795 + bool tx_control = false; 1797 1796 1798 1797 /* 1799 1798 * Scan the endpoint list and set: ··· 1809 1808 ep_type == USB_ENDPOINT_XFER_INT) { 1810 1809 1811 1810 rx_endpoint = ep; 1812 - ir_ep_found = 1; 1811 + ir_ep_found = true; 1813 1812 dev_dbg(ictx->dev, "%s: found IR endpoint\n", __func__); 1814 1813 1815 1814 } else if (!display_ep_found && ep_dir == USB_DIR_OUT && 1816 1815 ep_type == USB_ENDPOINT_XFER_INT) { 1817 1816 tx_endpoint = ep; 1818 - display_ep_found = 1; 1817 + display_ep_found = true; 1819 1818 dev_dbg(ictx->dev, "%s: found display endpoint\n", __func__); 1820 1819 } 1821 1820 } ··· 1836 1835 * newer iMON devices that use control urb instead of interrupt 1837 1836 */ 1838 1837 if (!display_ep_found) { 1839 - tx_control = 1; 1840 - display_ep_found = 1; 1838 + tx_control = true; 1839 + display_ep_found = true; 1841 1840 dev_dbg(ictx->dev, "%s: device uses control endpoint, not " 1842 1841 "interface OUT endpoint\n", __func__); 1843 1842 } ··· 1848 1847 * and without... :\ 1849 1848 */ 1850 1849 if (ictx->display_type == IMON_DISPLAY_TYPE_NONE) { 1851 - display_ep_found = 0; 1850 + display_ep_found = false; 1852 1851 dev_dbg(ictx->dev, "%s: device has no display\n", __func__); 1853 1852 } 1854 1853 ··· 1857 1856 * that refers to e.g. /dev/lcd0 (a character device LCD or VFD). 1858 1857 */ 1859 1858 if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) { 1860 - display_ep_found = 0; 1859 + display_ep_found = false; 1861 1860 dev_dbg(ictx->dev, "%s: iMON Touch device found\n", __func__); 1862 1861 } 1863 1862 ··· 1906 1905 1907 1906 ictx->dev = dev; 1908 1907 ictx->usbdev_intf0 = usb_get_dev(interface_to_usbdev(intf)); 1909 - ictx->dev_present_intf0 = 1; 1908 + ictx->dev_present_intf0 = true; 1910 1909 ictx->rx_urb_intf0 = rx_urb; 1911 1910 ictx->tx_urb = tx_urb; 1911 + ictx->rf_device = false; 1912 1912 1913 1913 ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); 1914 1914 ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); ··· 1981 1979 } 1982 1980 1983 1981 ictx->usbdev_intf1 = usb_get_dev(interface_to_usbdev(intf)); 1984 - ictx->dev_present_intf1 = 1; 1982 + ictx->dev_present_intf1 = true; 1985 1983 ictx->rx_urb_intf1 = rx_urb; 1986 1984 1987 1985 ret = -ENODEV; ··· 2048 2046 case 0x21: 2049 2047 dev_info(ictx->dev, "0xffdc iMON Knob, iMON IR"); 2050 2048 ictx->display_supported = false; 2049 + break; 2050 + /* iMON 2.4G LT (usb stick), no display, iMON RF */ 2051 + case 0x4e: 2052 + dev_info(ictx->dev, "0xffdc iMON 2.4G LT, iMON RF"); 2053 + ictx->display_supported = false; 2054 + ictx->rf_device = true; 2051 2055 break; 2052 2056 /* iMON VFD, no IR (does have vol knob tho) */ 2053 2057 case 0x35: ··· 2205 2197 goto fail; 2206 2198 } 2207 2199 2208 - if (product == 0xffdc) { 2209 - /* RF products *also* use 0xffdc... sigh... */ 2210 - sysfs_err = sysfs_create_group(&interface->dev.kobj, 2211 - &imon_rf_attribute_group); 2212 - if (sysfs_err) 2213 - err("%s: Could not create RF sysfs entries(%d)", 2214 - __func__, sysfs_err); 2215 - } 2216 - 2217 2200 } else { 2218 2201 /* this is the secondary interface on the device */ 2219 2202 ictx = imon_init_intf1(interface, first_if_ctx); ··· 2231 2232 imon_get_ffdc_type(ictx); 2232 2233 2233 2234 imon_set_display_type(ictx, interface); 2235 + 2236 + if (product == 0xffdc && ictx->rf_device) { 2237 + sysfs_err = sysfs_create_group(&interface->dev.kobj, 2238 + &imon_rf_attribute_group); 2239 + if (sysfs_err) 2240 + err("%s: Could not create RF sysfs entries(%d)", 2241 + __func__, sysfs_err); 2242 + } 2234 2243 2235 2244 if (ictx->display_supported) 2236 2245 imon_init_display(ictx, interface); ··· 2304 2297 } 2305 2298 2306 2299 if (ifnum == 0) { 2307 - ictx->dev_present_intf0 = 0; 2300 + ictx->dev_present_intf0 = false; 2308 2301 usb_kill_urb(ictx->rx_urb_intf0); 2309 2302 input_unregister_device(ictx->idev); 2310 2303 if (ictx->display_supported) { ··· 2314 2307 usb_deregister_dev(interface, &imon_vfd_class); 2315 2308 } 2316 2309 } else { 2317 - ictx->dev_present_intf1 = 0; 2310 + ictx->dev_present_intf1 = false; 2318 2311 usb_kill_urb(ictx->rx_urb_intf1); 2319 2312 if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) 2320 2313 input_unregister_device(ictx->touch);
+10 -7
drivers/media/IR/ir-keytable.c
··· 490 490 if (rc < 0) 491 491 goto out_table; 492 492 493 - if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) { 494 - rc = ir_raw_event_register(input_dev); 495 - if (rc < 0) 496 - goto out_event; 497 - } 493 + if (ir_dev->props) 494 + if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) { 495 + rc = ir_raw_event_register(input_dev); 496 + if (rc < 0) 497 + goto out_event; 498 + } 498 499 499 500 IR_dprintk(1, "Registered input device on %s for %s remote.\n", 500 501 driver_name, rc_tab->name); ··· 531 530 IR_dprintk(1, "Freed keycode table\n"); 532 531 533 532 del_timer_sync(&ir_dev->timer_keyup); 534 - if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) 535 - ir_raw_event_unregister(input_dev); 533 + if (ir_dev->props) 534 + if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) 535 + ir_raw_event_unregister(input_dev); 536 + 536 537 rc_tab = &ir_dev->rc_tab; 537 538 rc_tab->size = 0; 538 539 kfree(rc_tab->scan);
+4 -3
drivers/media/IR/ir-sysfs.c
··· 221 221 if (unlikely(devno < 0)) 222 222 return devno; 223 223 224 - if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) 225 - ir_dev->dev.type = &rc_dev_type; 226 - else 224 + if (ir_dev->props) { 225 + if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) 226 + ir_dev->dev.type = &rc_dev_type; 227 + } else 227 228 ir_dev->dev.type = &ir_raw_dev_type; 228 229 229 230 ir_dev->dev.class = &ir_input_class;
+2 -1
drivers/media/IR/keymaps/Makefile
··· 6 6 rc-avermedia.o \ 7 7 rc-avermedia-cardbus.o \ 8 8 rc-avermedia-dvbt.o \ 9 - rc-avermedia-m135a-rm-jx.o \ 9 + rc-avermedia-m135a.o \ 10 + rc-avermedia-m733a-rm-k6.o \ 10 11 rc-avertv-303.o \ 11 12 rc-behold.o \ 12 13 rc-behold-columbus.o \
-90
drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c
··· 1 - /* avermedia-m135a-rm-jx.h - Keytable for avermedia_m135a_rm_jx Remote Controller 2 - * 3 - * keymap imported from ir-keymaps.c 4 - * 5 - * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - */ 12 - 13 - #include <media/rc-map.h> 14 - 15 - /* 16 - * Avermedia M135A with IR model RM-JX 17 - * The same codes exist on both Positivo (BR) and original IR 18 - * Mauro Carvalho Chehab <mchehab@infradead.org> 19 - */ 20 - 21 - static struct ir_scancode avermedia_m135a_rm_jx[] = { 22 - { 0x0200, KEY_POWER2 }, 23 - { 0x022e, KEY_DOT }, /* '.' */ 24 - { 0x0201, KEY_MODE }, /* TV/FM or SOURCE */ 25 - 26 - { 0x0205, KEY_1 }, 27 - { 0x0206, KEY_2 }, 28 - { 0x0207, KEY_3 }, 29 - { 0x0209, KEY_4 }, 30 - { 0x020a, KEY_5 }, 31 - { 0x020b, KEY_6 }, 32 - { 0x020d, KEY_7 }, 33 - { 0x020e, KEY_8 }, 34 - { 0x020f, KEY_9 }, 35 - { 0x0211, KEY_0 }, 36 - 37 - { 0x0213, KEY_RIGHT }, /* -> or L */ 38 - { 0x0212, KEY_LEFT }, /* <- or R */ 39 - 40 - { 0x0217, KEY_SLEEP }, /* Capturar Imagem or Snapshot */ 41 - { 0x0210, KEY_SHUFFLE }, /* Amostra or 16 chan prev */ 42 - 43 - { 0x0303, KEY_CHANNELUP }, 44 - { 0x0302, KEY_CHANNELDOWN }, 45 - { 0x021f, KEY_VOLUMEUP }, 46 - { 0x021e, KEY_VOLUMEDOWN }, 47 - { 0x020c, KEY_ENTER }, /* Full Screen */ 48 - 49 - { 0x0214, KEY_MUTE }, 50 - { 0x0208, KEY_AUDIO }, 51 - 52 - { 0x0203, KEY_TEXT }, /* Teletext */ 53 - { 0x0204, KEY_EPG }, 54 - { 0x022b, KEY_TV2 }, /* TV2 or PIP */ 55 - 56 - { 0x021d, KEY_RED }, 57 - { 0x021c, KEY_YELLOW }, 58 - { 0x0301, KEY_GREEN }, 59 - { 0x0300, KEY_BLUE }, 60 - 61 - { 0x021a, KEY_PLAYPAUSE }, 62 - { 0x0219, KEY_RECORD }, 63 - { 0x0218, KEY_PLAY }, 64 - { 0x021b, KEY_STOP }, 65 - }; 66 - 67 - static struct rc_keymap avermedia_m135a_rm_jx_map = { 68 - .map = { 69 - .scan = avermedia_m135a_rm_jx, 70 - .size = ARRAY_SIZE(avermedia_m135a_rm_jx), 71 - .ir_type = IR_TYPE_NEC, 72 - .name = RC_MAP_AVERMEDIA_M135A_RM_JX, 73 - } 74 - }; 75 - 76 - static int __init init_rc_map_avermedia_m135a_rm_jx(void) 77 - { 78 - return ir_register_map(&avermedia_m135a_rm_jx_map); 79 - } 80 - 81 - static void __exit exit_rc_map_avermedia_m135a_rm_jx(void) 82 - { 83 - ir_unregister_map(&avermedia_m135a_rm_jx_map); 84 - } 85 - 86 - module_init(init_rc_map_avermedia_m135a_rm_jx) 87 - module_exit(exit_rc_map_avermedia_m135a_rm_jx) 88 - 89 - MODULE_LICENSE("GPL"); 90 - MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
+147
drivers/media/IR/keymaps/rc-avermedia-m135a.c
··· 1 + /* avermedia-m135a.c - Keytable for Avermedia M135A Remote Controllers 2 + * 3 + * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 4 + * Copyright (c) 2010 by Herton Ronaldo Krzesinski <herton@mandriva.com.br> 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + */ 11 + 12 + #include <media/rc-map.h> 13 + 14 + /* 15 + * Avermedia M135A with RM-JX and RM-K6 remote controls 16 + * 17 + * On Avermedia M135A with IR model RM-JX, the same codes exist on both 18 + * Positivo (BR) and original IR, initial version and remote control codes 19 + * added by Mauro Carvalho Chehab <mchehab@infradead.org> 20 + * 21 + * Positivo also ships Avermedia M135A with model RM-K6, extra control 22 + * codes added by Herton Ronaldo Krzesinski <herton@mandriva.com.br> 23 + */ 24 + 25 + static struct ir_scancode avermedia_m135a[] = { 26 + /* RM-JX */ 27 + { 0x0200, KEY_POWER2 }, 28 + { 0x022e, KEY_DOT }, /* '.' */ 29 + { 0x0201, KEY_MODE }, /* TV/FM or SOURCE */ 30 + 31 + { 0x0205, KEY_1 }, 32 + { 0x0206, KEY_2 }, 33 + { 0x0207, KEY_3 }, 34 + { 0x0209, KEY_4 }, 35 + { 0x020a, KEY_5 }, 36 + { 0x020b, KEY_6 }, 37 + { 0x020d, KEY_7 }, 38 + { 0x020e, KEY_8 }, 39 + { 0x020f, KEY_9 }, 40 + { 0x0211, KEY_0 }, 41 + 42 + { 0x0213, KEY_RIGHT }, /* -> or L */ 43 + { 0x0212, KEY_LEFT }, /* <- or R */ 44 + 45 + { 0x0217, KEY_SLEEP }, /* Capturar Imagem or Snapshot */ 46 + { 0x0210, KEY_SHUFFLE }, /* Amostra or 16 chan prev */ 47 + 48 + { 0x0303, KEY_CHANNELUP }, 49 + { 0x0302, KEY_CHANNELDOWN }, 50 + { 0x021f, KEY_VOLUMEUP }, 51 + { 0x021e, KEY_VOLUMEDOWN }, 52 + { 0x020c, KEY_ENTER }, /* Full Screen */ 53 + 54 + { 0x0214, KEY_MUTE }, 55 + { 0x0208, KEY_AUDIO }, 56 + 57 + { 0x0203, KEY_TEXT }, /* Teletext */ 58 + { 0x0204, KEY_EPG }, 59 + { 0x022b, KEY_TV2 }, /* TV2 or PIP */ 60 + 61 + { 0x021d, KEY_RED }, 62 + { 0x021c, KEY_YELLOW }, 63 + { 0x0301, KEY_GREEN }, 64 + { 0x0300, KEY_BLUE }, 65 + 66 + { 0x021a, KEY_PLAYPAUSE }, 67 + { 0x0219, KEY_RECORD }, 68 + { 0x0218, KEY_PLAY }, 69 + { 0x021b, KEY_STOP }, 70 + 71 + /* RM-K6 */ 72 + { 0x0401, KEY_POWER2 }, 73 + { 0x0406, KEY_MUTE }, 74 + { 0x0408, KEY_MODE }, /* TV/FM */ 75 + 76 + { 0x0409, KEY_1 }, 77 + { 0x040a, KEY_2 }, 78 + { 0x040b, KEY_3 }, 79 + { 0x040c, KEY_4 }, 80 + { 0x040d, KEY_5 }, 81 + { 0x040e, KEY_6 }, 82 + { 0x040f, KEY_7 }, 83 + { 0x0410, KEY_8 }, 84 + { 0x0411, KEY_9 }, 85 + { 0x044c, KEY_DOT }, /* '.' */ 86 + { 0x0412, KEY_0 }, 87 + { 0x0407, KEY_REFRESH }, /* Refresh/Reload */ 88 + 89 + { 0x0413, KEY_AUDIO }, 90 + { 0x0440, KEY_SCREEN }, /* Full Screen toggle */ 91 + { 0x0441, KEY_HOME }, 92 + { 0x0442, KEY_BACK }, 93 + { 0x0447, KEY_UP }, 94 + { 0x0448, KEY_DOWN }, 95 + { 0x0449, KEY_LEFT }, 96 + { 0x044a, KEY_RIGHT }, 97 + { 0x044b, KEY_OK }, 98 + { 0x0404, KEY_VOLUMEUP }, 99 + { 0x0405, KEY_VOLUMEDOWN }, 100 + { 0x0402, KEY_CHANNELUP }, 101 + { 0x0403, KEY_CHANNELDOWN }, 102 + 103 + { 0x0443, KEY_RED }, 104 + { 0x0444, KEY_GREEN }, 105 + { 0x0445, KEY_YELLOW }, 106 + { 0x0446, KEY_BLUE }, 107 + 108 + { 0x0414, KEY_TEXT }, 109 + { 0x0415, KEY_EPG }, 110 + { 0x041a, KEY_TV2 }, /* PIP */ 111 + { 0x041b, KEY_MHP }, /* Snapshot */ 112 + 113 + { 0x0417, KEY_RECORD }, 114 + { 0x0416, KEY_PLAYPAUSE }, 115 + { 0x0418, KEY_STOP }, 116 + { 0x0419, KEY_PAUSE }, 117 + 118 + { 0x041f, KEY_PREVIOUS }, 119 + { 0x041c, KEY_REWIND }, 120 + { 0x041d, KEY_FORWARD }, 121 + { 0x041e, KEY_NEXT }, 122 + }; 123 + 124 + static struct rc_keymap avermedia_m135a_map = { 125 + .map = { 126 + .scan = avermedia_m135a, 127 + .size = ARRAY_SIZE(avermedia_m135a), 128 + .ir_type = IR_TYPE_NEC, 129 + .name = RC_MAP_AVERMEDIA_M135A, 130 + } 131 + }; 132 + 133 + static int __init init_rc_map_avermedia_m135a(void) 134 + { 135 + return ir_register_map(&avermedia_m135a_map); 136 + } 137 + 138 + static void __exit exit_rc_map_avermedia_m135a(void) 139 + { 140 + ir_unregister_map(&avermedia_m135a_map); 141 + } 142 + 143 + module_init(init_rc_map_avermedia_m135a) 144 + module_exit(exit_rc_map_avermedia_m135a) 145 + 146 + MODULE_LICENSE("GPL"); 147 + MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
+95
drivers/media/IR/keymaps/rc-avermedia-m733a-rm-k6.c
··· 1 + /* avermedia-m733a-rm-k6.h - Keytable for avermedia_m733a_rm_k6 Remote Controller 2 + * 3 + * Copyright (c) 2010 by Herton Ronaldo Krzesinski <herton@mandriva.com.br> 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License as published by 7 + * the Free Software Foundation; either version 2 of the License, or 8 + * (at your option) any later version. 9 + */ 10 + 11 + #include <media/rc-map.h> 12 + 13 + /* 14 + * Avermedia M733A with IR model RM-K6 15 + * This is the stock remote controller used with Positivo machines with M733A 16 + * Herton Ronaldo Krzesinski <herton@mandriva.com.br> 17 + */ 18 + 19 + static struct ir_scancode avermedia_m733a_rm_k6[] = { 20 + { 0x0401, KEY_POWER2 }, 21 + { 0x0406, KEY_MUTE }, 22 + { 0x0408, KEY_MODE }, /* TV/FM */ 23 + 24 + { 0x0409, KEY_1 }, 25 + { 0x040a, KEY_2 }, 26 + { 0x040b, KEY_3 }, 27 + { 0x040c, KEY_4 }, 28 + { 0x040d, KEY_5 }, 29 + { 0x040e, KEY_6 }, 30 + { 0x040f, KEY_7 }, 31 + { 0x0410, KEY_8 }, 32 + { 0x0411, KEY_9 }, 33 + { 0x044c, KEY_DOT }, /* '.' */ 34 + { 0x0412, KEY_0 }, 35 + { 0x0407, KEY_REFRESH }, /* Refresh/Reload */ 36 + 37 + { 0x0413, KEY_AUDIO }, 38 + { 0x0440, KEY_SCREEN }, /* Full Screen toggle */ 39 + { 0x0441, KEY_HOME }, 40 + { 0x0442, KEY_BACK }, 41 + { 0x0447, KEY_UP }, 42 + { 0x0448, KEY_DOWN }, 43 + { 0x0449, KEY_LEFT }, 44 + { 0x044a, KEY_RIGHT }, 45 + { 0x044b, KEY_OK }, 46 + { 0x0404, KEY_VOLUMEUP }, 47 + { 0x0405, KEY_VOLUMEDOWN }, 48 + { 0x0402, KEY_CHANNELUP }, 49 + { 0x0403, KEY_CHANNELDOWN }, 50 + 51 + { 0x0443, KEY_RED }, 52 + { 0x0444, KEY_GREEN }, 53 + { 0x0445, KEY_YELLOW }, 54 + { 0x0446, KEY_BLUE }, 55 + 56 + { 0x0414, KEY_TEXT }, 57 + { 0x0415, KEY_EPG }, 58 + { 0x041a, KEY_TV2 }, /* PIP */ 59 + { 0x041b, KEY_MHP }, /* Snapshot */ 60 + 61 + { 0x0417, KEY_RECORD }, 62 + { 0x0416, KEY_PLAYPAUSE }, 63 + { 0x0418, KEY_STOP }, 64 + { 0x0419, KEY_PAUSE }, 65 + 66 + { 0x041f, KEY_PREVIOUS }, 67 + { 0x041c, KEY_REWIND }, 68 + { 0x041d, KEY_FORWARD }, 69 + { 0x041e, KEY_NEXT }, 70 + }; 71 + 72 + static struct rc_keymap avermedia_m733a_rm_k6_map = { 73 + .map = { 74 + .scan = avermedia_m733a_rm_k6, 75 + .size = ARRAY_SIZE(avermedia_m733a_rm_k6), 76 + .ir_type = IR_TYPE_NEC, 77 + .name = RC_MAP_AVERMEDIA_M733A_RM_K6, 78 + } 79 + }; 80 + 81 + static int __init init_rc_map_avermedia_m733a_rm_k6(void) 82 + { 83 + return ir_register_map(&avermedia_m733a_rm_k6_map); 84 + } 85 + 86 + static void __exit exit_rc_map_avermedia_m733a_rm_k6(void) 87 + { 88 + ir_unregister_map(&avermedia_m733a_rm_k6_map); 89 + } 90 + 91 + module_init(init_rc_map_avermedia_m733a_rm_k6) 92 + module_exit(exit_rc_map_avermedia_m733a_rm_k6) 93 + 94 + MODULE_LICENSE("GPL"); 95 + MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
+1 -1
drivers/media/dvb/dm1105/dm1105.c
··· 594 594 int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) 595 595 { 596 596 struct input_dev *input_dev; 597 - char *ir_codes = NULL; 597 + char *ir_codes = RC_MAP_DM1105_NEC; 598 598 int err = -ENOMEM; 599 599 600 600 input_dev = input_allocate_device();
+11 -1
drivers/media/dvb/dvb-core/dvb_net.c
··· 351 351 const u8 *ts, *ts_end, *from_where = NULL; 352 352 u8 ts_remain = 0, how_much = 0, new_ts = 1; 353 353 struct ethhdr *ethh = NULL; 354 + bool error = false; 354 355 355 356 #ifdef ULE_DEBUG 356 357 /* The code inside ULE_DEBUG keeps a history of the last 100 TS cells processed. */ ··· 461 460 462 461 /* Drop partly decoded SNDU, reset state, resync on PUSI. */ 463 462 if (priv->ule_skb) { 464 - dev_kfree_skb( priv->ule_skb ); 463 + error = true; 464 + dev_kfree_skb(priv->ule_skb); 465 + } 466 + 467 + if (error || priv->ule_sndu_remain) { 465 468 dev->stats.rx_errors++; 466 469 dev->stats.rx_frame_errors++; 470 + error = false; 467 471 } 472 + 468 473 reset_ule(priv); 469 474 priv->need_pusi = 1; 470 475 continue; ··· 542 535 from_where += 2; 543 536 } 544 537 538 + priv->ule_sndu_remain = priv->ule_sndu_len + 2; 545 539 /* 546 540 * State of current TS: 547 541 * ts_remain (remaining bytes in the current TS cell) ··· 552 544 */ 553 545 switch (ts_remain) { 554 546 case 1: 547 + priv->ule_sndu_remain--; 555 548 priv->ule_sndu_type = from_where[0] << 8; 556 549 priv->ule_sndu_type_1 = 1; /* first byte of ule_type is set. */ 557 550 ts_remain -= 1; from_where += 1; ··· 566 557 default: /* complete ULE header is present in current TS. */ 567 558 /* Extract ULE type field. */ 568 559 if (priv->ule_sndu_type_1) { 560 + priv->ule_sndu_type_1 = 0; 569 561 priv->ule_sndu_type |= from_where[0]; 570 562 from_where += 1; /* points to payload start. */ 571 563 ts_remain -= 1;
+3 -1
drivers/media/dvb/dvb-usb/Kconfig
··· 76 76 select DVB_S5H1411 if !DVB_FE_CUSTOMISE 77 77 select DVB_LGDT3305 if !DVB_FE_CUSTOMISE 78 78 select DVB_TUNER_DIB0070 if !DVB_FE_CUSTOMISE 79 + select DVB_TUNER_DIB0090 if !DVB_FE_CUSTOMISE 79 80 select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMISE 80 81 select MEDIA_TUNER_MT2266 if !MEDIA_TUNER_CUSTOMISE 81 82 select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE ··· 135 134 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 136 135 select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMISE 137 136 select MEDIA_TUNER_TDA827X if !MEDIA_TUNER_CUSTOMISE 137 + select MEDIA_TUNER_SIMPLE if !MEDIA_TUNER_CUSTOMISE 138 138 help 139 139 Say Y here to support the MSI Mega Sky 580 USB2.0 DVB-T receiver. 140 140 Currently, only devices with a product id of ··· 266 264 select DVB_STB6000 if !DVB_FE_CUSTOMISE 267 265 select DVB_CX24116 if !DVB_FE_CUSTOMISE 268 266 select DVB_SI21XX if !DVB_FE_CUSTOMISE 269 - select DVB_TDA10021 if !DVB_FE_CUSTOMISE 267 + select DVB_TDA10023 if !DVB_FE_CUSTOMISE 270 268 select DVB_MT312 if !DVB_FE_CUSTOMISE 271 269 select DVB_ZL10039 if !DVB_FE_CUSTOMISE 272 270 select DVB_DS3000 if !DVB_FE_CUSTOMISE
+3 -1
drivers/media/dvb/dvb-usb/cxusb.c
··· 1026 1026 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); 1027 1027 1028 1028 if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 1029 - &cxusb_dualdig4_rev2_config) < 0) 1029 + &cxusb_dualdig4_rev2_config) < 0) { 1030 + printk(KERN_WARNING "Unable to enumerate dib7000p\n"); 1030 1031 return -ENODEV; 1032 + } 1031 1033 1032 1034 adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, 1033 1035 &cxusb_dualdig4_rev2_config);
+1
drivers/media/dvb/dvb-usb/dvb-usb-ids.h
··· 198 198 #define USB_PID_AVERMEDIA_A850 0x850a 199 199 #define USB_PID_AVERMEDIA_A805 0xa805 200 200 #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 201 + #define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d 201 202 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a 202 203 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2 0x0081 203 204 #define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058
+89 -6
drivers/media/dvb/dvb-usb/ttusb2.c
··· 29 29 30 30 #include "tda826x.h" 31 31 #include "tda10086.h" 32 + #include "tda1002x.h" 33 + #include "tda827x.h" 32 34 #include "lnbp21.h" 33 35 34 36 /* debug */ ··· 152 150 .xtal_freq = TDA10086_XTAL_16M, 153 151 }; 154 152 155 - static int ttusb2_frontend_attach(struct dvb_usb_adapter *adap) 153 + static struct tda10023_config tda10023_config = { 154 + .demod_address = 0x0c, 155 + .invert = 0, 156 + .xtal = 16000000, 157 + .pll_m = 11, 158 + .pll_p = 3, 159 + .pll_n = 1, 160 + .deltaf = 0xa511, 161 + }; 162 + 163 + static int ttusb2_frontend_tda10086_attach(struct dvb_usb_adapter *adap) 156 164 { 157 165 if (usb_set_interface(adap->dev->udev,0,3) < 0) 158 166 err("set interface to alts=3 failed"); ··· 175 163 return 0; 176 164 } 177 165 178 - static int ttusb2_tuner_attach(struct dvb_usb_adapter *adap) 166 + static int ttusb2_frontend_tda10023_attach(struct dvb_usb_adapter *adap) 167 + { 168 + if (usb_set_interface(adap->dev->udev, 0, 3) < 0) 169 + err("set interface to alts=3 failed"); 170 + if ((adap->fe = dvb_attach(tda10023_attach, &tda10023_config, &adap->dev->i2c_adap, 0x48)) == NULL) { 171 + deb_info("TDA10023 attach failed\n"); 172 + return -ENODEV; 173 + } 174 + return 0; 175 + } 176 + 177 + static int ttusb2_tuner_tda827x_attach(struct dvb_usb_adapter *adap) 178 + { 179 + if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL) { 180 + printk(KERN_ERR "%s: No tda827x found!\n", __func__); 181 + return -ENODEV; 182 + } 183 + return 0; 184 + } 185 + 186 + static int ttusb2_tuner_tda826x_attach(struct dvb_usb_adapter *adap) 179 187 { 180 188 if (dvb_attach(tda826x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, 0) == NULL) { 181 189 deb_info("TDA8263 attach failed\n"); ··· 212 180 /* DVB USB Driver stuff */ 213 181 static struct dvb_usb_device_properties ttusb2_properties; 214 182 static struct dvb_usb_device_properties ttusb2_properties_s2400; 183 + static struct dvb_usb_device_properties ttusb2_properties_ct3650; 215 184 216 185 static int ttusb2_probe(struct usb_interface *intf, 217 186 const struct usb_device_id *id) ··· 220 187 if (0 == dvb_usb_device_init(intf, &ttusb2_properties, 221 188 THIS_MODULE, NULL, adapter_nr) || 222 189 0 == dvb_usb_device_init(intf, &ttusb2_properties_s2400, 190 + THIS_MODULE, NULL, adapter_nr) || 191 + 0 == dvb_usb_device_init(intf, &ttusb2_properties_ct3650, 223 192 THIS_MODULE, NULL, adapter_nr)) 224 193 return 0; 225 194 return -ENODEV; ··· 232 197 { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PCTV_450E) }, 233 198 { USB_DEVICE(USB_VID_TECHNOTREND, 234 199 USB_PID_TECHNOTREND_CONNECT_S2400) }, 200 + { USB_DEVICE(USB_VID_TECHNOTREND, 201 + USB_PID_TECHNOTREND_CONNECT_CT3650) }, 235 202 {} /* Terminating entry */ 236 203 }; 237 204 MODULE_DEVICE_TABLE (usb, ttusb2_table); ··· 251 214 { 252 215 .streaming_ctrl = NULL, // ttusb2_streaming_ctrl, 253 216 254 - .frontend_attach = ttusb2_frontend_attach, 255 - .tuner_attach = ttusb2_tuner_attach, 217 + .frontend_attach = ttusb2_frontend_tda10086_attach, 218 + .tuner_attach = ttusb2_tuner_tda826x_attach, 256 219 257 220 /* parameter for the MPEG2-data transfer */ 258 221 .stream = { ··· 303 266 { 304 267 .streaming_ctrl = NULL, 305 268 306 - .frontend_attach = ttusb2_frontend_attach, 307 - .tuner_attach = ttusb2_tuner_attach, 269 + .frontend_attach = ttusb2_frontend_tda10086_attach, 270 + .tuner_attach = ttusb2_tuner_tda826x_attach, 308 271 309 272 /* parameter for the MPEG2-data transfer */ 310 273 .stream = { ··· 334 297 { "Technotrend TT-connect S-2400", 335 298 { &ttusb2_table[2], NULL }, 336 299 { NULL }, 300 + }, 301 + } 302 + }; 303 + 304 + static struct dvb_usb_device_properties ttusb2_properties_ct3650 = { 305 + .caps = DVB_USB_IS_AN_I2C_ADAPTER, 306 + 307 + .usb_ctrl = CYPRESS_FX2, 308 + 309 + .size_of_priv = sizeof(struct ttusb2_state), 310 + 311 + .num_adapters = 1, 312 + .adapter = { 313 + { 314 + .streaming_ctrl = NULL, 315 + 316 + .frontend_attach = ttusb2_frontend_tda10023_attach, 317 + .tuner_attach = ttusb2_tuner_tda827x_attach, 318 + 319 + /* parameter for the MPEG2-data transfer */ 320 + .stream = { 321 + .type = USB_ISOC, 322 + .count = 5, 323 + .endpoint = 0x02, 324 + .u = { 325 + .isoc = { 326 + .framesperurb = 4, 327 + .framesize = 940, 328 + .interval = 1, 329 + } 330 + } 331 + } 332 + }, 333 + }, 334 + 335 + .power_ctrl = ttusb2_power_ctrl, 336 + .identify_state = ttusb2_identify_state, 337 + 338 + .i2c_algo = &ttusb2_i2c_algo, 339 + 340 + .generic_bulk_ctrl_endpoint = 0x01, 341 + 342 + .num_device_descs = 1, 343 + .devices = { 344 + { "Technotrend TT-connect CT-3650", 345 + .warm_ids = { &ttusb2_table[3], NULL }, 337 346 }, 338 347 } 339 348 };
+1 -1
drivers/media/dvb/firewire/firedtv-1394.c
··· 58 58 num = hpsb_iso_n_ready(iso); 59 59 60 60 if (!fdtv) { 61 - dev_err(fdtv->device, "received at unknown iso channel\n"); 61 + pr_err("received at unknown iso channel\n"); 62 62 goto out; 63 63 } 64 64
-26
drivers/media/dvb/frontends/au8522_decoder.c
··· 567 567 568 568 /* ----------------------------------------------------------------------- */ 569 569 570 - static int au8522_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 571 - { 572 - switch (fmt->type) { 573 - default: 574 - return -EINVAL; 575 - } 576 - return 0; 577 - } 578 - 579 - static int au8522_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 580 - { 581 - switch (fmt->type) { 582 - case V4L2_BUF_TYPE_VIDEO_CAPTURE: 583 - /* Not yet implemented */ 584 - break; 585 - default: 586 - return -EINVAL; 587 - } 588 - 589 - return 0; 590 - } 591 - 592 - /* ----------------------------------------------------------------------- */ 593 - 594 570 #ifdef CONFIG_VIDEO_ADV_DEBUG 595 571 static int au8522_g_register(struct v4l2_subdev *sd, 596 572 struct v4l2_dbg_register *reg) ··· 748 772 749 773 static const struct v4l2_subdev_video_ops au8522_video_ops = { 750 774 .s_routing = au8522_s_video_routing, 751 - .g_fmt = au8522_g_fmt, 752 - .s_fmt = au8522_s_fmt, 753 775 .s_stream = au8522_s_stream, 754 776 }; 755 777
+1 -4
drivers/media/dvb/frontends/ds3000.c
··· 969 969 dprintk("%s\n", __func__); 970 970 971 971 /* allocate memory for the internal state */ 972 - state = kmalloc(sizeof(struct ds3000_state), GFP_KERNEL); 972 + state = kzalloc(sizeof(struct ds3000_state), GFP_KERNEL); 973 973 if (state == NULL) { 974 974 printk(KERN_ERR "Unable to kmalloc\n"); 975 975 goto error2; 976 976 } 977 - 978 - /* setup the state */ 979 - memset(state, 0, sizeof(struct ds3000_state)); 980 977 981 978 state->config = config; 982 979 state->i2c = i2c;
+4 -1
drivers/media/dvb/frontends/stv6110x.c
··· 303 303 304 304 static int stv6110x_sleep(struct dvb_frontend *fe) 305 305 { 306 - return stv6110x_set_mode(fe, TUNER_SLEEP); 306 + if (fe->tuner_priv) 307 + return stv6110x_set_mode(fe, TUNER_SLEEP); 308 + 309 + return 0; 307 310 } 308 311 309 312 static int stv6110x_get_status(struct dvb_frontend *fe, u32 *status)
+15
drivers/media/dvb/ngene/ngene-cards.c
··· 217 217 .fw_version = 15, 218 218 }; 219 219 220 + static struct ngene_info ngene_info_duoFlexS2 = { 221 + .type = NGENE_SIDEWINDER, 222 + .name = "Digital Devices DuoFlex S2 miniPCIe", 223 + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, 224 + .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, 225 + .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, 226 + .fe_config = {&fe_cineS2, &fe_cineS2}, 227 + .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, 228 + .lnb = {0x0a, 0x08}, 229 + .tsf = {3, 3}, 230 + .fw_version = 15, 231 + }; 232 + 220 233 static struct ngene_info ngene_info_m780 = { 221 234 .type = NGENE_APP, 222 235 .name = "Aver M780 ATSC/QAM-B", ··· 269 256 NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), 270 257 NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2), 271 258 NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5), 259 + NGENE_ID(0x18c3, 0xdd10, ngene_info_duoFlexS2), 260 + NGENE_ID(0x18c3, 0xdd20, ngene_info_duoFlexS2), 272 261 NGENE_ID(0x1461, 0x062e, ngene_info_m780), 273 262 {0} 274 263 };
+55 -25
drivers/media/dvb/ngene/ngene-core.c
··· 53 53 54 54 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 55 55 56 - #define COMMAND_TIMEOUT_WORKAROUND 57 - 58 56 #define dprintk if (debug) printk 59 57 60 58 #define ngwriteb(dat, adr) writeb((dat), (char *)(dev->iomem + (adr))) ··· 145 147 } else { 146 148 if (chan->HWState == HWSTATE_RUN) { 147 149 u32 Flags = 0; 150 + IBufferExchange *exch1 = chan->pBufferExchange; 151 + IBufferExchange *exch2 = chan->pBufferExchange2; 148 152 if (Cur->ngeneBuffer.SR.Flags & 0x01) 149 153 Flags |= BEF_EVEN_FIELD; 150 154 if (Cur->ngeneBuffer.SR.Flags & 0x20) 151 155 Flags |= BEF_OVERFLOW; 152 - if (chan->pBufferExchange) 153 - chan->pBufferExchange(chan, 154 - Cur->Buffer1, 155 - chan-> 156 - Capture1Length, 157 - Cur->ngeneBuffer. 158 - SR.Clock, Flags); 159 - if (chan->pBufferExchange2) 160 - chan->pBufferExchange2(chan, 161 - Cur->Buffer2, 162 - chan-> 163 - Capture2Length, 164 - Cur->ngeneBuffer. 165 - SR.Clock, Flags); 156 + spin_unlock_irq(&chan->state_lock); 157 + if (exch1) 158 + exch1(chan, Cur->Buffer1, 159 + chan->Capture1Length, 160 + Cur->ngeneBuffer.SR.Clock, 161 + Flags); 162 + if (exch2) 163 + exch2(chan, Cur->Buffer2, 164 + chan->Capture2Length, 165 + Cur->ngeneBuffer.SR.Clock, 166 + Flags); 167 + spin_lock_irq(&chan->state_lock); 166 168 } else if (chan->HWState != HWSTATE_STOP) 167 169 chan->HWState = HWSTATE_RUN; 168 170 } ··· 570 572 u16 BsSPI = ((stream & 1) ? 0x9800 : 0x9700); 571 573 u16 BsSDO = 0x9B00; 572 574 573 - /* down(&dev->stream_mutex); */ 574 - while (down_trylock(&dev->stream_mutex)) { 575 - printk(KERN_INFO DEVICE_NAME ": SC locked\n"); 576 - msleep(1); 577 - } 575 + down(&dev->stream_mutex); 578 576 memset(&com, 0, sizeof(com)); 579 577 com.cmd.hdr.Opcode = CMD_CONTROL; 580 578 com.cmd.hdr.Length = sizeof(struct FW_STREAM_CONTROL) - 2; ··· 1246 1252 version = 15; 1247 1253 size = 23466; 1248 1254 fw_name = "ngene_15.fw"; 1255 + dev->cmd_timeout_workaround = true; 1249 1256 break; 1250 1257 case 16: 1251 1258 size = 23498; 1252 1259 fw_name = "ngene_16.fw"; 1260 + dev->cmd_timeout_workaround = true; 1253 1261 break; 1254 1262 case 17: 1255 1263 size = 24446; 1256 1264 fw_name = "ngene_17.fw"; 1265 + dev->cmd_timeout_workaround = true; 1257 1266 break; 1258 1267 } 1259 1268 ··· 1296 1299 ngwritel(0, NGENE_EVENT); 1297 1300 ngwritel(0, NGENE_EVENT_HI); 1298 1301 free_irq(dev->pci_dev->irq, dev); 1302 + #ifdef CONFIG_PCI_MSI 1303 + if (dev->msi_enabled) 1304 + pci_disable_msi(dev->pci_dev); 1305 + #endif 1299 1306 } 1300 1307 1301 1308 static int ngene_start(struct ngene *dev) 1302 1309 { 1303 1310 int stat; 1311 + unsigned long flags; 1304 1312 int i; 1305 1313 1306 1314 pci_set_master(dev->pci_dev); ··· 1335 1333 if (stat < 0) 1336 1334 goto fail; 1337 1335 1336 + #ifdef CONFIG_PCI_MSI 1337 + /* enable MSI if kernel and card support it */ 1338 + if (pci_msi_enabled() && dev->card_info->msi_supported) { 1339 + ngwritel(0, NGENE_INT_ENABLE); 1340 + free_irq(dev->pci_dev->irq, dev); 1341 + stat = pci_enable_msi(dev->pci_dev); 1342 + if (stat) { 1343 + printk(KERN_INFO DEVICE_NAME 1344 + ": MSI not available\n"); 1345 + flags = IRQF_SHARED; 1346 + } else { 1347 + flags = 0; 1348 + dev->msi_enabled = true; 1349 + } 1350 + stat = request_irq(dev->pci_dev->irq, irq_handler, 1351 + flags, "nGene", dev); 1352 + if (stat < 0) 1353 + goto fail2; 1354 + ngwritel(1, NGENE_INT_ENABLE); 1355 + } 1356 + #endif 1357 + 1338 1358 stat = ngene_i2c_init(dev, 0); 1339 1359 if (stat < 0) 1340 1360 goto fail; ··· 1382 1358 bconf = BUFFER_CONFIG_3333; 1383 1359 stat = ngene_command_config_buf(dev, bconf); 1384 1360 } 1385 - return stat; 1361 + if (!stat) 1362 + return stat; 1363 + 1364 + /* otherwise error: fall through */ 1386 1365 fail: 1387 1366 ngwritel(0, NGENE_INT_ENABLE); 1388 1367 free_irq(dev->pci_dev->irq, dev); 1368 + #ifdef CONFIG_PCI_MSI 1369 + fail2: 1370 + if (dev->msi_enabled) 1371 + pci_disable_msi(dev->pci_dev); 1372 + #endif 1389 1373 return stat; 1390 1374 } 1391 1375 ··· 1411 1379 struct ngene_info *ni = dev->card_info; 1412 1380 int io = ni->io_type[chan->number]; 1413 1381 1414 - #ifdef COMMAND_TIMEOUT_WORKAROUND 1415 - if (chan->running) 1382 + if (chan->dev->cmd_timeout_workaround && chan->running) 1416 1383 set_transfer(chan, 0); 1417 - #endif 1418 1384 1419 1385 tasklet_kill(&chan->demux_tasklet); 1420 1386
+3 -12
drivers/media/dvb/ngene/ngene-dvb.c
··· 37 37 #include <linux/pci.h> 38 38 #include <linux/smp_lock.h> 39 39 #include <linux/timer.h> 40 - #include <linux/version.h> 41 40 #include <linux/byteorder/generic.h> 42 41 #include <linux/firmware.h> 43 42 #include <linux/vmalloc.h> 44 43 45 44 #include "ngene.h" 46 - 47 - #define COMMAND_TIMEOUT_WORKAROUND 48 45 49 46 50 47 /****************************************************************************/ ··· 66 69 struct ngene_channel *chan = priv; 67 70 68 71 69 - #ifdef COMMAND_TIMEOUT_WORKAROUND 70 72 if (chan->users > 0) 71 - #endif 72 73 dvb_dmx_swfilter(&chan->demux, buf, len); 73 74 return NULL; 74 75 } ··· 101 106 struct ngene_channel *chan = dvbdmx->priv; 102 107 103 108 if (chan->users == 0) { 104 - #ifdef COMMAND_TIMEOUT_WORKAROUND 105 - if (!chan->running) 106 - #endif 109 + if (!chan->dev->cmd_timeout_workaround || !chan->running) 107 110 set_transfer(chan, 1); 108 - /* msleep(10); */ 109 111 } 110 112 111 113 return ++chan->users; ··· 116 124 if (--chan->users) 117 125 return chan->users; 118 126 119 - #ifndef COMMAND_TIMEOUT_WORKAROUND 120 - set_transfer(chan, 0); 121 - #endif 127 + if (!chan->dev->cmd_timeout_workaround) 128 + set_transfer(chan, 0); 122 129 123 130 return 0; 124 131 }
-1
drivers/media/dvb/ngene/ngene-i2c.c
··· 39 39 #include <linux/pci_ids.h> 40 40 #include <linux/smp_lock.h> 41 41 #include <linux/timer.h> 42 - #include <linux/version.h> 43 42 #include <linux/byteorder/generic.h> 44 43 #include <linux/firmware.h> 45 44 #include <linux/vmalloc.h>
+3
drivers/media/dvb/ngene/ngene.h
··· 725 725 u32 device_version; 726 726 u32 fw_interface_version; 727 727 u32 icounts; 728 + bool msi_enabled; 729 + bool cmd_timeout_workaround; 728 730 729 731 u8 *CmdDoneByte; 730 732 int BootFirmware; ··· 799 797 #define NGENE_VBOX_V2 7 800 798 801 799 int fw_version; 800 + bool msi_supported; 802 801 char *name; 803 802 804 803 int io_type[MAX_STREAM];
+3 -2
drivers/media/dvb/ttpci/Kconfig
··· 68 68 select DVB_VES1820 if !DVB_FE_CUSTOMISE 69 69 select DVB_L64781 if !DVB_FE_CUSTOMISE 70 70 select DVB_TDA8083 if !DVB_FE_CUSTOMISE 71 - select DVB_TDA10021 if !DVB_FE_CUSTOMISE 72 - select DVB_TDA10023 if !DVB_FE_CUSTOMISE 73 71 select DVB_S5H1420 if !DVB_FE_CUSTOMISE 74 72 select DVB_TDA10086 if !DVB_FE_CUSTOMISE 75 73 select DVB_TDA826X if !DVB_FE_CUSTOMISE 76 74 select DVB_LNBP21 if !DVB_FE_CUSTOMISE 77 75 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 76 + select DVB_ISL6423 if !DVB_FE_CUSTOMISE 77 + select DVB_STV090x if !DVB_FE_CUSTOMISE 78 + select DVB_STV6110x if !DVB_FE_CUSTOMISE 78 79 help 79 80 Support for simple SAA7146 based DVB cards (so called Budget- 80 81 or Nova-PCI cards) without onboard MPEG2 decoder, and without
+1
drivers/media/dvb/ttpci/budget-ci.c
··· 215 215 break; 216 216 case 0x1010: 217 217 case 0x1017: 218 + case 0x1019: 218 219 case 0x101a: 219 220 /* for the Technotrend 1500 bundled remote */ 220 221 ir_codes = RC_MAP_TT_1500;
+2 -2
drivers/media/video/Kconfig
··· 646 646 647 647 config VIDEO_BWQCAM 648 648 tristate "Quickcam BW Video For Linux" 649 - depends on PARPORT && VIDEO_V4L1 649 + depends on PARPORT && VIDEO_V4L2 650 650 help 651 651 Say Y have if you the black and white version of the QuickCam 652 652 camera. See the next option for the color version. ··· 656 656 657 657 config VIDEO_CQCAM 658 658 tristate "QuickCam Colour Video For Linux (EXPERIMENTAL)" 659 - depends on EXPERIMENTAL && PARPORT && VIDEO_V4L1 659 + depends on EXPERIMENTAL && PARPORT && VIDEO_V4L2 660 660 help 661 661 This is the video4linux driver for the colour version of the 662 662 Connectix QuickCam. If you have one of these cameras, say Y here,
+2 -1
drivers/media/video/ak881x.c
··· 11 11 #include <linux/i2c.h> 12 12 #include <linux/init.h> 13 13 #include <linux/platform_device.h> 14 + #include <linux/slab.h> 14 15 #include <linux/videodev2.h> 15 16 16 17 #include <media/ak881x.h> ··· 142 141 return ak881x_try_g_mbus_fmt(sd, mf); 143 142 } 144 143 145 - static int ak881x_enum_mbus_fmt(struct v4l2_subdev *sd, int index, 144 + static int ak881x_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index, 146 145 enum v4l2_mbus_pixelcode *code) 147 146 { 148 147 if (index)
+420 -351
drivers/media/video/bw-qcam.c
··· 66 66 #include <linux/delay.h> 67 67 #include <linux/errno.h> 68 68 #include <linux/fs.h> 69 - #include <linux/init.h> 70 69 #include <linux/kernel.h> 71 70 #include <linux/slab.h> 72 71 #include <linux/mm.h> 73 72 #include <linux/parport.h> 74 73 #include <linux/sched.h> 75 - #include <linux/videodev.h> 76 - #include <media/v4l2-common.h> 77 - #include <media/v4l2-ioctl.h> 74 + #include <linux/version.h> 75 + #include <linux/videodev2.h> 78 76 #include <linux/mutex.h> 79 77 #include <asm/uaccess.h> 78 + #include <media/v4l2-common.h> 79 + #include <media/v4l2-ioctl.h> 80 + #include <media/v4l2-device.h> 80 81 81 - #include "bw-qcam.h" 82 + /* One from column A... */ 83 + #define QC_NOTSET 0 84 + #define QC_UNIDIR 1 85 + #define QC_BIDIR 2 86 + #define QC_SERIAL 3 87 + 88 + /* ... and one from column B */ 89 + #define QC_ANY 0x00 90 + #define QC_FORCE_UNIDIR 0x10 91 + #define QC_FORCE_BIDIR 0x20 92 + #define QC_FORCE_SERIAL 0x30 93 + /* in the port_mode member */ 94 + 95 + #define QC_MODE_MASK 0x07 96 + #define QC_FORCE_MASK 0x70 97 + 98 + #define MAX_HEIGHT 243 99 + #define MAX_WIDTH 336 100 + 101 + /* Bit fields for status flags */ 102 + #define QC_PARAM_CHANGE 0x01 /* Camera status change has occurred */ 103 + 104 + struct qcam { 105 + struct v4l2_device v4l2_dev; 106 + struct video_device vdev; 107 + struct pardevice *pdev; 108 + struct parport *pport; 109 + struct mutex lock; 110 + int width, height; 111 + int bpp; 112 + int mode; 113 + int contrast, brightness, whitebal; 114 + int port_mode; 115 + int transfer_scale; 116 + int top, left; 117 + int status; 118 + unsigned int saved_bits; 119 + unsigned long in_use; 120 + }; 82 121 83 122 static unsigned int maxpoll = 250; /* Maximum busy-loop count for qcam I/O */ 84 123 static unsigned int yieldlines = 4; /* Yield after this many during capture */ ··· 132 93 * immediately attempt to initialize qcam */ 133 94 module_param(force_init, int, 0); 134 95 135 - static inline int read_lpstatus(struct qcam_device *q) 96 + #define MAX_CAMS 4 97 + static struct qcam *qcams[MAX_CAMS]; 98 + static unsigned int num_cams; 99 + 100 + static inline int read_lpstatus(struct qcam *q) 136 101 { 137 102 return parport_read_status(q->pport); 138 103 } 139 104 140 - static inline int read_lpdata(struct qcam_device *q) 105 + static inline int read_lpdata(struct qcam *q) 141 106 { 142 107 return parport_read_data(q->pport); 143 108 } 144 109 145 - static inline void write_lpdata(struct qcam_device *q, int d) 110 + static inline void write_lpdata(struct qcam *q, int d) 146 111 { 147 112 parport_write_data(q->pport, d); 148 113 } 149 114 150 - static inline void write_lpcontrol(struct qcam_device *q, int d) 115 + static void write_lpcontrol(struct qcam *q, int d) 151 116 { 152 117 if (d & 0x20) { 153 118 /* Set bidirectional mode to reverse (data in) */ ··· 167 124 parport_write_control(q->pport, d); 168 125 } 169 126 170 - static int qc_waithand(struct qcam_device *q, int val); 171 - static int qc_command(struct qcam_device *q, int command); 172 - static int qc_readparam(struct qcam_device *q); 173 - static int qc_setscanmode(struct qcam_device *q); 174 - static int qc_readbytes(struct qcam_device *q, char buffer[]); 175 - 176 - static struct video_device qcam_template; 177 - 178 - static int qc_calibrate(struct qcam_device *q) 179 - { 180 - /* 181 - * Bugfix by Hanno Mueller hmueller@kabel.de, Mai 21 96 182 - * The white balance is an individiual value for each 183 - * quickcam. 184 - */ 185 - 186 - int value; 187 - int count = 0; 188 - 189 - qc_command(q, 27); /* AutoAdjustOffset */ 190 - qc_command(q, 0); /* Dummy Parameter, ignored by the camera */ 191 - 192 - /* GetOffset (33) will read 255 until autocalibration */ 193 - /* is finished. After that, a value of 1-254 will be */ 194 - /* returned. */ 195 - 196 - do { 197 - qc_command(q, 33); 198 - value = qc_readparam(q); 199 - mdelay(1); 200 - schedule(); 201 - count++; 202 - } while (value == 0xff && count < 2048); 203 - 204 - q->whitebal = value; 205 - return value; 206 - } 207 - 208 - /* Initialize the QuickCam driver control structure. This is where 209 - * defaults are set for people who don't have a config file.*/ 210 - 211 - static struct qcam_device *qcam_init(struct parport *port) 212 - { 213 - struct qcam_device *q; 214 - 215 - q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); 216 - if (q == NULL) 217 - return NULL; 218 - 219 - q->pport = port; 220 - q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, 221 - NULL, 0, NULL); 222 - if (q->pdev == NULL) { 223 - printk(KERN_ERR "bw-qcam: couldn't register for %s.\n", 224 - port->name); 225 - kfree(q); 226 - return NULL; 227 - } 228 - 229 - memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); 230 - 231 - mutex_init(&q->lock); 232 - 233 - q->port_mode = (QC_ANY | QC_NOTSET); 234 - q->width = 320; 235 - q->height = 240; 236 - q->bpp = 4; 237 - q->transfer_scale = 2; 238 - q->contrast = 192; 239 - q->brightness = 180; 240 - q->whitebal = 105; 241 - q->top = 1; 242 - q->left = 14; 243 - q->mode = -1; 244 - q->status = QC_PARAM_CHANGE; 245 - return q; 246 - } 247 - 248 - 249 - /* qc_command is probably a bit of a misnomer -- it's used to send 250 - * bytes *to* the camera. Generally, these bytes are either commands 251 - * or arguments to commands, so the name fits, but it still bugs me a 252 - * bit. See the documentation for a list of commands. */ 253 - 254 - static int qc_command(struct qcam_device *q, int command) 255 - { 256 - int n1, n2; 257 - int cmd; 258 - 259 - write_lpdata(q, command); 260 - write_lpcontrol(q, 6); 261 - 262 - n1 = qc_waithand(q, 1); 263 - 264 - write_lpcontrol(q, 0xe); 265 - n2 = qc_waithand(q, 0); 266 - 267 - cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4); 268 - return cmd; 269 - } 270 - 271 - static int qc_readparam(struct qcam_device *q) 272 - { 273 - int n1, n2; 274 - int cmd; 275 - 276 - write_lpcontrol(q, 6); 277 - n1 = qc_waithand(q, 1); 278 - 279 - write_lpcontrol(q, 0xe); 280 - n2 = qc_waithand(q, 0); 281 - 282 - cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4); 283 - return cmd; 284 - } 285 127 286 128 /* qc_waithand busy-waits for a handshake signal from the QuickCam. 287 129 * Almost all communication with the camera requires handshaking. */ 288 130 289 - static int qc_waithand(struct qcam_device *q, int val) 131 + static int qc_waithand(struct qcam *q, int val) 290 132 { 291 133 int status; 292 134 int runs = 0; ··· 214 286 * (bit 3 of status register). It also returns the last value read, 215 287 * since this data is useful. */ 216 288 217 - static unsigned int qc_waithand2(struct qcam_device *q, int val) 289 + static unsigned int qc_waithand2(struct qcam *q, int val) 218 290 { 219 291 unsigned int status; 220 292 int runs = 0; ··· 237 309 return status; 238 310 } 239 311 312 + /* qc_command is probably a bit of a misnomer -- it's used to send 313 + * bytes *to* the camera. Generally, these bytes are either commands 314 + * or arguments to commands, so the name fits, but it still bugs me a 315 + * bit. See the documentation for a list of commands. */ 316 + 317 + static int qc_command(struct qcam *q, int command) 318 + { 319 + int n1, n2; 320 + int cmd; 321 + 322 + write_lpdata(q, command); 323 + write_lpcontrol(q, 6); 324 + 325 + n1 = qc_waithand(q, 1); 326 + 327 + write_lpcontrol(q, 0xe); 328 + n2 = qc_waithand(q, 0); 329 + 330 + cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4); 331 + return cmd; 332 + } 333 + 334 + static int qc_readparam(struct qcam *q) 335 + { 336 + int n1, n2; 337 + int cmd; 338 + 339 + write_lpcontrol(q, 6); 340 + n1 = qc_waithand(q, 1); 341 + 342 + write_lpcontrol(q, 0xe); 343 + n2 = qc_waithand(q, 0); 344 + 345 + cmd = (n1 & 0xf0) | ((n2 & 0xf0) >> 4); 346 + return cmd; 347 + } 348 + 240 349 241 350 /* Try to detect a QuickCam. It appears to flash the upper 4 bits of 242 351 the status register at 5-10 Hz. This is only used in the autoprobe ··· 282 317 almost completely safe, while their method screws up my printer if 283 318 I plug it in before the camera. */ 284 319 285 - static int qc_detect(struct qcam_device *q) 320 + static int qc_detect(struct qcam *q) 286 321 { 287 322 int reg, lastreg; 288 323 int count = 0; ··· 323 358 } 324 359 } 325 360 326 - 327 - /* Reset the QuickCam. This uses the same sequence the Windows 328 - * QuickPic program uses. Someone with a bi-directional port should 329 - * check that bi-directional mode is detected right, and then 330 - * implement bi-directional mode in qc_readbyte(). */ 331 - 332 - static void qc_reset(struct qcam_device *q) 333 - { 334 - switch (q->port_mode & QC_FORCE_MASK) { 335 - case QC_FORCE_UNIDIR: 336 - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; 337 - break; 338 - 339 - case QC_FORCE_BIDIR: 340 - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; 341 - break; 342 - 343 - case QC_ANY: 344 - write_lpcontrol(q, 0x20); 345 - write_lpdata(q, 0x75); 346 - 347 - if (read_lpdata(q) != 0x75) 348 - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; 349 - else 350 - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; 351 - break; 352 - } 353 - 354 - write_lpcontrol(q, 0xb); 355 - udelay(250); 356 - write_lpcontrol(q, 0xe); 357 - qc_setscanmode(q); /* in case port_mode changed */ 358 - } 359 - 360 - 361 361 /* Decide which scan mode to use. There's no real requirement that 362 362 * the scanmode match the resolution in q->height and q-> width -- the 363 363 * camera takes the picture at the resolution specified in the ··· 332 402 * returned. If the scan is smaller, then the rest of the image 333 403 * returned contains garbage. */ 334 404 335 - static int qc_setscanmode(struct qcam_device *q) 405 + static int qc_setscanmode(struct qcam *q) 336 406 { 337 407 int old_mode = q->mode; 338 408 ··· 372 442 } 373 443 374 444 445 + /* Reset the QuickCam. This uses the same sequence the Windows 446 + * QuickPic program uses. Someone with a bi-directional port should 447 + * check that bi-directional mode is detected right, and then 448 + * implement bi-directional mode in qc_readbyte(). */ 449 + 450 + static void qc_reset(struct qcam *q) 451 + { 452 + switch (q->port_mode & QC_FORCE_MASK) { 453 + case QC_FORCE_UNIDIR: 454 + q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; 455 + break; 456 + 457 + case QC_FORCE_BIDIR: 458 + q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; 459 + break; 460 + 461 + case QC_ANY: 462 + write_lpcontrol(q, 0x20); 463 + write_lpdata(q, 0x75); 464 + 465 + if (read_lpdata(q) != 0x75) 466 + q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; 467 + else 468 + q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; 469 + break; 470 + } 471 + 472 + write_lpcontrol(q, 0xb); 473 + udelay(250); 474 + write_lpcontrol(q, 0xe); 475 + qc_setscanmode(q); /* in case port_mode changed */ 476 + } 477 + 478 + 479 + 375 480 /* Reset the QuickCam and program for brightness, contrast, 376 481 * white-balance, and resolution. */ 377 482 378 - static void qc_set(struct qcam_device *q) 483 + static void qc_set(struct qcam *q) 379 484 { 380 485 int val; 381 486 int val2; ··· 464 499 the supplied buffer. It returns the number of bytes read, 465 500 or -1 on error. */ 466 501 467 - static inline int qc_readbytes(struct qcam_device *q, char buffer[]) 502 + static inline int qc_readbytes(struct qcam *q, char buffer[]) 468 503 { 469 504 int ret = 1; 470 505 unsigned int hi, lo; ··· 555 590 * n=2^(bit depth)-1. Ask me for more details if you don't understand 556 591 * this. */ 557 592 558 - static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long len) 593 + static long qc_capture(struct qcam *q, char __user *buf, unsigned long len) 559 594 { 560 595 int i, j, k, yield; 561 596 int bytes; ··· 639 674 * Video4linux interfacing 640 675 */ 641 676 642 - static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) 677 + static int qcam_querycap(struct file *file, void *priv, 678 + struct v4l2_capability *vcap) 643 679 { 644 - struct video_device *dev = video_devdata(file); 645 - struct qcam_device *qcam = (struct qcam_device *)dev; 680 + struct qcam *qcam = video_drvdata(file); 646 681 647 - switch (cmd) { 648 - case VIDIOCGCAP: 649 - { 650 - struct video_capability *b = arg; 651 - strcpy(b->name, "Quickcam"); 652 - b->type = VID_TYPE_CAPTURE|VID_TYPE_SCALES|VID_TYPE_MONOCHROME; 653 - b->channels = 1; 654 - b->audios = 0; 655 - b->maxwidth = 320; 656 - b->maxheight = 240; 657 - b->minwidth = 80; 658 - b->minheight = 60; 659 - return 0; 660 - } 661 - case VIDIOCGCHAN: 662 - { 663 - struct video_channel *v = arg; 664 - if (v->channel != 0) 665 - return -EINVAL; 666 - v->flags = 0; 667 - v->tuners = 0; 668 - /* Good question.. its composite or SVHS so.. */ 669 - v->type = VIDEO_TYPE_CAMERA; 670 - strcpy(v->name, "Camera"); 671 - return 0; 672 - } 673 - case VIDIOCSCHAN: 674 - { 675 - struct video_channel *v = arg; 676 - if (v->channel != 0) 677 - return -EINVAL; 678 - return 0; 679 - } 680 - case VIDIOCGTUNER: 681 - { 682 - struct video_tuner *v = arg; 683 - if (v->tuner) 684 - return -EINVAL; 685 - strcpy(v->name, "Format"); 686 - v->rangelow = 0; 687 - v->rangehigh = 0; 688 - v->flags = 0; 689 - v->mode = VIDEO_MODE_AUTO; 690 - return 0; 691 - } 692 - case VIDIOCSTUNER: 693 - { 694 - struct video_tuner *v = arg; 695 - if (v->tuner) 696 - return -EINVAL; 697 - if (v->mode != VIDEO_MODE_AUTO) 698 - return -EINVAL; 699 - return 0; 700 - } 701 - case VIDIOCGPICT: 702 - { 703 - struct video_picture *p = arg; 704 - p->colour = 0x8000; 705 - p->hue = 0x8000; 706 - p->brightness = qcam->brightness << 8; 707 - p->contrast = qcam->contrast << 8; 708 - p->whiteness = qcam->whitebal << 8; 709 - p->depth = qcam->bpp; 710 - p->palette = VIDEO_PALETTE_GREY; 711 - return 0; 712 - } 713 - case VIDIOCSPICT: 714 - { 715 - struct video_picture *p = arg; 716 - if (p->palette != VIDEO_PALETTE_GREY) 717 - return -EINVAL; 718 - if (p->depth != 4 && p->depth != 6) 719 - return -EINVAL; 720 - 721 - /* 722 - * Now load the camera. 723 - */ 724 - 725 - qcam->brightness = p->brightness >> 8; 726 - qcam->contrast = p->contrast >> 8; 727 - qcam->whitebal = p->whiteness >> 8; 728 - qcam->bpp = p->depth; 729 - 730 - mutex_lock(&qcam->lock); 731 - qc_setscanmode(qcam); 732 - mutex_unlock(&qcam->lock); 733 - qcam->status |= QC_PARAM_CHANGE; 734 - 735 - return 0; 736 - } 737 - case VIDIOCSWIN: 738 - { 739 - struct video_window *vw = arg; 740 - if (vw->flags) 741 - return -EINVAL; 742 - if (vw->clipcount) 743 - return -EINVAL; 744 - if (vw->height < 60 || vw->height > 240) 745 - return -EINVAL; 746 - if (vw->width < 80 || vw->width > 320) 747 - return -EINVAL; 748 - 749 - qcam->width = 320; 750 - qcam->height = 240; 751 - qcam->transfer_scale = 4; 752 - 753 - if (vw->width >= 160 && vw->height >= 120) 754 - qcam->transfer_scale = 2; 755 - if (vw->width >= 320 && vw->height >= 240) { 756 - qcam->width = 320; 757 - qcam->height = 240; 758 - qcam->transfer_scale = 1; 759 - } 760 - mutex_lock(&qcam->lock); 761 - qc_setscanmode(qcam); 762 - mutex_unlock(&qcam->lock); 763 - 764 - /* We must update the camera before we grab. We could 765 - just have changed the grab size */ 766 - qcam->status |= QC_PARAM_CHANGE; 767 - 768 - /* Ok we figured out what to use from our wide choice */ 769 - return 0; 770 - } 771 - case VIDIOCGWIN: 772 - { 773 - struct video_window *vw = arg; 774 - 775 - memset(vw, 0, sizeof(*vw)); 776 - vw->width = qcam->width / qcam->transfer_scale; 777 - vw->height = qcam->height / qcam->transfer_scale; 778 - return 0; 779 - } 780 - case VIDIOCKEY: 781 - return 0; 782 - case VIDIOCCAPTURE: 783 - case VIDIOCGFBUF: 784 - case VIDIOCSFBUF: 785 - case VIDIOCGFREQ: 786 - case VIDIOCSFREQ: 787 - case VIDIOCGAUDIO: 788 - case VIDIOCSAUDIO: 789 - return -EINVAL; 790 - default: 791 - return -ENOIOCTLCMD; 792 - } 682 + strlcpy(vcap->driver, qcam->v4l2_dev.name, sizeof(vcap->driver)); 683 + strlcpy(vcap->card, "B&W Quickcam", sizeof(vcap->card)); 684 + strlcpy(vcap->bus_info, "parport", sizeof(vcap->bus_info)); 685 + vcap->version = KERNEL_VERSION(0, 0, 2); 686 + vcap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; 793 687 return 0; 794 688 } 795 689 796 - static long qcam_ioctl(struct file *file, 797 - unsigned int cmd, unsigned long arg) 690 + static int qcam_enum_input(struct file *file, void *fh, struct v4l2_input *vin) 798 691 { 799 - return video_usercopy(file, cmd, arg, qcam_do_ioctl); 692 + if (vin->index > 0) 693 + return -EINVAL; 694 + strlcpy(vin->name, "Camera", sizeof(vin->name)); 695 + vin->type = V4L2_INPUT_TYPE_CAMERA; 696 + vin->audioset = 0; 697 + vin->tuner = 0; 698 + vin->std = 0; 699 + vin->status = 0; 700 + return 0; 701 + } 702 + 703 + static int qcam_g_input(struct file *file, void *fh, unsigned int *inp) 704 + { 705 + *inp = 0; 706 + return 0; 707 + } 708 + 709 + static int qcam_s_input(struct file *file, void *fh, unsigned int inp) 710 + { 711 + return (inp > 0) ? -EINVAL : 0; 712 + } 713 + 714 + static int qcam_queryctrl(struct file *file, void *priv, 715 + struct v4l2_queryctrl *qc) 716 + { 717 + switch (qc->id) { 718 + case V4L2_CID_BRIGHTNESS: 719 + return v4l2_ctrl_query_fill(qc, 0, 255, 1, 180); 720 + case V4L2_CID_CONTRAST: 721 + return v4l2_ctrl_query_fill(qc, 0, 255, 1, 192); 722 + case V4L2_CID_GAMMA: 723 + return v4l2_ctrl_query_fill(qc, 0, 255, 1, 105); 724 + } 725 + return -EINVAL; 726 + } 727 + 728 + static int qcam_g_ctrl(struct file *file, void *priv, 729 + struct v4l2_control *ctrl) 730 + { 731 + struct qcam *qcam = video_drvdata(file); 732 + int ret = 0; 733 + 734 + switch (ctrl->id) { 735 + case V4L2_CID_BRIGHTNESS: 736 + ctrl->value = qcam->brightness; 737 + break; 738 + case V4L2_CID_CONTRAST: 739 + ctrl->value = qcam->contrast; 740 + break; 741 + case V4L2_CID_GAMMA: 742 + ctrl->value = qcam->whitebal; 743 + break; 744 + default: 745 + ret = -EINVAL; 746 + break; 747 + } 748 + return ret; 749 + } 750 + 751 + static int qcam_s_ctrl(struct file *file, void *priv, 752 + struct v4l2_control *ctrl) 753 + { 754 + struct qcam *qcam = video_drvdata(file); 755 + int ret = 0; 756 + 757 + mutex_lock(&qcam->lock); 758 + switch (ctrl->id) { 759 + case V4L2_CID_BRIGHTNESS: 760 + qcam->brightness = ctrl->value; 761 + break; 762 + case V4L2_CID_CONTRAST: 763 + qcam->contrast = ctrl->value; 764 + break; 765 + case V4L2_CID_GAMMA: 766 + qcam->whitebal = ctrl->value; 767 + break; 768 + default: 769 + ret = -EINVAL; 770 + break; 771 + } 772 + if (ret == 0) { 773 + qc_setscanmode(qcam); 774 + qcam->status |= QC_PARAM_CHANGE; 775 + } 776 + mutex_unlock(&qcam->lock); 777 + return ret; 778 + } 779 + 780 + static int qcam_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) 781 + { 782 + struct qcam *qcam = video_drvdata(file); 783 + struct v4l2_pix_format *pix = &fmt->fmt.pix; 784 + 785 + pix->width = qcam->width / qcam->transfer_scale; 786 + pix->height = qcam->height / qcam->transfer_scale; 787 + pix->pixelformat = (qcam->bpp == 4) ? V4L2_PIX_FMT_Y4 : V4L2_PIX_FMT_Y6; 788 + pix->field = V4L2_FIELD_NONE; 789 + pix->bytesperline = qcam->width; 790 + pix->sizeimage = qcam->width * qcam->height; 791 + /* Just a guess */ 792 + pix->colorspace = V4L2_COLORSPACE_SRGB; 793 + return 0; 794 + } 795 + 796 + static int qcam_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) 797 + { 798 + struct v4l2_pix_format *pix = &fmt->fmt.pix; 799 + 800 + if (pix->height <= 60 || pix->width <= 80) { 801 + pix->height = 60; 802 + pix->width = 80; 803 + } else if (pix->height <= 120 || pix->width <= 160) { 804 + pix->height = 120; 805 + pix->width = 160; 806 + } else { 807 + pix->height = 240; 808 + pix->width = 320; 809 + } 810 + if (pix->pixelformat != V4L2_PIX_FMT_Y4 && 811 + pix->pixelformat != V4L2_PIX_FMT_Y6) 812 + pix->pixelformat = V4L2_PIX_FMT_Y4; 813 + pix->field = V4L2_FIELD_NONE; 814 + pix->bytesperline = pix->width; 815 + pix->sizeimage = pix->width * pix->height; 816 + /* Just a guess */ 817 + pix->colorspace = V4L2_COLORSPACE_SRGB; 818 + return 0; 819 + } 820 + 821 + static int qcam_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) 822 + { 823 + struct qcam *qcam = video_drvdata(file); 824 + struct v4l2_pix_format *pix = &fmt->fmt.pix; 825 + int ret = qcam_try_fmt_vid_cap(file, fh, fmt); 826 + 827 + if (ret) 828 + return ret; 829 + qcam->width = 320; 830 + qcam->height = 240; 831 + if (pix->height == 60) 832 + qcam->transfer_scale = 4; 833 + else if (pix->height == 120) 834 + qcam->transfer_scale = 2; 835 + else 836 + qcam->transfer_scale = 1; 837 + if (pix->pixelformat == V4L2_PIX_FMT_Y6) 838 + qcam->bpp = 6; 839 + else 840 + qcam->bpp = 4; 841 + 842 + mutex_lock(&qcam->lock); 843 + qc_setscanmode(qcam); 844 + /* We must update the camera before we grab. We could 845 + just have changed the grab size */ 846 + qcam->status |= QC_PARAM_CHANGE; 847 + mutex_unlock(&qcam->lock); 848 + return 0; 849 + } 850 + 851 + static int qcam_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) 852 + { 853 + static struct v4l2_fmtdesc formats[] = { 854 + { 0, 0, 0, 855 + "4-Bit Monochrome", V4L2_PIX_FMT_Y4, 856 + { 0, 0, 0, 0 } 857 + }, 858 + { 0, 0, 0, 859 + "6-Bit Monochrome", V4L2_PIX_FMT_Y6, 860 + { 0, 0, 0, 0 } 861 + }, 862 + }; 863 + enum v4l2_buf_type type = fmt->type; 864 + 865 + if (fmt->index > 1) 866 + return -EINVAL; 867 + 868 + *fmt = formats[fmt->index]; 869 + fmt->type = type; 870 + return 0; 800 871 } 801 872 802 873 static ssize_t qcam_read(struct file *file, char __user *buf, 803 874 size_t count, loff_t *ppos) 804 875 { 805 - struct video_device *v = video_devdata(file); 806 - struct qcam_device *qcam = (struct qcam_device *)v; 876 + struct qcam *qcam = video_drvdata(file); 807 877 int len; 808 878 parport_claim_or_block(qcam->pdev); 809 879 ··· 858 858 return len; 859 859 } 860 860 861 - static int qcam_exclusive_open(struct file *file) 862 - { 863 - struct video_device *dev = video_devdata(file); 864 - struct qcam_device *qcam = (struct qcam_device *)dev; 865 - 866 - return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0; 867 - } 868 - 869 - static int qcam_exclusive_release(struct file *file) 870 - { 871 - struct video_device *dev = video_devdata(file); 872 - struct qcam_device *qcam = (struct qcam_device *)dev; 873 - 874 - clear_bit(0, &qcam->in_use); 875 - return 0; 876 - } 877 - 878 861 static const struct v4l2_file_operations qcam_fops = { 879 862 .owner = THIS_MODULE, 880 - .open = qcam_exclusive_open, 881 - .release = qcam_exclusive_release, 882 - .ioctl = qcam_ioctl, 863 + .ioctl = video_ioctl2, 883 864 .read = qcam_read, 884 865 }; 885 - static struct video_device qcam_template = { 886 - .name = "Connectix Quickcam", 887 - .fops = &qcam_fops, 888 - .release = video_device_release_empty, 866 + 867 + static const struct v4l2_ioctl_ops qcam_ioctl_ops = { 868 + .vidioc_querycap = qcam_querycap, 869 + .vidioc_g_input = qcam_g_input, 870 + .vidioc_s_input = qcam_s_input, 871 + .vidioc_enum_input = qcam_enum_input, 872 + .vidioc_queryctrl = qcam_queryctrl, 873 + .vidioc_g_ctrl = qcam_g_ctrl, 874 + .vidioc_s_ctrl = qcam_s_ctrl, 875 + .vidioc_enum_fmt_vid_cap = qcam_enum_fmt_vid_cap, 876 + .vidioc_g_fmt_vid_cap = qcam_g_fmt_vid_cap, 877 + .vidioc_s_fmt_vid_cap = qcam_s_fmt_vid_cap, 878 + .vidioc_try_fmt_vid_cap = qcam_try_fmt_vid_cap, 889 879 }; 890 880 891 - #define MAX_CAMS 4 892 - static struct qcam_device *qcams[MAX_CAMS]; 893 - static unsigned int num_cams; 881 + /* Initialize the QuickCam driver control structure. This is where 882 + * defaults are set for people who don't have a config file.*/ 883 + 884 + static struct qcam *qcam_init(struct parport *port) 885 + { 886 + struct qcam *qcam; 887 + struct v4l2_device *v4l2_dev; 888 + 889 + qcam = kzalloc(sizeof(struct qcam), GFP_KERNEL); 890 + if (qcam == NULL) 891 + return NULL; 892 + 893 + v4l2_dev = &qcam->v4l2_dev; 894 + strlcpy(v4l2_dev->name, "bw-qcam", sizeof(v4l2_dev->name)); 895 + 896 + if (v4l2_device_register(NULL, v4l2_dev) < 0) { 897 + v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); 898 + return NULL; 899 + } 900 + 901 + qcam->pport = port; 902 + qcam->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, 903 + NULL, 0, NULL); 904 + if (qcam->pdev == NULL) { 905 + v4l2_err(v4l2_dev, "couldn't register for %s.\n", port->name); 906 + kfree(qcam); 907 + return NULL; 908 + } 909 + 910 + strlcpy(qcam->vdev.name, "Connectix QuickCam", sizeof(qcam->vdev.name)); 911 + qcam->vdev.v4l2_dev = v4l2_dev; 912 + qcam->vdev.fops = &qcam_fops; 913 + qcam->vdev.ioctl_ops = &qcam_ioctl_ops; 914 + qcam->vdev.release = video_device_release_empty; 915 + video_set_drvdata(&qcam->vdev, qcam); 916 + 917 + mutex_init(&qcam->lock); 918 + 919 + qcam->port_mode = (QC_ANY | QC_NOTSET); 920 + qcam->width = 320; 921 + qcam->height = 240; 922 + qcam->bpp = 4; 923 + qcam->transfer_scale = 2; 924 + qcam->contrast = 192; 925 + qcam->brightness = 180; 926 + qcam->whitebal = 105; 927 + qcam->top = 1; 928 + qcam->left = 14; 929 + qcam->mode = -1; 930 + qcam->status = QC_PARAM_CHANGE; 931 + return qcam; 932 + } 933 + 934 + static int qc_calibrate(struct qcam *q) 935 + { 936 + /* 937 + * Bugfix by Hanno Mueller hmueller@kabel.de, Mai 21 96 938 + * The white balance is an individual value for each 939 + * quickcam. 940 + */ 941 + 942 + int value; 943 + int count = 0; 944 + 945 + qc_command(q, 27); /* AutoAdjustOffset */ 946 + qc_command(q, 0); /* Dummy Parameter, ignored by the camera */ 947 + 948 + /* GetOffset (33) will read 255 until autocalibration */ 949 + /* is finished. After that, a value of 1-254 will be */ 950 + /* returned. */ 951 + 952 + do { 953 + qc_command(q, 33); 954 + value = qc_readparam(q); 955 + mdelay(1); 956 + schedule(); 957 + count++; 958 + } while (value == 0xff && count < 2048); 959 + 960 + q->whitebal = value; 961 + return value; 962 + } 894 963 895 964 static int init_bwqcam(struct parport *port) 896 965 { 897 - struct qcam_device *qcam; 966 + struct qcam *qcam; 898 967 899 968 if (num_cams == MAX_CAMS) { 900 969 printk(KERN_ERR "Too many Quickcams (max %d)\n", MAX_CAMS); ··· 988 919 989 920 parport_release(qcam->pdev); 990 921 991 - printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name); 922 + v4l2_info(&qcam->v4l2_dev, "Connectix Quickcam on %s\n", qcam->pport->name); 992 923 993 924 if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) { 994 925 parport_unregister_device(qcam->pdev); ··· 1001 932 return 0; 1002 933 } 1003 934 1004 - static void close_bwqcam(struct qcam_device *qcam) 935 + static void close_bwqcam(struct qcam *qcam) 1005 936 { 1006 937 video_unregister_device(&qcam->vdev); 1007 938 parport_unregister_device(qcam->pdev); ··· 1052 983 { 1053 984 int i; 1054 985 for (i = 0; i < num_cams; i++) { 1055 - struct qcam_device *qcam = qcams[i]; 986 + struct qcam *qcam = qcams[i]; 1056 987 if (qcam && qcam->pdev->port == port) { 1057 988 qcams[i] = NULL; 1058 989 close_bwqcam(qcam);
-69
drivers/media/video/bw-qcam.h
··· 1 - /* 2 - * Video4Linux bw-qcam driver 3 - * 4 - * Derived from code.. 5 - */ 6 - 7 - /****************************************************************** 8 - 9 - Copyright (C) 1996 by Scott Laird 10 - 11 - Permission is hereby granted, free of charge, to any person obtaining 12 - a copy of this software and associated documentation files (the 13 - "Software"), to deal in the Software without restriction, including 14 - without limitation the rights to use, copy, modify, merge, publish, 15 - distribute, sublicense, and/or sell copies of the Software, and to 16 - permit persons to whom the Software is furnished to do so, subject to 17 - the following conditions: 18 - 19 - The above copyright notice and this permission notice shall be 20 - included in all copies or substantial portions of the Software. 21 - 22 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 25 - IN NO EVENT SHALL SCOTT LAIRD BE LIABLE FOR ANY CLAIM, DAMAGES OR 26 - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 27 - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 - OTHER DEALINGS IN THE SOFTWARE. 29 - 30 - ******************************************************************/ 31 - 32 - /* One from column A... */ 33 - #define QC_NOTSET 0 34 - #define QC_UNIDIR 1 35 - #define QC_BIDIR 2 36 - #define QC_SERIAL 3 37 - 38 - /* ... and one from column B */ 39 - #define QC_ANY 0x00 40 - #define QC_FORCE_UNIDIR 0x10 41 - #define QC_FORCE_BIDIR 0x20 42 - #define QC_FORCE_SERIAL 0x30 43 - /* in the port_mode member */ 44 - 45 - #define QC_MODE_MASK 0x07 46 - #define QC_FORCE_MASK 0x70 47 - 48 - #define MAX_HEIGHT 243 49 - #define MAX_WIDTH 336 50 - 51 - /* Bit fields for status flags */ 52 - #define QC_PARAM_CHANGE 0x01 /* Camera status change has occurred */ 53 - 54 - struct qcam_device { 55 - struct video_device vdev; 56 - struct pardevice *pdev; 57 - struct parport *pport; 58 - struct mutex lock; 59 - int width, height; 60 - int bpp; 61 - int mode; 62 - int contrast, brightness, whitebal; 63 - int port_mode; 64 - int transfer_scale; 65 - int top, left; 66 - int status; 67 - unsigned int saved_bits; 68 - unsigned long in_use; 69 - };
+344 -318
drivers/media/video/c-qcam.c
··· 33 33 #include <linux/mm.h> 34 34 #include <linux/parport.h> 35 35 #include <linux/sched.h> 36 - #include <linux/videodev.h> 37 - #include <media/v4l2-common.h> 38 - #include <media/v4l2-ioctl.h> 39 36 #include <linux/mutex.h> 40 37 #include <linux/jiffies.h> 41 - 38 + #include <linux/version.h> 39 + #include <linux/videodev2.h> 42 40 #include <asm/uaccess.h> 41 + #include <media/v4l2-device.h> 42 + #include <media/v4l2-common.h> 43 + #include <media/v4l2-ioctl.h> 43 44 44 - struct qcam_device { 45 + struct qcam { 46 + struct v4l2_device v4l2_dev; 45 47 struct video_device vdev; 46 48 struct pardevice *pdev; 47 49 struct parport *pport; ··· 53 51 int contrast, brightness, whitebal; 54 52 int top, left; 55 53 unsigned int bidirectional; 56 - unsigned long in_use; 57 54 struct mutex lock; 58 55 }; 59 56 ··· 69 68 #define QC_DECIMATION_2 2 70 69 #define QC_DECIMATION_4 4 71 70 72 - #define BANNER "Colour QuickCam for Video4Linux v0.05" 71 + #define BANNER "Colour QuickCam for Video4Linux v0.06" 73 72 74 73 static int parport[MAX_CAMS] = { [1 ... MAX_CAMS-1] = -1 }; 75 74 static int probe = 2; 76 75 static int force_rgb; 77 76 static int video_nr = -1; 78 77 79 - static inline void qcam_set_ack(struct qcam_device *qcam, unsigned int i) 78 + /* FIXME: parport=auto would never have worked, surely? --RR */ 79 + MODULE_PARM_DESC(parport, "parport=<auto|n[,n]...> for port detection method\n" 80 + "probe=<0|1|2> for camera detection method\n" 81 + "force_rgb=<0|1> for RGB data format (default BGR)"); 82 + module_param_array(parport, int, NULL, 0); 83 + module_param(probe, int, 0); 84 + module_param(force_rgb, bool, 0); 85 + module_param(video_nr, int, 0); 86 + 87 + static struct qcam *qcams[MAX_CAMS]; 88 + static unsigned int num_cams; 89 + 90 + static inline void qcam_set_ack(struct qcam *qcam, unsigned int i) 80 91 { 81 92 /* note: the QC specs refer to the PCAck pin by voltage, not 82 93 software level. PC ports have builtin inverters. */ 83 94 parport_frob_control(qcam->pport, 8, i ? 8 : 0); 84 95 } 85 96 86 - static inline unsigned int qcam_ready1(struct qcam_device *qcam) 97 + static inline unsigned int qcam_ready1(struct qcam *qcam) 87 98 { 88 99 return (parport_read_status(qcam->pport) & 0x8) ? 1 : 0; 89 100 } 90 101 91 - static inline unsigned int qcam_ready2(struct qcam_device *qcam) 102 + static inline unsigned int qcam_ready2(struct qcam *qcam) 92 103 { 93 104 return (parport_read_data(qcam->pport) & 0x1) ? 1 : 0; 94 105 } 95 106 96 - static unsigned int qcam_await_ready1(struct qcam_device *qcam, 97 - int value) 107 + static unsigned int qcam_await_ready1(struct qcam *qcam, int value) 98 108 { 109 + struct v4l2_device *v4l2_dev = &qcam->v4l2_dev; 99 110 unsigned long oldjiffies = jiffies; 100 111 unsigned int i; 101 112 ··· 125 112 } 126 113 127 114 /* Probably somebody pulled the plug out. Not much we can do. */ 128 - printk(KERN_ERR "c-qcam: ready1 timeout (%d) %x %x\n", value, 115 + v4l2_err(v4l2_dev, "ready1 timeout (%d) %x %x\n", value, 129 116 parport_read_status(qcam->pport), 130 117 parport_read_control(qcam->pport)); 131 118 return 1; 132 119 } 133 120 134 - static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value) 121 + static unsigned int qcam_await_ready2(struct qcam *qcam, int value) 135 122 { 123 + struct v4l2_device *v4l2_dev = &qcam->v4l2_dev; 136 124 unsigned long oldjiffies = jiffies; 137 125 unsigned int i; 138 126 ··· 151 137 } 152 138 153 139 /* Probably somebody pulled the plug out. Not much we can do. */ 154 - printk(KERN_ERR "c-qcam: ready2 timeout (%d) %x %x %x\n", value, 140 + v4l2_err(v4l2_dev, "ready2 timeout (%d) %x %x %x\n", value, 155 141 parport_read_status(qcam->pport), 156 142 parport_read_control(qcam->pport), 157 143 parport_read_data(qcam->pport)); 158 144 return 1; 159 145 } 160 146 161 - static int qcam_read_data(struct qcam_device *qcam) 147 + static int qcam_read_data(struct qcam *qcam) 162 148 { 163 149 unsigned int idata; 164 150 ··· 173 159 return idata; 174 160 } 175 161 176 - static int qcam_write_data(struct qcam_device *qcam, unsigned int data) 162 + static int qcam_write_data(struct qcam *qcam, unsigned int data) 177 163 { 164 + struct v4l2_device *v4l2_dev = &qcam->v4l2_dev; 178 165 unsigned int idata; 179 166 180 167 parport_write_data(qcam->pport, data); 181 168 idata = qcam_read_data(qcam); 182 169 if (data != idata) { 183 - printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, 170 + v4l2_warn(v4l2_dev, "sent %x but received %x\n", data, 184 171 idata); 185 172 return 1; 186 173 } 187 174 return 0; 188 175 } 189 176 190 - static inline int qcam_set(struct qcam_device *qcam, unsigned int cmd, unsigned int data) 177 + static inline int qcam_set(struct qcam *qcam, unsigned int cmd, unsigned int data) 191 178 { 192 179 if (qcam_write_data(qcam, cmd)) 193 180 return -1; ··· 197 182 return 0; 198 183 } 199 184 200 - static inline int qcam_get(struct qcam_device *qcam, unsigned int cmd) 185 + static inline int qcam_get(struct qcam *qcam, unsigned int cmd) 201 186 { 202 187 if (qcam_write_data(qcam, cmd)) 203 188 return -1; 204 189 return qcam_read_data(qcam); 205 190 } 206 191 207 - static int qc_detect(struct qcam_device *qcam) 192 + static int qc_detect(struct qcam *qcam) 208 193 { 209 194 unsigned int stat, ostat, i, count = 0; 210 195 ··· 261 246 return 0; 262 247 } 263 248 264 - static void qc_reset(struct qcam_device *qcam) 249 + static void qc_reset(struct qcam *qcam) 265 250 { 266 251 parport_write_control(qcam->pport, 0xc); 267 252 parport_write_control(qcam->pport, 0x8); ··· 273 258 /* Reset the QuickCam and program for brightness, contrast, 274 259 * white-balance, and resolution. */ 275 260 276 - static void qc_setup(struct qcam_device *q) 261 + static void qc_setup(struct qcam *qcam) 277 262 { 278 - qc_reset(q); 263 + qc_reset(qcam); 279 264 280 265 /* Set the brightness. */ 281 - qcam_set(q, 11, q->brightness); 266 + qcam_set(qcam, 11, qcam->brightness); 282 267 283 268 /* Set the height and width. These refer to the actual 284 269 CCD area *before* applying the selected decimation. */ 285 - qcam_set(q, 17, q->ccd_height); 286 - qcam_set(q, 19, q->ccd_width / 2); 270 + qcam_set(qcam, 17, qcam->ccd_height); 271 + qcam_set(qcam, 19, qcam->ccd_width / 2); 287 272 288 273 /* Set top and left. */ 289 - qcam_set(q, 0xd, q->top); 290 - qcam_set(q, 0xf, q->left); 274 + qcam_set(qcam, 0xd, qcam->top); 275 + qcam_set(qcam, 0xf, qcam->left); 291 276 292 277 /* Set contrast and white balance. */ 293 - qcam_set(q, 0x19, q->contrast); 294 - qcam_set(q, 0x1f, q->whitebal); 278 + qcam_set(qcam, 0x19, qcam->contrast); 279 + qcam_set(qcam, 0x1f, qcam->whitebal); 295 280 296 281 /* Set the speed. */ 297 - qcam_set(q, 45, 2); 282 + qcam_set(qcam, 45, 2); 298 283 } 299 284 300 285 /* Read some bytes from the camera and put them in the buffer. 301 286 nbytes should be a multiple of 3, because bidirectional mode gives 302 287 us three bytes at a time. */ 303 288 304 - static unsigned int qcam_read_bytes(struct qcam_device *q, unsigned char *buf, unsigned int nbytes) 289 + static unsigned int qcam_read_bytes(struct qcam *qcam, unsigned char *buf, unsigned int nbytes) 305 290 { 306 291 unsigned int bytes = 0; 307 292 308 - qcam_set_ack(q, 0); 309 - if (q->bidirectional) { 293 + qcam_set_ack(qcam, 0); 294 + if (qcam->bidirectional) { 310 295 /* It's a bidirectional port */ 311 296 while (bytes < nbytes) { 312 297 unsigned int lo1, hi1, lo2, hi2; 313 298 unsigned char r, g, b; 314 299 315 - if (qcam_await_ready2(q, 1)) 300 + if (qcam_await_ready2(qcam, 1)) 316 301 return bytes; 317 - lo1 = parport_read_data(q->pport) >> 1; 318 - hi1 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10; 319 - qcam_set_ack(q, 1); 320 - if (qcam_await_ready2(q, 0)) 302 + lo1 = parport_read_data(qcam->pport) >> 1; 303 + hi1 = ((parport_read_status(qcam->pport) >> 3) & 0x1f) ^ 0x10; 304 + qcam_set_ack(qcam, 1); 305 + if (qcam_await_ready2(qcam, 0)) 321 306 return bytes; 322 - lo2 = parport_read_data(q->pport) >> 1; 323 - hi2 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10; 324 - qcam_set_ack(q, 0); 307 + lo2 = parport_read_data(qcam->pport) >> 1; 308 + hi2 = ((parport_read_status(qcam->pport) >> 3) & 0x1f) ^ 0x10; 309 + qcam_set_ack(qcam, 0); 325 310 r = lo1 | ((hi1 & 1) << 7); 326 311 g = ((hi1 & 0x1e) << 3) | ((hi2 & 0x1e) >> 1); 327 312 b = lo2 | ((hi2 & 1) << 7); ··· 343 328 while (bytes < nbytes) { 344 329 unsigned int hi, lo; 345 330 346 - if (qcam_await_ready1(q, 1)) 331 + if (qcam_await_ready1(qcam, 1)) 347 332 return bytes; 348 - hi = (parport_read_status(q->pport) & 0xf0); 349 - qcam_set_ack(q, 1); 350 - if (qcam_await_ready1(q, 0)) 333 + hi = (parport_read_status(qcam->pport) & 0xf0); 334 + qcam_set_ack(qcam, 1); 335 + if (qcam_await_ready1(qcam, 0)) 351 336 return bytes; 352 - lo = (parport_read_status(q->pport) & 0xf0); 353 - qcam_set_ack(q, 0); 337 + lo = (parport_read_status(qcam->pport) & 0xf0); 338 + qcam_set_ack(qcam, 0); 354 339 /* flip some bits */ 355 340 rgb[(i = bytes++ % 3)] = (hi | (lo >> 4)) ^ 0x88; 356 341 if (i >= 2) { ··· 376 361 377 362 #define BUFSZ 150 378 363 379 - static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long len) 364 + static long qc_capture(struct qcam *qcam, char __user *buf, unsigned long len) 380 365 { 366 + struct v4l2_device *v4l2_dev = &qcam->v4l2_dev; 381 367 unsigned lines, pixelsperline, bitsperxfer; 382 - unsigned int is_bi_dir = q->bidirectional; 368 + unsigned int is_bi_dir = qcam->bidirectional; 383 369 size_t wantlen, outptr = 0; 384 370 char tmpbuf[BUFSZ]; 385 371 ··· 389 373 390 374 /* Wait for camera to become ready */ 391 375 for (;;) { 392 - int i = qcam_get(q, 41); 376 + int i = qcam_get(qcam, 41); 393 377 394 378 if (i == -1) { 395 - qc_setup(q); 379 + qc_setup(qcam); 396 380 return -EIO; 397 381 } 398 382 if ((i & 0x80) == 0) ··· 400 384 schedule(); 401 385 } 402 386 403 - if (qcam_set(q, 7, (q->mode | (is_bi_dir ? 1 : 0)) + 1)) 387 + if (qcam_set(qcam, 7, (qcam->mode | (is_bi_dir ? 1 : 0)) + 1)) 404 388 return -EIO; 405 389 406 - lines = q->height; 407 - pixelsperline = q->width; 390 + lines = qcam->height; 391 + pixelsperline = qcam->width; 408 392 bitsperxfer = (is_bi_dir) ? 24 : 8; 409 393 410 394 if (is_bi_dir) { 411 395 /* Turn the port around */ 412 - parport_data_reverse(q->pport); 396 + parport_data_reverse(qcam->pport); 413 397 mdelay(3); 414 - qcam_set_ack(q, 0); 415 - if (qcam_await_ready1(q, 1)) { 416 - qc_setup(q); 398 + qcam_set_ack(qcam, 0); 399 + if (qcam_await_ready1(qcam, 1)) { 400 + qc_setup(qcam); 417 401 return -EIO; 418 402 } 419 - qcam_set_ack(q, 1); 420 - if (qcam_await_ready1(q, 0)) { 421 - qc_setup(q); 403 + qcam_set_ack(qcam, 1); 404 + if (qcam_await_ready1(qcam, 0)) { 405 + qc_setup(qcam); 422 406 return -EIO; 423 407 } 424 408 } ··· 429 413 size_t t, s; 430 414 431 415 s = (wantlen > BUFSZ) ? BUFSZ : wantlen; 432 - t = qcam_read_bytes(q, tmpbuf, s); 416 + t = qcam_read_bytes(qcam, tmpbuf, s); 433 417 if (outptr < len) { 434 418 size_t sz = len - outptr; 435 419 ··· 448 432 len = outptr; 449 433 450 434 if (wantlen) { 451 - printk(KERN_ERR "qcam: short read.\n"); 435 + v4l2_err(v4l2_dev, "short read.\n"); 452 436 if (is_bi_dir) 453 - parport_data_forward(q->pport); 454 - qc_setup(q); 437 + parport_data_forward(qcam->pport); 438 + qc_setup(qcam); 455 439 return len; 456 440 } 457 441 ··· 459 443 int l; 460 444 461 445 do { 462 - l = qcam_read_bytes(q, tmpbuf, 3); 446 + l = qcam_read_bytes(qcam, tmpbuf, 3); 463 447 cond_resched(); 464 448 } while (l && (tmpbuf[0] == 0x7e || tmpbuf[1] == 0x7e || tmpbuf[2] == 0x7e)); 465 449 if (force_rgb) { 466 450 if (tmpbuf[0] != 0xe || tmpbuf[1] != 0x0 || tmpbuf[2] != 0xf) 467 - printk(KERN_ERR "qcam: bad EOF\n"); 451 + v4l2_err(v4l2_dev, "bad EOF\n"); 468 452 } else { 469 453 if (tmpbuf[0] != 0xf || tmpbuf[1] != 0x0 || tmpbuf[2] != 0xe) 470 - printk(KERN_ERR "qcam: bad EOF\n"); 454 + v4l2_err(v4l2_dev, "bad EOF\n"); 471 455 } 472 - qcam_set_ack(q, 0); 473 - if (qcam_await_ready1(q, 1)) { 474 - printk(KERN_ERR "qcam: no ack after EOF\n"); 475 - parport_data_forward(q->pport); 476 - qc_setup(q); 456 + qcam_set_ack(qcam, 0); 457 + if (qcam_await_ready1(qcam, 1)) { 458 + v4l2_err(v4l2_dev, "no ack after EOF\n"); 459 + parport_data_forward(qcam->pport); 460 + qc_setup(qcam); 477 461 return len; 478 462 } 479 - parport_data_forward(q->pport); 463 + parport_data_forward(qcam->pport); 480 464 mdelay(3); 481 - qcam_set_ack(q, 1); 482 - if (qcam_await_ready1(q, 0)) { 483 - printk(KERN_ERR "qcam: no ack to port turnaround\n"); 484 - qc_setup(q); 465 + qcam_set_ack(qcam, 1); 466 + if (qcam_await_ready1(qcam, 0)) { 467 + v4l2_err(v4l2_dev, "no ack to port turnaround\n"); 468 + qc_setup(qcam); 485 469 return len; 486 470 } 487 471 } else { 488 472 int l; 489 473 490 474 do { 491 - l = qcam_read_bytes(q, tmpbuf, 1); 475 + l = qcam_read_bytes(qcam, tmpbuf, 1); 492 476 cond_resched(); 493 477 } while (l && tmpbuf[0] == 0x7e); 494 - l = qcam_read_bytes(q, tmpbuf + 1, 2); 478 + l = qcam_read_bytes(qcam, tmpbuf + 1, 2); 495 479 if (force_rgb) { 496 480 if (tmpbuf[0] != 0xe || tmpbuf[1] != 0x0 || tmpbuf[2] != 0xf) 497 - printk(KERN_ERR "qcam: bad EOF\n"); 481 + v4l2_err(v4l2_dev, "bad EOF\n"); 498 482 } else { 499 483 if (tmpbuf[0] != 0xf || tmpbuf[1] != 0x0 || tmpbuf[2] != 0xe) 500 - printk(KERN_ERR "qcam: bad EOF\n"); 484 + v4l2_err(v4l2_dev, "bad EOF\n"); 501 485 } 502 486 } 503 487 504 - qcam_write_data(q, 0); 488 + qcam_write_data(qcam, 0); 505 489 return len; 506 490 } 507 491 ··· 509 493 * Video4linux interfacing 510 494 */ 511 495 512 - static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) 496 + static int qcam_querycap(struct file *file, void *priv, 497 + struct v4l2_capability *vcap) 513 498 { 514 - struct video_device *dev = video_devdata(file); 515 - struct qcam_device *qcam = (struct qcam_device *)dev; 499 + struct qcam *qcam = video_drvdata(file); 516 500 517 - switch (cmd) { 518 - case VIDIOCGCAP: 519 - { 520 - struct video_capability *b = arg; 521 - 522 - strcpy(b->name, "Quickcam"); 523 - b->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; 524 - b->channels = 1; 525 - b->audios = 0; 526 - b->maxwidth = 320; 527 - b->maxheight = 240; 528 - b->minwidth = 80; 529 - b->minheight = 60; 530 - return 0; 531 - } 532 - case VIDIOCGCHAN: 533 - { 534 - struct video_channel *v = arg; 535 - 536 - if (v->channel != 0) 537 - return -EINVAL; 538 - v->flags = 0; 539 - v->tuners = 0; 540 - /* Good question.. its composite or SVHS so.. */ 541 - v->type = VIDEO_TYPE_CAMERA; 542 - strcpy(v->name, "Camera"); 543 - return 0; 544 - } 545 - case VIDIOCSCHAN: 546 - { 547 - struct video_channel *v = arg; 548 - 549 - if (v->channel != 0) 550 - return -EINVAL; 551 - return 0; 552 - } 553 - case VIDIOCGTUNER: 554 - { 555 - struct video_tuner *v = arg; 556 - 557 - if (v->tuner) 558 - return -EINVAL; 559 - memset(v, 0, sizeof(*v)); 560 - strcpy(v->name, "Format"); 561 - v->mode = VIDEO_MODE_AUTO; 562 - return 0; 563 - } 564 - case VIDIOCSTUNER: 565 - { 566 - struct video_tuner *v = arg; 567 - 568 - if (v->tuner) 569 - return -EINVAL; 570 - if (v->mode != VIDEO_MODE_AUTO) 571 - return -EINVAL; 572 - return 0; 573 - } 574 - case VIDIOCGPICT: 575 - { 576 - struct video_picture *p = arg; 577 - 578 - p->colour = 0x8000; 579 - p->hue = 0x8000; 580 - p->brightness = qcam->brightness << 8; 581 - p->contrast = qcam->contrast << 8; 582 - p->whiteness = qcam->whitebal << 8; 583 - p->depth = 24; 584 - p->palette = VIDEO_PALETTE_RGB24; 585 - return 0; 586 - } 587 - case VIDIOCSPICT: 588 - { 589 - struct video_picture *p = arg; 590 - 591 - /* 592 - * Sanity check args 593 - */ 594 - if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24) 595 - return -EINVAL; 596 - 597 - /* 598 - * Now load the camera. 599 - */ 600 - qcam->brightness = p->brightness >> 8; 601 - qcam->contrast = p->contrast >> 8; 602 - qcam->whitebal = p->whiteness >> 8; 603 - 604 - mutex_lock(&qcam->lock); 605 - parport_claim_or_block(qcam->pdev); 606 - qc_setup(qcam); 607 - parport_release(qcam->pdev); 608 - mutex_unlock(&qcam->lock); 609 - return 0; 610 - } 611 - case VIDIOCSWIN: 612 - { 613 - struct video_window *vw = arg; 614 - 615 - if (vw->flags) 616 - return -EINVAL; 617 - if (vw->clipcount) 618 - return -EINVAL; 619 - if (vw->height < 60 || vw->height > 240) 620 - return -EINVAL; 621 - if (vw->width < 80 || vw->width > 320) 622 - return -EINVAL; 623 - 624 - qcam->width = 80; 625 - qcam->height = 60; 626 - qcam->mode = QC_DECIMATION_4; 627 - 628 - if (vw->width >= 160 && vw->height >= 120) { 629 - qcam->width = 160; 630 - qcam->height = 120; 631 - qcam->mode = QC_DECIMATION_2; 632 - } 633 - if (vw->width >= 320 && vw->height >= 240) { 634 - qcam->width = 320; 635 - qcam->height = 240; 636 - qcam->mode = QC_DECIMATION_1; 637 - } 638 - qcam->mode |= QC_MILLIONS; 639 - #if 0 640 - if (vw->width >= 640 && vw->height >= 480) { 641 - qcam->width = 640; 642 - qcam->height = 480; 643 - qcam->mode = QC_BILLIONS | QC_DECIMATION_1; 644 - } 645 - #endif 646 - /* Ok we figured out what to use from our 647 - wide choice */ 648 - mutex_lock(&qcam->lock); 649 - parport_claim_or_block(qcam->pdev); 650 - qc_setup(qcam); 651 - parport_release(qcam->pdev); 652 - mutex_unlock(&qcam->lock); 653 - return 0; 654 - } 655 - case VIDIOCGWIN: 656 - { 657 - struct video_window *vw = arg; 658 - memset(vw, 0, sizeof(*vw)); 659 - vw->width = qcam->width; 660 - vw->height = qcam->height; 661 - return 0; 662 - } 663 - case VIDIOCKEY: 664 - return 0; 665 - case VIDIOCCAPTURE: 666 - case VIDIOCGFBUF: 667 - case VIDIOCSFBUF: 668 - case VIDIOCGFREQ: 669 - case VIDIOCSFREQ: 670 - case VIDIOCGAUDIO: 671 - case VIDIOCSAUDIO: 672 - return -EINVAL; 673 - default: 674 - return -ENOIOCTLCMD; 675 - } 501 + strlcpy(vcap->driver, qcam->v4l2_dev.name, sizeof(vcap->driver)); 502 + strlcpy(vcap->card, "Color Quickcam", sizeof(vcap->card)); 503 + strlcpy(vcap->bus_info, "parport", sizeof(vcap->bus_info)); 504 + vcap->version = KERNEL_VERSION(0, 0, 3); 505 + vcap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; 676 506 return 0; 677 507 } 678 508 679 - static long qcam_ioctl(struct file *file, 680 - unsigned int cmd, unsigned long arg) 509 + static int qcam_enum_input(struct file *file, void *fh, struct v4l2_input *vin) 681 510 { 682 - return video_usercopy(file, cmd, arg, qcam_do_ioctl); 511 + if (vin->index > 0) 512 + return -EINVAL; 513 + strlcpy(vin->name, "Camera", sizeof(vin->name)); 514 + vin->type = V4L2_INPUT_TYPE_CAMERA; 515 + vin->audioset = 0; 516 + vin->tuner = 0; 517 + vin->std = 0; 518 + vin->status = 0; 519 + return 0; 520 + } 521 + 522 + static int qcam_g_input(struct file *file, void *fh, unsigned int *inp) 523 + { 524 + *inp = 0; 525 + return 0; 526 + } 527 + 528 + static int qcam_s_input(struct file *file, void *fh, unsigned int inp) 529 + { 530 + return (inp > 0) ? -EINVAL : 0; 531 + } 532 + 533 + static int qcam_queryctrl(struct file *file, void *priv, 534 + struct v4l2_queryctrl *qc) 535 + { 536 + switch (qc->id) { 537 + case V4L2_CID_BRIGHTNESS: 538 + return v4l2_ctrl_query_fill(qc, 0, 255, 1, 240); 539 + case V4L2_CID_CONTRAST: 540 + return v4l2_ctrl_query_fill(qc, 0, 255, 1, 192); 541 + case V4L2_CID_GAMMA: 542 + return v4l2_ctrl_query_fill(qc, 0, 255, 1, 128); 543 + } 544 + return -EINVAL; 545 + } 546 + 547 + static int qcam_g_ctrl(struct file *file, void *priv, 548 + struct v4l2_control *ctrl) 549 + { 550 + struct qcam *qcam = video_drvdata(file); 551 + int ret = 0; 552 + 553 + switch (ctrl->id) { 554 + case V4L2_CID_BRIGHTNESS: 555 + ctrl->value = qcam->brightness; 556 + break; 557 + case V4L2_CID_CONTRAST: 558 + ctrl->value = qcam->contrast; 559 + break; 560 + case V4L2_CID_GAMMA: 561 + ctrl->value = qcam->whitebal; 562 + break; 563 + default: 564 + ret = -EINVAL; 565 + break; 566 + } 567 + return ret; 568 + } 569 + 570 + static int qcam_s_ctrl(struct file *file, void *priv, 571 + struct v4l2_control *ctrl) 572 + { 573 + struct qcam *qcam = video_drvdata(file); 574 + int ret = 0; 575 + 576 + mutex_lock(&qcam->lock); 577 + switch (ctrl->id) { 578 + case V4L2_CID_BRIGHTNESS: 579 + qcam->brightness = ctrl->value; 580 + break; 581 + case V4L2_CID_CONTRAST: 582 + qcam->contrast = ctrl->value; 583 + break; 584 + case V4L2_CID_GAMMA: 585 + qcam->whitebal = ctrl->value; 586 + break; 587 + default: 588 + ret = -EINVAL; 589 + break; 590 + } 591 + if (ret == 0) { 592 + parport_claim_or_block(qcam->pdev); 593 + qc_setup(qcam); 594 + parport_release(qcam->pdev); 595 + } 596 + mutex_unlock(&qcam->lock); 597 + return ret; 598 + } 599 + 600 + static int qcam_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) 601 + { 602 + struct qcam *qcam = video_drvdata(file); 603 + struct v4l2_pix_format *pix = &fmt->fmt.pix; 604 + 605 + pix->width = qcam->width; 606 + pix->height = qcam->height; 607 + pix->pixelformat = V4L2_PIX_FMT_RGB24; 608 + pix->field = V4L2_FIELD_NONE; 609 + pix->bytesperline = 3 * qcam->width; 610 + pix->sizeimage = 3 * qcam->width * qcam->height; 611 + /* Just a guess */ 612 + pix->colorspace = V4L2_COLORSPACE_SRGB; 613 + return 0; 614 + } 615 + 616 + static int qcam_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) 617 + { 618 + struct v4l2_pix_format *pix = &fmt->fmt.pix; 619 + 620 + if (pix->height < 60 || pix->width < 80) { 621 + pix->height = 60; 622 + pix->width = 80; 623 + } else if (pix->height < 120 || pix->width < 160) { 624 + pix->height = 120; 625 + pix->width = 160; 626 + } else { 627 + pix->height = 240; 628 + pix->width = 320; 629 + } 630 + pix->pixelformat = V4L2_PIX_FMT_RGB24; 631 + pix->field = V4L2_FIELD_NONE; 632 + pix->bytesperline = 3 * pix->width; 633 + pix->sizeimage = 3 * pix->width * pix->height; 634 + /* Just a guess */ 635 + pix->colorspace = V4L2_COLORSPACE_SRGB; 636 + return 0; 637 + } 638 + 639 + static int qcam_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) 640 + { 641 + struct qcam *qcam = video_drvdata(file); 642 + struct v4l2_pix_format *pix = &fmt->fmt.pix; 643 + int ret = qcam_try_fmt_vid_cap(file, fh, fmt); 644 + 645 + if (ret) 646 + return ret; 647 + switch (pix->height) { 648 + case 60: 649 + qcam->mode = QC_DECIMATION_4; 650 + break; 651 + case 120: 652 + qcam->mode = QC_DECIMATION_2; 653 + break; 654 + default: 655 + qcam->mode = QC_DECIMATION_1; 656 + break; 657 + } 658 + 659 + mutex_lock(&qcam->lock); 660 + qcam->mode |= QC_MILLIONS; 661 + qcam->height = pix->height; 662 + qcam->width = pix->width; 663 + parport_claim_or_block(qcam->pdev); 664 + qc_setup(qcam); 665 + parport_release(qcam->pdev); 666 + mutex_unlock(&qcam->lock); 667 + return 0; 668 + } 669 + 670 + static int qcam_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) 671 + { 672 + static struct v4l2_fmtdesc formats[] = { 673 + { 0, 0, 0, 674 + "RGB 8:8:8", V4L2_PIX_FMT_RGB24, 675 + { 0, 0, 0, 0 } 676 + }, 677 + }; 678 + enum v4l2_buf_type type = fmt->type; 679 + 680 + if (fmt->index > 0) 681 + return -EINVAL; 682 + 683 + *fmt = formats[fmt->index]; 684 + fmt->type = type; 685 + return 0; 683 686 } 684 687 685 688 static ssize_t qcam_read(struct file *file, char __user *buf, 686 689 size_t count, loff_t *ppos) 687 690 { 688 - struct video_device *v = video_devdata(file); 689 - struct qcam_device *qcam = (struct qcam_device *)v; 691 + struct qcam *qcam = video_drvdata(file); 690 692 int len; 691 693 692 694 mutex_lock(&qcam->lock); ··· 716 682 return len; 717 683 } 718 684 719 - static int qcam_exclusive_open(struct file *file) 720 - { 721 - struct video_device *dev = video_devdata(file); 722 - struct qcam_device *qcam = (struct qcam_device *)dev; 723 - 724 - return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0; 725 - } 726 - 727 - static int qcam_exclusive_release(struct file *file) 728 - { 729 - struct video_device *dev = video_devdata(file); 730 - struct qcam_device *qcam = (struct qcam_device *)dev; 731 - 732 - clear_bit(0, &qcam->in_use); 733 - return 0; 734 - } 735 - 736 - /* video device template */ 737 685 static const struct v4l2_file_operations qcam_fops = { 738 686 .owner = THIS_MODULE, 739 - .open = qcam_exclusive_open, 740 - .release = qcam_exclusive_release, 741 - .ioctl = qcam_ioctl, 687 + .ioctl = video_ioctl2, 742 688 .read = qcam_read, 743 689 }; 744 690 745 - static struct video_device qcam_template = { 746 - .name = "Colour QuickCam", 747 - .fops = &qcam_fops, 748 - .release = video_device_release_empty, 691 + static const struct v4l2_ioctl_ops qcam_ioctl_ops = { 692 + .vidioc_querycap = qcam_querycap, 693 + .vidioc_g_input = qcam_g_input, 694 + .vidioc_s_input = qcam_s_input, 695 + .vidioc_enum_input = qcam_enum_input, 696 + .vidioc_queryctrl = qcam_queryctrl, 697 + .vidioc_g_ctrl = qcam_g_ctrl, 698 + .vidioc_s_ctrl = qcam_s_ctrl, 699 + .vidioc_enum_fmt_vid_cap = qcam_enum_fmt_vid_cap, 700 + .vidioc_g_fmt_vid_cap = qcam_g_fmt_vid_cap, 701 + .vidioc_s_fmt_vid_cap = qcam_s_fmt_vid_cap, 702 + .vidioc_try_fmt_vid_cap = qcam_try_fmt_vid_cap, 749 703 }; 750 704 751 705 /* Initialize the QuickCam driver control structure. */ 752 706 753 - static struct qcam_device *qcam_init(struct parport *port) 707 + static struct qcam *qcam_init(struct parport *port) 754 708 { 755 - struct qcam_device *q; 709 + struct qcam *qcam; 710 + struct v4l2_device *v4l2_dev; 756 711 757 - q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); 758 - if (q == NULL) 712 + qcam = kzalloc(sizeof(*qcam), GFP_KERNEL); 713 + if (qcam == NULL) 759 714 return NULL; 760 715 761 - q->pport = port; 762 - q->pdev = parport_register_device(port, "c-qcam", NULL, NULL, 763 - NULL, 0, NULL); 716 + v4l2_dev = &qcam->v4l2_dev; 717 + strlcpy(v4l2_dev->name, "c-qcam", sizeof(v4l2_dev->name)); 764 718 765 - q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE) ? 1 : 0; 766 - 767 - if (q->pdev == NULL) { 768 - printk(KERN_ERR "c-qcam: couldn't register for %s.\n", 769 - port->name); 770 - kfree(q); 719 + if (v4l2_device_register(NULL, v4l2_dev) < 0) { 720 + v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); 771 721 return NULL; 772 722 } 773 723 774 - memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); 724 + qcam->pport = port; 725 + qcam->pdev = parport_register_device(port, "c-qcam", NULL, NULL, 726 + NULL, 0, NULL); 775 727 776 - mutex_init(&q->lock); 777 - q->width = q->ccd_width = 320; 778 - q->height = q->ccd_height = 240; 779 - q->mode = QC_MILLIONS | QC_DECIMATION_1; 780 - q->contrast = 192; 781 - q->brightness = 240; 782 - q->whitebal = 128; 783 - q->top = 1; 784 - q->left = 14; 785 - return q; 728 + qcam->bidirectional = (qcam->pport->modes & PARPORT_MODE_TRISTATE) ? 1 : 0; 729 + 730 + if (qcam->pdev == NULL) { 731 + v4l2_err(v4l2_dev, "couldn't register for %s.\n", port->name); 732 + kfree(qcam); 733 + return NULL; 734 + } 735 + 736 + strlcpy(qcam->vdev.name, "Colour QuickCam", sizeof(qcam->vdev.name)); 737 + qcam->vdev.v4l2_dev = v4l2_dev; 738 + qcam->vdev.fops = &qcam_fops; 739 + qcam->vdev.ioctl_ops = &qcam_ioctl_ops; 740 + qcam->vdev.release = video_device_release_empty; 741 + video_set_drvdata(&qcam->vdev, qcam); 742 + 743 + mutex_init(&qcam->lock); 744 + qcam->width = qcam->ccd_width = 320; 745 + qcam->height = qcam->ccd_height = 240; 746 + qcam->mode = QC_MILLIONS | QC_DECIMATION_1; 747 + qcam->contrast = 192; 748 + qcam->brightness = 240; 749 + qcam->whitebal = 128; 750 + qcam->top = 1; 751 + qcam->left = 14; 752 + return qcam; 786 753 } 787 - 788 - static struct qcam_device *qcams[MAX_CAMS]; 789 - static unsigned int num_cams; 790 754 791 755 static int init_cqcam(struct parport *port) 792 756 { 793 - struct qcam_device *qcam; 757 + struct qcam *qcam; 758 + struct v4l2_device *v4l2_dev; 794 759 795 760 if (parport[0] != -1) { 796 761 /* The user gave specific instructions */ ··· 810 777 if (qcam == NULL) 811 778 return -ENODEV; 812 779 780 + v4l2_dev = &qcam->v4l2_dev; 781 + 813 782 parport_claim_or_block(qcam->pdev); 814 783 815 784 qc_reset(qcam); ··· 828 793 parport_release(qcam->pdev); 829 794 830 795 if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) { 831 - printk(KERN_ERR "Unable to register Colour QuickCam on %s\n", 796 + v4l2_err(v4l2_dev, "Unable to register Colour QuickCam on %s\n", 832 797 qcam->pport->name); 833 798 parport_unregister_device(qcam->pdev); 834 799 kfree(qcam); 835 800 return -ENODEV; 836 801 } 837 802 838 - printk(KERN_INFO "%s: Colour QuickCam found on %s\n", 803 + v4l2_info(v4l2_dev, "%s: Colour QuickCam found on %s\n", 839 804 video_device_node_name(&qcam->vdev), qcam->pport->name); 840 805 841 806 qcams[num_cams++] = qcam; ··· 843 808 return 0; 844 809 } 845 810 846 - static void close_cqcam(struct qcam_device *qcam) 811 + static void close_cqcam(struct qcam *qcam) 847 812 { 848 813 video_unregister_device(&qcam->vdev); 849 814 parport_unregister_device(qcam->pdev); ··· 868 833 869 834 static int __init cqcam_init(void) 870 835 { 871 - printk(BANNER "\n"); 836 + printk(KERN_INFO BANNER "\n"); 872 837 873 838 return parport_register_driver(&cqcam_driver); 874 839 } ··· 886 851 MODULE_AUTHOR("Philip Blundell <philb@gnu.org>"); 887 852 MODULE_DESCRIPTION(BANNER); 888 853 MODULE_LICENSE("GPL"); 889 - 890 - /* FIXME: parport=auto would never have worked, surely? --RR */ 891 - MODULE_PARM_DESC(parport, "parport=<auto|n[,n]...> for port detection method\n" 892 - "probe=<0|1|2> for camera detection method\n" 893 - "force_rgb=<0|1> for RGB data format (default BGR)"); 894 - module_param_array(parport, int, NULL, 0); 895 - module_param(probe, int, 0); 896 - module_param(force_rgb, bool, 0); 897 - module_param(video_nr, int, 0); 898 854 899 855 module_init(cqcam_init); 900 856 module_exit(cqcam_cleanup);
+1 -1
drivers/media/video/cx18/cx18-alsa-main.c
··· 1 1 /* 2 2 * ALSA interface to cx18 PCM capture streams 3 3 * 4 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 4 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 5 5 * Copyright (C) 2009 Devin Heitmueller <dheitmueller@kernellabs.com> 6 6 * 7 7 * Portions of this work were sponsored by ONELAN Limited.
+1 -1
drivers/media/video/cx18/cx18-alsa-mixer.c
··· 2 2 * ALSA mixer controls for the 3 3 * ALSA interface to cx18 PCM capture streams 4 4 * 5 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-alsa-mixer.h
··· 2 2 * ALSA mixer controls for the 3 3 * ALSA interface to cx18 PCM capture streams 4 4 * 5 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-alsa-pcm.c
··· 2 2 * ALSA PCM device for the 3 3 * ALSA interface to cx18 PCM capture streams 4 4 * 5 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 6 6 * Copyright (C) 2009 Devin Heitmueller <dheitmueller@kernellabs.com> 7 7 * 8 8 * Portions of this work were sponsored by ONELAN Limited.
+1 -1
drivers/media/video/cx18/cx18-alsa-pcm.h
··· 2 2 * ALSA PCM device for the 3 3 * ALSA interface to cx18 PCM capture streams 4 4 * 5 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-alsa.h
··· 1 1 /* 2 2 * ALSA interface to cx18 PCM capture streams 3 3 * 4 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 4 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-av-audio.c
··· 4 4 * Derived from cx25840-audio.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or 10 10 * modify it under the terms of the GNU General Public License
+62 -75
drivers/media/video/cx18/cx18-av-core.c
··· 4 4 * Derived from cx25840-core.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or 10 10 * modify it under the terms of the GNU General Public License ··· 1021 1021 return -EINVAL; 1022 1022 } 1023 1023 1024 - static int cx18_av_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 1025 - { 1026 - if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) 1027 - return -EINVAL; 1028 - return cx18_av_g_sliced_fmt(sd, &fmt->fmt.sliced); 1029 - } 1030 - 1031 - static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 1024 + static int cx18_av_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 1032 1025 { 1033 1026 struct cx18_av_state *state = to_cx18_av_state(sd); 1034 1027 struct cx18 *cx = v4l2_get_subdevdata(sd); 1035 - 1036 - struct v4l2_pix_format *pix; 1037 1028 int HSC, VSC, Vsrc, Hsrc, filter, Vlines; 1038 1029 int is_50Hz = !(state->std & V4L2_STD_525_60); 1039 1030 1040 - switch (fmt->type) { 1041 - case V4L2_BUF_TYPE_VIDEO_CAPTURE: 1042 - pix = &(fmt->fmt.pix); 1043 - 1044 - Vsrc = (cx18_av_read(cx, 0x476) & 0x3f) << 4; 1045 - Vsrc |= (cx18_av_read(cx, 0x475) & 0xf0) >> 4; 1046 - 1047 - Hsrc = (cx18_av_read(cx, 0x472) & 0x3f) << 4; 1048 - Hsrc |= (cx18_av_read(cx, 0x471) & 0xf0) >> 4; 1049 - 1050 - /* 1051 - * This adjustment reflects the excess of vactive, set in 1052 - * cx18_av_std_setup(), above standard values: 1053 - * 1054 - * 480 + 1 for 60 Hz systems 1055 - * 576 + 3 for 50 Hz systems 1056 - */ 1057 - Vlines = pix->height + (is_50Hz ? 3 : 1); 1058 - 1059 - /* 1060 - * Invalid height and width scaling requests are: 1061 - * 1. width less than 1/16 of the source width 1062 - * 2. width greater than the source width 1063 - * 3. height less than 1/8 of the source height 1064 - * 4. height greater than the source height 1065 - */ 1066 - if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) || 1067 - (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) { 1068 - CX18_ERR_DEV(sd, "%dx%d is not a valid size!\n", 1069 - pix->width, pix->height); 1070 - return -ERANGE; 1071 - } 1072 - 1073 - HSC = (Hsrc * (1 << 20)) / pix->width - (1 << 20); 1074 - VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9)); 1075 - VSC &= 0x1fff; 1076 - 1077 - if (pix->width >= 385) 1078 - filter = 0; 1079 - else if (pix->width > 192) 1080 - filter = 1; 1081 - else if (pix->width > 96) 1082 - filter = 2; 1083 - else 1084 - filter = 3; 1085 - 1086 - CX18_DEBUG_INFO_DEV(sd, 1087 - "decoder set size %dx%d -> scale %ux%u\n", 1088 - pix->width, pix->height, HSC, VSC); 1089 - 1090 - /* HSCALE=HSC */ 1091 - cx18_av_write(cx, 0x418, HSC & 0xff); 1092 - cx18_av_write(cx, 0x419, (HSC >> 8) & 0xff); 1093 - cx18_av_write(cx, 0x41a, HSC >> 16); 1094 - /* VSCALE=VSC */ 1095 - cx18_av_write(cx, 0x41c, VSC & 0xff); 1096 - cx18_av_write(cx, 0x41d, VSC >> 8); 1097 - /* VS_INTRLACE=1 VFILT=filter */ 1098 - cx18_av_write(cx, 0x41e, 0x8 | filter); 1099 - break; 1100 - 1101 - default: 1031 + if (fmt->code != V4L2_MBUS_FMT_FIXED) 1102 1032 return -EINVAL; 1033 + 1034 + fmt->field = V4L2_FIELD_INTERLACED; 1035 + fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; 1036 + 1037 + Vsrc = (cx18_av_read(cx, 0x476) & 0x3f) << 4; 1038 + Vsrc |= (cx18_av_read(cx, 0x475) & 0xf0) >> 4; 1039 + 1040 + Hsrc = (cx18_av_read(cx, 0x472) & 0x3f) << 4; 1041 + Hsrc |= (cx18_av_read(cx, 0x471) & 0xf0) >> 4; 1042 + 1043 + /* 1044 + * This adjustment reflects the excess of vactive, set in 1045 + * cx18_av_std_setup(), above standard values: 1046 + * 1047 + * 480 + 1 for 60 Hz systems 1048 + * 576 + 3 for 50 Hz systems 1049 + */ 1050 + Vlines = fmt->height + (is_50Hz ? 3 : 1); 1051 + 1052 + /* 1053 + * Invalid height and width scaling requests are: 1054 + * 1. width less than 1/16 of the source width 1055 + * 2. width greater than the source width 1056 + * 3. height less than 1/8 of the source height 1057 + * 4. height greater than the source height 1058 + */ 1059 + if ((fmt->width * 16 < Hsrc) || (Hsrc < fmt->width) || 1060 + (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) { 1061 + CX18_ERR_DEV(sd, "%dx%d is not a valid size!\n", 1062 + fmt->width, fmt->height); 1063 + return -ERANGE; 1103 1064 } 1065 + 1066 + HSC = (Hsrc * (1 << 20)) / fmt->width - (1 << 20); 1067 + VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9)); 1068 + VSC &= 0x1fff; 1069 + 1070 + if (fmt->width >= 385) 1071 + filter = 0; 1072 + else if (fmt->width > 192) 1073 + filter = 1; 1074 + else if (fmt->width > 96) 1075 + filter = 2; 1076 + else 1077 + filter = 3; 1078 + 1079 + CX18_DEBUG_INFO_DEV(sd, 1080 + "decoder set size %dx%d -> scale %ux%u\n", 1081 + fmt->width, fmt->height, HSC, VSC); 1082 + 1083 + /* HSCALE=HSC */ 1084 + cx18_av_write(cx, 0x418, HSC & 0xff); 1085 + cx18_av_write(cx, 0x419, (HSC >> 8) & 0xff); 1086 + cx18_av_write(cx, 0x41a, HSC >> 16); 1087 + /* VSCALE=VSC */ 1088 + cx18_av_write(cx, 0x41c, VSC & 0xff); 1089 + cx18_av_write(cx, 0x41d, VSC >> 8); 1090 + /* VS_INTRLACE=1 VFILT=filter */ 1091 + cx18_av_write(cx, 0x41e, 0x8 | filter); 1104 1092 return 0; 1105 1093 } 1106 1094 ··· 1386 1398 static const struct v4l2_subdev_video_ops cx18_av_video_ops = { 1387 1399 .s_routing = cx18_av_s_video_routing, 1388 1400 .s_stream = cx18_av_s_stream, 1389 - .g_fmt = cx18_av_g_fmt, 1390 - .s_fmt = cx18_av_s_fmt, 1401 + .s_mbus_fmt = cx18_av_s_mbus_fmt, 1391 1402 }; 1392 1403 1393 1404 static const struct v4l2_subdev_vbi_ops cx18_av_vbi_ops = {
+1 -1
drivers/media/video/cx18/cx18-av-core.h
··· 4 4 * Derived from cx25840-core.h 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or 10 10 * modify it under the terms of the GNU General Public License
+1 -1
drivers/media/video/cx18/cx18-av-firmware.c
··· 2 2 * cx18 ADEC firmware functions 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or 8 8 * modify it under the terms of the GNU General Public License
+1 -1
drivers/media/video/cx18/cx18-cards.c
··· 4 4 * Derived from ivtv-cards.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-cards.h
··· 4 4 * Derived from ivtv-cards.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+5 -6
drivers/media/video/cx18/cx18-controls.c
··· 297 297 if (p.video_encoding != cx->params.video_encoding) { 298 298 int is_mpeg1 = p.video_encoding == 299 299 V4L2_MPEG_VIDEO_ENCODING_MPEG_1; 300 - struct v4l2_format fmt; 300 + struct v4l2_mbus_framefmt fmt; 301 301 302 302 /* fix videodecoder resolution */ 303 - fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 304 - fmt.fmt.pix.width = cx->params.width 305 - / (is_mpeg1 ? 2 : 1); 306 - fmt.fmt.pix.height = cx->params.height; 307 - v4l2_subdev_call(cx->sd_av, video, s_fmt, &fmt); 303 + fmt.width = cx->params.width / (is_mpeg1 ? 2 : 1); 304 + fmt.height = cx->params.height; 305 + fmt.code = V4L2_MBUS_FMT_FIXED; 306 + v4l2_subdev_call(cx->sd_av, video, s_mbus_fmt, &fmt); 308 307 } 309 308 priv.cx = cx; 310 309 priv.s = &cx->streams[id->type];
+1 -1
drivers/media/video/cx18/cx18-driver.c
··· 4 4 * Derived from ivtv-driver.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-driver.h
··· 4 4 * Derived from ivtv-driver.h 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-dvb.c
··· 2 2 * cx18 functions for DVB support 3 3 * 4 4 * Copyright (c) 2008 Steven Toth <stoth@linuxtv.org> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-fileops.c
··· 4 4 * Derived from ivtv-fileops.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-firmware.c
··· 2 2 * cx18 firmware functions 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-gpio.c
··· 4 4 * Derived from ivtv-gpio.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-gpio.h
··· 4 4 * Derived from ivtv-gpio.h 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-i2c.c
··· 4 4 * Derived from ivtv-i2c.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-io.c
··· 2 2 * cx18 driver PCI memory mapped IO access routines 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+2 -2
drivers/media/video/cx18/cx18-io.h
··· 2 2 * cx18 driver PCI memory mapped IO access routines 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by ··· 28 28 /* 29 29 * Readback and retry of MMIO access for reliability: 30 30 * The concept was suggested by Steve Toth <stoth@linuxtv.org>. 31 - * The implmentation is the fault of Andy Walls <awalls@radix.net>. 31 + * The implmentation is the fault of Andy Walls <awalls@md.metrocast.net>. 32 32 * 33 33 * *write* functions are implied to retry the mmio unless suffixed with _noretry 34 34 * *read* functions never retry the mmio (it never helps to do so)
+6 -4
drivers/media/video/cx18/cx18-ioctl.c
··· 4 4 * Derived from ivtv-ioctl.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by ··· 274 274 { 275 275 struct cx18_open_id *id = fh; 276 276 struct cx18 *cx = id->cx; 277 + struct v4l2_mbus_framefmt mbus_fmt; 277 278 int ret; 278 279 int w, h; 279 280 ··· 294 293 if (atomic_read(&cx->ana_capturing) > 0) 295 294 return -EBUSY; 296 295 297 - cx->params.width = w; 298 - cx->params.height = h; 299 - v4l2_subdev_call(cx->sd_av, video, s_fmt, fmt); 296 + mbus_fmt.width = cx->params.width = w; 297 + mbus_fmt.height = cx->params.height = h; 298 + mbus_fmt.code = V4L2_MBUS_FMT_FIXED; 299 + v4l2_subdev_call(cx->sd_av, video, s_mbus_fmt, &mbus_fmt); 300 300 return cx18_g_fmt_vid_cap(file, fh, fmt); 301 301 } 302 302
+1 -1
drivers/media/video/cx18/cx18-ioctl.h
··· 4 4 * Derived from ivtv-ioctl.h 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-irq.c
··· 2 2 * cx18 interrupt handling 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-irq.h
··· 2 2 * cx18 interrupt handling 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-mailbox.c
··· 2 2 * cx18 mailbox functions 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-mailbox.h
··· 2 2 * cx18 mailbox functions 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-queue.c
··· 4 4 * Derived from ivtv-queue.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-queue.h
··· 4 4 * Derived from ivtv-queue.h 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-scb.c
··· 2 2 * cx18 System Control Block initialization 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-scb.h
··· 2 2 * cx18 System Control Block initialization 3 3 * 4 4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 5 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify 8 8 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-streams.c
··· 4 4 * Derived from ivtv-streams.c 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx18/cx18-streams.h
··· 4 4 * Derived from ivtv-streams.h 5 5 * 6 6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 7 - * Copyright (C) 2008 Andy Walls <awalls@radix.net> 7 + * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License as published by
+4 -1
drivers/media/video/cx231xx/cx231xx-video.c
··· 993 993 struct cx231xx *dev = fh->dev; 994 994 int rc; 995 995 struct cx231xx_fmt *fmt; 996 + struct v4l2_mbus_framefmt mbus_fmt; 996 997 997 998 rc = check_dev(dev); 998 999 if (rc < 0) ··· 1027 1026 dev->format = fmt; 1028 1027 get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); 1029 1028 1030 - call_all(dev, video, s_fmt, f); 1029 + v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, V4L2_MBUS_FMT_FIXED); 1030 + call_all(dev, video, s_mbus_fmt, &mbus_fmt); 1031 + v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt); 1031 1032 1032 1033 /* Set the correct alternate setting for this resolution */ 1033 1034 cx231xx_resolution_set(dev);
+1 -5
drivers/media/video/cx2341x.c
··· 1113 1113 void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix) 1114 1114 { 1115 1115 int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1; 1116 - int temporal = p->video_temporal_filter; 1117 1116 1118 1117 /* Stream */ 1119 1118 printk(KERN_INFO "%s: Stream: %s", ··· 1178 1179 V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE), 1179 1180 p->video_spatial_filter); 1180 1181 1181 - if (p->width != 720 || p->height != (p->is_50hz ? 576 : 480)) 1182 - temporal = 0; 1183 - 1184 1182 printk(KERN_INFO "%s: Temporal Filter: %s, %d\n", 1185 1183 prefix, 1186 1184 cx2341x_menu_item(p, 1187 1185 V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE), 1188 - temporal); 1186 + p->video_temporal_filter); 1189 1187 printk(KERN_INFO 1190 1188 "%s: Median Filter: %s, Luma [%d, %d], Chroma [%d, %d]\n", 1191 1189 prefix,
+2
drivers/media/video/cx23885/cx23885-dvb.c
··· 991 991 ret = videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port, 992 992 &dev->pci->dev, adapter_nr, 0, 993 993 cx23885_dvb_fe_ioctl_override); 994 + if (!ret) 995 + return ret; 994 996 995 997 /* init CI & MAC */ 996 998 switch (dev->board) {
+11 -1
drivers/media/video/cx23885/cx23885-i2c.c
··· 365 365 366 366 memset(&info, 0, sizeof(struct i2c_board_info)); 367 367 strlcpy(info.type, "ir_video", I2C_NAME_SIZE); 368 - i2c_new_probed_device(&bus->i2c_adap, &info, addr_list); 368 + /* 369 + * We can't call i2c_new_probed_device() because it uses 370 + * quick writes for probing and the IR receiver device only 371 + * replies to reads. 372 + */ 373 + if (i2c_smbus_xfer(&bus->i2c_adap, addr_list[0], 0, 374 + I2C_SMBUS_READ, 0, I2C_SMBUS_QUICK, 375 + NULL) >= 0) { 376 + info.addr = addr_list[0]; 377 + i2c_new_device(&bus->i2c_adap, &info); 378 + } 369 379 } 370 380 371 381 return bus->i2c_rc;
+1 -1
drivers/media/video/cx23885/cx23885-input.c
··· 5 5 * 6 6 * Most of this file is 7 7 * 8 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 8 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 9 9 * 10 10 * However, the cx23885_input_{init,fini} functions contained herein are 11 11 * derived from Linux kernel files linux/media/video/.../...-input.c marked as:
+1 -1
drivers/media/video/cx23885/cx23885-input.h
··· 3 3 * 4 4 * Infrared remote control input device 5 5 * 6 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 6 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 7 7 * 8 8 * This program is free software; you can redistribute it and/or 9 9 * modify it under the terms of the GNU General Public License
+1 -1
drivers/media/video/cx23885/cx23885-ioctl.c
··· 3 3 * 4 4 * Various common ioctl() support functions 5 5 * 6 - * Copyright (c) 2009 Andy Walls <awalls@radix.net> 6 + * Copyright (c) 2009 Andy Walls <awalls@md.metrocast.net> 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx23885/cx23885-ioctl.h
··· 3 3 * 4 4 * Various common ioctl() support functions 5 5 * 6 - * Copyright (c) 2009 Andy Walls <awalls@radix.net> 6 + * Copyright (c) 2009 Andy Walls <awalls@md.metrocast.net> 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License as published by
+1 -1
drivers/media/video/cx23885/cx23885-ir.c
··· 3 3 * 4 4 * Infrared device support routines - non-input, non-vl42_subdev routines 5 5 * 6 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 6 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 7 7 * 8 8 * This program is free software; you can redistribute it and/or 9 9 * modify it under the terms of the GNU General Public License
+1 -1
drivers/media/video/cx23885/cx23885-ir.h
··· 3 3 * 4 4 * Infrared device support routines - non-input, non-vl42_subdev routines 5 5 * 6 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 6 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 7 7 * 8 8 * This program is free software; you can redistribute it and/or 9 9 * modify it under the terms of the GNU General Public License
+4 -1
drivers/media/video/cx23885/cx23885-video.c
··· 976 976 { 977 977 struct cx23885_fh *fh = priv; 978 978 struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; 979 + struct v4l2_mbus_framefmt mbus_fmt; 979 980 int err; 980 981 981 982 dprintk(2, "%s()\n", __func__); ··· 990 989 fh->vidq.field = f->fmt.pix.field; 991 990 dprintk(2, "%s() width=%d height=%d field=%d\n", __func__, 992 991 fh->width, fh->height, fh->vidq.field); 993 - call_all(dev, video, s_fmt, f); 992 + v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, V4L2_MBUS_FMT_FIXED); 993 + call_all(dev, video, s_mbus_fmt, &mbus_fmt); 994 + v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt); 994 995 return 0; 995 996 } 996 997
+1 -1
drivers/media/video/cx23885/cx23888-ir.c
··· 3 3 * 4 4 * CX23888 Integrated Consumer Infrared Controller 5 5 * 6 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 6 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 7 7 * 8 8 * This program is free software; you can redistribute it and/or 9 9 * modify it under the terms of the GNU General Public License
+1 -1
drivers/media/video/cx23885/cx23888-ir.h
··· 3 3 * 4 4 * CX23888 Integrated Consumer Infrared Controller 5 5 * 6 - * Copyright (C) 2009 Andy Walls <awalls@radix.net> 6 + * Copyright (C) 2009 Andy Walls <awalls@md.metrocast.net> 7 7 * 8 8 * This program is free software; you can redistribute it and/or 9 9 * modify it under the terms of the GNU General Public License
+45 -62
drivers/media/video/cx25840/cx25840-core.c
··· 1014 1014 1015 1015 /* ----------------------------------------------------------------------- */ 1016 1016 1017 - static int cx25840_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 1018 - { 1019 - switch (fmt->type) { 1020 - case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 1021 - return cx25840_g_sliced_fmt(sd, &fmt->fmt.sliced); 1022 - default: 1023 - return -EINVAL; 1024 - } 1025 - return 0; 1026 - } 1027 - 1028 - static int cx25840_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 1017 + static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 1029 1018 { 1030 1019 struct cx25840_state *state = to_state(sd); 1031 1020 struct i2c_client *client = v4l2_get_subdevdata(sd); 1032 - struct v4l2_pix_format *pix; 1033 1021 int HSC, VSC, Vsrc, Hsrc, filter, Vlines; 1034 1022 int is_50Hz = !(state->std & V4L2_STD_525_60); 1035 1023 1036 - switch (fmt->type) { 1037 - case V4L2_BUF_TYPE_VIDEO_CAPTURE: 1038 - pix = &(fmt->fmt.pix); 1039 - 1040 - Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; 1041 - Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; 1042 - 1043 - Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; 1044 - Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; 1045 - 1046 - Vlines = pix->height + (is_50Hz ? 4 : 7); 1047 - 1048 - if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) || 1049 - (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) { 1050 - v4l_err(client, "%dx%d is not a valid size!\n", 1051 - pix->width, pix->height); 1052 - return -ERANGE; 1053 - } 1054 - 1055 - HSC = (Hsrc * (1 << 20)) / pix->width - (1 << 20); 1056 - VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9)); 1057 - VSC &= 0x1fff; 1058 - 1059 - if (pix->width >= 385) 1060 - filter = 0; 1061 - else if (pix->width > 192) 1062 - filter = 1; 1063 - else if (pix->width > 96) 1064 - filter = 2; 1065 - else 1066 - filter = 3; 1067 - 1068 - v4l_dbg(1, cx25840_debug, client, "decoder set size %dx%d -> scale %ux%u\n", 1069 - pix->width, pix->height, HSC, VSC); 1070 - 1071 - /* HSCALE=HSC */ 1072 - cx25840_write(client, 0x418, HSC & 0xff); 1073 - cx25840_write(client, 0x419, (HSC >> 8) & 0xff); 1074 - cx25840_write(client, 0x41a, HSC >> 16); 1075 - /* VSCALE=VSC */ 1076 - cx25840_write(client, 0x41c, VSC & 0xff); 1077 - cx25840_write(client, 0x41d, VSC >> 8); 1078 - /* VS_INTRLACE=1 VFILT=filter */ 1079 - cx25840_write(client, 0x41e, 0x8 | filter); 1080 - break; 1081 - 1082 - default: 1024 + if (fmt->code != V4L2_MBUS_FMT_FIXED) 1083 1025 return -EINVAL; 1026 + 1027 + fmt->field = V4L2_FIELD_INTERLACED; 1028 + fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; 1029 + 1030 + Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; 1031 + Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; 1032 + 1033 + Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; 1034 + Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; 1035 + 1036 + Vlines = fmt->height + (is_50Hz ? 4 : 7); 1037 + 1038 + if ((fmt->width * 16 < Hsrc) || (Hsrc < fmt->width) || 1039 + (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) { 1040 + v4l_err(client, "%dx%d is not a valid size!\n", 1041 + fmt->width, fmt->height); 1042 + return -ERANGE; 1084 1043 } 1085 1044 1045 + HSC = (Hsrc * (1 << 20)) / fmt->width - (1 << 20); 1046 + VSC = (1 << 16) - (Vsrc * (1 << 9) / Vlines - (1 << 9)); 1047 + VSC &= 0x1fff; 1048 + 1049 + if (fmt->width >= 385) 1050 + filter = 0; 1051 + else if (fmt->width > 192) 1052 + filter = 1; 1053 + else if (fmt->width > 96) 1054 + filter = 2; 1055 + else 1056 + filter = 3; 1057 + 1058 + v4l_dbg(1, cx25840_debug, client, "decoder set size %dx%d -> scale %ux%u\n", 1059 + fmt->width, fmt->height, HSC, VSC); 1060 + 1061 + /* HSCALE=HSC */ 1062 + cx25840_write(client, 0x418, HSC & 0xff); 1063 + cx25840_write(client, 0x419, (HSC >> 8) & 0xff); 1064 + cx25840_write(client, 0x41a, HSC >> 16); 1065 + /* VSCALE=VSC */ 1066 + cx25840_write(client, 0x41c, VSC & 0xff); 1067 + cx25840_write(client, 0x41d, VSC >> 8); 1068 + /* VS_INTRLACE=1 VFILT=filter */ 1069 + cx25840_write(client, 0x41e, 0x8 | filter); 1086 1070 return 0; 1087 1071 } 1088 1072 ··· 1611 1627 1612 1628 static const struct v4l2_subdev_video_ops cx25840_video_ops = { 1613 1629 .s_routing = cx25840_s_video_routing, 1614 - .g_fmt = cx25840_g_fmt, 1615 - .s_fmt = cx25840_s_fmt, 1630 + .s_mbus_fmt = cx25840_s_mbus_fmt, 1616 1631 .s_stream = cx25840_s_stream, 1617 1632 }; 1618 1633
+15 -1
drivers/media/video/cx88/cx88-i2c.c
··· 188 188 0x18, 0x6b, 0x71, 189 189 I2C_CLIENT_END 190 190 }; 191 + const unsigned short *addrp; 191 192 192 193 memset(&info, 0, sizeof(struct i2c_board_info)); 193 194 strlcpy(info.type, "ir_video", I2C_NAME_SIZE); 194 - i2c_new_probed_device(&core->i2c_adap, &info, addr_list); 195 + /* 196 + * We can't call i2c_new_probed_device() because it uses 197 + * quick writes for probing and at least some R receiver 198 + * devices only reply to reads. 199 + */ 200 + for (addrp = addr_list; *addrp != I2C_CLIENT_END; addrp++) { 201 + if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0, 202 + I2C_SMBUS_READ, 0, 203 + I2C_SMBUS_QUICK, NULL) >= 0) { 204 + info.addr = *addrp; 205 + i2c_new_device(&core->i2c_adap, &info); 206 + break; 207 + } 208 + } 195 209 } 196 210 return core->i2c_rc; 197 211 }
+2 -5
drivers/media/video/em28xx/em28xx-core.c
··· 1186 1186 mutex_lock(&em28xx_devlist_mutex); 1187 1187 list_add_tail(&ops->next, &em28xx_extension_devlist); 1188 1188 list_for_each_entry(dev, &em28xx_devlist, devlist) { 1189 - if (dev) 1190 - ops->init(dev); 1189 + ops->init(dev); 1191 1190 } 1192 1191 printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name); 1193 1192 mutex_unlock(&em28xx_devlist_mutex); ··· 1200 1201 1201 1202 mutex_lock(&em28xx_devlist_mutex); 1202 1203 list_for_each_entry(dev, &em28xx_devlist, devlist) { 1203 - if (dev) 1204 - ops->fini(dev); 1204 + ops->fini(dev); 1205 1205 } 1206 - 1207 1206 printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name); 1208 1207 list_del(&ops->next); 1209 1208 mutex_unlock(&em28xx_devlist_mutex);
-2
drivers/media/video/gspca/sonixb.c
··· 1453 1453 {USB_DEVICE(0x0c45, 0x6029), SB(PAS106, 102)}, 1454 1454 {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)}, 1455 1455 {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)}, 1456 - #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE 1457 1456 {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)}, 1458 - #endif 1459 1457 {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)}, 1460 1458 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE 1461 1459 {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)},
+4 -1
drivers/media/video/gspca/sonixj.c
··· 3022 3022 /* {USB_DEVICE(0x0c45, 0x60c2), BS(SN9C105, P1030xC)}, */ 3023 3023 /* {USB_DEVICE(0x0c45, 0x60c8), BS(SN9C105, OM6802)}, */ 3024 3024 /* {USB_DEVICE(0x0c45, 0x60cc), BS(SN9C105, HV7131GP)}, */ 3025 + {USB_DEVICE(0x0c45, 0x60ce), BS(SN9C105, SP80708)}, 3025 3026 {USB_DEVICE(0x0c45, 0x60ec), BS(SN9C105, MO4000)}, 3026 3027 /* {USB_DEVICE(0x0c45, 0x60ef), BS(SN9C105, ICM105C)}, */ 3027 3028 /* {USB_DEVICE(0x0c45, 0x60fa), BS(SN9C105, OV7648)}, */ 3029 + /* {USB_DEVICE(0x0c45, 0x60f2), BS(SN9C105, OV7660)}, */ 3028 3030 {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)}, 3029 3031 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE 3030 3032 {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)}, 3031 3033 {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)}, 3032 3034 #endif 3033 3035 {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)}, /*sn9c128*/ 3034 - /* {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, P1030xC)}, */ 3036 + /* {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)}, * / GC0305*/ 3035 3037 /* {USB_DEVICE(0x0c45, 0x6108), BS(SN9C120, OM6802)}, */ 3036 3038 {USB_DEVICE(0x0c45, 0x610a), BS(SN9C120, OV7648)}, /*sn9c128*/ 3037 3039 {USB_DEVICE(0x0c45, 0x610b), BS(SN9C120, OV7660)}, /*sn9c128*/ ··· 3060 3058 {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)}, 3061 3059 {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)}, 3062 3060 {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/ 3061 + /* or GC0305 / GC0307 */ 3063 3062 {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/ 3064 3063 {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/ 3065 3064 {USB_DEVICE(0x0c45, 0x614a), BS(SN9C120, ADCM1700)}, /*sn9c120b*/
+1 -1
drivers/media/video/hdpvr/hdpvr-video.c
··· 366 366 367 367 dev = (struct hdpvr_device *)video_get_drvdata(video_devdata(file)); 368 368 if (!dev) { 369 - v4l2_err(&dev->v4l2_dev, "open failing with with ENODEV\n"); 369 + pr_err("open failing with with ENODEV\n"); 370 370 retval = -ENODEV; 371 371 goto err; 372 372 }
+5 -5
drivers/media/video/ivtv/ivtv-controls.c
··· 267 267 if (p.video_encoding != itv->params.video_encoding) { 268 268 int is_mpeg1 = p.video_encoding == 269 269 V4L2_MPEG_VIDEO_ENCODING_MPEG_1; 270 - struct v4l2_format fmt; 270 + struct v4l2_mbus_framefmt fmt; 271 271 272 272 /* fix videodecoder resolution */ 273 - fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 274 - fmt.fmt.pix.width = itv->params.width / (is_mpeg1 ? 2 : 1); 275 - fmt.fmt.pix.height = itv->params.height; 276 - v4l2_subdev_call(itv->sd_video, video, s_fmt, &fmt); 273 + fmt.width = itv->params.width / (is_mpeg1 ? 2 : 1); 274 + fmt.height = itv->params.height; 275 + fmt.code = V4L2_MBUS_FMT_FIXED; 276 + v4l2_subdev_call(itv->sd_video, video, s_mbus_fmt, &fmt); 277 277 } 278 278 err = cx2341x_update(itv, ivtv_api_func, &itv->params, &p); 279 279 if (!err && itv->params.stream_vbi_fmt != p.stream_vbi_fmt)
+7 -4
drivers/media/video/ivtv/ivtv-fileops.c
··· 823 823 824 824 IVTV_DEBUG_FILE("close() of %s\n", s->name); 825 825 826 + if (id->type == IVTV_DEC_STREAM_TYPE_YUV && 827 + test_bit(IVTV_F_I_DECODING_YUV, &itv->i_flags)) { 828 + /* Restore registers we've changed & clean up any mess */ 829 + ivtv_yuv_close(itv); 830 + } 831 + 826 832 /* Stop decoding */ 827 833 if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { 828 834 IVTV_DEBUG_INFO("close stopping decode\n"); ··· 838 832 } 839 833 clear_bit(IVTV_F_S_APPL_IO, &s->s_flags); 840 834 clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags); 841 - if (id->type == IVTV_DEC_STREAM_TYPE_YUV && test_bit(IVTV_F_I_DECODING_YUV, &itv->i_flags)) { 842 - /* Restore registers we've changed & clean up any mess we've made */ 843 - ivtv_yuv_close(itv); 844 - } 835 + 845 836 if (itv->output_mode == OUT_UDMA_YUV && id->yuv_frames) 846 837 itv->output_mode = OUT_NONE; 847 838
+5 -1
drivers/media/video/ivtv/ivtv-ioctl.c
··· 569 569 struct ivtv_open_id *id = fh; 570 570 struct ivtv *itv = id->itv; 571 571 struct cx2341x_mpeg_params *p = &itv->params; 572 + struct v4l2_mbus_framefmt mbus_fmt; 572 573 int ret = ivtv_try_fmt_vid_cap(file, fh, fmt); 573 574 int w = fmt->fmt.pix.width; 574 575 int h = fmt->fmt.pix.height; ··· 587 586 p->height = h; 588 587 if (p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1) 589 588 fmt->fmt.pix.width /= 2; 590 - v4l2_subdev_call(itv->sd_video, video, s_fmt, fmt); 589 + mbus_fmt.width = fmt->fmt.pix.width; 590 + mbus_fmt.height = h; 591 + mbus_fmt.code = V4L2_MBUS_FMT_FIXED; 592 + v4l2_subdev_call(itv->sd_video, video, s_mbus_fmt, &mbus_fmt); 591 593 return ivtv_g_fmt_vid_cap(file, fh, fmt); 592 594 } 593 595
+21 -2
drivers/media/video/ivtv/ivtv-streams.c
··· 618 618 struct ivtv *itv = s->itv; 619 619 struct cx2341x_mpeg_params *p = &itv->params; 620 620 int datatype; 621 + u16 width; 622 + u16 height; 621 623 622 624 if (s->vdev == NULL) 623 625 return -EINVAL; 624 626 625 627 IVTV_DEBUG_INFO("Setting some initial decoder settings\n"); 628 + 629 + width = p->width; 630 + height = p->height; 626 631 627 632 /* set audio mode to left/stereo for dual/stereo mode. */ 628 633 ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode); ··· 651 646 2 = yuv_from_host */ 652 647 switch (s->type) { 653 648 case IVTV_DEC_STREAM_TYPE_YUV: 654 - datatype = itv->output_mode == OUT_PASSTHROUGH ? 1 : 2; 649 + if (itv->output_mode == OUT_PASSTHROUGH) { 650 + datatype = 1; 651 + } else { 652 + /* Fake size to avoid switching video standard */ 653 + datatype = 2; 654 + width = 720; 655 + height = itv->is_out_50hz ? 576 : 480; 656 + } 655 657 IVTV_DEBUG_INFO("Setup DEC YUV Stream data[0] = %d\n", datatype); 656 658 break; 657 659 case IVTV_DEC_STREAM_TYPE_MPG: ··· 667 655 break; 668 656 } 669 657 if (ivtv_vapi(itv, CX2341X_DEC_SET_DECODER_SOURCE, 4, datatype, 670 - p->width, p->height, p->audio_properties)) { 658 + width, height, p->audio_properties)) { 671 659 IVTV_DEBUG_WARN("Couldn't initialize decoder source\n"); 672 660 } 661 + 662 + /* Decoder sometimes dies here, so wait a moment */ 663 + ivtv_msleep_timeout(10, 0); 664 + 673 665 return 0; 674 666 } 675 667 ··· 712 696 713 697 /* start playback */ 714 698 ivtv_vapi(itv, CX2341X_DEC_START_PLAYBACK, 2, gop_offset, 0); 699 + 700 + /* Let things settle before we actually start */ 701 + ivtv_msleep_timeout(10, 0); 715 702 716 703 /* Clear the following Interrupt mask bits for decoding */ 717 704 ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_DECODE);
+11 -3
drivers/media/video/ivtv/ivtvfb.c
··· 1066 1066 } 1067 1067 mutex_unlock(&itv->serialize_lock); 1068 1068 1069 - ivtvfb_get_framebuffer(itv, &oi->video_rbase, &oi->video_buffer_size); 1069 + if (ivtvfb_get_framebuffer(itv, &oi->video_rbase, 1070 + &oi->video_buffer_size) < 0) { 1071 + IVTVFB_ERR("Firmware failed to respond\n"); 1072 + return -EIO; 1073 + } 1070 1074 1071 1075 /* The osd buffer size depends on the number of video buffers allocated 1072 1076 on the PVR350 itself. For now we'll hardcode the smallest osd buffer ··· 1162 1158 } 1163 1159 1164 1160 /* Find & setup the OSD buffer */ 1165 - if ((rc = ivtvfb_init_io(itv))) 1161 + rc = ivtvfb_init_io(itv); 1162 + if (rc) { 1163 + ivtvfb_release_buffers(itv); 1166 1164 return rc; 1165 + } 1167 1166 1168 1167 /* Set the startup video mode information */ 1169 1168 if ((rc = ivtvfb_init_vidmode(itv))) { ··· 1217 1210 { 1218 1211 struct v4l2_device *v4l2_dev = dev_get_drvdata(dev); 1219 1212 struct ivtv *itv = container_of(v4l2_dev, struct ivtv, v4l2_dev); 1213 + struct osd_info *oi = itv->osd_info; 1220 1214 1221 1215 if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { 1222 1216 if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) { ··· 1226 1218 return 0; 1227 1219 } 1228 1220 IVTVFB_INFO("Unregister framebuffer %d\n", itv->instance); 1229 - ivtvfb_blank(FB_BLANK_POWERDOWN, &itv->osd_info->ivtvfb_info); 1221 + ivtvfb_blank(FB_BLANK_VSYNC_SUSPEND, &oi->ivtvfb_info); 1230 1222 ivtvfb_release_buffers(itv); 1231 1223 itv->osd_video_pbase = 0; 1232 1224 }
+2 -2
drivers/media/video/mt9m001.c
··· 701 701 #endif 702 702 }; 703 703 704 - static int mt9m001_enum_fmt(struct v4l2_subdev *sd, int index, 704 + static int mt9m001_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 705 705 enum v4l2_mbus_pixelcode *code) 706 706 { 707 707 struct i2c_client *client = sd->priv; 708 708 struct mt9m001 *mt9m001 = to_mt9m001(client); 709 709 710 - if ((unsigned int)index >= mt9m001->num_fmts) 710 + if (index >= mt9m001->num_fmts) 711 711 return -EINVAL; 712 712 713 713 *code = mt9m001->fmts[index].code;
+2 -2
drivers/media/video/mt9m111.c
··· 999 999 #endif 1000 1000 }; 1001 1001 1002 - static int mt9m111_enum_fmt(struct v4l2_subdev *sd, int index, 1002 + static int mt9m111_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 1003 1003 enum v4l2_mbus_pixelcode *code) 1004 1004 { 1005 - if ((unsigned int)index >= ARRAY_SIZE(mt9m111_colour_fmts)) 1005 + if (index >= ARRAY_SIZE(mt9m111_colour_fmts)) 1006 1006 return -EINVAL; 1007 1007 1008 1008 *code = mt9m111_colour_fmts[index].code;
+1 -1
drivers/media/video/mt9t031.c
··· 798 798 #endif 799 799 }; 800 800 801 - static int mt9t031_enum_fmt(struct v4l2_subdev *sd, int index, 801 + static int mt9t031_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 802 802 enum v4l2_mbus_pixelcode *code) 803 803 { 804 804 if (index)
+2 -2
drivers/media/video/mt9t112.c
··· 1017 1017 return 0; 1018 1018 } 1019 1019 1020 - static int mt9t112_enum_fmt(struct v4l2_subdev *sd, int index, 1020 + static int mt9t112_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 1021 1021 enum v4l2_mbus_pixelcode *code) 1022 1022 { 1023 - if ((unsigned int)index >= ARRAY_SIZE(mt9t112_cfmts)) 1023 + if (index >= ARRAY_SIZE(mt9t112_cfmts)) 1024 1024 return -EINVAL; 1025 1025 1026 1026 *code = mt9t112_cfmts[index].code;
+17 -20
drivers/media/video/mt9v011.c
··· 392 392 return 0; 393 393 } 394 394 395 - static int mt9v011_enum_fmt(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt) 395 + static int mt9v011_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned index, 396 + enum v4l2_mbus_pixelcode *code) 396 397 { 397 - if (fmt->index > 0) 398 + if (index > 0) 398 399 return -EINVAL; 399 400 400 - fmt->flags = 0; 401 - strcpy(fmt->description, "8 bpp Bayer GRGR..BGBG"); 402 - fmt->pixelformat = V4L2_PIX_FMT_SGRBG8; 403 - 401 + *code = V4L2_MBUS_FMT_SGRBG8_1X8; 404 402 return 0; 405 403 } 406 404 407 - static int mt9v011_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 405 + static int mt9v011_try_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 408 406 { 409 - struct v4l2_pix_format *pix = &fmt->fmt.pix; 410 - 411 - if (pix->pixelformat != V4L2_PIX_FMT_SGRBG8) 407 + if (fmt->code != V4L2_MBUS_FMT_SGRBG8_1X8) 412 408 return -EINVAL; 413 409 414 - v4l_bound_align_image(&pix->width, 48, 639, 1, 415 - &pix->height, 32, 480, 1, 0); 410 + v4l_bound_align_image(&fmt->width, 48, 639, 1, 411 + &fmt->height, 32, 480, 1, 0); 412 + fmt->field = V4L2_FIELD_NONE; 413 + fmt->colorspace = V4L2_COLORSPACE_SRGB; 416 414 417 415 return 0; 418 416 } ··· 453 455 return 0; 454 456 } 455 457 456 - static int mt9v011_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 458 + static int mt9v011_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 457 459 { 458 - struct v4l2_pix_format *pix = &fmt->fmt.pix; 459 460 struct mt9v011 *core = to_mt9v011(sd); 460 461 int rc; 461 462 462 - rc = mt9v011_try_fmt(sd, fmt); 463 + rc = mt9v011_try_mbus_fmt(sd, fmt); 463 464 if (rc < 0) 464 465 return -EINVAL; 465 466 466 - core->width = pix->width; 467 - core->height = pix->height; 467 + core->width = fmt->width; 468 + core->height = fmt->height; 468 469 469 470 set_res(sd); 470 471 ··· 546 549 }; 547 550 548 551 static const struct v4l2_subdev_video_ops mt9v011_video_ops = { 549 - .enum_fmt = mt9v011_enum_fmt, 550 - .try_fmt = mt9v011_try_fmt, 551 - .s_fmt = mt9v011_s_fmt, 552 + .enum_mbus_fmt = mt9v011_enum_mbus_fmt, 553 + .try_mbus_fmt = mt9v011_try_mbus_fmt, 554 + .s_mbus_fmt = mt9v011_s_mbus_fmt, 552 555 .g_parm = mt9v011_g_parm, 553 556 .s_parm = mt9v011_s_parm, 554 557 };
+2 -2
drivers/media/video/mt9v022.c
··· 838 838 #endif 839 839 }; 840 840 841 - static int mt9v022_enum_fmt(struct v4l2_subdev *sd, int index, 841 + static int mt9v022_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 842 842 enum v4l2_mbus_pixelcode *code) 843 843 { 844 844 struct i2c_client *client = sd->priv; 845 845 struct mt9v022 *mt9v022 = to_mt9v022(client); 846 846 847 - if ((unsigned int)index >= mt9v022->num_fmts) 847 + if (index >= mt9v022->num_fmts) 848 848 return -EINVAL; 849 849 850 850 *code = mt9v022->fmts[index].code;
+2 -2
drivers/media/video/mx3_camera.c
··· 672 672 fmt->packing == SOC_MBUS_PACKING_EXTEND16); 673 673 } 674 674 675 - static int mx3_camera_get_formats(struct soc_camera_device *icd, int idx, 675 + static int mx3_camera_get_formats(struct soc_camera_device *icd, unsigned int idx, 676 676 struct soc_camera_format_xlate *xlate) 677 677 { 678 678 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); ··· 689 689 fmt = soc_mbus_get_fmtdesc(code); 690 690 if (!fmt) { 691 691 dev_err(icd->dev.parent, 692 - "Invalid format code #%d: %d\n", idx, code); 692 + "Invalid format code #%u: %d\n", idx, code); 693 693 return 0; 694 694 } 695 695
+1 -2
drivers/media/video/omap/omap_vout.c
··· 2371 2371 2372 2372 for (k = 0; k < pdev->num_resources; k++) { 2373 2373 2374 - vout = kmalloc(sizeof(struct omap_vout_device), GFP_KERNEL); 2374 + vout = kzalloc(sizeof(struct omap_vout_device), GFP_KERNEL); 2375 2375 if (!vout) { 2376 2376 dev_err(&pdev->dev, ": could not allocate memory\n"); 2377 2377 return -ENOMEM; 2378 2378 } 2379 - memset(vout, 0, sizeof(struct omap_vout_device)); 2380 2379 2381 2380 vout->vid = k; 2382 2381 vid_dev->vouts[k] = vout;
+2 -2
drivers/media/video/ov772x.c
··· 1092 1092 #endif 1093 1093 }; 1094 1094 1095 - static int ov772x_enum_fmt(struct v4l2_subdev *sd, int index, 1095 + static int ov772x_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 1096 1096 enum v4l2_mbus_pixelcode *code) 1097 1097 { 1098 - if ((unsigned int)index >= ARRAY_SIZE(ov772x_cfmts)) 1098 + if (index >= ARRAY_SIZE(ov772x_cfmts)) 1099 1099 return -EINVAL; 1100 1100 1101 1101 *code = ov772x_cfmts[index].code;
+2 -2
drivers/media/video/ov9640.c
··· 614 614 return 0; 615 615 } 616 616 617 - static int ov9640_enum_fmt(struct v4l2_subdev *sd, int index, 617 + static int ov9640_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 618 618 enum v4l2_mbus_pixelcode *code) 619 619 { 620 - if ((unsigned int)index >= ARRAY_SIZE(ov9640_codes)) 620 + if (index >= ARRAY_SIZE(ov9640_codes)) 621 621 return -EINVAL; 622 622 623 623 *code = ov9640_codes[index];
+1
drivers/media/video/pvrusb2/pvrusb2-devattr.c
··· 117 117 static const struct pvr2_device_client_desc pvr2_cli_gotview_2[] = { 118 118 { .module_id = PVR2_CLIENT_ID_CX25840 }, 119 119 { .module_id = PVR2_CLIENT_ID_TUNER }, 120 + { .module_id = PVR2_CLIENT_ID_DEMOD }, 120 121 }; 121 122 122 123 static const struct pvr2_device_desc pvr2_device_gotview_2 = {
+5
drivers/media/video/pvrusb2/pvrusb2-devattr.h
··· 177 177 unsigned int flag_has_composite:1; /* Has composite input */ 178 178 unsigned int flag_has_svideo:1; /* Has s-video input */ 179 179 unsigned int flag_fx2_16kb:1; /* 16KB FX2 firmware OK here */ 180 + 181 + /* If this driver is considered experimental, i.e. not all aspects 182 + are working correctly and/or it is untested, mark that fact 183 + with this flag. */ 184 + unsigned int flag_is_experimental:1; 180 185 }; 181 186 182 187 extern struct usb_device_id pvr2_device_table[];
+30 -7
drivers/media/video/pvrusb2/pvrusb2-hdw.c
··· 2459 2459 hdw,hdw_desc->description); 2460 2460 pvr2_trace(PVR2_TRACE_INFO, "Hardware description: %s", 2461 2461 hdw_desc->description); 2462 + if (hdw_desc->flag_is_experimental) { 2463 + pvr2_trace(PVR2_TRACE_INFO, "**********"); 2464 + pvr2_trace(PVR2_TRACE_INFO, 2465 + "WARNING: Support for this device (%s) is" 2466 + " experimental.", hdw_desc->description); 2467 + pvr2_trace(PVR2_TRACE_INFO, 2468 + "Important functionality might not be" 2469 + " entirely working."); 2470 + pvr2_trace(PVR2_TRACE_INFO, 2471 + "Please consider contacting the driver author to" 2472 + " help with further stabilization of the driver."); 2473 + pvr2_trace(PVR2_TRACE_INFO, "**********"); 2474 + } 2462 2475 if (!hdw) goto fail; 2463 2476 2464 2477 init_timer(&hdw->quiescent_timer); ··· 3069 3056 } 3070 3057 3071 3058 if (hdw->res_hor_dirty || hdw->res_ver_dirty || hdw->force_dirty) { 3072 - struct v4l2_format fmt; 3059 + struct v4l2_mbus_framefmt fmt; 3073 3060 memset(&fmt, 0, sizeof(fmt)); 3074 - fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 3075 - fmt.fmt.pix.width = hdw->res_hor_val; 3076 - fmt.fmt.pix.height = hdw->res_ver_val; 3061 + fmt.width = hdw->res_hor_val; 3062 + fmt.height = hdw->res_ver_val; 3063 + fmt.code = V4L2_MBUS_FMT_FIXED; 3077 3064 pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_size(%dx%d)", 3078 - fmt.fmt.pix.width, fmt.fmt.pix.height); 3079 - v4l2_device_call_all(&hdw->v4l2_dev, 0, video, s_fmt, &fmt); 3065 + fmt.width, fmt.height); 3066 + v4l2_device_call_all(&hdw->v4l2_dev, 0, video, s_mbus_fmt, &fmt); 3080 3067 } 3081 3068 3082 3069 if (hdw->srate_dirty || hdw->force_dirty) { ··· 4097 4084 4098 4085 void pvr2_hdw_cpureset_assert(struct pvr2_hdw *hdw,int val) 4099 4086 { 4100 - char da[1]; 4087 + char *da; 4101 4088 unsigned int pipe; 4102 4089 int ret; 4103 4090 4104 4091 if (!hdw->usb_dev) return; 4092 + 4093 + da = kmalloc(16, GFP_KERNEL); 4094 + 4095 + if (da == NULL) { 4096 + pvr2_trace(PVR2_TRACE_ERROR_LEGS, 4097 + "Unable to allocate memory to control CPU reset"); 4098 + return; 4099 + } 4105 4100 4106 4101 pvr2_trace(PVR2_TRACE_INIT,"cpureset_assert(%d)",val); 4107 4102 ··· 4124 4103 "cpureset_assert(%d) error=%d",val,ret); 4125 4104 pvr2_hdw_render_useless(hdw); 4126 4105 } 4106 + 4107 + kfree(da); 4127 4108 } 4128 4109 4129 4110
+2 -2
drivers/media/video/pvrusb2/pvrusb2-main.c
··· 153 153 154 154 usb_deregister(&pvr_driver); 155 155 156 + pvr2_context_global_done(); 157 + 156 158 #ifdef CONFIG_VIDEO_PVRUSB2_SYSFS 157 159 pvr2_sysfs_class_destroy(class_ptr); 158 160 #endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */ 159 - 160 - pvr2_context_global_done(); 161 161 162 162 pvr2_trace(PVR2_TRACE_INIT,"pvr_exit complete"); 163 163 }
+10 -3
drivers/media/video/pvrusb2/pvrusb2-sysfs.c
··· 74 74 int ctl_id; 75 75 struct pvr2_sysfs *chptr; 76 76 struct pvr2_sysfs_ctl_item *item_next; 77 - struct attribute *attr_gen[7]; 77 + struct attribute *attr_gen[8]; 78 78 struct attribute_group grp; 79 79 int created_ok; 80 80 char name[80]; ··· 511 511 512 512 static void class_dev_destroy(struct pvr2_sysfs *sfp) 513 513 { 514 + struct device *dev; 514 515 if (!sfp->class_dev) return; 515 516 #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC 516 517 pvr2_sysfs_tear_down_debugifc(sfp); ··· 543 542 } 544 543 pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); 545 544 dev_set_drvdata(sfp->class_dev, NULL); 545 + dev = sfp->class_dev->parent; 546 + sfp->class_dev->parent = NULL; 547 + put_device(dev); 546 548 device_unregister(sfp->class_dev); 547 549 sfp->class_dev = NULL; 548 550 } ··· 635 631 pvr2_sysfs_trace("Creating class_dev id=%p",class_dev); 636 632 637 633 class_dev->class = &class_ptr->class; 634 + 638 635 dev_set_name(class_dev, "%s", 639 636 pvr2_hdw_get_device_identifier(sfp->channel.hdw)); 640 637 641 - class_dev->parent = &usb_dev->dev; 638 + class_dev->parent = get_device(&usb_dev->dev); 642 639 643 640 sfp->class_dev = class_dev; 644 641 dev_set_drvdata(class_dev, sfp); ··· 780 775 struct pvr2_sysfs_class *clp; 781 776 clp = kzalloc(sizeof(*clp),GFP_KERNEL); 782 777 if (!clp) return clp; 783 - pvr2_sysfs_trace("Creating pvr2_sysfs_class id=%p",clp); 778 + pvr2_sysfs_trace("Creating and registering pvr2_sysfs_class id=%p", 779 + clp); 784 780 clp->class.name = "pvrusb2"; 785 781 clp->class.class_release = pvr2_sysfs_class_release; 786 782 clp->class.dev_release = pvr2_sysfs_release; ··· 797 791 798 792 void pvr2_sysfs_class_destroy(struct pvr2_sysfs_class *clp) 799 793 { 794 + pvr2_sysfs_trace("Unregistering pvr2_sysfs_class id=%p", clp); 800 795 class_unregister(&clp->class); 801 796 } 802 797
+12 -3
drivers/media/video/pvrusb2/pvrusb2-v4l2.c
··· 883 883 { 884 884 struct pvr2_hdw *hdw = dip->v4lp->channel.mc_head->hdw; 885 885 enum pvr2_config cfg = dip->config; 886 + char msg[80]; 887 + unsigned int mcnt; 888 + 889 + /* Construct the unregistration message *before* we actually 890 + perform the unregistration step. By doing it this way we don't 891 + have to worry about potentially touching deleted resources. */ 892 + mcnt = scnprintf(msg, sizeof(msg) - 1, 893 + "pvrusb2: unregistered device %s [%s]", 894 + video_device_node_name(&dip->devbase), 895 + pvr2_config_get_name(cfg)); 896 + msg[mcnt] = 0; 886 897 887 898 pvr2_hdw_v4l_store_minor_number(hdw,dip->minor_type,-1); 888 899 ··· 905 894 are gone. */ 906 895 video_unregister_device(&dip->devbase); 907 896 908 - printk(KERN_INFO "pvrusb2: unregistered device %s [%s]\n", 909 - video_device_node_name(&dip->devbase), 910 - pvr2_config_get_name(cfg)); 897 + printk(KERN_INFO "%s\n", msg); 911 898 912 899 } 913 900
+2 -2
drivers/media/video/pxa_camera.c
··· 1247 1247 fmt->packing == SOC_MBUS_PACKING_EXTEND16); 1248 1248 } 1249 1249 1250 - static int pxa_camera_get_formats(struct soc_camera_device *icd, int idx, 1250 + static int pxa_camera_get_formats(struct soc_camera_device *icd, unsigned int idx, 1251 1251 struct soc_camera_format_xlate *xlate) 1252 1252 { 1253 1253 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); ··· 1264 1264 1265 1265 fmt = soc_mbus_get_fmtdesc(code); 1266 1266 if (!fmt) { 1267 - dev_err(dev, "Invalid format code #%d: %d\n", idx, code); 1267 + dev_err(dev, "Invalid format code #%u: %d\n", idx, code); 1268 1268 return 0; 1269 1269 } 1270 1270
+2 -2
drivers/media/video/rj54n1cb0c.c
··· 481 481 return 0; 482 482 } 483 483 484 - static int rj54n1_enum_fmt(struct v4l2_subdev *sd, int index, 484 + static int rj54n1_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 485 485 enum v4l2_mbus_pixelcode *code) 486 486 { 487 - if ((unsigned int)index >= ARRAY_SIZE(rj54n1_colour_fmts)) 487 + if (index >= ARRAY_SIZE(rj54n1_colour_fmts)) 488 488 return -EINVAL; 489 489 490 490 *code = rj54n1_colour_fmts[index].code;
+6 -13
drivers/media/video/saa7115.c
··· 1117 1117 return 0; 1118 1118 } 1119 1119 1120 - static int saa711x_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 1121 - { 1122 - if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) 1123 - return -EINVAL; 1124 - return saa711x_g_sliced_fmt(sd, &fmt->fmt.sliced); 1125 - } 1126 - 1127 1120 static int saa711x_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) 1128 1121 { 1129 1122 saa711x_set_lcr(sd, NULL); ··· 1129 1136 return 0; 1130 1137 } 1131 1138 1132 - static int saa711x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 1139 + static int saa711x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 1133 1140 { 1134 - if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1141 + if (fmt->code != V4L2_MBUS_FMT_FIXED) 1135 1142 return -EINVAL; 1136 - 1137 - return saa711x_set_size(sd, fmt->fmt.pix.width, fmt->fmt.pix.height); 1143 + fmt->field = V4L2_FIELD_INTERLACED; 1144 + fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; 1145 + return saa711x_set_size(sd, fmt->width, fmt->height); 1138 1146 } 1139 1147 1140 1148 /* Decode the sliced VBI data stream as created by the saa7115. ··· 1550 1556 static const struct v4l2_subdev_video_ops saa711x_video_ops = { 1551 1557 .s_routing = saa711x_s_routing, 1552 1558 .s_crystal_freq = saa711x_s_crystal_freq, 1553 - .g_fmt = saa711x_g_fmt, 1554 - .s_fmt = saa711x_s_fmt, 1559 + .s_mbus_fmt = saa711x_s_mbus_fmt, 1555 1560 .s_stream = saa711x_s_stream, 1556 1561 .querystd = saa711x_querystd, 1557 1562 .g_input_status = saa711x_g_input_status,
-8
drivers/media/video/saa7127.c
··· 645 645 return 0; 646 646 } 647 647 648 - static int saa7127_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 649 - { 650 - if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) 651 - return -EINVAL; 652 - return saa7127_g_sliced_fmt(sd, &fmt->fmt.sliced); 653 - } 654 - 655 648 static int saa7127_s_vbi_data(struct v4l2_subdev *sd, const struct v4l2_sliced_vbi_data *data) 656 649 { 657 650 switch (data->id) { ··· 724 731 }; 725 732 726 733 static const struct v4l2_subdev_video_ops saa7127_video_ops = { 727 - .g_fmt = saa7127_g_fmt, 728 734 .s_std_output = saa7127_s_std_output, 729 735 .s_routing = saa7127_s_routing, 730 736 .s_stream = saa7127_s_stream,
+26 -20
drivers/media/video/saa7134/saa6752hs.c
··· 846 846 return 0; 847 847 } 848 848 849 - static int saa6752hs_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *f) 849 + static int saa6752hs_g_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) 850 850 { 851 851 struct saa6752hs_state *h = to_state(sd); 852 852 853 853 if (h->video_format == SAA6752HS_VF_UNKNOWN) 854 854 h->video_format = SAA6752HS_VF_D1; 855 - f->fmt.pix.width = 856 - v4l2_format_table[h->video_format].fmt.pix.width; 857 - f->fmt.pix.height = 858 - v4l2_format_table[h->video_format].fmt.pix.height; 855 + f->width = v4l2_format_table[h->video_format].fmt.pix.width; 856 + f->height = v4l2_format_table[h->video_format].fmt.pix.height; 857 + f->code = V4L2_MBUS_FMT_FIXED; 858 + f->field = V4L2_FIELD_INTERLACED; 859 + f->colorspace = V4L2_COLORSPACE_SMPTE170M; 859 860 return 0; 860 861 } 861 862 862 - static int saa6752hs_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f) 863 + static int saa6752hs_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *f) 863 864 { 864 865 struct saa6752hs_state *h = to_state(sd); 865 866 int dist_352, dist_480, dist_720; 867 + 868 + if (f->code != V4L2_MBUS_FMT_FIXED) 869 + return -EINVAL; 866 870 867 871 /* 868 872 FIXME: translate and round width/height into EMPRESS ··· 880 876 D1 | 720x576 | 720x480 881 877 */ 882 878 883 - dist_352 = abs(f->fmt.pix.width - 352); 884 - dist_480 = abs(f->fmt.pix.width - 480); 885 - dist_720 = abs(f->fmt.pix.width - 720); 879 + dist_352 = abs(f->width - 352); 880 + dist_480 = abs(f->width - 480); 881 + dist_720 = abs(f->width - 720); 886 882 if (dist_720 < dist_480) { 887 - f->fmt.pix.width = 720; 888 - f->fmt.pix.height = 576; 883 + f->width = 720; 884 + f->height = 576; 889 885 h->video_format = SAA6752HS_VF_D1; 890 886 } else if (dist_480 < dist_352) { 891 - f->fmt.pix.width = 480; 892 - f->fmt.pix.height = 576; 887 + f->width = 480; 888 + f->height = 576; 893 889 h->video_format = SAA6752HS_VF_2_3_D1; 894 890 } else { 895 - f->fmt.pix.width = 352; 896 - if (abs(f->fmt.pix.height - 576) < 897 - abs(f->fmt.pix.height - 288)) { 898 - f->fmt.pix.height = 576; 891 + f->width = 352; 892 + if (abs(f->height - 576) < 893 + abs(f->height - 288)) { 894 + f->height = 576; 899 895 h->video_format = SAA6752HS_VF_1_2_D1; 900 896 } else { 901 - f->fmt.pix.height = 288; 897 + f->height = 288; 902 898 h->video_format = SAA6752HS_VF_SIF; 903 899 } 904 900 } 901 + f->field = V4L2_FIELD_INTERLACED; 902 + f->colorspace = V4L2_COLORSPACE_SMPTE170M; 905 903 return 0; 906 904 } 907 905 ··· 938 932 }; 939 933 940 934 static const struct v4l2_subdev_video_ops saa6752hs_video_ops = { 941 - .s_fmt = saa6752hs_s_fmt, 942 - .g_fmt = saa6752hs_g_fmt, 935 + .s_mbus_fmt = saa6752hs_s_mbus_fmt, 936 + .g_mbus_fmt = saa6752hs_g_mbus_fmt, 943 937 }; 944 938 945 939 static const struct v4l2_subdev_ops saa6752hs_ops = {
+55
drivers/media/video/saa7134/saa7134-cards.c
··· 3897 3897 .gpio = 0x01, 3898 3898 }, 3899 3899 }, 3900 + [SAA7134_BOARD_AVERMEDIA_M733A] = { 3901 + .name = "Avermedia PCI M733A", 3902 + .audio_clock = 0x00187de7, 3903 + .tuner_type = TUNER_PHILIPS_TDA8290, 3904 + .radio_type = UNSET, 3905 + .tuner_addr = ADDR_UNSET, 3906 + .radio_addr = ADDR_UNSET, 3907 + .tuner_config = 0, 3908 + .gpiomask = 0x020200000, 3909 + .inputs = {{ 3910 + .name = name_tv, 3911 + .vmux = 1, 3912 + .amux = TV, 3913 + .tv = 1, 3914 + }, { 3915 + .name = name_comp1, 3916 + .vmux = 3, 3917 + .amux = LINE1, 3918 + }, { 3919 + .name = name_svideo, 3920 + .vmux = 8, 3921 + .amux = LINE1, 3922 + } }, 3923 + .radio = { 3924 + .name = name_radio, 3925 + .amux = TV, 3926 + .gpio = 0x00200000, 3927 + }, 3928 + .mute = { 3929 + .name = name_mute, 3930 + .amux = TV, 3931 + .gpio = 0x01, 3932 + }, 3933 + }, 3900 3934 [SAA7134_BOARD_BEHOLD_401] = { 3901 3935 /* Beholder Intl. Ltd. 2008 */ 3902 3936 /*Dmitry Belimov <d.belimov@gmail.com> */ ··· 5856 5822 .driver_data = SAA7134_BOARD_AVERMEDIA_M135A, 5857 5823 }, { 5858 5824 .vendor = PCI_VENDOR_ID_PHILIPS, 5825 + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 5826 + .subvendor = 0x1461, /* Avermedia Technologies Inc */ 5827 + .subdevice = 0x4155, 5828 + .driver_data = SAA7134_BOARD_AVERMEDIA_M733A, 5829 + }, { 5830 + .vendor = PCI_VENDOR_ID_PHILIPS, 5831 + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 5832 + .subvendor = 0x1461, /* Avermedia Technologies Inc */ 5833 + .subdevice = 0x4255, 5834 + .driver_data = SAA7134_BOARD_AVERMEDIA_M733A, 5835 + }, { 5836 + .vendor = PCI_VENDOR_ID_PHILIPS, 5859 5837 .device = PCI_DEVICE_ID_PHILIPS_SAA7130, 5860 5838 .subvendor = PCI_VENDOR_ID_PHILIPS, 5861 5839 .subdevice = 0x2004, ··· 6832 6786 switch (dev->board) { 6833 6787 case SAA7134_BOARD_HAUPPAUGE_HVR1150: 6834 6788 case SAA7134_BOARD_HAUPPAUGE_HVR1120: 6789 + case SAA7134_BOARD_AVERMEDIA_M733A: 6835 6790 /* tda8290 + tda18271 */ 6836 6791 ret = saa7134_tda8290_18271_callback(dev, command, arg); 6837 6792 break; ··· 7133 7086 dev->has_remote = SAA7134_REMOTE_GPIO; 7134 7087 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x0000C000, 0x0000C000); 7135 7088 saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x0000C000, 0x0000C000); 7089 + break; 7090 + case SAA7134_BOARD_AVERMEDIA_M733A: 7091 + saa7134_set_gpio(dev, 1, 1); 7092 + msleep(10); 7093 + saa7134_set_gpio(dev, 1, 0); 7094 + msleep(10); 7095 + saa7134_set_gpio(dev, 1, 1); 7096 + dev->has_remote = SAA7134_REMOTE_GPIO; 7136 7097 break; 7137 7098 } 7138 7099 return 0;
+7 -2
drivers/media/video/saa7134/saa7134-empress.c
··· 223 223 struct v4l2_format *f) 224 224 { 225 225 struct saa7134_dev *dev = file->private_data; 226 + struct v4l2_mbus_framefmt mbus_fmt; 226 227 227 - saa_call_all(dev, video, g_fmt, f); 228 + saa_call_all(dev, video, g_mbus_fmt, &mbus_fmt); 228 229 230 + v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt); 229 231 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; 230 232 f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets; 231 233 ··· 238 236 struct v4l2_format *f) 239 237 { 240 238 struct saa7134_dev *dev = file->private_data; 239 + struct v4l2_mbus_framefmt mbus_fmt; 241 240 242 - saa_call_all(dev, video, s_fmt, f); 241 + v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, V4L2_MBUS_FMT_FIXED); 242 + saa_call_all(dev, video, s_mbus_fmt, &mbus_fmt); 243 + v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt); 243 244 244 245 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; 245 246 f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets;
+12 -6
drivers/media/video/saa7134/saa7134-input.c
··· 141 141 struct saa7134_dev *dev = ir->c->adapter->algo_data; 142 142 143 143 if (dev == NULL) { 144 - dprintk("get_key_flydvb_trio: " 145 - "gir->c->adapter->algo_data is NULL!\n"); 144 + i2cdprintk("get_key_flydvb_trio: " 145 + "ir->c->adapter->algo_data is NULL!\n"); 146 146 return -EIO; 147 147 } 148 148 ··· 195 195 /* <dev> is needed to access GPIO. Used by the saa_readl macro. */ 196 196 struct saa7134_dev *dev = ir->c->adapter->algo_data; 197 197 if (dev == NULL) { 198 - dprintk("get_key_msi_tvanywhere_plus: " 199 - "gir->c->adapter->algo_data is NULL!\n"); 198 + i2cdprintk("get_key_msi_tvanywhere_plus: " 199 + "ir->c->adapter->algo_data is NULL!\n"); 200 200 return -EIO; 201 201 } 202 202 ··· 657 657 saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); 658 658 break; 659 659 case SAA7134_BOARD_AVERMEDIA_M135A: 660 - ir_codes = RC_MAP_AVERMEDIA_M135A_RM_JX; 660 + ir_codes = RC_MAP_AVERMEDIA_M135A; 661 661 mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */ 662 + mask_keyup = 0x0040000; 663 + mask_keycode = 0xffff; 664 + raw_decode = 1; 665 + break; 666 + case SAA7134_BOARD_AVERMEDIA_M733A: 667 + ir_codes = RC_MAP_AVERMEDIA_M733A_RM_K6; 668 + mask_keydown = 0x0040000; 662 669 mask_keyup = 0x0040000; 663 670 mask_keycode = 0xffff; 664 671 raw_decode = 1; ··· 822 815 mask_keyup = 0x020000; 823 816 polling = 50; /* ms */ 824 817 break; 825 - break; 826 818 } 827 819 if (NULL == ir_codes) { 828 820 printk("%s: Oops: IR config error [card=%d]\n",
+1
drivers/media/video/saa7134/saa7134.h
··· 303 303 #define SAA7134_BOARD_HAWELL_HW_404M7 177 304 304 #define SAA7134_BOARD_BEHOLD_H7 178 305 305 #define SAA7134_BOARD_BEHOLD_A7 179 306 + #define SAA7134_BOARD_AVERMEDIA_M733A 180 306 307 307 308 #define SAA7134_MAXBOARDS 32 308 309 #define SAA7134_INPUT_MAX 8
+21 -17
drivers/media/video/saa717x.c
··· 1199 1199 } 1200 1200 #endif 1201 1201 1202 - static int saa717x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 1202 + static int saa717x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt) 1203 1203 { 1204 - struct v4l2_pix_format *pix; 1205 1204 int prescale, h_scale, v_scale; 1206 1205 1207 - pix = &fmt->fmt.pix; 1208 1206 v4l2_dbg(1, debug, sd, "decoder set size\n"); 1209 1207 1208 + if (fmt->code != V4L2_MBUS_FMT_FIXED) 1209 + return -EINVAL; 1210 + 1210 1211 /* FIXME need better bounds checking here */ 1211 - if (pix->width < 1 || pix->width > 1440) 1212 + if (fmt->width < 1 || fmt->width > 1440) 1212 1213 return -EINVAL; 1213 - if (pix->height < 1 || pix->height > 960) 1214 + if (fmt->height < 1 || fmt->height > 960) 1214 1215 return -EINVAL; 1216 + 1217 + fmt->field = V4L2_FIELD_INTERLACED; 1218 + fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; 1215 1219 1216 1220 /* scaling setting */ 1217 1221 /* NTSC and interlace only */ 1218 - prescale = SAA717X_NTSC_WIDTH / pix->width; 1222 + prescale = SAA717X_NTSC_WIDTH / fmt->width; 1219 1223 if (prescale == 0) 1220 1224 prescale = 1; 1221 - h_scale = 1024 * SAA717X_NTSC_WIDTH / prescale / pix->width; 1225 + h_scale = 1024 * SAA717X_NTSC_WIDTH / prescale / fmt->width; 1222 1226 /* interlace */ 1223 - v_scale = 512 * 2 * SAA717X_NTSC_HEIGHT / pix->height; 1227 + v_scale = 512 * 2 * SAA717X_NTSC_HEIGHT / fmt->height; 1224 1228 1225 1229 /* Horizontal prescaling etc */ 1226 1230 set_h_prescale(sd, 0, prescale); ··· 1245 1241 /* set video output size */ 1246 1242 /* video number of pixels at output */ 1247 1243 /* TASK A */ 1248 - saa717x_write(sd, 0x5C, (u8)(pix->width & 0xFF)); 1249 - saa717x_write(sd, 0x5D, (u8)((pix->width >> 8) & 0xFF)); 1244 + saa717x_write(sd, 0x5C, (u8)(fmt->width & 0xFF)); 1245 + saa717x_write(sd, 0x5D, (u8)((fmt->width >> 8) & 0xFF)); 1250 1246 /* TASK B */ 1251 - saa717x_write(sd, 0x9C, (u8)(pix->width & 0xFF)); 1252 - saa717x_write(sd, 0x9D, (u8)((pix->width >> 8) & 0xFF)); 1247 + saa717x_write(sd, 0x9C, (u8)(fmt->width & 0xFF)); 1248 + saa717x_write(sd, 0x9D, (u8)((fmt->width >> 8) & 0xFF)); 1253 1249 1254 1250 /* video number of lines at output */ 1255 1251 /* TASK A */ 1256 - saa717x_write(sd, 0x5E, (u8)(pix->height & 0xFF)); 1257 - saa717x_write(sd, 0x5F, (u8)((pix->height >> 8) & 0xFF)); 1252 + saa717x_write(sd, 0x5E, (u8)(fmt->height & 0xFF)); 1253 + saa717x_write(sd, 0x5F, (u8)((fmt->height >> 8) & 0xFF)); 1258 1254 /* TASK B */ 1259 - saa717x_write(sd, 0x9E, (u8)(pix->height & 0xFF)); 1260 - saa717x_write(sd, 0x9F, (u8)((pix->height >> 8) & 0xFF)); 1255 + saa717x_write(sd, 0x9E, (u8)(fmt->height & 0xFF)); 1256 + saa717x_write(sd, 0x9F, (u8)((fmt->height >> 8) & 0xFF)); 1261 1257 return 0; 1262 1258 } 1263 1259 ··· 1407 1403 1408 1404 static const struct v4l2_subdev_video_ops saa717x_video_ops = { 1409 1405 .s_routing = saa717x_s_video_routing, 1410 - .s_fmt = saa717x_s_fmt, 1406 + .s_mbus_fmt = saa717x_s_mbus_fmt, 1411 1407 .s_stream = saa717x_s_stream, 1412 1408 }; 1413 1409
+2 -2
drivers/media/video/sh_mobile_ceu_camera.c
··· 878 878 879 879 static int client_g_rect(struct v4l2_subdev *sd, struct v4l2_rect *rect); 880 880 881 - static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, int idx, 881 + static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int idx, 882 882 struct soc_camera_format_xlate *xlate) 883 883 { 884 884 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); ··· 897 897 fmt = soc_mbus_get_fmtdesc(code); 898 898 if (!fmt) { 899 899 dev_err(icd->dev.parent, 900 - "Invalid format code #%d: %d\n", idx, code); 900 + "Invalid format code #%u: %d\n", idx, code); 901 901 return -EINVAL; 902 902 } 903 903
+1 -1
drivers/media/video/sn9c102/sn9c102_devtable.h
··· 62 62 #if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE 63 63 { SN9C102_USB_DEVICE(0x0c45, 0x602c, BRIDGE_SN9C102), }, 64 64 /* { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, HV7131R */ 65 - #endif 66 65 { SN9C102_USB_DEVICE(0x0c45, 0x602e, BRIDGE_SN9C102), }, 66 + #endif 67 67 { SN9C102_USB_DEVICE(0x0c45, 0x6030, BRIDGE_SN9C102), }, 68 68 /* SN9C103 */ 69 69 { SN9C102_USB_DEVICE(0x0c45, 0x6080, BRIDGE_SN9C103), },
+2 -1
drivers/media/video/soc_camera.c
··· 200 200 { 201 201 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 202 202 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 203 - int i, fmts = 0, raw_fmts = 0, ret; 203 + unsigned int i, fmts = 0, raw_fmts = 0; 204 + int ret; 204 205 enum v4l2_mbus_pixelcode code; 205 206 206 207 while (!v4l2_subdev_call(sd, video, enum_mbus_fmt, raw_fmts, &code))
+1 -1
drivers/media/video/soc_camera_platform.c
··· 71 71 72 72 static struct v4l2_subdev_core_ops platform_subdev_core_ops; 73 73 74 - static int soc_camera_platform_enum_fmt(struct v4l2_subdev *sd, int index, 74 + static int soc_camera_platform_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 75 75 enum v4l2_mbus_pixelcode *code) 76 76 { 77 77 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
+40 -183
drivers/media/video/tvp514x.c
··· 88 88 * @pdata: Board specific 89 89 * @ver: Chip version 90 90 * @streaming: TVP5146/47 decoder streaming - enabled or disabled. 91 - * @pix: Current pixel format 92 - * @num_fmts: Number of formats 93 - * @fmt_list: Format list 94 91 * @current_std: Current standard 95 92 * @num_stds: Number of standards 96 93 * @std_list: Standards list ··· 102 105 int ver; 103 106 int streaming; 104 107 105 - struct v4l2_pix_format pix; 106 - int num_fmts; 107 - const struct v4l2_fmtdesc *fmt_list; 108 - 109 108 enum tvp514x_std current_std; 110 109 int num_stds; 111 - struct tvp514x_std_info *std_list; 110 + const struct tvp514x_std_info *std_list; 112 111 /* Input and Output Routing parameters */ 113 112 u32 input; 114 113 u32 output; ··· 196 203 }; 197 204 198 205 /** 199 - * List of image formats supported by TVP5146/47 decoder 200 - * Currently we are using 8 bit mode only, but can be 201 - * extended to 10/20 bit mode. 202 - */ 203 - static const struct v4l2_fmtdesc tvp514x_fmt_list[] = { 204 - { 205 - .index = 0, 206 - .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, 207 - .flags = 0, 208 - .description = "8-bit UYVY 4:2:2 Format", 209 - .pixelformat = V4L2_PIX_FMT_UYVY, 210 - }, 211 - }; 212 - 213 - /** 214 206 * Supported standards - 215 207 * 216 208 * Currently supports two standards only, need to add support for rest of the 217 209 * modes, like SECAM, etc... 218 210 */ 219 - static struct tvp514x_std_info tvp514x_std_list[] = { 211 + static const struct tvp514x_std_info tvp514x_std_list[] = { 220 212 /* Standard: STD_NTSC_MJ */ 221 213 [STD_NTSC_MJ] = { 222 214 .width = NTSC_NUM_ACTIVE_PIXELS, ··· 344 366 } 345 367 346 368 /** 347 - * tvp514x_get_current_std() : Get the current standard detected by TVP5146/47 369 + * tvp514x_query_current_std() : Query the current standard detected by TVP5146/47 348 370 * @sd: ptr to v4l2_subdev struct 349 371 * 350 - * Get current standard detected by TVP5146/47, STD_INVALID if there is no 372 + * Returns the current standard detected by TVP5146/47, STD_INVALID if there is no 351 373 * standard detected. 352 374 */ 353 - static enum tvp514x_std tvp514x_get_current_std(struct v4l2_subdev *sd) 375 + static enum tvp514x_std tvp514x_query_current_std(struct v4l2_subdev *sd) 354 376 { 355 377 u8 std, std_status; 356 378 ··· 496 518 * @std_id: standard V4L2 std_id ioctl enum 497 519 * 498 520 * Returns the current standard detected by TVP5146/47. If no active input is 499 - * detected, returns -EINVAL 521 + * detected then *std_id is set to 0 and the function returns 0. 500 522 */ 501 523 static int tvp514x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std_id) 502 524 { ··· 508 530 if (std_id == NULL) 509 531 return -EINVAL; 510 532 511 - /* get the current standard */ 512 - current_std = tvp514x_get_current_std(sd); 533 + *std_id = V4L2_STD_UNKNOWN; 534 + 535 + /* query the current standard */ 536 + current_std = tvp514x_query_current_std(sd); 513 537 if (current_std == STD_INVALID) 514 - return -EINVAL; 538 + return 0; 515 539 516 540 input_sel = decoder->input; 517 541 ··· 555 575 /* check whether signal is locked */ 556 576 sync_lock_status = tvp514x_read_reg(sd, REG_STATUS1); 557 577 if (lock_mask != (sync_lock_status & lock_mask)) 558 - return -EINVAL; /* No input detected */ 578 + return 0; /* No input detected */ 559 579 560 - decoder->current_std = current_std; 561 580 *std_id = decoder->std_list[current_std].standard.id; 562 581 563 - v4l2_dbg(1, debug, sd, "Current STD: %s", 582 + v4l2_dbg(1, debug, sd, "Current STD: %s\n", 564 583 decoder->std_list[current_std].standard.name); 565 584 return 0; 566 585 } ··· 593 614 decoder->tvp514x_regs[REG_VIDEO_STD].val = 594 615 decoder->std_list[i].video_std; 595 616 596 - v4l2_dbg(1, debug, sd, "Standard set to: %s", 617 + v4l2_dbg(1, debug, sd, "Standard set to: %s\n", 597 618 decoder->std_list[i].standard.name); 598 619 return 0; 599 620 } ··· 616 637 int err; 617 638 enum tvp514x_input input_sel; 618 639 enum tvp514x_output output_sel; 619 - enum tvp514x_std current_std = STD_INVALID; 620 640 u8 sync_lock_status, lock_mask; 621 641 int try_count = LOCK_RETRY_COUNT; 622 642 ··· 699 721 /* Allow decoder to sync up with new input */ 700 722 msleep(LOCK_RETRY_DELAY); 701 723 702 - /* get the current standard for future reference */ 703 - current_std = tvp514x_get_current_std(sd); 704 - if (current_std == STD_INVALID) 705 - continue; 706 - 707 724 sync_lock_status = tvp514x_read_reg(sd, 708 725 REG_STATUS1); 709 726 if (lock_mask == (sync_lock_status & lock_mask)) ··· 706 733 break; 707 734 } 708 735 709 - if ((current_std == STD_INVALID) || (try_count < 0)) 736 + if (try_count < 0) 710 737 return -EINVAL; 711 738 712 - decoder->current_std = current_std; 713 739 decoder->input = input; 714 740 decoder->output = output; 715 741 716 - v4l2_dbg(1, debug, sd, "Input set to: %d, std : %d", 717 - input_sel, current_std); 742 + v4l2_dbg(1, debug, sd, "Input set to: %d\n", input_sel); 718 743 719 744 return 0; 720 745 } ··· 765 794 return err; 766 795 } 767 796 768 - v4l2_dbg(1, debug, sd, "Query Control:%s: Min - %d, Max - %d, Def - %d", 797 + v4l2_dbg(1, debug, sd, "Query Control:%s: Min - %d, Max - %d, Def - %d\n", 769 798 qctrl->name, qctrl->minimum, qctrl->maximum, 770 799 qctrl->default_value); 771 800 ··· 822 851 return -EINVAL; 823 852 } 824 853 825 - v4l2_dbg(1, debug, sd, "Get Control: ID - %d - %d", 854 + v4l2_dbg(1, debug, sd, "Get Control: ID - %d - %d\n", 826 855 ctrl->id, ctrl->value); 827 856 return 0; 828 857 } ··· 922 951 return err; 923 952 } 924 953 925 - v4l2_dbg(1, debug, sd, "Set Control: ID - %d - %d", 954 + v4l2_dbg(1, debug, sd, "Set Control: ID - %d - %d\n", 926 955 ctrl->id, ctrl->value); 927 956 928 957 return err; ··· 938 967 static int 939 968 tvp514x_enum_fmt_cap(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt) 940 969 { 941 - struct tvp514x_decoder *decoder = to_decoder(sd); 942 - int index; 943 - 944 - if (fmt == NULL) 945 - return -EINVAL; 946 - 947 - index = fmt->index; 948 - if ((index >= decoder->num_fmts) || (index < 0)) 949 - /* Index out of bound */ 970 + if (fmt == NULL || fmt->index) 950 971 return -EINVAL; 951 972 952 973 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 953 974 /* only capture is supported */ 954 975 return -EINVAL; 955 976 956 - memcpy(fmt, &decoder->fmt_list[index], 957 - sizeof(struct v4l2_fmtdesc)); 958 - 959 - v4l2_dbg(1, debug, sd, "Current FMT: index - %d (%s)", 960 - decoder->fmt_list[index].index, 961 - decoder->fmt_list[index].description); 977 + /* only one format */ 978 + fmt->flags = 0; 979 + strlcpy(fmt->description, "8-bit UYVY 4:2:2 Format", 980 + sizeof(fmt->description)); 981 + fmt->pixelformat = V4L2_PIX_FMT_UYVY; 962 982 return 0; 963 983 } 964 984 965 985 /** 966 - * tvp514x_try_fmt_cap() - V4L2 decoder interface handler for try_fmt 986 + * tvp514x_fmt_cap() - V4L2 decoder interface handler for try/s/g_fmt 967 987 * @sd: pointer to standard V4L2 sub-device structure 968 988 * @f: pointer to standard V4L2 VIDIOC_TRY_FMT ioctl structure 969 989 * 970 - * Implement the VIDIOC_TRY_FMT ioctl for the CAPTURE buffer type. This 971 - * ioctl is used to negotiate the image capture size and pixel format 972 - * without actually making it take effect. 990 + * Implement the VIDIOC_TRY/S/G_FMT ioctl for the CAPTURE buffer type. This 991 + * ioctl is used to negotiate the image capture size and pixel format. 973 992 */ 974 993 static int 975 - tvp514x_try_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f) 994 + tvp514x_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f) 976 995 { 977 996 struct tvp514x_decoder *decoder = to_decoder(sd); 978 - int ifmt; 979 997 struct v4l2_pix_format *pix; 980 998 enum tvp514x_std current_std; 981 999 ··· 972 1012 return -EINVAL; 973 1013 974 1014 if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 975 - /* only capture is supported */ 976 - f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1015 + return -EINVAL; 977 1016 978 1017 pix = &f->fmt.pix; 979 1018 980 1019 /* Calculate height and width based on current standard */ 981 - current_std = tvp514x_get_current_std(sd); 982 - if (current_std == STD_INVALID) 983 - return -EINVAL; 1020 + current_std = decoder->current_std; 984 1021 985 - decoder->current_std = current_std; 1022 + pix->pixelformat = V4L2_PIX_FMT_UYVY; 986 1023 pix->width = decoder->std_list[current_std].width; 987 1024 pix->height = decoder->std_list[current_std].height; 988 - 989 - for (ifmt = 0; ifmt < decoder->num_fmts; ifmt++) { 990 - if (pix->pixelformat == 991 - decoder->fmt_list[ifmt].pixelformat) 992 - break; 993 - } 994 - if (ifmt == decoder->num_fmts) 995 - /* None of the format matched, select default */ 996 - ifmt = 0; 997 - pix->pixelformat = decoder->fmt_list[ifmt].pixelformat; 998 - 999 1025 pix->field = V4L2_FIELD_INTERLACED; 1000 1026 pix->bytesperline = pix->width * 2; 1001 1027 pix->sizeimage = pix->bytesperline * pix->height; 1002 1028 pix->colorspace = V4L2_COLORSPACE_SMPTE170M; 1003 1029 pix->priv = 0; 1004 1030 1005 - v4l2_dbg(1, debug, sd, "Try FMT: pixelformat - %s, bytesperline - %d" 1006 - "Width - %d, Height - %d", 1007 - decoder->fmt_list[ifmt].description, pix->bytesperline, 1031 + v4l2_dbg(1, debug, sd, "FMT: bytesperline - %d" 1032 + "Width - %d, Height - %d\n", 1033 + pix->bytesperline, 1008 1034 pix->width, pix->height); 1009 - return 0; 1010 - } 1011 - 1012 - /** 1013 - * tvp514x_s_fmt_cap() - V4L2 decoder interface handler for s_fmt 1014 - * @sd: pointer to standard V4L2 sub-device structure 1015 - * @f: pointer to standard V4L2 VIDIOC_S_FMT ioctl structure 1016 - * 1017 - * If the requested format is supported, configures the HW to use that 1018 - * format, returns error code if format not supported or HW can't be 1019 - * correctly configured. 1020 - */ 1021 - static int 1022 - tvp514x_s_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f) 1023 - { 1024 - struct tvp514x_decoder *decoder = to_decoder(sd); 1025 - struct v4l2_pix_format *pix; 1026 - int rval; 1027 - 1028 - if (f == NULL) 1029 - return -EINVAL; 1030 - 1031 - if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1032 - /* only capture is supported */ 1033 - return -EINVAL; 1034 - 1035 - pix = &f->fmt.pix; 1036 - rval = tvp514x_try_fmt_cap(sd, f); 1037 - if (rval) 1038 - return rval; 1039 - 1040 - decoder->pix = *pix; 1041 - 1042 - return rval; 1043 - } 1044 - 1045 - /** 1046 - * tvp514x_g_fmt_cap() - V4L2 decoder interface handler for tvp514x_g_fmt_cap 1047 - * @sd: pointer to standard V4L2 sub-device structure 1048 - * @f: pointer to standard V4L2 v4l2_format structure 1049 - * 1050 - * Returns the decoder's current pixel format in the v4l2_format 1051 - * parameter. 1052 - */ 1053 - static int 1054 - tvp514x_g_fmt_cap(struct v4l2_subdev *sd, struct v4l2_format *f) 1055 - { 1056 - struct tvp514x_decoder *decoder = to_decoder(sd); 1057 - 1058 - if (f == NULL) 1059 - return -EINVAL; 1060 - 1061 - if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1062 - /* only capture is supported */ 1063 - return -EINVAL; 1064 - 1065 - f->fmt.pix = decoder->pix; 1066 - 1067 - v4l2_dbg(1, debug, sd, "Current FMT: bytesperline - %d" 1068 - "Width - %d, Height - %d", 1069 - decoder->pix.bytesperline, 1070 - decoder->pix.width, decoder->pix.height); 1071 1035 return 0; 1072 1036 } 1073 1037 ··· 1016 1132 /* only capture is supported */ 1017 1133 return -EINVAL; 1018 1134 1019 - memset(a, 0, sizeof(*a)); 1020 - a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1021 - 1022 1135 /* get the current standard */ 1023 - current_std = tvp514x_get_current_std(sd); 1024 - if (current_std == STD_INVALID) 1025 - return -EINVAL; 1026 - 1027 - decoder->current_std = current_std; 1136 + current_std = decoder->current_std; 1028 1137 1029 1138 cparm = &a->parm.capture; 1030 1139 cparm->capability = V4L2_CAP_TIMEPERFRAME; ··· 1052 1175 timeperframe = &a->parm.capture.timeperframe; 1053 1176 1054 1177 /* get the current standard */ 1055 - current_std = tvp514x_get_current_std(sd); 1056 - if (current_std == STD_INVALID) 1057 - return -EINVAL; 1058 - 1059 - decoder->current_std = current_std; 1178 + current_std = decoder->current_std; 1060 1179 1061 1180 *timeperframe = 1062 1181 decoder->std_list[current_std].standard.frameperiod; ··· 1132 1259 .s_routing = tvp514x_s_routing, 1133 1260 .querystd = tvp514x_querystd, 1134 1261 .enum_fmt = tvp514x_enum_fmt_cap, 1135 - .g_fmt = tvp514x_g_fmt_cap, 1136 - .try_fmt = tvp514x_try_fmt_cap, 1137 - .s_fmt = tvp514x_s_fmt_cap, 1262 + .g_fmt = tvp514x_fmt_cap, 1263 + .try_fmt = tvp514x_fmt_cap, 1264 + .s_fmt = tvp514x_fmt_cap, 1138 1265 .g_parm = tvp514x_g_parm, 1139 1266 .s_parm = tvp514x_s_parm, 1140 1267 .s_stream = tvp514x_s_stream, ··· 1147 1274 1148 1275 static struct tvp514x_decoder tvp514x_dev = { 1149 1276 .streaming = 0, 1150 - 1151 - .fmt_list = tvp514x_fmt_list, 1152 - .num_fmts = ARRAY_SIZE(tvp514x_fmt_list), 1153 - 1154 - .pix = { 1155 - /* Default to NTSC 8-bit YUV 422 */ 1156 - .width = NTSC_NUM_ACTIVE_PIXELS, 1157 - .height = NTSC_NUM_ACTIVE_LINES, 1158 - .pixelformat = V4L2_PIX_FMT_UYVY, 1159 - .field = V4L2_FIELD_INTERLACED, 1160 - .bytesperline = NTSC_NUM_ACTIVE_PIXELS * 2, 1161 - .sizeimage = 1162 - NTSC_NUM_ACTIVE_PIXELS * 2 * NTSC_NUM_ACTIVE_LINES, 1163 - .colorspace = V4L2_COLORSPACE_SMPTE170M, 1164 - }, 1165 - 1166 1277 .current_std = STD_NTSC_MJ, 1167 1278 .std_list = tvp514x_std_list, 1168 1279 .num_stds = ARRAY_SIZE(tvp514x_std_list),
-20
drivers/media/video/tvp5150.c
··· 934 934 return 0; 935 935 } 936 936 937 - static int tvp5150_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 938 - { 939 - switch (fmt->type) { 940 - case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: 941 - return tvp5150_s_sliced_fmt(sd, &fmt->fmt.sliced); 942 - 943 - default: 944 - return -EINVAL; 945 - } 946 - } 947 - 948 937 static int tvp5150_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) 949 938 { 950 939 int i, mask = 0; ··· 947 958 } 948 959 svbi->service_set = mask; 949 960 return 0; 950 - } 951 - 952 - static int tvp5150_g_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) 953 - { 954 - if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) 955 - return -EINVAL; 956 - return tvp5150_g_sliced_fmt(sd, &fmt->fmt.sliced); 957 961 } 958 962 959 963 static int tvp5150_g_chip_ident(struct v4l2_subdev *sd, ··· 1036 1054 1037 1055 static const struct v4l2_subdev_video_ops tvp5150_video_ops = { 1038 1056 .s_routing = tvp5150_s_routing, 1039 - .g_fmt = tvp5150_g_fmt, 1040 - .s_fmt = tvp5150_s_fmt, 1041 1057 }; 1042 1058 1043 1059 static const struct v4l2_subdev_vbi_ops tvp5150_vbi_ops = {
+1 -1
drivers/media/video/tw9910.c
··· 903 903 #endif 904 904 }; 905 905 906 - static int tw9910_enum_fmt(struct v4l2_subdev *sd, int index, 906 + static int tw9910_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 907 907 enum v4l2_mbus_pixelcode *code) 908 908 { 909 909 if (index)
+1 -2
drivers/media/video/usbvision/usbvision-video.c
··· 1671 1671 PDEBUG(DBG_PROBE, ""); 1672 1672 1673 1673 if (usbvision == NULL) { 1674 - dev_err(&usbvision->dev->dev, 1675 - "%s: usb_get_intfdata() failed\n", __func__); 1674 + pr_err("%s: usb_get_intfdata() failed\n", __func__); 1676 1675 return; 1677 1676 } 1678 1677
+2 -1
drivers/staging/tm6000/Kconfig
··· 2 2 tristate "TV Master TM5600/6000/6010 driver" 3 3 depends on VIDEO_DEV && I2C && INPUT && USB && EXPERIMENTAL 4 4 select VIDEO_TUNER 5 - select TUNER_XC2028 5 + select MEDIA_TUNER_XC2028 6 + select MEDIA_TUNER_XC5000 6 7 select VIDEOBUF_VMALLOC 7 8 help 8 9 Support for TM5600/TM6000/TM6010 USB Device
+24 -1
drivers/staging/tm6000/tm6000-alsa.c
··· 410 410 snd_card_free(card); 411 411 return rc; 412 412 } 413 - EXPORT_SYMBOL_GPL(tm6000_audio_init); 414 413 414 + static int tm6000_audio_fini(struct tm6000_core *dev) 415 + { 416 + return 0; 417 + } 418 + 419 + struct tm6000_ops audio_ops = { 420 + .id = TM6000_AUDIO, 421 + .name = "TM6000 Audio Extension", 422 + .init = tm6000_audio_init, 423 + .fini = tm6000_audio_fini, 424 + }; 425 + 426 + static int __init tm6000_alsa_register(void) 427 + { 428 + return tm6000_register_extension(&audio_ops); 429 + } 430 + 431 + static void __exit tm6000_alsa_unregister(void) 432 + { 433 + tm6000_unregister_extension(&audio_ops); 434 + } 435 + 436 + module_init(tm6000_alsa_register); 437 + module_exit(tm6000_alsa_unregister);
+29 -16
drivers/staging/tm6000/tm6000-cards.c
··· 363 363 tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT, 364 364 0x02, arg); 365 365 msleep(10); 366 - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 367 - TM6000_GPIO_CLK, 0); 368 - if (rc < 0) 369 - return rc; 370 - msleep(10); 371 - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 372 - TM6000_GPIO_CLK, 1); 366 + rc = tm6000_i2c_reset(dev, 10); 373 367 break; 374 368 case XC2028_TUNER_RESET: 375 369 /* Reset codes during load firmware */ ··· 417 423 break; 418 424 419 425 case 2: 420 - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 421 - TM6000_GPIO_CLK, 0); 422 - if (rc < 0) 423 - return rc; 424 - msleep(100); 425 - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 426 - TM6000_GPIO_CLK, 1); 427 - msleep(100); 426 + rc = tm6000_i2c_reset(dev, 100); 428 427 break; 429 428 } 430 429 } ··· 550 563 551 564 switch (dev->tuner_type) { 552 565 case TUNER_XC2028: 553 - tun_setup.tuner_callback = tm6000_tuner_callback;; 566 + tun_setup.tuner_callback = tm6000_tuner_callback; 554 567 break; 555 568 case TUNER_XC5000: 556 569 tun_setup.tuner_callback = tm6000_xc5000_callback; ··· 678 691 rc = tm6000_v4l2_register(dev); 679 692 if (rc < 0) 680 693 goto err; 694 + 695 + tm6000_add_into_devlist(dev); 696 + 697 + tm6000_init_extension(dev); 681 698 682 699 if (dev->caps.has_dvb) { 683 700 dev->dvb = kzalloc(sizeof(*(dev->dvb)), GFP_KERNEL); ··· 912 921 } 913 922 #endif 914 923 924 + if (dev->gpio.power_led) { 925 + switch (dev->model) { 926 + case TM6010_BOARD_HAUPPAUGE_900H: 927 + case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: 928 + case TM6010_BOARD_TWINHAN_TU501: 929 + /* Power led off */ 930 + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 931 + dev->gpio.power_led, 0x01); 932 + msleep(15); 933 + break; 934 + case TM6010_BOARD_BEHOLD_WANDER: 935 + case TM6010_BOARD_BEHOLD_VOYAGER: 936 + /* Power led off */ 937 + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 938 + dev->gpio.power_led, 0x00); 939 + msleep(15); 940 + break; 941 + } 942 + } 915 943 tm6000_v4l2_unregister(dev); 916 944 917 945 tm6000_i2c_unregister(dev); ··· 940 930 dev->state |= DEV_DISCONNECTED; 941 931 942 932 usb_put_dev(dev->udev); 933 + 934 + tm6000_remove_from_devlist(dev); 935 + tm6000_close_extension(dev); 943 936 944 937 mutex_unlock(&dev->lock); 945 938 kfree(dev);
+121
drivers/staging/tm6000/tm6000-core.c
··· 153 153 return buf[3] | buf[2] << 8 | buf[1] << 16 | buf[0] << 24; 154 154 } 155 155 156 + int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep) 157 + { 158 + int rc; 159 + 160 + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 0); 161 + if (rc < 0) 162 + return rc; 163 + 164 + msleep(tsleep); 165 + 166 + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 1); 167 + msleep(tsleep); 168 + 169 + return rc; 170 + } 171 + 156 172 void tm6000_set_fourcc_format(struct tm6000_core *dev) 157 173 { 158 174 if (dev->dev_type == TM6010) { ··· 339 323 tm6000_set_standard (dev, &dev->norm); 340 324 tm6000_set_audio_bitrate (dev,48000); 341 325 326 + /* switch dvb led off */ 327 + if (dev->gpio.dvb_led) { 328 + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 329 + dev->gpio.dvb_led, 0x01); 330 + } 331 + 342 332 return 0; 343 333 } 344 334 ··· 397 375 tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00); 398 376 msleep(100); 399 377 } 378 + 379 + /* switch dvb led on */ 380 + if (dev->gpio.dvb_led) { 381 + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, 382 + dev->gpio.dvb_led, 0x00); 383 + } 384 + 400 385 return 0; 401 386 } 402 387 ··· 629 600 return val; 630 601 } 631 602 EXPORT_SYMBOL_GPL(tm6000_set_audio_bitrate); 603 + 604 + static LIST_HEAD(tm6000_devlist); 605 + static DEFINE_MUTEX(tm6000_devlist_mutex); 606 + 607 + /* 608 + * tm6000_realease_resource() 609 + */ 610 + 611 + void tm6000_remove_from_devlist(struct tm6000_core *dev) 612 + { 613 + mutex_lock(&tm6000_devlist_mutex); 614 + list_del(&dev->devlist); 615 + mutex_unlock(&tm6000_devlist_mutex); 616 + }; 617 + 618 + void tm6000_add_into_devlist(struct tm6000_core *dev) 619 + { 620 + mutex_lock(&tm6000_devlist_mutex); 621 + list_add_tail(&dev->devlist, &tm6000_devlist); 622 + mutex_unlock(&tm6000_devlist_mutex); 623 + }; 624 + 625 + /* 626 + * Extension interface 627 + */ 628 + 629 + static LIST_HEAD(tm6000_extension_devlist); 630 + static DEFINE_MUTEX(tm6000_extension_devlist_lock); 631 + 632 + int tm6000_register_extension(struct tm6000_ops *ops) 633 + { 634 + struct tm6000_core *dev = NULL; 635 + 636 + mutex_lock(&tm6000_devlist_mutex); 637 + mutex_lock(&tm6000_extension_devlist_lock); 638 + list_add_tail(&ops->next, &tm6000_extension_devlist); 639 + list_for_each_entry(dev, &tm6000_devlist, devlist) { 640 + if (dev) 641 + ops->init(dev); 642 + } 643 + printk(KERN_INFO "tm6000: Initialized (%s) extension\n", ops->name); 644 + mutex_unlock(&tm6000_extension_devlist_lock); 645 + mutex_unlock(&tm6000_devlist_mutex); 646 + return 0; 647 + } 648 + EXPORT_SYMBOL(tm6000_register_extension); 649 + 650 + void tm6000_unregister_extension(struct tm6000_ops *ops) 651 + { 652 + struct tm6000_core *dev = NULL; 653 + 654 + mutex_lock(&tm6000_devlist_mutex); 655 + list_for_each_entry(dev, &tm6000_devlist, devlist) { 656 + if (dev) 657 + ops->fini(dev); 658 + } 659 + 660 + mutex_lock(&tm6000_extension_devlist_lock); 661 + printk(KERN_INFO "tm6000: Remove (%s) extension\n", ops->name); 662 + list_del(&ops->next); 663 + mutex_unlock(&tm6000_extension_devlist_lock); 664 + mutex_unlock(&tm6000_devlist_mutex); 665 + } 666 + EXPORT_SYMBOL(tm6000_unregister_extension); 667 + 668 + void tm6000_init_extension(struct tm6000_core *dev) 669 + { 670 + struct tm6000_ops *ops = NULL; 671 + 672 + mutex_lock(&tm6000_extension_devlist_lock); 673 + if (!list_empty(&tm6000_extension_devlist)) { 674 + list_for_each_entry(ops, &tm6000_extension_devlist, next) { 675 + if (ops->init) 676 + ops->init(dev); 677 + } 678 + } 679 + mutex_unlock(&tm6000_extension_devlist_lock); 680 + } 681 + 682 + void tm6000_close_extension(struct tm6000_core *dev) 683 + { 684 + struct tm6000_ops *ops = NULL; 685 + 686 + mutex_lock(&tm6000_extension_devlist_lock); 687 + if (!list_empty(&tm6000_extension_devlist)) { 688 + list_for_each_entry(ops, &tm6000_extension_devlist, next) { 689 + if (ops->fini) 690 + ops->fini(dev); 691 + } 692 + } 693 + mutex_unlock(&tm6000_extension_devlist_lock); 694 + }
+51 -19
drivers/staging/tm6000/tm6000-dvb.c
··· 28 28 #include <media/tuner.h> 29 29 30 30 #include "tuner-xc2028.h" 31 + #include "xc5000.h" 31 32 32 33 static void inline print_err_status (struct tm6000_core *dev, 33 34 int packet, int status) ··· 101 100 102 101 printk(KERN_INFO "tm6000: got start stream request %s\n",__FUNCTION__); 103 102 104 - tm6000_init_digital_mode(dev); 103 + if (dev->mode != TM6000_MODE_DIGITAL) { 104 + tm6000_init_digital_mode(dev); 105 + dev->mode = TM6000_MODE_DIGITAL; 106 + } 105 107 106 108 dvb->bulk_urb = usb_alloc_urb(0, GFP_KERNEL); 107 109 if(dvb->bulk_urb == NULL) { ··· 258 254 dvb->adapter.priv = dev; 259 255 260 256 if (dvb->frontend) { 261 - struct xc2028_config cfg = { 262 - .i2c_adap = &dev->i2c_adap, 263 - .i2c_addr = dev->tuner_addr, 264 - }; 257 + switch (dev->tuner_type) { 258 + case TUNER_XC2028: { 259 + struct xc2028_config cfg = { 260 + .i2c_adap = &dev->i2c_adap, 261 + .i2c_addr = dev->tuner_addr, 262 + }; 265 263 266 - dvb->frontend->callback = tm6000_tuner_callback; 267 - ret = dvb_register_frontend(&dvb->adapter, dvb->frontend); 268 - if (ret < 0) { 269 - printk(KERN_ERR 270 - "tm6000: couldn't register frontend\n"); 271 - goto adapter_err; 272 - } 264 + dvb->frontend->callback = tm6000_tuner_callback; 265 + ret = dvb_register_frontend(&dvb->adapter, dvb->frontend); 266 + if (ret < 0) { 267 + printk(KERN_ERR 268 + "tm6000: couldn't register frontend\n"); 269 + goto adapter_err; 270 + } 273 271 274 - if (!dvb_attach(xc2028_attach, dvb->frontend, &cfg)) { 275 - printk(KERN_ERR "tm6000: couldn't register " 276 - "frontend (xc3028)\n"); 277 - ret = -EINVAL; 278 - goto frontend_err; 272 + if (!dvb_attach(xc2028_attach, dvb->frontend, &cfg)) { 273 + printk(KERN_ERR "tm6000: couldn't register " 274 + "frontend (xc3028)\n"); 275 + ret = -EINVAL; 276 + goto frontend_err; 277 + } 278 + printk(KERN_INFO "tm6000: XC2028/3028 asked to be " 279 + "attached to frontend!\n"); 280 + break; 281 + } 282 + case TUNER_XC5000: { 283 + struct xc5000_config cfg = { 284 + .i2c_address = dev->tuner_addr, 285 + }; 286 + 287 + dvb->frontend->callback = tm6000_xc5000_callback; 288 + ret = dvb_register_frontend(&dvb->adapter, dvb->frontend); 289 + if (ret < 0) { 290 + printk(KERN_ERR 291 + "tm6000: couldn't register frontend\n"); 292 + goto adapter_err; 293 + } 294 + 295 + if (!dvb_attach(xc5000_attach, dvb->frontend, &dev->i2c_adap, &cfg)) { 296 + printk(KERN_ERR "tm6000: couldn't register " 297 + "frontend (xc5000)\n"); 298 + ret = -EINVAL; 299 + goto frontend_err; 300 + } 301 + printk(KERN_INFO "tm6000: XC5000 asked to be " 302 + "attached to frontend!\n"); 303 + break; 304 + } 279 305 } 280 - printk(KERN_INFO "tm6000: XC2028/3028 asked to be " 281 - "attached to frontend!\n"); 282 306 } else { 283 307 printk(KERN_ERR "tm6000: no frontend found\n"); 284 308 }
+56 -48
drivers/staging/tm6000/tm6000-video.c
··· 48 48 #define TM6000_MIN_BUF 4 49 49 #define TM6000_DEF_BUF 8 50 50 51 - #define TM6000_MAX_ISO_PACKETS 40 /* Max number of ISO packets */ 51 + #define TM6000_MAX_ISO_PACKETS 46 /* Max number of ISO packets */ 52 52 53 53 /* Declare static vars that will be used as parameters */ 54 54 static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ ··· 205 205 c = (header >> 24) & 0xff; 206 206 207 207 /* split the header fields */ 208 - size = (((header & 0x7e) << 1) -1) *4; 208 + size = ((header & 0x7e) << 1); 209 + 210 + if (size > 0) 211 + size -= 4; 212 + 209 213 block = (header >> 7) & 0xf; 210 214 field = (header >> 11) & 0x1; 211 215 line = (header >> 12) & 0x1ff; ··· 311 307 case TM6000_URB_MSG_PTS: 312 308 break; 313 309 case TM6000_URB_MSG_AUDIO: 314 - /* Need some code to process audio */ 315 - printk ("%ld: cmd=%s, size=%d\n", jiffies, 310 + /* Need some code to process audio */ 311 + printk ("%ld: cmd=%s, size=%d\n", jiffies, 316 312 tm6000_msg_type[cmd],size); 313 + break; 314 + case TM6000_URB_MSG_VBI: 317 315 break; 318 316 default: 319 317 dprintk (dev, V4L2_DEBUG_ISOC, "cmd=%s, size=%d\n", ··· 339 333 return rc; 340 334 } 341 335 342 - static int copy_streams(u8 *data, u8 *out_p, unsigned long len, 343 - struct urb *urb, struct tm6000_buffer **buf) 336 + static int copy_streams(u8 *data, unsigned long len, 337 + struct urb *urb) 344 338 { 345 339 struct tm6000_dmaqueue *dma_q = urb->context; 346 340 struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); 347 341 u8 *ptr=data, *endp=data+len; 348 342 unsigned long header=0; 349 343 int rc=0; 344 + struct tm6000_buffer *buf; 345 + char *outp = NULL; 346 + 347 + get_next_buf(dma_q, &buf); 348 + if (buf) 349 + outp = videobuf_to_vmalloc(&buf->vb); 350 + 351 + if (!outp) 352 + return 0; 350 353 351 354 for (ptr=data; ptr<endp;) { 352 355 if (!dev->isoc_ctl.cmd) { ··· 403 388 } 404 389 HEADER: 405 390 /* Copy or continue last copy */ 406 - rc=copy_packet(urb,header,&ptr,endp,out_p,buf); 391 + rc=copy_packet(urb,header,&ptr,endp,outp,&buf); 407 392 if (rc<0) { 408 393 buf=NULL; 409 394 printk(KERN_ERR "tm6000: buffer underrun at %ld\n", 410 395 jiffies); 411 396 return rc; 412 397 } 413 - if (!*buf) 398 + if (!buf) 414 399 return 0; 415 400 } 416 401 ··· 419 404 /* 420 405 * Identify the tm5600/6000 buffer header type and properly handles 421 406 */ 422 - static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, 423 - struct urb *urb, struct tm6000_buffer **buf) 407 + static int copy_multiplexed(u8 *ptr, unsigned long len, 408 + struct urb *urb) 424 409 { 425 410 struct tm6000_dmaqueue *dma_q = urb->context; 426 411 struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); 427 412 unsigned int pos=dev->isoc_ctl.pos,cpysize; 428 413 int rc=1; 414 + struct tm6000_buffer *buf; 415 + char *outp = NULL; 416 + 417 + get_next_buf(dma_q, &buf); 418 + if (buf) 419 + outp = videobuf_to_vmalloc(&buf->vb); 420 + 421 + if (!outp) 422 + return 0; 429 423 430 424 while (len>0) { 431 - cpysize=min(len,(*buf)->vb.size-pos); 432 - //printk("Copying %d bytes (max=%lu) from %p to %p[%u]\n",cpysize,(*buf)->vb.size,ptr,out_p,pos); 433 - memcpy(&out_p[pos], ptr, cpysize); 425 + cpysize=min(len,buf->vb.size-pos); 426 + //printk("Copying %d bytes (max=%lu) from %p to %p[%u]\n",cpysize,(*buf)->vb.size,ptr,out_p,pos); 427 + memcpy(&outp[pos], ptr, cpysize); 434 428 pos+=cpysize; 435 429 ptr+=cpysize; 436 430 len-=cpysize; 437 - if (pos >= (*buf)->vb.size) { 431 + if (pos >= buf->vb.size) { 438 432 pos=0; 439 433 /* Announces that a new buffer were filled */ 440 - buffer_filled (dev, dma_q, *buf); 434 + buffer_filled (dev, dma_q, buf); 441 435 dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); 442 - get_next_buf (dma_q, buf); 443 - if (!*buf) 436 + get_next_buf (dma_q, &buf); 437 + if (!buf) 444 438 break; 445 - out_p = videobuf_to_vmalloc(&((*buf)->vb)); 446 - if (!out_p) 439 + outp = videobuf_to_vmalloc(&(buf->vb)); 440 + if (!outp) 447 441 return rc; 448 442 pos = 0; 449 443 } ··· 511 487 struct tm6000_dmaqueue *dma_q = urb->context; 512 488 struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); 513 489 struct tm6000_buffer *buf; 514 - int i, len=0, rc=1; 515 - int size; 516 - char *outp = NULL, *p; 517 - unsigned long copied; 490 + int i, len=0, rc=1, status; 491 + char *p; 518 492 519 - get_next_buf(dma_q, &buf); 520 - if (buf) 521 - outp = videobuf_to_vmalloc(&buf->vb); 522 - 523 - if (!outp) 524 - return 0; 525 - 526 - size = buf->vb.size; 527 - 528 - copied=0; 529 - 530 - if (urb->status<0) { 531 - print_err_status (dev,-1,urb->status); 493 + if (urb->status < 0) { 494 + print_err_status (dev, -1, urb->status); 532 495 return 0; 533 496 } 534 497 535 498 for (i = 0; i < urb->number_of_packets; i++) { 536 - int status = urb->iso_frame_desc[i].status; 499 + status = urb->iso_frame_desc[i].status; 537 500 538 501 if (status<0) { 539 502 print_err_status (dev,i,status); 540 503 continue; 541 504 } 542 505 543 - len=urb->iso_frame_desc[i].actual_length; 506 + len = urb->iso_frame_desc[i].actual_length; 544 507 545 - // if (len>=TM6000_URB_MSG_LEN) { 546 - p=urb->transfer_buffer + urb->iso_frame_desc[i].offset; 508 + if (len > 0) { 509 + p = urb->transfer_buffer + urb->iso_frame_desc[i].offset; 547 510 if (!urb->iso_frame_desc[i].status) { 548 - if ((buf->fmt->fourcc)==V4L2_PIX_FMT_TM6000) { 549 - rc=copy_multiplexed(p, outp, len, urb, &buf); 511 + if ((dev->fourcc)==V4L2_PIX_FMT_TM6000) { 512 + rc=copy_multiplexed(p, len, urb); 550 513 if (rc<=0) 551 514 return rc; 552 515 } else { 553 - copy_streams(p, outp, len, urb, &buf); 516 + copy_streams(p, len, urb); 554 517 } 555 518 } 556 - copied += len; 557 - if (copied >= size || !buf) 558 - break; 559 - // } 519 + } 560 520 } 561 521 return rc; 562 522 } ··· 620 612 static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) 621 613 { 622 614 struct tm6000_dmaqueue *dma_q = &dev->vidq; 623 - int i, j, sb_size, pipe, size, max_packets, num_bufs = 5; 615 + int i, j, sb_size, pipe, size, max_packets, num_bufs = 8; 624 616 struct urb *urb; 625 617 626 618 /* De-allocates all pending stuff */
+24 -1
drivers/staging/tm6000/tm6000.h
··· 168 168 struct i2c_adapter i2c_adap; 169 169 struct i2c_client i2c_client; 170 170 171 + 172 + /* extension */ 173 + struct list_head devlist; 174 + 171 175 /* video for linux */ 172 176 int users; 173 177 ··· 207 203 spinlock_t slock; 208 204 }; 209 205 206 + #define TM6000_AUDIO 0x10 207 + 208 + struct tm6000_ops { 209 + struct list_head next; 210 + char *name; 211 + int id; 212 + int (*init)(struct tm6000_core *); 213 + int (*fini)(struct tm6000_core *); 214 + }; 215 + 210 216 struct tm6000_fh { 211 217 struct tm6000_core *dev; 212 218 ··· 246 232 int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index); 247 233 int tm6000_get_reg32(struct tm6000_core *dev, u8 req, u16 value, u16 index); 248 234 int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index); 235 + int tm6000_i2c_reset(struct tm6000_core *dev, u16 tsleep); 236 + 249 237 int tm6000_init (struct tm6000_core *dev); 250 238 251 239 int tm6000_init_analog_mode (struct tm6000_core *dev); ··· 261 245 int tm6000_v4l2_unregister(struct tm6000_core *dev); 262 246 int tm6000_v4l2_exit(void); 263 247 void tm6000_set_fourcc_format(struct tm6000_core *dev); 248 + 249 + void tm6000_remove_from_devlist(struct tm6000_core *dev); 250 + void tm6000_add_into_devlist(struct tm6000_core *dev); 251 + int tm6000_register_extension(struct tm6000_ops *ops); 252 + void tm6000_unregister_extension(struct tm6000_ops *ops); 253 + void tm6000_init_extension(struct tm6000_core *dev); 254 + void tm6000_close_extension(struct tm6000_core *dev); 264 255 265 256 /* In tm6000-stds.c */ 266 257 void tm6000_get_std_res(struct tm6000_core *dev); ··· 298 275 int tm6000_queue_init(struct tm6000_core *dev); 299 276 300 277 /* In tm6000-alsa.c */ 301 - int tm6000_audio_init(struct tm6000_core *dev, int idx); 278 + /*int tm6000_audio_init(struct tm6000_core *dev, int idx);*/ 302 279 303 280 304 281 /* Debug stuff */
+2 -1
include/media/rc-map.h
··· 55 55 #define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d" 56 56 #define RC_MAP_AVERMEDIA_CARDBUS "rc-avermedia-cardbus" 57 57 #define RC_MAP_AVERMEDIA_DVBT "rc-avermedia-dvbt" 58 - #define RC_MAP_AVERMEDIA_M135A_RM_JX "rc-avermedia-m135a-rm-jx" 58 + #define RC_MAP_AVERMEDIA_M135A "rc-avermedia-m135a" 59 + #define RC_MAP_AVERMEDIA_M733A_RM_K6 "rc-avermedia-m733a-rm-k6" 59 60 #define RC_MAP_AVERMEDIA "rc-avermedia" 60 61 #define RC_MAP_AVERTV_303 "rc-avertv-303" 61 62 #define RC_MAP_BEHOLD_COLUMBUS "rc-behold-columbus"
+1 -1
include/media/soc_camera.h
··· 66 66 * .get_formats() fail, .put_formats() will not be called at all, the 67 67 * failing .get_formats() must then clean up internally. 68 68 */ 69 - int (*get_formats)(struct soc_camera_device *, int, 69 + int (*get_formats)(struct soc_camera_device *, unsigned int, 70 70 struct soc_camera_format_xlate *); 71 71 void (*put_formats)(struct soc_camera_device *); 72 72 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *);
+21
include/media/v4l2-mediabus.h
··· 40 40 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE, 41 41 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE, 42 42 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE, 43 + V4L2_MBUS_FMT_SGRBG8_1X8, 43 44 }; 44 45 45 46 /** ··· 58 57 enum v4l2_field field; 59 58 enum v4l2_colorspace colorspace; 60 59 }; 60 + 61 + static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, 62 + const struct v4l2_mbus_framefmt *mbus_fmt) 63 + { 64 + pix_fmt->width = mbus_fmt->width; 65 + pix_fmt->height = mbus_fmt->height; 66 + pix_fmt->field = mbus_fmt->field; 67 + pix_fmt->colorspace = mbus_fmt->colorspace; 68 + } 69 + 70 + static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt, 71 + const struct v4l2_pix_format *pix_fmt, 72 + enum v4l2_mbus_pixelcode code) 73 + { 74 + mbus_fmt->width = pix_fmt->width; 75 + mbus_fmt->height = pix_fmt->height; 76 + mbus_fmt->field = pix_fmt->field; 77 + mbus_fmt->colorspace = pix_fmt->colorspace; 78 + mbus_fmt->code = code; 79 + } 61 80 62 81 #endif
+1 -1
include/media/v4l2-subdev.h
··· 246 246 struct v4l2_dv_timings *timings); 247 247 int (*g_dv_timings)(struct v4l2_subdev *sd, 248 248 struct v4l2_dv_timings *timings); 249 - int (*enum_mbus_fmt)(struct v4l2_subdev *sd, int index, 249 + int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, 250 250 enum v4l2_mbus_pixelcode *code); 251 251 int (*g_mbus_fmt)(struct v4l2_subdev *sd, 252 252 struct v4l2_mbus_framefmt *fmt);