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