GIT 6b3508f6b32dc7ad75645849e19d79d9d9a17162 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git#devel commit 6b3508f6b32dc7ad75645849e19d79d9d9a17162 Author: Mauro Carvalho Chehab Date: Tue Jul 25 16:17:54 2006 -0300 V4L/DVB (4371): Included missing linux/version.h Signed-off-by: Mauro Carvalho Chehab commit 4221ece06318bf66f789d5304e098a96aca0e6fa Author: Mauro Carvalho Chehab Date: Tue Jul 25 14:27:36 2006 -0300 V4L/DVB (4370): Fix some typos on ioctl handling function Signed-off-by: Mauro Carvalho Chehab commit 2efd65e3ea194f45f49360d775ef5c18da422a5c Author: Trent Piepho Date: Tue Jul 25 09:32:31 2006 -0300 V4L/DVB (4368): Bttv: use class_device_create_file and handle errors Revert bttv-driver.c from video_device_create_file() to use class_device_create_file() again. video_device_create_file() is only available when V4L1 is on. Proper error checking is added for failure of class_device_create_file(). Will print error message and unroll partially created sysfs entries. Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab commit 118069539815bb68926db55cc0b12c5d2856801b Author: Trent Piepho Date: Tue Jul 25 09:31:42 2006 -0300 V4L/DVB (4367): Videodev: Handle class_device related errors Add proper error checking and roll-back for failure of class_device_create_file() in videodev.c. Print error messages and unroll partially created sysfs entries. Also, failure of class_device_register() in video_register_device() is handled correctly. It was failing to de-allocate the minor number. This must be done in video_register_device(), since the caller has no way of knowing if failure occurred before or after the class device was registered. Also added an error message if video_register_device() is called with an unknown type, which should never happen. Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab commit 2c86c09d35ecdbda1ef8bd3e0a65706a714add0d Author: Trent Piepho Date: Tue Jul 25 09:31:39 2006 -0300 V4L/DVB (4366): Remove of couple of useless lines A buffer was set just before an if block, and then again in both branches of the if. Obvious coding error. Signed-off-by: Trent Piepho Signed-off-by: Mauro Carvalho Chehab commit 191b1085355320e894ea1ae1464d01a357eee6fb Author: Mauro Carvalho Chehab Date: Mon Jul 24 15:19:37 2006 -0300 V4L/DVB (4365): OVERLAY flag were enabled by mistake A patch from Aug, 17 activated by mistake OVERLAY flag on cx88-video, together with several cx88-blackbird cleanups. This makes the cx88 driver to report: /dev/video0 [v4l2]: ioctl VIDIOC_G_FBUF: Invalid argument instead of: /dev/video0 [v4l2]: no overlay support Signed-off-by: Mauro Carvalho Chehab commit 0ea8eb8bf1a54979987a20cb165e3143b01af619 Author: Mauro Carvalho Chehab Date: Mon Jul 24 13:43:02 2006 -0300 V4L/DVB (4364): V4L2 conversion: radio-maxiradio Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit 10b3dc13abe9e6d68fb9ca2ef5bd29dc1dedd259 Author: Mauro Carvalho Chehab Date: Mon Jul 24 13:31:10 2006 -0300 V4L/DVB (4363): V4L2 conversion: radio-trust Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit f5fa840c4985fa85a2191fd3c1f616d404dceb89 Author: David Bussenschutt Date: Mon Jul 24 12:41:56 2006 -0300 V4L/DVB (4362): Cx88: Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann PCI TV Tuner card support Add support for Shenzhen Tungsten Ages Tech TE-DTV-250 OEM for Swann PCI TV Tuner Card Signed-off-by: David Bussenschutt Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab commit 2f8b170f0050534cf4813d8685be8e94c31fb486 Author: Peter Naulls Date: Mon Jul 24 12:41:55 2006 -0300 V4L/DVB (4361): Cx88: add support for Norwood PCI TV Tuner (non-pro) This patch adds support for Norwood PCI TV Tuner (non-pro) Signed-off-by: Peter Naulls Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab commit 18f5e2c98e10ccb7a628be1ce76d9dec2bc4a51d Author: Michael Krufky Date: Mon Jul 24 12:41:54 2006 -0300 V4L/DVB (4360): Cx88: add autodetection support for AverMedia M150-D This patch adds autodetection support for the AverMedia M150-D blackbird MPEG encoder / analog video capture card. This board is known to work with the ASUS PVR 416 configuration. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab commit 6cf46fb2bd35155caaa4ddbc6b5f2c3d22220142 Author: Eric Thomas Date: Mon Jul 24 12:41:54 2006 -0300 V4L/DVB (4359): Cx88: add initial support for Hauppauge HVR3000 trimode card add initial support for Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T only analog is working for now Signed-off-by: Eric Thomas Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab commit cd7033bf67d8ad30e276f6b218ee0e19831359ee Author: Mauro Carvalho Chehab Date: Mon Jul 24 07:22:07 2006 -0300 V4L/DVB (4358): V4L2 conversion: radio-zoltrix Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit 772e79e77bbbf74b133e099469486742908c5b10 Author: Mauro Carvalho Chehab Date: Mon Jul 24 07:06:58 2006 -0300 V4L/DVB (4357): V4L2 conversion: radio-typhoon Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit 44a632fdd96749e942a9562ca746500dd642c2e0 Author: Mauro Carvalho Chehab Date: Mon Jul 24 06:52:05 2006 -0300 V4L/DVB (4356): V4L2 conversion: radio-terratec Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit 687e846ccf6587c774fe763c46ec2b1c1aed725c Author: Mauro Carvalho Chehab Date: Mon Jul 24 06:42:48 2006 -0300 V4L/DVB (4355): V4L2 conversion: radio-sf16fmr2 Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit 56bf74e87921839d8a1c18118d6c161121ae9625 Author: Mauro Carvalho Chehab Date: Mon Jul 24 06:39:26 2006 -0300 V4L/DVB (4354): A small fix at fmi->flags logic Signed-off-by: Mauro Carvalho Chehab commit 9b5840305b1a9d03debcb34c434af444c32fa647 Author: Mauro Carvalho Chehab Date: Sun Jul 23 22:25:48 2006 -0300 V4L/DVB (4353): V4L2 conversion: radio-sf16fmi Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit f43f05cbb089dd4f68c53beda2c36a40afeffb0c Author: Mauro Carvalho Chehab Date: Sun Jul 23 22:01:21 2006 -0300 V4L/DVB (4352): V4L2 conversion: radio-rtrack2 Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit 2c2212816c04816c6ee7eaf6933d1922e0884725 Author: Mauro Carvalho Chehab Date: Sun Jul 23 19:53:24 2006 -0300 V4L/DVB (4351): V4L2 conversion: radio-maestro Driver conversion to V4L2 API. Require some testing, since I don't have such hardware Signed-off-by: Mauro Carvalho Chehab commit a8246e814dff673576b1bc7373d60cccf06308cb Author: Mauro Carvalho Chehab Date: Sun Jul 23 19:19:30 2006 -0300 V4L/DVB (4350): V4L2 conversion: radio_gemtek-pci Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit f15a98ec148e1afbb0863f403e70dce330ad06eb Author: Mauro Carvalho Chehab Date: Sun Jul 23 18:58:50 2006 -0300 V4L/DVB (4349): V4L2 conversion: radio_gemtek Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit b7b240f0ed447c574e84e07a0bc6c6ce79f01fc3 Author: Mauro Carvalho Chehab Date: Sun Jul 23 18:20:50 2006 -0300 V4L/DVB (4348): Fix: compile for radio aimslab and aztech with V4L2 only All radio devices use an obsolete mode of opening/release driver. Since this is not V4L1 core, better to keep the method available for more time than to rewrite open/release without a radio device to test, since the newer method is much more complex than the previous one (although providing support for multiple opens and multiple devices). Signed-off-by: Mauro Carvalho Chehab commit dfb8b7037b80b7b4eb81363b353b5fa62d585a1c Author: Mauro Carvalho Chehab Date: Sun Jul 23 09:51:22 2006 -0300 V4L/DVB (4347): V4L2 conversion: radio_aztech Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit b505f72c63f0ba3a2413b380ca1798753ac920af Author: Mauro Carvalho Chehab Date: Sun Jul 23 09:29:28 2006 -0300 V4L/DVB (4346): V4L2 conversion: radio_aimslab Driver conversion to V4L2 API. Require some testing, since this obsolete hardware is not common those days. Signed-off-by: Mauro Carvalho Chehab commit 125dabfc5b099da734e58102d5a99863a05ad77b Author: Mauro Carvalho Chehab Date: Sun Jul 23 06:32:05 2006 -0300 V4L/DVB (4344): Fix broken dependencies on media Kconfig Signed-off-by: Mauro Carvalho Chehab commit 75128664f2ac400721451dd849837e7f60e131a5 Author: Mauro Carvalho Chehab Date: Sun Jul 23 06:31:19 2006 -0300 V4L/DVB (4343): Fix for compilation without V4L1 or V4L1_COMPAT Removed usage of HAVE_V4L1 Including videodev.h will just include videodev2.h if V4L1 is not supported V4L1 code at core drivers will honor CONFIG_V4L1_COMPAT stuff Signed-off-by: Mauro Carvalho Chehab commit 28be594794f2309d39009087f85133c4a0d73990 Author: Mauro Carvalho Chehab Date: Sat Jul 22 08:20:07 2006 -0300 V4L/DVB (4342): Fix ext_controls align on 64 bit architectures u64 is aligned as 128bits on x86_64 architetures, requiring an special handling to ioctls that depends on v4l2_ext_control. Let's fix this before ext controls go to kernel mainstream to avoid one more compat32 stuff. Signed-off-by: Mauro Carvalho Chehab commit 7c7d0da5ad89ca5129779b8cdbef8637f8f1ee77 Author: Mauro Carvalho Chehab Date: Fri Jul 21 18:53:23 2006 -0300 V4L/DVB (4341): VIDIOCSMICROCODE were missing on compat_ioctl32 video_code size is 24 on i386 and 32 on x86_64, so a proper handling is needed on compat_ioctl32 to fix it. This code should be tested, since just *a few* boards use this ioctl. Signed-off-by: Mauro Carvalho Chehab commit 6e0c850cc534783bcfb0cc6de8e9d1059d7a6555 Author: Mauro Carvalho Chehab Date: Wed Jul 19 18:10:39 2006 -0300 V4L/DVB (4340): Videodev.h should be included also when V4L1_COMPAT is selected. Signed-off-by: Mauro Carvalho Chehab commit b6a12bef1c6a9f631bfba3caa43d19a64b9a93c5 Author: Mauro Carvalho Chehab Date: Wed Jul 19 13:52:09 2006 -0300 V4L/DVB (4339): Removed the remaining config.h stuff Since kernel include autoconf.h via command line, those config.h inclusion can be removed. Signed-off-by: Mauro Carvalho Chehab commit bfab1f95c47f44f73e4fb89218d2be5c0574e937 Author: Mike Isely Date: Tue Jul 18 22:42:18 2006 -0300 V4L/DVB (4337): Refine dead code elimination in pvrusb2 Signed-off-by: Mike Isely Signed-off-by: Mauro Carvalho Chehab commit 38986d3c6f51887008b4b0ebb8124f71d060ae12 Author: Andrew de Quincey Date: Tue Jul 18 16:37:13 2006 -0300 V4L/DVB (4322): Fix dvb-pll autoprobing Trent Piepho pointed out that the pll test i2c transmission is slightly wrong; it was transmitting a zero length message, and then reading from the PLL. This was wrong; it should only be transmitting a single read i2c message. Signed-off-by: Andrew de Quincey Signed-off-by: Mauro Carvalho Chehab commit dcad0267fa93d95ff1a6634dcc228f587fb9a37b Author: Oliver Endriss Date: Tue Jul 18 22:55:23 2006 -0300 V4L/DVB (4323): [budget/budget-av/budget-ci/budget-patch drivers] fixed DMA start/stop code Fix bug reported by Andrew de Quincey: After cold boot the saa7146 DMA did not start if the demuxer was opened before the frontend has locked to the signal. DMA transfers will be started now if (and only if) the frontend is locked and data should be sent to the demuxer. Signed-off-by: Oliver Endriss Signed-off-by: Mauro Carvalho Chehab commit 69851c5f529d6a89a05aa5cfd6120ea5181a678c Author: Michael Krufky Date: Wed Jul 19 13:23:38 2006 -0300 V4L/DVB (4316): Check __must_check warnings Check __must_check warnings for class_device_register and class_device_create_file video_device_create_file was declared as a void, but instead should return the int value of class_device_create_file. Move the check from bttv-driver.c into v4l2-dev.h, because all other callers of video_device_create_file must also be checked. Replace the call to class_device_create_file in videodev.c with video_device_create_file, as defined in v4l2-dev.h, so that the return value of class_device_create_file will be checked. Check the return value of class_device_register in videodev.c and pvrusb2-sysfs.c Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab commit ed084209aae56be5b87b43ddc76dd9c7590ebd1c Author: Michael Krufky Date: Mon Jul 17 17:15:26 2006 -0300 V4L/DVB (4314): Set the Auxiliary Byte when tuning LG H06xF in analog mode With the LG H06xF tuners, an auxiliary byte must be sent after the standard four-byte i2c sequence. The code that does this is currently in the wrong place, causing random bytes to be written to the tuner over i2c in the set_type function. This patch moves this code from set_type to default_set_tv_freq. Signed-off-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab commit 806777bbd9cef4c31efa7cd9fc481dc555226787 Author: Ricardo Cerqueira Date: Mon Jul 17 16:34:27 2006 -0300 V4L/DVB (4313): Bugfix for keycode calculation on NPG remotes Fix keycode calculations (all codes for this remote were wrong due to a lost + sign) Signed-off-by: Ricardo Cerqueira Signed-off-by: Mauro Carvalho Chehab commit e9c3d665978d47a15f817a3e99972d3d594f8069 Author: Alexander Tuschen Date: Sun Jul 16 19:42:37 2006 -0300 V4L/DVB (4312): [PATCH] Freecom DVB-T stick with ID 14aa:0225 Ok, here is the working patch for the Freecom DVB-T stick with USB-ID 14aa:0225. It uses the Firmware-file, wich Erich Focht created and wich can be obtainded from http://home.arcor.de/efocht/dvb-usb-wt220u-fc03.fw Also the original patch is from Erich. It adds the proper USB-IDs and I only had to change the endpoint of the MPEG-2 data-transfer to 0x86. Signed-off-by: Alexander Tuschen Signed-off-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab commit 49eeb4309eafa60c03e7b46b87dd865e786fa057 Author: Andrew de Quincey Date: Sun Jul 16 19:41:41 2006 -0300 V4L/DVB (4311): Fix possible dvb-pll oops Supplying a NULL i2c adapter to dvb_pll_attach is allowed, for example with mt352 demods. However, the pll i2c probe will segfault because it does not check for this. Signed-off-by: Andrew de Quincey Signed-off-by: Mauro Carvalho Chehab commit 12418c2dcffa8198d4d3ec8143a83dea9d2a101b Author: Adrian Bunk Date: Sat Jul 15 15:19:56 2006 -0300 V4L/DVB (4310): Saa7134: rename dmasound_{init, exit} Two different exports with the same name are not a good idea: $ grep -r EXPORT_SYMBOL\(dmasound_init\) * drivers/media/video/saa7134/saa7134-core.c:EXPORT_SYMBOL(dmasound_init); sound/oss/dmasound/dmasound_core.c:EXPORT_SYMBOL(dmasound_init); $ This patch renames the saa7134 dmasound_{init,exit} to saa7134_dmasound_{init,exit}. Signed-off-by: Adrian Bunk Signed-off-by: Mauro Carvalho Chehab commit 144b1e8b39f0c83630737c4512ce798f3ace80f4 Author: Hartmut Hackmann Date: Sat Jul 15 09:47:32 2006 -0300 V4L/DVB (4309): Added PCI ID of the Genius VideoWonder Dual Cardbus It is just another Lifeview clone Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab commit 66802716649c17e2f80c92fdc1fec374d077e893 Author: Hartmut Hackmann Date: Sat Jul 15 09:47:16 2006 -0300 V4L/DVB (4308): Added PCI ID for AverMedia DVB-T 777 with SAA7133 The change is just an additional PCI ID Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab commit f3e20ed14cd60d3253a97e41072a34fe40b3c107 Author: Hartmut Hackmann Date: Sat Jul 15 09:46:32 2006 -0300 V4L/DVB (4307): Added support for the md8800 quadro board Analog TV, CVBS, S-video and DVB-T are working, DVB-S not yet Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab commit ef28470dbe1bbaee9b23192c8cbf4f7d061fd606 Author: Hartmut Hackmann Date: Sat Jul 15 09:45:34 2006 -0300 V4L/DVB (4306): Support non interlaced capture by default for saa713x This patch just sets the option noninterlaced to 1 by default since it has no known disadvantages. It is still possibe to get the old behaviour by setting noninterlaced=0. Signed-off-by: Hartmut Hackmann Signed-off-by: Mauro Carvalho Chehab commit bfa86e13732fa145913edd15a77f79c6733813fa Author: Randy Dunlap Date: Sat Jul 15 09:08:26 2006 -0300 V4L/DVB (4298): Check all __must_check warnings in bttv. Signed-off-by: Randy Dunlap Signed-off-by: Mauro Carvalho Chehab commit 0569e8603bd8ec87a04e6106a8c846356852ebb6 Author: Andrew de Quincey Date: Mon Jul 10 03:34:16 2006 -0300 V4L/DVB (4296): Remove stradis MODULE_DEVICE_INFO definition To prevent autoloading of the driver, as it then conflicts with every other saa7146 device in existence. Signed-off-by: Andrew de Quincey Signed-off-by: Mauro Carvalho Chehab commit 7d224fd6874589d1c56b484137cff88d7786507a Author: Marco Schluessler Date: Mon Jul 10 03:34:16 2006 -0300 V4L/DVB (4295): Fix typo in comment for TDA9819 Fix typo in comment for TDA9819 Signed-off-by: Marco Schluessler Signed-off-by: Andrew de Quincey Signed-off-by: Mauro Carvalho Chehab commit f542605630b1bbcd265cb2afd196a4513a804b03 Author: Andrew de Quincey Date: Mon Jul 10 03:34:15 2006 -0300 V4L/DVB (4294): Fix broken tda665x PLL definition. It was pointed out on the mailing list that this PLL definition is broken. I went back to the original dibusb driver and confirmed it used to use these settings, as well as consulting the datasheet. Signed-off-by: Andrew de Quincey Signed-off-by: Mauro Carvalho Chehab commit 91fc8f92dd9bae0b1757f651c76bcfe334d76c10 Author: Andrew de Quincey Date: Mon Jul 10 03:34:15 2006 -0300 V4L/DVB (4293): Fix unstable DISEQC behaviour on budget cards. Use the stv0299 native DISEQC implementation instead of the bitbanging one as required by the ves1893. This was originally found by Oliver Endriss. Signed-off-by: Andrew de Quincey Signed-off-by: Oliver Endriss Signed-off-by: Mauro Carvalho Chehab commit 25aa031802998082bc598d0e7c962d95f7731630 Author: Andrew de Quincey Date: Mon Jul 10 03:34:14 2006 -0300 V4L/DVB (4292): Fix DISEQC regression The changes to add frontend reinitialisation moved the position where the init() op is called into the frontend thread. Unfortunately, since DISEQC operations do not use the frontend thread, this meant that DISEQC could be called against an uninitalised frontend, leading to all sorts of trouble. Patch fixes this by reinstating the original fronted intialisation call. Signed-off-by: Andrew de Quincey Signed-off-by: Mauro Carvalho Chehab commit f0d5508a086f5f85cacfae949caafb0206a858ce Author: Andrew de Quincey Date: Mon Jul 10 03:34:14 2006 -0300 V4L/DVB (4291): Add dvbpll i2c device check. Some cards have multiple possible addresses for their PLLs, with no other way to tell if a PLL is present or not apart from probing to see if an i2c device is present. This adds a quick check to see if an i2c device is present at the given i2c address. Signed-off-by: Andrew de Quincey Acked-by: Michael Krufky Signed-off-by: Mauro Carvalho Chehab --- Signed-off-by: Andrew Morton --- Documentation/video4linux/CARDLIST.cx88 | 5 Documentation/video4linux/CARDLIST.saa7134 | 5 drivers/media/common/ir-keymaps.c | 48 ++ drivers/media/dvb/dvb-core/dvb_frontend.c | 15 drivers/media/dvb/dvb-usb/dtt200u.c | 45 ++ drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 2 drivers/media/dvb/frontends/dvb-pll.c | 24 - drivers/media/dvb/ttpci/av7110.c | 4 drivers/media/dvb/ttpci/av7110_v4l.c | 12 drivers/media/dvb/ttpci/budget-av.c | 3 drivers/media/dvb/ttpci/budget-ci.c | 2 drivers/media/dvb/ttpci/budget-core.c | 57 ++ drivers/media/dvb/ttpci/budget-patch.c | 2 drivers/media/dvb/ttpci/budget.c | 5 drivers/media/dvb/ttpci/budget.h | 7 drivers/media/radio/Kconfig | 26 - drivers/media/radio/radio-aimslab.c | 151 +++++-- drivers/media/radio/radio-aztech.c | 164 +++++--- drivers/media/radio/radio-gemtek-pci.c | 164 +++++--- drivers/media/radio/radio-gemtek.c | 161 +++++-- drivers/media/radio/radio-maestro.c | 197 ++++++--- drivers/media/radio/radio-maxiradio.c | 160 ++++--- drivers/media/radio/radio-rtrack2.c | 159 +++++-- drivers/media/radio/radio-sf16fmi.c | 157 ++++--- drivers/media/radio/radio-sf16fmr2.c | 223 ++++++----- drivers/media/radio/radio-terratec.c | 154 +++++-- drivers/media/radio/radio-trust.c | 182 ++++++-- drivers/media/radio/radio-typhoon.c | 171 +++++--- drivers/media/radio/radio-zoltrix.c | 181 ++++++-- drivers/media/video/Kconfig | 4 drivers/media/video/bt8xx/Kconfig | 2 drivers/media/video/bt8xx/bttv-driver.c | 15 drivers/media/video/compat_ioctl32.c | 24 + drivers/media/video/cpia2/Kconfig | 2 drivers/media/video/cx88/cx88-cards.c | 86 ++++ drivers/media/video/cx88/cx88-core.c | 2 drivers/media/video/cx88/cx88-input.c | 19 drivers/media/video/cx88/cx88-tvaudio.c | 1 drivers/media/video/cx88/cx88-video.c | 5 drivers/media/video/cx88/cx88.h | 3 drivers/media/video/msp3400-driver.c | 10 drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h | 1 drivers/media/video/pvrusb2/pvrusb2-hdw.c | 8 drivers/media/video/pvrusb2/pvrusb2-io.c | 9 drivers/media/video/pvrusb2/pvrusb2-io.h | 2 drivers/media/video/pvrusb2/pvrusb2-ioread.c | 5 drivers/media/video/pvrusb2/pvrusb2-main.c | 1 drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 34 + drivers/media/video/saa7134/saa7134-alsa.c | 10 drivers/media/video/saa7134/saa7134-cards.c | 52 ++ drivers/media/video/saa7134/saa7134-core.c | 16 drivers/media/video/saa7134/saa7134-dvb.c | 54 ++ drivers/media/video/saa7134/saa7134-oss.c | 10 drivers/media/video/saa7134/saa7134-video.c | 6 drivers/media/video/saa7134/saa7134.h | 5 drivers/media/video/stradis.c | 1 drivers/media/video/tuner-core.c | 31 - drivers/media/video/tuner-simple.c | 21 - drivers/media/video/usbvideo/Kconfig | 8 drivers/media/video/v4l2-common.c | 24 - drivers/media/video/videodev.c | 29 + drivers/media/video/vivi.c | 4 include/linux/videodev.h | 7 include/linux/videodev2.h | 2 include/media/ir-common.h | 1 include/media/v4l2-dev.h | 13 66 files changed, 2132 insertions(+), 881 deletions(-) diff -puN Documentation/video4linux/CARDLIST.cx88~git-dvb Documentation/video4linux/CARDLIST.cx88 --- a/Documentation/video4linux/CARDLIST.cx88~git-dvb +++ a/Documentation/video4linux/CARDLIST.cx88 @@ -10,7 +10,7 @@ 9 -> Leadtek PVR 2000 [107d:663b,107d:663C] 10 -> IODATA GV-VCP3/PCI [10fc:d003] 11 -> Prolink PlayTV PVR - 12 -> ASUS PVR-416 [1043:4823] + 12 -> ASUS PVR-416 [1043:4823,1461:c111] 13 -> MSI TV-@nywhere 14 -> KWorld/VStream XPert DVB-T [17de:08a6] 15 -> DViCO FusionHDTV DVB-T1 [18ac:db00] @@ -51,3 +51,6 @@ 50 -> NPG Tech Real TV FM Top 10 [14f1:0842] 51 -> WinFast DTV2000 H [107d:665e] 52 -> Geniatech DVB-S [14f1:0084] + 53 -> Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T [0070:1404] + 54 -> Norwood Micro TV Tuner + 55 -> Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM [c180:c980] diff -puN Documentation/video4linux/CARDLIST.saa7134~git-dvb Documentation/video4linux/CARDLIST.saa7134 --- a/Documentation/video4linux/CARDLIST.saa7134~git-dvb +++ a/Documentation/video4linux/CARDLIST.saa7134 @@ -58,7 +58,7 @@ 57 -> Avermedia AVerTV GO 007 FM [1461:f31f] 58 -> ADS Tech Instant TV (saa7135) [1421:0350,1421:0351,1421:0370,1421:1370] 59 -> Kworld/Tevion V-Stream Xpert TV PVR7134 - 60 -> LifeView/Typhoon FlyDVB-T Duo Cardbus [5168:0502,4e42:0502] + 60 -> LifeView/Typhoon/Genius FlyDVB-T Duo Cardbus [5168:0502,4e42:0502,1489:0502] 61 -> Philips TOUGH DVB-T reference design [1131:2004] 62 -> Compro VideoMate TV Gold+II 63 -> Kworld Xpert TV PVR7134 @@ -83,7 +83,7 @@ 82 -> MSI TV@Anywhere plus [1462:6231] 83 -> Terratec Cinergy 250 PCI TV [153b:1160] 84 -> LifeView FlyDVB Trio [5168:0319] - 85 -> AverTV DVB-T 777 [1461:2c05] + 85 -> AverTV DVB-T 777 [1461:2c05,1461:2c05] 86 -> LifeView FlyDVB-T / Genius VideoWonder DVB-T [5168:0301,1489:0301] 87 -> ADS Instant TV Duo Cardbus PTV331 [0331:1421] 88 -> Tevion/KWorld DVB-T 220RF [17de:7201] @@ -94,3 +94,4 @@ 93 -> Medion 7134 Bridge #2 [16be:0005] 94 -> LifeView FlyDVB-T Hybrid Cardbus [5168:3306,5168:3502] 95 -> LifeView FlyVIDEO3000 (NTSC) [5169:0138] + 96 -> Medion Md8800 Quadro [16be:0007,16be:0008] diff -puN drivers/media/common/ir-keymaps.c~git-dvb drivers/media/common/ir-keymaps.c --- a/drivers/media/common/ir-keymaps.c~git-dvb +++ a/drivers/media/common/ir-keymaps.c @@ -1473,3 +1473,51 @@ IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTA }; EXPORT_SYMBOL_GPL(ir_codes_npgtech); + +/* Norwood Micro (non-Pro) TV Tuner + By Peter Naulls + Key comments are the functions given in the manual */ +IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE] = { + /* Keys 0 to 9 */ + [ 0x20 ] = KEY_0, + [ 0x21 ] = KEY_1, + [ 0x22 ] = KEY_2, + [ 0x23 ] = KEY_3, + [ 0x24 ] = KEY_4, + [ 0x25 ] = KEY_5, + [ 0x26 ] = KEY_6, + [ 0x27 ] = KEY_7, + [ 0x28 ] = KEY_8, + [ 0x29 ] = KEY_9, + + [ 0x78 ] = KEY_TUNER, /* Video Source */ + [ 0x2c ] = KEY_EXIT, /* Open/Close software */ + [ 0x2a ] = KEY_SELECT, /* 2 Digit Select */ + [ 0x69 ] = KEY_AGAIN, /* Recall */ + + [ 0x32 ] = KEY_BRIGHTNESSUP, /* Brightness increase */ + [ 0x33 ] = KEY_BRIGHTNESSDOWN, /* Brightness decrease */ + [ 0x6b ] = KEY_KPPLUS, /* (not named >>>>>) */ + [ 0x6c ] = KEY_KPMINUS, /* (not named <<<<<) */ + + [ 0x2d ] = KEY_MUTE, /* Mute */ + [ 0x30 ] = KEY_VOLUMEUP, /* Volume up */ + [ 0x31 ] = KEY_VOLUMEDOWN, /* Volume down */ + [ 0x60 ] = KEY_CHANNELUP, /* Channel up */ + [ 0x61 ] = KEY_CHANNELDOWN, /* Channel down */ + + [ 0x3f ] = KEY_RECORD, /* Record */ + [ 0x37 ] = KEY_PLAY, /* Play */ + [ 0x36 ] = KEY_PAUSE, /* Pause */ + [ 0x2b ] = KEY_STOP, /* Stop */ + [ 0x67 ] = KEY_FASTFORWARD, /* Foward */ + [ 0x66 ] = KEY_REWIND, /* Rewind */ + [ 0x3e ] = KEY_SEARCH, /* Auto Scan */ + [ 0x2e ] = KEY_CAMERA, /* Capture Video */ + [ 0x6d ] = KEY_MENU, /* Show/Hide Control */ + [ 0x2f ] = KEY_ZOOM, /* Full Screen */ + [ 0x34 ] = KEY_RADIO, /* FM */ + [ 0x65 ] = KEY_POWER, /* Computer power */ +}; + +EXPORT_SYMBOL_GPL(ir_codes_norwood); diff -puN drivers/media/dvb/dvb-core/dvb_frontend.c~git-dvb drivers/media/dvb/dvb-core/dvb_frontend.c --- a/drivers/media/dvb/dvb-core/dvb_frontend.c~git-dvb +++ a/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -526,7 +526,9 @@ static int dvb_frontend_thread(void *dat fepriv->delay = 3*HZ; fepriv->status = 0; fepriv->wakeup = 0; - fepriv->reinitialise = 1; + fepriv->reinitialise = 0; + + dvb_frontend_init(fe); while (1) { up(&fepriv->sem); /* is locked when we enter the thread... */ @@ -1013,17 +1015,18 @@ static int dvb_frontend_open(struct inod return ret; if ((file->f_flags & O_ACCMODE) != O_RDONLY) { + + /* normal tune mode when opened R/W */ + fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; + fepriv->tone = -1; + fepriv->voltage = -1; + ret = dvb_frontend_start (fe); if (ret) dvb_generic_release (inode, file); /* empty event queue */ fepriv->events.eventr = fepriv->events.eventw = 0; - - /* normal tune mode when opened R/W */ - fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; - fepriv->tone = -1; - fepriv->voltage = -1; } return ret; diff -puN drivers/media/dvb/dvb-usb/dtt200u.c~git-dvb drivers/media/dvb/dvb-usb/dtt200u.c --- a/drivers/media/dvb/dvb-usb/dtt200u.c~git-dvb +++ a/drivers/media/dvb/dvb-usb/dtt200u.c @@ -93,6 +93,7 @@ static int dtt200u_frontend_attach(struc } static struct dvb_usb_properties dtt200u_properties; +static struct dvb_usb_properties wt220u_fc_properties; static struct dvb_usb_properties wt220u_properties; static struct dvb_usb_properties wt220u_zl0353_properties; @@ -101,6 +102,7 @@ static int dtt200u_usb_probe(struct usb_ { if (dvb_usb_device_init(intf,&dtt200u_properties,THIS_MODULE,NULL) == 0 || dvb_usb_device_init(intf,&wt220u_properties,THIS_MODULE,NULL) == 0 || + dvb_usb_device_init(intf,&wt220u_fc_properties,THIS_MODULE,NULL) == 0 || dvb_usb_device_init(intf,&wt220u_zl0353_properties,THIS_MODULE,NULL) == 0) return 0; @@ -114,6 +116,8 @@ static struct usb_device_id dtt200u_usb_ { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_WARM) }, { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_ZL0353_COLD) }, { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_ZL0353_WARM) }, + { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_FC_COLD) }, + { USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_WT220U_FC_WARM) }, { 0 }, }; MODULE_DEVICE_TABLE(usb, dtt200u_usb_table); @@ -200,6 +204,47 @@ static struct dvb_usb_properties wt220u_ } }; +static struct dvb_usb_properties wt220u_fc_properties = { + .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, + .pid_filter_count = 15, + + .usb_ctrl = CYPRESS_FX2, + .firmware = "dvb-usb-wt220u-fc03.fw", + + .power_ctrl = dtt200u_power_ctrl, + .streaming_ctrl = dtt200u_streaming_ctrl, + .pid_filter = dtt200u_pid_filter, + .frontend_attach = dtt200u_frontend_attach, + + .rc_interval = 300, + .rc_key_map = dtt200u_rc_keys, + .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_query = dtt200u_rc_query, + + .generic_bulk_ctrl_endpoint = 0x01, + + /* parameter for the MPEG2-data transfer */ + .urb = { + .type = DVB_USB_BULK, + .count = 7, + .endpoint = 0x86, + .u = { + .bulk = { + .buffersize = 4096, + } + } + }, + + .num_device_descs = 1, + .devices = { + { .name = "WideView WT-220U PenType Receiver (Typhoon/Freecom)", + .cold_ids = { &dtt200u_usb_table[6], NULL }, + .warm_ids = { &dtt200u_usb_table[7], NULL }, + }, + { NULL }, + } +}; + static struct dvb_usb_properties wt220u_zl0353_properties = { .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING, .pid_filter_count = 15, diff -puN drivers/media/dvb/dvb-usb/dvb-usb-ids.h~git-dvb drivers/media/dvb/dvb-usb/dvb-usb-ids.h --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h~git-dvb +++ a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -84,6 +84,8 @@ #define USB_PID_DTT200U_WARM 0x0301 #define USB_PID_WT220U_COLD 0x0222 #define USB_PID_WT220U_WARM 0x0221 +#define USB_PID_WT220U_FC_COLD 0x0225 +#define USB_PID_WT220U_FC_WARM 0x0226 #define USB_PID_WT220U_ZL0353_COLD 0x022a #define USB_PID_WT220U_ZL0353_WARM 0x022b #define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 diff -puN drivers/media/dvb/frontends/dvb-pll.c~git-dvb drivers/media/dvb/frontends/dvb-pll.c --- a/drivers/media/dvb/frontends/dvb-pll.c~git-dvb +++ a/drivers/media/dvb/frontends/dvb-pll.c @@ -194,11 +194,11 @@ struct dvb_pll_desc dvb_pll_tda665x = { { 253834000, 36249333, 166667, 0xca, 0x62 /* 011 0 0 0 10 */ }, { 383834000, 36249333, 166667, 0xca, 0xa2 /* 101 0 0 0 10 */ }, { 443834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ }, - { 444000000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, - { 583834000, 36249333, 166667, 0xca, 0x63 /* 011 0 0 0 11 */ }, - { 793834000, 36249333, 166667, 0xca, 0xa3 /* 101 0 0 0 11 */ }, - { 444834000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, - { 861000000, 36249333, 166667, 0xca, 0xe3 /* 111 0 0 0 11 */ }, + { 444000000, 36249333, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ }, + { 583834000, 36249333, 166667, 0xca, 0x64 /* 011 0 0 1 00 */ }, + { 793834000, 36249333, 166667, 0xca, 0xa4 /* 101 0 0 1 00 */ }, + { 444834000, 36249333, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ }, + { 861000000, 36249333, 166667, 0xca, 0xe4 /* 111 0 0 1 00 */ }, } }; EXPORT_SYMBOL(dvb_pll_tda665x); @@ -613,7 +613,21 @@ static struct dvb_tuner_ops dvb_pll_tune int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc) { + u8 b1 [] = { 0 }; + struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, .buf = b1, .len = 1 }; struct dvb_pll_priv *priv = NULL; + int ret; + + if (i2c != NULL) { + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 1); + + ret = i2c_transfer (i2c, &msg, 1); + if (ret != 1) + return -1; + if (fe->ops.i2c_gate_ctrl) + fe->ops.i2c_gate_ctrl(fe, 0); + } priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL); if (priv == NULL) diff -puN drivers/media/dvb/ttpci/av7110.c~git-dvb drivers/media/dvb/ttpci/av7110.c --- a/drivers/media/dvb/ttpci/av7110.c~git-dvb +++ a/drivers/media/dvb/ttpci/av7110.c @@ -2203,8 +2203,8 @@ static int frontend_init(struct av7110 * av7110->fe->ops.tuner_ops.set_params = nexusca_stv0297_tuner_set_params; /* set TDA9819 into DVB mode */ - saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) - saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) + saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) + saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) /* tuner on this needs a slower i2c bus speed */ av7110->dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240; diff -puN drivers/media/dvb/ttpci/av7110_v4l.c~git-dvb drivers/media/dvb/ttpci/av7110_v4l.c --- a/drivers/media/dvb/ttpci/av7110_v4l.c~git-dvb +++ a/drivers/media/dvb/ttpci/av7110_v4l.c @@ -272,8 +272,8 @@ static int av7110_dvb_c_switch(struct sa if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) dprintk(1, "setting band in demodulator failed.\n"); } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { - saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD) - saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF) + saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9819 pin9(STD) + saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9819 pin30(VIF) } if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1) dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); @@ -308,8 +308,8 @@ static int av7110_dvb_c_switch(struct sa if (ves1820_writereg(dev, 0x09, 0x0f, 0x20)) dprintk(1, "setting band in demodulator failed.\n"); } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { - saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) - saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) + saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) + saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) } } @@ -750,8 +750,8 @@ int av7110_init_analog_module(struct av7 if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20)) dprintk(1, "setting band in demodulator failed.\n"); } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { - saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) - saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) + saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD) + saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF) } /* init the saa7113 */ diff -puN drivers/media/dvb/ttpci/budget-av.c~git-dvb drivers/media/dvb/ttpci/budget-av.c --- a/drivers/media/dvb/ttpci/budget-av.c~git-dvb +++ a/drivers/media/dvb/ttpci/budget-av.c @@ -1303,6 +1303,9 @@ static int budget_av_attach(struct saa71 budget_av->budget.dvb_adapter.priv = budget_av; frontend_init(budget_av); ciintf_init(budget_av); + + ttpci_budget_init_hooks(&budget_av->budget); + return 0; } diff -puN drivers/media/dvb/ttpci/budget.c~git-dvb drivers/media/dvb/ttpci/budget.c --- a/drivers/media/dvb/ttpci/budget.c~git-dvb +++ a/drivers/media/dvb/ttpci/budget.c @@ -375,9 +375,6 @@ static void frontend_init(struct budget if (budget->dvb_frontend) { budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; budget->dvb_frontend->tuner_priv = &budget->i2c_adap; - budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_diseqc_send_master_cmd; - budget->dvb_frontend->ops.diseqc_send_burst = budget_diseqc_send_burst; - budget->dvb_frontend->ops.set_tone = budget_set_tone; break; } break; @@ -474,6 +471,8 @@ static int budget_attach (struct saa7146 budget->dvb_adapter.priv = budget; frontend_init(budget); + ttpci_budget_init_hooks(budget); + return 0; } diff -puN drivers/media/dvb/ttpci/budget-ci.c~git-dvb drivers/media/dvb/ttpci/budget-ci.c --- a/drivers/media/dvb/ttpci/budget-ci.c~git-dvb +++ a/drivers/media/dvb/ttpci/budget-ci.c @@ -1101,6 +1101,8 @@ static int budget_ci_attach(struct saa71 budget_ci->budget.dvb_adapter.priv = budget_ci; frontend_init(budget_ci); + ttpci_budget_init_hooks(&budget_ci->budget); + return 0; } diff -puN drivers/media/dvb/ttpci/budget-core.c~git-dvb drivers/media/dvb/ttpci/budget-core.c --- a/drivers/media/dvb/ttpci/budget-core.c~git-dvb +++ a/drivers/media/dvb/ttpci/budget-core.c @@ -63,9 +63,6 @@ static int stop_ts_capture(struct budget { dprintk(2, "budget: %p\n", budget); - if (--budget->feeding) - return budget->feeding; - saa7146_write(budget->dev, MC1, MASK_20); // DMA3 off SAA7146_IER_DISABLE(budget->dev, MASK_10); return 0; @@ -77,8 +74,8 @@ static int start_ts_capture(struct budge dprintk(2, "budget: %p\n", budget); - if (budget->feeding) - return ++budget->feeding; + if (!budget->feeding || !budget->fe_synced) + return 0; saa7146_write(dev, MC1, MASK_20); // DMA3 off @@ -139,7 +136,33 @@ static int start_ts_capture(struct budge SAA7146_IER_ENABLE(budget->dev, MASK_10); /* VPE */ saa7146_write(dev, MC1, (MASK_04 | MASK_20)); /* DMA3 on */ - return ++budget->feeding; + return 0; +} + +static int budget_read_fe_status(struct dvb_frontend *fe, fe_status_t *status) +{ + struct budget *budget = (struct budget *) fe->dvb->priv; + int synced; + int ret; + + if (budget->read_fe_status) + ret = budget->read_fe_status(fe, status); + else + ret = -EINVAL; + + if (!ret) { + synced = (*status & FE_HAS_LOCK); + if (synced != budget->fe_synced) { + budget->fe_synced = synced; + spin_lock(&budget->feedlock); + if (synced) + start_ts_capture(budget); + else + stop_ts_capture(budget); + spin_unlock(&budget->feedlock); + } + } + return ret; } static void vpeirq(unsigned long data) @@ -267,7 +290,7 @@ static int budget_start_feed(struct dvb_ { struct dvb_demux *demux = feed->demux; struct budget *budget = (struct budget *) demux->priv; - int status; + int status = 0; dprintk(2, "budget: %p\n", budget); @@ -276,7 +299,8 @@ static int budget_start_feed(struct dvb_ spin_lock(&budget->feedlock); feed->pusi_seen = 0; /* have a clean section start */ - status = start_ts_capture(budget); + if (budget->feeding++ == 0) + status = start_ts_capture(budget); spin_unlock(&budget->feedlock); return status; } @@ -285,12 +309,13 @@ static int budget_stop_feed(struct dvb_d { struct dvb_demux *demux = feed->demux; struct budget *budget = (struct budget *) demux->priv; - int status; + int status = 0; dprintk(2, "budget: %p\n", budget); spin_lock(&budget->feedlock); - status = stop_ts_capture(budget); + if (--budget->feeding == 0) + status = stop_ts_capture(budget); spin_unlock(&budget->feedlock); return status; } @@ -470,6 +495,14 @@ err: return ret; } +void ttpci_budget_init_hooks(struct budget *budget) +{ + if (budget->dvb_frontend && !budget->read_fe_status) { + budget->read_fe_status = budget->dvb_frontend->ops.read_status; + budget->dvb_frontend->ops.read_status = budget_read_fe_status; + } +} + int ttpci_budget_deinit(struct budget *budget) { struct saa7146_dev *dev = budget->dev; @@ -508,11 +541,8 @@ void ttpci_budget_set_video_port(struct spin_lock(&budget->feedlock); budget->video_port = video_port; if (budget->feeding) { - int oldfeeding = budget->feeding; - budget->feeding = 1; stop_ts_capture(budget); start_ts_capture(budget); - budget->feeding = oldfeeding; } spin_unlock(&budget->feedlock); } @@ -520,6 +550,7 @@ void ttpci_budget_set_video_port(struct EXPORT_SYMBOL_GPL(ttpci_budget_debiread); EXPORT_SYMBOL_GPL(ttpci_budget_debiwrite); EXPORT_SYMBOL_GPL(ttpci_budget_init); +EXPORT_SYMBOL_GPL(ttpci_budget_init_hooks); EXPORT_SYMBOL_GPL(ttpci_budget_deinit); EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler); EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port); diff -puN drivers/media/dvb/ttpci/budget.h~git-dvb drivers/media/dvb/ttpci/budget.h --- a/drivers/media/dvb/ttpci/budget.h~git-dvb +++ a/drivers/media/dvb/ttpci/budget.h @@ -52,9 +52,6 @@ struct budget { struct dmx_frontend hw_frontend; struct dmx_frontend mem_frontend; - int fe_synced; - struct mutex pid_mutex; - int ci_present; int video_port; @@ -74,6 +71,9 @@ struct budget { struct dvb_adapter dvb_adapter; struct dvb_frontend *dvb_frontend; + int (*read_fe_status)(struct dvb_frontend *fe, fe_status_t *status); + int fe_synced; + void *priv; }; @@ -106,6 +106,7 @@ static struct saa7146_pci_extension_data extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, struct saa7146_pci_extension_data *info, struct module *owner); +extern void ttpci_budget_init_hooks(struct budget *budget); extern int ttpci_budget_deinit(struct budget *budget); extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr); extern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port); diff -puN drivers/media/dvb/ttpci/budget-patch.c~git-dvb drivers/media/dvb/ttpci/budget-patch.c --- a/drivers/media/dvb/ttpci/budget-patch.c~git-dvb +++ a/drivers/media/dvb/ttpci/budget-patch.c @@ -617,6 +617,8 @@ static int budget_patch_attach (struct s budget->dvb_adapter.priv = budget; frontend_init(budget); + ttpci_budget_init_hooks(budget); + return 0; } diff -puN drivers/media/radio/Kconfig~git-dvb drivers/media/radio/Kconfig --- a/drivers/media/radio/Kconfig~git-dvb +++ a/drivers/media/radio/Kconfig @@ -25,7 +25,7 @@ config RADIO_CADET config RADIO_RTRACK tristate "AIMSlab RadioTrack (aka RadioReveal) support" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 ---help--- Choose Y here if you have one of these FM radio cards, and then fill in the port address below. @@ -59,7 +59,7 @@ config RADIO_RTRACK_PORT config RADIO_RTRACK2 tristate "AIMSlab RadioTrack II support" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 ---help--- Choose Y here if you have this FM radio card, and then fill in the port address below. @@ -82,7 +82,7 @@ config RADIO_RTRACK2_PORT config RADIO_AZTECH tristate "Aztech/Packard Bell Radio" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 ---help--- Choose Y here if you have one of these FM radio cards, and then fill in the port address below. @@ -106,7 +106,7 @@ config RADIO_AZTECH_PORT config RADIO_GEMTEK tristate "GemTek Radio Card support" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 ---help--- Choose Y here if you have this FM radio card, and then fill in the port address below. @@ -131,7 +131,7 @@ config RADIO_GEMTEK_PORT config RADIO_GEMTEK_PCI tristate "GemTek PCI Radio Card support" - depends on VIDEO_V4L1 && PCI + depends on VIDEO_V4L2 && PCI ---help--- Choose Y here if you have this PCI FM radio card. @@ -145,7 +145,7 @@ config RADIO_GEMTEK_PCI config RADIO_MAXIRADIO tristate "Guillemot MAXI Radio FM 2000 radio" - depends on VIDEO_V4L1 && PCI + depends on VIDEO_V4L2 && PCI ---help--- Choose Y here if you have this radio card. This card may also be found as Gemtek PCI FM. @@ -160,7 +160,7 @@ config RADIO_MAXIRADIO config RADIO_MAESTRO tristate "Maestro on board radio" - depends on VIDEO_V4L1 + depends on VIDEO_V4L2 && PCI ---help--- Say Y here to directly support the on-board radio tuner on the Maestro 2 or 2E sound card. @@ -208,7 +208,7 @@ config RADIO_MIROPCM20_RDS config RADIO_SF16FMI tristate "SF16FMI Radio" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 ---help--- Choose Y here if you have one of these FM radio cards. If you compile the driver into the kernel and your card is not PnP one, you @@ -225,7 +225,7 @@ config RADIO_SF16FMI config RADIO_SF16FMR2 tristate "SF16FMR2 Radio" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 ---help--- Choose Y here if you have one of these FM radio cards. @@ -239,7 +239,7 @@ config RADIO_SF16FMR2 config RADIO_TERRATEC tristate "TerraTec ActiveRadio ISA Standalone" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 ---help--- Choose Y here if you have this FM radio card, and then fill in the port address below. (TODO) @@ -268,7 +268,7 @@ config RADIO_TERRATEC_PORT config RADIO_TRUST tristate "Trust FM radio card" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 help This is a driver for the Trust FM radio cards. Say Y if you have such a card and want to use it under Linux. @@ -286,7 +286,7 @@ config RADIO_TRUST_PORT config RADIO_TYPHOON tristate "Typhoon Radio (a.k.a. EcoRadio)" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 ---help--- Choose Y here if you have one of these FM radio cards, and then fill in the port address and the frequency used for muting below. @@ -330,7 +330,7 @@ config RADIO_TYPHOON_MUTEFREQ config RADIO_ZOLTRIX tristate "Zoltrix Radio" - depends on ISA && VIDEO_V4L1 + depends on ISA && VIDEO_V4L2 ---help--- Choose Y here if you have one of these FM radio cards, and then fill in the port address below. diff -puN drivers/media/radio/radio-aimslab.c~git-dvb drivers/media/radio/radio-aimslab.c --- a/drivers/media/radio/radio-aimslab.c~git-dvb +++ a/drivers/media/radio/radio-aimslab.c @@ -1,5 +1,6 @@ /* radiotrack (radioreveal) driver for Linux radio support * (c) 1997 M. Kirkwood + * Converted to V4L2 API by Mauro Carvalho Chehab * Converted to new API by Alan Cox * Various bugfixes and enhancements by Russell Kroll * @@ -33,11 +34,13 @@ #include /* udelay */ #include /* outb, outb_p */ #include /* copy to/from user */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include -#include /* CONFIG_RADIO_RTRACK_PORT */ #include /* Lock for the I/O */ +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + #ifndef CONFIG_RADIO_RTRACK_PORT #define CONFIG_RADIO_RTRACK_PORT -1 #endif @@ -209,6 +212,25 @@ static int rt_getsigstr(struct rt_device return 1; /* signal present */ } +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 0xff, + .step = 1, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; + static int rt_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) { @@ -217,73 +239,114 @@ static int rt_do_ioctl(struct inode *ino switch(cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - v->type=VID_TYPE_TUNER; - v->channels=1; - v->audios=1; - strcpy(v->name, "RadioTrack"); + strlcpy(v->driver, "radio-aimslab", sizeof (v->driver)); + strlcpy(v->card, "RadioTrack", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; - if(v->tuner) /* Only 1 tuner */ + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; + + memset(v,0,sizeof(*v)); + strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + v->rangelow=(87*16000); v->rangehigh=(108*16000); - v->flags=VIDEO_TUNER_LOW; - v->mode=VIDEO_MODE_AUTO; - strcpy(v->name, "FM"); + v->rxsubchans =V4L2_TUNER_SUB_MONO; + v->capability=V4L2_TUNER_CAP_LOW; + v->audmode = V4L2_TUNER_MODE_MONO; v->signal=0xFFFF*rt_getsigstr(rt); + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if(v->tuner!=0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - /* Only 1 tuner so no setting needed ! */ + return 0; } - case VIDIOCGFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; - *freq = rt->curfreq; + struct v4l2_frequency *f = arg; + + rt->curfreq = f->frequency; + rt_setfreq(rt, rt->curfreq); return 0; } - case VIDIOCSFREQ: + case VIDIOC_G_FREQUENCY: { - unsigned long *freq = arg; - rt->curfreq = *freq; - rt_setfreq(rt, rt->curfreq); + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = rt->curfreq; + return 0; } - case VIDIOCGAUDIO: + case VIDIOC_QUERYCTRL: { - struct video_audio *v = arg; - memset(v,0, sizeof(*v)); - v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; - v->volume=rt->curvol * 6554; - v->step=6554; - strcpy(v->name, "Radio"); - return 0; + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; } - case VIDIOCSAUDIO: + case VIDIOC_G_CTRL: { - struct video_audio *v = arg; - if(v->audio) - return -EINVAL; - if(v->flags&VIDEO_AUDIO_MUTE) - rt_mute(rt); - else - rt_setvol(rt,v->volume/6554); - return 0; + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=rt->muted; + return (0); + case V4L2_CID_AUDIO_VOLUME: + ctrl->value=rt->curvol * 6554; + return (0); + } + return -EINVAL; } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value) { + rt_mute(rt); + } else { + rt_setvol(rt,rt->curvol); + } + return (0); + case V4L2_CID_AUDIO_VOLUME: + rt_setvol(rt,ctrl->value); + return (0); + } + return -EINVAL; + } + default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + rt_do_ioctl); } } @@ -309,7 +372,7 @@ static struct video_device rtrack_radio= .owner = THIS_MODULE, .name = "RadioTrack radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_RTRACK, + .hardware = 0, .fops = &rtrack_fops, }; diff -puN drivers/media/radio/radio-aztech.c~git-dvb drivers/media/radio/radio-aztech.c --- a/drivers/media/radio/radio-aztech.c~git-dvb +++ a/drivers/media/radio/radio-aztech.c @@ -1,5 +1,6 @@ /* radio-aztech.c - Aztech radio card driver for Linux 2.2 * + * Converted to V4L2 API by Mauro Carvalho Chehab * Adapted to support the Video for Linux API by * Russell Kroll . Based on original tuner code by: * @@ -30,9 +31,30 @@ #include /* udelay */ #include /* outb, outb_p */ #include /* copy to/from user */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include -#include /* CONFIG_RADIO_AZTECH_PORT */ + +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 0xff, + .step = 1, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; /* acceptable ports: 0x350 (JP3 shorted), 0x358 (JP3 open) */ @@ -166,81 +188,121 @@ static int az_do_ioctl(struct inode *ino switch(cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - v->type=VID_TYPE_TUNER; - v->channels=1; - v->audios=1; - strcpy(v->name, "Aztech Radio"); + strlcpy(v->driver, "radio-aztech", sizeof (v->driver)); + strlcpy(v->card, "Aztech Radio", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; - if(v->tuner) /* Only 1 tuner */ + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; + + memset(v,0,sizeof(*v)); + strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + v->rangelow=(87*16000); v->rangehigh=(108*16000); - v->flags=VIDEO_TUNER_LOW; - v->mode=VIDEO_MODE_AUTO; - v->signal=0xFFFF*az_getsigstr(az); + v->rxsubchans =V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; + v->capability=V4L2_TUNER_CAP_LOW; if(az_getstereo(az)) - v->flags|=VIDEO_TUNER_STEREO_ON; - strcpy(v->name, "FM"); + v->audmode = V4L2_TUNER_MODE_STEREO; + else + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal=0xFFFF*az_getsigstr(az); + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if(v->tuner!=0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; + return 0; } - case VIDIOCGFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; - *freq = az->curfreq; + struct v4l2_frequency *f = arg; + + az->curfreq = f->frequency; + az_setfreq(az, az->curfreq); return 0; } - case VIDIOCSFREQ: + case VIDIOC_G_FREQUENCY: { - unsigned long *freq = arg; - az->curfreq = *freq; - az_setfreq(az, az->curfreq); + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = az->curfreq; + return 0; } - case VIDIOCGAUDIO: + + case VIDIOC_QUERYCTRL: { - struct video_audio *v = arg; - memset(v,0, sizeof(*v)); - v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; - if(az->stereo) - v->mode=VIDEO_SOUND_STEREO; - else - v->mode=VIDEO_SOUND_MONO; - v->volume=az->curvol; - v->step=16384; - strcpy(v->name, "Radio"); - return 0; + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; } - case VIDIOCSAUDIO: + case VIDIOC_G_CTRL: { - struct video_audio *v = arg; - if(v->audio) - return -EINVAL; - az->curvol=v->volume; + struct v4l2_control *ctrl= arg; - az->stereo=(v->mode&VIDEO_SOUND_STEREO)?1:0; - if(v->flags&VIDEO_AUDIO_MUTE) - az_setvol(az,0); - else - az_setvol(az,az->curvol); - return 0; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (az->curvol==0) + ctrl->value=1; + else + ctrl->value=0; + return (0); + case V4L2_CID_AUDIO_VOLUME: + ctrl->value=az->curvol * 6554; + return (0); + } + return -EINVAL; } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value) { + az_setvol(az,0); + } else { + az_setvol(az,az->curvol); + } + return (0); + case V4L2_CID_AUDIO_VOLUME: + az_setvol(az,ctrl->value); + return (0); + } + return -EINVAL; + } + default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + az_do_ioctl); } } @@ -266,7 +328,7 @@ static struct video_device aztech_radio= .owner = THIS_MODULE, .name = "Aztech radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_AZTECH, + .hardware = 0, .fops = &aztech_fops, }; diff -puN drivers/media/radio/radio-gemtek.c~git-dvb drivers/media/radio/radio-gemtek.c --- a/drivers/media/radio/radio-gemtek.c~git-dvb +++ a/drivers/media/radio/radio-gemtek.c @@ -13,6 +13,7 @@ * * TODO: Allow for more than one of these foolish entities :-) * + * Converted to V4L2 API by Mauro Carvalho Chehab */ #include /* Modules */ @@ -21,11 +22,32 @@ #include /* udelay */ #include /* outb, outb_p */ #include /* copy to/from user */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include -#include /* CONFIG_RADIO_GEMTEK_PORT */ #include +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 65535, + .step = 65535, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; + #ifndef CONFIG_RADIO_GEMTEK_PORT #define CONFIG_RADIO_GEMTEK_PORT -1 #endif @@ -147,77 +169,122 @@ static int gemtek_do_ioctl(struct inode switch(cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - v->type=VID_TYPE_TUNER; - v->channels=1; - v->audios=1; - strcpy(v->name, "GemTek"); + strlcpy(v->driver, "radio-gemtek", sizeof (v->driver)); + strlcpy(v->card, "GemTek", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; - if(v->tuner) /* Only 1 tuner */ + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - v->rangelow=87*16000; - v->rangehigh=108*16000; - v->flags=VIDEO_TUNER_LOW; - v->mode=VIDEO_MODE_AUTO; - v->signal=0xFFFF*gemtek_getsigstr(rt); + + memset(v,0,sizeof(*v)); strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + + v->rangelow=(87*16000); + v->rangehigh=(108*16000); + v->rxsubchans =V4L2_TUNER_SUB_MONO; + v->capability=V4L2_TUNER_CAP_LOW; + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal=0xFFFF*gemtek_getsigstr(rt); + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if(v->tuner!=0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - /* Only 1 tuner so no setting needed ! */ - return 0; - } - case VIDIOCGFREQ: - { - unsigned long *freq = arg; - *freq = rt->curfreq; + return 0; } - case VIDIOCSFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; - rt->curfreq = *freq; + struct v4l2_frequency *f = arg; + + rt->curfreq = f->frequency; /* needs to be called twice in order for getsigstr to work */ gemtek_setfreq(rt, rt->curfreq); gemtek_setfreq(rt, rt->curfreq); return 0; } - case VIDIOCGAUDIO: + case VIDIOC_G_FREQUENCY: { - struct video_audio *v = arg; - memset(v,0, sizeof(*v)); - v->flags|=VIDEO_AUDIO_MUTABLE; - v->volume=1; - v->step=65535; - strcpy(v->name, "Radio"); + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = rt->curfreq; + return 0; } - case VIDIOCSAUDIO: + case VIDIOC_QUERYCTRL: { - struct video_audio *v = arg; - if(v->audio) - return -EINVAL; + struct v4l2_queryctrl *qc = arg; + int i; - if(v->flags&VIDEO_AUDIO_MUTE) - gemtek_mute(rt); - else - gemtek_unmute(rt); + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; + } + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl= arg; - return 0; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=rt->muted; + return (0); + case V4L2_CID_AUDIO_VOLUME: + if (rt->muted) + ctrl->value=0; + else + ctrl->value=65535; + return (0); + } + return -EINVAL; + } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value) { + gemtek_mute(rt); + } else { + gemtek_unmute(rt); + } + return (0); + case V4L2_CID_AUDIO_VOLUME: + if (ctrl->value) { + gemtek_unmute(rt); + } else { + gemtek_mute(rt); + } + return (0); + } + return -EINVAL; } default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + gemtek_do_ioctl); } } @@ -243,7 +310,7 @@ static struct video_device gemtek_radio= .owner = THIS_MODULE, .name = "GemTek radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_GEMTEK, + .hardware = 0, .fops = &gemtek_fops, }; diff -puN drivers/media/radio/radio-gemtek-pci.c~git-dvb drivers/media/radio/radio-gemtek-pci.c --- a/drivers/media/radio/radio-gemtek-pci.c~git-dvb +++ a/drivers/media/radio/radio-gemtek-pci.c @@ -34,6 +34,8 @@ * * TODO: multiple device support and portability were not tested * + * Converted to V4L2 API by Mauro Carvalho Chehab + * *************************************************************************** */ @@ -42,10 +44,32 @@ #include #include #include -#include +#include #include #include +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 65535, + .step = 65535, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; + #include #include @@ -183,91 +207,117 @@ static int gemtek_pci_do_ioctl(struct in struct gemtek_pci_card *card = dev->priv; switch ( cmd ) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *c = arg; + struct v4l2_capability *v = arg; + memset(v,0,sizeof(*v)); + strlcpy(v->driver, "radio-gemtek-pci", sizeof (v->driver)); + strlcpy(v->card, "GemTek PCI Radio", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; - memset(c,0,sizeof(*c)); - c->type = VID_TYPE_TUNER; - c->channels = 1; - c->audios = 1; - strcpy( c->name, "Gemtek PCI Radio" ); return 0; } - - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *t = arg; + struct v4l2_tuner *v = arg; - if ( t->tuner ) + if (v->index > 0) return -EINVAL; - t->rangelow = GEMTEK_PCI_RANGE_LOW; - t->rangehigh = GEMTEK_PCI_RANGE_HIGH; - t->flags = VIDEO_TUNER_LOW; - t->mode = VIDEO_MODE_AUTO; - t->signal = 0xFFFF * gemtek_pci_getsignal( card ); - strcpy( t->name, "FM" ); + memset(v,0,sizeof(*v)); + strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + + v->rangelow = GEMTEK_PCI_RANGE_LOW; + v->rangehigh = GEMTEK_PCI_RANGE_HIGH; + v->rxsubchans =V4L2_TUNER_SUB_MONO; + v->capability=V4L2_TUNER_CAP_LOW; + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal=0xFFFF*gemtek_pci_getsignal( card ); + return 0; } - - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *t = arg; - if ( t->tuner ) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - return 0; - } - case VIDIOCGFREQ: - { - unsigned long *freq = arg; - *freq = card->current_frequency; return 0; } - case VIDIOCSFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; + struct v4l2_frequency *f = arg; - if ( (*freq < GEMTEK_PCI_RANGE_LOW) || - (*freq > GEMTEK_PCI_RANGE_HIGH) ) + if ( (f->frequency < GEMTEK_PCI_RANGE_LOW) || + (f->frequency > GEMTEK_PCI_RANGE_HIGH) ) return -EINVAL; - gemtek_pci_setfrequency( card, *freq ); - card->current_frequency = *freq; - card->mute = FALSE; + gemtek_pci_setfrequency( card, f->frequency ); + card->current_frequency = f->frequency; + card->mute = FALSE; return 0; } - - case VIDIOCGAUDIO: + case VIDIOC_QUERYCTRL: { - struct video_audio *a = arg; + struct v4l2_queryctrl *qc = arg; + int i; - memset( a, 0, sizeof( *a ) ); - a->flags |= VIDEO_AUDIO_MUTABLE; - a->volume = 1; - a->step = 65535; - strcpy( a->name, "Radio" ); - return 0; + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; } - - case VIDIOCSAUDIO: + case VIDIOC_G_CTRL: { - struct video_audio *a = arg; + struct v4l2_control *ctrl= arg; - if ( a->audio ) - return -EINVAL; - - if ( a->flags & VIDEO_AUDIO_MUTE ) - gemtek_pci_mute( card ); - else - gemtek_pci_unmute( card ); - return 0; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=card->mute; + return (0); + case V4L2_CID_AUDIO_VOLUME: + if (card->mute) + ctrl->value=0; + else + ctrl->value=65535; + return (0); + } + return -EINVAL; } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value) { + gemtek_pci_mute(card); + } else { + gemtek_pci_unmute(card); + } + return (0); + case V4L2_CID_AUDIO_VOLUME: + if (ctrl->value) { + gemtek_pci_unmute(card); + } else { + gemtek_pci_mute(card); + } + return (0); + } + return -EINVAL; + } default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + gemtek_pci_do_ioctl); } } @@ -309,7 +359,7 @@ static struct video_device vdev_template .owner = THIS_MODULE, .name = "Gemtek PCI Radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_GEMTEK, + .hardware = 0, .fops = &gemtek_pci_fops, }; diff -puN drivers/media/radio/radio-maestro.c~git-dvb drivers/media/radio/radio-maestro.c --- a/drivers/media/radio/radio-maestro.c~git-dvb +++ a/drivers/media/radio/radio-maestro.c @@ -14,6 +14,8 @@ * version 0.04 * + code improvements * + VIDEO_TUNER_LOW is permanent + * + * Converted to V4L2 API by Mauro Carvalho Chehab */ #include @@ -25,10 +27,23 @@ #include #include #include -#include +#include #include -#define DRIVER_VERSION "0.05" +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,6) +#define DRIVER_VERSION "0.06" + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + } +}; #define GPIO_DATA 0x60 /* port offset from ESS_IO_BASE */ @@ -96,7 +111,7 @@ static struct file_operations maestro_fo static struct video_device maestro_radio = { .name = "Maestro radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_SF16MI, + .hardware = 0, .fops = &maestro_fops, }; @@ -130,7 +145,7 @@ static u32 radio_bits_get(struct radio_d rdata = inw(io); if(!l) dev->stereo = rdata & STR_MOST ? - 0 : VIDEO_TUNER_STEREO_ON; + 0 : 1; else if(rdata & STR_DATA) data++; @@ -183,72 +198,120 @@ static inline int radio_function(struct struct radio_device *card = video_get_drvdata(dev); switch (cmd) { - case VIDIOCGCAP: { - struct video_capability *v = arg; - memset(v, 0, sizeof(*v)); - strcpy(v->name, "Maestro radio"); - v->type = VID_TYPE_TUNER; - v->channels = v->audios = 1; - return 0; - } case VIDIOCGTUNER: { - struct video_tuner *v = arg; - if (v->tuner) - return -EINVAL; - (void)radio_bits_get(card); - v->flags = VIDEO_TUNER_LOW | card->stereo; - v->signal = card->tuned; - strcpy(v->name, "FM"); - v->rangelow = FREQ_LO; - v->rangehigh = FREQ_HI; - v->mode = VIDEO_MODE_AUTO; - return 0; - } case VIDIOCSTUNER: { - struct video_tuner *v = arg; - if (v->tuner != 0) - return -EINVAL; - return 0; - } case VIDIOCGFREQ: { - unsigned long *freq = arg; - *freq = BITS2FREQ(radio_bits_get(card)); - return 0; - } case VIDIOCSFREQ: { - unsigned long *freq = arg; - if (*freq < FREQ_LO || *freq > FREQ_HI) + case VIDIOC_QUERYCAP: + { + struct v4l2_capability *v = arg; + memset(v,0,sizeof(*v)); + strlcpy(v->driver, "radio-maestro", sizeof (v->driver)); + strlcpy(v->card, "Maestro Radio", sizeof (v->card)); + sprintf(v->bus_info,"PCI"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + + return 0; + } + case VIDIOC_G_TUNER: + { + struct v4l2_tuner *v = arg; + + if (v->index > 0) + return -EINVAL; + + (void)radio_bits_get(card); + + memset(v,0,sizeof(*v)); + strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + + v->rangelow = FREQ_LO; + v->rangehigh = FREQ_HI; + v->rxsubchans =V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; + v->capability=V4L2_TUNER_CAP_LOW; + if(card->stereo) + v->audmode = V4L2_TUNER_MODE_STEREO; + else + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal=card->tuned; + + return 0; + } + case VIDIOC_S_TUNER: + { + struct v4l2_tuner *v = arg; + + if (v->index > 0) + return -EINVAL; + + return 0; + } + case VIDIOC_S_FREQUENCY: + { + struct v4l2_frequency *f = arg; + + if (f->frequency < FREQ_LO || f->frequency > FREQ_HI) + return -EINVAL; + radio_bits_set(card, FREQ2BITS(f->frequency)); + + return 0; + } + case VIDIOC_G_FREQUENCY: + { + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = BITS2FREQ(radio_bits_get(card)); + + return 0; + } + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } return -EINVAL; - radio_bits_set(card, FREQ2BITS(*freq)); - return 0; - } case VIDIOCGAUDIO: { - struct video_audio *v = arg; - memset(v, 0, sizeof(*v)); - strcpy(v->name, "Radio"); - v->flags = VIDEO_AUDIO_MUTABLE | card->muted; - v->mode = VIDEO_SOUND_STEREO; - return 0; - } case VIDIOCSAUDIO: { - struct video_audio *v = arg; - if (v->audio) + } + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=card->muted; + return (0); + } return -EINVAL; + } + case VIDIOC_S_CTRL: { - register u16 io = card->io; - register u16 omask = inw(io + IO_MASK); - outw(~STR_WREN, io + IO_MASK); - outw((card->muted = v->flags & VIDEO_AUDIO_MUTE) ? - STR_WREN : 0, io); - udelay(4); - outw(omask, io + IO_MASK); - msleep(125); - return 0; + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + { + register u16 io = card->io; + register u16 omask = inw(io + IO_MASK); + outw(~STR_WREN, io + IO_MASK); + outw((card->muted = ctrl->value ) ? + STR_WREN : 0, io); + udelay(4); + outw(omask, io + IO_MASK); + msleep(125); + + return (0); + } + } + return -EINVAL; } - } case VIDIOCGUNIT: { - struct video_unit *v = arg; - v->video = VIDEO_NO_UNIT; - v->vbi = VIDEO_NO_UNIT; - v->radio = dev->minor; - v->audio = 0; - v->teletext = VIDEO_NO_UNIT; - return 0; - } default: - return -ENOIOCTLCMD; + default: + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + radio_function); } } @@ -275,7 +338,7 @@ static u16 __devinit radio_power_on(stru omask = inw(io + IO_MASK); odir = (inw(io + IO_DIR) & ~STR_DATA) | (STR_CLK | STR_WREN); outw(odir & ~STR_WREN, io + IO_DIR); - dev->muted = inw(io) & STR_WREN ? 0 : VIDEO_AUDIO_MUTE; + dev->muted = inw(io) & STR_WREN ? 0 : 1; outw(odir, io + IO_DIR); outw(~(STR_WREN | STR_CLK), io + IO_MASK); outw(dev->muted ? 0 : STR_WREN, io); diff -puN drivers/media/radio/radio-maxiradio.c~git-dvb drivers/media/radio/radio-maxiradio.c --- a/drivers/media/radio/radio-maxiradio.c~git-dvb +++ a/drivers/media/radio/radio-maxiradio.c @@ -20,13 +20,14 @@ * 0.75b * - better pci interface thanks to Francois Romieu * - * 0.75 + * 0.75 Sun Feb 4 22:51:27 EET 2001 * - tiding up * - removed support for multiple devices as it didn't work anyway * * BUGS: * - card unmutes if you change frequency * + * Converted to V4L2 API by Mauro Carvalho Chehab */ @@ -40,11 +41,24 @@ #include #include -#include +#include #include -/* version 0.75 Sun Feb 4 22:51:27 EET 2001 */ -#define DRIVER_VERSION "0.75" +#define DRIVER_VERSION "0.76" + +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,7,6) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + } +}; #ifndef PCI_VENDOR_ID_GUILLEMOT #define PCI_VENDOR_ID_GUILLEMOT 0x5046 @@ -90,7 +104,6 @@ static struct video_device maxiradio_rad .owner = THIS_MODULE, .name = "Maxi Radio FM2000 radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_SF16MI, .fops = &maxiradio_fops, }; @@ -176,89 +189,116 @@ static inline int radio_function(struct struct radio_device *card=dev->priv; switch(cmd) { - case VIDIOCGCAP: { - struct video_capability *v = arg; - + case VIDIOC_QUERYCAP: + { + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - strcpy(v->name, "Maxi Radio FM2000 radio"); - v->type=VID_TYPE_TUNER; - v->channels=v->audios=1; + strlcpy(v->driver, "radio-maxiradio", sizeof (v->driver)); + strlcpy(v->card, "Maxi Radio FM2000 radio", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: { - struct video_tuner *v = arg; + case VIDIOC_G_TUNER: + { + struct v4l2_tuner *v = arg; - if(v->tuner) + if (v->index > 0) return -EINVAL; - card->stereo = 0xffff * get_stereo(card->io); - card->tuned = 0xffff * get_tune(card->io); - - v->flags = VIDEO_TUNER_LOW | card->stereo; - v->signal = card->tuned; - + memset(v,0,sizeof(*v)); strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; - v->rangelow = FREQ_LO; - v->rangehigh = FREQ_HI; - v->mode = VIDEO_MODE_AUTO; + v->rangelow=FREQ_LO; + v->rangehigh=FREQ_HI; + v->rxsubchans =V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; + v->capability=V4L2_TUNER_CAP_LOW; + if(get_stereo(card->io)) + v->audmode = V4L2_TUNER_MODE_STEREO; + else + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal=0xffff*get_tune(card->io); return 0; } - case VIDIOCSTUNER: { - struct video_tuner *v = arg; - if(v->tuner!=0) + case VIDIOC_S_TUNER: + { + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - return 0; - } - case VIDIOCGFREQ: { - unsigned long *freq = arg; - *freq = card->freq; return 0; } - case VIDIOCSFREQ: { - unsigned long *freq = arg; + case VIDIOC_S_FREQUENCY: + { + struct v4l2_frequency *f = arg; - if (*freq < FREQ_LO || *freq > FREQ_HI) + if (f->frequency < FREQ_LO || f->frequency > FREQ_HI) return -EINVAL; - card->freq = *freq; + + card->freq = f->frequency; set_freq(card->io, FREQ2BITS(card->freq)); msleep(125); return 0; } - case VIDIOCGAUDIO: { - struct video_audio *v = arg; - memset(v,0,sizeof(*v)); - strcpy(v->name, "Radio"); - v->flags=VIDEO_AUDIO_MUTABLE | card->muted; - v->mode=VIDEO_SOUND_STEREO; + case VIDIOC_G_FREQUENCY: + { + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = card->freq; + return 0; } + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl *qc = arg; + int i; - case VIDIOCSAUDIO: { - struct video_audio *v = arg; + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; + } + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl= arg; - if(v->audio) - return -EINVAL; - card->muted = v->flags & VIDEO_AUDIO_MUTE; - if(card->muted) - turn_power(card->io, 0); - else - set_freq(card->io, FREQ2BITS(card->freq)); - return 0; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=card->muted; + return (0); + } + return -EINVAL; } - case VIDIOCGUNIT: { - struct video_unit *v = arg; + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; - v->video=VIDEO_NO_UNIT; - v->vbi=VIDEO_NO_UNIT; - v->radio=dev->minor; - v->audio=0; - v->teletext=VIDEO_NO_UNIT; - return 0; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + card->muted = ctrl->value; + if(card->muted) + turn_power(card->io, 0); + else + set_freq(card->io, FREQ2BITS(card->freq)); + return 0; + } + return -EINVAL; } - default: return -ENOIOCTLCMD; + + default: + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + radio_function); + } } diff -puN drivers/media/radio/radio-rtrack2.c~git-dvb drivers/media/radio/radio-rtrack2.c --- a/drivers/media/radio/radio-rtrack2.c~git-dvb +++ a/drivers/media/radio/radio-rtrack2.c @@ -6,6 +6,7 @@ * * TODO: Allow for more than one of these foolish entities :-) * + * Converted to V4L2 API by Mauro Carvalho Chehab */ #include /* Modules */ @@ -14,11 +15,32 @@ #include /* udelay */ #include /* outb, outb_p */ #include /* copy to/from user */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include -#include /* CONFIG_RADIO_RTRACK2_PORT */ #include +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 65535, + .step = 65535, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; + #ifndef CONFIG_RADIO_RTRACK2_PORT #define CONFIG_RADIO_RTRACK2_PORT -1 #endif @@ -115,75 +137,120 @@ static int rt_do_ioctl(struct inode *ino switch(cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - v->type=VID_TYPE_TUNER; - v->channels=1; - v->audios=1; - strcpy(v->name, "RadioTrack II"); + strlcpy(v->driver, "radio-rtrack2", sizeof (v->driver)); + strlcpy(v->card, "RadioTrack II", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; - if(v->tuner) /* Only 1 tuner */ + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - v->rangelow=88*16000; - v->rangehigh=108*16000; - v->flags=VIDEO_TUNER_LOW; - v->mode=VIDEO_MODE_AUTO; - v->signal=0xFFFF*rt_getsigstr(rt); + + memset(v,0,sizeof(*v)); strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + + v->rangelow=(88*16000); + v->rangehigh=(108*16000); + v->rxsubchans =V4L2_TUNER_SUB_MONO; + v->capability=V4L2_TUNER_CAP_LOW; + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal=0xFFFF*rt_getsigstr(rt); + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if(v->tuner!=0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - /* Only 1 tuner so no setting needed ! */ + return 0; } - case VIDIOCGFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; - *freq = rt->curfreq; + struct v4l2_frequency *f = arg; + + rt->curfreq = f->frequency; + rt_setfreq(rt, rt->curfreq); return 0; } - case VIDIOCSFREQ: + case VIDIOC_G_FREQUENCY: { - unsigned long *freq = arg; - rt->curfreq = *freq; - rt_setfreq(rt, rt->curfreq); + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = rt->curfreq; + return 0; } - case VIDIOCGAUDIO: + case VIDIOC_QUERYCTRL: { - struct video_audio *v = arg; - memset(v,0, sizeof(*v)); - v->flags|=VIDEO_AUDIO_MUTABLE; - v->volume=1; - v->step=65535; - strcpy(v->name, "Radio"); - return 0; + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; } - case VIDIOCSAUDIO: + case VIDIOC_G_CTRL: { - struct video_audio *v = arg; - if(v->audio) - return -EINVAL; + struct v4l2_control *ctrl= arg; - if(v->flags&VIDEO_AUDIO_MUTE) - rt_mute(rt); - else - rt_unmute(rt); + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=rt->muted; + return (0); + case V4L2_CID_AUDIO_VOLUME: + if (rt->muted) + ctrl->value=0; + else + ctrl->value=65535; + return (0); + } + return -EINVAL; + } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; - return 0; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value) { + rt_mute(rt); + } else { + rt_unmute(rt); + } + return (0); + case V4L2_CID_AUDIO_VOLUME: + if (ctrl->value) { + rt_unmute(rt); + } else { + rt_mute(rt); + } + return (0); + } + return -EINVAL; } default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + rt_do_ioctl); } } @@ -209,7 +276,7 @@ static struct video_device rtrack2_radio .owner = THIS_MODULE, .name = "RadioTrack II radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_RTRACK2, + .hardware = 0, .fops = &rtrack2_fops, }; diff -puN drivers/media/radio/radio-sf16fmi.c~git-dvb drivers/media/radio/radio-sf16fmi.c --- a/drivers/media/radio/radio-sf16fmi.c~git-dvb +++ a/drivers/media/radio/radio-sf16fmi.c @@ -13,6 +13,7 @@ * No volume control - only mute/unmute - you have to use line volume * control on SB-part of SF16FMI * + * Converted to V4L2 API by Mauro Carvalho Chehab */ #include /* __setup */ @@ -20,13 +21,26 @@ #include /* Initdata */ #include /* request_region */ #include /* udelay */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include #include #include /* outb, outb_p */ #include /* copy to/from user */ #include +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + } +}; + struct fmi_device { int port; @@ -123,93 +137,122 @@ static int fmi_do_ioctl(struct inode *in switch(cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - strcpy(v->name, "SF16-FMx radio"); - v->type=VID_TYPE_TUNER; - v->channels=1; - v->audios=1; + strlcpy(v->driver, "radio-sf16fmi", sizeof (v->driver)); + strlcpy(v->card, "SF16-FMx radio", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; + struct v4l2_tuner *v = arg; int mult; - if(v->tuner) /* Only 1 tuner */ + if (v->index > 0) return -EINVAL; + + memset(v,0,sizeof(*v)); strcpy(v->name, "FM"); - mult = (fmi->flags & VIDEO_TUNER_LOW) ? 1 : 1000; + v->type = V4L2_TUNER_RADIO; + + mult = (fmi->flags & V4L2_TUNER_CAP_LOW) ? 1 : 1000; v->rangelow = RSF16_MINFREQ/mult; v->rangehigh = RSF16_MAXFREQ/mult; - v->flags=fmi->flags; - v->mode=VIDEO_MODE_AUTO; + v->rxsubchans =V4L2_TUNER_SUB_MONO | V4L2_TUNER_MODE_STEREO; + v->capability=fmi->flags&V4L2_TUNER_CAP_LOW; + v->audmode = V4L2_TUNER_MODE_STEREO; v->signal = fmi_getsigstr(fmi); + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if(v->tuner!=0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - fmi->flags = v->flags & VIDEO_TUNER_LOW; - /* Only 1 tuner so no setting needed ! */ - return 0; - } - case VIDIOCGFREQ: - { - unsigned long *freq = arg; - *freq = fmi->curfreq; - if (!(fmi->flags & VIDEO_TUNER_LOW)) - *freq /= 1000; + return 0; } - case VIDIOCSFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; - if (!(fmi->flags & VIDEO_TUNER_LOW)) - *freq *= 1000; - if (*freq < RSF16_MINFREQ || *freq > RSF16_MAXFREQ ) + struct v4l2_frequency *f = arg; + + if (!(fmi->flags & V4L2_TUNER_CAP_LOW)) + f->frequency *= 1000; + if (f->frequency < RSF16_MINFREQ || + f->frequency > RSF16_MAXFREQ ) return -EINVAL; /*rounding in steps of 800 to match th freq that will be used */ - fmi->curfreq = (*freq/800)*800; + fmi->curfreq = (f->frequency/800)*800; fmi_setfreq(fmi); + return 0; } - case VIDIOCGAUDIO: + case VIDIOC_G_FREQUENCY: { - struct video_audio *v = arg; - memset(v,0,sizeof(*v)); - v->flags=( (!fmi->curvol)*VIDEO_AUDIO_MUTE | VIDEO_AUDIO_MUTABLE); - strcpy(v->name, "Radio"); - v->mode=VIDEO_SOUND_STEREO; + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = fmi->curfreq; + if (!(fmi->flags & V4L2_TUNER_CAP_LOW)) + f->frequency /= 1000; + return 0; } - case VIDIOCSAUDIO: + case VIDIOC_QUERYCTRL: { - struct video_audio *v = arg; - if(v->audio) - return -EINVAL; - fmi->curvol= v->flags&VIDEO_AUDIO_MUTE ? 0 : 1; - fmi->curvol ? - fmi_unmute(fmi->port) : fmi_mute(fmi->port); - return 0; + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; } - case VIDIOCGUNIT: + case VIDIOC_G_CTRL: { - struct video_unit *v = arg; - v->video=VIDEO_NO_UNIT; - v->vbi=VIDEO_NO_UNIT; - v->radio=dev->minor; - v->audio=0; /* How do we find out this??? */ - v->teletext=VIDEO_NO_UNIT; - return 0; + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=fmi->curvol; + return (0); + } + return -EINVAL; + } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + { + if (ctrl->value) + fmi_mute(fmi->port); + else + fmi_unmute(fmi->port); + + fmi->curvol=ctrl->value; + return (0); + } + } + return -EINVAL; } default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + fmi_do_ioctl); } } @@ -235,7 +278,7 @@ static struct video_device fmi_radio= .owner = THIS_MODULE, .name = "SF16FMx radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_SF16MI, + .hardware = 0, .fops = &fmi_fops, }; @@ -294,7 +337,7 @@ static int __init fmi_init(void) fmi_unit.port = io; fmi_unit.curvol = 0; fmi_unit.curfreq = 0; - fmi_unit.flags = VIDEO_TUNER_LOW; + fmi_unit.flags = V4L2_TUNER_CAP_LOW; fmi_radio.priv = &fmi_unit; mutex_init(&lock); diff -puN drivers/media/radio/radio-sf16fmr2.c~git-dvb drivers/media/radio/radio-sf16fmr2.c --- a/drivers/media/radio/radio-sf16fmr2.c~git-dvb +++ a/drivers/media/radio/radio-sf16fmr2.c @@ -10,6 +10,8 @@ * For read stereo/mono you must wait 0.1 sec after set frequency and * card unmuted so I set frequency on unmute * Signal handling seem to work only on autoscanning (not implemented) + * + * Converted to V4L2 API by Mauro Carvalho Chehab */ #include /* Modules */ @@ -18,12 +20,34 @@ #include /* udelay */ #include /* outb, outb_p */ #include /* copy to/from user */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include #include static struct mutex lock; +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 65535, + .step = 1<<12, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; + #undef DEBUG //#define DEBUG 1 @@ -214,63 +238,65 @@ static int fmr2_do_ioctl(struct inode *i switch(cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - strcpy(v->name, "SF16-FMR2 radio"); - v->type=VID_TYPE_TUNER; - v->channels=1; - v->audios=1; + strlcpy(v->driver, "radio-sf16fmr2", sizeof (v->driver)); + strlcpy(v->card, "SF16-FMR2 radio", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; + struct v4l2_tuner *v = arg; int mult; - if(v->tuner) /* Only 1 tuner */ + if (v->index > 0) return -EINVAL; + + memset(v,0,sizeof(*v)); strcpy(v->name, "FM"); - mult = (fmr2->flags & VIDEO_TUNER_LOW) ? 1 : 1000; + v->type = V4L2_TUNER_RADIO; + + mult = (fmr2->flags & V4L2_TUNER_CAP_LOW) ? 1 : 1000; v->rangelow = RSF16_MINFREQ/mult; v->rangehigh = RSF16_MAXFREQ/mult; - v->flags = fmr2->flags | VIDEO_AUDIO_MUTABLE; - if (fmr2->mute) - v->flags |= VIDEO_AUDIO_MUTE; - v->mode=VIDEO_MODE_AUTO; + v->rxsubchans =V4L2_TUNER_SUB_MONO | V4L2_TUNER_MODE_STEREO; + v->capability=fmr2->flags&V4L2_TUNER_CAP_LOW; + + v->audmode = fmr2->stereo ? V4L2_TUNER_MODE_STEREO: + V4L2_TUNER_MODE_MONO; mutex_lock(&lock); v->signal = fmr2_getsigstr(fmr2); mutex_unlock(&lock); + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if (v->tuner!=0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - fmr2->flags = v->flags & VIDEO_TUNER_LOW; - return 0; - } - case VIDIOCGFREQ: - { - unsigned long *freq = arg; - *freq = fmr2->curfreq; - if (!(fmr2->flags & VIDEO_TUNER_LOW)) - *freq /= 1000; + return 0; } - case VIDIOCSFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; - if (!(fmr2->flags & VIDEO_TUNER_LOW)) - *freq *= 1000; - if ( *freq < RSF16_MINFREQ || *freq > RSF16_MAXFREQ ) + struct v4l2_frequency *f = arg; + + if (!(fmr2->flags & V4L2_TUNER_CAP_LOW)) + f->frequency *= 1000; + if (f->frequency < RSF16_MINFREQ || + f->frequency > RSF16_MAXFREQ ) return -EINVAL; - /* rounding in steps of 200 to match th freq - * that will be used - */ - fmr2->curfreq = (*freq/200)*200; + /*rounding in steps of 200 to match th freq + that will be used */ + fmr2->curfreq = (f->frequency/200)*200; /* set card freq (if not muted) */ if (fmr2->curvol && !fmr2->mute) @@ -279,40 +305,81 @@ static int fmr2_do_ioctl(struct inode *i fmr2_setfreq(fmr2); mutex_unlock(&lock); } + return 0; } - case VIDIOCGAUDIO: + case VIDIOC_G_FREQUENCY: { - struct video_audio *v = arg; - memset(v,0,sizeof(*v)); - /* !!! do not return VIDEO_AUDIO_MUTE */ - v->flags = VIDEO_AUDIO_MUTABLE; - strcpy(v->name, "Radio"); - /* get current stereo mode */ - v->mode = fmr2->stereo ? VIDEO_SOUND_STEREO: VIDEO_SOUND_MONO; - /* volume supported ? */ - if (fmr2->card_type == 11) - { - v->flags |= VIDEO_AUDIO_VOLUME; - v->step = 1 << 12; - v->volume = fmr2->curvol; - } - debug_print((KERN_DEBUG "Get flags %d vol %d\n", v->flags, v->volume)); + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = fmr2->curfreq; + if (!(fmr2->flags & V4L2_TUNER_CAP_LOW)) + f->frequency /= 1000; + return 0; } - case VIDIOCSAUDIO: + case VIDIOC_QUERYCTRL: { - struct video_audio *v = arg; - if(v->audio) - return -EINVAL; - debug_print((KERN_DEBUG "Set flags %d vol %d\n", v->flags, v->volume)); - /* set volume */ - if (v->flags & VIDEO_AUDIO_VOLUME) - fmr2->curvol = v->volume; /* !!! set with precision */ - if (fmr2->card_type != 11) fmr2->curvol = 65535; - fmr2->mute = 0; - if (v->flags & VIDEO_AUDIO_MUTE) - fmr2->mute = 1; + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if ((fmr2->card_type != 11) + && V4L2_CID_AUDIO_VOLUME) + radio_qctrl[i].step=65535; + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; + } + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=fmr2->mute; + return (0); + case V4L2_CID_AUDIO_VOLUME: + ctrl->value=fmr2->curvol; + return (0); + } + return -EINVAL; + } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + fmr2->mute=ctrl->value; + if (fmr2->card_type != 11) { + if (!fmr2->mute) { + fmr2->curvol = 65535; + } else { + fmr2->curvol = 0; + } + } + break; + case V4L2_CID_AUDIO_VOLUME: + fmr2->curvol = ctrl->value; + if (fmr2->card_type != 11) { + if (fmr2->curvol) { + fmr2->curvol = 65535; + fmr2->mute = 0; + } else { + fmr2->curvol = 0; + fmr2->mute = 1; + } + } + break; + default: + return -EINVAL; + } #ifdef DEBUG if (fmr2->curvol && !fmr2->mute) printk(KERN_DEBUG "unmute\n"); @@ -320,27 +387,18 @@ static int fmr2_do_ioctl(struct inode *i printk(KERN_DEBUG "mute\n"); #endif mutex_lock(&lock); - if (fmr2->curvol && !fmr2->mute) - { + if (fmr2->curvol && !fmr2->mute) { fmr2_setvolume(fmr2); fmr2_setfreq(fmr2); - } - else fmr2_mute(fmr2->port); + } else + fmr2_mute(fmr2->port); mutex_unlock(&lock); - return 0; - } - case VIDIOCGUNIT: - { - struct video_unit *v = arg; - v->video=VIDEO_NO_UNIT; - v->vbi=VIDEO_NO_UNIT; - v->radio=dev->minor; - v->audio=0; /* How do we find out this??? */ - v->teletext=VIDEO_NO_UNIT; - return 0; + return (0); } default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + fmr2_do_ioctl); + } } @@ -366,7 +424,7 @@ static struct video_device fmr2_radio= .owner = THIS_MODULE, .name = "SF16FMR2 radio", . type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_SF16FMR2, + .hardware = 0, .fops = &fmr2_fops, }; @@ -377,7 +435,7 @@ static int __init fmr2_init(void) fmr2_unit.mute = 0; fmr2_unit.curfreq = 0; fmr2_unit.stereo = 1; - fmr2_unit.flags = VIDEO_TUNER_LOW; + fmr2_unit.flags = V4L2_TUNER_CAP_LOW; fmr2_unit.card_type = 0; fmr2_radio.priv = &fmr2_unit; @@ -396,7 +454,6 @@ static int __init fmr2_init(void) } printk(KERN_INFO "SF16FMR2 radio card driver at 0x%x.\n", io); - debug_print((KERN_DEBUG "Mute %d Low %d\n",VIDEO_AUDIO_MUTE,VIDEO_TUNER_LOW)); /* mute card - prevents noisy bootups */ mutex_lock(&lock); fmr2_mute(io); diff -puN drivers/media/radio/radio-terratec.c~git-dvb drivers/media/radio/radio-terratec.c --- a/drivers/media/radio/radio-terratec.c~git-dvb +++ a/drivers/media/radio/radio-terratec.c @@ -21,6 +21,7 @@ * If you can help me out with that, please contact me!! * * + * Converted to V4L2 API by Mauro Carvalho Chehab */ #include /* Modules */ @@ -29,11 +30,32 @@ #include /* udelay */ #include /* outb, outb_p */ #include /* copy to/from user */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include -#include /* CONFIG_RADIO_TERRATEC_PORT */ #include +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 0xff, + .step = 1, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; + #ifndef CONFIG_RADIO_TERRATEC_PORT #define CONFIG_RADIO_TERRATEC_PORT 0x590 #endif @@ -194,73 +216,117 @@ static int tt_do_ioctl(struct inode *ino switch(cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - v->type=VID_TYPE_TUNER; - v->channels=1; - v->audios=1; - strcpy(v->name, "ActiveRadio"); + strlcpy(v->driver, "radio-terratec", sizeof (v->driver)); + strlcpy(v->card, "ActiveRadio", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; - if(v->tuner) /* Only 1 tuner */ + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; + + memset(v,0,sizeof(*v)); + strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + v->rangelow=(87*16000); v->rangehigh=(108*16000); - v->flags=VIDEO_TUNER_LOW; - v->mode=VIDEO_MODE_AUTO; - strcpy(v->name, "FM"); + v->rxsubchans =V4L2_TUNER_SUB_MONO; + v->capability=V4L2_TUNER_CAP_LOW; + v->audmode = V4L2_TUNER_MODE_MONO; v->signal=0xFFFF*tt_getsigstr(tt); + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if(v->tuner!=0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - /* Only 1 tuner so no setting needed ! */ + return 0; } - case VIDIOCGFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; - *freq = tt->curfreq; + struct v4l2_frequency *f = arg; + + tt->curfreq = f->frequency; + tt_setfreq(tt, tt->curfreq); return 0; } - case VIDIOCSFREQ: + case VIDIOC_G_FREQUENCY: { - unsigned long *freq = arg; - tt->curfreq = *freq; - tt_setfreq(tt, tt->curfreq); + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = tt->curfreq; + return 0; } - case VIDIOCGAUDIO: + case VIDIOC_QUERYCTRL: { - struct video_audio *v = arg; - memset(v,0, sizeof(*v)); - v->flags|=VIDEO_AUDIO_MUTABLE|VIDEO_AUDIO_VOLUME; - v->volume=tt->curvol * 6554; - v->step=6554; - strcpy(v->name, "Radio"); - return 0; + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; } - case VIDIOCSAUDIO: + case VIDIOC_G_CTRL: { - struct video_audio *v = arg; - if(v->audio) - return -EINVAL; - if(v->flags&VIDEO_AUDIO_MUTE) - tt_mute(tt); - else - tt_setvol(tt,v->volume/6554); - return 0; + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (tt->muted) + ctrl->value=1; + else + ctrl->value=0; + return (0); + case V4L2_CID_AUDIO_VOLUME: + ctrl->value=tt->curvol * 6554; + return (0); + } + return -EINVAL; } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value) { + tt_mute(tt); + } else { + tt_setvol(tt,tt->curvol); + } + return (0); + case V4L2_CID_AUDIO_VOLUME: + tt_setvol(tt,ctrl->value); + return (0); + } + return -EINVAL; + } + default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + tt_do_ioctl); } } @@ -286,7 +352,7 @@ static struct video_device terratec_radi .owner = THIS_MODULE, .name = "TerraTec ActiveRadio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_TERRATEC, + .hardware = 0, .fops = &terratec_fops, }; diff -puN drivers/media/radio/radio-trust.c~git-dvb drivers/media/radio/radio-trust.c --- a/drivers/media/radio/radio-trust.c~git-dvb +++ a/drivers/media/radio/radio-trust.c @@ -12,7 +12,7 @@ * Scott McGrath (smcgrath@twilight.vtc.vsc.edu) * William McGrath (wmcgrath@twilight.vtc.vsc.edu) * - * The basis for this code may be found at http://bigbang.vtc.vsc.edu/fmradio/ + * Converted to V4L2 API by Mauro Carvalho Chehab */ #include @@ -21,9 +21,46 @@ #include #include #include -#include +#include #include -#include /* CONFIG_RADIO_TRUST_PORT */ + +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 65535, + .step = 2048, + .default_value = 65535, + .type = V4L2_CTRL_TYPE_INTEGER, + },{ + .id = V4L2_CID_AUDIO_BASS, + .name = "Bass", + .minimum = 0, + .maximum = 65535, + .step = 4370, + .default_value = 32768, + .type = V4L2_CTRL_TYPE_INTEGER, + },{ + .id = V4L2_CID_AUDIO_TREBLE, + .name = "Treble", + .minimum = 0, + .maximum = 65535, + .step = 4370, + .default_value = 32768, + .type = V4L2_CTRL_TYPE_INTEGER, + }, +}; /* acceptable ports: 0x350 (JP3 shorted), 0x358 (JP3 open) */ @@ -160,88 +197,125 @@ static int tr_do_ioctl(struct inode *ino { switch(cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; - + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - v->type=VID_TYPE_TUNER; - v->channels=1; - v->audios=1; - strcpy(v->name, "Trust FM Radio"); + strlcpy(v->driver, "radio-trust", sizeof (v->driver)); + strlcpy(v->card, "Trust FM Radio", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; + struct v4l2_tuner *v = arg; - if(v->tuner) /* Only 1 tuner */ + if (v->index > 0) return -EINVAL; - v->rangelow = 87500 * 16; - v->rangehigh = 108000 * 16; - v->flags = VIDEO_TUNER_LOW; - v->mode = VIDEO_MODE_AUTO; + memset(v,0,sizeof(*v)); + strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; - v->signal = tr_getsigstr(); + v->rangelow=(87.5*16000); + v->rangehigh=(108*16000); + v->rxsubchans =V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; + v->capability=V4L2_TUNER_CAP_LOW; if(tr_getstereo()) - v->flags |= VIDEO_TUNER_STEREO_ON; - - strcpy(v->name, "FM"); + v->audmode = V4L2_TUNER_MODE_STEREO; + else + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal=tr_getsigstr(); return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if(v->tuner != 0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; + return 0; } - case VIDIOCGFREQ: + case VIDIOC_S_FREQUENCY: { - unsigned long *freq = arg; - *freq = curfreq; + struct v4l2_frequency *f = arg; + + curfreq = f->frequency; + tr_setfreq(curfreq); return 0; } - case VIDIOCSFREQ: + case VIDIOC_G_FREQUENCY: { - unsigned long *freq = arg; - tr_setfreq(*freq); + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = curfreq; + return 0; } - case VIDIOCGAUDIO: + case VIDIOC_QUERYCTRL: { - struct video_audio *v = arg; + struct v4l2_queryctrl *qc = arg; + int i; - memset(v,0, sizeof(*v)); - v->flags = VIDEO_AUDIO_MUTABLE | VIDEO_AUDIO_VOLUME | - VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE; - v->mode = curstereo? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; - v->volume = curvol * 2048; - v->step = 2048; - v->bass = curbass * 4370; - v->treble = curtreble * 4370; + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; + } + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl= arg; - strcpy(v->name, "Trust FM Radio"); - return 0; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=curmute; + return (0); + case V4L2_CID_AUDIO_VOLUME: + ctrl->value= curvol * 2048; + return (0); + case V4L2_CID_AUDIO_BASS: + ctrl->value= curbass * 4370; + return (0); + case V4L2_CID_AUDIO_TREBLE: + ctrl->value= curtreble * 4370; + return (0); + } + return -EINVAL; } - case VIDIOCSAUDIO: + case VIDIOC_S_CTRL: { - struct video_audio *v = arg; + struct v4l2_control *ctrl= arg; - if(v->audio) - return -EINVAL; - tr_setvol(v->volume); - tr_setbass(v->bass); - tr_settreble(v->treble); - tr_setstereo(v->mode & VIDEO_SOUND_STEREO); - tr_setmute(v->flags & VIDEO_AUDIO_MUTE); - return 0; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + tr_setmute(ctrl->value); + return 0; + case V4L2_CID_AUDIO_VOLUME: + tr_setvol(ctrl->value); + return 0; + case V4L2_CID_AUDIO_BASS: + tr_setbass(ctrl->value); + return 0; + case V4L2_CID_AUDIO_TREBLE: + tr_settreble(ctrl->value); + return (0); + } + return -EINVAL; } + default: - return -ENOIOCTLCMD; + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + tr_do_ioctl); } } @@ -265,7 +339,7 @@ static struct video_device trust_radio= .owner = THIS_MODULE, .name = "Trust FM Radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_TRUST, + .hardware = 0, .fops = &trust_fops, }; diff -puN drivers/media/radio/radio-typhoon.c~git-dvb drivers/media/radio/radio-typhoon.c --- a/drivers/media/radio/radio-typhoon.c~git-dvb +++ a/drivers/media/radio/radio-typhoon.c @@ -27,6 +27,8 @@ * value where I do expect just noise and turn the speaker volume down. * The frequency change is necessary since the card never seems to be * completely silent. + * + * Converted to V4L2 API by Mauro Carvalho Chehab */ #include /* Modules */ @@ -35,11 +37,32 @@ #include /* radio card status report */ #include /* outb, outb_p */ #include /* copy to/from user */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include -#include /* CONFIG_RADIO_TYPHOON_* */ -#define BANNER "Typhoon Radio Card driver v0.1\n" +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,1,1) +#define BANNER "Typhoon Radio Card driver v0.1.1\n" + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 65535, + .step = 1<<14, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; + #ifndef CONFIG_RADIO_TYPHOON_PORT #define CONFIG_RADIO_TYPHOON_PORT -1 @@ -171,76 +194,114 @@ static int typhoon_do_ioctl(struct inode struct typhoon_device *typhoon = dev->priv; switch (cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - v->type = VID_TYPE_TUNER; - v->channels = 1; - v->audios = 1; - strcpy(v->name, "Typhoon Radio"); + strlcpy(v->driver, "radio-typhoon", sizeof (v->driver)); + strlcpy(v->card, "Typhoon Radio", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; - if (v->tuner) /* Only 1 tuner */ + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - v->rangelow = 875 * 1600; - v->rangehigh = 1080 * 1600; - v->flags = VIDEO_TUNER_LOW; - v->mode = VIDEO_MODE_AUTO; - v->signal = 0xFFFF; /* We can't get the signal strength */ + + memset(v,0,sizeof(*v)); strcpy(v->name, "FM"); + v->type = V4L2_TUNER_RADIO; + + v->rangelow=(87.5*16000); + v->rangehigh=(108*16000); + v->rxsubchans =V4L2_TUNER_SUB_MONO; + v->capability=V4L2_TUNER_CAP_LOW; + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal = 0xFFFF; /* We can't get the signal strength */ + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if (v->tuner != 0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - /* Only 1 tuner so no setting needed ! */ + return 0; } - case VIDIOCGFREQ: - { - unsigned long *freq = arg; - *freq = typhoon->curfreq; - return 0; - } - case VIDIOCSFREQ: - { - unsigned long *freq = arg; - typhoon->curfreq = *freq; - typhoon_setfreq(typhoon, typhoon->curfreq); - return 0; - } - case VIDIOCGAUDIO: + case VIDIOC_S_FREQUENCY: { - struct video_audio *v = arg; - memset(v, 0, sizeof(*v)); - v->flags |= VIDEO_AUDIO_MUTABLE | VIDEO_AUDIO_VOLUME; - v->mode |= VIDEO_SOUND_MONO; - v->volume = typhoon->curvol; - v->step = 1 << 14; - strcpy(v->name, "Typhoon Radio"); + struct v4l2_frequency *f = arg; + + typhoon->curfreq = f->frequency; + typhoon_setfreq(typhoon, typhoon->curfreq); return 0; } - case VIDIOCSAUDIO: + case VIDIOC_G_FREQUENCY: { - struct video_audio *v = arg; - if (v->audio) - return -EINVAL; - if (v->flags & VIDEO_AUDIO_MUTE) - typhoon_mute(typhoon); - else - typhoon_unmute(typhoon); - if (v->flags & VIDEO_AUDIO_VOLUME) - typhoon_setvol(typhoon, v->volume); + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = typhoon->curfreq; + return 0; } - default: - return -ENOIOCTLCMD; + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; + } + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=typhoon->muted; + return (0); + case V4L2_CID_AUDIO_VOLUME: + ctrl->value=typhoon->curvol; + return (0); + } + return -EINVAL; + } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value) { + typhoon_mute(typhoon); + } else { + typhoon_unmute(typhoon); + } + return (0); + case V4L2_CID_AUDIO_VOLUME: + typhoon_setvol(typhoon, ctrl->value); + return (0); + } + return -EINVAL; + } + + default: + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + typhoon_do_ioctl); } } @@ -271,7 +332,7 @@ static struct video_device typhoon_radio .owner = THIS_MODULE, .name = "Typhoon Radio", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_TYPHOON, + .hardware = 0, .fops = &typhoon_fops, }; diff -puN drivers/media/radio/radio-zoltrix.c~git-dvb drivers/media/radio/radio-zoltrix.c --- a/drivers/media/radio/radio-zoltrix.c~git-dvb +++ a/drivers/media/radio/radio-zoltrix.c @@ -24,6 +24,9 @@ * - Added unmute function * - Reworked ioctl functions * 2002-07-15 - Fix Stereo typo + * + * 2006-07-24 - Converted to V4L2 API + * by Mauro Carvalho Chehab */ #include /* Modules */ @@ -32,9 +35,30 @@ #include /* udelay, msleep */ #include /* outb, outb_p */ #include /* copy to/from user */ -#include /* kernel radio structs */ +#include /* kernel radio structs */ #include -#include /* CONFIG_RADIO_ZOLTRIX_PORT */ + +#include /* for KERNEL_VERSION MACRO */ +#define RADIO_VERSION KERNEL_VERSION(0,0,2) + +static struct v4l2_queryctrl radio_qctrl[] = { + { + .id = V4L2_CID_AUDIO_MUTE, + .name = "Mute", + .minimum = 0, + .maximum = 1, + .default_value = 1, + .type = V4L2_CTRL_TYPE_BOOLEAN, + },{ + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 65535, + .step = 4096, + .default_value = 0xff, + .type = V4L2_CTRL_TYPE_INTEGER, + } +}; #ifndef CONFIG_RADIO_ZOLTRIX_PORT #define CONFIG_RADIO_ZOLTRIX_PORT -1 @@ -213,78 +237,116 @@ static int zol_do_ioctl(struct inode *in struct zol_device *zol = dev->priv; switch (cmd) { - case VIDIOCGCAP: + case VIDIOC_QUERYCAP: { - struct video_capability *v = arg; - + struct v4l2_capability *v = arg; memset(v,0,sizeof(*v)); - v->type = VID_TYPE_TUNER; - v->channels = 1 + zol->stereo; - v->audios = 1; - strcpy(v->name, "Zoltrix Radio"); + strlcpy(v->driver, "radio-zoltrix", sizeof (v->driver)); + strlcpy(v->card, "Zoltrix Radio", sizeof (v->card)); + sprintf(v->bus_info,"ISA"); + v->version = RADIO_VERSION; + v->capabilities = V4L2_CAP_TUNER; + return 0; } - case VIDIOCGTUNER: + case VIDIOC_G_TUNER: { - struct video_tuner *v = arg; - if (v->tuner) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; + + memset(v,0,sizeof(*v)); strcpy(v->name, "FM"); - v->rangelow = (int) (88.0 * 16000); - v->rangehigh = (int) (108.0 * 16000); - v->flags = zol_is_stereo(zol) - ? VIDEO_TUNER_STEREO_ON : 0; - v->flags |= VIDEO_TUNER_LOW; - v->mode = VIDEO_MODE_AUTO; - v->signal = 0xFFFF * zol_getsigstr(zol); + v->type = V4L2_TUNER_RADIO; + + v->rangelow=(88*16000); + v->rangehigh=(108*16000); + v->rxsubchans =V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; + v->capability=V4L2_TUNER_CAP_LOW; + if(zol_is_stereo(zol)) + v->audmode = V4L2_TUNER_MODE_STEREO; + else + v->audmode = V4L2_TUNER_MODE_MONO; + v->signal=0xFFFF*zol_getsigstr(zol); + return 0; } - case VIDIOCSTUNER: + case VIDIOC_S_TUNER: { - struct video_tuner *v = arg; - if (v->tuner != 0) + struct v4l2_tuner *v = arg; + + if (v->index > 0) return -EINVAL; - /* Only 1 tuner so no setting needed ! */ + return 0; } - case VIDIOCGFREQ: - { - unsigned long *freq = arg; - *freq = zol->curfreq; - return 0; - } - case VIDIOCSFREQ: - { - unsigned long *freq = arg; - zol->curfreq = *freq; - zol_setfreq(zol, zol->curfreq); - return 0; - } - case VIDIOCGAUDIO: + case VIDIOC_S_FREQUENCY: { - struct video_audio *v = arg; - memset(v, 0, sizeof(*v)); - v->flags |= VIDEO_AUDIO_MUTABLE | VIDEO_AUDIO_VOLUME; - v->mode |= zol_is_stereo(zol) - ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; - v->volume = zol->curvol * 4096; - v->step = 4096; - strcpy(v->name, "Zoltrix Radio"); + struct v4l2_frequency *f = arg; + + zol->curfreq = f->frequency; + zol_setfreq(zol, zol->curfreq); return 0; } - case VIDIOCSAUDIO: + case VIDIOC_G_FREQUENCY: { - struct video_audio *v = arg; - if (v->audio) - return -EINVAL; + struct v4l2_frequency *f = arg; + + f->type = V4L2_TUNER_RADIO; + f->frequency = zol->curfreq; + + return 0; + } + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { + if (qc->id && qc->id == radio_qctrl[i].id) { + memcpy(qc, &(radio_qctrl[i]), + sizeof(*qc)); + return (0); + } + } + return -EINVAL; + } + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl= arg; - if (v->flags & VIDEO_AUDIO_MUTE) - zol_mute(zol); - else { - zol_unmute(zol); - zol_setvol(zol, v->volume / 4096); + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + ctrl->value=zol->muted; + return (0); + case V4L2_CID_AUDIO_VOLUME: + ctrl->value=zol->curvol * 4096; + return (0); } + return -EINVAL; + } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl= arg; + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value) { + zol_mute(zol); + } else { + zol_unmute(zol); + zol_setvol(zol,zol->curvol); + } + return (0); + case V4L2_CID_AUDIO_VOLUME: + zol_setvol(zol,ctrl->value/4096); + return (0); + } + zol->stereo = 1; + zol_setfreq(zol, zol->curfreq); +#if 0 +/* FIXME: Implement stereo/mono switch on V4L2 */ if (v->mode & VIDEO_SOUND_STEREO) { zol->stereo = 1; zol_setfreq(zol, zol->curfreq); @@ -293,10 +355,13 @@ static int zol_do_ioctl(struct inode *in zol->stereo = 0; zol_setfreq(zol, zol->curfreq); } - return 0; +#endif + return -EINVAL; } - default: - return -ENOIOCTLCMD; + + default: + return v4l_compat_translate_ioctl(inode,file,cmd,arg, + zol_do_ioctl); } } @@ -323,7 +388,7 @@ static struct video_device zoltrix_radio .owner = THIS_MODULE, .name = "Zoltrix Radio Plus", .type = VID_TYPE_TUNER, - .hardware = VID_HARDWARE_ZOLTRIX, + .hardware = 0, .fops = &zoltrix_fops, }; diff -puN drivers/media/video/bt8xx/bttv-driver.c~git-dvb drivers/media/video/bt8xx/bttv-driver.c --- a/drivers/media/video/bt8xx/bttv-driver.c~git-dvb +++ a/drivers/media/video/bt8xx/bttv-driver.c @@ -3923,7 +3923,12 @@ static int __devinit bttv_register_video goto err; printk(KERN_INFO "bttv%d: registered device video%d\n", btv->c.nr,btv->video_dev->minor & 0x1f); - video_device_create_file(btv->video_dev, &class_device_attr_card); + if (class_device_create_file(&btv->video_dev->class_dev, + &class_device_attr_card)<0) { + printk(KERN_ERR "bttv%d: class_device_create_file 'card' " + "failed\n", btv->c.nr); + goto err; + } /* vbi */ btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi"); @@ -4287,6 +4292,8 @@ static struct pci_driver bttv_pci_driver static int bttv_init_module(void) { + int ret; + bttv_num = 0; printk(KERN_INFO "bttv: driver version %d.%d.%d loaded\n", @@ -4308,7 +4315,11 @@ static int bttv_init_module(void) bttv_check_chipset(); - bus_register(&bttv_sub_bus_type); + ret = bus_register(&bttv_sub_bus_type); + if (ret < 0) { + printk(KERN_WARNING "bttv: bus_register error: %d\n", ret); + return ret; + } return pci_register_driver(&bttv_pci_driver); } diff -puN drivers/media/video/bt8xx/Kconfig~git-dvb drivers/media/video/bt8xx/Kconfig --- a/drivers/media/video/bt8xx/Kconfig~git-dvb +++ a/drivers/media/video/bt8xx/Kconfig @@ -1,6 +1,6 @@ config VIDEO_BT848 tristate "BT848 Video For Linux" - depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 + depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L1 select I2C_ALGOBIT select FW_LOADER select VIDEO_BTCX diff -puN drivers/media/video/compat_ioctl32.c~git-dvb drivers/media/video/compat_ioctl32.c --- a/drivers/media/video/compat_ioctl32.c~git-dvb +++ a/drivers/media/video/compat_ioctl32.c @@ -490,6 +490,23 @@ static inline int put_v4l2_input(struct return 0; } +struct video_code32 +{ + char loadwhat[16]; /* name or tag of file being passed */ + compat_int_t datasize; + unsigned char *data; +}; + +static inline int microcode32(struct video_code *kp, struct video_code32 __user *up) +{ + if(!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) || + copy_from_user(kp->loadwhat, up->loadwhat, sizeof (up->loadwhat)) || + get_user(kp->datasize, &up->datasize) || + copy_from_user(kp->data, up->data, up->datasize)) + return -EFAULT; + return 0; +} + #define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32) #define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32) #define VIDIOCGWIN32 _IOR('v',9, struct video_window32) @@ -498,6 +515,7 @@ static inline int put_v4l2_input(struct #define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32) #define VIDIOCGFREQ32 _IOR('v',14, u32) #define VIDIOCSFREQ32 _IOW('v',15, u32) +#define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32) /* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ #define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) @@ -590,6 +608,7 @@ static int do_video_ioctl(struct file *f struct video_tuner vt; struct video_buffer vb; struct video_window vw; + struct video_code vc; struct v4l2_format v2f; struct v4l2_buffer v2b; struct v4l2_framebuffer v2fb; @@ -628,6 +647,7 @@ static int do_video_ioctl(struct file *f case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; + case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; }; switch(cmd) { @@ -703,6 +723,10 @@ static int do_video_ioctl(struct file *f case VIDIOC_G_FBUF: case VIDIOC_G_INPUT: compatible_arg = 0; + case VIDIOCSMICROCODE: + err = microcode32(&karg.vc, up); + compatible_arg = 0; + break; }; if(err) diff -puN drivers/media/video/cpia2/Kconfig~git-dvb drivers/media/video/cpia2/Kconfig --- a/drivers/media/video/cpia2/Kconfig~git-dvb +++ a/drivers/media/video/cpia2/Kconfig @@ -1,6 +1,6 @@ config VIDEO_CPIA2 tristate "CPiA2 Video For Linux" - depends on VIDEO_DEV && USB + depends on VIDEO_DEV && USB && VIDEO_V4L1 ---help--- This is the video4linux driver for cameras based on Vision's CPiA2 (Colour Processor Interface ASIC), such as the Digital Blue QX5 diff -puN drivers/media/video/cx88/cx88-cards.c~git-dvb drivers/media/video/cx88/cx88-cards.c --- a/drivers/media/video/cx88/cx88-cards.c~git-dvb +++ a/drivers/media/video/cx88/cx88-cards.c @@ -1209,6 +1209,77 @@ struct cx88_board cx88_boards[] = { }}, .dvb = 1, }, + [CX88_BOARD_HAUPPAUGE_HVR3000] = { + /* FIXME: Add dvb & radio support */ + .name = "Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T", + .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x84bf, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x84bf, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x84bf, + }}, + }, + [CX88_BOARD_NORWOOD_MICRO] = { + .name = "Norwood Micro TV Tuner", + .tuner_type = TUNER_TNF_5335MF, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0709, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x070b, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x070b, + }}, + }, + [CX88_BOARD_TE_DTV_250_OEM_SWANN] = { + .name = "Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM", + .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x003fffff, + .gpio1 = 0x00e00000, + .gpio2 = 0x003fffff, + .gpio3 = 0x02000000, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x003fffff, + .gpio1 = 0x00e00000, + .gpio2 = 0x003fffff, + .gpio3 = 0x02000000, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x003fffff, + .gpio1 = 0x00e00000, + .gpio2 = 0x003fffff, + .gpio3 = 0x02000000, + }}, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -1458,6 +1529,19 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x14f1, .subdevice = 0x0084, .card = CX88_BOARD_GENIATECH_DVBS, + },{ + .subvendor = 0x0070, + .subdevice = 0x1404, + .card = CX88_BOARD_HAUPPAUGE_HVR3000, + },{ + .subvendor = 0x1461, + .subdevice = 0xc111, /* AverMedia M150-D */ + /* This board is known to work with the ASUS PVR416 config */ + .card = CX88_BOARD_ASUS_PVR_416, + },{ + .subvendor = 0xc180, + .subdevice = 0xc980, + .card = CX88_BOARD_TE_DTV_250_OEM_SWANN, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); @@ -1501,6 +1585,7 @@ static void hauppauge_eeprom(struct cx88 /* Make sure we support the board model */ switch (tv.model) { + case 14569: /* WinTV-HVR3000 (OEM, no IR, no back panel video) */ case 28552: /* WinTV-PVR 'Roslyn' (No IR) */ case 34519: /* WinTV-PCI-FM */ case 90002: /* Nova-T-PCI (9002) */ @@ -1666,6 +1751,7 @@ void cx88_card_setup(struct cx88_core *c case CX88_BOARD_HAUPPAUGE_DVB_T1: case CX88_BOARD_HAUPPAUGE_HVR1100: case CX88_BOARD_HAUPPAUGE_HVR1100LP: + case CX88_BOARD_HAUPPAUGE_HVR3000: if (0 == core->i2c_rc) hauppauge_eeprom(core,eeprom); break; diff -puN drivers/media/video/cx88/cx88-core.c~git-dvb drivers/media/video/cx88/cx88-core.c --- a/drivers/media/video/cx88/cx88-core.c~git-dvb +++ a/drivers/media/video/cx88/cx88-core.c @@ -105,7 +105,7 @@ static u32* cx88_risc_field(u32 *rp, str *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); offset+=bpl; } else { - /* scanline needs to be splitted */ + /* scanline needs to be split */ todo = bpl; *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL| (sg_dma_len(sg)-offset)); diff -puN drivers/media/video/cx88/cx88.h~git-dvb drivers/media/video/cx88/cx88.h --- a/drivers/media/video/cx88/cx88.h~git-dvb +++ a/drivers/media/video/cx88/cx88.h @@ -197,6 +197,9 @@ extern struct sram_channel cx88_sram_cha #define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50 #define CX88_BOARD_WINFAST_DTV2000H 51 #define CX88_BOARD_GENIATECH_DVBS 52 +#define CX88_BOARD_HAUPPAUGE_HVR3000 53 +#define CX88_BOARD_NORWOOD_MICRO 54 +#define CX88_BOARD_TE_DTV_250_OEM_SWANN 55 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, diff -puN drivers/media/video/cx88/cx88-input.c~git-dvb drivers/media/video/cx88/cx88-input.c --- a/drivers/media/video/cx88/cx88-input.c~git-dvb +++ a/drivers/media/video/cx88/cx88-input.c @@ -89,7 +89,7 @@ static void cx88_ir_handle_key(struct cx auxgpio = cx_read(MO_GP1_IO); /* Take out the parity part */ - gpio+=(gpio & 0x7fd) + (auxgpio & 0xef); + gpio=(gpio & 0x7fd) + (auxgpio & 0xef); } else auxgpio = gpio; @@ -107,7 +107,15 @@ static void cx88_ir_handle_key(struct cx (gpio & ir->mask_keydown) ? " down" : "", (gpio & ir->mask_keyup) ? " up" : ""); - if (ir->mask_keydown) { + if (ir->core->board == CX88_BOARD_NORWOOD_MICRO) { + u32 gpio_key = cx_read(MO_GP0_IO); + + data = (data << 4) | ((gpio_key & 0xf0) >> 4); + + ir_input_keydown(ir->input, &ir->ir, data, data); + ir_input_nokey(ir->input, &ir->ir); + + } else if (ir->mask_keydown) { /* bit set on keydown */ if (gpio & ir->mask_keydown) { ir_input_keydown(ir->input, &ir->ir, data, data); @@ -248,6 +256,13 @@ int cx88_ir_init(struct cx88_core *core, ir_type = IR_TYPE_PD; ir->sampling = 0xff00; /* address */ break; + case CX88_BOARD_NORWOOD_MICRO: + ir_codes = ir_codes_norwood; + ir->gpio_addr = MO_GP1_IO; + ir->mask_keycode = 0x0e; + ir->mask_keyup = 0x80; + ir->polling = 50; /* ms */ + break; case CX88_BOARD_NPGTECH_REALTV_TOP10FM: ir_codes = ir_codes_npgtech; ir->gpio_addr = MO_GP0_IO; diff -puN drivers/media/video/cx88/cx88-tvaudio.c~git-dvb drivers/media/video/cx88/cx88-tvaudio.c --- a/drivers/media/video/cx88/cx88-tvaudio.c~git-dvb +++ a/drivers/media/video/cx88/cx88-tvaudio.c @@ -52,7 +52,6 @@ #include #include #include -#include #include #include "cx88.h" diff -puN drivers/media/video/cx88/cx88-video.c~git-dvb drivers/media/video/cx88/cx88-video.c --- a/drivers/media/video/cx88/cx88-video.c~git-dvb +++ a/drivers/media/video/cx88/cx88-video.c @@ -1180,7 +1180,6 @@ static int video_do_ioctl(struct inode * V4L2_CAP_READWRITE | V4L2_CAP_STREAMING | V4L2_CAP_VBI_CAPTURE | - V4L2_CAP_VIDEO_OVERLAY | 0; if (UNSET != core->tuner_type) cap->capabilities |= V4L2_CAP_TUNER; @@ -1226,7 +1225,7 @@ static int video_do_ioctl(struct inode * struct v4l2_format *f = arg; return cx8800_try_fmt(dev,fh,f); } -#ifdef HAVE_V4L1 +#ifdef CONFIG_V4L1_COMPAT /* --- streaming capture ------------------------------------- */ case VIDIOCGMBUF: { @@ -1585,7 +1584,7 @@ static int radio_do_ioctl(struct inode * *id = 0; return 0; } -#ifdef HAVE_V4L1 +#ifdef CONFIG_V4L1_COMPAT case VIDIOCSTUNER: { struct video_tuner *v = arg; diff -puN drivers/media/video/Kconfig~git-dvb drivers/media/video/Kconfig --- a/drivers/media/video/Kconfig~git-dvb +++ a/drivers/media/video/Kconfig @@ -145,7 +145,7 @@ config VIDEO_SAA5246A config VIDEO_SAA5249 tristate "SAA5249 Teletext processor" - depends on VIDEO_DEV && I2C + depends on VIDEO_DEV && I2C && VIDEO_V4L1 help Support for I2C bus based teletext using the SAA5249 chip. At the moment this is only useful on some European WinTV cards. @@ -155,7 +155,7 @@ config VIDEO_SAA5249 config TUNER_3036 tristate "SAB3036 tuner" - depends on VIDEO_DEV && I2C + depends on VIDEO_DEV && I2C && VIDEO_V4L1 help Say Y here to include support for Philips SAB3036 compatible tuners. If in doubt, say N. diff -puN drivers/media/video/msp3400-driver.c~git-dvb drivers/media/video/msp3400-driver.c --- a/drivers/media/video/msp3400-driver.c~git-dvb +++ a/drivers/media/video/msp3400-driver.c @@ -362,7 +362,7 @@ int msp_sleep(struct msp_state *state, i } /* ------------------------------------------------------------------------ */ - +#ifdef CONFIG_VIDEO_V4L1 static int msp_mode_v4l2_to_v4l1(int rxsubchans, int audmode) { if (rxsubchans == V4L2_TUNER_SUB_MONO) @@ -384,6 +384,7 @@ static int msp_mode_v4l1_to_v4l2(int mod return V4L2_TUNER_MODE_LANG1; return V4L2_TUNER_MODE_MONO; } +#endif static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) { @@ -509,6 +510,7 @@ static int msp_command(struct i2c_client /* --- v4l ioctls --- */ /* take care: bttv does userspace copying, we'll get a kernel pointer here... */ +#ifdef CONFIG_VIDEO_V4L1 case VIDIOCGAUDIO: { struct video_audio *va = arg; @@ -577,6 +579,12 @@ static int msp_command(struct i2c_client } case VIDIOCSFREQ: + { + /* new channel -- kick audio carrier scan */ + msp_wake_thread(client); + break; + } +#endif case VIDIOC_S_FREQUENCY: { /* new channel -- kick audio carrier scan */ diff -puN drivers/media/video/pvrusb2/pvrusb2-hdw.c~git-dvb drivers/media/video/pvrusb2/pvrusb2-hdw.c --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c~git-dvb +++ a/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -852,7 +852,6 @@ unsigned long pvr2_hdw_get_sn(struct pvr return hdw->serial_number; } - int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) { return hdw->unit_number; @@ -2318,7 +2317,6 @@ void pvr2_hdw_poll_trigger_unlocked(stru } } - /* Return name for this driver instance */ const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) { @@ -2542,6 +2540,10 @@ static void pvr2_ctl_timeout(unsigned lo } +/* Issue a command and get a response from the device. This extended + version includes a probe flag (which if set means that device errors + should not be logged or treated as fatal) and a timeout in jiffies. + This can be used to non-lethally probe the health of endpoint 1. */ static int pvr2_send_request_ex(struct pvr2_hdw *hdw, unsigned int timeout,int probe_fl, void *write_data,unsigned int write_len, @@ -2970,6 +2972,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pv } +/* Stop / start video stream transport */ static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) { int status; @@ -3068,6 +3071,7 @@ int pvr2_hdw_gpio_chg_out(struct pvr2_hd } +/* Find I2C address of eeprom */ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) { int result; diff -puN drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h~git-dvb drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h~git-dvb +++ a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -33,7 +33,6 @@ */ -#include #include #include #include diff -puN drivers/media/video/pvrusb2/pvrusb2-io.c~git-dvb drivers/media/video/pvrusb2/pvrusb2-io.c --- a/drivers/media/video/pvrusb2/pvrusb2-io.c~git-dvb +++ a/drivers/media/video/pvrusb2/pvrusb2-io.c @@ -26,6 +26,8 @@ #include #include +static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state); + #define BUFFER_SIG 0x47653271 // #define SANITY_CHECK_BUFFERS @@ -515,6 +517,10 @@ void pvr2_stream_set_callback(struct pvr } /* Query / set the nominal buffer count */ +int pvr2_stream_get_buffer_count(struct pvr2_stream *sp) +{ + return sp->buffer_target_count; +} int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt) { @@ -553,7 +559,6 @@ int pvr2_stream_get_ready_count(struct p return sp->r_count; } - void pvr2_stream_kill(struct pvr2_stream *sp) { struct pvr2_buffer *bp; @@ -607,7 +612,6 @@ int pvr2_buffer_queue(struct pvr2_buffer return ret; } - int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) { int ret = 0; @@ -646,7 +650,6 @@ int pvr2_buffer_get_status(struct pvr2_b return bp->status; } - int pvr2_buffer_get_id(struct pvr2_buffer *bp) { return bp->id; diff -puN drivers/media/video/pvrusb2/pvrusb2-io.h~git-dvb drivers/media/video/pvrusb2/pvrusb2-io.h --- a/drivers/media/video/pvrusb2/pvrusb2-io.h~git-dvb +++ a/drivers/media/video/pvrusb2/pvrusb2-io.h @@ -47,6 +47,7 @@ void pvr2_stream_set_callback(struct pvr void *data); /* Query / set the nominal buffer count */ +int pvr2_stream_get_buffer_count(struct pvr2_stream *); int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int); /* Get a pointer to a buffer that is either idle, ready, or is specified @@ -58,6 +59,7 @@ struct pvr2_buffer *pvr2_stream_get_buff /* Find out how many buffers are idle or ready */ int pvr2_stream_get_ready_count(struct pvr2_stream *); + /* Kill all pending buffers and throw away any ready buffers as well */ void pvr2_stream_kill(struct pvr2_stream *); diff -puN drivers/media/video/pvrusb2/pvrusb2-ioread.c~git-dvb drivers/media/video/pvrusb2/pvrusb2-ioread.c --- a/drivers/media/video/pvrusb2/pvrusb2-ioread.c~git-dvb +++ a/drivers/media/video/pvrusb2/pvrusb2-ioread.c @@ -213,7 +213,9 @@ int pvr2_ioread_setup(struct pvr2_ioread " pvr2_ioread_setup (tear-down) id=%p",cp); pvr2_ioread_stop(cp); pvr2_stream_kill(cp->stream); - pvr2_stream_set_buffer_count(cp->stream,0); + if (pvr2_stream_get_buffer_count(cp->stream)) { + pvr2_stream_set_buffer_count(cp->stream,0); + } cp->stream = NULL; } if (sp) { @@ -251,7 +253,6 @@ int pvr2_ioread_set_enabled(struct pvr2_ return ret; } - static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) { int stat; diff -puN drivers/media/video/pvrusb2/pvrusb2-main.c~git-dvb drivers/media/video/pvrusb2/pvrusb2-main.c --- a/drivers/media/video/pvrusb2/pvrusb2-main.c~git-dvb +++ a/drivers/media/video/pvrusb2/pvrusb2-main.c @@ -20,7 +20,6 @@ * */ -#include #include #include #include diff -puN drivers/media/video/pvrusb2/pvrusb2-sysfs.c~git-dvb drivers/media/video/pvrusb2/pvrusb2-sysfs.c --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c~git-dvb +++ a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c @@ -19,7 +19,6 @@ * */ -#include #include #include #include @@ -600,6 +599,8 @@ static ssize_t debugcmd_store(struct cla static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) { struct pvr2_sysfs_debugifc *dip; + int ret; + dip = kmalloc(sizeof(*dip),GFP_KERNEL); if (!dip) return; memset(dip,0,sizeof(*dip)); @@ -613,8 +614,14 @@ static void pvr2_sysfs_add_debugifc(stru dip->attr_debuginfo.attr.mode = S_IRUGO; dip->attr_debuginfo.show = debuginfo_show; sfp->debugifc = dip; - class_device_create_file(sfp->class_dev,&dip->attr_debugcmd); - class_device_create_file(sfp->class_dev,&dip->attr_debuginfo); + ret = class_device_create_file(sfp->class_dev,&dip->attr_debugcmd); + if (ret < 0) + printk(KERN_WARNING "%s: class_device_create_file error: %d\n", + __FUNCTION__, ret); + ret = class_device_create_file(sfp->class_dev,&dip->attr_debuginfo); + if (ret < 0) + printk(KERN_WARNING "%s: class_device_create_file error: %d\n", + __FUNCTION__, ret); } @@ -709,6 +716,8 @@ static void class_dev_create(struct pvr2 { struct usb_device *usb_dev; struct class_device *class_dev; + int ret; + usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); if (!usb_dev) return; class_dev = kmalloc(sizeof(*class_dev),GFP_KERNEL); @@ -733,20 +742,33 @@ static void class_dev_create(struct pvr2 sfp->class_dev = class_dev; class_dev->class_data = sfp; - class_device_register(class_dev); + ret = class_device_register(class_dev); + if (ret) { + printk(KERN_ERR "%s: class_device_register failed\n", + __FUNCTION__); + kfree(class_dev); + return; + } sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE; sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; sfp->attr_v4l_minor_number.show = v4l_minor_number_show; sfp->attr_v4l_minor_number.store = NULL; - class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number); + ret = class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number); + if (ret < 0) + printk(KERN_WARNING "%s: class_device_create_file error: %d\n", + __FUNCTION__, ret); + sfp->attr_unit_number.attr.owner = THIS_MODULE; sfp->attr_unit_number.attr.name = "unit_number"; sfp->attr_unit_number.attr.mode = S_IRUGO; sfp->attr_unit_number.show = unit_number_show; sfp->attr_unit_number.store = NULL; - class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); + ret = class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); + if (ret < 0) + printk(KERN_WARNING "%s: class_device_create_file error: %d\n", + __FUNCTION__, ret); pvr2_sysfs_add_controls(sfp); #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC diff -puN drivers/media/video/saa7134/saa7134-alsa.c~git-dvb drivers/media/video/saa7134/saa7134-alsa.c --- a/drivers/media/video/saa7134/saa7134-alsa.c~git-dvb +++ a/drivers/media/video/saa7134/saa7134-alsa.c @@ -997,9 +997,9 @@ static int saa7134_alsa_init(void) struct saa7134_dev *dev = NULL; struct list_head *list; - if (!dmasound_init && !dmasound_exit) { - dmasound_init = alsa_device_init; - dmasound_exit = alsa_device_exit; + if (!saa7134_dmasound_init && !saa7134_dmasound_exit) { + saa7134_dmasound_init = alsa_device_init; + saa7134_dmasound_exit = alsa_device_exit; } else { printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n"); return -EBUSY; @@ -1036,8 +1036,8 @@ static void saa7134_alsa_exit(void) snd_card_free(snd_saa7134_cards[idx]); } - dmasound_init = NULL; - dmasound_exit = NULL; + saa7134_dmasound_init = NULL; + saa7134_dmasound_exit = NULL; printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); return; diff -puN drivers/media/video/saa7134/saa7134-cards.c~git-dvb drivers/media/video/saa7134/saa7134-cards.c --- a/drivers/media/video/saa7134/saa7134-cards.c~git-dvb +++ a/drivers/media/video/saa7134/saa7134-cards.c @@ -1911,7 +1911,7 @@ struct saa7134_board saa7134_boards[] = }, }, [SAA7134_BOARD_FLYDVBT_DUO_CARDBUS] = { - .name = "LifeView/Typhoon FlyDVB-T Duo Cardbus", + .name = "LifeView/Typhoon/Genius FlyDVB-T Duo Cardbus", .audio_clock = 0x00200000, .tuner_type = TUNER_PHILIPS_TDA8290, .radio_type = UNSET, @@ -2891,6 +2891,29 @@ struct saa7134_board saa7134_boards[] = .gpio = 0x8000, }, }, + [SAA7134_BOARD_MEDION_MD8800_QUADRO] = { + .name = "Medion Md8800 Quadro", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 0, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -3375,7 +3398,7 @@ struct pci_device_id saa7134_pci_tbl[] = .driver_data = SAA7134_BOARD_FLYDVB_TRIO, },{ .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7134, /* SAA 7131E */ + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, .subvendor = 0x1461, .subdevice = 0x2c05, .driver_data = SAA7134_BOARD_AVERMEDIA_777, @@ -3446,6 +3469,30 @@ struct pci_device_id saa7134_pci_tbl[] = .subdevice = 0x3502, /* whats the difference to 0x3306 ?*/ .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS, },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x16be, + .subdevice = 0x0007, + .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x16be, + .subdevice = 0x0008, + .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1461, + .subdevice = 0x2c05, + .driver_data = SAA7134_BOARD_AVERMEDIA_777, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1489, + .subdevice = 0x0502, /* Cardbus version */ + .driver_data = SAA7134_BOARD_FLYDVBT_DUO_CARDBUS, + },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, @@ -3732,6 +3779,7 @@ int saa7134_board_init2(struct saa7134_d case SAA7134_BOARD_PHILIPS_TIGER: case SAA7134_BOARD_TEVION_DVBT_220RF: case SAA7134_BOARD_ASUSTeK_P7131_DUAL: + case SAA7134_BOARD_MEDION_MD8800_QUADRO: /* this is a hybrid board, initialize to analog mode * and configure firmware eeprom address */ diff -puN drivers/media/video/saa7134/saa7134-core.c~git-dvb drivers/media/video/saa7134/saa7134-core.c --- a/drivers/media/video/saa7134/saa7134-core.c~git-dvb +++ a/drivers/media/video/saa7134/saa7134-core.c @@ -95,8 +95,8 @@ LIST_HEAD(saa7134_devlist); static LIST_HEAD(mops_list); static unsigned int saa7134_devcount; -int (*dmasound_init)(struct saa7134_dev *dev); -int (*dmasound_exit)(struct saa7134_dev *dev); +int (*saa7134_dmasound_init)(struct saa7134_dev *dev); +int (*saa7134_dmasound_exit)(struct saa7134_dev *dev); #define dprintk(fmt, arg...) if (core_debug) \ printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg) @@ -1008,8 +1008,8 @@ static int __devinit saa7134_initdev(str /* check for signal */ saa7134_irq_video_intl(dev); - if (dmasound_init && !dev->dmasound.priv_data) { - dmasound_init(dev); + if (saa7134_dmasound_init && !dev->dmasound.priv_data) { + saa7134_dmasound_init(dev); } return 0; @@ -1036,8 +1036,8 @@ static void __devexit saa7134_finidev(st struct saa7134_mpeg_ops *mops; /* Release DMA sound modules if present */ - if (dmasound_exit && dev->dmasound.priv_data) { - dmasound_exit(dev); + if (saa7134_dmasound_exit && dev->dmasound.priv_data) { + saa7134_dmasound_exit(dev); } /* debugging ... */ @@ -1169,8 +1169,8 @@ EXPORT_SYMBOL(saa7134_boards); /* ----------------- for the DMA sound modules --------------- */ -EXPORT_SYMBOL(dmasound_init); -EXPORT_SYMBOL(dmasound_exit); +EXPORT_SYMBOL(saa7134_dmasound_init); +EXPORT_SYMBOL(saa7134_dmasound_exit); EXPORT_SYMBOL(saa7134_pgtable_free); EXPORT_SYMBOL(saa7134_pgtable_build); EXPORT_SYMBOL(saa7134_pgtable_alloc); diff -puN drivers/media/video/saa7134/saa7134-dvb.c~git-dvb drivers/media/video/saa7134/saa7134-dvb.c --- a/drivers/media/video/saa7134/saa7134-dvb.c~git-dvb +++ a/drivers/media/video/saa7134/saa7134-dvb.c @@ -969,6 +969,51 @@ static struct tda1004x_config tevion_dvb .request_firmware = NULL, }; +/* ------------------------------------------------------------------ */ + +static int md8800_dvbt_analog_mode(struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + static u8 data[] = { 0x3c, 0x33, 0x68}; + struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; + + i2c_transfer(&dev->i2c_adap, &msg, 1); + philips_tda827xa_tuner_sleep( 0x61, fe); + return 0; +} + +static int md8800_dvbt_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + int ret; + struct saa7134_dev *dev = fe->dvb->priv; + static u8 tda8290_close[] = { 0x21, 0xc0}; + static u8 tda8290_open[] = { 0x21, 0x80}; + struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2}; + /* close tda8290 i2c bridge */ + tda8290_msg.buf = tda8290_close; + ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); + if (ret != 1) + return -EIO; + msleep(20); + ret = philips_tda827xa_pll_set(0x60, fe, params); + if (ret != 0) + return ret; + /* open tda8290 i2c bridge */ + tda8290_msg.buf = tda8290_open; + i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); + return ret; +} + +static struct tda1004x_config md8800_dvbt_config = { + .demod_address = 0x08, + .invert = 1, + .invert_oclk = 0, + .xtal_freq = TDA10046_XTAL_16M, + .agc_config = TDA10046_AGC_TDA827X, + .if_freq = TDA10046_FREQ_045, + .request_firmware = NULL, +}; + #endif /* ------------------------------------------------------------------ */ @@ -1153,6 +1198,15 @@ static int dvb_init(struct saa7134_dev * dev->dvb.frontend->ops.tuner_ops.set_params = ads_duo_tuner_set_params; } break; + case SAA7134_BOARD_MEDION_MD8800_QUADRO: + dev->dvb.frontend = tda10046_attach(&md8800_dvbt_config, + &dev->i2c_adap); + if (dev->dvb.frontend) { + dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; + dev->dvb.frontend->ops.tuner_ops.sleep = md8800_dvbt_analog_mode; + dev->dvb.frontend->ops.tuner_ops.set_params = md8800_dvbt_pll_set; + } + break; #endif #ifdef HAVE_NXT200X case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: diff -puN drivers/media/video/saa7134/saa7134.h~git-dvb drivers/media/video/saa7134/saa7134.h --- a/drivers/media/video/saa7134/saa7134.h~git-dvb +++ a/drivers/media/video/saa7134/saa7134.h @@ -223,6 +223,7 @@ struct saa7134_format { #define SAA7134_BOARD_MD7134_BRIDGE_2 93 #define SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS 94 #define SAA7134_BOARD_FLYVIDEO3000_NTSC 95 +#define SAA7134_BOARD_MEDION_MD8800_QUADRO 96 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 @@ -586,8 +587,8 @@ void saa7134_dma_free(struct videobuf_qu int saa7134_set_dmabits(struct saa7134_dev *dev); -extern int (*dmasound_init)(struct saa7134_dev *dev); -extern int (*dmasound_exit)(struct saa7134_dev *dev); +extern int (*saa7134_dmasound_init)(struct saa7134_dev *dev); +extern int (*saa7134_dmasound_exit)(struct saa7134_dev *dev); /* ----------------------------------------------------------- */ diff -puN drivers/media/video/saa7134/saa7134-oss.c~git-dvb drivers/media/video/saa7134/saa7134-oss.c --- a/drivers/media/video/saa7134/saa7134-oss.c~git-dvb +++ a/drivers/media/video/saa7134/saa7134-oss.c @@ -993,9 +993,9 @@ static int saa7134_oss_init(void) struct saa7134_dev *dev = NULL; struct list_head *list; - if (!dmasound_init && !dmasound_exit) { - dmasound_init = oss_device_init; - dmasound_exit = oss_device_exit; + if (!saa7134_dmasound_init && !saa7134_dmasound_exit) { + saa7134_dmasound_init = oss_device_init; + saa7134_dmasound_exit = oss_device_exit; } else { printk(KERN_WARNING "saa7134 OSS: can't load, DMA sound handler already assigned (probably to ALSA)\n"); return -EBUSY; @@ -1037,8 +1037,8 @@ static void saa7134_oss_exit(void) } - dmasound_init = NULL; - dmasound_exit = NULL; + saa7134_dmasound_init = NULL; + saa7134_dmasound_exit = NULL; printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); diff -puN drivers/media/video/saa7134/saa7134-video.c~git-dvb drivers/media/video/saa7134/saa7134-video.c --- a/drivers/media/video/saa7134/saa7134-video.c~git-dvb +++ a/drivers/media/video/saa7134/saa7134-video.c @@ -40,7 +40,7 @@ static unsigned int video_debug = 0; static unsigned int gbuffers = 8; -static unsigned int noninterlaced = 0; +static unsigned int noninterlaced = 1; static unsigned int gbufsize = 720*576*4; static unsigned int gbufsize_max = 720*576*4; module_param(video_debug, int, 0644); @@ -48,7 +48,7 @@ MODULE_PARM_DESC(video_debug,"enable deb module_param(gbuffers, int, 0444); MODULE_PARM_DESC(gbuffers,"number of capture buffers, range 2-32"); module_param(noninterlaced, int, 0644); -MODULE_PARM_DESC(noninterlaced,"video input is noninterlaced"); +MODULE_PARM_DESC(noninterlaced,"capture non interlaced video"); #define dprintk(fmt, arg...) if (video_debug) \ printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg) @@ -2087,7 +2087,7 @@ static int video_do_ioctl(struct inode * struct v4l2_format *f = arg; return saa7134_try_fmt(dev,fh,f); } -#ifdef HAVE_V4L1 +#ifdef CONFIG_V4L1_COMPAT case VIDIOCGMBUF: { struct video_mbuf *mbuf = arg; diff -puN drivers/media/video/stradis.c~git-dvb drivers/media/video/stradis.c --- a/drivers/media/video/stradis.c~git-dvb +++ a/drivers/media/video/stradis.c @@ -2181,7 +2181,6 @@ static struct pci_device_id stradis_pci_ { 0 } }; -MODULE_DEVICE_TABLE(pci, stradis_pci_tbl); static struct pci_driver stradis_driver = { .name = "stradis", diff -puN drivers/media/video/tuner-core.c~git-dvb drivers/media/video/tuner-core.c --- a/drivers/media/video/tuner-core.c~git-dvb +++ a/drivers/media/video/tuner-core.c @@ -196,14 +196,6 @@ static void set_type(struct i2c_client * i2c_master_send(c, buffer, 4); default_tuner_init(c); break; - case TUNER_LG_TDVS_H06XF: - /* Set the Auxiliary Byte. */ - buffer[2] &= ~0x20; - buffer[2] |= 0x18; - buffer[3] = 0x20; - i2c_master_send(c, buffer, 4); - default_tuner_init(c); - break; case TUNER_PHILIPS_TD1316: buffer[0] = 0x0b; buffer[1] = 0xdc; @@ -598,6 +590,7 @@ static int tuner_command(struct i2c_clie if (t->standby) t->standby (client); break; +#ifdef CONFIG_VIDEO_V4L1 case VIDIOCSAUDIO: if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) return 0; @@ -607,17 +600,6 @@ static int tuner_command(struct i2c_clie /* Should be implemented, since bttv calls it */ tuner_dbg("VIDIOCSAUDIO not implemented.\n"); break; - case TDA9887_SET_CONFIG: - if (t->type == TUNER_TDA9887) { - int *i = arg; - - t->tda9887_config = *i; - set_freq(client, t->tv_freq); - } - break; - /* --- v4l ioctls --- */ - /* take care: bttv does userspace copying, we'll get a - kernel pointer here... */ case VIDIOCSCHAN: { static const v4l2_std_id map[] = { @@ -701,7 +683,18 @@ static int tuner_command(struct i2c_clie ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; return 0; } +#endif + case TDA9887_SET_CONFIG: + if (t->type == TUNER_TDA9887) { + int *i = arg; + t->tda9887_config = *i; + set_freq(client, t->tv_freq); + } + break; + /* --- v4l ioctls --- */ + /* take care: bttv does userspace copying, we'll get a + kernel pointer here... */ case VIDIOC_S_STD: { v4l2_std_id *id = arg; diff -puN drivers/media/video/tuner-simple.c~git-dvb drivers/media/video/tuner-simple.c --- a/drivers/media/video/tuner-simple.c~git-dvb +++ a/drivers/media/video/tuner-simple.c @@ -339,7 +339,20 @@ static void default_set_tv_freq(struct i if (4 != (rc = i2c_master_send(c,buffer,4))) tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); - if (t->type == TUNER_MICROTUNE_4042FI5) { + switch (t->type) { + case TUNER_LG_TDVS_H06XF: + /* Set the Auxiliary Byte. */ + buffer[0] = buffer[2]; + buffer[0] &= ~0x20; + buffer[0] |= 0x18; + buffer[1] = 0x20; + tuner_dbg("tv 0x%02x 0x%02x\n",buffer[0],buffer[1]); + + if (2 != (rc = i2c_master_send(c,buffer,2))) + tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc); + break; + case TUNER_MICROTUNE_4042FI5: + { // FIXME - this may also work for other tuners unsigned long timeout = jiffies + msecs_to_jiffies(1); u8 status_byte = 0; @@ -364,10 +377,12 @@ static void default_set_tv_freq(struct i buffer[2] = config; buffer[3] = cb; tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", - buffer[0],buffer[1],buffer[2],buffer[3]); + buffer[0],buffer[1],buffer[2],buffer[3]); if (4 != (rc = i2c_master_send(c,buffer,4))) tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); + break; + } } } @@ -424,8 +439,6 @@ static void default_set_radio_freq(struc buffer[3] = 0xa4; break; } - buffer[0] = (div>>8) & 0x7f; - buffer[1] = div & 0xff; if (params->cb_first_if_lower_freq && div < t->last_div) { buffer[0] = buffer[2]; buffer[1] = buffer[3]; diff -puN drivers/media/video/usbvideo/Kconfig~git-dvb drivers/media/video/usbvideo/Kconfig --- a/drivers/media/video/usbvideo/Kconfig~git-dvb +++ a/drivers/media/video/usbvideo/Kconfig @@ -3,7 +3,7 @@ config VIDEO_USBVIDEO config USB_VICAM tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" - depends on USB && VIDEO_V4L1 && EXPERIMENTAL + depends on USB && VIDEO_DEV && VIDEO_V4L1 && EXPERIMENTAL select VIDEO_USBVIDEO ---help--- Say Y here if you have 3com homeconnect camera (vicam). @@ -13,7 +13,7 @@ config USB_VICAM config USB_IBMCAM tristate "USB IBM (Xirlink) C-it Camera support" - depends on USB && VIDEO_V4L1 + depends on USB && VIDEO_DEV && VIDEO_V4L1 select VIDEO_USBVIDEO ---help--- Say Y here if you want to connect a IBM "C-It" camera, also known as @@ -28,7 +28,7 @@ config USB_IBMCAM config USB_KONICAWC tristate "USB Konica Webcam support" - depends on USB && VIDEO_V4L1 + depends on USB && VIDEO_DEV && VIDEO_V4L1 select VIDEO_USBVIDEO ---help--- Say Y here if you want support for webcams based on a Konica @@ -39,7 +39,7 @@ config USB_KONICAWC config USB_QUICKCAM_MESSENGER tristate "USB Logitech Quickcam Messenger" - depends on USB && VIDEO_DEV + depends on USB && VIDEO_DEV && VIDEO_V4L1 select VIDEO_USBVIDEO ---help--- Say Y or M here to enable support for the USB Logitech Quickcam diff -puN drivers/media/video/v4l2-common.c~git-dvb drivers/media/video/v4l2-common.c --- a/drivers/media/video/v4l2-common.c~git-dvb +++ a/drivers/media/video/v4l2-common.c @@ -202,7 +202,7 @@ static char *v4l2_memory_names[] = { /* ------------------------------------------------------------------ */ /* debug help functions */ -#ifdef HAVE_V4L1 +#ifdef CONFIG_V4L1_COMPAT static const char *v4l1_ioctls[] = { [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", @@ -301,7 +301,7 @@ static const char *v4l2_ioctls[] = { #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) static const char *v4l2_int_ioctls[] = { -#ifdef HAVE_VIDEO_DECODER +#ifdef CONFIG_V4L1_COMPAT [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", @@ -367,7 +367,7 @@ void v4l_printk_ioctl(unsigned int cmd) (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); break; -#ifdef HAVE_V4L1 +#ifdef CONFIG_V4L1_COMPAT case 'v': printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", (_IOC_NR(cmd) < V4L1_IOCTLS) ? @@ -414,6 +414,7 @@ void v4l_printk_ioctl_arg(char *s,unsign printk ("%s: tuner type=%d\n", s, *p); break; } +#ifdef CONFIG_VIDEO_V4L1_COMPAT case DECODER_SET_VBI_BYPASS: case DECODER_ENABLE_OUTPUT: case DECODER_GET_STATUS: @@ -424,6 +425,7 @@ void v4l_printk_ioctl_arg(char *s,unsign case VIDIOCCAPTURE: case VIDIOCSYNC: case VIDIOCSWRITEMODE: +#endif case TUNER_SET_TYPE_ADDR: case TUNER_SET_STANDBY: case TDA9887_SET_CONFIG: @@ -755,6 +757,7 @@ void v4l_printk_ioctl_arg(char *s,unsign p->afc); break; } +#ifdef CONFIG_VIDEO_V4L1_COMPAT case VIDIOCGVBIFMT: case VIDIOCSVBIFMT: { @@ -924,6 +927,14 @@ void v4l_printk_ioctl_arg(char *s,unsign p->clipcount); break; } + case VIDIOCGFREQ: + case VIDIOCSFREQ: + { + unsigned long *p=arg; + printk ("%s: value=%lu\n", s, *p); + break; + } +#endif case VIDIOC_INT_AUDIO_CLOCK_FREQ: case VIDIOC_INT_I2S_CLOCK_FREQ: case VIDIOC_INT_S_STANDBY: @@ -933,13 +944,6 @@ void v4l_printk_ioctl_arg(char *s,unsign printk ("%s: value=%d\n", s, *p); break; } - case VIDIOCGFREQ: - case VIDIOCSFREQ: - { - unsigned long *p=arg; - printk ("%s: value=%lu\n", s, *p); - break; - } case VIDIOC_G_STD: case VIDIOC_S_STD: case VIDIOC_QUERYSTD: diff -puN drivers/media/video/videodev.c~git-dvb drivers/media/video/videodev.c --- a/drivers/media/video/videodev.c~git-dvb +++ a/drivers/media/video/videodev.c @@ -760,7 +760,7 @@ static int __video_do_ioctl(struct inode ret=vfd->vidioc_overlay(file, fh, *i); break; } -#ifdef HAVE_V4L1 +#ifdef CONFIG_V4L1_COMPAT /* --- streaming capture ------------------------------------- */ case VIDIOCGMBUF: { @@ -1512,6 +1512,7 @@ int video_register_device(struct video_d int i=0; int base; int end; + int ret; char *name_base; switch(type) @@ -1537,6 +1538,8 @@ int video_register_device(struct video_d name_base = "radio"; break; default: + printk(KERN_ERR "%s called with unknown type: %d\n", + __FUNCTION__, type); return -1; } @@ -1571,9 +1574,18 @@ int video_register_device(struct video_d vfd->class_dev.class = &video_class; vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); - class_device_register(&vfd->class_dev); - class_device_create_file(&vfd->class_dev, - &class_device_attr_name); + ret = class_device_register(&vfd->class_dev); + if (ret) { + printk(KERN_ERR "%s: class_device_register failed\n", + __FUNCTION__); + goto fail_minor; + } + ret = class_device_create_file(&vfd->class_dev, &class_device_attr_name); + if (ret < 0) { + printk(KERN_ERR "%s: class_device_create_file 'name' failed\n", + __FUNCTION__); + goto fail_classdev; + } #if 1 /* needed until all drivers are fixed */ @@ -1583,6 +1595,15 @@ int video_register_device(struct video_d "http://lwn.net/Articles/36850/\n", vfd->name); #endif return 0; + +fail_classdev: + class_device_unregister(&vfd->class_dev); +fail_minor: + mutex_lock(&videodev_lock); + video_device[vfd->minor] = NULL; + vfd->minor = -1; + mutex_unlock(&videodev_lock); + return ret; } /** diff -puN drivers/media/video/vivi.c~git-dvb drivers/media/video/vivi.c --- a/drivers/media/video/vivi.c~git-dvb +++ a/drivers/media/video/vivi.c @@ -986,7 +986,7 @@ static int vidioc_dqbuf (struct file *fi file->f_flags & O_NONBLOCK)); } -#ifdef HAVE_V4L1 +#ifdef CONFIG_V4L1_COMPAT static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) { struct vivi_fh *fh=priv; @@ -1328,7 +1328,7 @@ static struct video_device vivi = { .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, -#ifdef HAVE_V4L1 +#ifdef CONFIG_V4L1_COMPAT .vidiocgmbuf = vidiocgmbuf, #endif .tvnorms = tvnorms, diff -puN include/linux/videodev2.h~git-dvb include/linux/videodev2.h --- a/include/linux/videodev2.h~git-dvb +++ a/include/linux/videodev2.h @@ -716,7 +716,7 @@ struct v4l2_ext_control __s64 value64; void *reserved; }; -}; +} __attribute__ ((packed)); struct v4l2_ext_controls { diff -puN include/linux/videodev.h~git-dvb include/linux/videodev.h --- a/include/linux/videodev.h~git-dvb +++ a/include/linux/videodev.h @@ -12,10 +12,11 @@ #ifndef __LINUX_VIDEODEV_H #define __LINUX_VIDEODEV_H -#define HAVE_V4L1 1 - #include +#ifdef CONFIG_VIDEO_V4L1_COMPAT +#define HAVE_V4L1 1 + struct video_capability { char name[32]; @@ -336,6 +337,8 @@ struct video_code #define VID_HARDWARE_SN9C102 38 #define VID_HARDWARE_ARV 39 +#endif /* CONFIG_VIDEO_V4L1_COMPAT */ + #endif /* __LINUX_VIDEODEV_H */ /* diff -puN include/media/ir-common.h~git-dvb include/media/ir-common.h --- a/include/media/ir-common.h~git-dvb +++ a/include/media/ir-common.h @@ -90,6 +90,7 @@ extern IR_KEYTAB_TYPE ir_codes_winfast[I extern IR_KEYTAB_TYPE ir_codes_pinnacle_color[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE]; extern IR_KEYTAB_TYPE ir_codes_npgtech[IR_KEYTAB_SIZE]; +extern IR_KEYTAB_TYPE ir_codes_norwood[IR_KEYTAB_SIZE]; #endif diff -puN include/media/v4l2-dev.h~git-dvb include/media/v4l2-dev.h --- a/include/media/v4l2-dev.h~git-dvb +++ a/include/media/v4l2-dev.h @@ -9,14 +9,15 @@ #ifndef _V4L2_DEV_H #define _V4L2_DEV_H -#define OBSOLETE_OWNER 1 /* to be removed soon */ +#define OBSOLETE_OWNER 1 /* to be removed soon */ +#define OBSOLETE_DEVDATA 1 /* to be removed soon */ #include #include #include #include #include /* need __user */ -#ifdef CONFIG_VIDEO_V4L1 +#ifdef CONFIG_VIDEO_V4L1_COMPAT #include #else #include @@ -354,6 +355,8 @@ video_device_remove_file(struct video_de class_device_remove_file(&vfd->class_dev, attr); } +#endif /* HAVE_V4L1 */ + #ifdef OBSOLETE_OWNER /* to be removed soon */ /* helper functions to access driver private data. */ static inline void *video_get_drvdata(struct video_device *dev) @@ -365,10 +368,14 @@ static inline void video_set_drvdata(str { dev->priv = data; } + #endif +#ifdef OBSOLETE_DEVDATA /* to be removed soon */ +/* Obsolete stuff - Still needed for radio devices and obsolete drivers */ +extern struct video_device* video_devdata(struct file*); extern int video_exclusive_open(struct inode *inode, struct file *file); extern int video_exclusive_release(struct inode *inode, struct file *file); -#endif /* HAVE_V4L1 */ +#endif #endif /* _V4L2_DEV_H */ _