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

Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb

* 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (44 commits)
V4L/DVB (5571): V4l1-compat: Make VIDIOCSPICT return errors in a useful way
V4L/DVB (5624): Radio-maestro.c cleanup
V4L/DVB (5623): Dsbr100.c Replace usb_dsbr100_do_ioctl to use video_ioctl2
V4L/DVB (5622): Radio-zoltrix.c cleanup
V4L/DVB (5621): Radio-cadet.c Replace cadet_do_ioctl to use video_ioctl2
V4L/DVB (5619): Dvb-usb: fix typo
V4L/DVB (5618): Cx88: Drop the generic i2c client from cx88-vp3054-i2c
V4L/DVB (5617): V4L2: videodev, allow debugging
V4L/DVB (5614): M920x: Disable second adapter on LifeView TV Walker Twin
V4L/DVB (5613): M920x: loosen up 80-col limit
V4L/DVB (5612): M920x: rename function prefixes from m9206_foo to m920x_foo
V4L/DVB (5611): M920x: replace deb_rc with deb
V4L/DVB (5610): M920x: remove duplicated code
V4L/DVB (5609): M920x: group like functions together
V4L/DVB (5608): M920x: various whitespace cleanups
V4L/DVB (5607): M920x: Initial support for devices likely manufactured by Dposh
V4L/DVB (5606): M920x: add "c-basic-offset: 8" to help emacs to enforce tabbing
V4L/DVB (5605): M920x: Add support for LifeView TV Walker Twin
V4L/DVB (5603): V4L: Prevent queueing queued buffers.
V4L/DVB (5602): Enable DiSEqC in Starbox II (vp7021a)
...

+1609 -871
+4 -1
Documentation/video4linux/CARDLIST.saa7134
··· 52 52 51 -> ProVideo PV952 [1540:9524] 53 53 52 -> AverMedia AverTV/305 [1461:2108] 54 54 53 -> ASUS TV-FM 7135 [1043:4845] 55 - 54 -> LifeView FlyTV Platinum FM / Gold [5168:0214,1489:0214,5168:0304] 55 + 54 -> LifeView FlyTV Platinum FM / Gold [5168:0214,5168:5214,1489:0214,5168:0304] 56 56 55 -> LifeView FlyDVB-T DUO / MSI TV@nywhere Duo [5168:0306,4E42:0306] 57 57 56 -> Avermedia AVerTV 307 [1461:a70a] 58 58 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] ··· 111 111 110 -> Avermedia M102 [1461:f31e] 112 112 111 -> ASUS P7131 4871 [1043:4871] 113 113 112 -> ASUSTeK P7131 Hybrid [1043:4876] 114 + 113 -> Elitegroup ECS TVP3XP FM1246 Tuner Card (PAL,FM) [1019:4cb6] 115 + 114 -> KWorld DVB-T 210 [17de:7250] 116 + 115 -> Sabrent PCMCIA TV-PCB05 [0919:2003]
+10 -8
Documentation/video4linux/sn9c102.txt
··· 355 355 356 356 Vendor ID Product ID 357 357 --------- ---------- 358 + 0x0458 0x7025 359 + 0x045e 0x00f5 360 + 0x045e 0x00f7 358 361 0x0471 0x0327 359 362 0x0471 0x0328 360 363 0x0c45 0x6001 ··· 435 432 HV7131D Hynix Semiconductor | Yes No No No 436 433 HV7131R Hynix Semiconductor | No Yes Yes Yes 437 434 MI-0343 Micron Technology | Yes No No No 438 - MI-0360 Micron Technology | No Yes No No 435 + MI-0360 Micron Technology | No Yes Yes Yes 439 436 OV7630 OmniVision Technologies | Yes Yes No No 440 437 OV7660 OmniVision Technologies | No No Yes Yes 441 438 PAS106B PixArt Imaging | Yes No No No ··· 481 478 This driver supports two different video formats: the first one is the "8-bit 482 479 Sequential Bayer" format and can be used to obtain uncompressed video data 483 480 from the device through the current I/O method, while the second one provides 484 - "raw" compressed video data (without frame headers not related to the 485 - compressed data). The compression quality may vary from 0 to 1 and can be 486 - selected or queried thanks to the VIDIOC_S_JPEGCOMP and VIDIOC_G_JPEGCOMP V4L2 487 - ioctl's. For maximum flexibility, both the default active video format and the 488 - default compression quality depend on how the image sensor being used is 489 - initialized (as described in the documentation of the API for the image sensors 490 - supplied by this driver). 481 + either "raw" compressed video data (without frame headers not related to the 482 + compressed data) or standard JPEG (with frame headers). The compression quality 483 + may vary from 0 to 1 and can be selected or queried thanks to the 484 + VIDIOC_S_JPEGCOMP and VIDIOC_G_JPEGCOMP V4L2 ioctl's. For maximum flexibility, 485 + both the default active video format and the default compression quality 486 + depend on how the image sensor being used is initialized. 491 487 492 488 493 489 11. Video frame formats [1]
+9
drivers/media/Kconfig
··· 87 87 tristate 88 88 depends on I2C 89 89 90 + config DAB 91 + boolean "DAB adapters" 92 + default y 93 + ---help--- 94 + Allow selecting support for for Digital Audio Broadcasting (DAB) 95 + Receiver adapters. 96 + 97 + if DAB 90 98 config USB_DABUSB 91 99 tristate "DABUSB driver" 92 100 depends on USB ··· 108 100 109 101 To compile this driver as a module, choose M here: the 110 102 module will be called dabusb. 103 + endif # DAB 111 104 112 105 endmenu
+1 -1
drivers/media/Makefile
··· 5 5 obj-y := common/ 6 6 obj-$(CONFIG_VIDEO_DEV) += video/ 7 7 obj-$(CONFIG_VIDEO_DEV) += radio/ 8 - obj-$(CONFIG_DVB) += dvb/ 8 + obj-$(CONFIG_DVB_CORE) += dvb/
+35 -19
drivers/media/common/saa7146_core.c
··· 136 136 char *mem = vmalloc_32(length); 137 137 int slen = 0; 138 138 139 - if (NULL == mem) { 140 - return NULL; 141 - } 139 + if (NULL == mem) 140 + goto err_null; 142 141 143 - if (!(pt->slist = vmalloc_to_sg(mem, pages))) { 144 - vfree(mem); 145 - return NULL; 146 - } 142 + if (!(pt->slist = vmalloc_to_sg(mem, pages))) 143 + goto err_free_mem; 147 144 148 - if (saa7146_pgtable_alloc(pci, pt)) { 149 - kfree(pt->slist); 150 - pt->slist = NULL; 151 - vfree(mem); 152 - return NULL; 153 - } 145 + if (saa7146_pgtable_alloc(pci, pt)) 146 + goto err_free_slist; 154 147 155 - slen = pci_map_sg(pci,pt->slist,pages,PCI_DMA_FROMDEVICE); 156 - if (0 != saa7146_pgtable_build_single(pci, pt, pt->slist, slen)) { 157 - return NULL; 158 - } 148 + pt->nents = pages; 149 + slen = pci_map_sg(pci,pt->slist,pt->nents,PCI_DMA_FROMDEVICE); 150 + if (0 == slen) 151 + goto err_free_pgtable; 152 + 153 + if (0 != saa7146_pgtable_build_single(pci, pt, pt->slist, slen)) 154 + goto err_unmap_sg; 159 155 160 156 return mem; 157 + 158 + err_unmap_sg: 159 + pci_unmap_sg(pci, pt->slist, pt->nents, PCI_DMA_FROMDEVICE); 160 + err_free_pgtable: 161 + saa7146_pgtable_free(pci, pt); 162 + err_free_slist: 163 + kfree(pt->slist); 164 + pt->slist = NULL; 165 + err_free_mem: 166 + vfree(mem); 167 + err_null: 168 + return NULL; 169 + } 170 + 171 + void saa7146_vfree_destroy_pgtable(struct pci_dev *pci, char *mem, struct saa7146_pgtable *pt) 172 + { 173 + pci_unmap_sg(pci, pt->slist, pt->nents, PCI_DMA_FROMDEVICE); 174 + saa7146_pgtable_free(pci, pt); 175 + kfree(pt->slist); 176 + pt->slist = NULL; 177 + vfree(mem); 161 178 } 162 179 163 180 void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt) ··· 183 166 return; 184 167 pci_free_consistent(pci, pt->size, pt->cpu, pt->dma); 185 168 pt->cpu = NULL; 186 - kfree(pt->slist); 187 - pt->slist = NULL; 188 169 } 189 170 190 171 int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) ··· 543 528 EXPORT_SYMBOL_GPL(saa7146_pgtable_free); 544 529 EXPORT_SYMBOL_GPL(saa7146_pgtable_build_single); 545 530 EXPORT_SYMBOL_GPL(saa7146_vmalloc_build_pgtable); 531 + EXPORT_SYMBOL_GPL(saa7146_vfree_destroy_pgtable); 546 532 EXPORT_SYMBOL_GPL(saa7146_wait_for_debi_done); 547 533 548 534 EXPORT_SYMBOL_GPL(saa7146_setgpio);
-1
drivers/media/common/saa7146_fops.c
··· 307 307 return 0; 308 308 } 309 309 310 - int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg); 311 310 static int fops_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 312 311 { 313 312 /*
+10 -18
drivers/media/dvb/Kconfig
··· 2 2 # Multimedia device configuration 3 3 # 4 4 5 - menu "Digital Video Broadcasting Devices" 6 - 7 - config DVB 8 - bool "DVB For Linux" 9 - depends on NET && INET 10 - ---help--- 11 - Support Digital Video Broadcasting hardware. Enable this if you 12 - own a DVB adapter and want to use it or if you compile Linux for 13 - a digital SetTopBox. 14 - 15 - API specs and user tools are available from <http://www.linuxtv.org/>. 16 - 17 - Please report problems regarding this driver to the LinuxDVB 18 - mailing list. 19 - 20 - If unsure say N. 21 - 22 5 source "drivers/media/dvb/dvb-core/Kconfig" 6 + 7 + menuconfig DVB_CAPTURE_DRIVERS 8 + bool "DVB/ATSC adapters" 9 + depends on DVB_CORE 10 + default y 11 + ---help--- 12 + Say Y to select Digital TV adapters 13 + 14 + if DVB_CAPTURE_DRIVERS 23 15 24 16 comment "Supported SAA7146 based PCI Adapters" 25 17 depends on DVB_CORE && PCI && I2C ··· 40 48 depends on DVB_CORE 41 49 source "drivers/media/dvb/frontends/Kconfig" 42 50 43 - endmenu 51 + endif # DVB_CAPTURE_DRIVERS
+12 -2
drivers/media/dvb/dvb-core/Kconfig
··· 1 1 config DVB_CORE 2 - tristate "DVB Core Support" 3 - depends on DVB 2 + tristate "DVB for Linux" 3 + depends on NET && INET 4 4 select CRC32 5 5 help 6 + Support Digital Video Broadcasting hardware. Enable this if you 7 + own a DVB adapter and want to use it or if you compile Linux for 8 + a digital SetTopBox. 9 + 6 10 DVB core utility functions for device handling, software fallbacks etc. 7 11 Say Y when you have a DVB card and want to use it. Say Y if your want 8 12 to build your drivers outside the kernel, but need the DVB core. All 9 13 in-kernel drivers will select this automatically if needed. 14 + 15 + API specs and user tools are available from <http://www.linuxtv.org/>. 16 + 17 + Please report problems regarding this driver to the LinuxDVB 18 + mailing list. 19 + 10 20 If unsure say N. 11 21 12 22 config DVB_CORE_ATTACH
+5
drivers/media/dvb/dvb-usb/dvb-usb-ids.h
··· 19 19 #define USB_VID_COMPRO_UNK 0x145f 20 20 #define USB_VID_CYPRESS 0x04b4 21 21 #define USB_VID_DIBCOM 0x10b8 22 + #define USB_VID_DPOSH 0x1498 22 23 #define USB_VID_DVICO 0x0fe9 23 24 #define USB_VID_EMPIA 0xeb1a 24 25 #define USB_VID_GENPIX 0x09c0 ··· 62 61 #define USB_PID_DIBCOM_STK7700P 0x1e14 63 62 #define USB_PID_DIBCOM_STK7700P_PC 0x1e78 64 63 #define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 64 + #define USB_PID_DPOSH_M9206_COLD 0x9206 65 + #define USB_PID_DPOSH_M9206_WARM 0xa090 65 66 #define USB_PID_UNIWILL_STK7700P 0x6003 66 67 #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 67 68 #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 ··· 148 145 #define USB_PID_MSI_DIGI_VOX_MINI_II 0x1513 149 146 #define USB_PID_OPERA1_COLD 0x2830 150 147 #define USB_PID_OPERA1_WARM 0x3829 148 + #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD 0x0514 149 + #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM 0x0513 151 150 152 151 153 152 #endif
+1 -1
drivers/media/dvb/dvb-usb/dvb-usb.h
··· 119 119 * @caps: capabilities of the DVB USB device. 120 120 * @pid_filter_count: number of PID filter position in the optional hardware 121 121 * PID-filter. 122 - * @streaming_crtl: called to start and stop the MPEG2-TS streaming of the 122 + * @streaming_ctrl: called to start and stop the MPEG2-TS streaming of the 123 123 * device (not URB submitting/killing). 124 124 * @pid_filter_ctrl: called to en/disable the PID filter, if any. 125 125 * @pid_filter: called to set/unset a PID for filtering.
+420 -151
drivers/media/dvb/dvb-usb/m920x.c
··· 3 3 * Copyright (C) 2006 Aapo Tahkola (aet@rasterburn.org) 4 4 * 5 5 * This program is free software; you can redistribute it and/or modify it 6 - * under the terms of the GNU General Public License as published by the Free 7 - * Software Foundation, version 2. 6 + * under the terms of the GNU General Public License as published by the 7 + * Free Software Foundation, version 2. 8 8 * 9 9 * see Documentation/dvb/README.dvb-usb for more information 10 10 */ ··· 22 22 module_param_named(debug,dvb_usb_m920x_debug, int, 0644); 23 23 MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS); 24 24 25 - static struct dvb_usb_rc_key megasky_rc_keys [] = { 26 - { 0x0, 0x12, KEY_POWER }, 27 - { 0x0, 0x1e, KEY_CYCLEWINDOWS }, /* min/max */ 28 - { 0x0, 0x02, KEY_CHANNELUP }, 29 - { 0x0, 0x05, KEY_CHANNELDOWN }, 30 - { 0x0, 0x03, KEY_VOLUMEUP }, 31 - { 0x0, 0x06, KEY_VOLUMEDOWN }, 32 - { 0x0, 0x04, KEY_MUTE }, 33 - { 0x0, 0x07, KEY_OK }, /* TS */ 34 - { 0x0, 0x08, KEY_STOP }, 35 - { 0x0, 0x09, KEY_MENU }, /* swap */ 36 - { 0x0, 0x0a, KEY_REWIND }, 37 - { 0x0, 0x1b, KEY_PAUSE }, 38 - { 0x0, 0x1f, KEY_FASTFORWARD }, 39 - { 0x0, 0x0c, KEY_RECORD }, 40 - { 0x0, 0x0d, KEY_CAMERA }, /* screenshot */ 41 - { 0x0, 0x0e, KEY_COFFEE }, /* "MTS" */ 42 - }; 43 - 44 - static inline int m9206_read(struct usb_device *udev, u8 request, u16 value,\ 25 + static inline int m920x_read(struct usb_device *udev, u8 request, u16 value, 45 26 u16 index, void *data, int size) 46 27 { 47 28 int ret; ··· 36 55 } 37 56 38 57 if (ret != size) { 39 - deb_rc("m920x_read = no data\n"); 58 + deb("m920x_read = no data\n"); 40 59 return -EIO; 41 60 } 42 61 43 62 return 0; 44 63 } 45 64 46 - static inline int m9206_write(struct usb_device *udev, u8 request, 65 + static inline int m920x_write(struct usb_device *udev, u8 request, 47 66 u16 value, u16 index) 48 67 { 49 68 int ret; ··· 55 74 return ret; 56 75 } 57 76 58 - static int m9206_init(struct dvb_usb_device *d) 77 + static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) 59 78 { 60 79 int ret = 0; 61 80 62 81 /* Remote controller init. */ 63 82 if (d->props.rc_query) { 64 - if ((ret = m9206_write(d->udev, M9206_CORE, 0xa8, M9206_RC_INIT2)) != 0) 65 - return ret; 83 + deb("Initialising remote control\n"); 84 + while (rc_seq->address) { 85 + if ((ret = m920x_write(d->udev, M9206_CORE, 86 + rc_seq->data, 87 + rc_seq->address)) != 0) { 88 + deb("Initialising remote control failed\n"); 89 + return ret; 90 + } 66 91 67 - if ((ret = m9206_write(d->udev, M9206_CORE, 0x51, M9206_RC_INIT1)) != 0) 68 - return ret; 92 + rc_seq++; 93 + } 94 + 95 + deb("Initialising remote control success\n"); 69 96 } 70 97 71 98 return ret; 72 99 } 73 100 74 - static int m9206_rc_query(struct dvb_usb_device *d, u32 *event, int *state) 101 + static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) 75 102 { 76 - struct m9206_state *m = d->priv; 103 + struct m920x_state *m = d->priv; 77 104 int i, ret = 0; 78 105 u8 rc_state[2]; 79 106 80 - if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0) 107 + if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_STATE, rc_state, 1)) != 0) 81 108 goto unlock; 82 109 83 - if ((ret = m9206_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) 110 + if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) 84 111 goto unlock; 85 112 86 113 for (i = 0; i < d->props.rc_key_map_size; i++) ··· 100 111 *state = REMOTE_NO_KEY_PRESSED; 101 112 goto unlock; 102 113 114 + case 0x88: /* framing error or "invalid code" */ 115 + case 0x99: 116 + case 0xc0: 117 + case 0xd8: 118 + *state = REMOTE_NO_KEY_PRESSED; 119 + m->rep_count = 0; 120 + goto unlock; 121 + 103 122 case 0x93: 104 123 case 0x92: 105 124 m->rep_count = 0; ··· 115 118 goto unlock; 116 119 117 120 case 0x91: 118 - /* For comfort. */ 121 + /* prevent immediate auto-repeat */ 119 122 if (++m->rep_count > 2) 120 123 *state = REMOTE_KEY_REPEAT; 124 + else 125 + *state = REMOTE_NO_KEY_PRESSED; 121 126 goto unlock; 122 127 123 128 default: 124 - deb_rc("Unexpected rc response %x\n", rc_state[0]); 129 + deb("Unexpected rc state %02x\n", rc_state[0]); 125 130 *state = REMOTE_NO_KEY_PRESSED; 126 131 goto unlock; 127 132 } 128 133 } 129 134 130 135 if (rc_state[1] != 0) 131 - deb_rc("Unknown rc key %x\n", rc_state[1]); 136 + deb("Unknown rc key %02x\n", rc_state[1]); 132 137 133 138 *state = REMOTE_NO_KEY_PRESSED; 134 139 135 - unlock: 140 + unlock: 136 141 137 142 return ret; 138 143 } 139 144 140 145 /* I2C */ 141 - static int m9206_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], 142 - int num) 146 + static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) 143 147 { 144 148 struct dvb_usb_device *d = i2c_get_adapdata(adap); 145 149 int i, j; ··· 153 155 return -EAGAIN; 154 156 155 157 for (i = 0; i < num; i++) { 156 - if (msg[i].flags & (I2C_M_NO_RD_ACK|I2C_M_IGNORE_NAK|I2C_M_TEN) || 157 - msg[i].len == 0) { 158 - /* For a 0 byte message, I think sending the address to index 0x80|0x40 159 - * would be the correct thing to do. However, zero byte messages are 160 - * only used for probing, and since we don't know how to get the slave's 161 - * ack, we can't probe. */ 158 + if (msg[i].flags & (I2C_M_NO_RD_ACK | I2C_M_IGNORE_NAK | I2C_M_TEN) || msg[i].len == 0) { 159 + /* For a 0 byte message, I think sending the address 160 + * to index 0x80|0x40 would be the correct thing to 161 + * do. However, zero byte messages are only used for 162 + * probing, and since we don't know how to get the 163 + * slave's ack, we can't probe. */ 162 164 ret = -ENOTSUPP; 163 165 goto unlock; 164 166 } 165 167 /* Send START & address/RW bit */ 166 168 if (!(msg[i].flags & I2C_M_NOSTART)) { 167 - if ((ret = m9206_write(d->udev, M9206_I2C, (msg[i].addr<<1)|(msg[i].flags&I2C_M_RD?0x01:0), 0x80)) != 0) 169 + if ((ret = m920x_write(d->udev, M9206_I2C, 170 + (msg[i].addr << 1) | 171 + (msg[i].flags & I2C_M_RD ? 0x01 : 0), 0x80)) != 0) 168 172 goto unlock; 169 173 /* Should check for ack here, if we knew how. */ 170 174 } 171 175 if (msg[i].flags & I2C_M_RD) { 172 176 for (j = 0; j < msg[i].len; j++) { 173 - /* Last byte of transaction? Send STOP, otherwise send ACK. */ 174 - int stop = (i+1 == num && j+1 == msg[i].len)?0x40:0x01; 175 - if ((ret = m9206_read(d->udev, M9206_I2C, 0x0, 0x20|stop, &msg[i].buf[j], 1)) != 0) 177 + /* Last byte of transaction? 178 + * Send STOP, otherwise send ACK. */ 179 + int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x01; 180 + 181 + if ((ret = m920x_read(d->udev, M9206_I2C, 0x0, 182 + 0x20 | stop, 183 + &msg[i].buf[j], 1)) != 0) 176 184 goto unlock; 177 185 } 178 186 } else { 179 187 for (j = 0; j < msg[i].len; j++) { 180 188 /* Last byte of transaction? Then send STOP. */ 181 - int stop = (i+1 == num && j+1 == msg[i].len)?0x40:0x00; 182 - if ((ret = m9206_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0) 189 + int stop = (i+1 == num && j+1 == msg[i].len) ? 0x40 : 0x00; 190 + 191 + if ((ret = m920x_write(d->udev, M9206_I2C, msg[i].buf[j], stop)) != 0) 183 192 goto unlock; 184 193 /* Should check for ack here too. */ 185 194 } ··· 194 189 } 195 190 ret = num; 196 191 197 - unlock: 192 + unlock: 198 193 mutex_unlock(&d->i2c_mutex); 199 194 200 195 return ret; 201 196 } 202 197 203 - static u32 m9206_i2c_func(struct i2c_adapter *adapter) 198 + static u32 m920x_i2c_func(struct i2c_adapter *adapter) 204 199 { 205 200 return I2C_FUNC_I2C; 206 201 } 207 202 208 - static struct i2c_algorithm m9206_i2c_algo = { 209 - .master_xfer = m9206_i2c_xfer, 210 - .functionality = m9206_i2c_func, 203 + static struct i2c_algorithm m920x_i2c_algo = { 204 + .master_xfer = m920x_i2c_xfer, 205 + .functionality = m920x_i2c_func, 211 206 }; 212 207 213 - 214 - static int m9206_set_filter(struct dvb_usb_adapter *adap, int type, int idx, 215 - int pid) 208 + /* pid filter */ 209 + static int m920x_set_filter(struct dvb_usb_adapter *adap, 210 + int type, int idx, int pid) 216 211 { 217 212 int ret = 0; 218 213 ··· 221 216 222 217 pid |= 0x8000; 223 218 224 - if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0) 219 + if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, pid, (type << 8) | (idx * 4) )) != 0) 225 220 return ret; 226 221 227 - if ((ret = m9206_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0) 222 + if ((ret = m920x_write(adap->dev->udev, M9206_FILTER, 0, (type << 8) | (idx * 4) )) != 0) 228 223 return ret; 229 224 230 225 return ret; 231 226 } 232 227 233 - static int m9206_update_filters(struct dvb_usb_adapter *adap) 228 + static int m920x_update_filters(struct dvb_usb_adapter *adap) 234 229 { 235 - struct m9206_state *m = adap->dev->priv; 230 + struct m920x_state *m = adap->dev->priv; 236 231 int enabled = m->filtering_enabled; 237 232 int i, ret = 0, filter = 0; 238 233 ··· 241 236 enabled = 0; 242 237 243 238 /* Disable all filters */ 244 - if ((ret = m9206_set_filter(adap, 0x81, 1, enabled)) != 0) 239 + if ((ret = m920x_set_filter(adap, 0x81, 1, enabled)) != 0) 245 240 return ret; 246 241 247 242 for (i = 0; i < M9206_MAX_FILTERS; i++) 248 - if ((ret = m9206_set_filter(adap, 0x81, i + 2, 0)) != 0) 243 + if ((ret = m920x_set_filter(adap, 0x81, i + 2, 0)) != 0) 249 244 return ret; 250 245 251 - if ((ret = m9206_set_filter(adap, 0x82, 0, 0x0)) != 0) 246 + if ((ret = m920x_set_filter(adap, 0x82, 0, 0x0)) != 0) 252 247 return ret; 253 248 254 249 /* Set */ ··· 257 252 if (m->filters[i] == 0) 258 253 continue; 259 254 260 - if ((ret = m9206_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0) 255 + if ((ret = m920x_set_filter(adap, 0x81, filter + 2, m->filters[i])) != 0) 261 256 return ret; 262 257 263 258 filter++; 264 259 } 265 260 } 266 261 267 - if ((ret = m9206_set_filter(adap, 0x82, 0, 0x02f5)) != 0) 262 + if ((ret = m920x_set_filter(adap, 0x82, 0, 0x02f5)) != 0) 268 263 return ret; 269 264 270 265 return ret; 271 266 } 272 267 273 - static int m9206_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) 268 + static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) 274 269 { 275 - struct m9206_state *m = adap->dev->priv; 270 + struct m920x_state *m = adap->dev->priv; 276 271 277 272 m->filtering_enabled = onoff ? 1 : 0; 278 273 279 - return m9206_update_filters(adap); 274 + return m920x_update_filters(adap); 280 275 } 281 276 282 - static int m9206_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, 283 - int onoff) 277 + static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) 284 278 { 285 - struct m9206_state *m = adap->dev->priv; 279 + struct m920x_state *m = adap->dev->priv; 286 280 287 281 m->filters[index] = onoff ? pid : 0; 288 282 289 - return m9206_update_filters(adap); 283 + return m920x_update_filters(adap); 290 284 } 291 285 292 - static int m9206_firmware_download(struct usb_device *udev, 293 - const struct firmware *fw) 286 + static int m920x_firmware_download(struct usb_device *udev, const struct firmware *fw) 294 287 { 295 288 u16 value, index, size; 296 289 u8 read[4], *buff; ··· 296 293 297 294 buff = kmalloc(65536, GFP_KERNEL); 298 295 299 - if ((ret = m9206_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) 296 + if ((ret = m920x_read(udev, M9206_FILTER, 0x0, 0x8000, read, 4)) != 0) 300 297 goto done; 301 - deb_rc("%x %x %x %x\n", read[0], read[1], read[2], read[3]); 298 + deb("%x %x %x %x\n", read[0], read[1], read[2], read[3]); 302 299 303 - if ((ret = m9206_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0) 300 + if ((ret = m920x_read(udev, M9206_FW, 0x0, 0x0, read, 1)) != 0) 304 301 goto done; 305 - deb_rc("%x\n", read[0]); 302 + deb("%x\n", read[0]); 306 303 307 304 for (pass = 0; pass < 2; pass++) { 308 305 for (i = 0; i + (sizeof(u16) * 3) < fw->size;) { ··· 320 317 memcpy(buff, fw->data + i, size); 321 318 322 319 ret = usb_control_msg(udev, usb_sndctrlpipe(udev,0), 323 - M9206_FW, 324 - USB_TYPE_VENDOR | USB_DIR_OUT, 325 - value, index, buff, size, 20); 320 + M9206_FW, 321 + USB_TYPE_VENDOR | USB_DIR_OUT, 322 + value, index, buff, size, 20); 326 323 if (ret != size) { 327 - deb_rc("error while uploading fw!\n"); 324 + deb("error while uploading fw!\n"); 328 325 ret = -EIO; 329 326 goto done; 330 327 } ··· 333 330 i += size; 334 331 } 335 332 if (i != fw->size) { 336 - deb_rc("bad firmware file!\n"); 333 + deb("bad firmware file!\n"); 337 334 ret = -EINVAL; 338 335 goto done; 339 336 } ··· 341 338 342 339 msleep(36); 343 340 344 - /* m9206 will disconnect itself from the bus after this. */ 345 - (void) m9206_write(udev, M9206_CORE, 0x01, M9206_FW_GO); 346 - deb_rc("firmware uploaded!\n"); 341 + /* m920x will disconnect itself from the bus after this. */ 342 + (void) m920x_write(udev, M9206_CORE, 0x01, M9206_FW_GO); 343 + deb("firmware uploaded!\n"); 347 344 348 - done: 345 + done: 349 346 kfree(buff); 350 347 351 348 return ret; ··· 365 362 return 0; 366 363 } 367 364 368 - static int megasky_mt352_demod_init(struct dvb_frontend *fe) 365 + /* demod configurations */ 366 + static int m920x_mt352_demod_init(struct dvb_frontend *fe) 369 367 { 370 368 u8 config[] = { CONFIG, 0x3d }; 371 369 u8 clock[] = { CLOCK_CTL, 0x30 }; ··· 386 382 mt352_write(fe, unk1, ARRAY_SIZE(unk1)); 387 383 mt352_write(fe, unk2, ARRAY_SIZE(unk2)); 388 384 389 - deb_rc("Demod init!\n"); 385 + deb("Demod init!\n"); 390 386 391 387 return 0; 392 388 } 393 389 394 - static struct mt352_config megasky_mt352_config = { 390 + static struct mt352_config m920x_mt352_config = { 395 391 .demod_address = 0x0f, 396 392 .no_tuner = 1, 397 - .demod_init = megasky_mt352_demod_init, 393 + .demod_init = m920x_mt352_demod_init, 398 394 }; 399 395 400 - static int megasky_mt352_frontend_attach(struct dvb_usb_adapter *adap) 401 - { 402 - deb_rc("megasky_frontend_attach!\n"); 403 - 404 - if ((adap->fe = dvb_attach(mt352_attach, &megasky_mt352_config, &adap->dev->i2c_adap)) == NULL) 405 - return -EIO; 406 - 407 - return 0; 408 - } 409 - 410 - static struct qt1010_config megasky_qt1010_config = { 411 - .i2c_address = 0x62 412 - }; 413 - 414 - static int megasky_qt1010_tuner_attach(struct dvb_usb_adapter *adap) 415 - { 416 - if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, 417 - &megasky_qt1010_config) == NULL) 418 - return -ENODEV; 419 - 420 - return 0; 421 - } 422 - 423 - static struct tda1004x_config digivox_tda10046_config = { 396 + static struct tda1004x_config m920x_tda10046_08_config = { 424 397 .demod_address = 0x08, 425 398 .invert = 0, 426 399 .invert_oclk = 0, ··· 409 428 .request_firmware = NULL, 410 429 }; 411 430 412 - static int digivox_tda10046_frontend_attach(struct dvb_usb_adapter *adap) 413 - { 414 - deb_rc("digivox_tda10046_frontend_attach!\n"); 431 + static struct tda1004x_config m920x_tda10046_0b_config = { 432 + .demod_address = 0x0b, 433 + .invert = 0, 434 + .invert_oclk = 0, 435 + .ts_mode = TDA10046_TS_SERIAL, 436 + .xtal_freq = TDA10046_XTAL_16M, 437 + .if_freq = TDA10046_FREQ_045, 438 + .agc_config = TDA10046_AGC_TDA827X, 439 + .gpio_config = TDA10046_GPTRI, 440 + .request_firmware = NULL, /* uses firmware EEPROM */ 441 + }; 415 442 416 - if ((adap->fe = dvb_attach(tda10046_attach, &digivox_tda10046_config, 443 + /* tuner configurations */ 444 + static struct qt1010_config m920x_qt1010_config = { 445 + .i2c_address = 0x62 446 + }; 447 + 448 + /* Callbacks for DVB USB */ 449 + static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap) 450 + { 451 + deb("%s\n",__FUNCTION__); 452 + 453 + if ((adap->fe = dvb_attach(mt352_attach, 454 + &m920x_mt352_config, 417 455 &adap->dev->i2c_adap)) == NULL) 418 456 return -EIO; 419 457 420 458 return 0; 421 459 } 422 460 423 - static int digivox_tda8275_tuner_attach(struct dvb_usb_adapter *adap) 461 + static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap) 424 462 { 425 - if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, 426 - NULL) == NULL) 427 - return -ENODEV; 463 + deb("%s\n",__FUNCTION__); 464 + 465 + if ((adap->fe = dvb_attach(tda10046_attach, 466 + &m920x_tda10046_08_config, 467 + &adap->dev->i2c_adap)) == NULL) 468 + return -EIO; 469 + 428 470 return 0; 429 471 } 472 + 473 + static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap) 474 + { 475 + deb("%s\n",__FUNCTION__); 476 + 477 + if ((adap->fe = dvb_attach(tda10046_attach, 478 + &m920x_tda10046_0b_config, 479 + &adap->dev->i2c_adap)) == NULL) 480 + return -EIO; 481 + 482 + return 0; 483 + } 484 + 485 + static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap) 486 + { 487 + deb("%s\n",__FUNCTION__); 488 + 489 + if (dvb_attach(qt1010_attach, adap->fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL) 490 + return -ENODEV; 491 + 492 + return 0; 493 + } 494 + 495 + static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap) 496 + { 497 + deb("%s\n",__FUNCTION__); 498 + 499 + if (dvb_attach(tda827x_attach, adap->fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL) 500 + return -ENODEV; 501 + 502 + return 0; 503 + } 504 + 505 + static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap) 506 + { 507 + deb("%s\n",__FUNCTION__); 508 + 509 + if (dvb_attach(tda827x_attach, adap->fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL) 510 + return -ENODEV; 511 + 512 + return 0; 513 + } 514 + 515 + /* device-specific initialization */ 516 + static struct m920x_inits megasky_rc_init [] = { 517 + { M9206_RC_INIT2, 0xa8 }, 518 + { M9206_RC_INIT1, 0x51 }, 519 + { } /* terminating entry */ 520 + }; 521 + 522 + static struct m920x_inits tvwalkertwin_rc_init [] = { 523 + { M9206_RC_INIT2, 0x00 }, 524 + { M9206_RC_INIT1, 0xef }, 525 + { 0xff28, 0x00 }, 526 + { 0xff23, 0x00 }, 527 + { 0xff21, 0x30 }, 528 + { } /* terminating entry */ 529 + }; 530 + 531 + /* ir keymaps */ 532 + static struct dvb_usb_rc_key megasky_rc_keys [] = { 533 + { 0x0, 0x12, KEY_POWER }, 534 + { 0x0, 0x1e, KEY_CYCLEWINDOWS }, /* min/max */ 535 + { 0x0, 0x02, KEY_CHANNELUP }, 536 + { 0x0, 0x05, KEY_CHANNELDOWN }, 537 + { 0x0, 0x03, KEY_VOLUMEUP }, 538 + { 0x0, 0x06, KEY_VOLUMEDOWN }, 539 + { 0x0, 0x04, KEY_MUTE }, 540 + { 0x0, 0x07, KEY_OK }, /* TS */ 541 + { 0x0, 0x08, KEY_STOP }, 542 + { 0x0, 0x09, KEY_MENU }, /* swap */ 543 + { 0x0, 0x0a, KEY_REWIND }, 544 + { 0x0, 0x1b, KEY_PAUSE }, 545 + { 0x0, 0x1f, KEY_FASTFORWARD }, 546 + { 0x0, 0x0c, KEY_RECORD }, 547 + { 0x0, 0x0d, KEY_CAMERA }, /* screenshot */ 548 + { 0x0, 0x0e, KEY_COFFEE }, /* "MTS" */ 549 + }; 550 + 551 + static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = { 552 + { 0x0, 0x01, KEY_ZOOM }, /* Full Screen */ 553 + { 0x0, 0x02, KEY_CAMERA }, /* snapshot */ 554 + { 0x0, 0x03, KEY_MUTE }, 555 + { 0x0, 0x04, KEY_REWIND }, 556 + { 0x0, 0x05, KEY_PLAYPAUSE }, /* Play/Pause */ 557 + { 0x0, 0x06, KEY_FASTFORWARD }, 558 + { 0x0, 0x07, KEY_RECORD }, 559 + { 0x0, 0x08, KEY_STOP }, 560 + { 0x0, 0x09, KEY_TIME }, /* Timeshift */ 561 + { 0x0, 0x0c, KEY_COFFEE }, /* Recall */ 562 + { 0x0, 0x0e, KEY_CHANNELUP }, 563 + { 0x0, 0x12, KEY_POWER }, 564 + { 0x0, 0x15, KEY_MENU }, /* source */ 565 + { 0x0, 0x18, KEY_CYCLEWINDOWS }, /* TWIN PIP */ 566 + { 0x0, 0x1a, KEY_CHANNELDOWN }, 567 + { 0x0, 0x1b, KEY_VOLUMEDOWN }, 568 + { 0x0, 0x1e, KEY_VOLUMEUP }, 569 + }; 430 570 431 571 /* DVB USB Driver stuff */ 432 572 static struct dvb_usb_device_properties megasky_properties; 433 573 static struct dvb_usb_device_properties digivox_mini_ii_properties; 574 + static struct dvb_usb_device_properties tvwalkertwin_properties; 575 + static struct dvb_usb_device_properties dposh_properties; 434 576 435 577 static int m920x_probe(struct usb_interface *intf, 436 578 const struct usb_device_id *id) ··· 561 457 struct dvb_usb_device *d; 562 458 struct usb_host_interface *alt; 563 459 int ret; 460 + struct m920x_inits *rc_init_seq = NULL; 461 + int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber; 564 462 565 - deb_rc("Probed!\n"); 463 + deb("Probing for m920x device at interface %d\n", bInterfaceNumber); 566 464 567 - if (((ret = dvb_usb_device_init(intf, &megasky_properties, THIS_MODULE, &d)) == 0) || 568 - ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties, THIS_MODULE, &d)) == 0)) 569 - goto found; 465 + if (bInterfaceNumber == 0) { 466 + /* Single-tuner device, or first interface on 467 + * multi-tuner device 468 + */ 570 469 571 - return ret; 470 + if ((ret = dvb_usb_device_init(intf, &megasky_properties, 471 + THIS_MODULE, &d)) == 0) { 472 + rc_init_seq = megasky_rc_init; 473 + goto found; 474 + } 572 475 573 - found: 476 + if ((ret = dvb_usb_device_init(intf, &digivox_mini_ii_properties, 477 + THIS_MODULE, &d)) == 0) { 478 + /* No remote control, so no rc_init_seq */ 479 + goto found; 480 + } 481 + 482 + /* This configures both tuners on the TV Walker Twin */ 483 + if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties, 484 + THIS_MODULE, &d)) == 0) { 485 + rc_init_seq = tvwalkertwin_rc_init; 486 + goto found; 487 + } 488 + 489 + if ((ret = dvb_usb_device_init(intf, &dposh_properties, 490 + THIS_MODULE, &d)) == 0) { 491 + /* Remote controller not supported yet. */ 492 + goto found; 493 + } 494 + 495 + return ret; 496 + } else { 497 + /* Another interface on a multi-tuner device */ 498 + 499 + /* The LifeView TV Walker Twin gets here, but struct 500 + * tvwalkertwin_properties already configured both 501 + * tuners, so there is nothing for us to do here 502 + */ 503 + 504 + return -ENODEV; 505 + } 506 + 507 + found: 574 508 alt = usb_altnum_to_altsetting(intf, 1); 575 509 if (alt == NULL) { 576 - deb_rc("No alt found!\n"); 510 + deb("No alt found!\n"); 577 511 return -ENODEV; 578 512 } 579 513 ··· 620 478 if (ret < 0) 621 479 return ret; 622 480 623 - if ((ret = m9206_init(d)) != 0) 481 + if ((ret = m920x_init(d, rc_init_seq)) != 0) 624 482 return ret; 625 483 626 484 return ret; ··· 630 488 { USB_DEVICE(USB_VID_MSI, USB_PID_MSI_MEGASKY580) }, 631 489 { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, 632 490 USB_PID_MSI_DIGI_VOX_MINI_II) }, 491 + { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, 492 + USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD) }, 493 + { USB_DEVICE(USB_VID_ANUBIS_ELECTRONIC, 494 + USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM) }, 495 + { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_COLD) }, 496 + { USB_DEVICE(USB_VID_DPOSH, USB_PID_DPOSH_M9206_WARM) }, 633 497 { } /* Terminating entry */ 634 498 }; 635 499 MODULE_DEVICE_TABLE (usb, m920x_table); ··· 645 497 646 498 .usb_ctrl = DEVICE_SPECIFIC, 647 499 .firmware = "dvb-usb-megasky-02.fw", 648 - .download_firmware = m9206_firmware_download, 500 + .download_firmware = m920x_firmware_download, 649 501 650 502 .rc_interval = 100, 651 503 .rc_key_map = megasky_rc_keys, 652 504 .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys), 653 - .rc_query = m9206_rc_query, 505 + .rc_query = m920x_rc_query, 654 506 655 - .size_of_priv = sizeof(struct m9206_state), 507 + .size_of_priv = sizeof(struct m920x_state), 656 508 657 509 .identify_state = m920x_identify_state, 658 510 .num_adapters = 1, ··· 661 513 DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 662 514 663 515 .pid_filter_count = 8, 664 - .pid_filter = m9206_pid_filter, 665 - .pid_filter_ctrl = m9206_pid_filter_ctrl, 516 + .pid_filter = m920x_pid_filter, 517 + .pid_filter_ctrl = m920x_pid_filter_ctrl, 666 518 667 - .frontend_attach = megasky_mt352_frontend_attach, 668 - .tuner_attach = megasky_qt1010_tuner_attach, 519 + .frontend_attach = m920x_mt352_frontend_attach, 520 + .tuner_attach = m920x_qt1010_tuner_attach, 669 521 670 522 .stream = { 671 523 .type = USB_BULK, ··· 678 530 } 679 531 }, 680 532 }}, 681 - .i2c_algo = &m9206_i2c_algo, 533 + .i2c_algo = &m920x_i2c_algo, 682 534 683 535 .num_device_descs = 1, 684 536 .devices = { ··· 694 546 695 547 .usb_ctrl = DEVICE_SPECIFIC, 696 548 .firmware = "dvb-usb-digivox-02.fw", 697 - .download_firmware = m9206_firmware_download, 549 + .download_firmware = m920x_firmware_download, 698 550 699 - .size_of_priv = sizeof(struct m9206_state), 551 + .size_of_priv = sizeof(struct m920x_state), 700 552 701 553 .identify_state = m920x_identify_state, 702 554 .num_adapters = 1, 703 555 .adapter = {{ 704 556 .caps = DVB_USB_ADAP_HAS_PID_FILTER | 705 - DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 557 + DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 706 558 707 559 .pid_filter_count = 8, 708 - .pid_filter = m9206_pid_filter, 709 - .pid_filter_ctrl = m9206_pid_filter_ctrl, 560 + .pid_filter = m920x_pid_filter, 561 + .pid_filter_ctrl = m920x_pid_filter_ctrl, 710 562 711 - .frontend_attach = digivox_tda10046_frontend_attach, 712 - .tuner_attach = digivox_tda8275_tuner_attach, 563 + .frontend_attach = m920x_tda10046_08_frontend_attach, 564 + .tuner_attach = m920x_tda8275_60_tuner_attach, 713 565 714 566 .stream = { 715 567 .type = USB_BULK, ··· 722 574 } 723 575 }, 724 576 }}, 725 - .i2c_algo = &m9206_i2c_algo, 577 + .i2c_algo = &m920x_i2c_algo, 726 578 727 579 .num_device_descs = 1, 728 580 .devices = { ··· 731 583 { NULL }, 732 584 }, 733 585 } 586 + }; 587 + 588 + /* LifeView TV Walker Twin support by Nick Andrew <nick@nick-andrew.net> 589 + * 590 + * LifeView TV Walker Twin has 1 x M9206, 2 x TDA10046, 2 x TDA8275A 591 + * TDA10046 #0 is located at i2c address 0x08 592 + * TDA10046 #1 is located at i2c address 0x0b (presently disabled - not yet working) 593 + * TDA8275A #0 is located at i2c address 0x60 594 + * TDA8275A #1 is located at i2c address 0x61 (presently disabled - not yet working) 595 + */ 596 + static struct dvb_usb_device_properties tvwalkertwin_properties = { 597 + .caps = DVB_USB_IS_AN_I2C_ADAPTER, 598 + 599 + .usb_ctrl = DEVICE_SPECIFIC, 600 + .firmware = "dvb-usb-tvwalkert.fw", 601 + .download_firmware = m920x_firmware_download, 602 + 603 + .rc_interval = 100, 604 + .rc_key_map = tvwalkertwin_rc_keys, 605 + .rc_key_map_size = ARRAY_SIZE(tvwalkertwin_rc_keys), 606 + .rc_query = m920x_rc_query, 607 + 608 + .size_of_priv = sizeof(struct m920x_state), 609 + 610 + .identify_state = m920x_identify_state, 611 + .num_adapters = 1, 612 + .adapter = {{ 613 + .caps = DVB_USB_ADAP_HAS_PID_FILTER | 614 + DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 615 + 616 + .pid_filter_count = 8, 617 + .pid_filter = m920x_pid_filter, 618 + .pid_filter_ctrl = m920x_pid_filter_ctrl, 619 + 620 + .frontend_attach = m920x_tda10046_08_frontend_attach, 621 + .tuner_attach = m920x_tda8275_60_tuner_attach, 622 + 623 + .stream = { 624 + .type = USB_BULK, 625 + .count = 8, 626 + .endpoint = 0x81, 627 + .u = { 628 + .bulk = { 629 + .buffersize = 512, 630 + } 631 + } 632 + }},{ 633 + .caps = DVB_USB_ADAP_HAS_PID_FILTER | 634 + DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 635 + 636 + .pid_filter_count = 8, 637 + .pid_filter = m920x_pid_filter, 638 + .pid_filter_ctrl = m920x_pid_filter_ctrl, 639 + 640 + .frontend_attach = m920x_tda10046_0b_frontend_attach, 641 + .tuner_attach = m920x_tda8275_61_tuner_attach, 642 + 643 + .stream = { 644 + .type = USB_BULK, 645 + .count = 8, 646 + .endpoint = 0x82, 647 + .u = { 648 + .bulk = { 649 + .buffersize = 512, 650 + } 651 + } 652 + }, 653 + }}, 654 + .i2c_algo = &m920x_i2c_algo, 655 + 656 + .num_device_descs = 1, 657 + .devices = { 658 + { .name = "LifeView TV Walker Twin DVB-T USB2.0", 659 + .cold_ids = { &m920x_table[2], NULL }, 660 + .warm_ids = { &m920x_table[3], NULL }, 661 + }, 662 + } 663 + }; 664 + 665 + static struct dvb_usb_device_properties dposh_properties = { 666 + .caps = DVB_USB_IS_AN_I2C_ADAPTER, 667 + 668 + .usb_ctrl = DEVICE_SPECIFIC, 669 + .firmware = "dvb-usb-dposh-01.fw", 670 + .download_firmware = m920x_firmware_download, 671 + 672 + .size_of_priv = sizeof(struct m920x_state), 673 + 674 + .identify_state = m920x_identify_state, 675 + .num_adapters = 1, 676 + .adapter = {{ 677 + /* Hardware pid filters don't work with this device/firmware */ 678 + 679 + .frontend_attach = m920x_mt352_frontend_attach, 680 + .tuner_attach = m920x_qt1010_tuner_attach, 681 + 682 + .stream = { 683 + .type = USB_BULK, 684 + .count = 8, 685 + .endpoint = 0x81, 686 + .u = { 687 + .bulk = { 688 + .buffersize = 512, 689 + } 690 + } 691 + }, 692 + }}, 693 + .i2c_algo = &m920x_i2c_algo, 694 + 695 + .num_device_descs = 1, 696 + .devices = { 697 + { .name = "Dposh DVB-T USB2.0", 698 + .cold_ids = { &m920x_table[4], NULL }, 699 + .warm_ids = { &m920x_table[5], NULL }, 700 + }, 701 + } 734 702 }; 735 703 736 704 static struct usb_driver m920x_driver = { ··· 879 615 module_exit (m920x_module_exit); 880 616 881 617 MODULE_AUTHOR("Aapo Tahkola <aet@rasterburn.org>"); 882 - MODULE_DESCRIPTION("Driver MSI Mega Sky 580 DVB-T USB2.0 / Uli m920x"); 618 + MODULE_DESCRIPTION("DVB Driver for ULI M920x"); 883 619 MODULE_VERSION("0.1"); 884 620 MODULE_LICENSE("GPL"); 621 + 622 + /* 623 + * Local variables: 624 + * c-basic-offset: 8 625 + */
+11 -2
drivers/media/dvb/dvb-usb/m920x.h
··· 4 4 #define DVB_USB_LOG_PREFIX "m920x" 5 5 #include "dvb-usb.h" 6 6 7 - #define deb_rc(args...) dprintk(dvb_usb_m920x_debug,0x01,args) 7 + #define deb(args...) dprintk(dvb_usb_m920x_debug,0x01,args) 8 8 9 9 #define M9206_CORE 0x22 10 10 #define M9206_RC_STATE 0xff51 ··· 59 59 response to a write, is unknown. 60 60 */ 61 61 62 - struct m9206_state { 62 + struct m920x_state { 63 63 u16 filters[M9206_MAX_FILTERS]; 64 64 int filtering_enabled; 65 65 int rep_count; 66 66 }; 67 + 68 + /* Initialisation data for the m920x 69 + */ 70 + 71 + struct m920x_inits { 72 + u16 address; 73 + u8 data; 74 + }; 75 + 67 76 #endif
+7 -7
drivers/media/dvb/dvb-usb/vp702x-fe.c
··· 204 204 static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe, 205 205 struct dvb_diseqc_master_cmd *m) 206 206 { 207 - //struct vp702x_fe_state *st = fe->demodulator_priv; 208 - u8 cmd[8];//,ibuf[10]; 207 + struct vp702x_fe_state *st = fe->demodulator_priv; 208 + u8 cmd[8],ibuf[10]; 209 209 memset(cmd,0,8); 210 210 211 211 deb_fe("%s\n",__FUNCTION__); ··· 218 218 memcpy(&cmd[3], m->msg, m->msg_len); 219 219 cmd[7] = vp702x_chksum(cmd,0,7); 220 220 221 - // vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100); 221 + vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100); 222 222 223 - // if (ibuf[2] == 0 && ibuf[3] == 0) 224 - // deb_fe("diseqc cmd failed.\n"); 225 - // else 226 - // deb_fe("diseqc cmd succeeded.\n"); 223 + if (ibuf[2] == 0 && ibuf[3] == 0) 224 + deb_fe("diseqc cmd failed.\n"); 225 + else 226 + deb_fe("diseqc cmd succeeded.\n"); 227 227 228 228 return 0; 229 229 }
+8
drivers/media/dvb/pluto2/pluto2.c
··· 293 293 * but no packets have been transfered. 294 294 * [2] Sometimes (actually very often) NBPACKETS stays at zero 295 295 * although one packet has been transfered. 296 + * [3] Sometimes (actually rarely), the card gets into an erroneous 297 + * mode where it continuously generates interrupts, claiming it 298 + * has recieved nbpackets>TS_DMA_PACKETS packets, but no packet 299 + * has been transfered. Only a reset seems to solve this 296 300 */ 297 301 if ((nbpackets == 0) || (nbpackets > TS_DMA_PACKETS)) { 298 302 unsigned int i = 0; 299 303 while (pluto->dma_buf[i] == 0x47) 300 304 i += 188; 301 305 nbpackets = i / 188; 306 + if (i == 0) { 307 + pluto_reset_ts(pluto, 1); 308 + dev_printk(KERN_DEBUG, &pluto->pdev->dev, "resetting TS because of invalid packet counter\n"); 309 + } 302 310 } 303 311 304 312 dvb_dmx_swfilter_packets(&pluto->demux, pluto->dma_buf, nbpackets);
+6 -3
drivers/media/dvb/ttpci/av7110.c
··· 1246 1246 if (!budget->feeding1 || (newdma == olddma)) 1247 1247 return; 1248 1248 1249 + /* Ensure streamed PCI data is synced to CPU */ 1250 + pci_dma_sync_sg_for_cpu(budget->dev->pci, budget->pt.slist, budget->pt.nents, PCI_DMA_FROMDEVICE); 1251 + 1249 1252 #if 0 1250 1253 /* track rps1 activity */ 1251 1254 printk("vpeirq: %02x Event Counter 1 0x%04x\n", ··· 2682 2679 err_pci_free_5: 2683 2680 pci_free_consistent(pdev, 8192, av7110->debi_virt, av7110->debi_bus); 2684 2681 err_saa71466_vfree_4: 2685 - if (!av7110->grabbing) 2686 - saa7146_pgtable_free(pdev, &av7110->pt); 2682 + if (av7110->grabbing) 2683 + saa7146_vfree_destroy_pgtable(pdev, av7110->grabbing, &av7110->pt); 2687 2684 err_i2c_del_3: 2688 2685 i2c_del_adapter(&av7110->i2c_adap); 2689 2686 err_dvb_unregister_adapter_2: ··· 2713 2710 SAA7146_ISR_CLEAR(saa, MASK_10); 2714 2711 msleep(50); 2715 2712 tasklet_kill(&av7110->vpe_tasklet); 2716 - saa7146_pgtable_free(saa->pci, &av7110->pt); 2713 + saa7146_vfree_destroy_pgtable(saa->pci, av7110->grabbing, &av7110->pt); 2717 2714 } 2718 2715 av7110_exit_v4l(av7110); 2719 2716
+1 -1
drivers/media/dvb/ttpci/budget-ci.c
··· 904 904 band = 1; 905 905 } else if (tuner_frequency < 200000000) { 906 906 cp = 6; 907 - band = 2; 907 + band = 1; 908 908 } else if (tuner_frequency < 290000000) { 909 909 cp = 3; 910 910 band = 2;
+20 -17
drivers/media/dvb/ttpci/budget-core.c
··· 195 195 u32 newdma = saa7146_read(budget->dev, PCI_VDP3); 196 196 u32 count; 197 197 198 + /* Ensure streamed PCI data is synced to CPU */ 199 + pci_dma_sync_sg_for_cpu(budget->dev->pci, budget->pt.slist, budget->pt.nents, PCI_DMA_FROMDEVICE); 200 + 198 201 /* nearest lower position divisible by 188 */ 199 202 newdma -= newdma % 188; 200 203 ··· 507 504 strcpy(budget->i2c_adap.name, budget->card->name); 508 505 509 506 if (i2c_add_adapter(&budget->i2c_adap) < 0) { 510 - dvb_unregister_adapter(&budget->dvb_adapter); 511 - return -ENOMEM; 507 + ret = -ENOMEM; 508 + goto err_dvb_unregister; 512 509 } 513 510 514 511 ttpci_eeprom_parse_mac(&budget->i2c_adap, budget->dvb_adapter.proposed_mac); 515 512 516 - if (NULL == 517 - (budget->grabbing = saa7146_vmalloc_build_pgtable(dev->pci, budget->buffer_size, &budget->pt))) { 513 + budget->grabbing = saa7146_vmalloc_build_pgtable(dev->pci, budget->buffer_size, &budget->pt); 514 + if (NULL == budget->grabbing) { 518 515 ret = -ENOMEM; 519 - goto err; 516 + goto err_del_i2c; 520 517 } 521 518 522 519 saa7146_write(dev, PCI_BT_V1, 0x001c0000); ··· 529 526 if (bi->type != BUDGET_FS_ACTIVY) 530 527 saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI); 531 528 532 - if (budget_register(budget) == 0) { 533 - return 0; 534 - } 535 - err: 529 + if (budget_register(budget) == 0) 530 + return 0; /* Everything OK */ 531 + 532 + /* An error occurred, cleanup resources */ 533 + saa7146_vfree_destroy_pgtable(dev->pci, budget->grabbing, &budget->pt); 534 + 535 + err_del_i2c: 536 536 i2c_del_adapter(&budget->i2c_adap); 537 537 538 - vfree(budget->grabbing); 539 - 538 + err_dvb_unregister: 540 539 dvb_unregister_adapter(&budget->dvb_adapter); 541 540 542 541 return ret; ··· 560 555 561 556 budget_unregister(budget); 562 557 558 + tasklet_kill(&budget->vpe_tasklet); 559 + 560 + saa7146_vfree_destroy_pgtable(dev->pci, budget->grabbing, &budget->pt); 561 + 563 562 i2c_del_adapter(&budget->i2c_adap); 564 563 565 564 dvb_unregister_adapter(&budget->dvb_adapter); 566 - 567 - tasklet_kill(&budget->vpe_tasklet); 568 - 569 - saa7146_pgtable_free(dev->pci, &budget->pt); 570 - 571 - vfree(budget->grabbing); 572 565 573 566 return 0; 574 567 }
+9 -2
drivers/media/radio/Kconfig
··· 2 2 # Multimedia Video device configuration 3 3 # 4 4 5 - menu "Radio Adapters" 5 + menuconfig RADIO_ADAPTERS 6 + bool "Radio Adapters" 6 7 depends on VIDEO_DEV 8 + default y 9 + ---help--- 10 + Say Y here to enable selecting AM/FM radio adapters. 11 + 12 + if RADIO_ADAPTERS 7 13 8 14 config RADIO_CADET 9 15 tristate "ADS Cadet AM/FM Tuner" ··· 334 328 335 329 To compile this driver as a module, choose M here: the 336 330 module will be called dsbr100. 337 - endmenu 331 + 332 + endif # RADIO_ADAPTERS
+203 -176
drivers/media/radio/dsbr100.c
··· 33 33 34 34 History: 35 35 36 + Version 0.42: 37 + Converted dsbr100 to use video_ioctl2 38 + by Douglas Landgraf <dougsland@gmail.com> 39 + 36 40 Version 0.41-ac1: 37 41 Alan Cox: Some cleanups and fixes 38 42 ··· 125 121 static int usb_dsbr100_probe(struct usb_interface *intf, 126 122 const struct usb_device_id *id); 127 123 static void usb_dsbr100_disconnect(struct usb_interface *intf); 128 - static int usb_dsbr100_ioctl(struct inode *inode, struct file *file, 129 - unsigned int cmd, unsigned long arg); 130 124 static int usb_dsbr100_open(struct inode *inode, struct file *file); 131 125 static int usb_dsbr100_close(struct inode *inode, struct file *file); 132 126 ··· 143 141 int muted; 144 142 }; 145 143 146 - 147 - /* File system interface */ 148 - static const struct file_operations usb_dsbr100_fops = { 149 - .owner = THIS_MODULE, 150 - .open = usb_dsbr100_open, 151 - .release = usb_dsbr100_close, 152 - .ioctl = usb_dsbr100_ioctl, 153 - .compat_ioctl = v4l_compat_ioctl32, 154 - .llseek = no_llseek, 155 - }; 156 - 157 - /* V4L interface */ 158 - static struct video_device dsbr100_videodev_template= 159 - { 160 - .owner = THIS_MODULE, 161 - .name = "D-Link DSB-R 100", 162 - .type = VID_TYPE_TUNER, 163 - .fops = &usb_dsbr100_fops, 164 - .release = video_device_release, 165 - }; 166 144 167 145 static struct usb_device_id usb_dsbr100_device_table [] = { 168 146 { USB_DEVICE(DSB100_VENDOR, DSB100_PRODUCT) }, ··· 234 252 235 253 /* USB subsystem interface begins here */ 236 254 237 - /* check if the device is present and register with v4l and 238 - usb if it is */ 239 - static int usb_dsbr100_probe(struct usb_interface *intf, 240 - const struct usb_device_id *id) 241 - { 242 - struct dsbr100_device *radio; 243 - 244 - if (!(radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL))) 245 - return -ENOMEM; 246 - if (!(radio->videodev = video_device_alloc())) { 247 - kfree(radio); 248 - return -ENOMEM; 249 - } 250 - memcpy(radio->videodev, &dsbr100_videodev_template, 251 - sizeof(dsbr100_videodev_template)); 252 - radio->removed = 0; 253 - radio->users = 0; 254 - radio->usbdev = interface_to_usbdev(intf); 255 - radio->curfreq = FREQ_MIN*FREQ_MUL; 256 - video_set_drvdata(radio->videodev, radio); 257 - if (video_register_device(radio->videodev, VFL_TYPE_RADIO, 258 - radio_nr)) { 259 - warn("Could not register video device"); 260 - video_device_release(radio->videodev); 261 - kfree(radio); 262 - return -EIO; 263 - } 264 - usb_set_intfdata(intf, radio); 265 - return 0; 266 - } 267 - 268 255 /* handle unplugging of the device, release data structures 269 256 if nothing keeps us from doing it. If something is still 270 257 keeping us busy, the release callback of v4l will take care ··· 258 307 } 259 308 260 309 261 - /* Video for Linux interface */ 262 - 263 - static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, 264 - unsigned int cmd, void *arg) 310 + static int vidioc_querycap(struct file *file, void *priv, 311 + struct v4l2_capability *v) 265 312 { 266 - struct dsbr100_device *radio=video_get_drvdata(video_devdata(file)); 267 - 268 - if (!radio) 269 - return -EIO; 270 - 271 - switch(cmd) { 272 - case VIDIOC_QUERYCAP: 273 - { 274 - struct v4l2_capability *v = arg; 275 - memset(v,0,sizeof(*v)); 276 - strlcpy(v->driver, "dsbr100", sizeof (v->driver)); 277 - strlcpy(v->card, "D-Link R-100 USB FM Radio", sizeof (v->card)); 278 - sprintf(v->bus_info,"ISA"); 279 - v->version = RADIO_VERSION; 280 - v->capabilities = V4L2_CAP_TUNER; 281 - 282 - return 0; 283 - } 284 - case VIDIOC_G_TUNER: 285 - { 286 - struct v4l2_tuner *v = arg; 287 - 288 - if (v->index > 0) 289 - return -EINVAL; 290 - 291 - dsbr100_getstat(radio); 292 - 293 - memset(v,0,sizeof(*v)); 294 - strcpy(v->name, "FM"); 295 - v->type = V4L2_TUNER_RADIO; 296 - 297 - v->rangelow = FREQ_MIN*FREQ_MUL; 298 - v->rangehigh = FREQ_MAX*FREQ_MUL; 299 - v->rxsubchans =V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; 300 - v->capability=V4L2_TUNER_CAP_LOW; 301 - if(radio->stereo) 302 - v->audmode = V4L2_TUNER_MODE_STEREO; 303 - else 304 - v->audmode = V4L2_TUNER_MODE_MONO; 305 - v->signal = 0xFFFF; /* We can't get the signal strength */ 306 - 307 - return 0; 308 - } 309 - case VIDIOC_S_TUNER: 310 - { 311 - struct v4l2_tuner *v = arg; 312 - 313 - if (v->index > 0) 314 - return -EINVAL; 315 - 316 - return 0; 317 - } 318 - case VIDIOC_S_FREQUENCY: 319 - { 320 - struct v4l2_frequency *f = arg; 321 - 322 - radio->curfreq = f->frequency; 323 - if (dsbr100_setfreq(radio, radio->curfreq)==-1) 324 - warn("Set frequency failed"); 325 - return 0; 326 - } 327 - case VIDIOC_G_FREQUENCY: 328 - { 329 - struct v4l2_frequency *f = arg; 330 - 331 - f->type = V4L2_TUNER_RADIO; 332 - f->frequency = radio->curfreq; 333 - 334 - return 0; 335 - } 336 - case VIDIOC_QUERYCTRL: 337 - { 338 - struct v4l2_queryctrl *qc = arg; 339 - int i; 340 - 341 - for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { 342 - if (qc->id && qc->id == radio_qctrl[i].id) { 343 - memcpy(qc, &(radio_qctrl[i]), 344 - sizeof(*qc)); 345 - return 0; 346 - } 347 - } 348 - return -EINVAL; 349 - } 350 - case VIDIOC_G_CTRL: 351 - { 352 - struct v4l2_control *ctrl= arg; 353 - 354 - switch (ctrl->id) { 355 - case V4L2_CID_AUDIO_MUTE: 356 - ctrl->value=radio->muted; 357 - return 0; 358 - } 359 - return -EINVAL; 360 - } 361 - case VIDIOC_S_CTRL: 362 - { 363 - struct v4l2_control *ctrl= arg; 364 - 365 - switch (ctrl->id) { 366 - case V4L2_CID_AUDIO_MUTE: 367 - if (ctrl->value) { 368 - if (dsbr100_stop(radio)==-1) 369 - warn("Radio did not respond properly"); 370 - } else { 371 - if (dsbr100_start(radio)==-1) 372 - warn("Radio did not respond properly"); 373 - } 374 - return 0; 375 - } 376 - return -EINVAL; 377 - } 378 - default: 379 - return v4l_compat_translate_ioctl(inode,file,cmd,arg, 380 - usb_dsbr100_do_ioctl); 381 - } 313 + strlcpy(v->driver, "dsbr100", sizeof(v->driver)); 314 + strlcpy(v->card, "D-Link R-100 USB FM Radio", sizeof(v->card)); 315 + sprintf(v->bus_info, "ISA"); 316 + v->version = RADIO_VERSION; 317 + v->capabilities = V4L2_CAP_TUNER; 318 + return 0; 382 319 } 383 320 384 - static int usb_dsbr100_ioctl(struct inode *inode, struct file *file, 385 - unsigned int cmd, unsigned long arg) 321 + static int vidioc_g_tuner(struct file *file, void *priv, 322 + struct v4l2_tuner *v) 386 323 { 387 - return video_usercopy(inode, file, cmd, arg, usb_dsbr100_do_ioctl); 324 + struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); 325 + 326 + if (v->index > 0) 327 + return -EINVAL; 328 + 329 + dsbr100_getstat(radio); 330 + strcpy(v->name, "FM"); 331 + v->type = V4L2_TUNER_RADIO; 332 + v->rangelow = FREQ_MIN*FREQ_MUL; 333 + v->rangehigh = FREQ_MAX*FREQ_MUL; 334 + v->rxsubchans = V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; 335 + v->capability = V4L2_TUNER_CAP_LOW; 336 + if(radio->stereo) 337 + v->audmode = V4L2_TUNER_MODE_STEREO; 338 + else 339 + v->audmode = V4L2_TUNER_MODE_MONO; 340 + v->signal = 0xffff; /* We can't get the signal strength */ 341 + return 0; 342 + } 343 + 344 + static int vidioc_s_tuner(struct file *file, void *priv, 345 + struct v4l2_tuner *v) 346 + { 347 + if (v->index > 0) 348 + return -EINVAL; 349 + 350 + return 0; 351 + } 352 + 353 + static int vidioc_s_frequency(struct file *file, void *priv, 354 + struct v4l2_frequency *f) 355 + { 356 + struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); 357 + 358 + radio->curfreq = f->frequency; 359 + if (dsbr100_setfreq(radio, radio->curfreq)==-1) 360 + warn("Set frequency failed"); 361 + return 0; 362 + } 363 + 364 + static int vidioc_g_frequency(struct file *file, void *priv, 365 + struct v4l2_frequency *f) 366 + { 367 + struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); 368 + 369 + f->type = V4L2_TUNER_RADIO; 370 + f->frequency = radio->curfreq; 371 + return 0; 372 + } 373 + 374 + static int vidioc_queryctrl(struct file *file, void *priv, 375 + struct v4l2_queryctrl *qc) 376 + { 377 + int i; 378 + 379 + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { 380 + if (qc->id && qc->id == radio_qctrl[i].id) { 381 + memcpy(qc, &(radio_qctrl[i]), 382 + sizeof(*qc)); 383 + return 0; 384 + } 385 + } 386 + return -EINVAL; 387 + } 388 + 389 + static int vidioc_g_ctrl(struct file *file, void *priv, 390 + struct v4l2_control *ctrl) 391 + { 392 + struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); 393 + 394 + switch (ctrl->id) { 395 + case V4L2_CID_AUDIO_MUTE: 396 + ctrl->value = radio->muted; 397 + return 0; 398 + } 399 + return -EINVAL; 400 + } 401 + 402 + static int vidioc_s_ctrl(struct file *file, void *priv, 403 + struct v4l2_control *ctrl) 404 + { 405 + struct dsbr100_device *radio = video_get_drvdata(video_devdata(file)); 406 + 407 + switch (ctrl->id) { 408 + case V4L2_CID_AUDIO_MUTE: 409 + if (ctrl->value) { 410 + if (dsbr100_stop(radio)==-1) 411 + warn("Radio did not respond properly"); 412 + } else { 413 + if (dsbr100_start(radio)==-1) 414 + warn("Radio did not respond properly"); 415 + } 416 + return 0; 417 + } 418 + return -EINVAL; 419 + } 420 + 421 + static int vidioc_g_audio(struct file *file, void *priv, 422 + struct v4l2_audio *a) 423 + { 424 + if (a->index > 1) 425 + return -EINVAL; 426 + 427 + strcpy(a->name, "Radio"); 428 + a->capability = V4L2_AUDCAP_STEREO; 429 + return 0; 430 + } 431 + 432 + static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) 433 + { 434 + *i = 0; 435 + return 0; 436 + } 437 + 438 + static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) 439 + { 440 + if (i != 0) 441 + return -EINVAL; 442 + return 0; 443 + } 444 + 445 + static int vidioc_s_audio(struct file *file, void *priv, 446 + struct v4l2_audio *a) 447 + { 448 + if (a->index != 0) 449 + return -EINVAL; 450 + return 0; 388 451 } 389 452 390 453 static int usb_dsbr100_open(struct inode *inode, struct file *file) ··· 427 462 if (radio->removed) { 428 463 kfree(radio); 429 464 } 465 + return 0; 466 + } 467 + 468 + /* File system interface */ 469 + static const struct file_operations usb_dsbr100_fops = { 470 + .owner = THIS_MODULE, 471 + .open = usb_dsbr100_open, 472 + .release = usb_dsbr100_close, 473 + .ioctl = video_ioctl2, 474 + .compat_ioctl = v4l_compat_ioctl32, 475 + .llseek = no_llseek, 476 + }; 477 + 478 + /* V4L2 interface */ 479 + static struct video_device dsbr100_videodev_template = 480 + { 481 + .owner = THIS_MODULE, 482 + .name = "D-Link DSB-R 100", 483 + .type = VID_TYPE_TUNER, 484 + .fops = &usb_dsbr100_fops, 485 + .release = video_device_release, 486 + .vidioc_querycap = vidioc_querycap, 487 + .vidioc_g_tuner = vidioc_g_tuner, 488 + .vidioc_s_tuner = vidioc_s_tuner, 489 + .vidioc_g_frequency = vidioc_g_frequency, 490 + .vidioc_s_frequency = vidioc_s_frequency, 491 + .vidioc_queryctrl = vidioc_queryctrl, 492 + .vidioc_g_ctrl = vidioc_g_ctrl, 493 + .vidioc_s_ctrl = vidioc_s_ctrl, 494 + .vidioc_g_audio = vidioc_g_audio, 495 + .vidioc_s_audio = vidioc_s_audio, 496 + .vidioc_g_input = vidioc_g_input, 497 + .vidioc_s_input = vidioc_s_input, 498 + }; 499 + 500 + /* check if the device is present and register with v4l and 501 + usb if it is */ 502 + static int usb_dsbr100_probe(struct usb_interface *intf, 503 + const struct usb_device_id *id) 504 + { 505 + struct dsbr100_device *radio; 506 + 507 + if (!(radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL))) 508 + return -ENOMEM; 509 + if (!(radio->videodev = video_device_alloc())) { 510 + kfree(radio); 511 + return -ENOMEM; 512 + } 513 + memcpy(radio->videodev, &dsbr100_videodev_template, 514 + sizeof(dsbr100_videodev_template)); 515 + radio->removed = 0; 516 + radio->users = 0; 517 + radio->usbdev = interface_to_usbdev(intf); 518 + radio->curfreq = FREQ_MIN*FREQ_MUL; 519 + video_set_drvdata(radio->videodev, radio); 520 + if (video_register_device(radio->videodev, VFL_TYPE_RADIO,radio_nr)) { 521 + warn("Could not register video device"); 522 + video_device_release(radio->videodev); 523 + kfree(radio); 524 + return -EIO; 525 + } 526 + usb_set_intfdata(intf, radio); 430 527 return 0; 431 528 } 432 529
+187 -126
drivers/media/radio/radio-cadet.c
··· 48 48 49 49 #define CADET_VERSION KERNEL_VERSION(0,3,3) 50 50 51 + static struct v4l2_queryctrl radio_qctrl[] = { 52 + { 53 + .id = V4L2_CID_AUDIO_MUTE, 54 + .name = "Mute", 55 + .minimum = 0, 56 + .maximum = 1, 57 + .default_value = 1, 58 + .type = V4L2_CTRL_TYPE_BOOLEAN, 59 + },{ 60 + .id = V4L2_CID_AUDIO_VOLUME, 61 + .name = "Volume", 62 + .minimum = 0, 63 + .maximum = 0xff, 64 + .step = 1, 65 + .default_value = 0xff, 66 + .type = V4L2_CTRL_TYPE_INTEGER, 67 + } 68 + }; 69 + 51 70 static int io=-1; /* default to isapnp activation */ 52 71 static int radio_nr = -1; 53 72 static int users=0; ··· 366 347 } 367 348 368 349 369 - 370 - static int cadet_do_ioctl(struct inode *inode, struct file *file, 371 - unsigned int cmd, void *arg) 350 + static int vidioc_querycap(struct file *file, void *priv, 351 + struct v4l2_capability *v) 372 352 { 373 - switch(cmd) 374 - { 375 - case VIDIOC_QUERYCAP: 376 - { 377 - struct v4l2_capability *cap = arg; 378 - memset(cap,0,sizeof(*cap)); 379 - cap->capabilities = 380 - V4L2_CAP_TUNER | 381 - V4L2_CAP_READWRITE; 382 - cap->version = CADET_VERSION; 383 - strcpy(cap->driver, "ADS Cadet"); 384 - strcpy(cap->card, "ADS Cadet"); 385 - return 0; 386 - } 387 - case VIDIOC_G_TUNER: 388 - { 389 - struct v4l2_tuner *t = arg; 390 - memset(t,0,sizeof(*t)); 391 - t->type = V4L2_TUNER_RADIO; 392 - switch (t->index) 393 - { 394 - case 0: strcpy(t->name, "FM"); 395 - t->capability = V4L2_TUNER_CAP_STEREO; 396 - t->rangelow = 1400; /* 87.5 MHz */ 397 - t->rangehigh = 1728; /* 108.0 MHz */ 398 - t->rxsubchans=cadet_getstereo(); 399 - switch (t->rxsubchans){ 400 - case V4L2_TUNER_SUB_MONO: 401 - t->audmode = V4L2_TUNER_MODE_MONO; 402 - break; 403 - case V4L2_TUNER_SUB_STEREO: 404 - t->audmode = V4L2_TUNER_MODE_STEREO; 405 - break; 406 - default: ; 407 - } 408 - break; 409 - case 1: strcpy(t->name, "AM"); 410 - t->capability = V4L2_TUNER_CAP_LOW; 411 - t->rangelow = 8320; /* 520 kHz */ 412 - t->rangehigh = 26400; /* 1650 kHz */ 413 - t->rxsubchans = V4L2_TUNER_SUB_MONO; 414 - t->audmode = V4L2_TUNER_MODE_MONO; 415 - break; 416 - default: 417 - return -EINVAL; 418 - } 419 - 420 - t->signal = sigstrength; /* We might need to modify scaling of this */ 421 - return 0; 422 - } 423 - case VIDIOC_S_TUNER: 424 - { 425 - struct v4l2_tuner *t = arg; 426 - if((t->index != 0)&&(t->index != 1)) 427 - return -EINVAL; 428 - 429 - curtuner = t->index; 430 - return 0; 431 - } 432 - case VIDIOC_G_FREQUENCY: 433 - { 434 - struct v4l2_frequency *f = arg; 435 - memset(f,0,sizeof(*f)); 436 - f->tuner = curtuner; 437 - f->type = V4L2_TUNER_RADIO; 438 - f->frequency = cadet_getfreq(); 439 - return 0; 440 - } 441 - case VIDIOC_S_FREQUENCY: 442 - { 443 - struct v4l2_frequency *f = arg; 444 - if (f->type != V4L2_TUNER_RADIO){ 445 - return -EINVAL; 446 - } 447 - if((curtuner==0)&&((f->frequency<1400)||(f->frequency>1728))) { 448 - return -EINVAL; 449 - } 450 - if((curtuner==1)&&((f->frequency<8320)||(f->frequency>26400))) { 451 - return -EINVAL; 452 - } 453 - cadet_setfreq(f->frequency); 454 - return 0; 455 - } 456 - case VIDIOC_G_CTRL: 457 - { 458 - struct v4l2_control *c = arg; 459 - switch (c->id){ 460 - case V4L2_CID_AUDIO_MUTE: /* TODO: Handle this correctly */ 461 - c->value = (cadet_getvol() == 0); 462 - break; 463 - case V4L2_CID_AUDIO_VOLUME: 464 - c->value = cadet_getvol(); 465 - break; 466 - default: 467 - return -EINVAL; 468 - } 469 - return 0; 470 - } 471 - case VIDIOC_S_CTRL: 472 - { 473 - struct v4l2_control *c = arg; 474 - switch (c->id){ 475 - case V4L2_CID_AUDIO_MUTE: /* TODO: Handle this correctly */ 476 - if (c->value) cadet_setvol(0); 477 - else cadet_setvol(0xffff); 478 - break; 479 - case V4L2_CID_AUDIO_VOLUME: 480 - cadet_setvol(c->value); 481 - break; 482 - default: 483 - return -EINVAL; 484 - } 485 - return 0; 486 - } 487 - 488 - default: 489 - return -ENOIOCTLCMD; 490 - } 353 + v->capabilities = 354 + V4L2_CAP_TUNER | 355 + V4L2_CAP_READWRITE; 356 + v->version = CADET_VERSION; 357 + strcpy(v->driver, "ADS Cadet"); 358 + strcpy(v->card, "ADS Cadet"); 359 + return 0; 491 360 } 492 361 493 - static int 494 - cadet_ioctl(struct inode *inode, struct file *file, 495 - unsigned int cmd, unsigned long arg) 362 + static int vidioc_g_tuner(struct file *file, void *priv, 363 + struct v4l2_tuner *v) 496 364 { 497 - return video_usercopy(inode, file, cmd, arg, cadet_do_ioctl); 365 + v->type = V4L2_TUNER_RADIO; 366 + switch (v->index) { 367 + case 0: 368 + strcpy(v->name, "FM"); 369 + v->capability = V4L2_TUNER_CAP_STEREO; 370 + v->rangelow = 1400; /* 87.5 MHz */ 371 + v->rangehigh = 1728; /* 108.0 MHz */ 372 + v->rxsubchans=cadet_getstereo(); 373 + switch (v->rxsubchans){ 374 + case V4L2_TUNER_SUB_MONO: 375 + v->audmode = V4L2_TUNER_MODE_MONO; 376 + break; 377 + case V4L2_TUNER_SUB_STEREO: 378 + v->audmode = V4L2_TUNER_MODE_STEREO; 379 + break; 380 + default: ; 381 + } 382 + break; 383 + case 1: 384 + strcpy(v->name, "AM"); 385 + v->capability = V4L2_TUNER_CAP_LOW; 386 + v->rangelow = 8320; /* 520 kHz */ 387 + v->rangehigh = 26400; /* 1650 kHz */ 388 + v->rxsubchans = V4L2_TUNER_SUB_MONO; 389 + v->audmode = V4L2_TUNER_MODE_MONO; 390 + break; 391 + default: 392 + return -EINVAL; 393 + } 394 + v->signal = sigstrength; /* We might need to modify scaling of this */ 395 + return 0; 396 + } 397 + 398 + static int vidioc_s_tuner(struct file *file, void *priv, 399 + struct v4l2_tuner *v) 400 + { 401 + if((v->index != 0)&&(v->index != 1)) 402 + return -EINVAL; 403 + curtuner = v->index; 404 + return 0; 405 + } 406 + 407 + static int vidioc_g_frequency(struct file *file, void *priv, 408 + struct v4l2_frequency *f) 409 + { 410 + f->tuner = curtuner; 411 + f->type = V4L2_TUNER_RADIO; 412 + f->frequency = cadet_getfreq(); 413 + return 0; 414 + } 415 + 416 + 417 + static int vidioc_s_frequency(struct file *file, void *priv, 418 + struct v4l2_frequency *f) 419 + { 420 + if (f->type != V4L2_TUNER_RADIO) 421 + return -EINVAL; 422 + if((curtuner==0)&&((f->frequency<1400)||(f->frequency>1728))) 423 + return -EINVAL; 424 + if((curtuner==1)&&((f->frequency<8320)||(f->frequency>26400))) 425 + return -EINVAL; 426 + cadet_setfreq(f->frequency); 427 + return 0; 428 + } 429 + 430 + static int vidioc_queryctrl(struct file *file, void *priv, 431 + struct v4l2_queryctrl *qc) 432 + { 433 + int i; 434 + 435 + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { 436 + if (qc->id && qc->id == radio_qctrl[i].id) { 437 + memcpy(qc, &(radio_qctrl[i]), 438 + sizeof(*qc)); 439 + return 0; 440 + } 441 + } 442 + return -EINVAL; 443 + } 444 + 445 + static int vidioc_g_ctrl(struct file *file, void *priv, 446 + struct v4l2_control *ctrl) 447 + { 448 + switch (ctrl->id){ 449 + case V4L2_CID_AUDIO_MUTE: /* TODO: Handle this correctly */ 450 + ctrl->value = (cadet_getvol() == 0); 451 + break; 452 + case V4L2_CID_AUDIO_VOLUME: 453 + ctrl->value = cadet_getvol(); 454 + break; 455 + default: 456 + return -EINVAL; 457 + } 458 + return 0; 459 + } 460 + 461 + static int vidioc_s_ctrl(struct file *file, void *priv, 462 + struct v4l2_control *ctrl) 463 + { 464 + switch (ctrl->id){ 465 + case V4L2_CID_AUDIO_MUTE: /* TODO: Handle this correctly */ 466 + if (ctrl->value) 467 + cadet_setvol(0); 468 + else 469 + cadet_setvol(0xffff); 470 + break; 471 + case V4L2_CID_AUDIO_VOLUME: 472 + cadet_setvol(ctrl->value); 473 + break; 474 + default: 475 + return -EINVAL; 476 + } 477 + return 0; 478 + } 479 + 480 + static int vidioc_g_audio(struct file *file, void *priv, 481 + struct v4l2_audio *a) 482 + { 483 + if (a->index > 1) 484 + return -EINVAL; 485 + strcpy(a->name, "Radio"); 486 + a->capability = V4L2_AUDCAP_STEREO; 487 + return 0; 488 + } 489 + 490 + static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) 491 + { 492 + *i = 0; 493 + return 0; 494 + } 495 + 496 + static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) 497 + { 498 + if (i != 0) 499 + return -EINVAL; 500 + return 0; 501 + } 502 + 503 + static int vidioc_s_audio(struct file *file, void *priv, 504 + struct v4l2_audio *a) 505 + { 506 + if (a->index != 0) 507 + return -EINVAL; 508 + return 0; 498 509 } 499 510 500 511 static int ··· 561 512 .open = cadet_open, 562 513 .release = cadet_release, 563 514 .read = cadet_read, 564 - .ioctl = cadet_ioctl, 515 + .ioctl = video_ioctl2, 565 516 .poll = cadet_poll, 566 517 .compat_ioctl = v4l_compat_ioctl32, 567 518 .llseek = no_llseek, ··· 573 524 .name = "Cadet radio", 574 525 .type = VID_TYPE_TUNER, 575 526 .fops = &cadet_fops, 527 + .vidioc_querycap = vidioc_querycap, 528 + .vidioc_g_tuner = vidioc_g_tuner, 529 + .vidioc_s_tuner = vidioc_s_tuner, 530 + .vidioc_g_frequency = vidioc_g_frequency, 531 + .vidioc_s_frequency = vidioc_s_frequency, 532 + .vidioc_queryctrl = vidioc_queryctrl, 533 + .vidioc_g_ctrl = vidioc_g_ctrl, 534 + .vidioc_s_ctrl = vidioc_s_ctrl, 535 + .vidioc_g_audio = vidioc_g_audio, 536 + .vidioc_s_audio = vidioc_s_audio, 537 + .vidioc_g_input = vidioc_g_input, 538 + .vidioc_s_input = vidioc_s_input, 576 539 }; 577 540 578 541 static struct pnp_device_id cadet_pnp_devices[] = {
-3
drivers/media/radio/radio-maestro.c
··· 24 24 #include <linux/delay.h> 25 25 #include <asm/io.h> 26 26 #include <asm/uaccess.h> 27 - #include <linux/mutex.h> 28 27 #include <linux/pci.h> 29 28 #include <linux/videodev2.h> 30 29 #include <media/v4l2-common.h> ··· 109 110 muted, /* VIDEO_AUDIO_MUTE */ 110 111 stereo, /* VIDEO_TUNER_STEREO_ON */ 111 112 tuned; /* signal strength (0 or 0xffff) */ 112 - struct mutex lock; 113 113 }; 114 114 115 115 static u32 radio_bits_get(struct radio_device *dev) ··· 392 394 } 393 395 394 396 radio_unit->io = pci_resource_start(pdev, 0) + GPIO_DATA; 395 - mutex_init(&radio_unit->lock); 396 397 397 398 maestro_radio_inst = video_device_alloc(); 398 399 if (maestro_radio_inst == NULL) {
-1
drivers/media/radio/radio-zoltrix.c
··· 410 410 .owner = THIS_MODULE, 411 411 .name = "Zoltrix Radio Plus", 412 412 .type = VID_TYPE_TUNER, 413 - .hardware = 0, 414 413 .fops = &zoltrix_fops, 415 414 .vidioc_querycap = vidioc_querycap, 416 415 .vidioc_g_tuner = vidioc_g_tuner,
+27 -18
drivers/media/video/Kconfig
··· 2 2 # Multimedia Video device configuration 3 3 # 4 4 5 - menu "Video Capture Adapters" 5 + menuconfig VIDEO_CAPTURE_DRIVERS 6 + bool "Video capture adapters" 6 7 depends on VIDEO_DEV 8 + default y 9 + ---help--- 10 + Say Y here to enable selecting the video adapters for 11 + webcams, analog TV, and hybrid analog/digital TV. 12 + Some of those devices also supports FM radio. 7 13 8 - comment "Video Capture Adapters" 14 + if VIDEO_CAPTURE_DRIVERS 9 15 10 16 config VIDEO_ADV_DEBUG 11 17 bool "Enable advanced debug functionality" 12 - depends on VIDEO_DEV 13 18 default n 14 19 ---help--- 15 20 Say Y here to enable advanced debugging functionality on some ··· 39 34 # 40 35 41 36 menu "Encoders/decoders and other helper chips" 42 - depends on VIDEO_DEV && !VIDEO_HELPER_CHIPS_AUTO 37 + depends on !VIDEO_HELPER_CHIPS_AUTO 43 38 44 39 comment "Audio decoders" 45 40 ··· 66 61 67 62 config VIDEO_TDA9840 68 63 tristate "Philips TDA9840 audio processor" 69 - depends on VIDEO_DEV && I2C 64 + depends on I2C 70 65 ---help--- 71 66 Support for tda9840 audio decoder chip found on some Zoran boards. 72 67 ··· 84 79 85 80 config VIDEO_TEA6415C 86 81 tristate "Philips TEA6415C audio processor" 87 - depends on VIDEO_DEV && I2C 82 + depends on I2C 88 83 ---help--- 89 84 Support for tea6415c audio decoder chip found on some bt8xx boards. 90 85 ··· 93 88 94 89 config VIDEO_TEA6420 95 90 tristate "Philips TEA6420 audio processor" 96 - depends on VIDEO_DEV && I2C 91 + depends on I2C 97 92 ---help--- 98 93 Support for tea6420 audio decoder chip found on some bt8xx boards. 99 94 ··· 474 469 475 470 config VIDEO_SAA5249 476 471 tristate "SAA5249 Teletext processor" 477 - depends on VIDEO_DEV && I2C && VIDEO_V4L2 472 + depends on I2C && VIDEO_V4L2 478 473 help 479 474 Support for I2C bus based teletext using the SAA5249 chip. At the 480 475 moment this is only useful on some European WinTV cards. ··· 484 479 485 480 config TUNER_3036 486 481 tristate "SAB3036 tuner" 487 - depends on VIDEO_DEV && I2C && VIDEO_V4L1 482 + depends on I2C && VIDEO_V4L1 488 483 help 489 484 Say Y here to include support for Philips SAB3036 compatible tuners. 490 485 If in doubt, say N. ··· 686 681 # USB Multimedia device configuration 687 682 # 688 683 689 - menu "V4L USB devices" 690 - depends on USB && VIDEO_DEV 684 + menuconfig V4L_USB_DRIVERS 685 + bool "V4L USB devices" 686 + depends on USB 687 + default y 688 + 689 + if V4L_USB_DRIVERS 691 690 692 691 source "drivers/media/video/pvrusb2/Kconfig" 693 692 ··· 716 707 717 708 config USB_W9968CF 718 709 tristate "USB W996[87]CF JPEG Dual Mode Camera support" 719 - depends on USB && VIDEO_V4L1 && I2C 710 + depends on VIDEO_V4L1 && I2C 720 711 select VIDEO_OVCAMCHIP 721 712 ---help--- 722 713 Say Y here if you want support for cameras based on OV681 or ··· 734 725 735 726 config USB_OV511 736 727 tristate "USB OV511 Camera support" 737 - depends on USB && VIDEO_V4L1 728 + depends on VIDEO_V4L1 738 729 ---help--- 739 730 Say Y here if you want to connect this type of camera to your 740 731 computer's USB port. See <file:Documentation/video4linux/ov511.txt> ··· 745 736 746 737 config USB_SE401 747 738 tristate "USB SE401 Camera support" 748 - depends on USB && VIDEO_V4L1 739 + depends on VIDEO_V4L1 749 740 ---help--- 750 741 Say Y here if you want to connect this type of camera to your 751 742 computer's USB port. See <file:Documentation/video4linux/se401.txt> ··· 758 749 759 750 config USB_STV680 760 751 tristate "USB STV680 (Pencam) Camera support" 761 - depends on USB && VIDEO_V4L1 752 + depends on VIDEO_V4L1 762 753 ---help--- 763 754 Say Y here if you want to connect this type of camera to your 764 755 computer's USB port. This includes the Pencam line of cameras. ··· 774 765 775 766 config USB_ZR364XX 776 767 tristate "USB ZR364XX Camera support" 777 - depends on USB && VIDEO_V4L2 768 + depends on VIDEO_V4L2 778 769 ---help--- 779 770 Say Y here if you want to connect this type of camera to your 780 771 computer's USB port. ··· 784 775 To compile this driver as a module, choose M here: the 785 776 module will be called zr364xx. 786 777 787 - endmenu # V4L USB devices 778 + endif # V4L_USB_DRIVERS 788 779 789 - endmenu 780 + endif # VIDEO_CAPTURE_DRIVERS
+2 -2
drivers/media/video/cx25840/cx25840-core.c
··· 555 555 { 556 556 struct v4l2_pix_format *pix; 557 557 int HSC, VSC, Vsrc, Hsrc, filter, Vlines; 558 - int is_pal = !(cx25840_get_v4lstd(client) & V4L2_STD_NTSC); 558 + int is_50Hz = !(cx25840_get_v4lstd(client) & V4L2_STD_525_60); 559 559 560 560 switch (fmt->type) { 561 561 case V4L2_BUF_TYPE_VIDEO_CAPTURE: ··· 567 567 Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; 568 568 Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; 569 569 570 - Vlines = pix->height + (is_pal ? 4 : 7); 570 + Vlines = pix->height + (is_50Hz ? 4 : 7); 571 571 572 572 if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) || 573 573 (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) {
+3 -2
drivers/media/video/cx88/cx88-mpeg.c
··· 28 28 #include <linux/device.h> 29 29 #include <linux/dma-mapping.h> 30 30 #include <linux/interrupt.h> 31 + #include <linux/dma-mapping.h> 31 32 #include <asm/delay.h> 32 33 33 34 #include "cx88.h" ··· 613 612 } 614 613 615 614 /* Driver asked for hardware access. */ 616 - int cx8802_request_acquire(struct cx8802_driver *drv) 615 + static int cx8802_request_acquire(struct cx8802_driver *drv) 617 616 { 618 617 struct cx88_core *core = drv->core; 619 618 ··· 633 632 } 634 633 635 634 /* Driver asked to release hardware. */ 636 - int cx8802_request_release(struct cx8802_driver *drv) 635 + static int cx8802_request_release(struct cx8802_driver *drv) 637 636 { 638 637 struct cx88_core *core = drv->core; 639 638
+1
drivers/media/video/cx88/cx88-video.c
··· 36 36 #include <linux/dma-mapping.h> 37 37 #include <linux/delay.h> 38 38 #include <linux/kthread.h> 39 + #include <linux/dma-mapping.h> 39 40 #include <asm/div64.h> 40 41 41 42 #include "cx88.h"
-7
drivers/media/video/cx88/cx88-vp3054-i2c.c
··· 111 111 .id = I2C_HW_B_CX2388x, 112 112 }; 113 113 114 - static struct i2c_client vp3054_i2c_client_template = { 115 - .name = "VP-3054", 116 - }; 117 - 118 114 int vp3054_i2c_probe(struct cx8802_dev *dev) 119 115 { 120 116 struct cx88_core *core = dev->core; ··· 129 133 sizeof(vp3054_i2c->adap)); 130 134 memcpy(&vp3054_i2c->algo, &vp3054_i2c_algo_template, 131 135 sizeof(vp3054_i2c->algo)); 132 - memcpy(&vp3054_i2c->client, &vp3054_i2c_client_template, 133 - sizeof(vp3054_i2c->client)); 134 136 135 137 vp3054_i2c->adap.class |= I2C_CLASS_TV_DIGITAL; 136 138 ··· 138 144 vp3054_i2c->algo.data = dev; 139 145 i2c_set_adapdata(&vp3054_i2c->adap, dev); 140 146 vp3054_i2c->adap.algo_data = &vp3054_i2c->algo; 141 - vp3054_i2c->client.adapter = &vp3054_i2c->adap; 142 147 143 148 vp3054_bit_setscl(dev,1); 144 149 vp3054_bit_setsda(dev,1);
-1
drivers/media/video/cx88/cx88-vp3054-i2c.h
··· 26 26 struct vp3054_i2c_state { 27 27 struct i2c_adapter adap; 28 28 struct i2c_algo_bit_data algo; 29 - struct i2c_client client; 30 29 u32 state; 31 30 }; 32 31
+1 -1
drivers/media/video/em28xx/Kconfig
··· 1 1 config VIDEO_EM28XX 2 2 tristate "Empia EM2800/2820/2840 USB video capture support" 3 - depends on VIDEO_V4L1 && USB && I2C 3 + depends on VIDEO_V4L1 && I2C 4 4 select VIDEO_BUF 5 5 select VIDEO_TUNER 6 6 select VIDEO_TVEEPROM
+1 -1
drivers/media/video/et61x251/Kconfig
··· 1 1 config USB_ET61X251 2 2 tristate "USB ET61X[12]51 PC Camera Controller support" 3 - depends on USB && VIDEO_V4L1 3 + depends on VIDEO_V4L1 4 4 ---help--- 5 5 Say Y here if you want support for cameras based on Etoms ET61X151 6 6 or ET61X251 PC Camera Controllers.
+1 -1
drivers/media/video/ivtv/ivtv-driver.c
··· 74 74 struct ivtv *ivtv_cards[IVTV_MAX_CARDS]; 75 75 76 76 /* Protects ivtv_cards_active */ 77 - spinlock_t ivtv_cards_lock = SPIN_LOCK_UNLOCKED; 77 + DEFINE_SPINLOCK(ivtv_cards_lock); 78 78 79 79 /* add your revision and whatnot here */ 80 80 static struct pci_device_id ivtv_pci_tbl[] __devinitdata = {
+1 -1
drivers/media/video/ivtv/ivtv-fileops.c
··· 804 804 struct ivtv_open_id *item; 805 805 struct ivtv *itv = NULL; 806 806 struct ivtv_stream *s = NULL; 807 - int minor = MINOR(inode->i_rdev); 807 + int minor = iminor(inode); 808 808 809 809 /* Find which card this open was on */ 810 810 spin_lock(&ivtv_cards_lock);
+1 -1
drivers/media/video/pvrusb2/Kconfig
··· 1 1 config VIDEO_PVRUSB2 2 2 tristate "Hauppauge WinTV-PVR USB2 support" 3 - depends on VIDEO_V4L2 && USB && I2C && EXPERIMENTAL 3 + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL 4 4 select FW_LOADER 5 5 select VIDEO_TUNER 6 6 select VIDEO_TVEEPROM
+10 -3
drivers/media/video/pvrusb2/pvrusb2-encoder.c
··· 391 391 int pvr2_encoder_configure(struct pvr2_hdw *hdw) 392 392 { 393 393 int ret; 394 + int val; 394 395 pvr2_trace(PVR2_TRACE_ENCODER,"pvr2_encoder_configure" 395 396 " (cx2341x module)"); 396 397 hdw->enc_ctl_state.port = CX2341X_PORT_STREAMING; 397 398 hdw->enc_ctl_state.width = hdw->res_hor_val; 398 399 hdw->enc_ctl_state.height = hdw->res_ver_val; 399 - hdw->enc_ctl_state.is_50hz = ((hdw->std_mask_cur & 400 - (V4L2_STD_NTSC|V4L2_STD_PAL_M)) ? 400 + hdw->enc_ctl_state.is_50hz = ((hdw->std_mask_cur & V4L2_STD_525_60) ? 401 401 0 : 1); 402 402 403 403 ret = 0; 404 404 405 405 ret |= pvr2_encoder_prep_config(hdw); 406 406 407 + /* saa7115: 0xf0 */ 408 + val = 0xf0; 409 + if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { 410 + /* ivtv cx25840: 0x140 */ 411 + val = 0x140; 412 + } 413 + 407 414 if (!ret) ret = pvr2_encoder_vcmd( 408 415 hdw,CX2341X_ENC_SET_NUM_VSYNC_LINES, 2, 409 - 0xf0, 0xf0); 416 + val, val); 410 417 411 418 /* setup firmware to notify us about some events (don't know why...) */ 412 419 if (!ret) ret = pvr2_encoder_vcmd(
+5 -5
drivers/media/video/pvrusb2/pvrusb2-hdw.c
··· 83 83 }; 84 84 85 85 static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; 86 - static DECLARE_MUTEX(pvr2_unit_sem); 86 + static DEFINE_MUTEX(pvr2_unit_mtx); 87 87 88 88 static int ctlchg = 0; 89 89 static int initusbreset = 1; ··· 2076 2076 hdw->ctl_read_urb = usb_alloc_urb(0,GFP_KERNEL); 2077 2077 if (!hdw->ctl_read_urb) goto fail; 2078 2078 2079 - down(&pvr2_unit_sem); do { 2079 + mutex_lock(&pvr2_unit_mtx); do { 2080 2080 for (idx = 0; idx < PVR_NUM; idx++) { 2081 2081 if (unit_pointers[idx]) continue; 2082 2082 hdw->unit_number = idx; 2083 2083 unit_pointers[idx] = hdw; 2084 2084 break; 2085 2085 } 2086 - } while (0); up(&pvr2_unit_sem); 2086 + } while (0); mutex_unlock(&pvr2_unit_mtx); 2087 2087 2088 2088 cnt1 = 0; 2089 2089 cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2"); ··· 2186 2186 } 2187 2187 pvr2_i2c_core_done(hdw); 2188 2188 pvr2_hdw_remove_usb_stuff(hdw); 2189 - down(&pvr2_unit_sem); do { 2189 + mutex_lock(&pvr2_unit_mtx); do { 2190 2190 if ((hdw->unit_number >= 0) && 2191 2191 (hdw->unit_number < PVR_NUM) && 2192 2192 (unit_pointers[hdw->unit_number] == hdw)) { 2193 2193 unit_pointers[hdw->unit_number] = NULL; 2194 2194 } 2195 - } while (0); up(&pvr2_unit_sem); 2195 + } while (0); mutex_unlock(&pvr2_unit_mtx); 2196 2196 kfree(hdw->controls); 2197 2197 kfree(hdw->mpeg_ctrl_info); 2198 2198 kfree(hdw->std_defs);
+22 -1
drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
··· 23 23 #include "pvrusb2-hdw-internal.h" 24 24 #include "pvrusb2-debug.h" 25 25 #include "pvrusb2-fx2-cmd.h" 26 + #include "pvrusb2.h" 26 27 27 28 #define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__) 28 29 ··· 38 37 static unsigned int i2c_scan = 0; 39 38 module_param(i2c_scan, int, S_IRUGO|S_IWUSR); 40 39 MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); 40 + 41 + static int ir_mode[PVR_NUM] = { [0 ... PVR_NUM-1] = 1 }; 42 + module_param_array(ir_mode, int, NULL, 0444); 43 + MODULE_PARM_DESC(ir_mode,"specify: 0=disable IR reception, 1=normal IR"); 41 44 42 45 static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, 43 46 unsigned int detail, ··· 276 271 return 0; 277 272 } 278 273 return pvr2_i2c_basic_op(hdw,i2c_addr,wdata,wlen,rdata,rlen); 274 + } 275 + 276 + /* This is an entry point designed to always fail any attempt to perform a 277 + transfer. We use this to cause certain I2C addresses to not be 278 + probed. */ 279 + static int i2c_black_hole(struct pvr2_hdw *hdw, 280 + u8 i2c_addr,u8 *wdata,u16 wlen,u8 *rdata,u16 rlen) 281 + { 282 + return -EIO; 279 283 } 280 284 281 285 /* This is a special entry point that is entered if an I2C operation is ··· 1008 994 } 1009 995 1010 996 /* However, deal with various special cases for 24xxx hardware. */ 997 + if (ir_mode[hdw->unit_number] == 0) { 998 + printk(KERN_INFO "%s: IR disabled\n",hdw->name); 999 + hdw->i2c_func[0x18] = i2c_black_hole; 1000 + } else if (ir_mode[hdw->unit_number] == 1) { 1001 + if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { 1002 + hdw->i2c_func[0x18] = i2c_24xxx_ir; 1003 + } 1004 + } 1011 1005 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { 1012 1006 hdw->i2c_func[0x1b] = i2c_hack_wm8775; 1013 1007 hdw->i2c_func[0x44] = i2c_hack_cx25840; 1014 - hdw->i2c_func[0x18] = i2c_24xxx_ir; 1015 1008 } 1016 1009 1017 1010 // Configure the adapter and set up everything else related to it.
-14
drivers/media/video/pvrusb2/pvrusb2-sysfs.c
··· 518 518 } 519 519 sfp->item_last = cip; 520 520 521 - cip->attr_name.attr.owner = THIS_MODULE; 522 521 cip->attr_name.attr.name = "name"; 523 522 cip->attr_name.attr.mode = S_IRUGO; 524 523 cip->attr_name.show = fp->show_name; 525 524 526 - cip->attr_type.attr.owner = THIS_MODULE; 527 525 cip->attr_type.attr.name = "type"; 528 526 cip->attr_type.attr.mode = S_IRUGO; 529 527 cip->attr_type.show = fp->show_type; 530 528 531 - cip->attr_min.attr.owner = THIS_MODULE; 532 529 cip->attr_min.attr.name = "min_val"; 533 530 cip->attr_min.attr.mode = S_IRUGO; 534 531 cip->attr_min.show = fp->show_min; 535 532 536 - cip->attr_max.attr.owner = THIS_MODULE; 537 533 cip->attr_max.attr.name = "max_val"; 538 534 cip->attr_max.attr.mode = S_IRUGO; 539 535 cip->attr_max.show = fp->show_max; 540 536 541 - cip->attr_val.attr.owner = THIS_MODULE; 542 537 cip->attr_val.attr.name = "cur_val"; 543 538 cip->attr_val.attr.mode = S_IRUGO; 544 539 545 - cip->attr_custom.attr.owner = THIS_MODULE; 546 540 cip->attr_custom.attr.name = "custom_val"; 547 541 cip->attr_custom.attr.mode = S_IRUGO; 548 542 549 - cip->attr_enum.attr.owner = THIS_MODULE; 550 543 cip->attr_enum.attr.name = "enum_val"; 551 544 cip->attr_enum.attr.mode = S_IRUGO; 552 545 cip->attr_enum.show = fp->show_enum; 553 546 554 - cip->attr_bits.attr.owner = THIS_MODULE; 555 547 cip->attr_bits.attr.name = "bit_val"; 556 548 cip->attr_bits.attr.mode = S_IRUGO; 557 549 cip->attr_bits.show = fp->show_bits; ··· 608 616 609 617 dip = kzalloc(sizeof(*dip),GFP_KERNEL); 610 618 if (!dip) return; 611 - dip->attr_debugcmd.attr.owner = THIS_MODULE; 612 619 dip->attr_debugcmd.attr.name = "debugcmd"; 613 620 dip->attr_debugcmd.attr.mode = S_IRUGO|S_IWUSR|S_IWGRP; 614 621 dip->attr_debugcmd.show = debugcmd_show; 615 622 dip->attr_debugcmd.store = debugcmd_store; 616 - dip->attr_debuginfo.attr.owner = THIS_MODULE; 617 623 dip->attr_debuginfo.attr.name = "debuginfo"; 618 624 dip->attr_debuginfo.attr.mode = S_IRUGO; 619 625 dip->attr_debuginfo.show = debuginfo_show; ··· 801 811 return; 802 812 } 803 813 804 - sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE; 805 814 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; 806 815 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; 807 816 sfp->attr_v4l_minor_number.show = v4l_minor_number_show; ··· 814 825 sfp->v4l_minor_number_created_ok = !0; 815 826 } 816 827 817 - sfp->attr_v4l_radio_minor_number.attr.owner = THIS_MODULE; 818 828 sfp->attr_v4l_radio_minor_number.attr.name = "v4l_radio_minor_number"; 819 829 sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO; 820 830 sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show; ··· 827 839 sfp->v4l_radio_minor_number_created_ok = !0; 828 840 } 829 841 830 - sfp->attr_unit_number.attr.owner = THIS_MODULE; 831 842 sfp->attr_unit_number.attr.name = "unit_number"; 832 843 sfp->attr_unit_number.attr.mode = S_IRUGO; 833 844 sfp->attr_unit_number.show = unit_number_show; ··· 839 852 sfp->unit_number_created_ok = !0; 840 853 } 841 854 842 - sfp->attr_bus_info.attr.owner = THIS_MODULE; 843 855 sfp->attr_bus_info.attr.name = "bus_info_str"; 844 856 sfp->attr_bus_info.attr.mode = S_IRUGO; 845 857 sfp->attr_bus_info.show = bus_info_show;
+1 -1
drivers/media/video/pwc/Kconfig
··· 1 1 config USB_PWC 2 2 tristate "USB Philips Cameras" 3 - depends on USB && VIDEO_V4L1 3 + depends on VIDEO_V4L1 4 4 ---help--- 5 5 Say Y or M here if you want to use one of these Philips & OEM 6 6 webcams:
+122 -1
drivers/media/video/saa7134/saa7134-cards.c
··· 1170 1170 .amux = LINE2, 1171 1171 }, 1172 1172 }, 1173 + [SAA7134_BOARD_ECS_TVP3XP_4CB6] = { 1174 + /* Barry Scott <barry.scott@onelan.co.uk> */ 1175 + .name = "Elitegroup ECS TVP3XP FM1246 Tuner Card (PAL,FM)", 1176 + .audio_clock = 0x187de7, 1177 + .tuner_type = TUNER_PHILIPS_PAL_I, 1178 + .radio_type = UNSET, 1179 + .tuner_addr = ADDR_UNSET, 1180 + .radio_addr = ADDR_UNSET, 1181 + .inputs = {{ 1182 + .name = name_tv, 1183 + .vmux = 1, 1184 + .amux = TV, 1185 + .tv = 1, 1186 + },{ 1187 + .name = name_tv_mono, 1188 + .vmux = 1, 1189 + .amux = LINE2, 1190 + .tv = 1, 1191 + },{ 1192 + .name = name_comp1, 1193 + .vmux = 3, 1194 + .amux = LINE1, 1195 + },{ 1196 + .name = name_svideo, 1197 + .vmux = 8, 1198 + .amux = LINE1, 1199 + },{ 1200 + .name = "CVid over SVid", 1201 + .vmux = 0, 1202 + .amux = LINE1, 1203 + }}, 1204 + .radio = { 1205 + .name = name_radio, 1206 + .amux = LINE2, 1207 + }, 1208 + }, 1173 1209 [SAA7134_BOARD_AVACSSMARTTV] = { 1174 1210 /* Roman Pszonczenko <romka@kolos.math.uni.lodz.pl> */ 1175 1211 .name = "AVACS SmartTV", ··· 2790 2754 .amux = LINE1, 2791 2755 }, 2792 2756 }, 2757 + [SAA7134_BOARD_KWORLD_DVBT_210] = { 2758 + .name = "KWorld DVB-T 210", 2759 + .audio_clock = 0x00187de7, 2760 + .tuner_type = TUNER_PHILIPS_TDA8290, 2761 + .radio_type = UNSET, 2762 + .tuner_addr = ADDR_UNSET, 2763 + .radio_addr = ADDR_UNSET, 2764 + .mpeg = SAA7134_MPEG_DVB, 2765 + .gpiomask = 1 << 21, 2766 + .inputs = {{ 2767 + .name = name_tv, 2768 + .vmux = 1, 2769 + .amux = TV, 2770 + .tv = 1, 2771 + },{ 2772 + .name = name_comp1, 2773 + .vmux = 3, 2774 + .amux = LINE1, 2775 + },{ 2776 + .name = name_svideo, 2777 + .vmux = 8, 2778 + .amux = LINE1, 2779 + }}, 2780 + .radio = { 2781 + .name = name_radio, 2782 + .amux = TV, 2783 + .gpio = 0x0200000, 2784 + }, 2785 + }, 2793 2786 [SAA7134_BOARD_KWORLD_ATSC110] = { 2794 2787 .name = "Kworld ATSC110", 2795 2788 .audio_clock = 0x00187de7, ··· 3472 3407 .gpio = 0x0200000, 3473 3408 }, 3474 3409 }, 3410 + [SAA7134_BOARD_SABRENT_TV_PCB05] = { 3411 + .name = "Sabrent PCMCIA TV-PCB05", 3412 + .audio_clock = 0x00187de7, 3413 + .tuner_type = TUNER_PHILIPS_TDA8290, 3414 + .radio_type = UNSET, 3415 + .tuner_addr = ADDR_UNSET, 3416 + .radio_addr = ADDR_UNSET, 3417 + .inputs = {{ 3418 + .name = name_tv, 3419 + .vmux = 1, 3420 + .amux = TV, 3421 + .tv = 1, 3422 + },{ 3423 + .name = name_comp1, 3424 + .vmux = 3, 3425 + .amux = LINE1, 3426 + },{ 3427 + .name = name_comp2, 3428 + .vmux = 0, 3429 + .amux = LINE1, 3430 + },{ 3431 + .name = name_svideo, 3432 + .vmux = 8, 3433 + .amux = LINE1, 3434 + }}, 3435 + .mute = { 3436 + .name = name_mute, 3437 + .amux = TV, 3438 + }, 3439 + }, 3475 3440 }; 3476 3441 3477 3442 const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); ··· 3610 3515 .vendor = PCI_VENDOR_ID_PHILIPS, 3611 3516 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 3612 3517 .subvendor = 0x5168, /* Animation Technologies (LifeView) */ 3613 - .subdevice = 0x0214, /* Standard PCI, LR214WF */ 3518 + .subdevice = 0x0214, /* Standard PCI, LR214 Rev E and earlier (SAA7135) */ 3519 + .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, 3520 + },{ 3521 + .vendor = PCI_VENDOR_ID_PHILIPS, 3522 + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 3523 + .subvendor = 0x5168, /* Animation Technologies (LifeView) */ 3524 + .subdevice = 0x5214, /* Standard PCI, LR214 Rev F onwards (SAA7131) */ 3614 3525 .driver_data = SAA7134_BOARD_FLYTVPLATINUM_FM, 3615 3526 },{ 3616 3527 .vendor = PCI_VENDOR_ID_PHILIPS, ··· 3788 3687 .subvendor = 0x1019, 3789 3688 .subdevice = 0x4cb5, 3790 3689 .driver_data = SAA7134_BOARD_ECS_TVP3XP_4CB5, 3690 + },{ 3691 + .vendor = PCI_VENDOR_ID_PHILIPS, 3692 + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 3693 + .subvendor = 0x1019, 3694 + .subdevice = 0x4cb6, 3695 + .driver_data = SAA7134_BOARD_ECS_TVP3XP_4CB6, 3791 3696 },{ 3792 3697 .vendor = PCI_VENDOR_ID_PHILIPS, 3793 3698 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, ··· 4022 3915 .driver_data = SAA7134_BOARD_TEVION_DVBT_220RF, 4023 3916 },{ 4024 3917 .vendor = PCI_VENDOR_ID_PHILIPS, 3918 + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 3919 + .subvendor = 0x17de, 3920 + .subdevice = 0x7250, 3921 + .driver_data = SAA7134_BOARD_KWORLD_DVBT_210, 3922 + },{ 3923 + .vendor = PCI_VENDOR_ID_PHILIPS, 4025 3924 .device = PCI_DEVICE_ID_PHILIPS_SAA7133, /* SAA7135HL */ 4026 3925 .subvendor = 0x17de, 4027 3926 .subdevice = 0x7350, ··· 4213 4100 .subdevice = 0x4857, 4214 4101 .driver_data = SAA7134_BOARD_ASUSTeK_P7131_DUAL, 4215 4102 },{ 4103 + .vendor = PCI_VENDOR_ID_PHILIPS, 4104 + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 4105 + .subvendor = 0x0919, /* SinoVideo PCI 2309 Proteus (7134) */ 4106 + .subdevice = 0x2003, /* OEM cardbus */ 4107 + .driver_data = SAA7134_BOARD_SABRENT_TV_PCB05, 4108 + },{ 4216 4109 /* --- boards without eeprom + subsystem ID --- */ 4217 4110 .vendor = PCI_VENDOR_ID_PHILIPS, 4218 4111 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, ··· 4297 4178 case SAA7134_BOARD_CINERGY600_MK3: 4298 4179 case SAA7134_BOARD_ECS_TVP3XP: 4299 4180 case SAA7134_BOARD_ECS_TVP3XP_4CB5: 4181 + case SAA7134_BOARD_ECS_TVP3XP_4CB6: 4300 4182 case SAA7134_BOARD_MD2819: 4301 4183 case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: 4302 4184 case SAA7134_BOARD_KWORLD_XPERT: ··· 4546 4426 } 4547 4427 break; 4548 4428 case SAA7134_BOARD_PINNACLE_PCTV_310i: 4429 + case SAA7134_BOARD_KWORLD_DVBT_210: 4549 4430 case SAA7134_BOARD_TEVION_DVBT_220RF: 4550 4431 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 4551 4432 case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
+17
drivers/media/video/saa7134/saa7134-dvb.c
··· 887 887 .antenna_switch= 2, 888 888 .request_firmware = philips_tda1004x_request_firmware 889 889 }; 890 + static struct tda1004x_config kworld_dvb_t_210_config = { 891 + .demod_address = 0x08, 892 + .invert = 1, 893 + .invert_oclk = 0, 894 + .xtal_freq = TDA10046_XTAL_16M, 895 + .agc_config = TDA10046_AGC_TDA827X, 896 + .gpio_config = TDA10046_GP11_I, 897 + .if_freq = TDA10046_FREQ_045, 898 + .i2c_gate = 0x4b, 899 + .tuner_address = 0x61, 900 + .tuner_config = 2, 901 + .antenna_switch= 1, 902 + .request_firmware = philips_tda1004x_request_firmware 903 + }; 890 904 /* ------------------------------------------------------------------ 891 905 * special case: this card uses saa713x GPIO22 for the mode switch 892 906 */ ··· 1052 1038 dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_init; 1053 1039 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda6651_pll_set; 1054 1040 } 1041 + break; 1042 + case SAA7134_BOARD_KWORLD_DVBT_210: 1043 + configure_tda827x_fe(dev, &kworld_dvb_t_210_config); 1055 1044 break; 1056 1045 case SAA7134_BOARD_PHILIPS_TIGER: 1057 1046 configure_tda827x_fe(dev, &philips_tiger_config);
+3
drivers/media/video/saa7134/saa7134.h
··· 235 235 #define SAA7134_BOARD_AVERMEDIA_M102 110 236 236 #define SAA7134_BOARD_ASUS_P7131_4871 111 237 237 #define SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA 112 238 + #define SAA7134_BOARD_ECS_TVP3XP_4CB6 113 239 + #define SAA7134_BOARD_KWORLD_DVBT_210 114 240 + #define SAA7134_BOARD_SABRENT_TV_PCB05 115 238 241 239 242 #define SAA7134_MAXBOARDS 8 240 243 #define SAA7134_INPUT_MAX 8
+1 -1
drivers/media/video/sn9c102/Kconfig
··· 1 1 config USB_SN9C102 2 2 tristate "USB SN9C1xx PC Camera Controller support" 3 - depends on USB && VIDEO_V4L2 3 + depends on VIDEO_V4L2 4 4 ---help--- 5 5 Say Y here if you want support for cameras based on SONiX SN9C101, 6 6 SN9C102, SN9C103, SN9C105 and SN9C120 PC Camera Controllers.
+1 -1
drivers/media/video/sn9c102/sn9c102.h
··· 141 141 142 142 void 143 143 sn9c102_attach_sensor(struct sn9c102_device* cam, 144 - struct sn9c102_sensor* sensor) 144 + const struct sn9c102_sensor* sensor) 145 145 { 146 146 memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor)); 147 147 }
+42 -47
drivers/media/video/sn9c102/sn9c102_core.c
··· 48 48 #define SN9C102_MODULE_AUTHOR "(C) 2004-2007 Luca Risolia" 49 49 #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" 50 50 #define SN9C102_MODULE_LICENSE "GPL" 51 - #define SN9C102_MODULE_VERSION "1:1.39" 52 - #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 39) 51 + #define SN9C102_MODULE_VERSION "1:1.44" 52 + #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 1, 44) 53 53 54 54 /*****************************************************************************/ 55 55 ··· 209 209 } 210 210 211 211 /*****************************************************************************/ 212 + 212 213 /* 213 - * Write a sequence of count value/register pairs. Returns -1 after the 214 - * first failed write, or 0 for no errors. 215 - */ 214 + Write a sequence of count value/register pairs. Returns -1 after the first 215 + failed write, or 0 for no errors. 216 + */ 216 217 int sn9c102_write_regs(struct sn9c102_device* cam, const u8 valreg[][2], 217 218 int count) 218 219 { 219 220 struct usb_device* udev = cam->usbdev; 220 - u8* value = cam->control_buffer; /* Needed for DMA'able memory */ 221 + u8* buff = cam->control_buffer; 221 222 int i, res; 222 223 223 224 for (i = 0; i < count; i++) { 224 225 u8 index = valreg[i][1]; 225 226 226 227 /* 227 - * index is a u8, so it must be <256 and can't be out of range. 228 - * If we put in a check anyway, gcc annoys us with a warning 229 - * that our check is useless. People get all uppity when they 230 - * see warnings in the kernel compile. 231 - */ 228 + index is a u8, so it must be <256 and can't be out of range. 229 + If we put in a check anyway, gcc annoys us with a warning 230 + hat our check is useless. People get all uppity when they 231 + see warnings in the kernel compile. 232 + */ 232 233 233 - *value = valreg[i][0]; 234 - res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 235 - 0x08, 0x41, index, 0, 236 - value, 1, SN9C102_CTRL_TIMEOUT); 234 + *buff = valreg[i][0]; 235 + 236 + res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 237 + 0x41, index, 0, buff, 1, 238 + SN9C102_CTRL_TIMEOUT); 239 + 237 240 if (res < 0) { 238 241 DBG(3, "Failed to write a register (value 0x%02X, " 239 - "index 0x%02X, error %d)", *value, index, res); 242 + "index 0x%02X, error %d)", *buff, index, res); 240 243 return -1; 241 244 } 242 245 243 - cam->reg[index] = *value; 246 + cam->reg[index] = *buff; 244 247 } 245 248 246 249 return 0; ··· 275 272 } 276 273 277 274 278 - /* NOTE: reading some registers always returns 0 */ 279 - static int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) 275 + /* NOTE: with the SN9C10[123] reading some registers always returns 0 */ 276 + int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) 280 277 { 281 278 struct usb_device* udev = cam->usbdev; 282 279 u8* buff = cam->control_buffer; ··· 302 299 303 300 304 301 static int 305 - sn9c102_i2c_wait(struct sn9c102_device* cam, struct sn9c102_sensor* sensor) 302 + sn9c102_i2c_wait(struct sn9c102_device* cam, 303 + const struct sn9c102_sensor* sensor) 306 304 { 307 305 int i, r; 308 306 ··· 324 320 325 321 static int 326 322 sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, 327 - struct sn9c102_sensor* sensor) 323 + const struct sn9c102_sensor* sensor) 328 324 { 329 325 int r , err = 0; 330 326 ··· 346 342 347 343 static int 348 344 sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, 349 - struct sn9c102_sensor* sensor) 345 + const struct sn9c102_sensor* sensor) 350 346 { 351 347 int r; 352 348 r = sn9c102_read_reg(cam, 0x08); ··· 356 352 357 353 int 358 354 sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, 359 - struct sn9c102_sensor* sensor, u8 data0, u8 data1, 360 - u8 n, u8 buffer[]) 355 + const struct sn9c102_sensor* sensor, u8 data0, 356 + u8 data1, u8 n, u8 buffer[]) 361 357 { 362 358 struct usb_device* udev = cam->usbdev; 363 359 u8* data = cam->control_buffer; 364 - int err = 0, res; 360 + int i = 0, err = 0, res; 365 361 366 362 /* Write cycle */ 367 363 data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | ··· 406 402 } 407 403 408 404 if (buffer) 409 - memcpy(buffer, data, sizeof(buffer)); 405 + for (i = 0; i < n && i < 5; i++) 406 + buffer[n-i-1] = data[4-i]; 410 407 411 408 return (int)data[4]; 412 409 } ··· 415 410 416 411 int 417 412 sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, 418 - struct sn9c102_sensor* sensor, u8 n, u8 data0, 413 + const struct sn9c102_sensor* sensor, u8 n, u8 data0, 419 414 u8 data1, u8 data2, u8 data3, u8 data4, u8 data5) 420 415 { 421 416 struct usb_device* udev = cam->usbdev; ··· 454 449 455 450 int 456 451 sn9c102_i2c_try_read(struct sn9c102_device* cam, 457 - struct sn9c102_sensor* sensor, u8 address) 452 + const struct sn9c102_sensor* sensor, u8 address) 458 453 { 459 454 return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id, 460 455 address, 1, NULL); ··· 463 458 464 459 int 465 460 sn9c102_i2c_try_write(struct sn9c102_device* cam, 466 - struct sn9c102_sensor* sensor, u8 address, u8 value) 461 + const struct sn9c102_sensor* sensor, u8 address, u8 value) 467 462 { 468 463 return sn9c102_i2c_try_raw_write(cam, sensor, 3, 469 464 sensor->i2c_slave_id, address, ··· 659 654 *(pos + 567) = 0x21; 660 655 661 656 f->buf.bytesused += sizeof(jpeg_header); 662 - } 663 - 664 - 665 - static void 666 - sn9c102_write_eoimarker(struct sn9c102_device* cam, struct sn9c102_frame_t* f) 667 - { 668 - static const u8 eoi_marker[2] = {0xff, 0xd9}; 669 - 670 - memcpy(f->bufmem + f->buf.bytesused, eoi_marker, sizeof(eoi_marker)); 671 - f->buf.bytesused += sizeof(eoi_marker); 672 657 } 673 658 674 659 ··· 3176 3181 3177 3182 static const struct file_operations sn9c102_fops = { 3178 3183 .owner = THIS_MODULE, 3179 - .open = sn9c102_open, 3184 + .open = sn9c102_open, 3180 3185 .release = sn9c102_release, 3181 - .ioctl = sn9c102_ioctl, 3186 + .ioctl = sn9c102_ioctl, 3182 3187 .compat_ioctl = v4l_compat_ioctl32, 3183 - .read = sn9c102_read, 3184 - .poll = sn9c102_poll, 3185 - .mmap = sn9c102_mmap, 3186 - .llseek = no_llseek, 3188 + .read = sn9c102_read, 3189 + .poll = sn9c102_poll, 3190 + .mmap = sn9c102_mmap, 3191 + .llseek = no_llseek, 3187 3192 }; 3188 3193 3189 3194 /*****************************************************************************/ ··· 3246 3251 break; 3247 3252 } 3248 3253 3249 - for (i = 0; sn9c102_sensor_table[i]; i++) { 3254 + for (i = 0; i < ARRAY_SIZE(sn9c102_sensor_table); i++) { 3250 3255 err = sn9c102_sensor_table[i](cam); 3251 3256 if (!err) 3252 3257 break; ··· 3257 3262 DBG(3, "Support for %s maintained by %s", 3258 3263 cam->sensor.name, cam->sensor.maintainer); 3259 3264 } else { 3260 - DBG(1, "No supported image sensor detected"); 3265 + DBG(1, "No supported image sensor detected for this bridge"); 3261 3266 err = -ENODEV; 3262 3267 goto fail; 3263 3268 }
+3 -1
drivers/media/video/sn9c102/sn9c102_devtable.h
··· 86 86 { SN9C102_USB_DEVICE(0x0c45, 0x60bc, BRIDGE_SN9C103), }, 87 87 { SN9C102_USB_DEVICE(0x0c45, 0x60be, BRIDGE_SN9C103), }, 88 88 /* SN9C105 */ 89 + { SN9C102_USB_DEVICE(0x045e, 0x00f5, BRIDGE_SN9C105), }, 90 + { SN9C102_USB_DEVICE(0x045e, 0x00f7, BRIDGE_SN9C105), }, 89 91 { SN9C102_USB_DEVICE(0x0471, 0x0327, BRIDGE_SN9C105), }, 90 92 { SN9C102_USB_DEVICE(0x0471, 0x0328, BRIDGE_SN9C105), }, 91 93 { SN9C102_USB_DEVICE(0x0c45, 0x60c0, BRIDGE_SN9C105), }, ··· 102 100 { SN9C102_USB_DEVICE(0x0c45, 0x60fc, BRIDGE_SN9C105), }, 103 101 { SN9C102_USB_DEVICE(0x0c45, 0x60fe, BRIDGE_SN9C105), }, 104 102 /* SN9C120 */ 103 + { SN9C102_USB_DEVICE(0x0458, 0x7025, BRIDGE_SN9C120), }, 105 104 { SN9C102_USB_DEVICE(0x0c45, 0x6102, BRIDGE_SN9C120), }, 106 105 { SN9C102_USB_DEVICE(0x0c45, 0x6108, BRIDGE_SN9C120), }, 107 106 { SN9C102_USB_DEVICE(0x0c45, 0x610f, BRIDGE_SN9C120), }, ··· 151 148 &sn9c102_probe_tas5110c1b, /* detection based on USB pid/vid */ 152 149 &sn9c102_probe_tas5110d, /* detection based on USB pid/vid */ 153 150 &sn9c102_probe_tas5130d1b, /* detection based on USB pid/vid */ 154 - NULL, 155 151 }; 156 152 157 153 #endif /* _SN9C102_DEVTABLE_H_ */
+2 -4
drivers/media/video/sn9c102/sn9c102_hv7131d.c
··· 144 144 } 145 145 146 146 147 - static struct sn9c102_sensor hv7131d = { 147 + static const struct sn9c102_sensor hv7131d = { 148 148 .name = "HV7131D", 149 149 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 150 150 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102, ··· 248 248 249 249 err = sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, 250 250 {0x28, 0x17}); 251 - if (err) 252 - return -EIO; 253 251 254 252 r0 = sn9c102_i2c_try_read(cam, &hv7131d, 0x00); 255 253 r1 = sn9c102_i2c_try_read(cam, &hv7131d, 0x01); 256 - if (r0 < 0 || r1 < 0) 254 + if (err || r0 < 0 || r1 < 0) 257 255 return -EIO; 258 256 259 257 if (r0 != 0x00 || r1 != 0x04)
+2 -6
drivers/media/video/sn9c102/sn9c102_hv7131r.c
··· 44 44 {0xb0, 0x2b}, {0xc0, 0x2c}, 45 45 {0xd0, 0x2d}, {0xe0, 0x2e}, 46 46 {0xf0, 0x2f}, {0xff, 0x30}); 47 - 48 47 break; 49 48 case BRIDGE_SN9C105: 50 49 case BRIDGE_SN9C120: ··· 253 254 } 254 255 255 256 256 - static struct sn9c102_sensor hv7131r = { 257 + static const struct sn9c102_sensor hv7131r = { 257 258 .name = "HV7131R", 258 259 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 259 260 .supported_bridge = BRIDGE_SN9C103 | BRIDGE_SN9C105 | BRIDGE_SN9C120, ··· 349 350 {0x34, 0x01}, {0x20, 0x17}, 350 351 {0x34, 0x01}, {0x46, 0x01}); 351 352 352 - if (err) 353 - return -EIO; 354 - 355 353 devid = sn9c102_i2c_try_read(cam, &hv7131r, 0x00); 356 - if (devid < 0) 354 + if (err || devid < 0) 357 355 return -EIO; 358 356 359 357 if (devid != 0x02)
+24 -27
drivers/media/video/sn9c102/sn9c102_mi0343.c
··· 55 55 struct v4l2_control* ctrl) 56 56 { 57 57 struct sn9c102_sensor* s = sn9c102_get_sensor(cam); 58 - u8 data[5+1]; 58 + u8 data[2]; 59 59 60 60 switch (ctrl->id) { 61 61 case V4L2_CID_EXPOSURE: 62 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x09, 63 - 2+1, data) < 0) 62 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x09, 2, 63 + data) < 0) 64 64 return -EIO; 65 - ctrl->value = data[2]; 65 + ctrl->value = data[0]; 66 66 return 0; 67 67 case V4L2_CID_GAIN: 68 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x35, 69 - 2+1, data) < 0) 68 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x35, 2, 69 + data) < 0) 70 70 return -EIO; 71 71 break; 72 72 case V4L2_CID_HFLIP: 73 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x20, 74 - 2+1, data) < 0) 73 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x20, 2, 74 + data) < 0) 75 75 return -EIO; 76 - ctrl->value = data[3] & 0x20 ? 1 : 0; 76 + ctrl->value = data[1] & 0x20 ? 1 : 0; 77 77 return 0; 78 78 case V4L2_CID_VFLIP: 79 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x20, 80 - 2+1, data) < 0) 79 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x20, 2, 80 + data) < 0) 81 81 return -EIO; 82 - ctrl->value = data[3] & 0x80 ? 1 : 0; 82 + ctrl->value = data[1] & 0x80 ? 1 : 0; 83 83 return 0; 84 84 case V4L2_CID_RED_BALANCE: 85 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2d, 86 - 2+1, data) < 0) 85 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2d, 2, 86 + data) < 0) 87 87 return -EIO; 88 88 break; 89 89 case V4L2_CID_BLUE_BALANCE: 90 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2c, 91 - 2+1, data) < 0) 90 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2c, 2, 91 + data) < 0) 92 92 return -EIO; 93 93 break; 94 94 case SN9C102_V4L2_CID_GREEN_BALANCE: 95 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2e, 96 - 2+1, data) < 0) 95 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2e, 2, 96 + data) < 0) 97 97 return -EIO; 98 98 break; 99 99 default: ··· 105 105 case V4L2_CID_RED_BALANCE: 106 106 case V4L2_CID_BLUE_BALANCE: 107 107 case SN9C102_V4L2_CID_GREEN_BALANCE: 108 - ctrl->value = data[3] | (data[2] << 8); 108 + ctrl->value = data[1] | (data[0] << 8); 109 109 if (ctrl->value >= 0x10 && ctrl->value <= 0x3f) 110 110 ctrl->value -= 0x10; 111 111 else if (ctrl->value >= 0x60 && ctrl->value <= 0x7f) ··· 223 223 } 224 224 225 225 226 - static struct sn9c102_sensor mi0343 = { 226 + static const struct sn9c102_sensor mi0343 = { 227 227 .name = "MI-0343", 228 228 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 229 229 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102, ··· 332 332 333 333 int sn9c102_probe_mi0343(struct sn9c102_device* cam) 334 334 { 335 - u8 data[5+1]; 336 - int err = 0; 335 + u8 data[2]; 337 336 338 - err = sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, 339 - {0x28, 0x17}); 340 - 341 - if (err) 337 + if (sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, 338 + {0x28, 0x17})) 342 339 return -EIO; 343 340 344 341 if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00, 345 342 2, data) < 0) 346 343 return -EIO; 347 344 348 - if (data[4] != 0x32 || data[3] != 0xe3) 345 + if (data[1] != 0x42 || data[0] != 0xe3) 349 346 return -ENODEV; 350 347 351 348 sn9c102_attach_sensor(cam, &mi0343);
+167 -53
drivers/media/video/sn9c102/sn9c102_mi0360.c
··· 27 27 struct sn9c102_sensor* s = sn9c102_get_sensor(cam); 28 28 int err = 0; 29 29 30 - err = sn9c102_write_const_regs(cam, {0x00, 0x10}, {0x00, 0x11}, 31 - {0x0a, 0x14}, {0x40, 0x01}, 32 - {0x20, 0x17}, {0x07, 0x18}, 33 - {0xa0, 0x19}, {0x02, 0x1c}, 34 - {0x03, 0x1d}, {0x0f, 0x1e}, 35 - {0x0c, 0x1f}, {0x00, 0x20}, 36 - {0x10, 0x21}, {0x20, 0x22}, 37 - {0x30, 0x23}, {0x40, 0x24}, 38 - {0x50, 0x25}, {0x60, 0x26}, 39 - {0x70, 0x27}, {0x80, 0x28}, 40 - {0x90, 0x29}, {0xa0, 0x2a}, 41 - {0xb0, 0x2b}, {0xc0, 0x2c}, 42 - {0xd0, 0x2d}, {0xe0, 0x2e}, 43 - {0xf0, 0x2f}, {0xff, 0x30}); 30 + switch (sn9c102_get_bridge(cam)) { 31 + case BRIDGE_SN9C103: 32 + err = sn9c102_write_const_regs(cam, {0x00, 0x10}, {0x00, 0x11}, 33 + {0x0a, 0x14}, {0x40, 0x01}, 34 + {0x20, 0x17}, {0x07, 0x18}, 35 + {0xa0, 0x19}, {0x02, 0x1c}, 36 + {0x03, 0x1d}, {0x0f, 0x1e}, 37 + {0x0c, 0x1f}, {0x00, 0x20}, 38 + {0x10, 0x21}, {0x20, 0x22}, 39 + {0x30, 0x23}, {0x40, 0x24}, 40 + {0x50, 0x25}, {0x60, 0x26}, 41 + {0x70, 0x27}, {0x80, 0x28}, 42 + {0x90, 0x29}, {0xa0, 0x2a}, 43 + {0xb0, 0x2b}, {0xc0, 0x2c}, 44 + {0xd0, 0x2d}, {0xe0, 0x2e}, 45 + {0xf0, 0x2f}, {0xff, 0x30}); 46 + break; 47 + case BRIDGE_SN9C105: 48 + case BRIDGE_SN9C120: 49 + err = sn9c102_write_const_regs(cam, {0x44, 0x01}, {0x40, 0x02}, 50 + {0x00, 0x03}, {0x1a, 0x04}, 51 + {0x50, 0x05}, {0x20, 0x06}, 52 + {0x10, 0x07}, {0x03, 0x10}, 53 + {0x08, 0x14}, {0xa2, 0x17}, 54 + {0x47, 0x18}, {0x00, 0x19}, 55 + {0x1d, 0x1a}, {0x10, 0x1b}, 56 + {0x02, 0x1c}, {0x03, 0x1d}, 57 + {0x0f, 0x1e}, {0x0c, 0x1f}, 58 + {0x00, 0x20}, {0x29, 0x21}, 59 + {0x40, 0x22}, {0x54, 0x23}, 60 + {0x66, 0x24}, {0x76, 0x25}, 61 + {0x85, 0x26}, {0x94, 0x27}, 62 + {0xa1, 0x28}, {0xae, 0x29}, 63 + {0xbb, 0x2a}, {0xc7, 0x2b}, 64 + {0xd3, 0x2c}, {0xde, 0x2d}, 65 + {0xea, 0x2e}, {0xf4, 0x2f}, 66 + {0xff, 0x30}, {0x00, 0x3F}, 67 + {0xC7, 0x40}, {0x01, 0x41}, 68 + {0x44, 0x42}, {0x00, 0x43}, 69 + {0x44, 0x44}, {0x00, 0x45}, 70 + {0x44, 0x46}, {0x00, 0x47}, 71 + {0xC7, 0x48}, {0x01, 0x49}, 72 + {0xC7, 0x4A}, {0x01, 0x4B}, 73 + {0xC7, 0x4C}, {0x01, 0x4D}, 74 + {0x44, 0x4E}, {0x00, 0x4F}, 75 + {0x44, 0x50}, {0x00, 0x51}, 76 + {0x44, 0x52}, {0x00, 0x53}, 77 + {0xC7, 0x54}, {0x01, 0x55}, 78 + {0xC7, 0x56}, {0x01, 0x57}, 79 + {0xC7, 0x58}, {0x01, 0x59}, 80 + {0x44, 0x5A}, {0x00, 0x5B}, 81 + {0x44, 0x5C}, {0x00, 0x5D}, 82 + {0x44, 0x5E}, {0x00, 0x5F}, 83 + {0xC7, 0x60}, {0x01, 0x61}, 84 + {0xC7, 0x62}, {0x01, 0x63}, 85 + {0xC7, 0x64}, {0x01, 0x65}, 86 + {0x44, 0x66}, {0x00, 0x67}, 87 + {0x44, 0x68}, {0x00, 0x69}, 88 + {0x44, 0x6A}, {0x00, 0x6B}, 89 + {0xC7, 0x6C}, {0x01, 0x6D}, 90 + {0xC7, 0x6E}, {0x01, 0x6F}, 91 + {0xC7, 0x70}, {0x01, 0x71}, 92 + {0x44, 0x72}, {0x00, 0x73}, 93 + {0x44, 0x74}, {0x00, 0x75}, 94 + {0x44, 0x76}, {0x00, 0x77}, 95 + {0xC7, 0x78}, {0x01, 0x79}, 96 + {0xC7, 0x7A}, {0x01, 0x7B}, 97 + {0xC7, 0x7C}, {0x01, 0x7D}, 98 + {0x44, 0x7E}, {0x00, 0x7F}, 99 + {0x14, 0x84}, {0x00, 0x85}, 100 + {0x27, 0x86}, {0x00, 0x87}, 101 + {0x07, 0x88}, {0x00, 0x89}, 102 + {0xEC, 0x8A}, {0x0f, 0x8B}, 103 + {0xD8, 0x8C}, {0x0f, 0x8D}, 104 + {0x3D, 0x8E}, {0x00, 0x8F}, 105 + {0x3D, 0x90}, {0x00, 0x91}, 106 + {0xCD, 0x92}, {0x0f, 0x93}, 107 + {0xf7, 0x94}, {0x0f, 0x95}, 108 + {0x0C, 0x96}, {0x00, 0x97}, 109 + {0x00, 0x98}, {0x66, 0x99}, 110 + {0x05, 0x9A}, {0x00, 0x9B}, 111 + {0x04, 0x9C}, {0x00, 0x9D}, 112 + {0x08, 0x9E}, {0x00, 0x9F}, 113 + {0x2D, 0xC0}, {0x2D, 0xC1}, 114 + {0x3A, 0xC2}, {0x05, 0xC3}, 115 + {0x04, 0xC4}, {0x3F, 0xC5}, 116 + {0x00, 0xC6}, {0x00, 0xC7}, 117 + {0x50, 0xC8}, {0x3C, 0xC9}, 118 + {0x28, 0xCA}, {0xD8, 0xCB}, 119 + {0x14, 0xCC}, {0xEC, 0xCD}, 120 + {0x32, 0xCE}, {0xDD, 0xCF}, 121 + {0x32, 0xD0}, {0xDD, 0xD1}, 122 + {0x6A, 0xD2}, {0x50, 0xD3}, 123 + {0x00, 0xD4}, {0x00, 0xD5}, 124 + {0x00, 0xD6}); 125 + break; 126 + default: 127 + break; 128 + } 44 129 45 130 err += sn9c102_i2c_try_raw_write(cam, s, 4, s->i2c_slave_id, 0x0d, 46 131 0x00, 0x01, 0, 0); ··· 150 65 struct v4l2_control* ctrl) 151 66 { 152 67 struct sn9c102_sensor* s = sn9c102_get_sensor(cam); 153 - u8 data[5+1]; 68 + u8 data[2]; 154 69 155 70 switch (ctrl->id) { 156 71 case V4L2_CID_EXPOSURE: 157 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x09, 158 - 2+1, data) < 0) 72 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x09, 2, 73 + data) < 0) 159 74 return -EIO; 160 - ctrl->value = data[2]; 75 + ctrl->value = data[0]; 161 76 return 0; 162 77 case V4L2_CID_GAIN: 163 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x35, 164 - 2+1, data) < 0) 78 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x35, 2, 79 + data) < 0) 165 80 return -EIO; 166 - ctrl->value = data[3]; 81 + ctrl->value = data[1]; 167 82 return 0; 168 83 case V4L2_CID_RED_BALANCE: 169 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2c, 170 - 2+1, data) < 0) 84 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2c, 2, 85 + data) < 0) 171 86 return -EIO; 172 - ctrl->value = data[3]; 87 + ctrl->value = data[1]; 173 88 return 0; 174 89 case V4L2_CID_BLUE_BALANCE: 175 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2d, 176 - 2+1, data) < 0) 90 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2d, 2, 91 + data) < 0) 177 92 return -EIO; 178 - ctrl->value = data[3]; 93 + ctrl->value = data[1]; 179 94 return 0; 180 95 case SN9C102_V4L2_CID_GREEN_BALANCE: 181 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2e, 182 - 2+1, data) < 0) 96 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x2e, 2, 97 + data) < 0) 183 98 return -EIO; 184 - ctrl->value = data[3]; 99 + ctrl->value = data[1]; 185 100 return 0; 186 101 case V4L2_CID_HFLIP: 187 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x20, 188 - 2+1, data) < 0) 102 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x20, 2, 103 + data) < 0) 189 104 return -EIO; 190 - ctrl->value = data[3] & 0x20 ? 1 : 0; 105 + ctrl->value = data[1] & 0x20 ? 1 : 0; 191 106 return 0; 192 107 case V4L2_CID_VFLIP: 193 - if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x20, 194 - 2+1, data) < 0) 108 + if (sn9c102_i2c_try_raw_read(cam, s, s->i2c_slave_id, 0x20, 2, 109 + data) < 0) 195 110 return -EIO; 196 - ctrl->value = data[3] & 0x80 ? 1 : 0; 111 + ctrl->value = data[1] & 0x80 ? 1 : 0; 197 112 return 0; 198 113 default: 199 114 return -EINVAL; ··· 263 178 { 264 179 struct sn9c102_sensor* s = sn9c102_get_sensor(cam); 265 180 int err = 0; 266 - u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 0, 267 - v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; 181 + u8 h_start = 0, v_start = (u8)(rect->top - s->cropcap.bounds.top) + 1; 182 + 183 + switch (sn9c102_get_bridge(cam)) { 184 + case BRIDGE_SN9C103: 185 + h_start = (u8)(rect->left - s->cropcap.bounds.left) + 0; 186 + break; 187 + case BRIDGE_SN9C105: 188 + case BRIDGE_SN9C120: 189 + h_start = (u8)(rect->left - s->cropcap.bounds.left) + 1; 190 + break; 191 + default: 192 + break; 193 + } 268 194 269 195 err += sn9c102_write_reg(cam, h_start, 0x12); 270 196 err += sn9c102_write_reg(cam, v_start, 0x13); ··· 290 194 struct sn9c102_sensor* s = sn9c102_get_sensor(cam); 291 195 int err = 0; 292 196 293 - if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) { 294 - err += sn9c102_i2c_try_raw_write(cam, s, 4, s->i2c_slave_id, 295 - 0x0a, 0x00, 0x02, 0, 0); 296 - err += sn9c102_write_reg(cam, 0x20, 0x19); 297 - } else { 197 + if (pix->pixelformat == V4L2_PIX_FMT_SBGGR8) { 298 198 err += sn9c102_i2c_try_raw_write(cam, s, 4, s->i2c_slave_id, 299 199 0x0a, 0x00, 0x05, 0, 0); 300 200 err += sn9c102_write_reg(cam, 0x60, 0x19); 201 + if (sn9c102_get_bridge(cam) == BRIDGE_SN9C105 || 202 + sn9c102_get_bridge(cam) == BRIDGE_SN9C120) 203 + err += sn9c102_write_reg(cam, 0xa6, 0x17); 204 + } else { 205 + err += sn9c102_i2c_try_raw_write(cam, s, 4, s->i2c_slave_id, 206 + 0x0a, 0x00, 0x02, 0, 0); 207 + err += sn9c102_write_reg(cam, 0x20, 0x19); 208 + if (sn9c102_get_bridge(cam) == BRIDGE_SN9C105 || 209 + sn9c102_get_bridge(cam) == BRIDGE_SN9C120) 210 + err += sn9c102_write_reg(cam, 0xa2, 0x17); 301 211 } 302 212 303 213 return err; 304 214 } 305 215 306 216 307 - static struct sn9c102_sensor mi0360 = { 217 + static const struct sn9c102_sensor mi0360 = { 308 218 .name = "MI-0360", 309 219 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 310 - .supported_bridge = BRIDGE_SN9C103, 220 + .supported_bridge = BRIDGE_SN9C103 | BRIDGE_SN9C105 | BRIDGE_SN9C120, 311 221 .frequency = SN9C102_I2C_100KHZ, 312 222 .interface = SN9C102_I2C_2WIRES, 313 223 .i2c_slave_id = 0x5d, ··· 419 317 420 318 int sn9c102_probe_mi0360(struct sn9c102_device* cam) 421 319 { 422 - u8 data[5+1]; 423 - int err; 424 320 425 - err = sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, 426 - {0x28, 0x17}); 427 - if (err) 428 - return -EIO; 321 + u8 data[2]; 322 + 323 + switch (sn9c102_get_bridge(cam)) { 324 + case BRIDGE_SN9C103: 325 + if (sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, 326 + {0x28, 0x17})) 327 + return -EIO; 328 + break; 329 + case BRIDGE_SN9C105: 330 + case BRIDGE_SN9C120: 331 + if (sn9c102_write_const_regs(cam, {0x01, 0xf1}, {0x00, 0xf1}, 332 + {0x01, 0x01}, {0x00, 0x01}, 333 + {0x28, 0x17})) 334 + return -EIO; 335 + break; 336 + default: 337 + break; 338 + } 429 339 430 340 if (sn9c102_i2c_try_raw_read(cam, &mi0360, mi0360.i2c_slave_id, 0x00, 431 - 2+1, data) < 0) 341 + 2, data) < 0) 432 342 return -EIO; 433 343 434 - if (data[2] != 0x82 || data[3] != 0x43) 344 + if (data[0] != 0x82 || data[1] != 0x43) 435 345 return -ENODEV; 436 346 437 347 sn9c102_attach_sensor(cam, &mi0360);
+10 -15
drivers/media/video/sn9c102/sn9c102_ov7630.c
··· 29 29 switch (sn9c102_get_bridge(cam)) { 30 30 case BRIDGE_SN9C101: 31 31 case BRIDGE_SN9C102: 32 - err = sn9c102_write_const_regs(cam, {0x00, 0x14}, 33 - {0x60, 0x17}, {0x0f, 0x18}, 34 - {0x50, 0x19}); 32 + err = sn9c102_write_const_regs(cam, {0x00, 0x14}, {0x60, 0x17}, 33 + {0x0f, 0x18}, {0x50, 0x19}); 35 34 36 35 err += sn9c102_i2c_write(cam, 0x12, 0x8d); 37 36 err += sn9c102_i2c_write(cam, 0x12, 0x0d); ··· 60 61 err += sn9c102_i2c_write(cam, 0x71, 0x00); 61 62 err += sn9c102_i2c_write(cam, 0x74, 0x21); 62 63 err += sn9c102_i2c_write(cam, 0x7d, 0xf7); 63 - 64 64 break; 65 65 case BRIDGE_SN9C103: 66 66 err = sn9c102_write_const_regs(cam, {0x00, 0x02}, {0x00, 0x03}, ··· 251 253 } 252 254 253 255 254 - static struct sn9c102_sensor ov7630 = { 256 + static const struct sn9c102_sensor ov7630 = { 255 257 .name = "OV7630", 256 258 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 257 259 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102 | BRIDGE_SN9C103, ··· 406 408 switch (sn9c102_get_bridge(cam)) { 407 409 case BRIDGE_SN9C101: 408 410 case BRIDGE_SN9C102: 409 - err = sn9c102_write_const_regs(cam, {0x01, 0x01}, 410 - {0x00, 0x01}, {0x28, 0x17}); 411 - 411 + err = sn9c102_write_const_regs(cam, {0x01, 0x01}, {0x00, 0x01}, 412 + {0x28, 0x17}); 412 413 break; 413 414 case BRIDGE_SN9C103: /* do _not_ change anything! */ 414 - err = sn9c102_write_const_regs(cam, {0x09, 0x01}, 415 - {0x42, 0x01}, {0x28, 0x17}, 416 - {0x44, 0x02}); 415 + err = sn9c102_write_const_regs(cam, {0x09, 0x01}, {0x42, 0x01}, 416 + {0x28, 0x17}, {0x44, 0x02}); 417 417 pid = sn9c102_i2c_try_read(cam, &ov7630, 0x0a); 418 - if (err || pid < 0) { /* try a different initialization */ 419 - err = sn9c102_write_reg(cam, 0x01, 0x01); 420 - err += sn9c102_write_reg(cam, 0x00, 0x01); 421 - } 418 + if (err || pid < 0) /* try a different initialization */ 419 + err += sn9c102_write_const_regs(cam, {0x01, 0x01}, 420 + {0x00, 0x01}); 422 421 break; 423 422 default: 424 423 break;
+43 -20
drivers/media/video/sn9c102/sn9c102_ov7660.c
··· 104 104 err += sn9c102_i2c_write(cam, 0x12, 0x80); 105 105 err += sn9c102_i2c_write(cam, 0x11, 0x09); 106 106 err += sn9c102_i2c_write(cam, 0x00, 0x0A); 107 - err += sn9c102_i2c_write(cam, 0x01, 0x78); 108 - err += sn9c102_i2c_write(cam, 0x02, 0x90); 107 + err += sn9c102_i2c_write(cam, 0x01, 0x80); 108 + err += sn9c102_i2c_write(cam, 0x02, 0x80); 109 109 err += sn9c102_i2c_write(cam, 0x03, 0x00); 110 110 err += sn9c102_i2c_write(cam, 0x04, 0x00); 111 111 err += sn9c102_i2c_write(cam, 0x05, 0x08); ··· 122 122 err += sn9c102_i2c_write(cam, 0x10, 0x20); 123 123 err += sn9c102_i2c_write(cam, 0x11, 0x03); 124 124 err += sn9c102_i2c_write(cam, 0x12, 0x05); 125 - err += sn9c102_i2c_write(cam, 0x13, 0xF8); 125 + err += sn9c102_i2c_write(cam, 0x13, 0xC7); 126 126 err += sn9c102_i2c_write(cam, 0x14, 0x2C); 127 127 err += sn9c102_i2c_write(cam, 0x15, 0x00); 128 128 err += sn9c102_i2c_write(cam, 0x16, 0x02); ··· 162 162 err += sn9c102_i2c_write(cam, 0x38, 0x02); 163 163 err += sn9c102_i2c_write(cam, 0x39, 0x43); 164 164 err += sn9c102_i2c_write(cam, 0x3A, 0x00); 165 - err += sn9c102_i2c_write(cam, 0x3B, 0x02); 165 + err += sn9c102_i2c_write(cam, 0x3B, 0x0A); 166 166 err += sn9c102_i2c_write(cam, 0x3C, 0x6C); 167 167 err += sn9c102_i2c_write(cam, 0x3D, 0x99); 168 168 err += sn9c102_i2c_write(cam, 0x3E, 0x0E); ··· 281 281 return -EIO; 282 282 break; 283 283 case V4L2_CID_DO_WHITE_BALANCE: 284 - ctrl->value = sn9c102_pread_reg(cam, 0x02); 284 + if ((ctrl->value = sn9c102_read_reg(cam, 0x02)) < 0) 285 + return -EIO; 285 286 ctrl->value = (ctrl->value & 0x04) ? 1 : 0; 286 287 break; 287 288 case V4L2_CID_RED_BALANCE: 288 - ctrl->value = sn9c102_pread_reg(cam, 0x05); 289 + if ((ctrl->value = sn9c102_read_reg(cam, 0x05)) < 0) 290 + return -EIO; 289 291 ctrl->value &= 0x7f; 290 292 break; 291 293 case V4L2_CID_BLUE_BALANCE: 292 - ctrl->value = sn9c102_pread_reg(cam, 0x06); 294 + if ((ctrl->value = sn9c102_read_reg(cam, 0x06)) < 0) 295 + return -EIO; 293 296 ctrl->value &= 0x7f; 294 297 break; 295 298 case SN9C102_V4L2_CID_GREEN_BALANCE: 296 - ctrl->value = sn9c102_pread_reg(cam, 0x07); 299 + if ((ctrl->value = sn9c102_read_reg(cam, 0x07)) < 0) 300 + return -EIO; 297 301 ctrl->value &= 0x7f; 302 + break; 303 + case SN9C102_V4L2_CID_BAND_FILTER: 304 + if ((ctrl->value = sn9c102_i2c_read(cam, 0x3b)) < 0) 305 + return -EIO; 306 + ctrl->value &= 0x08; 298 307 break; 299 308 case V4L2_CID_GAIN: 300 309 if ((ctrl->value = sn9c102_i2c_read(cam, 0x00)) < 0) 301 310 return -EIO; 302 - ctrl->value &= 0x7f; 311 + ctrl->value &= 0x1f; 303 312 break; 304 313 case V4L2_CID_AUTOGAIN: 305 314 if ((ctrl->value = sn9c102_i2c_read(cam, 0x13)) < 0) ··· 344 335 case SN9C102_V4L2_CID_GREEN_BALANCE: 345 336 err += sn9c102_write_reg(cam, ctrl->value, 0x07); 346 337 break; 338 + case SN9C102_V4L2_CID_BAND_FILTER: 339 + err += sn9c102_i2c_write(cam, ctrl->value << 3, 0x3b); 340 + break; 347 341 case V4L2_CID_GAIN: 348 - err += sn9c102_i2c_write(cam, 0x00, ctrl->value); 342 + err += sn9c102_i2c_write(cam, 0x00, 0x60 + ctrl->value); 349 343 break; 350 344 case V4L2_CID_AUTOGAIN: 351 - err += sn9c102_i2c_write(cam, 0x13, 0xf0 | ctrl->value | 352 - (ctrl->value << 1)); 345 + err += sn9c102_i2c_write(cam, 0x13, 0xc0 | 346 + (ctrl->value * 0x07)); 353 347 break; 354 348 default: 355 349 return -EINVAL; ··· 398 386 } 399 387 400 388 401 - static struct sn9c102_sensor ov7660 = { 389 + static const struct sn9c102_sensor ov7660 = { 402 390 .name = "OV7660", 403 391 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 404 392 .supported_bridge = BRIDGE_SN9C105 | BRIDGE_SN9C120, ··· 413 401 .type = V4L2_CTRL_TYPE_INTEGER, 414 402 .name = "global gain", 415 403 .minimum = 0x00, 416 - .maximum = 0x7f, 404 + .maximum = 0x1f, 417 405 .step = 0x01, 418 - .default_value = 0x0a, 406 + .default_value = 0x09, 419 407 .flags = 0, 420 408 }, 421 409 { ··· 425 413 .minimum = 0x00, 426 414 .maximum = 0xff, 427 415 .step = 0x01, 428 - .default_value = 0x50, 416 + .default_value = 0x27, 429 417 .flags = 0, 430 418 }, 431 419 { ··· 445 433 .minimum = 0x00, 446 434 .maximum = 0x7f, 447 435 .step = 0x01, 448 - .default_value = 0x1f, 436 + .default_value = 0x14, 449 437 .flags = 0, 450 438 }, 451 439 { ··· 455 443 .minimum = 0x00, 456 444 .maximum = 0x7f, 457 445 .step = 0x01, 458 - .default_value = 0x1e, 446 + .default_value = 0x14, 459 447 .flags = 0, 460 448 }, 461 449 { ··· 465 453 .minimum = 0x00, 466 454 .maximum = 0x01, 467 455 .step = 0x01, 468 - .default_value = 0x00, 456 + .default_value = 0x01, 469 457 .flags = 0, 470 458 }, 471 459 { ··· 475 463 .minimum = 0x00, 476 464 .maximum = 0x7f, 477 465 .step = 0x01, 478 - .default_value = 0x20, 466 + .default_value = 0x14, 467 + .flags = 0, 468 + }, 469 + { 470 + .id = SN9C102_V4L2_CID_BAND_FILTER, 471 + .type = V4L2_CTRL_TYPE_BOOLEAN, 472 + .name = "band filter", 473 + .minimum = 0x00, 474 + .maximum = 0x01, 475 + .step = 0x01, 476 + .default_value = 0x00, 479 477 .flags = 0, 480 478 }, 481 479 }, ··· 530 508 return -EIO; 531 509 if (pid != 0x76 || ver != 0x60) 532 510 return -ENODEV; 511 + 533 512 sn9c102_attach_sensor(cam, &ov7660); 534 513 535 514 return 0;
+6 -8
drivers/media/video/sn9c102/sn9c102_pas106b.c
··· 163 163 } 164 164 165 165 166 - static struct sn9c102_sensor pas106b = { 166 + static const struct sn9c102_sensor pas106b = { 167 167 .name = "PAS106B", 168 168 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 169 169 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102, ··· 273 273 274 274 int sn9c102_probe_pas106b(struct sn9c102_device* cam) 275 275 { 276 - int r0 = 0, r1 = 0, err; 276 + int r0 = 0, r1 = 0; 277 277 unsigned int pid = 0; 278 278 279 279 /* 280 280 Minimal initialization to enable the I2C communication 281 281 NOTE: do NOT change the values! 282 282 */ 283 - err = sn9c102_write_const_regs(cam, 284 - {0x01, 0x01}, /* sensor power down */ 285 - {0x00, 0x01}, /* sensor power on */ 286 - {0x28, 0x17});/* sensor clock 24 MHz */ 287 - if (err) 283 + if (sn9c102_write_const_regs(cam, 284 + {0x01, 0x01}, /* sensor power down */ 285 + {0x00, 0x01}, /* sensor power on */ 286 + {0x28, 0x17})) /* sensor clock at 24 MHz */ 288 287 return -EIO; 289 288 290 289 r0 = sn9c102_i2c_try_read(cam, &pas106b, 0x00); 291 290 r1 = sn9c102_i2c_try_read(cam, &pas106b, 0x01); 292 - 293 291 if (r0 < 0 || r1 < 0) 294 292 return -EIO; 295 293
+23 -25
drivers/media/video/sn9c102/sn9c102_pas202bcb.c
··· 35 35 switch (sn9c102_get_bridge(cam)) { 36 36 case BRIDGE_SN9C101: 37 37 case BRIDGE_SN9C102: 38 - err = sn9c102_write_const_regs(cam, {0x00, 0x10}, 39 - {0x00, 0x11}, {0x00, 0x14}, 40 - {0x20, 0x17}, {0x30, 0x19}, 41 - {0x09, 0x18}); 38 + err = sn9c102_write_const_regs(cam, {0x00, 0x10}, {0x00, 0x11}, 39 + {0x00, 0x14}, {0x20, 0x17}, 40 + {0x30, 0x19}, {0x09, 0x18}); 42 41 break; 43 42 case BRIDGE_SN9C103: 44 - err = sn9c102_write_const_regs(cam, {0x00, 0x02}, 45 - {0x00, 0x03}, {0x1a, 0x04}, 46 - {0x20, 0x05}, {0x20, 0x06}, 47 - {0x20, 0x07}, {0x00, 0x10}, 48 - {0x00, 0x11}, {0x00, 0x14}, 49 - {0x20, 0x17}, {0x30, 0x19}, 50 - {0x09, 0x18}, {0x02, 0x1c}, 51 - {0x03, 0x1d}, {0x0f, 0x1e}, 52 - {0x0c, 0x1f}, {0x00, 0x20}, 53 - {0x10, 0x21}, {0x20, 0x22}, 54 - {0x30, 0x23}, {0x40, 0x24}, 55 - {0x50, 0x25}, {0x60, 0x26}, 56 - {0x70, 0x27}, {0x80, 0x28}, 57 - {0x90, 0x29}, {0xa0, 0x2a}, 58 - {0xb0, 0x2b}, {0xc0, 0x2c}, 59 - {0xd0, 0x2d}, {0xe0, 0x2e}, 60 - {0xf0, 0x2f}, {0xff, 0x30}); 43 + err = sn9c102_write_const_regs(cam, {0x00, 0x02}, {0x00, 0x03}, 44 + {0x1a, 0x04}, {0x20, 0x05}, 45 + {0x20, 0x06}, {0x20, 0x07}, 46 + {0x00, 0x10}, {0x00, 0x11}, 47 + {0x00, 0x14}, {0x20, 0x17}, 48 + {0x30, 0x19}, {0x09, 0x18}, 49 + {0x02, 0x1c}, {0x03, 0x1d}, 50 + {0x0f, 0x1e}, {0x0c, 0x1f}, 51 + {0x00, 0x20}, {0x10, 0x21}, 52 + {0x20, 0x22}, {0x30, 0x23}, 53 + {0x40, 0x24}, {0x50, 0x25}, 54 + {0x60, 0x26}, {0x70, 0x27}, 55 + {0x80, 0x28}, {0x90, 0x29}, 56 + {0xa0, 0x2a}, {0xb0, 0x2b}, 57 + {0xc0, 0x2c}, {0xd0, 0x2d}, 58 + {0xe0, 0x2e}, {0xf0, 0x2f}, 59 + {0xff, 0x30}); 61 60 break; 62 61 default: 63 62 break; ··· 196 197 } 197 198 198 199 199 - static struct sn9c102_sensor pas202bcb = { 200 + static const struct sn9c102_sensor pas202bcb = { 200 201 .name = "PAS202BCB", 201 202 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 202 203 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102 | BRIDGE_SN9C103, ··· 312 313 {0x28, 0x17});/* clock 24 MHz */ 313 314 break; 314 315 case BRIDGE_SN9C103: /* do _not_ change anything! */ 315 - err = sn9c102_write_const_regs(cam, {0x09, 0x01}, 316 - {0x44, 0x01}, {0x44, 0x02}, 317 - {0x29, 0x17}); 316 + err = sn9c102_write_const_regs(cam, {0x09, 0x01}, {0x44, 0x01}, 317 + {0x44, 0x02}, {0x29, 0x17}); 318 318 break; 319 319 default: 320 320 break;
+18 -15
drivers/media/video/sn9c102/sn9c102_sensor.h
··· 22 22 #define _SN9C102_SENSOR_H_ 23 23 24 24 #include <linux/usb.h> 25 - #include <linux/videodev.h> 25 + #include <linux/videodev2.h> 26 26 #include <linux/device.h> 27 27 #include <linux/stddef.h> 28 28 #include <linux/errno.h> ··· 74 74 /* Attach a probed sensor to the camera. */ 75 75 extern void 76 76 sn9c102_attach_sensor(struct sn9c102_device* cam, 77 - struct sn9c102_sensor* sensor); 77 + const struct sn9c102_sensor* sensor); 78 78 79 79 /* 80 80 Read/write routines: they always return -1 on error, 0 or the read value ··· 85 85 */ 86 86 87 87 /* The "try" I2C I/O versions are used when probing the sensor */ 88 - extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*, 89 - u8 address, u8 value); 90 - extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, 91 - u8 address); 88 + extern int sn9c102_i2c_try_write(struct sn9c102_device*, 89 + const struct sn9c102_sensor*, u8 address, 90 + u8 value); 91 + extern int sn9c102_i2c_try_read(struct sn9c102_device*, 92 + const struct sn9c102_sensor*, u8 address); 92 93 93 94 /* 94 95 These must be used if and only if the sensor doesn't implement the standard ··· 103 102 byte. 104 103 */ 105 104 extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, 106 - struct sn9c102_sensor* sensor, u8 n, 105 + const struct sn9c102_sensor* sensor, u8 n, 107 106 u8 data0, u8 data1, u8 data2, u8 data3, 108 107 u8 data4, u8 data5); 109 108 extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, 110 - struct sn9c102_sensor* sensor, u8 data0, 111 - u8 data1, u8 n, u8 buffer[]); 109 + const struct sn9c102_sensor* sensor, 110 + u8 data0, u8 data1, u8 n, u8 buffer[]); 112 111 113 112 /* To be used after the sensor struct has been attached to the camera struct */ 114 113 extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value); 115 114 extern int sn9c102_i2c_read(struct sn9c102_device*, u8 address); 116 115 117 116 /* I/O on registers in the bridge. Could be used by the sensor methods too */ 117 + extern int sn9c102_read_reg(struct sn9c102_device*, u16 index); 118 118 extern int sn9c102_pread_reg(struct sn9c102_device*, u16 index); 119 119 extern int sn9c102_write_reg(struct sn9c102_device*, u8 value, u16 index); 120 120 extern int sn9c102_write_regs(struct sn9c102_device*, const u8 valreg[][2], 121 121 int count); 122 122 /* 123 - * Write multiple registers with constant values. For example: 124 - * sn9c102_write_const_regs(cam, {0x00, 0x14}, {0x60, 0x17}, {0x0f, 0x18}); 125 - */ 126 - #define sn9c102_write_const_regs(device, data...) \ 127 - ({ const static u8 _data[][2] = {data}; \ 128 - sn9c102_write_regs(device, _data, ARRAY_SIZE(_data)); }) 123 + Write multiple registers with constant values. For example: 124 + sn9c102_write_const_regs(cam, {0x00, 0x14}, {0x60, 0x17}, {0x0f, 0x18}); 125 + Register adresses must be < 256. 126 + */ 127 + #define sn9c102_write_const_regs(sn9c102_device, data...) \ 128 + ({ const static u8 _valreg[][2] = {data}; \ 129 + sn9c102_write_regs(sn9c102_device, _valreg, ARRAY_SIZE(_valreg)); }) 129 130 130 131 /*****************************************************************************/ 131 132
+1 -1
drivers/media/video/sn9c102/sn9c102_tas5110c1b.c
··· 88 88 } 89 89 90 90 91 - static struct sn9c102_sensor tas5110c1b = { 91 + static const struct sn9c102_sensor tas5110c1b = { 92 92 .name = "TAS5110C1B", 93 93 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 94 94 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102,
+1 -1
drivers/media/video/sn9c102/sn9c102_tas5110d.c
··· 68 68 } 69 69 70 70 71 - static struct sn9c102_sensor tas5110d = { 71 + static const struct sn9c102_sensor tas5110d = { 72 72 .name = "TAS5110D", 73 73 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 74 74 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102,
+1 -1
drivers/media/video/sn9c102/sn9c102_tas5130d1b.c
··· 89 89 } 90 90 91 91 92 - static struct sn9c102_sensor tas5130d1b = { 92 + static const struct sn9c102_sensor tas5130d1b = { 93 93 .name = "TAS5130D1B", 94 94 .maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>", 95 95 .supported_bridge = BRIDGE_SN9C101 | BRIDGE_SN9C102,
+4 -4
drivers/media/video/usbvideo/Kconfig
··· 3 3 4 4 config USB_VICAM 5 5 tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" 6 - depends on USB && VIDEO_DEV && VIDEO_V4L1 && EXPERIMENTAL 6 + depends on VIDEO_V4L1 && EXPERIMENTAL 7 7 select VIDEO_USBVIDEO 8 8 ---help--- 9 9 Say Y here if you have 3com homeconnect camera (vicam). ··· 13 13 14 14 config USB_IBMCAM 15 15 tristate "USB IBM (Xirlink) C-it Camera support" 16 - depends on USB && VIDEO_DEV && VIDEO_V4L1 16 + depends on VIDEO_V4L1 17 17 select VIDEO_USBVIDEO 18 18 ---help--- 19 19 Say Y here if you want to connect a IBM "C-It" camera, also known as ··· 28 28 29 29 config USB_KONICAWC 30 30 tristate "USB Konica Webcam support" 31 - depends on USB && VIDEO_DEV && VIDEO_V4L1 31 + depends on VIDEO_V4L1 32 32 select VIDEO_USBVIDEO 33 33 ---help--- 34 34 Say Y here if you want support for webcams based on a Konica ··· 39 39 40 40 config USB_QUICKCAM_MESSENGER 41 41 tristate "USB Logitech Quickcam Messenger" 42 - depends on USB && VIDEO_DEV && VIDEO_V4L1 42 + depends on VIDEO_V4L1 43 43 select VIDEO_USBVIDEO 44 44 ---help--- 45 45 Say Y or M here to enable support for the USB Logitech Quickcam
+1 -1
drivers/media/video/usbvision/Kconfig
··· 1 1 config VIDEO_USBVISION 2 2 tristate "USB video devices based on Nogatech NT1003/1004/1005" 3 - depends on I2C && VIDEO_V4L2 && USB 3 + depends on I2C && VIDEO_V4L2 4 4 select VIDEO_TUNER 5 5 select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO 6 6 ---help---
+45 -17
drivers/media/video/v4l1-compat.c
··· 127 127 128 128 /* ----------------------------------------------------------------- */ 129 129 130 - static int palette2pixelformat[] = { 130 + const static unsigned int palette2pixelformat[] = { 131 131 [VIDEO_PALETTE_GREY] = V4L2_PIX_FMT_GREY, 132 132 [VIDEO_PALETTE_RGB555] = V4L2_PIX_FMT_RGB555, 133 133 [VIDEO_PALETTE_RGB565] = V4L2_PIX_FMT_RGB565, ··· 145 145 [VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P, 146 146 }; 147 147 148 - static unsigned int 148 + static unsigned int __attribute_pure__ 149 149 palette_to_pixelformat(unsigned int palette) 150 150 { 151 151 if (palette < ARRAY_SIZE(palette2pixelformat)) ··· 154 154 return 0; 155 155 } 156 156 157 - static unsigned int 158 - pixelformat_to_palette(int pixelformat) 157 + static unsigned int __attribute_const__ 158 + pixelformat_to_palette(unsigned int pixelformat) 159 159 { 160 160 int palette = 0; 161 161 switch (pixelformat) ··· 616 616 case VIDIOCSPICT: /* set tone controls & partial capture format */ 617 617 { 618 618 struct video_picture *pict = arg; 619 + int mem_err = 0, ovl_err = 0; 620 + 619 621 memset(&fbuf2, 0, sizeof(fbuf2)); 620 622 621 623 set_v4l_control(inode, file, ··· 630 628 V4L2_CID_SATURATION, pict->colour, drv); 631 629 set_v4l_control(inode, file, 632 630 V4L2_CID_WHITENESS, pict->whiteness, drv); 631 + /* 632 + * V4L1 uses this ioctl to set both memory capture and overlay 633 + * pixel format, while V4L2 has two different ioctls for this. 634 + * Some cards may not support one or the other, and may support 635 + * different pixel formats for memory vs overlay. 636 + */ 633 637 634 638 fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL); 635 639 fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 636 640 err = drv(inode, file, VIDIOC_G_FMT, fmt2); 637 - if (err < 0) 641 + /* If VIDIOC_G_FMT failed, then the driver likely doesn't 642 + support memory capture. Trying to set the memory capture 643 + parameters would be pointless. */ 644 + if (err < 0) { 638 645 dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %d\n",err); 639 - if (fmt2->fmt.pix.pixelformat != 640 - palette_to_pixelformat(pict->palette)) { 646 + mem_err = -1000; /* didn't even try */ 647 + } else if (fmt2->fmt.pix.pixelformat != 648 + palette_to_pixelformat(pict->palette)) { 641 649 fmt2->fmt.pix.pixelformat = palette_to_pixelformat( 642 650 pict->palette); 643 - err = drv(inode, file, VIDIOC_S_FMT, fmt2); 644 - if (err < 0) 645 - dprintk("VIDIOCSPICT / VIDIOC_S_FMT: %d\n",err); 651 + mem_err = drv(inode, file, VIDIOC_S_FMT, fmt2); 652 + if (mem_err < 0) 653 + dprintk("VIDIOCSPICT / VIDIOC_S_FMT: %d\n", 654 + mem_err); 646 655 } 647 656 648 657 err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); 649 - if (err < 0) 658 + /* If VIDIOC_G_FBUF failed, then the driver likely doesn't 659 + support overlay. Trying to set the overlay parameters 660 + would be quite pointless. */ 661 + if (err < 0) { 650 662 dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %d\n",err); 651 - if (fbuf2.fmt.pixelformat != 652 - palette_to_pixelformat(pict->palette)) { 663 + ovl_err = -1000; /* didn't even try */ 664 + } else if (fbuf2.fmt.pixelformat != 665 + palette_to_pixelformat(pict->palette)) { 653 666 fbuf2.fmt.pixelformat = palette_to_pixelformat( 654 667 pict->palette); 655 - err = drv(inode, file, VIDIOC_S_FBUF, &fbuf2); 656 - if (err < 0) 657 - dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n",err); 658 - err = 0; /* likely fails for non-root */ 668 + ovl_err = drv(inode, file, VIDIOC_S_FBUF, &fbuf2); 669 + if (ovl_err < 0) 670 + dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n", 671 + ovl_err); 659 672 } 673 + if (ovl_err < 0 && mem_err < 0) 674 + /* ioctl failed, couldn't set either parameter */ 675 + if (mem_err != -1000) { 676 + err = mem_err; 677 + } else if (ovl_err == -EPERM) { 678 + err = 0; 679 + } else { 680 + err = ovl_err; 681 + } 682 + else 683 + err = 0; 660 684 break; 661 685 } 662 686 case VIDIOCGTUNER: /* get tuner information */
+1 -3
drivers/media/video/video-buf.c
··· 702 702 dprintk(1,"qbuf: memory type is wrong.\n"); 703 703 goto done; 704 704 } 705 - if (buf->state == STATE_QUEUED || 706 - buf->state == STATE_PREPARED || 707 - buf->state == STATE_ACTIVE) { 705 + if (buf->state != STATE_NEEDS_INIT && buf->state != STATE_IDLE) { 708 706 dprintk(1,"qbuf: buffer is already queued or active.\n"); 709 707 goto done; 710 708 }
+31 -19
drivers/media/video/videodev.c
··· 433 433 int ret = -EINVAL; 434 434 435 435 if ( (vfd->debug & V4L2_DEBUG_IOCTL) && 436 - !(vfd->debug | V4L2_DEBUG_IOCTL_ARG)) { 436 + !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { 437 437 v4l_print_ioctl(vfd->name, cmd); 438 438 } 439 439 440 + #ifdef CONFIG_VIDEO_V4L1_COMPAT 441 + /*********************************************************** 442 + Handles calls to the obsoleted V4L1 API 443 + Due to the nature of VIDIOCGMBUF, each driver that supports 444 + V4L1 should implement its own handler for this ioctl. 445 + ***********************************************************/ 446 + 447 + /* --- streaming capture ------------------------------------- */ 448 + if (cmd == VIDIOCGMBUF) { 449 + struct video_mbuf *p=arg; 450 + 451 + memset(p,0,sizeof(p)); 452 + 453 + if (!vfd->vidiocgmbuf) 454 + return ret; 455 + ret=vfd->vidiocgmbuf(file, fh, p); 456 + if (!ret) 457 + dbgarg (cmd, "size=%d, frames=%d, offsets=0x%08lx\n", 458 + p->size, p->frames, 459 + (unsigned long)p->offsets); 460 + return ret; 461 + } 462 + 463 + /******************************************************** 464 + All other V4L1 calls are handled by v4l1_compat module. 465 + Those calls will be translated into V4L2 calls, and 466 + __video_do_ioctl will be called again, with one or more 467 + V4L2 ioctls. 468 + ********************************************************/ 440 469 if (_IOC_TYPE(cmd)=='v') 441 470 return v4l_compat_translate_ioctl(inode,file,cmd,arg, 442 471 __video_do_ioctl); 472 + #endif 443 473 444 474 switch(cmd) { 445 475 /* --- capabilities ------------------------------------------ */ ··· 821 791 ret=vfd->vidioc_overlay(file, fh, *i); 822 792 break; 823 793 } 824 - #ifdef CONFIG_VIDEO_V4L1_COMPAT 825 - /* --- streaming capture ------------------------------------- */ 826 - case VIDIOCGMBUF: 827 - { 828 - struct video_mbuf *p=arg; 829 - 830 - memset(p,0,sizeof(p)); 831 - 832 - if (!vfd->vidiocgmbuf) 833 - break; 834 - ret=vfd->vidiocgmbuf(file, fh, p); 835 - if (!ret) 836 - dbgarg (cmd, "size=%d, frames=%d, offsets=0x%08lx\n", 837 - p->size, p->frames, 838 - (unsigned long)p->offsets); 839 - break; 840 - } 841 - #endif 842 794 case VIDIOC_G_FBUF: 843 795 { 844 796 struct v4l2_framebuffer *p=arg;
+1 -1
drivers/media/video/zc0301/Kconfig
··· 1 1 config USB_ZC0301 2 2 tristate "USB ZC0301[P] Image Processor and Control Chip support" 3 - depends on USB && VIDEO_V4L1 3 + depends on VIDEO_V4L1 4 4 ---help--- 5 5 Say Y here if you want support for cameras based on the ZC0301 or 6 6 ZC0301P Image Processors and Control Chips.
+2
include/media/saa7146.h
··· 58 58 unsigned long offset; 59 59 /* used for custom pagetables (used for example by budget dvb cards) */ 60 60 struct scatterlist *slist; 61 + int nents; 61 62 }; 62 63 63 64 struct saa7146_pci_extension_data { ··· 158 157 void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt); 159 158 int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length ); 160 159 char *saa7146_vmalloc_build_pgtable(struct pci_dev *pci, long length, struct saa7146_pgtable *pt); 160 + void saa7146_vfree_destroy_pgtable(struct pci_dev *pci, char *mem, struct saa7146_pgtable *pt); 161 161 void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data); 162 162 int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop); 163 163
+2
include/media/saa7146_vv.h
··· 216 216 extern struct saa7146_use_ops saa7146_video_uops; 217 217 int saa7146_start_preview(struct saa7146_fh *fh); 218 218 int saa7146_stop_preview(struct saa7146_fh *fh); 219 + int saa7146_video_do_ioctl(struct inode *inode, struct file *file, 220 + unsigned int cmd, void *arg); 219 221 220 222 /* from saa7146_vbi.c */ 221 223 extern struct saa7146_use_ops saa7146_vbi_uops;