From 9701dc94a14e54a33c3c99744ec3a761f6385fc6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Sep 2009 09:42:41 -0300 Subject: [PATCH 001/534] V4L/DVB (12770): Add tm6000 driver to staging tree Adds a driver for Trident TV Master tm5600/tm6000 chips. Those USB devices are usually found with a Xceive xc2028/xc3028 tuner, although the firmware seems to be modified to work with those chips on some older devices. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Kconfig | 14 + drivers/staging/tm6000/Makefile | 8 + drivers/staging/tm6000/tm6000-cards.c | 409 ++++++ drivers/staging/tm6000/tm6000-core.c | 633 +++++++++ drivers/staging/tm6000/tm6000-i2c.c | 460 +++++++ drivers/staging/tm6000/tm6000-regs.h | 76 ++ drivers/staging/tm6000/tm6000-usb-isoc.h | 41 + drivers/staging/tm6000/tm6000-video.c | 1559 ++++++++++++++++++++++ drivers/staging/tm6000/tm6000.h | 230 ++++ include/linux/videodev2.h | 1 + 10 files changed, 3431 insertions(+) create mode 100644 drivers/staging/tm6000/Kconfig create mode 100644 drivers/staging/tm6000/Makefile create mode 100644 drivers/staging/tm6000/tm6000-cards.c create mode 100644 drivers/staging/tm6000/tm6000-core.c create mode 100644 drivers/staging/tm6000/tm6000-i2c.c create mode 100644 drivers/staging/tm6000/tm6000-regs.h create mode 100644 drivers/staging/tm6000/tm6000-usb-isoc.h create mode 100644 drivers/staging/tm6000/tm6000-video.c create mode 100644 drivers/staging/tm6000/tm6000.h diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig new file mode 100644 index 000000000000..841e026ecef0 --- /dev/null +++ b/drivers/staging/tm6000/Kconfig @@ -0,0 +1,14 @@ +config VIDEO_TM6000 + tristate "TV Master TM5600/6000 driver" + select VIDEO_V4L2 + select TUNER_XC2028 + select VIDEO_USB_ISOC + select VIDEOBUF_VMALLOC + help + Support for TM5600/TM6000 USB Device + + Since these cards have no MPEG decoder onboard, they transmit + only compressed MPEG data over the usb bus, so you need + an external software decoder to watch TV on your computer. + + Say Y if you own such a device and want to use it. diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile new file mode 100644 index 000000000000..1efc583c10a4 --- /dev/null +++ b/drivers/staging/tm6000/Makefile @@ -0,0 +1,8 @@ +tm6000-objs := tm6000-cards.o \ + tm6000-core.o \ + tm6000-i2c.o \ + tm6000-video.o + +obj-$(CONFIG_VIDEO_TM6000) += tm6000.o + +EXTRA_CFLAGS = -Idrivers/media/video diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c new file mode 100644 index 000000000000..b0719a52ef42 --- /dev/null +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -0,0 +1,409 @@ +/* + tm6000-cards.c - driver for TM5600/TM6000 USB video capture devices + + Copyright (C) 2006-2007 Mauro Carvalho Chehab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tm6000.h" + +#define TM6000_BOARD_UNKNOWN 0 +#define TM5600_BOARD_GENERIC 1 +#define TM6000_BOARD_GENERIC 2 +#define TM5600_BOARD_10MOONS_UT821 3 +#define TM6000_BOARD_10MOONS_UT330 4 +#define TM6000_BOARD_ADSTECH_DUAL_TV 5 + +#define TM6000_MAXBOARDS 16 +static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; + +module_param_array(card, int, NULL, 0444); + +struct tm6000_board { + char *name; + + struct tm6000_capabilities caps; + + int tuner_type; /* type of the tuner */ + int tuner_addr; /* tuner address */ +}; + + +struct tm6000_board tm6000_boards[] = { + [TM6000_BOARD_UNKNOWN] = { + .name = "Unknown tm6000 video grabber", + .caps = { + .has_tuner = 1, + }, + }, + [TM5600_BOARD_GENERIC] = { + .name = "Generic tm5600 board", + .tuner_type = TUNER_XC2028, + .tuner_addr = 0xc2, + .caps = { + .has_tuner = 1, + }, + }, + [TM6000_BOARD_GENERIC] = { + .name = "Generic tm6000 board", + .tuner_type = TUNER_XC2028, + .tuner_addr = 0xc2, + .caps = { + .has_tuner = 1, + .has_dvb = 1, + }, + }, + [TM5600_BOARD_10MOONS_UT821] = { + .name = "10Moons UT 821", + .tuner_type = TUNER_XC2028, + .tuner_addr = 0xc2, + .caps = { + .has_tuner = 1, + .has_eeprom = 1, + }, + }, + [TM6000_BOARD_10MOONS_UT330] = { + .name = "10Moons UT 330", + .tuner_type = TUNER_XC2028, + .tuner_addr = 0xc8, + .caps = { + .has_tuner = 1, + .has_dvb = 1, + .has_zl10353 = 1, + .has_eeprom = 1, + }, + }, + [TM6000_BOARD_ADSTECH_DUAL_TV] = { + .name = "ADSTECH Dual TV USB", + .tuner_type = TUNER_XC2028, + .tuner_addr = 0xc8, + .caps = { + .has_tuner = 1, + .has_tda9874 = 1, + .has_dvb = 1, + .has_zl10353 = 1, + .has_eeprom = 1, + }, + }, +}; + +/* table of devices that work with this driver */ +struct usb_device_id tm6000_id_table [] = { + { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_10MOONS_UT821 }, + { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV }, + { }, +}; + +static int tm6000_init_dev(struct tm6000_core *dev) +{ + struct v4l2_frequency f; + int rc = 0; + + mutex_init(&dev->lock); + + mutex_lock(&dev->lock); + + /* Initializa board-specific data */ + dev->tuner_type = tm6000_boards[dev->model].tuner_type; + dev->tuner_addr = tm6000_boards[dev->model].tuner_addr; + + dev->caps = tm6000_boards[dev->model].caps; + + /* initialize hardware */ + rc=tm6000_init (dev); + if (rc<0) + goto err; + + /* register i2c bus */ + rc=tm6000_i2c_register(dev); + if (rc<0) + goto err; + + /* register and initialize V4L2 */ + rc=tm6000_v4l2_register(dev); + if (rc<0) + goto err; + + /* Request tuner */ + request_module ("tuner"); +// norm=V4L2_STD_NTSC_M; + dev->norm=V4L2_STD_PAL_M; + tm6000_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm); + + /* configure tuner */ + f.tuner = 0; + f.type = V4L2_TUNER_ANALOG_TV; + f.frequency = 3092; /* 193.25 MHz */ + dev->freq = f.frequency; + + tm6000_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); + +err: + mutex_unlock(&dev->lock); + return rc; +} + +/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */ +#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) + +static void get_max_endpoint ( struct usb_device *usbdev, + char *msgtype, + struct usb_host_endpoint *curr_e, + unsigned int *maxsize, + struct usb_host_endpoint **ep ) +{ + u16 tmp = le16_to_cpu(curr_e->desc.wMaxPacketSize); + unsigned int size = tmp & 0x7ff; + + if (usbdev->speed == USB_SPEED_HIGH) + size = size * hb_mult (tmp); + + if (size>*maxsize) { + *ep = curr_e; + *maxsize = size; + printk("tm6000: %s endpoint: 0x%02x (max size=%u bytes)\n", + msgtype, curr_e->desc.bEndpointAddress, + size); + } +} + +/* + * tm6000_usb_probe() + * checks for supported devices + */ +static int tm6000_usb_probe(struct usb_interface *interface, + const struct usb_device_id *id) +{ + struct usb_device *usbdev; + struct tm6000_core *dev = NULL; + int i,rc=0; + int nr=0; + char *speed; + + + usbdev=usb_get_dev(interface_to_usbdev(interface)); + + /* Selects the proper interface */ + rc=usb_set_interface(usbdev,0,1); + if (rc<0) + goto err; + + /* Check to see next free device and mark as used */ + nr=find_first_zero_bit(&tm6000_devused,TM6000_MAXBOARDS); + if (nr >= TM6000_MAXBOARDS) { + printk ("tm6000: Supports only %i em28xx boards.\n",TM6000_MAXBOARDS); + usb_put_dev(usbdev); + return -ENOMEM; + } + + /* Create and initialize dev struct */ + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (dev == NULL) { + printk ("tm6000" ": out of memory!\n"); + usb_put_dev(usbdev); + return -ENOMEM; + } + spin_lock_init(&dev->slock); + + /* Increment usage count */ + tm6000_devused|=1<udev= usbdev; + dev->model=id->driver_info; + snprintf(dev->name, 29, "tm6000 #%d", nr); + dev->devno=nr; + + switch (usbdev->speed) { + case USB_SPEED_LOW: + speed = "1.5"; + break; + case USB_SPEED_UNKNOWN: + case USB_SPEED_FULL: + speed = "12"; + break; + case USB_SPEED_HIGH: + speed = "480"; + break; + default: + speed = "unknown"; + } + + + + /* Get endpoints */ + for (i = 0; i < interface->num_altsetting; i++) { + int ep; + + for (ep = 0; ep < interface->altsetting[i].desc.bNumEndpoints; ep++) { + struct usb_host_endpoint *e; + int dir_out; + + e = &interface->altsetting[i].endpoint[ep]; + + dir_out = ((e->desc.bEndpointAddress & + USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); + + printk("tm6000: alt %d, interface %i, class %i\n", + i, + interface->altsetting[i].desc.bInterfaceNumber, + interface->altsetting[i].desc.bInterfaceClass); + + switch (e->desc.bmAttributes) { + case USB_ENDPOINT_XFER_BULK: + if (!dir_out) { + get_max_endpoint (usbdev, "Bulk IN", e, + &dev->max_bulk_in, + &dev->bulk_in); + } else { + get_max_endpoint (usbdev, "Bulk OUT", e, + &dev->max_bulk_out, + &dev->bulk_out); + } + break; + case USB_ENDPOINT_XFER_ISOC: + if (!dir_out) { + get_max_endpoint (usbdev, "ISOC IN", e, + &dev->max_isoc_in, + &dev->isoc_in); + } else { + get_max_endpoint (usbdev, "ISOC OUT", e, + &dev->max_isoc_out, + &dev->isoc_out); + } + break; + } + } + } + + if (interface->altsetting->desc.bAlternateSetting) { + printk("selecting alt setting %d\n", + interface->altsetting->desc.bAlternateSetting); + rc = usb_set_interface (usbdev, + interface->altsetting->desc.bInterfaceNumber, + interface->altsetting->desc.bAlternateSetting); + if (rc<0) + goto err; + } + + printk("tm6000: New video device @ %s Mbps (%04x:%04x, ifnum %d)\n", + speed, + le16_to_cpu(dev->udev->descriptor.idVendor), + le16_to_cpu(dev->udev->descriptor.idProduct), + interface->altsetting->desc.bInterfaceNumber); + +/* check if the the device has the iso in endpoint at the correct place */ + if (!dev->isoc_in) { + printk("tm6000: probing error: no IN ISOC endpoint!\n"); + rc= -ENODEV; + + goto err; + } + + /* save our data pointer in this interface device */ + usb_set_intfdata(interface, dev); + + printk("tm6000: Found %s\n", tm6000_boards[dev->model].name); + + rc=tm6000_init_dev(dev); + + if (rc<0) + goto err; + + return 0; + +err: + tm6000_devused&=~(1<name); + + mutex_lock(&dev->lock); + + tm6000_i2c_unregister(dev); + + tm6000_v4l2_unregister(dev); + +// wake_up_interruptible_all(&dev->open); + + dev->state |= DEV_DISCONNECTED; + + mutex_unlock(&dev->lock); +} + +static struct usb_driver tm6000_usb_driver = { + .name = "tm6000", + .probe = tm6000_usb_probe, + .disconnect = tm6000_usb_disconnect, + .id_table = tm6000_id_table, +}; + +static int __init tm6000_module_init(void) +{ + int result; + + printk(KERN_INFO "tm6000" " v4l2 driver version %d.%d.%d loaded\n", + (TM6000_VERSION >> 16) & 0xff, + (TM6000_VERSION >> 8) & 0xff, TM6000_VERSION & 0xff); + + /* register this driver with the USB subsystem */ + result = usb_register(&tm6000_usb_driver); + if (result) + printk("tm6000" + " usb_register failed. Error number %d.\n", result); + + return result; +} + +static void __exit tm6000_module_exit(void) +{ + /* deregister at USB subsystem */ + usb_deregister(&tm6000_usb_driver); +} + +module_init(tm6000_module_init); +module_exit(tm6000_module_exit); + +MODULE_DESCRIPTION("Trident TVMaster TM5600/TM6000 USB2 adapter"); +MODULE_AUTHOR("Mauro Carvalho Chehab"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c new file mode 100644 index 000000000000..ea26f0daa82f --- /dev/null +++ b/drivers/staging/tm6000/tm6000-core.c @@ -0,0 +1,633 @@ +/* + tm6000-core.c - driver for TM5600/TM6000 USB video capture devices + + Copyright (C) 2006-2007 Mauro Carvalho Chehab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include "tm6000.h" +#include "tm6000-regs.h" +#include +#include + +#ifdef HACK /* HACK */ +#include "tm6000-hack.c" +#endif + +#define USB_TIMEOUT 5*HZ /* ms */ + +int tm6000_read_write_usb (struct tm6000_core *dev, u8 req_type, u8 req, + u16 value, u16 index, u8 *buf, u16 len) +{ + int ret, i; + unsigned int pipe; + static int ini=0, last=0, n=0; + u8 *data=NULL; + + if (len) + data = kzalloc(len, GFP_KERNEL); + + + if (req_type & USB_DIR_IN) + pipe=usb_rcvctrlpipe(dev->udev, 0); + else { + pipe=usb_sndctrlpipe(dev->udev, 0); + memcpy(data, buf, len); + } + + if (tm6000_debug & V4L2_DEBUG_I2C) { + if (!ini) + last=ini=jiffies; + + printk("%06i (dev %p, pipe %08x): ", n, dev->udev, pipe); + + printk( "%s: %06u ms %06u ms %02x %02x %02x %02x %02x %02x %02x %02x ", + (req_type & USB_DIR_IN)?" IN":"OUT", + jiffies_to_msecs(jiffies-last), + jiffies_to_msecs(jiffies-ini), + req_type, req,value&0xff,value>>8, index&0xff, index>>8, + len&0xff, len>>8); + last=jiffies; + n++; + + if ( !(req_type & USB_DIR_IN) ) { + printk(">>> "); + for (i=0;iudev, pipe, req, req_type, value, index, data, + len, USB_TIMEOUT); + + if (req_type & USB_DIR_IN) + memcpy(buf, data, len); + + if (tm6000_debug & V4L2_DEBUG_I2C) { + if (ret<0) { + if (req_type & USB_DIR_IN) + printk("<<< (len=%d)\n",len); + + printk("%s: Error #%d\n", __FUNCTION__, ret); + } else if (req_type & USB_DIR_IN) { + printk("<<< "); + for (i=0;ifourcc==V4L2_PIX_FMT_UYVY) { + /* Sets driver to UYUV */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0xd0); + } else { + /* Sets driver to YUV2 */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0x90); + } +} + +int tm6000_init_analog_mode (struct tm6000_core *dev) +{ + + /* Enables soft reset */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); + + if (dev->scaler) { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc0, 0x20); + } else { + /* Enable Hfilter and disable TS Drop err */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc0, 0x80); + } + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc3, 0x88); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xda, 0x23); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd1, 0xc0); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd2, 0xd8); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd6, 0x06); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); + + /* AP Software reset */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xff, 0x08); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xff, 0x00); + + tm6000_set_fourcc_format(dev); + + /* Disables soft reset */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); + + /* E3: Select input 0 - TV tuner */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); + + /* Tuner firmware can now be loaded */ + + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_1, 0x00); + msleep(11); + + /* This controls input */ + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_2, 0x0); + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_3, 0x01); + msleep(20); + + /*FIXME: Hack!!! */ + struct v4l2_frequency f; + mutex_lock(&dev->lock); + f.frequency=dev->freq; + tm6000_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); + mutex_unlock(&dev->lock); + + msleep(100); + tm6000_set_standard (dev, &dev->norm); + tm6000_set_audio_bitrate (dev,48000); + + + return 0; +} + + +/* The meaning of those initializations are unknown */ +u8 init_tab[][2] = { + /* REG VALUE */ + { 0xdf, 0x1f }, + { 0xff, 0x08 }, + { 0xff, 0x00 }, + { 0xd5, 0x4f }, + { 0xda, 0x23 }, + { 0xdb, 0x08 }, + { 0xe2, 0x00 }, + { 0xe3, 0x10 }, + { 0xe5, 0x00 }, + { 0xe8, 0x00 }, + { 0xeb, 0x64 }, /* 48000 bits/sample, external input */ + { 0xee, 0xc2 }, + { 0x3f, 0x01 }, /* Start of soft reset */ + { 0x00, 0x00 }, + { 0x01, 0x07 }, + { 0x02, 0x5f }, + { 0x03, 0x00 }, + { 0x05, 0x64 }, + { 0x07, 0x01 }, + { 0x08, 0x82 }, + { 0x09, 0x36 }, + { 0x0a, 0x50 }, + { 0x0c, 0x6a }, + { 0x11, 0xc9 }, + { 0x12, 0x07 }, + { 0x13, 0x3b }, + { 0x14, 0x47 }, + { 0x15, 0x6f }, + { 0x17, 0xcd }, + { 0x18, 0x1e }, + { 0x19, 0x8b }, + { 0x1a, 0xa2 }, + { 0x1b, 0xe9 }, + { 0x1c, 0x1c }, + { 0x1d, 0xcc }, + { 0x1e, 0xcc }, + { 0x1f, 0xcd }, + { 0x20, 0x3c }, + { 0x21, 0x3c }, + { 0x2d, 0x48 }, + { 0x2e, 0x88 }, + { 0x30, 0x22 }, + { 0x31, 0x61 }, + { 0x32, 0x74 }, + { 0x33, 0x1c }, + { 0x34, 0x74 }, + { 0x35, 0x1c }, + { 0x36, 0x7a }, + { 0x37, 0x26 }, + { 0x38, 0x40 }, + { 0x39, 0x0a }, + { 0x42, 0x55 }, + { 0x51, 0x11 }, + { 0x55, 0x01 }, + { 0x57, 0x02 }, + { 0x58, 0x35 }, + { 0x59, 0xa0 }, + { 0x80, 0x15 }, + { 0x82, 0x42 }, + { 0xc1, 0xd0 }, + { 0xc3, 0x88 }, + { 0x3f, 0x00 }, /* End of the soft reset */ +}; + +int tm6000_init (struct tm6000_core *dev) +{ + int board, rc=0, i; + +#ifdef HACK /* HACK */ + init_tm6000(dev); + return 0; +#else + + /* Load board's initialization table */ + for (i=0; i< ARRAY_SIZE(init_tab); i++) { + rc= tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, + init_tab[i][0],init_tab[i][1]); + if (rc<0) { + printk (KERN_ERR "Error %i while setting reg %d to value %d\n", + rc, init_tab[i][0],init_tab[i][1]); + return rc; + } + } + + /* Check board version - maybe 10Moons specific */ + board=tm6000_get_reg16 (dev, 0x40, 0, 0); + if (board >=0) { + printk (KERN_INFO "Board version = 0x%04x\n",board); + } else { + printk (KERN_ERR "Error %i while retrieving board version\n",board); + } + + tm6000_set_reg (dev, REQ_05_SET_GET_USBREG, 0x18, 0x00); + msleep(5); /* Just to be conservative */ + + /* Reset GPIO1. Maybe, this is 10 Moons specific */ + for (i=0; i< 3; i++) { + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_1, 0); + if (rc<0) { + printk (KERN_ERR "Error %i doing GPIO1 reset\n",rc); + return rc; + } + + msleep(10); /* Just to be conservative */ + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_1, 1); + if (rc<0) { + printk (KERN_ERR "Error %i doing GPIO1 reset\n",rc); + return rc; + } + + if (!i) + rc=tm6000_get_reg16(dev, 0x40,0,0); + } + return 0; + +#endif /* HACK */ +} + +#define tm6000_wrt(dev,req,reg,val, data...) \ + { const static u8 _val[] = data; \ + tm6000_read_write_usb(dev,USB_DIR_OUT | USB_TYPE_VENDOR, \ + req,reg, val, (u8 *) _val, ARRAY_SIZE(_val)); \ + } + +/* +TM5600/6000 register values to set video standards. + There's an adjust, common to all, for composite video + Additional adjustments are required for S-Video, based on std. + + Standards values for TV S-Video Changes +REG PAL PAL_M PAL_N SECAM NTSC Comp. PAL PAL_M PAL_N SECAM NTSC +0xdf 0x1f 0x1f 0x1f 0x1f 0x1f +0xe2 0x00 0x00 0x00 0x00 0x00 +0xe8 0x0f 0x0f 0x0f 0x0f 0x0f 0x00 0x00 0x00 0x00 0x00 +0xeb 0x60 0x60 0x60 0x60 0x60 0x64 0x64 0x64 0x64 0x64 0x64 +0xd5 0x5f 0x5f 0x5f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f +0xe3 0x00 0x00 0x00 0x00 0x00 0x10 0x10 0x10 0x10 0x10 0x10 +0xe5 0x00 0x00 0x00 0x00 0x00 0x10 0x10 0x10 0x10 0x10 +0x3f 0x01 0x01 0x01 0x01 0x01 +0x00 0x32 0x04 0x36 0x38 0x00 0x33 0x05 0x37 0x39 0x01 +0x01 0x0e 0x0e 0x0e 0x0e 0x0f +0x02 0x5f 0x5f 0x5f 0x5f 0x5f +0x03 0x02 0x00 0x02 0x02 0x00 0x04 0x04 0x04 0x03 0x03 +0x07 0x01 0x01 0x01 0x01 0x01 0x00 0x00 +0x17 0xcd 0xcd 0xcd 0xcd 0xcd 0x8b +0x18 0x25 0x1e 0x1e 0x24 0x1e +0x19 0xd5 0x83 0x91 0x92 0x8b +0x1a 0x63 0x0a 0x1f 0xe8 0xa2 +0x1b 0x50 0xe0 0x0c 0xed 0xe9 +0x1c 0x1c 0x1c 0x1c 0x1c 0x1c +0x1d 0xcc 0xcc 0xcc 0xcc 0xcc +0x1e 0xcc 0xcc 0xcc 0xcc 0xcc +0x1f 0xcd 0xcd 0xcd 0xcd 0xcd +0x2e 0x8c 0x88 0x8c 0x8c 0x88 0x88 +0x30 0x2c 0x20 0x2c 0x2c 0x22 0x2a 0x22 0x22 0x2a +0x31 0xc1 0x61 0xc1 0xc1 0x61 +0x33 0x0c 0x0c 0x0c 0x2c 0x1c +0x35 0x1c 0x1c 0x1c 0x18 0x1c +0x82 0x52 0x52 0x52 0x42 0x42 +0x04 0xdc 0xdc 0xdc 0xdd +0x0d 0x07 0x07 0x07 0x87 0x07 +0x3f 0x00 0x00 0x00 0x00 0x00 +*/ + +int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm) +{ + dev->norm=*norm; + + /* HACK: Should use, instead, the common code!!! */ + if (*norm & V4L2_STD_PAL_M) { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe2, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe8, 0x0f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x5f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe5, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x04); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0e); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x02, 0x5f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x07, 0x01); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x1e); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x83); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x0a); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0xe0); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1c, 0x1c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1d, 0xcc); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1e, 0xcc); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1f, 0xcd); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x88); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x20); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x31, 0x61); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x0c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x1c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x52); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x04, 0xdc); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x07); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); + return 0; + } + + /* */ +// tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x02, 0x01); +// tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x02, 0x00); + + /* Set registers common to all standards */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe2, 0x00); + + switch (dev->input) { + case TM6000_INPUT_TV: + /* Seems to disable ADC2 - needed for TV and RCA */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe8, 0x0f); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); + + if (*norm & V4L2_STD_PAL) { + /* Enable UV_FLT_EN */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x5f); + } else { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x4f); + } + + /* E3: Select input 0 */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe5, 0x10); + + break; + case TM6000_INPUT_COMPOSITE: + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x64); + /* E3: Select input 1 */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x10); + break; + case TM6000_INPUT_SVIDEO: + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe8, 0x00); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x64); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x4f); + /* E3: Select input 1 */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x10); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe5, 0x10); + + break; + } + + /* Software reset */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x02, 0x5f); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x07, 0x01); +// tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x17, 0xcd); + + /* Horizontal Sync DTO = 0x1ccccccd */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1c, 0x1c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1d, 0xcc); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1e, 0xcc); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1f, 0xcd); + + /* Vertical Height */ + if (*norm & V4L2_STD_525_60) { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x31, 0x61); + } else { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x31, 0xc1); + } + + /* Horizontal Length */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2f, 640/8); + + if (*norm & V4L2_STD_PAL) { + /* Common to All PAL Standards */ + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0e); + + /* Vsync Hsinc Lockout End */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x0c); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x1c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x52); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x04, 0xdc); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x07); + if (*norm & V4L2_STD_PAL_M) { + + /* Chroma DTO */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x1e); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x83); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x0a); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0xe0); + + /* Active Video Horiz Start Time */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x88); + + if (dev->input==TM6000_INPUT_SVIDEO) { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x05); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x04); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x22); + } else { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x04); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x20); + } + } else if (*norm & V4L2_STD_PAL_N) { + /* Chroma DTO */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x1e); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x91); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x1f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0x0c); + + if (dev->input==TM6000_INPUT_SVIDEO) { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x37); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x04); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x88); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x22); + } else { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x36); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x02); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x8c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); + } + } else { // Other PAL standards + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x25); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0xd5); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x63); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0x50); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x8c); + + if (dev->input==TM6000_INPUT_SVIDEO) { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x33); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x04); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2a); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); + } else { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x32); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x02); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); + } + } + } if (*norm & V4L2_STD_SECAM) { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0e); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x24); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x92); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0xe8); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0xed); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x8c); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x2c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x18); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x42); + // Register 0x04 is not initialized on SECAM + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x87); + + if (dev->input==TM6000_INPUT_SVIDEO) { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x39); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x03); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2a); + } else { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x38); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x02); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); + } + } else { /* NTSC */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x1e); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x8b); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0xa2); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0xe9); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x88); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x22); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x1c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x1c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x42); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x07); + if (dev->input==TM6000_INPUT_SVIDEO) { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x01); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x03); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x07, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x17, 0x8b); + } else { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x00); + } + } + + + /* End of software reset */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); + + msleep(40); + + return 0; +} + +int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate) +{ + int val; + + val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x0); +printk("Original value=%d\n",val); + if (val<0) + return val; + + val &= 0x0f; /* Preserve the audio input control bits */ + switch (bitrate) { + case 44100: + val|=0xd0; + break; + case 48000: + val|=0x60; + break; + } + val=tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, val); + + return val; +} diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c new file mode 100644 index 000000000000..5e165ed25eee --- /dev/null +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -0,0 +1,460 @@ +/* + tm6000-i2c.c - driver for TM5600/TM6000 USB video capture devices + + Copyright (C) 2006-2007 Mauro Carvalho Chehab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +#include "tm6000.h" +#include "tm6000-regs.h" +#include +#include +#include "tuner-xc2028.h" + + +/*FIXME: Hack to avoid needing to patch i2c-id.h */ +#define I2C_HW_B_TM6000 I2C_HW_B_EM28XX +/* ----------------------------------------------------------- */ + +static unsigned int i2c_scan = 0; +module_param(i2c_scan, int, 0444); +MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); + +static unsigned int i2c_debug = 0; +module_param(i2c_debug, int, 0644); +MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); + +#define i2c_dprintk(lvl,fmt, args...) if (i2c_debug>=lvl) do{ \ + printk(KERN_DEBUG "%s at %s: " fmt, \ + dev->name, __FUNCTION__ , ##args); } while (0) + + +/* Returns 0 if address is found */ +static int tm6000_i2c_scan(struct i2c_adapter *i2c_adap, int addr) +{ + struct tm6000_core *dev = i2c_adap->algo_data; + +#if 1 + /* HACK: i2c scan is not working yet */ + if ( + (dev->caps.has_tuner && (addr==dev->tuner_addr)) || + (dev->caps.has_tda9874 && (addr==0xb0)) || + (dev->caps.has_zl10353 && (addr==0x1e)) || + (dev->caps.has_eeprom && (addr==0xa0)) + ) { + printk("Hack: enabling device at addr 0x%02x\n",addr); + return (1); + } else { + return -ENODEV; + } +#else + int rc=-ENODEV; + char buf[1]; + + /* This sends addr + 1 byte with 0 */ + rc = tm6000_read_write_usb (dev, + USB_DIR_IN | USB_TYPE_VENDOR, + REQ_16_SET_GET_I2CSEQ, + addr, 0, + buf, 0); + msleep(10); + + if (rc<0) { + if (i2c_debug>=2) + printk("no device at addr 0x%02x\n",addr); + } + + printk("Hack: check on addr 0x%02x returned %d\n",addr,rc); + + return rc; +#endif +} + +static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, + struct i2c_msg msgs[], int num) +{ + struct tm6000_core *dev = i2c_adap->algo_data; + int addr, rc, i, byte; + + if (num <= 0) + return 0; + for (i = 0; i < num; i++) { + addr = (msgs[i].addr << 1) &0xff; + i2c_dprintk(2,"%s %s addr=0x%x len=%d:", + (msgs[i].flags & I2C_M_RD) ? "read" : "write", + i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); + + if (!msgs[i].len) { + /* Do I2C scan */ + rc=tm6000_i2c_scan(i2c_adap, addr); + } else if (msgs[i].flags & I2C_M_RD) { + char buf[msgs[i].len]; + memcpy(buf,msgs[i].buf, msgs[i].len-1); + buf[msgs[i].len-1]=0; + + /* Read bytes */ + /* I2C is assumed to have always a subaddr at the first byte of the + message bus. Also, the first i2c value of the answer is returned + out of message data. + */ + rc = tm6000_read_write_usb (dev, + USB_DIR_IN | USB_TYPE_VENDOR, + REQ_16_SET_GET_I2CSEQ, + addr|(*msgs[i].buf)<<8, 0, + msgs[i].buf, msgs[i].len); + if (i2c_debug>=2) { + for (byte = 0; byte < msgs[i].len; byte++) { + printk(" %02x", msgs[i].buf[byte]); + } + } + } else { + /* write bytes */ + if (i2c_debug>=2) { + for (byte = 0; byte < msgs[i].len; byte++) + printk(" %02x", msgs[i].buf[byte]); + } + + rc = tm6000_read_write_usb (dev, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_16_SET_GET_I2CSEQ, + addr|(*msgs[i].buf)<<8, 0, + msgs[i].buf+1, msgs[i].len-1); + } + if (i2c_debug>=2) + printk("\n"); + if (rc < 0) + goto err; + } + + return num; +err: + i2c_dprintk(2," ERROR: %i\n", rc); + return rc; +} + + +static int tm6000_i2c_eeprom( struct tm6000_core *dev, + unsigned char *eedata, int len ) +{ + int i, rc; + unsigned char *p = eedata; + unsigned char bytes[17]; + + dev->i2c_client.addr = 0xa0 >> 1; + +//006779: OUT: 000006 ms 089867 ms c0 0e a0 00 00 00 01 00 <<< 00 +//006780: OUT: 000005 ms 089873 ms c0 10 a0 00 00 00 01 00 <<< 00 +//006781: OUT: 000108 ms 089878 ms 40 0e a0 00 00 00 01 00 >>> 99 +//006782: OUT: 000015 ms 089986 ms c0 0e a0 00 01 00 01 00 <<< 99 +//006783: OUT: 000004 ms 090001 ms c0 0e a0 00 10 00 01 00 <<< 99 +//006784: OUT: 000005 ms 090005 ms 40 10 a0 00 00 00 01 00 >>> 00 +//006785: OUT: 000308 ms 090010 ms 40 0e a0 00 00 00 01 00 >>> 00 + + + for (i = 0; i < len; i++) { + bytes[0x14+i] = 0; + + rc = i2c_master_recv(&dev->i2c_client, p, 1); + if (rc<1) { + if (p==eedata) { + printk (KERN_WARNING "%s doesn't have eeprom", + dev->name); + } else { + printk(KERN_WARNING + "%s: i2c eeprom read error (err=%d)\n", + dev->name, rc); + } + return -1; + } + p++; + if (0 == (i % 16)) + printk(KERN_INFO "%s: i2c eeprom %02x:", dev->name, i); + printk(" %02x", eedata[i]); + if ((eedata[i]>=' ')&&(eedata[i]<='z')) { + bytes[i%16]=eedata[i]; + } else { + bytes[i%16]='.'; + } + if (15 == (i % 16)) { + bytes[i%16]='\0'; + printk(" %s\n", bytes); + } + } + if ((i%16)!=15) { + bytes[i%16]='\0'; + printk(" %s\n", bytes); + } + return 0; +} + +/* ----------------------------------------------------------- */ + +/* + * algo_control() + */ +static int algo_control(struct i2c_adapter *adapter, + unsigned int cmd, unsigned long arg) +{ + return 0; +} + +/* + * functionality() + */ +static u32 functionality(struct i2c_adapter *adap) +{ + return I2C_FUNC_SMBUS_EMUL; +} + +#ifndef I2C_PEC +static void inc_use(struct i2c_adapter *adap) +{ + MOD_INC_USE_COUNT; +} + +static void dec_use(struct i2c_adapter *adap) +{ + MOD_DEC_USE_COUNT; +} +#endif + +#define mass_write(addr, reg, data...) \ + { const static u8 _val[] = data; \ + rc=tm6000_read_write_usb(dev,USB_DIR_OUT | USB_TYPE_VENDOR, \ + REQ_16_SET_GET_I2CSEQ,(reg<<8)+addr, 0x00, (u8 *) _val, \ + ARRAY_SIZE(_val)); \ + if (rc<0) { \ + printk(KERN_ERR "Error on line %d: %d\n",__LINE__,rc); \ + return rc; \ + } \ + msleep (10); \ + } + +int static init_zl10353 (struct tm6000_core *dev, u8 addr) +{ + int rc=0; + + mass_write (addr, 0x89, { 0x38 }); + mass_write (addr, 0x8a, { 0x2d }); + mass_write (addr, 0x50, { 0xff }); + mass_write (addr, 0x51, { 0x00 , 0x00 , 0x50 }); + mass_write (addr, 0x54, { 0x72 , 0x49 }); + mass_write (addr, 0x87, { 0x0e , 0x0e }); + mass_write (addr, 0x7b, { 0x04 }); + mass_write (addr, 0x57, { 0xb8 , 0xc2 }); + mass_write (addr, 0x59, { 0x00 , 0x02 , 0x00 , 0x00 , 0x01 }); + mass_write (addr, 0x59, { 0x00 , 0x00 , 0xb3 , 0xd0 , 0x01 }); + mass_write (addr, 0x58, { 0xc0 , 0x11 , 0xc5 , 0xc2 , 0xa4 , 0x01 }); + mass_write (addr, 0x5e, { 0x01 }); + mass_write (addr, 0x67, { 0x1c , 0x20 }); + mass_write (addr, 0x75, { 0x33 }); + mass_write (addr, 0x85, { 0x10 , 0x40 }); + mass_write (addr, 0x8c, { 0x0b , 0x00 , 0x40 , 0x00 }); + + return 0; +} + +/* Tuner callback to provide the proper gpio changes needed for xc2028 */ + +static int tm6000_tuner_callback(void *ptr, int command, int arg) +{ + int rc=0; + struct tm6000_core *dev = ptr; + + if (dev->tuner_type!=TUNER_XC2028) + return 0; + + switch (command) { + case XC2028_RESET_CLK: + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, + 0x02, arg); + msleep(10); + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_CLK, 0); + if (rc<0) + return rc; + msleep(10); + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_CLK, 1); + break; + case XC2028_TUNER_RESET: + /* Reset codes during load firmware */ + switch (arg) { + case 0: + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_1, 0x00); + msleep(10); + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_1, 0x01); + break; + case 1: + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, + 0x02, 0x01); + msleep(10); + break; + + case 2: + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_CLK, 0); + if (rc<0) + return rc; + msleep(10); + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_CLK, 1); + break; + } + } + return (rc); +} + +static int attach_inform(struct i2c_client *client) +{ + struct tm6000_core *dev = client->adapter->algo_data; + struct tuner_setup tun_setup; + unsigned char eedata[11]; + + i2c_dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", + client->driver->driver.name, client->addr, client->name); + + switch (client->addr<<1) { + case 0x1e: + init_zl10353 (dev, client->addr); + return 0; + case 0xa0: + tm6000_i2c_eeprom(dev, eedata, sizeof(eedata)-1); + eedata[sizeof(eedata)]='\0'; + + printk("Board string ID = %s\n",eedata); + return 0; + case 0xb0: + request_module("tvaudio"); + return 0; + } + + /* If tuner, initialize the tuner part */ + if ( dev->tuner_addr != client->addr<<1 ) { + return 0; + } + + memset (&tun_setup, 0, sizeof(tun_setup)); + + tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; + tun_setup.type = dev->tuner_type; + tun_setup.addr = dev->tuner_addr>>1; + tun_setup.tuner_callback = tm6000_tuner_callback; + + client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup); + + return 0; +} + +static struct i2c_algorithm tm6000_algo = { + .master_xfer = tm6000_i2c_xfer, + .algo_control = algo_control, + .functionality = functionality, +}; + +static struct i2c_adapter tm6000_adap_template = { +#ifdef I2C_PEC + .owner = THIS_MODULE, +#else + .inc_use = inc_use, + .dec_use = dec_use, +#endif + .class = I2C_CLASS_TV_ANALOG, + .name = "tm6000", + .id = I2C_HW_B_TM6000, + .algo = &tm6000_algo, + .client_register = attach_inform, +}; + +static struct i2c_client tm6000_client_template = { + .name = "tm6000 internal", +}; + +/* ----------------------------------------------------------- */ + +/* + * i2c_devs + * incomplete list of known devices + */ +static char *i2c_devs[128] = { + [0xc2 >> 1] = "tuner (analog)", +}; + +/* + * do_i2c_scan() + * check i2c address range for devices + */ +static void do_i2c_scan(char *name, struct i2c_client *c) +{ + unsigned char buf; + int i, rc; + + for (i = 0; i < 128; i++) { + c->addr = i; + rc = i2c_master_recv(c, &buf, 0); + if (rc < 0) + continue; + printk(KERN_INFO "%s: found i2c device @ 0x%x [%s]\n", name, + i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); + } +} + +/* + * tm6000_i2c_call_clients() + * send commands to all attached i2c devices + */ +void tm6000_i2c_call_clients(struct tm6000_core *dev, unsigned int cmd, void *arg) +{ + BUG_ON(NULL == dev->i2c_adap.algo_data); + i2c_clients_command(&dev->i2c_adap, cmd, arg); +} + +/* + * tm6000_i2c_register() + * register i2c bus + */ +int tm6000_i2c_register(struct tm6000_core *dev) +{ + dev->i2c_adap = tm6000_adap_template; + dev->i2c_adap.dev.parent = &dev->udev->dev; + strcpy(dev->i2c_adap.name, dev->name); + dev->i2c_adap.algo_data = dev; + i2c_add_adapter(&dev->i2c_adap); + + dev->i2c_client = tm6000_client_template; + dev->i2c_client.adapter = &dev->i2c_adap; + + if (i2c_scan) + do_i2c_scan(dev->name, &dev->i2c_client); + + return 0; +} + +/* + * tm6000_i2c_unregister() + * unregister i2c_bus + */ +int tm6000_i2c_unregister(struct tm6000_core *dev) +{ + i2c_del_adapter(&dev->i2c_adap); + return 0; +} diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h new file mode 100644 index 000000000000..414852e69fce --- /dev/null +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -0,0 +1,76 @@ +/* + tm6000-regs.h - driver for TM5600/TM6000 USB video capture devices + + Copyright (C) 2006-2007 Mauro Carvalho Chehab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Define TV Master TM5600/TM6000 Request codes + */ +#define REQ_00_SET_IR_VALUE 0 +#define REQ_01_SET_WAKEUP_IRCODE 1 +#define REQ_02_GET_IR_CODE 2 +#define REQ_03_SET_GET_MCU_PIN 3 +#define REQ_04_EN_DISABLE_MCU_INT 4 +#define REQ_05_SET_GET_USBREG 5 + /* Write: RegNum, Value, 0 */ + /* Read : RegNum, Value, 1, RegStatus */ +#define REQ_06_SET_GET_USBREG_BIT 6 +#define REQ_07_SET_GET_AVREG 7 + /* Write: RegNum, Value, 0 */ + /* Read : RegNum, Value, 1, RegStatus */ +#define REQ_08_SET_GET_AVREG_BIT 8 +#define REQ_09_SET_GET_TUNER_FQ 9 +#define REQ_10_SET_TUNER_SYSTEM 10 +#define REQ_11_SET_EEPROM_ADDR 11 +#define REQ_12_SET_GET_EEPROMBYTE 12 +#define REQ_13_GET_EEPROM_SEQREAD 13 +#define REQ_14_SET_GET_EEPROM_PAGE 14 +#define REQ_15_SET_GET_I2CBYTE 15 + /* Write: Subaddr, Slave Addr, value, 0 */ + /* Read : Subaddr, Slave Addr, value, 1 */ +#define REQ_16_SET_GET_I2CSEQ 16 + /* Subaddr, Slave Addr, 0, length */ +#define REQ_17_SET_GET_I2CFP 17 + /* Write: Slave Addr, register, value */ + /* Read : Slave Addr, register, 2, data */ + +/* + * Define TV Master TM5600/TM6000 GPIO lines + */ + +#define TM6000_GPIO_CLK 0x101 +#define TM6000_GPIO_DATA 0x100 +#define TM6000_GPIO_1 0x102 +#define TM6000_GPIO_2 0x103 +#define TM6000_GPIO_3 0x104 +#define TM6000_GPIO_4 0x300 +#define TM6000_GPIO_5 0x301 +#define TM6000_GPIO_6 0x304 +#define TM6000_GPIO_7 0x305 + +/* + * Define TV Master TM5600/TM6000 URB message codes and length + */ + +#define TM6000_URB_MSG_LEN 180 +enum { + TM6000_URB_MSG_VIDEO=1, + TM6000_URB_MSG_AUDIO, + TM6000_URB_MSG_VBI, + TM6000_URB_MSG_PTS, + TM6000_URB_MSG_ERR, +}; diff --git a/drivers/staging/tm6000/tm6000-usb-isoc.h b/drivers/staging/tm6000/tm6000-usb-isoc.h new file mode 100644 index 000000000000..27b103f939d9 --- /dev/null +++ b/drivers/staging/tm6000/tm6000-usb-isoc.h @@ -0,0 +1,41 @@ +/* + tm6000-buf.c - driver for TM5600/TM6000 USB video capture devices + + Copyright (C) 2006-2007 Mauro Carvalho Chehab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +struct usb_isoc_ctl { + /* max packet size of isoc transaction */ + int max_pkt_size; + + /* number of allocated urbs */ + int num_bufs; + + /* urb for isoc transfers */ + struct urb **urb; + + /* transfer buffers for isoc transfer */ + char **transfer_buffer; + + /* Last buffer command and region */ + u8 cmd; + int pos, size, pktsize; + + /* Last field: ODD or EVEN? */ + int field; +}; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c new file mode 100644 index 000000000000..970f3a11308d --- /dev/null +++ b/drivers/staging/tm6000/tm6000-video.c @@ -0,0 +1,1559 @@ +/* + tm6000-video.c - driver for TM5600/TM6000 USB video capture devices + + Copyright (C) 2006-2007 Mauro Carvalho Chehab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_VIDEO_V4L1_COMPAT +#include +#endif +#include +#include +#include +#include + +#include "tm6000-regs.h" +#include "tm6000.h" + +#define BUFFER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ + +/* Declare static vars that will be used as parameters */ +static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ +static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ + +unsigned long tm6000_devused; + +/* Debug level */ +int tm6000_debug; + +/* supported controls */ +static struct v4l2_queryctrl tm6000_qctrl[] = { + { + .id = V4L2_CID_BRIGHTNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Brightness", + .minimum = 0, + .maximum = 255, + .step = 1, + .default_value = 54, + .flags = 0, + }, { + .id = V4L2_CID_CONTRAST, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Contrast", + .minimum = 0, + .maximum = 255, + .step = 0x1, + .default_value = 119, + .flags = 0, + }, { + .id = V4L2_CID_SATURATION, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Saturation", + .minimum = 0, + .maximum = 255, + .step = 0x1, + .default_value = 112, + .flags = 0, + }, { + .id = V4L2_CID_HUE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Hue", + .minimum = -128, + .maximum = 127, + .step = 0x1, + .default_value = 0, //4 ? + .flags = 0, + } +}; + +static int qctl_regs[ARRAY_SIZE(tm6000_qctrl)]; + +static struct tm6000_fmt format[] = { + { + .name = "4:2:2, packed, YVY2", + .fourcc = V4L2_PIX_FMT_YUYV, + .depth = 16, + },{ + .name = "4:2:2, packed, UYVY", + .fourcc = V4L2_PIX_FMT_UYVY, + .depth = 16, + },{ + .name = "A/V + VBI mux packet", + .fourcc = V4L2_PIX_FMT_TM6000, + .depth = 16, + } +}; + +static LIST_HEAD(tm6000_corelist); + +/* ------------------------------------------------------------------ + DMA and thread functions + ------------------------------------------------------------------*/ + +#define norm_maxw(a) 720 +#define norm_maxh(a) 480 + +//#define norm_minw(a) norm_maxw(a) +#define norm_minw(a) norm_maxw(a) +#define norm_minh(a) norm_maxh(a) + +/* + * video-buf generic routine to get the next available buffer + */ +static int inline get_next_buf (struct tm6000_dmaqueue *dma_q, + struct tm6000_buffer **buf) +{ + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + + if (list_empty(&dma_q->active)) { + dprintk(dev, V4L2_DEBUG_QUEUE,"No active queue to serve\n"); + return 0; + } + + *buf = list_entry(dma_q->active.next, + struct tm6000_buffer, vb.queue); + + /* Nobody is waiting something to be done, just return */ + if (!waitqueue_active(&(*buf)->vb.done)) { + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + return -1; + } + + return 1; +} + +/* + * Announces that a buffer were filled and request the next + */ +static void inline buffer_filled (struct tm6000_core *dev, + struct tm6000_buffer *buf) +{ + /* Advice that buffer was filled */ + dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] wakeup\n",buf,buf->vb.i); + buf->vb.state = STATE_DONE; + buf->vb.field_count++; + do_gettimeofday(&buf->vb.ts); + + list_del(&buf->vb.queue); + wake_up(&buf->vb.done); +} + +/* + * Macro to allow copying data into the proper memory type + */ + +#define bufcpy(buf,out_ptr,in_ptr,size) \ + { \ + if (__copy_to_user(out_ptr,in_ptr,size)!=0) \ + tm6000_err("copy_to_user failed.\n"); \ + } + +/* + * Identify the tm5600/6000 buffer header type and properly handles + */ +static int copy_streams(u8 *data, u8 *out_p, unsigned long len, + struct urb *urb, struct tm6000_buffer **buf) +{ + struct tm6000_dmaqueue *dma_q = urb->context; + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + u8 *ptr=data, *endp=data+len; + u8 c; + unsigned int cmd, cpysize, pktsize, size, field, block, line, pos=0; + unsigned long header; + int rc=0; + + /* FIXME: this is the hardcoded window size + */ + unsigned int linesize=720*2; + +//static int last_line=-2; + + for (ptr=data; ptrisoc_ctl.cmd) { + /* Seek for sync */ + for (ptr+=3;ptr=endp) + return rc; + + /* Get message header */ + header=*(unsigned long *)ptr; + ptr+=4; + c=(header>>24) & 0xff; + + /* split the header fields */ + size = (((header & 0x7e)<<1) -1) *4; + block = (header>>7) & 0xf; + field = (header>>11) & 0x1; + line = (header>>12) & 0x1ff; + cmd = (header>>21) & 0x7; + + /* FIXME: Maximum possible line is 511. + * This doesn't seem to be enough for PAL standards + */ + + /* Validates header fields */ + if(size>TM6000_URB_MSG_LEN) + size=TM6000_URB_MSG_LEN; + if(block>=8) + cmd = TM6000_URB_MSG_ERR; + + /* FIXME: Mounts the image as field0+field1 + * It should, instead, check if the user selected + * entrelaced or non-entrelaced mode + */ + pos=((line<<1)+field)*linesize+ + block*TM6000_URB_MSG_LEN; + + + + /* Don't allow to write out of the buffer */ + if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) + cmd = TM6000_URB_MSG_ERR; + + /* Prints debug info */ + dprintk(dev, V4L2_DEBUG_ISOC, "size=%d, num=%d, " + " line=%d, field=%d\n", + size, block, line, field); + + dev->isoc_ctl.cmd = cmd; + dev->isoc_ctl.size = size; + dev->isoc_ctl.pos = pos; + dev->isoc_ctl.pktsize = pktsize = TM6000_URB_MSG_LEN; + } else { + cmd = dev->isoc_ctl.cmd; + size= dev->isoc_ctl.size; + pos = dev->isoc_ctl.pos; + pktsize = dev->isoc_ctl.pktsize; + } + cpysize=(endp-ptr>size)?size:endp-ptr; + + if (cpysize) { + /* handles each different URB message */ + switch(cmd) { + case TM6000_URB_MSG_VIDEO: + /* Fills video buffer */ + bufcpy(*buf,&out_p[pos],ptr,cpysize); + break; + } + } + if (cpysizeisoc_ctl.pos = pos+cpysize; + dev->isoc_ctl.size= size-cpysize; + dev->isoc_ctl.cmd = cmd; + dev->isoc_ctl.pktsize = pktsize-cpysize; + ptr+=cpysize; + } else { + dev->isoc_ctl.cmd = 0; + ptr+=pktsize; + } + } + + return rc; +} +/* + * Identify the tm5600/6000 buffer header type and properly handles + */ +static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, + struct urb *urb, struct tm6000_buffer **buf) +{ + struct tm6000_dmaqueue *dma_q = urb->context; + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + unsigned int pos=dev->isoc_ctl.pos,cpysize; + int rc=1; + + while (len>0) { + cpysize=min(len,(*buf)->vb.size-pos); +//printk("Copying %d bytes (max=%lu) from %p to %p[%u]\n",cpysize,(*buf)->vb.size,ptr,out_p,pos); + bufcpy(*buf,&out_p[pos],ptr,cpysize); + pos+=cpysize; + ptr+=cpysize; + len-=cpysize; + if (pos >= (*buf)->vb.size) { + pos=0; + /* Announces that a new buffer were filled */ + buffer_filled (dev, *buf); + dprintk(dev, V4L2_DEBUG_QUEUE, "new buffer filled\n"); + + rc=get_next_buf (dma_q, buf); + if (rc<=0) { + *buf=NULL; + printk(KERN_ERR "tm6000: buffer underrun\n"); + break; + } + } + } + + dev->isoc_ctl.pos=pos; + return rc; +} + +/* + * Controls the isoc copy of each urb packet + */ +static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) +{ + struct tm6000_dmaqueue *dma_q = urb->context; + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + void *outp=videobuf_to_vmalloc (&((*buf)->vb)); + int i, len=0, rc=1; + int size=(*buf)->vb.size; + char *p; + unsigned long copied; + + copied=0; + + + for (i = 0; i < urb->number_of_packets; i++) { + int status = urb->iso_frame_desc[i].status; + char *errmsg = "Unknown"; + + switch(status) { + case -ENOENT: + errmsg = "unlinked synchronuously"; + break; + case -ECONNRESET: + errmsg = "unlinked asynchronuously"; + break; + case -ENOSR: + errmsg = "Buffer error (overrun)"; + break; + case -EPIPE: + errmsg = "Stalled (device not responding)"; + break; + case -EOVERFLOW: + errmsg = "Babble (bad cable?)"; + break; + case -EPROTO: + errmsg = "Bit-stuff error (bad cable?)"; + break; + case -EILSEQ: + errmsg = "CRC/Timeout (could be anything)"; + break; + case -ETIME: + errmsg = "Device does not respond"; + break; + } + dprintk(dev, V4L2_DEBUG_QUEUE, "URB status %d [%s].\n", + status, errmsg); + + if (status<0) + continue; + + len=urb->iso_frame_desc[i].actual_length; + + if (len>=TM6000_URB_MSG_LEN) { + p=urb->transfer_buffer + urb->iso_frame_desc[i].offset; + if (!urb->iso_frame_desc[i].status) { + if (((*buf)->fmt->fourcc)==V4L2_PIX_FMT_TM6000) { + rc=copy_multiplexed(p,outp,len,urb,buf); + if (rc<=0) + return rc; + } else { + rc=copy_streams(p,outp,len,urb,buf); + } + } + copied += len; + if (copied>=size) + break; + } + } + + if (((*buf)->fmt->fourcc)!=V4L2_PIX_FMT_TM6000) { + buffer_filled (dev, *buf); + dprintk(dev, V4L2_DEBUG_QUEUE, "new buffer filled\n"); + } + + return rc; +} + +/* ------------------------------------------------------------------ + URB control + ------------------------------------------------------------------*/ + +/* + * IRQ callback, called by URB callback + */ +static void tm6000_irq_callback(struct urb *urb) +{ + struct tm6000_buffer *buf; + struct tm6000_dmaqueue *dma_q = urb->context; + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + int rc,i; + unsigned long flags; + + spin_lock_irqsave(&dev->slock,flags); + + rc=get_next_buf (dma_q, &buf); + if (rc<=0) + goto ret; + + /* Copy data from URB */ + rc=tm6000_isoc_copy(urb, &buf); + +ret: + /* Reset urb buffers */ + for (i = 0; i < urb->number_of_packets; i++) { + urb->iso_frame_desc[i].status = 0; + urb->iso_frame_desc[i].actual_length = 0; + } + urb->status = 0; + + if ((urb->status = usb_submit_urb(urb, GFP_ATOMIC))) { + tm6000_err("urb resubmit failed (error=%i)\n", + urb->status); + } + + if (rc>=0) { + if (!rc) { + dprintk(dev, V4L2_DEBUG_QUEUE, "No active queue to serve\n"); + del_timer(&dma_q->timeout); + } else { + /* Data filled, reset watchdog */ + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + } + } + spin_unlock_irqrestore(&dev->slock,flags); +} + +/* + * Stop and Deallocate URBs + */ +static void tm6000_uninit_isoc(struct tm6000_core *dev) +{ + struct urb *urb; + int i; + + for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { + urb=dev->isoc_ctl.urb[i]; + if (urb) { + usb_kill_urb(urb); + usb_unlink_urb(urb); + if (dev->isoc_ctl.transfer_buffer[i]) { + usb_buffer_free(dev->udev, + urb->transfer_buffer_length, + dev->isoc_ctl.transfer_buffer[i], + urb->transfer_dma); + } + usb_free_urb(urb); + dev->isoc_ctl.urb[i] = NULL; + } + dev->isoc_ctl.transfer_buffer[i] = NULL; + } + + kfree (dev->isoc_ctl.urb); + kfree (dev->isoc_ctl.transfer_buffer); + dev->isoc_ctl.urb=NULL; + dev->isoc_ctl.transfer_buffer=NULL; + + dev->isoc_ctl.num_bufs=0; +} + +/* + * Stop video thread - FIXME: Can be easily removed + */ +static void tm6000_stop_thread(struct tm6000_dmaqueue *dma_q) +{ + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + + tm6000_uninit_isoc(dev); +} + + +/* + * Allocate URBs and start IRQ + */ +static int tm6000_prepare_isoc(struct tm6000_core *dev, + int max_packets, int num_bufs) +{ + struct tm6000_dmaqueue *dma_q = &dev->vidq; + int i; + int sb_size, pipe; + struct urb *urb; + int j, k; + + /* De-allocates all pending stuff */ + tm6000_uninit_isoc(dev); + + dev->isoc_ctl.num_bufs=num_bufs; + + dev->isoc_ctl.urb=kmalloc(sizeof(void *)*num_bufs, + GFP_KERNEL); + if (!dev->isoc_ctl.urb) { + tm6000_err("cannot alloc memory for usb buffers\n"); + return -ENOMEM; + } + + dev->isoc_ctl.transfer_buffer=kmalloc(sizeof(void *)*num_bufs, + GFP_KERNEL); + if (!dev->isoc_ctl.urb) { + tm6000_err("cannot allocate memory for usbtransfer\n"); + kfree(dev->isoc_ctl.urb); + return -ENOMEM; + } + + dev->isoc_ctl.max_pkt_size=dev->max_isoc_in; + + sb_size = max_packets * dev->isoc_ctl.max_pkt_size; + + + /* allocate urbs and transfer buffers */ + for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { + urb = usb_alloc_urb(max_packets, GFP_KERNEL); + if (!urb) { + tm6000_err("cannot alloc isoc_ctl.urb %i\n", i); + tm6000_uninit_isoc(dev); + return -ENOMEM; + } + dev->isoc_ctl.urb[i] = urb; + + dev->isoc_ctl.transfer_buffer[i] = usb_buffer_alloc(dev->udev, + sb_size, GFP_KERNEL, + &dev->isoc_ctl.urb[i]->transfer_dma); + if (!dev->isoc_ctl.transfer_buffer[i]) { + tm6000_err ("unable to allocate %i bytes for transfer" + " buffer %i\n", sb_size, i); + tm6000_uninit_isoc(dev); + return -ENOMEM; + } + memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size); + + pipe=usb_rcvisocpipe(dev->udev, + dev->isoc_in->desc.bEndpointAddress & + USB_ENDPOINT_NUMBER_MASK); + usb_fill_int_urb(urb, dev->udev, pipe, + dev->isoc_ctl.transfer_buffer[i],sb_size, + tm6000_irq_callback, dma_q, + dev->isoc_in->desc.bInterval); + + urb->number_of_packets = max_packets; + urb->transfer_flags = URB_ISO_ASAP; + + k = 0; + for (j = 0; j < max_packets; j++) { + urb->iso_frame_desc[j].offset = k; + urb->iso_frame_desc[j].length = + dev->isoc_ctl.max_pkt_size; + k += dev->isoc_ctl.max_pkt_size; + } + } + + return 0; +} + +static int tm6000_start_thread( struct tm6000_dmaqueue *dma_q, + struct tm6000_buffer *buf) +{ + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + int i,rc; + + dma_q->frame=0; + dma_q->ini_jiffies=jiffies; + + init_waitqueue_head(&dma_q->wq); + + /* submit urbs and enables IRQ */ + for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { + rc = usb_submit_urb(dev->isoc_ctl.urb[i], GFP_KERNEL); + if (rc) { + tm6000_err("submit of urb %i failed (error=%i)\n", i, + rc); + tm6000_uninit_isoc(dev); + return rc; + } + } + + if (rc<0) + return rc; + + return 0; +} + +static int restart_video_queue(struct tm6000_dmaqueue *dma_q) +{ + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + + struct tm6000_buffer *buf, *prev; + struct list_head *item; + + dprintk(dev, V4L2_DEBUG_QUEUE, "%s dma_q=0x%08lx\n", + __FUNCTION__,(unsigned long)dma_q); + + if (!list_empty(&dma_q->active)) { + buf = list_entry(dma_q->active.next, struct tm6000_buffer, vb.queue); + dprintk(dev, V4L2_DEBUG_QUEUE, + "restart_queue [%p/%d]: restart dma\n", buf, buf->vb.i); + + dprintk(dev, V4L2_DEBUG_QUEUE, "Restarting video dma\n"); + tm6000_stop_thread(dma_q); + tm6000_start_thread(dma_q, buf); + + /* cancel all outstanding capture / vbi requests */ + list_for_each(item,&dma_q->active) { + buf = list_entry(item, struct tm6000_buffer, vb.queue); + + list_del(&buf->vb.queue); + buf->vb.state = STATE_ERROR; + wake_up(&buf->vb.done); + } + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + + return 0; + } + + prev = NULL; + for (;;) { + if (list_empty(&dma_q->queued)) + return 0; + buf = list_entry(dma_q->queued.next, struct tm6000_buffer, vb.queue); + if (NULL == prev) { + list_del(&buf->vb.queue); + list_add_tail(&buf->vb.queue,&dma_q->active); + + dprintk(dev, V4L2_DEBUG_QUEUE, "Restarting video dma\n"); + tm6000_stop_thread(dma_q); + tm6000_start_thread(dma_q, buf); + + buf->vb.state = STATE_ACTIVE; + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] restart_queue -" + " first active\n", buf, buf->vb.i); + + } else if (prev->vb.width == buf->vb.width && + prev->vb.height == buf->vb.height && + prev->fmt == buf->fmt) { + list_del(&buf->vb.queue); + list_add_tail(&buf->vb.queue,&dma_q->active); + buf->vb.state = STATE_ACTIVE; + dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] restart_queue -" + " move to active\n",buf,buf->vb.i); + } else { + return 0; + } + prev = buf; + } +} + +static void tm6000_vid_timeout(unsigned long data) +{ + struct tm6000_core *dev = (struct tm6000_core*)data; + struct tm6000_dmaqueue *vidq = &dev->vidq; + struct tm6000_buffer *buf; + unsigned long flags; + + spin_lock_irqsave(&dev->slock,flags); + while (!list_empty(&vidq->active)) { + buf = list_entry(vidq->active.next, struct tm6000_buffer, + vb.queue); + list_del(&buf->vb.queue); + buf->vb.state = STATE_ERROR; + wake_up(&buf->vb.done); + dprintk(dev, V4L2_DEBUG_QUEUE, "tm6000/0: [%p/%d] timeout\n", + buf, buf->vb.i); + } + + restart_video_queue(vidq); + spin_unlock_irqrestore(&dev->slock,flags); +} + +/* ------------------------------------------------------------------ + Videobuf operations + ------------------------------------------------------------------*/ +static int +buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) +{ + struct tm6000_fh *fh = vq->priv_data; + + *size = fh->fmt->depth * fh->width * fh->height >> 3; + if (0 == *count) + *count = 32; + while (*size * *count > vid_limit * 1024 * 1024) + (*count)--; + return 0; +} + +static void free_buffer(struct videobuf_queue *vq, struct tm6000_buffer *buf) +{ + if (in_interrupt()) + BUG(); + + videobuf_waiton(&buf->vb,0,0); + videobuf_vmalloc_free(&buf->vb); + buf->vb.state = STATE_NEEDS_INIT; +} + +static int +buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, + enum v4l2_field field) +{ + struct tm6000_fh *fh = vq->priv_data; + struct tm6000_buffer *buf = container_of(vb,struct tm6000_buffer,vb); + struct tm6000_core *dev = fh->dev; + int rc=0, urbsize, urb_init=0; + + BUG_ON(NULL == fh->fmt); + + if (fh->width < norm_minw(core) || fh->width > norm_maxw(core) || + fh->height < norm_minh(core) || fh->height > norm_maxh(core)) { + dprintk(dev, V4L2_DEBUG_QUEUE, "Window size (%dx%d) is out of " + "supported range\n", fh->width, fh->height); + dprintk(dev, V4L2_DEBUG_QUEUE, "Valid range is from (%dx%d) to " + "(%dx%d)\n", norm_minw(core), norm_minh(core), + norm_maxw(core),norm_maxh(core)); + return -EINVAL; + } + + /* FIXME: It assumes depth=2 */ + /* The only currently supported format is 16 bits/pixel */ + buf->vb.size = fh->fmt->depth*fh->width*fh->height >> 3; + if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) + return -EINVAL; + + if (buf->fmt != fh->fmt || + buf->vb.width != fh->width || + buf->vb.height != fh->height || + buf->vb.field != field) { + buf->fmt = fh->fmt; + buf->vb.width = fh->width; + buf->vb.height = fh->height; + buf->vb.field = field; + buf->vb.state = STATE_NEEDS_INIT; + } + + if (STATE_NEEDS_INIT == buf->vb.state) { + if (0 != (rc = videobuf_iolock(vq,&buf->vb,NULL))) + goto fail; + urb_init=1; + } + + + if (!dev->isoc_ctl.num_bufs) + urb_init=1; + + if (urb_init) { + /* Should allocate/request at least h + res x v res x 2 bytes/pixel */ + urbsize=(buf->vb.size+dev->max_isoc_in-1)/dev->max_isoc_in; + + /* Hack to allocate memory for Video + Audio */ + /* FIXME: should also consider header ovehead of + 4 bytes/180 bytes */ + urbsize+=((48000*4+24)/25+dev->max_isoc_in-1)/dev->max_isoc_in; + + dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %d packets to handle " + "%lu size\n", urbsize,buf->vb.size); + rc = tm6000_prepare_isoc(dev, urbsize, 2); + + if (rc<0) + goto fail; + } + + buf->vb.state = STATE_PREPARED; + return 0; + +fail: + free_buffer(vq,buf); + return rc; +} + +static void +buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) +{ + struct tm6000_buffer *buf = container_of(vb,struct tm6000_buffer,vb); + struct tm6000_fh *fh = vq->priv_data; + struct tm6000_core *dev = fh->dev; + struct tm6000_dmaqueue *vidq = &dev->vidq; + struct tm6000_buffer *prev; + + if (!list_empty(&vidq->queued)) { + list_add_tail(&buf->vb.queue,&vidq->queued); + buf->vb.state = STATE_QUEUED; + dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue - " + "append to queued\n", buf, buf->vb.i); + } else if (list_empty(&vidq->active)) { + list_add_tail(&buf->vb.queue,&vidq->active); + buf->vb.state = STATE_ACTIVE; + mod_timer(&vidq->timeout, jiffies+BUFFER_TIMEOUT); + dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue - " + "first active\n", buf, buf->vb.i); + tm6000_start_thread(vidq, buf); + } else { + prev = list_entry(vidq->active.prev, struct tm6000_buffer, vb.queue); + if (prev->vb.width == buf->vb.width && + prev->vb.height == buf->vb.height && + prev->fmt == buf->fmt) { + list_add_tail(&buf->vb.queue,&vidq->active); + buf->vb.state = STATE_ACTIVE; + dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue -" + " append to active\n", buf, buf->vb.i); + } else { + list_add_tail(&buf->vb.queue,&vidq->queued); + buf->vb.state = STATE_QUEUED; + dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue -" + " first queued\n", buf, buf->vb.i); + } + } +} + +static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb) +{ + struct tm6000_buffer *buf = container_of(vb,struct tm6000_buffer,vb); + struct tm6000_fh *fh = vq->priv_data; + struct tm6000_core *dev = (struct tm6000_core*)fh->dev; + struct tm6000_dmaqueue *vidq = &dev->vidq; + + tm6000_stop_thread(vidq); + + free_buffer(vq,buf); +} + +static struct videobuf_queue_ops tm6000_video_qops = { + .buf_setup = buffer_setup, + .buf_prepare = buffer_prepare, + .buf_queue = buffer_queue, + .buf_release = buffer_release, +}; + +/* ------------------------------------------------------------------ + IOCTL handling + ------------------------------------------------------------------*/ + +static int res_get(struct tm6000_core *dev, struct tm6000_fh *fh) +{ + /* is it free? */ + mutex_lock(&dev->lock); + if (dev->resources) { + /* no, someone else uses it */ + mutex_unlock(&dev->lock); + return 0; + } + /* it's free, grab it */ + dev->resources =1; + dprintk(dev, V4L2_DEBUG_RES_LOCK, "res: get\n"); + mutex_unlock(&dev->lock); + return 1; +} + +static int res_locked(struct tm6000_core *dev) +{ + return (dev->resources); +} + +static void res_free(struct tm6000_core *dev, struct tm6000_fh *fh) +{ + mutex_lock(&dev->lock); + dev->resources = 0; + dprintk(dev, V4L2_DEBUG_RES_LOCK, "res: put\n"); + mutex_unlock(&dev->lock); +} + +/* ------------------------------------------------------------------ + IOCTL vidioc handling + ------------------------------------------------------------------*/ +static int vidioc_querycap (struct file *file, void *priv, + struct v4l2_capability *cap) +{ + // struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev; + + strlcpy(cap->driver, "tm6000", sizeof(cap->driver)); + strlcpy(cap->card,"Trident TVMaster TM5600/6000", sizeof(cap->card)); + // strlcpy(cap->bus_info, dev->udev->dev.bus_id, sizeof(cap->bus_info)); + cap->version = TM6000_VERSION; + cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | + V4L2_CAP_STREAMING | + V4L2_CAP_TUNER | + V4L2_CAP_READWRITE; + return 0; +} + +static int vidioc_enum_fmt_cap (struct file *file, void *priv, + struct v4l2_fmtdesc *f) +{ + if (unlikely(f->index >= ARRAY_SIZE(format))) + return -EINVAL; + + strlcpy(f->description,format[f->index].name,sizeof(f->description)); + f->pixelformat = format[f->index].fourcc; + return 0; +} + +static int vidioc_g_fmt_cap (struct file *file, void *priv, + struct v4l2_format *f) +{ + struct tm6000_fh *fh=priv; + + f->fmt.pix.width = fh->width; + f->fmt.pix.height = fh->height; + f->fmt.pix.field = fh->vb_vidq.field; + f->fmt.pix.pixelformat = fh->fmt->fourcc; + f->fmt.pix.bytesperline = + (f->fmt.pix.width * fh->fmt->depth) >> 3; + f->fmt.pix.sizeimage = + f->fmt.pix.height * f->fmt.pix.bytesperline; + + return (0); +} + +static struct tm6000_fmt* format_by_fourcc(unsigned int fourcc) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(format); i++) + if (format[i].fourcc == fourcc) + return format+i; + return NULL; +} + +static int vidioc_try_fmt_cap (struct file *file, void *priv, + struct v4l2_format *f) +{ + struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev; + struct tm6000_fmt *fmt; + enum v4l2_field field; + + fmt = format_by_fourcc(f->fmt.pix.pixelformat); + if (NULL == fmt) { + dprintk(dev, V4L2_DEBUG_IOCTL_ARG, "Fourcc format (0x%08x)" + " invalid.\n", f->fmt.pix.pixelformat); + return -EINVAL; + } + + field = f->fmt.pix.field; + + if (field == V4L2_FIELD_ANY) { +// field=V4L2_FIELD_INTERLACED; + field=V4L2_FIELD_SEQ_TB; + } else if (V4L2_FIELD_INTERLACED != field) { + dprintk(dev, V4L2_DEBUG_IOCTL_ARG, "Field type invalid.\n"); + return -EINVAL; + } + + if (f->fmt.pix.width < norm_minw(core)) + f->fmt.pix.width = norm_minw(core); + + if (f->fmt.pix.width > norm_maxw(core)) + f->fmt.pix.width = norm_maxw(core); + + if (f->fmt.pix.height < norm_minh(core)) + f->fmt.pix.height = norm_minh(core); + + if (f->fmt.pix.height > norm_maxh(core)) + f->fmt.pix.height = norm_maxh(core); + + f->fmt.pix.width &= ~0x01; + + f->fmt.pix.field = field; + + f->fmt.pix.bytesperline = + (f->fmt.pix.width * fmt->depth) >> 3; + f->fmt.pix.sizeimage = + f->fmt.pix.height * f->fmt.pix.bytesperline; + + return 0; +} + +/*FIXME: This seems to be generic enough to be at videodev2 */ +static int vidioc_s_fmt_cap (struct file *file, void *priv, + struct v4l2_format *f) +{ + struct tm6000_fh *fh=priv; + struct tm6000_core *dev = fh->dev; + int ret = vidioc_try_fmt_cap(file,fh,f); + if (ret < 0) + return (ret); + + fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); + fh->width = f->fmt.pix.width; + fh->height = f->fmt.pix.height; + fh->vb_vidq.field = f->fmt.pix.field; + fh->type = f->type; + + dev->fourcc = f->fmt.pix.pixelformat; + + tm6000_set_fourcc_format(dev); + + return (0); +} + +static int vidioc_reqbufs (struct file *file, void *priv, + struct v4l2_requestbuffers *p) +{ + struct tm6000_fh *fh=priv; + + return (videobuf_reqbufs(&fh->vb_vidq, p)); +} + +static int vidioc_querybuf (struct file *file, void *priv, + struct v4l2_buffer *p) +{ + struct tm6000_fh *fh=priv; + + return (videobuf_querybuf(&fh->vb_vidq, p)); +} + +static int vidioc_qbuf (struct file *file, void *priv, struct v4l2_buffer *p) +{ + struct tm6000_fh *fh=priv; + + return (videobuf_qbuf(&fh->vb_vidq, p)); +} + +static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *p) +{ + struct tm6000_fh *fh=priv; + + return (videobuf_dqbuf(&fh->vb_vidq, p, + file->f_flags & O_NONBLOCK)); +} + +#ifdef CONFIG_VIDEO_V4L1_COMPAT +static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) +{ + struct tm6000_fh *fh=priv; + + return videobuf_cgmbuf (&fh->vb_vidq, mbuf, 8); +} +#endif + +static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) +{ + struct tm6000_fh *fh=priv; + struct tm6000_core *dev = fh->dev; + + if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (i != fh->type) + return -EINVAL; + + if (!res_get(dev,fh)) + return -EBUSY; + return (videobuf_streamon(&fh->vb_vidq)); +} + +static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) +{ + struct tm6000_fh *fh=priv; + struct tm6000_core *dev = fh->dev; + + if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (i != fh->type) + return -EINVAL; + + videobuf_streamoff(&fh->vb_vidq); + res_free(dev,fh); + + return (0); +} + +static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *norm) +{ + int rc=0; + struct tm6000_fh *fh=priv; + struct tm6000_core *dev = fh->dev; + + rc=tm6000_set_standard (dev, norm); + if (rc<0) + return rc; + + tm6000_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm); + + return 0; +} + +static int vidioc_enum_input (struct file *file, void *priv, + struct v4l2_input *inp) +{ + switch (inp->index) { + case TM6000_INPUT_TV: + inp->type = V4L2_INPUT_TYPE_TUNER; + strcpy(inp->name,"Television"); + break; + case TM6000_INPUT_COMPOSITE: + inp->type = V4L2_INPUT_TYPE_CAMERA; + strcpy(inp->name,"Composite"); + break; + case TM6000_INPUT_SVIDEO: + inp->type = V4L2_INPUT_TYPE_CAMERA; + strcpy(inp->name,"S-Video"); + break; + default: + return -EINVAL; + } + inp->std = TM6000_STD; + + return 0; +} + +static int vidioc_g_input (struct file *file, void *priv, unsigned int *i) +{ + struct tm6000_fh *fh=priv; + struct tm6000_core *dev = fh->dev; + + *i=dev->input; + + return 0; +} +static int vidioc_s_input (struct file *file, void *priv, unsigned int i) +{ + struct tm6000_fh *fh=priv; + struct tm6000_core *dev = fh->dev; + int rc=0; + char buf[1]; + + switch (i) { + case TM6000_INPUT_TV: + dev->input=i; + *buf=0; + break; + case TM6000_INPUT_COMPOSITE: + case TM6000_INPUT_SVIDEO: + dev->input=i; + *buf=1; + break; + default: + return -EINVAL; + } + rc=tm6000_read_write_usb (dev, USB_DIR_OUT | USB_TYPE_VENDOR, + REQ_03_SET_GET_MCU_PIN, 0x03, 1, buf, 1); + + if (!rc) { + dev->input=i; + rc=vidioc_s_std (file, priv, &dev->vfd.current_norm); + } + + return (rc); +} + + /* --- controls ---------------------------------------------- */ +static int vidioc_queryctrl (struct file *file, void *priv, + struct v4l2_queryctrl *qc) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(tm6000_qctrl); i++) + if (qc->id && qc->id == tm6000_qctrl[i].id) { + memcpy(qc, &(tm6000_qctrl[i]), + sizeof(*qc)); + return (0); + } + + return -EINVAL; +} + +static int vidioc_g_ctrl (struct file *file, void *priv, + struct v4l2_control *ctrl) +{ + struct tm6000_fh *fh=priv; + struct tm6000_core *dev = fh->dev; + int val; + + /* FIXME: Probably, those won't work! Maybe we need shadow regs */ + switch (ctrl->id) { + case V4L2_CID_CONTRAST: + val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x08, 0); + break; + case V4L2_CID_BRIGHTNESS: + val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x09, 0); + return 0; + case V4L2_CID_SATURATION: + val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x0a, 0); + return 0; + case V4L2_CID_HUE: + val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x0b, 0); + return 0; + default: + return -EINVAL; + } + + if (val<0) + return val; + + ctrl->value=val; + + return 0; +} +static int vidioc_s_ctrl (struct file *file, void *priv, + struct v4l2_control *ctrl) +{ + struct tm6000_fh *fh =priv; + struct tm6000_core *dev = fh->dev; + u8 val=ctrl->value; + + switch (ctrl->id) { + case V4L2_CID_CONTRAST: + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x08, val); + return 0; + case V4L2_CID_BRIGHTNESS: + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x09, val); + return 0; + case V4L2_CID_SATURATION: + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0a, val); + return 0; + case V4L2_CID_HUE: + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0b, val); + return 0; + } + return -EINVAL; +} + +static int vidioc_g_tuner (struct file *file, void *priv, + struct v4l2_tuner *t) +{ + struct tm6000_fh *fh =priv; + struct tm6000_core *dev = fh->dev; + + if (unlikely(UNSET == dev->tuner_type)) + return -EINVAL; + if (0 != t->index) + return -EINVAL; + + strcpy(t->name, "Television"); + t->type = V4L2_TUNER_ANALOG_TV; + t->capability = V4L2_TUNER_CAP_NORM; + t->rangehigh = 0xffffffffUL; + t->rxsubchans = V4L2_TUNER_SUB_MONO; + + return 0; +} + +static int vidioc_s_tuner (struct file *file, void *priv, + struct v4l2_tuner *t) +{ + struct tm6000_fh *fh =priv; + struct tm6000_core *dev = fh->dev; + + if (UNSET == dev->tuner_type) + return -EINVAL; + if (0 != t->index) + return -EINVAL; + + return 0; +} + +static int vidioc_g_frequency (struct file *file, void *priv, + struct v4l2_frequency *f) +{ + struct tm6000_fh *fh =priv; + struct tm6000_core *dev = fh->dev; + + if (unlikely(UNSET == dev->tuner_type)) + return -EINVAL; + + f->type = V4L2_TUNER_ANALOG_TV; + f->frequency = dev->freq; + + tm6000_i2c_call_clients(dev,VIDIOC_G_FREQUENCY,f); + + return 0; +} + +static int vidioc_s_frequency (struct file *file, void *priv, + struct v4l2_frequency *f) +{ + struct tm6000_fh *fh =priv; + struct tm6000_core *dev = fh->dev; + + if (unlikely(f->type != V4L2_TUNER_ANALOG_TV)) + return -EINVAL; + + if (unlikely(UNSET == dev->tuner_type)) + return -EINVAL; + if (unlikely(f->tuner != 0)) + return -EINVAL; + +// mutex_lock(&dev->lock); + dev->freq = f->frequency; + tm6000_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,f); +// mutex_unlock(&dev->lock); + + return 0; +} + +/* ------------------------------------------------------------------ + File operations for the device + ------------------------------------------------------------------*/ + +static int tm6000_open(struct inode *inode, struct file *file) +{ + int minor = iminor(inode); + struct tm6000_core *h,*dev = NULL; + struct tm6000_fh *fh; + struct list_head *list; + enum v4l2_buf_type type = 0; + int i,rc; + + dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called " + "(minor=%d)\n",minor); + + list_for_each(list,&tm6000_corelist) { + h = list_entry(list, struct tm6000_core, tm6000_corelist); + if (h->vfd.minor == minor) { + dev = h; + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + } + } + if (NULL == dev) + return -ENODEV; + + + /* If more than one user, mutex should be added */ + dev->users++; + + dprintk(dev, V4L2_DEBUG_OPEN, "open minor=%d type=%s users=%d\n", + minor,v4l2_type_names[type],dev->users); + + /* allocate + initialize per filehandle data */ + fh = kzalloc(sizeof(*fh),GFP_KERNEL); + if (NULL == fh) { + dev->users--; + return -ENOMEM; + } + + file->private_data = fh; + fh->dev = dev; + + fh->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + dev->fourcc = format[0].fourcc; + + fh->fmt = format_by_fourcc(dev->fourcc); + fh->width = norm_maxw(); + fh->height = norm_maxh(); + + dprintk(dev, V4L2_DEBUG_OPEN, "Open: fh=0x%08lx, dev=0x%08lx, " + "dev->vidq=0x%08lx\n", + (unsigned long)fh,(unsigned long)dev,(unsigned long)&dev->vidq); + dprintk(dev, V4L2_DEBUG_OPEN, "Open: list_empty " + "queued=%d\n",list_empty(&dev->vidq.queued)); + dprintk(dev, V4L2_DEBUG_OPEN, "Open: list_empty " + "active=%d\n",list_empty(&dev->vidq.active)); + + /* initialize hardware on analog mode */ + if (dev->mode!=TM6000_MODE_ANALOG) { + rc=tm6000_init_analog_mode (dev); + if (rc<0) + return rc; + + /* Put all controls at a sane state */ + for (i = 0; i < ARRAY_SIZE(tm6000_qctrl); i++) + qctl_regs[i] =tm6000_qctrl[i].default_value; + + dev->mode=TM6000_MODE_ANALOG; + } + + videobuf_queue_vmalloc_init(&fh->vb_vidq, &tm6000_video_qops, + NULL, &dev->slock, + fh->type, + V4L2_FIELD_INTERLACED, + sizeof(struct tm6000_buffer),fh); + + return 0; +} + +static ssize_t +tm6000_read(struct file *file, char __user *data, size_t count, loff_t *pos) +{ + struct tm6000_fh *fh = file->private_data; + + if (fh->type==V4L2_BUF_TYPE_VIDEO_CAPTURE) { + if (res_locked(fh->dev)) + return -EBUSY; + + return videobuf_read_stream(&fh->vb_vidq, data, count, pos, 0, + file->f_flags & O_NONBLOCK); + } + return 0; +} + +static unsigned int +tm6000_poll(struct file *file, struct poll_table_struct *wait) +{ + struct tm6000_fh *fh = file->private_data; + struct tm6000_buffer *buf; + + if (V4L2_BUF_TYPE_VIDEO_CAPTURE != fh->type) + return POLLERR; + + if (res_get(fh->dev,fh)) { + /* streaming capture */ + if (list_empty(&fh->vb_vidq.stream)) + return POLLERR; + buf = list_entry(fh->vb_vidq.stream.next,struct tm6000_buffer,vb.stream); + } else { + /* read() capture */ + buf = (struct tm6000_buffer*)fh->vb_vidq.read_buf; + if (NULL == buf) + return POLLERR; + } + poll_wait(file, &buf->vb.done, wait); + if (buf->vb.state == STATE_DONE || + buf->vb.state == STATE_ERROR) + return POLLIN|POLLRDNORM; + return 0; +} + +static int tm6000_release(struct inode *inode, struct file *file) +{ + struct tm6000_fh *fh = file->private_data; + struct tm6000_core *dev = fh->dev; + struct tm6000_dmaqueue *vidq = &dev->vidq; + int minor = iminor(inode); + + tm6000_stop_thread(vidq); + videobuf_mmap_free(&fh->vb_vidq); + + kfree (fh); + + dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users); + + return 0; +} + +static int tm6000_mmap(struct file *file, struct vm_area_struct * vma) +{ + struct tm6000_fh *fh = file->private_data; + int ret; + + ret=videobuf_mmap_mapper(&fh->vb_vidq, vma); + + return ret; +} + +static struct file_operations tm6000_fops = { + .owner = THIS_MODULE, + .open = tm6000_open, + .release = tm6000_release, + .ioctl = video_ioctl2, /* V4L2 ioctl handler */ + .read = tm6000_read, + .poll = tm6000_poll, + .mmap = tm6000_mmap, + .llseek = no_llseek, +}; + +static struct video_device tm6000_template = { + .name = "tm6000", + .type = VID_TYPE_CAPTURE, + .fops = &tm6000_fops, + .minor = -1, + .release = video_device_release, + + .vidioc_querycap = vidioc_querycap, + .vidioc_enum_fmt_cap = vidioc_enum_fmt_cap, + .vidioc_g_fmt_cap = vidioc_g_fmt_cap, + .vidioc_try_fmt_cap = vidioc_try_fmt_cap, + .vidioc_s_fmt_cap = vidioc_s_fmt_cap, + .vidioc_s_std = vidioc_s_std, + .vidioc_enum_input = vidioc_enum_input, + .vidioc_g_input = vidioc_g_input, + .vidioc_s_input = vidioc_s_input, + .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_s_ctrl = vidioc_s_ctrl, + .vidioc_g_tuner = vidioc_g_tuner, + .vidioc_s_tuner = vidioc_s_tuner, + .vidioc_g_frequency = vidioc_g_frequency, + .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_streamon = vidioc_streamon, + .vidioc_streamoff = vidioc_streamoff, + .vidioc_reqbufs = vidioc_reqbufs, + .vidioc_querybuf = vidioc_querybuf, + .vidioc_qbuf = vidioc_qbuf, + .vidioc_dqbuf = vidioc_dqbuf, +#ifdef CONFIG_VIDEO_V4L1_COMPAT + .vidiocgmbuf = vidiocgmbuf, +#endif + .tvnorms = TM6000_STD, + .current_norm = V4L2_STD_NTSC_M, +}; +/* ----------------------------------------------------------------- + Initialization and module stuff + ------------------------------------------------------------------*/ + +int tm6000_v4l2_register(struct tm6000_core *dev) +{ + int ret; + + list_add_tail(&dev->tm6000_corelist,&tm6000_corelist); + + /* init video dma queues */ + INIT_LIST_HEAD(&dev->vidq.active); + INIT_LIST_HEAD(&dev->vidq.queued); + + dev->vidq.timeout.function = tm6000_vid_timeout; + dev->vidq.timeout.data = (unsigned long)dev; + init_timer(&dev->vidq.timeout); + + memcpy (&dev->vfd, &tm6000_template, sizeof(dev->vfd)); + dev->vfd.debug=tm6000_debug; + + ret = video_register_device(&dev->vfd, VFL_TYPE_GRABBER, video_nr); + printk(KERN_INFO "Trident TVMaster TM5600/TM6000 USB2 board (Load status: %d)\n", ret); + return ret; +} + +int tm6000_v4l2_unregister(struct tm6000_core *dev) +{ + struct tm6000_core *h; + struct list_head *list; + + while (!list_empty(&tm6000_corelist)) { + list = tm6000_corelist.next; + h = list_entry(list, struct tm6000_core, tm6000_corelist); + if (h == dev) { + video_unregister_device(&dev->vfd); + list_del(list); + kfree (h); + } + } + + return 0; +} + +int tm6000_v4l2_exit(void) +{ + return 0; +} + +module_param(video_nr, int, 0); +MODULE_PARM_DESC(video_nr,"Allow changing video device number"); + +module_param_named (debug, tm6000_debug, int, 0444); +MODULE_PARM_DESC(debug,"activates debug info"); + +module_param(vid_limit,int,0644); +MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes"); + diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h new file mode 100644 index 000000000000..623e85c351e1 --- /dev/null +++ b/drivers/staging/tm6000/tm6000.h @@ -0,0 +1,230 @@ +/* + tm6000.h - driver for TM5600/TM6000 USB video capture devices + + Copyright (C) 2006-2007 Mauro Carvalho Chehab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +// Use the tm6000-hack, instead of the proper initialization code +//#define HACK 1 + +#include +#include +#include +#include "tm6000-usb-isoc.h" +#include +#include + +#define TM6000_VERSION KERNEL_VERSION(0, 0, 1) + +/* Inputs */ +#define TM6000_INPUT_TV 0 +#define TM6000_INPUT_COMPOSITE 1 +#define TM6000_INPUT_SVIDEO 2 + +/* ------------------------------------------------------------------ + Basic structures + ------------------------------------------------------------------*/ + +struct tm6000_fmt { + char *name; + u32 fourcc; /* v4l2 format id */ + int depth; +}; + +/* buffer for one video frame */ +struct tm6000_buffer { + /* common v4l buffer stuff -- must be first */ + struct videobuf_buffer vb; + + struct tm6000_fmt *fmt; +}; + +struct tm6000_dmaqueue { + struct list_head active; + struct list_head queued; + struct timer_list timeout; + + /* thread for generating video stream*/ + struct task_struct *kthread; + wait_queue_head_t wq; + /* Counters to control fps rate */ + int frame; + int ini_jiffies; +}; + +/* device states */ +enum tm6000_core_state { + DEV_INITIALIZED = 0x01, + DEV_DISCONNECTED = 0x02, + DEV_MISCONFIGURED = 0x04, +}; + +/* io methods */ +enum tm6000_io_method { + IO_NONE, + IO_READ, + IO_MMAP, +}; + +enum tm6000_mode { + TM6000_MODE_UNKNOWN=0, + TM6000_MODE_ANALOG, + TM6000_MODE_DIGITAL, +}; + +struct tm6000_capabilities { + unsigned int has_tuner:1; + unsigned int has_tda9874:1; + unsigned int has_dvb:1; + unsigned int has_zl10353:1; + unsigned int has_eeprom:1; +}; + +struct tm6000_core { + /* generic device properties */ + char name[30]; /* name (including minor) of the device */ + int model; /* index in the device_data struct */ + int devno; /* marks the number of this device */ + v4l2_std_id norm; /* Current norm */ + + enum tm6000_core_state state; + + /* Device Capabilities*/ + struct tm6000_capabilities caps; + + /* Tuner configuration */ + int tuner_type; /* type of the tuner */ + int tuner_addr; /* tuner address */ + + /* i2c i/o */ + struct i2c_adapter i2c_adap; + struct i2c_client i2c_client; + + /* video for linux */ + struct list_head tm6000_corelist; + int users; + + /* various device info */ + unsigned int resources; + struct video_device vfd; + struct tm6000_dmaqueue vidq; + + int input; + int freq; + unsigned int fourcc; + + enum tm6000_mode mode; + + /* locks */ + struct mutex lock; + + /* usb transfer */ + struct usb_device *udev; /* the usb device */ + + struct usb_host_endpoint *bulk_in, *bulk_out, *isoc_in, *isoc_out; + unsigned int max_bulk_in, max_bulk_out; + unsigned int max_isoc_in, max_isoc_out; + + /* scaler!=0 if scaler is active*/ + int scaler; + + /* Isoc control struct */ + struct usb_isoc_ctl isoc_ctl; + + spinlock_t slock; +}; + +struct tm6000_fh { + struct tm6000_core *dev; + + /* video capture */ + struct tm6000_fmt *fmt; + unsigned int width,height; + struct videobuf_queue vb_vidq; + + enum v4l2_buf_type type; +}; + +#define TM6000_STD V4L2_STD_PAL|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc| \ + V4L2_STD_PAL_M|V4L2_STD_PAL_60|V4L2_STD_NTSC_M| \ + V4L2_STD_NTSC_M_JP|V4L2_STD_SECAM + +/* In tm6000-core.c */ +extern unsigned long tm6000_devused; + +int tm6000_read_write_usb (struct tm6000_core *dev, u8 reqtype, u8 req, + u16 value, u16 index, u8 *buf, u16 len); +int tm6000_get_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index); +int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index); +int tm6000_init (struct tm6000_core *dev); +int tm6000_init_after_firmware (struct tm6000_core *dev); + +int tm6000_init_analog_mode (struct tm6000_core *dev); +int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm); +int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate); + +int tm6000_v4l2_register(struct tm6000_core *dev); +int tm6000_v4l2_unregister(struct tm6000_core *dev); +int tm6000_v4l2_exit(void); +void tm6000_set_fourcc_format(struct tm6000_core *dev); + +/* In tm6000-i2c.c */ +int tm6000_i2c_register(struct tm6000_core *dev); +int tm6000_i2c_unregister(struct tm6000_core *dev); +void tm6000_i2c_call_clients(struct tm6000_core *dev, unsigned int cmd, + void *arg); + +/* In tm6000-queue.c */ + +int tm6000_v4l2_mmap(struct file *filp, struct vm_area_struct *vma); + +int tm6000_vidioc_streamon(struct file *file, void *priv, + enum v4l2_buf_type i); +int tm6000_vidioc_streamoff(struct file *file, void *priv, + enum v4l2_buf_type i); +int tm6000_vidioc_reqbufs (struct file *file, void *priv, + struct v4l2_requestbuffers *rb); +int tm6000_vidioc_querybuf (struct file *file, void *priv, + struct v4l2_buffer *b); +int tm6000_vidioc_qbuf (struct file *file, void *priv, struct v4l2_buffer *b); +int tm6000_vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *b); +ssize_t tm6000_v4l2_read(struct file *filp, char __user * buf, size_t count, + loff_t * f_pos); +unsigned int tm6000_v4l2_poll(struct file *file, + struct poll_table_struct *wait); +int tm6000_queue_init(struct tm6000_core *dev); + +/* Debug stuff */ + +extern int tm6000_debug; + +#define dprintk(dev, level, fmt, arg...) do {\ + if (tm6000_debug & level) \ + printk(KERN_INFO "(%lu) %s %s :"fmt, jiffies, \ + dev->name, __FUNCTION__ , ##arg); } while (0) + +#define V4L2_DEBUG_REG 0x0004 +#define V4L2_DEBUG_I2C 0x0008 +#define V4L2_DEBUG_QUEUE 0x0010 +#define V4L2_DEBUG_ISOC 0x0020 +#define V4L2_DEBUG_RES_LOCK 0x0040 /* Resource locking */ +#define V4L2_DEBUG_OPEN 0x0080 /* video open/close debug */ + +#define tm6000_err(fmt, arg...) do {\ + printk(KERN_ERR "tm6000 %s :"fmt, \ + __FUNCTION__ , ##arg); } while (0) + + diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 3793d168b44d..3c265603d735 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -369,6 +369,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ #define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ #define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ +#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ /* * F O R M A T E N U M E R A T I O N -- GitLab From 22927e8e0007fe653dd2824cf86b799b43e3bff8 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Thu, 14 Jun 2007 17:19:59 -0300 Subject: [PATCH 002/534] V4L/DVB (12772): tm6000: fix module load/unload Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 4 ++-- drivers/staging/tm6000/tm6000-video.c | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index b0719a52ef42..81f5ea613d80 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -230,6 +230,7 @@ static int tm6000_usb_probe(struct usb_interface *interface, /* Increment usage count */ tm6000_devused|=1<tm6000_corelist); dev->udev= usbdev; dev->model=id->driver_info; snprintf(dev->name, 29, "tm6000 #%d", nr); @@ -354,8 +355,6 @@ static void tm6000_usb_disconnect(struct usb_interface *interface) if (!dev) return; - tm6000_i2c_unregister(dev); - printk("tm6000: disconnecting %s\n", dev->name); mutex_lock(&dev->lock); @@ -369,6 +368,7 @@ static void tm6000_usb_disconnect(struct usb_interface *interface) dev->state |= DEV_DISCONNECTED; mutex_unlock(&dev->lock); + kfree(dev); } static struct usb_driver tm6000_usb_driver = { diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 970f3a11308d..ffd2fe7ed984 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1528,15 +1528,14 @@ int tm6000_v4l2_register(struct tm6000_core *dev) int tm6000_v4l2_unregister(struct tm6000_core *dev) { struct tm6000_core *h; - struct list_head *list; + struct list_head *pos, *tmp; - while (!list_empty(&tm6000_corelist)) { - list = tm6000_corelist.next; - h = list_entry(list, struct tm6000_core, tm6000_corelist); + video_unregister_device(&dev->vfd); + + list_for_each_safe(pos, tmp, &tm6000_corelist) { + h = list_entry(pos, struct tm6000_core, tm6000_corelist); if (h == dev) { - video_unregister_device(&dev->vfd); list_del(list); - kfree (h); } } -- GitLab From 8c9d26fd55ac7378ad0e2afd2bd122fa060bdaee Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Fri, 15 Jun 2007 11:02:56 -0300 Subject: [PATCH 003/534] V4L/DVB (12773): tm6000: fix module unregister Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index ffd2fe7ed984..41073ed2cb59 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1535,7 +1535,7 @@ int tm6000_v4l2_unregister(struct tm6000_core *dev) list_for_each_safe(pos, tmp, &tm6000_corelist) { h = list_entry(pos, struct tm6000_core, tm6000_corelist); if (h == dev) { - list_del(list); + list_del(pos); } } -- GitLab From 7c3f53ec491b64b3c3fa339e4e77e49782b0be9f Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Sat, 16 Jun 2007 23:21:48 -0300 Subject: [PATCH 004/534] V4L/DVB (12774): tm6000: fix module load/unload Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 6 ++++-- drivers/staging/tm6000/tm6000-video.c | 31 +++++++++++++++++++-------- drivers/staging/tm6000/tm6000.h | 2 +- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 81f5ea613d80..da2348e1c048 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -359,14 +359,16 @@ static void tm6000_usb_disconnect(struct usb_interface *interface) mutex_lock(&dev->lock); - tm6000_i2c_unregister(dev); - tm6000_v4l2_unregister(dev); + tm6000_i2c_unregister(dev); + // wake_up_interruptible_all(&dev->open); dev->state |= DEV_DISCONNECTED; + usb_put_dev(dev->udev); + mutex_unlock(&dev->lock); kfree(dev); } diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 41073ed2cb59..68002a14ef3d 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -3,6 +3,9 @@ Copyright (C) 2006-2007 Mauro Carvalho Chehab + Copyright (C) 2007 Michel Ludwig + - Fixed module load/unload + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 @@ -1153,7 +1156,7 @@ static int vidioc_s_input (struct file *file, void *priv, unsigned int i) if (!rc) { dev->input=i; - rc=vidioc_s_std (file, priv, &dev->vfd.current_norm); + rc=vidioc_s_std (file, priv, &dev->vfd->current_norm); } return (rc); @@ -1317,12 +1320,15 @@ static int tm6000_open(struct inode *inode, struct file *file) enum v4l2_buf_type type = 0; int i,rc; + printk(KERN_INFO "tm6000: open called (minor=%d)\n",minor); + + dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called " "(minor=%d)\n",minor); list_for_each(list,&tm6000_corelist) { h = list_entry(list, struct tm6000_core, tm6000_corelist); - if (h->vfd.minor == minor) { + if (h->vfd->minor == minor) { dev = h; type = V4L2_BUF_TYPE_VIDEO_CAPTURE; } @@ -1433,13 +1439,13 @@ static int tm6000_release(struct inode *inode, struct file *file) struct tm6000_dmaqueue *vidq = &dev->vidq; int minor = iminor(inode); + dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users); + tm6000_stop_thread(vidq); videobuf_mmap_free(&fh->vb_vidq); kfree (fh); - dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users); - return 0; } @@ -1505,7 +1511,14 @@ static struct video_device tm6000_template = { int tm6000_v4l2_register(struct tm6000_core *dev) { - int ret; + int ret = -1; + struct video_device *vfd; + + vfd = video_device_alloc(); + if(!vfd) { + return -ENOMEM; + } + dev->vfd = vfd; list_add_tail(&dev->tm6000_corelist,&tm6000_corelist); @@ -1517,10 +1530,10 @@ int tm6000_v4l2_register(struct tm6000_core *dev) dev->vidq.timeout.data = (unsigned long)dev; init_timer(&dev->vidq.timeout); - memcpy (&dev->vfd, &tm6000_template, sizeof(dev->vfd)); - dev->vfd.debug=tm6000_debug; + memcpy (dev->vfd, &tm6000_template, sizeof(*(dev->vfd))); + dev->vfd->debug=tm6000_debug; - ret = video_register_device(&dev->vfd, VFL_TYPE_GRABBER, video_nr); + ret = video_register_device(dev->vfd, VFL_TYPE_GRABBER, video_nr); printk(KERN_INFO "Trident TVMaster TM5600/TM6000 USB2 board (Load status: %d)\n", ret); return ret; } @@ -1530,7 +1543,7 @@ int tm6000_v4l2_unregister(struct tm6000_core *dev) struct tm6000_core *h; struct list_head *pos, *tmp; - video_unregister_device(&dev->vfd); + video_unregister_device(dev->vfd); list_for_each_safe(pos, tmp, &tm6000_corelist) { h = list_entry(pos, struct tm6000_core, tm6000_corelist); diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 623e85c351e1..c255adac98e5 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -119,7 +119,7 @@ struct tm6000_core { /* various device info */ unsigned int resources; - struct video_device vfd; + struct video_device *vfd; struct tm6000_dmaqueue vidq; int input; -- GitLab From 2cd4fd1e57cb6897612ead8a3d39ecb444920a1a Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Sun, 17 Jun 2007 17:12:32 -0300 Subject: [PATCH 005/534] V4L/DVB (12775): tm6000: fix usb_submit_urb to be called inside interrupt context Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 8 ++++++-- drivers/staging/tm6000/tm6000-video.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index da2348e1c048..df973c0cc46a 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -229,11 +229,15 @@ static int tm6000_usb_probe(struct usb_interface *interface, /* Increment usage count */ tm6000_devused|=1<name, 29, "tm6000 #%d", nr); + + dev->model=id->driver_info; + if ((card[nr]>=0) && (card[nr]model=card[nr]; + } INIT_LIST_HEAD(&dev->tm6000_corelist); dev->udev= usbdev; - dev->model=id->driver_info; - snprintf(dev->name, 29, "tm6000 #%d", nr); dev->devno=nr; switch (usbdev->speed) { diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 68002a14ef3d..5697be06ddd7 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -591,7 +591,7 @@ static int tm6000_start_thread( struct tm6000_dmaqueue *dma_q, /* submit urbs and enables IRQ */ for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { - rc = usb_submit_urb(dev->isoc_ctl.urb[i], GFP_KERNEL); + rc = usb_submit_urb(dev->isoc_ctl.urb[i], GFP_ATOMIC); if (rc) { tm6000_err("submit of urb %i failed (error=%i)\n", i, rc); -- GitLab From a58d35cb933f21a43fbdb5e4f575ff40faba3df2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 17 Jun 2007 17:14:12 -0300 Subject: [PATCH 006/534] V4L/DVB (12776): tm6000: decrement users count Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 5697be06ddd7..df3d835ce750 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1441,8 +1441,12 @@ static int tm6000_release(struct inode *inode, struct file *file) dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users); - tm6000_stop_thread(vidq); - videobuf_mmap_free(&fh->vb_vidq); + dev->users--; + + if (!dev->users) { + tm6000_stop_thread(vidq); + videobuf_mmap_free(&fh->vb_vidq); + } kfree (fh); -- GitLab From 0ec4acc6a6405c78a8655687d382ece0daf001b8 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Wed, 27 Jun 2007 17:01:50 -0300 Subject: [PATCH 007/534] V4L/DVB (12777): tm6000: Add support for Freecom Hybrid Stick / Moka DVB-T Receiver Dual Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index df973c0cc46a..139fd6f352af 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -29,12 +29,14 @@ #include "tm6000.h" -#define TM6000_BOARD_UNKNOWN 0 -#define TM5600_BOARD_GENERIC 1 -#define TM6000_BOARD_GENERIC 2 -#define TM5600_BOARD_10MOONS_UT821 3 -#define TM6000_BOARD_10MOONS_UT330 4 -#define TM6000_BOARD_ADSTECH_DUAL_TV 5 +#define TM6000_BOARD_UNKNOWN 0 +#define TM5600_BOARD_GENERIC 1 +#define TM6000_BOARD_GENERIC 2 +#define TM5600_BOARD_10MOONS_UT821 3 +#define TM6000_BOARD_10MOONS_UT330 4 +#define TM6000_BOARD_ADSTECH_DUAL_TV 5 +#define TM6000_BOARD_FREECOM_AND_SIMILAR 6 + #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; @@ -107,12 +109,25 @@ struct tm6000_board tm6000_boards[] = { .has_eeprom = 1, }, }, + [TM6000_BOARD_FREECOM_AND_SIMILAR] = { + .name = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual", + .tuner_type = TUNER_XC2028, + .tuner_addr = 0xc2, + .caps = { + .has_tuner = 1, + .has_dvb = 1, + .has_zl10353 = 1, + .has_eeprom = 0, + }, + }, + }; /* table of devices that work with this driver */ struct usb_device_id tm6000_id_table [] = { { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_10MOONS_UT821 }, { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV }, + { USB_DEVICE(0x14aa, 0x620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR }, { }, }; -- GitLab From 526835d5b30a591578f2813a8837ac70172c0aa9 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Fri, 29 Jun 2007 09:51:39 -0300 Subject: [PATCH 008/534] V4L/DVB (12778): tm6000: Fix SMBus Read Byte command Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 37 +++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 5e165ed25eee..80252b746699 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -3,6 +3,9 @@ Copyright (C) 2006-2007 Mauro Carvalho Chehab + Copyright (C) 2007 Michel Ludwig + - Fix SMBus Read Byte command + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 @@ -92,6 +95,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, { struct tm6000_core *dev = i2c_adap->algo_data; int addr, rc, i, byte; + u8 prev_reg = 0; if (num <= 0) return 0; @@ -100,25 +104,31 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, i2c_dprintk(2,"%s %s addr=0x%x len=%d:", (msgs[i].flags & I2C_M_RD) ? "read" : "write", i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); - if (!msgs[i].len) { /* Do I2C scan */ rc=tm6000_i2c_scan(i2c_adap, addr); } else if (msgs[i].flags & I2C_M_RD) { - char buf[msgs[i].len]; - memcpy(buf,msgs[i].buf, msgs[i].len-1); - buf[msgs[i].len-1]=0; - /* Read bytes */ /* I2C is assumed to have always a subaddr at the first byte of the message bus. Also, the first i2c value of the answer is returned out of message data. */ - rc = tm6000_read_write_usb (dev, - USB_DIR_IN | USB_TYPE_VENDOR, - REQ_16_SET_GET_I2CSEQ, - addr|(*msgs[i].buf)<<8, 0, - msgs[i].buf, msgs[i].len); + /* SMBus Read Byte command */ + if(msgs[i].len == 1) { + // we use the previously used register to read from + rc = tm6000_read_write_usb (dev, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_16_SET_GET_I2CSEQ, + addr | prev_reg<<8, 0, + msgs[i].buf, msgs[i].len); + } + else { + rc = tm6000_read_write_usb (dev, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_16_SET_GET_I2CSEQ, + addr|(*msgs[i].buf)<<8, 0, + msgs[i].buf, msgs[i].len); + } if (i2c_debug>=2) { for (byte = 0; byte < msgs[i].len; byte++) { printk(" %02x", msgs[i].buf[byte]); @@ -136,6 +146,13 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, REQ_16_SET_GET_I2CSEQ, addr|(*msgs[i].buf)<<8, 0, msgs[i].buf+1, msgs[i].len-1); + + if(msgs[i].len >= 1) { + prev_reg = msgs[i].buf[0]; + } + else { + prev_reg = 0; + } } if (i2c_debug>=2) printk("\n"); -- GitLab From a5adfbed09ffedb4ffa8e9a93dbd757096020470 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Mon, 2 Jul 2007 20:59:58 -0300 Subject: [PATCH 009/534] V4L/DVB (12779): tm6000: Correct dev init & Add general USB ctrl msg pause Add GPIO4 reset, which is required to make DVB-T work with the Freecom stick. Add a general 5 ms pause to the "tm6000_read_write_usb" method. Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index ea26f0daa82f..6becde2eace6 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -99,6 +99,8 @@ int tm6000_read_write_usb (struct tm6000_core *dev, u8 req_type, u8 req, kfree(data); + msleep(5); + return ret; } @@ -304,8 +306,8 @@ int tm6000_init (struct tm6000_core *dev) tm6000_set_reg (dev, REQ_05_SET_GET_USBREG, 0x18, 0x00); msleep(5); /* Just to be conservative */ - /* Reset GPIO1. Maybe, this is 10 Moons specific */ - for (i=0; i< 3; i++) { + /* Reset GPIO1 and GPIO4. */ + for (i=0; i< 2; i++) { rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_1, 0); if (rc<0) { printk (KERN_ERR "Error %i doing GPIO1 reset\n",rc); @@ -319,9 +321,26 @@ int tm6000_init (struct tm6000_core *dev) return rc; } + msleep(10); + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 0); + if (rc<0) { + printk (KERN_ERR "Error %i doing GPIO4 reset\n",rc); + return rc; + } + + msleep(10); + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 1); + if (rc<0) { + printk (KERN_ERR "Error %i doing GPIO4 reset\n",rc); + return rc; + } + if (!i) rc=tm6000_get_reg16(dev, 0x40,0,0); } + + msleep(50); + return 0; #endif /* HACK */ -- GitLab From 4f44dcec7141244ae4baba66c0334cc33c9bbd78 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Wed, 18 Jul 2007 10:26:38 -0300 Subject: [PATCH 010/534] V4L/DVB (12780): tm6000: Improve handling of SMBus Write Byte commands followed by a read command. SMBus Write Byte commands followed by a read command on the same I2C address are not sent out to the chip as they wouldn't have any effect. Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 80252b746699..2a8c169cf07f 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -141,6 +141,13 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, printk(" %02x", msgs[i].buf[byte]); } + /* SMBus Write Byte command followed by a read command */ + if(msgs[i].len == 1 && i+1 < num && msgs[i+1].flags & I2C_M_RD + && msgs[i+1].addr == msgs[i].addr) { + prev_reg = msgs[i].buf[0]; + continue; + } + rc = tm6000_read_write_usb (dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, REQ_16_SET_GET_I2CSEQ, -- GitLab From c85cba3fe6d44b3955a4c2e19efb7bb8156cab5d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 19 Jul 2007 11:09:58 -0300 Subject: [PATCH 011/534] V4L/DVB (12781): tm6000: Start adding support for GPIO device-specific parameters Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 11 ++++++++++- drivers/staging/tm6000/tm6000.h | 10 +++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 139fd6f352af..a10c9efd633e 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -28,6 +28,7 @@ #include #include "tm6000.h" +#include "tm6000-regs.h" #define TM6000_BOARD_UNKNOWN 0 #define TM5600_BOARD_GENERIC 1 @@ -43,6 +44,7 @@ static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; module_param_array(card, int, NULL, 0444); + struct tm6000_board { char *name; @@ -50,6 +52,8 @@ struct tm6000_board { int tuner_type; /* type of the tuner */ int tuner_addr; /* tuner address */ + + int gpio_addr_tun_reset; /* GPIO used for reset tuner */ }; @@ -59,6 +63,7 @@ struct tm6000_board tm6000_boards[] = { .caps = { .has_tuner = 1, }, + .gpio_addr_tun_reset = TM6000_GPIO_1, }, [TM5600_BOARD_GENERIC] = { .name = "Generic tm5600 board", @@ -67,6 +72,7 @@ struct tm6000_board tm6000_boards[] = { .caps = { .has_tuner = 1, }, + .gpio_addr_tun_reset = TM6000_GPIO_1, }, [TM6000_BOARD_GENERIC] = { .name = "Generic tm6000 board", @@ -76,6 +82,7 @@ struct tm6000_board tm6000_boards[] = { .has_tuner = 1, .has_dvb = 1, }, + .gpio_addr_tun_reset = TM6000_GPIO_1, }, [TM5600_BOARD_10MOONS_UT821] = { .name = "10Moons UT 821", @@ -85,6 +92,7 @@ struct tm6000_board tm6000_boards[] = { .has_tuner = 1, .has_eeprom = 1, }, + .gpio_addr_tun_reset = TM6000_GPIO_1, }, [TM6000_BOARD_10MOONS_UT330] = { .name = "10Moons UT 330", @@ -96,6 +104,7 @@ struct tm6000_board tm6000_boards[] = { .has_zl10353 = 1, .has_eeprom = 1, }, + .gpio_addr_tun_reset = TM6000_GPIO_4, }, [TM6000_BOARD_ADSTECH_DUAL_TV] = { .name = "ADSTECH Dual TV USB", @@ -127,7 +136,7 @@ struct tm6000_board tm6000_boards[] = { struct usb_device_id tm6000_id_table [] = { { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_10MOONS_UT821 }, { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV }, - { USB_DEVICE(0x14aa, 0x620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR }, + { USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR }, { }, }; diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index c255adac98e5..e8ae81d236b9 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -30,9 +30,13 @@ #define TM6000_VERSION KERNEL_VERSION(0, 0, 1) /* Inputs */ -#define TM6000_INPUT_TV 0 -#define TM6000_INPUT_COMPOSITE 1 -#define TM6000_INPUT_SVIDEO 2 + +enum tm6000_itype { + TM6000_INPUT_TV = 0, + TM6000_INPUT_COMPOSITE, + TM6000_INPUT_SVIDEO, +}; + /* ------------------------------------------------------------------ Basic structures -- GitLab From 95a838243b906e096275b179d4e7302f282c990e Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Tue, 24 Jul 2007 08:06:45 -0300 Subject: [PATCH 012/534] V4L/DVB (12782): tm6000: Correct some device capabilities Add tuner reset GPIO and demodulator address fields to the tm6000_core struct. Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 22 ++++++++++++---------- drivers/staging/tm6000/tm6000-video.c | 15 ++++++++++++++- drivers/staging/tm6000/tm6000.h | 8 ++++++-- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index a10c9efd633e..e8f88ea5ded9 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -34,11 +34,10 @@ #define TM5600_BOARD_GENERIC 1 #define TM6000_BOARD_GENERIC 2 #define TM5600_BOARD_10MOONS_UT821 3 -#define TM6000_BOARD_10MOONS_UT330 4 +#define TM5600_BOARD_10MOONS_UT330 4 #define TM6000_BOARD_ADSTECH_DUAL_TV 5 #define TM6000_BOARD_FREECOM_AND_SIMILAR 6 - #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; @@ -52,8 +51,8 @@ struct tm6000_board { int tuner_type; /* type of the tuner */ int tuner_addr; /* tuner address */ - - int gpio_addr_tun_reset; /* GPIO used for reset tuner */ + int demod_addr; /* demodulator address */ + int gpio_addr_tun_reset; /* GPIO used for tuner reset */ }; @@ -94,17 +93,16 @@ struct tm6000_board tm6000_boards[] = { }, .gpio_addr_tun_reset = TM6000_GPIO_1, }, - [TM6000_BOARD_10MOONS_UT330] = { + [TM5600_BOARD_10MOONS_UT330] = { .name = "10Moons UT 330", - .tuner_type = TUNER_XC2028, + .tuner_type = TUNER_PHILIPS_FQ1216AME_MK4, .tuner_addr = 0xc8, .caps = { .has_tuner = 1, - .has_dvb = 1, - .has_zl10353 = 1, + .has_dvb = 0, + .has_zl10353 = 0, .has_eeprom = 1, }, - .gpio_addr_tun_reset = TM6000_GPIO_4, }, [TM6000_BOARD_ADSTECH_DUAL_TV] = { .name = "ADSTECH Dual TV USB", @@ -122,14 +120,15 @@ struct tm6000_board tm6000_boards[] = { .name = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual", .tuner_type = TUNER_XC2028, .tuner_addr = 0xc2, + .demod_addr = 0x1e, .caps = { .has_tuner = 1, .has_dvb = 1, .has_zl10353 = 1, .has_eeprom = 0, }, + .gpio_addr_tun_reset = TM6000_GPIO_4, }, - }; /* table of devices that work with this driver */ @@ -152,6 +151,9 @@ static int tm6000_init_dev(struct tm6000_core *dev) /* Initializa board-specific data */ dev->tuner_type = tm6000_boards[dev->model].tuner_type; dev->tuner_addr = tm6000_boards[dev->model].tuner_addr; + dev->tuner_reset_gpio = tm6000_boards[dev->model].gpio_addr_tun_reset; + + dev->demod_addr = tm6000_boards[dev->model].demod_addr; dev->caps = tm6000_boards[dev->model].caps; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index df3d835ce750..d8e9f2714969 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -46,6 +46,10 @@ #define BUFFER_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ +/* Limits minimum and default number of buffers */ +#define TM6000_MIN_BUF 4 +#define TM6000_DEF_BUF 8 + /* Declare static vars that will be used as parameters */ static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ @@ -696,6 +700,7 @@ static void tm6000_vid_timeout(unsigned long data) /* ------------------------------------------------------------------ Videobuf operations ------------------------------------------------------------------*/ + static int buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) { @@ -703,9 +708,17 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) *size = fh->fmt->depth * fh->width * fh->height >> 3; if (0 == *count) - *count = 32; + *count = TM6000_DEF_BUF; + + if (*count < TM6000_MIN_BUF) { + *count=TM6000_MIN_BUF; + } + +printk("Requesting %d buffers\n",*count); + while (*size * *count > vid_limit * 1024 * 1024) (*count)--; + return 0; } diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index e8ae81d236b9..27bee627d3b7 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -110,8 +110,12 @@ struct tm6000_core { struct tm6000_capabilities caps; /* Tuner configuration */ - int tuner_type; /* type of the tuner */ - int tuner_addr; /* tuner address */ + int tuner_type; /* type of the tuner */ + int tuner_addr; /* tuner address */ + int tuner_reset_gpio; /* GPIO used for tuner reset */ + + /* Demodulator configuration */ + int demod_addr; /* demodulator address */ /* i2c i/o */ struct i2c_adapter i2c_adap; -- GitLab From 90d5802795173580db003699373058f74e5c9d0a Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Wed, 18 Jul 2007 10:29:10 -0300 Subject: [PATCH 013/534] V4L/DVB (12783): tm6000: add xc2028/3028 to dvb Add experimental DVB frontend tuner interface to xc2028/3028 Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 2a8c169cf07f..62cd08de03ff 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -343,6 +343,14 @@ static int tm6000_tuner_callback(void *ptr, int command, int arg) rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 1); break; + case 4: + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_4, 0x00); + msleep(10); + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_4, 0x01); + break; + } } return (rc); -- GitLab From ec50e8e6f19b623ff4c5590edf6118a53729369a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 18 Jul 2007 23:14:25 -0300 Subject: [PATCH 014/534] V4L/DVB (12784): tm6000: Some cleanups at the driver Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index d8e9f2714969..964ffd2ddda5 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -714,8 +714,6 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) *count=TM6000_MIN_BUF; } -printk("Requesting %d buffers\n",*count); - while (*size * *count > vid_limit * 1024 * 1024) (*count)--; -- GitLab From fb31ab4532902a3e9f3fd5103be6ac67d952bced Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Tue, 24 Jul 2007 08:08:52 -0300 Subject: [PATCH 015/534] V4L/DVB (12785): tm6000: allow user gpio address for tuner reset Modify tuner_callback to user the device's GPIO address field for tuner reset. Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 62cd08de03ff..a2986ae273fe 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -323,10 +323,10 @@ static int tm6000_tuner_callback(void *ptr, int command, int arg) switch (arg) { case 0: tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_1, 0x00); + dev->tuner_reset_gpio, 0x00); msleep(10); tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_1, 0x01); + dev->tuner_reset_gpio, 0x01); break; case 1: tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, @@ -343,14 +343,6 @@ static int tm6000_tuner_callback(void *ptr, int command, int arg) rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 1); break; - case 4: - tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_4, 0x00); - msleep(10); - tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_4, 0x01); - break; - } } return (rc); -- GitLab From a4cf976c77ce0865ceaa0f08cc1667538894936c Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Tue, 21 Aug 2007 16:05:43 -0300 Subject: [PATCH 016/534] V4L/DVB (12786): tm6000: Remove code dealing with the ZL10353 Remove code dealing with the ZL10353 as this is all handled by the ZL10353 module. Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index a2986ae273fe..e9e63df186fc 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -59,7 +59,6 @@ static int tm6000_i2c_scan(struct i2c_adapter *i2c_adap, int addr) if ( (dev->caps.has_tuner && (addr==dev->tuner_addr)) || (dev->caps.has_tda9874 && (addr==0xb0)) || - (dev->caps.has_zl10353 && (addr==0x1e)) || (dev->caps.has_eeprom && (addr==0xa0)) ) { printk("Hack: enabling device at addr 0x%02x\n",addr); @@ -271,30 +270,6 @@ static void dec_use(struct i2c_adapter *adap) msleep (10); \ } -int static init_zl10353 (struct tm6000_core *dev, u8 addr) -{ - int rc=0; - - mass_write (addr, 0x89, { 0x38 }); - mass_write (addr, 0x8a, { 0x2d }); - mass_write (addr, 0x50, { 0xff }); - mass_write (addr, 0x51, { 0x00 , 0x00 , 0x50 }); - mass_write (addr, 0x54, { 0x72 , 0x49 }); - mass_write (addr, 0x87, { 0x0e , 0x0e }); - mass_write (addr, 0x7b, { 0x04 }); - mass_write (addr, 0x57, { 0xb8 , 0xc2 }); - mass_write (addr, 0x59, { 0x00 , 0x02 , 0x00 , 0x00 , 0x01 }); - mass_write (addr, 0x59, { 0x00 , 0x00 , 0xb3 , 0xd0 , 0x01 }); - mass_write (addr, 0x58, { 0xc0 , 0x11 , 0xc5 , 0xc2 , 0xa4 , 0x01 }); - mass_write (addr, 0x5e, { 0x01 }); - mass_write (addr, 0x67, { 0x1c , 0x20 }); - mass_write (addr, 0x75, { 0x33 }); - mass_write (addr, 0x85, { 0x10 , 0x40 }); - mass_write (addr, 0x8c, { 0x0b , 0x00 , 0x40 , 0x00 }); - - return 0; -} - /* Tuner callback to provide the proper gpio changes needed for xc2028 */ static int tm6000_tuner_callback(void *ptr, int command, int arg) @@ -358,9 +333,6 @@ static int attach_inform(struct i2c_client *client) client->driver->driver.name, client->addr, client->name); switch (client->addr<<1) { - case 0x1e: - init_zl10353 (dev, client->addr); - return 0; case 0xa0: tm6000_i2c_eeprom(dev, eedata, sizeof(eedata)-1); eedata[sizeof(eedata)]='\0'; -- GitLab From 3169c9b26fffa180bc3bc81dc247df2f4824ee7d Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Tue, 21 Aug 2007 17:37:22 -0300 Subject: [PATCH 017/534] V4L/DVB (12788): tm6000: Add initial DVB-T support Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Makefile | 5 +- drivers/staging/tm6000/hack.c | 251 +++++++++++++++++++++ drivers/staging/tm6000/hack.h | 45 ++++ drivers/staging/tm6000/tm6000-cards.c | 19 +- drivers/staging/tm6000/tm6000-core.c | 29 +++ drivers/staging/tm6000/tm6000-dvb.c | 303 ++++++++++++++++++++++++++ drivers/staging/tm6000/tm6000.h | 28 ++- 7 files changed, 677 insertions(+), 3 deletions(-) create mode 100644 drivers/staging/tm6000/hack.c create mode 100644 drivers/staging/tm6000/hack.h create mode 100644 drivers/staging/tm6000/tm6000-dvb.c diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile index 1efc583c10a4..1fefe057d4e8 100644 --- a/drivers/staging/tm6000/Makefile +++ b/drivers/staging/tm6000/Makefile @@ -1,7 +1,10 @@ tm6000-objs := tm6000-cards.o \ tm6000-core.o \ tm6000-i2c.o \ - tm6000-video.o + tm6000-video.o \ + tm6000-dvb.o \ + hack.o \ + obj-$(CONFIG_VIDEO_TM6000) += tm6000.o diff --git a/drivers/staging/tm6000/hack.c b/drivers/staging/tm6000/hack.c new file mode 100644 index 000000000000..87f3f498e8eb --- /dev/null +++ b/drivers/staging/tm6000/hack.c @@ -0,0 +1,251 @@ + + + + + + +/* + hack.h - hackish code that needs to be improved (or removed) at a + later point + + Copyright (C) 2007 Michel Ludwig + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "hack.h" + +#include "tm6000.h" + +#include + +static inline int tm6000_snd_control_msg(struct tm6000_core *dev, __u8 request, __u16 value, __u16 index, void *data, __u16 size) +{ + return tm6000_read_write_usb (dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, request, value, index, data, size); +} + +static int pseudo_zl10353_pll(struct tm6000_core *tm6000_dev, struct dvb_frontend_parameters *p) +{ + int ret; + u8 *data = kzalloc(50*sizeof(u8), GFP_KERNEL); + +printk(KERN_ALERT "should set frequency %u\n", p->frequency); +printk(KERN_ALERT "and bandwith %u\n", p->u.ofdm.bandwidth); + + if(tm6000_dev->dvb->frontend->ops.tuner_ops.set_params) { + tm6000_dev->dvb->frontend->ops.tuner_ops.set_params(tm6000_dev->dvb->frontend, p); + } + else { + printk(KERN_ALERT "pseudo zl10353: couldn't set tuner parameters\n"); + } + + // init ZL10353 + data[0] = 0x0b; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x501e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x80; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x551e, 0x00, data, 0x1); + msleep(100); + data[0] = 0x01; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xea1e, 0x00, data, 0x1); + msleep(100); + data[0] = 0x00; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xea1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x1c; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x561e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x40; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5e1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x36; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x67; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1); + msleep(15); + data[0] = 0xe5; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x19; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0xe9; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x44; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x46; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x15; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x0f; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x75; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x01; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x00; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); + msleep(15); + + msleep(50); + + switch(p->u.ofdm.bandwidth) { + case BANDWIDTH_8_MHZ: + data[0] = 0x00; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x36; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x67; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1); + msleep(15); + data[0] = 0xe5; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x19; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0xe9; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x44; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x46; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x15; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x0f; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x75; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x01; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); + msleep(15); + break; + + default: + printk(KERN_ALERT "tm6000: bandwidth not supported\n"); + case BANDWIDTH_7_MHZ: + data[0] = 0x00; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x35; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x5a; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1); + msleep(15); + data[0] = 0xe9; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x19; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0xe9; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x44; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x46; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x15; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x0f; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x86; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1); + msleep(15); + data[0] = 0x01; + ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); + msleep(15); + break; + } + + kfree(data); + + return 0; +}; + + + +int pseudo_zl10353_set_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) +{ + struct tm6000_core *tm6000_dev = fe->dvb->priv; + u32 status; + + if(p != NULL) { +// mutex_lock(&tm6000_dev->mutex); + pseudo_zl10353_pll(tm6000_dev, p); +// mutex_unlock(&tm6000_dev->mutex); + } + + if(tm6000_dev->dvb->frontend->ops.read_status) { + tm6000_dev->dvb->frontend->ops.read_status(tm6000_dev->dvb->frontend, &status); + printk(KERN_ALERT "demodulator status: FE_HAS_CARRIER %i \n", (status & FE_HAS_CARRIER)); + printk(KERN_ALERT "demodulator status: FE_HAS_VITERBI %i \n", (status & FE_HAS_VITERBI)); + printk(KERN_ALERT "demodulator status: FE_HAS_LOCK %i \n", (status & FE_HAS_LOCK)); + printk(KERN_ALERT "demodulator status: FE_HAS_SYNC %i \n", (status & FE_HAS_SYNC)); + printk(KERN_ALERT "demodulator status: FE_HAS_SIGNAL %i \n", (status & FE_HAS_SIGNAL)); + } + else { + printk(KERN_ALERT "pseudo zl10353: couldn't read demodulator status\n"); + } + return 0; +} + +int pseudo_zl10353_read_status(struct dvb_frontend *fe, fe_status_t *status) +{ + + *status = FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK | FE_HAS_SIGNAL; + + return 0; +} + +struct dvb_frontend* pseudo_zl10353_attach(struct tm6000_core *dev, + const struct zl10353_config *config, + struct i2c_adapter *i2c) +{ + struct tm6000_dvb *dvb = dev->dvb; + + dvb->frontend = zl10353_attach(config, i2c); + if(!dvb->frontend) { + return NULL; + } + + /* override some functions with our implementations */ + dvb->frontend->ops.set_frontend = pseudo_zl10353_set_frontend; + dvb->frontend->ops.read_status = pseudo_zl10353_read_status; + dvb->frontend->frontend_priv = dev; + + return dvb->frontend; +} diff --git a/drivers/staging/tm6000/hack.h b/drivers/staging/tm6000/hack.h new file mode 100644 index 000000000000..96f1b61df682 --- /dev/null +++ b/drivers/staging/tm6000/hack.h @@ -0,0 +1,45 @@ +/* + hack.h - hackish code that needs to be improved (or removed) at a + later point + + Copyright (C) 2007 Michel Ludwig + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef HACK_H +#define HACK_H + +#include + +#include "zl10353.h" +#include "dvb_frontend.h" + +struct tm6000_core; + +int pseudo_zl103530_init(struct dvb_frontend *fe); + +int pseudo_zl10353_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p); + +int pseudo_zl10353_read_status(struct dvb_frontend *fe, fe_status_t *status); + +int pseudo_zl10353_read_signal_strength(struct dvb_frontend* fe, u16* strength); + +int pseudo_zl10353_read_snr(struct dvb_frontend *fe, u16 *snr); + +struct dvb_frontend* pseudo_zl10353_attach(struct tm6000_core *dev, + const struct zl10353_config *config, + struct i2c_adapter *i2c); + +#endif diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index e8f88ea5ded9..b41b3a46779f 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -185,7 +185,19 @@ static int tm6000_init_dev(struct tm6000_core *dev) dev->freq = f.frequency; tm6000_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); - + if(dev->caps.has_dvb) { + dev->dvb = kzalloc(sizeof(*(dev->dvb)), GFP_KERNEL); + if(!dev->dvb) { + rc = -ENOMEM; + goto err; + } + rc = tm6000_dvb_register(dev); + if(rc < 0) { + kfree(dev->dvb); + dev->dvb = NULL; + goto err; + } + } err: mutex_unlock(&dev->lock); return rc; @@ -389,6 +401,11 @@ static void tm6000_usb_disconnect(struct usb_interface *interface) mutex_lock(&dev->lock); + if(dev->dvb) { + tm6000_dvb_unregister(dev); + kfree(dev->dvb); + } + tm6000_v4l2_unregister(dev); tm6000_i2c_unregister(dev); diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 6becde2eace6..5e9325582bde 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -3,6 +3,9 @@ Copyright (C) 2006-2007 Mauro Carvalho Chehab + Copyright (C) 2007 Michel Ludwig + - DVB-T support + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 @@ -207,6 +210,32 @@ int tm6000_init_analog_mode (struct tm6000_core *dev) return 0; } +int tm6000_init_digital_mode (struct tm6000_core *dev) +{ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00ff, 0x08); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00ff, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x003f, 0x01); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00df, 0x08); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e2, 0x0c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e8, 0xff); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0xd8); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c0, 0x40); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c1, 0xd0); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c3, 0x09); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00da, 0x37); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d1, 0xd8); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d2, 0xc0); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d6, 0x60); + msleep(50); + + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00); + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x01); + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00); + + msleep(100); + + return 0; +} /* The meaning of those initializations are unknown */ u8 init_tab[][2] = { diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c new file mode 100644 index 000000000000..d2ec6ca766cb --- /dev/null +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -0,0 +1,303 @@ +/* + tm6000-dvb.c - dvb-t support for TM5600/TM6000 USB video capture devices + + Copyright (C) 2007 Michel Ludwig + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +#include "tm6000.h" +#include "tm6000-regs.h" + +#include "hack.h" + +#include "zl10353.h" + +#include + +static void tm6000_urb_received(struct urb *urb) +{ + int ret; + struct tm6000_core* dev = urb->context; + + if(urb->status != 0){ + printk(KERN_ERR "tm6000: status != 0\n"); + } + else if(urb->actual_length>0){ + dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer, + urb->actual_length); + } + + if(dev->dvb->streams > 0) { + ret = usb_submit_urb(urb, GFP_ATOMIC); + if(ret < 0) { + printk(KERN_ERR "tm6000: error %s\n", __FUNCTION__); + kfree(urb->transfer_buffer); + usb_free_urb(urb); + } + } +} + +int tm6000_start_stream(struct tm6000_core *dev) +{ + int ret; + unsigned int pipe, maxPaketSize; + struct tm6000_dvb *dvb = dev->dvb; + + printk(KERN_INFO "tm6000: got start stream request %s\n",__FUNCTION__); + + tm6000_init_digital_mode(dev); + +// ret = usb_set_interface(dev->udev, 0, 1); +// if (ret<0) +// return ret; + +/* + ret = tm6000_set_led_status(tm6000_dev, 0x1); + if(ret < 0) { + return -1; + } +*/ + + dvb->bulk_urb = usb_alloc_urb(0, GFP_KERNEL); + if(dvb->bulk_urb == NULL) { + printk(KERN_ERR "tm6000: couldn't allocate urb\n"); + return -ENOMEM; + } + + maxPaketSize = dev->bulk_in->desc.wMaxPacketSize; + + dvb->bulk_urb->transfer_buffer = kzalloc(maxPaketSize, GFP_KERNEL); + if(dvb->bulk_urb->transfer_buffer == NULL) { + usb_free_urb(dvb->bulk_urb); + printk(KERN_ERR "tm6000: couldn't allocate transfer buffer!\n"); + return -ENOMEM; + } + + pipe = usb_rcvbulkpipe(dev->udev, dev->bulk_in->desc.bEndpointAddress + & USB_ENDPOINT_NUMBER_MASK); + + usb_fill_bulk_urb(dvb->bulk_urb, dev->udev, pipe, + dvb->bulk_urb->transfer_buffer, + maxPaketSize, + tm6000_urb_received, dev); + ret = usb_clear_halt(dev->udev, pipe); + if(ret < 0) { + printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",ret,__FUNCTION__); +// return ret; + } + else { + printk(KERN_ERR "tm6000: pipe resetted\n"); + } + +// mutex_lock(&tm6000_driver.open_close_mutex); + ret = usb_submit_urb(dvb->bulk_urb, GFP_KERNEL); + + +// mutex_unlock(&tm6000_driver.open_close_mutex); + if (ret) { + printk(KERN_ERR "tm6000: submit of urb failed (error=%i)\n",ret); + + kfree(dvb->bulk_urb->transfer_buffer); + usb_free_urb(dvb->bulk_urb); + return ret; + } + + return 0; +} + +void tm6000_stop_stream(struct tm6000_core *dev) +{ + struct tm6000_dvb *dvb = dev->dvb; + +// tm6000_set_led_status(tm6000_dev, 0x0); + + if(dvb->bulk_urb) { + usb_kill_urb(dvb->bulk_urb); + kfree(dvb->bulk_urb->transfer_buffer); + usb_free_urb(dvb->bulk_urb); + dvb->bulk_urb = NULL; + } +} + +int tm6000_start_feed(struct dvb_demux_feed *feed) +{ + struct dvb_demux *demux = feed->demux; + struct tm6000_core *dev = demux->priv; + struct tm6000_dvb *dvb = dev->dvb; + printk(KERN_INFO "tm6000: got start feed request %s\n",__FUNCTION__); + + mutex_lock(&dvb->mutex); + if(dvb->streams == 0) { + dvb->streams = 1; +// mutex_init(&tm6000_dev->streaming_mutex); + tm6000_start_stream(dev); + } + else { + ++(dvb->streams); + } + mutex_unlock(&dvb->mutex); + + return 0; +} + +int tm6000_stop_feed(struct dvb_demux_feed *feed) { + struct dvb_demux *demux = feed->demux; + struct tm6000_core *dev = demux->priv; + struct tm6000_dvb *dvb = dev->dvb; + + printk(KERN_INFO "tm6000: got stop feed request %s\n",__FUNCTION__); + + mutex_lock(&dvb->mutex); + --dvb->streams; + + if(0 == dvb->streams) { + tm6000_stop_stream(dev); +// mutex_destroy(&tm6000_dev->streaming_mutex); + } + mutex_unlock(&dvb->mutex); +// mutex_destroy(&tm6000_dev->streaming_mutex); + + return 0; +} + +int tm6000_dvb_attach_frontend(struct tm6000_core *dev) +{ + struct tm6000_dvb *dvb = dev->dvb; + + if(dev->caps.has_zl10353) { + struct zl10353_config config = + {.demod_address = dev->demod_addr >> 1, + .no_tuner = 1, +// .input_frequency = 0x19e9, +// .r56_agc_targets = 0x1c, + }; + + dvb->frontend = pseudo_zl10353_attach(dev, &config, + &dev->i2c_adap); + } + else { + printk(KERN_ERR "tm6000: no frontend defined for the device!\n"); + return -1; + } + + if(dvb->frontend) { + return 0; + } + else { + return -1; + } +} + +int tm6000_dvb_register(struct tm6000_core *dev) +{ + int ret = -1; + struct tm6000_dvb *dvb = dev->dvb; + + mutex_init(&dvb->mutex); + + dvb->streams = 0; + + /* attach the frontend */ + ret = tm6000_dvb_attach_frontend(dev); + if(ret < 0) { + printk(KERN_ERR "tm6000: couldn't attach the frontend!\n"); +// goto err; + } + + ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T", + THIS_MODULE, &dev->udev->dev); + dvb->adapter.priv = dev; + + if(dvb->frontend) { + ret = dvb_register_frontend(&dvb->adapter, dvb->frontend); + if(ret < 0) { + printk("tm6000: couldn't register frontend\n"); + goto adapter_err; + } + + // attach the tuner like this for now + tm6000_i2c_call_clients(dev, VIDIOC_INT_DVB_TUNER_ATTACH, dvb->frontend); + + printk("tm6000: XC2028/3028 asked to be attached to frontend!\n"); + } + else { + printk("tm6000: no frontend found\n"); + } + + dvb->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING + | DMX_MEMORY_BASED_FILTERING; + dvb->demux.priv = dev; + dvb->demux.filternum = 256; + dvb->demux.feednum = 256; + dvb->demux.start_feed = tm6000_start_feed; + dvb->demux.stop_feed = tm6000_stop_feed; + dvb->demux.write_to_decoder = NULL; + ret = dvb_dmx_init(&dvb->demux); + if(ret < 0) { + printk("tm6000: dvb_dmx_init failed (errno = %d)\n", ret); + goto frontend_err; + } + + dvb->dmxdev.filternum = dev->dvb->demux.filternum; + dvb->dmxdev.demux = &dev->dvb->demux.dmx; + dvb->dmxdev.capabilities = 0; + + ret = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter); + if(ret < 0) { + printk("tm6000: dvb_dmxdev_init failed (errno = %d)\n", ret); + goto dvb_dmx_err; + } + + return 0; + +dvb_dmx_err: + dvb_dmx_release(&dvb->demux); +frontend_err: + if(dvb->frontend) { + dvb_unregister_frontend(dvb->frontend); + } +adapter_err: + dvb_unregister_adapter(&dvb->adapter); +err: + return ret; +} + +void tm6000_dvb_unregister(struct tm6000_core *dev) +{ + struct tm6000_dvb *dvb = dev->dvb; + + if(dvb->bulk_urb != NULL) { + struct urb *bulk_urb = dvb->bulk_urb; + + kfree(bulk_urb->transfer_buffer); + bulk_urb->transfer_buffer = NULL; + usb_unlink_urb(bulk_urb); + usb_free_urb(bulk_urb); + } + +// mutex_lock(&tm6000_driver.open_close_mutex); + if(dvb->frontend) { + dvb_unregister_frontend(dvb->frontend); + } + + dvb_dmxdev_release(&dvb->dmxdev); + dvb_dmx_release(&dvb->demux); + dvb_unregister_adapter(&dvb->adapter); + mutex_destroy(&dvb->mutex); +// mutex_unlock(&tm6000_driver.open_close_mutex); + +} diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 27bee627d3b7..3556fa4c403d 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -3,6 +3,9 @@ Copyright (C) 2006-2007 Mauro Carvalho Chehab + Copyright (C) 2007 Michel Ludwig + - DVB-T support + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 @@ -27,6 +30,11 @@ #include #include +#include +#include "dvb_demux.h" +#include "dvb_frontend.h" +#include "dmxdev.h" + #define TM6000_VERSION KERNEL_VERSION(0, 0, 1) /* Inputs */ @@ -97,12 +105,23 @@ struct tm6000_capabilities { unsigned int has_eeprom:1; }; +struct tm6000_dvb { + struct dvb_adapter adapter; + struct dvb_demux demux; + struct dvb_frontend *frontend; + struct dmxdev dmxdev; + unsigned int streams; + struct urb *bulk_urb; + struct mutex mutex; +}; + struct tm6000_core { /* generic device properties */ char name[30]; /* name (including minor) of the device */ int model; /* index in the device_data struct */ int devno; /* marks the number of this device */ - v4l2_std_id norm; /* Current norm */ + + v4l2_std_id norm; /* Current norm */ enum tm6000_core_state state; @@ -136,6 +155,9 @@ struct tm6000_core { enum tm6000_mode mode; + /* DVB-T support */ + struct tm6000_dvb *dvb; + /* locks */ struct mutex lock; @@ -181,9 +203,13 @@ int tm6000_init (struct tm6000_core *dev); int tm6000_init_after_firmware (struct tm6000_core *dev); int tm6000_init_analog_mode (struct tm6000_core *dev); +int tm6000_init_digital_mode (struct tm6000_core *dev); int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm); int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate); +int tm6000_dvb_register(struct tm6000_core *dev); +void tm6000_dvb_unregister(struct tm6000_core *dev); + int tm6000_v4l2_register(struct tm6000_core *dev); int tm6000_v4l2_unregister(struct tm6000_core *dev); int tm6000_v4l2_exit(void); -- GitLab From 5c0d0b21fd3868672b5a550093efa7a72e458ed7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Aug 2007 08:35:31 -0300 Subject: [PATCH 018/534] V4L/DVB (12789): tm6000: fix DVB dependency Compilation were causing errors, if DVB_CORE weren't selected. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Kconfig | 6 ++++++ drivers/staging/tm6000/Makefile | 8 +++++--- drivers/staging/tm6000/tm6000-cards.c | 4 ++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig index 841e026ecef0..231dda3d4bbf 100644 --- a/drivers/staging/tm6000/Kconfig +++ b/drivers/staging/tm6000/Kconfig @@ -12,3 +12,9 @@ config VIDEO_TM6000 an external software decoder to watch TV on your computer. Say Y if you own such a device and want to use it. + +config VIDEO_TM6000_DVB + bool "DVB Support for tm6000 based TV cards" + depends on VIDEO_TM6000 && DVB_CORE + ---help--- + This adds support for DVB cards based on the tm5600/tm6000 chip. diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile index 1fefe057d4e8..9b0e5b5bf3db 100644 --- a/drivers/staging/tm6000/Makefile +++ b/drivers/staging/tm6000/Makefile @@ -1,10 +1,12 @@ tm6000-objs := tm6000-cards.o \ tm6000-core.o \ tm6000-i2c.o \ - tm6000-video.o \ - tm6000-dvb.o \ - hack.o \ + tm6000-video.o +ifeq ($(CONFIG_VIDEO_TM6000_DVB),y) +tm6000-objs := tm6000-dvb.o \ + hack.o +endif obj-$(CONFIG_VIDEO_TM6000) += tm6000.o diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index b41b3a46779f..608de59c9c13 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -191,12 +191,14 @@ static int tm6000_init_dev(struct tm6000_core *dev) rc = -ENOMEM; goto err; } +#ifdef CONFIG_VIDEO_TM6000_DVB rc = tm6000_dvb_register(dev); if(rc < 0) { kfree(dev->dvb); dev->dvb = NULL; goto err; } +#endif } err: mutex_unlock(&dev->lock); @@ -401,10 +403,12 @@ static void tm6000_usb_disconnect(struct usb_interface *interface) mutex_lock(&dev->lock); +#ifdef CONFIG_VIDEO_TM6000_DVB if(dev->dvb) { tm6000_dvb_unregister(dev); kfree(dev->dvb); } +#endif tm6000_v4l2_unregister(dev); -- GitLab From 5f796752e80b76a81a066084c87dd86bf307dada Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 27 Aug 2007 07:55:05 -0300 Subject: [PATCH 019/534] V4L/DVB (12790): tm6000: check for errors on usb->status Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 85 ++++++++++++++++----------- 1 file changed, 51 insertions(+), 34 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 964ffd2ddda5..9557dfe95ef0 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -163,7 +163,7 @@ static void inline buffer_filled (struct tm6000_core *dev, struct tm6000_buffer *buf) { /* Advice that buffer was filled */ - dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] wakeup\n",buf,buf->vb.i); + dprintk(dev, V4L2_DEBUG_ISOC, "[%p/%d] wakeup\n",buf,buf->vb.i); buf->vb.state = STATE_DONE; buf->vb.field_count++; do_gettimeofday(&buf->vb.ts); @@ -314,7 +314,7 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, pos=0; /* Announces that a new buffer were filled */ buffer_filled (dev, *buf); - dprintk(dev, V4L2_DEBUG_QUEUE, "new buffer filled\n"); + dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); rc=get_next_buf (dma_q, buf); if (rc<=0) { @@ -329,6 +329,47 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, return rc; } +static void inline print_err_status (struct tm6000_core *dev, + int packet, int status) +{ + char *errmsg = "Unknown"; + + switch(status) { + case -ENOENT: + errmsg = "unlinked synchronuously"; + break; + case -ECONNRESET: + errmsg = "unlinked asynchronuously"; + break; + case -ENOSR: + errmsg = "Buffer error (overrun)"; + break; + case -EPIPE: + errmsg = "Stalled (device not responding)"; + break; + case -EOVERFLOW: + errmsg = "Babble (bad cable?)"; + break; + case -EPROTO: + errmsg = "Bit-stuff error (bad cable?)"; + break; + case -EILSEQ: + errmsg = "CRC/Timeout (could be anything)"; + break; + case -ETIME: + errmsg = "Device does not respond"; + break; + } + if (packet<0) { + dprintk(dev, V4L2_DEBUG_QUEUE, "URB status %d [%s].\n", + status, errmsg); + } else { + dprintk(dev, V4L2_DEBUG_QUEUE, "URB packet %d, status %d [%s].\n", + packet, status, errmsg); + } +} + + /* * Controls the isoc copy of each urb packet */ @@ -344,42 +385,18 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) copied=0; + if (urb->status<0) { + print_err_status (dev,-1,urb->status); + return 0; + } for (i = 0; i < urb->number_of_packets; i++) { int status = urb->iso_frame_desc[i].status; - char *errmsg = "Unknown"; - - switch(status) { - case -ENOENT: - errmsg = "unlinked synchronuously"; - break; - case -ECONNRESET: - errmsg = "unlinked asynchronuously"; - break; - case -ENOSR: - errmsg = "Buffer error (overrun)"; - break; - case -EPIPE: - errmsg = "Stalled (device not responding)"; - break; - case -EOVERFLOW: - errmsg = "Babble (bad cable?)"; - break; - case -EPROTO: - errmsg = "Bit-stuff error (bad cable?)"; - break; - case -EILSEQ: - errmsg = "CRC/Timeout (could be anything)"; - break; - case -ETIME: - errmsg = "Device does not respond"; - break; - } - dprintk(dev, V4L2_DEBUG_QUEUE, "URB status %d [%s].\n", - status, errmsg); - if (status<0) + if (status<0) { + print_err_status (dev,i,status); continue; + } len=urb->iso_frame_desc[i].actual_length; @@ -402,7 +419,7 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) if (((*buf)->fmt->fourcc)!=V4L2_PIX_FMT_TM6000) { buffer_filled (dev, *buf); - dprintk(dev, V4L2_DEBUG_QUEUE, "new buffer filled\n"); + dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); } return rc; -- GitLab From dc6a02aa35cc3c1dd84e06fa4ff300ae50bc5a70 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 27 Aug 2007 07:55:38 -0300 Subject: [PATCH 020/534] V4L/DVB (12791): tm6000: fix poll() method Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 9557dfe95ef0..f96c7a77efb6 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1449,9 +1449,8 @@ tm6000_poll(struct file *file, struct poll_table_struct *wait) buf = list_entry(fh->vb_vidq.stream.next,struct tm6000_buffer,vb.stream); } else { /* read() capture */ - buf = (struct tm6000_buffer*)fh->vb_vidq.read_buf; - if (NULL == buf) - return POLLERR; + return videobuf_poll_stream(file, &fh->vb_vidq, + wait); } poll_wait(file, &buf->vb.done, wait); if (buf->vb.state == STATE_DONE || -- GitLab From 88894cba79318fabc011a78094fe22ec953bfa97 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 3 Sep 2007 21:24:52 -0300 Subject: [PATCH 021/534] V4L/DVB (12793): tm6000: On some kernels, eeprom reading were generating a bug Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index e9e63df186fc..48473bdabb76 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -333,12 +333,6 @@ static int attach_inform(struct i2c_client *client) client->driver->driver.name, client->addr, client->name); switch (client->addr<<1) { - case 0xa0: - tm6000_i2c_eeprom(dev, eedata, sizeof(eedata)-1); - eedata[sizeof(eedata)]='\0'; - - printk("Board string ID = %s\n",eedata); - return 0; case 0xb0: request_module("tvaudio"); return 0; -- GitLab From 4475c0444303842743049c420f41de04907e44d9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 3 Sep 2007 21:51:45 -0300 Subject: [PATCH 022/534] V4L/DVB (12794): tm6000: handle also PAL/SECAM resolutions Fix the resolutions for 625 line video standards (european PAL/SECAM) Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 15 +++++++++++++ drivers/staging/tm6000/tm6000-video.c | 31 ++++++++------------------- drivers/staging/tm6000/tm6000.h | 2 ++ 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 5e9325582bde..c650d3e926a3 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -421,9 +421,24 @@ REG PAL PAL_M PAL_N SECAM NTSC Comp. PAL PAL_M PAL_N SECAM NTSC 0x3f 0x00 0x00 0x00 0x00 0x00 */ + +void tm6000_get_std_res(struct tm6000_core *dev) +{ + /* Currently, those are the only supported resoltions */ + if (dev->norm & V4L2_STD_525_60) { + dev->height=480; + } else { + dev->height=576; + } + dev->width=720; + +printk("tm6000: res= %dx%d\n",dev->width,dev->height); +} + int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm) { dev->norm=*norm; + tm6000_get_std_res(dev); /* HACK: Should use, instead, the common code!!! */ if (*norm & V4L2_STD_PAL_M) { diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index f96c7a77efb6..3470a55a5796 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -125,7 +125,7 @@ static LIST_HEAD(tm6000_corelist); ------------------------------------------------------------------*/ #define norm_maxw(a) 720 -#define norm_maxh(a) 480 +#define norm_maxh(a) 576 //#define norm_minw(a) norm_maxw(a) #define norm_minw(a) norm_maxw(a) @@ -758,15 +758,6 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, BUG_ON(NULL == fh->fmt); - if (fh->width < norm_minw(core) || fh->width > norm_maxw(core) || - fh->height < norm_minh(core) || fh->height > norm_maxh(core)) { - dprintk(dev, V4L2_DEBUG_QUEUE, "Window size (%dx%d) is out of " - "supported range\n", fh->width, fh->height); - dprintk(dev, V4L2_DEBUG_QUEUE, "Valid range is from (%dx%d) to " - "(%dx%d)\n", norm_minw(core), norm_minh(core), - norm_maxw(core),norm_maxh(core)); - return -EINVAL; - } /* FIXME: It assumes depth=2 */ /* The only currently supported format is 16 bits/pixel */ @@ -993,17 +984,10 @@ static int vidioc_try_fmt_cap (struct file *file, void *priv, return -EINVAL; } - if (f->fmt.pix.width < norm_minw(core)) - f->fmt.pix.width = norm_minw(core); - - if (f->fmt.pix.width > norm_maxw(core)) - f->fmt.pix.width = norm_maxw(core); + tm6000_get_std_res (dev); - if (f->fmt.pix.height < norm_minh(core)) - f->fmt.pix.height = norm_minh(core); - - if (f->fmt.pix.height > norm_maxh(core)) - f->fmt.pix.height = norm_maxh(core); + f->fmt.pix.width = dev->width; + f->fmt.pix.height = dev->height; f->fmt.pix.width &= ~0x01; @@ -1385,8 +1369,11 @@ static int tm6000_open(struct inode *inode, struct file *file) dev->fourcc = format[0].fourcc; fh->fmt = format_by_fourcc(dev->fourcc); - fh->width = norm_maxw(); - fh->height = norm_maxh(); + + tm6000_get_std_res (dev); + + fh->width = dev->width; + fh->height = dev->height; dprintk(dev, V4L2_DEBUG_OPEN, "Open: fh=0x%08lx, dev=0x%08lx, " "dev->vidq=0x%08lx\n", diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 3556fa4c403d..479b4fb520dd 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -122,6 +122,7 @@ struct tm6000_core { int devno; /* marks the number of this device */ v4l2_std_id norm; /* Current norm */ + int width,height; /* Selected resolution */ enum tm6000_core_state state; @@ -204,6 +205,7 @@ int tm6000_init_after_firmware (struct tm6000_core *dev); int tm6000_init_analog_mode (struct tm6000_core *dev); int tm6000_init_digital_mode (struct tm6000_core *dev); +void tm6000_get_std_res(struct tm6000_core *dev); int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm); int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate); -- GitLab From 71e7cfae31e4eb25e127d034ec71922c661dc958 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 6 Sep 2007 20:12:10 -0300 Subject: [PATCH 023/534] V4L/DVB (12795): tm6000: Fix buffering size At the first time an application were called, resolutions were wrong. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 3470a55a5796..65510d853814 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1102,6 +1102,10 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *norm) struct tm6000_core *dev = fh->dev; rc=tm6000_set_standard (dev, norm); + + fh->width = dev->width; + fh->height = dev->height; + if (rc<0) return rc; -- GitLab From 7e2fdf025ccb8c8ad9dfd3ec09d1fda73038593b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 19 Sep 2007 07:35:18 -0300 Subject: [PATCH 024/534] V4L/DVB (12796): tm6000: Add a hack for PAL standards The common code is not properly working. This hack should do the work for now. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index c650d3e926a3..5497b7c4aea8 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -442,6 +442,7 @@ int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm) /* HACK: Should use, instead, the common code!!! */ if (*norm & V4L2_STD_PAL_M) { +printk("calling PAL/M hack\n"); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe2, 0x00); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe8, 0x0f); @@ -475,6 +476,42 @@ int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm) return 0; } + if (*norm & V4L2_STD_PAL) { +printk("calling PAL hack\n"); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe2, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe8, 0x0f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x5f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe5, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x32); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0e); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x02, 0x5f); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x02); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x07, 0x01); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x25); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0xd5); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x63); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0x50); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1c, 0x1c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1d, 0xcc); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1e, 0xcc); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1f, 0xcd); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x8c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x31, 0xc1); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x0c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x1c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x52); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x04, 0xdc); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x07); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); + + return 0; + } + /* */ // tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x02, 0x01); // tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x02, 0x00); -- GitLab From c13dd70411e87e1ad1ccca0ba9bc3cf0a555e5a0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 19 Sep 2007 07:36:34 -0300 Subject: [PATCH 025/534] V4L/DVB (12797): tm6000: Allow selecting audio bitrate Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 2 ++ drivers/staging/tm6000/tm6000-video.c | 37 +++++++++++++++++++-------- drivers/staging/tm6000/tm6000.h | 1 + 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 5497b7c4aea8..3f2727d5b957 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -722,9 +722,11 @@ printk("Original value=%d\n",val); switch (bitrate) { case 44100: val|=0xd0; + dev->audio_bitrate=bitrate; break; case 48000: val|=0x60; + dev->audio_bitrate=bitrate; break; } val=tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, val); diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 65510d853814..ced4b478f6b1 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -566,8 +566,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, dev->isoc_ctl.urb[i] = urb; dev->isoc_ctl.transfer_buffer[i] = usb_buffer_alloc(dev->udev, - sb_size, GFP_KERNEL, - &dev->isoc_ctl.urb[i]->transfer_dma); + sb_size, GFP_KERNEL, &urb->transfer_dma); if (!dev->isoc_ctl.transfer_buffer[i]) { tm6000_err ("unable to allocate %i bytes for transfer" " buffer %i\n", sb_size, i); @@ -787,14 +786,32 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, urb_init=1; if (urb_init) { - /* Should allocate/request at least h - res x v res x 2 bytes/pixel */ - urbsize=(buf->vb.size+dev->max_isoc_in-1)/dev->max_isoc_in; - - /* Hack to allocate memory for Video + Audio */ - /* FIXME: should also consider header ovehead of - 4 bytes/180 bytes */ - urbsize+=((48000*4+24)/25+dev->max_isoc_in-1)/dev->max_isoc_in; + /* memory for video + Should be at least + Vres x Vres x 2 bytes/pixel by frame */ + urbsize=buf->vb.size; + + /* memory for audio + Should be at least + bitrate * 2 channels * 2 bytes / frame rate */ + if (dev->norm & V4L2_STD_525_60) { + urbsize+=(dev->audio_bitrate*4+29)/30; + } else { + urbsize+=(dev->audio_bitrate*4+24)/25; + } + + /* each audio frame seeems to have a frame number + with 2 bytes */ + urbsize+=2; + + /* Add 4 bytes by each 180 bytes frame */ + urbsize+=((urbsize+179)/180)*4; + + /* Round to an enough number of URBs */ + urbsize=(urbsize+dev->max_isoc_in-1)/dev->max_isoc_in; + + +printk("Allocating %d packets to handle %lu size\n", urbsize,buf->vb.size); dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %d packets to handle " "%lu size\n", urbsize,buf->vb.size); diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 479b4fb520dd..a5977e7ce51b 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -137,6 +137,7 @@ struct tm6000_core { /* Demodulator configuration */ int demod_addr; /* demodulator address */ + int audio_bitrate; /* i2c i/o */ struct i2c_adapter i2c_adap; struct i2c_client i2c_client; -- GitLab From e2c9500d1023623516a33b0fcb4cc62ba2419a03 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 19 Sep 2007 15:39:22 -0300 Subject: [PATCH 026/534] V4L/DVB (12798): tm6000: Split header processing from header find Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 163 ++++++++++++++------------ 1 file changed, 87 insertions(+), 76 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index ced4b478f6b1..44d455f2d315 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -185,16 +185,14 @@ static void inline buffer_filled (struct tm6000_core *dev, /* * Identify the tm5600/6000 buffer header type and properly handles */ -static int copy_streams(u8 *data, u8 *out_p, unsigned long len, - struct urb *urb, struct tm6000_buffer **buf) +static u8 *copy_packet (struct urb *urb, u32 header, u8 *data, u8 *endp, + u8 *out_p, struct tm6000_buffer **buf) { struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - u8 *ptr=data, *endp=data+len; + u8 *ptr=data; u8 c; unsigned int cmd, cpysize, pktsize, size, field, block, line, pos=0; - unsigned long header; - int rc=0; /* FIXME: this is the hardcoded window size */ @@ -202,6 +200,87 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, //static int last_line=-2; + if (!dev->isoc_ctl.cmd) { + c=(header>>24) & 0xff; + + /* split the header fields */ + size = (((header & 0x7e)<<1) -1) *4; + block = (header>>7) & 0xf; + field = (header>>11) & 0x1; + line = (header>>12) & 0x1ff; + cmd = (header>>21) & 0x7; + + /* Validates header fields */ + if(size>TM6000_URB_MSG_LEN) + size=TM6000_URB_MSG_LEN; + if(block>=8) + cmd = TM6000_URB_MSG_ERR; + + /* FIXME: Mounts the image as field0+field1 + * It should, instead, check if the user selected + * entrelaced or non-entrelaced mode + */ + pos=((line<<1)+field)*linesize+ + block*TM6000_URB_MSG_LEN; + + /* Don't allow to write out of the buffer */ + if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) + cmd = TM6000_URB_MSG_ERR; + + /* Prints debug info */ + dprintk(dev, V4L2_DEBUG_ISOC, "size=%d, num=%d, " + " line=%d, field=%d\n", + size, block, line, field); + + pktsize = TM6000_URB_MSG_LEN; +///////////////////////////// +/// nao seria size??? + + } else { + /* Continue the last copy */ + cmd = dev->isoc_ctl.cmd; + size= dev->isoc_ctl.size; + pos = dev->isoc_ctl.pos; + pktsize = dev->isoc_ctl.pktsize; + } + + cpysize=(endp-ptr>size)?size:endp-ptr; + + if (cpysize) { + /* handles each different URB message */ + switch(cmd) { + case TM6000_URB_MSG_VIDEO: + /* Fills video buffer */ + bufcpy(*buf,&out_p[pos],ptr,cpysize); + break; + } + } + if (cpysizeisoc_ctl.pos = pos+cpysize; + dev->isoc_ctl.size= size-cpysize; + dev->isoc_ctl.cmd = cmd; + dev->isoc_ctl.pktsize = pktsize-cpysize; + ptr+=cpysize; + } else { + dev->isoc_ctl.cmd = 0; + ptr+=pktsize; + } + + return ptr; +} + +static int copy_streams(u8 *data, u8 *out_p, unsigned long len, + struct urb *urb, struct tm6000_buffer **buf) +{ + struct tm6000_dmaqueue *dma_q = urb->context; + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + u8 *ptr=data, *endp=data+len; + u32 header=0; + int rc=0; + for (ptr=data; ptrisoc_ctl.cmd) { /* Seek for sync */ @@ -217,77 +296,10 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, /* Get message header */ header=*(unsigned long *)ptr; ptr+=4; - c=(header>>24) & 0xff; - - /* split the header fields */ - size = (((header & 0x7e)<<1) -1) *4; - block = (header>>7) & 0xf; - field = (header>>11) & 0x1; - line = (header>>12) & 0x1ff; - cmd = (header>>21) & 0x7; - - /* FIXME: Maximum possible line is 511. - * This doesn't seem to be enough for PAL standards - */ - - /* Validates header fields */ - if(size>TM6000_URB_MSG_LEN) - size=TM6000_URB_MSG_LEN; - if(block>=8) - cmd = TM6000_URB_MSG_ERR; - - /* FIXME: Mounts the image as field0+field1 - * It should, instead, check if the user selected - * entrelaced or non-entrelaced mode - */ - pos=((line<<1)+field)*linesize+ - block*TM6000_URB_MSG_LEN; - - - - /* Don't allow to write out of the buffer */ - if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) - cmd = TM6000_URB_MSG_ERR; - - /* Prints debug info */ - dprintk(dev, V4L2_DEBUG_ISOC, "size=%d, num=%d, " - " line=%d, field=%d\n", - size, block, line, field); - - dev->isoc_ctl.cmd = cmd; - dev->isoc_ctl.size = size; - dev->isoc_ctl.pos = pos; - dev->isoc_ctl.pktsize = pktsize = TM6000_URB_MSG_LEN; - } else { - cmd = dev->isoc_ctl.cmd; - size= dev->isoc_ctl.size; - pos = dev->isoc_ctl.pos; - pktsize = dev->isoc_ctl.pktsize; - } - cpysize=(endp-ptr>size)?size:endp-ptr; - - if (cpysize) { - /* handles each different URB message */ - switch(cmd) { - case TM6000_URB_MSG_VIDEO: - /* Fills video buffer */ - bufcpy(*buf,&out_p[pos],ptr,cpysize); - break; - } - } - if (cpysizeisoc_ctl.pos = pos+cpysize; - dev->isoc_ctl.size= size-cpysize; - dev->isoc_ctl.cmd = cmd; - dev->isoc_ctl.pktsize = pktsize-cpysize; - ptr+=cpysize; - } else { - dev->isoc_ctl.cmd = 0; - ptr+=pktsize; } + + /* Copy or continue last copy */ + ptr=copy_packet(urb,header,ptr,endp,out_p,buf); } return rc; @@ -810,7 +822,6 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, /* Round to an enough number of URBs */ urbsize=(urbsize+dev->max_isoc_in-1)/dev->max_isoc_in; - printk("Allocating %d packets to handle %lu size\n", urbsize,buf->vb.size); dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %d packets to handle " -- GitLab From cc6c60d912ceeb390a0969a7c76dc05fa3fffaa9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 19 Sep 2007 16:24:05 -0300 Subject: [PATCH 027/534] V4L/DVB (12799): tm6000: avoid troubles if a header is broken on separate URBs Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-usb-isoc.h | 3 ++ drivers/staging/tm6000/tm6000-video.c | 56 ++++++++++++++++++------ 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-usb-isoc.h b/drivers/staging/tm6000/tm6000-usb-isoc.h index 27b103f939d9..83a4ed0d1bca 100644 --- a/drivers/staging/tm6000/tm6000-usb-isoc.h +++ b/drivers/staging/tm6000/tm6000-usb-isoc.h @@ -38,4 +38,7 @@ struct usb_isoc_ctl { /* Last field: ODD or EVEN? */ int field; + + u32 tmp_buf; + int tmp_buf_len; }; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 44d455f2d315..372850c3e70b 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -212,7 +212,7 @@ static u8 *copy_packet (struct urb *urb, u32 header, u8 *data, u8 *endp, /* Validates header fields */ if(size>TM6000_URB_MSG_LEN) - size=TM6000_URB_MSG_LEN; + size = TM6000_URB_MSG_LEN; if(block>=8) cmd = TM6000_URB_MSG_ERR; @@ -220,8 +220,7 @@ static u8 *copy_packet (struct urb *urb, u32 header, u8 *data, u8 *endp, * It should, instead, check if the user selected * entrelaced or non-entrelaced mode */ - pos=((line<<1)+field)*linesize+ - block*TM6000_URB_MSG_LEN; + pos=((line<<1)+field)*linesize+block*TM6000_URB_MSG_LEN; /* Don't allow to write out of the buffer */ if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) @@ -232,6 +231,7 @@ static u8 *copy_packet (struct urb *urb, u32 header, u8 *data, u8 *endp, " line=%d, field=%d\n", size, block, line, field); + pktsize = TM6000_URB_MSG_LEN; ///////////////////////////// /// nao seria size??? @@ -251,8 +251,9 @@ static u8 *copy_packet (struct urb *urb, u32 header, u8 *data, u8 *endp, switch(cmd) { case TM6000_URB_MSG_VIDEO: /* Fills video buffer */ - bufcpy(*buf,&out_p[pos],ptr,cpysize); - break; + if (__copy_to_user(&out_p[pos],ptr,cpysize)!=0) + tm6000_err("copy_to_user failed.\n"); + break; } } if (cpysizecontext; struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); u8 *ptr=data, *endp=data+len; - u32 header=0; + unsigned long header=0; int rc=0; for (ptr=data; ptrisoc_ctl.cmd) { + u8 *p=(u8 *)&dev->isoc_ctl.tmp_buf; + /* FIXME: This seems very complex + * It just recovers up to 3 bytes of the header that + * might be at the previous packet + */ + if (dev->isoc_ctl.tmp_buf_len) { + while (dev->isoc_ctl.tmp_buf_len) { + if ( *(ptr+3-dev->isoc_ctl.tmp_buf_len) == 0x47) { + break; + } + p++; + dev->isoc_ctl.tmp_buf_len--; + } + if (dev->isoc_ctl.tmp_buf_len) { + memcpy (&header,p, + dev->isoc_ctl.tmp_buf_len); + memcpy (((u8 *)header)+ + dev->isoc_ctl.tmp_buf, + ptr, + 4-dev->isoc_ctl.tmp_buf_len); + ptr+=4-dev->isoc_ctl.tmp_buf_len; + goto HEADER; + } + } /* Seek for sync */ - for (ptr+=3;ptr=endp) + + if (ptr+3>=endp) { + dev->isoc_ctl.tmp_buf_len=endp-ptr; + memcpy (&dev->isoc_ctl.tmp_buf,ptr, + dev->isoc_ctl.tmp_buf_len); + dev->isoc_ctl.cmd=0; return rc; + } /* Get message header */ header=*(unsigned long *)ptr; ptr+=4; } - +HEADER: /* Copy or continue last copy */ ptr=copy_packet(urb,header,ptr,endp,out_p,buf); } @@ -581,7 +610,8 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, sb_size, GFP_KERNEL, &urb->transfer_dma); if (!dev->isoc_ctl.transfer_buffer[i]) { tm6000_err ("unable to allocate %i bytes for transfer" - " buffer %i\n", sb_size, i); + " buffer %i, in int=%i\n", + sb_size, i, in_interrupt()); tm6000_uninit_isoc(dev); return -ENOMEM; } -- GitLab From a228618c1a2c15da35f8cc60286a25541fbc6348 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 22 Sep 2007 02:06:25 -0300 Subject: [PATCH 028/534] V4L/DVB (12800): tm6000: fix tm6000 analog video buffer handling Previously, there were no sync between video buffer filling and received URBs. So, the presented image were a mix of frame and frame-1. Now, a filled buffer should contain only data for that frame. allocates a maximum of 64 KB per each URB area. This fixed two bugs: - Sometimes, there were no available continuos block of about 1 MB; - Image weren't not properly updated, since parts of the URBs aren't updated. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-usb-isoc.h | 7 + drivers/staging/tm6000/tm6000-video.c | 198 ++++++++++++++++------- 2 files changed, 147 insertions(+), 58 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-usb-isoc.h b/drivers/staging/tm6000/tm6000-usb-isoc.h index 83a4ed0d1bca..42de91715185 100644 --- a/drivers/staging/tm6000/tm6000-usb-isoc.h +++ b/drivers/staging/tm6000/tm6000-usb-isoc.h @@ -39,6 +39,13 @@ struct usb_isoc_ctl { /* Last field: ODD or EVEN? */ int field; + /* Stores incomplete commands */ u32 tmp_buf; int tmp_buf_len; + + /* Stores already requested buffers */ + struct tm6000_buffer *buf; + + /* Stores the number of received fields */ + int nfields; }; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 372850c3e70b..f7e8a3710b37 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -147,12 +147,6 @@ static int inline get_next_buf (struct tm6000_dmaqueue *dma_q, *buf = list_entry(dma_q->active.next, struct tm6000_buffer, vb.queue); - /* Nobody is waiting something to be done, just return */ - if (!waitqueue_active(&(*buf)->vb.done)) { - mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); - return -1; - } - return 1; } @@ -160,8 +154,19 @@ static int inline get_next_buf (struct tm6000_dmaqueue *dma_q, * Announces that a buffer were filled and request the next */ static void inline buffer_filled (struct tm6000_core *dev, + struct tm6000_dmaqueue *dma_q, struct tm6000_buffer *buf) { + /* Nobody is waiting something to be done, just return */ + if (!waitqueue_active(&buf->vb.done)) { + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + + printk(KERN_ERR "tm6000: buffer underrun at %ld\n", + jiffies); + + return; + } + /* Advice that buffer was filled */ dprintk(dev, V4L2_DEBUG_ISOC, "[%p/%d] wakeup\n",buf,buf->vb.i); buf->vb.state = STATE_DONE; @@ -182,23 +187,36 @@ static void inline buffer_filled (struct tm6000_core *dev, tm6000_err("copy_to_user failed.\n"); \ } + +const char *tm6000_msg_type[]= { + "unknown(0)", //0 + "video", //1 + "audio", //2 + "vbi", //3 + "pts", //4 + "err", //5 + "unknown(6)", //6 + "unknown(7)", //7 +}; + /* * Identify the tm5600/6000 buffer header type and properly handles */ -static u8 *copy_packet (struct urb *urb, u32 header, u8 *data, u8 *endp, +static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp, u8 *out_p, struct tm6000_buffer **buf) { struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - u8 *ptr=data; u8 c; unsigned int cmd, cpysize, pktsize, size, field, block, line, pos=0; + int rc=0; + /* FIXME: move to tm6000-isoc */ + static int last_line=-2, start_line=-2, last_field=-2; /* FIXME: this is the hardcoded window size */ - unsigned int linesize=720*2; + unsigned int linewidth=(*buf)->vb.width<<1; -//static int last_line=-2; if (!dev->isoc_ctl.cmd) { c=(header>>24) & 0xff; @@ -213,29 +231,71 @@ static u8 *copy_packet (struct urb *urb, u32 header, u8 *data, u8 *endp, /* Validates header fields */ if(size>TM6000_URB_MSG_LEN) size = TM6000_URB_MSG_LEN; - if(block>=8) - cmd = TM6000_URB_MSG_ERR; - /* FIXME: Mounts the image as field0+field1 - * It should, instead, check if the user selected - * entrelaced or non-entrelaced mode - */ - pos=((line<<1)+field)*linesize+block*TM6000_URB_MSG_LEN; + if (cmd == TM6000_URB_MSG_VIDEO) { + if ((block+1)*TM6000_URB_MSG_LEN>linewidth) + cmd = TM6000_URB_MSG_ERR; + + /* FIXME: Mounts the image as field0+field1 + * It should, instead, check if the user selected + * entrelaced or non-entrelaced mode + */ + pos= ((line<<1)+field)*linewidth + + block*TM6000_URB_MSG_LEN; + + /* Don't allow to write out of the buffer */ + if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) { + dprintk(dev, V4L2_DEBUG_ISOC, + "ERR: size=%d, num=%d, line=%d, " + "field=%d\n", + size, block, line, field); - /* Don't allow to write out of the buffer */ - if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) - cmd = TM6000_URB_MSG_ERR; + cmd = TM6000_URB_MSG_ERR; + } + } else { + pos=0; + } /* Prints debug info */ dprintk(dev, V4L2_DEBUG_ISOC, "size=%d, num=%d, " " line=%d, field=%d\n", size, block, line, field); + if ((last_line!=line)&&(last_line+1!=line) && + (cmd != TM6000_URB_MSG_ERR) ) { + if (cmd != TM6000_URB_MSG_VIDEO) { + dprintk(dev, V4L2_DEBUG_ISOC, "cmd=%d, " + "size=%d, num=%d, line=%d, field=%d\n", + cmd, size, block, line, field); + } + if (start_line<0) + start_line=last_line; + /* Prints debug info */ + dprintk(dev, V4L2_DEBUG_ISOC, "lines= %d-%d, " + "field=%d\n", + start_line, last_line, field); + + if ((start_line<6 && last_line>200) && + (last_field != field) ) { + + dev->isoc_ctl.nfields++; + if (dev->isoc_ctl.nfields>=2) { + dev->isoc_ctl.nfields=0; + + /* Announces that a new buffer were filled */ + buffer_filled (dev, dma_q, *buf); + dprintk(dev, V4L2_DEBUG_ISOC, + "new buffer filled\n"); + rc=get_next_buf (dma_q, buf); + } + } + + start_line=line; + last_field=field; + } + last_line=line; pktsize = TM6000_URB_MSG_LEN; -///////////////////////////// -/// nao seria size??? - } else { /* Continue the last copy */ cmd = dev->isoc_ctl.cmd; @@ -244,16 +304,27 @@ static u8 *copy_packet (struct urb *urb, u32 header, u8 *data, u8 *endp, pktsize = dev->isoc_ctl.pktsize; } - cpysize=(endp-ptr>size)?size:endp-ptr; + cpysize=(endp-(*ptr)>size)?size:endp-(*ptr); if (cpysize) { /* handles each different URB message */ switch(cmd) { case TM6000_URB_MSG_VIDEO: /* Fills video buffer */ - if (__copy_to_user(&out_p[pos],ptr,cpysize)!=0) + if (__copy_to_user(&out_p[pos],*ptr,cpysize)!=0) tm6000_err("copy_to_user failed.\n"); - break; + + break; + case TM6000_URB_MSG_PTS: + break; + case TM6000_URB_MSG_AUDIO: +/* Need some code to process audio */ +printk ("%ld: cmd=%s, size=%d\n", jiffies, + tm6000_msg_type[cmd],size); + break; + default: + dprintk (dev, V4L2_DEBUG_ISOC, "cmd=%s, size=%d\n", + tm6000_msg_type[cmd],size); } } if (cpysizeisoc_ctl.size= size-cpysize; dev->isoc_ctl.cmd = cmd; dev->isoc_ctl.pktsize = pktsize-cpysize; - ptr+=cpysize; + (*ptr)+=cpysize; } else { dev->isoc_ctl.cmd = 0; - ptr+=pktsize; + (*ptr)+=pktsize; } - return ptr; + return rc; } static int copy_streams(u8 *data, u8 *out_p, unsigned long len, @@ -328,10 +399,16 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, } HEADER: /* Copy or continue last copy */ - ptr=copy_packet(urb,header,ptr,endp,out_p,buf); + rc=copy_packet(urb,header,&ptr,endp,out_p,buf); + if (rc<0) { + buf=NULL; + printk(KERN_ERR "tm6000: buffer underrun at %ld\n", + jiffies); + return rc; + } } - return rc; + return 0; } /* * Identify the tm5600/6000 buffer header type and properly handles @@ -354,13 +431,11 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, if (pos >= (*buf)->vb.size) { pos=0; /* Announces that a new buffer were filled */ - buffer_filled (dev, *buf); + buffer_filled (dev, dma_q, *buf); dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); - rc=get_next_buf (dma_q, buf); if (rc<=0) { *buf=NULL; - printk(KERN_ERR "tm6000: buffer underrun\n"); break; } } @@ -441,7 +516,7 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) len=urb->iso_frame_desc[i].actual_length; - if (len>=TM6000_URB_MSG_LEN) { +// if (len>=TM6000_URB_MSG_LEN) { p=urb->transfer_buffer + urb->iso_frame_desc[i].offset; if (!urb->iso_frame_desc[i].status) { if (((*buf)->fmt->fourcc)==V4L2_PIX_FMT_TM6000) { @@ -449,20 +524,14 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) if (rc<=0) return rc; } else { - rc=copy_streams(p,outp,len,urb,buf); + copy_streams(p,outp,len,urb,buf); } } copied += len; if (copied>=size) break; - } - } - - if (((*buf)->fmt->fourcc)!=V4L2_PIX_FMT_TM6000) { - buffer_filled (dev, *buf); - dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); +// } } - return rc; } @@ -483,13 +552,18 @@ static void tm6000_irq_callback(struct urb *urb) spin_lock_irqsave(&dev->slock,flags); - rc=get_next_buf (dma_q, &buf); - if (rc<=0) - goto ret; + buf=dev->isoc_ctl.buf; + + if (!buf) { + rc=get_next_buf (dma_q, &buf); + if (rc<=0) + goto ret; + } /* Copy data from URB */ rc=tm6000_isoc_copy(urb, &buf); + dev->isoc_ctl.buf=buf; ret: /* Reset urb buffers */ for (i = 0; i < urb->number_of_packets; i++) { @@ -504,13 +578,9 @@ static void tm6000_irq_callback(struct urb *urb) } if (rc>=0) { - if (!rc) { - dprintk(dev, V4L2_DEBUG_QUEUE, "No active queue to serve\n"); - del_timer(&dma_q->timeout); - } else { /* Data filled, reset watchdog */ mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); - } +// } } spin_unlock_irqrestore(&dev->slock,flags); } @@ -523,6 +593,8 @@ static void tm6000_uninit_isoc(struct tm6000_core *dev) struct urb *urb; int i; + dev->isoc_ctl.nfields=-1; + dev->isoc_ctl.buf=NULL; for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { urb=dev->isoc_ctl.urb[i]; if (urb) { @@ -610,8 +682,9 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, sb_size, GFP_KERNEL, &urb->transfer_dma); if (!dev->isoc_ctl.transfer_buffer[i]) { tm6000_err ("unable to allocate %i bytes for transfer" - " buffer %i, in int=%i\n", - sb_size, i, in_interrupt()); + " buffer %i%s\n", + sb_size, i, + in_interrupt()?" while in int":""); tm6000_uninit_isoc(dev); return -ENOMEM; } @@ -795,7 +868,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, struct tm6000_fh *fh = vq->priv_data; struct tm6000_buffer *buf = container_of(vb,struct tm6000_buffer,vb); struct tm6000_core *dev = fh->dev; - int rc=0, urbsize, urb_init=0; + int rc=0, urbsize, urb_init=0, npackets=1; BUG_ON(NULL == fh->fmt); @@ -833,6 +906,9 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, Vres x Vres x 2 bytes/pixel by frame */ urbsize=buf->vb.size; + /* Need also one PTS */ + urbsize+=180; + /* memory for audio Should be at least bitrate * 2 channels * 2 bytes / frame rate */ @@ -852,11 +928,17 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, /* Round to an enough number of URBs */ urbsize=(urbsize+dev->max_isoc_in-1)/dev->max_isoc_in; -printk("Allocating %d packets to handle %lu size\n", urbsize,buf->vb.size); + /* Avoids allocating big memory areas for URB */ + while ((urbsize*dev->max_isoc_in)/npackets>65535) { + npackets++; + } + urbsize/=(urbsize+npackets-1)/npackets; + + dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %dx%d packets" + " of %d bytes each to handle %lu size\n", + npackets,urbsize,dev->max_isoc_in,buf->vb.size); - dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %d packets to handle " - "%lu size\n", urbsize,buf->vb.size); - rc = tm6000_prepare_isoc(dev, urbsize, 2); + rc = tm6000_prepare_isoc(dev, urbsize, npackets); if (rc<0) goto fail; -- GitLab From 4386136d29327a6645f7dba963d609d2452db843 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Mon, 24 Sep 2007 17:01:49 -0300 Subject: [PATCH 029/534] V4L/DVB (12801): tm6000: Add support for ADSTech Mini Dual TV (PTV-339). Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 19 +++++++++++++++++-- drivers/staging/tm6000/tm6000-core.c | 7 ++++++- drivers/staging/tm6000/tm6000-dvb.c | 19 ++++++++++++++----- drivers/staging/tm6000/tm6000-i2c.c | 6 ++++-- drivers/staging/tm6000/tm6000.h | 1 + 5 files changed, 42 insertions(+), 10 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 608de59c9c13..c16f765aae57 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -37,6 +37,7 @@ #define TM5600_BOARD_10MOONS_UT330 4 #define TM6000_BOARD_ADSTECH_DUAL_TV 5 #define TM6000_BOARD_FREECOM_AND_SIMILAR 6 +#define TM6000_BOARD_ADSTECH_MINI_DUAL_TV 7 #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; @@ -55,7 +56,6 @@ struct tm6000_board { int gpio_addr_tun_reset; /* GPIO used for tuner reset */ }; - struct tm6000_board tm6000_boards[] = { [TM6000_BOARD_UNKNOWN] = { .name = "Unknown tm6000 video grabber", @@ -118,9 +118,23 @@ struct tm6000_board tm6000_boards[] = { }, [TM6000_BOARD_FREECOM_AND_SIMILAR] = { .name = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual", - .tuner_type = TUNER_XC2028, + .tuner_type = TUNER_XC2028, /* has a XC3028 */ .tuner_addr = 0xc2, .demod_addr = 0x1e, + .caps = { + .has_tuner = 1, + .has_dvb = 1, + .has_zl10353 = 1, + .has_eeprom = 0, + .has_remote = 1, + }, + .gpio_addr_tun_reset = TM6000_GPIO_4, + }, + [TM6000_BOARD_ADSTECH_MINI_DUAL_TV] = { + .name = "ADSTECH Mini Dual TV USB", + .tuner_type = TUNER_XC2028, /* has a XC3028 */ + .tuner_addr = 0xc8, + .demod_addr = 0x1e, .caps = { .has_tuner = 1, .has_dvb = 1, @@ -136,6 +150,7 @@ struct usb_device_id tm6000_id_table [] = { { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_10MOONS_UT821 }, { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV }, { USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR }, + { USB_DEVICE(0x06e1, 0xb339), .driver_info = TM6000_BOARD_ADSTECH_MINI_DUAL_TV }, { }, }; diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 3f2727d5b957..7728e40a34db 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -226,12 +226,17 @@ int tm6000_init_digital_mode (struct tm6000_core *dev) tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d1, 0xd8); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d2, 0xc0); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d6, 0x60); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e2, 0x0c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e8, 0xff); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0x08); msleep(50); tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00); + msleep(50); tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x01); + msleep(50); tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00); - msleep(100); return 0; diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index d2ec6ca766cb..9df93cfe3106 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -61,10 +61,6 @@ int tm6000_start_stream(struct tm6000_core *dev) tm6000_init_digital_mode(dev); -// ret = usb_set_interface(dev->udev, 0, 1); -// if (ret<0) -// return ret; - /* ret = tm6000_set_led_status(tm6000_dev, 0x1); if(ret < 0) { @@ -94,10 +90,17 @@ int tm6000_start_stream(struct tm6000_core *dev) dvb->bulk_urb->transfer_buffer, maxPaketSize, tm6000_urb_received, dev); + + ret = usb_set_interface(dev->udev, 0, 1); + if(ret < 0) { + printk(KERN_ERR "tm6000: error %i in %s during set interface\n", ret, __FUNCTION__); + return ret; + } + ret = usb_clear_halt(dev->udev, pipe); if(ret < 0) { printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",ret,__FUNCTION__); -// return ret; + return ret; } else { printk(KERN_ERR "tm6000: pipe resetted\n"); @@ -121,10 +124,16 @@ int tm6000_start_stream(struct tm6000_core *dev) void tm6000_stop_stream(struct tm6000_core *dev) { + int ret; struct tm6000_dvb *dvb = dev->dvb; // tm6000_set_led_status(tm6000_dev, 0x0); + ret = usb_set_interface(dev->udev, 0, 0); + if(ret < 0) { + printk(KERN_ERR "tm6000: error %i in %s during set interface\n",ret,__FUNCTION__); + } + if(dvb->bulk_urb) { usb_kill_urb(dvb->bulk_urb); kfree(dvb->bulk_urb->transfer_buffer); diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 48473bdabb76..10c7d947d53e 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -299,9 +299,10 @@ static int tm6000_tuner_callback(void *ptr, int command, int arg) case 0: tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, dev->tuner_reset_gpio, 0x00); - msleep(10); + msleep(130); tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, dev->tuner_reset_gpio, 0x01); + msleep(130); break; case 1: tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, @@ -314,9 +315,10 @@ static int tm6000_tuner_callback(void *ptr, int command, int arg) TM6000_GPIO_CLK, 0); if (rc<0) return rc; - msleep(10); + msleep(100); rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_CLK, 1); + msleep(100); break; } } diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index a5977e7ce51b..ffc55019390d 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -103,6 +103,7 @@ struct tm6000_capabilities { unsigned int has_dvb:1; unsigned int has_zl10353:1; unsigned int has_eeprom:1; + unsigned int has_remote:1; }; struct tm6000_dvb { -- GitLab From 106bdbe24ea9038cecc01c168324af59343092ee Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 27 Sep 2007 18:27:35 -0300 Subject: [PATCH 030/534] V4L/DVB (12802): tm6000: adds command to enable audio output at tm6000 Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 7728e40a34db..8a645fe8e5a3 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -478,6 +478,12 @@ printk("calling PAL/M hack\n"); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x04, 0xdc); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x07); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); + + /* Enables audio and AV */ + /* maybe it should be, instead, 0x20 */ + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xcc, 0x60); + tm6000_set_reg (dev, REQ_08_SET_GET_AVREG_BIT, 0x01, 0x80); + return 0; } -- GitLab From 7f9b1412f56eb5ec10694c27f93bd33276be0465 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 1 Oct 2007 06:45:22 -0300 Subject: [PATCH 031/534] V4L/DVB (12803): tm6000: make tm6000_devused static Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 2 ++ drivers/staging/tm6000/tm6000-video.c | 2 -- drivers/staging/tm6000/tm6000.h | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index c16f765aae57..5544b8a26197 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -44,6 +44,8 @@ static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; module_param_array(card, int, NULL, 0444); +static unsigned long tm6000_devused; + struct tm6000_board { char *name; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index f7e8a3710b37..58fcf6ae6069 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -54,8 +54,6 @@ static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ -unsigned long tm6000_devused; - /* Debug level */ int tm6000_debug; diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index ffc55019390d..045e676cc8fa 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -196,7 +196,6 @@ struct tm6000_fh { V4L2_STD_NTSC_M_JP|V4L2_STD_SECAM /* In tm6000-core.c */ -extern unsigned long tm6000_devused; int tm6000_read_write_usb (struct tm6000_core *dev, u8 reqtype, u8 req, u16 value, u16 index, u8 *buf, u16 len); -- GitLab From 2b971af2384a11db0dbdb82e41fd9577ffaea46f Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Wed, 10 Oct 2007 03:50:10 -0300 Subject: [PATCH 032/534] V4L/DVB (12804): tm6000: Build the module properly if CONFIG_VIDEO_TM6000_DVB is selected. Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile index 9b0e5b5bf3db..294e0ce49ac9 100644 --- a/drivers/staging/tm6000/Makefile +++ b/drivers/staging/tm6000/Makefile @@ -4,7 +4,7 @@ tm6000-objs := tm6000-cards.o \ tm6000-video.o ifeq ($(CONFIG_VIDEO_TM6000_DVB),y) -tm6000-objs := tm6000-dvb.o \ +tm6000-objs += tm6000-dvb.o \ hack.o endif -- GitLab From c1a1641450e769f534df4d1217f3feec8e38ea37 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 15 Oct 2007 15:43:50 -0300 Subject: [PATCH 033/534] V4L/DVB (12805): tm6000: Fix a memory leak at tm6000-video if a transfer buffer allocation fails, the last allocated urb is leaked (it hasn't been stored in dev->urb[] yet so tm6000_uninit_isoc misses it). The patch also includes a small typo fix. Thanks to Florin Malita for pointing this. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 58fcf6ae6069..cdaf44806e3e 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -672,6 +672,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, if (!urb) { tm6000_err("cannot alloc isoc_ctl.urb %i\n", i); tm6000_uninit_isoc(dev); + usb_free_urb(urb); return -ENOMEM; } dev->isoc_ctl.urb[i] = urb; -- GitLab From 7594304ee775608256b60b3628e795306196a283 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 23 Oct 2007 16:36:55 -0300 Subject: [PATCH 034/534] V4L/DVB (12806): tm6000: Select VIDEO_TUNER for tm6000 devices Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig index 231dda3d4bbf..7e236a223b81 100644 --- a/drivers/staging/tm6000/Kconfig +++ b/drivers/staging/tm6000/Kconfig @@ -1,6 +1,7 @@ config VIDEO_TM6000 tristate "TV Master TM5600/6000 driver" select VIDEO_V4L2 + select VIDEO_TUNER select TUNER_XC2028 select VIDEO_USB_ISOC select VIDEOBUF_VMALLOC -- GitLab From d544f2c33f39086fe08cfabe98bd2a36592c5ffb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Oct 2007 09:22:08 -0300 Subject: [PATCH 035/534] V4L/DVB (12807): tm6000: Properly select xc2028 parameters Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 22 ++++++++++++++++++++++ drivers/staging/tm6000/tm6000-core.c | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 5544b8a26197..c60863470180 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -29,6 +29,7 @@ #include "tm6000.h" #include "tm6000-regs.h" +#include "tuner-xc2028.h" #define TM6000_BOARD_UNKNOWN 0 #define TM5600_BOARD_GENERIC 1 @@ -156,6 +157,24 @@ struct usb_device_id tm6000_id_table [] = { { }, }; +static void tm6000_config_tuner (struct tm6000_core *dev) +{ + struct v4l2_priv_tun_config xc2028_cfg; + struct xc2028_ctrl ctl; + + memset (&ctl,0,sizeof(ctl)); + + ctl.fname = "tm6000-xc3028.fw"; + ctl.type = XC2028_FIRM_MTS; + + xc2028_cfg.tuner = TUNER_XC2028; + xc2028_cfg.priv = &ctl; + +printk("Setting firmware parameters for tm6000\n"); + + tm6000_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); +} + static int tm6000_init_dev(struct tm6000_core *dev) { struct v4l2_frequency f; @@ -191,6 +210,9 @@ static int tm6000_init_dev(struct tm6000_core *dev) /* Request tuner */ request_module ("tuner"); + + tm6000_config_tuner (dev); + // norm=V4L2_STD_NTSC_M; dev->norm=V4L2_STD_PAL_M; tm6000_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm); diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 8a645fe8e5a3..bef528f2413b 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -375,9 +375,9 @@ int tm6000_init (struct tm6000_core *dev) msleep(50); - return 0; - #endif /* HACK */ + + return 0; } #define tm6000_wrt(dev,req,reg,val, data...) \ -- GitLab From 5200401ad8a80b95b3ba5636580f10adc74b6b60 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 09:51:13 -0300 Subject: [PATCH 036/534] V4L/DVB (12808): tm6000: Move analog tv standards to tm6000-stds tm5600/6000/6010 requires a large config table for video standards. Better to move this to their own file. Also added register settings for tm6010 (needs testing. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Makefile | 3 +- drivers/staging/tm6000/tm6000-core.c | 340 ----------- drivers/staging/tm6000/tm6000-stds.c | 852 +++++++++++++++++++++++++++ drivers/staging/tm6000/tm6000.h | 6 +- 4 files changed, 858 insertions(+), 343 deletions(-) create mode 100644 drivers/staging/tm6000/tm6000-stds.c diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile index 294e0ce49ac9..e4297cae93e2 100644 --- a/drivers/staging/tm6000/Makefile +++ b/drivers/staging/tm6000/Makefile @@ -1,7 +1,8 @@ tm6000-objs := tm6000-cards.o \ tm6000-core.o \ tm6000-i2c.o \ - tm6000-video.o + tm6000-video.o \ + tm6000-stds.o ifeq ($(CONFIG_VIDEO_TM6000_DVB),y) tm6000-objs += tm6000-dvb.o \ diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index bef528f2413b..ddd61ca3d1d0 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -380,346 +380,6 @@ int tm6000_init (struct tm6000_core *dev) return 0; } -#define tm6000_wrt(dev,req,reg,val, data...) \ - { const static u8 _val[] = data; \ - tm6000_read_write_usb(dev,USB_DIR_OUT | USB_TYPE_VENDOR, \ - req,reg, val, (u8 *) _val, ARRAY_SIZE(_val)); \ - } - -/* -TM5600/6000 register values to set video standards. - There's an adjust, common to all, for composite video - Additional adjustments are required for S-Video, based on std. - - Standards values for TV S-Video Changes -REG PAL PAL_M PAL_N SECAM NTSC Comp. PAL PAL_M PAL_N SECAM NTSC -0xdf 0x1f 0x1f 0x1f 0x1f 0x1f -0xe2 0x00 0x00 0x00 0x00 0x00 -0xe8 0x0f 0x0f 0x0f 0x0f 0x0f 0x00 0x00 0x00 0x00 0x00 -0xeb 0x60 0x60 0x60 0x60 0x60 0x64 0x64 0x64 0x64 0x64 0x64 -0xd5 0x5f 0x5f 0x5f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f 0x4f -0xe3 0x00 0x00 0x00 0x00 0x00 0x10 0x10 0x10 0x10 0x10 0x10 -0xe5 0x00 0x00 0x00 0x00 0x00 0x10 0x10 0x10 0x10 0x10 -0x3f 0x01 0x01 0x01 0x01 0x01 -0x00 0x32 0x04 0x36 0x38 0x00 0x33 0x05 0x37 0x39 0x01 -0x01 0x0e 0x0e 0x0e 0x0e 0x0f -0x02 0x5f 0x5f 0x5f 0x5f 0x5f -0x03 0x02 0x00 0x02 0x02 0x00 0x04 0x04 0x04 0x03 0x03 -0x07 0x01 0x01 0x01 0x01 0x01 0x00 0x00 -0x17 0xcd 0xcd 0xcd 0xcd 0xcd 0x8b -0x18 0x25 0x1e 0x1e 0x24 0x1e -0x19 0xd5 0x83 0x91 0x92 0x8b -0x1a 0x63 0x0a 0x1f 0xe8 0xa2 -0x1b 0x50 0xe0 0x0c 0xed 0xe9 -0x1c 0x1c 0x1c 0x1c 0x1c 0x1c -0x1d 0xcc 0xcc 0xcc 0xcc 0xcc -0x1e 0xcc 0xcc 0xcc 0xcc 0xcc -0x1f 0xcd 0xcd 0xcd 0xcd 0xcd -0x2e 0x8c 0x88 0x8c 0x8c 0x88 0x88 -0x30 0x2c 0x20 0x2c 0x2c 0x22 0x2a 0x22 0x22 0x2a -0x31 0xc1 0x61 0xc1 0xc1 0x61 -0x33 0x0c 0x0c 0x0c 0x2c 0x1c -0x35 0x1c 0x1c 0x1c 0x18 0x1c -0x82 0x52 0x52 0x52 0x42 0x42 -0x04 0xdc 0xdc 0xdc 0xdd -0x0d 0x07 0x07 0x07 0x87 0x07 -0x3f 0x00 0x00 0x00 0x00 0x00 -*/ - - -void tm6000_get_std_res(struct tm6000_core *dev) -{ - /* Currently, those are the only supported resoltions */ - if (dev->norm & V4L2_STD_525_60) { - dev->height=480; - } else { - dev->height=576; - } - dev->width=720; - -printk("tm6000: res= %dx%d\n",dev->width,dev->height); -} - -int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm) -{ - dev->norm=*norm; - tm6000_get_std_res(dev); - - /* HACK: Should use, instead, the common code!!! */ - if (*norm & V4L2_STD_PAL_M) { -printk("calling PAL/M hack\n"); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe2, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe8, 0x0f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x5f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe5, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x04); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0e); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x02, 0x5f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x07, 0x01); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x1e); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x83); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x0a); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0xe0); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1c, 0x1c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1d, 0xcc); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1e, 0xcc); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1f, 0xcd); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x88); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x20); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x31, 0x61); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x0c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x1c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x52); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x04, 0xdc); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x07); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); - - /* Enables audio and AV */ - /* maybe it should be, instead, 0x20 */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xcc, 0x60); - tm6000_set_reg (dev, REQ_08_SET_GET_AVREG_BIT, 0x01, 0x80); - - return 0; - } - - if (*norm & V4L2_STD_PAL) { -printk("calling PAL hack\n"); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe2, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe8, 0x0f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x5f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe5, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x32); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0e); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x02, 0x5f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x02); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x07, 0x01); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x25); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0xd5); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x63); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0x50); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1c, 0x1c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1d, 0xcc); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1e, 0xcc); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1f, 0xcd); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x8c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x31, 0xc1); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x0c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x1c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x52); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x04, 0xdc); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x07); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); - - return 0; - } - - /* */ -// tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x02, 0x01); -// tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x02, 0x00); - - /* Set registers common to all standards */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe2, 0x00); - - switch (dev->input) { - case TM6000_INPUT_TV: - /* Seems to disable ADC2 - needed for TV and RCA */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe8, 0x0f); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); - - if (*norm & V4L2_STD_PAL) { - /* Enable UV_FLT_EN */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x5f); - } else { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x4f); - } - - /* E3: Select input 0 */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe5, 0x10); - - break; - case TM6000_INPUT_COMPOSITE: - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x64); - /* E3: Select input 1 */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x10); - break; - case TM6000_INPUT_SVIDEO: - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe8, 0x00); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x64); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd5, 0x4f); - /* E3: Select input 1 */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x10); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe5, 0x10); - - break; - } - - /* Software reset */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x02, 0x5f); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x07, 0x01); -// tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x17, 0xcd); - - /* Horizontal Sync DTO = 0x1ccccccd */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1c, 0x1c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1d, 0xcc); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1e, 0xcc); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1f, 0xcd); - - /* Vertical Height */ - if (*norm & V4L2_STD_525_60) { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x31, 0x61); - } else { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x31, 0xc1); - } - - /* Horizontal Length */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2f, 640/8); - - if (*norm & V4L2_STD_PAL) { - /* Common to All PAL Standards */ - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0e); - - /* Vsync Hsinc Lockout End */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x0c); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x1c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x52); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x04, 0xdc); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x07); - if (*norm & V4L2_STD_PAL_M) { - - /* Chroma DTO */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x1e); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x83); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x0a); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0xe0); - - /* Active Video Horiz Start Time */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x88); - - if (dev->input==TM6000_INPUT_SVIDEO) { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x05); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x04); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x22); - } else { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x04); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x20); - } - } else if (*norm & V4L2_STD_PAL_N) { - /* Chroma DTO */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x1e); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x91); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x1f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0x0c); - - if (dev->input==TM6000_INPUT_SVIDEO) { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x37); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x04); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x88); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x22); - } else { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x36); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x02); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x8c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); - } - } else { // Other PAL standards - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x25); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0xd5); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0x63); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0x50); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x8c); - - if (dev->input==TM6000_INPUT_SVIDEO) { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x33); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x04); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2a); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); - } else { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x32); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x02); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); - } - } - } if (*norm & V4L2_STD_SECAM) { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0e); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x24); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x92); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0xe8); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0xed); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x8c); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x2c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x18); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x42); - // Register 0x04 is not initialized on SECAM - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x87); - - if (dev->input==TM6000_INPUT_SVIDEO) { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x39); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x03); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2a); - } else { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x38); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x02); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x2c); - } - } else { /* NTSC */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x01, 0x0f); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x18, 0x1e); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x19, 0x8b); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1a, 0xa2); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x1b, 0xe9); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x2e, 0x88); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x30, 0x22); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x33, 0x1c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x35, 0x1c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x82, 0x42); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0d, 0x07); - if (dev->input==TM6000_INPUT_SVIDEO) { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x01); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x03); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x07, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x17, 0x8b); - } else { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x03, 0x00); - } - } - - - /* End of software reset */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); - - msleep(40); - - return 0; -} - int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate) { int val; diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c new file mode 100644 index 000000000000..d74793a8d596 --- /dev/null +++ b/drivers/staging/tm6000/tm6000-stds.c @@ -0,0 +1,852 @@ +/* + tm6000-stds.c - driver for TM5600/TM6000 USB video capture devices + + Copyright (C) 2007 Mauro Carvalho Chehab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation version 2 + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include "tm6000.h" +#include "tm6000-regs.h" + +struct tm6000_reg_settings { + unsigned char req; + unsigned char reg; + unsigned char value; +}; + +struct tm6000_std_tv_settings { + v4l2_std_id id; + struct tm6000_reg_settings sif[12]; + struct tm6000_reg_settings nosif[12]; + struct tm6000_reg_settings common[25]; +}; + +struct tm6000_std_settings { + v4l2_std_id id; + struct tm6000_reg_settings common[37]; +}; + +static struct tm6000_std_tv_settings tv_stds[] = { + { + .id = V4L2_STD_PAL_M, + .sif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, + {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {0, 0, 0}, + }, + .nosif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {0, 0, 0}, + }, + .common = { + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x04}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x00}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, + {REQ_07_SET_GET_AVREG, 0x19, 0x83}, + {REQ_07_SET_GET_AVREG, 0x1a, 0x0a}, + {REQ_07_SET_GET_AVREG, 0x1b, 0xe0}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, + {REQ_07_SET_GET_AVREG, 0x30, 0x20}, + {REQ_07_SET_GET_AVREG, 0x31, 0x61}, + {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x52}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_PAL_Nc, + .sif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, + {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {0, 0, 0}, + }, + .nosif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {0, 0, 0}, + }, + .common = { + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x36}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x02}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, + {REQ_07_SET_GET_AVREG, 0x19, 0x91}, + {REQ_07_SET_GET_AVREG, 0x1a, 0x1f}, + {REQ_07_SET_GET_AVREG, 0x1b, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, + {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, + {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, + {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x52}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_PAL, + .sif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, + {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {0, 0, 0} + }, + .nosif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {0, 0, 0}, + }, + .common = { + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x32}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x02}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x25}, + {REQ_07_SET_GET_AVREG, 0x19, 0xd5}, + {REQ_07_SET_GET_AVREG, 0x1a, 0x63}, + {REQ_07_SET_GET_AVREG, 0x1b, 0x50}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, + {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, + {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, + {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x52}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_SECAM, + .sif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, + {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {0, 0, 0}, + }, + .nosif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {0, 0, 0}, + }, + .common = { + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x38}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x02}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x24}, + {REQ_07_SET_GET_AVREG, 0x19, 0x92}, + {REQ_07_SET_GET_AVREG, 0x1a, 0xe8}, + {REQ_07_SET_GET_AVREG, 0x1b, 0xed}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, + {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, + {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, + {REQ_07_SET_GET_AVREG, 0x33, 0x2c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x18}, + {REQ_07_SET_GET_AVREG, 0x82, 0x42}, + {REQ_07_SET_GET_AVREG, 0x83, 0xFF}, + + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_NTSC, + .sif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, + {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {0, 0, 0}, + }, + .nosif = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {0, 0, 0}, + }, + .common = { + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x00}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0f}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x00}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, + {REQ_07_SET_GET_AVREG, 0x19, 0x8b}, + {REQ_07_SET_GET_AVREG, 0x1a, 0xa2}, + {REQ_07_SET_GET_AVREG, 0x1b, 0xe9}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, + {REQ_07_SET_GET_AVREG, 0x30, 0x22}, + {REQ_07_SET_GET_AVREG, 0x31, 0x61}, + {REQ_07_SET_GET_AVREG, 0x33, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x42}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdd}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, +}; + +static struct tm6000_std_settings composite_stds[] = { + { + .id = V4L2_STD_PAL_M, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x04}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x00}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, + {REQ_07_SET_GET_AVREG, 0x19, 0x83}, + {REQ_07_SET_GET_AVREG, 0x1a, 0x0a}, + {REQ_07_SET_GET_AVREG, 0x1b, 0xe0}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, + {REQ_07_SET_GET_AVREG, 0x30, 0x20}, + {REQ_07_SET_GET_AVREG, 0x31, 0x61}, + {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x52}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_PAL_Nc, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x36}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x02}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, + {REQ_07_SET_GET_AVREG, 0x19, 0x91}, + {REQ_07_SET_GET_AVREG, 0x1a, 0x1f}, + {REQ_07_SET_GET_AVREG, 0x1b, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, + {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, + {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, + {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x52}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_PAL, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x32}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x02}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x25}, + {REQ_07_SET_GET_AVREG, 0x19, 0xd5}, + {REQ_07_SET_GET_AVREG, 0x1a, 0x63}, + {REQ_07_SET_GET_AVREG, 0x1b, 0x50}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, + {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, + {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, + {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x52}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_SECAM, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x38}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x02}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x24}, + {REQ_07_SET_GET_AVREG, 0x19, 0x92}, + {REQ_07_SET_GET_AVREG, 0x1a, 0xe8}, + {REQ_07_SET_GET_AVREG, 0x1b, 0xed}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, + {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, + {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, + {REQ_07_SET_GET_AVREG, 0x33, 0x2c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x18}, + {REQ_07_SET_GET_AVREG, 0x82, 0x42}, + {REQ_07_SET_GET_AVREG, 0x83, 0xFF}, + + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_NTSC, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x00}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0f}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x00}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, + {REQ_07_SET_GET_AVREG, 0x19, 0x8b}, + {REQ_07_SET_GET_AVREG, 0x1a, 0xa2}, + {REQ_07_SET_GET_AVREG, 0x1b, 0xe9}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, + {REQ_07_SET_GET_AVREG, 0x30, 0x22}, + {REQ_07_SET_GET_AVREG, 0x31, 0x61}, + {REQ_07_SET_GET_AVREG, 0x33, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x42}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdd}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, +}; + +static struct tm6000_std_settings svideo_stds[] = { + { + .id = V4L2_STD_PAL_M, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x05}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x04}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, + {REQ_07_SET_GET_AVREG, 0x19, 0x83}, + {REQ_07_SET_GET_AVREG, 0x1a, 0x0a}, + {REQ_07_SET_GET_AVREG, 0x1b, 0xe0}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, + {REQ_07_SET_GET_AVREG, 0x30, 0x22}, + {REQ_07_SET_GET_AVREG, 0x31, 0x61}, + {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x52}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_PAL_Nc, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x37}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x04}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, + {REQ_07_SET_GET_AVREG, 0x19, 0x91}, + {REQ_07_SET_GET_AVREG, 0x1a, 0x1f}, + {REQ_07_SET_GET_AVREG, 0x1b, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, + {REQ_07_SET_GET_AVREG, 0x30, 0x22}, + {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, + {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x52}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_PAL, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x33}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x04}, + {REQ_07_SET_GET_AVREG, 0x07, 0x00}, + {REQ_07_SET_GET_AVREG, 0x18, 0x25}, + {REQ_07_SET_GET_AVREG, 0x19, 0xd5}, + {REQ_07_SET_GET_AVREG, 0x1a, 0x63}, + {REQ_07_SET_GET_AVREG, 0x1b, 0x50}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, + {REQ_07_SET_GET_AVREG, 0x30, 0x2a}, + {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, + {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x52}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_SECAM, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x39}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x03}, + {REQ_07_SET_GET_AVREG, 0x07, 0x01}, + {REQ_07_SET_GET_AVREG, 0x18, 0x24}, + {REQ_07_SET_GET_AVREG, 0x19, 0x92}, + {REQ_07_SET_GET_AVREG, 0x1a, 0xe8}, + {REQ_07_SET_GET_AVREG, 0x1b, 0xed}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, + {REQ_07_SET_GET_AVREG, 0x30, 0x2a}, + {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, + {REQ_07_SET_GET_AVREG, 0x33, 0x2c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x18}, + {REQ_07_SET_GET_AVREG, 0x82, 0x42}, + {REQ_07_SET_GET_AVREG, 0x83, 0xFF}, + + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, { + .id = V4L2_STD_NTSC, + .common = { + {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, + {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, + {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, + {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, + {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, + {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, + {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, + {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, + {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, + {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, + + {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, + {REQ_07_SET_GET_AVREG, 0x00, 0x01}, + {REQ_07_SET_GET_AVREG, 0x01, 0x0f}, + {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, + {REQ_07_SET_GET_AVREG, 0x03, 0x03}, + {REQ_07_SET_GET_AVREG, 0x07, 0x00}, + {REQ_07_SET_GET_AVREG, 0x17, 0x8b}, + {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, + {REQ_07_SET_GET_AVREG, 0x19, 0x8b}, + {REQ_07_SET_GET_AVREG, 0x1a, 0xa2}, + {REQ_07_SET_GET_AVREG, 0x1b, 0xe9}, + {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, + {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, + {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, + {REQ_07_SET_GET_AVREG, 0x30, 0x22}, + {REQ_07_SET_GET_AVREG, 0x31, 0x61}, + {REQ_07_SET_GET_AVREG, 0x33, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, + {REQ_07_SET_GET_AVREG, 0x82, 0x42}, + {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, + + {REQ_07_SET_GET_AVREG, 0x04, 0xdd}, + {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, + {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {0, 0, 0}, + }, + }, +}; + +void tm6000_get_std_res(struct tm6000_core *dev) +{ + /* Currently, those are the only supported resoltions */ + if (dev->norm & V4L2_STD_525_60) { + dev->height = 480; + } else { + dev->height = 576; + } + dev->width = 720; +} + +static int tm6000_load_std(struct tm6000_core *dev, + struct tm6000_reg_settings *set, int max_size) +{ + int i, rc; + + /* Load board's initialization table */ + for (i = 0; max_size; i++) { + if (!set[i].req) + return 0; + + rc = tm6000_set_reg(dev, set[i].req, set[i].reg, set[i].value); + if (rc < 0) { + printk(KERN_ERR "Error %i while setting " + "req %d, reg %d to value %d\n", + rc, set[i].req, set[i].reg, set[i].value); + return rc; + } + } + + return 0; +} + +static int tm6000_set_tv(struct tm6000_core *dev, int pos) +{ + int rc; + + rc = tm6000_load_std(dev, tv_stds[pos].common, + sizeof(tv_stds[pos].common)); + + return rc; +} + +int tm6000_set_standard(struct tm6000_core *dev, v4l2_std_id * norm) +{ + int i, rc = 0; + + dev->norm = *norm; + tm6000_get_std_res(dev); + + switch (dev->input) { + case TM6000_INPUT_TV: + for (i = 0; i < ARRAY_SIZE(tv_stds); i++) { + if (*norm & tv_stds[i].id) { + rc = tm6000_set_tv(dev, i); + goto ret; + } + } + return -EINVAL; + case TM6000_INPUT_SVIDEO: + for (i = 0; i < ARRAY_SIZE(svideo_stds); i++) { + if (*norm & svideo_stds[i].id) { + rc = tm6000_load_std(dev, svideo_stds[i].common, + sizeof(svideo_stds[i]. + common)); + goto ret; + } + } + return -EINVAL; + case TM6000_INPUT_COMPOSITE: + for (i = 0; i < ARRAY_SIZE(composite_stds); i++) { + if (*norm & composite_stds[i].id) { + rc = tm6000_load_std(dev, + composite_stds[i].common, + sizeof(composite_stds[i]. + common)); + goto ret; + } + } + return -EINVAL; + } + +ret: + if (rc < 0) + return rc; + + msleep(40); + + return 0; +} diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 045e676cc8fa..9355b14c2f3d 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -206,8 +206,6 @@ int tm6000_init_after_firmware (struct tm6000_core *dev); int tm6000_init_analog_mode (struct tm6000_core *dev); int tm6000_init_digital_mode (struct tm6000_core *dev); -void tm6000_get_std_res(struct tm6000_core *dev); -int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm); int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate); int tm6000_dvb_register(struct tm6000_core *dev); @@ -218,6 +216,10 @@ int tm6000_v4l2_unregister(struct tm6000_core *dev); int tm6000_v4l2_exit(void); void tm6000_set_fourcc_format(struct tm6000_core *dev); +/* In tm6000-stds.c */ +void tm6000_get_std_res(struct tm6000_core *dev); +int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm); + /* In tm6000-i2c.c */ int tm6000_i2c_register(struct tm6000_core *dev); int tm6000_i2c_unregister(struct tm6000_core *dev); -- GitLab From 2c9a95ba17bfe5fc24a1f782c172c03b74fcda1e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 11:16:35 -0300 Subject: [PATCH 037/534] V4L/DVB (12809): tm6000: Remove an old hack Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index ddd61ca3d1d0..af97a2391123 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -30,10 +30,6 @@ #include #include -#ifdef HACK /* HACK */ -#include "tm6000-hack.c" -#endif - #define USB_TIMEOUT 5*HZ /* ms */ int tm6000_read_write_usb (struct tm6000_core *dev, u8 req_type, u8 req, @@ -313,11 +309,6 @@ int tm6000_init (struct tm6000_core *dev) { int board, rc=0, i; -#ifdef HACK /* HACK */ - init_tm6000(dev); - return 0; -#else - /* Load board's initialization table */ for (i=0; i< ARRAY_SIZE(init_tab); i++) { rc= tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, @@ -375,8 +366,6 @@ int tm6000_init (struct tm6000_core *dev) msleep(50); -#endif /* HACK */ - return 0; } -- GitLab From cc27a8c275ff5a1d2b7cffbb5b8e96509d4231b9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 11:23:14 -0300 Subject: [PATCH 038/534] V4L/DVB (12810): tm6000: Avoid sending xc3028 setups for other tuners Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 30 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index c60863470180..6adf9376b80c 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -164,15 +164,19 @@ static void tm6000_config_tuner (struct tm6000_core *dev) memset (&ctl,0,sizeof(ctl)); - ctl.fname = "tm6000-xc3028.fw"; - ctl.type = XC2028_FIRM_MTS; + request_module ("tuner"); + + if (dev->tuner_type == TUNER_XC2028) { + ctl.fname = "tm6000-xc3028.fw"; + ctl.type = XC2028_FIRM_MTS; - xc2028_cfg.tuner = TUNER_XC2028; - xc2028_cfg.priv = &ctl; + xc2028_cfg.tuner = TUNER_XC2028; + xc2028_cfg.priv = &ctl; -printk("Setting firmware parameters for tm6000\n"); + printk(KERN_INFO "Setting firmware parameters for xc2028\n"); - tm6000_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); + tm6000_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); + } } static int tm6000_init_dev(struct tm6000_core *dev) @@ -208,22 +212,24 @@ static int tm6000_init_dev(struct tm6000_core *dev) if (rc<0) goto err; - /* Request tuner */ - request_module ("tuner"); + /* Default values for STD and resolutions */ + dev->width = 720; + dev->height = 480; + dev->norm = V4L2_STD_PAL_M; + /* Configure tuner */ tm6000_config_tuner (dev); -// norm=V4L2_STD_NTSC_M; - dev->norm=V4L2_STD_PAL_M; + /* Set video standard */ tm6000_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm); - /* configure tuner */ + /* Set tuner frequency - also loads firmware on xc2028/xc3028 */ f.tuner = 0; f.type = V4L2_TUNER_ANALOG_TV; f.frequency = 3092; /* 193.25 MHz */ dev->freq = f.frequency; - tm6000_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); + if(dev->caps.has_dvb) { dev->dvb = kzalloc(sizeof(*(dev->dvb)), GFP_KERNEL); if(!dev->dvb) { -- GitLab From 0ef4b05a4f7610182174c09616aa930bbd990435 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Nov 2007 11:54:18 -0300 Subject: [PATCH 039/534] V4L/DVB (12811): tm6000: a few registers is needed from the sif/noif setings Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-stds.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c index d74793a8d596..11e600bdc41b 100644 --- a/drivers/staging/tm6000/tm6000-stds.c +++ b/drivers/staging/tm6000/tm6000-stds.c @@ -781,6 +781,13 @@ static int tm6000_load_std(struct tm6000_core *dev, if (!set[i].req) return 0; + /* FIXME: REQ 8 settings are for tm6010 + not tested yet + This doesn't work with tm5600 + */ + if (set[i].req == REQ_08_SET_GET_AVREG_BIT) + continue; + rc = tm6000_set_reg(dev, set[i].req, set[i].reg, set[i].value); if (rc < 0) { printk(KERN_ERR "Error %i while setting " @@ -797,6 +804,22 @@ static int tm6000_set_tv(struct tm6000_core *dev, int pos) { int rc; + /* FIXME: This code is for tm6010 - not tested yet - doesn't work with + tm5600 + */ + + /* FIXME: This is tuner-dependent */ + int nosif = 0; + + if (nosif) { + rc = tm6000_load_std(dev, tv_stds[pos].nosif, + sizeof(tv_stds[pos].nosif)); + } else { + rc = tm6000_load_std(dev, tv_stds[pos].sif, + sizeof(tv_stds[pos].sif)); + } + if (rc < 0) + return rc; rc = tm6000_load_std(dev, tv_stds[pos].common, sizeof(tv_stds[pos].common)); -- GitLab From b1ce40b1392e2a20529ad2f01ab76145102c0ef1 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Sun, 4 Nov 2007 16:36:15 -0300 Subject: [PATCH 040/534] V4L/DVB (12812): tm6000: fix build dependencies for tm6000 and tuner-xc2028 Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig index 7e236a223b81..5e0c98189cc7 100644 --- a/drivers/staging/tm6000/Kconfig +++ b/drivers/staging/tm6000/Kconfig @@ -3,7 +3,6 @@ config VIDEO_TM6000 select VIDEO_V4L2 select VIDEO_TUNER select TUNER_XC2028 - select VIDEO_USB_ISOC select VIDEOBUF_VMALLOC help Support for TM5600/TM6000 USB Device @@ -17,5 +16,6 @@ config VIDEO_TM6000 config VIDEO_TM6000_DVB bool "DVB Support for tm6000 based TV cards" depends on VIDEO_TM6000 && DVB_CORE + select DVB_ZL10353 ---help--- This adds support for DVB cards based on the tm5600/tm6000 chip. -- GitLab From 28cb88caaec4d22c970a28e080c1815ee3b043fa Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Nov 2007 11:03:04 -0300 Subject: [PATCH 041/534] V4L/DVB (12813): tm6000: all read messages should use prev_reg read messages with length>1 where using the wrong register. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 10c7d947d53e..c53b7046c2ec 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -113,21 +113,11 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, out of message data. */ /* SMBus Read Byte command */ - if(msgs[i].len == 1) { - // we use the previously used register to read from - rc = tm6000_read_write_usb (dev, - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - REQ_16_SET_GET_I2CSEQ, - addr | prev_reg<<8, 0, - msgs[i].buf, msgs[i].len); - } - else { - rc = tm6000_read_write_usb (dev, - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - REQ_16_SET_GET_I2CSEQ, - addr|(*msgs[i].buf)<<8, 0, - msgs[i].buf, msgs[i].len); - } + rc = tm6000_read_write_usb (dev, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_16_SET_GET_I2CSEQ, + addr | (prev_reg << 8), 0, + msgs[i].buf, msgs[i].len); if (i2c_debug>=2) { for (byte = 0; byte < msgs[i].len; byte++) { printk(" %02x", msgs[i].buf[byte]); -- GitLab From d4e15bcd3de4bb5fccf5b1c0f512d57983c09623 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 5 Nov 2007 15:39:41 -0300 Subject: [PATCH 042/534] V4L/DVB (12814): tm6000: fix eeprom reading on tm6000 Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 62 ++++++++++++++++------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index c53b7046c2ec..c0327d724eb2 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -163,8 +163,8 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, } -static int tm6000_i2c_eeprom( struct tm6000_core *dev, - unsigned char *eedata, int len ) +static int tm6000_i2c_eeprom(struct tm6000_core *dev, + unsigned char *eedata, int len) { int i, rc; unsigned char *p = eedata; @@ -172,24 +172,16 @@ static int tm6000_i2c_eeprom( struct tm6000_core *dev, dev->i2c_client.addr = 0xa0 >> 1; -//006779: OUT: 000006 ms 089867 ms c0 0e a0 00 00 00 01 00 <<< 00 -//006780: OUT: 000005 ms 089873 ms c0 10 a0 00 00 00 01 00 <<< 00 -//006781: OUT: 000108 ms 089878 ms 40 0e a0 00 00 00 01 00 >>> 99 -//006782: OUT: 000015 ms 089986 ms c0 0e a0 00 01 00 01 00 <<< 99 -//006783: OUT: 000004 ms 090001 ms c0 0e a0 00 10 00 01 00 <<< 99 -//006784: OUT: 000005 ms 090005 ms 40 10 a0 00 00 00 01 00 >>> 00 -//006785: OUT: 000308 ms 090010 ms 40 0e a0 00 00 00 01 00 >>> 00 - - - for (i = 0; i < len; i++) { - bytes[0x14+i] = 0; - - rc = i2c_master_recv(&dev->i2c_client, p, 1); - if (rc<1) { - if (p==eedata) { - printk (KERN_WARNING "%s doesn't have eeprom", - dev->name); - } else { + bytes[16] = '\0'; + for (i = 0; i < len; ) { + *p = i; + rc = tm6000_read_write_usb (dev, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_16_SET_GET_I2CSEQ, 0xa0 | i<<8, 0, p, 1); + if (rc < 1) { + if (p == eedata) + goto noeeprom; + else { printk(KERN_WARNING "%s: i2c eeprom read error (err=%d)\n", dev->name, rc); @@ -200,21 +192,32 @@ static int tm6000_i2c_eeprom( struct tm6000_core *dev, if (0 == (i % 16)) printk(KERN_INFO "%s: i2c eeprom %02x:", dev->name, i); printk(" %02x", eedata[i]); - if ((eedata[i]>=' ')&&(eedata[i]<='z')) { - bytes[i%16]=eedata[i]; + if ((eedata[i] >= ' ') && (eedata[i] <= 'z')) { + bytes[i%16] = eedata[i]; } else { bytes[i%16]='.'; } - if (15 == (i % 16)) { - bytes[i%16]='\0'; + + i++; + + if (0 == (i % 16)) { + bytes[16] = '\0'; printk(" %s\n", bytes); } } - if ((i%16)!=15) { - bytes[i%16]='\0'; - printk(" %s\n", bytes); + if (0 != (i%16)) { + bytes[i%16] = '\0'; + for (i %= 16; i < 16; i++) + printk(" "); } + printk(" %s\n", bytes); + return 0; + +noeeprom: + printk(KERN_INFO "%s: Huh, no eeprom present (err=%d)?\n", + dev->name, rc); + return rc; } /* ----------------------------------------------------------- */ @@ -319,7 +322,6 @@ static int attach_inform(struct i2c_client *client) { struct tm6000_core *dev = client->adapter->algo_data; struct tuner_setup tun_setup; - unsigned char eedata[11]; i2c_dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", client->driver->driver.name, client->addr, client->name); @@ -416,6 +418,8 @@ void tm6000_i2c_call_clients(struct tm6000_core *dev, unsigned int cmd, void *ar */ int tm6000_i2c_register(struct tm6000_core *dev) { + unsigned char eedata[256]; + dev->i2c_adap = tm6000_adap_template; dev->i2c_adap.dev.parent = &dev->udev->dev; strcpy(dev->i2c_adap.name, dev->name); @@ -428,6 +432,8 @@ int tm6000_i2c_register(struct tm6000_core *dev) if (i2c_scan) do_i2c_scan(dev->name, &dev->i2c_client); + tm6000_i2c_eeprom(dev, eedata, sizeof(eedata)); + return 0; } -- GitLab From 47878f163f68bfc93483ba9bca82ac0283c751e5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 15 Nov 2007 16:37:35 -0300 Subject: [PATCH 043/534] V4L/DVB (12815): tm6000: follow videobuf API changes Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index cdaf44806e3e..107d597038b8 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -167,7 +167,7 @@ static void inline buffer_filled (struct tm6000_core *dev, /* Advice that buffer was filled */ dprintk(dev, V4L2_DEBUG_ISOC, "[%p/%d] wakeup\n",buf,buf->vb.i); - buf->vb.state = STATE_DONE; + buf->vb.state = VIDEOBUF_DONE; buf->vb.field_count++; do_gettimeofday(&buf->vb.ts); @@ -764,7 +764,7 @@ static int restart_video_queue(struct tm6000_dmaqueue *dma_q) buf = list_entry(item, struct tm6000_buffer, vb.queue); list_del(&buf->vb.queue); - buf->vb.state = STATE_ERROR; + buf->vb.state = VIDEOBUF_ERROR; wake_up(&buf->vb.done); } mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); @@ -785,7 +785,7 @@ static int restart_video_queue(struct tm6000_dmaqueue *dma_q) tm6000_stop_thread(dma_q); tm6000_start_thread(dma_q, buf); - buf->vb.state = STATE_ACTIVE; + buf->vb.state = VIDEOBUF_ACTIVE; mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] restart_queue -" " first active\n", buf, buf->vb.i); @@ -795,7 +795,7 @@ static int restart_video_queue(struct tm6000_dmaqueue *dma_q) prev->fmt == buf->fmt) { list_del(&buf->vb.queue); list_add_tail(&buf->vb.queue,&dma_q->active); - buf->vb.state = STATE_ACTIVE; + buf->vb.state = VIDEOBUF_ACTIVE; dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] restart_queue -" " move to active\n",buf,buf->vb.i); } else { @@ -817,7 +817,7 @@ static void tm6000_vid_timeout(unsigned long data) buf = list_entry(vidq->active.next, struct tm6000_buffer, vb.queue); list_del(&buf->vb.queue); - buf->vb.state = STATE_ERROR; + buf->vb.state = VIDEOBUF_ERROR; wake_up(&buf->vb.done); dprintk(dev, V4L2_DEBUG_QUEUE, "tm6000/0: [%p/%d] timeout\n", buf, buf->vb.i); @@ -857,7 +857,7 @@ static void free_buffer(struct videobuf_queue *vq, struct tm6000_buffer *buf) videobuf_waiton(&buf->vb,0,0); videobuf_vmalloc_free(&buf->vb); - buf->vb.state = STATE_NEEDS_INIT; + buf->vb.state = VIDEOBUF_NEEDS_INIT; } static int @@ -886,10 +886,10 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, buf->vb.width = fh->width; buf->vb.height = fh->height; buf->vb.field = field; - buf->vb.state = STATE_NEEDS_INIT; + buf->vb.state = VIDEOBUF_NEEDS_INIT; } - if (STATE_NEEDS_INIT == buf->vb.state) { + if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { if (0 != (rc = videobuf_iolock(vq,&buf->vb,NULL))) goto fail; urb_init=1; @@ -943,7 +943,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, goto fail; } - buf->vb.state = STATE_PREPARED; + buf->vb.state = VIDEOBUF_PREPARED; return 0; fail: @@ -962,12 +962,12 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) if (!list_empty(&vidq->queued)) { list_add_tail(&buf->vb.queue,&vidq->queued); - buf->vb.state = STATE_QUEUED; + buf->vb.state = VIDEOBUF_QUEUED; dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue - " "append to queued\n", buf, buf->vb.i); } else if (list_empty(&vidq->active)) { list_add_tail(&buf->vb.queue,&vidq->active); - buf->vb.state = STATE_ACTIVE; + buf->vb.state = VIDEOBUF_ACTIVE; mod_timer(&vidq->timeout, jiffies+BUFFER_TIMEOUT); dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue - " "first active\n", buf, buf->vb.i); @@ -978,12 +978,12 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) prev->vb.height == buf->vb.height && prev->fmt == buf->fmt) { list_add_tail(&buf->vb.queue,&vidq->active); - buf->vb.state = STATE_ACTIVE; + buf->vb.state = VIDEOBUF_ACTIVE; dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue -" " append to active\n", buf, buf->vb.i); } else { list_add_tail(&buf->vb.queue,&vidq->queued); - buf->vb.state = STATE_QUEUED; + buf->vb.state = VIDEOBUF_QUEUED; dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue -" " first queued\n", buf, buf->vb.i); } @@ -1583,8 +1583,8 @@ tm6000_poll(struct file *file, struct poll_table_struct *wait) wait); } poll_wait(file, &buf->vb.done, wait); - if (buf->vb.state == STATE_DONE || - buf->vb.state == STATE_ERROR) + if (buf->vb.state == VIDEOBUF_DONE || + buf->vb.state == VIDEOBUF_ERROR) return POLLIN|POLLRDNORM; return 0; } -- GitLab From 5b74c2c739064248bb9c78102e94751b317684d5 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Fri, 16 Nov 2007 13:16:59 -0300 Subject: [PATCH 044/534] V4L/DVB (12816): tm6000: fix tm6000 attach method and fix a few CodingStyles Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-dvb.c | 34 ++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index 9df93cfe3106..15133109f7ec 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -28,6 +28,8 @@ #include +#include "tuner-xc2028.h" + static void tm6000_urb_received(struct urb *urb) { int ret; @@ -231,20 +233,29 @@ int tm6000_dvb_register(struct tm6000_core *dev) THIS_MODULE, &dev->udev->dev); dvb->adapter.priv = dev; - if(dvb->frontend) { + if (dvb->frontend) { + struct xc2028_config cfg = { + .i2c_adap = &dev->i2c_adap, + .video_dev = dev, + }; + ret = dvb_register_frontend(&dvb->adapter, dvb->frontend); - if(ret < 0) { - printk("tm6000: couldn't register frontend\n"); + if (ret < 0) { + printk(KERN_ERR + "tm6000: couldn't register frontend\n"); goto adapter_err; } - // attach the tuner like this for now - tm6000_i2c_call_clients(dev, VIDIOC_INT_DVB_TUNER_ATTACH, dvb->frontend); - - printk("tm6000: XC2028/3028 asked to be attached to frontend!\n"); - } - else { - printk("tm6000: no frontend found\n"); + if (!dvb_attach(xc2028_attach, dvb->frontend, &cfg)) { + printk(KERN_ERR "tm6000: couldn't register " + "frontend (xc3028)\n"); + ret = -EINVAL; + goto adapter_err; + } + printk(KERN_INFO "tm6000: XC2028/3028 asked to be " + "attached to frontend!\n"); + } else { + printk(KERN_ERR "tm6000: no frontend found\n"); } dvb->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING @@ -278,6 +289,9 @@ int tm6000_dvb_register(struct tm6000_core *dev) frontend_err: if(dvb->frontend) { dvb_unregister_frontend(dvb->frontend); +#ifdef CONFIG_DVB_CORE_ATTACH + symbol_put(xc3028_attach); +#endif } adapter_err: dvb_unregister_adapter(&dvb->adapter); -- GitLab From e762d420b4d8ba120cb5c85c484e09792e6b8a44 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Fri, 16 Nov 2007 18:07:12 -0300 Subject: [PATCH 045/534] V4L/DVB (12817): tm6000: add a missing symbol_put Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-dvb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index 15133109f7ec..b423795f0017 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -315,6 +315,9 @@ void tm6000_dvb_unregister(struct tm6000_core *dev) // mutex_lock(&tm6000_driver.open_close_mutex); if(dvb->frontend) { dvb_unregister_frontend(dvb->frontend); +#ifdef CONFIG_DVB_CORE_ATTACH + symbol_put(xc3028_attach); +#endif } dvb_dmxdev_release(&dvb->dmxdev); -- GitLab From 70bfae5aaf7254f3cdfc1647441ff2b595933f09 Mon Sep 17 00:00:00 2001 From: Michel Ludwig Date: Mon, 19 Nov 2007 06:10:54 -0300 Subject: [PATCH 046/534] V4L/DVB (12818): tm6000: Use dvb_frontend_detach instead of single symbol_put commands Thanks to Mike Krufky for pointed that one out. Also include some minor cleanups. Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/hack.c | 3 ++- drivers/staging/tm6000/tm6000-dvb.c | 19 +++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/staging/tm6000/hack.c b/drivers/staging/tm6000/hack.c index 87f3f498e8eb..f181fce6716b 100644 --- a/drivers/staging/tm6000/hack.c +++ b/drivers/staging/tm6000/hack.c @@ -237,8 +237,9 @@ struct dvb_frontend* pseudo_zl10353_attach(struct tm6000_core *dev, { struct tm6000_dvb *dvb = dev->dvb; - dvb->frontend = zl10353_attach(config, i2c); + dvb->frontend = dvb_attach(zl10353_attach, config, i2c); if(!dvb->frontend) { + printk(KERN_ERR "Error during zl10353_attach!\n"); return NULL; } diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index b423795f0017..fa6d3a00f9b0 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -205,12 +205,7 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev) return -1; } - if(dvb->frontend) { - return 0; - } - else { - return -1; - } + return (!dvb->frontend) ? -1 : 0; } int tm6000_dvb_register(struct tm6000_core *dev) @@ -226,7 +221,7 @@ int tm6000_dvb_register(struct tm6000_core *dev) ret = tm6000_dvb_attach_frontend(dev); if(ret < 0) { printk(KERN_ERR "tm6000: couldn't attach the frontend!\n"); -// goto err; + goto err; } ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T", @@ -250,7 +245,7 @@ int tm6000_dvb_register(struct tm6000_core *dev) printk(KERN_ERR "tm6000: couldn't register " "frontend (xc3028)\n"); ret = -EINVAL; - goto adapter_err; + goto frontend_err; } printk(KERN_INFO "tm6000: XC2028/3028 asked to be " "attached to frontend!\n"); @@ -288,10 +283,8 @@ int tm6000_dvb_register(struct tm6000_core *dev) dvb_dmx_release(&dvb->demux); frontend_err: if(dvb->frontend) { + dvb_frontend_detach(dvb->frontend); dvb_unregister_frontend(dvb->frontend); -#ifdef CONFIG_DVB_CORE_ATTACH - symbol_put(xc3028_attach); -#endif } adapter_err: dvb_unregister_adapter(&dvb->adapter); @@ -314,10 +307,8 @@ void tm6000_dvb_unregister(struct tm6000_core *dev) // mutex_lock(&tm6000_driver.open_close_mutex); if(dvb->frontend) { + dvb_frontend_detach(dvb->frontend); dvb_unregister_frontend(dvb->frontend); -#ifdef CONFIG_DVB_CORE_ATTACH - symbol_put(xc3028_attach); -#endif } dvb_dmxdev_release(&dvb->dmxdev); -- GitLab From 3716ae3ed7e4fc0a60c8733f7e6a15ba48f65b01 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 23 Nov 2007 13:00:18 -0300 Subject: [PATCH 047/534] V4L/DVB (12819): tm6000: mts parameter has changed on tuner-xc2028.c Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 6adf9376b80c..21cf847ec018 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -168,7 +168,7 @@ static void tm6000_config_tuner (struct tm6000_core *dev) if (dev->tuner_type == TUNER_XC2028) { ctl.fname = "tm6000-xc3028.fw"; - ctl.type = XC2028_FIRM_MTS; + ctl.mts = 1; xc2028_cfg.tuner = TUNER_XC2028; xc2028_cfg.priv = &ctl; -- GitLab From cf9e1509c278c3d5005f222539813933e4dc345c Mon Sep 17 00:00:00 2001 From: Christopher Pascoe Date: Fri, 23 Nov 2007 13:18:56 -0300 Subject: [PATCH 048/534] V4L/DVB (12820): tm6000: fix i2c readings Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 33 +++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index c0327d724eb2..8569cfca8f82 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -94,7 +94,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, { struct tm6000_core *dev = i2c_adap->algo_data; int addr, rc, i, byte; - u8 prev_reg = 0; + int prev_reg = -1; if (num <= 0) return 0; @@ -113,16 +113,38 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, out of message data. */ /* SMBus Read Byte command */ + if (prev_reg < 0) + printk("XXX read from unknown prev_reg\n"); rc = tm6000_read_write_usb (dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, REQ_16_SET_GET_I2CSEQ, addr | (prev_reg << 8), 0, msgs[i].buf, msgs[i].len); + if (prev_reg >= 0) + prev_reg += msgs[i].len; if (i2c_debug>=2) { for (byte = 0; byte < msgs[i].len; byte++) { printk(" %02x", msgs[i].buf[byte]); } } + } else if (i+1 < num && msgs[i].len == 2 && + (msgs[i+1].flags & I2C_M_RD) && + msgs[i].addr == msgs[i+1].addr) { + i2c_dprintk(2, "msg %d: write 2, read %d", i, + msgs[i+1].len); + /* Write 2 Read N command */ + rc = tm6000_read_write_usb (dev, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_14_SET_GET_EEPROM_PAGE, /* XXX wrong name */ + addr | msgs[i].buf[0] << 8, msgs[i].buf[1], + msgs[i+1].buf, msgs[i+1].len); + i++; + if (i2c_debug>=2) { + for (byte = 0; byte < msgs[i].len; byte++) { + printk(" %02x", msgs[i].buf[byte]); + } + } + prev_reg = -1; } else { /* write bytes */ if (i2c_debug>=2) { @@ -134,6 +156,8 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, if(msgs[i].len == 1 && i+1 < num && msgs[i+1].flags & I2C_M_RD && msgs[i+1].addr == msgs[i].addr) { prev_reg = msgs[i].buf[0]; + if (i2c_debug >= 2) + printk("\n"); continue; } @@ -143,12 +167,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, addr|(*msgs[i].buf)<<8, 0, msgs[i].buf+1, msgs[i].len-1); - if(msgs[i].len >= 1) { - prev_reg = msgs[i].buf[0]; - } - else { - prev_reg = 0; - } + prev_reg = -1; } if (i2c_debug>=2) printk("\n"); -- GitLab From e30b9d6c641dbd9687a5605b2151a2a83d2e8770 Mon Sep 17 00:00:00 2001 From: Chris Pascoe Date: Sat, 24 Nov 2007 04:34:42 -0300 Subject: [PATCH 049/534] V4L/DVB (12821): tm6000: update USB request names and clean up i2c routine Update the descriptions of the USB request types so that they match what we now know they do. Rework the i2c_xfer function so that it is more explicit what sort of I2C transfers it is that the tm6000 can't perform. Signed-off-by: Chris Pascoe Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 96 +++++++++++----------------- drivers/staging/tm6000/tm6000-regs.h | 4 +- 2 files changed, 39 insertions(+), 61 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 8569cfca8f82..12e2c98e5433 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -73,7 +73,7 @@ static int tm6000_i2c_scan(struct i2c_adapter *i2c_adap, int addr) /* This sends addr + 1 byte with 0 */ rc = tm6000_read_write_usb (dev, USB_DIR_IN | USB_TYPE_VENDOR, - REQ_16_SET_GET_I2CSEQ, + REQ_16_SET_GET_I2C_WR1_RDN, addr, 0, buf, 0); msleep(10); @@ -94,82 +94,61 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, { struct tm6000_core *dev = i2c_adap->algo_data; int addr, rc, i, byte; - int prev_reg = -1; if (num <= 0) return 0; for (i = 0; i < num; i++) { - addr = (msgs[i].addr << 1) &0xff; + addr = (msgs[i].addr << 1) & 0xff; i2c_dprintk(2,"%s %s addr=0x%x len=%d:", (msgs[i].flags & I2C_M_RD) ? "read" : "write", i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); if (!msgs[i].len) { /* Do I2C scan */ - rc=tm6000_i2c_scan(i2c_adap, addr); + rc = tm6000_i2c_scan(i2c_adap, addr); } else if (msgs[i].flags & I2C_M_RD) { - /* Read bytes */ - /* I2C is assumed to have always a subaddr at the first byte of the - message bus. Also, the first i2c value of the answer is returned - out of message data. - */ - /* SMBus Read Byte command */ - if (prev_reg < 0) - printk("XXX read from unknown prev_reg\n"); - rc = tm6000_read_write_usb (dev, - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - REQ_16_SET_GET_I2CSEQ, - addr | (prev_reg << 8), 0, - msgs[i].buf, msgs[i].len); - if (prev_reg >= 0) - prev_reg += msgs[i].len; - if (i2c_debug>=2) { - for (byte = 0; byte < msgs[i].len; byte++) { + /* read request without preceding register selection */ + /* + * The TM6000 only supports a read transaction + * immediately after a 1 or 2 byte write to select + * a register. We cannot fulfil this request. + */ + i2c_dprintk(2, " read without preceding write not" + " supported"); + rc = -EOPNOTSUPP; + goto err; + } else if (i + 1 < num && msgs[i].len <= 2 && + (msgs[i + 1].flags & I2C_M_RD) && + msgs[i].addr == msgs[i + 1].addr) { + /* 1 or 2 byte write followed by a read */ + if (i2c_debug >= 2) + for (byte = 0; byte < msgs[i].len; byte++) printk(" %02x", msgs[i].buf[byte]); - } - } - } else if (i+1 < num && msgs[i].len == 2 && - (msgs[i+1].flags & I2C_M_RD) && - msgs[i].addr == msgs[i+1].addr) { - i2c_dprintk(2, "msg %d: write 2, read %d", i, - msgs[i+1].len); - /* Write 2 Read N command */ + i2c_dprintk(2, "; joined to read %s len=%d:", + i == num - 2 ? "stop" : "nonstop", + msgs[i + 1].len); rc = tm6000_read_write_usb (dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - REQ_14_SET_GET_EEPROM_PAGE, /* XXX wrong name */ - addr | msgs[i].buf[0] << 8, msgs[i].buf[1], - msgs[i+1].buf, msgs[i+1].len); + msgs[i].len == 1 ? REQ_16_SET_GET_I2C_WR1_RDN + : REQ_14_SET_GET_I2C_WR2_RDN, + addr | msgs[i].buf[0] << 8, + msgs[i].len == 1 ? 0 : msgs[i].buf[1], + msgs[i + 1].buf, msgs[i + 1].len); i++; - if (i2c_debug>=2) { - for (byte = 0; byte < msgs[i].len; byte++) { + if (i2c_debug >= 2) + for (byte = 0; byte < msgs[i].len; byte++) printk(" %02x", msgs[i].buf[byte]); - } - } - prev_reg = -1; } else { /* write bytes */ - if (i2c_debug>=2) { + if (i2c_debug >= 2) for (byte = 0; byte < msgs[i].len; byte++) printk(" %02x", msgs[i].buf[byte]); - } - - /* SMBus Write Byte command followed by a read command */ - if(msgs[i].len == 1 && i+1 < num && msgs[i+1].flags & I2C_M_RD - && msgs[i+1].addr == msgs[i].addr) { - prev_reg = msgs[i].buf[0]; - if (i2c_debug >= 2) - printk("\n"); - continue; - } - - rc = tm6000_read_write_usb (dev, + rc = tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - REQ_16_SET_GET_I2CSEQ, - addr|(*msgs[i].buf)<<8, 0, - msgs[i].buf+1, msgs[i].len-1); - - prev_reg = -1; + REQ_16_SET_GET_I2C_WR1_RDN, + addr | msgs[i].buf[0] << 8, 0, + msgs[i].buf + 1, msgs[i].len - 1); } - if (i2c_debug>=2) + if (i2c_debug >= 2) printk("\n"); if (rc < 0) goto err; @@ -181,7 +160,6 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, return rc; } - static int tm6000_i2c_eeprom(struct tm6000_core *dev, unsigned char *eedata, int len) { @@ -196,7 +174,7 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev, *p = i; rc = tm6000_read_write_usb (dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - REQ_16_SET_GET_I2CSEQ, 0xa0 | i<<8, 0, p, 1); + REQ_16_SET_GET_I2C_WR1_RDN, 0xa0 | i<<8, 0, p, 1); if (rc < 1) { if (p == eedata) goto noeeprom; @@ -273,7 +251,7 @@ static void dec_use(struct i2c_adapter *adap) #define mass_write(addr, reg, data...) \ { const static u8 _val[] = data; \ rc=tm6000_read_write_usb(dev,USB_DIR_OUT | USB_TYPE_VENDOR, \ - REQ_16_SET_GET_I2CSEQ,(reg<<8)+addr, 0x00, (u8 *) _val, \ + REQ_16_SET_GET_I2C_WR1_RDN,(reg<<8)+addr, 0x00, (u8 *) _val, \ ARRAY_SIZE(_val)); \ if (rc<0) { \ printk(KERN_ERR "Error on line %d: %d\n",__LINE__,rc); \ diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 414852e69fce..9b6456e18426 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -38,11 +38,11 @@ #define REQ_11_SET_EEPROM_ADDR 11 #define REQ_12_SET_GET_EEPROMBYTE 12 #define REQ_13_GET_EEPROM_SEQREAD 13 -#define REQ_14_SET_GET_EEPROM_PAGE 14 +#define REQ_14_SET_GET_I2C_WR2_RDN 14 #define REQ_15_SET_GET_I2CBYTE 15 /* Write: Subaddr, Slave Addr, value, 0 */ /* Read : Subaddr, Slave Addr, value, 1 */ -#define REQ_16_SET_GET_I2CSEQ 16 +#define REQ_16_SET_GET_I2C_WR1_RDN 16 /* Subaddr, Slave Addr, 0, length */ #define REQ_17_SET_GET_I2CFP 17 /* Write: Slave Addr, register, value */ -- GitLab From 29c389be1ceb714739cdcd41fec6547d19b32864 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Jan 2008 11:19:22 -0300 Subject: [PATCH 050/534] V4L/DVB (12822): tm6000: Add support for tm6010 Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 33 ++- drivers/staging/tm6000/tm6000-core.c | 319 +++++++++++++++++--------- drivers/staging/tm6000/tm6000-regs.h | 11 + drivers/staging/tm6000/tm6000-stds.c | 10 +- drivers/staging/tm6000/tm6000.h | 6 + 5 files changed, 263 insertions(+), 116 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 21cf847ec018..c0bb3ec35480 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -34,11 +34,12 @@ #define TM6000_BOARD_UNKNOWN 0 #define TM5600_BOARD_GENERIC 1 #define TM6000_BOARD_GENERIC 2 -#define TM5600_BOARD_10MOONS_UT821 3 -#define TM5600_BOARD_10MOONS_UT330 4 -#define TM6000_BOARD_ADSTECH_DUAL_TV 5 -#define TM6000_BOARD_FREECOM_AND_SIMILAR 6 -#define TM6000_BOARD_ADSTECH_MINI_DUAL_TV 7 +#define TM6010_BOARD_GENERIC 3 +#define TM5600_BOARD_10MOONS_UT821 4 +#define TM5600_BOARD_10MOONS_UT330 5 +#define TM6000_BOARD_ADSTECH_DUAL_TV 6 +#define TM6000_BOARD_FREECOM_AND_SIMILAR 7 +#define TM6000_BOARD_ADSTECH_MINI_DUAL_TV 8 #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; @@ -53,6 +54,7 @@ struct tm6000_board { struct tm6000_capabilities caps; + enum tm6000_devtype type; /* variant of the chipset */ int tuner_type; /* type of the tuner */ int tuner_addr; /* tuner address */ int demod_addr; /* demodulator address */ @@ -69,6 +71,7 @@ struct tm6000_board tm6000_boards[] = { }, [TM5600_BOARD_GENERIC] = { .name = "Generic tm5600 board", + .type = TM5600, .tuner_type = TUNER_XC2028, .tuner_addr = 0xc2, .caps = { @@ -86,9 +89,21 @@ struct tm6000_board tm6000_boards[] = { }, .gpio_addr_tun_reset = TM6000_GPIO_1, }, + [TM6010_BOARD_GENERIC] = { + .name = "Generic tm6010 board", + .type = TM6010, + .tuner_type = TUNER_XC2028, + .tuner_addr = 0xc2, + .caps = { + .has_tuner = 1, + .has_dvb = 1, + }, + .gpio_addr_tun_reset = TM6010_GPIO_4, + }, [TM5600_BOARD_10MOONS_UT821] = { .name = "10Moons UT 821", .tuner_type = TUNER_XC2028, + .type = TM5600, .tuner_addr = 0xc2, .caps = { .has_tuner = 1, @@ -151,6 +166,7 @@ struct tm6000_board tm6000_boards[] = { /* table of devices that work with this driver */ struct usb_device_id tm6000_id_table [] = { { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_10MOONS_UT821 }, + { USB_DEVICE(0x6000, 0x0002), .driver_info = TM6010_BOARD_GENERIC }, { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV }, { USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR }, { USB_DEVICE(0x06e1, 0xb339), .driver_info = TM6000_BOARD_ADSTECH_MINI_DUAL_TV }, @@ -167,7 +183,11 @@ static void tm6000_config_tuner (struct tm6000_core *dev) request_module ("tuner"); if (dev->tuner_type == TUNER_XC2028) { - ctl.fname = "tm6000-xc3028.fw"; + if (dev->dev_type == TM6010) + ctl.fname = "xc3028-v27.fw"; + else + ctl.fname = "tm6000-xc3028.fw"; + ctl.mts = 1; xc2028_cfg.tuner = TUNER_XC2028; @@ -189,6 +209,7 @@ static int tm6000_init_dev(struct tm6000_core *dev) mutex_lock(&dev->lock); /* Initializa board-specific data */ + dev->dev_type = tm6000_boards[dev->model].type; dev->tuner_type = tm6000_boards[dev->model].tuner_type; dev->tuner_addr = tm6000_boards[dev->model].tuner_addr; dev->tuner_reset_gpio = tm6000_boards[dev->model].gpio_addr_tun_reset; diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index af97a2391123..35e7d63f00fb 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -151,46 +151,54 @@ void tm6000_set_fourcc_format(struct tm6000_core *dev) int tm6000_init_analog_mode (struct tm6000_core *dev) { + if (dev->dev_type == TM6010) { + int val; - /* Enables soft reset */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); + /* Enable video */ + val = tm6000_get_reg(dev, REQ_07_SET_GET_AVREG, 0xcc, 0); + val |= 0x60; + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xcc, val); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xfe, 0xcf); - if (dev->scaler) { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc0, 0x20); } else { - /* Enable Hfilter and disable TS Drop err */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc0, 0x80); - } - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc3, 0x88); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xda, 0x23); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd1, 0xc0); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd2, 0xd8); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xd6, 0x06); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); - - /* AP Software reset */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xff, 0x08); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xff, 0x00); + /* Enables soft reset */ + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); + + if (dev->scaler) { + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xc0, 0x20); + } else { + /* Enable Hfilter and disable TS Drop err */ + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xc0, 0x80); + } - tm6000_set_fourcc_format(dev); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xc3, 0x88); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xda, 0x23); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xd1, 0xc0); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xd2, 0xd8); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xd6, 0x06); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); - /* Disables soft reset */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); + /* AP Software reset */ + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xff, 0x08); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xff, 0x00); - /* E3: Select input 0 - TV tuner */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); + tm6000_set_fourcc_format(dev); - /* Tuner firmware can now be loaded */ + /* Disables soft reset */ + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); - tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_1, 0x00); - msleep(11); + /* E3: Select input 0 - TV tuner */ + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); - /* This controls input */ - tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_2, 0x0); - tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_3, 0x01); + /* This controls input */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_2, 0x0); + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_3, 0x01); + } msleep(20); + /* Tuner firmware can now be loaded */ + /*FIXME: Hack!!! */ struct v4l2_frequency f; mutex_lock(&dev->lock); @@ -202,7 +210,6 @@ int tm6000_init_analog_mode (struct tm6000_core *dev) tm6000_set_standard (dev, &dev->norm); tm6000_set_audio_bitrate (dev,48000); - return 0; } @@ -238,88 +245,183 @@ int tm6000_init_digital_mode (struct tm6000_core *dev) return 0; } +struct reg_init { + u8 req; + u8 reg; + u8 val; +}; + /* The meaning of those initializations are unknown */ -u8 init_tab[][2] = { +struct reg_init tm6000_init_tab[] = { /* REG VALUE */ - { 0xdf, 0x1f }, - { 0xff, 0x08 }, - { 0xff, 0x00 }, - { 0xd5, 0x4f }, - { 0xda, 0x23 }, - { 0xdb, 0x08 }, - { 0xe2, 0x00 }, - { 0xe3, 0x10 }, - { 0xe5, 0x00 }, - { 0xe8, 0x00 }, - { 0xeb, 0x64 }, /* 48000 bits/sample, external input */ - { 0xee, 0xc2 }, - { 0x3f, 0x01 }, /* Start of soft reset */ - { 0x00, 0x00 }, - { 0x01, 0x07 }, - { 0x02, 0x5f }, - { 0x03, 0x00 }, - { 0x05, 0x64 }, - { 0x07, 0x01 }, - { 0x08, 0x82 }, - { 0x09, 0x36 }, - { 0x0a, 0x50 }, - { 0x0c, 0x6a }, - { 0x11, 0xc9 }, - { 0x12, 0x07 }, - { 0x13, 0x3b }, - { 0x14, 0x47 }, - { 0x15, 0x6f }, - { 0x17, 0xcd }, - { 0x18, 0x1e }, - { 0x19, 0x8b }, - { 0x1a, 0xa2 }, - { 0x1b, 0xe9 }, - { 0x1c, 0x1c }, - { 0x1d, 0xcc }, - { 0x1e, 0xcc }, - { 0x1f, 0xcd }, - { 0x20, 0x3c }, - { 0x21, 0x3c }, - { 0x2d, 0x48 }, - { 0x2e, 0x88 }, - { 0x30, 0x22 }, - { 0x31, 0x61 }, - { 0x32, 0x74 }, - { 0x33, 0x1c }, - { 0x34, 0x74 }, - { 0x35, 0x1c }, - { 0x36, 0x7a }, - { 0x37, 0x26 }, - { 0x38, 0x40 }, - { 0x39, 0x0a }, - { 0x42, 0x55 }, - { 0x51, 0x11 }, - { 0x55, 0x01 }, - { 0x57, 0x02 }, - { 0x58, 0x35 }, - { 0x59, 0xa0 }, - { 0x80, 0x15 }, - { 0x82, 0x42 }, - { 0xc1, 0xd0 }, - { 0xc3, 0x88 }, - { 0x3f, 0x00 }, /* End of the soft reset */ + { REQ_07_SET_GET_AVREG, 0xdf, 0x1f }, + { REQ_07_SET_GET_AVREG, 0xff, 0x08 }, + { REQ_07_SET_GET_AVREG, 0xff, 0x00 }, + { REQ_07_SET_GET_AVREG, 0xd5, 0x4f }, + { REQ_07_SET_GET_AVREG, 0xda, 0x23 }, + { REQ_07_SET_GET_AVREG, 0xdb, 0x08 }, + { REQ_07_SET_GET_AVREG, 0xe2, 0x00 }, + { REQ_07_SET_GET_AVREG, 0xe3, 0x10 }, + { REQ_07_SET_GET_AVREG, 0xe5, 0x00 }, + { REQ_07_SET_GET_AVREG, 0xe8, 0x00 }, + { REQ_07_SET_GET_AVREG, 0xeb, 0x64 }, /* 48000 bits/sample, external input */ + { REQ_07_SET_GET_AVREG, 0xee, 0xc2 }, + { REQ_07_SET_GET_AVREG, 0x3f, 0x01 }, /* Start of soft reset */ + { REQ_07_SET_GET_AVREG, 0x00, 0x00 }, + { REQ_07_SET_GET_AVREG, 0x01, 0x07 }, + { REQ_07_SET_GET_AVREG, 0x02, 0x5f }, + { REQ_07_SET_GET_AVREG, 0x03, 0x00 }, + { REQ_07_SET_GET_AVREG, 0x05, 0x64 }, + { REQ_07_SET_GET_AVREG, 0x07, 0x01 }, + { REQ_07_SET_GET_AVREG, 0x08, 0x82 }, + { REQ_07_SET_GET_AVREG, 0x09, 0x36 }, + { REQ_07_SET_GET_AVREG, 0x0a, 0x50 }, + { REQ_07_SET_GET_AVREG, 0x0c, 0x6a }, + { REQ_07_SET_GET_AVREG, 0x11, 0xc9 }, + { REQ_07_SET_GET_AVREG, 0x12, 0x07 }, + { REQ_07_SET_GET_AVREG, 0x13, 0x3b }, + { REQ_07_SET_GET_AVREG, 0x14, 0x47 }, + { REQ_07_SET_GET_AVREG, 0x15, 0x6f }, + { REQ_07_SET_GET_AVREG, 0x17, 0xcd }, + { REQ_07_SET_GET_AVREG, 0x18, 0x1e }, + { REQ_07_SET_GET_AVREG, 0x19, 0x8b }, + { REQ_07_SET_GET_AVREG, 0x1a, 0xa2 }, + { REQ_07_SET_GET_AVREG, 0x1b, 0xe9 }, + { REQ_07_SET_GET_AVREG, 0x1c, 0x1c }, + { REQ_07_SET_GET_AVREG, 0x1d, 0xcc }, + { REQ_07_SET_GET_AVREG, 0x1e, 0xcc }, + { REQ_07_SET_GET_AVREG, 0x1f, 0xcd }, + { REQ_07_SET_GET_AVREG, 0x20, 0x3c }, + { REQ_07_SET_GET_AVREG, 0x21, 0x3c }, + { REQ_07_SET_GET_AVREG, 0x2d, 0x48 }, + { REQ_07_SET_GET_AVREG, 0x2e, 0x88 }, + { REQ_07_SET_GET_AVREG, 0x30, 0x22 }, + { REQ_07_SET_GET_AVREG, 0x31, 0x61 }, + { REQ_07_SET_GET_AVREG, 0x32, 0x74 }, + { REQ_07_SET_GET_AVREG, 0x33, 0x1c }, + { REQ_07_SET_GET_AVREG, 0x34, 0x74 }, + { REQ_07_SET_GET_AVREG, 0x35, 0x1c }, + { REQ_07_SET_GET_AVREG, 0x36, 0x7a }, + { REQ_07_SET_GET_AVREG, 0x37, 0x26 }, + { REQ_07_SET_GET_AVREG, 0x38, 0x40 }, + { REQ_07_SET_GET_AVREG, 0x39, 0x0a }, + { REQ_07_SET_GET_AVREG, 0x42, 0x55 }, + { REQ_07_SET_GET_AVREG, 0x51, 0x11 }, + { REQ_07_SET_GET_AVREG, 0x55, 0x01 }, + { REQ_07_SET_GET_AVREG, 0x57, 0x02 }, + { REQ_07_SET_GET_AVREG, 0x58, 0x35 }, + { REQ_07_SET_GET_AVREG, 0x59, 0xa0 }, + { REQ_07_SET_GET_AVREG, 0x80, 0x15 }, + { REQ_07_SET_GET_AVREG, 0x82, 0x42 }, + { REQ_07_SET_GET_AVREG, 0xc1, 0xd0 }, + { REQ_07_SET_GET_AVREG, 0xc3, 0x88 }, + { REQ_07_SET_GET_AVREG, 0x3f, 0x00 }, /* End of the soft reset */ + { REQ_05_SET_GET_USBREG, 0x18, 0x00 }, +}; + +struct reg_init tm6010_init_tab[] = { + { REQ_07_SET_GET_AVREG, 0xc0, 0x00 }, + { REQ_07_SET_GET_AVREG, 0xc4, 0xa0 }, + { REQ_07_SET_GET_AVREG, 0xc6, 0x40 }, + { REQ_07_SET_GET_AVREG, 0xca, 0x31 }, + { REQ_07_SET_GET_AVREG, 0xcc, 0xe1 }, + { REQ_07_SET_GET_AVREG, 0xe0, 0x03 }, + { REQ_07_SET_GET_AVREG, 0xfe, 0x7f }, + + { REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0 }, + { REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4 }, + { REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8 }, + { REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00 }, + { REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2 }, + { REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0 }, + { REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2 }, + { REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60 }, + { REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc }, + + { REQ_07_SET_GET_AVREG, 0x3f, 0x01 }, + { REQ_07_SET_GET_AVREG, 0x00, 0x00 }, + { REQ_07_SET_GET_AVREG, 0x01, 0x07 }, + { REQ_07_SET_GET_AVREG, 0x02, 0x5f }, + { REQ_07_SET_GET_AVREG, 0x03, 0x00 }, + { REQ_07_SET_GET_AVREG, 0x05, 0x64 }, + { REQ_07_SET_GET_AVREG, 0x07, 0x01 }, + { REQ_07_SET_GET_AVREG, 0x08, 0x82 }, + { REQ_07_SET_GET_AVREG, 0x09, 0x36 }, + { REQ_07_SET_GET_AVREG, 0x0a, 0x50 }, + { REQ_07_SET_GET_AVREG, 0x0c, 0x6a }, + { REQ_07_SET_GET_AVREG, 0x11, 0xc9 }, + { REQ_07_SET_GET_AVREG, 0x12, 0x07 }, + { REQ_07_SET_GET_AVREG, 0x13, 0x3b }, + { REQ_07_SET_GET_AVREG, 0x14, 0x47 }, + { REQ_07_SET_GET_AVREG, 0x15, 0x6f }, + { REQ_07_SET_GET_AVREG, 0x17, 0xcd }, + { REQ_07_SET_GET_AVREG, 0x18, 0x1e }, + { REQ_07_SET_GET_AVREG, 0x19, 0x8b }, + { REQ_07_SET_GET_AVREG, 0x1a, 0xa2 }, + { REQ_07_SET_GET_AVREG, 0x1b, 0xe9 }, + { REQ_07_SET_GET_AVREG, 0x1c, 0x1c }, + { REQ_07_SET_GET_AVREG, 0x1d, 0xcc }, + { REQ_07_SET_GET_AVREG, 0x1e, 0xcc }, + { REQ_07_SET_GET_AVREG, 0x1f, 0xcd }, + { REQ_07_SET_GET_AVREG, 0x20, 0x3c }, + { REQ_07_SET_GET_AVREG, 0x21, 0x3c }, + { REQ_07_SET_GET_AVREG, 0x2d, 0x48 }, + { REQ_07_SET_GET_AVREG, 0x2e, 0x88 }, + { REQ_07_SET_GET_AVREG, 0x30, 0x22 }, + { REQ_07_SET_GET_AVREG, 0x31, 0x61 }, + { REQ_07_SET_GET_AVREG, 0x32, 0x74 }, + { REQ_07_SET_GET_AVREG, 0x33, 0x1c }, + { REQ_07_SET_GET_AVREG, 0x34, 0x74 }, + { REQ_07_SET_GET_AVREG, 0x35, 0x1c }, + { REQ_07_SET_GET_AVREG, 0x36, 0x7a }, + { REQ_07_SET_GET_AVREG, 0x37, 0x26 }, + { REQ_07_SET_GET_AVREG, 0x38, 0x40 }, + { REQ_07_SET_GET_AVREG, 0x39, 0x0a }, + { REQ_07_SET_GET_AVREG, 0x42, 0x55 }, + { REQ_07_SET_GET_AVREG, 0x51, 0x11 }, + { REQ_07_SET_GET_AVREG, 0x55, 0x01 }, + { REQ_07_SET_GET_AVREG, 0x57, 0x02 }, + { REQ_07_SET_GET_AVREG, 0x58, 0x35 }, + { REQ_07_SET_GET_AVREG, 0x59, 0xa0 }, + { REQ_07_SET_GET_AVREG, 0x80, 0x15 }, + { REQ_07_SET_GET_AVREG, 0x82, 0x42 }, + { REQ_07_SET_GET_AVREG, 0xc1, 0xd0 }, + { REQ_07_SET_GET_AVREG, 0xc3, 0x88 }, + { REQ_07_SET_GET_AVREG, 0x3f, 0x00 }, + + { REQ_05_SET_GET_USBREG, 0x18, 0x00 }, + + /* set remote wakeup key:any key wakeup */ + { REQ_07_SET_GET_AVREG, 0xe5, 0xfe }, + { REQ_07_SET_GET_AVREG, 0xda, 0xff }, }; int tm6000_init (struct tm6000_core *dev) { - int board, rc=0, i; + int board, rc=0, i, size; + struct reg_init *tab; + + if (dev->dev_type == TM6010) { + tab = tm6010_init_tab; + size = ARRAY_SIZE(tm6010_init_tab); + } else { + tab = tm6000_init_tab; + size = ARRAY_SIZE(tm6000_init_tab); + } /* Load board's initialization table */ - for (i=0; i< ARRAY_SIZE(init_tab); i++) { - rc= tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, - init_tab[i][0],init_tab[i][1]); + for (i=0; i< size; i++) { + rc= tm6000_set_reg (dev, tab[i].req, tab[i].reg, tab[i].val); if (rc<0) { - printk (KERN_ERR "Error %i while setting reg %d to value %d\n", - rc, init_tab[i][0],init_tab[i][1]); + printk (KERN_ERR "Error %i while setting req %d, " + "reg %d to value %d\n", rc, + tab[i].req,tab[i].reg, tab[i].val); return rc; } } + msleep(5); /* Just to be conservative */ + /* Check board version - maybe 10Moons specific */ board=tm6000_get_reg16 (dev, 0x40, 0, 0); if (board >=0) { @@ -328,19 +430,24 @@ int tm6000_init (struct tm6000_core *dev) printk (KERN_ERR "Error %i while retrieving board version\n",board); } - tm6000_set_reg (dev, REQ_05_SET_GET_USBREG, 0x18, 0x00); - msleep(5); /* Just to be conservative */ + if (dev->dev_type == TM6010) { + /* Turn xceive 3028 on */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_3, 0x01); + msleep(11); + } /* Reset GPIO1 and GPIO4. */ for (i=0; i< 2; i++) { - rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_1, 0); + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x00); if (rc<0) { printk (KERN_ERR "Error %i doing GPIO1 reset\n",rc); return rc; } msleep(10); /* Just to be conservative */ - rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_1, 1); + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x01); if (rc<0) { printk (KERN_ERR "Error %i doing GPIO1 reset\n",rc); return rc; @@ -360,8 +467,12 @@ int tm6000_init (struct tm6000_core *dev) return rc; } - if (!i) + if (!i) { rc=tm6000_get_reg16(dev, 0x40,0,0); + if (rc>=0) { + printk ("board=%d\n", rc); + } + } } msleep(50); diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 9b6456e18426..3d676fcc262d 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -54,6 +54,7 @@ #define TM6000_GPIO_CLK 0x101 #define TM6000_GPIO_DATA 0x100 + #define TM6000_GPIO_1 0x102 #define TM6000_GPIO_2 0x103 #define TM6000_GPIO_3 0x104 @@ -62,6 +63,16 @@ #define TM6000_GPIO_6 0x304 #define TM6000_GPIO_7 0x305 +/* tm6010 defines GPIO with different values */ +#define TM6010_GPIO_0 0x0102 +#define TM6010_GPIO_1 0x0103 +#define TM6010_GPIO_2 0x0104 +#define TM6010_GPIO_3 0x0105 +#define TM6010_GPIO_4 0x0106 +#define TM6010_GPIO_5 0x0107 +#define TM6010_GPIO_6 0x0300 +#define TM6010_GPIO_7 0x0301 +#define TM6010_GPIO_9 0x0305 /* * Define TV Master TM5600/TM6000 URB message codes and length */ diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c index 11e600bdc41b..c61d1a61ea3e 100644 --- a/drivers/staging/tm6000/tm6000-stds.c +++ b/drivers/staging/tm6000/tm6000-stds.c @@ -781,12 +781,9 @@ static int tm6000_load_std(struct tm6000_core *dev, if (!set[i].req) return 0; - /* FIXME: REQ 8 settings are for tm6010 - not tested yet - This doesn't work with tm5600 - */ - if (set[i].req == REQ_08_SET_GET_AVREG_BIT) - continue; + if ((dev->dev_type != TM6010) && + (set[i].req == REQ_08_SET_GET_AVREG_BIT)) + continue; rc = tm6000_set_reg(dev, set[i].req, set[i].reg, set[i].value); if (rc < 0) { @@ -871,5 +868,6 @@ int tm6000_set_standard(struct tm6000_core *dev, v4l2_std_id * norm) msleep(40); + return 0; } diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 9355b14c2f3d..0032a418b28e 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -45,6 +45,11 @@ enum tm6000_itype { TM6000_INPUT_SVIDEO, }; +enum tm6000_devtype { + TM6000 = 0, + TM5600, + TM6010, +}; /* ------------------------------------------------------------------ Basic structures @@ -121,6 +126,7 @@ struct tm6000_core { char name[30]; /* name (including minor) of the device */ int model; /* index in the device_data struct */ int devno; /* marks the number of this device */ + enum tm6000_devtype dev_type; /* type of device */ v4l2_std_id norm; /* Current norm */ int width,height; /* Selected resolution */ -- GitLab From 6eb5c8a6c82d7c753ea52df94ea2ff096b5aba96 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Jan 2008 11:25:57 -0300 Subject: [PATCH 051/534] V4L/DVB (12823): tm6000: Uses another method for handling incomplete packets This requires a little more memory, and some memcpy to work, but the logic is simpler than the previous method. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-regs.h | 1 - drivers/staging/tm6000/tm6000-usb-isoc.h | 12 +- drivers/staging/tm6000/tm6000-video.c | 249 +++++++++++------------ 3 files changed, 129 insertions(+), 133 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 3d676fcc262d..85acc07f62e9 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -77,7 +77,6 @@ * Define TV Master TM5600/TM6000 URB message codes and length */ -#define TM6000_URB_MSG_LEN 180 enum { TM6000_URB_MSG_VIDEO=1, TM6000_URB_MSG_AUDIO, diff --git a/drivers/staging/tm6000/tm6000-usb-isoc.h b/drivers/staging/tm6000/tm6000-usb-isoc.h index 42de91715185..10e72c04f74f 100644 --- a/drivers/staging/tm6000/tm6000-usb-isoc.h +++ b/drivers/staging/tm6000/tm6000-usb-isoc.h @@ -19,6 +19,8 @@ #include +#define TM6000_URB_MSG_LEN 180 + struct usb_isoc_ctl { /* max packet size of isoc transaction */ int max_pkt_size; @@ -32,16 +34,16 @@ struct usb_isoc_ctl { /* transfer buffers for isoc transfer */ char **transfer_buffer; - /* Last buffer command and region */ - u8 cmd; - int pos, size, pktsize; + /* Last buffer control */ + int pending; + int pos; /* Last field: ODD or EVEN? */ int field; /* Stores incomplete commands */ - u32 tmp_buf; - int tmp_buf_len; + u8 tbuf[TM6000_URB_MSG_LEN+4]; + size_t len; /* Stores already requested buffers */ struct tm6000_buffer *buf; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 107d597038b8..b72cfd0d7559 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -215,92 +215,83 @@ static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp, */ unsigned int linewidth=(*buf)->vb.width<<1; + c=(header>>24) & 0xff; + + /* split the header fields */ + size = (((header & 0x7e)<<1) -1) *4; + block = (header>>7) & 0xf; + field = (header>>11) & 0x1; + line = (header>>12) & 0x1ff; + cmd = (header>>21) & 0x7; + + /* Validates header fields */ + if(size>TM6000_URB_MSG_LEN) + size = TM6000_URB_MSG_LEN; + + if (cmd == TM6000_URB_MSG_VIDEO) { + if ((block+1)*TM6000_URB_MSG_LEN>linewidth) + cmd = TM6000_URB_MSG_ERR; + + /* FIXME: Mounts the image as field0+field1 + * It should, instead, check if the user selected + * entrelaced or non-entrelaced mode + */ + pos= ((line<<1)+field)*linewidth + + block*TM6000_URB_MSG_LEN; + + /* Don't allow to write out of the buffer */ + if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) { + dprintk(dev, V4L2_DEBUG_ISOC, + "ERR: size=%d, num=%d, line=%d, " + "field=%d\n", + size, block, line, field); - if (!dev->isoc_ctl.cmd) { - c=(header>>24) & 0xff; - - /* split the header fields */ - size = (((header & 0x7e)<<1) -1) *4; - block = (header>>7) & 0xf; - field = (header>>11) & 0x1; - line = (header>>12) & 0x1ff; - cmd = (header>>21) & 0x7; + cmd = TM6000_URB_MSG_ERR; + } + } else { + pos=0; + } - /* Validates header fields */ - if(size>TM6000_URB_MSG_LEN) - size = TM6000_URB_MSG_LEN; + /* Prints debug info */ + dprintk(dev, V4L2_DEBUG_ISOC, "size=%d, num=%d, " + " line=%d, field=%d\n", + size, block, line, field); + + if ((last_line!=line)&&(last_line+1!=line) && + (cmd != TM6000_URB_MSG_ERR) ) { + if (cmd != TM6000_URB_MSG_VIDEO) { + dprintk(dev, V4L2_DEBUG_ISOC, "cmd=%d, " + "size=%d, num=%d, line=%d, field=%d\n", + cmd, size, block, line, field); + } + if (start_line<0) + start_line=last_line; + /* Prints debug info */ + dprintk(dev, V4L2_DEBUG_ISOC, "lines= %d-%d, " + "field=%d\n", + start_line, last_line, field); - if (cmd == TM6000_URB_MSG_VIDEO) { - if ((block+1)*TM6000_URB_MSG_LEN>linewidth) - cmd = TM6000_URB_MSG_ERR; + if ((start_line<6 && last_line>200) && + (last_field != field) ) { - /* FIXME: Mounts the image as field0+field1 - * It should, instead, check if the user selected - * entrelaced or non-entrelaced mode - */ - pos= ((line<<1)+field)*linewidth + - block*TM6000_URB_MSG_LEN; + dev->isoc_ctl.nfields++; + if (dev->isoc_ctl.nfields>=2) { + dev->isoc_ctl.nfields=0; - /* Don't allow to write out of the buffer */ - if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) { + /* Announces that a new buffer were filled */ + buffer_filled (dev, dma_q, *buf); dprintk(dev, V4L2_DEBUG_ISOC, - "ERR: size=%d, num=%d, line=%d, " - "field=%d\n", - size, block, line, field); - - cmd = TM6000_URB_MSG_ERR; - } - } else { - pos=0; - } - - /* Prints debug info */ - dprintk(dev, V4L2_DEBUG_ISOC, "size=%d, num=%d, " - " line=%d, field=%d\n", - size, block, line, field); - - if ((last_line!=line)&&(last_line+1!=line) && - (cmd != TM6000_URB_MSG_ERR) ) { - if (cmd != TM6000_URB_MSG_VIDEO) { - dprintk(dev, V4L2_DEBUG_ISOC, "cmd=%d, " - "size=%d, num=%d, line=%d, field=%d\n", - cmd, size, block, line, field); - } - if (start_line<0) - start_line=last_line; - /* Prints debug info */ - dprintk(dev, V4L2_DEBUG_ISOC, "lines= %d-%d, " - "field=%d\n", - start_line, last_line, field); - - if ((start_line<6 && last_line>200) && - (last_field != field) ) { - - dev->isoc_ctl.nfields++; - if (dev->isoc_ctl.nfields>=2) { - dev->isoc_ctl.nfields=0; - - /* Announces that a new buffer were filled */ - buffer_filled (dev, dma_q, *buf); - dprintk(dev, V4L2_DEBUG_ISOC, - "new buffer filled\n"); - rc=get_next_buf (dma_q, buf); - } + "new buffer filled\n"); + rc=get_next_buf (dma_q, buf); } - - start_line=line; - last_field=field; } - last_line=line; - pktsize = TM6000_URB_MSG_LEN; - } else { - /* Continue the last copy */ - cmd = dev->isoc_ctl.cmd; - size= dev->isoc_ctl.size; - pos = dev->isoc_ctl.pos; - pktsize = dev->isoc_ctl.pktsize; + start_line=line; + last_field=field; } + last_line=line; + + pktsize = TM6000_URB_MSG_LEN; cpysize=(endp-(*ptr)>size)?size:endp-(*ptr); @@ -325,19 +316,7 @@ printk ("%ld: cmd=%s, size=%d\n", jiffies, tm6000_msg_type[cmd],size); } } - if (cpysizeisoc_ctl.pos = pos+cpysize; - dev->isoc_ctl.size= size-cpysize; - dev->isoc_ctl.cmd = cmd; - dev->isoc_ctl.pktsize = pktsize-cpysize; - (*ptr)+=cpysize; - } else { - dev->isoc_ctl.cmd = 0; - (*ptr)+=pktsize; - } + (*ptr)+=cpysize; return rc; } @@ -347,57 +326,73 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, { struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - u8 *ptr=data, *endp=data+len; + u8 *ptr, *endp; unsigned long header=0; - int rc=0; + int rc=0, size; - for (ptr=data; ptrisoc_ctl.cmd) { - u8 *p=(u8 *)&dev->isoc_ctl.tmp_buf; - /* FIXME: This seems very complex - * It just recovers up to 3 bytes of the header that - * might be at the previous packet - */ - if (dev->isoc_ctl.tmp_buf_len) { - while (dev->isoc_ctl.tmp_buf_len) { - if ( *(ptr+3-dev->isoc_ctl.tmp_buf_len) == 0x47) { - break; - } - p++; - dev->isoc_ctl.tmp_buf_len--; - } - if (dev->isoc_ctl.tmp_buf_len) { - memcpy (&header,p, - dev->isoc_ctl.tmp_buf_len); - memcpy (((u8 *)header)+ - dev->isoc_ctl.tmp_buf, - ptr, - 4-dev->isoc_ctl.tmp_buf_len); - ptr+=4-dev->isoc_ctl.tmp_buf_len; - goto HEADER; - } - } + /* Process pending data */ + if (dev->isoc_ctl.pending) { + memcpy(dev->isoc_ctl.tbuf + dev->isoc_ctl.len, ptr, + sizeof(dev->isoc_ctl.tbuf) - dev->isoc_ctl.len); + + /* Seek for sync */ + endp = dev->isoc_ctl.tbuf + sizeof(dev->isoc_ctl.tbuf); + for (ptr = dev->isoc_ctl.tbuf;ptr < endp - 3;ptr++) { + if (*(ptr + 3) == 0x47) + break; + } + header=*(unsigned long *)ptr; + size = (((header & 0x7e) << 1) - 1) * 4; + if(size > TM6000_URB_MSG_LEN) + size = TM6000_URB_MSG_LEN; + + if (ptr+3+size >= endp) { + printk(KERN_ERR "tm6000: broken data\n"); + ptr = data; + goto process_new_uri; + } + ptr+=4; + + /* Copy or continue last copy */ + rc=copy_packet(urb, header, &ptr, endp, out_p, buf); + if (rc<0) { + buf=NULL; + printk(KERN_ERR "tm6000: buffer underrun at %ld\n", + jiffies); + return rc; + } + dev->isoc_ctl.pending = 0; + ptr = data + (ptr - dev->isoc_ctl.tbuf); + } else + ptr = data; + +process_new_uri: + endp = data + len; + while (ptrisoc_ctl.pending) { /* Seek for sync */ for (;ptrTM6000_URB_MSG_LEN) + size = TM6000_URB_MSG_LEN; + + if (ptr+3+size >= endp) { + int len = endp - ptr; - if (ptr+3>=endp) { - dev->isoc_ctl.tmp_buf_len=endp-ptr; - memcpy (&dev->isoc_ctl.tmp_buf,ptr, - dev->isoc_ctl.tmp_buf_len); - dev->isoc_ctl.cmd=0; + memcpy (dev->isoc_ctl.tbuf, ptr, len); + dev->isoc_ctl.len = len; + dev->isoc_ctl.pending = 1; return rc; } - - /* Get message header */ - header=*(unsigned long *)ptr; ptr+=4; } -HEADER: + /* Copy or continue last copy */ - rc=copy_packet(urb,header,&ptr,endp,out_p,buf); + rc=copy_packet(urb, header, &ptr, endp, out_p, buf); if (rc<0) { buf=NULL; printk(KERN_ERR "tm6000: buffer underrun at %ld\n", -- GitLab From e5cc2bf4450fd9739534e690cc16efc140d7b7fc Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Jan 2008 11:26:59 -0300 Subject: [PATCH 052/534] V4L/DVB (12824): tuner-xc2028: adds an option to send i2c data on slower speed Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tuner-xc2028.c | 5 ++++- drivers/media/common/tuners/tuner-xc2028.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index 96d61707f501..8d2907f38a94 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c @@ -100,6 +100,7 @@ struct xc2028_data { if (size != _rc) \ tuner_info("i2c output error: rc = %d (should be %d)\n",\ _rc, (int)size); \ + msleep(priv->ctrl.msleep); \ _rc; \ }) @@ -119,6 +120,7 @@ struct xc2028_data { if (isize != _rc) \ tuner_err("i2c input error: rc = %d (should be %d)\n", \ _rc, (int)isize); \ + msleep(priv->ctrl.msleep); \ _rc; \ }) @@ -130,7 +132,7 @@ struct xc2028_data { _val, sizeof(_val)))) { \ tuner_err("Error on line %d: %d\n", __LINE__, _rc); \ } else \ - msleep(10); \ + msleep(priv->ctrl.msleep); \ _rc; \ }) @@ -996,6 +998,7 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, The reset CLK is needed only with tm6000. Driver should work fine even if this fails. */ + msleep(priv->ctrl.msleep); do_tuner_callback(fe, XC2028_RESET_CLK, 1); msleep(10); diff --git a/drivers/media/common/tuners/tuner-xc2028.h b/drivers/media/common/tuners/tuner-xc2028.h index a90c35d50add..e116071810e0 100644 --- a/drivers/media/common/tuners/tuner-xc2028.h +++ b/drivers/media/common/tuners/tuner-xc2028.h @@ -33,6 +33,7 @@ enum firmware_type { struct xc2028_ctrl { char *fname; int max_len; + int msleep; unsigned int scode_table; unsigned int mts :1; unsigned int input1:1; -- GitLab From 2d5024a9e97337874d8d7aa1d6a54ed1c917c5a0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Sep 2009 10:23:20 -0300 Subject: [PATCH 053/534] V4L/DVB (12825): tm6000: I2C reading operations is not reliable on tm6000 tm6000 sometimes can't read from i2c, but this is currently required for tuner-xc2028 to work. This patch adds an option to tuner-xc2028 to not rely on i2c reading. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tuner-xc2028.c | 10 ++++++++-- drivers/media/common/tuners/tuner-xc2028.h | 1 + drivers/staging/tm6000/tm6000-cards.c | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index 8d2907f38a94..53f0fbb33cc6 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c @@ -813,8 +813,14 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, /* Check firmware version against what we downloaded. */ if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) { - tuner_err("Incorrect readback of firmware version.\n"); - goto fail; + if (!priv->ctrl.read_not_reliable) { + tuner_err("Incorrect readback of firmware version.\n"); + goto fail; + } else { + tuner_err("Returned an incorrect version. However, " + "read is not reliable enough. Ignoring it.\n"); + hwmodel = 3028; + } } /* Check that the tuner hardware model remains consistent over time. */ diff --git a/drivers/media/common/tuners/tuner-xc2028.h b/drivers/media/common/tuners/tuner-xc2028.h index e116071810e0..9778c96a5006 100644 --- a/drivers/media/common/tuners/tuner-xc2028.h +++ b/drivers/media/common/tuners/tuner-xc2028.h @@ -40,6 +40,7 @@ struct xc2028_ctrl { unsigned int vhfbw7:1; unsigned int uhfbw8:1; unsigned int disable_power_mgmt:1; + unsigned int read_not_reliable:1; unsigned int demod; enum firmware_type type:2; }; diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index c0bb3ec35480..23f9672d6937 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -189,6 +189,7 @@ static void tm6000_config_tuner (struct tm6000_core *dev) ctl.fname = "tm6000-xc3028.fw"; ctl.mts = 1; + ctl.read_not_reliable = 1; xc2028_cfg.tuner = TUNER_XC2028; xc2028_cfg.priv = &ctl; -- GitLab From e381a81010469e4443c0b69d340063d92b5eb89b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 8 Jan 2008 11:27:59 -0300 Subject: [PATCH 054/534] V4L/DVB (12826): tm6000: adds 10ms delay between two consecutive i2c write ops tm6000 original driver seems to use a delay between two consecutive i2c write operations. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 23f9672d6937..d081f1423152 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -190,6 +190,7 @@ static void tm6000_config_tuner (struct tm6000_core *dev) ctl.mts = 1; ctl.read_not_reliable = 1; + ctl.msleep = 10; xc2028_cfg.tuner = TUNER_XC2028; xc2028_cfg.priv = &ctl; -- GitLab From 204193d95974df3ea4a6309cc68948e3a9596e3c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 9 Jan 2008 18:12:39 -0300 Subject: [PATCH 055/534] V4L/DVB (12827): tm6000: fix image hangs A previous committed patch hanged image output. This patch corrects this issue. It also warrants that buffer is updated for each frame0+frame1 frame set. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 9 --- drivers/staging/tm6000/tm6000-usb-isoc.h | 4 ++ drivers/staging/tm6000/tm6000-video.c | 74 +++++++++--------------- 3 files changed, 30 insertions(+), 57 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index d081f1423152..650ed8e88f38 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -410,15 +410,6 @@ static int tm6000_usb_probe(struct usb_interface *interface, } } - if (interface->altsetting->desc.bAlternateSetting) { - printk("selecting alt setting %d\n", - interface->altsetting->desc.bAlternateSetting); - rc = usb_set_interface (usbdev, - interface->altsetting->desc.bInterfaceNumber, - interface->altsetting->desc.bAlternateSetting); - if (rc<0) - goto err; - } printk("tm6000: New video device @ %s Mbps (%04x:%04x, ifnum %d)\n", speed, diff --git a/drivers/staging/tm6000/tm6000-usb-isoc.h b/drivers/staging/tm6000/tm6000-usb-isoc.h index 10e72c04f74f..24b0fd07900e 100644 --- a/drivers/staging/tm6000/tm6000-usb-isoc.h +++ b/drivers/staging/tm6000/tm6000-usb-isoc.h @@ -50,4 +50,8 @@ struct usb_isoc_ctl { /* Stores the number of received fields */ int nfields; + + /* Checks if a complete field were received */ + int last_line; + unsigned int fields:2; }; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index b72cfd0d7559..528ac6e8b085 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -257,6 +257,22 @@ static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp, " line=%d, field=%d\n", size, block, line, field); + /* Checks if a complete set of frame0 + frame 1 were received */ + if (dev->isoc_ctl.last_line > line) { + if (dev->isoc_ctl.fields == 3) { + /* Announces that a new buffer were filled */ + buffer_filled(dev, dma_q, *buf); + dprintk(dev, V4L2_DEBUG_ISOC, + "new buffer filled\n"); + rc = get_next_buf(dma_q, buf); + + dev->isoc_ctl.fields = 0; + } else { + dev->isoc_ctl.fields |= 1 << field; + } + } + dev->isoc_ctl.last_line = line; + if ((last_line!=line)&&(last_line+1!=line) && (cmd != TM6000_URB_MSG_ERR) ) { if (cmd != TM6000_URB_MSG_VIDEO) { @@ -277,12 +293,6 @@ static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp, dev->isoc_ctl.nfields++; if (dev->isoc_ctl.nfields>=2) { dev->isoc_ctl.nfields=0; - - /* Announces that a new buffer were filled */ - buffer_filled (dev, dma_q, *buf); - dprintk(dev, V4L2_DEBUG_ISOC, - "new buffer filled\n"); - rc=get_next_buf (dma_q, buf); } } @@ -631,11 +641,17 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, int max_packets, int num_bufs) { struct tm6000_dmaqueue *dma_q = &dev->vidq; - int i; + int i, rc; int sb_size, pipe; struct urb *urb; int j, k; + dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %dx%d packets" + " of %d bytes each to handle %u size\n", + max_packets, num_bufs, + dev->max_isoc_in, dev->isoc_ctl.max_pkt_size); + + /* De-allocates all pending stuff */ tm6000_uninit_isoc(dev); @@ -684,6 +700,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, } memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size); + pipe=usb_rcvisocpipe(dev->udev, dev->isoc_in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); @@ -862,7 +879,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, struct tm6000_fh *fh = vq->priv_data; struct tm6000_buffer *buf = container_of(vb,struct tm6000_buffer,vb); struct tm6000_core *dev = fh->dev; - int rc=0, urbsize, urb_init=0, npackets=1; + int rc = 0, urb_init = 0; BUG_ON(NULL == fh->fmt); @@ -890,50 +907,11 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, urb_init=1; } - if (!dev->isoc_ctl.num_bufs) urb_init=1; if (urb_init) { - /* memory for video - Should be at least - Vres x Vres x 2 bytes/pixel by frame */ - urbsize=buf->vb.size; - - /* Need also one PTS */ - urbsize+=180; - - /* memory for audio - Should be at least - bitrate * 2 channels * 2 bytes / frame rate */ - if (dev->norm & V4L2_STD_525_60) { - urbsize+=(dev->audio_bitrate*4+29)/30; - } else { - urbsize+=(dev->audio_bitrate*4+24)/25; - } - - /* each audio frame seeems to have a frame number - with 2 bytes */ - urbsize+=2; - - /* Add 4 bytes by each 180 bytes frame */ - urbsize+=((urbsize+179)/180)*4; - - /* Round to an enough number of URBs */ - urbsize=(urbsize+dev->max_isoc_in-1)/dev->max_isoc_in; - - /* Avoids allocating big memory areas for URB */ - while ((urbsize*dev->max_isoc_in)/npackets>65535) { - npackets++; - } - urbsize/=(urbsize+npackets-1)/npackets; - - dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %dx%d packets" - " of %d bytes each to handle %lu size\n", - npackets,urbsize,dev->max_isoc_in,buf->vb.size); - - rc = tm6000_prepare_isoc(dev, urbsize, npackets); - + rc = tm6000_prepare_isoc(dev, 128, 1); if (rc<0) goto fail; } -- GitLab From c4acf48cad7f6654c55e53734440d67140cf4269 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 9 Jan 2008 22:44:51 -0300 Subject: [PATCH 056/534] V4L/DVB (12828): tm6000: fixes several CodingStyle and do some cleanups Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 313 ++++++++++++-------------- 1 file changed, 146 insertions(+), 167 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 528ac6e8b085..56dc001460bd 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -33,9 +33,6 @@ #include #include #include -#ifdef CONFIG_VIDEO_V4L1_COMPAT -#include -#endif #include #include #include @@ -93,7 +90,7 @@ static struct v4l2_queryctrl tm6000_qctrl[] = { .minimum = -128, .maximum = 127, .step = 0x1, - .default_value = 0, //4 ? + .default_value = 0, .flags = 0, } }; @@ -105,11 +102,11 @@ static struct tm6000_fmt format[] = { .name = "4:2:2, packed, YVY2", .fourcc = V4L2_PIX_FMT_YUYV, .depth = 16, - },{ + }, { .name = "4:2:2, packed, UYVY", .fourcc = V4L2_PIX_FMT_UYVY, .depth = 16, - },{ + }, { .name = "A/V + VBI mux packet", .fourcc = V4L2_PIX_FMT_TM6000, .depth = 16, @@ -125,20 +122,19 @@ static LIST_HEAD(tm6000_corelist); #define norm_maxw(a) 720 #define norm_maxh(a) 576 -//#define norm_minw(a) norm_maxw(a) #define norm_minw(a) norm_maxw(a) #define norm_minh(a) norm_maxh(a) /* * video-buf generic routine to get the next available buffer */ -static int inline get_next_buf (struct tm6000_dmaqueue *dma_q, - struct tm6000_buffer **buf) +static inline int get_next_buf(struct tm6000_dmaqueue *dma_q, + struct tm6000_buffer **buf) { - struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); if (list_empty(&dma_q->active)) { - dprintk(dev, V4L2_DEBUG_QUEUE,"No active queue to serve\n"); + dprintk(dev, V4L2_DEBUG_QUEUE, "No active queue to serve\n"); return 0; } @@ -151,9 +147,9 @@ static int inline get_next_buf (struct tm6000_dmaqueue *dma_q, /* * Announces that a buffer were filled and request the next */ -static void inline buffer_filled (struct tm6000_core *dev, - struct tm6000_dmaqueue *dma_q, - struct tm6000_buffer *buf) +static inline void buffer_filled(struct tm6000_core *dev, + struct tm6000_dmaqueue *dma_q, + struct tm6000_buffer *buf) { /* Nobody is waiting something to be done, just return */ if (!waitqueue_active(&buf->vb.done)) { @@ -166,7 +162,7 @@ static void inline buffer_filled (struct tm6000_core *dev, } /* Advice that buffer was filled */ - dprintk(dev, V4L2_DEBUG_ISOC, "[%p/%d] wakeup\n",buf,buf->vb.i); + dprintk(dev, V4L2_DEBUG_ISOC, "[%p/%d] wakeup\n", buf, buf->vb.i); buf->vb.state = VIDEOBUF_DONE; buf->vb.field_count++; do_gettimeofday(&buf->vb.ts); @@ -175,72 +171,61 @@ static void inline buffer_filled (struct tm6000_core *dev, wake_up(&buf->vb.done); } -/* - * Macro to allow copying data into the proper memory type - */ - -#define bufcpy(buf,out_ptr,in_ptr,size) \ - { \ - if (__copy_to_user(out_ptr,in_ptr,size)!=0) \ - tm6000_err("copy_to_user failed.\n"); \ - } - - -const char *tm6000_msg_type[]= { - "unknown(0)", //0 - "video", //1 - "audio", //2 - "vbi", //3 - "pts", //4 - "err", //5 - "unknown(6)", //6 - "unknown(7)", //7 +const char *tm6000_msg_type[] = { + "unknown(0)", /* 0 */ + "video", /* 1 */ + "audio", /* 2 */ + "vbi", /* 3 */ + "pts", /* 4 */ + "err", /* 5 */ + "unknown(6)", /* 6 */ + "unknown(7)", /* 7 */ }; /* * Identify the tm5600/6000 buffer header type and properly handles */ -static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp, +static int copy_packet(struct urb *urb, u32 header, u8 **ptr, u8 *endp, u8 *out_p, struct tm6000_buffer **buf) { struct tm6000_dmaqueue *dma_q = urb->context; - struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); u8 c; - unsigned int cmd, cpysize, pktsize, size, field, block, line, pos=0; - int rc=0; + unsigned int cmd, cpysize, pktsize, size, field, block, line, pos = 0; + int rc = 0; /* FIXME: move to tm6000-isoc */ - static int last_line=-2, start_line=-2, last_field=-2; + static int last_line = -2, start_line = -2, last_field = -2; /* FIXME: this is the hardcoded window size */ - unsigned int linewidth=(*buf)->vb.width<<1; + unsigned int linewidth = (*buf)->vb.width << 1; - c=(header>>24) & 0xff; + c = (header >> 24) & 0xff; /* split the header fields */ - size = (((header & 0x7e)<<1) -1) *4; - block = (header>>7) & 0xf; - field = (header>>11) & 0x1; - line = (header>>12) & 0x1ff; - cmd = (header>>21) & 0x7; + size = (((header & 0x7e) << 1) - 1) * 4; + block = (header >> 7) & 0xf; + field = (header >> 11) & 0x1; + line = (header >> 12) & 0x1ff; + cmd = (header >> 21) & 0x7; /* Validates header fields */ - if(size>TM6000_URB_MSG_LEN) + if (size > TM6000_URB_MSG_LEN) size = TM6000_URB_MSG_LEN; if (cmd == TM6000_URB_MSG_VIDEO) { - if ((block+1)*TM6000_URB_MSG_LEN>linewidth) + if ((block + 1) * TM6000_URB_MSG_LEN > linewidth) cmd = TM6000_URB_MSG_ERR; /* FIXME: Mounts the image as field0+field1 * It should, instead, check if the user selected * entrelaced or non-entrelaced mode */ - pos= ((line<<1)+field)*linewidth + - block*TM6000_URB_MSG_LEN; + pos = ((line << 1) + field) * linewidth + + block * TM6000_URB_MSG_LEN; /* Don't allow to write out of the buffer */ - if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) { + if (pos + TM6000_URB_MSG_LEN > (*buf)->vb.size) { dprintk(dev, V4L2_DEBUG_ISOC, "ERR: size=%d, num=%d, line=%d, " "field=%d\n", @@ -249,7 +234,7 @@ static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp, cmd = TM6000_URB_MSG_ERR; } } else { - pos=0; + pos = 0; } /* Prints debug info */ @@ -273,60 +258,59 @@ static int copy_packet (struct urb *urb, u32 header, u8 **ptr, u8 *endp, } dev->isoc_ctl.last_line = line; - if ((last_line!=line)&&(last_line+1!=line) && - (cmd != TM6000_URB_MSG_ERR) ) { + if ((last_line != line) && (last_line + 1 != line) && + (cmd != TM6000_URB_MSG_ERR)) { if (cmd != TM6000_URB_MSG_VIDEO) { dprintk(dev, V4L2_DEBUG_ISOC, "cmd=%d, " "size=%d, num=%d, line=%d, field=%d\n", cmd, size, block, line, field); } - if (start_line<0) - start_line=last_line; + if (start_line < 0) + start_line = last_line; /* Prints debug info */ dprintk(dev, V4L2_DEBUG_ISOC, "lines= %d-%d, " "field=%d\n", start_line, last_line, field); - if ((start_line<6 && last_line>200) && - (last_field != field) ) { + if ((start_line < 6 && last_line > 200) && + (last_field != field)) { dev->isoc_ctl.nfields++; - if (dev->isoc_ctl.nfields>=2) { - dev->isoc_ctl.nfields=0; - } + if (dev->isoc_ctl.nfields >= 2) + dev->isoc_ctl.nfields = 0; } - start_line=line; - last_field=field; + start_line = line; + last_field = field; } - last_line=line; + last_line = line; pktsize = TM6000_URB_MSG_LEN; - cpysize=(endp-(*ptr)>size)?size:endp-(*ptr); + cpysize = (endp-(*ptr) > size) ? size : endp - *ptr; if (cpysize) { /* handles each different URB message */ - switch(cmd) { + switch (cmd) { case TM6000_URB_MSG_VIDEO: /* Fills video buffer */ - if (__copy_to_user(&out_p[pos],*ptr,cpysize)!=0) + if (__copy_to_user(&out_p[pos], *ptr, cpysize) != 0) tm6000_err("copy_to_user failed.\n"); break; case TM6000_URB_MSG_PTS: break; case TM6000_URB_MSG_AUDIO: -/* Need some code to process audio */ -printk ("%ld: cmd=%s, size=%d\n", jiffies, - tm6000_msg_type[cmd],size); + /* Need some code to process audio */ + printk(KERN_INFO "%ld: cmd=%s, size=%d\n", jiffies, + tm6000_msg_type[cmd], size); break; default: - dprintk (dev, V4L2_DEBUG_ISOC, "cmd=%s, size=%d\n", - tm6000_msg_type[cmd],size); + dprintk(dev, V4L2_DEBUG_ISOC, "cmd=%s, size=%d\n", + tm6000_msg_type[cmd], size); } } - (*ptr)+=cpysize; + (*ptr) += cpysize; return rc; } @@ -335,10 +319,10 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, struct urb *urb, struct tm6000_buffer **buf) { struct tm6000_dmaqueue *dma_q = urb->context; - struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); u8 *ptr, *endp; - unsigned long header=0; - int rc=0, size; + unsigned long header = 0; + int rc = 0, size; /* Process pending data */ if (dev->isoc_ctl.pending) { @@ -347,26 +331,26 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, /* Seek for sync */ endp = dev->isoc_ctl.tbuf + sizeof(dev->isoc_ctl.tbuf); - for (ptr = dev->isoc_ctl.tbuf;ptr < endp - 3;ptr++) { + for (ptr = dev->isoc_ctl.tbuf; ptr < endp - 3; ptr++) { if (*(ptr + 3) == 0x47) break; } - header=*(unsigned long *)ptr; - size = (((header & 0x7e) << 1) - 1) * 4; - if(size > TM6000_URB_MSG_LEN) + header = *(unsigned long *)ptr; + size = (((header & 0x7e) << 1) - 1) * 4; + if (size > TM6000_URB_MSG_LEN) size = TM6000_URB_MSG_LEN; - if (ptr+3+size >= endp) { + if (ptr + 3 + size >= endp) { printk(KERN_ERR "tm6000: broken data\n"); ptr = data; goto process_new_uri; } - ptr+=4; + ptr += 4; /* Copy or continue last copy */ - rc=copy_packet(urb, header, &ptr, endp, out_p, buf); - if (rc<0) { - buf=NULL; + rc = copy_packet(urb, header, &ptr, endp, out_p, buf); + if (rc < 0) { + buf = NULL; printk(KERN_ERR "tm6000: buffer underrun at %ld\n", jiffies); return rc; @@ -378,33 +362,33 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, process_new_uri: endp = data + len; - while (ptrisoc_ctl.pending) { /* Seek for sync */ - for (;ptrTM6000_URB_MSG_LEN) + header = *(unsigned long *)ptr; + size = (((header & 0x7e) << 1) - 1) * 4; + if (size > TM6000_URB_MSG_LEN) size = TM6000_URB_MSG_LEN; - if (ptr+3+size >= endp) { + if (ptr + 3 + size >= endp) { int len = endp - ptr; - memcpy (dev->isoc_ctl.tbuf, ptr, len); + memcpy(dev->isoc_ctl.tbuf, ptr, len); dev->isoc_ctl.len = len; dev->isoc_ctl.pending = 1; return rc; } - ptr+=4; + ptr += 4; } /* Copy or continue last copy */ - rc=copy_packet(urb, header, &ptr, endp, out_p, buf); - if (rc<0) { - buf=NULL; + rc = copy_packet(urb, header, &ptr, endp, out_p, buf); + if (rc < 0) { + buf = NULL; printk(KERN_ERR "tm6000: buffer underrun at %ld\n", jiffies); return rc; @@ -420,40 +404,42 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, struct urb *urb, struct tm6000_buffer **buf) { struct tm6000_dmaqueue *dma_q = urb->context; - struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - unsigned int pos=dev->isoc_ctl.pos,cpysize; - int rc=1; - - while (len>0) { - cpysize=min(len,(*buf)->vb.size-pos); -//printk("Copying %d bytes (max=%lu) from %p to %p[%u]\n",cpysize,(*buf)->vb.size,ptr,out_p,pos); - bufcpy(*buf,&out_p[pos],ptr,cpysize); - pos+=cpysize; - ptr+=cpysize; - len-=cpysize; + struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); + unsigned int pos = dev->isoc_ctl.pos, cpysize; + int rc = 1; + + while (len > 0) { + cpysize = min(len, (*buf)->vb.size-pos); + + if (__copy_to_user(&out_p[pos], ptr, cpysize) != 0) + tm6000_err("copy_to_user failed.\n"); + + pos += cpysize; + ptr += cpysize; + len -= cpysize; if (pos >= (*buf)->vb.size) { - pos=0; + pos = 0; /* Announces that a new buffer were filled */ - buffer_filled (dev, dma_q, *buf); + buffer_filled(dev, dma_q, *buf); dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); - rc=get_next_buf (dma_q, buf); - if (rc<=0) { - *buf=NULL; + rc = get_next_buf(dma_q, buf); + if (rc <= 0) { + *buf = NULL; break; } } } - dev->isoc_ctl.pos=pos; + dev->isoc_ctl.pos = pos; return rc; } -static void inline print_err_status (struct tm6000_core *dev, - int packet, int status) +static inline void print_err_status(struct tm6000_core *dev, + int packet, int status) { char *errmsg = "Unknown"; - switch(status) { + switch (status) { case -ENOENT: errmsg = "unlinked synchronuously"; break; @@ -479,11 +465,12 @@ static void inline print_err_status (struct tm6000_core *dev, errmsg = "Device does not respond"; break; } - if (packet<0) { + if (packet < 0) { dprintk(dev, V4L2_DEBUG_QUEUE, "URB status %d [%s].\n", status, errmsg); } else { - dprintk(dev, V4L2_DEBUG_QUEUE, "URB packet %d, status %d [%s].\n", + dprintk(dev, V4L2_DEBUG_QUEUE, + "URB packet %d, status %d [%s].\n", packet, status, errmsg); } } @@ -495,45 +482,40 @@ static void inline print_err_status (struct tm6000_core *dev, static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) { struct tm6000_dmaqueue *dma_q = urb->context; - struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - void *outp=videobuf_to_vmalloc (&((*buf)->vb)); - int i, len=0, rc=1; - int size=(*buf)->vb.size; + struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); + void *outp = videobuf_to_vmalloc(&((*buf)->vb)); + int i, len = 0, rc = 1; + int size = (*buf)->vb.size; char *p; - unsigned long copied; + unsigned long copied = 0; - copied=0; - - if (urb->status<0) { - print_err_status (dev,-1,urb->status); + if (urb->status < 0) { + print_err_status(dev, -1, urb->status); return 0; } for (i = 0; i < urb->number_of_packets; i++) { int status = urb->iso_frame_desc[i].status; - if (status<0) { - print_err_status (dev,i,status); + if (status < 0) { + print_err_status(dev, i, status); continue; } - len=urb->iso_frame_desc[i].actual_length; - -// if (len>=TM6000_URB_MSG_LEN) { - p=urb->transfer_buffer + urb->iso_frame_desc[i].offset; - if (!urb->iso_frame_desc[i].status) { - if (((*buf)->fmt->fourcc)==V4L2_PIX_FMT_TM6000) { - rc=copy_multiplexed(p,outp,len,urb,buf); - if (rc<=0) - return rc; - } else { - copy_streams(p,outp,len,urb,buf); - } - } - copied += len; - if (copied>=size) - break; -// } + len = urb->iso_frame_desc[i].actual_length; + + p = urb->transfer_buffer + urb->iso_frame_desc[i].offset; + if (!urb->iso_frame_desc[i].status) { + if (((*buf)->fmt->fourcc) == V4L2_PIX_FMT_TM6000) { + rc = copy_multiplexed(p, outp, len, urb, buf); + if (rc <= 0) + return rc; + } else + copy_streams(p, outp, len, urb, buf); + } + copied += len; + if (copied >= size) + break; } return rc; } @@ -549,43 +531,41 @@ static void tm6000_irq_callback(struct urb *urb) { struct tm6000_buffer *buf; struct tm6000_dmaqueue *dma_q = urb->context; - struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - int rc,i; + struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); + int rc, i; unsigned long flags; - spin_lock_irqsave(&dev->slock,flags); + spin_lock_irqsave(&dev->slock, flags); - buf=dev->isoc_ctl.buf; + buf = dev->isoc_ctl.buf; if (!buf) { - rc=get_next_buf (dma_q, &buf); - if (rc<=0) + rc = get_next_buf(dma_q, &buf); + if (rc <= 0) goto ret; } /* Copy data from URB */ - rc=tm6000_isoc_copy(urb, &buf); + rc = tm6000_isoc_copy(urb, &buf); - dev->isoc_ctl.buf=buf; + dev->isoc_ctl.buf = buf; ret: /* Reset urb buffers */ for (i = 0; i < urb->number_of_packets; i++) { urb->iso_frame_desc[i].status = 0; urb->iso_frame_desc[i].actual_length = 0; } - urb->status = 0; - if ((urb->status = usb_submit_urb(urb, GFP_ATOMIC))) { + urb->status = usb_submit_urb(urb, GFP_ATOMIC); + if (urb->status) tm6000_err("urb resubmit failed (error=%i)\n", urb->status); - } - if (rc>=0) { - /* Data filled, reset watchdog */ - mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); -// } - } - spin_unlock_irqrestore(&dev->slock,flags); + /* Data filled, reset watchdog */ + if (rc >= 0) + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + + spin_unlock_irqrestore(&dev->slock, flags); } /* @@ -641,7 +621,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, int max_packets, int num_bufs) { struct tm6000_dmaqueue *dma_q = &dev->vidq; - int i, rc; + int i; int sb_size, pipe; struct urb *urb; int j, k; @@ -700,7 +680,6 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, } memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size); - pipe=usb_rcvisocpipe(dev->udev, dev->isoc_in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); -- GitLab From ee1fc07c9fb038298bf85fef774669a7bdf4b58b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 10 Jan 2008 17:27:26 -0300 Subject: [PATCH 057/534] V4L/DVB (12829): tm6000: several changes on usb preparation trying to avoid -EPROTO errors Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 96 ++++++++++++++------------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 56dc001460bd..13be5a0df8d6 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -47,6 +47,8 @@ #define TM6000_MIN_BUF 4 #define TM6000_DEF_BUF 8 +#define TM6000_MAX_ISO_PACKETS 40 /* Max number of ISO packets */ + /* Declare static vars that will be used as parameters */ static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ @@ -532,7 +534,7 @@ static void tm6000_irq_callback(struct urb *urb) struct tm6000_buffer *buf; struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); - int rc, i; + int rc; unsigned long flags; spin_lock_irqsave(&dev->slock, flags); @@ -550,11 +552,6 @@ static void tm6000_irq_callback(struct urb *urb) dev->isoc_ctl.buf = buf; ret: - /* Reset urb buffers */ - for (i = 0; i < urb->number_of_packets; i++) { - urb->iso_frame_desc[i].status = 0; - urb->iso_frame_desc[i].actual_length = 0; - } urb->status = usb_submit_urb(urb, GFP_ATOMIC); if (urb->status) @@ -576,8 +573,8 @@ static void tm6000_uninit_isoc(struct tm6000_core *dev) struct urb *urb; int i; - dev->isoc_ctl.nfields=-1; - dev->isoc_ctl.buf=NULL; + dev->isoc_ctl.nfields = -1; + dev->isoc_ctl.buf = NULL; for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { urb=dev->isoc_ctl.urb[i]; if (urb) { @@ -613,38 +610,47 @@ static void tm6000_stop_thread(struct tm6000_dmaqueue *dma_q) tm6000_uninit_isoc(dev); } - /* * Allocate URBs and start IRQ */ -static int tm6000_prepare_isoc(struct tm6000_core *dev, - int max_packets, int num_bufs) +static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) { struct tm6000_dmaqueue *dma_q = &dev->vidq; - int i; - int sb_size, pipe; + int i, j, sb_size, pipe, size, max_packets, num_bufs = 5; struct urb *urb; - int j, k; - - dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %dx%d packets" - " of %d bytes each to handle %u size\n", - max_packets, num_bufs, - dev->max_isoc_in, dev->isoc_ctl.max_pkt_size); - /* De-allocates all pending stuff */ tm6000_uninit_isoc(dev); - dev->isoc_ctl.num_bufs=num_bufs; - dev->isoc_ctl.urb=kmalloc(sizeof(void *)*num_bufs, - GFP_KERNEL); + pipe = usb_rcvisocpipe(dev->udev, + dev->isoc_in->desc.bEndpointAddress & + USB_ENDPOINT_NUMBER_MASK); + + size = usb_maxpacket(dev->udev, pipe, usb_pipeout(pipe)); + + if (size > dev->max_isoc_in) + size = dev->max_isoc_in; + + dev->isoc_ctl.max_pkt_size = size; + + max_packets = ( framesize + size - 1) / size; + + if (max_packets > TM6000_MAX_ISO_PACKETS) + max_packets = TM6000_MAX_ISO_PACKETS; + + sb_size = max_packets * size; + + dev->isoc_ctl.num_bufs = num_bufs; + + dev->isoc_ctl.urb = kmalloc(sizeof(void *)*num_bufs, + GFP_KERNEL); if (!dev->isoc_ctl.urb) { tm6000_err("cannot alloc memory for usb buffers\n"); return -ENOMEM; } - dev->isoc_ctl.transfer_buffer=kmalloc(sizeof(void *)*num_bufs, + dev->isoc_ctl.transfer_buffer = kmalloc(sizeof(void *)*num_bufs, GFP_KERNEL); if (!dev->isoc_ctl.urb) { tm6000_err("cannot allocate memory for usbtransfer\n"); @@ -652,9 +658,10 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, return -ENOMEM; } - dev->isoc_ctl.max_pkt_size=dev->max_isoc_in; - - sb_size = max_packets * dev->isoc_ctl.max_pkt_size; + dprintk(dev, V4L2_DEBUG_QUEUE, "Allocating %d x %d packets" + " (%d bytes) of %d bytes each to handle %u size\n", + max_packets, num_bufs, sb_size, + dev->max_isoc_in, size); /* allocate urbs and transfer buffers */ @@ -680,23 +687,17 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, } memset(dev->isoc_ctl.transfer_buffer[i], 0, sb_size); - pipe=usb_rcvisocpipe(dev->udev, - dev->isoc_in->desc.bEndpointAddress & - USB_ENDPOINT_NUMBER_MASK); - usb_fill_int_urb(urb, dev->udev, pipe, - dev->isoc_ctl.transfer_buffer[i],sb_size, - tm6000_irq_callback, dma_q, - dev->isoc_in->desc.bInterval); - + usb_fill_bulk_urb(urb, dev->udev, pipe, + dev->isoc_ctl.transfer_buffer[i], sb_size, + tm6000_irq_callback, dma_q); +// urb->interval = dev->isoc_in->desc.bInterval; + urb->interval = 2; urb->number_of_packets = max_packets; - urb->transfer_flags = URB_ISO_ASAP; + urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; - k = 0; for (j = 0; j < max_packets; j++) { - urb->iso_frame_desc[j].offset = k; - urb->iso_frame_desc[j].length = - dev->isoc_ctl.max_pkt_size; - k += dev->isoc_ctl.max_pkt_size; + urb->iso_frame_desc[j].offset = size * j; + urb->iso_frame_desc[j].length = size; } } @@ -881,17 +882,18 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, } if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { - if (0 != (rc = videobuf_iolock(vq,&buf->vb,NULL))) + if (0 != (rc = videobuf_iolock(vq, &buf->vb, NULL))) goto fail; - urb_init=1; + urb_init = 1; } if (!dev->isoc_ctl.num_bufs) - urb_init=1; + urb_init = 1; if (urb_init) { - rc = tm6000_prepare_isoc(dev, 128, 1); - if (rc<0) + rc = tm6000_prepare_isoc(dev, buf->vb.size); + + if (rc < 0) goto fail; } @@ -899,7 +901,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, return 0; fail: - free_buffer(vq,buf); + free_buffer(vq, buf); return rc; } -- GitLab From d72d50670efa7f41d441541aded4e60ddfec7932 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 11 Jan 2008 10:28:50 -0300 Subject: [PATCH 058/534] V4L/DVB (12830): tm6000: copy cx88-alsa as tm6000-alsa Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-alsa.c | 912 +++++++++++++++++++++++++++ 1 file changed, 912 insertions(+) create mode 100644 drivers/staging/tm6000/tm6000-alsa.c diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c new file mode 100644 index 000000000000..074dcf091454 --- /dev/null +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -0,0 +1,912 @@ +/* + * + * Support for audio capture + * PCI function #1 of the cx2388x. + * + * (c) 2007 Trent Piepho + * (c) 2005,2006 Ricardo Cerqueira + * (c) 2005 Mauro Carvalho Chehab + * Based on a dummy cx88 module by Gerd Knorr + * Based on dummy.c by Jaroslav Kysela + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cx88.h" +#include "cx88-reg.h" + +#define dprintk(level,fmt, arg...) if (debug >= level) \ + printk(KERN_INFO "%s/1: " fmt, chip->core->name , ## arg) + +#define dprintk_core(level,fmt, arg...) if (debug >= level) \ + printk(KERN_DEBUG "%s/1: " fmt, chip->core->name , ## arg) + +/**************************************************************************** + Data type declarations - Can be moded to a header file later + ****************************************************************************/ + +struct cx88_audio_dev { + struct cx88_core *core; + struct cx88_dmaqueue q; + + /* pci i/o */ + struct pci_dev *pci; + + /* audio controls */ + int irq; + + struct snd_card *card; + + spinlock_t reg_lock; + atomic_t count; + + unsigned int dma_size; + unsigned int period_size; + unsigned int num_periods; + + struct videobuf_dmabuf *dma_risc; + + struct cx88_buffer *buf; + + struct snd_pcm_substream *substream; +}; +typedef struct cx88_audio_dev snd_cx88_card_t; + + + + +/**************************************************************************** + Module global static vars + ****************************************************************************/ + +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ +static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ +static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1}; + +module_param_array(enable, bool, NULL, 0444); +MODULE_PARM_DESC(enable, "Enable cx88x soundcard. default enabled."); + +module_param_array(index, int, NULL, 0444); +MODULE_PARM_DESC(index, "Index value for cx88x capture interface(s)."); + + +/**************************************************************************** + Module macros + ****************************************************************************/ + +MODULE_DESCRIPTION("ALSA driver module for cx2388x based TV cards"); +MODULE_AUTHOR("Ricardo Cerqueira"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); +MODULE_LICENSE("GPL"); +MODULE_SUPPORTED_DEVICE("{{Conexant,23881}," + "{{Conexant,23882}," + "{{Conexant,23883}"); +static unsigned int debug; +module_param(debug,int,0644); +MODULE_PARM_DESC(debug,"enable debug messages"); + +/**************************************************************************** + Module specific funtions + ****************************************************************************/ + +/* + * BOARD Specific: Sets audio DMA + */ + +static int _cx88_start_audio_dma(snd_cx88_card_t *chip) +{ + struct cx88_buffer *buf = chip->buf; + struct cx88_core *core=chip->core; + struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25]; + + /* Make sure RISC/FIFO are off before changing FIFO/RISC settings */ + cx_clear(MO_AUD_DMACNTRL, 0x11); + + /* setup fifo + format - out channel */ + cx88_sram_channel_setup(chip->core, audio_ch, buf->bpl, buf->risc.dma); + + /* sets bpl size */ + cx_write(MO_AUDD_LNGTH, buf->bpl); + + /* reset counter */ + cx_write(MO_AUDD_GPCNTRL, GP_COUNT_CONTROL_RESET); + atomic_set(&chip->count, 0); + + dprintk(1, "Start audio DMA, %d B/line, %d lines/FIFO, %d periods, %d " + "byte buffer\n", buf->bpl, cx_read(audio_ch->cmds_start + 8)>>1, + chip->num_periods, buf->bpl * chip->num_periods); + + /* Enables corresponding bits at AUD_INT_STAT */ + cx_write(MO_AUD_INTMSK, AUD_INT_OPC_ERR | AUD_INT_DN_SYNC | + AUD_INT_DN_RISCI2 | AUD_INT_DN_RISCI1); + + /* Clean any pending interrupt bits already set */ + cx_write(MO_AUD_INTSTAT, ~0); + + /* enable audio irqs */ + cx_set(MO_PCI_INTMSK, chip->core->pci_irqmask | PCI_INT_AUDINT); + + /* start dma */ + cx_set(MO_DEV_CNTRL2, (1<<5)); /* Enables Risc Processor */ + cx_set(MO_AUD_DMACNTRL, 0x11); /* audio downstream FIFO and RISC enable */ + + if (debug) + cx88_sram_channel_dump(chip->core, audio_ch); + + return 0; +} + +/* + * BOARD Specific: Resets audio DMA + */ +static int _cx88_stop_audio_dma(snd_cx88_card_t *chip) +{ + struct cx88_core *core=chip->core; + dprintk(1, "Stopping audio DMA\n"); + + /* stop dma */ + cx_clear(MO_AUD_DMACNTRL, 0x11); + + /* disable irqs */ + cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT); + cx_clear(MO_AUD_INTMSK, AUD_INT_OPC_ERR | AUD_INT_DN_SYNC | + AUD_INT_DN_RISCI2 | AUD_INT_DN_RISCI1); + + if (debug) + cx88_sram_channel_dump(chip->core, &cx88_sram_channels[SRAM_CH25]); + + return 0; +} + +#define MAX_IRQ_LOOP 50 + +/* + * BOARD Specific: IRQ dma bits + */ +static char *cx88_aud_irqs[32] = { + "dn_risci1", "up_risci1", "rds_dn_risc1", /* 0-2 */ + NULL, /* reserved */ + "dn_risci2", "up_risci2", "rds_dn_risc2", /* 4-6 */ + NULL, /* reserved */ + "dnf_of", "upf_uf", "rds_dnf_uf", /* 8-10 */ + NULL, /* reserved */ + "dn_sync", "up_sync", "rds_dn_sync", /* 12-14 */ + NULL, /* reserved */ + "opc_err", "par_err", "rip_err", /* 16-18 */ + "pci_abort", "ber_irq", "mchg_irq" /* 19-21 */ +}; + +/* + * BOARD Specific: Threats IRQ audio specific calls + */ +static void cx8801_aud_irq(snd_cx88_card_t *chip) +{ + struct cx88_core *core = chip->core; + u32 status, mask; + + status = cx_read(MO_AUD_INTSTAT); + mask = cx_read(MO_AUD_INTMSK); + if (0 == (status & mask)) + return; + cx_write(MO_AUD_INTSTAT, status); + if (debug > 1 || (status & mask & ~0xff)) + cx88_print_irqbits(core->name, "irq aud", + cx88_aud_irqs, ARRAY_SIZE(cx88_aud_irqs), + status, mask); + /* risc op code error */ + if (status & AUD_INT_OPC_ERR) { + printk(KERN_WARNING "%s/1: Audio risc op code error\n",core->name); + cx_clear(MO_AUD_DMACNTRL, 0x11); + cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH25]); + } + if (status & AUD_INT_DN_SYNC) { + dprintk(1, "Downstream sync error\n"); + cx_write(MO_AUDD_GPCNTRL, GP_COUNT_CONTROL_RESET); + return; + } + /* risc1 downstream */ + if (status & AUD_INT_DN_RISCI1) { + atomic_set(&chip->count, cx_read(MO_AUDD_GPCNT)); + snd_pcm_period_elapsed(chip->substream); + } + /* FIXME: Any other status should deserve a special handling? */ +} + +/* + * BOARD Specific: Handles IRQ calls + */ +static irqreturn_t cx8801_irq(int irq, void *dev_id) +{ + snd_cx88_card_t *chip = dev_id; + struct cx88_core *core = chip->core; + u32 status; + int loop, handled = 0; + + for (loop = 0; loop < MAX_IRQ_LOOP; loop++) { + status = cx_read(MO_PCI_INTSTAT) & + (core->pci_irqmask | PCI_INT_AUDINT); + if (0 == status) + goto out; + dprintk(3, "cx8801_irq loop %d/%d, status %x\n", + loop, MAX_IRQ_LOOP, status); + handled = 1; + cx_write(MO_PCI_INTSTAT, status); + + if (status & core->pci_irqmask) + cx88_core_irq(core, status); + if (status & PCI_INT_AUDINT) + cx8801_aud_irq(chip); + } + + if (MAX_IRQ_LOOP == loop) { + printk(KERN_ERR + "%s/1: IRQ loop detected, disabling interrupts\n", + core->name); + cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT); + } + + out: + return IRQ_RETVAL(handled); +} + + +static int dsp_buffer_free(snd_cx88_card_t *chip) +{ + BUG_ON(!chip->dma_size); + + dprintk(2,"Freeing buffer\n"); + videobuf_pci_dma_unmap(chip->pci, chip->dma_risc); + videobuf_dma_free(chip->dma_risc); + btcx_riscmem_free(chip->pci,&chip->buf->risc); + kfree(chip->buf); + + chip->dma_risc = NULL; + chip->dma_size = 0; + + return 0; +} + +/**************************************************************************** + ALSA PCM Interface + ****************************************************************************/ + +/* + * Digital hardware definition + */ +#define DEFAULT_FIFO_SIZE 4096 +static struct snd_pcm_hardware snd_cx88_digital_hw = { + .info = SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP_VALID, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .channels_min = 2, + .channels_max = 2, + /* Analog audio output will be full of clicks and pops if there + are not exactly four lines in the SRAM FIFO buffer. */ + .period_bytes_min = DEFAULT_FIFO_SIZE/4, + .period_bytes_max = DEFAULT_FIFO_SIZE/4, + .periods_min = 1, + .periods_max = 1024, + .buffer_bytes_max = (1024*1024), +}; + +/* + * audio pcm capture open callback + */ +static int snd_cx88_pcm_open(struct snd_pcm_substream *substream) +{ + snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + int err; + + err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS); + if (err < 0) + goto _error; + + chip->substream = substream; + + runtime->hw = snd_cx88_digital_hw; + + if (cx88_sram_channels[SRAM_CH25].fifo_size != DEFAULT_FIFO_SIZE) { + unsigned int bpl = cx88_sram_channels[SRAM_CH25].fifo_size / 4; + bpl &= ~7; /* must be multiple of 8 */ + runtime->hw.period_bytes_min = bpl; + runtime->hw.period_bytes_max = bpl; + } + + return 0; +_error: + dprintk(1,"Error opening PCM!\n"); + return err; +} + +/* + * audio close callback + */ +static int snd_cx88_close(struct snd_pcm_substream *substream) +{ + return 0; +} + +/* + * hw_params callback + */ +static int snd_cx88_hw_params(struct snd_pcm_substream * substream, + struct snd_pcm_hw_params * hw_params) +{ + snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); + struct videobuf_dmabuf *dma; + + struct cx88_buffer *buf; + int ret; + + if (substream->runtime->dma_area) { + dsp_buffer_free(chip); + substream->runtime->dma_area = NULL; + } + + chip->period_size = params_period_bytes(hw_params); + chip->num_periods = params_periods(hw_params); + chip->dma_size = chip->period_size * params_periods(hw_params); + + BUG_ON(!chip->dma_size); + BUG_ON(chip->num_periods & (chip->num_periods-1)); + + buf = videobuf_pci_alloc(sizeof(*buf)); + if (NULL == buf) + return -ENOMEM; + + buf->vb.memory = V4L2_MEMORY_MMAP; + buf->vb.field = V4L2_FIELD_NONE; + buf->vb.width = chip->period_size; + buf->bpl = chip->period_size; + buf->vb.height = chip->num_periods; + buf->vb.size = chip->dma_size; + + dma=videobuf_to_dma(&buf->vb); + videobuf_dma_init(dma); + ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE, + (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); + if (ret < 0) + goto error; + + ret = videobuf_pci_dma_map(chip->pci,dma); + if (ret < 0) + goto error; + + ret = cx88_risc_databuffer(chip->pci, &buf->risc, dma->sglist, + buf->vb.width, buf->vb.height, 1); + if (ret < 0) + goto error; + + /* Loop back to start of program */ + buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP|RISC_IRQ1|RISC_CNT_INC); + buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma); + + buf->vb.state = VIDEOBUF_PREPARED; + + chip->buf = buf; + chip->dma_risc = dma; + + substream->runtime->dma_area = chip->dma_risc->vmalloc; + substream->runtime->dma_bytes = chip->dma_size; + substream->runtime->dma_addr = 0; + return 0; + +error: + kfree(buf); + return ret; +} + +/* + * hw free callback + */ +static int snd_cx88_hw_free(struct snd_pcm_substream * substream) +{ + + snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); + + if (substream->runtime->dma_area) { + dsp_buffer_free(chip); + substream->runtime->dma_area = NULL; + } + + return 0; +} + +/* + * prepare callback + */ +static int snd_cx88_prepare(struct snd_pcm_substream *substream) +{ + return 0; +} + +/* + * trigger callback + */ +static int snd_cx88_card_trigger(struct snd_pcm_substream *substream, int cmd) +{ + snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); + int err; + + /* Local interrupts are already disabled by ALSA */ + spin_lock(&chip->reg_lock); + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + err=_cx88_start_audio_dma(chip); + break; + case SNDRV_PCM_TRIGGER_STOP: + err=_cx88_stop_audio_dma(chip); + break; + default: + err=-EINVAL; + break; + } + + spin_unlock(&chip->reg_lock); + + return err; +} + +/* + * pointer callback + */ +static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream) +{ + snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + u16 count; + + count = atomic_read(&chip->count); + +// dprintk(2, "%s - count %d (+%u), period %d, frame %lu\n", __FUNCTION__, +// count, new, count & (runtime->periods-1), +// runtime->period_size * (count & (runtime->periods-1))); + return runtime->period_size * (count & (runtime->periods-1)); +} + +/* + * page callback (needed for mmap) + */ +static struct page *snd_cx88_page(struct snd_pcm_substream *substream, + unsigned long offset) +{ + void *pageptr = substream->runtime->dma_area + offset; + return vmalloc_to_page(pageptr); +} + +/* + * operators + */ +static struct snd_pcm_ops snd_cx88_pcm_ops = { + .open = snd_cx88_pcm_open, + .close = snd_cx88_close, + .ioctl = snd_pcm_lib_ioctl, + .hw_params = snd_cx88_hw_params, + .hw_free = snd_cx88_hw_free, + .prepare = snd_cx88_prepare, + .trigger = snd_cx88_card_trigger, + .pointer = snd_cx88_pointer, + .page = snd_cx88_page, +}; + +/* + * create a PCM device + */ +static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, char *name) +{ + int err; + struct snd_pcm *pcm; + + err = snd_pcm_new(chip->card, name, device, 0, 1, &pcm); + if (err < 0) + return err; + pcm->private_data = chip; + strcpy(pcm->name, name); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cx88_pcm_ops); + + return 0; +} + +/**************************************************************************** + CONTROL INTERFACE + ****************************************************************************/ +static int snd_cx88_volume_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *info) +{ + info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + info->count = 2; + info->value.integer.min = 0; + info->value.integer.max = 0x3f; + + return 0; +} + +static int snd_cx88_volume_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); + struct cx88_core *core=chip->core; + int vol = 0x3f - (cx_read(AUD_VOL_CTL) & 0x3f), + bal = cx_read(AUD_BAL_CTL); + + value->value.integer.value[(bal & 0x40) ? 0 : 1] = vol; + vol -= (bal & 0x3f); + value->value.integer.value[(bal & 0x40) ? 1 : 0] = vol < 0 ? 0 : vol; + + return 0; +} + +/* OK - TODO: test it */ +static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); + struct cx88_core *core=chip->core; + int v, b; + int changed = 0; + u32 old; + + b = value->value.integer.value[1] - value->value.integer.value[0]; + if (b < 0) { + v = 0x3f - value->value.integer.value[0]; + b = (-b) | 0x40; + } else { + v = 0x3f - value->value.integer.value[1]; + } + /* Do we really know this will always be called with IRQs on? */ + spin_lock_irq(&chip->reg_lock); + old = cx_read(AUD_VOL_CTL); + if (v != (old & 0x3f)) { + cx_write(AUD_VOL_CTL, (old & ~0x3f) | v); + changed = 1; + } + if (cx_read(AUD_BAL_CTL) != b) { + cx_write(AUD_BAL_CTL, b); + changed = 1; + } + spin_unlock_irq(&chip->reg_lock); + + return changed; +} + +static const DECLARE_TLV_DB_SCALE(snd_cx88_db_scale, -6300, 100, 0); + +static struct snd_kcontrol_new snd_cx88_volume = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | + SNDRV_CTL_ELEM_ACCESS_TLV_READ, + .name = "Playback Volume", + .info = snd_cx88_volume_info, + .get = snd_cx88_volume_get, + .put = snd_cx88_volume_put, + .tlv.p = snd_cx88_db_scale, +}; + +static int snd_cx88_switch_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); + struct cx88_core *core = chip->core; + u32 bit = kcontrol->private_value; + + value->value.integer.value[0] = !(cx_read(AUD_VOL_CTL) & bit); + return 0; +} + +static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *value) +{ + snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); + struct cx88_core *core = chip->core; + u32 bit = kcontrol->private_value; + int ret = 0; + u32 vol; + + spin_lock_irq(&chip->reg_lock); + vol = cx_read(AUD_VOL_CTL); + if (value->value.integer.value[0] != !(vol & bit)) { + vol ^= bit; + cx_write(AUD_VOL_CTL, vol); + ret = 1; + } + spin_unlock_irq(&chip->reg_lock); + return ret; +} + +static struct snd_kcontrol_new snd_cx88_dac_switch = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Playback Switch", + .info = snd_ctl_boolean_mono_info, + .get = snd_cx88_switch_get, + .put = snd_cx88_switch_put, + .private_value = (1<<8), +}; + +static struct snd_kcontrol_new snd_cx88_source_switch = { + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Capture Switch", + .info = snd_ctl_boolean_mono_info, + .get = snd_cx88_switch_get, + .put = snd_cx88_switch_put, + .private_value = (1<<6), +}; + +/**************************************************************************** + Basic Flow for Sound Devices + ****************************************************************************/ + +/* + * PCI ID Table - 14f1:8801 and 14f1:8811 means function 1: Audio + * Only boards with eeprom and byte 1 at eeprom=1 have it + */ + +static struct pci_device_id cx88_audio_pci_tbl[] __devinitdata = { + {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, + {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, + {0, } +}; +MODULE_DEVICE_TABLE(pci, cx88_audio_pci_tbl); + +/* + * Chip-specific destructor + */ + +static int snd_cx88_free(snd_cx88_card_t *chip) +{ + + if (chip->irq >= 0){ + synchronize_irq(chip->irq); + free_irq(chip->irq, chip); + } + + cx88_core_put(chip->core,chip->pci); + + pci_disable_device(chip->pci); + return 0; +} + +/* + * Component Destructor + */ +static void snd_cx88_dev_free(struct snd_card * card) +{ + snd_cx88_card_t *chip = card->private_data; + + snd_cx88_free(chip); +} + + +/* + * Alsa Constructor - Component probe + */ + +static int devno; +static int __devinit snd_cx88_create(struct snd_card *card, + struct pci_dev *pci, + snd_cx88_card_t **rchip) +{ + snd_cx88_card_t *chip; + struct cx88_core *core; + int err; + unsigned char pci_lat; + + *rchip = NULL; + + err = pci_enable_device(pci); + if (err < 0) + return err; + + pci_set_master(pci); + + chip = (snd_cx88_card_t *) card->private_data; + + core = cx88_core_get(pci); + if (NULL == core) { + err = -EINVAL; + kfree (chip); + return err; + } + + if (!pci_dma_supported(pci,DMA_32BIT_MASK)) { + dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name); + err = -EIO; + cx88_core_put(core,pci); + return err; + } + + + /* pci init */ + chip->card = card; + chip->pci = pci; + chip->irq = -1; + spin_lock_init(&chip->reg_lock); + + chip->core = core; + + /* get irq */ + err = request_irq(chip->pci->irq, cx8801_irq, + IRQF_SHARED | IRQF_DISABLED, chip->core->name, chip); + if (err < 0) { + dprintk(0, "%s: can't get IRQ %d\n", + chip->core->name, chip->pci->irq); + return err; + } + + /* print pci info */ + pci_read_config_byte(pci, PCI_LATENCY_TIMER, &pci_lat); + + dprintk(1,"ALSA %s/%i: found at %s, rev: %d, irq: %d, " + "latency: %d, mmio: 0x%llx\n", core->name, devno, + pci_name(pci), pci->revision, pci->irq, + pci_lat, (unsigned long long)pci_resource_start(pci,0)); + + chip->irq = pci->irq; + synchronize_irq(chip->irq); + + snd_card_set_dev(card, &pci->dev); + + *rchip = chip; + + return 0; +} + +static int __devinit cx88_audio_initdev(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ + struct snd_card *card; + snd_cx88_card_t *chip; + int err; + + if (devno >= SNDRV_CARDS) + return (-ENODEV); + + if (!enable[devno]) { + ++devno; + return (-ENOENT); + } + + card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx88_card_t)); + if (!card) + return (-ENOMEM); + + card->private_free = snd_cx88_dev_free; + + err = snd_cx88_create(card, pci, &chip); + if (err < 0) + return (err); + + err = snd_cx88_pcm(chip, 0, "CX88 Digital"); + if (err < 0) + goto error; + + err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_volume, chip)); + if (err < 0) + goto error; + err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_dac_switch, chip)); + if (err < 0) + goto error; + err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_source_switch, chip)); + if (err < 0) + goto error; + + strcpy (card->driver, "CX88x"); + sprintf(card->shortname, "Conexant CX%x", pci->device); + sprintf(card->longname, "%s at %#llx", + card->shortname,(unsigned long long)pci_resource_start(pci, 0)); + strcpy (card->mixername, "CX88"); + + dprintk (0, "%s/%i: ALSA support for cx2388x boards\n", + card->driver,devno); + + err = snd_card_register(card); + if (err < 0) + goto error; + pci_set_drvdata(pci,card); + + devno++; + return 0; + +error: + snd_card_free(card); + return err; +} +/* + * ALSA destructor + */ +static void __devexit cx88_audio_finidev(struct pci_dev *pci) +{ + struct cx88_audio_dev *card = pci_get_drvdata(pci); + + snd_card_free((void *)card); + + pci_set_drvdata(pci, NULL); + + devno--; +} + +/* + * PCI driver definition + */ + +static struct pci_driver cx88_audio_pci_driver = { + .name = "cx88_audio", + .id_table = cx88_audio_pci_tbl, + .probe = cx88_audio_initdev, + .remove = cx88_audio_finidev, +}; + +/**************************************************************************** + LINUX MODULE INIT + ****************************************************************************/ + +/* + * module init + */ +static int cx88_audio_init(void) +{ + printk(KERN_INFO "cx2388x alsa driver version %d.%d.%d loaded\n", + (CX88_VERSION_CODE >> 16) & 0xff, + (CX88_VERSION_CODE >> 8) & 0xff, + CX88_VERSION_CODE & 0xff); +#ifdef SNAPSHOT + printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", + SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); +#endif + return pci_register_driver(&cx88_audio_pci_driver); +} + +/* + * module remove + */ +static void cx88_audio_fini(void) +{ + + pci_unregister_driver(&cx88_audio_pci_driver); +} + +module_init(cx88_audio_init); +module_exit(cx88_audio_fini); + +/* ----------------------------------------------------------- */ +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ -- GitLab From 7ca30c524e7c6f21d05577f2ffe6fc1e632f372a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 11 Jan 2008 13:19:09 -0300 Subject: [PATCH 059/534] V4L/DVB (12831): tm6000: Convert cx88-alsa into tm6000-alsa - Remove cx88 specific setups; - Add tm6000 specific start/stop commands; - Do CodingStyle cleanups. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-alsa.c | 749 ++++----------------------- 1 file changed, 101 insertions(+), 648 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index 074dcf091454..0538887542f7 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -1,36 +1,20 @@ /* * - * Support for audio capture - * PCI function #1 of the cx2388x. + * Support for audio capture for tm5600/6000 + * (c) 2007-2008 Mauro Carvalho Chehab * - * (c) 2007 Trent Piepho - * (c) 2005,2006 Ricardo Cerqueira - * (c) 2005 Mauro Carvalho Chehab - * Based on a dummy cx88 module by Gerd Knorr - * Based on dummy.c by Jaroslav Kysela + * Based on cx88-alsa.c * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #include #include #include #include -#include #include -#include #include #include @@ -39,49 +23,39 @@ #include #include #include -#include -#include "cx88.h" -#include "cx88-reg.h" -#define dprintk(level,fmt, arg...) if (debug >= level) \ - printk(KERN_INFO "%s/1: " fmt, chip->core->name , ## arg) +#include "tm6000.h" +#include "tm6000-regs.h" + +#undef dprintk -#define dprintk_core(level,fmt, arg...) if (debug >= level) \ - printk(KERN_DEBUG "%s/1: " fmt, chip->core->name , ## arg) +#define dprintk(level, fmt, arg...) do { \ + if (debug >= level) \ + printk(KERN_INFO "%s/1: " fmt, chip->core->name , ## arg); \ + } while (0) /**************************************************************************** Data type declarations - Can be moded to a header file later ****************************************************************************/ -struct cx88_audio_dev { - struct cx88_core *core; - struct cx88_dmaqueue q; - - /* pci i/o */ - struct pci_dev *pci; - - /* audio controls */ - int irq; - +struct snd_tm6000_card { struct snd_card *card; spinlock_t reg_lock; + atomic_t count; - unsigned int dma_size; unsigned int period_size; unsigned int num_periods; - struct videobuf_dmabuf *dma_risc; + struct tm6000_core *core; + struct tm6000_buffer *buf; - struct cx88_buffer *buf; + int bufsize; - struct snd_pcm_substream *substream; + struct snd_pcm_substream *substream; }; -typedef struct cx88_audio_dev snd_cx88_card_t; - - /**************************************************************************** @@ -89,30 +63,27 @@ typedef struct cx88_audio_dev snd_cx88_card_t; ****************************************************************************/ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ -static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1}; module_param_array(enable, bool, NULL, 0444); -MODULE_PARM_DESC(enable, "Enable cx88x soundcard. default enabled."); +MODULE_PARM_DESC(enable, "Enable tm6000x soundcard. default enabled."); module_param_array(index, int, NULL, 0444); -MODULE_PARM_DESC(index, "Index value for cx88x capture interface(s)."); +MODULE_PARM_DESC(index, "Index value for tm6000x capture interface(s)."); /**************************************************************************** Module macros ****************************************************************************/ -MODULE_DESCRIPTION("ALSA driver module for cx2388x based TV cards"); -MODULE_AUTHOR("Ricardo Cerqueira"); +MODULE_DESCRIPTION("ALSA driver module for tm5600/tm6000 based TV cards"); MODULE_AUTHOR("Mauro Carvalho Chehab "); MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("{{Conexant,23881}," - "{{Conexant,23882}," - "{{Conexant,23883}"); +MODULE_SUPPORTED_DEVICE("{{Trident,tm5600}," + "{{Trident,tm6000}"); static unsigned int debug; -module_param(debug,int,0644); -MODULE_PARM_DESC(debug,"enable debug messages"); +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "enable debug messages"); /**************************************************************************** Module specific funtions @@ -122,45 +93,17 @@ MODULE_PARM_DESC(debug,"enable debug messages"); * BOARD Specific: Sets audio DMA */ -static int _cx88_start_audio_dma(snd_cx88_card_t *chip) +static int _tm6000_start_audio_dma(struct snd_tm6000_card *chip) { - struct cx88_buffer *buf = chip->buf; - struct cx88_core *core=chip->core; - struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25]; - - /* Make sure RISC/FIFO are off before changing FIFO/RISC settings */ - cx_clear(MO_AUD_DMACNTRL, 0x11); - - /* setup fifo + format - out channel */ - cx88_sram_channel_setup(chip->core, audio_ch, buf->bpl, buf->risc.dma); - - /* sets bpl size */ - cx_write(MO_AUDD_LNGTH, buf->bpl); + struct tm6000_core *core = chip->core; + int val; - /* reset counter */ - cx_write(MO_AUDD_GPCNTRL, GP_COUNT_CONTROL_RESET); - atomic_set(&chip->count, 0); + /* Enables audio */ + val = tm6000_get_reg(core, REQ_07_SET_GET_AVREG, 0xcc, 0x0); + val |= 0x20; + tm6000_set_reg(core, REQ_07_SET_GET_AVREG, 0xcc, val); - dprintk(1, "Start audio DMA, %d B/line, %d lines/FIFO, %d periods, %d " - "byte buffer\n", buf->bpl, cx_read(audio_ch->cmds_start + 8)>>1, - chip->num_periods, buf->bpl * chip->num_periods); - - /* Enables corresponding bits at AUD_INT_STAT */ - cx_write(MO_AUD_INTMSK, AUD_INT_OPC_ERR | AUD_INT_DN_SYNC | - AUD_INT_DN_RISCI2 | AUD_INT_DN_RISCI1); - - /* Clean any pending interrupt bits already set */ - cx_write(MO_AUD_INTSTAT, ~0); - - /* enable audio irqs */ - cx_set(MO_PCI_INTMSK, chip->core->pci_irqmask | PCI_INT_AUDINT); - - /* start dma */ - cx_set(MO_DEV_CNTRL2, (1<<5)); /* Enables Risc Processor */ - cx_set(MO_AUD_DMACNTRL, 0x11); /* audio downstream FIFO and RISC enable */ - - if (debug) - cx88_sram_channel_dump(chip->core, audio_ch); + tm6000_set_reg(core, REQ_08_SET_GET_AVREG_BIT, 0x01, 0x80); return 0; } @@ -168,131 +111,33 @@ static int _cx88_start_audio_dma(snd_cx88_card_t *chip) /* * BOARD Specific: Resets audio DMA */ -static int _cx88_stop_audio_dma(snd_cx88_card_t *chip) +static int _tm6000_stop_audio_dma(struct snd_tm6000_card *chip) { - struct cx88_core *core=chip->core; + struct tm6000_core *core = chip->core; + int val; dprintk(1, "Stopping audio DMA\n"); - /* stop dma */ - cx_clear(MO_AUD_DMACNTRL, 0x11); - - /* disable irqs */ - cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT); - cx_clear(MO_AUD_INTMSK, AUD_INT_OPC_ERR | AUD_INT_DN_SYNC | - AUD_INT_DN_RISCI2 | AUD_INT_DN_RISCI1); + /* Enables audio */ + val = tm6000_get_reg(core, REQ_07_SET_GET_AVREG, 0xcc, 0x0); + val &= ~0x20; + tm6000_set_reg(core, REQ_07_SET_GET_AVREG, 0xcc, val); - if (debug) - cx88_sram_channel_dump(chip->core, &cx88_sram_channels[SRAM_CH25]); + tm6000_set_reg(core, REQ_08_SET_GET_AVREG_BIT, 0x01, 0); return 0; } -#define MAX_IRQ_LOOP 50 - -/* - * BOARD Specific: IRQ dma bits - */ -static char *cx88_aud_irqs[32] = { - "dn_risci1", "up_risci1", "rds_dn_risc1", /* 0-2 */ - NULL, /* reserved */ - "dn_risci2", "up_risci2", "rds_dn_risc2", /* 4-6 */ - NULL, /* reserved */ - "dnf_of", "upf_uf", "rds_dnf_uf", /* 8-10 */ - NULL, /* reserved */ - "dn_sync", "up_sync", "rds_dn_sync", /* 12-14 */ - NULL, /* reserved */ - "opc_err", "par_err", "rip_err", /* 16-18 */ - "pci_abort", "ber_irq", "mchg_irq" /* 19-21 */ -}; - -/* - * BOARD Specific: Threats IRQ audio specific calls - */ -static void cx8801_aud_irq(snd_cx88_card_t *chip) +static int dsp_buffer_free(struct snd_tm6000_card *chip) { - struct cx88_core *core = chip->core; - u32 status, mask; - - status = cx_read(MO_AUD_INTSTAT); - mask = cx_read(MO_AUD_INTMSK); - if (0 == (status & mask)) - return; - cx_write(MO_AUD_INTSTAT, status); - if (debug > 1 || (status & mask & ~0xff)) - cx88_print_irqbits(core->name, "irq aud", - cx88_aud_irqs, ARRAY_SIZE(cx88_aud_irqs), - status, mask); - /* risc op code error */ - if (status & AUD_INT_OPC_ERR) { - printk(KERN_WARNING "%s/1: Audio risc op code error\n",core->name); - cx_clear(MO_AUD_DMACNTRL, 0x11); - cx88_sram_channel_dump(core, &cx88_sram_channels[SRAM_CH25]); - } - if (status & AUD_INT_DN_SYNC) { - dprintk(1, "Downstream sync error\n"); - cx_write(MO_AUDD_GPCNTRL, GP_COUNT_CONTROL_RESET); - return; - } - /* risc1 downstream */ - if (status & AUD_INT_DN_RISCI1) { - atomic_set(&chip->count, cx_read(MO_AUDD_GPCNT)); - snd_pcm_period_elapsed(chip->substream); - } - /* FIXME: Any other status should deserve a special handling? */ -} - -/* - * BOARD Specific: Handles IRQ calls - */ -static irqreturn_t cx8801_irq(int irq, void *dev_id) -{ - snd_cx88_card_t *chip = dev_id; - struct cx88_core *core = chip->core; - u32 status; - int loop, handled = 0; - - for (loop = 0; loop < MAX_IRQ_LOOP; loop++) { - status = cx_read(MO_PCI_INTSTAT) & - (core->pci_irqmask | PCI_INT_AUDINT); - if (0 == status) - goto out; - dprintk(3, "cx8801_irq loop %d/%d, status %x\n", - loop, MAX_IRQ_LOOP, status); - handled = 1; - cx_write(MO_PCI_INTSTAT, status); - - if (status & core->pci_irqmask) - cx88_core_irq(core, status); - if (status & PCI_INT_AUDINT) - cx8801_aud_irq(chip); - } + BUG_ON(!chip->bufsize); - if (MAX_IRQ_LOOP == loop) { - printk(KERN_ERR - "%s/1: IRQ loop detected, disabling interrupts\n", - core->name); - cx_clear(MO_PCI_INTMSK, PCI_INT_AUDINT); - } - - out: - return IRQ_RETVAL(handled); -} - - -static int dsp_buffer_free(snd_cx88_card_t *chip) -{ - BUG_ON(!chip->dma_size); + dprintk(2, "Freeing buffer\n"); - dprintk(2,"Freeing buffer\n"); - videobuf_pci_dma_unmap(chip->pci, chip->dma_risc); - videobuf_dma_free(chip->dma_risc); - btcx_riscmem_free(chip->pci,&chip->buf->risc); - kfree(chip->buf); + /* FIXME: Frees buffer */ - chip->dma_risc = NULL; - chip->dma_size = 0; + chip->bufsize = 0; - return 0; + return 0; } /**************************************************************************** @@ -303,20 +148,19 @@ static int dsp_buffer_free(snd_cx88_card_t *chip) * Digital hardware definition */ #define DEFAULT_FIFO_SIZE 4096 -static struct snd_pcm_hardware snd_cx88_digital_hw = { + +static struct snd_pcm_hardware snd_tm6000_digital_hw = { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID, .formats = SNDRV_PCM_FMTBIT_S16_LE, - .rates = SNDRV_PCM_RATE_48000, - .rate_min = 48000, + .rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000, + .rate_min = 44100, .rate_max = 48000, .channels_min = 2, .channels_max = 2, - /* Analog audio output will be full of clicks and pops if there - are not exactly four lines in the SRAM FIFO buffer. */ .period_bytes_min = DEFAULT_FIFO_SIZE/4, .period_bytes_max = DEFAULT_FIFO_SIZE/4, .periods_min = 1, @@ -327,37 +171,31 @@ static struct snd_pcm_hardware snd_cx88_digital_hw = { /* * audio pcm capture open callback */ -static int snd_cx88_pcm_open(struct snd_pcm_substream *substream) +static int snd_tm6000_pcm_open(struct snd_pcm_substream *substream) { - snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); + struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; int err; - err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS); + err = snd_pcm_hw_constraint_pow2(runtime, 0, + SNDRV_PCM_HW_PARAM_PERIODS); if (err < 0) goto _error; chip->substream = substream; - runtime->hw = snd_cx88_digital_hw; - - if (cx88_sram_channels[SRAM_CH25].fifo_size != DEFAULT_FIFO_SIZE) { - unsigned int bpl = cx88_sram_channels[SRAM_CH25].fifo_size / 4; - bpl &= ~7; /* must be multiple of 8 */ - runtime->hw.period_bytes_min = bpl; - runtime->hw.period_bytes_max = bpl; - } + runtime->hw = snd_tm6000_digital_hw; return 0; _error: - dprintk(1,"Error opening PCM!\n"); + dprintk(1, "Error opening PCM!\n"); return err; } /* * audio close callback */ -static int snd_cx88_close(struct snd_pcm_substream *substream) +static int snd_tm6000_close(struct snd_pcm_substream *substream) { return 0; } @@ -365,14 +203,10 @@ static int snd_cx88_close(struct snd_pcm_substream *substream) /* * hw_params callback */ -static int snd_cx88_hw_params(struct snd_pcm_substream * substream, - struct snd_pcm_hw_params * hw_params) +static int snd_tm6000_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); - struct videobuf_dmabuf *dma; - - struct cx88_buffer *buf; - int ret; + struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream); if (substream->runtime->dma_area) { dsp_buffer_free(chip); @@ -381,64 +215,25 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, chip->period_size = params_period_bytes(hw_params); chip->num_periods = params_periods(hw_params); - chip->dma_size = chip->period_size * params_periods(hw_params); - - BUG_ON(!chip->dma_size); - BUG_ON(chip->num_periods & (chip->num_periods-1)); - - buf = videobuf_pci_alloc(sizeof(*buf)); - if (NULL == buf) - return -ENOMEM; - - buf->vb.memory = V4L2_MEMORY_MMAP; - buf->vb.field = V4L2_FIELD_NONE; - buf->vb.width = chip->period_size; - buf->bpl = chip->period_size; - buf->vb.height = chip->num_periods; - buf->vb.size = chip->dma_size; - - dma=videobuf_to_dma(&buf->vb); - videobuf_dma_init(dma); - ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE, - (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); - if (ret < 0) - goto error; - - ret = videobuf_pci_dma_map(chip->pci,dma); - if (ret < 0) - goto error; - - ret = cx88_risc_databuffer(chip->pci, &buf->risc, dma->sglist, - buf->vb.width, buf->vb.height, 1); - if (ret < 0) - goto error; - - /* Loop back to start of program */ - buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP|RISC_IRQ1|RISC_CNT_INC); - buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma); - - buf->vb.state = VIDEOBUF_PREPARED; - - chip->buf = buf; - chip->dma_risc = dma; - - substream->runtime->dma_area = chip->dma_risc->vmalloc; - substream->runtime->dma_bytes = chip->dma_size; - substream->runtime->dma_addr = 0; - return 0; + chip->bufsize = chip->period_size * params_periods(hw_params); + + BUG_ON(!chip->bufsize); + + dprintk(1, "Setting buffer\n"); -error: - kfree(buf); - return ret; + /* FIXME: Allocate buffer for audio */ + + + return 0; } /* * hw free callback */ -static int snd_cx88_hw_free(struct snd_pcm_substream * substream) +static int snd_tm6000_hw_free(struct snd_pcm_substream *substream) { - snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); + struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream); if (substream->runtime->dma_area) { dsp_buffer_free(chip); @@ -451,31 +246,31 @@ static int snd_cx88_hw_free(struct snd_pcm_substream * substream) /* * prepare callback */ -static int snd_cx88_prepare(struct snd_pcm_substream *substream) +static int snd_tm6000_prepare(struct snd_pcm_substream *substream) { return 0; } + /* * trigger callback */ -static int snd_cx88_card_trigger(struct snd_pcm_substream *substream, int cmd) +static int snd_tm6000_card_trigger(struct snd_pcm_substream *substream, int cmd) { - snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); + struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream); int err; - /* Local interrupts are already disabled by ALSA */ spin_lock(&chip->reg_lock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: - err=_cx88_start_audio_dma(chip); + err = _tm6000_start_audio_dma(chip); break; case SNDRV_PCM_TRIGGER_STOP: - err=_cx88_stop_audio_dma(chip); + err = _tm6000_stop_audio_dma(chip); break; default: - err=-EINVAL; + err = -EINVAL; break; } @@ -487,49 +282,36 @@ static int snd_cx88_card_trigger(struct snd_pcm_substream *substream, int cmd) /* * pointer callback */ -static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream) +static snd_pcm_uframes_t snd_tm6000_pointer(struct snd_pcm_substream *substream) { - snd_cx88_card_t *chip = snd_pcm_substream_chip(substream); + struct snd_tm6000_card *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; u16 count; count = atomic_read(&chip->count); -// dprintk(2, "%s - count %d (+%u), period %d, frame %lu\n", __FUNCTION__, -// count, new, count & (runtime->periods-1), -// runtime->period_size * (count & (runtime->periods-1))); return runtime->period_size * (count & (runtime->periods-1)); } -/* - * page callback (needed for mmap) - */ -static struct page *snd_cx88_page(struct snd_pcm_substream *substream, - unsigned long offset) -{ - void *pageptr = substream->runtime->dma_area + offset; - return vmalloc_to_page(pageptr); -} - /* * operators */ -static struct snd_pcm_ops snd_cx88_pcm_ops = { - .open = snd_cx88_pcm_open, - .close = snd_cx88_close, +static struct snd_pcm_ops snd_tm6000_pcm_ops = { + .open = snd_tm6000_pcm_open, + .close = snd_tm6000_close, .ioctl = snd_pcm_lib_ioctl, - .hw_params = snd_cx88_hw_params, - .hw_free = snd_cx88_hw_free, - .prepare = snd_cx88_prepare, - .trigger = snd_cx88_card_trigger, - .pointer = snd_cx88_pointer, - .page = snd_cx88_page, + .hw_params = snd_tm6000_hw_params, + .hw_free = snd_tm6000_hw_free, + .prepare = snd_tm6000_prepare, + .trigger = snd_tm6000_card_trigger, + .pointer = snd_tm6000_pointer, }; /* * create a PCM device */ -static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, char *name) +static int __devinit snd_tm6000_pcm(struct snd_tm6000_card *chip, + int device, char *name) { int err; struct snd_pcm *pcm; @@ -539,177 +321,23 @@ static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, char *name) return err; pcm->private_data = chip; strcpy(pcm->name, name); - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cx88_pcm_ops); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_tm6000_pcm_ops); return 0; } -/**************************************************************************** - CONTROL INTERFACE - ****************************************************************************/ -static int snd_cx88_volume_info(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_info *info) -{ - info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - info->count = 2; - info->value.integer.min = 0; - info->value.integer.max = 0x3f; - - return 0; -} - -static int snd_cx88_volume_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *value) -{ - snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); - struct cx88_core *core=chip->core; - int vol = 0x3f - (cx_read(AUD_VOL_CTL) & 0x3f), - bal = cx_read(AUD_BAL_CTL); - - value->value.integer.value[(bal & 0x40) ? 0 : 1] = vol; - vol -= (bal & 0x3f); - value->value.integer.value[(bal & 0x40) ? 1 : 0] = vol < 0 ? 0 : vol; - - return 0; -} - -/* OK - TODO: test it */ -static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *value) -{ - snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); - struct cx88_core *core=chip->core; - int v, b; - int changed = 0; - u32 old; - - b = value->value.integer.value[1] - value->value.integer.value[0]; - if (b < 0) { - v = 0x3f - value->value.integer.value[0]; - b = (-b) | 0x40; - } else { - v = 0x3f - value->value.integer.value[1]; - } - /* Do we really know this will always be called with IRQs on? */ - spin_lock_irq(&chip->reg_lock); - old = cx_read(AUD_VOL_CTL); - if (v != (old & 0x3f)) { - cx_write(AUD_VOL_CTL, (old & ~0x3f) | v); - changed = 1; - } - if (cx_read(AUD_BAL_CTL) != b) { - cx_write(AUD_BAL_CTL, b); - changed = 1; - } - spin_unlock_irq(&chip->reg_lock); - - return changed; -} - -static const DECLARE_TLV_DB_SCALE(snd_cx88_db_scale, -6300, 100, 0); - -static struct snd_kcontrol_new snd_cx88_volume = { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | - SNDRV_CTL_ELEM_ACCESS_TLV_READ, - .name = "Playback Volume", - .info = snd_cx88_volume_info, - .get = snd_cx88_volume_get, - .put = snd_cx88_volume_put, - .tlv.p = snd_cx88_db_scale, -}; - -static int snd_cx88_switch_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *value) -{ - snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); - struct cx88_core *core = chip->core; - u32 bit = kcontrol->private_value; - - value->value.integer.value[0] = !(cx_read(AUD_VOL_CTL) & bit); - return 0; -} - -static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *value) -{ - snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); - struct cx88_core *core = chip->core; - u32 bit = kcontrol->private_value; - int ret = 0; - u32 vol; - - spin_lock_irq(&chip->reg_lock); - vol = cx_read(AUD_VOL_CTL); - if (value->value.integer.value[0] != !(vol & bit)) { - vol ^= bit; - cx_write(AUD_VOL_CTL, vol); - ret = 1; - } - spin_unlock_irq(&chip->reg_lock); - return ret; -} - -static struct snd_kcontrol_new snd_cx88_dac_switch = { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Playback Switch", - .info = snd_ctl_boolean_mono_info, - .get = snd_cx88_switch_get, - .put = snd_cx88_switch_put, - .private_value = (1<<8), -}; - -static struct snd_kcontrol_new snd_cx88_source_switch = { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Switch", - .info = snd_ctl_boolean_mono_info, - .get = snd_cx88_switch_get, - .put = snd_cx88_switch_put, - .private_value = (1<<6), -}; +/* FIXME: Control interface - How to control volume/mute? */ /**************************************************************************** Basic Flow for Sound Devices ****************************************************************************/ -/* - * PCI ID Table - 14f1:8801 and 14f1:8811 means function 1: Audio - * Only boards with eeprom and byte 1 at eeprom=1 have it - */ - -static struct pci_device_id cx88_audio_pci_tbl[] __devinitdata = { - {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, - {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, - {0, } -}; -MODULE_DEVICE_TABLE(pci, cx88_audio_pci_tbl); - -/* - * Chip-specific destructor - */ - -static int snd_cx88_free(snd_cx88_card_t *chip) -{ - - if (chip->irq >= 0){ - synchronize_irq(chip->irq); - free_irq(chip->irq, chip); - } - - cx88_core_put(chip->core,chip->pci); - - pci_disable_device(chip->pci); - return 0; -} /* * Component Destructor */ -static void snd_cx88_dev_free(struct snd_card * card) +static void snd_tm6000_dev_free(struct snd_card *card) { - snd_cx88_card_t *chip = card->private_data; - - snd_cx88_free(chip); } @@ -717,196 +345,21 @@ static void snd_cx88_dev_free(struct snd_card * card) * Alsa Constructor - Component probe */ -static int devno; -static int __devinit snd_cx88_create(struct snd_card *card, - struct pci_dev *pci, - snd_cx88_card_t **rchip) -{ - snd_cx88_card_t *chip; - struct cx88_core *core; - int err; - unsigned char pci_lat; - - *rchip = NULL; - - err = pci_enable_device(pci); - if (err < 0) - return err; - pci_set_master(pci); - - chip = (snd_cx88_card_t *) card->private_data; - - core = cx88_core_get(pci); - if (NULL == core) { - err = -EINVAL; - kfree (chip); - return err; - } - - if (!pci_dma_supported(pci,DMA_32BIT_MASK)) { - dprintk(0, "%s/1: Oops: no 32bit PCI DMA ???\n",core->name); - err = -EIO; - cx88_core_put(core,pci); - return err; - } - - - /* pci init */ - chip->card = card; - chip->pci = pci; - chip->irq = -1; - spin_lock_init(&chip->reg_lock); - - chip->core = core; - - /* get irq */ - err = request_irq(chip->pci->irq, cx8801_irq, - IRQF_SHARED | IRQF_DISABLED, chip->core->name, chip); - if (err < 0) { - dprintk(0, "%s: can't get IRQ %d\n", - chip->core->name, chip->pci->irq); - return err; - } - - /* print pci info */ - pci_read_config_byte(pci, PCI_LATENCY_TIMER, &pci_lat); - - dprintk(1,"ALSA %s/%i: found at %s, rev: %d, irq: %d, " - "latency: %d, mmio: 0x%llx\n", core->name, devno, - pci_name(pci), pci->revision, pci->irq, - pci_lat, (unsigned long long)pci_resource_start(pci,0)); - - chip->irq = pci->irq; - synchronize_irq(chip->irq); - - snd_card_set_dev(card, &pci->dev); - - *rchip = chip; - - return 0; -} - -static int __devinit cx88_audio_initdev(struct pci_dev *pci, - const struct pci_device_id *pci_id) +/* FIXME: initialize -alsa driver */ +static int tm6000_audio_init(void) { - struct snd_card *card; - snd_cx88_card_t *chip; - int err; - - if (devno >= SNDRV_CARDS) - return (-ENODEV); - - if (!enable[devno]) { - ++devno; - return (-ENOENT); - } - - card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx88_card_t)); - if (!card) - return (-ENOMEM); - - card->private_free = snd_cx88_dev_free; - - err = snd_cx88_create(card, pci, &chip); - if (err < 0) - return (err); - - err = snd_cx88_pcm(chip, 0, "CX88 Digital"); - if (err < 0) - goto error; - - err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_volume, chip)); - if (err < 0) - goto error; - err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_dac_switch, chip)); - if (err < 0) - goto error; - err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_source_switch, chip)); - if (err < 0) - goto error; + printk("tm6000-alsa not ready yet\n"); - strcpy (card->driver, "CX88x"); - sprintf(card->shortname, "Conexant CX%x", pci->device); - sprintf(card->longname, "%s at %#llx", - card->shortname,(unsigned long long)pci_resource_start(pci, 0)); - strcpy (card->mixername, "CX88"); - - dprintk (0, "%s/%i: ALSA support for cx2388x boards\n", - card->driver,devno); - - err = snd_card_register(card); - if (err < 0) - goto error; - pci_set_drvdata(pci,card); - - devno++; return 0; - -error: - snd_card_free(card); - return err; -} -/* - * ALSA destructor - */ -static void __devexit cx88_audio_finidev(struct pci_dev *pci) -{ - struct cx88_audio_dev *card = pci_get_drvdata(pci); - - snd_card_free((void *)card); - - pci_set_drvdata(pci, NULL); - - devno--; -} - -/* - * PCI driver definition - */ - -static struct pci_driver cx88_audio_pci_driver = { - .name = "cx88_audio", - .id_table = cx88_audio_pci_tbl, - .probe = cx88_audio_initdev, - .remove = cx88_audio_finidev, -}; - -/**************************************************************************** - LINUX MODULE INIT - ****************************************************************************/ - -/* - * module init - */ -static int cx88_audio_init(void) -{ - printk(KERN_INFO "cx2388x alsa driver version %d.%d.%d loaded\n", - (CX88_VERSION_CODE >> 16) & 0xff, - (CX88_VERSION_CODE >> 8) & 0xff, - CX88_VERSION_CODE & 0xff); -#ifdef SNAPSHOT - printk(KERN_INFO "cx2388x: snapshot date %04d-%02d-%02d\n", - SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); -#endif - return pci_register_driver(&cx88_audio_pci_driver); } /* * module remove */ -static void cx88_audio_fini(void) +static void tm6000_audio_fini(void) { - - pci_unregister_driver(&cx88_audio_pci_driver); } -module_init(cx88_audio_init); -module_exit(cx88_audio_fini); - -/* ----------------------------------------------------------- */ -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ +module_init(tm6000_audio_init); +module_exit(tm6000_audio_fini); -- GitLab From 44351aa0ee98b745986c94e139e0b1fdbd270015 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 11 Jan 2008 13:19:45 -0300 Subject: [PATCH 060/534] V4L/DVB (12832): tm6000: allow compilation of tm6000-alsa module Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Kconfig | 18 +++++++++++++++--- drivers/staging/tm6000/Makefile | 1 + drivers/staging/tm6000/tm6000-core.c | 3 ++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig index 5e0c98189cc7..5d36df472edb 100644 --- a/drivers/staging/tm6000/Kconfig +++ b/drivers/staging/tm6000/Kconfig @@ -1,11 +1,12 @@ config VIDEO_TM6000 - tristate "TV Master TM5600/6000 driver" + tristate "TV Master TM5600/6000/6010 driver" + depends on EXPERIMENTAL select VIDEO_V4L2 select VIDEO_TUNER select TUNER_XC2028 select VIDEOBUF_VMALLOC help - Support for TM5600/TM6000 USB Device + Support for TM5600/TM6000/TM6010 USB Device Since these cards have no MPEG decoder onboard, they transmit only compressed MPEG data over the usb bus, so you need @@ -13,9 +14,20 @@ config VIDEO_TM6000 Say Y if you own such a device and want to use it. +config VIDEO_TM6000_ALSA + tristate "TV Master TM5600/6000/6010 audio support" + depends on VIDEO_TM6000 && SND && EXPERIMENTAL + select SND_PCM + ---help--- + This is a video4linux driver for direct (DMA) audio for + TM5600/TM6000/TM6010 USB Devices. + + To compile this driver as a module, choose M here: the + module will be called tm6000-alsa. + config VIDEO_TM6000_DVB bool "DVB Support for tm6000 based TV cards" - depends on VIDEO_TM6000 && DVB_CORE + depends on VIDEO_TM6000 && DVB_CORE && EXPERIMENTAL select DVB_ZL10353 ---help--- This adds support for DVB cards based on the tm5600/tm6000 chip. diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile index e4297cae93e2..25aefe74dddc 100644 --- a/drivers/staging/tm6000/Makefile +++ b/drivers/staging/tm6000/Makefile @@ -10,5 +10,6 @@ tm6000-objs += tm6000-dvb.o \ endif obj-$(CONFIG_VIDEO_TM6000) += tm6000.o +obj-$(CONFIG_VIDEO_TM6000_ALSA) += tm6000-alsa.o EXTRA_CFLAGS = -Idrivers/media/video diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 35e7d63f00fb..179885a193e6 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -480,7 +480,7 @@ int tm6000_init (struct tm6000_core *dev) return 0; } -int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate) +int tm6000_set_audio_bitrate(struct tm6000_core *dev, int bitrate) { int val; @@ -504,3 +504,4 @@ printk("Original value=%d\n",val); return val; } +EXPORT_SYMBOL_GPL(tm6000_set_audio_bitrate); -- GitLab From 6ad6e88a156e131597c8636456d4d84f7987808a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 11 Jan 2008 13:51:45 -0300 Subject: [PATCH 061/534] V4L/DVB (12833): tm6000: add a proper init code for -alsa Uses about the same initialization code as defined on usbaudio.c. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-alsa.c | 83 +++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 13 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index 0538887542f7..2e48bb27a554 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include @@ -63,6 +63,7 @@ struct snd_tm6000_card { ****************************************************************************/ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ +static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1}; module_param_array(enable, bool, NULL, 0444); @@ -345,21 +346,77 @@ static void snd_tm6000_dev_free(struct snd_card *card) * Alsa Constructor - Component probe */ - -/* FIXME: initialize -alsa driver */ -static int tm6000_audio_init(void) +static int tm6000_audio_init(struct tm6000_core *dev, int idx) { - printk("tm6000-alsa not ready yet\n"); + struct snd_card *card; + struct snd_tm6000_card *chip; + int rc, len; + char component[14]; + + if (idx >= SNDRV_CARDS) + return -ENODEV; + + if (!enable[idx]) + return -ENOENT; + + card = snd_card_new(index[idx], id[idx], THIS_MODULE, 0); + if (card == NULL) { + snd_printk(KERN_ERR "cannot create card instance %d\n", idx); + return -ENOMEM; + } + + chip = kzalloc(sizeof(*chip), GFP_KERNEL); + if (!chip) { + rc = -ENOMEM; + goto error; + } + + chip->core = dev; + chip->card = card; + + strcpy(card->driver, "tm6000-alsa"); + sprintf(component, "USB%04x:%04x", + le16_to_cpu(dev->udev->descriptor.idVendor), + le16_to_cpu(dev->udev->descriptor.idProduct)); + snd_component_add(card, component); + + if (dev->udev->descriptor.iManufacturer) + len = usb_string(dev->udev, + dev->udev->descriptor.iManufacturer, + card->longname, sizeof(card->longname)); + else + len = 0; + + if (len > 0) + strlcat(card->longname, " ", sizeof(card->longname)); + + strlcat(card->longname, card->shortname, sizeof(card->longname)); + + len = strlcat(card->longname, " at ", sizeof(card->longname)); + + if (len < sizeof(card->longname)) + usb_make_path(dev->udev, card->longname + len, + sizeof(card->longname) - len); + + strlcat(card->longname, + dev->udev->speed == USB_SPEED_LOW ? ", low speed" : + dev->udev->speed == USB_SPEED_FULL ? ", full speed" : + ", high speed", + sizeof(card->longname)); + + rc = snd_tm6000_pcm(chip, 0, "tm6000 Digital"); + if (rc < 0) + goto error; + + rc = snd_card_register(card); + if (rc < 0) + goto error; + return 0; -} -/* - * module remove - */ -static void tm6000_audio_fini(void) -{ +error: + snd_card_free(card); + return rc; } -module_init(tm6000_audio_init); -module_exit(tm6000_audio_fini); -- GitLab From 576d5739a44af5fcbacfe504a8d989a5c7ea8fc7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 11 Jan 2008 13:55:45 -0300 Subject: [PATCH 062/534] V4L/DVB (12834): tm6000: Fix two warnings Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-alsa.c | 12 ++---------- drivers/staging/tm6000/tm6000.h | 4 ++++ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index 2e48bb27a554..052e2cc255f5 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -333,20 +333,11 @@ static int __devinit snd_tm6000_pcm(struct snd_tm6000_card *chip, Basic Flow for Sound Devices ****************************************************************************/ - -/* - * Component Destructor - */ -static void snd_tm6000_dev_free(struct snd_card *card) -{ -} - - /* * Alsa Constructor - Component probe */ -static int tm6000_audio_init(struct tm6000_core *dev, int idx) +int tm6000_audio_init(struct tm6000_core *dev, int idx) { struct snd_card *card; struct snd_tm6000_card *chip; @@ -419,4 +410,5 @@ static int tm6000_audio_init(struct tm6000_core *dev, int idx) snd_card_free(card); return rc; } +EXPORT_SYMBOL_GPL(tm6000_audio_init); diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 0032a418b28e..3bf4e018ded5 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -252,6 +252,10 @@ unsigned int tm6000_v4l2_poll(struct file *file, struct poll_table_struct *wait); int tm6000_queue_init(struct tm6000_core *dev); +/* In tm6000-alsa.c */ +int tm6000_audio_init(struct tm6000_core *dev, int idx); + + /* Debug stuff */ extern int tm6000_debug; -- GitLab From c144c037153765f572ab4ffea277467370dd97dd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 9 Apr 2008 01:49:19 -0300 Subject: [PATCH 063/534] V4L/DVB (12835): tm6000: Cleanups to work like em28xx-video Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Kconfig | 3 +- drivers/staging/tm6000/tm6000-i2c.c | 10 -- drivers/staging/tm6000/tm6000-video.c | 181 +++----------------------- drivers/staging/tm6000/tm6000.h | 1 - 4 files changed, 17 insertions(+), 178 deletions(-) diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig index 5d36df472edb..cb2011536363 100644 --- a/drivers/staging/tm6000/Kconfig +++ b/drivers/staging/tm6000/Kconfig @@ -1,7 +1,6 @@ config VIDEO_TM6000 tristate "TV Master TM5600/6000/6010 driver" - depends on EXPERIMENTAL - select VIDEO_V4L2 + depends on VIDEO_DEV && I2C && INPUT && EXPERIMENTAL select VIDEO_TUNER select TUNER_XC2028 select VIDEOBUF_VMALLOC diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 12e2c98e5433..0df4820481c3 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -219,15 +219,6 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev, /* ----------------------------------------------------------- */ -/* - * algo_control() - */ -static int algo_control(struct i2c_adapter *adapter, - unsigned int cmd, unsigned long arg) -{ - return 0; -} - /* * functionality() */ @@ -348,7 +339,6 @@ static int attach_inform(struct i2c_client *client) static struct i2c_algorithm tm6000_algo = { .master_xfer = tm6000_i2c_xfer, - .algo_control = algo_control, .functionality = functionality, }; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 13be5a0df8d6..5f2865e14e6e 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -153,16 +153,6 @@ static inline void buffer_filled(struct tm6000_core *dev, struct tm6000_dmaqueue *dma_q, struct tm6000_buffer *buf) { - /* Nobody is waiting something to be done, just return */ - if (!waitqueue_active(&buf->vb.done)) { - mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); - - printk(KERN_ERR "tm6000: buffer underrun at %ld\n", - jiffies); - - return; - } - /* Advice that buffer was filled */ dprintk(dev, V4L2_DEBUG_ISOC, "[%p/%d] wakeup\n", buf, buf->vb.i); buf->vb.state = VIDEOBUF_DONE; @@ -558,10 +548,6 @@ static void tm6000_irq_callback(struct urb *urb) tm6000_err("urb resubmit failed (error=%i)\n", urb->status); - /* Data filled, reset watchdog */ - if (rc >= 0) - mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); - spin_unlock_irqrestore(&dev->slock, flags); } @@ -594,22 +580,14 @@ static void tm6000_uninit_isoc(struct tm6000_core *dev) kfree (dev->isoc_ctl.urb); kfree (dev->isoc_ctl.transfer_buffer); + dev->isoc_ctl.urb=NULL; dev->isoc_ctl.transfer_buffer=NULL; + dev->isoc_ctl.num_bufs = 0; dev->isoc_ctl.num_bufs=0; } -/* - * Stop video thread - FIXME: Can be easily removed - */ -static void tm6000_stop_thread(struct tm6000_dmaqueue *dma_q) -{ - struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - - tm6000_uninit_isoc(dev); -} - /* * Allocate URBs and start IRQ */ @@ -622,7 +600,6 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) /* De-allocates all pending stuff */ tm6000_uninit_isoc(dev); - pipe = usb_rcvisocpipe(dev->udev, dev->isoc_in->desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); @@ -643,8 +620,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) dev->isoc_ctl.num_bufs = num_bufs; - dev->isoc_ctl.urb = kmalloc(sizeof(void *)*num_bufs, - GFP_KERNEL); + dev->isoc_ctl.urb = kmalloc(sizeof(void *)*num_bufs, GFP_KERNEL); if (!dev->isoc_ctl.urb) { tm6000_err("cannot alloc memory for usb buffers\n"); return -ENOMEM; @@ -690,8 +666,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) usb_fill_bulk_urb(urb, dev->udev, pipe, dev->isoc_ctl.transfer_buffer[i], sb_size, tm6000_irq_callback, dma_q); -// urb->interval = dev->isoc_in->desc.bInterval; - urb->interval = 2; + urb->interval = dev->isoc_in->desc.bInterval; urb->number_of_packets = max_packets; urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; @@ -704,11 +679,10 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) return 0; } -static int tm6000_start_thread( struct tm6000_dmaqueue *dma_q, - struct tm6000_buffer *buf) +static int tm6000_start_thread( struct tm6000_core *dev) { - struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - int i,rc; + struct tm6000_dmaqueue *dma_q = &dev->vidq; + int i; dma_q->frame=0; dma_q->ini_jiffies=jiffies; @@ -717,7 +691,7 @@ static int tm6000_start_thread( struct tm6000_dmaqueue *dma_q, /* submit urbs and enables IRQ */ for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { - rc = usb_submit_urb(dev->isoc_ctl.urb[i], GFP_ATOMIC); + int rc = usb_submit_urb(dev->isoc_ctl.urb[i], GFP_ATOMIC); if (rc) { tm6000_err("submit of urb %i failed (error=%i)\n", i, rc); @@ -726,99 +700,9 @@ static int tm6000_start_thread( struct tm6000_dmaqueue *dma_q, } } - if (rc<0) - return rc; - return 0; } -static int restart_video_queue(struct tm6000_dmaqueue *dma_q) -{ - struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - - struct tm6000_buffer *buf, *prev; - struct list_head *item; - - dprintk(dev, V4L2_DEBUG_QUEUE, "%s dma_q=0x%08lx\n", - __FUNCTION__,(unsigned long)dma_q); - - if (!list_empty(&dma_q->active)) { - buf = list_entry(dma_q->active.next, struct tm6000_buffer, vb.queue); - dprintk(dev, V4L2_DEBUG_QUEUE, - "restart_queue [%p/%d]: restart dma\n", buf, buf->vb.i); - - dprintk(dev, V4L2_DEBUG_QUEUE, "Restarting video dma\n"); - tm6000_stop_thread(dma_q); - tm6000_start_thread(dma_q, buf); - - /* cancel all outstanding capture / vbi requests */ - list_for_each(item,&dma_q->active) { - buf = list_entry(item, struct tm6000_buffer, vb.queue); - - list_del(&buf->vb.queue); - buf->vb.state = VIDEOBUF_ERROR; - wake_up(&buf->vb.done); - } - mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); - - return 0; - } - - prev = NULL; - for (;;) { - if (list_empty(&dma_q->queued)) - return 0; - buf = list_entry(dma_q->queued.next, struct tm6000_buffer, vb.queue); - if (NULL == prev) { - list_del(&buf->vb.queue); - list_add_tail(&buf->vb.queue,&dma_q->active); - - dprintk(dev, V4L2_DEBUG_QUEUE, "Restarting video dma\n"); - tm6000_stop_thread(dma_q); - tm6000_start_thread(dma_q, buf); - - buf->vb.state = VIDEOBUF_ACTIVE; - mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); - dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] restart_queue -" - " first active\n", buf, buf->vb.i); - - } else if (prev->vb.width == buf->vb.width && - prev->vb.height == buf->vb.height && - prev->fmt == buf->fmt) { - list_del(&buf->vb.queue); - list_add_tail(&buf->vb.queue,&dma_q->active); - buf->vb.state = VIDEOBUF_ACTIVE; - dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] restart_queue -" - " move to active\n",buf,buf->vb.i); - } else { - return 0; - } - prev = buf; - } -} - -static void tm6000_vid_timeout(unsigned long data) -{ - struct tm6000_core *dev = (struct tm6000_core*)data; - struct tm6000_dmaqueue *vidq = &dev->vidq; - struct tm6000_buffer *buf; - unsigned long flags; - - spin_lock_irqsave(&dev->slock,flags); - while (!list_empty(&vidq->active)) { - buf = list_entry(vidq->active.next, struct tm6000_buffer, - vb.queue); - list_del(&buf->vb.queue); - buf->vb.state = VIDEOBUF_ERROR; - wake_up(&buf->vb.done); - dprintk(dev, V4L2_DEBUG_QUEUE, "tm6000/0: [%p/%d] timeout\n", - buf, buf->vb.i); - } - - restart_video_queue(vidq); - spin_unlock_irqrestore(&dev->slock,flags); -} - /* ------------------------------------------------------------------ Videobuf operations ------------------------------------------------------------------*/ @@ -892,9 +776,13 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, if (urb_init) { rc = tm6000_prepare_isoc(dev, buf->vb.size); + if (rc < 0) + goto fail; + rc = tm6000_start_thread(dev); if (rc < 0) goto fail; + } buf->vb.state = VIDEOBUF_PREPARED; @@ -912,46 +800,14 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) struct tm6000_fh *fh = vq->priv_data; struct tm6000_core *dev = fh->dev; struct tm6000_dmaqueue *vidq = &dev->vidq; - struct tm6000_buffer *prev; - - if (!list_empty(&vidq->queued)) { - list_add_tail(&buf->vb.queue,&vidq->queued); - buf->vb.state = VIDEOBUF_QUEUED; - dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue - " - "append to queued\n", buf, buf->vb.i); - } else if (list_empty(&vidq->active)) { - list_add_tail(&buf->vb.queue,&vidq->active); - buf->vb.state = VIDEOBUF_ACTIVE; - mod_timer(&vidq->timeout, jiffies+BUFFER_TIMEOUT); - dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue - " - "first active\n", buf, buf->vb.i); - tm6000_start_thread(vidq, buf); - } else { - prev = list_entry(vidq->active.prev, struct tm6000_buffer, vb.queue); - if (prev->vb.width == buf->vb.width && - prev->vb.height == buf->vb.height && - prev->fmt == buf->fmt) { - list_add_tail(&buf->vb.queue,&vidq->active); - buf->vb.state = VIDEOBUF_ACTIVE; - dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue -" - " append to active\n", buf, buf->vb.i); - } else { - list_add_tail(&buf->vb.queue,&vidq->queued); - buf->vb.state = VIDEOBUF_QUEUED; - dprintk(dev, V4L2_DEBUG_QUEUE, "[%p/%d] buffer_queue -" - " first queued\n", buf, buf->vb.i); - } - } + + buf->vb.state = VIDEOBUF_QUEUED; + list_add_tail(&buf->vb.queue, &vidq->active); } static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb) { struct tm6000_buffer *buf = container_of(vb,struct tm6000_buffer,vb); - struct tm6000_fh *fh = vq->priv_data; - struct tm6000_core *dev = (struct tm6000_core*)fh->dev; - struct tm6000_dmaqueue *vidq = &dev->vidq; - - tm6000_stop_thread(vidq); free_buffer(vq,buf); } @@ -1547,7 +1403,6 @@ static int tm6000_release(struct inode *inode, struct file *file) { struct tm6000_fh *fh = file->private_data; struct tm6000_core *dev = fh->dev; - struct tm6000_dmaqueue *vidq = &dev->vidq; int minor = iminor(inode); dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users); @@ -1555,7 +1410,7 @@ static int tm6000_release(struct inode *inode, struct file *file) dev->users--; if (!dev->users) { - tm6000_stop_thread(vidq); + tm6000_uninit_isoc(dev); videobuf_mmap_free(&fh->vb_vidq); } @@ -1641,10 +1496,6 @@ int tm6000_v4l2_register(struct tm6000_core *dev) INIT_LIST_HEAD(&dev->vidq.active); INIT_LIST_HEAD(&dev->vidq.queued); - dev->vidq.timeout.function = tm6000_vid_timeout; - dev->vidq.timeout.data = (unsigned long)dev; - init_timer(&dev->vidq.timeout); - memcpy (dev->vfd, &tm6000_template, sizeof(*(dev->vfd))); dev->vfd->debug=tm6000_debug; diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 3bf4e018ded5..2ca8b24f18be 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -72,7 +72,6 @@ struct tm6000_buffer { struct tm6000_dmaqueue { struct list_head active; struct list_head queued; - struct timer_list timeout; /* thread for generating video stream*/ struct task_struct *kthread; -- GitLab From ed0236afa2382e1b75fec2a080a1e11ff1909de1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 9 Apr 2008 08:07:20 -0300 Subject: [PATCH 064/534] V4L/DVB (12836): tm6000: revert to an old way to copy video The new way is causing machine hangups. This one works. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-usb-isoc.h | 14 +- drivers/staging/tm6000/tm6000-video.c | 387 +++++++++++------------ 2 files changed, 196 insertions(+), 205 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-usb-isoc.h b/drivers/staging/tm6000/tm6000-usb-isoc.h index 24b0fd07900e..11297763de6f 100644 --- a/drivers/staging/tm6000/tm6000-usb-isoc.h +++ b/drivers/staging/tm6000/tm6000-usb-isoc.h @@ -34,24 +34,20 @@ struct usb_isoc_ctl { /* transfer buffers for isoc transfer */ char **transfer_buffer; - /* Last buffer control */ - int pending; - int pos; + /* Last buffer command and region */ + u8 cmd; + int pos, size, pktsize; /* Last field: ODD or EVEN? */ int field; /* Stores incomplete commands */ - u8 tbuf[TM6000_URB_MSG_LEN+4]; - size_t len; + u32 tmp_buf; + int tmp_buf_len; /* Stores already requested buffers */ struct tm6000_buffer *buf; /* Stores the number of received fields */ int nfields; - - /* Checks if a complete field were received */ - int last_line; - unsigned int fields:2; }; diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 5f2865e14e6e..98f68fe67e4c 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -192,117 +192,126 @@ static int copy_packet(struct urb *urb, u32 header, u8 **ptr, u8 *endp, */ unsigned int linewidth = (*buf)->vb.width << 1; - c = (header >> 24) & 0xff; - - /* split the header fields */ - size = (((header & 0x7e) << 1) - 1) * 4; - block = (header >> 7) & 0xf; - field = (header >> 11) & 0x1; - line = (header >> 12) & 0x1ff; - cmd = (header >> 21) & 0x7; - - /* Validates header fields */ - if (size > TM6000_URB_MSG_LEN) - size = TM6000_URB_MSG_LEN; - - if (cmd == TM6000_URB_MSG_VIDEO) { - if ((block + 1) * TM6000_URB_MSG_LEN > linewidth) - cmd = TM6000_URB_MSG_ERR; - - /* FIXME: Mounts the image as field0+field1 - * It should, instead, check if the user selected - * entrelaced or non-entrelaced mode - */ - pos = ((line << 1) + field) * linewidth + - block * TM6000_URB_MSG_LEN; - - /* Don't allow to write out of the buffer */ - if (pos + TM6000_URB_MSG_LEN > (*buf)->vb.size) { - dprintk(dev, V4L2_DEBUG_ISOC, - "ERR: size=%d, num=%d, line=%d, " - "field=%d\n", - size, block, line, field); - - cmd = TM6000_URB_MSG_ERR; - } - } else { - pos = 0; - } - - /* Prints debug info */ - dprintk(dev, V4L2_DEBUG_ISOC, "size=%d, num=%d, " - " line=%d, field=%d\n", - size, block, line, field); - - /* Checks if a complete set of frame0 + frame 1 were received */ - if (dev->isoc_ctl.last_line > line) { - if (dev->isoc_ctl.fields == 3) { - /* Announces that a new buffer were filled */ - buffer_filled(dev, dma_q, *buf); - dprintk(dev, V4L2_DEBUG_ISOC, - "new buffer filled\n"); - rc = get_next_buf(dma_q, buf); + if (!dev->isoc_ctl.cmd) { + c = (header >> 24) & 0xff; + + /* split the header fields */ + size = (((header & 0x7e) << 1) -1) *4; + block = (header >> 7) & 0xf; + field = (header >> 11) & 0x1; + line = (header >> 12) & 0x1ff; + cmd = (header >> 21) & 0x7; + + /* Validates header fields */ + if(size > TM6000_URB_MSG_LEN) + size = TM6000_URB_MSG_LEN; - dev->isoc_ctl.fields = 0; + if (cmd == TM6000_URB_MSG_VIDEO) { + if ((block+1)*TM6000_URB_MSG_LEN>linewidth) + cmd = TM6000_URB_MSG_ERR; + + /* FIXME: Mounts the image as field0+field1 + * It should, instead, check if the user selected + * entrelaced or non-entrelaced mode + */ + pos= ((line<<1)+field)*linewidth + + block*TM6000_URB_MSG_LEN; + + /* Don't allow to write out of the buffer */ + if (pos+TM6000_URB_MSG_LEN > (*buf)->vb.size) { + dprintk(dev, V4L2_DEBUG_ISOC, + "ERR: size=%d, num=%d, line=%d, " + "field=%d\n", + size, block, line, field); + + cmd = TM6000_URB_MSG_ERR; + } } else { - dev->isoc_ctl.fields |= 1 << field; - } - } - dev->isoc_ctl.last_line = line; - - if ((last_line != line) && (last_line + 1 != line) && - (cmd != TM6000_URB_MSG_ERR)) { - if (cmd != TM6000_URB_MSG_VIDEO) { - dprintk(dev, V4L2_DEBUG_ISOC, "cmd=%d, " - "size=%d, num=%d, line=%d, field=%d\n", - cmd, size, block, line, field); + pos=0; } - if (start_line < 0) - start_line = last_line; + /* Prints debug info */ - dprintk(dev, V4L2_DEBUG_ISOC, "lines= %d-%d, " - "field=%d\n", - start_line, last_line, field); + dprintk(dev, V4L2_DEBUG_ISOC, "size=%d, num=%d, " + " line=%d, field=%d\n", + size, block, line, field); - if ((start_line < 6 && last_line > 200) && - (last_field != field)) { + if ((last_line!=line)&&(last_line+1!=line) && + (cmd != TM6000_URB_MSG_ERR) ) { + if (cmd != TM6000_URB_MSG_VIDEO) { + dprintk(dev, V4L2_DEBUG_ISOC, "cmd=%d, " + "size=%d, num=%d, line=%d, field=%d\n", + cmd, size, block, line, field); + } + if (start_line<0) + start_line=last_line; + /* Prints debug info */ + dprintk(dev, V4L2_DEBUG_ISOC, "lines= %d-%d, " + "field=%d\n", + start_line, last_line, field); + + if ((start_line<6 && last_line>200) && + (last_field != field) ) { + + dev->isoc_ctl.nfields++; + if (dev->isoc_ctl.nfields>=2) { + dev->isoc_ctl.nfields=0; + + /* Announces that a new buffer were filled */ + buffer_filled (dev, dma_q, *buf); + dprintk(dev, V4L2_DEBUG_ISOC, + "new buffer filled\n"); + rc=get_next_buf (dma_q, buf); + } + } - dev->isoc_ctl.nfields++; - if (dev->isoc_ctl.nfields >= 2) - dev->isoc_ctl.nfields = 0; + start_line=line; + last_field=field; } + last_line=line; - start_line = line; - last_field = field; + pktsize = TM6000_URB_MSG_LEN; + } else { + /* Continue the last copy */ + cmd = dev->isoc_ctl.cmd; + size= dev->isoc_ctl.size; + pos = dev->isoc_ctl.pos; + pktsize = dev->isoc_ctl.pktsize; } - last_line = line; - - pktsize = TM6000_URB_MSG_LEN; cpysize = (endp-(*ptr) > size) ? size : endp - *ptr; if (cpysize) { /* handles each different URB message */ - switch (cmd) { + switch(cmd) { case TM6000_URB_MSG_VIDEO: /* Fills video buffer */ - if (__copy_to_user(&out_p[pos], *ptr, cpysize) != 0) - tm6000_err("copy_to_user failed.\n"); - + memcpy(&out_p[pos], *ptr, cpysize); break; case TM6000_URB_MSG_PTS: break; case TM6000_URB_MSG_AUDIO: - /* Need some code to process audio */ - printk(KERN_INFO "%ld: cmd=%s, size=%d\n", jiffies, - tm6000_msg_type[cmd], size); +/* Need some code to process audio */ +printk ("%ld: cmd=%s, size=%d\n", jiffies, + tm6000_msg_type[cmd],size); break; default: - dprintk(dev, V4L2_DEBUG_ISOC, "cmd=%s, size=%d\n", - tm6000_msg_type[cmd], size); + dprintk (dev, V4L2_DEBUG_ISOC, "cmd=%s, size=%d\n", + tm6000_msg_type[cmd],size); } } - (*ptr) += cpysize; + if (cpysizeisoc_ctl.pos = pos+cpysize; + dev->isoc_ctl.size= size-cpysize; + dev->isoc_ctl.cmd = cmd; + dev->isoc_ctl.pktsize = pktsize-cpysize; + (*ptr)+=cpysize; + } else { + dev->isoc_ctl.cmd = 0; + (*ptr)+=pktsize; + } return rc; } @@ -311,76 +320,60 @@ static int copy_streams(u8 *data, u8 *out_p, unsigned long len, struct urb *urb, struct tm6000_buffer **buf) { struct tm6000_dmaqueue *dma_q = urb->context; - struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); - u8 *ptr, *endp; - unsigned long header = 0; - int rc = 0, size; - - /* Process pending data */ - if (dev->isoc_ctl.pending) { - memcpy(dev->isoc_ctl.tbuf + dev->isoc_ctl.len, ptr, - sizeof(dev->isoc_ctl.tbuf) - dev->isoc_ctl.len); - - /* Seek for sync */ - endp = dev->isoc_ctl.tbuf + sizeof(dev->isoc_ctl.tbuf); - for (ptr = dev->isoc_ctl.tbuf; ptr < endp - 3; ptr++) { - if (*(ptr + 3) == 0x47) - break; - } - header = *(unsigned long *)ptr; - size = (((header & 0x7e) << 1) - 1) * 4; - if (size > TM6000_URB_MSG_LEN) - size = TM6000_URB_MSG_LEN; - - if (ptr + 3 + size >= endp) { - printk(KERN_ERR "tm6000: broken data\n"); - ptr = data; - goto process_new_uri; - } - ptr += 4; + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + u8 *ptr=data, *endp=data+len; + unsigned long header=0; + int rc=0; - /* Copy or continue last copy */ - rc = copy_packet(urb, header, &ptr, endp, out_p, buf); - if (rc < 0) { - buf = NULL; - printk(KERN_ERR "tm6000: buffer underrun at %ld\n", - jiffies); - return rc; - } - dev->isoc_ctl.pending = 0; - ptr = data + (ptr - dev->isoc_ctl.tbuf); - } else - ptr = data; - -process_new_uri: - endp = data + len; - while (ptr < endp) { - if (!dev->isoc_ctl.pending) { + for (ptr=data; ptrisoc_ctl.cmd) { + u8 *p=(u8 *)&dev->isoc_ctl.tmp_buf; + /* FIXME: This seems very complex + * It just recovers up to 3 bytes of the header that + * might be at the previous packet + */ + if (dev->isoc_ctl.tmp_buf_len) { + while (dev->isoc_ctl.tmp_buf_len) { + if ( *(ptr+3-dev->isoc_ctl.tmp_buf_len) == 0x47) { + break; + } + p++; + dev->isoc_ctl.tmp_buf_len--; + } + if (dev->isoc_ctl.tmp_buf_len) { + memcpy (&header,p, + dev->isoc_ctl.tmp_buf_len); + memcpy (((u8 *)header)+ + dev->isoc_ctl.tmp_buf, + ptr, + 4-dev->isoc_ctl.tmp_buf_len); + ptr+=4-dev->isoc_ctl.tmp_buf_len; + goto HEADER; + } + } /* Seek for sync */ - for (; ptr < endp - 3; ptr++) { - if (*(ptr + 3) == 0x47) + for (;ptr TM6000_URB_MSG_LEN) - size = TM6000_URB_MSG_LEN; - - if (ptr + 3 + size >= endp) { - int len = endp - ptr; - memcpy(dev->isoc_ctl.tbuf, ptr, len); - dev->isoc_ctl.len = len; - dev->isoc_ctl.pending = 1; + if (ptr+3>=endp) { + dev->isoc_ctl.tmp_buf_len=endp-ptr; + memcpy (&dev->isoc_ctl.tmp_buf,ptr, + dev->isoc_ctl.tmp_buf_len); + dev->isoc_ctl.cmd=0; return rc; } - ptr += 4; - } + /* Get message header */ + header=*(unsigned long *)ptr; + ptr+=4; + } +HEADER: /* Copy or continue last copy */ - rc = copy_packet(urb, header, &ptr, endp, out_p, buf); - if (rc < 0) { - buf = NULL; + rc=copy_packet(urb,header,&ptr,endp,out_p,buf); + if (rc<0) { + buf=NULL; printk(KERN_ERR "tm6000: buffer underrun at %ld\n", jiffies); return rc; @@ -396,42 +389,40 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, struct urb *urb, struct tm6000_buffer **buf) { struct tm6000_dmaqueue *dma_q = urb->context; - struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); - unsigned int pos = dev->isoc_ctl.pos, cpysize; - int rc = 1; - - while (len > 0) { - cpysize = min(len, (*buf)->vb.size-pos); - - if (__copy_to_user(&out_p[pos], ptr, cpysize) != 0) - tm6000_err("copy_to_user failed.\n"); - - pos += cpysize; - ptr += cpysize; - len -= cpysize; + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + unsigned int pos=dev->isoc_ctl.pos,cpysize; + int rc=1; + + while (len>0) { + cpysize=min(len,(*buf)->vb.size-pos); +//printk("Copying %d bytes (max=%lu) from %p to %p[%u]\n",cpysize,(*buf)->vb.size,ptr,out_p,pos); + memcpy(&out_p[pos], ptr, cpysize); + pos+=cpysize; + ptr+=cpysize; + len-=cpysize; if (pos >= (*buf)->vb.size) { - pos = 0; + pos=0; /* Announces that a new buffer were filled */ - buffer_filled(dev, dma_q, *buf); + buffer_filled (dev, dma_q, *buf); dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); - rc = get_next_buf(dma_q, buf); - if (rc <= 0) { - *buf = NULL; + rc=get_next_buf (dma_q, buf); + if (rc<=0) { + *buf=NULL; break; } } } - dev->isoc_ctl.pos = pos; + dev->isoc_ctl.pos=pos; return rc; } -static inline void print_err_status(struct tm6000_core *dev, - int packet, int status) +static void inline print_err_status (struct tm6000_core *dev, + int packet, int status) { char *errmsg = "Unknown"; - switch (status) { + switch(status) { case -ENOENT: errmsg = "unlinked synchronuously"; break; @@ -457,12 +448,11 @@ static inline void print_err_status(struct tm6000_core *dev, errmsg = "Device does not respond"; break; } - if (packet < 0) { + if (packet<0) { dprintk(dev, V4L2_DEBUG_QUEUE, "URB status %d [%s].\n", status, errmsg); } else { - dprintk(dev, V4L2_DEBUG_QUEUE, - "URB packet %d, status %d [%s].\n", + dprintk(dev, V4L2_DEBUG_QUEUE, "URB packet %d, status %d [%s].\n", packet, status, errmsg); } } @@ -474,40 +464,45 @@ static inline void print_err_status(struct tm6000_core *dev, static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) { struct tm6000_dmaqueue *dma_q = urb->context; - struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); - void *outp = videobuf_to_vmalloc(&((*buf)->vb)); - int i, len = 0, rc = 1; - int size = (*buf)->vb.size; + struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); + void *outp=videobuf_to_vmalloc (&((*buf)->vb)); + int i, len=0, rc=1; + int size=(*buf)->vb.size; char *p; - unsigned long copied = 0; + unsigned long copied; - if (urb->status < 0) { - print_err_status(dev, -1, urb->status); + copied=0; + + if (urb->status<0) { + print_err_status (dev,-1,urb->status); return 0; } for (i = 0; i < urb->number_of_packets; i++) { int status = urb->iso_frame_desc[i].status; - if (status < 0) { - print_err_status(dev, i, status); + if (status<0) { + print_err_status (dev,i,status); continue; } - len = urb->iso_frame_desc[i].actual_length; - - p = urb->transfer_buffer + urb->iso_frame_desc[i].offset; - if (!urb->iso_frame_desc[i].status) { - if (((*buf)->fmt->fourcc) == V4L2_PIX_FMT_TM6000) { - rc = copy_multiplexed(p, outp, len, urb, buf); - if (rc <= 0) - return rc; - } else - copy_streams(p, outp, len, urb, buf); - } - copied += len; - if (copied >= size) - break; + len=urb->iso_frame_desc[i].actual_length; + +// if (len>=TM6000_URB_MSG_LEN) { + p=urb->transfer_buffer + urb->iso_frame_desc[i].offset; + if (!urb->iso_frame_desc[i].status) { + if (((*buf)->fmt->fourcc)==V4L2_PIX_FMT_TM6000) { + rc=copy_multiplexed(p,outp,len,urb,buf); + if (rc<=0) + return rc; + } else { + copy_streams(p,outp,len,urb,buf); + } + } + copied += len; + if (copied>=size) + break; +// } } return rc; } -- GitLab From 1b4c5b1f0582df9231e6e1093e504d7df3a062b9 Mon Sep 17 00:00:00 2001 From: Maykel Moya Date: Mon, 28 Apr 2008 19:20:26 -0300 Subject: [PATCH 065/534] V4L/DVB (12837): tm6000: make tree buildable Signed-off-by: Maykel Moya Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-dvb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index fa6d3a00f9b0..6a4cbc5fcd93 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -208,6 +208,8 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev) return (!dvb->frontend) ? -1 : 0; } +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + int tm6000_dvb_register(struct tm6000_core *dev) { int ret = -1; @@ -225,7 +227,7 @@ int tm6000_dvb_register(struct tm6000_core *dev) } ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T", - THIS_MODULE, &dev->udev->dev); + THIS_MODULE, &dev->udev->dev, adapter_nr); dvb->adapter.priv = dev; if (dvb->frontend) { -- GitLab From 717ecd2b9a71970698c04f34239c6a1e5d08fbc2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Oct 2008 08:56:16 -0300 Subject: [PATCH 066/534] V4L/DVB (12838): tm6000: Fix color support on tm6010 TM6010 uses some different registers for format support. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 179885a193e6..c4e1aeb0195b 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -140,12 +140,16 @@ int tm6000_get_reg16 (struct tm6000_core *dev, u8 req, u16 value, u16 index) void tm6000_set_fourcc_format(struct tm6000_core *dev) { - if (dev->fourcc==V4L2_PIX_FMT_UYVY) { - /* Sets driver to UYUV */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0xd0); + if (dev->dev_type == TM6010) { + if (dev->fourcc == V4L2_PIX_FMT_UYVY) + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0xfc); + else + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0xfd); } else { - /* Sets driver to YUV2 */ - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0x90); + if (dev->fourcc == V4L2_PIX_FMT_UYVY) + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0xd0); + else + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0x90); } } -- GitLab From 8ae1fc6e10cdf9be754cccee2a3ee551a981ab08 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Oct 2008 08:56:22 -0300 Subject: [PATCH 067/534] V4L/DVB (12839): tm6000: Another trial to fix analog streaming Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index c4e1aeb0195b..c56750338dd1 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -51,7 +51,8 @@ int tm6000_read_write_usb (struct tm6000_core *dev, u8 req_type, u8 req, memcpy(data, buf, len); } - if (tm6000_debug & V4L2_DEBUG_I2C) { +// if (tm6000_debug & V4L2_DEBUG_I2C) { +if(1){ if (!ini) last=ini=jiffies; @@ -71,7 +72,7 @@ int tm6000_read_write_usb (struct tm6000_core *dev, u8 req_type, u8 req, for (i=0;i Date: Sat, 25 Oct 2008 08:56:22 -0300 Subject: [PATCH 068/534] V4L/DVB (12840): tm6000: add support for HVR900H Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 40 +++++++++++++++++++++------ 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 650ed8e88f38..4e9fa38f2cfe 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -40,6 +40,7 @@ #define TM6000_BOARD_ADSTECH_DUAL_TV 6 #define TM6000_BOARD_FREECOM_AND_SIMILAR 7 #define TM6000_BOARD_ADSTECH_MINI_DUAL_TV 8 +#define TM6010_BOARD_HAUPPAUGE_900H 9 #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; @@ -161,6 +162,20 @@ struct tm6000_board tm6000_boards[] = { }, .gpio_addr_tun_reset = TM6000_GPIO_4, }, + [TM6010_BOARD_HAUPPAUGE_900H] = { + .name = "Hauppauge HVR-900H", + .tuner_type = TUNER_XC2028, /* has a XC3028 */ + .tuner_addr = 0xc2, + .demod_addr = 0x1e, + .type = TM6010, + .caps = { + .has_tuner = 1, + .has_dvb = 1, + .has_zl10353 = 1, + .has_eeprom = 1, + }, + .gpio_addr_tun_reset = TM6000_GPIO_2, + }, }; /* table of devices that work with this driver */ @@ -170,23 +185,19 @@ struct usb_device_id tm6000_id_table [] = { { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV }, { USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR }, { USB_DEVICE(0x06e1, 0xb339), .driver_info = TM6000_BOARD_ADSTECH_MINI_DUAL_TV }, + { USB_DEVICE(0x2040, 0x6600), .driver_info = TM6010_BOARD_HAUPPAUGE_900H }, { }, }; static void tm6000_config_tuner (struct tm6000_core *dev) { - struct v4l2_priv_tun_config xc2028_cfg; - struct xc2028_ctrl ctl; - - memset (&ctl,0,sizeof(ctl)); - request_module ("tuner"); if (dev->tuner_type == TUNER_XC2028) { - if (dev->dev_type == TM6010) - ctl.fname = "xc3028-v27.fw"; - else - ctl.fname = "tm6000-xc3028.fw"; + struct v4l2_priv_tun_config xc2028_cfg; + struct xc2028_ctrl ctl; + + memset (&ctl,0,sizeof(ctl)); ctl.mts = 1; ctl.read_not_reliable = 1; @@ -195,6 +206,17 @@ static void tm6000_config_tuner (struct tm6000_core *dev) xc2028_cfg.tuner = TUNER_XC2028; xc2028_cfg.priv = &ctl; + switch(dev->model) { + case TM6010_BOARD_HAUPPAUGE_900H: + ctl.fname = "xc3028L-v36.fw"; + break; + default: + if (dev->dev_type == TM6010) + ctl.fname = "xc3028-v27.fw"; + else + ctl.fname = "tm6000-xc3028.fw"; + } + printk(KERN_INFO "Setting firmware parameters for xc2028\n"); tm6000_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); -- GitLab From 2a8145d4b82b347c9bf49402aad2c2b6184f0540 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 25 Oct 2008 10:43:04 -0300 Subject: [PATCH 069/534] V4L/DVB (12841): tm6000: Fix compilation with newer v4l2-dev API Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 72 ++++++++++++++------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 98f68fe67e4c..2b30083b0860 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -866,7 +867,7 @@ static int vidioc_querycap (struct file *file, void *priv, return 0; } -static int vidioc_enum_fmt_cap (struct file *file, void *priv, +static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv, struct v4l2_fmtdesc *f) { if (unlikely(f->index >= ARRAY_SIZE(format))) @@ -877,7 +878,7 @@ static int vidioc_enum_fmt_cap (struct file *file, void *priv, return 0; } -static int vidioc_g_fmt_cap (struct file *file, void *priv, +static int vidioc_g_fmt_vid_cap (struct file *file, void *priv, struct v4l2_format *f) { struct tm6000_fh *fh=priv; @@ -904,7 +905,7 @@ static struct tm6000_fmt* format_by_fourcc(unsigned int fourcc) return NULL; } -static int vidioc_try_fmt_cap (struct file *file, void *priv, +static int vidioc_try_fmt_vid_cap (struct file *file, void *priv, struct v4l2_format *f) { struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev; @@ -946,12 +947,12 @@ static int vidioc_try_fmt_cap (struct file *file, void *priv, } /*FIXME: This seems to be generic enough to be at videodev2 */ -static int vidioc_s_fmt_cap (struct file *file, void *priv, +static int vidioc_s_fmt_vid_cap (struct file *file, void *priv, struct v4l2_format *f) { struct tm6000_fh *fh=priv; struct tm6000_core *dev = fh->dev; - int ret = vidioc_try_fmt_cap(file,fh,f); + int ret = vidioc_try_fmt_vid_cap(file,fh,f); if (ret < 0) return (ret); @@ -1435,41 +1436,44 @@ static struct file_operations tm6000_fops = { .llseek = no_llseek, }; +static const struct v4l2_ioctl_ops video_ioctl_ops = { + .vidioc_querycap = vidioc_querycap, + .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, + .vidioc_s_std = vidioc_s_std, + .vidioc_enum_input = vidioc_enum_input, + .vidioc_g_input = vidioc_g_input, + .vidioc_s_input = vidioc_s_input, + .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_s_ctrl = vidioc_s_ctrl, + .vidioc_g_tuner = vidioc_g_tuner, + .vidioc_s_tuner = vidioc_s_tuner, + .vidioc_g_frequency = vidioc_g_frequency, + .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_streamon = vidioc_streamon, + .vidioc_streamoff = vidioc_streamoff, + .vidioc_reqbufs = vidioc_reqbufs, + .vidioc_querybuf = vidioc_querybuf, + .vidioc_qbuf = vidioc_qbuf, + .vidioc_dqbuf = vidioc_dqbuf, +#ifdef CONFIG_VIDEO_V4L1_COMPAT + .vidiocgmbuf = vidiocgmbuf, +#endif +}; + static struct video_device tm6000_template = { .name = "tm6000", - .type = VID_TYPE_CAPTURE, .fops = &tm6000_fops, + .ioctl_ops = &video_ioctl_ops, .minor = -1, .release = video_device_release, - - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_cap = vidioc_enum_fmt_cap, - .vidioc_g_fmt_cap = vidioc_g_fmt_cap, - .vidioc_try_fmt_cap = vidioc_try_fmt_cap, - .vidioc_s_fmt_cap = vidioc_s_fmt_cap, - .vidioc_s_std = vidioc_s_std, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_queryctrl = vidioc_queryctrl, - .vidioc_g_ctrl = vidioc_g_ctrl, - .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, - .vidioc_streamon = vidioc_streamon, - .vidioc_streamoff = vidioc_streamoff, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, - .vidioc_dqbuf = vidioc_dqbuf, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif - .tvnorms = TM6000_STD, - .current_norm = V4L2_STD_NTSC_M, + .tvnorms = TM6000_STD, + .current_norm = V4L2_STD_NTSC_M, }; + /* ----------------------------------------------------------------- Initialization and module stuff ------------------------------------------------------------------*/ -- GitLab From 721f507b694f3be7c872d63a323afde91e43dfff Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 26 Oct 2008 09:18:53 -0300 Subject: [PATCH 070/534] V4L/DVB (12842): tm6000: avoid kernel panic while retrieving the filling buffer Instead of storing next buf on a temp var, saved over URB processing, restore it using get_next_buf. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 67 +++++++++++++++++---------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 2b30083b0860..125cb368dfe5 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -131,20 +131,28 @@ static LIST_HEAD(tm6000_corelist); /* * video-buf generic routine to get the next available buffer */ -static inline int get_next_buf(struct tm6000_dmaqueue *dma_q, +static inline void get_next_buf(struct tm6000_dmaqueue *dma_q, struct tm6000_buffer **buf) { struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); + char *outp; if (list_empty(&dma_q->active)) { dprintk(dev, V4L2_DEBUG_QUEUE, "No active queue to serve\n"); - return 0; + return; } *buf = list_entry(dma_q->active.next, struct tm6000_buffer, vb.queue); - return 1; + if (!buf) + return; + + /* Cleans up buffer - Usefull for testing for frame/URB loss */ + outp = videobuf_to_vmalloc(&(*buf)->vb); + memset(outp, 0, (*buf)->vb.size); + + return; } /* @@ -261,7 +269,9 @@ static int copy_packet(struct urb *urb, u32 header, u8 **ptr, u8 *endp, buffer_filled (dev, dma_q, *buf); dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); - rc=get_next_buf (dma_q, buf); + get_next_buf (dma_q, buf); + if (!*buf) + return rc; } } @@ -406,11 +416,9 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, /* Announces that a new buffer were filled */ buffer_filled (dev, dma_q, *buf); dprintk(dev, V4L2_DEBUG_ISOC, "new buffer filled\n"); - rc=get_next_buf (dma_q, buf); - if (rc<=0) { - *buf=NULL; + get_next_buf (dma_q, buf); + if (!*buf) break; - } } } @@ -517,34 +525,26 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) */ static void tm6000_irq_callback(struct urb *urb) { - struct tm6000_buffer *buf; + struct tm6000_buffer *buf = NULL; struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); - int rc; unsigned long flags; - spin_lock_irqsave(&dev->slock, flags); - - buf = dev->isoc_ctl.buf; + if (!dev) + return; - if (!buf) { - rc = get_next_buf(dma_q, &buf); - if (rc <= 0) - goto ret; - } + spin_lock_irqsave(&dev->slock, flags); - /* Copy data from URB */ - rc = tm6000_isoc_copy(urb, &buf); + get_next_buf(dma_q, &buf); + if (buf) + tm6000_isoc_copy(urb, &buf); + spin_unlock_irqrestore(&dev->slock, flags); - dev->isoc_ctl.buf = buf; -ret: urb->status = usb_submit_urb(urb, GFP_ATOMIC); if (urb->status) tm6000_err("urb resubmit failed (error=%i)\n", urb->status); - - spin_unlock_irqrestore(&dev->slock, flags); } /* @@ -724,10 +724,27 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) static void free_buffer(struct videobuf_queue *vq, struct tm6000_buffer *buf) { + struct tm6000_fh *fh = vq->priv_data; + struct tm6000_core *dev = fh->dev; + unsigned long flags; + if (in_interrupt()) BUG(); - videobuf_waiton(&buf->vb,0,0); + /* We used to wait for the buffer to finish here, but this didn't work + because, as we were keeping the state as VIDEOBUF_QUEUED, + videobuf_queue_cancel marked it as finished for us. + (Also, it could wedge forever if the hardware was misconfigured.) + + This should be safe; by the time we get here, the buffer isn't + queued anymore. If we ever start marking the buffers as + VIDEOBUF_ACTIVE, it won't be, though. + */ + spin_lock_irqsave(&dev->slock, flags); + if (dev->isoc_ctl.buf == buf) + dev->isoc_ctl.buf = NULL; + spin_unlock_irqrestore(&dev->slock, flags); + videobuf_vmalloc_free(&buf->vb); buf->vb.state = VIDEOBUF_NEEDS_INIT; } -- GitLab From edecce0a31b4447ee75dd0df34c7c5fc90ba6f6b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 28 Nov 2008 06:42:24 -0300 Subject: [PATCH 071/534] V4L/DVB (12843): tm6000: cleanup: remove a test debug code Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index c56750338dd1..d467326b8692 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -51,8 +51,7 @@ int tm6000_read_write_usb (struct tm6000_core *dev, u8 req_type, u8 req, memcpy(data, buf, len); } -// if (tm6000_debug & V4L2_DEBUG_I2C) { -if(1){ + if (tm6000_debug & V4L2_DEBUG_I2C) { if (!ini) last=ini=jiffies; @@ -82,8 +81,7 @@ if(1){ if (req_type & USB_DIR_IN) memcpy(buf, data, len); -// if (tm6000_debug & V4L2_DEBUG_I2C) { -if(1) { + if (tm6000_debug & V4L2_DEBUG_I2C) { if (ret<0) { if (req_type & USB_DIR_IN) printk("<<< (len=%d)\n",len); -- GitLab From 1f9305b7a56b1c7dd62add13e763b3fc537ae499 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 28 Nov 2008 06:44:06 -0300 Subject: [PATCH 072/534] V4L/DVB (12844): tm6000: avoid writing on a floating pointer Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 125cb368dfe5..3723d832879b 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -139,6 +139,7 @@ static inline void get_next_buf(struct tm6000_dmaqueue *dma_q, if (list_empty(&dma_q->active)) { dprintk(dev, V4L2_DEBUG_QUEUE, "No active queue to serve\n"); + *buf = NULL; return; } -- GitLab From e8a4845d2a797958b1e0cb6acc5e826985ee90ce Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 28 Nov 2008 07:39:00 -0300 Subject: [PATCH 073/534] V4L/DVB (12845): tm6000: more buffer handling fixes Before this patch, we were writing outside vmalloced buffer Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 49 +++++++++++++++++++-------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 3723d832879b..932dfde6d69a 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -273,6 +273,11 @@ static int copy_packet(struct urb *urb, u32 header, u8 **ptr, u8 *endp, get_next_buf (dma_q, buf); if (!*buf) return rc; + out_p = videobuf_to_vmalloc(&((*buf)->vb)); + if (!out_p) + return rc; + + pos = dev->isoc_ctl.pos = 0; } } @@ -420,6 +425,10 @@ static int copy_multiplexed(u8 *ptr, u8 *out_p, unsigned long len, get_next_buf (dma_q, buf); if (!*buf) break; + out_p = videobuf_to_vmalloc(&((*buf)->vb)); + if (!out_p) + return rc; + pos = 0; } } @@ -471,16 +480,25 @@ static void inline print_err_status (struct tm6000_core *dev, /* * Controls the isoc copy of each urb packet */ -static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) +static inline int tm6000_isoc_copy(struct urb *urb) { struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev= container_of(dma_q,struct tm6000_core,vidq); - void *outp=videobuf_to_vmalloc (&((*buf)->vb)); + struct tm6000_buffer *buf; int i, len=0, rc=1; - int size=(*buf)->vb.size; - char *p; + int size; + char *outp = NULL, *p; unsigned long copied; + get_next_buf(dma_q, &buf); + if (!buf) + outp = videobuf_to_vmalloc(&buf->vb); + + if (!outp) + return 0; + + size = buf->vb.size; + copied=0; if (urb->status<0) { @@ -501,12 +519,12 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) // if (len>=TM6000_URB_MSG_LEN) { p=urb->transfer_buffer + urb->iso_frame_desc[i].offset; if (!urb->iso_frame_desc[i].status) { - if (((*buf)->fmt->fourcc)==V4L2_PIX_FMT_TM6000) { - rc=copy_multiplexed(p,outp,len,urb,buf); + if ((buf->fmt->fourcc)==V4L2_PIX_FMT_TM6000) { + rc=copy_multiplexed(p, outp, len, urb, &buf); if (rc<=0) return rc; } else { - copy_streams(p,outp,len,urb,buf); + copy_streams(p, outp, len, urb, &buf); } } copied += len; @@ -526,21 +544,22 @@ static inline int tm6000_isoc_copy(struct urb *urb, struct tm6000_buffer **buf) */ static void tm6000_irq_callback(struct urb *urb) { - struct tm6000_buffer *buf = NULL; struct tm6000_dmaqueue *dma_q = urb->context; struct tm6000_core *dev = container_of(dma_q, struct tm6000_core, vidq); - unsigned long flags; + int i; if (!dev) return; - spin_lock_irqsave(&dev->slock, flags); - - get_next_buf(dma_q, &buf); - if (buf) - tm6000_isoc_copy(urb, &buf); - spin_unlock_irqrestore(&dev->slock, flags); + spin_lock(&dev->slock); + tm6000_isoc_copy(urb); + spin_unlock(&dev->slock); + /* Reset urb buffers */ + for (i = 0; i < urb->number_of_packets; i++) { + urb->iso_frame_desc[i].status = 0; + urb->iso_frame_desc[i].actual_length = 0; + } urb->status = usb_submit_urb(urb, GFP_ATOMIC); if (urb->status) -- GitLab From 0fb84ce0dbffee26dc0934496e6bcdce853fa0d0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 2 Dec 2008 08:30:16 -0300 Subject: [PATCH 074/534] V4L/DVB (12846): tuner-xc2028: Fix skip code for devices with broken read (tm6000) Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tuner-xc2028.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index 53f0fbb33cc6..61a7e138c748 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c @@ -811,6 +811,10 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, hwmodel, (version & 0xf000) >> 12, (version & 0xf00) >> 8, (version & 0xf0) >> 4, version & 0xf); + + if (priv->ctrl.read_not_reliable) + goto read_not_reliable; + /* Check firmware version against what we downloaded. */ if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) { if (!priv->ctrl.read_not_reliable) { @@ -834,6 +838,7 @@ static int check_firmware(struct dvb_frontend *fe, unsigned int type, goto fail; } +read_not_reliable: memcpy(&priv->cur_fw, &new_fw, sizeof(priv->cur_fw)); /* -- GitLab From 77d966a25aa3732d79e740088ff0401ebf26b3c9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Sep 2009 13:04:08 -0300 Subject: [PATCH 075/534] V4L/DVB (12848): tm6000: Add README with todo list Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/README | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 drivers/staging/tm6000/README diff --git a/drivers/staging/tm6000/README b/drivers/staging/tm6000/README new file mode 100644 index 000000000000..cff09b7b477e --- /dev/null +++ b/drivers/staging/tm6000/README @@ -0,0 +1,11 @@ +Todo: + - checkpatch.pl cleanups + - sparse cleanups + - convert to new i2c approach + - better support DVB + - fix reading from i2c, if possible + - fix loosing frames + - fix oops? + +Please send patches to linux-media@vger.kernel.org + -- GitLab From 427f7facb374b8651ff01b7700e690ef8ccae159 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Sep 2009 16:37:13 -0300 Subject: [PATCH 076/534] V4L/DVB (12852): tm6000: Fix compilation against 2.6.31 Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-alsa.c | 7 +- drivers/staging/tm6000/tm6000-cards.c | 42 +++++++-- drivers/staging/tm6000/tm6000-core.c | 2 +- drivers/staging/tm6000/tm6000-dvb.c | 4 +- drivers/staging/tm6000/tm6000-i2c.c | 121 +------------------------- drivers/staging/tm6000/tm6000-video.c | 7 +- drivers/staging/tm6000/tm6000.h | 5 +- 7 files changed, 51 insertions(+), 137 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index 052e2cc255f5..cf24340e0874 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -350,10 +349,10 @@ int tm6000_audio_init(struct tm6000_core *dev, int idx) if (!enable[idx]) return -ENOENT; - card = snd_card_new(index[idx], id[idx], THIS_MODULE, 0); - if (card == NULL) { + rc = snd_card_create(index[idx], id[idx], THIS_MODULE, 0, &card); + if (rc < 0) { snd_printk(KERN_ERR "cannot create card instance %d\n", idx); - return -ENOMEM; + return rc; } chip = kzalloc(sizeof(*chip), GFP_KERNEL); diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 4e9fa38f2cfe..290296859620 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "tm6000.h" #include "tm6000-regs.h" @@ -191,12 +193,23 @@ struct usb_device_id tm6000_id_table [] = { static void tm6000_config_tuner (struct tm6000_core *dev) { - request_module ("tuner"); + struct tuner_setup tun_setup; + + /* Load tuner module */ + v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, + "tuner", "tuner",dev->tuner_addr, NULL); + + memset(&tun_setup, 0, sizeof(tun_setup)); + tun_setup.type = dev->tuner_type; + tun_setup.addr = dev->tuner_addr; + + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup); if (dev->tuner_type == TUNER_XC2028) { struct v4l2_priv_tun_config xc2028_cfg; struct xc2028_ctrl ctl; + memset(&xc2028_cfg, 0, sizeof(xc2028_cfg)); memset (&ctl,0,sizeof(ctl)); ctl.mts = 1; @@ -219,7 +232,8 @@ static void tm6000_config_tuner (struct tm6000_core *dev) printk(KERN_INFO "Setting firmware parameters for xc2028\n"); - tm6000_i2c_call_clients(dev, TUNER_SET_CONFIG, &xc2028_cfg); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_config, + &xc2028_cfg); } } @@ -247,6 +261,10 @@ static int tm6000_init_dev(struct tm6000_core *dev) if (rc<0) goto err; + rc = v4l2_device_register(&dev->udev->dev, &dev->v4l2_dev); + if (rc < 0) + goto err; + /* register i2c bus */ rc=tm6000_i2c_register(dev); if (rc<0) @@ -266,30 +284,38 @@ static int tm6000_init_dev(struct tm6000_core *dev) tm6000_config_tuner (dev); /* Set video standard */ - tm6000_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm); /* Set tuner frequency - also loads firmware on xc2028/xc3028 */ f.tuner = 0; f.type = V4L2_TUNER_ANALOG_TV; f.frequency = 3092; /* 193.25 MHz */ dev->freq = f.frequency; - tm6000_i2c_call_clients(dev, VIDIOC_S_FREQUENCY, &f); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); + + if (dev->caps.has_tda9874) + v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, + "tvaudio", "tvaudio", I2C_ADDR_TDA9874, NULL); if(dev->caps.has_dvb) { dev->dvb = kzalloc(sizeof(*(dev->dvb)), GFP_KERNEL); if(!dev->dvb) { rc = -ENOMEM; - goto err; + goto err2; } #ifdef CONFIG_VIDEO_TM6000_DVB rc = tm6000_dvb_register(dev); if(rc < 0) { kfree(dev->dvb); dev->dvb = NULL; - goto err; + goto err2; } #endif } + +err2: + v4l2_device_unregister(&dev->v4l2_dev); + err: mutex_unlock(&dev->lock); return rc; @@ -460,6 +486,8 @@ static int tm6000_usb_probe(struct usb_interface *interface, return 0; err: + printk("tm6000: Error %d while registering\n", rc); + tm6000_devused&=~(1<v4l2_dev); + // wake_up_interruptible_all(&dev->open); dev->state |= DEV_DISCONNECTED; diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index d467326b8692..d41af1d6c66a 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -207,7 +207,7 @@ int tm6000_init_analog_mode (struct tm6000_core *dev) struct v4l2_frequency f; mutex_lock(&dev->lock); f.frequency=dev->freq; - tm6000_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); mutex_unlock(&dev->lock); msleep(100); diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index 6a4cbc5fcd93..e900d6ddea30 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -232,8 +232,8 @@ int tm6000_dvb_register(struct tm6000_core *dev) if (dvb->frontend) { struct xc2028_config cfg = { - .i2c_adap = &dev->i2c_adap, - .video_dev = dev, + .i2c_adap = &dev->i2c_adap, + .i2c_addr = dev->tuner_addr, }; ret = dvb_register_frontend(&dvb->adapter, dvb->frontend); diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 0df4820481c3..e9ad51617561 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -36,10 +36,6 @@ #define I2C_HW_B_TM6000 I2C_HW_B_EM28XX /* ----------------------------------------------------------- */ -static unsigned int i2c_scan = 0; -module_param(i2c_scan, int, 0444); -MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); - static unsigned int i2c_debug = 0; module_param(i2c_debug, int, 0644); MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); @@ -48,47 +44,6 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); printk(KERN_DEBUG "%s at %s: " fmt, \ dev->name, __FUNCTION__ , ##args); } while (0) - -/* Returns 0 if address is found */ -static int tm6000_i2c_scan(struct i2c_adapter *i2c_adap, int addr) -{ - struct tm6000_core *dev = i2c_adap->algo_data; - -#if 1 - /* HACK: i2c scan is not working yet */ - if ( - (dev->caps.has_tuner && (addr==dev->tuner_addr)) || - (dev->caps.has_tda9874 && (addr==0xb0)) || - (dev->caps.has_eeprom && (addr==0xa0)) - ) { - printk("Hack: enabling device at addr 0x%02x\n",addr); - return (1); - } else { - return -ENODEV; - } -#else - int rc=-ENODEV; - char buf[1]; - - /* This sends addr + 1 byte with 0 */ - rc = tm6000_read_write_usb (dev, - USB_DIR_IN | USB_TYPE_VENDOR, - REQ_16_SET_GET_I2C_WR1_RDN, - addr, 0, - buf, 0); - msleep(10); - - if (rc<0) { - if (i2c_debug>=2) - printk("no device at addr 0x%02x\n",addr); - } - - printk("Hack: check on addr 0x%02x returned %d\n",addr,rc); - - return rc; -#endif -} - static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) { @@ -102,10 +57,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, i2c_dprintk(2,"%s %s addr=0x%x len=%d:", (msgs[i].flags & I2C_M_RD) ? "read" : "write", i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); - if (!msgs[i].len) { - /* Do I2C scan */ - rc = tm6000_i2c_scan(i2c_adap, addr); - } else if (msgs[i].flags & I2C_M_RD) { + if (msgs[i].flags & I2C_M_RD) { /* read request without preceding register selection */ /* * The TM6000 only supports a read transaction @@ -306,36 +258,6 @@ static int tm6000_tuner_callback(void *ptr, int command, int arg) return (rc); } -static int attach_inform(struct i2c_client *client) -{ - struct tm6000_core *dev = client->adapter->algo_data; - struct tuner_setup tun_setup; - - i2c_dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", - client->driver->driver.name, client->addr, client->name); - - switch (client->addr<<1) { - case 0xb0: - request_module("tvaudio"); - return 0; - } - - /* If tuner, initialize the tuner part */ - if ( dev->tuner_addr != client->addr<<1 ) { - return 0; - } - - memset (&tun_setup, 0, sizeof(tun_setup)); - - tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; - tun_setup.type = dev->tuner_type; - tun_setup.addr = dev->tuner_addr>>1; - tun_setup.tuner_callback = tm6000_tuner_callback; - - client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup); - - return 0; -} static struct i2c_algorithm tm6000_algo = { .master_xfer = tm6000_i2c_xfer, @@ -353,7 +275,6 @@ static struct i2c_adapter tm6000_adap_template = { .name = "tm6000", .id = I2C_HW_B_TM6000, .algo = &tm6000_algo, - .client_register = attach_inform, }; static struct i2c_client tm6000_client_template = { @@ -362,43 +283,6 @@ static struct i2c_client tm6000_client_template = { /* ----------------------------------------------------------- */ -/* - * i2c_devs - * incomplete list of known devices - */ -static char *i2c_devs[128] = { - [0xc2 >> 1] = "tuner (analog)", -}; - -/* - * do_i2c_scan() - * check i2c address range for devices - */ -static void do_i2c_scan(char *name, struct i2c_client *c) -{ - unsigned char buf; - int i, rc; - - for (i = 0; i < 128; i++) { - c->addr = i; - rc = i2c_master_recv(c, &buf, 0); - if (rc < 0) - continue; - printk(KERN_INFO "%s: found i2c device @ 0x%x [%s]\n", name, - i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); - } -} - -/* - * tm6000_i2c_call_clients() - * send commands to all attached i2c devices - */ -void tm6000_i2c_call_clients(struct tm6000_core *dev, unsigned int cmd, void *arg) -{ - BUG_ON(NULL == dev->i2c_adap.algo_data); - i2c_clients_command(&dev->i2c_adap, cmd, arg); -} - /* * tm6000_i2c_register() * register i2c bus @@ -416,8 +300,7 @@ int tm6000_i2c_register(struct tm6000_core *dev) dev->i2c_client = tm6000_client_template; dev->i2c_client.adapter = &dev->i2c_adap; - if (i2c_scan) - do_i2c_scan(dev->name, &dev->i2c_client); + i2c_set_adapdata(&dev->i2c_adap, &dev->v4l2_dev); tm6000_i2c_eeprom(dev, eedata, sizeof(eedata)); diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 932dfde6d69a..8e93eb0bc8f6 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1091,7 +1091,7 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *norm) if (rc<0) return rc; - tm6000_i2c_call_clients(dev, VIDIOC_S_STD, &dev->norm); + v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm); return 0; } @@ -1278,7 +1278,7 @@ static int vidioc_g_frequency (struct file *file, void *priv, f->type = V4L2_TUNER_ANALOG_TV; f->frequency = dev->freq; - tm6000_i2c_call_clients(dev,VIDIOC_G_FREQUENCY,f); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_frequency, f); return 0; } @@ -1299,7 +1299,7 @@ static int vidioc_s_frequency (struct file *file, void *priv, // mutex_lock(&dev->lock); dev->freq = f->frequency; - tm6000_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,f); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); // mutex_unlock(&dev->lock); return 0; @@ -1534,6 +1534,7 @@ int tm6000_v4l2_register(struct tm6000_core *dev) memcpy (dev->vfd, &tm6000_template, sizeof(*(dev->vfd))); dev->vfd->debug=tm6000_debug; + vfd->v4l2_dev = &dev->v4l2_dev; ret = video_register_device(dev->vfd, VFL_TYPE_GRABBER, video_nr); printk(KERN_INFO "Trident TVMaster TM5600/TM6000 USB2 board (Load status: %d)\n", ret); diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 2ca8b24f18be..54dbdb91c52f 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -29,6 +29,8 @@ #include "tm6000-usb-isoc.h" #include #include +#include + #include #include "dvb_demux.h" @@ -156,6 +158,7 @@ struct tm6000_core { unsigned int resources; struct video_device *vfd; struct tm6000_dmaqueue vidq; + struct v4l2_device v4l2_dev; int input; int freq; @@ -228,8 +231,6 @@ int tm6000_set_standard (struct tm6000_core *dev, v4l2_std_id *norm); /* In tm6000-i2c.c */ int tm6000_i2c_register(struct tm6000_core *dev); int tm6000_i2c_unregister(struct tm6000_core *dev); -void tm6000_i2c_call_clients(struct tm6000_core *dev, unsigned int cmd, - void *arg); /* In tm6000-queue.c */ -- GitLab From 64d339d42d6165c3276b524b939f7866693b83e0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Sep 2009 17:16:32 -0300 Subject: [PATCH 077/534] V4L/DVB (12853): tm6000: Fix almost all warnings at the driver Onr warning is left, since it is there for a purpose: tm6000-core.c:218: warning: ISO C90 forbids mixed declarations and code It indicates a place where a temporary hack were added. Tests are needed to be sure that we can remove it. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 57 +++++++++++++++++++++++++++ drivers/staging/tm6000/tm6000-i2c.c | 56 -------------------------- drivers/staging/tm6000/tm6000-video.c | 13 +++--- 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 290296859620..f848840c8a85 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -191,6 +191,61 @@ struct usb_device_id tm6000_id_table [] = { { }, }; +/* Tuner callback to provide the proper gpio changes needed for xc2028 */ + +static int tm6000_tuner_callback(void *ptr, int component, int command, int arg) +{ + int rc=0; + struct tm6000_core *dev = ptr; + + if (dev->tuner_type!=TUNER_XC2028) + return 0; + + switch (command) { + case XC2028_RESET_CLK: + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, + 0x02, arg); + msleep(10); + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_CLK, 0); + if (rc<0) + return rc; + msleep(10); + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_CLK, 1); + break; + case XC2028_TUNER_RESET: + /* Reset codes during load firmware */ + switch (arg) { + case 0: + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x00); + msleep(130); + tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x01); + msleep(130); + break; + case 1: + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, + 0x02, 0x01); + msleep(10); + break; + + case 2: + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_CLK, 0); + if (rc<0) + return rc; + msleep(100); + rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, + TM6000_GPIO_CLK, 1); + msleep(100); + break; + } + } + return (rc); +} + static void tm6000_config_tuner (struct tm6000_core *dev) { struct tuner_setup tun_setup; @@ -202,6 +257,8 @@ static void tm6000_config_tuner (struct tm6000_core *dev) memset(&tun_setup, 0, sizeof(tun_setup)); tun_setup.type = dev->tuner_type; tun_setup.addr = dev->tuner_addr; + tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; + tun_setup.tuner_callback = tm6000_tuner_callback; v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup); diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index e9ad51617561..7a296ec82278 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -203,62 +203,6 @@ static void dec_use(struct i2c_adapter *adap) msleep (10); \ } -/* Tuner callback to provide the proper gpio changes needed for xc2028 */ - -static int tm6000_tuner_callback(void *ptr, int command, int arg) -{ - int rc=0; - struct tm6000_core *dev = ptr; - - if (dev->tuner_type!=TUNER_XC2028) - return 0; - - switch (command) { - case XC2028_RESET_CLK: - tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, - 0x02, arg); - msleep(10); - rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_CLK, 0); - if (rc<0) - return rc; - msleep(10); - rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_CLK, 1); - break; - case XC2028_TUNER_RESET: - /* Reset codes during load firmware */ - switch (arg) { - case 0: - tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - dev->tuner_reset_gpio, 0x00); - msleep(130); - tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - dev->tuner_reset_gpio, 0x01); - msleep(130); - break; - case 1: - tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, - 0x02, 0x01); - msleep(10); - break; - - case 2: - rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_CLK, 0); - if (rc<0) - return rc; - msleep(100); - rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - TM6000_GPIO_CLK, 1); - msleep(100); - break; - } - } - return (rc); -} - - static struct i2c_algorithm tm6000_algo = { .master_xfer = tm6000_i2c_xfer, .functionality = functionality, diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 8e93eb0bc8f6..fc5a9089ab68 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1299,7 +1299,7 @@ static int vidioc_s_frequency (struct file *file, void *priv, // mutex_lock(&dev->lock); dev->freq = f->frequency; - v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, &f); + v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f); // mutex_unlock(&dev->lock); return 0; @@ -1309,9 +1309,9 @@ static int vidioc_s_frequency (struct file *file, void *priv, File operations for the device ------------------------------------------------------------------*/ -static int tm6000_open(struct inode *inode, struct file *file) +static int tm6000_open(struct file *file) { - int minor = iminor(inode); + int minor = video_devdata(file)->minor; struct tm6000_core *h,*dev = NULL; struct tm6000_fh *fh; struct list_head *list; @@ -1432,11 +1432,11 @@ tm6000_poll(struct file *file, struct poll_table_struct *wait) return 0; } -static int tm6000_release(struct inode *inode, struct file *file) +static int tm6000_release(struct file *file) { struct tm6000_fh *fh = file->private_data; struct tm6000_core *dev = fh->dev; - int minor = iminor(inode); + int minor = video_devdata(file)->minor; dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users); @@ -1462,7 +1462,7 @@ static int tm6000_mmap(struct file *file, struct vm_area_struct * vma) return ret; } -static struct file_operations tm6000_fops = { +static struct v4l2_file_operations tm6000_fops = { .owner = THIS_MODULE, .open = tm6000_open, .release = tm6000_release, @@ -1470,7 +1470,6 @@ static struct file_operations tm6000_fops = { .read = tm6000_read, .poll = tm6000_poll, .mmap = tm6000_mmap, - .llseek = no_llseek, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { -- GitLab From 1fade8d9fc8ff37866fd1d4a060133fa31dbeb95 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Sep 2009 23:13:53 -0300 Subject: [PATCH 078/534] V4L/DVB (12854): tm6000: i2c addresses should now be specified in 7bit formats Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index f848840c8a85..fd9ee77aee52 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -76,7 +76,7 @@ struct tm6000_board tm6000_boards[] = { .name = "Generic tm5600 board", .type = TM5600, .tuner_type = TUNER_XC2028, - .tuner_addr = 0xc2, + .tuner_addr = 0xc2 >> 1, .caps = { .has_tuner = 1, }, @@ -85,7 +85,7 @@ struct tm6000_board tm6000_boards[] = { [TM6000_BOARD_GENERIC] = { .name = "Generic tm6000 board", .tuner_type = TUNER_XC2028, - .tuner_addr = 0xc2, + .tuner_addr = 0xc2 >> 1, .caps = { .has_tuner = 1, .has_dvb = 1, @@ -96,7 +96,7 @@ struct tm6000_board tm6000_boards[] = { .name = "Generic tm6010 board", .type = TM6010, .tuner_type = TUNER_XC2028, - .tuner_addr = 0xc2, + .tuner_addr = 0xc2 >> 1, .caps = { .has_tuner = 1, .has_dvb = 1, @@ -107,7 +107,7 @@ struct tm6000_board tm6000_boards[] = { .name = "10Moons UT 821", .tuner_type = TUNER_XC2028, .type = TM5600, - .tuner_addr = 0xc2, + .tuner_addr = 0xc2 >> 1, .caps = { .has_tuner = 1, .has_eeprom = 1, @@ -117,7 +117,7 @@ struct tm6000_board tm6000_boards[] = { [TM5600_BOARD_10MOONS_UT330] = { .name = "10Moons UT 330", .tuner_type = TUNER_PHILIPS_FQ1216AME_MK4, - .tuner_addr = 0xc8, + .tuner_addr = 0xc8 >> 1, .caps = { .has_tuner = 1, .has_dvb = 0, @@ -128,7 +128,7 @@ struct tm6000_board tm6000_boards[] = { [TM6000_BOARD_ADSTECH_DUAL_TV] = { .name = "ADSTECH Dual TV USB", .tuner_type = TUNER_XC2028, - .tuner_addr = 0xc8, + .tuner_addr = 0xc8 >> 1, .caps = { .has_tuner = 1, .has_tda9874 = 1, @@ -140,8 +140,8 @@ struct tm6000_board tm6000_boards[] = { [TM6000_BOARD_FREECOM_AND_SIMILAR] = { .name = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual", .tuner_type = TUNER_XC2028, /* has a XC3028 */ - .tuner_addr = 0xc2, - .demod_addr = 0x1e, + .tuner_addr = 0xc2 >> 1, + .demod_addr = 0x1e >> 1, .caps = { .has_tuner = 1, .has_dvb = 1, @@ -154,8 +154,8 @@ struct tm6000_board tm6000_boards[] = { [TM6000_BOARD_ADSTECH_MINI_DUAL_TV] = { .name = "ADSTECH Mini Dual TV USB", .tuner_type = TUNER_XC2028, /* has a XC3028 */ - .tuner_addr = 0xc8, - .demod_addr = 0x1e, + .tuner_addr = 0xc8 >> 1, + .demod_addr = 0x1e >> 1, .caps = { .has_tuner = 1, .has_dvb = 1, @@ -167,8 +167,8 @@ struct tm6000_board tm6000_boards[] = { [TM6010_BOARD_HAUPPAUGE_900H] = { .name = "Hauppauge HVR-900H", .tuner_type = TUNER_XC2028, /* has a XC3028 */ - .tuner_addr = 0xc2, - .demod_addr = 0x1e, + .tuner_addr = 0xc2 >> 1, + .demod_addr = 0x1e >> 1, .type = TM6010, .caps = { .has_tuner = 1, -- GitLab From bfc42b9a48467586296e4c3bbc5f48d814e2a00f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 18 Sep 2009 01:44:24 -0300 Subject: [PATCH 079/534] tm6000: Remove legacy code to work with older kernel versions Such code has no space upstream and prevents tm6000 from compiling. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 7a296ec82278..4da10f5ea024 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -179,18 +179,6 @@ static u32 functionality(struct i2c_adapter *adap) return I2C_FUNC_SMBUS_EMUL; } -#ifndef I2C_PEC -static void inc_use(struct i2c_adapter *adap) -{ - MOD_INC_USE_COUNT; -} - -static void dec_use(struct i2c_adapter *adap) -{ - MOD_DEC_USE_COUNT; -} -#endif - #define mass_write(addr, reg, data...) \ { const static u8 _val[] = data; \ rc=tm6000_read_write_usb(dev,USB_DIR_OUT | USB_TYPE_VENDOR, \ @@ -209,12 +197,7 @@ static struct i2c_algorithm tm6000_algo = { }; static struct i2c_adapter tm6000_adap_template = { -#ifdef I2C_PEC .owner = THIS_MODULE, -#else - .inc_use = inc_use, - .dec_use = dec_use, -#endif .class = I2C_CLASS_TV_ANALOG, .name = "tm6000", .id = I2C_HW_B_TM6000, -- GitLab From 1eefd763fb482e5a325c68b6889c699de4b7dc16 Mon Sep 17 00:00:00 2001 From: Dmitri Belimov Date: Tue, 10 Nov 2009 01:37:43 -0300 Subject: [PATCH 080/534] V4L/DVB (13403): Add new TV cards of Beholder Add new TV cards of Beholder for autodetect. With my best regards, Dmitry. Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index fd9ee77aee52..de1aa65ffb35 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -32,6 +32,7 @@ #include "tm6000.h" #include "tm6000-regs.h" #include "tuner-xc2028.h" +#include "tuner-xc5000.h" #define TM6000_BOARD_UNKNOWN 0 #define TM5600_BOARD_GENERIC 1 @@ -178,6 +179,36 @@ struct tm6000_board tm6000_boards[] = { }, .gpio_addr_tun_reset = TM6000_GPIO_2, }, + [TM6010_BOARD_BEHOLD_WANDER] = { + .name = "Beholder Wander DVB-T/TV/FM USB2.0", + .tuner_type = TUNER_XC5000, + .tuner_addr = 0xc2 >> 1, + .demod_addr = 0x1e >> 1, + .type = TM6010, + .caps = { + .has_tuner = 1, + .has_dvb = 1, + .has_zl10353 = 1, + .has_eeprom = 1, + .has_remote = 1, + }, + .gpio_addr_tun_reset = TM6000_GPIO_2, + }, + [TM6010_BOARD_BEHOLD_VOYAGER] = { + .name = "Beholder Voyager TV/FM USB2.0", + .tuner_type = TUNER_XC5000, + .tuner_addr = 0xc2 >> 1, + .type = TM6010, + .caps = { + .has_tuner = 1, + .has_dvb = 0, + .has_zl10353 = 0, + .has_eeprom = 1, + .has_remote = 1, + }, + .gpio_addr_tun_reset = TM6000_GPIO_2, + }, + }; /* table of devices that work with this driver */ @@ -188,6 +219,8 @@ struct usb_device_id tm6000_id_table [] = { { USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR }, { USB_DEVICE(0x06e1, 0xb339), .driver_info = TM6000_BOARD_ADSTECH_MINI_DUAL_TV }, { USB_DEVICE(0x2040, 0x6600), .driver_info = TM6010_BOARD_HAUPPAUGE_900H }, + { USB_DEVICE(0x6000, 0xdec0), .driver_info = TM6010_BOARD_BEHOLD_WANDER }, + { USB_DEVICE(0x6000, 0xdec1), .driver_info = TM6010_BOARD_BEHOLD_VOYAGER }, { }, }; -- GitLab From 0a34df5359ea153bf6f756c0c9db2ca2bc002cf4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 18 May 2010 00:43:18 -0300 Subject: [PATCH 081/534] V4L/DVB (13555a): v4l: Use video_device_node_name() instead of the minor number Instead of using the minor number in kernel log messages, use the device node name as returned by the video_device_node_name() function. This makes debug, informational and error messages easier to understand for end users. [mchehab.redhat.com: apply just the tm6000 changes on a separate patch] Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index fc5a9089ab68..d853f82f443d 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1311,18 +1311,18 @@ static int vidioc_s_frequency (struct file *file, void *priv, static int tm6000_open(struct file *file) { - int minor = video_devdata(file)->minor; - struct tm6000_core *h,*dev = NULL; + struct video_device *vdev = video_devdata(file); + struct tm6000_core *dev = video_drvdata(file); struct tm6000_fh *fh; struct list_head *list; enum v4l2_buf_type type = 0; int i,rc; - printk(KERN_INFO "tm6000: open called (minor=%d)\n",minor); + printk(KERN_INFO "tm6000: open called (dev=%s)\n", + video_device_node_name(vdev)); - - dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called " - "(minor=%d)\n",minor); + dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called (dev=%s)\n", + video_device_node_name(vdev)); list_for_each(list,&tm6000_corelist) { h = list_entry(list, struct tm6000_core, tm6000_corelist); @@ -1338,8 +1338,9 @@ static int tm6000_open(struct file *file) /* If more than one user, mutex should be added */ dev->users++; - dprintk(dev, V4L2_DEBUG_OPEN, "open minor=%d type=%s users=%d\n", - minor,v4l2_type_names[type],dev->users); + dprintk(dev, V4L2_DEBUG_OPEN, "open dev=%s type=%s users=%d\n", + video_device_node_name(vdev), v4l2_type_names[type], + dev->users); /* allocate + initialize per filehandle data */ fh = kzalloc(sizeof(*fh),GFP_KERNEL); @@ -1436,9 +1437,10 @@ static int tm6000_release(struct file *file) { struct tm6000_fh *fh = file->private_data; struct tm6000_core *dev = fh->dev; - int minor = video_devdata(file)->minor; + struct video_device *vdev = video_devdata(file); - dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users); + dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (dev=%s, users=%d)\n", + video_device_node_name(vdev), dev->users); dev->users--; -- GitLab From 833724afc0e60fe94da64beb9e1afd390a9948a4 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 10 Dec 2009 11:55:34 -0200 Subject: [PATCH 082/534] V4L/DVB (13556a): v4l: Remove unneeded video_device::minor assignments Now that the video_device registration is tested using video_is_registered(), drivers don't need to initialize the video_device::minor field to -1 anymore. Remove those unneeded assignments. [mchehab.redhat.com: apply just the tm6000 changes on a separate patch] Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index d853f82f443d..217721f2195c 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1506,7 +1506,6 @@ static struct video_device tm6000_template = { .name = "tm6000", .fops = &tm6000_fops, .ioctl_ops = &video_ioctl_ops, - .minor = -1, .release = video_device_release, .tvnorms = TM6000_STD, .current_norm = V4L2_STD_NTSC_M, -- GitLab From 70ca3c4b9a722b24626ffe81bdfd7d1a6824f175 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Tue, 19 Jan 2010 01:38:45 -0300 Subject: [PATCH 083/534] V4L/DVB: xc3028: fix regression in firmware loading time Fix a regression in the firmware loading time where it went from 1080 ms to 4700 ms. This was noticed when the em28xx based HVR-950 took noticably longer to load the driver. Regression introduced in hg 12824. The developer added an msleep() call with an argument based on a newly introduced xc3028_ctrl field, which is left initialized to zero for pretty much every board that is currently supported. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tuner-xc2028.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index 61a7e138c748..b6ce528e1889 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c @@ -100,7 +100,8 @@ struct xc2028_data { if (size != _rc) \ tuner_info("i2c output error: rc = %d (should be %d)\n",\ _rc, (int)size); \ - msleep(priv->ctrl.msleep); \ + if (priv->ctrl.msleep) \ + msleep(priv->ctrl.msleep); \ _rc; \ }) @@ -120,7 +121,8 @@ struct xc2028_data { if (isize != _rc) \ tuner_err("i2c input error: rc = %d (should be %d)\n", \ _rc, (int)isize); \ - msleep(priv->ctrl.msleep); \ + if (priv->ctrl.msleep) \ + msleep(priv->ctrl.msleep); \ _rc; \ }) @@ -131,7 +133,7 @@ struct xc2028_data { (_rc = tuner_i2c_xfer_send(&priv->i2c_props, \ _val, sizeof(_val)))) { \ tuner_err("Error on line %d: %d\n", __LINE__, _rc); \ - } else \ + } else if (priv->ctrl.msleep) \ msleep(priv->ctrl.msleep); \ _rc; \ }) @@ -1009,7 +1011,8 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */, The reset CLK is needed only with tm6000. Driver should work fine even if this fails. */ - msleep(priv->ctrl.msleep); + if (priv->ctrl.msleep) + msleep(priv->ctrl.msleep); do_tuner_callback(fe, XC2028_RESET_CLK, 1); msleep(10); -- GitLab From 7dcc51b7346c4d4730eb8ffe1b8a92ed31d263bf Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Wed, 3 Feb 2010 18:48:24 -0300 Subject: [PATCH 084/534] V4L/DVB: tm6000: fix driver compilation The name of xc5000.h include file were wrong Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index de1aa65ffb35..9e8f1fbcceb5 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -32,7 +32,7 @@ #include "tm6000.h" #include "tm6000-regs.h" #include "tuner-xc2028.h" -#include "tuner-xc5000.h" +#include "xc5000.h" #define TM6000_BOARD_UNKNOWN 0 #define TM5600_BOARD_GENERIC 1 -- GitLab From c733a4d5b8c75ecf8d3369c2c2ba3bb1438d67f1 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Wed, 3 Feb 2010 17:27:23 -0300 Subject: [PATCH 085/534] V4L/DVB: tm6000: add digital init for tm6010 The init sequence requires extra initialization for tm6010 in digital mode. Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 72 ++++++++++++++++++---------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index d41af1d6c66a..7ec13d52d810 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -219,33 +219,53 @@ int tm6000_init_analog_mode (struct tm6000_core *dev) int tm6000_init_digital_mode (struct tm6000_core *dev) { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00ff, 0x08); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00ff, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x003f, 0x01); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00df, 0x08); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e2, 0x0c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e8, 0xff); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0xd8); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c0, 0x40); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c1, 0xd0); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c3, 0x09); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00da, 0x37); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d1, 0xd8); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d2, 0xc0); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d6, 0x60); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e2, 0x0c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e8, 0xff); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0x08); - msleep(50); - - tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00); - msleep(50); - tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x01); - msleep(50); - tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00); - msleep(100); + if (dev->dev_type == TM6010) { + int val; + u8 buf[2]; + /* digital init */ + val = tm6000_get_reg(dev, REQ_07_SET_GET_AVREG, 0xcc, 0); + val &= ~0x60; + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xcc, val); + val = tm6000_get_reg(dev, REQ_07_SET_GET_AVREG, 0xc0, 0); + val |= 0x40; + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xc0, val); + tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xfe, 0x28); + tm6000_set_reg(dev, REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xfc); + tm6000_set_reg(dev, REQ_08_SET_GET_AVREG_BIT, 0xe6, 0xff); + tm6000_set_reg(dev, REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe); + tm6000_read_write_usb (dev, 0xc0, 0x0e, 0x00c2, 0x0008, buf, 2); + printk (KERN_INFO "buf %#x %#x \n", buf[0], buf[1]); + + + } else { + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00ff, 0x08); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00ff, 0x00); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x003f, 0x01); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00df, 0x08); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e2, 0x0c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e8, 0xff); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0xd8); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c0, 0x40); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c1, 0xd0); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c3, 0x09); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00da, 0x37); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d1, 0xd8); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d2, 0xc0); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d6, 0x60); + + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e2, 0x0c); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e8, 0xff); + tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0x08); + msleep(50); + + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00); + msleep(50); + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x01); + msleep(50); + tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 0x0020, 0x00); + msleep(100); + } return 0; } -- GitLab From 9d3aeb5f00a78743daa0c077add8cac29e6084b6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 8 Feb 2010 08:48:22 -0200 Subject: [PATCH 086/534] V4L-DVB: tm6000: add missing BEHOLDER board definitions The missing of those board definitions break compilation Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 9e8f1fbcceb5..16d49c6ba0a6 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -44,6 +44,8 @@ #define TM6000_BOARD_FREECOM_AND_SIMILAR 7 #define TM6000_BOARD_ADSTECH_MINI_DUAL_TV 8 #define TM6010_BOARD_HAUPPAUGE_900H 9 +#define TM6010_BOARD_BEHOLD_WANDER 10 +#define TM6010_BOARD_BEHOLD_VOYAGER 11 #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; -- GitLab From 04574a6881cd4b49b49ba95f893520dabe1d76f5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 8 Feb 2010 08:50:02 -0200 Subject: [PATCH 087/534] V4L/DVB: tm6000: add Terratec Cinergy Hybrid XE [mchehab@redhat.com: moved the defines for the two beholder boards to a separate commit ] Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 16d49c6ba0a6..f6be4c5d88ca 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -46,6 +46,7 @@ #define TM6010_BOARD_HAUPPAUGE_900H 9 #define TM6010_BOARD_BEHOLD_WANDER 10 #define TM6010_BOARD_BEHOLD_VOYAGER 11 +#define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE 12 #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; @@ -210,7 +211,21 @@ struct tm6000_board tm6000_boards[] = { }, .gpio_addr_tun_reset = TM6000_GPIO_2, }, - + [TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = { + .name = "Terratec Cinergy Hybrid XE", + .tuner_type = TUNER_XC2028, /* has a XC3028 */ + .tuner_addr = 0xc2 >> 1, + .demod_addr = 0x1e >> 1, + .type = TM6010, + .caps = { + .has_tuner = 1, + .has_dvb = 1, + .has_zl10353 = 1, + .has_eeprom = 1, + .has_remote = 1, + }, + .gpio_addr_tun_reset = TM6010_GPIO_2, + } }; /* table of devices that work with this driver */ @@ -223,6 +238,7 @@ struct usb_device_id tm6000_id_table [] = { { USB_DEVICE(0x2040, 0x6600), .driver_info = TM6010_BOARD_HAUPPAUGE_900H }, { USB_DEVICE(0x6000, 0xdec0), .driver_info = TM6010_BOARD_BEHOLD_WANDER }, { USB_DEVICE(0x6000, 0xdec1), .driver_info = TM6010_BOARD_BEHOLD_VOYAGER }, + { USB_DEVICE(0x0ccd, 0x0086), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE }, { }, }; @@ -313,6 +329,7 @@ static void tm6000_config_tuner (struct tm6000_core *dev) switch(dev->model) { case TM6010_BOARD_HAUPPAUGE_900H: + case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: ctl.fname = "xc3028L-v36.fw"; break; default: -- GitLab From 80af6bb73e52c614e0571f82e4dd88a6941066a4 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Fri, 5 Feb 2010 19:57:02 -0300 Subject: [PATCH 088/534] V4L/DVB: tm6000: fix: avoid unregister the driver after success After successfully running tm6000_init_dev, due to a lack of a return(), the driver runs the error code, unregistering the device. Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index f6be4c5d88ca..e1a6c1666543 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -421,6 +421,7 @@ static int tm6000_init_dev(struct tm6000_core *dev) } #endif } + return 0; err2: v4l2_device_unregister(&dev->v4l2_dev); -- GitLab From 7b96640e8f79c0e382eba1a11486da11a60d0df3 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Fri, 5 Feb 2010 19:57:03 -0300 Subject: [PATCH 089/534] V4L/DVB: tm6000: typo fix: the identifer string is wrong Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index e1a6c1666543..3f4eb0516406 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -479,7 +479,7 @@ static int tm6000_usb_probe(struct usb_interface *interface, /* Check to see next free device and mark as used */ nr=find_first_zero_bit(&tm6000_devused,TM6000_MAXBOARDS); if (nr >= TM6000_MAXBOARDS) { - printk ("tm6000: Supports only %i em28xx boards.\n",TM6000_MAXBOARDS); + printk ("tm6000: Supports only %i tm60xx boards.\n",TM6000_MAXBOARDS); usb_put_dev(usbdev); return -ENOMEM; } -- GitLab From 20cabed421399a5f0f1b33742d765cbdfad4ac79 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Fri, 5 Feb 2010 19:57:04 -0300 Subject: [PATCH 090/534] V4L/DVB: tm6000: add special usb request to quit i2c tuner transfer After sending an i2c command, tm6010 needs a reset, in order to properly work. While here, add the missing I2C_CLASS_TV_DIGITAL i2c class. Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 4da10f5ea024..05df06badd83 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -86,6 +86,11 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, msgs[i].len == 1 ? 0 : msgs[i].buf[1], msgs[i + 1].buf, msgs[i + 1].len); i++; + + if ((dev->dev_type == TM6010) && (addr == 0xc2)) { + tm6000_set_reg(dev, 0x32, 0,0); + tm6000_set_reg(dev, 0x33, 0,0); + } if (i2c_debug >= 2) for (byte = 0; byte < msgs[i].len; byte++) printk(" %02x", msgs[i].buf[byte]); @@ -99,6 +104,11 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, REQ_16_SET_GET_I2C_WR1_RDN, addr | msgs[i].buf[0] << 8, 0, msgs[i].buf + 1, msgs[i].len - 1); + + if ((dev->dev_type == TM6010) && (addr == 0xc2)) { + tm6000_set_reg(dev, 0x32, 0,0); + tm6000_set_reg(dev, 0x33, 0,0); + } } if (i2c_debug >= 2) printk("\n"); @@ -198,7 +208,7 @@ static struct i2c_algorithm tm6000_algo = { static struct i2c_adapter tm6000_adap_template = { .owner = THIS_MODULE, - .class = I2C_CLASS_TV_ANALOG, + .class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, .name = "tm6000", .id = I2C_HW_B_TM6000, .algo = &tm6000_algo, -- GitLab From e78c8f22b536e646032dd9b9f396305d0893e0cd Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Fri, 5 Feb 2010 19:57:06 -0300 Subject: [PATCH 091/534] V4L/DVB: tm6000: add tuner callback for dvb frontend Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 2 +- drivers/staging/tm6000/tm6000-dvb.c | 1 + drivers/staging/tm6000/tm6000.h | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 3f4eb0516406..e42092f54c72 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -244,7 +244,7 @@ struct usb_device_id tm6000_id_table [] = { /* Tuner callback to provide the proper gpio changes needed for xc2028 */ -static int tm6000_tuner_callback(void *ptr, int component, int command, int arg) +int tm6000_tuner_callback(void *ptr, int component, int command, int arg) { int rc=0; struct tm6000_core *dev = ptr; diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index e900d6ddea30..f54f6d9ea6f4 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -236,6 +236,7 @@ int tm6000_dvb_register(struct tm6000_core *dev) .i2c_addr = dev->tuner_addr, }; + dvb->frontend->callback = tm6000_tuner_callback; ret = dvb_register_frontend(&dvb->adapter, dvb->frontend); if (ret < 0) { printk(KERN_ERR diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 54dbdb91c52f..125391c20d05 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -203,6 +203,9 @@ struct tm6000_fh { V4L2_STD_PAL_M|V4L2_STD_PAL_60|V4L2_STD_NTSC_M| \ V4L2_STD_NTSC_M_JP|V4L2_STD_SECAM +/* In tm6000-cards.c */ + +int tm6000_tuner_callback (void *ptr, int component, int command, int arg); /* In tm6000-core.c */ int tm6000_read_write_usb (struct tm6000_core *dev, u8 reqtype, u8 req, -- GitLab From 58b2f4bd5f58e544bd19f91e240e0972b1990b13 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Fri, 5 Feb 2010 19:57:07 -0300 Subject: [PATCH 092/534] V4L/DVB: tm6000: add tuner parameter for DVB devices Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index e42092f54c72..0a70c19df9e3 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -308,7 +308,7 @@ static void tm6000_config_tuner (struct tm6000_core *dev) memset(&tun_setup, 0, sizeof(tun_setup)); tun_setup.type = dev->tuner_type; tun_setup.addr = dev->tuner_addr; - tun_setup.mode_mask = T_ANALOG_TV | T_RADIO; + tun_setup.mode_mask = T_ANALOG_TV | T_RADIO | T_DIGITAL_TV; tun_setup.tuner_callback = tm6000_tuner_callback; v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup); @@ -320,10 +320,12 @@ static void tm6000_config_tuner (struct tm6000_core *dev) memset(&xc2028_cfg, 0, sizeof(xc2028_cfg)); memset (&ctl,0,sizeof(ctl)); - ctl.mts = 1; - ctl.read_not_reliable = 1; + ctl.input1 = 1; + ctl.read_not_reliable = 0; ctl.msleep = 10; - + ctl.demod = XC3028_FE_ZARLINK456; + ctl.vhfbw7 = 1; + ctl.uhfbw8 = 1; xc2028_cfg.tuner = TUNER_XC2028; xc2028_cfg.priv = &ctl; -- GitLab From 3a5de48a8783eeb17db7b63d50ba85c31ab7b9ef Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Fri, 5 Feb 2010 19:57:08 -0300 Subject: [PATCH 093/534] V4L/DVB: tm6000: remove unused function Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 125391c20d05..b4b603204ed4 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -213,7 +213,6 @@ int tm6000_read_write_usb (struct tm6000_core *dev, u8 reqtype, u8 req, int tm6000_get_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index); int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index); int tm6000_init (struct tm6000_core *dev); -int tm6000_init_after_firmware (struct tm6000_core *dev); int tm6000_init_analog_mode (struct tm6000_core *dev); int tm6000_init_digital_mode (struct tm6000_core *dev); -- GitLab From 08e60ba0c1c88f86f44909a1b3b8de9960b94c2e Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Fri, 5 Feb 2010 20:06:52 -0300 Subject: [PATCH 094/534] V4L/DVB: tm6000: Fix several bugs at the usb DVB transfer Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-dvb.c | 123 ++++++++++++++++++---------- 1 file changed, 78 insertions(+), 45 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index f54f6d9ea6f4..97bc2d14878e 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -17,7 +17,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include +#include #include "tm6000.h" #include "tm6000-regs.h" @@ -30,13 +32,58 @@ #include "tuner-xc2028.h" +static void inline print_err_status (struct tm6000_core *dev, + int packet, int status) +{ + char *errmsg = "Unknown"; + + switch(status) { + case -ENOENT: + errmsg = "unlinked synchronuously"; + break; + case -ECONNRESET: + errmsg = "unlinked asynchronuously"; + break; + case -ENOSR: + errmsg = "Buffer error (overrun)"; + break; + case -EPIPE: + errmsg = "Stalled (device not responding)"; + break; + case -EOVERFLOW: + errmsg = "Babble (bad cable?)"; + break; + case -EPROTO: + errmsg = "Bit-stuff error (bad cable?)"; + break; + case -EILSEQ: + errmsg = "CRC/Timeout (could be anything)"; + break; + case -ETIME: + errmsg = "Device does not respond"; + break; + } + if (packet<0) { + dprintk(dev, 1, "URB status %d [%s].\n", + status, errmsg); + } else { + dprintk(dev, 1, "URB packet %d, status %d [%s].\n", + packet, status, errmsg); + } +} + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) +static void tm6000_urb_received(struct urb *urb, struct pt_regs *ptregs) +#else static void tm6000_urb_received(struct urb *urb) +#endif { int ret; struct tm6000_core* dev = urb->context; - if(urb->status != 0){ - printk(KERN_ERR "tm6000: status != 0\n"); + if(urb->status != 0) { + print_err_status (dev,0,urb->status); } else if(urb->actual_length>0){ dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer, @@ -56,49 +103,37 @@ static void tm6000_urb_received(struct urb *urb) int tm6000_start_stream(struct tm6000_core *dev) { int ret; - unsigned int pipe, maxPaketSize; + unsigned int pipe, size; struct tm6000_dvb *dvb = dev->dvb; printk(KERN_INFO "tm6000: got start stream request %s\n",__FUNCTION__); tm6000_init_digital_mode(dev); -/* - ret = tm6000_set_led_status(tm6000_dev, 0x1); - if(ret < 0) { - return -1; - } -*/ - dvb->bulk_urb = usb_alloc_urb(0, GFP_KERNEL); if(dvb->bulk_urb == NULL) { printk(KERN_ERR "tm6000: couldn't allocate urb\n"); return -ENOMEM; } - maxPaketSize = dev->bulk_in->desc.wMaxPacketSize; + pipe = usb_rcvbulkpipe(dev->udev, dev->bulk_in->desc.bEndpointAddress + & USB_ENDPOINT_NUMBER_MASK); + + size = usb_maxpacket(dev->udev, pipe, usb_pipeout(pipe)); + size = size * 15; /* 512 x 8 or 12 or 15 */ - dvb->bulk_urb->transfer_buffer = kzalloc(maxPaketSize, GFP_KERNEL); + dvb->bulk_urb->transfer_buffer = kzalloc(size, GFP_KERNEL); if(dvb->bulk_urb->transfer_buffer == NULL) { usb_free_urb(dvb->bulk_urb); printk(KERN_ERR "tm6000: couldn't allocate transfer buffer!\n"); return -ENOMEM; } - pipe = usb_rcvbulkpipe(dev->udev, dev->bulk_in->desc.bEndpointAddress - & USB_ENDPOINT_NUMBER_MASK); - usb_fill_bulk_urb(dvb->bulk_urb, dev->udev, pipe, dvb->bulk_urb->transfer_buffer, - maxPaketSize, + size, tm6000_urb_received, dev); - ret = usb_set_interface(dev->udev, 0, 1); - if(ret < 0) { - printk(KERN_ERR "tm6000: error %i in %s during set interface\n", ret, __FUNCTION__); - return ret; - } - ret = usb_clear_halt(dev->udev, pipe); if(ret < 0) { printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",ret,__FUNCTION__); @@ -108,11 +143,10 @@ int tm6000_start_stream(struct tm6000_core *dev) printk(KERN_ERR "tm6000: pipe resetted\n"); } -// mutex_lock(&tm6000_driver.open_close_mutex); +/* mutex_lock(&tm6000_driver.open_close_mutex); */ ret = usb_submit_urb(dvb->bulk_urb, GFP_KERNEL); - -// mutex_unlock(&tm6000_driver.open_close_mutex); +/* mutex_unlock(&tm6000_driver.open_close_mutex); */ if (ret) { printk(KERN_ERR "tm6000: submit of urb failed (error=%i)\n",ret); @@ -126,18 +160,12 @@ int tm6000_start_stream(struct tm6000_core *dev) void tm6000_stop_stream(struct tm6000_core *dev) { - int ret; struct tm6000_dvb *dvb = dev->dvb; -// tm6000_set_led_status(tm6000_dev, 0x0); - - ret = usb_set_interface(dev->udev, 0, 0); - if(ret < 0) { - printk(KERN_ERR "tm6000: error %i in %s during set interface\n",ret,__FUNCTION__); - } - if(dvb->bulk_urb) { + printk (KERN_INFO "urb killing\n"); usb_kill_urb(dvb->bulk_urb); + printk (KERN_INFO "urb buffer free\n"); kfree(dvb->bulk_urb->transfer_buffer); usb_free_urb(dvb->bulk_urb); dvb->bulk_urb = NULL; @@ -154,7 +182,7 @@ int tm6000_start_feed(struct dvb_demux_feed *feed) mutex_lock(&dvb->mutex); if(dvb->streams == 0) { dvb->streams = 1; -// mutex_init(&tm6000_dev->streaming_mutex); +/* mutex_init(&tm6000_dev->streming_mutex); */ tm6000_start_stream(dev); } else { @@ -173,14 +201,16 @@ int tm6000_stop_feed(struct dvb_demux_feed *feed) { printk(KERN_INFO "tm6000: got stop feed request %s\n",__FUNCTION__); mutex_lock(&dvb->mutex); - --dvb->streams; - if(0 == dvb->streams) { + printk (KERN_INFO "stream %#x\n", dvb->streams); + --(dvb->streams); + if(dvb->streams == 0) { + printk (KERN_INFO "stop stream\n"); tm6000_stop_stream(dev); -// mutex_destroy(&tm6000_dev->streaming_mutex); +/* mutex_destroy(&tm6000_dev->streaming_mutex); */ } mutex_unlock(&dvb->mutex); -// mutex_destroy(&tm6000_dev->streaming_mutex); +/* mutex_destroy(&tm6000_dev->streaming_mutex); */ return 0; } @@ -191,13 +221,16 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev) if(dev->caps.has_zl10353) { struct zl10353_config config = - {.demod_address = dev->demod_addr >> 1, + {.demod_address = dev->demod_addr, .no_tuner = 1, -// .input_frequency = 0x19e9, -// .r56_agc_targets = 0x1c, + .parallel_ts = 1, + .if2 = 45700, + .disable_i2c_gate_ctrl = 1, + .tm6000 = 1, }; dvb->frontend = pseudo_zl10353_attach(dev, &config, +/* dvb->frontend = dvb_attach (zl10353_attach, &config, */ &dev->i2c_adap); } else { @@ -259,8 +292,8 @@ int tm6000_dvb_register(struct tm6000_core *dev) dvb->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING; dvb->demux.priv = dev; - dvb->demux.filternum = 256; - dvb->demux.feednum = 256; + dvb->demux.filternum = 5; /* 256; */ + dvb->demux.feednum = 5; /* 256; */ dvb->demux.start_feed = tm6000_start_feed; dvb->demux.stop_feed = tm6000_stop_feed; dvb->demux.write_to_decoder = NULL; @@ -308,7 +341,7 @@ void tm6000_dvb_unregister(struct tm6000_core *dev) usb_free_urb(bulk_urb); } -// mutex_lock(&tm6000_driver.open_close_mutex); +/* mutex_lock(&tm6000_driver.open_close_mutex); */ if(dvb->frontend) { dvb_frontend_detach(dvb->frontend); dvb_unregister_frontend(dvb->frontend); @@ -318,6 +351,6 @@ void tm6000_dvb_unregister(struct tm6000_core *dev) dvb_dmx_release(&dvb->demux); dvb_unregister_adapter(&dvb->adapter); mutex_destroy(&dvb->mutex); -// mutex_unlock(&tm6000_driver.open_close_mutex); +/* mutex_unlock(&tm6000_driver.open_close_mutex); */ } -- GitLab From caa0d36cc7c5674c9b8dfab060ea6c36c2a8e62f Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Fri, 5 Feb 2010 20:06:54 -0300 Subject: [PATCH 095/534] V4L/DVB: tm6000: add a different set param values Fix several parameter sets, in order to make dvb work Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/hack.c | 158 +++++++++++++++++++++++++++++++++- 1 file changed, 156 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tm6000/hack.c b/drivers/staging/tm6000/hack.c index f181fce6716b..fdc70788e491 100644 --- a/drivers/staging/tm6000/hack.c +++ b/drivers/staging/tm6000/hack.c @@ -37,7 +37,6 @@ static inline int tm6000_snd_control_msg(struct tm6000_core *dev, __u8 request, static int pseudo_zl10353_pll(struct tm6000_core *tm6000_dev, struct dvb_frontend_parameters *p) { - int ret; u8 *data = kzalloc(50*sizeof(u8), GFP_KERNEL); printk(KERN_ALERT "should set frequency %u\n", p->frequency); @@ -51,7 +50,7 @@ printk(KERN_ALERT "and bandwith %u\n", p->u.ofdm.bandwidth); } // init ZL10353 - data[0] = 0x0b; +/* data[0] = 0x0b; ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x501e, 0x00, data, 0x1); msleep(15); data[0] = 0x80; @@ -189,6 +188,161 @@ printk(KERN_ALERT "and bandwith %u\n", p->u.ofdm.bandwidth); msleep(15); break; } +*/ + switch(p->u.ofdm.bandwidth) { + case BANDWIDTH_8_MHZ: + data[0] = 0x03; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x501e,0,data,1); + msleep(40); + data[0] = 0x44; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x511e,0,data,1); + msleep(40); + data[0] = 0x40; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x551e,0,data,1); + msleep(40); + data[0] = 0x46; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x521e,0,data,1); + msleep(40); + data[0] = 0x15; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x531e,0,data,1); + msleep(40); + data[0] = 0x0f; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x541e,0,data,1); + msleep(40); + data[0] = 0x80; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x551e,0,data,1); + msleep(40); + data[0] = 0x01; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xea1e,0,data,1); + msleep(40); + data[0] = 0x00; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xea1e,0,data,1); + msleep(40); + data[0] = 0x8b; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x631e,0,data,1); + msleep(40); + data[0] = 0x75; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xcc1e,0,data,1); + msleep(40); + data[0] = 0xe6; //0x19; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x6c1e,0,data,1); + msleep(40); + data[0] = 0x09; //0xf7; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x6d1e,0,data,1); + msleep(40); + data[0] = 0x67; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x651e,0,data,1); + msleep(40); + data[0] = 0xe5; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x661e,0,data,1); + msleep(40); + data[0] = 0x75; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5c1e,0,data,1); + msleep(40); + data[0] = 0x17; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5f1e,0,data,1); + msleep(40); + data[0] = 0x40; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5e1e,0,data,1); + msleep(40); + data[0] = 0x01; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x701e,0,data,1); + msleep(40); + break; + case BANDWIDTH_7_MHZ: + data[0] = 0x03; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x501e,0,data,1); + msleep(40); + data[0] = 0x44; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x511e,0,data,1); + msleep(40); + data[0] = 0x40; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x551e,0,data,1); + msleep(40); + data[0] = 0x46; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x521e,0,data,1); + msleep(40); + data[0] = 0x15; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x531e,0,data,1); + msleep(40); + data[0] = 0x0f; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x541e,0,data,1); + msleep(40); + data[0] = 0x80; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x551e,0,data,1); + msleep(40); + data[0] = 0x01; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xea1e,0,data,1); + msleep(40); + data[0] = 0x00; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xea1e,0,data,1); + msleep(40); + data[0] = 0x83; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x631e,0,data,1); + msleep(40); + data[0] = 0xa3; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xcc1e,0,data,1); + msleep(40); + data[0] = 0xe6; //0x19; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x6c1e,0,data,1); + msleep(40); + data[0] = 0x09; //0xf7; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x6d1e,0,data,1); + msleep(40); + data[0] = 0x5a; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x651e,0,data,1); + msleep(40); + data[0] = 0xe9; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x661e,0,data,1); + msleep(40); + data[0] = 0x86; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5c1e,0,data,1); + msleep(40); + data[0] = 0x17; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5f1e,0,data,1); + msleep(40); + data[0] = 0x40; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5e1e,0,data,1); + msleep(40); + data[0] = 0x01; + tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x701e,0,data,1); + msleep(40); + break; + default: + printk(KERN_ALERT "tm6000: bandwidth not supported\n"); + } + + tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); + printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); + msleep(40); + + tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); + printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); + msleep(40); + + tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); + printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); + msleep(40); + + tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); + printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); + msleep(40); + + tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); + printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); + msleep(40); + + tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x0f1f,0,data,2); + printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); + msleep(40); + + tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x091f,0,data,2); + printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); + msleep(40); + + tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x0b1f,0,data,2); + printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); + msleep(40); kfree(data); -- GitLab From 591a0d35a8e9bad1ae2481502ba3b7facb4a0dac Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 8 Feb 2010 08:44:26 -0200 Subject: [PATCH 096/534] V4L/DVB: tm6000: Allow tm6000 driver compilation Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/Kconfig | 2 ++ drivers/staging/Makefile | 1 + drivers/staging/tm6000/Makefile | 3 +++ drivers/staging/tm6000/tm6000-core.c | 1 - drivers/staging/tm6000/tm6000-dvb.c | 7 ------- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 7696a664f8a5..5589616082e7 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -49,6 +49,8 @@ source "drivers/staging/go7007/Kconfig" source "drivers/staging/cx25821/Kconfig" +source "drivers/staging/tm6000/Kconfig" + source "drivers/staging/usbip/Kconfig" source "drivers/staging/winbond/Kconfig" diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index ea2e70e2fed4..ec45d4bb8c11 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_ET131X) += et131x/ obj-$(CONFIG_SLICOSS) += slicoss/ obj-$(CONFIG_VIDEO_GO7007) += go7007/ obj-$(CONFIG_VIDEO_CX25821) += cx25821/ +obj-$(CONFIG_VIDEO_TM6000) += tm6000/ obj-$(CONFIG_USB_IP_COMMON) += usbip/ obj-$(CONFIG_W35UND) += winbond/ obj-$(CONFIG_PRISM2_USB) += wlan-ng/ diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile index 25aefe74dddc..f904d5779c81 100644 --- a/drivers/staging/tm6000/Makefile +++ b/drivers/staging/tm6000/Makefile @@ -13,3 +13,6 @@ obj-$(CONFIG_VIDEO_TM6000) += tm6000.o obj-$(CONFIG_VIDEO_TM6000_ALSA) += tm6000-alsa.o EXTRA_CFLAGS = -Idrivers/media/video +EXTRA_CFLAGS += -Idrivers/media/common/tuners +EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core +EXTRA_CFLAGS += -Idrivers/media/dvb/frontends diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 7ec13d52d810..bc9ec2c9e202 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -24,7 +24,6 @@ #include #include #include -#include #include "tm6000.h" #include "tm6000-regs.h" #include diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index 97bc2d14878e..e16d55efb4f2 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -19,7 +19,6 @@ #include #include -#include #include "tm6000.h" #include "tm6000-regs.h" @@ -72,12 +71,7 @@ static void inline print_err_status (struct tm6000_core *dev, } } - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) -static void tm6000_urb_received(struct urb *urb, struct pt_regs *ptregs) -#else static void tm6000_urb_received(struct urb *urb) -#endif { int ret; struct tm6000_core* dev = urb->context; @@ -226,7 +220,6 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev) .parallel_ts = 1, .if2 = 45700, .disable_i2c_gate_ctrl = 1, - .tm6000 = 1, }; dvb->frontend = pseudo_zl10353_attach(dev, &config, -- GitLab From e3ee9e5ec17767a24848035a1d759af8a03c971f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 8 Feb 2010 08:43:41 -0200 Subject: [PATCH 097/534] V4L/DVB: tm6000: move board-specific init to tm6000-cards Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 72 +++++++++++++++++++++++++++ drivers/staging/tm6000/tm6000-core.c | 49 +----------------- drivers/staging/tm6000/tm6000.h | 3 ++ 3 files changed, 77 insertions(+), 47 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 0a70c19df9e3..e09d75707714 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -297,6 +297,78 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg) return (rc); } +int tm6000_cards_setup(struct tm6000_core *dev) +{ + int i, rc; + + /* + * Board-specific initialization sequence. Handles all GPIO + * initialization sequences that are board-specific. + * Up to now, all found devices use GPIO1 and GPIO4 at the same way. + * Probably, they're all based on some reference device. Due to that, + * there's a common routine at the end to handle those GPIO's. Devices + * that use different pinups or init sequences can just return at + * the board-specific session. + */ + switch (dev->model) { + case TM6010_BOARD_HAUPPAUGE_900H: + /* Turn xceive 3028 on */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_3, 0x01); + msleep(11); + break; + default: + break; + } + + /* + * Default initialization. Most of the devices seem to use GPIO1 + * and GPIO4.on the same way, so, this handles the common sequence + * used by most devices. + * If a device uses a different sequence or different GPIO pins for + * reset, just add the code at the board-specific part + */ + for (i = 0; i < 2; i++) { + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x00); + if (rc < 0) { + printk(KERN_ERR "Error %i doing GPIO1 reset\n", rc); + return rc; + } + + msleep(10); /* Just to be conservative */ + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x01); + if (rc < 0) { + printk(KERN_ERR "Error %i doing GPIO1 reset\n", rc); + return rc; + } + + msleep(10); + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 0); + if (rc < 0) { + printk(KERN_ERR "Error %i doing GPIO4 reset\n", rc); + return rc; + } + + msleep(10); + rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 1); + if (rc < 0) { + printk(KERN_ERR "Error %i doing GPIO4 reset\n", rc); + return rc; + } + + if (!i) { + rc = tm6000_get_reg16(dev, 0x40, 0, 0); + if (rc >= 0) + printk(KERN_DEBUG "board=%d\n", rc); + } + } + + msleep(50); + + return 0; +}; + static void tm6000_config_tuner (struct tm6000_core *dev) { struct tuner_setup tun_setup; diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index bc9ec2c9e202..9d66a3fc091d 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -453,54 +453,9 @@ int tm6000_init (struct tm6000_core *dev) printk (KERN_ERR "Error %i while retrieving board version\n",board); } - if (dev->dev_type == TM6010) { - /* Turn xceive 3028 on */ - tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_3, 0x01); - msleep(11); - } - - /* Reset GPIO1 and GPIO4. */ - for (i=0; i< 2; i++) { - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, - dev->tuner_reset_gpio, 0x00); - if (rc<0) { - printk (KERN_ERR "Error %i doing GPIO1 reset\n",rc); - return rc; - } - - msleep(10); /* Just to be conservative */ - rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, - dev->tuner_reset_gpio, 0x01); - if (rc<0) { - printk (KERN_ERR "Error %i doing GPIO1 reset\n",rc); - return rc; - } - - msleep(10); - rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 0); - if (rc<0) { - printk (KERN_ERR "Error %i doing GPIO4 reset\n",rc); - return rc; - } - - msleep(10); - rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 1); - if (rc<0) { - printk (KERN_ERR "Error %i doing GPIO4 reset\n",rc); - return rc; - } + rc = tm6000_cards_setup(dev); - if (!i) { - rc=tm6000_get_reg16(dev, 0x40,0,0); - if (rc>=0) { - printk ("board=%d\n", rc); - } - } - } - - msleep(50); - - return 0; + return rc; } int tm6000_set_audio_bitrate(struct tm6000_core *dev, int bitrate) diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index b4b603204ed4..3ec5704092fc 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -206,11 +206,14 @@ struct tm6000_fh { /* In tm6000-cards.c */ int tm6000_tuner_callback (void *ptr, int component, int command, int arg); +int tm6000_cards_setup(struct tm6000_core *dev); + /* In tm6000-core.c */ int tm6000_read_write_usb (struct tm6000_core *dev, u8 reqtype, u8 req, u16 value, u16 index, u8 *buf, u16 len); int tm6000_get_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index); +int tm6000_get_reg16(struct tm6000_core *dev, u8 req, u16 value, u16 index); int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index); int tm6000_init (struct tm6000_core *dev); -- GitLab From 29ec15e90ba9e20ff33da4824c32721bbc6bcfad Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 10 Feb 2010 14:53:57 -0300 Subject: [PATCH 098/534] V4L/DVB: tm6000: fix build errors (1) tm6000 uses usb_*() interfaces, so it should depend on USB. drivers/built-in.o: In function `tm6000_usb_disconnect': tm6000-cards.c:(.text+0x4abb44): undefined reference to `usb_put_dev' drivers/built-in.o: In function `tm6000_usb_probe': tm6000-cards.c:(.text+0x4ac923): undefined reference to `usb_get_dev' tm6000-cards.c:(.text+0x4ac93c): undefined reference to `usb_set_interface' drivers/built-in.o: In function `tm6000_read_write_usb': (.text+0x4ad274): undefined reference to `usb_control_msg' drivers/built-in.o: In function `tm6000_uninit_isoc': tm6000-video.c:(.text+0x4b00d5): undefined reference to `usb_kill_urb' tm6000-video.c:(.text+0x4b00e4): undefined reference to `usb_unlink_urb' tm6000-video.c:(.text+0x4b013c): undefined reference to `usb_buffer_free' tm6000-video.c:(.text+0x4b014b): undefined reference to `usb_free_urb' drivers/built-in.o: In function `tm6000_prepare_isoc': tm6000-video.c:(.text+0x4b0773): undefined reference to `usb_alloc_urb' tm6000-video.c:(.text+0x4b0835): undefined reference to `usb_buffer_alloc' drivers/built-in.o: In function `tm6000_irq_callback': tm6000-video.c:(.text+0x4b1ad3): undefined reference to `usb_submit_urb' drivers/built-in.o: In function `tm6000_module_init': tm6000-cards.c:(.init.text+0x24499): undefined reference to `usb_register_driver' drivers/built-in.o: In function `tm6000_module_exit': tm6000-cards.c:(.exit.text+0x5cb0): undefined reference to `usb_deregister' (2) tm6000-alsa uses interfaces from tm6000-core, so when they are both built as modules, the core interfaces need to be exported. ERROR: "tm6000_set_reg" [drivers/staging/tm6000/tm6000-alsa.ko] undefined! ERROR: "tm6000_get_reg" [drivers/staging/tm6000/tm6000-alsa.ko] undefined! Cc: linux-next@vger.kernel.org, LKML , linux-media@vger.kernel.org Signed-off-by: Randy Dunlap Cc: Mauro Carvalho Chehab Cc: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Kconfig | 2 +- drivers/staging/tm6000/tm6000-core.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/Kconfig b/drivers/staging/tm6000/Kconfig index cb2011536363..5fe759cc2ee9 100644 --- a/drivers/staging/tm6000/Kconfig +++ b/drivers/staging/tm6000/Kconfig @@ -1,6 +1,6 @@ config VIDEO_TM6000 tristate "TV Master TM5600/6000/6010 driver" - depends on VIDEO_DEV && I2C && INPUT && EXPERIMENTAL + depends on VIDEO_DEV && I2C && INPUT && USB && EXPERIMENTAL select VIDEO_TUNER select TUNER_XC2028 select VIDEOBUF_VMALLOC diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 9d66a3fc091d..afd03929e5a8 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -108,6 +108,7 @@ int tm6000_set_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index) tm6000_read_write_usb (dev, USB_DIR_OUT | USB_TYPE_VENDOR, req, value, index, NULL, 0); } +EXPORT_SYMBOL_GPL(tm6000_set_reg); int tm6000_get_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index) { @@ -122,6 +123,7 @@ int tm6000_get_reg (struct tm6000_core *dev, u8 req, u16 value, u16 index) return *buf; } +EXPORT_SYMBOL_GPL(tm6000_get_reg); int tm6000_get_reg16 (struct tm6000_core *dev, u8 req, u16 value, u16 index) { -- GitLab From f8960ee7a44d58d79aae063e46f3316e1d5748e0 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 11 Feb 2010 03:30:30 -0300 Subject: [PATCH 099/534] V4L/DVB: drivers/staging/tm6000/tm6000-video.c: correct NULL test Test the just-allocated value for NULL rather than some other value. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,y; statement S; @@ x = \(kmalloc\|kcalloc\|kzalloc\)(...); ( if ((x) == NULL) S | if ( - y + x == NULL) S ) // Signed-off-by: Julia Lawall Acked-by: Greg Kroah-Hartman Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 217721f2195c..627b0ddfcd18 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -644,7 +644,7 @@ static int tm6000_prepare_isoc(struct tm6000_core *dev, unsigned int framesize) dev->isoc_ctl.transfer_buffer = kmalloc(sizeof(void *)*num_bufs, GFP_KERNEL); - if (!dev->isoc_ctl.urb) { + if (!dev->isoc_ctl.transfer_buffer) { tm6000_err("cannot allocate memory for usbtransfer\n"); kfree(dev->isoc_ctl.urb); return -ENOMEM; -- GitLab From 762e17eb520cf31daa46061818f13b0665e38d7f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 12 Feb 2010 03:51:43 -0300 Subject: [PATCH 100/534] V4L/DVB: tm6000: only register after initialized Udev calls an utility when it senses a v4l device. So, register needs to be delayed, otherwise it may cause block conditions. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index e09d75707714..43620a3f5ec1 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -453,11 +453,6 @@ static int tm6000_init_dev(struct tm6000_core *dev) if (rc<0) goto err; - /* register and initialize V4L2 */ - rc=tm6000_v4l2_register(dev); - if (rc<0) - goto err; - /* Default values for STD and resolutions */ dev->width = 720; dev->height = 480; @@ -480,12 +475,18 @@ static int tm6000_init_dev(struct tm6000_core *dev) v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, "tvaudio", "tvaudio", I2C_ADDR_TDA9874, NULL); + /* register and initialize V4L2 */ + rc=tm6000_v4l2_register(dev); + if (rc<0) + goto err; + if(dev->caps.has_dvb) { dev->dvb = kzalloc(sizeof(*(dev->dvb)), GFP_KERNEL); if(!dev->dvb) { rc = -ENOMEM; goto err2; } + #ifdef CONFIG_VIDEO_TM6000_DVB rc = tm6000_dvb_register(dev); if(rc < 0) { -- GitLab From dfd36d83d963f14c383067cb7fa23f85c7b981b9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 12 Feb 2010 03:52:46 -0300 Subject: [PATCH 101/534] V4L/DVB: tm6000: fix mutex lock unbalance Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 43620a3f5ec1..268a7de20d6d 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -496,6 +496,7 @@ static int tm6000_init_dev(struct tm6000_core *dev) } #endif } + mutex_unlock(&dev->lock); return 0; err2: -- GitLab From d46ca93255d260dceccfdcb60965ed205d2bd274 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Mon, 15 Feb 2010 14:37:16 -0300 Subject: [PATCH 102/534] V4L/DVB: tm6000: add additional init register for tm6010 Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index afd03929e5a8..3db15c6cd139 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -416,6 +416,13 @@ struct reg_init tm6010_init_tab[] = { { REQ_05_SET_GET_USBREG, 0x18, 0x00 }, + { REQ_07_SET_GET_AVREG, 0xdc, 0xaa }, + { REQ_07_SET_GET_AVREG, 0xdd, 0x30 }, + { REQ_07_SET_GET_AVREG, 0xde, 0x20 }, + { REQ_07_SET_GET_AVREG, 0xdf, 0xd0 }, + { REQ_04_EN_DISABLE_MCU_INT, 0x02, 0x00 }, + { REQ_07_SET_GET_AVREG, 0xd8, 0x2f }, + /* set remote wakeup key:any key wakeup */ { REQ_07_SET_GET_AVREG, 0xe5, 0xfe }, { REQ_07_SET_GET_AVREG, 0xda, 0xff }, -- GitLab From 583c871467a4ecad2b09030a3a68156065f9b934 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Mon, 15 Feb 2010 14:37:17 -0300 Subject: [PATCH 103/534] V4L/DVB: tm6000: add different tuner reset for terratec [mchehab@redhat.com: Fix CodingStyle] Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 28 +++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 268a7de20d6d..0db31bc17813 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -269,12 +269,28 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg) /* Reset codes during load firmware */ switch (arg) { case 0: - tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - dev->tuner_reset_gpio, 0x00); - msleep(130); - tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, - dev->tuner_reset_gpio, 0x01); - msleep(130); + /* newer tuner can faster reset */ + switch (dev->model) { + case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x01); + msleep(60); + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x00); + msleep(75); + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x01); + msleep(60); + break; + default: + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x00); + msleep(130); + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, + dev->tuner_reset_gpio, 0x01); + msleep(130); + break; + } break; case 1: tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, -- GitLab From 439e7c14820061cbd34e66d32a84e6bf2a63dd9a Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Mon, 15 Feb 2010 14:37:18 -0300 Subject: [PATCH 104/534] V4L/DVB: tm6000: add card setup for terratec cinergy hybrid Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 0db31bc17813..54571c1e926c 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -332,6 +332,31 @@ int tm6000_cards_setup(struct tm6000_core *dev) tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_3, 0x01); msleep(11); break; + case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: + /* Turn zarlink zl10353 on */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_4, 0x00); + msleep(15); + /* Reset zarlink zl10353 */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_1, 0x00); + msleep(50); + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_1, 0x01); + msleep(15); + /* Turn zarlink zl10353 off */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_4, 0x01); + msleep(15); + /* ir ? */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_0, 0x01); + msleep(15); + /* Power led on (blue) */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_7, 0x00); + msleep(15); + /* DVB led off (orange) */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_5, 0x01); + msleep(15); + /* Turn zarlink zl10353 on */ + tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_4, 0x00); + msleep(15); + break; default: break; } -- GitLab From 38d75a7908198a309b56822f8f472208fbe47629 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Mon, 15 Feb 2010 14:37:19 -0300 Subject: [PATCH 105/534] V4L/DVB: tm6000: reset the numbers of feeds to 8 Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-dvb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index e16d55efb4f2..12a0758559ad 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -285,8 +285,8 @@ int tm6000_dvb_register(struct tm6000_core *dev) dvb->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING; dvb->demux.priv = dev; - dvb->demux.filternum = 5; /* 256; */ - dvb->demux.feednum = 5; /* 256; */ + dvb->demux.filternum = 8; + dvb->demux.feednum = 8; dvb->demux.start_feed = tm6000_start_feed; dvb->demux.stop_feed = tm6000_stop_feed; dvb->demux.write_to_decoder = NULL; -- GitLab From 606d47dae40c2bbe2e3381c06c0195fdd58c8d68 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Mon, 15 Feb 2010 14:37:21 -0300 Subject: [PATCH 106/534] V4L/DVB: tm6000: special request for all tuner Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 05df06badd83..656cd199d5e4 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -87,7 +87,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, msgs[i + 1].buf, msgs[i + 1].len); i++; - if ((dev->dev_type == TM6010) && (addr == 0xc2)) { + if (addr == dev->tuner_addr) { tm6000_set_reg(dev, 0x32, 0,0); tm6000_set_reg(dev, 0x33, 0,0); } @@ -105,7 +105,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, addr | msgs[i].buf[0] << 8, 0, msgs[i].buf + 1, msgs[i].len - 1); - if ((dev->dev_type == TM6010) && (addr == 0xc2)) { + if (addr == dev->tuner_addr) { tm6000_set_reg(dev, 0x32, 0,0); tm6000_set_reg(dev, 0x33, 0,0); } -- GitLab From 49e5e03c9c499e89cc0f9c7736a418869e887d56 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Mon, 15 Feb 2010 14:37:24 -0300 Subject: [PATCH 107/534] V4L/DVB: tm6000: change version to 0.0.2 Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index 3ec5704092fc..f7d71be806b1 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -37,7 +37,7 @@ #include "dvb_frontend.h" #include "dmxdev.h" -#define TM6000_VERSION KERNEL_VERSION(0, 0, 1) +#define TM6000_VERSION KERNEL_VERSION(0, 0, 2) /* Inputs */ -- GitLab From 89eeda67118c10b0d3d0d94006919d7640b26ab4 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Mon, 15 Feb 2010 14:37:23 -0300 Subject: [PATCH 108/534] V4L/DVB: tm6000: remove hack.c hack.h, switch to zl10353 module "hack" module were a temporary file with some zl10353 magic. This is not needed anymore. Just remove it. [mchehab@redhat.com: CodingStyle fixes] Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/Makefile | 3 +- drivers/staging/tm6000/hack.c | 406 ---------------------------- drivers/staging/tm6000/hack.h | 45 --- drivers/staging/tm6000/tm6000-dvb.c | 5 +- 4 files changed, 2 insertions(+), 457 deletions(-) delete mode 100644 drivers/staging/tm6000/hack.c delete mode 100644 drivers/staging/tm6000/hack.h diff --git a/drivers/staging/tm6000/Makefile b/drivers/staging/tm6000/Makefile index f904d5779c81..93370fccc073 100644 --- a/drivers/staging/tm6000/Makefile +++ b/drivers/staging/tm6000/Makefile @@ -5,8 +5,7 @@ tm6000-objs := tm6000-cards.o \ tm6000-stds.o ifeq ($(CONFIG_VIDEO_TM6000_DVB),y) -tm6000-objs += tm6000-dvb.o \ - hack.o +tm6000-objs += tm6000-dvb.o endif obj-$(CONFIG_VIDEO_TM6000) += tm6000.o diff --git a/drivers/staging/tm6000/hack.c b/drivers/staging/tm6000/hack.c deleted file mode 100644 index fdc70788e491..000000000000 --- a/drivers/staging/tm6000/hack.c +++ /dev/null @@ -1,406 +0,0 @@ - - - - - - -/* - hack.h - hackish code that needs to be improved (or removed) at a - later point - - Copyright (C) 2007 Michel Ludwig - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation version 2 - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "hack.h" - -#include "tm6000.h" - -#include - -static inline int tm6000_snd_control_msg(struct tm6000_core *dev, __u8 request, __u16 value, __u16 index, void *data, __u16 size) -{ - return tm6000_read_write_usb (dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, request, value, index, data, size); -} - -static int pseudo_zl10353_pll(struct tm6000_core *tm6000_dev, struct dvb_frontend_parameters *p) -{ - u8 *data = kzalloc(50*sizeof(u8), GFP_KERNEL); - -printk(KERN_ALERT "should set frequency %u\n", p->frequency); -printk(KERN_ALERT "and bandwith %u\n", p->u.ofdm.bandwidth); - - if(tm6000_dev->dvb->frontend->ops.tuner_ops.set_params) { - tm6000_dev->dvb->frontend->ops.tuner_ops.set_params(tm6000_dev->dvb->frontend, p); - } - else { - printk(KERN_ALERT "pseudo zl10353: couldn't set tuner parameters\n"); - } - - // init ZL10353 -/* data[0] = 0x0b; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x501e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x80; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x551e, 0x00, data, 0x1); - msleep(100); - data[0] = 0x01; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xea1e, 0x00, data, 0x1); - msleep(100); - data[0] = 0x00; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0xea1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x1c; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x561e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x40; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5e1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x36; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x67; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1); - msleep(15); - data[0] = 0xe5; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x19; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0xe9; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x44; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x46; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x15; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x0f; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x75; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x01; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x00; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); - msleep(15); - - msleep(50); - - switch(p->u.ofdm.bandwidth) { - case BANDWIDTH_8_MHZ: - data[0] = 0x00; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x36; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x67; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1); - msleep(15); - data[0] = 0xe5; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x19; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0xe9; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x44; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x46; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x15; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x0f; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x75; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x01; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); - msleep(15); - break; - - default: - printk(KERN_ALERT "tm6000: bandwidth not supported\n"); - case BANDWIDTH_7_MHZ: - data[0] = 0x00; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x35; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x641e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x5a; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x651e, 0x00, data, 0x1); - msleep(15); - data[0] = 0xe9; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x661e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x19; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6c1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0xe9; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x6d1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x44; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x511e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x46; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x521e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x15; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x531e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x0f; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x541e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x86; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x5c1e, 0x00, data, 0x1); - msleep(15); - data[0] = 0x01; - ret = tm6000_snd_control_msg(tm6000_dev, 0x10, 0x701e, 0x00, data, 0x1); - msleep(15); - break; - } -*/ - switch(p->u.ofdm.bandwidth) { - case BANDWIDTH_8_MHZ: - data[0] = 0x03; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x501e,0,data,1); - msleep(40); - data[0] = 0x44; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x511e,0,data,1); - msleep(40); - data[0] = 0x40; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x551e,0,data,1); - msleep(40); - data[0] = 0x46; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x521e,0,data,1); - msleep(40); - data[0] = 0x15; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x531e,0,data,1); - msleep(40); - data[0] = 0x0f; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x541e,0,data,1); - msleep(40); - data[0] = 0x80; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x551e,0,data,1); - msleep(40); - data[0] = 0x01; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xea1e,0,data,1); - msleep(40); - data[0] = 0x00; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xea1e,0,data,1); - msleep(40); - data[0] = 0x8b; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x631e,0,data,1); - msleep(40); - data[0] = 0x75; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xcc1e,0,data,1); - msleep(40); - data[0] = 0xe6; //0x19; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x6c1e,0,data,1); - msleep(40); - data[0] = 0x09; //0xf7; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x6d1e,0,data,1); - msleep(40); - data[0] = 0x67; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x651e,0,data,1); - msleep(40); - data[0] = 0xe5; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x661e,0,data,1); - msleep(40); - data[0] = 0x75; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5c1e,0,data,1); - msleep(40); - data[0] = 0x17; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5f1e,0,data,1); - msleep(40); - data[0] = 0x40; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5e1e,0,data,1); - msleep(40); - data[0] = 0x01; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x701e,0,data,1); - msleep(40); - break; - case BANDWIDTH_7_MHZ: - data[0] = 0x03; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x501e,0,data,1); - msleep(40); - data[0] = 0x44; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x511e,0,data,1); - msleep(40); - data[0] = 0x40; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x551e,0,data,1); - msleep(40); - data[0] = 0x46; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x521e,0,data,1); - msleep(40); - data[0] = 0x15; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x531e,0,data,1); - msleep(40); - data[0] = 0x0f; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x541e,0,data,1); - msleep(40); - data[0] = 0x80; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x551e,0,data,1); - msleep(40); - data[0] = 0x01; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xea1e,0,data,1); - msleep(40); - data[0] = 0x00; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xea1e,0,data,1); - msleep(40); - data[0] = 0x83; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x631e,0,data,1); - msleep(40); - data[0] = 0xa3; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0xcc1e,0,data,1); - msleep(40); - data[0] = 0xe6; //0x19; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x6c1e,0,data,1); - msleep(40); - data[0] = 0x09; //0xf7; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x6d1e,0,data,1); - msleep(40); - data[0] = 0x5a; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x651e,0,data,1); - msleep(40); - data[0] = 0xe9; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x661e,0,data,1); - msleep(40); - data[0] = 0x86; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5c1e,0,data,1); - msleep(40); - data[0] = 0x17; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5f1e,0,data,1); - msleep(40); - data[0] = 0x40; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x5e1e,0,data,1); - msleep(40); - data[0] = 0x01; - tm6000_read_write_usb(tm6000_dev,0x40,0x10,0x701e,0,data,1); - msleep(40); - break; - default: - printk(KERN_ALERT "tm6000: bandwidth not supported\n"); - } - - tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); - printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); - msleep(40); - - tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); - printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); - msleep(40); - - tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); - printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); - msleep(40); - - tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); - printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); - msleep(40); - - tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x051f,0,data,2); - printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); - msleep(40); - - tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x0f1f,0,data,2); - printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); - msleep(40); - - tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x091f,0,data,2); - printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); - msleep(40); - - tm6000_read_write_usb(tm6000_dev,0xc0,0x10,0x0b1f,0,data,2); - printk(KERN_INFO "buf %#x %#x \n", data[0], data[1]); - msleep(40); - - kfree(data); - - return 0; -}; - - - -int pseudo_zl10353_set_frontend(struct dvb_frontend *fe, - struct dvb_frontend_parameters *p) -{ - struct tm6000_core *tm6000_dev = fe->dvb->priv; - u32 status; - - if(p != NULL) { -// mutex_lock(&tm6000_dev->mutex); - pseudo_zl10353_pll(tm6000_dev, p); -// mutex_unlock(&tm6000_dev->mutex); - } - - if(tm6000_dev->dvb->frontend->ops.read_status) { - tm6000_dev->dvb->frontend->ops.read_status(tm6000_dev->dvb->frontend, &status); - printk(KERN_ALERT "demodulator status: FE_HAS_CARRIER %i \n", (status & FE_HAS_CARRIER)); - printk(KERN_ALERT "demodulator status: FE_HAS_VITERBI %i \n", (status & FE_HAS_VITERBI)); - printk(KERN_ALERT "demodulator status: FE_HAS_LOCK %i \n", (status & FE_HAS_LOCK)); - printk(KERN_ALERT "demodulator status: FE_HAS_SYNC %i \n", (status & FE_HAS_SYNC)); - printk(KERN_ALERT "demodulator status: FE_HAS_SIGNAL %i \n", (status & FE_HAS_SIGNAL)); - } - else { - printk(KERN_ALERT "pseudo zl10353: couldn't read demodulator status\n"); - } - return 0; -} - -int pseudo_zl10353_read_status(struct dvb_frontend *fe, fe_status_t *status) -{ - - *status = FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK | FE_HAS_SIGNAL; - - return 0; -} - -struct dvb_frontend* pseudo_zl10353_attach(struct tm6000_core *dev, - const struct zl10353_config *config, - struct i2c_adapter *i2c) -{ - struct tm6000_dvb *dvb = dev->dvb; - - dvb->frontend = dvb_attach(zl10353_attach, config, i2c); - if(!dvb->frontend) { - printk(KERN_ERR "Error during zl10353_attach!\n"); - return NULL; - } - - /* override some functions with our implementations */ - dvb->frontend->ops.set_frontend = pseudo_zl10353_set_frontend; - dvb->frontend->ops.read_status = pseudo_zl10353_read_status; - dvb->frontend->frontend_priv = dev; - - return dvb->frontend; -} diff --git a/drivers/staging/tm6000/hack.h b/drivers/staging/tm6000/hack.h deleted file mode 100644 index 96f1b61df682..000000000000 --- a/drivers/staging/tm6000/hack.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - hack.h - hackish code that needs to be improved (or removed) at a - later point - - Copyright (C) 2007 Michel Ludwig - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation version 2 - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef HACK_H -#define HACK_H - -#include - -#include "zl10353.h" -#include "dvb_frontend.h" - -struct tm6000_core; - -int pseudo_zl103530_init(struct dvb_frontend *fe); - -int pseudo_zl10353_set_frontend(struct dvb_frontend *fe, struct dvb_frontend_parameters *p); - -int pseudo_zl10353_read_status(struct dvb_frontend *fe, fe_status_t *status); - -int pseudo_zl10353_read_signal_strength(struct dvb_frontend* fe, u16* strength); - -int pseudo_zl10353_read_snr(struct dvb_frontend *fe, u16 *snr); - -struct dvb_frontend* pseudo_zl10353_attach(struct tm6000_core *dev, - const struct zl10353_config *config, - struct i2c_adapter *i2c); - -#endif diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index 12a0758559ad..f832b1950c74 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -23,8 +23,6 @@ #include "tm6000.h" #include "tm6000-regs.h" -#include "hack.h" - #include "zl10353.h" #include @@ -222,8 +220,7 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev) .disable_i2c_gate_ctrl = 1, }; - dvb->frontend = pseudo_zl10353_attach(dev, &config, -/* dvb->frontend = dvb_attach (zl10353_attach, &config, */ + dvb->frontend = dvb_attach(zl10353_attach, &config, &dev->i2c_adap); } else { -- GitLab From 685b122906069f9e7b9995bf2b128137c86b558c Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Sun, 21 Feb 2010 17:10:36 -0300 Subject: [PATCH 109/534] V4L/DVB: tm6000: fix i2c addr test The i2c addr on I2C core is specified on 7-bit format, but tm6000 expects it on 8-bit format. Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 656cd199d5e4..050cbe41c12b 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -87,7 +87,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, msgs[i + 1].buf, msgs[i + 1].len); i++; - if (addr == dev->tuner_addr) { + if (addr == dev->tuner_addr << 1) { tm6000_set_reg(dev, 0x32, 0,0); tm6000_set_reg(dev, 0x33, 0,0); } @@ -105,7 +105,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, addr | msgs[i].buf[0] << 8, 0, msgs[i].buf + 1, msgs[i].len - 1); - if (addr == dev->tuner_addr) { + if (addr == dev->tuner_addr << 1) { tm6000_set_reg(dev, 0x32, 0,0); tm6000_set_reg(dev, 0x33, 0,0); } -- GitLab From e28f49b0b2a8e678af62745ffdc4e4f36d7283a6 Mon Sep 17 00:00:00 2001 From: Dmitri Belimov Date: Mon, 22 Feb 2010 06:32:15 -0300 Subject: [PATCH 110/534] V4L/DVB: tm6000: fix some info messages Fix some messages for add information about TM6010 Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-alsa.c | 7 ++++--- drivers/staging/tm6000/tm6000-cards.c | 4 ++-- drivers/staging/tm6000/tm6000-core.c | 2 +- drivers/staging/tm6000/tm6000-dvb.c | 2 +- drivers/staging/tm6000/tm6000-i2c.c | 2 +- drivers/staging/tm6000/tm6000-regs.h | 8 ++++---- drivers/staging/tm6000/tm6000-stds.c | 2 +- drivers/staging/tm6000/tm6000-usb-isoc.h | 2 +- drivers/staging/tm6000/tm6000-video.c | 6 +++--- drivers/staging/tm6000/tm6000.h | 2 +- 10 files changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index cf24340e0874..7cc2ac740d8a 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -1,6 +1,6 @@ /* * - * Support for audio capture for tm5600/6000 + * Support for audio capture for tm5600/6000/6010 * (c) 2007-2008 Mauro Carvalho Chehab * * Based on cx88-alsa.c @@ -76,11 +76,12 @@ MODULE_PARM_DESC(index, "Index value for tm6000x capture interface(s)."); Module macros ****************************************************************************/ -MODULE_DESCRIPTION("ALSA driver module for tm5600/tm6000 based TV cards"); +MODULE_DESCRIPTION("ALSA driver module for tm5600/tm6000/tm6010 based TV cards"); MODULE_AUTHOR("Mauro Carvalho Chehab "); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Trident,tm5600}," - "{{Trident,tm6000}"); + "{{Trident,tm6000}," + "{{Trident,tm6010}"); static unsigned int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "enable debug messages"); diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 54571c1e926c..d4f29fde4b12 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -1,5 +1,5 @@ /* - tm6000-cards.c - driver for TM5600/TM6000 USB video capture devices + tm6000-cards.c - driver for TM5600/TM6000/TM6010 USB video capture devices Copyright (C) 2006-2007 Mauro Carvalho Chehab @@ -795,6 +795,6 @@ static void __exit tm6000_module_exit(void) module_init(tm6000_module_init); module_exit(tm6000_module_exit); -MODULE_DESCRIPTION("Trident TVMaster TM5600/TM6000 USB2 adapter"); +MODULE_DESCRIPTION("Trident TVMaster TM5600/TM6000/TM6010 USB2 adapter"); MODULE_AUTHOR("Mauro Carvalho Chehab"); MODULE_LICENSE("GPL"); diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index 3db15c6cd139..bf40aa833ed0 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -1,5 +1,5 @@ /* - tm6000-core.c - driver for TM5600/TM6000 USB video capture devices + tm6000-core.c - driver for TM5600/TM6000/TM6010 USB video capture devices Copyright (C) 2006-2007 Mauro Carvalho Chehab diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c index f832b1950c74..1072206f2a71 100644 --- a/drivers/staging/tm6000/tm6000-dvb.c +++ b/drivers/staging/tm6000/tm6000-dvb.c @@ -1,5 +1,5 @@ /* - tm6000-dvb.c - dvb-t support for TM5600/TM6000 USB video capture devices + tm6000-dvb.c - dvb-t support for TM5600/TM6000/TM6010 USB video capture devices Copyright (C) 2007 Michel Ludwig diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index 050cbe41c12b..fa11173e0fad 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -1,5 +1,5 @@ /* - tm6000-i2c.c - driver for TM5600/TM6000 USB video capture devices + tm6000-i2c.c - driver for TM5600/TM6000/TM6010 USB video capture devices Copyright (C) 2006-2007 Mauro Carvalho Chehab diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 85acc07f62e9..6c9368878f5b 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -1,5 +1,5 @@ /* - tm6000-regs.h - driver for TM5600/TM6000 USB video capture devices + tm6000-regs.h - driver for TM5600/TM6000/TM6010 USB video capture devices Copyright (C) 2006-2007 Mauro Carvalho Chehab @@ -18,7 +18,7 @@ */ /* - * Define TV Master TM5600/TM6000 Request codes + * Define TV Master TM5600/TM6000/TM6010 Request codes */ #define REQ_00_SET_IR_VALUE 0 #define REQ_01_SET_WAKEUP_IRCODE 1 @@ -49,7 +49,7 @@ /* Read : Slave Addr, register, 2, data */ /* - * Define TV Master TM5600/TM6000 GPIO lines + * Define TV Master TM5600/TM6000/TM6010 GPIO lines */ #define TM6000_GPIO_CLK 0x101 @@ -74,7 +74,7 @@ #define TM6010_GPIO_7 0x0301 #define TM6010_GPIO_9 0x0305 /* - * Define TV Master TM5600/TM6000 URB message codes and length + * Define TV Master TM5600/TM6000/TM6010 URB message codes and length */ enum { diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c index c61d1a61ea3e..1e142e5d59c5 100644 --- a/drivers/staging/tm6000/tm6000-stds.c +++ b/drivers/staging/tm6000/tm6000-stds.c @@ -1,5 +1,5 @@ /* - tm6000-stds.c - driver for TM5600/TM6000 USB video capture devices + tm6000-stds.c - driver for TM5600/TM6000/TM6010 USB video capture devices Copyright (C) 2007 Mauro Carvalho Chehab diff --git a/drivers/staging/tm6000/tm6000-usb-isoc.h b/drivers/staging/tm6000/tm6000-usb-isoc.h index 11297763de6f..5a5049acd4ec 100644 --- a/drivers/staging/tm6000/tm6000-usb-isoc.h +++ b/drivers/staging/tm6000/tm6000-usb-isoc.h @@ -1,5 +1,5 @@ /* - tm6000-buf.c - driver for TM5600/TM6000 USB video capture devices + tm6000-buf.c - driver for TM5600/TM6000/TM6010 USB video capture devices Copyright (C) 2006-2007 Mauro Carvalho Chehab diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 627b0ddfcd18..0bee7dfaae4e 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1,5 +1,5 @@ /* - tm6000-video.c - driver for TM5600/TM6000 USB video capture devices + tm6000-video.c - driver for TM5600/TM6000/TM6010 USB video capture devices Copyright (C) 2006-2007 Mauro Carvalho Chehab @@ -894,7 +894,7 @@ static int vidioc_querycap (struct file *file, void *priv, // struct tm6000_core *dev = ((struct tm6000_fh *)priv)->dev; strlcpy(cap->driver, "tm6000", sizeof(cap->driver)); - strlcpy(cap->card,"Trident TVMaster TM5600/6000", sizeof(cap->card)); + strlcpy(cap->card,"Trident TVMaster TM5600/6000/6010", sizeof(cap->card)); // strlcpy(cap->bus_info, dev->udev->dev.bus_id, sizeof(cap->bus_info)); cap->version = TM6000_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | @@ -1537,7 +1537,7 @@ int tm6000_v4l2_register(struct tm6000_core *dev) vfd->v4l2_dev = &dev->v4l2_dev; ret = video_register_device(dev->vfd, VFL_TYPE_GRABBER, video_nr); - printk(KERN_INFO "Trident TVMaster TM5600/TM6000 USB2 board (Load status: %d)\n", ret); + printk(KERN_INFO "Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: %d)\n", ret); return ret; } diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index f7d71be806b1..321e60eb9a83 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h @@ -1,5 +1,5 @@ /* - tm6000.h - driver for TM5600/TM6000 USB video capture devices + tm6000.h - driver for TM5600/TM6000/TM6010 USB video capture devices Copyright (C) 2006-2007 Mauro Carvalho Chehab -- GitLab From 4e11502d4597c6252411dc1b5c16b47d08b5f246 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Mon, 22 Feb 2010 14:35:05 -0300 Subject: [PATCH 111/534] V4L/DVB: tm6000: add send and recv function Split the i2c send and receive functions on separate functions [mchehab@redhat.com: CodingStyle and fix the logic for more than 2 read values] Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 56 +++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index fa11173e0fad..a5323303c34a 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -44,6 +44,36 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); printk(KERN_DEBUG "%s at %s: " fmt, \ dev->name, __FUNCTION__ , ##args); } while (0) +static int tm6000_i2c_send_regs(struct tm6000_core *dev, unsigned char addr, + __u8 reg, char *buf, int len) +{ + return tm6000_read_write_usb(dev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len); +} + +/* Generic read - doesn't work fine with 16bit registers */ +static int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, + __u8 reg, char *buf, int len) +{ + int rc; + + rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len); + + return rc; +} + +/* + * read from a 16bit register + * for example xc2028, xc3028 or xc3028L + */ +static int tm6000_i2c_recv_regs16(struct tm6000_core *dev, unsigned char addr, + __u16 reg, char *buf, int len) +{ + return tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_14_SET_GET_I2C_WR2_RDN, addr, reg, buf, len); +} + static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) { @@ -78,13 +108,16 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, i2c_dprintk(2, "; joined to read %s len=%d:", i == num - 2 ? "stop" : "nonstop", msgs[i + 1].len); - rc = tm6000_read_write_usb (dev, - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - msgs[i].len == 1 ? REQ_16_SET_GET_I2C_WR1_RDN - : REQ_14_SET_GET_I2C_WR2_RDN, - addr | msgs[i].buf[0] << 8, - msgs[i].len == 1 ? 0 : msgs[i].buf[1], - msgs[i + 1].buf, msgs[i + 1].len); + + if (msgs[i].len == 2) { + rc = tm6000_i2c_recv_regs16(dev, addr, + msgs[i].buf[0] << 8 | msgs[i].buf[1], + msgs[i + 1].buf, msgs[i + 1].len); + } else { + rc = tm6000_i2c_recv_regs(dev, addr, msgs[i].buf[0], + msgs[i + 1].buf, msgs[i + 1].len); + } + i++; if (addr == dev->tuner_addr << 1) { @@ -99,10 +132,7 @@ static int tm6000_i2c_xfer(struct i2c_adapter *i2c_adap, if (i2c_debug >= 2) for (byte = 0; byte < msgs[i].len; byte++) printk(" %02x", msgs[i].buf[byte]); - rc = tm6000_read_write_usb(dev, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - REQ_16_SET_GET_I2C_WR1_RDN, - addr | msgs[i].buf[0] << 8, 0, + rc = tm6000_i2c_send_regs(dev, addr, msgs[i].buf[0], msgs[i].buf + 1, msgs[i].len - 1); if (addr == dev->tuner_addr << 1) { @@ -134,9 +164,7 @@ static int tm6000_i2c_eeprom(struct tm6000_core *dev, bytes[16] = '\0'; for (i = 0; i < len; ) { *p = i; - rc = tm6000_read_write_usb (dev, - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - REQ_16_SET_GET_I2C_WR1_RDN, 0xa0 | i<<8, 0, p, 1); + rc = tm6000_i2c_recv_regs(dev, 0xa0, i, p, 1); if (rc < 1) { if (p == eedata) goto noeeprom; -- GitLab From 02512fe33e9162713cd522937aabc81fcd97ad74 Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Mon, 22 Feb 2010 14:35:06 -0300 Subject: [PATCH 112/534] V4L/DVB: tm6000: bugfix reading problems with demodulator zl10353 Reading from zl10353 with tm6000 has a bug. For example: regs w/o patch with patch 0x06 0x00 0x7f 0x07 0x33 0x30 0x08 0x00 0x00 0x09 0x58 0x50 0x0f 0x31 0x28 0x10 0x00 0x84 This patch provides the workaround for the bug [mchehab@redhat.com: Fix merge conflict and add a comment at the workaround] Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-i2c.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/staging/tm6000/tm6000-i2c.c b/drivers/staging/tm6000/tm6000-i2c.c index a5323303c34a..ec4c9381c14a 100644 --- a/drivers/staging/tm6000/tm6000-i2c.c +++ b/drivers/staging/tm6000/tm6000-i2c.c @@ -56,9 +56,23 @@ static int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, __u8 reg, char *buf, int len) { int rc; + u8 b[2]; - rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + if ((dev->caps.has_zl10353) && (dev->demod_addr << 1 == addr) && (reg % 2 == 0)) { + /* + * Workaround an I2C bug when reading from zl10353 + */ + reg -= 1; + len += 1; + + rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, b, len); + + *buf = b[1]; + } else { + rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len); + } return rc; } -- GitLab From e26b31449142a18512b57dbea515af234992ba7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20N=C3=A9meth?= Date: Wed, 24 Feb 2010 17:13:29 -0300 Subject: [PATCH 113/534] V4L/DVB: The first two parameters of soc_camera_limit_side() are usually pointers to struct v4l2_rect elements. They are signed, so adjust the prototype accordingly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will remove the following sparse warning (see "make C=1"): * incorrect type in argument 1 (different signedness) expected unsigned int *start got signed int * as well as a couple more signedness mismatches. Signed-off-by: Márton Németh Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/mt9v022.c | 2 +- drivers/media/video/mx3_camera.c | 4 ++-- drivers/media/video/rj54n1cb0c.c | 18 +++++++++--------- drivers/media/video/sh_mobile_ceu_camera.c | 8 ++++---- include/media/soc_camera.h | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index 1a34d2993e94..e5bae4c9393b 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c @@ -325,7 +325,7 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) if (ret < 0) return ret; - dev_dbg(&client->dev, "Frame %ux%u pixel\n", rect.width, rect.height); + dev_dbg(&client->dev, "Frame %dx%d pixel\n", rect.width, rect.height); mt9v022->rect = rect; diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index bd297f567dc7..d477e3058002 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c @@ -796,7 +796,7 @@ static int acquire_dma_channel(struct mx3_camera_dev *mx3_cam) * FIXME: learn to use stride != width, then we can keep stride properly aligned * and support arbitrary (even) widths. */ -static inline void stride_align(__s32 *width) +static inline void stride_align(__u32 *width) { if (((*width + 7) & ~7) < 4096) *width = (*width + 7) & ~7; @@ -844,7 +844,7 @@ static int mx3_camera_set_crop(struct soc_camera_device *icd, * So far only direct camera-to-memory is supported */ if (channel_change_requested(icd, rect)) { - int ret = acquire_dma_channel(mx3_cam); + ret = acquire_dma_channel(mx3_cam); if (ret < 0) return ret; } diff --git a/drivers/media/video/rj54n1cb0c.c b/drivers/media/video/rj54n1cb0c.c index 9277194cd821..bbd9c11e2c5a 100644 --- a/drivers/media/video/rj54n1cb0c.c +++ b/drivers/media/video/rj54n1cb0c.c @@ -555,15 +555,15 @@ static int rj54n1_commit(struct i2c_client *client) return ret; } -static int rj54n1_sensor_scale(struct v4l2_subdev *sd, u32 *in_w, u32 *in_h, - u32 *out_w, u32 *out_h); +static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h, + s32 *out_w, s32 *out_h); static int rj54n1_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) { struct i2c_client *client = sd->priv; struct rj54n1 *rj54n1 = to_rj54n1(client); struct v4l2_rect *rect = &a->c; - unsigned int dummy = 0, output_w, output_h, + int dummy = 0, output_w, output_h, input_w = rect->width, input_h = rect->height; int ret; @@ -577,7 +577,7 @@ static int rj54n1_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) output_w = (input_w * 1024 + rj54n1->resize / 2) / rj54n1->resize; output_h = (input_h * 1024 + rj54n1->resize / 2) / rj54n1->resize; - dev_dbg(&client->dev, "Scaling for %ux%u : %u = %ux%u\n", + dev_dbg(&client->dev, "Scaling for %dx%d : %u = %dx%d\n", input_w, input_h, rj54n1->resize, output_w, output_h); ret = rj54n1_sensor_scale(sd, &input_w, &input_h, &output_w, &output_h); @@ -638,8 +638,8 @@ static int rj54n1_g_fmt(struct v4l2_subdev *sd, * the output one, updates the window sizes and returns an error or the resize * coefficient on success. Note: we only use the "Fixed Scaling" on this camera. */ -static int rj54n1_sensor_scale(struct v4l2_subdev *sd, u32 *in_w, u32 *in_h, - u32 *out_w, u32 *out_h) +static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h, + s32 *out_w, s32 *out_h) { struct i2c_client *client = sd->priv; struct rj54n1 *rj54n1 = to_rj54n1(client); @@ -749,7 +749,7 @@ static int rj54n1_sensor_scale(struct v4l2_subdev *sd, u32 *in_w, u32 *in_h, * improve the image quality or stability for larger frames (see comment * above), but I didn't check the framerate. */ - skip = min(resize / 1024, (unsigned)15); + skip = min(resize / 1024, 15U); inc_sel = 1 << skip; @@ -819,7 +819,7 @@ static int rj54n1_sensor_scale(struct v4l2_subdev *sd, u32 *in_w, u32 *in_h, *out_w = output_w; *out_h = output_h; - dev_dbg(&client->dev, "Scaled for %ux%u : %u = %ux%u, skip %u\n", + dev_dbg(&client->dev, "Scaled for %dx%d : %u = %ux%u, skip %u\n", *in_w, *in_h, resize, output_w, output_h, skip); return resize; @@ -1017,7 +1017,7 @@ static int rj54n1_s_fmt(struct v4l2_subdev *sd, struct i2c_client *client = sd->priv; struct rj54n1 *rj54n1 = to_rj54n1(client); const struct rj54n1_datafmt *fmt; - unsigned int output_w, output_h, max_w, max_h, + int output_w, output_h, max_w, max_h, input_w = rj54n1->rect.width, input_h = rj54n1->rect.height; int ret; diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 1ad980f8e770..7a229ebe6923 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c @@ -1041,13 +1041,13 @@ static int client_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *crop, */ if (!memcmp(rect, cam_rect, sizeof(*rect))) { /* Even if camera S_CROP failed, but camera rectangle matches */ - dev_dbg(dev, "Camera S_CROP successful for %ux%u@%u:%u\n", + dev_dbg(dev, "Camera S_CROP successful for %dx%d@%d:%d\n", rect->width, rect->height, rect->left, rect->top); return 0; } /* Try to fix cropping, that camera hasn't managed to set */ - dev_geo(dev, "Fix camera S_CROP for %ux%u@%u:%u to %ux%u@%u:%u\n", + dev_geo(dev, "Fix camera S_CROP for %dx%d@%d:%d to %dx%d@%d:%d\n", cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top, rect->width, rect->height, rect->left, rect->top); @@ -1103,7 +1103,7 @@ static int client_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *crop, v4l2_subdev_call(sd, video, s_crop, cam_crop); ret = client_g_rect(sd, cam_rect); - dev_geo(dev, "Camera S_CROP %d for %ux%u@%u:%u\n", ret, + dev_geo(dev, "Camera S_CROP %d for %dx%d@%d:%d\n", ret, cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top); } @@ -1117,7 +1117,7 @@ static int client_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *crop, *cam_rect = cap.bounds; v4l2_subdev_call(sd, video, s_crop, cam_crop); ret = client_g_rect(sd, cam_rect); - dev_geo(dev, "Camera S_CROP %d for max %ux%u@%u:%u\n", ret, + dev_geo(dev, "Camera S_CROP %d for max %dx%d@%d:%d\n", ret, cam_rect->width, cam_rect->height, cam_rect->left, cam_rect->top); } diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 9d69f01b6fa2..5a173652cf4a 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -266,8 +266,8 @@ static inline unsigned long soc_camera_bus_param_compatible( common_flags; } -static inline void soc_camera_limit_side(unsigned int *start, - unsigned int *length, unsigned int start_min, +static inline void soc_camera_limit_side(int *start, int *length, + unsigned int start_min, unsigned int length_min, unsigned int length_max) { if (*length < length_min) -- GitLab From 4f9fb5ed020324d6c151db34460df572b0fdc491 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 18 May 2010 00:46:09 -0300 Subject: [PATCH 114/534] V4L/DVB: soc-camera: add runtime pm support for subdevices To save power soc-camera powers subdevices down, when they are not in use, if this is supported by the platform. However, the V4L standard dictates, that video nodes shall preserve configuration between uses. This requires runtime power management, which is implemented by this patch. It allows subdevice drivers to specify their runtime power-management methods, by assigning a type to the video device. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/soc_camera.c | 18 +++++++++++++++++- include/media/soc_camera.h | 8 ++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index a24174ddec46..0c65031f3d82 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -388,6 +389,11 @@ static int soc_camera_open(struct file *file) goto eiciadd; } + pm_runtime_enable(&icd->vdev->dev); + ret = pm_runtime_resume(&icd->vdev->dev); + if (ret < 0 && ret != -ENOSYS) + goto eresume; + /* * Try to configure with default parameters. Notice: this is the * very first open, so, we cannot race against other calls, @@ -409,10 +415,12 @@ static int soc_camera_open(struct file *file) return 0; /* - * First five errors are entered with the .video_lock held + * First four errors are entered with the .video_lock held * and use_count == 1 */ esfmt: + pm_runtime_disable(&icd->vdev->dev); +eresume: ici->ops->remove(icd); eiciadd: if (icl->power) @@ -437,7 +445,11 @@ static int soc_camera_close(struct file *file) if (!icd->use_count) { struct soc_camera_link *icl = to_soc_camera_link(icd); + pm_runtime_suspend(&icd->vdev->dev); + pm_runtime_disable(&icd->vdev->dev); + ici->ops->remove(icd); + if (icl->power) icl->power(icd->pdev, 0); } @@ -1319,6 +1331,7 @@ static int video_dev_create(struct soc_camera_device *icd) */ static int soc_camera_video_start(struct soc_camera_device *icd) { + struct device_type *type = icd->vdev->dev.type; int ret; if (!icd->dev.parent) @@ -1335,6 +1348,9 @@ static int soc_camera_video_start(struct soc_camera_device *icd) return ret; } + /* Restore device type, possibly set by the subdevice driver */ + icd->vdev->dev.type = type; + return 0; } diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 5a173652cf4a..c9a5bbfa6ab5 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -284,4 +284,12 @@ static inline void soc_camera_limit_side(int *start, int *length, extern unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, unsigned long flags); +/* This is only temporary here - until v4l2-subdev begins to link to video_device */ +#include +static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *client) +{ + struct soc_camera_device *icd = client->dev.platform_data; + return icd->vdev; +} + #endif -- GitLab From 535653b1c22c29d4e8f554928efc87fe138f917d Mon Sep 17 00:00:00 2001 From: Valentin Longchamp Date: Tue, 9 Feb 2010 07:59:12 -0300 Subject: [PATCH 115/534] V4L/DVB: mt9t031: use runtime pm support to restore ADDRESS_MODE registers If the platform hooks are provided, soc_camera powers off the device on close and powers it on on open. This resets the ADDRESS_MODE registers which then can be different to the value the driver has computed for them. This patch setups runtime pm usage for mt9t031 and uses the resume function to write the ADDRESS_MODE registers in order to fix the above described problem. Signed-off-by: Valentin Longchamp Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/mt9t031.c | 66 ++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c index a9061bff79b2..78b4e091d2d5 100644 --- a/drivers/media/video/mt9t031.c +++ b/drivers/media/video/mt9t031.c @@ -8,14 +8,16 @@ * published by the Free Software Foundation. */ -#include -#include +#include #include #include +#include +#include +#include -#include -#include #include +#include +#include /* * mt9t031 i2c address 0x5d @@ -680,6 +682,59 @@ static int mt9t031_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) return 0; } +/* + * Power Management: + * This function does nothing for now but must be present for pm to work + */ +static int mt9t031_runtime_suspend(struct device *dev) +{ + return 0; +} + +/* + * Power Management: + * COLUMN_ADDRESS_MODE and ROW_ADDRESS_MODE are not rewritten if unchanged + * they are however changed at reset if the platform hook is present + * thus we rewrite them with the values stored by the driver + */ +static int mt9t031_runtime_resume(struct device *dev) +{ + struct video_device *vdev = to_video_device(dev); + struct soc_camera_device *icd = container_of(vdev->parent, + struct soc_camera_device, dev); + struct v4l2_subdev *sd = soc_camera_to_subdev(icd); + struct i2c_client *client = sd->priv; + struct mt9t031 *mt9t031 = to_mt9t031(client); + + int ret; + u16 xbin, ybin; + + xbin = min(mt9t031->xskip, (u16)3); + ybin = min(mt9t031->yskip, (u16)3); + + ret = reg_write(client, MT9T031_COLUMN_ADDRESS_MODE, + ((xbin - 1) << 4) | (mt9t031->xskip - 1)); + if (ret < 0) + return ret; + + ret = reg_write(client, MT9T031_ROW_ADDRESS_MODE, + ((ybin - 1) << 4) | (mt9t031->yskip - 1)); + if (ret < 0) + return ret; + + return 0; +} + +static struct dev_pm_ops mt9t031_dev_pm_ops = { + .runtime_suspend = mt9t031_runtime_suspend, + .runtime_resume = mt9t031_runtime_resume, +}; + +static struct device_type mt9t031_dev_type = { + .name = "MT9T031", + .pm = &mt9t031_dev_pm_ops, +}; + /* * Interface active, can use i2c. If it fails, it can indeed mean, that * this wasn't our capture interface, so, we wait for the right one @@ -687,6 +742,7 @@ static int mt9t031_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) static int mt9t031_video_probe(struct i2c_client *client) { struct mt9t031 *mt9t031 = to_mt9t031(client); + struct video_device *vdev = soc_camera_i2c_to_vdev(client); s32 data; int ret; @@ -712,6 +768,8 @@ static int mt9t031_video_probe(struct i2c_client *client) ret = mt9t031_idle(client); if (ret < 0) dev_err(&client->dev, "Failed to initialise the camera\n"); + else + vdev->dev.type = &mt9t031_dev_type; /* mt9t031_idle() has reset the chip to default. */ mt9t031->exposure = 255; -- GitLab From 7f2c983cf5978186ee2c379fd63d04316158fc9b Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Wed, 17 Feb 2010 22:47:55 -0300 Subject: [PATCH 116/534] V4L/DVB: au8522: fix race condition in switching from digital to analog mode With applications like MythTV, switching inputs results in closing the digital side and then immediately opening the analog side. This exposes a race condition where the dvb_frontend kernel thread powers down the chip and closes the i2c gate even though we're in the middle of bringing up the analog part of the chip (since the shutdown of the dvb_frontend kernel thread occurs asychronously). Introduce a construct to keep track of what mode we're in, and drop requests to power down or management the gate if we've already switched to analog mode. Thanks to Zaphod Beeblebrox for reporting this issue. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/au8522_decoder.c | 2 ++ drivers/media/dvb/frontends/au8522_dig.c | 21 ++++++++++++++++++++ drivers/media/dvb/frontends/au8522_priv.h | 5 +++++ 3 files changed, 28 insertions(+) diff --git a/drivers/media/dvb/frontends/au8522_decoder.c b/drivers/media/dvb/frontends/au8522_decoder.c index 24268ef2753d..ef5fd49363c2 100644 --- a/drivers/media/dvb/frontends/au8522_decoder.c +++ b/drivers/media/dvb/frontends/au8522_decoder.c @@ -664,6 +664,8 @@ static int au8522_reset(struct v4l2_subdev *sd, u32 val) { struct au8522_state *state = to_state(sd); + state->operational_mode = AU8522_ANALOG_MODE; + au8522_writereg(state, 0xa4, 1 << 5); return 0; diff --git a/drivers/media/dvb/frontends/au8522_dig.c b/drivers/media/dvb/frontends/au8522_dig.c index a1fed0fa8ed4..e2efb25d1a75 100644 --- a/drivers/media/dvb/frontends/au8522_dig.c +++ b/drivers/media/dvb/frontends/au8522_dig.c @@ -84,6 +84,14 @@ static int au8522_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) dprintk("%s(%d)\n", __func__, enable); + if (state->operational_mode == AU8522_ANALOG_MODE) { + /* We're being asked to manage the gate even though we're + not in digital mode. This can occur if we get switched + over to analog mode before the dvb_frontend kernel thread + has completely shutdown */ + return 0; + } + if (enable) return au8522_writereg(state, 0x106, 1); else @@ -608,6 +616,8 @@ int au8522_init(struct dvb_frontend *fe) struct au8522_state *state = fe->demodulator_priv; dprintk("%s()\n", __func__); + state->operational_mode = AU8522_DIGITAL_MODE; + au8522_writereg(state, 0xa4, 1 << 5); au8522_i2c_gate_ctrl(fe, 1); @@ -704,6 +714,15 @@ int au8522_sleep(struct dvb_frontend *fe) struct au8522_state *state = fe->demodulator_priv; dprintk("%s()\n", __func__); + /* Only power down if the digital side is currently using the chip */ + if (state->operational_mode == AU8522_ANALOG_MODE) { + /* We're not in one of the expected power modes, which means + that the DVB thread is probably telling us to go to sleep + even though the analog frontend has already started using + the chip. So ignore the request */ + return 0; + } + /* turn off led */ au8522_led_ctrl(state, 0); @@ -932,6 +951,8 @@ struct dvb_frontend *au8522_attach(const struct au8522_config *config, /* setup the state */ state->config = config; state->i2c = i2c; + state->operational_mode = AU8522_DIGITAL_MODE; + /* create dvb_frontend */ memcpy(&state->frontend.ops, &au8522_ops, sizeof(struct dvb_frontend_ops)); diff --git a/drivers/media/dvb/frontends/au8522_priv.h b/drivers/media/dvb/frontends/au8522_priv.h index c74c4e72fe91..609cf04bc312 100644 --- a/drivers/media/dvb/frontends/au8522_priv.h +++ b/drivers/media/dvb/frontends/au8522_priv.h @@ -34,10 +34,15 @@ #include "au8522.h" #include "tuner-i2c.h" +#define AU8522_ANALOG_MODE 0 +#define AU8522_DIGITAL_MODE 1 + struct au8522_state { struct i2c_client *c; struct i2c_adapter *i2c; + u8 operational_mode; + /* Used for sharing of the state between analog and digital mode */ struct tuner_i2c_props i2c_props; struct list_head hybrid_tuner_instance_list; -- GitLab From b628a2a3d4e97044cc9f6818bfb8330d8d0b021a Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Wed, 17 Feb 2010 22:51:46 -0300 Subject: [PATCH 117/534] V4L/DVB: au8522: fix case where we don't perform the first tune after going digital Address a problem found in MythTV where if we are in digital mode, switch to analog mode, and the switch back to digital mode, the first tuning request after switching back to digital mode gets dropped. This is because the au8522 maintains internal state, and would think the demod was already tuned to the target frequency. Thanks to Zaphod Beeblebrox for reporting this issue. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/au8522_decoder.c | 5 +++++ drivers/media/dvb/frontends/au8522_dig.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/drivers/media/dvb/frontends/au8522_decoder.c b/drivers/media/dvb/frontends/au8522_decoder.c index ef5fd49363c2..68dba3a4b4da 100644 --- a/drivers/media/dvb/frontends/au8522_decoder.c +++ b/drivers/media/dvb/frontends/au8522_decoder.c @@ -666,6 +666,11 @@ static int au8522_reset(struct v4l2_subdev *sd, u32 val) state->operational_mode = AU8522_ANALOG_MODE; + /* Clear out any state associated with the digital side of the + chip, so that when it gets powered back up it won't think + that it is already tuned */ + state->current_frequency = 0; + au8522_writereg(state, 0xa4, 1 << 5); return 0; diff --git a/drivers/media/dvb/frontends/au8522_dig.c b/drivers/media/dvb/frontends/au8522_dig.c index e2efb25d1a75..65f6a36dfb21 100644 --- a/drivers/media/dvb/frontends/au8522_dig.c +++ b/drivers/media/dvb/frontends/au8522_dig.c @@ -618,6 +618,11 @@ int au8522_init(struct dvb_frontend *fe) state->operational_mode = AU8522_DIGITAL_MODE; + /* Clear out any state associated with the digital side of the + chip, so that when it gets powered back up it won't think + that it is already tuned */ + state->current_frequency = 0; + au8522_writereg(state, 0xa4, 1 << 5); au8522_i2c_gate_ctrl(fe, 1); -- GitLab From d044189dfea1e8329d63cb4e18815a7e92d2e049 Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Wed, 24 Feb 2010 13:23:36 -0300 Subject: [PATCH 118/534] V4L/DVB: cx88: increase BUFFER_TIMEOUT to 2 seconds When temporarily there is no video signal, sometimes it takes more than 0.5 secs for the cx88 chip to generate a single frame. If a dma timeout occurs during recording, it confuses the recording application (at least mencoder) and the recording stops. Since there is already an #if 0 for 2 seconds buffer timeout in the code at the -hg development tree, re-enabling that seemed the most simple solution. Signed-off-by: Marton Balint Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 48b6c04fb497..b5f054d124f1 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -290,7 +290,7 @@ struct cx88_subid { #define RESOURCE_VIDEO 2 #define RESOURCE_VBI 4 -#define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ +#define BUFFER_TIMEOUT msecs_to_jiffies(2000) /* buffer for one video frame */ struct cx88_buffer { -- GitLab From 6c9eaa82da53676db830572f5a41aa9ffea133a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20N=C3=A9meth?= Date: Sun, 28 Feb 2010 11:19:47 -0300 Subject: [PATCH 119/534] V4L/DVB: tlg2300: cleanups when power management is not configured MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When power management is not configured (CONFIG_PM) then some code is no longer necessary. This patch will remove the following compiler warnings: * pd-dvb.c: In function 'poseidon_fe_release': * pd-dvb.c:101: warning: unused variable 'pd' * pd-video.c:14: warning: 'pm_video_suspend' declared 'static' but never defined * pd-video.c:15: warning: 'pm_video_resume' declared 'static' but never defined Signed-off-by: Márton Németh Acked-by: Huang Shijie Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/tlg2300/pd-dvb.c | 6 ++++-- drivers/media/video/tlg2300/pd-video.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/tlg2300/pd-dvb.c b/drivers/media/video/tlg2300/pd-dvb.c index ebd9cb5bec74..edd78f8b1baa 100644 --- a/drivers/media/video/tlg2300/pd-dvb.c +++ b/drivers/media/video/tlg2300/pd-dvb.c @@ -97,15 +97,17 @@ static int poseidon_ts_bus_ctrl(struct dvb_frontend *fe, int acquire) return ret; } +#ifdef CONFIG_PM static void poseidon_fe_release(struct dvb_frontend *fe) { struct poseidon *pd = fe->demodulator_priv; -#ifdef CONFIG_PM pd->pm_suspend = NULL; pd->pm_resume = NULL; -#endif } +#else +#define poseidon_fe_release NULL +#endif static s32 poseidon_fe_sleep(struct dvb_frontend *fe) { diff --git a/drivers/media/video/tlg2300/pd-video.c b/drivers/media/video/tlg2300/pd-video.c index cf8f18c007e6..ed5cb1818adc 100644 --- a/drivers/media/video/tlg2300/pd-video.c +++ b/drivers/media/video/tlg2300/pd-video.c @@ -12,8 +12,10 @@ #include "pd-common.h" #include "vendorcmds.h" +#ifdef CONFIG_PM static int pm_video_suspend(struct poseidon *pd); static int pm_video_resume(struct poseidon *pd); +#endif static void iso_bubble_handler(struct work_struct *w); int usb_transfer_mode; -- GitLab From 7b1fc72c2fdeb91565f4969397757ee938cce67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20N=C3=A9meth?= Date: Sun, 28 Feb 2010 11:34:35 -0300 Subject: [PATCH 120/534] V4L/DVB: nGene: use NULL when pointer is needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use NULL when calling a function with pointer parameter, initializing a pointer and returning a pointer. This will remove the following sparse warning at different locations (see "make C=1"): * warning: Using plain integer as NULL pointer Signed-off-by: Márton Németh Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/ngene-core.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 645e8b8a7137..52f60d448de0 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -819,7 +819,7 @@ static int ngene_i2c_master_xfer(struct i2c_adapter *adapter, msg[0].buf, msg[0].len)) goto done; if (num == 1 && (msg[0].flags & I2C_M_RD)) - if (!ngene_command_i2c_read(dev, msg[0].addr, 0, 0, + if (!ngene_command_i2c_read(dev, msg[0].addr, NULL, 0, msg[0].buf, msg[0].len, 0)) goto done; @@ -882,7 +882,7 @@ static void *tsin_exchange(void *priv, void *buf, u32 len, u32 clock, u32 flags) if (chan->users > 0) #endif dvb_dmx_swfilter(&chan->demux, buf, len); - return 0; + return NULL; } u8 fill_ts[188] = { 0x47, 0x1f, 0xff, 0x10 }; @@ -970,7 +970,7 @@ static void set_transfer(struct ngene_channel *chan, int state) state); if (!state) { spin_lock_irq(&chan->state_lock); - chan->pBufferExchange = 0; + chan->pBufferExchange = NULL; dvb_ringbuffer_flush(&dev->tsout_rbuf); spin_unlock_irq(&chan->state_lock); } @@ -1020,7 +1020,7 @@ static int my_dvb_dmx_ts_card_init(struct dvb_demux *dvbdemux, char *id, dvbdemux->feednum = 256; dvbdemux->start_feed = start_feed; dvbdemux->stop_feed = stop_feed; - dvbdemux->write_to_decoder = 0; + dvbdemux->write_to_decoder = NULL; dvbdemux->dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING); @@ -1094,8 +1094,8 @@ static void free_idlebuffer(struct ngene *dev, return; free_ringbuffer(dev, rb); for (j = 0; j < tb->NumBuffers; j++, Cur = Cur->Next) { - Cur->Buffer2 = 0; - Cur->scList2 = 0; + Cur->Buffer2 = NULL; + Cur->scList2 = NULL; Cur->ngeneBuffer.Address_of_first_entry_2 = 0; Cur->ngeneBuffer.Number_of_entries_2 = 0; } @@ -1141,7 +1141,7 @@ static int create_ring_buffer(struct pci_dev *pci_dev, u64 PARingBufferNext; struct SBufferHeader *Cur, *Next; - descr->Head = 0; + descr->Head = NULL; descr->MemSize = 0; descr->PAHead = 0; descr->NumBuffers = 0; @@ -1719,7 +1719,7 @@ static void release_channel(struct ngene_channel *chan) if (chan->fe) { dvb_unregister_frontend(chan->fe); dvb_frontend_detach(chan->fe); - chan->fe = 0; + chan->fe = NULL; } dvbdemux->dmx.close(&dvbdemux->dmx); dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, @@ -1820,7 +1820,7 @@ static void __devexit ngene_remove(struct pci_dev *pdev) release_channel(&dev->channel[i]); ngene_stop(dev); ngene_release_buffers(dev); - pci_set_drvdata(pdev, 0); + pci_set_drvdata(pdev, NULL); pci_disable_device(pdev); } @@ -1868,7 +1868,7 @@ static int __devinit ngene_probe(struct pci_dev *pci_dev, ngene_release_buffers(dev); fail0: pci_disable_device(pci_dev); - pci_set_drvdata(pci_dev, 0); + pci_set_drvdata(pci_dev, NULL); return stat; } -- GitLab From 278a58cf2ab6e690fa79ca7e0d466a0cb453296f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20N=C3=A9meth?= Date: Mon, 1 Mar 2010 03:31:02 -0300 Subject: [PATCH 121/534] V4L/DVB: tlg2300: make local variables and functions static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the local variables and functions static. Some of them are not exported by their symbol name but used trough other means. For example a pointer of the operation structure is passed through a function call. This will remove the following sparse warnings (see "make C=1"): * pd-video.c:20:5: warning: symbol 'usb_transfer_mode' was not declared. Should it be static? * pd-video.c:621:5: warning: symbol 'fire_all_urb' was not declared. Should it be static? * pd-video.c:881:5: warning: symbol 'vidioc_s_std' was not declared. Should it be static? * pd-video.c:1024:5: warning: symbol 'vidioc_g_audio' was not declared. Should it be static? * pd-video.c:1033:5: warning: symbol 'vidioc_s_audio' was not declared. Should it be static? * pd-video.c:1193:5: warning: symbol 'usb_transfer_stop' was not declared. Should it be static? * pd-video.c:1522:14: warning: symbol 'pd_video_poll' was not declared. Should it be static? * pd-video.c:1528:9: warning: symbol 'pd_video_read' was not declared. Should it be static? * pd-radio.c:164:5: warning: symbol 'tlg_fm_vidioc_g_tuner' was not declared. Should it be static? * pd-radio.c:206:5: warning: symbol 'fm_get_freq' was not declared. Should it be static? * pd-radio.c:249:5: warning: symbol 'fm_set_freq' was not declared. Should it be static? * pd-radio.c:261:5: warning: symbol 'tlg_fm_vidioc_g_ctrl' was not declared. Should it be static? * pd-radio.c:267:5: warning: symbol 'tlg_fm_vidioc_g_exts_ctrl' was not declared. Should it be static? * pd-radio.c:288:5: warning: symbol 'tlg_fm_vidioc_s_exts_ctrl' was not declared. Should it be static? * pd-radio.c:315:5: warning: symbol 'tlg_fm_vidioc_s_ctrl' was not declared. Should it be static? * pd-radio.c:321:5: warning: symbol 'tlg_fm_vidioc_queryctrl' was not declared. Should it be static? * pd-radio.c:340:5: warning: symbol 'tlg_fm_vidioc_querymenu' was not declared. Should it be static? * pd-main.c:58:12: warning: symbol 'firmware_name' was not declared. Should it be static? * pd-main.c:59:19: warning: symbol 'poseidon_driver' was not declared. Should it be static? Signed-off-by: Márton Németh Acked-by: Huang Shijie Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/tlg2300/pd-main.c | 6 +++--- drivers/media/video/tlg2300/pd-radio.c | 21 ++++++++++++--------- drivers/media/video/tlg2300/pd-video.c | 16 ++++++++-------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/media/video/tlg2300/pd-main.c b/drivers/media/video/tlg2300/pd-main.c index 2cf0ebf9f28b..832b7c7b13d6 100644 --- a/drivers/media/video/tlg2300/pd-main.c +++ b/drivers/media/video/tlg2300/pd-main.c @@ -55,8 +55,8 @@ int debug_mode; module_param(debug_mode, int, 0644); MODULE_PARM_DESC(debug_mode, "0 = disable, 1 = enable, 2 = verbose"); -const char *firmware_name = "tlg2300_firmware.bin"; -struct usb_driver poseidon_driver; +static const char *firmware_name = "tlg2300_firmware.bin"; +static struct usb_driver poseidon_driver; static LIST_HEAD(pd_device_list); /* @@ -501,7 +501,7 @@ static void poseidon_disconnect(struct usb_interface *interface) kref_put(&pd->kref, poseidon_delete); } -struct usb_driver poseidon_driver = { +static struct usb_driver poseidon_driver = { .name = "poseidon", .probe = poseidon_probe, .disconnect = poseidon_disconnect, diff --git a/drivers/media/video/tlg2300/pd-radio.c b/drivers/media/video/tlg2300/pd-radio.c index 755766b15157..fae84c2a0c39 100644 --- a/drivers/media/video/tlg2300/pd-radio.c +++ b/drivers/media/video/tlg2300/pd-radio.c @@ -161,7 +161,8 @@ static const struct v4l2_file_operations poseidon_fm_fops = { .ioctl = video_ioctl2, }; -int tlg_fm_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *vt) +static int tlg_fm_vidioc_g_tuner(struct file *file, void *priv, + struct v4l2_tuner *vt) { struct tuner_fm_sig_stat_s fm_stat = {}; int ret, status, count = 5; @@ -203,7 +204,8 @@ int tlg_fm_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *vt) return 0; } -int fm_get_freq(struct file *file, void *priv, struct v4l2_frequency *argp) +static int fm_get_freq(struct file *file, void *priv, + struct v4l2_frequency *argp) { struct poseidon *p = file->private_data; @@ -246,7 +248,8 @@ static int set_frequency(struct poseidon *p, __u32 frequency) return ret; } -int fm_set_freq(struct file *file, void *priv, struct v4l2_frequency *argp) +static int fm_set_freq(struct file *file, void *priv, + struct v4l2_frequency *argp) { struct poseidon *p = file->private_data; @@ -258,13 +261,13 @@ int fm_set_freq(struct file *file, void *priv, struct v4l2_frequency *argp) return set_frequency(p, argp->frequency); } -int tlg_fm_vidioc_g_ctrl(struct file *file, void *priv, +static int tlg_fm_vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *arg) { return 0; } -int tlg_fm_vidioc_g_exts_ctrl(struct file *file, void *fh, +static int tlg_fm_vidioc_g_exts_ctrl(struct file *file, void *fh, struct v4l2_ext_controls *ctrls) { struct poseidon *p = file->private_data; @@ -285,7 +288,7 @@ int tlg_fm_vidioc_g_exts_ctrl(struct file *file, void *fh, return 0; } -int tlg_fm_vidioc_s_exts_ctrl(struct file *file, void *fh, +static int tlg_fm_vidioc_s_exts_ctrl(struct file *file, void *fh, struct v4l2_ext_controls *ctrls) { int i; @@ -312,13 +315,13 @@ int tlg_fm_vidioc_s_exts_ctrl(struct file *file, void *fh, return 0; } -int tlg_fm_vidioc_s_ctrl(struct file *file, void *priv, +static int tlg_fm_vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { return 0; } -int tlg_fm_vidioc_queryctrl(struct file *file, void *priv, +static int tlg_fm_vidioc_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *ctrl) { if (!(ctrl->id & V4L2_CTRL_FLAG_NEXT_CTRL)) @@ -337,7 +340,7 @@ int tlg_fm_vidioc_queryctrl(struct file *file, void *priv, return -EINVAL; } -int tlg_fm_vidioc_querymenu(struct file *file, void *fh, +static int tlg_fm_vidioc_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) { return v4l2_ctrl_query_menu(qmenu, NULL, NULL); diff --git a/drivers/media/video/tlg2300/pd-video.c b/drivers/media/video/tlg2300/pd-video.c index ed5cb1818adc..c750fd115ec4 100644 --- a/drivers/media/video/tlg2300/pd-video.c +++ b/drivers/media/video/tlg2300/pd-video.c @@ -18,7 +18,7 @@ static int pm_video_resume(struct poseidon *pd); #endif static void iso_bubble_handler(struct work_struct *w); -int usb_transfer_mode; +static int usb_transfer_mode; module_param(usb_transfer_mode, int, 0644); MODULE_PARM_DESC(usb_transfer_mode, "0 = Bulk, 1 = Isochronous"); @@ -619,7 +619,7 @@ static int pd_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, return 0; } -int fire_all_urb(struct video_data *video) +static int fire_all_urb(struct video_data *video) { int i, ret; @@ -879,7 +879,7 @@ static int set_std(struct poseidon *pd, v4l2_std_id *norm) return ret; } -int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *norm) +static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *norm) { struct front_face *front = fh; logs(front); @@ -1022,7 +1022,7 @@ static int vidioc_enumaudio(struct file *file, void *fh, struct v4l2_audio *a) return 0; } -int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *a) +static int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *a) { a->index = 0; a->capability = V4L2_AUDCAP_STEREO; @@ -1031,7 +1031,7 @@ int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *a) return 0; } -int vidioc_s_audio(struct file *file, void *fh, struct v4l2_audio *a) +static int vidioc_s_audio(struct file *file, void *fh, struct v4l2_audio *a) { return (0 == a->index) ? 0 : -EINVAL; } @@ -1191,7 +1191,7 @@ static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b) } /* Just stop the URBs, do not free the URBs */ -int usb_transfer_stop(struct video_data *video) +static int usb_transfer_stop(struct video_data *video) { if (video->is_streaming) { int i; @@ -1520,13 +1520,13 @@ static int pd_video_mmap(struct file *file, struct vm_area_struct *vma) return videobuf_mmap_mapper(&front->q, vma); } -unsigned int pd_video_poll(struct file *file, poll_table *table) +static unsigned int pd_video_poll(struct file *file, poll_table *table) { struct front_face *front = file->private_data; return videobuf_poll_stream(file, &front->q, table); } -ssize_t pd_video_read(struct file *file, char __user *buffer, +static ssize_t pd_video_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct front_face *front = file->private_data; -- GitLab From 6120792baa00542b5113222b0e09f5e52b510444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20N=C3=A9meth?= Date: Mon, 1 Mar 2010 04:10:52 -0300 Subject: [PATCH 122/534] V4L/DVB: az6027: remove redundant condition check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The condition (msg[i].addr == 0xd0) is checked twice the second one is not necessary. This will remove the following compiler warning: az6027.c: In function 'az6027_i2c_xfer': az6027.c:942: warning: 'index' may be used uninitialized in this function az6027.c:943: warning: 'value' may be used uninitialized in this function az6027.c:944: warning: 'length' may be used uninitialized in this function az6027.c:945: warning: 'req' may be used uninitialized in this function Signed-off-by: Márton Németh Cc: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index d7290b2c0913..27acbfb6d33a 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -976,17 +976,14 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n i++; } else { - if (msg[i].addr == 0xd0) { - /* demod 16bit addr */ - req = 0xBD; - index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff)); - value = msg[i].addr + (2 << 8); - length = msg[i].len - 2; - len = msg[i].len - 2; - for (j = 0; j < len; j++) - data[j] = msg[i].buf[j + 2]; - - } + /* demod 16bit addr */ + req = 0xBD; + index = (((msg[i].buf[0] << 8) & 0xff00) | (msg[i].buf[1] & 0x00ff)); + value = msg[i].addr + (2 << 8); + length = msg[i].len - 2; + len = msg[i].len - 2; + for (j = 0; j < len; j++) + data[j] = msg[i].buf[j + 2]; az6027_usb_out_op(d, req, value, index, data, length); } } -- GitLab From ad5e9b9b7db760f36b2a51a8b5802355f2d95d47 Mon Sep 17 00:00:00 2001 From: Henrik Kurelid Date: Tue, 21 Jul 2009 13:45:50 -0300 Subject: [PATCH 123/534] V4L/DVB: firedtv: correct version number and current/next in CA_PMT The version number in the CA_PMT message sent to the hardware was alwaysed set to zero. This could cause problems if the PMT would change during decryption of a channel since the new CA_PMT would have the same version number as the old. The version number is now copied from the original PMT. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/firewire/firedtv-avc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/dvb/firewire/firedtv-avc.c index 1b31bebc27d6..28294af752db 100644 --- a/drivers/media/dvb/firewire/firedtv-avc.c +++ b/drivers/media/dvb/firewire/firedtv-avc.c @@ -1096,7 +1096,7 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length) c->operand[15] = msg[1]; /* Program number */ c->operand[16] = msg[2]; - c->operand[17] = 0x01; /* Version number=0 + current/next=1 */ + c->operand[17] = msg[3]; /* Version number and current/next */ c->operand[18] = 0x00; /* Section number=0 */ c->operand[19] = 0x00; /* Last section number=0 */ c->operand[20] = 0x1f; /* PCR_PID=1FFF */ -- GitLab From 52897d86b1f0c8639e4b132b6b4ab1973694650f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Sun, 7 Mar 2010 05:13:49 -0300 Subject: [PATCH 124/534] V4L/DVB: gspca - pac207: Let all pac207 ctrls have a coherent naming MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Erik Andrén Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/pac207.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c index 0c87c3490b1e..a40f8893310d 100644 --- a/drivers/media/video/gspca/pac207.c +++ b/drivers/media/video/gspca/pac207.c @@ -99,7 +99,7 @@ static const struct ctrl sd_ctrls[] = { { .id = V4L2_CID_EXPOSURE, .type = V4L2_CTRL_TYPE_INTEGER, - .name = "exposure", + .name = "Exposure", .minimum = PAC207_EXPOSURE_MIN, .maximum = PAC207_EXPOSURE_MAX, .step = 1, @@ -130,7 +130,7 @@ static const struct ctrl sd_ctrls[] = { { .id = V4L2_CID_GAIN, .type = V4L2_CTRL_TYPE_INTEGER, - .name = "gain", + .name = "Gain", .minimum = PAC207_GAIN_MIN, .maximum = PAC207_GAIN_MAX, .step = 1, -- GitLab From 24f222e77ad62e41b1a882c77feeb8268c80b909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Moine?= Date: Sun, 7 Mar 2010 05:58:55 -0300 Subject: [PATCH 125/534] V4L/DVB: gspca - t613: Check the result of kmalloc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/t613.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 668a7536af90..8c7dadef8211 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c @@ -523,6 +523,10 @@ static void reg_w_buf(struct gspca_dev *gspca_dev, u8 *tmpbuf; tmpbuf = kmalloc(len, GFP_KERNEL); + if (!tmpbuf) { + err("Out of memory"); + return; + } memcpy(tmpbuf, buffer, len); usb_control_msg(gspca_dev->dev, usb_sndctrlpipe(gspca_dev->dev, 0), @@ -542,10 +546,15 @@ static void reg_w_ixbuf(struct gspca_dev *gspca_dev, int i; u8 *p, *tmpbuf; - if (len * 2 <= USB_BUF_SZ) + if (len * 2 <= USB_BUF_SZ) { p = tmpbuf = gspca_dev->usb_buf; - else + } else { p = tmpbuf = kmalloc(len * 2, GFP_KERNEL); + if (!tmpbuf) { + err("Out of memory"); + return; + } + } i = len; while (--i >= 0) { *p++ = reg++; -- GitLab From e10f73194d63321d020433fa1287e619d4107b79 Mon Sep 17 00:00:00 2001 From: German Galkin Date: Sun, 7 Mar 2010 06:19:02 -0300 Subject: [PATCH 126/534] V4L/DVB: gspca - sn9c20x: Fix exposure control for HV7131R sensor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the range of exposure values (0-0x1770) distribute evenly through HV7131R's exposure control bytes. Signed-off-by: German Galkin Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/sn9c20x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 3dee3e5844b6..04bf80ddfbb8 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c @@ -1655,9 +1655,9 @@ static int set_exposure(struct gspca_dev *gspca_dev) case SENSOR_HV7131R: exp[0] |= (4 << 4); exp[2] = 0x25; - exp[3] = ((sd->exposure * 0xffffff) / 0xffff) >> 16; - exp[4] = ((sd->exposure * 0xffffff) / 0xffff) >> 8; - exp[5] = ((sd->exposure * 0xffffff) / 0xffff) & 0xff; + exp[3] = (sd->exposure >> 5) & 0xff; + exp[4] = (sd->exposure << 3) & 0xff; + exp[5] = 0; break; default: return 0; -- GitLab From 2f51d00ffa2a41c76fe8a492383e1c1124137694 Mon Sep 17 00:00:00 2001 From: Paulo Assis Date: Sun, 7 Mar 2010 06:56:56 -0300 Subject: [PATCH 127/534] V4L/DVB: gspca - main: Use ktime instead of jiffies for buffer timestamping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/gspca.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 222af479150b..415949526eec 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include "gspca.h" @@ -442,8 +442,7 @@ void gspca_frame_add(struct gspca_dev *gspca_dev, * is not queued, discard the whole frame */ if (packet_type == FIRST_PACKET) { frame->data_end = frame->data; - jiffies_to_timeval(get_jiffies_64(), - &frame->v4l2_buf.timestamp); + frame->v4l2_buf.timestamp = ktime_to_timeval(ktime_get()); frame->v4l2_buf.sequence = ++gspca_dev->sequence; } else if (gspca_dev->last_packet_type == DISCARD_PACKET) { if (packet_type == LAST_PACKET) @@ -2124,7 +2123,7 @@ static ssize_t dev_read(struct file *file, char __user *data, } /* get a frame */ - jiffies_to_timeval(get_jiffies_64(), ×tamp); + timestamp = ktime_to_timeval(ktime_get()); timestamp.tv_sec--; n = 2; for (;;) { -- GitLab From a4fa8e9e8586bc769b14069bbb663e2738abe7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Moine?= Date: Sun, 7 Mar 2010 07:18:59 -0300 Subject: [PATCH 128/534] V4L/DVB: gspca - cpia1 / sn9c2028: Make control descriptors constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/cpia1.c | 2 +- drivers/media/video/gspca/sn9c2028.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/gspca/cpia1.c b/drivers/media/video/gspca/cpia1.c index 82945ed5cbe5..8fa98439c3f8 100644 --- a/drivers/media/video/gspca/cpia1.c +++ b/drivers/media/video/gspca/cpia1.c @@ -374,7 +374,7 @@ static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setcomptarget(struct gspca_dev *gspca_dev, __s32 val); static int sd_getcomptarget(struct gspca_dev *gspca_dev, __s32 *val); -static struct ctrl sd_ctrls[] = { +static const struct ctrl sd_ctrls[] = { { { .id = V4L2_CID_BRIGHTNESS, diff --git a/drivers/media/video/gspca/sn9c2028.c b/drivers/media/video/gspca/sn9c2028.c index dda5fd4aa69e..71d9447a7986 100644 --- a/drivers/media/video/gspca/sn9c2028.c +++ b/drivers/media/video/gspca/sn9c2028.c @@ -39,7 +39,7 @@ struct init_command { }; /* V4L2 controls supported by the driver */ -static struct ctrl sd_ctrls[] = { +static const struct ctrl sd_ctrls[] = { }; /* How to change the resolution of any of the VGA cams is unknown */ -- GitLab From ab6a21f363d830e96e5839b5b1ef67d76f679e59 Mon Sep 17 00:00:00 2001 From: Abylay Ospan Date: Sat, 6 Mar 2010 14:58:01 -0300 Subject: [PATCH 129/534] V4L/DVB: Allow to enable TS continuity and TEI check on loaded module Current dvb_demux_tscheck processing doesn't allow to enable check on loaded module. dvb_demux_tscheck can be enabled only when loading module ( dvb_dmx_init should be called to enable dvb_demux_tscheck ). This patch fix this issue. Signed-off-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-core/dvb_demux.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index 67f189b7aa1f..977ddba3e235 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c @@ -426,7 +426,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf) }; }; - if (demux->cnt_storage) { + if (demux->cnt_storage && dvb_demux_tscheck) { /* check pkt counter */ if (pid < MAX_PID) { if (buf[1] & 0x80) @@ -1248,12 +1248,9 @@ int dvb_dmx_init(struct dvb_demux *dvbdemux) dvbdemux->feed[i].index = i; } - if (dvb_demux_tscheck) { - dvbdemux->cnt_storage = vmalloc(MAX_PID + 1); - - if (!dvbdemux->cnt_storage) - printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n"); - } + dvbdemux->cnt_storage = vmalloc(MAX_PID + 1); + if (!dvbdemux->cnt_storage) + printk(KERN_WARNING "Couldn't allocate memory for TS/TEI check. Disabling it\n"); INIT_LIST_HEAD(&dvbdemux->frontend_list); -- GitLab From 723fb9b79b5a2279ed8ea8adfa6f6c92d73deaa2 Mon Sep 17 00:00:00 2001 From: Dmitri Belimov Date: Mon, 1 Mar 2010 21:24:12 -0300 Subject: [PATCH 130/534] V4L/DVB: tm6000 register defines Add defines for all registers of the tm6000 module. This defines made by doc for TM6010, need look docs for TM6000 and TM5600 Some registers can be different. Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-regs.h | 455 +++++++++++++++++++++++++++ 1 file changed, 455 insertions(+) diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 6c9368878f5b..9af4c066a3bf 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -47,6 +47,18 @@ #define REQ_17_SET_GET_I2CFP 17 /* Write: Slave Addr, register, value */ /* Read : Slave Addr, register, 2, data */ +#define REQ_20_DATA_TRANSFER 20 +#define REQ_30_I2C_WRITE 30 +#define REQ_31_I2C_READ 31 +#define REQ_35_AFTEK_TUNER_READ 35 +#define REQ_40_GET_VERSION 40 +#define REQ_50_SET_START 50 +#define REQ_51_SET_STOP 51 +#define REQ_52_TRANSMIT_DATA 52 +#define REQ_53_SPI_INITIAL 53 +#define REQ_54_SPI_SETSTART 54 +#define REQ_55_SPI_INOUTDATA 55 +#define REQ_56_SPI_SETSTOP 56 /* * Define TV Master TM5600/TM6000/TM6010 GPIO lines @@ -84,3 +96,446 @@ enum { TM6000_URB_MSG_PTS, TM6000_URB_MSG_ERR, }; + +/* Define TM6000/TM6010 Video decoder registers */ +#define TM6000_VIDEO_CONTROL0 0x00 +#define TM6000_VIDEO_CONTROL1 0x01 +#define TM6000_VIDEO_CONTROL2 0x02 +#define TM6000_YC_SEP_CONTROL 0x03 +#define TM6000_LUMA_HAGC_CONTROL 0x04 +#define TM6000_NOISE_THRESHOLD 0x05 +#define TM6000_AGC_GATE_THRESHOLD 0x06 +#define TM6000_OUTPUT_CONTROL 0x07 +#define TM6000_LUMA_CONTRAST_ADJ 0x08 +#define TM6000_LUMA_BRIGHTNESS_ADJ 0x09 +#define TM6000_CHROMA_SATURATION_ADJ 0x0A +#define TM6000_CHROMA_HUE_PHASE_ADJ 0x0B +#define TM6000_CHROMA_AGC_CONTROL 0x0C +#define TM6000_CHROMA_KILL_LEVEL 0x0D +#define TM6000_CHROMA_AUTO_POSITION 0x0F +#define TM6000_AGC_PEAK_NOMINAL 0x10 +#define TM6000_AGC_PEAK_CONTROL 0x11 +#define TM6000_AGC_GATE_STARTH 0x12 +#define TM6000_AGC_GATE_STARTL 0x13 +#define TM6000_AGC_GATE_WIDTH 0x14 +#define TM6000_AGC_BP_DELAY 0x15 +#define TM6000_LOCK_COUNT 0x16 +#define TM6000_HLOOP_MAXSTATE 0x17 +#define TM6000_CHROMA_DTO_INCREMENT3 0x18 +#define TM6000_CHROMA_DTO_INCREMENT2 0x19 +#define TM6000_CHROMA_DTO_INCREMENT1 0x1A +#define TM6000_CHROMA_DTO_INCREMENT0 0x1B +#define TM6000_HSYNC_DTO_INCREMENT3 0x1C +#define TM6000_HSYNC_DTO_INCREMENT2 0x1D +#define TM6000_HSYNC_DTO_INCREMENT1 0x1E +#define TM6000_HSYNC_DTO_INCREMENT0 0x1F +#define TM6000_HSYNC_RISING_EDGE_TIME 0x20 +#define TM6000_HSYNC_PHASE_OFFSET 0x21 +#define TM6000_HSYNC_PLL_START_TIME 0x22 +#define TM6000_HSYNC_PLL_END_TIME 0x23 +#define TM6000_HSYNC_TIP_START_TIME 0x24 +#define TM6000_HSYNC_TIP_END_TIME 0x25 +#define TM6000_HSYNC_RISING_EDGE_START 0x26 +#define TM6000_HSYNC_RISING_EDGE_END 0x27 +#define TM6000_BACKPORCH_START 0x28 +#define TM6000_BACKPORCH_END 0x29 +#define TM6000_HSYNC_FILTER_START 0x2A +#define TM6000_HSYNC_FILTER_END 0x2B +#define TM6000_CHROMA_BURST_START 0x2C +#define TM6000_CHROMA_BURST_END 0x2D +#define TM6000_ACTIVE_VIDEO_HSTART 0x2E +#define TM6000_ACTIVE_VIDEO_HWIDTH 0x2F +#define TM6000_ACTIVE_VIDEO_VSTART 0x30 +#define TM6000_ACTIVE_VIDEO_VHIGHT 0x31 +#define TM6000_VSYNC_HLOCK_MIN 0x32 +#define TM6000_VSYNC_HLOCK_MAX 0x33 +#define TM6000_VSYNC_AGC_MIN 0x34 +#define TM6000_VSYNC_AGC_MAX 0x35 +#define TM6000_VSYNC_VBI_MIN 0x36 +#define TM6000_VSYNC_VBI_MAX 0x37 +#define TM6000_VSYNC_THRESHOLD 0x38 +#define TM6000_VSYNC_TIME_CONSTANT 0x39 +#define TM6000_STATUS1 0x3A +#define TM6000_STATUS2 0x3B +#define TM6000_STATUS3 0x3C +#define TM6000_RESET 0x3F +#define TM6000_TELETEXT_VBI_CODE0 0x40 +#define TM6000_TELETEXT_VBI_CODE1 0x41 +#define TM6000_VBI_DATA_HIGH_LEVEL 0x42 +#define TM6000_VBI_DATA_TYPE_LINE7 0x43 +#define TM6000_VBI_DATA_TYPE_LINE8 0x44 +#define TM6000_VBI_DATA_TYPE_LINE9 0x45 +#define TM6000_VBI_DATA_TYPE_LINE10 0x46 +#define TM6000_VBI_DATA_TYPE_LINE11 0x47 +#define TM6000_VBI_DATA_TYPE_LINE12 0x48 +#define TM6000_VBI_DATA_TYPE_LINE13 0x49 +#define TM6000_VBI_DATA_TYPE_LINE14 0x4A +#define TM6000_VBI_DATA_TYPE_LINE15 0x4B +#define TM6000_VBI_DATA_TYPE_LINE16 0x4C +#define TM6000_VBI_DATA_TYPE_LINE17 0x4D +#define TM6000_VBI_DATA_TYPE_LINE18 0x4E +#define TM6000_VBI_DATA_TYPE_LINE19 0x4F +#define TM6000_VBI_DATA_TYPE_LINE20 0x50 +#define TM6000_VBI_DATA_TYPE_LINE21 0x51 +#define TM6000_VBI_DATA_TYPE_LINE22 0x52 +#define TM6000_VBI_DATA_TYPE_LINE23 0x53 +#define TM6000_VBI_DATA_TYPE_RLINES 0x54 +#define TM6000_VBI_LOOP_FILTER_GAIN 0x55 +#define TM6000_VBI_LOOP_FILTER_I_GAIN 0x56 +#define TM6000_VBI_LOOP_FILTER_P_GAIN 0x57 +#define TM6000_VBI_CAPTION_DTO1 0x58 +#define TM6000_VBI_CAPTION_DTO0 0x59 +#define TM6000_VBI_TELETEXT_DTO1 0x5A +#define TM6000_VBI_TELETEXT_DTO0 0x5B +#define TM6000_VBI_WSS625_DTO1 0x5C +#define TM6000_VBI_WSS625_DTO0 0x5D +#define TM6000_VBI_CAPTION_FRAME_START 0x5E +#define TM6000_VBI_WSS625_FRAME_START 0x5F +#define TM6000_TELETEXT_FRAME_START 0x60 +#define TM6000_VBI_CCDATA1 0x61 +#define TM6000_VBI_CCDATA2 0x62 +#define TM6000_VBI_WSS625_DATA1 0x63 +#define TM6000_VBI_WSS625_DATA2 0x64 +#define TM6000_VBI_DATA_STATUS 0x65 +#define TM6000_VBI_CAPTION_START 0x66 +#define TM6000_VBI_WSS625_START 0x67 +#define TM6000_VBI_TELETEXT_START 0x68 +#define TM6000_HSYNC_DTO_INC_STATUS3 0x70 +#define TM6000_HSYNC_DTO_INC_STATUS2 0x71 +#define TM6000_HSYNC_DTO_INC_STATUS1 0x72 +#define TM6000_HSYNC_DTO_INC_STATUS0 0x73 +#define TM6000_CHROMA_DTO_INC_STATUS3 0x74 +#define TM6000_CHROMA_DTO_INC_STATUS2 0x75 +#define TM6000_CHROMA_DTO_INC_STATUS1 0x76 +#define TM6000_CHROMA_DTO_INC_STATUS0 0x77 +#define TM6000_AGC_AGAIN_STATUS 0x78 +#define TM6000_AGC_DGAIN_STATUS 0x79 +#define TM6000_CHROMA_MAG_STATUS 0x7A +#define TM6000_CHROMA_GAIN_STATUS1 0x7B +#define TM6000_CHROMA_GAIN_STATUS0 0x7C +#define TM6000_CORDIC_FREQ_STATUS 0x7D +#define TM6000_STATUS_NOISE 0x7F +#define TM6000_COMB_FILTER_TRESHOLD 0x80 +#define TM6000_COMB_FILTER_CONFIG 0x82 +#define TM6000_CHROMA_LOCK_CONFIG 0x83 +#define TM6000_NOISE_NTSC_C 0x84 +#define TM6000_NOISE_PAL_C 0x85 +#define TM6000_NOISE_PHASE_C 0x86 +#define TM6000_NOISE_PHASE_Y 0x87 +#define TM6000_CHROMA_LOOPFILTER_STATE 0x8A +#define TM6000_CHROMA_HRESAMPLER 0x8B +#define TM6000_CPUMP_DELAY_ADJ 0x8D +#define TM6000_CPUMP_ADJ 0x8E +#define TM6000_CPUMP_DELAY 0x8F + +/* Define TM6000/TM6010 Miscellaneous registers */ +#define TM6000_ACTIVE_VIDEO_SOURCE 0xC0 +#define TM6000_TRESHOLD 0xC1 +#define TM6000_HSYNC_WIDTH 0xC2 +#define TM6000_HSTART1 0xC3 +#define TM6000_HSTART0 0xC4 +#define TM6000_HEND1 0xC5 +#define TM6000_HEND0 0xC6 +#define TM6000_VSTART1 0xC7 +#define TM6000_VSTART0 0xC8 +#define TM6000_VEND1 0xC9 +#define TM6000_VEND0 0xCA +#define TM6000_DELAY 0xCB +#define TM6000_ACTIVE_VIDEO_IF 0xCC +#define TM6000_USB_PERIPHERY_CONTROL 0xD0 +#define TM6000_ADDR_FOR_REQ1 0xD1 +#define TM6000_ADDR_FOR_REQ2 0xD2 +#define TM6000_ADDR_FOR_REQ3 0xD3 +#define TM6000_ADDR_FOR_REQ4 0xD4 +#define TM6000_POWERSAVE 0xD5 +#define TM6000_ENDP_REQ1_REQ2 0xD6 +#define TM6000_ENDP_REQ3_REQ4 0xD7 +#define TM6000_IR 0xD8 +#define TM6000_IR_BSIZE 0xD9 +#define TM6000_IR_WAKEUP_SEL 0xDA +#define TM6000_IR_WAKEUP_ADD 0xDB +#define TM6000_IR_LEADER1 0xDC +#define TM6000_IR_LEADER0 0xDD +#define TM6000_IR_PULSE_CNT1 0xDE +#define TM6000_IR_PULSE_CNT0 0xDF +#define TM6000_DVIDEO_SOURCE 0xE0 +#define TM6000_DVIDEO_SOURCE_IF 0xE1 +#define TM6000_OUT_SEL2 0xE2 +#define TM6000_OUT_SEL1 0xE3 +#define TM6000_OUT_SEL0 0xE4 +#define TM6000_REMOTE_WAKEUP 0xE5 +#define TM6000_PUB_GPIO 0xE7 +#define TM6000_TYPESEL_MOS_I2S 0xE8 +#define TM6000_TYPESEL_MOS_TS 0xE9 +#define TM6000_TYPESEL_MOS_CCIR 0xEA +#define TM6000_BIST_CRC_RESULT0 0xF0 +#define TM6000_BIST_CRC_RESULT1 0xF1 +#define TM6000_BIST_CRC_RESULT2 0xF2 +#define TM6000_BIST_CRC_RESULT3 0xF3 +#define TM6000_BIST_ERR_VST2 0xF4 +#define TM6000_BIST_ERR_VST1 0xF5 +#define TM6000_BIST_ERR_VST0 0xF6 +#define TM6000_BIST 0xF7 +#define TM6000_POWER_DOWN 0xFE +#define TM6000_SOFT_RESET 0xFF + +/* Define TM6000/TM6010 USB registers */ +#define TM6000_U_MAIN_CTRL 0x00 +#define TM6000_U_DEVADDR 0x01 +#define TM6000_U_TEST 0x02 +#define TM6000_U_SOFN0 0x04 +#define TM6000_U_SOFN1 0x05 +#define TM6000_U_SOFTM0 0x06 +#define TM6000_U_SOFTM1 0x07 +#define TM6000_U_PHY_TEST 0x08 +#define TM6000_U_VCTL 0x09 +#define TM6000_U_VSTA 0x0A +#define TM6000_U_CX_CFG 0x0B +#define TM6000_U_ENDP0_REG0 0x0C +#define TM6000_U_GMASK 0x10 +#define TM6000_U_IMASK0 0x11 +#define TM6000_U_IMASK1 0x12 +#define TM6000_U_IMASK2 0x13 +#define TM6000_U_IMASK3 0x14 +#define TM6000_U_IMASK4 0x15 +#define TM6000_U_IMASK5 0x16 +#define TM6000_U_IMASK6 0x17 +#define TM6000_U_IMASK7 0x18 +#define TM6000_U_ZEROP0 0x19 +#define TM6000_U_ZEROP1 0x1A +#define TM6000_U_FIFO_EMP0 0x1C +#define TM6000_U_FIFO_EMP1 0x1D +#define TM6000_U_IRQ_GROUP 0x20 +#define TM6000_U_IRQ_SOURCE0 0x21 +#define TM6000_U_IRQ_SOURCE1 0x22 +#define TM6000_U_IRQ_SOURCE2 0x23 +#define TM6000_U_IRQ_SOURCE3 0x24 +#define TM6000_U_IRQ_SOURCE4 0x25 +#define TM6000_U_IRQ_SOURCE5 0x26 +#define TM6000_U_IRQ_SOURCE6 0x27 +#define TM6000_U_IRQ_SOURCE7 0x28 +#define TM6000_U_SEQ_ERR0 0x29 +#define TM6000_U_SEQ_ERR1 0x2A +#define TM6000_U_SEQ_ABORT0 0x2B +#define TM6000_U_SEQ_ABORT1 0x2C +#define TM6000_U_TX_ZERO0 0x2D +#define TM6000_U_TX_ZERO1 0x2E +#define TM6000_U_IDLE_CNT 0x2F +#define TM6000_U_FNO_P1 0x30 +#define TM6000_U_FNO_P2 0x31 +#define TM6000_U_FNO_P3 0x32 +#define TM6000_U_FNO_P4 0x33 +#define TM6000_U_FNO_P5 0x34 +#define TM6000_U_FNO_P6 0x35 +#define TM6000_U_FNO_P7 0x36 +#define TM6000_U_FNO_P8 0x37 +#define TM6000_U_FNO_P9 0x38 +#define TM6000_U_FNO_P10 0x39 +#define TM6000_U_FNO_P11 0x3A +#define TM6000_U_FNO_P12 0x3B +#define TM6000_U_FNO_P13 0x3C +#define TM6000_U_FNO_P14 0x3D +#define TM6000_U_FNO_P15 0x3E +#define TM6000_U_IN_MAXPS_LOW1 0x40 +#define TM6000_U_IN_MAXPS_HIGH1 0x41 +#define TM6000_U_IN_MAXPS_LOW2 0x42 +#define TM6000_U_IN_MAXPS_HIGH2 0x43 +#define TM6000_U_IN_MAXPS_LOW3 0x44 +#define TM6000_U_IN_MAXPS_HIGH3 0x45 +#define TM6000_U_IN_MAXPS_LOW4 0x46 +#define TM6000_U_IN_MAXPS_HIGH4 0x47 +#define TM6000_U_IN_MAXPS_LOW5 0x48 +#define TM6000_U_IN_MAXPS_HIGH5 0x49 +#define TM6000_U_IN_MAXPS_LOW6 0x4A +#define TM6000_U_IN_MAXPS_HIGH6 0x4B +#define TM6000_U_IN_MAXPS_LOW7 0x4C +#define TM6000_U_IN_MAXPS_HIGH7 0x4D +#define TM6000_U_IN_MAXPS_LOW8 0x4E +#define TM6000_U_IN_MAXPS_HIGH8 0x4F +#define TM6000_U_IN_MAXPS_LOW9 0x50 +#define TM6000_U_IN_MAXPS_HIGH9 0x51 +#define TM6000_U_IN_MAXPS_LOW10 0x52 +#define TM6000_U_IN_MAXPS_HIGH10 0x53 +#define TM6000_U_IN_MAXPS_LOW11 0x54 +#define TM6000_U_IN_MAXPS_HIGH11 0x55 +#define TM6000_U_IN_MAXPS_LOW12 0x56 +#define TM6000_U_IN_MAXPS_HIGH12 0x57 +#define TM6000_U_IN_MAXPS_LOW13 0x58 +#define TM6000_U_IN_MAXPS_HIGH13 0x59 +#define TM6000_U_IN_MAXPS_LOW14 0x5A +#define TM6000_U_IN_MAXPS_HIGH14 0x5B +#define TM6000_U_IN_MAXPS_LOW15 0x5C +#define TM6000_U_IN_MAXPS_HIGH15 0x5D +#define TM6000_U_OUT_MAXPS_LOW1 0x60 +#define TM6000_U_OUT_MAXPS_HIGH1 0x61 +#define TM6000_U_OUT_MAXPS_LOW2 0x62 +#define TM6000_U_OUT_MAXPS_HIGH2 0x63 +#define TM6000_U_OUT_MAXPS_LOW3 0x64 +#define TM6000_U_OUT_MAXPS_HIGH3 0x65 +#define TM6000_U_OUT_MAXPS_LOW4 0x66 +#define TM6000_U_OUT_MAXPS_HIGH4 0x67 +#define TM6000_U_OUT_MAXPS_LOW5 0x68 +#define TM6000_U_OUT_MAXPS_HIGH5 0x69 +#define TM6000_U_OUT_MAXPS_LOW6 0x6A +#define TM6000_U_OUT_MAXPS_HIGH6 0x6B +#define TM6000_U_OUT_MAXPS_LOW7 0x6C +#define TM6000_U_OUT_MAXPS_HIGH7 0x6D +#define TM6000_U_OUT_MAXPS_LOW8 0x6E +#define TM6000_U_OUT_MAXPS_HIGH8 0x6F +#define TM6000_U_OUT_MAXPS_LOW9 0x70 +#define TM6000_U_OUT_MAXPS_HIGH9 0x71 +#define TM6000_U_OUT_MAXPS_LOW10 0x72 +#define TM6000_U_OUT_MAXPS_HIGH10 0x73 +#define TM6000_U_OUT_MAXPS_LOW11 0x74 +#define TM6000_U_OUT_MAXPS_HIGH11 0x75 +#define TM6000_U_OUT_MAXPS_LOW12 0x76 +#define TM6000_U_OUT_MAXPS_HIGH12 0x77 +#define TM6000_U_OUT_MAXPS_LOW13 0x78 +#define TM6000_U_OUT_MAXPS_HIGH13 0x79 +#define TM6000_U_OUT_MAXPS_LOW14 0x7A +#define TM6000_U_OUT_MAXPS_HIGH14 0x7B +#define TM6000_U_OUT_MAXPS_LOW15 0x7C +#define TM6000_U_OUT_MAXPS_HIGH15 0x7D +#define TM6000_U_FIFO0 0x80 +#define TM6000_U_FIFO1 0x81 +#define TM6000_U_FIFO2 0x82 +#define TM6000_U_FIFO3 0x83 +#define TM6000_U_FIFO4 0x84 +#define TM6000_U_FIFO5 0x85 +#define TM6000_U_FIFO6 0x86 +#define TM6000_U_FIFO7 0x87 +#define TM6000_U_FIFO8 0x88 +#define TM6000_U_FIFO9 0x89 +#define TM6000_U_FIFO10 0x8A +#define TM6000_U_FIFO11 0x8B +#define TM6000_U_FIFO12 0x8C +#define TM6000_U_FIFO13 0x8D +#define TM6000_U_FIFO14 0x8E +#define TM6000_U_FIFO15 0x8F +#define TM6000_U_CFG_FIFO0 0x90 +#define TM6000_U_CFG_FIFO1 0x91 +#define TM6000_U_CFG_FIFO2 0x92 +#define TM6000_U_CFG_FIFO3 0x93 +#define TM6000_U_CFG_FIFO4 0x94 +#define TM6000_U_CFG_FIFO5 0x95 +#define TM6000_U_CFG_FIFO6 0x96 +#define TM6000_U_CFG_FIFO7 0x97 +#define TM6000_U_CFG_FIFO8 0x98 +#define TM6000_U_CFG_FIFO9 0x99 +#define TM6000_U_CFG_FIFO10 0x9A +#define TM6000_U_CFG_FIFO11 0x9B +#define TM6000_U_CFG_FIFO12 0x9C +#define TM6000_U_CFG_FIFO13 0x9D +#define TM6000_U_CFG_FIFO14 0x9E +#define TM6000_U_CFG_FIFO15 0x9F +#define TM6000_U_CTL_FIFO0 0xA0 +#define TM6000_U_CTL_FIFO1 0xA1 +#define TM6000_U_CTL_FIFO2 0xA2 +#define TM6000_U_CTL_FIFO3 0xA3 +#define TM6000_U_CTL_FIFO4 0xA4 +#define TM6000_U_CTL_FIFO5 0xA5 +#define TM6000_U_CTL_FIFO6 0xA6 +#define TM6000_U_CTL_FIFO7 0xA7 +#define TM6000_U_CTL_FIFO8 0xA8 +#define TM6000_U_CTL_FIFO9 0xA9 +#define TM6000_U_CTL_FIFO10 0xAA +#define TM6000_U_CTL_FIFO11 0xAB +#define TM6000_U_CTL_FIFO12 0xAC +#define TM6000_U_CTL_FIFO13 0xAD +#define TM6000_U_CTL_FIFO14 0xAE +#define TM6000_U_CTL_FIFO15 0xAF +#define TM6000_U_BC_LOW_FIFO0 0xB0 +#define TM6000_U_BC_LOW_FIFO1 0xB1 +#define TM6000_U_BC_LOW_FIFO2 0xB2 +#define TM6000_U_BC_LOW_FIFO3 0xB3 +#define TM6000_U_BC_LOW_FIFO4 0xB4 +#define TM6000_U_BC_LOW_FIFO5 0xB5 +#define TM6000_U_BC_LOW_FIFO6 0xB6 +#define TM6000_U_BC_LOW_FIFO7 0xB7 +#define TM6000_U_BC_LOW_FIFO8 0xB8 +#define TM6000_U_BC_LOW_FIFO9 0xB9 +#define TM6000_U_BC_LOW_FIFO10 0xBA +#define TM6000_U_BC_LOW_FIFO11 0xBB +#define TM6000_U_BC_LOW_FIFO12 0xBC +#define TM6000_U_BC_LOW_FIFO13 0xBD +#define TM6000_U_BC_LOW_FIFO14 0xBE +#define TM6000_U_BC_LOW_FIFO15 0xBF +#define TM6000_U_DATA_FIFO0 0xC0 +#define TM6000_U_DATA_FIFO1 0xC4 +#define TM6000_U_DATA_FIFO2 0xC8 +#define TM6000_U_DATA_FIFO3 0xCC +#define TM6000_U_DATA_FIFO4 0xD0 +#define TM6000_U_DATA_FIFO5 0xD4 +#define TM6000_U_DATA_FIFO6 0xD8 +#define TM6000_U_DATA_FIFO7 0xDC +#define TM6000_U_DATA_FIFO8 0xE0 +#define TM6000_U_DATA_FIFO9 0xE4 +#define TM6000_U_DATA_FIFO10 0xE8 +#define TM6000_U_DATA_FIFO11 0xEC +#define TM6000_U_DATA_FIFO12 0xF0 +#define TM6000_U_DATA_FIFO13 0xF4 +#define TM6000_U_DATA_FIFO14 0xF8 +#define TM6000_U_DATA_FIFO15 0xFC + +/* Define TM6000/TM6010 Audio decoder registers */ +#define TM6000_A_VERSION 0x00 +#define TM6000_A_INIT 0x01 +#define TM6000_A_FIX_GAIN_CTRL 0x02 +#define TM6000_A_AUTO_GAIN_CTRL 0x03 +#define TM6000_A_SIF_AMP_CTRL 0x04 +#define TM6000_A_STANDARD_MOD 0x05 +#define TM6000_A_SOUND_MOD 0x06 +#define TM6000_A_LEFT_VOL 0x07 +#define TM6000_A_RIGHT_VOL 0x08 +#define TM6000_A_MAIN_VOL 0x09 +#define TM6000_A_I2S_MOD 0x0A +#define TM6000_A_ASD_THRES1 0x0B +#define TM6000_A_ASD_THRES2 0x0C +#define TM6000_A_AMD_THRES 0x0D +#define TM6000_A_MONO_THRES1 0x0E +#define TM6000_A_MONO_THRES2 0x0F +#define TM6000_A_MUTE_THRES1 0x10 +#define TM6000_A_MUTE_THRES2 0x11 +#define TM6000_A_AGC_U 0x12 +#define TM6000_A_AGC_ERR_T 0x13 +#define TM6000_A_AGC_GAIN_INIT 0x14 +#define TM6000_A_AGC_STEP_THR 0x15 +#define TM6000_A_AGC_GAIN_MAX 0x16 +#define TM6000_A_AGC_GAIN_MIN 0x17 +#define TM6000_A_TR_CTRL 0x18 +#define TM6000_A_FH_2FH_GAIN 0x19 +#define TM6000_A_NICAM_SER_MAX 0x1A +#define TM6000_A_NICAM_SER_MIN 0x1B +#define TM6000_A_GAIN_DEEMPH_OUT 0x1E +#define TM6000_A_TEST_INTF_SEL 0x1F +#define TM6000_A_TEST_PIN_SEL 0x20 +#define TM6000_A_AGC_ERR 0x21 +#define TM6000_A_AGC_GAIN 0x22 +#define TM6000_A_NICAM_INFO 0x23 +#define TM6000_A_SER 0x24 +#define TM6000_A_C1_AMP 0x25 +#define TM6000_A_C2_AMP 0x26 +#define TM6000_A_NOISE_AMP 0x27 +#define TM6000_A_AUDIO_MODE_RES 0x28 + +/* Define TM6000/TM6010 Video ADC registers */ +#define TM6000_ADC_REF 0xE0 +#define TM6000_DAC_CLMP 0xE1 +#define TM6000_POWER_DOWN_CTRL1 0xE2 +#define TM6000_ADC_IN1_SEL 0xE3 +#define TM6000_ADC_IN2_SEL 0xE4 +#define TM6000_GAIN_PARAM 0xE5 +#define TM6000_POWER_DOWN_CTRL2 0xE6 +#define TM6000_REG_GAIN_Y 0xE7 +#define TM6000_REG_GAIN_C 0xE8 +#define TM6000_BIAS_CTRL 0xE9 +#define TM6000_BUFF_DRV_CTRL 0xEA +#define TM6000_SIF_GAIN_CTRL 0xEB +#define TM6000_REVERSE_YC_CTRL 0xEC +#define TM6000_GAIN_SEL 0xED + +/* Define TM6000/TM6010 Audio ADC registers */ +#define TM6000_DAUDIO_INPUT_CONFIG 0xF0 +#define TM6000_AADC_POWER_DOWN 0xF1 +#define TM6000_LEFT_CHANNEL_VOL 0xF2 +#define TM6000_RIGHT_CHANNEL_VOL 0xF3 -- GitLab From 4de39f5d6f8267a0b062cba70eaa84fb161007e4 Mon Sep 17 00:00:00 2001 From: Dean Anderson Date: Wed, 3 Mar 2010 19:39:19 -0300 Subject: [PATCH 131/534] V4L/DVB: s2255drv: adding video input status capability Video status capability for inputs on Sensoray 2255 driver. Signed-off-by: Dean Anderson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/s2255drv.c | 85 ++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 3de914deb8ee..a9c53335fd8f 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -1,7 +1,7 @@ /* * s2255drv.c - a driver for the Sensoray 2255 USB video capture device * - * Copyright (C) 2007-2008 by Sensoray Company Inc. + * Copyright (C) 2007-2010 by Sensoray Company Inc. * Dean Anderson * * Some video buffer code based on vivi driver: @@ -76,11 +76,13 @@ #define S2255_LOAD_TIMEOUT (5000 + S2255_DSP_BOOTTIME) #define S2255_DEF_BUFS 16 #define S2255_SETMODE_TIMEOUT 500 +#define S2255_VIDSTATUS_TIMEOUT 350 #define MAX_CHANNELS 4 #define S2255_MARKER_FRAME 0x2255DA4AL #define S2255_MARKER_RESPONSE 0x2255ACACL #define S2255_RESPONSE_SETMODE 0x01 #define S2255_RESPONSE_FW 0x10 +#define S2255_RESPONSE_STATUS 0x20 #define S2255_USB_XFER_SIZE (16 * 1024) #define MAX_CHANNELS 4 #define MAX_PIPE_BUFFERS 1 @@ -261,9 +263,16 @@ struct s2255_dev { int chn_configured[MAX_CHANNELS]; wait_queue_head_t wait_setmode[MAX_CHANNELS]; int setmode_ready[MAX_CHANNELS]; + /* video status items */ + int vidstatus[MAX_CHANNELS]; + wait_queue_head_t wait_vidstatus[MAX_CHANNELS]; + int vidstatus_ready[MAX_CHANNELS]; + int chn_ready; struct kref kref; spinlock_t slock; + /* dsp firmware version (f2255usb.bin) */ + int dsp_fw_ver; }; #define to_s2255_dev(d) container_of(d, struct s2255_dev, kref) @@ -296,8 +305,12 @@ struct s2255_fh { /* current cypress EEPROM firmware version */ #define S2255_CUR_USB_FWVER ((3 << 8) | 6) +/* current DSP FW version */ +#define S2255_CUR_DSP_FWVER 5 +/* Need DSP version 5+ for video status feature */ +#define S2255_MIN_DSP_STATUS 5 #define S2255_MAJOR_VERSION 1 -#define S2255_MINOR_VERSION 14 +#define S2255_MINOR_VERSION 15 #define S2255_RELEASE 0 #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ S2255_MINOR_VERSION, \ @@ -1261,6 +1274,42 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, return res; } +static int s2255_cmd_status(struct s2255_dev *dev, unsigned long chn, + u32 *pstatus) +{ + int res; + u32 *buffer; + u32 chn_rev; + mutex_lock(&dev->lock); + chn_rev = G_chnmap[chn]; + dprintk(4, "%s chan %d\n", __func__, chn_rev); + buffer = kzalloc(512, GFP_KERNEL); + if (buffer == NULL) { + dev_err(&dev->udev->dev, "out of mem\n"); + mutex_unlock(&dev->lock); + return -ENOMEM; + } + /* form the get vid status command */ + buffer[0] = IN_DATA_TOKEN; + buffer[1] = chn_rev; + buffer[2] = CMD_STATUS; + *pstatus = 0; + dev->vidstatus_ready[chn] = 0; + res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); + kfree(buffer); + wait_event_timeout(dev->wait_vidstatus[chn], + (dev->vidstatus_ready[chn] != 0), + msecs_to_jiffies(S2255_VIDSTATUS_TIMEOUT)); + if (dev->vidstatus_ready[chn] != 1) { + printk(KERN_DEBUG "s2255: no vidstatus response\n"); + res = -EFAULT; + } + *pstatus = dev->vidstatus[chn]; + dprintk(4, "%s, vid status %d\n", __func__, *pstatus); + mutex_unlock(&dev->lock); + return res; +} + static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) { int res; @@ -1386,11 +1435,24 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *i) static int vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *inp) { + struct s2255_fh *fh = priv; + struct s2255_dev *dev = fh->dev; + u32 status = 0; + if (inp->index != 0) return -EINVAL; inp->type = V4L2_INPUT_TYPE_CAMERA; inp->std = S2255_NORMS; + inp->status = 0; + if (dev->dsp_fw_ver >= S2255_MIN_DSP_STATUS) { + int rc; + rc = s2255_cmd_status(dev, fh->channel, &status); + dprintk(4, "s2255_cmd_status rc: %d status %x\n", rc, status); + if (rc == 0) + inp->status = (status & 0x01) ? 0 + : V4L2_IN_ST_NO_SIGNAL; + } strlcpy(inp->name, "Camera", sizeof(inp->name)); return 0; } @@ -1700,6 +1762,8 @@ static void s2255_destroy(struct kref *kref) for (i = 0; i < MAX_CHANNELS; i++) { dev->setmode_ready[i] = 1; wake_up(&dev->wait_setmode[i]); + dev->vidstatus_ready[i] = 1; + wake_up(&dev->wait_vidstatus[i]); } mutex_lock(&dev->open_lock); /* reset the DSP so firmware can be reload next time */ @@ -1965,6 +2029,13 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info) S2255_FW_SUCCESS); wake_up(&dev->fw_data->wait_fw); break; + case S2255_RESPONSE_STATUS: + dev->vidstatus[cc] = pdword[3]; + dev->vidstatus_ready[cc] = 1; + wake_up(&dev->wait_vidstatus[cc]); + dprintk(5, "got vidstatus %x chan %d\n", + pdword[3], cc); + break; default: printk(KERN_INFO "s2255 unknown resp\n"); } @@ -2527,9 +2598,10 @@ static int s2255_probe(struct usb_interface *interface, dev->timer.data = (unsigned long)dev->fw_data; init_waitqueue_head(&dev->fw_data->wait_fw); - for (i = 0; i < MAX_CHANNELS; i++) + for (i = 0; i < MAX_CHANNELS; i++) { init_waitqueue_head(&dev->wait_setmode[i]); - + init_waitqueue_head(&dev->wait_vidstatus[i]); + } dev->fw_data->fw_urb = usb_alloc_urb(0, GFP_KERNEL); @@ -2561,6 +2633,9 @@ static int s2255_probe(struct usb_interface *interface, __le32 *pRel; pRel = (__le32 *) &dev->fw_data->fw->data[fw_size - 4]; printk(KERN_INFO "s2255 dsp fw version %x\n", *pRel); + dev->dsp_fw_ver = *pRel; + if (*pRel < S2255_CUR_DSP_FWVER) + printk(KERN_INFO "s2255: f2255usb.bin out of date.\n"); } /* loads v4l specific */ s2255_probe_v4l(dev); @@ -2597,6 +2672,8 @@ static void s2255_disconnect(struct usb_interface *interface) for (i = 0; i < MAX_CHANNELS; i++) { dev->setmode_ready[i] = 1; wake_up(&dev->wait_setmode[i]); + dev->vidstatus_ready[i] = 1; + wake_up(&dev->wait_vidstatus[i]); } mutex_lock(&dev->open_lock); -- GitLab From 811fab623f435932f2a26aa64b40ec6102618cc6 Mon Sep 17 00:00:00 2001 From: Antonio Larrosa Date: Thu, 4 Mar 2010 22:19:48 -0300 Subject: [PATCH 132/534] V4L/DVB: em28xx: Support for Kworld VS-DVB-T 323UR This patch adapts the changes submitted by Dainius Ridzevicius to the linux-media mailing list on 8/14/09, to the current sources in order to make the Kworld VS-DVB-T 323UR usb device work. I also removed the "not validated" flag since I own the device and validated that it works fine after the patch is applied. Thanks to Devin Heitmueller for his guidance with the code. Signed-off-by: Antonio Larrosa Acked-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-cards.c | 7 ++++++- drivers/media/video/em28xx/em28xx-dvb.c | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index b0fb08337710..5ed834ee7569 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -1404,10 +1404,14 @@ struct em28xx_board em28xx_boards[] = { }, [EM2882_BOARD_KWORLD_VS_DVBT] = { .name = "Kworld VS-DVB-T 323UR", - .valid = EM28XX_BOARD_NOT_VALIDATED, .tuner_type = TUNER_XC2028, .tuner_gpio = default_tuner_gpio, .decoder = EM28XX_TVP5150, + .mts_firmware = 1, + .has_dvb = 1, + .dvb_gpio = kworld_330u_digital, + .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */ + .ir_codes = &ir_codes_kworld_315u_table, .input = { { .type = EM28XX_VMUX_TELEVISION, .vmux = TVP5150_COMPOSITE0, @@ -2138,6 +2142,7 @@ static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl) break; case EM2883_BOARD_KWORLD_HYBRID_330U: case EM2882_BOARD_DIKOM_DK300: + case EM2882_BOARD_KWORLD_VS_DVBT: ctl->demod = XC3028_FE_CHINA; ctl->fname = XC2028_DEFAULT_FIRMWARE; break; diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c index bcd3c371009b..e7b3d5371558 100644 --- a/drivers/media/video/em28xx/em28xx-dvb.c +++ b/drivers/media/video/em28xx/em28xx-dvb.c @@ -506,6 +506,7 @@ static int dvb_init(struct em28xx *dev) case EM2880_BOARD_TERRATEC_HYBRID_XS_FR: case EM2881_BOARD_PINNACLE_HYBRID_PRO: case EM2882_BOARD_DIKOM_DK300: + case EM2882_BOARD_KWORLD_VS_DVBT: dvb->frontend = dvb_attach(zl10353_attach, &em28xx_zl10353_xc3028_no_i2c_gate, &dev->i2c_adap); -- GitLab From 3fa0060526eafe3eeda1db681b4aab5b79d4543e Mon Sep 17 00:00:00 2001 From: Dean Anderson Date: Thu, 4 Mar 2010 20:47:33 -0300 Subject: [PATCH 133/534] V4L/DVB: s2255drv: fixes for big endian arch s2255drv fixes for big endian architecture Signed-off-by: Dean Anderson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/s2255drv.c | 55 ++++++++++++++++------------------ 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index a9c53335fd8f..882a79679dc6 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -78,11 +78,11 @@ #define S2255_SETMODE_TIMEOUT 500 #define S2255_VIDSTATUS_TIMEOUT 350 #define MAX_CHANNELS 4 -#define S2255_MARKER_FRAME 0x2255DA4AL -#define S2255_MARKER_RESPONSE 0x2255ACACL -#define S2255_RESPONSE_SETMODE 0x01 -#define S2255_RESPONSE_FW 0x10 -#define S2255_RESPONSE_STATUS 0x20 +#define S2255_MARKER_FRAME cpu_to_le32(0x2255DA4AL) +#define S2255_MARKER_RESPONSE cpu_to_le32(0x2255ACACL) +#define S2255_RESPONSE_SETMODE cpu_to_le32(0x01) +#define S2255_RESPONSE_FW cpu_to_le32(0x10) +#define S2255_RESPONSE_STATUS cpu_to_le32(0x20) #define S2255_USB_XFER_SIZE (16 * 1024) #define MAX_CHANNELS 4 #define MAX_PIPE_BUFFERS 1 @@ -141,12 +141,12 @@ #define DEF_HUE 0 /* usb config commands */ -#define IN_DATA_TOKEN 0x2255c0de -#define CMD_2255 0xc2255000 -#define CMD_SET_MODE (CMD_2255 | 0x10) -#define CMD_START (CMD_2255 | 0x20) -#define CMD_STOP (CMD_2255 | 0x30) -#define CMD_STATUS (CMD_2255 | 0x40) +#define IN_DATA_TOKEN cpu_to_le32(0x2255c0de) +#define CMD_2255 cpu_to_le32(0xc2255000) +#define CMD_SET_MODE cpu_to_le32((CMD_2255 | 0x10)) +#define CMD_START cpu_to_le32((CMD_2255 | 0x20)) +#define CMD_STOP cpu_to_le32((CMD_2255 | 0x30)) +#define CMD_STATUS cpu_to_le32((CMD_2255 | 0x40)) struct s2255_mode { u32 format; /* input video format (NTSC, PAL) */ @@ -310,7 +310,7 @@ struct s2255_fh { /* Need DSP version 5+ for video status feature */ #define S2255_MIN_DSP_STATUS 5 #define S2255_MAJOR_VERSION 1 -#define S2255_MINOR_VERSION 15 +#define S2255_MINOR_VERSION 16 #define S2255_RELEASE 0 #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ S2255_MINOR_VERSION, \ @@ -1219,9 +1219,8 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, struct s2255_mode *mode) { int res; - u32 *buffer; + __le32 *buffer; unsigned long chn_rev; - mutex_lock(&dev->lock); chn_rev = G_chnmap[chn]; dprintk(3, "mode scale [%ld] %p %d\n", chn, mode, mode->scale); @@ -1247,7 +1246,7 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, /* set the mode */ buffer[0] = IN_DATA_TOKEN; - buffer[1] = (u32) chn_rev; + buffer[1] = (__le32) cpu_to_le32(chn_rev); buffer[2] = CMD_SET_MODE; memcpy(&buffer[3], &dev->mode[chn], sizeof(struct s2255_mode)); dev->setmode_ready[chn] = 0; @@ -1278,7 +1277,7 @@ static int s2255_cmd_status(struct s2255_dev *dev, unsigned long chn, u32 *pstatus) { int res; - u32 *buffer; + __le32 *buffer; u32 chn_rev; mutex_lock(&dev->lock); chn_rev = G_chnmap[chn]; @@ -1291,7 +1290,7 @@ static int s2255_cmd_status(struct s2255_dev *dev, unsigned long chn, } /* form the get vid status command */ buffer[0] = IN_DATA_TOKEN; - buffer[1] = chn_rev; + buffer[1] = (__le32) cpu_to_le32(chn_rev); buffer[2] = CMD_STATUS; *pstatus = 0; dev->vidstatus_ready[chn] = 0; @@ -1971,14 +1970,14 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info) if (frm->ulState == S2255_READ_IDLE) { int jj; unsigned int cc; - s32 *pdword; + __le32 *pdword; /*data from dsp is little endian */ int payload; /* search for marker codes */ pdata = (unsigned char *)pipe_info->transfer_buffer; + pdword = (__le32 *)pdata; for (jj = 0; jj < (pipe_info->cur_transfer_size - 12); jj++) { - switch (*(s32 *) pdata) { + switch (*pdword) { case S2255_MARKER_FRAME: - pdword = (s32 *)pdata; dprintk(4, "found frame marker at offset:" " %d [%x %x]\n", jj, pdata[0], pdata[1]); @@ -2002,7 +2001,6 @@ static int save_frame(struct s2255_dev *dev, struct s2255_pipeinfo *pipe_info) dev->jpg_size[dev->cc] = pdword[4]; break; case S2255_MARKER_RESPONSE: - pdword = (s32 *)pdata; pdata += DEF_USB_BLOCK; jj += DEF_USB_BLOCK; if (pdword[1] >= MAX_CHANNELS) @@ -2437,9 +2435,9 @@ static int s2255_start_acquire(struct s2255_dev *dev, unsigned long chn) } /* send the start command */ - *(u32 *) buffer = IN_DATA_TOKEN; - *((u32 *) buffer + 1) = (u32) chn_rev; - *((u32 *) buffer + 2) = (u32) CMD_START; + *(__le32 *) buffer = IN_DATA_TOKEN; + *((__le32 *) buffer + 1) = (__le32) cpu_to_le32(chn_rev); + *((__le32 *) buffer + 2) = CMD_START; res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); if (res != 0) dev_err(&dev->udev->dev, "CMD_START error\n"); @@ -2454,24 +2452,21 @@ static int s2255_stop_acquire(struct s2255_dev *dev, unsigned long chn) unsigned char *buffer; int res; unsigned long chn_rev; - if (chn >= MAX_CHANNELS) { dprintk(2, "stop acquire failed, bad channel %lu\n", chn); return -1; } chn_rev = G_chnmap[chn]; - buffer = kzalloc(512, GFP_KERNEL); if (buffer == NULL) { dev_err(&dev->udev->dev, "out of mem\n"); return -ENOMEM; } - /* send the stop command */ dprintk(4, "stop acquire %lu\n", chn); - *(u32 *) buffer = IN_DATA_TOKEN; - *((u32 *) buffer + 1) = (u32) chn_rev; - *((u32 *) buffer + 2) = CMD_STOP; + *(__le32 *) buffer = IN_DATA_TOKEN; + *((__le32 *) buffer + 1) = (__le32) cpu_to_le32(chn_rev); + *((__le32 *) buffer + 2) = CMD_STOP; res = s2255_write_config(dev->udev, (unsigned char *)buffer, 512); if (res != 0) -- GitLab From 2e70db9a4553e0f79cb4db05c0552d33932cca80 Mon Sep 17 00:00:00 2001 From: Dean Anderson Date: Fri, 5 Mar 2010 14:29:09 -0300 Subject: [PATCH 134/534] V4L/DVB: s2255drv: cleanup of V4L2 controls Signed-off-by: Dean Anderson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/s2255drv.c | 166 ++++++++++++--------------------- 1 file changed, 62 insertions(+), 104 deletions(-) diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 882a79679dc6..631a84eea1ae 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -310,7 +310,7 @@ struct s2255_fh { /* Need DSP version 5+ for video status feature */ #define S2255_MIN_DSP_STATUS 5 #define S2255_MAJOR_VERSION 1 -#define S2255_MINOR_VERSION 16 +#define S2255_MINOR_VERSION 17 #define S2255_RELEASE 0 #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ S2255_MINOR_VERSION, \ @@ -384,49 +384,6 @@ MODULE_DEVICE_TABLE(usb, s2255_table); #define BUFFER_TIMEOUT msecs_to_jiffies(400) -/* supported controls */ -static struct v4l2_queryctrl s2255_qctrl[] = { - { - .id = V4L2_CID_BRIGHTNESS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Brightness", - .minimum = -127, - .maximum = 128, - .step = 1, - .default_value = 0, - .flags = 0, - }, { - .id = V4L2_CID_CONTRAST, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Contrast", - .minimum = 0, - .maximum = 255, - .step = 0x1, - .default_value = DEF_CONTRAST, - .flags = 0, - }, { - .id = V4L2_CID_SATURATION, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Saturation", - .minimum = 0, - .maximum = 255, - .step = 0x1, - .default_value = DEF_SATURATION, - .flags = 0, - }, { - .id = V4L2_CID_HUE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Hue", - .minimum = 0, - .maximum = 255, - .step = 0x1, - .default_value = DEF_HUE, - .flags = 0, - } -}; - -static int qctl_regs[ARRAY_SIZE(s2255_qctrl)]; - /* image formats. */ static const struct s2255_fmt formats[] = { { @@ -1472,74 +1429,82 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) static int vidioc_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *qc) { - int i; - - for (i = 0; i < ARRAY_SIZE(s2255_qctrl); i++) - if (qc->id && qc->id == s2255_qctrl[i].id) { - memcpy(qc, &(s2255_qctrl[i]), sizeof(*qc)); - return 0; - } - - dprintk(4, "query_ctrl -EINVAL %d\n", qc->id); - return -EINVAL; + switch (qc->id) { + case V4L2_CID_BRIGHTNESS: + v4l2_ctrl_query_fill(qc, -127, 127, 1, DEF_BRIGHT); + break; + case V4L2_CID_CONTRAST: + v4l2_ctrl_query_fill(qc, 0, 255, 1, DEF_CONTRAST); + break; + case V4L2_CID_SATURATION: + v4l2_ctrl_query_fill(qc, 0, 255, 1, DEF_SATURATION); + break; + case V4L2_CID_HUE: + v4l2_ctrl_query_fill(qc, 0, 255, 1, DEF_HUE); + break; + default: + return -EINVAL; + } + dprintk(4, "%s, id %d\n", __func__, qc->id); + return 0; } static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { - int i; - - for (i = 0; i < ARRAY_SIZE(s2255_qctrl); i++) - if (ctrl->id == s2255_qctrl[i].id) { - ctrl->value = qctl_regs[i]; - return 0; - } - dprintk(4, "g_ctrl -EINVAL\n"); - - return -EINVAL; + struct s2255_fh *fh = priv; + switch (ctrl->id) { + case V4L2_CID_BRIGHTNESS: + ctrl->value = fh->mode.bright; + break; + case V4L2_CID_CONTRAST: + ctrl->value = fh->mode.contrast; + break; + case V4L2_CID_SATURATION: + ctrl->value = fh->mode.saturation; + break; + case V4L2_CID_HUE: + ctrl->value = fh->mode.hue; + break; + default: + return -EINVAL; + } + dprintk(4, "%s, id %d val %d\n", __func__, ctrl->id, ctrl->value); + return 0; } static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { - int i; struct s2255_fh *fh = priv; struct s2255_dev *dev = fh->dev; struct s2255_mode *mode; mode = &fh->mode; - dprintk(4, "vidioc_s_ctrl\n"); - for (i = 0; i < ARRAY_SIZE(s2255_qctrl); i++) { - if (ctrl->id == s2255_qctrl[i].id) { - if (ctrl->value < s2255_qctrl[i].minimum || - ctrl->value > s2255_qctrl[i].maximum) - return -ERANGE; - - qctl_regs[i] = ctrl->value; - /* update the mode to the corresponding value */ - switch (ctrl->id) { - case V4L2_CID_BRIGHTNESS: - mode->bright = ctrl->value; - break; - case V4L2_CID_CONTRAST: - mode->contrast = ctrl->value; - break; - case V4L2_CID_HUE: - mode->hue = ctrl->value; - break; - case V4L2_CID_SATURATION: - mode->saturation = ctrl->value; - break; - } - mode->restart = 0; - /* set mode here. Note: stream does not need restarted. - some V4L programs restart stream unnecessarily - after a s_crtl. - */ - s2255_set_mode(dev, fh->channel, mode); - return 0; - } + dprintk(4, "%s\n", __func__); + /* update the mode to the corresponding value */ + switch (ctrl->id) { + case V4L2_CID_BRIGHTNESS: + mode->bright = ctrl->value; + break; + case V4L2_CID_CONTRAST: + mode->contrast = ctrl->value; + break; + case V4L2_CID_HUE: + mode->hue = ctrl->value; + break; + case V4L2_CID_SATURATION: + mode->saturation = ctrl->value; + break; + default: + return -EINVAL; } - return -EINVAL; + mode->restart = 0; + /* set mode here. Note: stream does not need restarted. + some V4L programs restart stream unnecessarily + after a s_crtl. + */ + s2255_set_mode(dev, fh->channel, mode); + return 0; } static int vidioc_g_jpegcomp(struct file *file, void *priv, @@ -1701,18 +1666,11 @@ static int s2255_open(struct file *file) fh->width = LINE_SZ_4CIFS_NTSC; fh->height = NUM_LINES_4CIFS_NTSC * 2; fh->channel = cur_channel; - /* configure channel to default state */ if (!dev->chn_configured[cur_channel]) { s2255_set_mode(dev, cur_channel, &fh->mode); dev->chn_configured[cur_channel] = 1; } - - - /* Put all controls at a sane state */ - for (i = 0; i < ARRAY_SIZE(s2255_qctrl); i++) - qctl_regs[i] = s2255_qctrl[i].default_value; - dprintk(1, "s2255drv: open dev=%s type=%s users=%d\n", video_device_node_name(vdev), v4l2_type_names[type], dev->users[cur_channel]); -- GitLab From 5a34d9dfaf3cb690c448fac67923effac08c902d Mon Sep 17 00:00:00 2001 From: Dean Anderson Date: Fri, 5 Mar 2010 19:59:48 -0300 Subject: [PATCH 135/534] V4L/DVB: s2255drv: Add support for 2257 device 2257 is 2255 with 2 svideo inputs Signed-off-by: Dean Anderson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/s2255drv.c | 154 +++++++++++++++++++++++++++------ 1 file changed, 129 insertions(+), 25 deletions(-) diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 631a84eea1ae..745f557200aa 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -120,9 +120,10 @@ #define COLOR_YUVPK 2 /* YUV packed */ #define COLOR_Y8 4 /* monochrome */ #define COLOR_JPG 5 /* JPEG */ -#define MASK_COLOR 0xff -#define MASK_JPG_QUALITY 0xff00 +#define MASK_COLOR 0x000000ff +#define MASK_JPG_QUALITY 0x0000ff00 +#define MASK_INPUT_TYPE 0x000f0000 /* frame decimation. Not implemented by V4L yet(experimental in V4L) */ #define FDEC_1 1 /* capture every frame. default */ #define FDEC_2 2 /* capture every 2nd frame */ @@ -196,7 +197,6 @@ struct s2255_dmaqueue { #define S2255_FW_SUCCESS 2 #define S2255_FW_FAILED 3 #define S2255_FW_DISCONNECTING 4 - #define S2255_FW_MARKER cpu_to_le32(0x22552f2f) /* 2255 read states */ #define S2255_READ_IDLE 0 @@ -267,12 +267,12 @@ struct s2255_dev { int vidstatus[MAX_CHANNELS]; wait_queue_head_t wait_vidstatus[MAX_CHANNELS]; int vidstatus_ready[MAX_CHANNELS]; - int chn_ready; - struct kref kref; spinlock_t slock; /* dsp firmware version (f2255usb.bin) */ int dsp_fw_ver; + u16 pid; /* product id */ + struct kref kref; }; #define to_s2255_dev(d) container_of(d, struct s2255_dev, kref) @@ -306,20 +306,49 @@ struct s2255_fh { /* current cypress EEPROM firmware version */ #define S2255_CUR_USB_FWVER ((3 << 8) | 6) /* current DSP FW version */ -#define S2255_CUR_DSP_FWVER 5 +#define S2255_CUR_DSP_FWVER 8 /* Need DSP version 5+ for video status feature */ -#define S2255_MIN_DSP_STATUS 5 +#define S2255_MIN_DSP_STATUS 5 +#define S2255_MIN_DSP_COLORFILTER 8 #define S2255_MAJOR_VERSION 1 -#define S2255_MINOR_VERSION 17 +#define S2255_MINOR_VERSION 18 #define S2255_RELEASE 0 #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ S2255_MINOR_VERSION, \ S2255_RELEASE) -/* vendor ids */ -#define USB_S2255_VENDOR_ID 0x1943 -#define USB_S2255_PRODUCT_ID 0x2255 #define S2255_NORMS (V4L2_STD_PAL | V4L2_STD_NTSC) + +/* private V4L2 controls */ + +/* + * The following chart displays how COLORFILTER should be set + * ========================================================= + * = fourcc = COLORFILTER = + * = =============================== + * = = 0 = 1 = + * ========================================================= + * = V4L2_PIX_FMT_GREY(Y8) = monochrome from = monochrome= + * = = s-video or = composite = + * = = B/W camera = input = + * ========================================================= + * = other = color, svideo = color, = + * = = = composite = + * ========================================================= + * + * Notes: + * channels 0-3 on 2255 are composite + * channels 0-1 on 2257 are composite, 2-3 are s-video + * If COLORFILTER is 0 with a composite color camera connected, + * the output will appear monochrome but hatching + * will occur. + * COLORFILTER is different from "color killer" and "color effects" + * for reasons above. + */ +#define S2255_V4L2_YC_ON 1 +#define S2255_V4L2_YC_OFF 0 +#define V4L2_CID_PRIVATE_COLORFILTER (V4L2_CID_PRIVATE_BASE + 0) + /* frame prefix size (sent once every frame) */ #define PREFIX_SIZE 512 @@ -360,7 +389,6 @@ static long s2255_vendor_req(struct s2255_dev *dev, unsigned char req, static struct usb_driver s2255_driver; - /* Declare static vars that will be used as parameters */ static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ @@ -375,13 +403,14 @@ module_param(video_nr, int, 0644); MODULE_PARM_DESC(video_nr, "start video minor(-1 default autodetect)"); /* USB device table */ +#define USB_SENSORAY_VID 0x1943 static struct usb_device_id s2255_table[] = { - {USB_DEVICE(USB_S2255_VENDOR_ID, USB_S2255_PRODUCT_ID)}, + {USB_DEVICE(USB_SENSORAY_VID, 0x2255)}, + {USB_DEVICE(USB_SENSORAY_VID, 0x2257)}, /*same family as 2255*/ { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, s2255_table); - #define BUFFER_TIMEOUT msecs_to_jiffies(400) /* image formats. */ @@ -798,6 +827,28 @@ static void res_free(struct s2255_dev *dev, struct s2255_fh *fh) dprintk(1, "res: put\n"); } +static int vidioc_querymenu(struct file *file, void *priv, + struct v4l2_querymenu *qmenu) +{ + static const char *colorfilter[] = { + "Off", + "On", + NULL + }; + if (qmenu->id == V4L2_CID_PRIVATE_COLORFILTER) { + int i; + const char **menu_items = colorfilter; + for (i = 0; i < qmenu->index && menu_items[i]; i++) + ; /* do nothing (from v4l2-common.c) */ + if (menu_items[i] == NULL || menu_items[i][0] == '\0') + return -EINVAL; + strlcpy(qmenu->name, menu_items[qmenu->index], + sizeof(qmenu->name)); + return 0; + } + return v4l2_ctrl_query_menu(qmenu, NULL, NULL); +} + static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) @@ -1007,19 +1058,23 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, /* color mode */ switch (fh->fmt->fourcc) { case V4L2_PIX_FMT_GREY: - fh->mode.color = COLOR_Y8; + fh->mode.color &= ~MASK_COLOR; + fh->mode.color |= COLOR_Y8; break; case V4L2_PIX_FMT_JPEG: - fh->mode.color = COLOR_JPG | - (fh->dev->jc[fh->channel].quality << 8); + fh->mode.color &= ~MASK_COLOR; + fh->mode.color |= COLOR_JPG; + fh->mode.color |= (fh->dev->jc[fh->channel].quality << 8); break; case V4L2_PIX_FMT_YUV422P: - fh->mode.color = COLOR_YUVPL; + fh->mode.color &= ~MASK_COLOR; + fh->mode.color |= COLOR_YUVPL; break; case V4L2_PIX_FMT_YUYV: case V4L2_PIX_FMT_UYVY: default: - fh->mode.color = COLOR_YUVPK; + fh->mode.color &= ~MASK_COLOR; + fh->mode.color |= COLOR_YUVPK; break; } ret = 0; @@ -1186,8 +1241,12 @@ static int s2255_set_mode(struct s2255_dev *dev, unsigned long chn, dprintk(2, "mode contrast %x\n", mode->contrast); /* if JPEG, set the quality */ - if ((mode->color & MASK_COLOR) == COLOR_JPG) - mode->color = (dev->jc[chn].quality << 8) | COLOR_JPG; + if ((mode->color & MASK_COLOR) == COLOR_JPG) { + mode->color &= ~MASK_COLOR; + mode->color |= COLOR_JPG; + mode->color &= ~MASK_JPG_QUALITY; + mode->color |= (dev->jc[chn].quality << 8); + } /* save the mode */ dev->mode[chn] = *mode; @@ -1296,7 +1355,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) new_mode = &fh->mode; old_mode = &fh->dev->mode[chn]; - if (new_mode->color != old_mode->color) + if ((new_mode->color & MASK_COLOR) != (old_mode->color & MASK_COLOR)) new_mode->restart = 1; else if (new_mode->scale != old_mode->scale) new_mode->restart = 1; @@ -1354,6 +1413,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *i) int ret = 0; mutex_lock(&q->vb_lock); + if (videobuf_queue_is_busy(q)) { dprintk(1, "queue busy\n"); ret = -EBUSY; @@ -1366,7 +1426,6 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *i) goto out_s_std; } mode = &fh->mode; - if (*i & V4L2_STD_NTSC) { dprintk(4, "vidioc_s_std NTSC\n"); mode->format = FORMAT_NTSC; @@ -1409,7 +1468,16 @@ static int vidioc_enum_input(struct file *file, void *priv, inp->status = (status & 0x01) ? 0 : V4L2_IN_ST_NO_SIGNAL; } - strlcpy(inp->name, "Camera", sizeof(inp->name)); + switch (dev->pid) { + case 0x2255: + default: + strlcpy(inp->name, "Composite", sizeof(inp->name)); + break; + case 0x2257: + strlcpy(inp->name, (fh->channel < 2) ? "Composite" : "S-Video", + sizeof(inp->name)); + break; + } return 0; } @@ -1429,6 +1497,8 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int i) static int vidioc_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *qc) { + struct s2255_fh *fh = priv; + struct s2255_dev *dev = fh->dev; switch (qc->id) { case V4L2_CID_BRIGHTNESS: v4l2_ctrl_query_fill(qc, -127, 127, 1, DEF_BRIGHT); @@ -1442,6 +1512,19 @@ static int vidioc_queryctrl(struct file *file, void *priv, case V4L2_CID_HUE: v4l2_ctrl_query_fill(qc, 0, 255, 1, DEF_HUE); break; + case V4L2_CID_PRIVATE_COLORFILTER: + if (dev->dsp_fw_ver < S2255_MIN_DSP_COLORFILTER) + return -EINVAL; + if ((dev->pid == 0x2257) && (fh->channel > 1)) + return -EINVAL; + strlcpy(qc->name, "Color Filter", sizeof(qc->name)); + qc->type = V4L2_CTRL_TYPE_MENU; + qc->minimum = 0; + qc->maximum = 1; + qc->step = 1; + qc->default_value = 1; + qc->flags = 0; + break; default: return -EINVAL; } @@ -1453,6 +1536,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct s2255_fh *fh = priv; + struct s2255_dev *dev = fh->dev; switch (ctrl->id) { case V4L2_CID_BRIGHTNESS: ctrl->value = fh->mode.bright; @@ -1466,6 +1550,13 @@ static int vidioc_g_ctrl(struct file *file, void *priv, case V4L2_CID_HUE: ctrl->value = fh->mode.hue; break; + case V4L2_CID_PRIVATE_COLORFILTER: + if (dev->dsp_fw_ver < S2255_MIN_DSP_COLORFILTER) + return -EINVAL; + if ((dev->pid == 0x2257) && (fh->channel > 1)) + return -EINVAL; + ctrl->value = !((fh->mode.color & MASK_INPUT_TYPE) >> 16); + break; default: return -EINVAL; } @@ -1495,6 +1586,14 @@ static int vidioc_s_ctrl(struct file *file, void *priv, case V4L2_CID_SATURATION: mode->saturation = ctrl->value; break; + case V4L2_CID_PRIVATE_COLORFILTER: + if (dev->dsp_fw_ver < S2255_MIN_DSP_COLORFILTER) + return -EINVAL; + if ((dev->pid == 0x2257) && (fh->channel > 1)) + return -EINVAL; + mode->color &= ~MASK_INPUT_TYPE; + mode->color |= ((ctrl->value ? 0 : 1) << 16); + break; default: return -EINVAL; } @@ -1807,6 +1906,7 @@ static const struct v4l2_file_operations s2255_fops_v4l = { }; static const struct v4l2_ioctl_ops s2255_ioctl_ops = { + .vidioc_querymenu = vidioc_querymenu, .vidioc_querycap = vidioc_querycap, .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, @@ -2230,6 +2330,8 @@ static int s2255_board_init(struct s2255_dev *dev) for (j = 0; j < MAX_CHANNELS; j++) { dev->b_acquire[j] = 0; dev->mode[j] = mode_def; + if (dev->pid == 0x2257 && j > 1) + dev->mode[j].color |= (1 << 16); dev->jc[j].quality = S2255_DEF_JPEG_QUAL; dev->cur_fmt[j] = &formats[0]; dev->mode[j].restart = 1; @@ -2506,7 +2608,7 @@ static int s2255_probe(struct usb_interface *interface, s2255_dev_err(&interface->dev, "out of memory\n"); goto error; } - + dev->pid = id->idProduct; dev->fw_data = kzalloc(sizeof(struct s2255_fw), GFP_KERNEL); if (!dev->fw_data) goto error; @@ -2589,6 +2691,8 @@ static int s2255_probe(struct usb_interface *interface, dev->dsp_fw_ver = *pRel; if (*pRel < S2255_CUR_DSP_FWVER) printk(KERN_INFO "s2255: f2255usb.bin out of date.\n"); + if (dev->pid == 0x2257 && *pRel < S2255_MIN_DSP_COLORFILTER) + printk(KERN_WARNING "s2255: 2257 requires firmware 8 or above.\n"); } /* loads v4l specific */ s2255_probe_v4l(dev); -- GitLab From 2ffbb64c671261c80703cd8b7fec5ebd21e58b0c Mon Sep 17 00:00:00 2001 From: Dmitri Belimov Date: Thu, 4 Mar 2010 02:40:37 -0300 Subject: [PATCH 136/534] V4L/DVB: fix broken I2C IR for Beholder Fix broken I2C IR for TV cards of Beholder. Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 58a0cdc8414a..a2b16693ee9a 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -837,6 +837,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) dev->init_data.name = "BeholdTV"; dev->init_data.get_key = get_key_beholdm6xx; dev->init_data.ir_codes = &ir_codes_behold_table; + dev->init_data.type = IR_TYPE_NEC; info.addr = 0x2d; break; case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: -- GitLab From e7c3ee6302ef0dde86c1918bae3b0783839e6a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20N=C3=A9meth?= Date: Sun, 7 Mar 2010 03:33:45 -0300 Subject: [PATCH 137/534] V4L/DVB: gspca cpia1: make local functions static MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the local functions static. Note that the function command_setlights() is currently not called from anywhere. This will remove the following sparse warnings (see "make C=1"): * symbol 'command_setformat' was not declared. Should it be static? * symbol 'command_setcolourparams' was not declared. Should it be static? * symbol 'command_setapcor' was not declared. Should it be static? * symbol 'command_setvloffset' was not declared. Should it be static? * symbol 'command_setexposure' was not declared. Should it be static? * symbol 'command_setcolourbalance' was not declared. Should it be static? * symbol 'command_setcompressiontarget' was not declared. Should it be static? * symbol 'command_setyuvtresh' was not declared. Should it be static? * symbol 'command_setcompressionparams' was not declared. Should it be static? * symbol 'command_setcompression' was not declared. Should it be static? * symbol 'command_setsensorfps' was not declared. Should it be static? * symbol 'command_setflickerctrl' was not declared. Should it be static? * symbol 'command_setecptiming' was not declared. Should it be static? * symbol 'command_pause' was not declared. Should it be static? * symbol 'command_resume' was not declared. Should it be static? * symbol 'command_setlights' was not declared. Should it be static? Signed-off-by: Márton Németh Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/cpia1.c | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/media/video/gspca/cpia1.c b/drivers/media/video/gspca/cpia1.c index 8fa98439c3f8..92879c072e98 100644 --- a/drivers/media/video/gspca/cpia1.c +++ b/drivers/media/video/gspca/cpia1.c @@ -861,7 +861,7 @@ static int save_camera_state(struct gspca_dev *gspca_dev) return do_command(gspca_dev, CPIA_COMMAND_GetExposure, 0, 0, 0, 0); } -int command_setformat(struct gspca_dev *gspca_dev) +static int command_setformat(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; int ret; @@ -878,7 +878,7 @@ int command_setformat(struct gspca_dev *gspca_dev) sd->params.roi.rowStart, sd->params.roi.rowEnd); } -int command_setcolourparams(struct gspca_dev *gspca_dev) +static int command_setcolourparams(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; return do_command(gspca_dev, CPIA_COMMAND_SetColourParams, @@ -887,7 +887,7 @@ int command_setcolourparams(struct gspca_dev *gspca_dev) sd->params.colourParams.saturation, 0); } -int command_setapcor(struct gspca_dev *gspca_dev) +static int command_setapcor(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; return do_command(gspca_dev, CPIA_COMMAND_SetApcor, @@ -897,7 +897,7 @@ int command_setapcor(struct gspca_dev *gspca_dev) sd->params.apcor.gain8); } -int command_setvloffset(struct gspca_dev *gspca_dev) +static int command_setvloffset(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; return do_command(gspca_dev, CPIA_COMMAND_SetVLOffset, @@ -907,7 +907,7 @@ int command_setvloffset(struct gspca_dev *gspca_dev) sd->params.vlOffset.gain8); } -int command_setexposure(struct gspca_dev *gspca_dev) +static int command_setexposure(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; int ret; @@ -943,7 +943,7 @@ int command_setexposure(struct gspca_dev *gspca_dev) return ret; } -int command_setcolourbalance(struct gspca_dev *gspca_dev) +static int command_setcolourbalance(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -973,7 +973,7 @@ int command_setcolourbalance(struct gspca_dev *gspca_dev) return -EINVAL; } -int command_setcompressiontarget(struct gspca_dev *gspca_dev) +static int command_setcompressiontarget(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -983,7 +983,7 @@ int command_setcompressiontarget(struct gspca_dev *gspca_dev) sd->params.compressionTarget.targetQ, 0); } -int command_setyuvtresh(struct gspca_dev *gspca_dev) +static int command_setyuvtresh(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -992,7 +992,7 @@ int command_setyuvtresh(struct gspca_dev *gspca_dev) sd->params.yuvThreshold.uvThreshold, 0, 0); } -int command_setcompressionparams(struct gspca_dev *gspca_dev) +static int command_setcompressionparams(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -1009,7 +1009,7 @@ int command_setcompressionparams(struct gspca_dev *gspca_dev) sd->params.compressionParams.decimationThreshMod); } -int command_setcompression(struct gspca_dev *gspca_dev) +static int command_setcompression(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -1018,7 +1018,7 @@ int command_setcompression(struct gspca_dev *gspca_dev) sd->params.compression.decimation, 0, 0); } -int command_setsensorfps(struct gspca_dev *gspca_dev) +static int command_setsensorfps(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -1027,7 +1027,7 @@ int command_setsensorfps(struct gspca_dev *gspca_dev) sd->params.sensorFps.baserate, 0, 0); } -int command_setflickerctrl(struct gspca_dev *gspca_dev) +static int command_setflickerctrl(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -1038,7 +1038,7 @@ int command_setflickerctrl(struct gspca_dev *gspca_dev) 0); } -int command_setecptiming(struct gspca_dev *gspca_dev) +static int command_setecptiming(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -1046,12 +1046,12 @@ int command_setecptiming(struct gspca_dev *gspca_dev) sd->params.ecpTiming, 0, 0, 0); } -int command_pause(struct gspca_dev *gspca_dev) +static int command_pause(struct gspca_dev *gspca_dev) { return do_command(gspca_dev, CPIA_COMMAND_EndStreamCap, 0, 0, 0, 0); } -int command_resume(struct gspca_dev *gspca_dev) +static int command_resume(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -1059,7 +1059,7 @@ int command_resume(struct gspca_dev *gspca_dev) 0, sd->params.streamStartLine, 0, 0); } -int command_setlights(struct gspca_dev *gspca_dev) +static int command_setlights(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; int ret, p1, p2; -- GitLab From e6b44bc521b48048e3089ed773950867e409f886 Mon Sep 17 00:00:00 2001 From: Dean Anderson Date: Mon, 8 Mar 2010 20:04:48 -0300 Subject: [PATCH 138/534] V4L/DVB: s2255drv: support for frame skipping adds hardware frame skipping using VIDIOC_S_PARM ioctl. adds support for VIDIOC_ENUM_FRAMEINTERVALS. Signed-off-by: Dean Anderson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/s2255drv.c | 113 ++++++++++++++++++++++++++++++--- 1 file changed, 105 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 745f557200aa..0092ff52bb27 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -1427,11 +1427,19 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *i) } mode = &fh->mode; if (*i & V4L2_STD_NTSC) { - dprintk(4, "vidioc_s_std NTSC\n"); - mode->format = FORMAT_NTSC; + dprintk(4, "%s NTSC\n", __func__); + /* if changing format, reset frame decimation/intervals */ + if (mode->format != FORMAT_NTSC) { + mode->format = FORMAT_NTSC; + mode->fdec = FDEC_1; + } } else if (*i & V4L2_STD_PAL) { - dprintk(4, "vidioc_s_std PAL\n"); + dprintk(4, "%s PAL\n", __func__); mode->format = FORMAT_PAL; + if (mode->format != FORMAT_PAL) { + mode->format = FORMAT_PAL; + mode->fdec = FDEC_1; + } } else { ret = -EINVAL; } @@ -1633,10 +1641,34 @@ static int vidioc_g_parm(struct file *file, void *priv, { struct s2255_fh *fh = priv; struct s2255_dev *dev = fh->dev; + __u32 def_num, def_dem; if (sp->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; + memset(sp, 0, sizeof(struct v4l2_streamparm)); + sp->parm.capture.capability = V4L2_CAP_TIMEPERFRAME; sp->parm.capture.capturemode = dev->cap_parm[fh->channel].capturemode; - dprintk(2, "getting parm %d\n", sp->parm.capture.capturemode); + def_num = (fh->mode.format == FORMAT_NTSC) ? 1001 : 1000; + def_dem = (fh->mode.format == FORMAT_NTSC) ? 30000 : 25000; + sp->parm.capture.timeperframe.denominator = def_dem; + switch (fh->mode.fdec) { + default: + case FDEC_1: + sp->parm.capture.timeperframe.numerator = def_num; + break; + case FDEC_2: + sp->parm.capture.timeperframe.numerator = def_num * 2; + break; + case FDEC_3: + sp->parm.capture.timeperframe.numerator = def_num * 3; + break; + case FDEC_5: + sp->parm.capture.timeperframe.numerator = def_num * 5; + break; + } + dprintk(4, "%s capture mode, %d timeperframe %d/%d\n", __func__, + sp->parm.capture.capturemode, + sp->parm.capture.timeperframe.numerator, + sp->parm.capture.timeperframe.denominator); return 0; } @@ -1645,15 +1677,79 @@ static int vidioc_s_parm(struct file *file, void *priv, { struct s2255_fh *fh = priv; struct s2255_dev *dev = fh->dev; - + int fdec = FDEC_1; + __u32 def_num, def_dem; if (sp->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; + /* high quality capture mode requires a stream restart */ + if (dev->cap_parm[fh->channel].capturemode + != sp->parm.capture.capturemode && res_locked(fh->dev, fh)) + return -EBUSY; + def_num = (fh->mode.format == FORMAT_NTSC) ? 1001 : 1000; + def_dem = (fh->mode.format == FORMAT_NTSC) ? 30000 : 25000; + if (def_dem != sp->parm.capture.timeperframe.denominator) + sp->parm.capture.timeperframe.numerator = def_num; + else if (sp->parm.capture.timeperframe.numerator <= def_num) + sp->parm.capture.timeperframe.numerator = def_num; + else if (sp->parm.capture.timeperframe.numerator <= (def_num * 2)) { + sp->parm.capture.timeperframe.numerator = def_num * 2; + fdec = FDEC_2; + } else if (sp->parm.capture.timeperframe.numerator <= (def_num * 3)) { + sp->parm.capture.timeperframe.numerator = def_num * 3; + fdec = FDEC_3; + } else { + sp->parm.capture.timeperframe.numerator = def_num * 5; + fdec = FDEC_5; + } + fh->mode.fdec = fdec; + sp->parm.capture.timeperframe.denominator = def_dem; + s2255_set_mode(dev, fh->channel, &fh->mode); + dprintk(4, "%s capture mode, %d timeperframe %d/%d, fdec %d\n", + __func__, + sp->parm.capture.capturemode, + sp->parm.capture.timeperframe.numerator, + sp->parm.capture.timeperframe.denominator, fdec); + return 0; +} - dev->cap_parm[fh->channel].capturemode = sp->parm.capture.capturemode; - dprintk(2, "setting param capture mode %d\n", - sp->parm.capture.capturemode); +static int vidioc_enum_frameintervals(struct file *file, void *priv, + struct v4l2_frmivalenum *fe) +{ + int is_ntsc = 0; +#define NUM_FRAME_ENUMS 4 + int frm_dec[NUM_FRAME_ENUMS] = {1, 2, 3, 5}; + if (fe->index < 0 || fe->index >= NUM_FRAME_ENUMS) + return -EINVAL; + switch (fe->width) { + case 640: + if (fe->height != 240 && fe->height != 480) + return -EINVAL; + is_ntsc = 1; + break; + case 320: + if (fe->height != 240) + return -EINVAL; + is_ntsc = 1; + break; + case 704: + if (fe->height != 288 && fe->height != 576) + return -EINVAL; + break; + case 352: + if (fe->height != 288) + return -EINVAL; + break; + default: + return -EINVAL; + } + fe->type = V4L2_FRMIVAL_TYPE_DISCRETE; + fe->discrete.denominator = is_ntsc ? 30000 : 25000; + fe->discrete.numerator = (is_ntsc ? 1001 : 1000) * frm_dec[fe->index]; + dprintk(4, "%s discrete %d/%d\n", __func__, fe->discrete.numerator, + fe->discrete.denominator); return 0; } + static int s2255_open(struct file *file) { struct video_device *vdev = video_devdata(file); @@ -1932,6 +2028,7 @@ static const struct v4l2_ioctl_ops s2255_ioctl_ops = { .vidioc_g_jpegcomp = vidioc_g_jpegcomp, .vidioc_s_parm = vidioc_s_parm, .vidioc_g_parm = vidioc_g_parm, + .vidioc_enum_frameintervals = vidioc_enum_frameintervals, }; static struct video_device template = { -- GitLab From ab9b4f2c11904c3c491b626915526049ecfe5ecf Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 1 Mar 2010 13:50:40 -0300 Subject: [PATCH 139/534] V4L/DVB: af9015: support for KWorld USB DVB-T Stick Mobile (UB383-T) Add USB ID 1b80:e383 for KWorld USB DVB-T Stick Mobile (UB383-T). Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/af9015.c | 9 ++++++++- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 74d94e45324d..7611af60b6bf 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -1297,6 +1297,7 @@ static struct usb_device_id af9015_usb_table[] = { {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20)}, {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_TINYTWIN_2)}, {USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV2000DS)}, +/* 30 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB383_T)}, {0}, }; MODULE_DEVICE_TABLE(usb, af9015_usb_table); @@ -1569,7 +1570,7 @@ static struct dvb_usb_device_properties af9015_properties[] = { .i2c_algo = &af9015_i2c_algo, - .num_device_descs = 7, /* max 9 */ + .num_device_descs = 8, /* max 9 */ .devices = { { .name = "AverMedia AVerTV Volar GPS 805 (A805)", @@ -1608,6 +1609,12 @@ static struct dvb_usb_device_properties af9015_properties[] = { .cold_ids = {&af9015_usb_table[29], NULL}, .warm_ids = {NULL}, }, + { + .name = "KWorld USB DVB-T Stick Mobile " \ + "(UB383-T)", + .cold_ids = {&af9015_usb_table[30], NULL}, + .warm_ids = {NULL}, + }, } }, }; diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index ae8b57acfe05..6568db52f4a3 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -127,6 +127,7 @@ #define USB_PID_KWORLD_MC810 0xc810 #define USB_PID_KWORLD_PC160_2T 0xc160 #define USB_PID_KWORLD_PC160_T 0xc161 +#define USB_PID_KWORLD_UB383_T 0xe383 #define USB_PID_KWORLD_VSTREAM_COLD 0x17de #define USB_PID_KWORLD_VSTREAM_WARM 0x17df #define USB_PID_TERRATEC_CINERGY_T_USB_XE 0x0055 -- GitLab From 7fc8709e4d7230ab640a91b9aef8fbd0f7c1488b Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Mon, 1 Mar 2010 14:06:52 -0300 Subject: [PATCH 140/534] V4L/DVB: af9015: support for KWorld TV Stick II (395UR) Add USB ID 1b80:e39a for KWorld TV Stick II (395UR). Signed-off-by: Antti Palosaari Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/af9015.c | 4 +++- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 7611af60b6bf..d5ba1de8f074 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -1298,6 +1298,7 @@ static struct usb_device_id af9015_usb_table[] = { {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_TINYTWIN_2)}, {USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV2000DS)}, /* 30 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB383_T)}, + {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U_4)}, {0}, }; MODULE_DEVICE_TABLE(usb, af9015_usb_table); @@ -1501,7 +1502,8 @@ static struct dvb_usb_device_properties af9015_properties[] = { "(VS-DVB-T 395U)", .cold_ids = {&af9015_usb_table[16], &af9015_usb_table[17], - &af9015_usb_table[18], NULL}, + &af9015_usb_table[18], + &af9015_usb_table[31], NULL}, .warm_ids = {NULL}, }, { diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 6568db52f4a3..b34ca80de434 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -124,6 +124,7 @@ #define USB_PID_KWORLD_395U 0xe396 #define USB_PID_KWORLD_395U_2 0xe39b #define USB_PID_KWORLD_395U_3 0xe395 +#define USB_PID_KWORLD_395U_4 0xe39a #define USB_PID_KWORLD_MC810 0xc810 #define USB_PID_KWORLD_PC160_2T 0xc160 #define USB_PID_KWORLD_PC160_T 0xc161 -- GitLab From 403c34f6bbc095f9c8b2e25becd65c9c3d159080 Mon Sep 17 00:00:00 2001 From: Abylay Ospan Date: Sat, 6 Mar 2010 15:05:26 -0300 Subject: [PATCH 141/534] V4L/DVB: get_frontend for STV0900 Signed-off-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv0900_core.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/frontends/stv0900_core.c b/drivers/media/dvb/frontends/stv0900_core.c index 01f8f1f802fd..a3cdca724634 100644 --- a/drivers/media/dvb/frontends/stv0900_core.c +++ b/drivers/media/dvb/frontends/stv0900_core.c @@ -1583,7 +1583,7 @@ static enum dvbfe_search stv0900_search(struct dvb_frontend *fe, struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct stv0900_search_params p_search; - struct stv0900_signal_info p_result; + struct stv0900_signal_info p_result = intp->result[demod]; enum fe_stv0900_error error = STV0900_NO_ERROR; @@ -1842,6 +1842,19 @@ static void stv0900_release(struct dvb_frontend *fe) kfree(state); } +static int stv0900_get_frontend(struct dvb_frontend *fe, + struct dvb_frontend_parameters *p) +{ + struct stv0900_state *state = fe->demodulator_priv; + struct stv0900_internal *intp = state->internal; + enum fe_stv0900_demod_num demod = state->demod; + struct stv0900_signal_info p_result = intp->result[demod]; + + p->frequency = p_result.locked ? p_result.frequency : 0; + p->u.qpsk.symbol_rate = p_result.locked ? p_result.symbol_rate : 0; + return 0; +} + static struct dvb_frontend_ops stv0900_ops = { .info = { @@ -1862,6 +1875,7 @@ static struct dvb_frontend_ops stv0900_ops = { }, .release = stv0900_release, .init = stv0900_init, + .get_frontend = stv0900_get_frontend, .get_frontend_algo = stv0900_frontend_algo, .i2c_gate_ctrl = stv0900_i2c_gate_ctrl, .diseqc_send_master_cmd = stv0900_send_master_cmd, -- GitLab From 2a8f96085449f3aa6fe99b27d7ee506e808059b9 Mon Sep 17 00:00:00 2001 From: Abylay Ospan Date: Sat, 6 Mar 2010 15:46:39 -0300 Subject: [PATCH 142/534] V4L/DVB: configurable IRQ from CAM IRQ from CAM disabled by default. In some environment enabled IRQ can cause of machine freeze. Signed-off-by: Abylay Ospan Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx23885/cimax2.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/cx23885/cimax2.c b/drivers/media/video/cx23885/cimax2.c index d4a9d2c5947c..c95e7bc14745 100644 --- a/drivers/media/video/cx23885/cimax2.c +++ b/drivers/media/video/cx23885/cimax2.c @@ -60,12 +60,18 @@ static unsigned int ci_dbg; module_param(ci_dbg, int, 0644); MODULE_PARM_DESC(ci_dbg, "Enable CI debugging"); +static unsigned int ci_irq_enable; +module_param(ci_irq_enable, int, 0644); +MODULE_PARM_DESC(ci_irq_enable, "Enable IRQ from CAM"); + #define ci_dbg_print(args...) \ do { \ if (ci_dbg) \ printk(KERN_DEBUG args); \ } while (0) +#define ci_irq_flags() (ci_irq_enable ? NETUP_IRQ_IRQAM : 0) + /* stores all private variables for communication with CI */ struct netup_ci_state { struct dvb_ca_en50221 ca; @@ -392,7 +398,7 @@ int netup_poll_ci_slot_status(struct dvb_ca_en50221 *en50221, int slot, int open if (0 != slot) return -EINVAL; - netup_ci_set_irq(en50221, open ? (NETUP_IRQ_DETAM | NETUP_IRQ_IRQAM) + netup_ci_set_irq(en50221, open ? (NETUP_IRQ_DETAM | ci_irq_flags()) : NETUP_IRQ_DETAM); return state->status; @@ -429,7 +435,7 @@ int netup_ci_init(struct cx23885_tsport *port) 0x01, /* power on (use it like store place) */ 0x00, /* RFU */ 0x00, /* int status read only */ - NETUP_IRQ_IRQAM | NETUP_IRQ_DETAM, /* DETAM, IRQAM unmasked */ + ci_irq_flags() | NETUP_IRQ_DETAM, /* DETAM, IRQAM unmasked */ 0x05, /* EXTINT=active-high, INT=push-pull */ 0x00, /* USCG1 */ 0x04, /* ack active low */ @@ -470,7 +476,7 @@ int netup_ci_init(struct cx23885_tsport *port) state->ca.poll_slot_status = netup_poll_ci_slot_status; state->ca.data = state; state->priv = port; - state->current_irq_mode = NETUP_IRQ_IRQAM | NETUP_IRQ_DETAM; + state->current_irq_mode = ci_irq_flags() | NETUP_IRQ_DETAM; ret = netup_write_i2c(state->i2c_adap, state->ci_i2c_addr, 0, &cimax_init[0], 34); -- GitLab From 283328c29db4463c31ee59f9ab418449cfa376b3 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 6 Mar 2010 21:08:35 -0300 Subject: [PATCH 143/534] V4L/DVB: ivtv: Combine capture start delays into a single delay Combine the two 150 ms delays into a single 300 ms delay. Ian Armstrong has noted that the delay between CX2341X_ENC_INITIALIZE_INPUT and CX2341X_ENC_START_CAPTURE can cause problems if the temporal filter is allowed to be enabled. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-streams.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 1f9387f6ca24..a994b0adb444 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -581,10 +581,9 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s) v4l2_subdev_call(itv->sd_audio, audio, s_stream, 1); /* Avoid unpredictable PCI bus hang - disable video clocks */ v4l2_subdev_call(itv->sd_video, video, s_stream, 0); - ivtv_msleep_timeout(150, 1); + ivtv_msleep_timeout(300, 1); ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0); v4l2_subdev_call(itv->sd_video, video, s_stream, 1); - ivtv_msleep_timeout(150, 1); } /* begin_capture */ -- GitLab From 9a766d55b72a439b2e16ecf2ac3eb831ab25e0d3 Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Sat, 6 Mar 2010 21:37:04 -0300 Subject: [PATCH 144/534] V4L/DVB: ivtv: Really stop capture on device close When a capture is started, the firmware also appears to start a secondary stream. Unless this secondary stream is also stopped, the encoder will remain active and not reinitialise for the next capture. Unfortunately, setting up the video source can glitch the encoder and result in undesirable effects that this initialisation will clear. Signed-off-by: Ian Armstrong Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-streams.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index a994b0adb444..6917c497fb7e 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -829,6 +829,10 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) ivtv_set_irq_mask(itv, IVTV_IRQ_ENC_VIM_RST); } + /* Raw-passthrough is implied on start. Make sure it's stopped so + the encoder will re-initialize when next started */ + ivtv_vapi(itv, CX2341X_ENC_STOP_CAPTURE, 3, 1, 2, 7); + wake_up(&s->waitq); return 0; -- GitLab From 947f04cba2159ff731a59766b05a643536eb6262 Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Sat, 6 Mar 2010 21:43:04 -0300 Subject: [PATCH 145/534] V4L/DVB: cx2341x: Remove temporal filter control restriction Since the change that stops the CX23415/6 firmware-intiiated secondary stream appears to fix the temporal filter, it's now fully re-enabled for all capture resolutions. Signed-off-by: Ian Armstrong Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx2341x.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c index 4c8e95853fa3..022b480918cd 100644 --- a/drivers/media/video/cx2341x.c +++ b/drivers/media/video/cx2341x.c @@ -1000,20 +1000,6 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, h, w); if (err) return err; } - - if (new->width != 720 || new->height != (new->is_50hz ? 576 : 480)) { - /* Adjust temporal filter if necessary. The problem with the - temporal filter is that it works well with full resolution - capturing, but not when the capture window is scaled (the - filter introduces a ghosting effect). So if the capture - window is scaled, then force the filter to 0. - - For full resolution the filter really improves the video - quality, especially if the original video quality is - suboptimal. */ - temporal = 0; - } - if (force || NEQ(stream_type)) { err = cx2341x_api(priv, func, CX2341X_ENC_SET_STREAM_TYPE, 1, mpeg_stream_type[new->stream_type]); -- GitLab From 823b63b49eb9a670fd9125b625e8f4b008fe3abc Mon Sep 17 00:00:00 2001 From: Oleg Roitburd Date: Thu, 25 Feb 2010 17:19:31 -0300 Subject: [PATCH 146/534] V4L/DVB: AZ6027: Add support for Technisat V1 device Signed-off-by: Oleg Roitburd Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 3 ++- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 27acbfb6d33a..7db7d3d94f74 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -1057,7 +1057,8 @@ int az6027_identify_state(struct usb_device *udev, static struct usb_device_id az6027_usb_table[] = { { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) }, { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI) }, - { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI) }, + { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) }, + { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) }, { }, }; diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index b34ca80de434..0573de50c09a 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -299,5 +299,6 @@ #define USB_PID_SVEON_STV20 0xe39d #define USB_PID_AZUREWAVE_AZ6027 0x3275 #define USB_PID_TERRATEC_DVBS2CI 0x3275 -#define USB_PID_TECHNISAT_USB2_HDCI 0x0002 +#define USB_PID_TECHNISAT_USB2_HDCI_V1 0x0001 +#define USB_PID_TECHNISAT_USB2_HDCI_V2 0x0002 #endif -- GitLab From 20d2c56de8b3c462c40ef2eff42ff722905e28cf Mon Sep 17 00:00:00 2001 From: Oleg Roitburd Date: Fri, 26 Feb 2010 09:47:16 -0300 Subject: [PATCH 147/534] V4L/DVB: AZ6027: Fix initialization for some cards Also add in some more device ID's Signed-off-by: Oleg Roitburd Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 21 +++++++++++++++++++-- drivers/media/dvb/dvb-usb/dvb-usb-ids.h | 3 ++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 7db7d3d94f74..60787a28edb3 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -1056,7 +1056,8 @@ int az6027_identify_state(struct usb_device *udev, static struct usb_device_id az6027_usb_table[] = { { USB_DEVICE(USB_VID_AZUREWAVE, USB_PID_AZUREWAVE_AZ6027) }, - { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI) }, + { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V1) }, + { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_DVBS2CI_V2) }, { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V1) }, { USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) }, { }, @@ -1101,12 +1102,28 @@ static struct dvb_usb_device_properties az6027_properties = { .rc_query = az6027_rc_query, .i2c_algo = &az6027_i2c_algo, - .num_device_descs = 1, + .num_device_descs = 5, .devices = { { .name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)", .cold_ids = { &az6027_usb_table[0], NULL }, .warm_ids = { NULL }, + }, { + .name = "TERRATEC S7", + .cold_ids = { &az6027_usb_table[1], NULL }, + .warm_ids = { NULL }, + }, { + .name = "TERRATEC S7 MKII", + .cold_ids = { &az6027_usb_table[2], NULL }, + .warm_ids = { NULL }, + }, { + .name = "Technisat SkyStar USB 2 HD CI", + .cold_ids = { &az6027_usb_table[3], NULL }, + .warm_ids = { NULL }, + }, { + .name = "Technisat SkyStar USB 2 HD CI", + .cold_ids = { &az6027_usb_table[4], NULL }, + .warm_ids = { NULL }, }, { NULL }, } diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 0573de50c09a..de1f3af60d53 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -298,7 +298,8 @@ #define USB_PID_TVWAY_PLUS 0x0002 #define USB_PID_SVEON_STV20 0xe39d #define USB_PID_AZUREWAVE_AZ6027 0x3275 -#define USB_PID_TERRATEC_DVBS2CI 0x3275 +#define USB_PID_TERRATEC_DVBS2CI_V1 0x10a4 +#define USB_PID_TERRATEC_DVBS2CI_V2 0x10ac #define USB_PID_TECHNISAT_USB2_HDCI_V1 0x0001 #define USB_PID_TECHNISAT_USB2_HDCI_V2 0x0002 #endif -- GitLab From 19c4ee58325ac7c9d9595153fabb5d885dfe931e Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Fri, 22 Jan 2010 17:19:49 -0300 Subject: [PATCH 148/534] V4L/DVB: [STV090x] Code simplification - Remove a redundant exported gate control function Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 57 +++++++++++++-------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 96972804f4ad..0af17083511c 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -754,9 +754,8 @@ static int stv090x_write_reg(struct stv090x_state *state, unsigned int reg, u8 d return stv090x_write_regs(state, reg, &data, 1); } -static int stv090x_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) +static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable) { - struct stv090x_state *state = fe->demodulator_priv; u32 reg; if (enable) @@ -1778,7 +1777,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) freq -= cur_step * car_step; /* Setup tuner */ - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_set_frequency) { @@ -1791,12 +1790,12 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; msleep(50); - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_status) { @@ -1809,7 +1808,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) else dprintk(FE_DEBUG, 1, "Tuner unlocked"); - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; } @@ -1822,7 +1821,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state) return srate_coarse; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -2167,7 +2166,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) freq -= cur_step * car_step; /* Setup tuner */ - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_set_frequency) { @@ -2180,12 +2179,12 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; msleep(50); - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_status) { @@ -2198,7 +2197,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) else dprintk(FE_DEBUG, 1, "Tuner unlocked"); - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; STV090x_WRITE_DEMOD(state, DMDISTATE, 0x1c); @@ -2222,7 +2221,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd) return lock; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -2591,7 +2590,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st } state->delsys = stv090x_get_std(state); - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_frequency) { @@ -2599,7 +2598,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; offst_freq = stv090x_get_car_freq(state, state->internal->mclk) / 1000; @@ -2619,7 +2618,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st if ((state->algo == STV090x_BLIND_SEARCH) || (state->srate < 10000000)) { - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_frequency) { @@ -2627,7 +2626,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; if (abs(offst_freq) <= ((state->search_range / 2000) + 500)) @@ -2646,7 +2645,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st return STV090x_OUTOFRANGE; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -3000,7 +2999,7 @@ static int stv090x_optimize_track(struct stv090x_state *state) if (state->algo != STV090x_WARM_SEARCH) { - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_set_bandwidth) { @@ -3008,7 +3007,7 @@ static int stv090x_optimize_track(struct stv090x_state *state) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; } @@ -3059,7 +3058,7 @@ static int stv090x_optimize_track(struct stv090x_state *state) return 0; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -3235,7 +3234,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) } /* Setup tuner */ - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_set_bbgain) { @@ -3256,17 +3255,17 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; msleep(50); if (state->config->tuner_get_status) { - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (state->config->tuner_get_status(fe, ®) < 0) goto err_gateoff; - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; if (reg) @@ -3400,7 +3399,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state) return signal_state; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -4336,7 +4335,7 @@ static int stv090x_init(struct dvb_frontend *fe) if (STV090x_WRITE_DEMOD(state, DEMOD, reg) < 0) goto err; - if (stv090x_i2c_gate_ctrl(fe, 1) < 0) + if (stv090x_i2c_gate_ctrl(state, 1) < 0) goto err; if (config->tuner_set_mode) { @@ -4349,7 +4348,7 @@ static int stv090x_init(struct dvb_frontend *fe) goto err_gateoff; } - if (stv090x_i2c_gate_ctrl(fe, 0) < 0) + if (stv090x_i2c_gate_ctrl(state, 0) < 0) goto err; if (stv090x_set_tspath(state) < 0) @@ -4358,7 +4357,7 @@ static int stv090x_init(struct dvb_frontend *fe) return 0; err_gateoff: - stv090x_i2c_gate_ctrl(fe, 0); + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; @@ -4503,8 +4502,6 @@ static struct dvb_frontend_ops stv090x_ops = { .sleep = stv090x_sleep, .get_frontend_algo = stv090x_frontend_algo, - .i2c_gate_ctrl = stv090x_i2c_gate_ctrl, - .diseqc_send_master_cmd = stv090x_send_diseqc_msg, .diseqc_send_burst = stv090x_send_diseqc_burst, .diseqc_recv_slave_reply = stv090x_recv_slave_reply, -- GitLab From c5b74b0f5e81386ca1e9b1128de83502e92fa028 Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Sat, 23 Jan 2010 05:49:08 -0300 Subject: [PATCH 149/534] V4L/DVB: [STV090x, STV6110x] Use tuner sleep within the demodulator control Oliver Endriss pointed out: Imho not a good idea, as the frontend thread calls - fe->ops.tuner_ops.init - fe->ops.tuner_ops.sleep If you remove fe->ops.i2c_gate_ctrl, init and sleep will fail, because gate_ctrl was never called... -- Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 8 ++++++++ drivers/media/dvb/frontends/stv090x.h | 1 + drivers/media/dvb/frontends/stv6110x.c | 4 +--- drivers/media/dvb/frontends/stv6110x.h | 1 + drivers/media/dvb/ttpci/budget.c | 2 ++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 0af17083511c..a80a34bb9eb8 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -3838,6 +3838,11 @@ static int stv090x_sleep(struct dvb_frontend *fe) struct stv090x_state *state = fe->demodulator_priv; u32 reg; + if (state->config->tuner_init) { + if (state->config->tuner_sleep(fe) < 0) + goto err_gateoff; + } + dprintk(FE_DEBUG, 1, "Set %s to sleep", state->device == STV0900 ? "STV0900" : "STV0903"); @@ -3852,6 +3857,9 @@ static int stv090x_sleep(struct dvb_frontend *fe) goto err; return 0; + +err_gateoff: + stv090x_i2c_gate_ctrl(state, 0); err: dprintk(FE_ERROR, 1, "I/O error"); return -1; diff --git a/drivers/media/dvb/frontends/stv090x.h b/drivers/media/dvb/frontends/stv090x.h index 30f01a6902ac..dd1b93ae4e9d 100644 --- a/drivers/media/dvb/frontends/stv090x.h +++ b/drivers/media/dvb/frontends/stv090x.h @@ -87,6 +87,7 @@ struct stv090x_config { bool diseqc_envelope_mode; int (*tuner_init) (struct dvb_frontend *fe); + int (*tuner_sleep) (struct dvb_frontend *fe); int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode); int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency); int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency); diff --git a/drivers/media/dvb/frontends/stv6110x.c b/drivers/media/dvb/frontends/stv6110x.c index dea4245f077c..c1ddb83e6349 100644 --- a/drivers/media/dvb/frontends/stv6110x.c +++ b/drivers/media/dvb/frontends/stv6110x.c @@ -338,14 +338,12 @@ static struct dvb_tuner_ops stv6110x_ops = { .frequency_max = 2150000, .frequency_step = 0, }, - - .init = stv6110x_init, - .sleep = stv6110x_sleep, .release = stv6110x_release }; static struct stv6110x_devctl stv6110x_ctl = { .tuner_init = stv6110x_init, + .tuner_sleep = stv6110x_sleep, .tuner_set_mode = stv6110x_set_mode, .tuner_set_frequency = stv6110x_set_frequency, .tuner_get_frequency = stv6110x_get_frequency, diff --git a/drivers/media/dvb/frontends/stv6110x.h b/drivers/media/dvb/frontends/stv6110x.h index 2429ae6d7847..47516753929a 100644 --- a/drivers/media/dvb/frontends/stv6110x.h +++ b/drivers/media/dvb/frontends/stv6110x.h @@ -40,6 +40,7 @@ enum tuner_status { struct stv6110x_devctl { int (*tuner_init) (struct dvb_frontend *fe); + int (*tuner_sleep) (struct dvb_frontend *fe); int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode); int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency); int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency); diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 1500210c06cf..e5cb1022d9db 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c @@ -442,6 +442,7 @@ static struct stv090x_config tt1600_stv090x_config = { .repeater_level = STV090x_RPTLEVEL_16, .tuner_init = NULL, + .tuner_sleep = NULL, .tuner_set_mode = NULL, .tuner_set_frequency = NULL, .tuner_get_frequency = NULL, @@ -628,6 +629,7 @@ static void frontend_init(struct budget *budget) &budget->i2c_adap); tt1600_stv090x_config.tuner_init = ctl->tuner_init; + tt1600_stv090x_config.tuner_sleep = ctl->tuner_sleep; tt1600_stv090x_config.tuner_set_mode = ctl->tuner_set_mode; tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency; tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency; -- GitLab From 85532d1454dd3df7327d12bf6ca7ef5a00bb1282 Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Sat, 23 Jan 2010 06:05:37 -0300 Subject: [PATCH 150/534] V4L/DVB: [STV090x] Use gate control, while tuner is being accessed Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index a80a34bb9eb8..3cc1be28534e 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -3838,11 +3838,17 @@ static int stv090x_sleep(struct dvb_frontend *fe) struct stv090x_state *state = fe->demodulator_priv; u32 reg; - if (state->config->tuner_init) { + if (stv090x_i2c_gate_ctrl(state, 1) < 0) + goto err; + + if (state->config->tuner_sleep) { if (state->config->tuner_sleep(fe) < 0) goto err_gateoff; } + if (stv090x_i2c_gate_ctrl(state, 0) < 0) + goto err; + dprintk(FE_DEBUG, 1, "Set %s to sleep", state->device == STV0900 ? "STV0900" : "STV0903"); -- GitLab From 5817ea0c83665dbc117cb7ca637202da0fb1abce Mon Sep 17 00:00:00 2001 From: Andreas Regel Date: Sat, 13 Feb 2010 16:48:07 -0300 Subject: [PATCH 151/534] V4L/DVB: Budget/STV090x/STV6110x: Initialize the demodulator immediately after the tuner is attached Signed-off-by: Andreas Regel Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 14 ++++++++++++++ drivers/media/dvb/frontends/stv6110x.c | 20 -------------------- drivers/media/dvb/ttpci/budget.c | 6 ++++++ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 3cc1be28534e..a461fdff2c9c 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -4324,6 +4324,20 @@ static int stv090x_init(struct dvb_frontend *fe) u32 reg; if (state->internal->mclk == 0) { + /* call tuner init to configure the tuner's clock output + divider directly before setting up the master clock of + the stv090x. */ + if (stv090x_i2c_gate_ctrl(state, 1) < 0) + goto err; + + if (config->tuner_init) { + if (config->tuner_init(fe) < 0) + goto err_gateoff; + } + + if (stv090x_i2c_gate_ctrl(state, 0) < 0) + goto err; + stv090x_set_mclk(state, 135000000, config->xtal); /* 135 Mhz */ msleep(5); if (stv090x_write_reg(state, STV090x_SYNTCTRL, diff --git a/drivers/media/dvb/frontends/stv6110x.c b/drivers/media/dvb/frontends/stv6110x.c index c1ddb83e6349..2f9cd2441340 100644 --- a/drivers/media/dvb/frontends/stv6110x.c +++ b/drivers/media/dvb/frontends/stv6110x.c @@ -361,7 +361,6 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, { struct stv6110x_state *stv6110x; u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e}; - int ret; stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL); if (stv6110x == NULL) @@ -390,25 +389,6 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, break; } - if (fe->ops.i2c_gate_ctrl) { - ret = fe->ops.i2c_gate_ctrl(fe, 1); - if (ret < 0) - goto error; - } - - ret = stv6110x_write_regs(stv6110x, 0, stv6110x->regs, - ARRAY_SIZE(stv6110x->regs)); - if (ret < 0) { - dprintk(FE_ERROR, 1, "Initialization failed"); - goto error; - } - - if (fe->ops.i2c_gate_ctrl) { - ret = fe->ops.i2c_gate_ctrl(fe, 0); - if (ret < 0) - goto error; - } - fe->tuner_priv = stv6110x; fe->ops.tuner_ops = stv6110x_ops; diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index e5cb1022d9db..f5db13d8b990 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c @@ -640,6 +640,12 @@ static void frontend_init(struct budget *budget) tt1600_stv090x_config.tuner_set_refclk = ctl->tuner_set_refclk; tt1600_stv090x_config.tuner_get_status = ctl->tuner_get_status; + /* call the init function once to initialize + tuner's clock output divider and demod's + master clock */ + if (budget->dvb_frontend->ops.init) + budget->dvb_frontend->ops.init(budget->dvb_frontend); + dvb_attach(isl6423_attach, budget->dvb_frontend, &budget->i2c_adap, -- GitLab From c8382c8e3295a1c85975c1898410f4d103650e4a Mon Sep 17 00:00:00 2001 From: Manu Abraham Date: Sat, 13 Feb 2010 17:06:14 -0300 Subject: [PATCH 152/534] V4L/DVB: stv090x: Add some notes about the internal tuner I/O control Signed-off-by: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv090x.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index a461fdff2c9c..425e7a43ae19 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -758,6 +758,15 @@ static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable) { u32 reg; + /* + * NOTE! A lock is used as a FSM to control the state in which + * access is serialized between two tuners on the same demod. + * This has nothing to do with a lock to protect a critical section + * which may in some other cases be confused with protecting I/O + * access to the demodulator gate. + * In case of any error, the lock is unlocked and exit within the + * relevant operations themselves. + */ if (enable) mutex_lock(&state->internal->tuner_lock); -- GitLab From 5ce005002cd30a71f4355bd4fa8884154d6bd1ad Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 9 Mar 2010 18:13:49 -0300 Subject: [PATCH 153/534] V4L/DVB: drivers/media: drop redundant memset The region set by the call to memset is immediately overwritten by the subsequent call to memcpy. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2,e3,e4; @@ - memset(e1,e2,e3); memcpy(e1,e4,e3); // Signed-off-by: Julia Lawall Cc: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/bt8xx/dst.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c index 8b0cde38984d..248a2a9d8416 100644 --- a/drivers/media/dvb/bt8xx/dst.c +++ b/drivers/media/dvb/bt8xx/dst.c @@ -930,7 +930,6 @@ static int dst_fw_ver(struct dst_state *state) dprintk(verbose, DST_INFO, 1, "Unsupported Command"); return -1; } - memset(&state->fw_version, '\0', 8); memcpy(&state->fw_version, &state->rxbuffer, 8); dprintk(verbose, DST_ERROR, 1, "Firmware Ver = %x.%x Build = %02x, on %x:%x, %x-%x-20%02x", state->fw_version[0] >> 4, state->fw_version[0] & 0x0f, @@ -1053,7 +1052,6 @@ static int dst_get_tuner_info(struct dst_state *state) goto force; } } - memset(&state->board_info, '\0', 8); memcpy(&state->board_info, &state->rxbuffer, 8); if (state->type_flags & DST_TYPE_HAS_MULTI_FE) { dprintk(verbose, DST_ERROR, 1, "DST type has TS=188"); -- GitLab From c4ea13b40bc962245a38148dc5e7633fd8428880 Mon Sep 17 00:00:00 2001 From: Oliver Endriss Date: Wed, 10 Mar 2010 12:46:46 -0300 Subject: [PATCH 154/534] V4L/DVB: ngene: Add support for cineS2 v5 and SaTiX-S2 Dual v2 Add support for - Linux4Media cineS2 DVB-S2 Twin Tuner (v5) - Mystique SaTiX-S2 Dual (v2) Signed-off-by: Oliver Endriss Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ngene/ngene-core.c | 32 ++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 52f60d448de0..a45e53a65462 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c @@ -1920,7 +1920,7 @@ static struct ngene_info ngene_info_cineS2 = { .fw_version = 15, }; -static struct ngene_info ngene_info_satixs2 = { +static struct ngene_info ngene_info_satixS2 = { .type = NGENE_SIDEWINDER, .name = "Mystique SaTiX-S2 Dual", .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, @@ -1933,6 +1933,32 @@ static struct ngene_info ngene_info_satixs2 = { .fw_version = 15, }; +static struct ngene_info ngene_info_satixS2v2 = { + .type = NGENE_SIDEWINDER, + .name = "Mystique SaTiX-S2 Dual (v2)", + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, + .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, + .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, + .fe_config = {&fe_cineS2, &fe_cineS2}, + .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, + .lnb = {0x0a, 0x08}, + .tsf = {3, 3}, + .fw_version = 15, +}; + +static struct ngene_info ngene_info_cineS2v5 = { + .type = NGENE_SIDEWINDER, + .name = "Linux4Media cineS2 DVB-S2 Twin Tuner (v5)", + .io_type = {NGENE_IO_TSIN, NGENE_IO_TSIN}, + .demod_attach = {demod_attach_stv0900, demod_attach_stv0900}, + .tuner_attach = {tuner_attach_stv6110, tuner_attach_stv6110}, + .fe_config = {&fe_cineS2, &fe_cineS2}, + .tuner_config = {&tuner_cineS2_0, &tuner_cineS2_1}, + .lnb = {0x0a, 0x08}, + .tsf = {3, 3}, + .fw_version = 15, +}; + /****************************************************************************/ @@ -1951,7 +1977,9 @@ static struct ngene_info ngene_info_satixs2 = { static const struct pci_device_id ngene_id_tbl[] __devinitdata = { NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), - NGENE_ID(0x18c3, 0xdb01, ngene_info_satixs2), + NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), + NGENE_ID(0x18c3, 0xdb02, ngene_info_satixS2v2), + NGENE_ID(0x18c3, 0xdd00, ngene_info_cineS2v5), {0} }; MODULE_DEVICE_TABLE(pci, ngene_id_tbl); -- GitLab From c3f52f630d067c7590ed438bfb0a82bcb91e0b21 Mon Sep 17 00:00:00 2001 From: Max Thrun Date: Sat, 27 Feb 2010 17:20:18 -0300 Subject: [PATCH 155/534] V4L/DVB: gspca- ov534: Remove ambiguous controls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove Blue/Red Channel Target Value, they are meant for Black Level Calibration but it is not completely clear how to use them. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 100 ++---------------------------- 1 file changed, 6 insertions(+), 94 deletions(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 957e05e2d08f..2a0e8a3e794f 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -60,8 +60,6 @@ struct sd { u8 contrast; u8 gain; u8 exposure; - u8 redblc; - u8 blueblc; u8 hue; u8 autogain; u8 awb; @@ -76,10 +74,6 @@ static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val); static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setredblc(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getredblc(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setblueblc(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getblueblc(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); @@ -155,34 +149,6 @@ static const struct ctrl sd_ctrls[] = { .get = sd_getexposure, }, { /* 4 */ - { - .id = V4L2_CID_RED_BALANCE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Red Balance", - .minimum = 0, - .maximum = 255, - .step = 1, -#define RED_BALANCE_DEF 128 - .default_value = RED_BALANCE_DEF, - }, - .set = sd_setredblc, - .get = sd_getredblc, - }, - { /* 5 */ - { - .id = V4L2_CID_BLUE_BALANCE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Blue Balance", - .minimum = 0, - .maximum = 255, - .step = 1, -#define BLUE_BALANCE_DEF 128 - .default_value = BLUE_BALANCE_DEF, - }, - .set = sd_setblueblc, - .get = sd_getblueblc, - }, - { /* 6 */ { .id = V4L2_CID_HUE, .type = V4L2_CTRL_TYPE_INTEGER, @@ -196,7 +162,7 @@ static const struct ctrl sd_ctrls[] = { .set = sd_sethue, .get = sd_gethue, }, - { /* 7 */ + { /* 5 */ { .id = V4L2_CID_AUTOGAIN, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -210,8 +176,8 @@ static const struct ctrl sd_ctrls[] = { .set = sd_setautogain, .get = sd_getautogain, }, -#define AWB_IDX 8 - { /* 8 */ +#define AWB_IDX 6 + { /* 6 */ { .id = V4L2_CID_AUTO_WHITE_BALANCE, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -225,7 +191,7 @@ static const struct ctrl sd_ctrls[] = { .set = sd_setawb, .get = sd_getawb, }, - { /* 9 */ + { /* 7 */ { .id = V4L2_CID_SHARPNESS, .type = V4L2_CTRL_TYPE_INTEGER, @@ -239,7 +205,7 @@ static const struct ctrl sd_ctrls[] = { .set = sd_setsharpness, .get = sd_getsharpness, }, - { /* 10 */ + { /* 8 */ { .id = V4L2_CID_HFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -253,7 +219,7 @@ static const struct ctrl sd_ctrls[] = { .set = sd_sethflip, .get = sd_gethflip, }, - { /* 11 */ + { /* 9 */ { .id = V4L2_CID_VFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -722,20 +688,6 @@ static void setexposure(struct gspca_dev *gspca_dev) sccb_reg_write(gspca_dev, 0x10, val << 1); } -static void setredblc(struct gspca_dev *gspca_dev) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sccb_reg_write(gspca_dev, 0x43, sd->redblc); -} - -static void setblueblc(struct gspca_dev *gspca_dev) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sccb_reg_write(gspca_dev, 0x42, sd->blueblc); -} - static void sethue(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -825,8 +777,6 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->contrast = CONTRAST_DEF; sd->gain = GAIN_DEF; sd->exposure = EXPO_DEF; - sd->redblc = RED_BALANCE_DEF; - sd->blueblc = BLUE_BALANCE_DEF; sd->hue = HUE_DEF; #if AUTOGAIN_DEF != 0 sd->autogain = AUTOGAIN_DEF; @@ -907,8 +857,6 @@ static int sd_start(struct gspca_dev *gspca_dev) setautogain(gspca_dev); setawb(gspca_dev); setgain(gspca_dev); - setredblc(gspca_dev); - setblueblc(gspca_dev); sethue(gspca_dev); setexposure(gspca_dev); setbrightness(gspca_dev); @@ -1092,42 +1040,6 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) return 0; } -static int sd_setredblc(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->redblc = val; - if (gspca_dev->streaming) - setredblc(gspca_dev); - return 0; -} - -static int sd_getredblc(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->redblc; - return 0; -} - -static int sd_setblueblc(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->blueblc = val; - if (gspca_dev->streaming) - setblueblc(gspca_dev); - return 0; -} - -static int sd_getblueblc(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->blueblc; - return 0; -} - static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; -- GitLab From 0c41acf158b61577dd8e50ba00f3cadabdc3c756 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Sat, 27 Feb 2010 17:20:19 -0300 Subject: [PATCH 156/534] V4L/DVB: gspca - ov534: Remove hue control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hue control doesn't work and the sensor datasheet is not clear about how to set hue properly. Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 54 +++---------------------------- 1 file changed, 5 insertions(+), 49 deletions(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 2a0e8a3e794f..186827a0d276 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -60,7 +60,6 @@ struct sd { u8 contrast; u8 gain; u8 exposure; - u8 hue; u8 autogain; u8 awb; s8 sharpness; @@ -82,8 +81,6 @@ static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val); static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val); -static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val); static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); @@ -149,20 +146,6 @@ static const struct ctrl sd_ctrls[] = { .get = sd_getexposure, }, { /* 4 */ - { - .id = V4L2_CID_HUE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Hue", - .minimum = 0, - .maximum = 255, - .step = 1, -#define HUE_DEF 143 - .default_value = HUE_DEF, - }, - .set = sd_sethue, - .get = sd_gethue, - }, - { /* 5 */ { .id = V4L2_CID_AUTOGAIN, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -176,8 +159,8 @@ static const struct ctrl sd_ctrls[] = { .set = sd_setautogain, .get = sd_getautogain, }, -#define AWB_IDX 6 - { /* 6 */ +#define AWB_IDX 5 + { /* 5 */ { .id = V4L2_CID_AUTO_WHITE_BALANCE, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -191,7 +174,7 @@ static const struct ctrl sd_ctrls[] = { .set = sd_setawb, .get = sd_getawb, }, - { /* 7 */ + { /* 6 */ { .id = V4L2_CID_SHARPNESS, .type = V4L2_CTRL_TYPE_INTEGER, @@ -205,7 +188,7 @@ static const struct ctrl sd_ctrls[] = { .set = sd_setsharpness, .get = sd_getsharpness, }, - { /* 8 */ + { /* 7 */ { .id = V4L2_CID_HFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -219,7 +202,7 @@ static const struct ctrl sd_ctrls[] = { .set = sd_sethflip, .get = sd_gethflip, }, - { /* 9 */ + { /* 8 */ { .id = V4L2_CID_VFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -688,13 +671,6 @@ static void setexposure(struct gspca_dev *gspca_dev) sccb_reg_write(gspca_dev, 0x10, val << 1); } -static void sethue(struct gspca_dev *gspca_dev) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sccb_reg_write(gspca_dev, 0x01, sd->hue); -} - static void setautogain(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -777,7 +753,6 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->contrast = CONTRAST_DEF; sd->gain = GAIN_DEF; sd->exposure = EXPO_DEF; - sd->hue = HUE_DEF; #if AUTOGAIN_DEF != 0 sd->autogain = AUTOGAIN_DEF; #else @@ -857,7 +832,6 @@ static int sd_start(struct gspca_dev *gspca_dev) setautogain(gspca_dev); setawb(gspca_dev); setgain(gspca_dev); - sethue(gspca_dev); setexposure(gspca_dev); setbrightness(gspca_dev); setcontrast(gspca_dev); @@ -1040,24 +1014,6 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) return 0; } -static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->hue = val; - if (gspca_dev->streaming) - sethue(gspca_dev); - return 0; -} - -static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->hue; - return 0; -} - static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; -- GitLab From 8b7fbda484176b46a7760fd474d605ca5152c86d Mon Sep 17 00:00:00 2001 From: Max Thrun Date: Sat, 27 Feb 2010 17:20:20 -0300 Subject: [PATCH 157/534] V4L/DVB: gspca - ov534: Fix autogain control, enable it by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use 'agc' instead of 'autogain' in the code so to align the naming as in AEC/AWB. * Tweak brightness and contrast default values. * Fix setting/resetting registers values for AGC. * Set actual gain back when disabling AGC. * Skip setting GAIN register when AGC is enabled. * Enable AGC by default. Note that as Auto Gain Control is now enabled by default, if you are using the driver for visual computing applications you might need to disable it explicitly in your software. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 53 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 186827a0d276..4058e224d6a4 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -60,7 +60,7 @@ struct sd { u8 contrast; u8 gain; u8 exposure; - u8 autogain; + u8 agc; u8 awb; s8 sharpness; u8 hflip; @@ -73,8 +73,8 @@ static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val); static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getagc(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val); @@ -97,7 +97,7 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, -#define BRIGHTNESS_DEF 20 +#define BRIGHTNESS_DEF 0 .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, @@ -111,7 +111,7 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, -#define CONTRAST_DEF 37 +#define CONTRAST_DEF 32 .default_value = CONTRAST_DEF, }, .set = sd_setcontrast, @@ -149,15 +149,15 @@ static const struct ctrl sd_ctrls[] = { { .id = V4L2_CID_AUTOGAIN, .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Autogain", + .name = "Auto Gain", .minimum = 0, .maximum = 1, .step = 1, -#define AUTOGAIN_DEF 0 - .default_value = AUTOGAIN_DEF, +#define AGC_DEF 1 + .default_value = AGC_DEF, }, - .set = sd_setautogain, - .get = sd_getautogain, + .set = sd_setagc, + .get = sd_getagc, }, #define AWB_IDX 5 { /* 5 */ @@ -639,6 +639,9 @@ static void setgain(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; u8 val; + if (sd->agc) + return; + val = sd->gain; switch (val & 0x30) { case 0x00: @@ -671,18 +674,22 @@ static void setexposure(struct gspca_dev *gspca_dev) sccb_reg_write(gspca_dev, 0x10, val << 1); } -static void setautogain(struct gspca_dev *gspca_dev) +static void setagc(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - if (sd->autogain) { - sccb_reg_write(gspca_dev, 0x13, 0xf7); /* AGC,AEC,AWB ON */ + if (sd->agc) { + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) | 0x04); sccb_reg_write(gspca_dev, 0x64, sccb_reg_read(gspca_dev, 0x64) | 0x03); } else { - sccb_reg_write(gspca_dev, 0x13, 0xf0); /* AGC,AEC,AWB OFF */ + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) & ~0x04); sccb_reg_write(gspca_dev, 0x64, - sccb_reg_read(gspca_dev, 0x64) & 0xfc); + sccb_reg_read(gspca_dev, 0x64) & ~0x03); + + setgain(gspca_dev); } } @@ -753,8 +760,8 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->contrast = CONTRAST_DEF; sd->gain = GAIN_DEF; sd->exposure = EXPO_DEF; -#if AUTOGAIN_DEF != 0 - sd->autogain = AUTOGAIN_DEF; +#if AGC_DEF != 0 + sd->agc = AGC_DEF; #else gspca_dev->ctrl_inac |= (1 << AWB_IDX); #endif @@ -829,7 +836,7 @@ static int sd_start(struct gspca_dev *gspca_dev) } set_frame_rate(gspca_dev); - setautogain(gspca_dev); + setagc(gspca_dev); setawb(gspca_dev); setgain(gspca_dev); setexposure(gspca_dev); @@ -1014,11 +1021,11 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) return 0; } -static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) +static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; - sd->autogain = val; + sd->agc = val; if (gspca_dev->streaming) { @@ -1028,16 +1035,16 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) gspca_dev->ctrl_inac &= ~(1 << AWB_IDX); else gspca_dev->ctrl_inac |= (1 << AWB_IDX); - setautogain(gspca_dev); + setagc(gspca_dev); } return 0; } -static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) +static int sd_getagc(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; - *val = sd->autogain; + *val = sd->agc; return 0; } -- GitLab From f2938822523739e99a39fd634943865a432e9c00 Mon Sep 17 00:00:00 2001 From: Max Thrun Date: Sat, 27 Feb 2010 17:20:21 -0300 Subject: [PATCH 158/534] V4L/DVB: gspca - ov534: Add Auto Exposure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also makes manual exposure actually work: it never worked before because AEC was always enabled. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 55 +++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 4058e224d6a4..2d8965003077 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -62,6 +62,7 @@ struct sd { u8 exposure; u8 agc; u8 awb; + u8 aec; s8 sharpness; u8 hflip; u8 vflip; @@ -83,6 +84,8 @@ static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val); static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); @@ -175,6 +178,20 @@ static const struct ctrl sd_ctrls[] = { .get = sd_getawb, }, { /* 6 */ + { + .id = V4L2_CID_EXPOSURE_AUTO, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Auto Exposure", + .minimum = 0, + .maximum = 1, + .step = 1, +#define AEC_DEF 1 + .default_value = AEC_DEF, + }, + .set = sd_setaec, + .get = sd_getaec, + }, + { /* 7 */ { .id = V4L2_CID_SHARPNESS, .type = V4L2_CTRL_TYPE_INTEGER, @@ -188,7 +205,7 @@ static const struct ctrl sd_ctrls[] = { .set = sd_setsharpness, .get = sd_getsharpness, }, - { /* 7 */ + { /* 8 */ { .id = V4L2_CID_HFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -202,7 +219,7 @@ static const struct ctrl sd_ctrls[] = { .set = sd_sethflip, .get = sd_gethflip, }, - { /* 8 */ + { /* 9 */ { .id = V4L2_CID_VFLIP, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -703,6 +720,20 @@ static void setawb(struct gspca_dev *gspca_dev) sccb_reg_write(gspca_dev, 0x63, 0xaa); /* AWB off */ } +static void setaec(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + if (sd->aec) + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) | 0x01); + else { + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) & ~0x01); + setexposure(gspca_dev); + } +} + static void setsharpness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -768,6 +799,7 @@ static int sd_config(struct gspca_dev *gspca_dev, #if AWB_DEF != 0 sd->awb = AWB_DEF #endif + sd->aec = AEC_DEF; #if SHARPNESS_DEF != 0 sd->sharpness = SHARPNESS_DEF; #endif @@ -838,6 +870,7 @@ static int sd_start(struct gspca_dev *gspca_dev) setagc(gspca_dev); setawb(gspca_dev); + setaec(gspca_dev); setgain(gspca_dev); setexposure(gspca_dev); setbrightness(gspca_dev); @@ -1066,6 +1099,24 @@ static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val) return 0; } +static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->aec = val; + if (gspca_dev->streaming) + setaec(gspca_dev); + return 0; +} + +static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->aec; + return 0; +} + static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; -- GitLab From 18cf8c91ad558f8d2d0177656df493f81949cfe6 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 1 Mar 2010 08:53:34 -0300 Subject: [PATCH 159/534] V4L/DVB: gspca - ov534: Fix and document setting manual exposure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Document that even if the state is a u8 value, both MSB and LSB are set as sd->exposure represents half of the value we are going to set into registers. Skip setting exposure when AEC is enabled. Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 2d8965003077..4fda0980be04 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -686,6 +686,15 @@ static void setexposure(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; u8 val; + if (sd->aec) + return; + + /* 'val' is one byte and represents half of the exposure value we are + * going to set into registers, a two bytes value: + * + * MSB: ((u16) val << 1) >> 8 == val >> 7 + * LSB: ((u16) val << 1) & 0xff == val << 1 + */ val = sd->exposure; sccb_reg_write(gspca_dev, 0x08, val >> 7); sccb_reg_write(gspca_dev, 0x10, val << 1); -- GitLab From 8fef9d962237e29b3d84243387b1f3487b3caaf4 Mon Sep 17 00:00:00 2001 From: Max Thrun Date: Sat, 27 Feb 2010 17:20:23 -0300 Subject: [PATCH 160/534] V4L/DVB: gspca - ov534: Fix Auto White Balance control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Set only the needed bits for AWB, and enable it by default. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 4fda0980be04..3b538d735ecc 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -171,7 +171,7 @@ static const struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 1, .step = 1, -#define AWB_DEF 0 +#define AWB_DEF 1 .default_value = AWB_DEF, }, .set = sd_setawb, @@ -723,10 +723,17 @@ static void setawb(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - if (sd->awb) - sccb_reg_write(gspca_dev, 0x63, 0xe0); /* AWB on */ - else - sccb_reg_write(gspca_dev, 0x63, 0xaa); /* AWB off */ + if (sd->awb) { + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) | 0x02); + sccb_reg_write(gspca_dev, 0x63, + sccb_reg_read(gspca_dev, 0x63) | 0xc0); + } else { + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) & ~0x02); + sccb_reg_write(gspca_dev, 0x63, + sccb_reg_read(gspca_dev, 0x63) & ~0xc0); + } } static void setaec(struct gspca_dev *gspca_dev) @@ -805,9 +812,7 @@ static int sd_config(struct gspca_dev *gspca_dev, #else gspca_dev->ctrl_inac |= (1 << AWB_IDX); #endif -#if AWB_DEF != 0 - sd->awb = AWB_DEF -#endif + sd->awb = AWB_DEF; sd->aec = AEC_DEF; #if SHARPNESS_DEF != 0 sd->sharpness = SHARPNESS_DEF; -- GitLab From 3149cfbfaca7912995a32d72ddd2381e66ca845e Mon Sep 17 00:00:00 2001 From: Max Thrun Date: Sat, 27 Feb 2010 17:20:24 -0300 Subject: [PATCH 161/534] V4L/DVB: gspca - ov534: Fixes for sharpness control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adjust comments for sharpness control * Set default value unconditionally, for readability Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 3b538d735ecc..f2077eaa619c 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -756,8 +756,8 @@ static void setsharpness(struct gspca_dev *gspca_dev) u8 val; val = sd->sharpness; - sccb_reg_write(gspca_dev, 0x91, val); /* vga noise */ - sccb_reg_write(gspca_dev, 0x8e, val); /* qvga noise */ + sccb_reg_write(gspca_dev, 0x91, val); /* Auto de-noise threshold */ + sccb_reg_write(gspca_dev, 0x8e, val); /* De-noise threshold */ } static void sethflip(struct gspca_dev *gspca_dev) @@ -814,9 +814,7 @@ static int sd_config(struct gspca_dev *gspca_dev, #endif sd->awb = AWB_DEF; sd->aec = AEC_DEF; -#if SHARPNESS_DEF != 0 sd->sharpness = SHARPNESS_DEF; -#endif #if HFLIP_DEF != 0 sd->hflip = HFLIP_DEF; #endif -- GitLab From eb171073b6f941e83f01b6444ab347e893785faf Mon Sep 17 00:00:00 2001 From: Max Thrun Date: Sat, 27 Feb 2010 17:20:25 -0300 Subject: [PATCH 162/534] V4L/DVB: gspca - ov534: Fix unsetting hflip and vflip bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also set default values unconditionally, for readability. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index f2077eaa619c..8f01201956c1 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -769,7 +769,7 @@ static void sethflip(struct gspca_dev *gspca_dev) sccb_reg_read(gspca_dev, 0x0c) | 0x40); else sccb_reg_write(gspca_dev, 0x0c, - sccb_reg_read(gspca_dev, 0x0c) & 0xbf); + sccb_reg_read(gspca_dev, 0x0c) & ~0x40); } static void setvflip(struct gspca_dev *gspca_dev) @@ -781,7 +781,7 @@ static void setvflip(struct gspca_dev *gspca_dev) sccb_reg_read(gspca_dev, 0x0c) | 0x80); else sccb_reg_write(gspca_dev, 0x0c, - sccb_reg_read(gspca_dev, 0x0c) & 0x7f); + sccb_reg_read(gspca_dev, 0x0c) & ~0x80); } /* this function is called at probe time */ @@ -815,12 +815,8 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->awb = AWB_DEF; sd->aec = AEC_DEF; sd->sharpness = SHARPNESS_DEF; -#if HFLIP_DEF != 0 sd->hflip = HFLIP_DEF; -#endif -#if VFLIP_DEF != 0 sd->vflip = VFLIP_DEF; -#endif return 0; } -- GitLab From 7f9e9e8dc2d5b226819e486e13c9532f40a0fbda Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 1 Mar 2010 08:54:33 -0300 Subject: [PATCH 163/534] V4L/DVB: gspca - ov534: Cosmetics: fix indentation and hex digits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Indent with tabs, not with spaces, nor with mixed style. * Less indentation for controls index comments. * Use lowercase hex digits. Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 244 +++++++++++++++--------------- 1 file changed, 122 insertions(+), 122 deletions(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 8f01201956c1..878384442482 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -92,147 +92,147 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); static const struct ctrl sd_ctrls[] = { - { /* 0 */ - { - .id = V4L2_CID_BRIGHTNESS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Brightness", - .minimum = 0, - .maximum = 255, - .step = 1, + { /* 0 */ + { + .id = V4L2_CID_BRIGHTNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Brightness", + .minimum = 0, + .maximum = 255, + .step = 1, #define BRIGHTNESS_DEF 0 - .default_value = BRIGHTNESS_DEF, + .default_value = BRIGHTNESS_DEF, + }, + .set = sd_setbrightness, + .get = sd_getbrightness, }, - .set = sd_setbrightness, - .get = sd_getbrightness, - }, - { /* 1 */ - { - .id = V4L2_CID_CONTRAST, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Contrast", - .minimum = 0, - .maximum = 255, - .step = 1, + { /* 1 */ + { + .id = V4L2_CID_CONTRAST, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Contrast", + .minimum = 0, + .maximum = 255, + .step = 1, #define CONTRAST_DEF 32 - .default_value = CONTRAST_DEF, + .default_value = CONTRAST_DEF, + }, + .set = sd_setcontrast, + .get = sd_getcontrast, }, - .set = sd_setcontrast, - .get = sd_getcontrast, - }, - { /* 2 */ - { - .id = V4L2_CID_GAIN, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Main Gain", - .minimum = 0, - .maximum = 63, - .step = 1, + { /* 2 */ + { + .id = V4L2_CID_GAIN, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Main Gain", + .minimum = 0, + .maximum = 63, + .step = 1, #define GAIN_DEF 20 - .default_value = GAIN_DEF, + .default_value = GAIN_DEF, + }, + .set = sd_setgain, + .get = sd_getgain, }, - .set = sd_setgain, - .get = sd_getgain, - }, - { /* 3 */ - { - .id = V4L2_CID_EXPOSURE, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Exposure", - .minimum = 0, - .maximum = 255, - .step = 1, + { /* 3 */ + { + .id = V4L2_CID_EXPOSURE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Exposure", + .minimum = 0, + .maximum = 255, + .step = 1, #define EXPO_DEF 120 - .default_value = EXPO_DEF, + .default_value = EXPO_DEF, + }, + .set = sd_setexposure, + .get = sd_getexposure, }, - .set = sd_setexposure, - .get = sd_getexposure, - }, - { /* 4 */ - { - .id = V4L2_CID_AUTOGAIN, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Auto Gain", - .minimum = 0, - .maximum = 1, - .step = 1, + { /* 4 */ + { + .id = V4L2_CID_AUTOGAIN, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Auto Gain", + .minimum = 0, + .maximum = 1, + .step = 1, #define AGC_DEF 1 - .default_value = AGC_DEF, + .default_value = AGC_DEF, + }, + .set = sd_setagc, + .get = sd_getagc, }, - .set = sd_setagc, - .get = sd_getagc, - }, #define AWB_IDX 5 - { /* 5 */ - { - .id = V4L2_CID_AUTO_WHITE_BALANCE, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Auto White Balance", - .minimum = 0, - .maximum = 1, - .step = 1, + { /* 5 */ + { + .id = V4L2_CID_AUTO_WHITE_BALANCE, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Auto White Balance", + .minimum = 0, + .maximum = 1, + .step = 1, #define AWB_DEF 1 - .default_value = AWB_DEF, + .default_value = AWB_DEF, + }, + .set = sd_setawb, + .get = sd_getawb, }, - .set = sd_setawb, - .get = sd_getawb, - }, - { /* 6 */ - { - .id = V4L2_CID_EXPOSURE_AUTO, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "Auto Exposure", - .minimum = 0, - .maximum = 1, - .step = 1, + { /* 6 */ + { + .id = V4L2_CID_EXPOSURE_AUTO, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Auto Exposure", + .minimum = 0, + .maximum = 1, + .step = 1, #define AEC_DEF 1 - .default_value = AEC_DEF, + .default_value = AEC_DEF, + }, + .set = sd_setaec, + .get = sd_getaec, }, - .set = sd_setaec, - .get = sd_getaec, - }, - { /* 7 */ - { - .id = V4L2_CID_SHARPNESS, - .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Sharpness", - .minimum = 0, - .maximum = 63, - .step = 1, + { /* 7 */ + { + .id = V4L2_CID_SHARPNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Sharpness", + .minimum = 0, + .maximum = 63, + .step = 1, #define SHARPNESS_DEF 0 - .default_value = SHARPNESS_DEF, + .default_value = SHARPNESS_DEF, + }, + .set = sd_setsharpness, + .get = sd_getsharpness, }, - .set = sd_setsharpness, - .get = sd_getsharpness, - }, - { /* 8 */ - { - .id = V4L2_CID_HFLIP, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "HFlip", - .minimum = 0, - .maximum = 1, - .step = 1, + { /* 8 */ + { + .id = V4L2_CID_HFLIP, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "HFlip", + .minimum = 0, + .maximum = 1, + .step = 1, #define HFLIP_DEF 0 - .default_value = HFLIP_DEF, + .default_value = HFLIP_DEF, + }, + .set = sd_sethflip, + .get = sd_gethflip, }, - .set = sd_sethflip, - .get = sd_gethflip, - }, - { /* 9 */ - { - .id = V4L2_CID_VFLIP, - .type = V4L2_CTRL_TYPE_BOOLEAN, - .name = "VFlip", - .minimum = 0, - .maximum = 1, - .step = 1, + { /* 9 */ + { + .id = V4L2_CID_VFLIP, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "VFlip", + .minimum = 0, + .maximum = 1, + .step = 1, #define VFLIP_DEF 0 - .default_value = VFLIP_DEF, + .default_value = VFLIP_DEF, + }, + .set = sd_setvflip, + .get = sd_getvflip, }, - .set = sd_setvflip, - .get = sd_getvflip, - }, }; static const struct v4l2_pix_format ov772x_mode[] = { @@ -641,14 +641,14 @@ static void setbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - sccb_reg_write(gspca_dev, 0x9B, sd->brightness); + sccb_reg_write(gspca_dev, 0x9b, sd->brightness); } static void setcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - sccb_reg_write(gspca_dev, 0x9C, sd->contrast); + sccb_reg_write(gspca_dev, 0x9c, sd->contrast); } static void setgain(struct gspca_dev *gspca_dev) -- GitLab From 4b7875407b2fb56433586877ca0a564b8d999f4e Mon Sep 17 00:00:00 2001 From: Mosalam Ebrahimi Date: Mon, 8 Mar 2010 13:52:17 -0300 Subject: [PATCH 164/534] V4L/DVB: gspca - ov534: Add Powerline Frequency control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that setting this options to 50Hz can reduce the framerate, so it is still disabled (60Hz) by default. Signed-off-by: Mosalam Ebrahimi Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 71 ++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 878384442482..29af17e173d5 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -66,7 +66,7 @@ struct sd { s8 sharpness; u8 hflip; u8 vflip; - + u8 freqfltr; }; /* V4L2 controls supported by the driver */ @@ -90,6 +90,10 @@ static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_querymenu(struct gspca_dev *gspca_dev, + struct v4l2_querymenu *menu); static const struct ctrl sd_ctrls[] = { { /* 0 */ @@ -233,6 +237,20 @@ static const struct ctrl sd_ctrls[] = { .set = sd_setvflip, .get = sd_getvflip, }, + { /* 10 */ + { + .id = V4L2_CID_POWER_LINE_FREQUENCY, + .type = V4L2_CTRL_TYPE_MENU, + .name = "Light Frequency Filter", + .minimum = 0, + .maximum = 1, + .step = 1, +#define FREQFLTR_DEF 0 + .default_value = FREQFLTR_DEF, + }, + .set = sd_setfreqfltr, + .get = sd_getfreqfltr, + }, }; static const struct v4l2_pix_format ov772x_mode[] = { @@ -784,6 +802,17 @@ static void setvflip(struct gspca_dev *gspca_dev) sccb_reg_read(gspca_dev, 0x0c) & ~0x80); } +static void setfreqfltr(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + if (sd->freqfltr == 0) + sccb_reg_write(gspca_dev, 0x2b, 0x00); + else + sccb_reg_write(gspca_dev, 0x2b, 0x9e); +} + + /* this function is called at probe time */ static int sd_config(struct gspca_dev *gspca_dev, const struct usb_device_id *id) @@ -817,6 +846,7 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->sharpness = SHARPNESS_DEF; sd->hflip = HFLIP_DEF; sd->vflip = VFLIP_DEF; + sd->freqfltr = FREQFLTR_DEF; return 0; } @@ -886,6 +916,7 @@ static int sd_start(struct gspca_dev *gspca_dev) setsharpness(gspca_dev); setvflip(gspca_dev); sethflip(gspca_dev); + setfreqfltr(gspca_dev); ov534_set_led(gspca_dev, 1); ov534_reg_write(gspca_dev, 0xe0, 0x00); @@ -1179,6 +1210,43 @@ static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) return 0; } +static int sd_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->freqfltr = val; + if (gspca_dev->streaming) + setfreqfltr(gspca_dev); + return 0; +} + +static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->freqfltr; + return 0; +} + +static int sd_querymenu(struct gspca_dev *gspca_dev, + struct v4l2_querymenu *menu) +{ + switch (menu->id) { + case V4L2_CID_POWER_LINE_FREQUENCY: + switch (menu->index) { + case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */ + strcpy((char *) menu->name, "Disabled"); + return 0; + case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ + strcpy((char *) menu->name, "50 Hz"); + return 0; + } + break; + } + + return -EINVAL; +} + /* get stream parameters (framerate) */ static int sd_get_streamparm(struct gspca_dev *gspca_dev, struct v4l2_streamparm *parm) @@ -1230,6 +1298,7 @@ static const struct sd_desc sd_desc = { .start = sd_start, .stopN = sd_stopN, .pkt_scan = sd_pkt_scan, + .querymenu = sd_querymenu, .get_streamparm = sd_get_streamparm, .set_streamparm = sd_set_streamparm, }; -- GitLab From 6721b51ece65967fe628007fee3e16479c07afd1 Mon Sep 17 00:00:00 2001 From: Max Thrun Date: Sat, 27 Feb 2010 17:20:28 -0300 Subject: [PATCH 165/534] V4L/DVB: gspca - ov534: Update copyright info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/ov534.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 29af17e173d5..8cd193d18b74 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -10,8 +10,8 @@ * https://jim.sh/svn/jim/devl/playstation/ps3/eye/test/ * * PS3 Eye camera enhanced by Richard Kaswy http://kaswy.free.fr - * PS3 Eye camera, brightness, contrast, hue, AWB control added - * by Max Thrun + * PS3 Eye camera - brightness, contrast, awb, agc, aec controls + * added by Max Thrun * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by -- GitLab From 000f64efc7fe6693261a78a0164c0e805553631b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 01:58:12 -0300 Subject: [PATCH 166/534] V4L/DVB: Fix bad whitespacing Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/az6027.c | 10 +++++----- drivers/media/dvb/frontends/atbm8830_priv.h | 2 +- drivers/media/dvb/mantis/mantis_vp1041.c | 10 +++++----- drivers/media/video/davinci/isif_regs.h | 2 +- drivers/media/video/gspca/ov534.c | 2 +- drivers/media/video/ov9640.c | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 60787a28edb3..30ea3eff1ef7 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -125,12 +125,12 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_RCOMPC , 0xc9 }, { STB0899_AGC1CN , 0x01 }, { STB0899_AGC1REF , 0x10 }, - { STB0899_RTC , 0x23 }, + { STB0899_RTC , 0x23 }, { STB0899_TMGCFG , 0x4e }, { STB0899_AGC2REF , 0x34 }, { STB0899_TLSR , 0x84 }, { STB0899_CFD , 0xf7 }, - { STB0899_ACLC , 0x87 }, + { STB0899_ACLC , 0x87 }, { STB0899_BCLC , 0x94 }, { STB0899_EQON , 0x41 }, { STB0899_LDT , 0xf1 }, @@ -183,10 +183,10 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_ECNT3M , 0x0a }, { STB0899_ECNT3L , 0xad }, { STB0899_FECAUTO1 , 0x06 }, - { STB0899_FECM , 0x01 }, + { STB0899_FECM , 0x01 }, { STB0899_VTH12 , 0xb0 }, { STB0899_VTH23 , 0x7a }, - { STB0899_VTH34 , 0x58 }, + { STB0899_VTH34 , 0x58 }, { STB0899_VTH56 , 0x38 }, { STB0899_VTH67 , 0x34 }, { STB0899_VTH78 , 0x24 }, @@ -195,7 +195,7 @@ static const struct stb0899_s1_reg az6027_stb0899_s1_init_3[] = { { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */ { STB0899_TSULC , 0x42 }, { STB0899_RSLLC , 0x41 }, - { STB0899_TSLPL , 0x12 }, + { STB0899_TSLPL , 0x12 }, { STB0899_TSCFGH , 0x0c }, { STB0899_TSCFGM , 0x00 }, { STB0899_TSCFGL , 0x00 }, diff --git a/drivers/media/dvb/frontends/atbm8830_priv.h b/drivers/media/dvb/frontends/atbm8830_priv.h index ce960f76092a..d460058d497e 100644 --- a/drivers/media/dvb/frontends/atbm8830_priv.h +++ b/drivers/media/dvb/frontends/atbm8830_priv.h @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - + #ifndef __ATBM8830_PRIV_H #define __ATBM8830_PRIV_H diff --git a/drivers/media/dvb/mantis/mantis_vp1041.c b/drivers/media/dvb/mantis/mantis_vp1041.c index 515346dd31d0..d1aa2bc0c155 100644 --- a/drivers/media/dvb/mantis/mantis_vp1041.c +++ b/drivers/media/dvb/mantis/mantis_vp1041.c @@ -136,12 +136,12 @@ static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = { { STB0899_RCOMPC , 0xc9 }, { STB0899_AGC1CN , 0x01 }, { STB0899_AGC1REF , 0x10 }, - { STB0899_RTC , 0x23 }, + { STB0899_RTC , 0x23 }, { STB0899_TMGCFG , 0x4e }, { STB0899_AGC2REF , 0x34 }, { STB0899_TLSR , 0x84 }, { STB0899_CFD , 0xf7 }, - { STB0899_ACLC , 0x87 }, + { STB0899_ACLC , 0x87 }, { STB0899_BCLC , 0x94 }, { STB0899_EQON , 0x41 }, { STB0899_LDT , 0xf1 }, @@ -194,10 +194,10 @@ static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = { { STB0899_ECNT3M , 0x0a }, { STB0899_ECNT3L , 0xad }, { STB0899_FECAUTO1 , 0x06 }, - { STB0899_FECM , 0x01 }, + { STB0899_FECM , 0x01 }, { STB0899_VTH12 , 0xb0 }, { STB0899_VTH23 , 0x7a }, - { STB0899_VTH34 , 0x58 }, + { STB0899_VTH34 , 0x58 }, { STB0899_VTH56 , 0x38 }, { STB0899_VTH67 , 0x34 }, { STB0899_VTH78 , 0x24 }, @@ -206,7 +206,7 @@ static const struct stb0899_s1_reg vp1041_stb0899_s1_init_3[] = { { STB0899_RSULC , 0xb1 }, /* DVB = 0xb1, DSS = 0xa1 */ { STB0899_TSULC , 0x42 }, { STB0899_RSLLC , 0x41 }, - { STB0899_TSLPL , 0x12 }, + { STB0899_TSLPL , 0x12 }, { STB0899_TSCFGH , 0x0c }, { STB0899_TSCFGM , 0x00 }, { STB0899_TSCFGL , 0x00 }, diff --git a/drivers/media/video/davinci/isif_regs.h b/drivers/media/video/davinci/isif_regs.h index f7b8893a2957..aa69a463c122 100644 --- a/drivers/media/video/davinci/isif_regs.h +++ b/drivers/media/video/davinci/isif_regs.h @@ -158,7 +158,7 @@ /* gain - offset masks */ #define GAIN_INTEGER_SHIFT 9 -#define OFFSET_MASK 0xFFF +#define OFFSET_MASK 0xFFF #define GAIN_SDRAM_EN_SHIFT 12 #define GAIN_IPIPE_EN_SHIFT 13 #define GAIN_H3A_EN_SHIFT 14 diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index 8cd193d18b74..dc1e4efe30fb 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c @@ -709,7 +709,7 @@ static void setexposure(struct gspca_dev *gspca_dev) /* 'val' is one byte and represents half of the exposure value we are * going to set into registers, a two bytes value: - * + * * MSB: ((u16) val << 1) >> 8 == val >> 7 * LSB: ((u16) val << 1) & 0xff == val << 1 */ diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c index 47bf60ceb7a2..36599a65f548 100644 --- a/drivers/media/video/ov9640.c +++ b/drivers/media/video/ov9640.c @@ -59,9 +59,9 @@ static const struct ov9640_reg ov9640_regs_dflt[] = { * COM12 |= OV9640_COM12_YUV_AVG * * for RGB, alter the following registers: - * COM7 |= OV9640_COM7_RGB - * COM13 |= OV9640_COM13_RGB_AVG - * COM15 |= proper RGB color encoding mode + * COM7 |= OV9640_COM7_RGB + * COM13 |= OV9640_COM13_RGB_AVG + * COM15 |= proper RGB color encoding mode */ static const struct ov9640_reg ov9640_regs_qqcif[] = { { OV9640_CLKRC, OV9640_CLKRC_DPLL_EN | OV9640_CLKRC_DIV(0x0f) }, -- GitLab From 8b0d2a052733d0a0e8ed59aeb8c7e6c90fdb793e Mon Sep 17 00:00:00 2001 From: Stefan Ringel Date: Wed, 10 Mar 2010 14:57:57 -0300 Subject: [PATCH 167/534] V4L/DVB: tm6000: add new hybrid-stick -add Hauppauge WinTV HVR 900H/WinTV USB2-Stick vid/pid 0x2040/6601 0x2040/6610 0x2040/6611 -add Terratec Cinergy Hybrid-Stick vid/pid 0x0ccd/0x00a5 -add Twinhan TU501(704D1) vid/pid 0x13d3/0x3240 0x13d3/0x3241 0x13d3/0x3243 0x13d3/0x3264 Signed-off-by: Stefan Ringel Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-cards.c | 39 ++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index d4f29fde4b12..c26cf2f73e19 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -47,6 +47,7 @@ #define TM6010_BOARD_BEHOLD_WANDER 10 #define TM6010_BOARD_BEHOLD_VOYAGER 11 #define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE 12 +#define TM6010_BOARD_TWINHAN_TU501 13 #define TM6000_MAXBOARDS 16 static unsigned int card[] = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET }; @@ -169,7 +170,7 @@ struct tm6000_board tm6000_boards[] = { .gpio_addr_tun_reset = TM6000_GPIO_4, }, [TM6010_BOARD_HAUPPAUGE_900H] = { - .name = "Hauppauge HVR-900H", + .name = "Hauppauge WinTV HVR-900H / WinTV USB2-Stick", .tuner_type = TUNER_XC2028, /* has a XC3028 */ .tuner_addr = 0xc2 >> 1, .demod_addr = 0x1e >> 1, @@ -180,7 +181,7 @@ struct tm6000_board tm6000_boards[] = { .has_zl10353 = 1, .has_eeprom = 1, }, - .gpio_addr_tun_reset = TM6000_GPIO_2, + .gpio_addr_tun_reset = TM6010_GPIO_2, }, [TM6010_BOARD_BEHOLD_WANDER] = { .name = "Beholder Wander DVB-T/TV/FM USB2.0", @@ -212,7 +213,22 @@ struct tm6000_board tm6000_boards[] = { .gpio_addr_tun_reset = TM6000_GPIO_2, }, [TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = { - .name = "Terratec Cinergy Hybrid XE", + .name = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick", + .tuner_type = TUNER_XC2028, /* has a XC3028 */ + .tuner_addr = 0xc2 >> 1, + .demod_addr = 0x1e >> 1, + .type = TM6010, + .caps = { + .has_tuner = 1, + .has_dvb = 1, + .has_zl10353 = 1, + .has_eeprom = 1, + .has_remote = 1, + }, + .gpio_addr_tun_reset = TM6010_GPIO_2, + }, + [TM6010_BOARD_TWINHAN_TU501] = { + .name = "Twinhan TU501(704D1)", .tuner_type = TUNER_XC2028, /* has a XC3028 */ .tuner_addr = 0xc2 >> 1, .demod_addr = 0x1e >> 1, @@ -236,9 +252,17 @@ struct usb_device_id tm6000_id_table [] = { { USB_DEVICE(0x14aa, 0x0620), .driver_info = TM6000_BOARD_FREECOM_AND_SIMILAR }, { USB_DEVICE(0x06e1, 0xb339), .driver_info = TM6000_BOARD_ADSTECH_MINI_DUAL_TV }, { USB_DEVICE(0x2040, 0x6600), .driver_info = TM6010_BOARD_HAUPPAUGE_900H }, + { USB_DEVICE(0x2040, 0x6601), .driver_info = TM6010_BOARD_HAUPPAUGE_900H }, + { USB_DEVICE(0x2040, 0x6610), .driver_info = TM6010_BOARD_HAUPPAUGE_900H }, + { USB_DEVICE(0x2040, 0x6611), .driver_info = TM6010_BOARD_HAUPPAUGE_900H }, { USB_DEVICE(0x6000, 0xdec0), .driver_info = TM6010_BOARD_BEHOLD_WANDER }, { USB_DEVICE(0x6000, 0xdec1), .driver_info = TM6010_BOARD_BEHOLD_VOYAGER }, { USB_DEVICE(0x0ccd, 0x0086), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE }, + { USB_DEVICE(0x0ccd, 0x00A5), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE }, + { USB_DEVICE(0x13d3, 0x3240), .driver_info = TM6010_BOARD_TWINHAN_TU501 }, + { USB_DEVICE(0x13d3, 0x3241), .driver_info = TM6010_BOARD_TWINHAN_TU501 }, + { USB_DEVICE(0x13d3, 0x3243), .driver_info = TM6010_BOARD_TWINHAN_TU501 }, + { USB_DEVICE(0x13d3, 0x3264), .driver_info = TM6010_BOARD_TWINHAN_TU501 }, { }, }; @@ -271,7 +295,9 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg) case 0: /* newer tuner can faster reset */ switch (dev->model) { + case TM6010_BOARD_HAUPPAUGE_900H: case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: + case TM6010_BOARD_TWINHAN_TU501: tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, dev->tuner_reset_gpio, 0x01); msleep(60); @@ -328,11 +354,11 @@ int tm6000_cards_setup(struct tm6000_core *dev) */ switch (dev->model) { case TM6010_BOARD_HAUPPAUGE_900H: + case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: + case TM6010_BOARD_TWINHAN_TU501: /* Turn xceive 3028 on */ tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_3, 0x01); - msleep(11); - break; - case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: + msleep(15); /* Turn zarlink zl10353 on */ tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_4, 0x00); msleep(15); @@ -445,6 +471,7 @@ static void tm6000_config_tuner (struct tm6000_core *dev) switch(dev->model) { case TM6010_BOARD_HAUPPAUGE_900H: case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: + case TM6010_BOARD_TWINHAN_TU501: ctl.fname = "xc3028L-v36.fw"; break; default: -- GitLab From 945cdfa2c99e2a3f5ead11519ba11ed1df2dd5c1 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 12:41:56 -0300 Subject: [PATCH 168/534] V4L/DVB: ir: use a real device instead of a virtual class Change the ir-sysfs approach to create irrcv0 as a device, instead of using class_dev. Also, change the way input is registered, in order to make its parent to be the irrcv device. Due to this change, now the event device is created under /sys/class/ir/irrcv class: /sys/class/irrcv/irrcv0/ |-- current_protocol |-- device -> ../../../1-3 |-- input9 | |-- capabilities | | |-- abs ... Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 10 +---- drivers/media/IR/ir-sysfs.c | 78 +++++++++++++++++++++++----------- include/media/ir-core.h | 4 +- 3 files changed, 56 insertions(+), 36 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index bfca26d51827..af1f4d7fb910 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -449,22 +449,15 @@ int ir_input_register(struct input_dev *input_dev, input_dev->setkeycode = ir_setkeycode; input_set_drvdata(input_dev, ir_dev); - rc = input_register_device(input_dev); - if (rc < 0) - goto err; - rc = ir_register_class(input_dev); - if (rc < 0) { - input_unregister_device(input_dev); + if (rc < 0) goto err; - } return 0; err: kfree(rc_tab->scan); kfree(ir_dev); - input_set_drvdata(input_dev, NULL); return rc; } EXPORT_SYMBOL_GPL(ir_input_register); @@ -493,7 +486,6 @@ void ir_input_unregister(struct input_dev *dev) ir_unregister_class(dev); kfree(ir_dev); - input_unregister_device(dev); } EXPORT_SYMBOL_GPL(ir_input_unregister); diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index e14e6c486b52..59bd388be8d7 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -23,7 +23,15 @@ static unsigned long ir_core_dev_number; /* class for /sys/class/irrcv */ -static struct class *ir_input_class; +static char *ir_devnode(struct device *dev, mode_t *mode) +{ + return kasprintf(GFP_KERNEL, "irrcv/%s", dev_name(dev)); +} + +struct class ir_input_class = { + .name = "irrcv", + .devnode = ir_devnode, +}; /** * show_protocol() - shows the current IR protocol @@ -129,6 +137,20 @@ static struct attribute *ir_dev_attrs[] = { NULL, }; +static struct attribute_group ir_dev_attr_grp = { + .attrs = ir_dev_attrs, +}; + +static const struct attribute_group *ir_dev_attr_groups[] = { + &ir_dev_attr_grp, + NULL +}; + +static struct device_type ir_dev_type = { + .groups = ir_dev_attr_groups, +}; + + /** * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv? * @input_dev: the struct input_dev descriptor of the device @@ -138,7 +160,7 @@ static struct attribute *ir_dev_attrs[] = { int ir_register_class(struct input_dev *input_dev) { int rc; - struct kobject *kobj; + const char *path; struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); int devno = find_first_zero_bit(&ir_core_dev_number, @@ -147,19 +169,31 @@ int ir_register_class(struct input_dev *input_dev) if (unlikely(devno < 0)) return devno; - ir_dev->attr.attrs = ir_dev_attrs; - ir_dev->class_dev = device_create(ir_input_class, NULL, - input_dev->dev.devt, ir_dev, - "irrcv%d", devno); - kobj = &ir_dev->class_dev->kobj; - - printk(KERN_WARNING "Creating IR device %s\n", kobject_name(kobj)); - rc = sysfs_create_group(kobj, &ir_dev->attr); - if (unlikely(rc < 0)) { - device_destroy(ir_input_class, input_dev->dev.devt); - return -ENOMEM; + ir_dev->dev.type = &ir_dev_type; + ir_dev->dev.class = &ir_input_class; + ir_dev->dev.parent = input_dev->dev.parent; + dev_set_name(&ir_dev->dev, "irrcv%d", devno); + rc = device_register(&ir_dev->dev); + if (rc) + return rc; + + + input_dev->dev.parent = &ir_dev->dev; + rc = input_register_device(input_dev); + if (rc < 0) { + device_del(&ir_dev->dev); + return rc; } + __module_get(THIS_MODULE); + + path = kobject_get_path(&input_dev->dev.kobj, GFP_KERNEL); + printk(KERN_INFO "%s: %s associated with sysfs %s\n", + dev_name(&ir_dev->dev), + input_dev->name ? input_dev->name : "Unspecified device", + path ? path : "N/A"); + kfree(path); + ir_dev->devno = devno; set_bit(devno, &ir_core_dev_number); @@ -176,16 +210,12 @@ int ir_register_class(struct input_dev *input_dev) void ir_unregister_class(struct input_dev *input_dev) { struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - struct kobject *kobj; clear_bit(ir_dev->devno, &ir_core_dev_number); + input_unregister_device(input_dev); + device_del(&ir_dev->dev); - kobj = &ir_dev->class_dev->kobj; - - sysfs_remove_group(kobj, &ir_dev->attr); - device_destroy(ir_input_class, input_dev->dev.devt); - - kfree(ir_dev->attr.name); + module_put(THIS_MODULE); } /* @@ -194,10 +224,10 @@ void ir_unregister_class(struct input_dev *input_dev) static int __init ir_core_init(void) { - ir_input_class = class_create(THIS_MODULE, "irrcv"); - if (IS_ERR(ir_input_class)) { + int rc = class_register(&ir_input_class); + if (rc) { printk(KERN_ERR "ir_core: unable to register irrcv class\n"); - return PTR_ERR(ir_input_class); + return rc; } return 0; @@ -205,7 +235,7 @@ static int __init ir_core_init(void) static void __exit ir_core_exit(void) { - class_destroy(ir_input_class); + class_unregister(&ir_input_class); } module_init(ir_core_init); diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 61c223bc3953..ce9f3476bbdc 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -47,11 +47,9 @@ struct ir_dev_props { struct ir_input_dev { - struct input_dev *dev; /* Input device*/ + struct device dev; /* device */ struct ir_scancode_table rc_tab; /* scan/key table */ unsigned long devno; /* device number */ - struct attribute_group attr; /* IR attributes */ - struct device *class_dev; /* virtual class dev */ const struct ir_dev_props *props; /* Device properties */ }; #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) -- GitLab From 2915e5ef35d103a5ecae15d9ecc614fcd0dc48f4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 12 Mar 2010 11:40:13 -0300 Subject: [PATCH 169/534] V4L/DVB: ir-core: Add a macro to properly create IR tables Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keymaps.c | 455 ++++++---------------------------- include/media/ir-core.h | 3 +- 2 files changed, 83 insertions(+), 375 deletions(-) diff --git a/drivers/media/IR/ir-keymaps.c b/drivers/media/IR/ir-keymaps.c index 0efdefe75f32..dfc777b78dea 100644 --- a/drivers/media/IR/ir-keymaps.c +++ b/drivers/media/IR/ir-keymaps.c @@ -28,16 +28,28 @@ #include #include + +/* + * The usage of tables with just the command part is deprecated. + * All new IR keytables should contain address+command and need + * to define the proper IR_TYPE (IR_TYPE_RC5/IR_TYPE_NEC). + * The deprecated tables should use IR_TYPE_UNKNOWN + */ +#define IR_TABLE(irname, type, tabname) \ +struct ir_scancode_table tabname ## _table = { \ + .scan = tabname, \ + .size = ARRAY_SIZE(tabname), \ + .ir_type = type, \ + .name = #irname, \ +}; \ +EXPORT_SYMBOL_GPL(tabname ## _table) + + /* empty keytable, can be used as placeholder for not-yet created keytables */ static struct ir_scancode ir_codes_empty[] = { { 0x2a, KEY_COFFEE }, }; - -struct ir_scancode_table ir_codes_empty_table = { - .scan = ir_codes_empty, - .size = ARRAY_SIZE(ir_codes_empty), -}; -EXPORT_SYMBOL_GPL(ir_codes_empty_table); +IR_TABLE(empty, IR_TYPE_UNKNOWN, ir_codes_empty); /* Michal Majchrowicz */ static struct ir_scancode ir_codes_proteus_2309[] = { @@ -68,12 +80,7 @@ static struct ir_scancode ir_codes_proteus_2309[] = { { 0x1e, KEY_VOLUMEUP }, /* volume + */ { 0x14, KEY_F1 }, }; - -struct ir_scancode_table ir_codes_proteus_2309_table = { - .scan = ir_codes_proteus_2309, - .size = ARRAY_SIZE(ir_codes_proteus_2309), -}; -EXPORT_SYMBOL_GPL(ir_codes_proteus_2309_table); +IR_TABLE(proteus_2309, IR_TYPE_UNKNOWN, ir_codes_proteus_2309); /* Matt Jesson */ static struct ir_scancode ir_codes_avermedia_m135a[] = { @@ -168,12 +170,7 @@ static struct ir_scancode ir_codes_avermedia_m135a[] = { { 0x18, KEY_PLAY }, { 0x1b, KEY_STOP }, }; - -struct ir_scancode_table ir_codes_avermedia_m135a_table = { - .scan = ir_codes_avermedia_m135a, - .size = ARRAY_SIZE(ir_codes_avermedia_m135a), -}; -EXPORT_SYMBOL_GPL(ir_codes_avermedia_m135a_table); +IR_TABLE(avermedia_m135a, IR_TYPE_UNKNOWN, ir_codes_avermedia_m135a); /* Oldrich Jedlicka */ static struct ir_scancode ir_codes_avermedia_cardbus[] = { @@ -232,12 +229,7 @@ static struct ir_scancode ir_codes_avermedia_cardbus[] = { { 0x42, KEY_CHANNELDOWN }, /* Channel down */ { 0x43, KEY_CHANNELUP }, /* Channel up */ }; - -struct ir_scancode_table ir_codes_avermedia_cardbus_table = { - .scan = ir_codes_avermedia_cardbus, - .size = ARRAY_SIZE(ir_codes_avermedia_cardbus), -}; -EXPORT_SYMBOL_GPL(ir_codes_avermedia_cardbus_table); +IR_TABLE(avermedia_cardbus, IR_TYPE_UNKNOWN, ir_codes_avermedia_cardbus); /* Attila Kondoros */ static struct ir_scancode ir_codes_apac_viewcomp[] = { @@ -279,12 +271,7 @@ static struct ir_scancode ir_codes_apac_viewcomp[] = { { 0x0c, KEY_KPPLUS }, /* fine tune >>>> */ { 0x18, KEY_KPMINUS }, /* fine tune <<<< */ }; - -struct ir_scancode_table ir_codes_apac_viewcomp_table = { - .scan = ir_codes_apac_viewcomp, - .size = ARRAY_SIZE(ir_codes_apac_viewcomp), -}; -EXPORT_SYMBOL_GPL(ir_codes_apac_viewcomp_table); +IR_TABLE(apac_viewcomp, IR_TYPE_UNKNOWN, ir_codes_apac_viewcomp); /* ---------------------------------------------------------------------- */ @@ -331,12 +318,7 @@ static struct ir_scancode ir_codes_pixelview[] = { { 0x1d, KEY_REFRESH }, /* reset */ { 0x18, KEY_MUTE }, /* mute/unmute */ }; - -struct ir_scancode_table ir_codes_pixelview_table = { - .scan = ir_codes_pixelview, - .size = ARRAY_SIZE(ir_codes_pixelview), -}; -EXPORT_SYMBOL_GPL(ir_codes_pixelview_table); +IR_TABLE(pixelview, IR_TYPE_UNKNOWN, ir_codes_pixelview); /* Mauro Carvalho Chehab @@ -381,12 +363,7 @@ static struct ir_scancode ir_codes_pixelview_new[] = { { 0x31, KEY_TV }, { 0x34, KEY_RADIO }, }; - -struct ir_scancode_table ir_codes_pixelview_new_table = { - .scan = ir_codes_pixelview_new, - .size = ARRAY_SIZE(ir_codes_pixelview_new), -}; -EXPORT_SYMBOL_GPL(ir_codes_pixelview_new_table); +IR_TABLE(pixelview_new, IR_TYPE_UNKNOWN, ir_codes_pixelview_new); static struct ir_scancode ir_codes_nebula[] = { { 0x00, KEY_0 }, @@ -445,12 +422,7 @@ static struct ir_scancode ir_codes_nebula[] = { { 0x35, KEY_PHONE }, { 0x36, KEY_PC }, }; - -struct ir_scancode_table ir_codes_nebula_table = { - .scan = ir_codes_nebula, - .size = ARRAY_SIZE(ir_codes_nebula), -}; -EXPORT_SYMBOL_GPL(ir_codes_nebula_table); +IR_TABLE(nebula, IR_TYPE_UNKNOWN, ir_codes_nebula); /* DigitalNow DNTV Live DVB-T Remote */ static struct ir_scancode ir_codes_dntv_live_dvb_t[] = { @@ -490,12 +462,7 @@ static struct ir_scancode ir_codes_dntv_live_dvb_t[] = { { 0x1e, KEY_CHANNELDOWN }, { 0x1f, KEY_VOLUMEDOWN }, }; - -struct ir_scancode_table ir_codes_dntv_live_dvb_t_table = { - .scan = ir_codes_dntv_live_dvb_t, - .size = ARRAY_SIZE(ir_codes_dntv_live_dvb_t), -}; -EXPORT_SYMBOL_GPL(ir_codes_dntv_live_dvb_t_table); +IR_TABLE(dntv_live_dvb_t, IR_TYPE_UNKNOWN, ir_codes_dntv_live_dvb_t); /* ---------------------------------------------------------------------- */ @@ -547,12 +514,7 @@ static struct ir_scancode ir_codes_iodata_bctv7e[] = { { 0x61, KEY_FASTFORWARD }, /* forward >> */ { 0x01, KEY_NEXT }, /* skip >| */ }; - -struct ir_scancode_table ir_codes_iodata_bctv7e_table = { - .scan = ir_codes_iodata_bctv7e, - .size = ARRAY_SIZE(ir_codes_iodata_bctv7e), -}; -EXPORT_SYMBOL_GPL(ir_codes_iodata_bctv7e_table); +IR_TABLE(iodata_bctv7e, IR_TYPE_UNKNOWN, ir_codes_iodata_bctv7e); /* ---------------------------------------------------------------------- */ @@ -605,12 +567,7 @@ static struct ir_scancode ir_codes_adstech_dvb_t_pci[] = { { 0x15, KEY_VOLUMEUP }, { 0x1c, KEY_VOLUMEDOWN }, }; - -struct ir_scancode_table ir_codes_adstech_dvb_t_pci_table = { - .scan = ir_codes_adstech_dvb_t_pci, - .size = ARRAY_SIZE(ir_codes_adstech_dvb_t_pci), -}; -EXPORT_SYMBOL_GPL(ir_codes_adstech_dvb_t_pci_table); +IR_TABLE(adstech_dvb_t_pci, IR_TYPE_UNKNOWN, ir_codes_adstech_dvb_t_pci); /* ---------------------------------------------------------------------- */ @@ -644,12 +601,7 @@ static struct ir_scancode ir_codes_msi_tvanywhere[] = { { 0x1e, KEY_CHANNELDOWN }, { 0x1f, KEY_VOLUMEDOWN }, }; - -struct ir_scancode_table ir_codes_msi_tvanywhere_table = { - .scan = ir_codes_msi_tvanywhere, - .size = ARRAY_SIZE(ir_codes_msi_tvanywhere), -}; -EXPORT_SYMBOL_GPL(ir_codes_msi_tvanywhere_table); +IR_TABLE(msi_tvanywhere, IR_TYPE_UNKNOWN, ir_codes_msi_tvanywhere); /* ---------------------------------------------------------------------- */ @@ -738,12 +690,7 @@ static struct ir_scancode ir_codes_msi_tvanywhere_plus[] = { { 0x0c, KEY_FASTFORWARD }, /* >> */ { 0x1d, KEY_RESTART }, /* Reset */ }; - -struct ir_scancode_table ir_codes_msi_tvanywhere_plus_table = { - .scan = ir_codes_msi_tvanywhere_plus, - .size = ARRAY_SIZE(ir_codes_msi_tvanywhere_plus), -}; -EXPORT_SYMBOL_GPL(ir_codes_msi_tvanywhere_plus_table); +IR_TABLE(msi_tvanywhere_plus, IR_TYPE_UNKNOWN, ir_codes_msi_tvanywhere_plus); /* ---------------------------------------------------------------------- */ @@ -791,12 +738,7 @@ static struct ir_scancode ir_codes_cinergy_1400[] = { { 0x48, KEY_STOP }, { 0x5c, KEY_NEXT }, }; - -struct ir_scancode_table ir_codes_cinergy_1400_table = { - .scan = ir_codes_cinergy_1400, - .size = ARRAY_SIZE(ir_codes_cinergy_1400), -}; -EXPORT_SYMBOL_GPL(ir_codes_cinergy_1400_table); +IR_TABLE(cinergy_1400, IR_TYPE_UNKNOWN, ir_codes_cinergy_1400); /* ---------------------------------------------------------------------- */ @@ -845,12 +787,7 @@ static struct ir_scancode ir_codes_avertv_303[] = { { 0x13, KEY_DOWN }, { 0x1b, KEY_UP }, }; - -struct ir_scancode_table ir_codes_avertv_303_table = { - .scan = ir_codes_avertv_303, - .size = ARRAY_SIZE(ir_codes_avertv_303), -}; -EXPORT_SYMBOL_GPL(ir_codes_avertv_303_table); +IR_TABLE(avertv_303, IR_TYPE_UNKNOWN, ir_codes_avertv_303); /* ---------------------------------------------------------------------- */ @@ -911,12 +848,7 @@ static struct ir_scancode ir_codes_dntv_live_dvbt_pro[] = { { 0x5c, KEY_YELLOW }, { 0x5d, KEY_BLUE }, }; - -struct ir_scancode_table ir_codes_dntv_live_dvbt_pro_table = { - .scan = ir_codes_dntv_live_dvbt_pro, - .size = ARRAY_SIZE(ir_codes_dntv_live_dvbt_pro), -}; -EXPORT_SYMBOL_GPL(ir_codes_dntv_live_dvbt_pro_table); +IR_TABLE(dntv_live_dvbt_pro, IR_TYPE_UNKNOWN, ir_codes_dntv_live_dvbt_pro); static struct ir_scancode ir_codes_em_terratec[] = { { 0x01, KEY_CHANNEL }, @@ -948,12 +880,7 @@ static struct ir_scancode ir_codes_em_terratec[] = { { 0x1e, KEY_STOP }, { 0x40, KEY_ZOOM }, }; - -struct ir_scancode_table ir_codes_em_terratec_table = { - .scan = ir_codes_em_terratec, - .size = ARRAY_SIZE(ir_codes_em_terratec), -}; -EXPORT_SYMBOL_GPL(ir_codes_em_terratec_table); +IR_TABLE(em_terratec, IR_TYPE_UNKNOWN, ir_codes_em_terratec); static struct ir_scancode ir_codes_pinnacle_grey[] = { { 0x3a, KEY_0 }, @@ -1005,12 +932,7 @@ static struct ir_scancode ir_codes_pinnacle_grey[] = { { 0x2a, KEY_MEDIA }, { 0x18, KEY_EPG }, }; - -struct ir_scancode_table ir_codes_pinnacle_grey_table = { - .scan = ir_codes_pinnacle_grey, - .size = ARRAY_SIZE(ir_codes_pinnacle_grey), -}; -EXPORT_SYMBOL_GPL(ir_codes_pinnacle_grey_table); +IR_TABLE(pinnacle_grey, IR_TYPE_UNKNOWN, ir_codes_pinnacle_grey); static struct ir_scancode ir_codes_flyvideo[] = { { 0x0f, KEY_0 }, @@ -1043,12 +965,7 @@ static struct ir_scancode ir_codes_flyvideo[] = { { 0x1f, KEY_FORWARD }, /* Forward ( >>> ) */ { 0x0a, KEY_ANGLE }, /* no label, may be used as the PAUSE button */ }; - -struct ir_scancode_table ir_codes_flyvideo_table = { - .scan = ir_codes_flyvideo, - .size = ARRAY_SIZE(ir_codes_flyvideo), -}; -EXPORT_SYMBOL_GPL(ir_codes_flyvideo_table); +IR_TABLE(flyvideo, IR_TYPE_UNKNOWN, ir_codes_flyvideo); static struct ir_scancode ir_codes_flydvb[] = { { 0x01, KEY_ZOOM }, /* Full Screen */ @@ -1088,12 +1005,7 @@ static struct ir_scancode ir_codes_flydvb[] = { { 0x11, KEY_STOP }, /* Stop */ { 0x0e, KEY_NEXT }, /* End >>| */ }; - -struct ir_scancode_table ir_codes_flydvb_table = { - .scan = ir_codes_flydvb, - .size = ARRAY_SIZE(ir_codes_flydvb), -}; -EXPORT_SYMBOL_GPL(ir_codes_flydvb_table); +IR_TABLE(flydvb, IR_TYPE_UNKNOWN, ir_codes_flydvb); static struct ir_scancode ir_codes_cinergy[] = { { 0x00, KEY_0 }, @@ -1134,12 +1046,7 @@ static struct ir_scancode ir_codes_cinergy[] = { { 0x22, KEY_PAUSE }, { 0x23, KEY_STOP }, }; - -struct ir_scancode_table ir_codes_cinergy_table = { - .scan = ir_codes_cinergy, - .size = ARRAY_SIZE(ir_codes_cinergy), -}; -EXPORT_SYMBOL_GPL(ir_codes_cinergy_table); +IR_TABLE(cinergy, IR_TYPE_UNKNOWN, ir_codes_cinergy); /* Alfons Geser * updates from Job D. R. Borges */ @@ -1197,12 +1104,7 @@ static struct ir_scancode ir_codes_eztv[] = { { 0x13, KEY_ENTER }, /* enter */ { 0x21, KEY_DOT }, /* . (decimal dot) */ }; - -struct ir_scancode_table ir_codes_eztv_table = { - .scan = ir_codes_eztv, - .size = ARRAY_SIZE(ir_codes_eztv), -}; -EXPORT_SYMBOL_GPL(ir_codes_eztv_table); +IR_TABLE(eztv, IR_TYPE_UNKNOWN, ir_codes_eztv); /* Alex Hermann */ static struct ir_scancode ir_codes_avermedia[] = { @@ -1250,12 +1152,7 @@ static struct ir_scancode ir_codes_avermedia[] = { { 0x11, KEY_CHANNELDOWN }, /* CHANNEL/PAGE- */ { 0x31, KEY_CHANNELUP } /* CHANNEL/PAGE+ */ }; - -struct ir_scancode_table ir_codes_avermedia_table = { - .scan = ir_codes_avermedia, - .size = ARRAY_SIZE(ir_codes_avermedia), -}; -EXPORT_SYMBOL_GPL(ir_codes_avermedia_table); +IR_TABLE(avermedia, IR_TYPE_UNKNOWN, ir_codes_avermedia); static struct ir_scancode ir_codes_videomate_tv_pvr[] = { { 0x14, KEY_MUTE }, @@ -1305,12 +1202,7 @@ static struct ir_scancode ir_codes_videomate_tv_pvr[] = { { 0x20, KEY_LANGUAGE }, { 0x21, KEY_SLEEP }, }; - -struct ir_scancode_table ir_codes_videomate_tv_pvr_table = { - .scan = ir_codes_videomate_tv_pvr, - .size = ARRAY_SIZE(ir_codes_videomate_tv_pvr), -}; -EXPORT_SYMBOL_GPL(ir_codes_videomate_tv_pvr_table); +IR_TABLE(videomate_tv_pvr, IR_TYPE_UNKNOWN, ir_codes_videomate_tv_pvr); /* Michael Tokarev http://www.corpit.ru/mjt/beholdTV/remote_control.jpg @@ -1407,12 +1299,7 @@ static struct ir_scancode ir_codes_manli[] = { /* 0x1d unused ? */ }; - -struct ir_scancode_table ir_codes_manli_table = { - .scan = ir_codes_manli, - .size = ARRAY_SIZE(ir_codes_manli), -}; -EXPORT_SYMBOL_GPL(ir_codes_manli_table); +IR_TABLE(manli, IR_TYPE_UNKNOWN, ir_codes_manli); /* Mike Baikov */ static struct ir_scancode ir_codes_gotview7135[] = { @@ -1453,12 +1340,7 @@ static struct ir_scancode ir_codes_gotview7135[] = { { 0x1e, KEY_TIME }, /* TIMESHIFT */ { 0x38, KEY_F24 }, /* NORMAL TIMESHIFT */ }; - -struct ir_scancode_table ir_codes_gotview7135_table = { - .scan = ir_codes_gotview7135, - .size = ARRAY_SIZE(ir_codes_gotview7135), -}; -EXPORT_SYMBOL_GPL(ir_codes_gotview7135_table); +IR_TABLE(gotview7135, IR_TYPE_UNKNOWN, ir_codes_gotview7135); static struct ir_scancode ir_codes_purpletv[] = { { 0x03, KEY_POWER }, @@ -1502,12 +1384,7 @@ static struct ir_scancode ir_codes_purpletv[] = { { 0x42, KEY_REWIND }, /* Backward ? */ }; - -struct ir_scancode_table ir_codes_purpletv_table = { - .scan = ir_codes_purpletv, - .size = ARRAY_SIZE(ir_codes_purpletv), -}; -EXPORT_SYMBOL_GPL(ir_codes_purpletv_table); +IR_TABLE(purpletv, IR_TYPE_UNKNOWN, ir_codes_purpletv); /* Mapping for the 28 key remote control as seen at http://www.sednacomputer.com/photo/cardbus-tv.jpg @@ -1549,12 +1426,7 @@ static struct ir_scancode ir_codes_pctv_sedna[] = { { 0x17, KEY_DIGITS }, /* Plus */ { 0x1f, KEY_PLAY }, /* Play */ }; - -struct ir_scancode_table ir_codes_pctv_sedna_table = { - .scan = ir_codes_pctv_sedna, - .size = ARRAY_SIZE(ir_codes_pctv_sedna), -}; -EXPORT_SYMBOL_GPL(ir_codes_pctv_sedna_table); +IR_TABLE(pctv_sedna, IR_TYPE_UNKNOWN, ir_codes_pctv_sedna); /* Mark Phalan */ static struct ir_scancode ir_codes_pv951[] = { @@ -1594,12 +1466,7 @@ static struct ir_scancode ir_codes_pv951[] = { { 0x14, KEY_EQUAL }, /* SYNC */ { 0x1c, KEY_MEDIA }, /* PC/TV */ }; - -struct ir_scancode_table ir_codes_pv951_table = { - .scan = ir_codes_pv951, - .size = ARRAY_SIZE(ir_codes_pv951), -}; -EXPORT_SYMBOL_GPL(ir_codes_pv951_table); +IR_TABLE(pv951, IR_TYPE_UNKNOWN, ir_codes_pv951); /* generic RC5 keytable */ /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ @@ -1642,12 +1509,7 @@ static struct ir_scancode ir_codes_rc5_tv[] = { { 0x3d, KEY_SUSPEND }, /* system standby */ }; - -struct ir_scancode_table ir_codes_rc5_tv_table = { - .scan = ir_codes_rc5_tv, - .size = ARRAY_SIZE(ir_codes_rc5_tv), -}; -EXPORT_SYMBOL_GPL(ir_codes_rc5_tv_table); +IR_TABLE(rc5_tv, IR_TYPE_UNKNOWN, ir_codes_rc5_tv); /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ static struct ir_scancode ir_codes_winfast[] = { @@ -1711,12 +1573,7 @@ static struct ir_scancode ir_codes_winfast[] = { { 0x3b, KEY_F23 }, /* MCE +CH, on Y04G0033 */ { 0x3f, KEY_F24 } /* MCE -CH, on Y04G0033 */ }; - -struct ir_scancode_table ir_codes_winfast_table = { - .scan = ir_codes_winfast, - .size = ARRAY_SIZE(ir_codes_winfast), -}; -EXPORT_SYMBOL_GPL(ir_codes_winfast_table); +IR_TABLE(winfast, IR_TYPE_UNKNOWN, ir_codes_winfast); static struct ir_scancode ir_codes_pinnacle_color[] = { { 0x59, KEY_MUTE }, @@ -1773,12 +1630,7 @@ static struct ir_scancode ir_codes_pinnacle_color[] = { { 0x74, KEY_CHANNEL }, { 0x0a, KEY_BACKSPACE }, }; - -struct ir_scancode_table ir_codes_pinnacle_color_table = { - .scan = ir_codes_pinnacle_color, - .size = ARRAY_SIZE(ir_codes_pinnacle_color), -}; -EXPORT_SYMBOL_GPL(ir_codes_pinnacle_color_table); +IR_TABLE(pinnacle_color, IR_TYPE_UNKNOWN, ir_codes_pinnacle_color); /* Hauppauge: the newer, gray remotes (seems there are multiple * slightly different versions), shipped with cx88+ivtv cards. @@ -1840,12 +1692,7 @@ static struct ir_scancode ir_codes_hauppauge_new[] = { { 0x3c, KEY_ZOOM }, /* full */ { 0x3d, KEY_POWER }, /* system power (green button) */ }; - -struct ir_scancode_table ir_codes_hauppauge_new_table = { - .scan = ir_codes_hauppauge_new, - .size = ARRAY_SIZE(ir_codes_hauppauge_new), -}; -EXPORT_SYMBOL_GPL(ir_codes_hauppauge_new_table); +IR_TABLE(hauppauge_new, IR_TYPE_UNKNOWN, ir_codes_hauppauge_new); static struct ir_scancode ir_codes_npgtech[] = { { 0x1d, KEY_SWITCHVIDEOMODE }, /* switch inputs */ @@ -1888,12 +1735,7 @@ static struct ir_scancode ir_codes_npgtech[] = { { 0x10, KEY_POWER }, }; - -struct ir_scancode_table ir_codes_npgtech_table = { - .scan = ir_codes_npgtech, - .size = ARRAY_SIZE(ir_codes_npgtech), -}; -EXPORT_SYMBOL_GPL(ir_codes_npgtech_table); +IR_TABLE(npgtech, IR_TYPE_UNKNOWN, ir_codes_npgtech); /* Norwood Micro (non-Pro) TV Tuner By Peter Naulls @@ -1940,12 +1782,7 @@ static struct ir_scancode ir_codes_norwood[] = { { 0x34, KEY_RADIO }, /* FM */ { 0x65, KEY_POWER }, /* Computer power */ }; - -struct ir_scancode_table ir_codes_norwood_table = { - .scan = ir_codes_norwood, - .size = ARRAY_SIZE(ir_codes_norwood), -}; -EXPORT_SYMBOL_GPL(ir_codes_norwood_table); +IR_TABLE(norwood, IR_TYPE_UNKNOWN, ir_codes_norwood); /* From reading the following remotes: * Zenith Universal 7 / TV Mode 807 / VCR Mode 837 @@ -1999,12 +1836,7 @@ static struct ir_scancode ir_codes_budget_ci_old[] = { { 0x3d, KEY_POWER2 }, { 0x3e, KEY_TUNER }, }; - -struct ir_scancode_table ir_codes_budget_ci_old_table = { - .scan = ir_codes_budget_ci_old, - .size = ARRAY_SIZE(ir_codes_budget_ci_old), -}; -EXPORT_SYMBOL_GPL(ir_codes_budget_ci_old_table); +IR_TABLE(budget_ci_old, IR_TYPE_UNKNOWN, ir_codes_budget_ci_old); /* * Marc Fargas @@ -2057,13 +1889,7 @@ static struct ir_scancode ir_codes_asus_pc39[] = { { 0x3d, KEY_MUTE }, /* mute */ { 0x01, KEY_DVD }, /* dvd */ }; - -struct ir_scancode_table ir_codes_asus_pc39_table = { - .scan = ir_codes_asus_pc39, - .size = ARRAY_SIZE(ir_codes_asus_pc39), -}; -EXPORT_SYMBOL_GPL(ir_codes_asus_pc39_table); - +IR_TABLE(asus_pc39, IR_TYPE_UNKNOWN, ir_codes_asus_pc39); /* Encore ENLTV-FM - black plastic, white front cover with white glowing buttons Juan Pablo Sormani */ @@ -2137,12 +1963,7 @@ static struct ir_scancode ir_codes_encore_enltv[] = { { 0x47, KEY_YELLOW }, /* AP3 */ { 0x57, KEY_BLUE }, /* AP4 */ }; - -struct ir_scancode_table ir_codes_encore_enltv_table = { - .scan = ir_codes_encore_enltv, - .size = ARRAY_SIZE(ir_codes_encore_enltv), -}; -EXPORT_SYMBOL_GPL(ir_codes_encore_enltv_table); +IR_TABLE(encore_enltv, IR_TYPE_UNKNOWN, ir_codes_encore_enltv); /* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton Mauro Carvalho Chehab */ @@ -2194,12 +2015,7 @@ static struct ir_scancode ir_codes_encore_enltv2[] = { { 0x7d, KEY_FORWARD }, { 0x79, KEY_STOP }, }; - -struct ir_scancode_table ir_codes_encore_enltv2_table = { - .scan = ir_codes_encore_enltv2, - .size = ARRAY_SIZE(ir_codes_encore_enltv2), -}; -EXPORT_SYMBOL_GPL(ir_codes_encore_enltv2_table); +IR_TABLE(encore_enltv2, IR_TYPE_UNKNOWN, ir_codes_encore_enltv2); /* for the Technotrend 1500 bundled remotes (grey and black): */ static struct ir_scancode ir_codes_tt_1500[] = { @@ -2243,12 +2059,7 @@ static struct ir_scancode ir_codes_tt_1500[] = { { 0x3e, KEY_PAUSE }, { 0x3f, KEY_FORWARD }, }; - -struct ir_scancode_table ir_codes_tt_1500_table = { - .scan = ir_codes_tt_1500, - .size = ARRAY_SIZE(ir_codes_tt_1500), -}; -EXPORT_SYMBOL_GPL(ir_codes_tt_1500_table); +IR_TABLE(tt_1500, IR_TYPE_UNKNOWN, ir_codes_tt_1500); /* DViCO FUSION HDTV MCE remote */ static struct ir_scancode ir_codes_fusionhdtv_mce[] = { @@ -2308,12 +2119,7 @@ static struct ir_scancode ir_codes_fusionhdtv_mce[] = { { 0x01, KEY_RECORD }, { 0x4e, KEY_POWER }, }; - -struct ir_scancode_table ir_codes_fusionhdtv_mce_table = { - .scan = ir_codes_fusionhdtv_mce, - .size = ARRAY_SIZE(ir_codes_fusionhdtv_mce), -}; -EXPORT_SYMBOL_GPL(ir_codes_fusionhdtv_mce_table); +IR_TABLE(fusionhdtv_mce, IR_TYPE_UNKNOWN, ir_codes_fusionhdtv_mce); /* Pinnacle PCTV HD 800i mini remote */ static struct ir_scancode ir_codes_pinnacle_pctv_hd[] = { @@ -2348,12 +2154,7 @@ static struct ir_scancode ir_codes_pinnacle_pctv_hd[] = { { 0x36, KEY_RECORD }, { 0x3f, KEY_EPG }, /* Labeled "?" */ }; - -struct ir_scancode_table ir_codes_pinnacle_pctv_hd_table = { - .scan = ir_codes_pinnacle_pctv_hd, - .size = ARRAY_SIZE(ir_codes_pinnacle_pctv_hd), -}; -EXPORT_SYMBOL_GPL(ir_codes_pinnacle_pctv_hd_table); +IR_TABLE(pinnacle_pctv_hd, IR_TYPE_UNKNOWN, ir_codes_pinnacle_pctv_hd); /* * Igor Kuznetsov @@ -2456,12 +2257,7 @@ static struct ir_scancode ir_codes_behold[] = { { 0x5c, KEY_CAMERA }, }; - -struct ir_scancode_table ir_codes_behold_table = { - .scan = ir_codes_behold, - .size = ARRAY_SIZE(ir_codes_behold), -}; -EXPORT_SYMBOL_GPL(ir_codes_behold_table); +IR_TABLE(behold, IR_TYPE_UNKNOWN, ir_codes_behold); /* Beholder Intl. Ltd. 2008 * Dmitry Belimov d.belimov@google.com @@ -2531,12 +2327,7 @@ static struct ir_scancode ir_codes_behold_columbus[] = { { 0x1A, KEY_NEXT }, }; - -struct ir_scancode_table ir_codes_behold_columbus_table = { - .scan = ir_codes_behold_columbus, - .size = ARRAY_SIZE(ir_codes_behold_columbus), -}; -EXPORT_SYMBOL_GPL(ir_codes_behold_columbus_table); +IR_TABLE(behold_columbus, IR_TYPE_UNKNOWN, ir_codes_behold_columbus); /* * Remote control for the Genius TVGO A11MCE @@ -2582,12 +2373,7 @@ static struct ir_scancode ir_codes_genius_tvgo_a11mce[] = { { 0x13, KEY_YELLOW }, { 0x50, KEY_BLUE }, }; - -struct ir_scancode_table ir_codes_genius_tvgo_a11mce_table = { - .scan = ir_codes_genius_tvgo_a11mce, - .size = ARRAY_SIZE(ir_codes_genius_tvgo_a11mce), -}; -EXPORT_SYMBOL_GPL(ir_codes_genius_tvgo_a11mce_table); +IR_TABLE(genius_tvgo_a11mce, IR_TYPE_UNKNOWN, ir_codes_genius_tvgo_a11mce); /* * Remote control for Powercolor Real Angel 330 @@ -2630,12 +2416,7 @@ static struct ir_scancode ir_codes_powercolor_real_angel[] = { { 0x14, KEY_RADIO }, /* FM radio */ { 0x25, KEY_POWER }, /* power */ }; - -struct ir_scancode_table ir_codes_powercolor_real_angel_table = { - .scan = ir_codes_powercolor_real_angel, - .size = ARRAY_SIZE(ir_codes_powercolor_real_angel), -}; -EXPORT_SYMBOL_GPL(ir_codes_powercolor_real_angel_table); +IR_TABLE(powercolor_real_angel, IR_TYPE_UNKNOWN, ir_codes_powercolor_real_angel); /* Kworld Plus TV Analog Lite PCI IR Mauro Carvalho Chehab @@ -2696,11 +2477,7 @@ static struct ir_scancode ir_codes_kworld_plus_tv_analog[] = { { 0x18, KEY_RED}, /* B */ { 0x23, KEY_GREEN}, /* C */ }; -struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table = { - .scan = ir_codes_kworld_plus_tv_analog, - .size = ARRAY_SIZE(ir_codes_kworld_plus_tv_analog), -}; -EXPORT_SYMBOL_GPL(ir_codes_kworld_plus_tv_analog_table); +IR_TABLE(kworld_plus_tv_analog, IR_TYPE_UNKNOWN, ir_codes_kworld_plus_tv_analog); /* Kaiomy TVnPC U2 Mauro Carvalho Chehab @@ -2749,11 +2526,7 @@ static struct ir_scancode ir_codes_kaiomy[] = { { 0x1e, KEY_YELLOW}, { 0x1f, KEY_BLUE}, }; -struct ir_scancode_table ir_codes_kaiomy_table = { - .scan = ir_codes_kaiomy, - .size = ARRAY_SIZE(ir_codes_kaiomy), -}; -EXPORT_SYMBOL_GPL(ir_codes_kaiomy_table); +IR_TABLE(kaiomy, IR_TYPE_UNKNOWN, ir_codes_kaiomy); static struct ir_scancode ir_codes_avermedia_a16d[] = { { 0x20, KEY_LIST}, @@ -2791,11 +2564,7 @@ static struct ir_scancode ir_codes_avermedia_a16d[] = { { 0x08, KEY_EPG}, { 0x2a, KEY_MENU}, }; -struct ir_scancode_table ir_codes_avermedia_a16d_table = { - .scan = ir_codes_avermedia_a16d, - .size = ARRAY_SIZE(ir_codes_avermedia_a16d), -}; -EXPORT_SYMBOL_GPL(ir_codes_avermedia_a16d_table); +IR_TABLE(avermedia_a16d, IR_TYPE_UNKNOWN, ir_codes_avermedia_a16d); /* Encore ENLTV-FM v5.3 Mauro Carvalho Chehab @@ -2838,11 +2607,7 @@ static struct ir_scancode ir_codes_encore_enltv_fm53[] = { { 0x0c, KEY_ZOOM}, /* hide pannel */ { 0x47, KEY_SLEEP}, /* shutdown */ }; -struct ir_scancode_table ir_codes_encore_enltv_fm53_table = { - .scan = ir_codes_encore_enltv_fm53, - .size = ARRAY_SIZE(ir_codes_encore_enltv_fm53), -}; -EXPORT_SYMBOL_GPL(ir_codes_encore_enltv_fm53_table); +IR_TABLE(encore_enltv_fm53, IR_TYPE_UNKNOWN, ir_codes_encore_enltv_fm53); /* Zogis Real Audio 220 - 32 keys IR */ static struct ir_scancode ir_codes_real_audio_220_32_keys[] = { @@ -2882,11 +2647,7 @@ static struct ir_scancode ir_codes_real_audio_220_32_keys[] = { { 0x19, KEY_CAMERA}, /* Snapshot */ }; -struct ir_scancode_table ir_codes_real_audio_220_32_keys_table = { - .scan = ir_codes_real_audio_220_32_keys, - .size = ARRAY_SIZE(ir_codes_real_audio_220_32_keys), -}; -EXPORT_SYMBOL_GPL(ir_codes_real_audio_220_32_keys_table); +IR_TABLE(real_audio_220_32_keys, IR_TYPE_UNKNOWN, ir_codes_real_audio_220_32_keys); /* ATI TV Wonder HD 600 USB Devin Heitmueller @@ -2917,11 +2678,7 @@ static struct ir_scancode ir_codes_ati_tv_wonder_hd_600[] = { { 0x16, KEY_MUTE}, { 0x17, KEY_VOLUMEDOWN}, }; -struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table = { - .scan = ir_codes_ati_tv_wonder_hd_600, - .size = ARRAY_SIZE(ir_codes_ati_tv_wonder_hd_600), -}; -EXPORT_SYMBOL_GPL(ir_codes_ati_tv_wonder_hd_600_table); +IR_TABLE(ati_tv_wonder_hd_600, IR_TYPE_UNKNOWN, ir_codes_ati_tv_wonder_hd_600); /* DVBWorld remotes Igor M. Liplianin @@ -2959,11 +2716,7 @@ static struct ir_scancode ir_codes_dm1105_nec[] = { { 0x1e, KEY_TV}, /* tvmode */ { 0x1b, KEY_B}, /* recall */ }; -struct ir_scancode_table ir_codes_dm1105_nec_table = { - .scan = ir_codes_dm1105_nec, - .size = ARRAY_SIZE(ir_codes_dm1105_nec), -}; -EXPORT_SYMBOL_GPL(ir_codes_dm1105_nec_table); +IR_TABLE(dm1105_nec, IR_TYPE_UNKNOWN, ir_codes_dm1105_nec); static struct ir_scancode ir_codes_tevii_nec[] = { { 0x0a, KEY_POWER2}, @@ -3014,11 +2767,7 @@ static struct ir_scancode ir_codes_tevii_nec[] = { { 0x56, KEY_MODE}, { 0x58, KEY_SWITCHVIDEOMODE}, }; -struct ir_scancode_table ir_codes_tevii_nec_table = { - .scan = ir_codes_tevii_nec, - .size = ARRAY_SIZE(ir_codes_tevii_nec), -}; -EXPORT_SYMBOL_GPL(ir_codes_tevii_nec_table); +IR_TABLE(tevii_nec, IR_TYPE_UNKNOWN, ir_codes_tevii_nec); static struct ir_scancode ir_codes_tbs_nec[] = { { 0x04, KEY_POWER2}, /*power*/ @@ -3054,11 +2803,7 @@ static struct ir_scancode ir_codes_tbs_nec[] = { { 0x00, KEY_PREVIOUS}, { 0x1b, KEY_MODE}, }; -struct ir_scancode_table ir_codes_tbs_nec_table = { - .scan = ir_codes_tbs_nec, - .size = ARRAY_SIZE(ir_codes_tbs_nec), -}; -EXPORT_SYMBOL_GPL(ir_codes_tbs_nec_table); +IR_TABLE(tbs_nec, IR_TYPE_UNKNOWN, ir_codes_tbs_nec); /* Terratec Cinergy Hybrid T USB XS Devin Heitmueller @@ -3112,11 +2857,7 @@ static struct ir_scancode ir_codes_terratec_cinergy_xs[] = { { 0x4f, KEY_FASTFORWARD}, { 0x5c, KEY_NEXT}, }; -struct ir_scancode_table ir_codes_terratec_cinergy_xs_table = { - .scan = ir_codes_terratec_cinergy_xs, - .size = ARRAY_SIZE(ir_codes_terratec_cinergy_xs), -}; -EXPORT_SYMBOL_GPL(ir_codes_terratec_cinergy_xs_table); +IR_TABLE(terratec_cinergy_xs, IR_TYPE_UNKNOWN, ir_codes_terratec_cinergy_xs); /* EVGA inDtube Devin Heitmueller @@ -3139,11 +2880,7 @@ static struct ir_scancode ir_codes_evga_indtube[] = { { 0x1f, KEY_NEXT}, { 0x13, KEY_CAMERA}, }; -struct ir_scancode_table ir_codes_evga_indtube_table = { - .scan = ir_codes_evga_indtube, - .size = ARRAY_SIZE(ir_codes_evga_indtube), -}; -EXPORT_SYMBOL_GPL(ir_codes_evga_indtube_table); +IR_TABLE(evga_indtube, IR_TYPE_UNKNOWN, ir_codes_evga_indtube); static struct ir_scancode ir_codes_videomate_s350[] = { { 0x00, KEY_TV}, @@ -3191,11 +2928,7 @@ static struct ir_scancode ir_codes_videomate_s350[] = { { 0x11, KEY_ENTER}, { 0x20, KEY_TEXT}, }; -struct ir_scancode_table ir_codes_videomate_s350_table = { - .scan = ir_codes_videomate_s350, - .size = ARRAY_SIZE(ir_codes_videomate_s350), -}; -EXPORT_SYMBOL_GPL(ir_codes_videomate_s350_table); +IR_TABLE(videomate_s350, IR_TYPE_UNKNOWN, ir_codes_videomate_s350); /* GADMEI UTV330+ RM008Z remote Shine Liu @@ -3238,11 +2971,7 @@ static struct ir_scancode ir_codes_gadmei_rm008z[] = { { 0x13, KEY_CHANNELDOWN}, /* CHANNELDOWN */ { 0x15, KEY_ENTER}, /* OK */ }; -struct ir_scancode_table ir_codes_gadmei_rm008z_table = { - .scan = ir_codes_gadmei_rm008z, - .size = ARRAY_SIZE(ir_codes_gadmei_rm008z), -}; -EXPORT_SYMBOL_GPL(ir_codes_gadmei_rm008z_table); +IR_TABLE(gadmei_rm008z, IR_TYPE_UNKNOWN, ir_codes_gadmei_rm008z); /************************************************************* * COMPLETE SCANCODE TABLES @@ -3313,13 +3042,7 @@ static struct ir_scancode ir_codes_rc5_hauppauge_new[] = { { 0x1e3c, KEY_ZOOM }, /* full */ { 0x1e3d, KEY_POWER }, /* system power (green button) */ }; - -struct ir_scancode_table ir_codes_rc5_hauppauge_new_table = { - .scan = ir_codes_rc5_hauppauge_new, - .size = ARRAY_SIZE(ir_codes_rc5_hauppauge_new), - .ir_type = IR_TYPE_RC5, -}; -EXPORT_SYMBOL_GPL(ir_codes_rc5_hauppauge_new_table); +IR_TABLE(rc5_hauppauge_new, IR_TYPE_RC5, ir_codes_rc5_hauppauge_new); /* Terratec Cinergy Hybrid T USB XS FM Mauro Carvalho Chehab @@ -3386,13 +3109,7 @@ static struct ir_scancode ir_codes_nec_terratec_cinergy_xs[] = { { 0x144f, KEY_FASTFORWARD}, { 0x145c, KEY_NEXT}, }; -struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table = { - .scan = ir_codes_nec_terratec_cinergy_xs, - .size = ARRAY_SIZE(ir_codes_nec_terratec_cinergy_xs), - .ir_type = IR_TYPE_NEC, -}; -EXPORT_SYMBOL_GPL(ir_codes_nec_terratec_cinergy_xs_table); - +IR_TABLE(nec_terratec_cinergy_xs, IR_TYPE_NEC, ir_codes_nec_terratec_cinergy_xs); /* Leadtek Winfast TV USB II Deluxe remote Magnus Alm @@ -3436,11 +3153,7 @@ static struct ir_scancode ir_codes_winfast_usbii_deluxe[] = { { 0x63, KEY_ENTER}, /* ENTER */ }; -struct ir_scancode_table ir_codes_winfast_usbii_deluxe_table = { - .scan = ir_codes_winfast_usbii_deluxe, - .size = ARRAY_SIZE(ir_codes_winfast_usbii_deluxe), -}; -EXPORT_SYMBOL_GPL(ir_codes_winfast_usbii_deluxe_table); +IR_TABLE(winfast_usbii_deluxe, IR_TYPE_UNKNOWN, ir_codes_winfast_usbii_deluxe); /* Kworld 315U */ @@ -3485,10 +3198,4 @@ static struct ir_scancode ir_codes_kworld_315u[] = { { 0x611e, KEY_YELLOW }, { 0x611f, KEY_BLUE }, }; - -struct ir_scancode_table ir_codes_kworld_315u_table = { - .scan = ir_codes_kworld_315u, - .size = ARRAY_SIZE(ir_codes_kworld_315u), - .ir_type = IR_TYPE_NEC, -}; -EXPORT_SYMBOL_GPL(ir_codes_kworld_315u_table); +IR_TABLE(kworld_315u, IR_TYPE_NEC, ir_codes_kworld_315u); diff --git a/include/media/ir-core.h b/include/media/ir-core.h index ce9f3476bbdc..9ab8a7774223 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -35,7 +35,8 @@ struct ir_scancode { struct ir_scancode_table { struct ir_scancode *scan; int size; - u64 ir_type; + u64 ir_type; + char *name; spinlock_t lock; }; -- GitLab From 9c89a181a09eaafca5fc638c3b7ce1620227f60a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 12 Mar 2010 11:50:17 -0300 Subject: [PATCH 170/534] V4L/DVB: ir-core: Export IR name via uevent Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 1 + drivers/media/IR/ir-sysfs.c | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index af1f4d7fb910..6db3ff74659b 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -419,6 +419,7 @@ int ir_input_register(struct input_dev *input_dev, spin_lock_init(&ir_dev->rc_tab.lock); + ir_dev->rc_tab.name = rc_tab->name; ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size); ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size * sizeof(struct ir_scancode), GFP_KERNEL); diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 59bd388be8d7..6d63657b5685 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -126,6 +126,24 @@ static ssize_t store_protocol(struct device *d, return len; } + +#define ADD_HOTPLUG_VAR(fmt, val...) \ + do { \ + int err = add_uevent_var(env, fmt, val); \ + if (err) \ + return err; \ + } while (0) + +static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env) +{ + struct ir_input_dev *ir_dev = dev_get_drvdata(device); + + if (ir_dev->rc_tab.name) + ADD_HOTPLUG_VAR("NAME=\"%s\"", ir_dev->rc_tab.name); + + return 0; +} + /* * Static device attribute struct with the sysfs attributes for IR's */ @@ -148,9 +166,9 @@ static const struct attribute_group *ir_dev_attr_groups[] = { static struct device_type ir_dev_type = { .groups = ir_dev_attr_groups, + .uevent = ir_dev_uevent, }; - /** * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv? * @input_dev: the struct input_dev descriptor of the device @@ -173,6 +191,7 @@ int ir_register_class(struct input_dev *input_dev) ir_dev->dev.class = &ir_input_class; ir_dev->dev.parent = input_dev->dev.parent; dev_set_name(&ir_dev->dev, "irrcv%d", devno); + dev_set_drvdata(&ir_dev->dev, ir_dev); rc = device_register(&ir_dev->dev); if (rc) return rc; @@ -187,8 +206,8 @@ int ir_register_class(struct input_dev *input_dev) __module_get(THIS_MODULE); - path = kobject_get_path(&input_dev->dev.kobj, GFP_KERNEL); - printk(KERN_INFO "%s: %s associated with sysfs %s\n", + path = kobject_get_path(&ir_dev->dev.kobj, GFP_KERNEL); + printk(KERN_INFO "%s: %s as %s\n", dev_name(&ir_dev->dev), input_dev->name ? input_dev->name : "Unspecified device", path ? path : "N/A"); -- GitLab From 727e625cc2c114e449a78f851b0c12edac897a83 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 12 Mar 2010 21:18:14 -0300 Subject: [PATCH 171/534] V4L/DVB: ir-core: export driver name used by IR via uevent Now, both driver and keytable names are exported to userspace. This will help userspace to decide when a table need to be replaced by another one. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 7 ++++++- drivers/media/IR/ir-sysfs.c | 2 ++ drivers/media/dvb/dm1105/dm1105.c | 4 +++- drivers/media/dvb/mantis/mantis_input.c | 4 +++- drivers/media/dvb/ttpci/budget-ci.c | 4 +++- drivers/media/video/bt8xx/bttv-input.c | 4 +++- drivers/media/video/cx231xx/cx231xx-input.c | 5 ++++- drivers/media/video/cx23885/cx23885-input.c | 4 +++- drivers/media/video/cx88/cx88-input.c | 4 +++- drivers/media/video/em28xx/em28xx-input.c | 4 +++- drivers/media/video/ir-kbd-i2c.c | 8 ++++---- drivers/media/video/saa7134/saa7134-input.c | 4 +++- include/media/ir-core.h | 4 +++- 13 files changed, 43 insertions(+), 15 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 6db3ff74659b..73fe4bec83bc 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -404,7 +404,8 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); */ int ir_input_register(struct input_dev *input_dev, const struct ir_scancode_table *rc_tab, - const struct ir_dev_props *props) + const struct ir_dev_props *props, + const char *driver_name) { struct ir_input_dev *ir_dev; struct ir_scancode *keymap = rc_tab->scan; @@ -419,6 +420,10 @@ int ir_input_register(struct input_dev *input_dev, spin_lock_init(&ir_dev->rc_tab.lock); + ir_dev->driver_name = kmalloc(strlen(driver_name) + 1, GFP_KERNEL); + if (!ir_dev->driver_name) + return -ENOMEM; + strcpy(ir_dev->driver_name, driver_name); ir_dev->rc_tab.name = rc_tab->name; ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size); ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size * diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 6d63657b5685..0592515a19f8 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -140,6 +140,8 @@ static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env) if (ir_dev->rc_tab.name) ADD_HOTPLUG_VAR("NAME=\"%s\"", ir_dev->rc_tab.name); + if (ir_dev->driver_name) + ADD_HOTPLUG_VAR("DRV_NAME=\"%s\"", ir_dev->driver_name); return 0; } diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index b6d46961a99e..3229ff325c56 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -46,6 +46,8 @@ #include "z0194a.h" #include "ds3000.h" +#define MODULE_NAME "dm1105" + #define UNSET (-1U) #define DM1105_BOARD_NOAUTO UNSET @@ -628,7 +630,7 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) INIT_WORK(&dm1105->ir.work, dm1105_emit_key); - err = ir_input_register(input_dev, ir_codes, NULL); + err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); return err; } diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index 4675a3b53c7d..6baf30229689 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c @@ -32,6 +32,8 @@ #include "mantis_reg.h" #include "mantis_uart.h" +#define MODULE_NAME "mantis_core" + static struct ir_scancode mantis_ir_table[] = { { 0x29, KEY_POWER }, { 0x28, KEY_FAVORITES }, @@ -126,7 +128,7 @@ int mantis_input_init(struct mantis_pci *mantis) rc->id.version = 1; rc->dev = mantis->pdev->dev; - err = ir_input_register(rc, &ir_mantis, NULL); + err = ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME); if (err) { dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); input_free_device(rc); diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 49c2a817a06f..ec89afd38917 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -54,6 +54,8 @@ #include "tda1002x.h" #include "tda827x.h" +#define MODULE_NAME "budget_ci" + /* * Regarding DEBIADDR_IR: * Some CI modules hang if random addresses are read. @@ -254,7 +256,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) budget_ci->ir.timer_keyup.function = msp430_ir_keyup; budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; budget_ci->ir.last_raw = 0xffff; /* An impossible value */ - error = ir_input_register(input_dev, ir_codes, NULL); + error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); return error; diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index aa153a986ade..d17a9b7911e5 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -49,6 +49,8 @@ module_param(ir_rc5_key_timeout, int, 0644); #define DEVNAME "bttv-input" +#define MODULE_NAME "bttv" + /* ---------------------------------------------------------------------- */ static void ir_handle_key(struct bttv *btv) @@ -390,7 +392,7 @@ int bttv_input_init(struct bttv *btv) bttv_ir_start(btv, ir); /* all done */ - err = ir_input_register(btv->remote->dev, ir_codes, NULL); + err = ir_input_register(btv->remote->dev, ir_codes, NULL, MODULE_NAME); if (err) goto err_out_stop; diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c index b473cd8367f5..a0e8bb88d67e 100644 --- a/drivers/media/video/cx231xx/cx231xx-input.c +++ b/drivers/media/video/cx231xx/cx231xx-input.c @@ -35,6 +35,8 @@ static unsigned int ir_debug; module_param(ir_debug, int, 0644); MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); +#define MODULE_NAME "cx231xx" + #define i2cdprintk(fmt, arg...) \ if (ir_debug) { \ printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \ @@ -217,7 +219,8 @@ int cx231xx_ir_init(struct cx231xx *dev) cx231xx_ir_start(ir); /* all done */ - err = ir_input_register(ir->input, dev->board.ir_codes, NULL); + err = ir_input_register(ir->input, dev->board.ir_codes, + NULL, MODULE_NAME); if (err) goto err_out_stop; diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index 8e9d990dbe93..ef1db2d9668a 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c @@ -51,6 +51,8 @@ #define RC5_EXTENDED_COMMAND_OFFSET 64 +#define MODULE_NAME "cx23885" + static inline unsigned int rc5_command(u32 rc5_baseband) { return RC5_INSTR(rc5_baseband) + @@ -398,7 +400,7 @@ int cx23885_input_init(struct cx23885_dev *dev) dev->ir_input = ir; cx23885_input_ir_start(dev); - ret = ir_input_register(ir->dev, ir_codes, NULL); + ret = ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME); if (ret) goto err_out_stop; diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 6b6abf062c21..8b52546c6e1d 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -32,6 +32,8 @@ #include "cx88.h" #include +#define MODULE_NAME "cx88xx" + /* ---------------------------------------------------------------------- */ struct cx88_IR { @@ -384,7 +386,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) cx88_ir_start(core, ir); /* all done */ - err = ir_input_register(ir->input, ir_codes, NULL); + err = ir_input_register(ir->input, ir_codes, NULL, MODULE_NAME); if (err) goto err_out_stop; diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 20a0001e8885..32f376654c0c 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -39,6 +39,8 @@ static unsigned int ir_debug; module_param(ir_debug, int, 0644); MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); +#define MODULE_NAME "em28xx" + #define i2cdprintk(fmt, arg...) \ if (ir_debug) { \ printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg); \ @@ -474,7 +476,7 @@ int em28xx_ir_init(struct em28xx *dev) /* all done */ err = ir_input_register(ir->input, dev->board.ir_codes, - &ir->props); + &ir->props, MODULE_NAME); if (err) goto err_out_stop; diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index da18d698e7f2..6af69d5c8499 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -61,9 +61,9 @@ module_param(hauppauge, int, 0644); /* Choose Hauppauge remote */ MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults to 0)"); -#define DEVNAME "ir-kbd-i2c" +#define MODULE_NAME "ir-kbd-i2c" #define dprintk(level, fmt, arg...) if (debug >= level) \ - printk(KERN_DEBUG DEVNAME ": " fmt , ## arg) + printk(KERN_DEBUG MODULE_NAME ": " fmt , ## arg) /* ----------------------------------------------------------------------- */ @@ -447,11 +447,11 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) input_dev->name = ir->name; input_dev->phys = ir->phys; - err = ir_input_register(ir->input, ir->ir_codes, NULL); + err = ir_input_register(ir->input, ir->ir_codes, NULL, MODULE_NAME); if (err) goto err_out_free; - printk(DEVNAME ": %s detected at %s [%s]\n", + printk(MODULE_NAME ": %s detected at %s [%s]\n", ir->input->name, ir->input->phys, adap->name); /* start polling via eventd */ diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index a2b16693ee9a..c1fe7c9369b2 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -28,6 +28,8 @@ #include "saa7134-reg.h" #include "saa7134.h" +#define MODULE_NAME "saa7134" + static unsigned int disable_ir; module_param(disable_ir, int, 0444); MODULE_PARM_DESC(disable_ir,"disable infrared remote support"); @@ -730,7 +732,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) dev->remote = ir; saa7134_ir_start(dev, ir); - err = ir_input_register(ir->dev, ir_codes, NULL); + err = ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME); if (err) goto err_out_stop; diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 9ab8a7774223..1eae72d518e0 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -49,6 +49,7 @@ struct ir_dev_props { struct ir_input_dev { struct device dev; /* device */ + char *driver_name; /* Name of the driver module */ struct ir_scancode_table rc_tab; /* scan/key table */ unsigned long devno; /* device number */ const struct ir_dev_props *props; /* Device properties */ @@ -62,7 +63,8 @@ u32 ir_g_keycode_from_table(struct input_dev *input_dev, int ir_input_register(struct input_dev *dev, const struct ir_scancode_table *ir_codes, - const struct ir_dev_props *props); + const struct ir_dev_props *props, + const char *driver_name); void ir_input_unregister(struct input_dev *input_dev); /* Routines from ir-sysfs.c */ -- GitLab From 4605664bd94ed94ab65a00bc7c749704304cfd40 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 31 Jan 2010 21:06:10 -0300 Subject: [PATCH 172/534] V4L/DVB: dvb-usb: enable specifying a separate generic bulk ctrl response endpoint Some DVB USB devices use a separate endpoint for responses to control messages sent with bulk transfers via the generic_bulk_ctrl_endpoint. When generic_bulk_ctrl_endpoint_response is set, it will be used instead of the generic_bulk_ctrl_endpoint when reading usb responses in the dvb_usb_generic_rw helper function. Signed-off-by: Michael Krufky Reviewed-by: Patrick Boettcher Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/dvb-usb-urb.c | 2 ++ drivers/media/dvb/dvb-usb/dvb-usb.h | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index 6fe71c6745eb..bb46ba6a3573 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c @@ -42,6 +42,8 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, msleep(delay_ms); ret = usb_bulk_msg(d->udev,usb_rcvbulkpipe(d->udev, + d->props.generic_bulk_ctrl_endpoint_response ? + d->props.generic_bulk_ctrl_endpoint_response : d->props.generic_bulk_ctrl_endpoint),rbuf,rlen,&actlen, 2000); diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 0143aef19ecd..4a9f676087bf 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h @@ -198,6 +198,12 @@ struct dvb_usb_adapter_properties { * is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write- * helper functions. * + * @generic_bulk_ctrl_endpoint_response: some DVB USB devices use a separate + * endpoint for responses to control messages sent with bulk transfers via + * the generic_bulk_ctrl_endpoint. When this is non-zero, this will be used + * instead of the generic_bulk_ctrl_endpoint when reading usb responses in + * the dvb_usb_generic_rw helper function. + * * @num_device_descs: number of struct dvb_usb_device_description in @devices * @devices: array of struct dvb_usb_device_description compatibles with these * properties. @@ -239,6 +245,7 @@ struct dvb_usb_device_properties { struct i2c_algorithm *i2c_algo; int generic_bulk_ctrl_endpoint; + int generic_bulk_ctrl_endpoint_response; int num_device_descs; struct dvb_usb_device_description devices[12]; -- GitLab From b8e286260e97be4bb245041ae63b9565922246c2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 10:26:46 -0300 Subject: [PATCH 173/534] V4L/DVB: tm6000: Replace all Req 7 group of regs with another naming convention According with the original patch that added the register names, those are related to tm6010, so name it properly as such. Also, clearly indicates when a register belongs to Request 0x07 and add its register value at the name. This makes easier to double check if the proper register is used along the driver. This patch were made with the help of this simple perl script: if (m/define (TM6000_)([^\s]+)\s+0x([A-F0-9].)/) { $name=$2; $val=$3; printf "s,$1$2,TM6010_REQ07_R%s_%s,g\n", $val, $name; } And were manually adjusted to fix a few minor issues. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-regs.h | 356 +++++++++++++-------------- 1 file changed, 178 insertions(+), 178 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 9af4c066a3bf..321eb3fc859f 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -98,186 +98,186 @@ enum { }; /* Define TM6000/TM6010 Video decoder registers */ -#define TM6000_VIDEO_CONTROL0 0x00 -#define TM6000_VIDEO_CONTROL1 0x01 -#define TM6000_VIDEO_CONTROL2 0x02 -#define TM6000_YC_SEP_CONTROL 0x03 -#define TM6000_LUMA_HAGC_CONTROL 0x04 -#define TM6000_NOISE_THRESHOLD 0x05 -#define TM6000_AGC_GATE_THRESHOLD 0x06 -#define TM6000_OUTPUT_CONTROL 0x07 -#define TM6000_LUMA_CONTRAST_ADJ 0x08 -#define TM6000_LUMA_BRIGHTNESS_ADJ 0x09 -#define TM6000_CHROMA_SATURATION_ADJ 0x0A -#define TM6000_CHROMA_HUE_PHASE_ADJ 0x0B -#define TM6000_CHROMA_AGC_CONTROL 0x0C -#define TM6000_CHROMA_KILL_LEVEL 0x0D -#define TM6000_CHROMA_AUTO_POSITION 0x0F -#define TM6000_AGC_PEAK_NOMINAL 0x10 -#define TM6000_AGC_PEAK_CONTROL 0x11 -#define TM6000_AGC_GATE_STARTH 0x12 -#define TM6000_AGC_GATE_STARTL 0x13 -#define TM6000_AGC_GATE_WIDTH 0x14 -#define TM6000_AGC_BP_DELAY 0x15 -#define TM6000_LOCK_COUNT 0x16 -#define TM6000_HLOOP_MAXSTATE 0x17 -#define TM6000_CHROMA_DTO_INCREMENT3 0x18 -#define TM6000_CHROMA_DTO_INCREMENT2 0x19 -#define TM6000_CHROMA_DTO_INCREMENT1 0x1A -#define TM6000_CHROMA_DTO_INCREMENT0 0x1B -#define TM6000_HSYNC_DTO_INCREMENT3 0x1C -#define TM6000_HSYNC_DTO_INCREMENT2 0x1D -#define TM6000_HSYNC_DTO_INCREMENT1 0x1E -#define TM6000_HSYNC_DTO_INCREMENT0 0x1F -#define TM6000_HSYNC_RISING_EDGE_TIME 0x20 -#define TM6000_HSYNC_PHASE_OFFSET 0x21 -#define TM6000_HSYNC_PLL_START_TIME 0x22 -#define TM6000_HSYNC_PLL_END_TIME 0x23 -#define TM6000_HSYNC_TIP_START_TIME 0x24 -#define TM6000_HSYNC_TIP_END_TIME 0x25 -#define TM6000_HSYNC_RISING_EDGE_START 0x26 -#define TM6000_HSYNC_RISING_EDGE_END 0x27 -#define TM6000_BACKPORCH_START 0x28 -#define TM6000_BACKPORCH_END 0x29 -#define TM6000_HSYNC_FILTER_START 0x2A -#define TM6000_HSYNC_FILTER_END 0x2B -#define TM6000_CHROMA_BURST_START 0x2C -#define TM6000_CHROMA_BURST_END 0x2D -#define TM6000_ACTIVE_VIDEO_HSTART 0x2E -#define TM6000_ACTIVE_VIDEO_HWIDTH 0x2F -#define TM6000_ACTIVE_VIDEO_VSTART 0x30 -#define TM6000_ACTIVE_VIDEO_VHIGHT 0x31 -#define TM6000_VSYNC_HLOCK_MIN 0x32 -#define TM6000_VSYNC_HLOCK_MAX 0x33 -#define TM6000_VSYNC_AGC_MIN 0x34 -#define TM6000_VSYNC_AGC_MAX 0x35 -#define TM6000_VSYNC_VBI_MIN 0x36 -#define TM6000_VSYNC_VBI_MAX 0x37 -#define TM6000_VSYNC_THRESHOLD 0x38 -#define TM6000_VSYNC_TIME_CONSTANT 0x39 -#define TM6000_STATUS1 0x3A -#define TM6000_STATUS2 0x3B -#define TM6000_STATUS3 0x3C -#define TM6000_RESET 0x3F -#define TM6000_TELETEXT_VBI_CODE0 0x40 -#define TM6000_TELETEXT_VBI_CODE1 0x41 -#define TM6000_VBI_DATA_HIGH_LEVEL 0x42 -#define TM6000_VBI_DATA_TYPE_LINE7 0x43 -#define TM6000_VBI_DATA_TYPE_LINE8 0x44 -#define TM6000_VBI_DATA_TYPE_LINE9 0x45 -#define TM6000_VBI_DATA_TYPE_LINE10 0x46 -#define TM6000_VBI_DATA_TYPE_LINE11 0x47 -#define TM6000_VBI_DATA_TYPE_LINE12 0x48 -#define TM6000_VBI_DATA_TYPE_LINE13 0x49 -#define TM6000_VBI_DATA_TYPE_LINE14 0x4A -#define TM6000_VBI_DATA_TYPE_LINE15 0x4B -#define TM6000_VBI_DATA_TYPE_LINE16 0x4C -#define TM6000_VBI_DATA_TYPE_LINE17 0x4D -#define TM6000_VBI_DATA_TYPE_LINE18 0x4E -#define TM6000_VBI_DATA_TYPE_LINE19 0x4F -#define TM6000_VBI_DATA_TYPE_LINE20 0x50 -#define TM6000_VBI_DATA_TYPE_LINE21 0x51 -#define TM6000_VBI_DATA_TYPE_LINE22 0x52 -#define TM6000_VBI_DATA_TYPE_LINE23 0x53 -#define TM6000_VBI_DATA_TYPE_RLINES 0x54 -#define TM6000_VBI_LOOP_FILTER_GAIN 0x55 -#define TM6000_VBI_LOOP_FILTER_I_GAIN 0x56 -#define TM6000_VBI_LOOP_FILTER_P_GAIN 0x57 -#define TM6000_VBI_CAPTION_DTO1 0x58 -#define TM6000_VBI_CAPTION_DTO0 0x59 -#define TM6000_VBI_TELETEXT_DTO1 0x5A -#define TM6000_VBI_TELETEXT_DTO0 0x5B -#define TM6000_VBI_WSS625_DTO1 0x5C -#define TM6000_VBI_WSS625_DTO0 0x5D -#define TM6000_VBI_CAPTION_FRAME_START 0x5E -#define TM6000_VBI_WSS625_FRAME_START 0x5F -#define TM6000_TELETEXT_FRAME_START 0x60 -#define TM6000_VBI_CCDATA1 0x61 -#define TM6000_VBI_CCDATA2 0x62 -#define TM6000_VBI_WSS625_DATA1 0x63 -#define TM6000_VBI_WSS625_DATA2 0x64 -#define TM6000_VBI_DATA_STATUS 0x65 -#define TM6000_VBI_CAPTION_START 0x66 -#define TM6000_VBI_WSS625_START 0x67 -#define TM6000_VBI_TELETEXT_START 0x68 -#define TM6000_HSYNC_DTO_INC_STATUS3 0x70 -#define TM6000_HSYNC_DTO_INC_STATUS2 0x71 -#define TM6000_HSYNC_DTO_INC_STATUS1 0x72 -#define TM6000_HSYNC_DTO_INC_STATUS0 0x73 -#define TM6000_CHROMA_DTO_INC_STATUS3 0x74 -#define TM6000_CHROMA_DTO_INC_STATUS2 0x75 -#define TM6000_CHROMA_DTO_INC_STATUS1 0x76 -#define TM6000_CHROMA_DTO_INC_STATUS0 0x77 -#define TM6000_AGC_AGAIN_STATUS 0x78 -#define TM6000_AGC_DGAIN_STATUS 0x79 -#define TM6000_CHROMA_MAG_STATUS 0x7A -#define TM6000_CHROMA_GAIN_STATUS1 0x7B -#define TM6000_CHROMA_GAIN_STATUS0 0x7C -#define TM6000_CORDIC_FREQ_STATUS 0x7D -#define TM6000_STATUS_NOISE 0x7F -#define TM6000_COMB_FILTER_TRESHOLD 0x80 -#define TM6000_COMB_FILTER_CONFIG 0x82 -#define TM6000_CHROMA_LOCK_CONFIG 0x83 -#define TM6000_NOISE_NTSC_C 0x84 -#define TM6000_NOISE_PAL_C 0x85 -#define TM6000_NOISE_PHASE_C 0x86 -#define TM6000_NOISE_PHASE_Y 0x87 -#define TM6000_CHROMA_LOOPFILTER_STATE 0x8A -#define TM6000_CHROMA_HRESAMPLER 0x8B -#define TM6000_CPUMP_DELAY_ADJ 0x8D -#define TM6000_CPUMP_ADJ 0x8E -#define TM6000_CPUMP_DELAY 0x8F +#define TM6010_REQ07_R00_VIDEO_CONTROL0 0x00 +#define TM6010_REQ07_R01_VIDEO_CONTROL1 0x01 +#define TM6010_REQ07_R02_VIDEO_CONTROL2 0x02 +#define TM6010_REQ07_R03_YC_SEP_CONTROL 0x03 +#define TM6010_REQ07_R04_LUMA_HAGC_CONTROL 0x04 +#define TM6010_REQ07_R05_NOISE_THRESHOLD 0x05 +#define TM6010_REQ07_R06_AGC_GATE_THRESHOLD 0x06 +#define TM6010_REQ07_R07_OUTPUT_CONTROL 0x07 +#define TM6010_REQ07_R08_LUMA_CONTRAST_ADJ 0x08 +#define TM6010_REQ07_R09_LUMA_BRIGHTNESS_ADJ 0x09 +#define TM6010_REQ07_R0A_CHROMA_SATURATION_ADJ 0x0A +#define TM6010_REQ07_R0B_CHROMA_HUE_PHASE_ADJ 0x0B +#define TM6010_REQ07_R0C_CHROMA_AGC_CONTROL 0x0C +#define TM6010_REQ07_R0D_CHROMA_KILL_LEVEL 0x0D +#define TM6010_REQ07_R0F_CHROMA_AUTO_POSITION 0x0F +#define TM6010_REQ07_R10_AGC_PEAK_NOMINAL 0x10 +#define TM6010_REQ07_R11_AGC_PEAK_CONTROL 0x11 +#define TM6010_REQ07_R12_AGC_GATE_STARTH 0x12 +#define TM6010_REQ07_R13_AGC_GATE_STARTL 0x13 +#define TM6010_REQ07_R14_AGC_GATE_WIDTH 0x14 +#define TM6010_REQ07_R15_AGC_BP_DELAY 0x15 +#define TM6010_REQ07_R16_LOCK_COUNT 0x16 +#define TM6010_REQ07_R17_HLOOP_MAXSTATE 0x17 +#define TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3 0x18 +#define TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2 0x19 +#define TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1 0x1A +#define TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0 0x1B +#define TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3 0x1C +#define TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2 0x1D +#define TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1 0x1E +#define TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0 0x1F +#define TM6010_REQ07_R20_HSYNC_RISING_EDGE_TIME 0x20 +#define TM6010_REQ07_R21_HSYNC_PHASE_OFFSET 0x21 +#define TM6010_REQ07_R22_HSYNC_PLL_START_TIME 0x22 +#define TM6010_REQ07_R23_HSYNC_PLL_END_TIME 0x23 +#define TM6010_REQ07_R24_HSYNC_TIP_START_TIME 0x24 +#define TM6010_REQ07_R25_HSYNC_TIP_END_TIME 0x25 +#define TM6010_REQ07_R26_HSYNC_RISING_EDGE_START 0x26 +#define TM6010_REQ07_R27_HSYNC_RISING_EDGE_END 0x27 +#define TM6010_REQ07_R28_BACKPORCH_START 0x28 +#define TM6010_REQ07_R29_BACKPORCH_END 0x29 +#define TM6010_REQ07_R2A_HSYNC_FILTER_START 0x2A +#define TM6010_REQ07_R2B_HSYNC_FILTER_END 0x2B +#define TM6010_REQ07_R2C_CHROMA_BURST_START 0x2C +#define TM6010_REQ07_R2D_CHROMA_BURST_END 0x2D +#define TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART 0x2E +#define TM6010_REQ07_R2F_ACTIVE_VIDEO_HWIDTH 0x2F +#define TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART 0x30 +#define TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT 0x31 +#define TM6010_REQ07_R32_VSYNC_HLOCK_MIN 0x32 +#define TM6010_REQ07_R33_VSYNC_HLOCK_MAX 0x33 +#define TM6010_REQ07_R34_VSYNC_AGC_MIN 0x34 +#define TM6010_REQ07_R35_VSYNC_AGC_MAX 0x35 +#define TM6010_REQ07_R36_VSYNC_VBI_MIN 0x36 +#define TM6010_REQ07_R37_VSYNC_VBI_MAX 0x37 +#define TM6010_REQ07_R38_VSYNC_THRESHOLD 0x38 +#define TM6010_REQ07_R39_VSYNC_TIME_CONSTANT 0x39 +#define TM6010_REQ07_R3A_STATUS1 0x3A +#define TM6010_REQ07_R3B_STATUS2 0x3B +#define TM6010_REQ07_R3C_STATUS3 0x3C +#define TM6010_REQ07_R3F_RESET 0x3F +#define TM6010_REQ07_R40_TELETEXT_VBI_CODE0 0x40 +#define TM6010_REQ07_R41_TELETEXT_VBI_CODE1 0x41 +#define TM6010_REQ07_R42_VBI_DATA_HIGH_LEVEL 0x42 +#define TM6010_REQ07_R43_VBI_DATA_TYPE_LINE7 0x43 +#define TM6010_REQ07_R44_VBI_DATA_TYPE_LINE8 0x44 +#define TM6010_REQ07_R45_VBI_DATA_TYPE_LINE9 0x45 +#define TM6010_REQ07_R46_VBI_DATA_TYPE_LINE10 0x46 +#define TM6010_REQ07_R47_VBI_DATA_TYPE_LINE11 0x47 +#define TM6010_REQ07_R48_VBI_DATA_TYPE_LINE12 0x48 +#define TM6010_REQ07_R49_VBI_DATA_TYPE_LINE13 0x49 +#define TM6010_REQ07_R4A_VBI_DATA_TYPE_LINE14 0x4A +#define TM6010_REQ07_R4B_VBI_DATA_TYPE_LINE15 0x4B +#define TM6010_REQ07_R4C_VBI_DATA_TYPE_LINE16 0x4C +#define TM6010_REQ07_R4D_VBI_DATA_TYPE_LINE17 0x4D +#define TM6010_REQ07_R4E_VBI_DATA_TYPE_LINE18 0x4E +#define TM6010_REQ07_R4F_VBI_DATA_TYPE_LINE19 0x4F +#define TM6010_REQ07_R50_VBI_DATA_TYPE_LINE20 0x50 +#define TM6010_REQ07_R51_VBI_DATA_TYPE_LINE21 0x51 +#define TM6010_REQ07_R52_VBI_DATA_TYPE_LINE22 0x52 +#define TM6010_REQ07_R53_VBI_DATA_TYPE_LINE23 0x53 +#define TM6010_REQ07_R54_VBI_DATA_TYPE_RLINES 0x54 +#define TM6010_REQ07_R55_VBI_LOOP_FILTER_GAIN 0x55 +#define TM6010_REQ07_R56_VBI_LOOP_FILTER_I_GAIN 0x56 +#define TM6010_REQ07_R57_VBI_LOOP_FILTER_P_GAIN 0x57 +#define TM6010_REQ07_R58_VBI_CAPTION_DTO1 0x58 +#define TM6010_REQ07_R59_VBI_CAPTION_DTO0 0x59 +#define TM6010_REQ07_R5A_VBI_TELETEXT_DTO1 0x5A +#define TM6010_REQ07_R5B_VBI_TELETEXT_DTO0 0x5B +#define TM6010_REQ07_R5C_VBI_WSS625_DTO1 0x5C +#define TM6010_REQ07_R5D_VBI_WSS625_DTO0 0x5D +#define TM6010_REQ07_R5E_VBI_CAPTION_FRAME_START 0x5E +#define TM6010_REQ07_R5F_VBI_WSS625_FRAME_START 0x5F +#define TM6010_REQ07_R60_TELETEXT_FRAME_START 0x60 +#define TM6010_REQ07_R61_VBI_CCDATA1 0x61 +#define TM6010_REQ07_R62_VBI_CCDATA2 0x62 +#define TM6010_REQ07_R63_VBI_WSS625_DATA1 0x63 +#define TM6010_REQ07_R64_VBI_WSS625_DATA2 0x64 +#define TM6010_REQ07_R65_VBI_DATA_STATUS 0x65 +#define TM6010_REQ07_R66_VBI_CAPTION_START 0x66 +#define TM6010_REQ07_R67_VBI_WSS625_START 0x67 +#define TM6010_REQ07_R68_VBI_TELETEXT_START 0x68 +#define TM6010_REQ07_R70_HSYNC_DTO_INC_STATUS3 0x70 +#define TM6010_REQ07_R71_HSYNC_DTO_INC_STATUS2 0x71 +#define TM6010_REQ07_R72_HSYNC_DTO_INC_STATUS1 0x72 +#define TM6010_REQ07_R73_HSYNC_DTO_INC_STATUS0 0x73 +#define TM6010_REQ07_R74_CHROMA_DTO_INC_STATUS3 0x74 +#define TM6010_REQ07_R75_CHROMA_DTO_INC_STATUS2 0x75 +#define TM6010_REQ07_R76_CHROMA_DTO_INC_STATUS1 0x76 +#define TM6010_REQ07_R77_CHROMA_DTO_INC_STATUS0 0x77 +#define TM6010_REQ07_R78_AGC_AGAIN_STATUS 0x78 +#define TM6010_REQ07_R79_AGC_DGAIN_STATUS 0x79 +#define TM6010_REQ07_R7A_CHROMA_MAG_STATUS 0x7A +#define TM6010_REQ07_R7B_CHROMA_GAIN_STATUS1 0x7B +#define TM6010_REQ07_R7C_CHROMA_GAIN_STATUS0 0x7C +#define TM6010_REQ07_R7D_CORDIC_FREQ_STATUS 0x7D +#define TM6010_REQ07_R7F_STATUS_NOISE 0x7F +#define TM6010_REQ07_R80_COMB_FILTER_TRESHOLD 0x80 +#define TM6010_REQ07_R82_COMB_FILTER_CONFIG 0x82 +#define TM6010_REQ07_R83_CHROMA_LOCK_CONFIG 0x83 +#define TM6010_REQ07_R84_NOISE_NTSC_C 0x84 +#define TM6010_REQ07_R85_NOISE_PAL_C 0x85 +#define TM6010_REQ07_R86_NOISE_PHASE_C 0x86 +#define TM6010_REQ07_R87_NOISE_PHASE_Y 0x87 +#define TM6010_REQ07_R8A_CHROMA_LOOPFILTER_STATE 0x8A +#define TM6010_REQ07_R8B_CHROMA_HRESAMPLER 0x8B +#define TM6010_REQ07_R8D_CPUMP_DELAY_ADJ 0x8D +#define TM6010_REQ07_R8E_CPUMP_ADJ 0x8E +#define TM6010_REQ07_R8F_CPUMP_DELAY 0x8F /* Define TM6000/TM6010 Miscellaneous registers */ -#define TM6000_ACTIVE_VIDEO_SOURCE 0xC0 -#define TM6000_TRESHOLD 0xC1 -#define TM6000_HSYNC_WIDTH 0xC2 -#define TM6000_HSTART1 0xC3 -#define TM6000_HSTART0 0xC4 -#define TM6000_HEND1 0xC5 -#define TM6000_HEND0 0xC6 -#define TM6000_VSTART1 0xC7 -#define TM6000_VSTART0 0xC8 -#define TM6000_VEND1 0xC9 -#define TM6000_VEND0 0xCA -#define TM6000_DELAY 0xCB -#define TM6000_ACTIVE_VIDEO_IF 0xCC -#define TM6000_USB_PERIPHERY_CONTROL 0xD0 -#define TM6000_ADDR_FOR_REQ1 0xD1 -#define TM6000_ADDR_FOR_REQ2 0xD2 -#define TM6000_ADDR_FOR_REQ3 0xD3 -#define TM6000_ADDR_FOR_REQ4 0xD4 -#define TM6000_POWERSAVE 0xD5 -#define TM6000_ENDP_REQ1_REQ2 0xD6 -#define TM6000_ENDP_REQ3_REQ4 0xD7 -#define TM6000_IR 0xD8 -#define TM6000_IR_BSIZE 0xD9 -#define TM6000_IR_WAKEUP_SEL 0xDA -#define TM6000_IR_WAKEUP_ADD 0xDB -#define TM6000_IR_LEADER1 0xDC -#define TM6000_IR_LEADER0 0xDD -#define TM6000_IR_PULSE_CNT1 0xDE -#define TM6000_IR_PULSE_CNT0 0xDF -#define TM6000_DVIDEO_SOURCE 0xE0 -#define TM6000_DVIDEO_SOURCE_IF 0xE1 -#define TM6000_OUT_SEL2 0xE2 -#define TM6000_OUT_SEL1 0xE3 -#define TM6000_OUT_SEL0 0xE4 -#define TM6000_REMOTE_WAKEUP 0xE5 -#define TM6000_PUB_GPIO 0xE7 -#define TM6000_TYPESEL_MOS_I2S 0xE8 -#define TM6000_TYPESEL_MOS_TS 0xE9 -#define TM6000_TYPESEL_MOS_CCIR 0xEA -#define TM6000_BIST_CRC_RESULT0 0xF0 -#define TM6000_BIST_CRC_RESULT1 0xF1 -#define TM6000_BIST_CRC_RESULT2 0xF2 -#define TM6000_BIST_CRC_RESULT3 0xF3 -#define TM6000_BIST_ERR_VST2 0xF4 -#define TM6000_BIST_ERR_VST1 0xF5 -#define TM6000_BIST_ERR_VST0 0xF6 -#define TM6000_BIST 0xF7 -#define TM6000_POWER_DOWN 0xFE -#define TM6000_SOFT_RESET 0xFF +#define TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE 0xC0 +#define TM6010_REQ07_RC1_TRESHOLD 0xC1 +#define TM6010_REQ07_RC2_HSYNC_WIDTH 0xC2 +#define TM6010_REQ07_RC3_HSTART1 0xC3 +#define TM6010_REQ07_RC4_HSTART0 0xC4 +#define TM6010_REQ07_RC5_HEND1 0xC5 +#define TM6010_REQ07_RC6_HEND0 0xC6 +#define TM6010_REQ07_RC7_VSTART1 0xC7 +#define TM6010_REQ07_RC8_VSTART0 0xC8 +#define TM6010_REQ07_RC9_VEND1 0xC9 +#define TM6010_REQ07_RCA_VEND0 0xCA +#define TM6010_REQ07_RCB_DELAY 0xCB +#define TM6010_REQ07_RCC_ACTIVE_VIDEO_IF 0xCC +#define TM6010_REQ07_RD0_USB_PERIPHERY_CONTROL 0xD0 +#define TM6010_REQ07_RD1_ADDR_FOR_REQ1 0xD1 +#define TM6010_REQ07_RD2_ADDR_FOR_REQ2 0xD2 +#define TM6010_REQ07_RD3_ADDR_FOR_REQ3 0xD3 +#define TM6010_REQ07_RD4_ADDR_FOR_REQ4 0xD4 +#define TM6010_REQ07_RD5_POWERSAVE 0xD5 +#define TM6010_REQ07_RD6_ENDP_REQ1_REQ2 0xD6 +#define TM6010_REQ07_RD7_ENDP_REQ3_REQ4 0xD7 +#define TM6010_REQ07_RD8_IR 0xD8 +#define TM6010_REQ07_RD8_IR_BSIZE 0xD9 +#define TM6010_REQ07_RD8_IR_WAKEUP_SEL 0xDA +#define TM6010_REQ07_RD8_IR_WAKEUP_ADD 0xDB +#define TM6010_REQ07_RD8_IR_LEADER1 0xDC +#define TM6010_REQ07_RD8_IR_LEADER0 0xDD +#define TM6010_REQ07_RD8_IR_PULSE_CNT1 0xDE +#define TM6010_REQ07_RD8_IR_PULSE_CNT0 0xDF +#define TM6010_REQ07_RE0_DVIDEO_SOURCE 0xE0 +#define TM6010_REQ07_RE0_DVIDEO_SOURCE_IF 0xE1 +#define TM6010_REQ07_RE2_OUT_SEL2 0xE2 +#define TM6010_REQ07_RE3_OUT_SEL1 0xE3 +#define TM6010_REQ07_RE4_OUT_SEL0 0xE4 +#define TM6010_REQ07_RE5_REMOTE_WAKEUP 0xE5 +#define TM6010_REQ07_RE7_PUB_GPIO 0xE7 +#define TM6010_REQ07_RE8_TYPESEL_MOS_I2S 0xE8 +#define TM6010_REQ07_RE9_TYPESEL_MOS_TS 0xE9 +#define TM6010_REQ07_REA_TYPESEL_MOS_CCIR 0xEA +#define TM6010_REQ07_RF0_BIST_CRC_RESULT0 0xF0 +#define TM6010_REQ07_RF1_BIST_CRC_RESULT1 0xF1 +#define TM6010_REQ07_RF2_BIST_CRC_RESULT2 0xF2 +#define TM6010_REQ07_RF3_BIST_CRC_RESULT3 0xF3 +#define TM6010_REQ07_RF4_BIST_ERR_VST2 0xF4 +#define TM6010_REQ07_RF5_BIST_ERR_VST1 0xF5 +#define TM6010_REQ07_RF6_BIST_ERR_VST0 0xF6 +#define TM6010_REQ07_RF7_BIST 0xF7 +#define TM6010_REQ07_RFE_POWER_DOWN 0xFE +#define TM6010_REQ07_RFF_SOFT_RESET 0xFF /* Define TM6000/TM6010 USB registers */ #define TM6000_U_MAIN_CTRL 0x00 -- GitLab From c4bccf5e780a1e32807530d6b4b0624f14346cff Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 10:26:46 -0300 Subject: [PATCH 174/534] V4L/DVB: tm6000: Replace all Req 8 group of regs with another naming convention According with the original patch that added the register names, those are related to tm6010, so name it properly as such. Also, clearly indicates when a register belongs to Request 0x08 and add its register value at the name. This makes easier to double check if the proper register is used along the driver. This patch were made with the help of this simple perl script, applied over the definitions of the last register groups: if (m/define (TM6000_)([^\s]+)\s+0x([A-F0-9].)/) { $name=$2; $val=$3; printf "s,$1$2,TM6010_REQ08_R%s_%s,g\n", $val, $name; } And were manually adjusted to fix a few minor issues. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-regs.h | 114 +++++++++++++-------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 321eb3fc859f..00f7e04c3295 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -478,64 +478,64 @@ enum { #define TM6000_U_DATA_FIFO15 0xFC /* Define TM6000/TM6010 Audio decoder registers */ -#define TM6000_A_VERSION 0x00 -#define TM6000_A_INIT 0x01 -#define TM6000_A_FIX_GAIN_CTRL 0x02 -#define TM6000_A_AUTO_GAIN_CTRL 0x03 -#define TM6000_A_SIF_AMP_CTRL 0x04 -#define TM6000_A_STANDARD_MOD 0x05 -#define TM6000_A_SOUND_MOD 0x06 -#define TM6000_A_LEFT_VOL 0x07 -#define TM6000_A_RIGHT_VOL 0x08 -#define TM6000_A_MAIN_VOL 0x09 -#define TM6000_A_I2S_MOD 0x0A -#define TM6000_A_ASD_THRES1 0x0B -#define TM6000_A_ASD_THRES2 0x0C -#define TM6000_A_AMD_THRES 0x0D -#define TM6000_A_MONO_THRES1 0x0E -#define TM6000_A_MONO_THRES2 0x0F -#define TM6000_A_MUTE_THRES1 0x10 -#define TM6000_A_MUTE_THRES2 0x11 -#define TM6000_A_AGC_U 0x12 -#define TM6000_A_AGC_ERR_T 0x13 -#define TM6000_A_AGC_GAIN_INIT 0x14 -#define TM6000_A_AGC_STEP_THR 0x15 -#define TM6000_A_AGC_GAIN_MAX 0x16 -#define TM6000_A_AGC_GAIN_MIN 0x17 -#define TM6000_A_TR_CTRL 0x18 -#define TM6000_A_FH_2FH_GAIN 0x19 -#define TM6000_A_NICAM_SER_MAX 0x1A -#define TM6000_A_NICAM_SER_MIN 0x1B -#define TM6000_A_GAIN_DEEMPH_OUT 0x1E -#define TM6000_A_TEST_INTF_SEL 0x1F -#define TM6000_A_TEST_PIN_SEL 0x20 -#define TM6000_A_AGC_ERR 0x21 -#define TM6000_A_AGC_GAIN 0x22 -#define TM6000_A_NICAM_INFO 0x23 -#define TM6000_A_SER 0x24 -#define TM6000_A_C1_AMP 0x25 -#define TM6000_A_C2_AMP 0x26 -#define TM6000_A_NOISE_AMP 0x27 -#define TM6000_A_AUDIO_MODE_RES 0x28 +#define TM6010_REQ08_R00_A_VERSION 0x00 +#define TM6010_REQ08_R01_A_INIT 0x01 +#define TM6010_REQ08_R02_A_FIX_GAIN_CTRL 0x02 +#define TM6010_REQ08_R03_A_AUTO_GAIN_CTRL 0x03 +#define TM6010_REQ08_R04_A_SIF_AMP_CTRL 0x04 +#define TM6010_REQ08_R05_A_STANDARD_MOD 0x05 +#define TM6010_REQ08_R06_A_SOUND_MOD 0x06 +#define TM6010_REQ08_R07_A_LEFT_VOL 0x07 +#define TM6010_REQ08_R08_A_RIGHT_VOL 0x08 +#define TM6010_REQ08_R09_A_MAIN_VOL 0x09 +#define TM6010_REQ08_R0A_A_I2S_MOD 0x0A +#define TM6010_REQ08_R0B_A_ASD_THRES1 0x0B +#define TM6010_REQ08_R0C_A_ASD_THRES2 0x0C +#define TM6010_REQ08_R0D_A_AMD_THRES 0x0D +#define TM6010_REQ08_R0E_A_MONO_THRES1 0x0E +#define TM6010_REQ08_R0F_A_MONO_THRES2 0x0F +#define TM6010_REQ08_R10_A_MUTE_THRES1 0x10 +#define TM6010_REQ08_R11_A_MUTE_THRES2 0x11 +#define TM6010_REQ08_R12_A_AGC_U 0x12 +#define TM6010_REQ08_R13_A_AGC_ERR_T 0x13 +#define TM6010_REQ08_R14_A_AGC_GAIN_INIT 0x14 +#define TM6010_REQ08_R15_A_AGC_STEP_THR 0x15 +#define TM6010_REQ08_R16_A_AGC_GAIN_MAX 0x16 +#define TM6010_REQ08_R17_A_AGC_GAIN_MIN 0x17 +#define TM6010_REQ08_R18_A_TR_CTRL 0x18 +#define TM6010_REQ08_R19_A_FH_2FH_GAIN 0x19 +#define TM6010_REQ08_R1A_A_NICAM_SER_MAX 0x1A +#define TM6010_REQ08_R1B_A_NICAM_SER_MIN 0x1B +#define TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT 0x1E +#define TM6010_REQ08_R1F_A_TEST_INTF_SEL 0x1F +#define TM6010_REQ08_R20_A_TEST_PIN_SEL 0x20 +#define TM6010_REQ08_R21_A_AGC_ERR 0x21 +#define TM6010_REQ08_R22_A_AGC_GAIN 0x22 +#define TM6010_REQ08_R23_A_NICAM_INFO 0x23 +#define TM6010_REQ08_R24_A_SER 0x24 +#define TM6010_REQ08_R25_A_C1_AMP 0x25 +#define TM6010_REQ08_R26_A_C2_AMP 0x26 +#define TM6010_REQ08_R27_A_NOISE_AMP 0x27 +#define TM6010_REQ08_R28_A_AUDIO_MODE_RES 0x28 /* Define TM6000/TM6010 Video ADC registers */ -#define TM6000_ADC_REF 0xE0 -#define TM6000_DAC_CLMP 0xE1 -#define TM6000_POWER_DOWN_CTRL1 0xE2 -#define TM6000_ADC_IN1_SEL 0xE3 -#define TM6000_ADC_IN2_SEL 0xE4 -#define TM6000_GAIN_PARAM 0xE5 -#define TM6000_POWER_DOWN_CTRL2 0xE6 -#define TM6000_REG_GAIN_Y 0xE7 -#define TM6000_REG_GAIN_C 0xE8 -#define TM6000_BIAS_CTRL 0xE9 -#define TM6000_BUFF_DRV_CTRL 0xEA -#define TM6000_SIF_GAIN_CTRL 0xEB -#define TM6000_REVERSE_YC_CTRL 0xEC -#define TM6000_GAIN_SEL 0xED +#define TM6010_REQ08_RE0_ADC_REF 0xE0 +#define TM6010_REQ08_RE1_DAC_CLMP 0xE1 +#define TM6010_REQ08_RE2_POWER_DOWN_CTRL1 0xE2 +#define TM6010_REQ08_RE3_ADC_IN1_SEL 0xE3 +#define TM6010_REQ08_RE4_ADC_IN2_SEL 0xE4 +#define TM6010_REQ08_RE5_GAIN_PARAM 0xE5 +#define TM6010_REQ08_RE6_POWER_DOWN_CTRL2 0xE6 +#define TM6010_REQ08_RE7_REG_GAIN_Y 0xE7 +#define TM6010_REQ08_RE8_REG_GAIN_C 0xE8 +#define TM6010_REQ08_RE9_BIAS_CTRL 0xE9 +#define TM6010_REQ08_REA_BUFF_DRV_CTRL 0xEA +#define TM6010_REQ08_REB_SIF_GAIN_CTRL 0xEB +#define TM6010_REQ08_REC_REVERSE_YC_CTRL 0xEC +#define TM6010_REQ08_RED_GAIN_SEL 0xED /* Define TM6000/TM6010 Audio ADC registers */ -#define TM6000_DAUDIO_INPUT_CONFIG 0xF0 -#define TM6000_AADC_POWER_DOWN 0xF1 -#define TM6000_LEFT_CHANNEL_VOL 0xF2 -#define TM6000_RIGHT_CHANNEL_VOL 0xF3 +#define TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG 0xF0 +#define TM6010_REQ08_RF1_AADC_POWER_DOWN 0xF1 +#define TM6010_REQ08_RF2_LEFT_CHANNEL_VOL 0xF2 +#define TM6010_REQ08_RF3_RIGHT_CHANNEL_VOL 0xF3 -- GitLab From 77012fb9954ebe355ce4ecfdaf9a0d5b88cb665b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 10:26:46 -0300 Subject: [PATCH 175/534] V4L/DVB: tm6000: Add request at Req07/Req08 register definitions Use a pair Req/Reg for all registers at req07 and req08 groups. This makes easier to replace them at the code with a script and helps to avoid using the wrong req with some register. This change were generated by this script: if (m/^(\#define TM6010_REQ)([0-9].)([^\s]+)(\s+)0x([A-F0-9].)/) { $name="$1$2$3"; $sp=$4; $req=$2; $val=$5; $val=~tr/A-F/a-f/; printf "$name%s0x%s, 0x%s\n", $sp, $req, $val; } else { print $_ } Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-regs.h | 470 +++++++++++++-------------- 1 file changed, 235 insertions(+), 235 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 00f7e04c3295..631984ae934d 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -98,186 +98,186 @@ enum { }; /* Define TM6000/TM6010 Video decoder registers */ -#define TM6010_REQ07_R00_VIDEO_CONTROL0 0x00 -#define TM6010_REQ07_R01_VIDEO_CONTROL1 0x01 -#define TM6010_REQ07_R02_VIDEO_CONTROL2 0x02 -#define TM6010_REQ07_R03_YC_SEP_CONTROL 0x03 -#define TM6010_REQ07_R04_LUMA_HAGC_CONTROL 0x04 -#define TM6010_REQ07_R05_NOISE_THRESHOLD 0x05 -#define TM6010_REQ07_R06_AGC_GATE_THRESHOLD 0x06 -#define TM6010_REQ07_R07_OUTPUT_CONTROL 0x07 -#define TM6010_REQ07_R08_LUMA_CONTRAST_ADJ 0x08 -#define TM6010_REQ07_R09_LUMA_BRIGHTNESS_ADJ 0x09 -#define TM6010_REQ07_R0A_CHROMA_SATURATION_ADJ 0x0A -#define TM6010_REQ07_R0B_CHROMA_HUE_PHASE_ADJ 0x0B -#define TM6010_REQ07_R0C_CHROMA_AGC_CONTROL 0x0C -#define TM6010_REQ07_R0D_CHROMA_KILL_LEVEL 0x0D -#define TM6010_REQ07_R0F_CHROMA_AUTO_POSITION 0x0F -#define TM6010_REQ07_R10_AGC_PEAK_NOMINAL 0x10 -#define TM6010_REQ07_R11_AGC_PEAK_CONTROL 0x11 -#define TM6010_REQ07_R12_AGC_GATE_STARTH 0x12 -#define TM6010_REQ07_R13_AGC_GATE_STARTL 0x13 -#define TM6010_REQ07_R14_AGC_GATE_WIDTH 0x14 -#define TM6010_REQ07_R15_AGC_BP_DELAY 0x15 -#define TM6010_REQ07_R16_LOCK_COUNT 0x16 -#define TM6010_REQ07_R17_HLOOP_MAXSTATE 0x17 -#define TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3 0x18 -#define TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2 0x19 -#define TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1 0x1A -#define TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0 0x1B -#define TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3 0x1C -#define TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2 0x1D -#define TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1 0x1E -#define TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0 0x1F -#define TM6010_REQ07_R20_HSYNC_RISING_EDGE_TIME 0x20 -#define TM6010_REQ07_R21_HSYNC_PHASE_OFFSET 0x21 -#define TM6010_REQ07_R22_HSYNC_PLL_START_TIME 0x22 -#define TM6010_REQ07_R23_HSYNC_PLL_END_TIME 0x23 -#define TM6010_REQ07_R24_HSYNC_TIP_START_TIME 0x24 -#define TM6010_REQ07_R25_HSYNC_TIP_END_TIME 0x25 -#define TM6010_REQ07_R26_HSYNC_RISING_EDGE_START 0x26 -#define TM6010_REQ07_R27_HSYNC_RISING_EDGE_END 0x27 -#define TM6010_REQ07_R28_BACKPORCH_START 0x28 -#define TM6010_REQ07_R29_BACKPORCH_END 0x29 -#define TM6010_REQ07_R2A_HSYNC_FILTER_START 0x2A -#define TM6010_REQ07_R2B_HSYNC_FILTER_END 0x2B -#define TM6010_REQ07_R2C_CHROMA_BURST_START 0x2C -#define TM6010_REQ07_R2D_CHROMA_BURST_END 0x2D -#define TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART 0x2E -#define TM6010_REQ07_R2F_ACTIVE_VIDEO_HWIDTH 0x2F -#define TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART 0x30 -#define TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT 0x31 -#define TM6010_REQ07_R32_VSYNC_HLOCK_MIN 0x32 -#define TM6010_REQ07_R33_VSYNC_HLOCK_MAX 0x33 -#define TM6010_REQ07_R34_VSYNC_AGC_MIN 0x34 -#define TM6010_REQ07_R35_VSYNC_AGC_MAX 0x35 -#define TM6010_REQ07_R36_VSYNC_VBI_MIN 0x36 -#define TM6010_REQ07_R37_VSYNC_VBI_MAX 0x37 -#define TM6010_REQ07_R38_VSYNC_THRESHOLD 0x38 -#define TM6010_REQ07_R39_VSYNC_TIME_CONSTANT 0x39 -#define TM6010_REQ07_R3A_STATUS1 0x3A -#define TM6010_REQ07_R3B_STATUS2 0x3B -#define TM6010_REQ07_R3C_STATUS3 0x3C -#define TM6010_REQ07_R3F_RESET 0x3F -#define TM6010_REQ07_R40_TELETEXT_VBI_CODE0 0x40 -#define TM6010_REQ07_R41_TELETEXT_VBI_CODE1 0x41 -#define TM6010_REQ07_R42_VBI_DATA_HIGH_LEVEL 0x42 -#define TM6010_REQ07_R43_VBI_DATA_TYPE_LINE7 0x43 -#define TM6010_REQ07_R44_VBI_DATA_TYPE_LINE8 0x44 -#define TM6010_REQ07_R45_VBI_DATA_TYPE_LINE9 0x45 -#define TM6010_REQ07_R46_VBI_DATA_TYPE_LINE10 0x46 -#define TM6010_REQ07_R47_VBI_DATA_TYPE_LINE11 0x47 -#define TM6010_REQ07_R48_VBI_DATA_TYPE_LINE12 0x48 -#define TM6010_REQ07_R49_VBI_DATA_TYPE_LINE13 0x49 -#define TM6010_REQ07_R4A_VBI_DATA_TYPE_LINE14 0x4A -#define TM6010_REQ07_R4B_VBI_DATA_TYPE_LINE15 0x4B -#define TM6010_REQ07_R4C_VBI_DATA_TYPE_LINE16 0x4C -#define TM6010_REQ07_R4D_VBI_DATA_TYPE_LINE17 0x4D -#define TM6010_REQ07_R4E_VBI_DATA_TYPE_LINE18 0x4E -#define TM6010_REQ07_R4F_VBI_DATA_TYPE_LINE19 0x4F -#define TM6010_REQ07_R50_VBI_DATA_TYPE_LINE20 0x50 -#define TM6010_REQ07_R51_VBI_DATA_TYPE_LINE21 0x51 -#define TM6010_REQ07_R52_VBI_DATA_TYPE_LINE22 0x52 -#define TM6010_REQ07_R53_VBI_DATA_TYPE_LINE23 0x53 -#define TM6010_REQ07_R54_VBI_DATA_TYPE_RLINES 0x54 -#define TM6010_REQ07_R55_VBI_LOOP_FILTER_GAIN 0x55 -#define TM6010_REQ07_R56_VBI_LOOP_FILTER_I_GAIN 0x56 -#define TM6010_REQ07_R57_VBI_LOOP_FILTER_P_GAIN 0x57 -#define TM6010_REQ07_R58_VBI_CAPTION_DTO1 0x58 -#define TM6010_REQ07_R59_VBI_CAPTION_DTO0 0x59 -#define TM6010_REQ07_R5A_VBI_TELETEXT_DTO1 0x5A -#define TM6010_REQ07_R5B_VBI_TELETEXT_DTO0 0x5B -#define TM6010_REQ07_R5C_VBI_WSS625_DTO1 0x5C -#define TM6010_REQ07_R5D_VBI_WSS625_DTO0 0x5D -#define TM6010_REQ07_R5E_VBI_CAPTION_FRAME_START 0x5E -#define TM6010_REQ07_R5F_VBI_WSS625_FRAME_START 0x5F -#define TM6010_REQ07_R60_TELETEXT_FRAME_START 0x60 -#define TM6010_REQ07_R61_VBI_CCDATA1 0x61 -#define TM6010_REQ07_R62_VBI_CCDATA2 0x62 -#define TM6010_REQ07_R63_VBI_WSS625_DATA1 0x63 -#define TM6010_REQ07_R64_VBI_WSS625_DATA2 0x64 -#define TM6010_REQ07_R65_VBI_DATA_STATUS 0x65 -#define TM6010_REQ07_R66_VBI_CAPTION_START 0x66 -#define TM6010_REQ07_R67_VBI_WSS625_START 0x67 -#define TM6010_REQ07_R68_VBI_TELETEXT_START 0x68 -#define TM6010_REQ07_R70_HSYNC_DTO_INC_STATUS3 0x70 -#define TM6010_REQ07_R71_HSYNC_DTO_INC_STATUS2 0x71 -#define TM6010_REQ07_R72_HSYNC_DTO_INC_STATUS1 0x72 -#define TM6010_REQ07_R73_HSYNC_DTO_INC_STATUS0 0x73 -#define TM6010_REQ07_R74_CHROMA_DTO_INC_STATUS3 0x74 -#define TM6010_REQ07_R75_CHROMA_DTO_INC_STATUS2 0x75 -#define TM6010_REQ07_R76_CHROMA_DTO_INC_STATUS1 0x76 -#define TM6010_REQ07_R77_CHROMA_DTO_INC_STATUS0 0x77 -#define TM6010_REQ07_R78_AGC_AGAIN_STATUS 0x78 -#define TM6010_REQ07_R79_AGC_DGAIN_STATUS 0x79 -#define TM6010_REQ07_R7A_CHROMA_MAG_STATUS 0x7A -#define TM6010_REQ07_R7B_CHROMA_GAIN_STATUS1 0x7B -#define TM6010_REQ07_R7C_CHROMA_GAIN_STATUS0 0x7C -#define TM6010_REQ07_R7D_CORDIC_FREQ_STATUS 0x7D -#define TM6010_REQ07_R7F_STATUS_NOISE 0x7F -#define TM6010_REQ07_R80_COMB_FILTER_TRESHOLD 0x80 -#define TM6010_REQ07_R82_COMB_FILTER_CONFIG 0x82 -#define TM6010_REQ07_R83_CHROMA_LOCK_CONFIG 0x83 -#define TM6010_REQ07_R84_NOISE_NTSC_C 0x84 -#define TM6010_REQ07_R85_NOISE_PAL_C 0x85 -#define TM6010_REQ07_R86_NOISE_PHASE_C 0x86 -#define TM6010_REQ07_R87_NOISE_PHASE_Y 0x87 -#define TM6010_REQ07_R8A_CHROMA_LOOPFILTER_STATE 0x8A -#define TM6010_REQ07_R8B_CHROMA_HRESAMPLER 0x8B -#define TM6010_REQ07_R8D_CPUMP_DELAY_ADJ 0x8D -#define TM6010_REQ07_R8E_CPUMP_ADJ 0x8E -#define TM6010_REQ07_R8F_CPUMP_DELAY 0x8F +#define TM6010_REQ07_R00_VIDEO_CONTROL0 0x07, 0x00 +#define TM6010_REQ07_R01_VIDEO_CONTROL1 0x07, 0x01 +#define TM6010_REQ07_R02_VIDEO_CONTROL2 0x07, 0x02 +#define TM6010_REQ07_R03_YC_SEP_CONTROL 0x07, 0x03 +#define TM6010_REQ07_R04_LUMA_HAGC_CONTROL 0x07, 0x04 +#define TM6010_REQ07_R05_NOISE_THRESHOLD 0x07, 0x05 +#define TM6010_REQ07_R06_AGC_GATE_THRESHOLD 0x07, 0x06 +#define TM6010_REQ07_R07_OUTPUT_CONTROL 0x07, 0x07 +#define TM6010_REQ07_R08_LUMA_CONTRAST_ADJ 0x07, 0x08 +#define TM6010_REQ07_R09_LUMA_BRIGHTNESS_ADJ 0x07, 0x09 +#define TM6010_REQ07_R0A_CHROMA_SATURATION_ADJ 0x07, 0x0a +#define TM6010_REQ07_R0B_CHROMA_HUE_PHASE_ADJ 0x07, 0x0b +#define TM6010_REQ07_R0C_CHROMA_AGC_CONTROL 0x07, 0x0c +#define TM6010_REQ07_R0D_CHROMA_KILL_LEVEL 0x07, 0x0d +#define TM6010_REQ07_R0F_CHROMA_AUTO_POSITION 0x07, 0x0f +#define TM6010_REQ07_R10_AGC_PEAK_NOMINAL 0x07, 0x10 +#define TM6010_REQ07_R11_AGC_PEAK_CONTROL 0x07, 0x11 +#define TM6010_REQ07_R12_AGC_GATE_STARTH 0x07, 0x12 +#define TM6010_REQ07_R13_AGC_GATE_STARTL 0x07, 0x13 +#define TM6010_REQ07_R14_AGC_GATE_WIDTH 0x07, 0x14 +#define TM6010_REQ07_R15_AGC_BP_DELAY 0x07, 0x15 +#define TM6010_REQ07_R16_LOCK_COUNT 0x07, 0x16 +#define TM6010_REQ07_R17_HLOOP_MAXSTATE 0x07, 0x17 +#define TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3 0x07, 0x18 +#define TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2 0x07, 0x19 +#define TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1 0x07, 0x1a +#define TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0 0x07, 0x1b +#define TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3 0x07, 0x1c +#define TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2 0x07, 0x1d +#define TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1 0x07, 0x1e +#define TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0 0x07, 0x1f +#define TM6010_REQ07_R20_HSYNC_RISING_EDGE_TIME 0x07, 0x20 +#define TM6010_REQ07_R21_HSYNC_PHASE_OFFSET 0x07, 0x21 +#define TM6010_REQ07_R22_HSYNC_PLL_START_TIME 0x07, 0x22 +#define TM6010_REQ07_R23_HSYNC_PLL_END_TIME 0x07, 0x23 +#define TM6010_REQ07_R24_HSYNC_TIP_START_TIME 0x07, 0x24 +#define TM6010_REQ07_R25_HSYNC_TIP_END_TIME 0x07, 0x25 +#define TM6010_REQ07_R26_HSYNC_RISING_EDGE_START 0x07, 0x26 +#define TM6010_REQ07_R27_HSYNC_RISING_EDGE_END 0x07, 0x27 +#define TM6010_REQ07_R28_BACKPORCH_START 0x07, 0x28 +#define TM6010_REQ07_R29_BACKPORCH_END 0x07, 0x29 +#define TM6010_REQ07_R2A_HSYNC_FILTER_START 0x07, 0x2a +#define TM6010_REQ07_R2B_HSYNC_FILTER_END 0x07, 0x2b +#define TM6010_REQ07_R2C_CHROMA_BURST_START 0x07, 0x2c +#define TM6010_REQ07_R2D_CHROMA_BURST_END 0x07, 0x2d +#define TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART 0x07, 0x2e +#define TM6010_REQ07_R2F_ACTIVE_VIDEO_HWIDTH 0x07, 0x2f +#define TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART 0x07, 0x30 +#define TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT 0x07, 0x31 +#define TM6010_REQ07_R32_VSYNC_HLOCK_MIN 0x07, 0x32 +#define TM6010_REQ07_R33_VSYNC_HLOCK_MAX 0x07, 0x33 +#define TM6010_REQ07_R34_VSYNC_AGC_MIN 0x07, 0x34 +#define TM6010_REQ07_R35_VSYNC_AGC_MAX 0x07, 0x35 +#define TM6010_REQ07_R36_VSYNC_VBI_MIN 0x07, 0x36 +#define TM6010_REQ07_R37_VSYNC_VBI_MAX 0x07, 0x37 +#define TM6010_REQ07_R38_VSYNC_THRESHOLD 0x07, 0x38 +#define TM6010_REQ07_R39_VSYNC_TIME_CONSTANT 0x07, 0x39 +#define TM6010_REQ07_R3A_STATUS1 0x07, 0x3a +#define TM6010_REQ07_R3B_STATUS2 0x07, 0x3b +#define TM6010_REQ07_R3C_STATUS3 0x07, 0x3c +#define TM6010_REQ07_R3F_RESET 0x07, 0x3f +#define TM6010_REQ07_R40_TELETEXT_VBI_CODE0 0x07, 0x40 +#define TM6010_REQ07_R41_TELETEXT_VBI_CODE1 0x07, 0x41 +#define TM6010_REQ07_R42_VBI_DATA_HIGH_LEVEL 0x07, 0x42 +#define TM6010_REQ07_R43_VBI_DATA_TYPE_LINE7 0x07, 0x43 +#define TM6010_REQ07_R44_VBI_DATA_TYPE_LINE8 0x07, 0x44 +#define TM6010_REQ07_R45_VBI_DATA_TYPE_LINE9 0x07, 0x45 +#define TM6010_REQ07_R46_VBI_DATA_TYPE_LINE10 0x07, 0x46 +#define TM6010_REQ07_R47_VBI_DATA_TYPE_LINE11 0x07, 0x47 +#define TM6010_REQ07_R48_VBI_DATA_TYPE_LINE12 0x07, 0x48 +#define TM6010_REQ07_R49_VBI_DATA_TYPE_LINE13 0x07, 0x49 +#define TM6010_REQ07_R4A_VBI_DATA_TYPE_LINE14 0x07, 0x4a +#define TM6010_REQ07_R4B_VBI_DATA_TYPE_LINE15 0x07, 0x4b +#define TM6010_REQ07_R4C_VBI_DATA_TYPE_LINE16 0x07, 0x4c +#define TM6010_REQ07_R4D_VBI_DATA_TYPE_LINE17 0x07, 0x4d +#define TM6010_REQ07_R4E_VBI_DATA_TYPE_LINE18 0x07, 0x4e +#define TM6010_REQ07_R4F_VBI_DATA_TYPE_LINE19 0x07, 0x4f +#define TM6010_REQ07_R50_VBI_DATA_TYPE_LINE20 0x07, 0x50 +#define TM6010_REQ07_R51_VBI_DATA_TYPE_LINE21 0x07, 0x51 +#define TM6010_REQ07_R52_VBI_DATA_TYPE_LINE22 0x07, 0x52 +#define TM6010_REQ07_R53_VBI_DATA_TYPE_LINE23 0x07, 0x53 +#define TM6010_REQ07_R54_VBI_DATA_TYPE_RLINES 0x07, 0x54 +#define TM6010_REQ07_R55_VBI_LOOP_FILTER_GAIN 0x07, 0x55 +#define TM6010_REQ07_R56_VBI_LOOP_FILTER_I_GAIN 0x07, 0x56 +#define TM6010_REQ07_R57_VBI_LOOP_FILTER_P_GAIN 0x07, 0x57 +#define TM6010_REQ07_R58_VBI_CAPTION_DTO1 0x07, 0x58 +#define TM6010_REQ07_R59_VBI_CAPTION_DTO0 0x07, 0x59 +#define TM6010_REQ07_R5A_VBI_TELETEXT_DTO1 0x07, 0x5a +#define TM6010_REQ07_R5B_VBI_TELETEXT_DTO0 0x07, 0x5b +#define TM6010_REQ07_R5C_VBI_WSS625_DTO1 0x07, 0x5c +#define TM6010_REQ07_R5D_VBI_WSS625_DTO0 0x07, 0x5d +#define TM6010_REQ07_R5E_VBI_CAPTION_FRAME_START 0x07, 0x5e +#define TM6010_REQ07_R5F_VBI_WSS625_FRAME_START 0x07, 0x5f +#define TM6010_REQ07_R60_TELETEXT_FRAME_START 0x07, 0x60 +#define TM6010_REQ07_R61_VBI_CCDATA1 0x07, 0x61 +#define TM6010_REQ07_R62_VBI_CCDATA2 0x07, 0x62 +#define TM6010_REQ07_R63_VBI_WSS625_DATA1 0x07, 0x63 +#define TM6010_REQ07_R64_VBI_WSS625_DATA2 0x07, 0x64 +#define TM6010_REQ07_R65_VBI_DATA_STATUS 0x07, 0x65 +#define TM6010_REQ07_R66_VBI_CAPTION_START 0x07, 0x66 +#define TM6010_REQ07_R67_VBI_WSS625_START 0x07, 0x67 +#define TM6010_REQ07_R68_VBI_TELETEXT_START 0x07, 0x68 +#define TM6010_REQ07_R70_HSYNC_DTO_INC_STATUS3 0x07, 0x70 +#define TM6010_REQ07_R71_HSYNC_DTO_INC_STATUS2 0x07, 0x71 +#define TM6010_REQ07_R72_HSYNC_DTO_INC_STATUS1 0x07, 0x72 +#define TM6010_REQ07_R73_HSYNC_DTO_INC_STATUS0 0x07, 0x73 +#define TM6010_REQ07_R74_CHROMA_DTO_INC_STATUS3 0x07, 0x74 +#define TM6010_REQ07_R75_CHROMA_DTO_INC_STATUS2 0x07, 0x75 +#define TM6010_REQ07_R76_CHROMA_DTO_INC_STATUS1 0x07, 0x76 +#define TM6010_REQ07_R77_CHROMA_DTO_INC_STATUS0 0x07, 0x77 +#define TM6010_REQ07_R78_AGC_AGAIN_STATUS 0x07, 0x78 +#define TM6010_REQ07_R79_AGC_DGAIN_STATUS 0x07, 0x79 +#define TM6010_REQ07_R7A_CHROMA_MAG_STATUS 0x07, 0x7a +#define TM6010_REQ07_R7B_CHROMA_GAIN_STATUS1 0x07, 0x7b +#define TM6010_REQ07_R7C_CHROMA_GAIN_STATUS0 0x07, 0x7c +#define TM6010_REQ07_R7D_CORDIC_FREQ_STATUS 0x07, 0x7d +#define TM6010_REQ07_R7F_STATUS_NOISE 0x07, 0x7f +#define TM6010_REQ07_R80_COMB_FILTER_TRESHOLD 0x07, 0x80 +#define TM6010_REQ07_R82_COMB_FILTER_CONFIG 0x07, 0x82 +#define TM6010_REQ07_R83_CHROMA_LOCK_CONFIG 0x07, 0x83 +#define TM6010_REQ07_R84_NOISE_NTSC_C 0x07, 0x84 +#define TM6010_REQ07_R85_NOISE_PAL_C 0x07, 0x85 +#define TM6010_REQ07_R86_NOISE_PHASE_C 0x07, 0x86 +#define TM6010_REQ07_R87_NOISE_PHASE_Y 0x07, 0x87 +#define TM6010_REQ07_R8A_CHROMA_LOOPFILTER_STATE 0x07, 0x8a +#define TM6010_REQ07_R8B_CHROMA_HRESAMPLER 0x07, 0x8b +#define TM6010_REQ07_R8D_CPUMP_DELAY_ADJ 0x07, 0x8d +#define TM6010_REQ07_R8E_CPUMP_ADJ 0x07, 0x8e +#define TM6010_REQ07_R8F_CPUMP_DELAY 0x07, 0x8f /* Define TM6000/TM6010 Miscellaneous registers */ -#define TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE 0xC0 -#define TM6010_REQ07_RC1_TRESHOLD 0xC1 -#define TM6010_REQ07_RC2_HSYNC_WIDTH 0xC2 -#define TM6010_REQ07_RC3_HSTART1 0xC3 -#define TM6010_REQ07_RC4_HSTART0 0xC4 -#define TM6010_REQ07_RC5_HEND1 0xC5 -#define TM6010_REQ07_RC6_HEND0 0xC6 -#define TM6010_REQ07_RC7_VSTART1 0xC7 -#define TM6010_REQ07_RC8_VSTART0 0xC8 -#define TM6010_REQ07_RC9_VEND1 0xC9 -#define TM6010_REQ07_RCA_VEND0 0xCA -#define TM6010_REQ07_RCB_DELAY 0xCB -#define TM6010_REQ07_RCC_ACTIVE_VIDEO_IF 0xCC -#define TM6010_REQ07_RD0_USB_PERIPHERY_CONTROL 0xD0 -#define TM6010_REQ07_RD1_ADDR_FOR_REQ1 0xD1 -#define TM6010_REQ07_RD2_ADDR_FOR_REQ2 0xD2 -#define TM6010_REQ07_RD3_ADDR_FOR_REQ3 0xD3 -#define TM6010_REQ07_RD4_ADDR_FOR_REQ4 0xD4 -#define TM6010_REQ07_RD5_POWERSAVE 0xD5 -#define TM6010_REQ07_RD6_ENDP_REQ1_REQ2 0xD6 -#define TM6010_REQ07_RD7_ENDP_REQ3_REQ4 0xD7 -#define TM6010_REQ07_RD8_IR 0xD8 -#define TM6010_REQ07_RD8_IR_BSIZE 0xD9 -#define TM6010_REQ07_RD8_IR_WAKEUP_SEL 0xDA -#define TM6010_REQ07_RD8_IR_WAKEUP_ADD 0xDB -#define TM6010_REQ07_RD8_IR_LEADER1 0xDC -#define TM6010_REQ07_RD8_IR_LEADER0 0xDD -#define TM6010_REQ07_RD8_IR_PULSE_CNT1 0xDE -#define TM6010_REQ07_RD8_IR_PULSE_CNT0 0xDF -#define TM6010_REQ07_RE0_DVIDEO_SOURCE 0xE0 -#define TM6010_REQ07_RE0_DVIDEO_SOURCE_IF 0xE1 -#define TM6010_REQ07_RE2_OUT_SEL2 0xE2 -#define TM6010_REQ07_RE3_OUT_SEL1 0xE3 -#define TM6010_REQ07_RE4_OUT_SEL0 0xE4 -#define TM6010_REQ07_RE5_REMOTE_WAKEUP 0xE5 -#define TM6010_REQ07_RE7_PUB_GPIO 0xE7 -#define TM6010_REQ07_RE8_TYPESEL_MOS_I2S 0xE8 -#define TM6010_REQ07_RE9_TYPESEL_MOS_TS 0xE9 -#define TM6010_REQ07_REA_TYPESEL_MOS_CCIR 0xEA -#define TM6010_REQ07_RF0_BIST_CRC_RESULT0 0xF0 -#define TM6010_REQ07_RF1_BIST_CRC_RESULT1 0xF1 -#define TM6010_REQ07_RF2_BIST_CRC_RESULT2 0xF2 -#define TM6010_REQ07_RF3_BIST_CRC_RESULT3 0xF3 -#define TM6010_REQ07_RF4_BIST_ERR_VST2 0xF4 -#define TM6010_REQ07_RF5_BIST_ERR_VST1 0xF5 -#define TM6010_REQ07_RF6_BIST_ERR_VST0 0xF6 -#define TM6010_REQ07_RF7_BIST 0xF7 -#define TM6010_REQ07_RFE_POWER_DOWN 0xFE -#define TM6010_REQ07_RFF_SOFT_RESET 0xFF +#define TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE 0x07, 0xc0 +#define TM6010_REQ07_RC1_TRESHOLD 0x07, 0xc1 +#define TM6010_REQ07_RC2_HSYNC_WIDTH 0x07, 0xc2 +#define TM6010_REQ07_RC3_HSTART1 0x07, 0xc3 +#define TM6010_REQ07_RC4_HSTART0 0x07, 0xc4 +#define TM6010_REQ07_RC5_HEND1 0x07, 0xc5 +#define TM6010_REQ07_RC6_HEND0 0x07, 0xc6 +#define TM6010_REQ07_RC7_VSTART1 0x07, 0xc7 +#define TM6010_REQ07_RC8_VSTART0 0x07, 0xc8 +#define TM6010_REQ07_RC9_VEND1 0x07, 0xc9 +#define TM6010_REQ07_RCA_VEND0 0x07, 0xca +#define TM6010_REQ07_RCB_DELAY 0x07, 0xcb +#define TM6010_REQ07_RCC_ACTIVE_VIDEO_IF 0x07, 0xcc +#define TM6010_REQ07_RD0_USB_PERIPHERY_CONTROL 0x07, 0xd0 +#define TM6010_REQ07_RD1_ADDR_FOR_REQ1 0x07, 0xd1 +#define TM6010_REQ07_RD2_ADDR_FOR_REQ2 0x07, 0xd2 +#define TM6010_REQ07_RD3_ADDR_FOR_REQ3 0x07, 0xd3 +#define TM6010_REQ07_RD4_ADDR_FOR_REQ4 0x07, 0xd4 +#define TM6010_REQ07_RD5_POWERSAVE 0x07, 0xd5 +#define TM6010_REQ07_RD6_ENDP_REQ1_REQ2 0x07, 0xd6 +#define TM6010_REQ07_RD7_ENDP_REQ3_REQ4 0x07, 0xd7 +#define TM6010_REQ07_RD8_IR 0x07, 0xd8 +#define TM6010_REQ07_RD8_IR_BSIZE 0x07, 0xd9 +#define TM6010_REQ07_RD8_IR_WAKEUP_SEL 0x07, 0xda +#define TM6010_REQ07_RD8_IR_WAKEUP_ADD 0x07, 0xdb +#define TM6010_REQ07_RD8_IR_LEADER1 0x07, 0xdc +#define TM6010_REQ07_RD8_IR_LEADER0 0x07, 0xdd +#define TM6010_REQ07_RD8_IR_PULSE_CNT1 0x07, 0xde +#define TM6010_REQ07_RD8_IR_PULSE_CNT0 0x07, 0xdf +#define TM6010_REQ07_RE0_DVIDEO_SOURCE 0x07, 0xe0 +#define TM6010_REQ07_RE0_DVIDEO_SOURCE_IF 0x07, 0xe1 +#define TM6010_REQ07_RE2_OUT_SEL2 0x07, 0xe2 +#define TM6010_REQ07_RE3_OUT_SEL1 0x07, 0xe3 +#define TM6010_REQ07_RE4_OUT_SEL0 0x07, 0xe4 +#define TM6010_REQ07_RE5_REMOTE_WAKEUP 0x07, 0xe5 +#define TM6010_REQ07_RE7_PUB_GPIO 0x07, 0xe7 +#define TM6010_REQ07_RE8_TYPESEL_MOS_I2S 0x07, 0xe8 +#define TM6010_REQ07_RE9_TYPESEL_MOS_TS 0x07, 0xe9 +#define TM6010_REQ07_REA_TYPESEL_MOS_CCIR 0x07, 0xea +#define TM6010_REQ07_RF0_BIST_CRC_RESULT0 0x07, 0xf0 +#define TM6010_REQ07_RF1_BIST_CRC_RESULT1 0x07, 0xf1 +#define TM6010_REQ07_RF2_BIST_CRC_RESULT2 0x07, 0xf2 +#define TM6010_REQ07_RF3_BIST_CRC_RESULT3 0x07, 0xf3 +#define TM6010_REQ07_RF4_BIST_ERR_VST2 0x07, 0xf4 +#define TM6010_REQ07_RF5_BIST_ERR_VST1 0x07, 0xf5 +#define TM6010_REQ07_RF6_BIST_ERR_VST0 0x07, 0xf6 +#define TM6010_REQ07_RF7_BIST 0x07, 0xf7 +#define TM6010_REQ07_RFE_POWER_DOWN 0x07, 0xfe +#define TM6010_REQ07_RFF_SOFT_RESET 0x07, 0xff /* Define TM6000/TM6010 USB registers */ #define TM6000_U_MAIN_CTRL 0x00 @@ -478,64 +478,64 @@ enum { #define TM6000_U_DATA_FIFO15 0xFC /* Define TM6000/TM6010 Audio decoder registers */ -#define TM6010_REQ08_R00_A_VERSION 0x00 -#define TM6010_REQ08_R01_A_INIT 0x01 -#define TM6010_REQ08_R02_A_FIX_GAIN_CTRL 0x02 -#define TM6010_REQ08_R03_A_AUTO_GAIN_CTRL 0x03 -#define TM6010_REQ08_R04_A_SIF_AMP_CTRL 0x04 -#define TM6010_REQ08_R05_A_STANDARD_MOD 0x05 -#define TM6010_REQ08_R06_A_SOUND_MOD 0x06 -#define TM6010_REQ08_R07_A_LEFT_VOL 0x07 -#define TM6010_REQ08_R08_A_RIGHT_VOL 0x08 -#define TM6010_REQ08_R09_A_MAIN_VOL 0x09 -#define TM6010_REQ08_R0A_A_I2S_MOD 0x0A -#define TM6010_REQ08_R0B_A_ASD_THRES1 0x0B -#define TM6010_REQ08_R0C_A_ASD_THRES2 0x0C -#define TM6010_REQ08_R0D_A_AMD_THRES 0x0D -#define TM6010_REQ08_R0E_A_MONO_THRES1 0x0E -#define TM6010_REQ08_R0F_A_MONO_THRES2 0x0F -#define TM6010_REQ08_R10_A_MUTE_THRES1 0x10 -#define TM6010_REQ08_R11_A_MUTE_THRES2 0x11 -#define TM6010_REQ08_R12_A_AGC_U 0x12 -#define TM6010_REQ08_R13_A_AGC_ERR_T 0x13 -#define TM6010_REQ08_R14_A_AGC_GAIN_INIT 0x14 -#define TM6010_REQ08_R15_A_AGC_STEP_THR 0x15 -#define TM6010_REQ08_R16_A_AGC_GAIN_MAX 0x16 -#define TM6010_REQ08_R17_A_AGC_GAIN_MIN 0x17 -#define TM6010_REQ08_R18_A_TR_CTRL 0x18 -#define TM6010_REQ08_R19_A_FH_2FH_GAIN 0x19 -#define TM6010_REQ08_R1A_A_NICAM_SER_MAX 0x1A -#define TM6010_REQ08_R1B_A_NICAM_SER_MIN 0x1B -#define TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT 0x1E -#define TM6010_REQ08_R1F_A_TEST_INTF_SEL 0x1F -#define TM6010_REQ08_R20_A_TEST_PIN_SEL 0x20 -#define TM6010_REQ08_R21_A_AGC_ERR 0x21 -#define TM6010_REQ08_R22_A_AGC_GAIN 0x22 -#define TM6010_REQ08_R23_A_NICAM_INFO 0x23 -#define TM6010_REQ08_R24_A_SER 0x24 -#define TM6010_REQ08_R25_A_C1_AMP 0x25 -#define TM6010_REQ08_R26_A_C2_AMP 0x26 -#define TM6010_REQ08_R27_A_NOISE_AMP 0x27 -#define TM6010_REQ08_R28_A_AUDIO_MODE_RES 0x28 +#define TM6010_REQ08_R00_A_VERSION 0x08, 0x00 +#define TM6010_REQ08_R01_A_INIT 0x08, 0x01 +#define TM6010_REQ08_R02_A_FIX_GAIN_CTRL 0x08, 0x02 +#define TM6010_REQ08_R03_A_AUTO_GAIN_CTRL 0x08, 0x03 +#define TM6010_REQ08_R04_A_SIF_AMP_CTRL 0x08, 0x04 +#define TM6010_REQ08_R05_A_STANDARD_MOD 0x08, 0x05 +#define TM6010_REQ08_R06_A_SOUND_MOD 0x08, 0x06 +#define TM6010_REQ08_R07_A_LEFT_VOL 0x08, 0x07 +#define TM6010_REQ08_R08_A_RIGHT_VOL 0x08, 0x08 +#define TM6010_REQ08_R09_A_MAIN_VOL 0x08, 0x09 +#define TM6010_REQ08_R0A_A_I2S_MOD 0x08, 0x0a +#define TM6010_REQ08_R0B_A_ASD_THRES1 0x08, 0x0b +#define TM6010_REQ08_R0C_A_ASD_THRES2 0x08, 0x0c +#define TM6010_REQ08_R0D_A_AMD_THRES 0x08, 0x0d +#define TM6010_REQ08_R0E_A_MONO_THRES1 0x08, 0x0e +#define TM6010_REQ08_R0F_A_MONO_THRES2 0x08, 0x0f +#define TM6010_REQ08_R10_A_MUTE_THRES1 0x08, 0x10 +#define TM6010_REQ08_R11_A_MUTE_THRES2 0x08, 0x11 +#define TM6010_REQ08_R12_A_AGC_U 0x08, 0x12 +#define TM6010_REQ08_R13_A_AGC_ERR_T 0x08, 0x13 +#define TM6010_REQ08_R14_A_AGC_GAIN_INIT 0x08, 0x14 +#define TM6010_REQ08_R15_A_AGC_STEP_THR 0x08, 0x15 +#define TM6010_REQ08_R16_A_AGC_GAIN_MAX 0x08, 0x16 +#define TM6010_REQ08_R17_A_AGC_GAIN_MIN 0x08, 0x17 +#define TM6010_REQ08_R18_A_TR_CTRL 0x08, 0x18 +#define TM6010_REQ08_R19_A_FH_2FH_GAIN 0x08, 0x19 +#define TM6010_REQ08_R1A_A_NICAM_SER_MAX 0x08, 0x1a +#define TM6010_REQ08_R1B_A_NICAM_SER_MIN 0x08, 0x1b +#define TM6010_REQ08_R1E_A_GAIN_DEEMPH_OUT 0x08, 0x1e +#define TM6010_REQ08_R1F_A_TEST_INTF_SEL 0x08, 0x1f +#define TM6010_REQ08_R20_A_TEST_PIN_SEL 0x08, 0x20 +#define TM6010_REQ08_R21_A_AGC_ERR 0x08, 0x21 +#define TM6010_REQ08_R22_A_AGC_GAIN 0x08, 0x22 +#define TM6010_REQ08_R23_A_NICAM_INFO 0x08, 0x23 +#define TM6010_REQ08_R24_A_SER 0x08, 0x24 +#define TM6010_REQ08_R25_A_C1_AMP 0x08, 0x25 +#define TM6010_REQ08_R26_A_C2_AMP 0x08, 0x26 +#define TM6010_REQ08_R27_A_NOISE_AMP 0x08, 0x27 +#define TM6010_REQ08_R28_A_AUDIO_MODE_RES 0x08, 0x28 /* Define TM6000/TM6010 Video ADC registers */ -#define TM6010_REQ08_RE0_ADC_REF 0xE0 -#define TM6010_REQ08_RE1_DAC_CLMP 0xE1 -#define TM6010_REQ08_RE2_POWER_DOWN_CTRL1 0xE2 -#define TM6010_REQ08_RE3_ADC_IN1_SEL 0xE3 -#define TM6010_REQ08_RE4_ADC_IN2_SEL 0xE4 -#define TM6010_REQ08_RE5_GAIN_PARAM 0xE5 -#define TM6010_REQ08_RE6_POWER_DOWN_CTRL2 0xE6 -#define TM6010_REQ08_RE7_REG_GAIN_Y 0xE7 -#define TM6010_REQ08_RE8_REG_GAIN_C 0xE8 -#define TM6010_REQ08_RE9_BIAS_CTRL 0xE9 -#define TM6010_REQ08_REA_BUFF_DRV_CTRL 0xEA -#define TM6010_REQ08_REB_SIF_GAIN_CTRL 0xEB -#define TM6010_REQ08_REC_REVERSE_YC_CTRL 0xEC -#define TM6010_REQ08_RED_GAIN_SEL 0xED +#define TM6010_REQ08_RE0_ADC_REF 0x08, 0xe0 +#define TM6010_REQ08_RE1_DAC_CLMP 0x08, 0xe1 +#define TM6010_REQ08_RE2_POWER_DOWN_CTRL1 0x08, 0xe2 +#define TM6010_REQ08_RE3_ADC_IN1_SEL 0x08, 0xe3 +#define TM6010_REQ08_RE4_ADC_IN2_SEL 0x08, 0xe4 +#define TM6010_REQ08_RE5_GAIN_PARAM 0x08, 0xe5 +#define TM6010_REQ08_RE6_POWER_DOWN_CTRL2 0x08, 0xe6 +#define TM6010_REQ08_RE7_REG_GAIN_Y 0x08, 0xe7 +#define TM6010_REQ08_RE8_REG_GAIN_C 0x08, 0xe8 +#define TM6010_REQ08_RE9_BIAS_CTRL 0x08, 0xe9 +#define TM6010_REQ08_REA_BUFF_DRV_CTRL 0x08, 0xea +#define TM6010_REQ08_REB_SIF_GAIN_CTRL 0x08, 0xeb +#define TM6010_REQ08_REC_REVERSE_YC_CTRL 0x08, 0xec +#define TM6010_REQ08_RED_GAIN_SEL 0x08, 0xed /* Define TM6000/TM6010 Audio ADC registers */ -#define TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG 0xF0 -#define TM6010_REQ08_RF1_AADC_POWER_DOWN 0xF1 -#define TM6010_REQ08_RF2_LEFT_CHANNEL_VOL 0xF2 -#define TM6010_REQ08_RF3_RIGHT_CHANNEL_VOL 0xF3 +#define TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG 0x08, 0xf0 +#define TM6010_REQ08_RF1_AADC_POWER_DOWN 0x08, 0xf1 +#define TM6010_REQ08_RF2_LEFT_CHANNEL_VOL 0x08, 0xf2 +#define TM6010_REQ08_RF3_RIGHT_CHANNEL_VOL 0x08, 0xf3 -- GitLab From 9afec493e2fe1a477305a09f933267d805fe4c8c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 10:26:46 -0300 Subject: [PATCH 176/534] V4L/DVB: tm6000: Replace all magic values by a register alias Instead of using magic pairs of req/reg, replace them by the defined values. This patch were generated by the following script: cat tm6000-regs.h |perl -ne 'if (m/(TM6010_REQ[^\s]+)\s+0x([a-f0-9]+)\, 0x([a-f0-9]+)/) { $name="$1"; $req=$2; $val=$3; printf "s/REQ_${req}_SET_GET_AVREG[_BIT]*, 0x[0]*$3,/$1,/\n" }' >a; for i in tm*.c; do sed -f a $i >b && mv b $i; done Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-alsa.c | 12 +- drivers/staging/tm6000/tm6000-core.c | 358 ++++---- drivers/staging/tm6000/tm6000-stds.c | 1206 ++++++++++++------------- drivers/staging/tm6000/tm6000-video.c | 16 +- 4 files changed, 796 insertions(+), 796 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c index 7cc2ac740d8a..bc89f9d28002 100644 --- a/drivers/staging/tm6000/tm6000-alsa.c +++ b/drivers/staging/tm6000/tm6000-alsa.c @@ -100,11 +100,11 @@ static int _tm6000_start_audio_dma(struct snd_tm6000_card *chip) int val; /* Enables audio */ - val = tm6000_get_reg(core, REQ_07_SET_GET_AVREG, 0xcc, 0x0); + val = tm6000_get_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x0); val |= 0x20; - tm6000_set_reg(core, REQ_07_SET_GET_AVREG, 0xcc, val); + tm6000_set_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val); - tm6000_set_reg(core, REQ_08_SET_GET_AVREG_BIT, 0x01, 0x80); + tm6000_set_reg(core, TM6010_REQ08_R01_A_INIT, 0x80); return 0; } @@ -119,11 +119,11 @@ static int _tm6000_stop_audio_dma(struct snd_tm6000_card *chip) dprintk(1, "Stopping audio DMA\n"); /* Enables audio */ - val = tm6000_get_reg(core, REQ_07_SET_GET_AVREG, 0xcc, 0x0); + val = tm6000_get_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0x0); val &= ~0x20; - tm6000_set_reg(core, REQ_07_SET_GET_AVREG, 0xcc, val); + tm6000_set_reg(core, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val); - tm6000_set_reg(core, REQ_08_SET_GET_AVREG_BIT, 0x01, 0); + tm6000_set_reg(core, TM6010_REQ08_R01_A_INIT, 0); return 0; } diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index bf40aa833ed0..b9640d74b916 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -143,14 +143,14 @@ void tm6000_set_fourcc_format(struct tm6000_core *dev) { if (dev->dev_type == TM6010) { if (dev->fourcc == V4L2_PIX_FMT_UYVY) - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0xfc); + tm6000_set_reg(dev, TM6010_REQ07_RC1_TRESHOLD, 0xfc); else - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0xfd); + tm6000_set_reg(dev, TM6010_REQ07_RC1_TRESHOLD, 0xfd); } else { if (dev->fourcc == V4L2_PIX_FMT_UYVY) - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0xd0); + tm6000_set_reg(dev, TM6010_REQ07_RC1_TRESHOLD, 0xd0); else - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0xc1, 0x90); + tm6000_set_reg(dev, TM6010_REQ07_RC1_TRESHOLD, 0x90); } } @@ -160,40 +160,40 @@ int tm6000_init_analog_mode (struct tm6000_core *dev) int val; /* Enable video */ - val = tm6000_get_reg(dev, REQ_07_SET_GET_AVREG, 0xcc, 0); + val = tm6000_get_reg(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0); val |= 0x60; - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xcc, val); - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xfe, 0xcf); + tm6000_set_reg(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val); + tm6000_set_reg(dev, TM6010_REQ07_RFE_POWER_DOWN, 0xcf); } else { /* Enables soft reset */ - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0x3f, 0x01); + tm6000_set_reg(dev, TM6010_REQ07_R3F_RESET, 0x01); if (dev->scaler) { - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xc0, 0x20); + tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x20); } else { /* Enable Hfilter and disable TS Drop err */ - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xc0, 0x80); + tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x80); } - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xc3, 0x88); - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xda, 0x23); - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xd1, 0xc0); - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xd2, 0xd8); - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xd6, 0x06); - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xdf, 0x1f); + tm6000_set_reg(dev, TM6010_REQ07_RC3_HSTART1, 0x88); + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0x23); + tm6000_set_reg(dev, TM6010_REQ07_RD1_ADDR_FOR_REQ1, 0xc0); + tm6000_set_reg(dev, TM6010_REQ07_RD2_ADDR_FOR_REQ2, 0xd8); + tm6000_set_reg(dev, TM6010_REQ07_RD6_ENDP_REQ1_REQ2, 0x06); + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_PULSE_CNT0, 0x1f); /* AP Software reset */ - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xff, 0x08); - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xff, 0x00); + tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x08); + tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x00); tm6000_set_fourcc_format(dev); /* Disables soft reset */ - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0x3f, 0x00); + tm6000_set_reg(dev, TM6010_REQ07_R3F_RESET, 0x00); /* E3: Select input 0 - TV tuner */ - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xe3, 0x00); + tm6000_set_reg(dev, TM6010_REQ07_RE3_OUT_SEL1, 0x00); tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xeb, 0x60); /* This controls input */ @@ -225,38 +225,38 @@ int tm6000_init_digital_mode (struct tm6000_core *dev) u8 buf[2]; /* digital init */ - val = tm6000_get_reg(dev, REQ_07_SET_GET_AVREG, 0xcc, 0); + val = tm6000_get_reg(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0); val &= ~0x60; - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xcc, val); - val = tm6000_get_reg(dev, REQ_07_SET_GET_AVREG, 0xc0, 0); + tm6000_set_reg(dev, TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, val); + val = tm6000_get_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0); val |= 0x40; - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xc0, val); - tm6000_set_reg(dev, REQ_07_SET_GET_AVREG, 0xfe, 0x28); - tm6000_set_reg(dev, REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xfc); - tm6000_set_reg(dev, REQ_08_SET_GET_AVREG_BIT, 0xe6, 0xff); - tm6000_set_reg(dev, REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe); + tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, val); + tm6000_set_reg(dev, TM6010_REQ07_RFE_POWER_DOWN, 0x28); + tm6000_set_reg(dev, TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xfc); + tm6000_set_reg(dev, TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0xff); + tm6000_set_reg(dev, TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe); tm6000_read_write_usb (dev, 0xc0, 0x0e, 0x00c2, 0x0008, buf, 2); printk (KERN_INFO "buf %#x %#x \n", buf[0], buf[1]); } else { - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00ff, 0x08); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00ff, 0x00); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x003f, 0x01); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00df, 0x08); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e2, 0x0c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e8, 0xff); + tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x08); + tm6000_set_reg(dev, TM6010_REQ07_RFF_SOFT_RESET, 0x00); + tm6000_set_reg(dev, TM6010_REQ07_R3F_RESET, 0x01); + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_PULSE_CNT0, 0x08); + tm6000_set_reg(dev, TM6010_REQ07_RE2_OUT_SEL2, 0x0c); + tm6000_set_reg(dev, TM6010_REQ07_RE8_TYPESEL_MOS_I2S, 0xff); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0xd8); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c0, 0x40); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c1, 0xd0); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00c3, 0x09); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00da, 0x37); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d1, 0xd8); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d2, 0xc0); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00d6, 0x60); - - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e2, 0x0c); - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00e8, 0xff); + tm6000_set_reg(dev, TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x40); + tm6000_set_reg(dev, TM6010_REQ07_RC1_TRESHOLD, 0xd0); + tm6000_set_reg(dev, TM6010_REQ07_RC3_HSTART1, 0x09); + tm6000_set_reg(dev, TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0x37); + tm6000_set_reg(dev, TM6010_REQ07_RD1_ADDR_FOR_REQ1, 0xd8); + tm6000_set_reg(dev, TM6010_REQ07_RD2_ADDR_FOR_REQ2, 0xc0); + tm6000_set_reg(dev, TM6010_REQ07_RD6_ENDP_REQ1_REQ2, 0x60); + + tm6000_set_reg(dev, TM6010_REQ07_RE2_OUT_SEL2, 0x0c); + tm6000_set_reg(dev, TM6010_REQ07_RE8_TYPESEL_MOS_I2S, 0xff); tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x00eb, 0x08); msleep(50); @@ -279,153 +279,153 @@ struct reg_init { /* The meaning of those initializations are unknown */ struct reg_init tm6000_init_tab[] = { /* REG VALUE */ - { REQ_07_SET_GET_AVREG, 0xdf, 0x1f }, - { REQ_07_SET_GET_AVREG, 0xff, 0x08 }, - { REQ_07_SET_GET_AVREG, 0xff, 0x00 }, - { REQ_07_SET_GET_AVREG, 0xd5, 0x4f }, - { REQ_07_SET_GET_AVREG, 0xda, 0x23 }, - { REQ_07_SET_GET_AVREG, 0xdb, 0x08 }, - { REQ_07_SET_GET_AVREG, 0xe2, 0x00 }, - { REQ_07_SET_GET_AVREG, 0xe3, 0x10 }, - { REQ_07_SET_GET_AVREG, 0xe5, 0x00 }, - { REQ_07_SET_GET_AVREG, 0xe8, 0x00 }, + { TM6010_REQ07_RD8_IR_PULSE_CNT0, 0x1f }, + { TM6010_REQ07_RFF_SOFT_RESET, 0x08 }, + { TM6010_REQ07_RFF_SOFT_RESET, 0x00 }, + { TM6010_REQ07_RD5_POWERSAVE, 0x4f }, + { TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0x23 }, + { TM6010_REQ07_RD8_IR_WAKEUP_ADD, 0x08 }, + { TM6010_REQ07_RE2_OUT_SEL2, 0x00 }, + { TM6010_REQ07_RE3_OUT_SEL1, 0x10 }, + { TM6010_REQ07_RE5_REMOTE_WAKEUP, 0x00 }, + { TM6010_REQ07_RE8_TYPESEL_MOS_I2S, 0x00 }, { REQ_07_SET_GET_AVREG, 0xeb, 0x64 }, /* 48000 bits/sample, external input */ { REQ_07_SET_GET_AVREG, 0xee, 0xc2 }, - { REQ_07_SET_GET_AVREG, 0x3f, 0x01 }, /* Start of soft reset */ - { REQ_07_SET_GET_AVREG, 0x00, 0x00 }, - { REQ_07_SET_GET_AVREG, 0x01, 0x07 }, - { REQ_07_SET_GET_AVREG, 0x02, 0x5f }, - { REQ_07_SET_GET_AVREG, 0x03, 0x00 }, - { REQ_07_SET_GET_AVREG, 0x05, 0x64 }, - { REQ_07_SET_GET_AVREG, 0x07, 0x01 }, - { REQ_07_SET_GET_AVREG, 0x08, 0x82 }, - { REQ_07_SET_GET_AVREG, 0x09, 0x36 }, - { REQ_07_SET_GET_AVREG, 0x0a, 0x50 }, - { REQ_07_SET_GET_AVREG, 0x0c, 0x6a }, - { REQ_07_SET_GET_AVREG, 0x11, 0xc9 }, - { REQ_07_SET_GET_AVREG, 0x12, 0x07 }, - { REQ_07_SET_GET_AVREG, 0x13, 0x3b }, - { REQ_07_SET_GET_AVREG, 0x14, 0x47 }, - { REQ_07_SET_GET_AVREG, 0x15, 0x6f }, - { REQ_07_SET_GET_AVREG, 0x17, 0xcd }, - { REQ_07_SET_GET_AVREG, 0x18, 0x1e }, - { REQ_07_SET_GET_AVREG, 0x19, 0x8b }, - { REQ_07_SET_GET_AVREG, 0x1a, 0xa2 }, - { REQ_07_SET_GET_AVREG, 0x1b, 0xe9 }, - { REQ_07_SET_GET_AVREG, 0x1c, 0x1c }, - { REQ_07_SET_GET_AVREG, 0x1d, 0xcc }, - { REQ_07_SET_GET_AVREG, 0x1e, 0xcc }, - { REQ_07_SET_GET_AVREG, 0x1f, 0xcd }, - { REQ_07_SET_GET_AVREG, 0x20, 0x3c }, - { REQ_07_SET_GET_AVREG, 0x21, 0x3c }, - { REQ_07_SET_GET_AVREG, 0x2d, 0x48 }, - { REQ_07_SET_GET_AVREG, 0x2e, 0x88 }, - { REQ_07_SET_GET_AVREG, 0x30, 0x22 }, - { REQ_07_SET_GET_AVREG, 0x31, 0x61 }, - { REQ_07_SET_GET_AVREG, 0x32, 0x74 }, - { REQ_07_SET_GET_AVREG, 0x33, 0x1c }, - { REQ_07_SET_GET_AVREG, 0x34, 0x74 }, - { REQ_07_SET_GET_AVREG, 0x35, 0x1c }, - { REQ_07_SET_GET_AVREG, 0x36, 0x7a }, - { REQ_07_SET_GET_AVREG, 0x37, 0x26 }, - { REQ_07_SET_GET_AVREG, 0x38, 0x40 }, - { REQ_07_SET_GET_AVREG, 0x39, 0x0a }, - { REQ_07_SET_GET_AVREG, 0x42, 0x55 }, - { REQ_07_SET_GET_AVREG, 0x51, 0x11 }, - { REQ_07_SET_GET_AVREG, 0x55, 0x01 }, - { REQ_07_SET_GET_AVREG, 0x57, 0x02 }, - { REQ_07_SET_GET_AVREG, 0x58, 0x35 }, - { REQ_07_SET_GET_AVREG, 0x59, 0xa0 }, - { REQ_07_SET_GET_AVREG, 0x80, 0x15 }, - { REQ_07_SET_GET_AVREG, 0x82, 0x42 }, - { REQ_07_SET_GET_AVREG, 0xc1, 0xd0 }, - { REQ_07_SET_GET_AVREG, 0xc3, 0x88 }, - { REQ_07_SET_GET_AVREG, 0x3f, 0x00 }, /* End of the soft reset */ + { TM6010_REQ07_R3F_RESET, 0x01 }, /* Start of soft reset */ + { TM6010_REQ07_R00_VIDEO_CONTROL0, 0x00 }, + { TM6010_REQ07_R01_VIDEO_CONTROL1, 0x07 }, + { TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f }, + { TM6010_REQ07_R03_YC_SEP_CONTROL, 0x00 }, + { TM6010_REQ07_R05_NOISE_THRESHOLD, 0x64 }, + { TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01 }, + { TM6010_REQ07_R08_LUMA_CONTRAST_ADJ, 0x82 }, + { TM6010_REQ07_R09_LUMA_BRIGHTNESS_ADJ, 0x36 }, + { TM6010_REQ07_R0A_CHROMA_SATURATION_ADJ, 0x50 }, + { TM6010_REQ07_R0C_CHROMA_AGC_CONTROL, 0x6a }, + { TM6010_REQ07_R11_AGC_PEAK_CONTROL, 0xc9 }, + { TM6010_REQ07_R12_AGC_GATE_STARTH, 0x07 }, + { TM6010_REQ07_R13_AGC_GATE_STARTL, 0x3b }, + { TM6010_REQ07_R14_AGC_GATE_WIDTH, 0x47 }, + { TM6010_REQ07_R15_AGC_BP_DELAY, 0x6f }, + { TM6010_REQ07_R17_HLOOP_MAXSTATE, 0xcd }, + { TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e }, + { TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x8b }, + { TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xa2 }, + { TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe9 }, + { TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c }, + { TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc }, + { TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc }, + { TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd }, + { TM6010_REQ07_R20_HSYNC_RISING_EDGE_TIME, 0x3c }, + { TM6010_REQ07_R21_HSYNC_PHASE_OFFSET, 0x3c }, + { TM6010_REQ07_R2D_CHROMA_BURST_END, 0x48 }, + { TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88 }, + { TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x22 }, + { TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61 }, + { TM6010_REQ07_R32_VSYNC_HLOCK_MIN, 0x74 }, + { TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x1c }, + { TM6010_REQ07_R34_VSYNC_AGC_MIN, 0x74 }, + { TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c }, + { TM6010_REQ07_R36_VSYNC_VBI_MIN, 0x7a }, + { TM6010_REQ07_R37_VSYNC_VBI_MAX, 0x26 }, + { TM6010_REQ07_R38_VSYNC_THRESHOLD, 0x40 }, + { TM6010_REQ07_R39_VSYNC_TIME_CONSTANT, 0x0a }, + { TM6010_REQ07_R42_VBI_DATA_HIGH_LEVEL, 0x55 }, + { TM6010_REQ07_R51_VBI_DATA_TYPE_LINE21, 0x11 }, + { TM6010_REQ07_R55_VBI_LOOP_FILTER_GAIN, 0x01 }, + { TM6010_REQ07_R57_VBI_LOOP_FILTER_P_GAIN, 0x02 }, + { TM6010_REQ07_R58_VBI_CAPTION_DTO1, 0x35 }, + { TM6010_REQ07_R59_VBI_CAPTION_DTO0, 0xa0 }, + { TM6010_REQ07_R80_COMB_FILTER_TRESHOLD, 0x15 }, + { TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42 }, + { TM6010_REQ07_RC1_TRESHOLD, 0xd0 }, + { TM6010_REQ07_RC3_HSTART1, 0x88 }, + { TM6010_REQ07_R3F_RESET, 0x00 }, /* End of the soft reset */ { REQ_05_SET_GET_USBREG, 0x18, 0x00 }, }; struct reg_init tm6010_init_tab[] = { - { REQ_07_SET_GET_AVREG, 0xc0, 0x00 }, - { REQ_07_SET_GET_AVREG, 0xc4, 0xa0 }, - { REQ_07_SET_GET_AVREG, 0xc6, 0x40 }, - { REQ_07_SET_GET_AVREG, 0xca, 0x31 }, - { REQ_07_SET_GET_AVREG, 0xcc, 0xe1 }, - { REQ_07_SET_GET_AVREG, 0xe0, 0x03 }, - { REQ_07_SET_GET_AVREG, 0xfe, 0x7f }, - - { REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0 }, - { REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4 }, - { REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8 }, - { REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00 }, - { REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2 }, - { REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0 }, - { REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2 }, - { REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60 }, - { REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc }, - - { REQ_07_SET_GET_AVREG, 0x3f, 0x01 }, - { REQ_07_SET_GET_AVREG, 0x00, 0x00 }, - { REQ_07_SET_GET_AVREG, 0x01, 0x07 }, - { REQ_07_SET_GET_AVREG, 0x02, 0x5f }, - { REQ_07_SET_GET_AVREG, 0x03, 0x00 }, - { REQ_07_SET_GET_AVREG, 0x05, 0x64 }, - { REQ_07_SET_GET_AVREG, 0x07, 0x01 }, - { REQ_07_SET_GET_AVREG, 0x08, 0x82 }, - { REQ_07_SET_GET_AVREG, 0x09, 0x36 }, - { REQ_07_SET_GET_AVREG, 0x0a, 0x50 }, - { REQ_07_SET_GET_AVREG, 0x0c, 0x6a }, - { REQ_07_SET_GET_AVREG, 0x11, 0xc9 }, - { REQ_07_SET_GET_AVREG, 0x12, 0x07 }, - { REQ_07_SET_GET_AVREG, 0x13, 0x3b }, - { REQ_07_SET_GET_AVREG, 0x14, 0x47 }, - { REQ_07_SET_GET_AVREG, 0x15, 0x6f }, - { REQ_07_SET_GET_AVREG, 0x17, 0xcd }, - { REQ_07_SET_GET_AVREG, 0x18, 0x1e }, - { REQ_07_SET_GET_AVREG, 0x19, 0x8b }, - { REQ_07_SET_GET_AVREG, 0x1a, 0xa2 }, - { REQ_07_SET_GET_AVREG, 0x1b, 0xe9 }, - { REQ_07_SET_GET_AVREG, 0x1c, 0x1c }, - { REQ_07_SET_GET_AVREG, 0x1d, 0xcc }, - { REQ_07_SET_GET_AVREG, 0x1e, 0xcc }, - { REQ_07_SET_GET_AVREG, 0x1f, 0xcd }, - { REQ_07_SET_GET_AVREG, 0x20, 0x3c }, - { REQ_07_SET_GET_AVREG, 0x21, 0x3c }, - { REQ_07_SET_GET_AVREG, 0x2d, 0x48 }, - { REQ_07_SET_GET_AVREG, 0x2e, 0x88 }, - { REQ_07_SET_GET_AVREG, 0x30, 0x22 }, - { REQ_07_SET_GET_AVREG, 0x31, 0x61 }, - { REQ_07_SET_GET_AVREG, 0x32, 0x74 }, - { REQ_07_SET_GET_AVREG, 0x33, 0x1c }, - { REQ_07_SET_GET_AVREG, 0x34, 0x74 }, - { REQ_07_SET_GET_AVREG, 0x35, 0x1c }, - { REQ_07_SET_GET_AVREG, 0x36, 0x7a }, - { REQ_07_SET_GET_AVREG, 0x37, 0x26 }, - { REQ_07_SET_GET_AVREG, 0x38, 0x40 }, - { REQ_07_SET_GET_AVREG, 0x39, 0x0a }, - { REQ_07_SET_GET_AVREG, 0x42, 0x55 }, - { REQ_07_SET_GET_AVREG, 0x51, 0x11 }, - { REQ_07_SET_GET_AVREG, 0x55, 0x01 }, - { REQ_07_SET_GET_AVREG, 0x57, 0x02 }, - { REQ_07_SET_GET_AVREG, 0x58, 0x35 }, - { REQ_07_SET_GET_AVREG, 0x59, 0xa0 }, - { REQ_07_SET_GET_AVREG, 0x80, 0x15 }, - { REQ_07_SET_GET_AVREG, 0x82, 0x42 }, - { REQ_07_SET_GET_AVREG, 0xc1, 0xd0 }, - { REQ_07_SET_GET_AVREG, 0xc3, 0x88 }, - { REQ_07_SET_GET_AVREG, 0x3f, 0x00 }, + { TM6010_REQ07_RC0_ACTIVE_VIDEO_SOURCE, 0x00 }, + { TM6010_REQ07_RC4_HSTART0, 0xa0 }, + { TM6010_REQ07_RC6_HEND0, 0x40 }, + { TM6010_REQ07_RCA_VEND0, 0x31 }, + { TM6010_REQ07_RCC_ACTIVE_VIDEO_IF, 0xe1 }, + { TM6010_REQ07_RE0_DVIDEO_SOURCE, 0x03 }, + { TM6010_REQ07_RFE_POWER_DOWN, 0x7f }, + + { TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0 }, + { TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4 }, + { TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8 }, + { TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00 }, + { TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2 }, + { TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0 }, + { TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2 }, + { TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60 }, + { TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc }, + + { TM6010_REQ07_R3F_RESET, 0x01 }, + { TM6010_REQ07_R00_VIDEO_CONTROL0, 0x00 }, + { TM6010_REQ07_R01_VIDEO_CONTROL1, 0x07 }, + { TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f }, + { TM6010_REQ07_R03_YC_SEP_CONTROL, 0x00 }, + { TM6010_REQ07_R05_NOISE_THRESHOLD, 0x64 }, + { TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01 }, + { TM6010_REQ07_R08_LUMA_CONTRAST_ADJ, 0x82 }, + { TM6010_REQ07_R09_LUMA_BRIGHTNESS_ADJ, 0x36 }, + { TM6010_REQ07_R0A_CHROMA_SATURATION_ADJ, 0x50 }, + { TM6010_REQ07_R0C_CHROMA_AGC_CONTROL, 0x6a }, + { TM6010_REQ07_R11_AGC_PEAK_CONTROL, 0xc9 }, + { TM6010_REQ07_R12_AGC_GATE_STARTH, 0x07 }, + { TM6010_REQ07_R13_AGC_GATE_STARTL, 0x3b }, + { TM6010_REQ07_R14_AGC_GATE_WIDTH, 0x47 }, + { TM6010_REQ07_R15_AGC_BP_DELAY, 0x6f }, + { TM6010_REQ07_R17_HLOOP_MAXSTATE, 0xcd }, + { TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e }, + { TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x8b }, + { TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xa2 }, + { TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe9 }, + { TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c }, + { TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc }, + { TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc }, + { TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd }, + { TM6010_REQ07_R20_HSYNC_RISING_EDGE_TIME, 0x3c }, + { TM6010_REQ07_R21_HSYNC_PHASE_OFFSET, 0x3c }, + { TM6010_REQ07_R2D_CHROMA_BURST_END, 0x48 }, + { TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88 }, + { TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x22 }, + { TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61 }, + { TM6010_REQ07_R32_VSYNC_HLOCK_MIN, 0x74 }, + { TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x1c }, + { TM6010_REQ07_R34_VSYNC_AGC_MIN, 0x74 }, + { TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c }, + { TM6010_REQ07_R36_VSYNC_VBI_MIN, 0x7a }, + { TM6010_REQ07_R37_VSYNC_VBI_MAX, 0x26 }, + { TM6010_REQ07_R38_VSYNC_THRESHOLD, 0x40 }, + { TM6010_REQ07_R39_VSYNC_TIME_CONSTANT, 0x0a }, + { TM6010_REQ07_R42_VBI_DATA_HIGH_LEVEL, 0x55 }, + { TM6010_REQ07_R51_VBI_DATA_TYPE_LINE21, 0x11 }, + { TM6010_REQ07_R55_VBI_LOOP_FILTER_GAIN, 0x01 }, + { TM6010_REQ07_R57_VBI_LOOP_FILTER_P_GAIN, 0x02 }, + { TM6010_REQ07_R58_VBI_CAPTION_DTO1, 0x35 }, + { TM6010_REQ07_R59_VBI_CAPTION_DTO0, 0xa0 }, + { TM6010_REQ07_R80_COMB_FILTER_TRESHOLD, 0x15 }, + { TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42 }, + { TM6010_REQ07_RC1_TRESHOLD, 0xd0 }, + { TM6010_REQ07_RC3_HSTART1, 0x88 }, + { TM6010_REQ07_R3F_RESET, 0x00 }, { REQ_05_SET_GET_USBREG, 0x18, 0x00 }, - { REQ_07_SET_GET_AVREG, 0xdc, 0xaa }, - { REQ_07_SET_GET_AVREG, 0xdd, 0x30 }, - { REQ_07_SET_GET_AVREG, 0xde, 0x20 }, - { REQ_07_SET_GET_AVREG, 0xdf, 0xd0 }, + { TM6010_REQ07_RD8_IR_LEADER1, 0xaa }, + { TM6010_REQ07_RD8_IR_LEADER0, 0x30 }, + { TM6010_REQ07_RD8_IR_PULSE_CNT1, 0x20 }, + { TM6010_REQ07_RD8_IR_PULSE_CNT0, 0xd0 }, { REQ_04_EN_DISABLE_MCU_INT, 0x02, 0x00 }, - { REQ_07_SET_GET_AVREG, 0xd8, 0x2f }, + { TM6010_REQ07_RD8_IR, 0x2f }, /* set remote wakeup key:any key wakeup */ - { REQ_07_SET_GET_AVREG, 0xe5, 0xfe }, - { REQ_07_SET_GET_AVREG, 0xda, 0xff }, + { TM6010_REQ07_RE5_REMOTE_WAKEUP, 0xfe }, + { TM6010_REQ07_RD8_IR_WAKEUP_SEL, 0xff }, }; int tm6000_init (struct tm6000_core *dev) diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c index 1e142e5d59c5..b3564f611e5e 100644 --- a/drivers/staging/tm6000/tm6000-stds.c +++ b/drivers/staging/tm6000/tm6000-stds.c @@ -44,290 +44,290 @@ static struct tm6000_std_tv_settings tv_stds[] = { { .id = V4L2_STD_PAL_M, .sif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, - {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, + {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, {0, 0, 0}, }, .nosif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, {0, 0, 0}, }, .common = { - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x04}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x00}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, - {REQ_07_SET_GET_AVREG, 0x19, 0x83}, - {REQ_07_SET_GET_AVREG, 0x1a, 0x0a}, - {REQ_07_SET_GET_AVREG, 0x1b, 0xe0}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, - {REQ_07_SET_GET_AVREG, 0x30, 0x20}, - {REQ_07_SET_GET_AVREG, 0x31, 0x61}, - {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x52}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x04}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x00}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x83}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x0a}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe0}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x20}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_PAL_Nc, .sif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, - {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, + {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, {0, 0, 0}, }, .nosif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, {0, 0, 0}, }, .common = { - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x36}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x02}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, - {REQ_07_SET_GET_AVREG, 0x19, 0x91}, - {REQ_07_SET_GET_AVREG, 0x1a, 0x1f}, - {REQ_07_SET_GET_AVREG, 0x1b, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, - {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, - {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, - {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x52}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x36}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x91}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x1f}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0x0c}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_PAL, .sif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, - {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, + {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, {0, 0, 0} }, .nosif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, {0, 0, 0}, }, .common = { - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x32}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x02}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x25}, - {REQ_07_SET_GET_AVREG, 0x19, 0xd5}, - {REQ_07_SET_GET_AVREG, 0x1a, 0x63}, - {REQ_07_SET_GET_AVREG, 0x1b, 0x50}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, - {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, - {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, - {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x52}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x32}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x25}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0xd5}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x63}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0x50}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_SECAM, .sif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, - {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, + {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, {0, 0, 0}, }, .nosif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, {0, 0, 0}, }, .common = { - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x38}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x02}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x24}, - {REQ_07_SET_GET_AVREG, 0x19, 0x92}, - {REQ_07_SET_GET_AVREG, 0x1a, 0xe8}, - {REQ_07_SET_GET_AVREG, 0x1b, 0xed}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, - {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, - {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, - {REQ_07_SET_GET_AVREG, 0x33, 0x2c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x18}, - {REQ_07_SET_GET_AVREG, 0x82, 0x42}, - {REQ_07_SET_GET_AVREG, 0x83, 0xFF}, - - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x38}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x24}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x92}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xe8}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xed}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x2c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x18}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0xFF}, + + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_NTSC, .sif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x08}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x62}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfe}, - {REQ_07_SET_GET_AVREG, 0xfe, 0xcb}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf2}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x08}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x62}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfe}, + {TM6010_REQ07_RFE_POWER_DOWN, 0xcb}, {0, 0, 0}, }, .nosif = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x60}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf8}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x60}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, {0, 0, 0}, }, .common = { - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x00}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0f}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x00}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, - {REQ_07_SET_GET_AVREG, 0x19, 0x8b}, - {REQ_07_SET_GET_AVREG, 0x1a, 0xa2}, - {REQ_07_SET_GET_AVREG, 0x1b, 0xe9}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, - {REQ_07_SET_GET_AVREG, 0x30, 0x22}, - {REQ_07_SET_GET_AVREG, 0x31, 0x61}, - {REQ_07_SET_GET_AVREG, 0x33, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x42}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdd}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x00}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0f}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x00}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x8b}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xa2}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe9}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x22}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x1c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdd}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, @@ -337,210 +337,210 @@ static struct tm6000_std_settings composite_stds[] = { { .id = V4L2_STD_PAL_M, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x04}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x00}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, - {REQ_07_SET_GET_AVREG, 0x19, 0x83}, - {REQ_07_SET_GET_AVREG, 0x1a, 0x0a}, - {REQ_07_SET_GET_AVREG, 0x1b, 0xe0}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, - {REQ_07_SET_GET_AVREG, 0x30, 0x20}, - {REQ_07_SET_GET_AVREG, 0x31, 0x61}, - {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x52}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x04}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x00}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x83}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x0a}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe0}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x20}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_PAL_Nc, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x36}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x02}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, - {REQ_07_SET_GET_AVREG, 0x19, 0x91}, - {REQ_07_SET_GET_AVREG, 0x1a, 0x1f}, - {REQ_07_SET_GET_AVREG, 0x1b, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, - {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, - {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, - {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x52}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x36}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x91}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x1f}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0x0c}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_PAL, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x32}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x02}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x25}, - {REQ_07_SET_GET_AVREG, 0x19, 0xd5}, - {REQ_07_SET_GET_AVREG, 0x1a, 0x63}, - {REQ_07_SET_GET_AVREG, 0x1b, 0x50}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, - {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, - {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, - {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x52}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x32}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x25}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0xd5}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x63}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0x50}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_SECAM, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x38}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x02}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x24}, - {REQ_07_SET_GET_AVREG, 0x19, 0x92}, - {REQ_07_SET_GET_AVREG, 0x1a, 0xe8}, - {REQ_07_SET_GET_AVREG, 0x1b, 0xed}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, - {REQ_07_SET_GET_AVREG, 0x30, 0x2c}, - {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, - {REQ_07_SET_GET_AVREG, 0x33, 0x2c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x18}, - {REQ_07_SET_GET_AVREG, 0x82, 0x42}, - {REQ_07_SET_GET_AVREG, 0x83, 0xFF}, - - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x38}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x02}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x24}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x92}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xe8}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xed}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2c}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x2c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x18}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0xFF}, + + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_NTSC, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xf4}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf3}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x0f}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf1}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe8}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8b}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x00}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0f}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x00}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, - {REQ_07_SET_GET_AVREG, 0x19, 0x8b}, - {REQ_07_SET_GET_AVREG, 0x1a, 0xa2}, - {REQ_07_SET_GET_AVREG, 0x1b, 0xe9}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, - {REQ_07_SET_GET_AVREG, 0x30, 0x22}, - {REQ_07_SET_GET_AVREG, 0x31, 0x61}, - {REQ_07_SET_GET_AVREG, 0x33, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x42}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdd}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xf4}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x0f}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf1}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xe0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe8}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8b}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x00}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0f}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x00}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x8b}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xa2}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe9}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x22}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x1c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdd}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, @@ -550,211 +550,211 @@ static struct tm6000_std_settings svideo_stds[] = { { .id = V4L2_STD_PAL_M, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x05}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x04}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, - {REQ_07_SET_GET_AVREG, 0x19, 0x83}, - {REQ_07_SET_GET_AVREG, 0x1a, 0x0a}, - {REQ_07_SET_GET_AVREG, 0x1b, 0xe0}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, - {REQ_07_SET_GET_AVREG, 0x30, 0x22}, - {REQ_07_SET_GET_AVREG, 0x31, 0x61}, - {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x52}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x05}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x04}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x83}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x0a}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe0}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x22}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_PAL_Nc, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x37}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x04}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, - {REQ_07_SET_GET_AVREG, 0x19, 0x91}, - {REQ_07_SET_GET_AVREG, 0x1a, 0x1f}, - {REQ_07_SET_GET_AVREG, 0x1b, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, - {REQ_07_SET_GET_AVREG, 0x30, 0x22}, - {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, - {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x52}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x37}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x04}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x91}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x1f}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0x0c}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x22}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_PAL, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x33}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x04}, - {REQ_07_SET_GET_AVREG, 0x07, 0x00}, - {REQ_07_SET_GET_AVREG, 0x18, 0x25}, - {REQ_07_SET_GET_AVREG, 0x19, 0xd5}, - {REQ_07_SET_GET_AVREG, 0x1a, 0x63}, - {REQ_07_SET_GET_AVREG, 0x1b, 0x50}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, - {REQ_07_SET_GET_AVREG, 0x30, 0x2a}, - {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, - {REQ_07_SET_GET_AVREG, 0x33, 0x0c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x52}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdc}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x33}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x04}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x00}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x25}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0xd5}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0x63}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0x50}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2a}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x0c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x52}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdc}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_SECAM, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x39}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0e}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x03}, - {REQ_07_SET_GET_AVREG, 0x07, 0x01}, - {REQ_07_SET_GET_AVREG, 0x18, 0x24}, - {REQ_07_SET_GET_AVREG, 0x19, 0x92}, - {REQ_07_SET_GET_AVREG, 0x1a, 0xe8}, - {REQ_07_SET_GET_AVREG, 0x1b, 0xed}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x8c}, - {REQ_07_SET_GET_AVREG, 0x30, 0x2a}, - {REQ_07_SET_GET_AVREG, 0x31, 0xc1}, - {REQ_07_SET_GET_AVREG, 0x33, 0x2c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x18}, - {REQ_07_SET_GET_AVREG, 0x82, 0x42}, - {REQ_07_SET_GET_AVREG, 0x83, 0xFF}, - - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x39}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0e}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x03}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x01}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x24}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x92}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xe8}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xed}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x8c}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x2a}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0xc1}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x2c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x18}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0xFF}, + + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, { .id = V4L2_STD_NTSC, .common = { - {REQ_08_SET_GET_AVREG_BIT, 0xe2, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xe3, 0xfc}, - {REQ_08_SET_GET_AVREG_BIT, 0xe4, 0xf8}, - {REQ_08_SET_GET_AVREG_BIT, 0xe6, 0x00}, - {REQ_08_SET_GET_AVREG_BIT, 0xea, 0xf2}, - {REQ_08_SET_GET_AVREG_BIT, 0xeb, 0xf0}, - {REQ_08_SET_GET_AVREG_BIT, 0xec, 0xc2}, - {REQ_08_SET_GET_AVREG_BIT, 0xed, 0xe0}, - {REQ_08_SET_GET_AVREG_BIT, 0xf0, 0x68}, - {REQ_08_SET_GET_AVREG_BIT, 0xf1, 0xfc}, - {REQ_07_SET_GET_AVREG, 0xfe, 0x8a}, - - {REQ_07_SET_GET_AVREG, 0x3f, 0x01}, - {REQ_07_SET_GET_AVREG, 0x00, 0x01}, - {REQ_07_SET_GET_AVREG, 0x01, 0x0f}, - {REQ_07_SET_GET_AVREG, 0x02, 0x5f}, - {REQ_07_SET_GET_AVREG, 0x03, 0x03}, - {REQ_07_SET_GET_AVREG, 0x07, 0x00}, - {REQ_07_SET_GET_AVREG, 0x17, 0x8b}, - {REQ_07_SET_GET_AVREG, 0x18, 0x1e}, - {REQ_07_SET_GET_AVREG, 0x19, 0x8b}, - {REQ_07_SET_GET_AVREG, 0x1a, 0xa2}, - {REQ_07_SET_GET_AVREG, 0x1b, 0xe9}, - {REQ_07_SET_GET_AVREG, 0x1c, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x1d, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1e, 0xcc}, - {REQ_07_SET_GET_AVREG, 0x1f, 0xcd}, - {REQ_07_SET_GET_AVREG, 0x2e, 0x88}, - {REQ_07_SET_GET_AVREG, 0x30, 0x22}, - {REQ_07_SET_GET_AVREG, 0x31, 0x61}, - {REQ_07_SET_GET_AVREG, 0x33, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x35, 0x1c}, - {REQ_07_SET_GET_AVREG, 0x82, 0x42}, - {REQ_07_SET_GET_AVREG, 0x83, 0x6F}, - - {REQ_07_SET_GET_AVREG, 0x04, 0xdd}, - {REQ_07_SET_GET_AVREG, 0x0d, 0x07}, - {REQ_07_SET_GET_AVREG, 0x3f, 0x00}, + {TM6010_REQ08_RE2_POWER_DOWN_CTRL1, 0xf0}, + {TM6010_REQ08_RE3_ADC_IN1_SEL, 0xfc}, + {TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf8}, + {TM6010_REQ08_RE6_POWER_DOWN_CTRL2, 0x00}, + {TM6010_REQ08_REA_BUFF_DRV_CTRL, 0xf2}, + {TM6010_REQ08_REB_SIF_GAIN_CTRL, 0xf0}, + {TM6010_REQ08_REC_REVERSE_YC_CTRL, 0xc2}, + {TM6010_REQ08_RED_GAIN_SEL, 0xe0}, + {TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 0x68}, + {TM6010_REQ08_RF1_AADC_POWER_DOWN, 0xfc}, + {TM6010_REQ07_RFE_POWER_DOWN, 0x8a}, + + {TM6010_REQ07_R3F_RESET, 0x01}, + {TM6010_REQ07_R00_VIDEO_CONTROL0, 0x01}, + {TM6010_REQ07_R01_VIDEO_CONTROL1, 0x0f}, + {TM6010_REQ07_R02_VIDEO_CONTROL2, 0x5f}, + {TM6010_REQ07_R03_YC_SEP_CONTROL, 0x03}, + {TM6010_REQ07_R07_OUTPUT_CONTROL, 0x00}, + {TM6010_REQ07_R17_HLOOP_MAXSTATE, 0x8b}, + {TM6010_REQ07_R18_CHROMA_DTO_INCREMENT3, 0x1e}, + {TM6010_REQ07_R19_CHROMA_DTO_INCREMENT2, 0x8b}, + {TM6010_REQ07_R1A_CHROMA_DTO_INCREMENT1, 0xa2}, + {TM6010_REQ07_R1B_CHROMA_DTO_INCREMENT0, 0xe9}, + {TM6010_REQ07_R1C_HSYNC_DTO_INCREMENT3, 0x1c}, + {TM6010_REQ07_R1D_HSYNC_DTO_INCREMENT2, 0xcc}, + {TM6010_REQ07_R1E_HSYNC_DTO_INCREMENT1, 0xcc}, + {TM6010_REQ07_R1F_HSYNC_DTO_INCREMENT0, 0xcd}, + {TM6010_REQ07_R2E_ACTIVE_VIDEO_HSTART, 0x88}, + {TM6010_REQ07_R30_ACTIVE_VIDEO_VSTART, 0x22}, + {TM6010_REQ07_R31_ACTIVE_VIDEO_VHIGHT, 0x61}, + {TM6010_REQ07_R33_VSYNC_HLOCK_MAX, 0x1c}, + {TM6010_REQ07_R35_VSYNC_AGC_MAX, 0x1c}, + {TM6010_REQ07_R82_COMB_FILTER_CONFIG, 0x42}, + {TM6010_REQ07_R83_CHROMA_LOCK_CONFIG, 0x6F}, + + {TM6010_REQ07_R04_LUMA_HAGC_CONTROL, 0xdd}, + {TM6010_REQ07_R0D_CHROMA_KILL_LEVEL, 0x07}, + {TM6010_REQ07_R3F_RESET, 0x00}, {0, 0, 0}, }, }, diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 0bee7dfaae4e..67f4d2908c35 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1186,16 +1186,16 @@ static int vidioc_g_ctrl (struct file *file, void *priv, /* FIXME: Probably, those won't work! Maybe we need shadow regs */ switch (ctrl->id) { case V4L2_CID_CONTRAST: - val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x08, 0); + val = tm6000_get_reg(dev, TM6010_REQ07_R08_LUMA_CONTRAST_ADJ, 0); break; case V4L2_CID_BRIGHTNESS: - val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x09, 0); + val = tm6000_get_reg(dev, TM6010_REQ07_R09_LUMA_BRIGHTNESS_ADJ, 0); return 0; case V4L2_CID_SATURATION: - val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x0a, 0); + val = tm6000_get_reg(dev, TM6010_REQ07_R0A_CHROMA_SATURATION_ADJ, 0); return 0; case V4L2_CID_HUE: - val=tm6000_get_reg (dev, REQ_07_SET_GET_AVREG, 0x0b, 0); + val = tm6000_get_reg(dev, TM6010_REQ07_R0B_CHROMA_HUE_PHASE_ADJ, 0); return 0; default: return -EINVAL; @@ -1217,16 +1217,16 @@ static int vidioc_s_ctrl (struct file *file, void *priv, switch (ctrl->id) { case V4L2_CID_CONTRAST: - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x08, val); + tm6000_set_reg(dev, TM6010_REQ07_R08_LUMA_CONTRAST_ADJ, val); return 0; case V4L2_CID_BRIGHTNESS: - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x09, val); + tm6000_set_reg(dev, TM6010_REQ07_R09_LUMA_BRIGHTNESS_ADJ, val); return 0; case V4L2_CID_SATURATION: - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0a, val); + tm6000_set_reg(dev, TM6010_REQ07_R0A_CHROMA_SATURATION_ADJ, val); return 0; case V4L2_CID_HUE: - tm6000_set_reg (dev, REQ_07_SET_GET_AVREG, 0x0b, val); + tm6000_set_reg(dev, TM6010_REQ07_R0B_CHROMA_HUE_PHASE_ADJ, val); return 0; } return -EINVAL; -- GitLab From f7d110c68c7d0fe1de567ea86194fb405d6a43a6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 10:26:45 -0300 Subject: [PATCH 177/534] V4L/DVB: tm6000: Replace naming convention for registers of req 05 group After looking at the "magic" registers, it is clear that usb registers belong to request 5. Replace them with this script: cat /tmp/reg3 |perl -ne 'if (m/define (TM6000_U_)([^\s]+)\s+0x([A-F0-9].)/) { \ $name=$2; $val=$3; printf "s,$1$2,TM6010_REQ05_R%s_%s,g\n", $val, $name; }' >a; sed -f a tm6000-regs.h >b; mv b tm6000-regs.h Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-regs.h | 392 +++++++++++++-------------- 1 file changed, 196 insertions(+), 196 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 631984ae934d..6be16b798f6b 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -280,202 +280,202 @@ enum { #define TM6010_REQ07_RFF_SOFT_RESET 0x07, 0xff /* Define TM6000/TM6010 USB registers */ -#define TM6000_U_MAIN_CTRL 0x00 -#define TM6000_U_DEVADDR 0x01 -#define TM6000_U_TEST 0x02 -#define TM6000_U_SOFN0 0x04 -#define TM6000_U_SOFN1 0x05 -#define TM6000_U_SOFTM0 0x06 -#define TM6000_U_SOFTM1 0x07 -#define TM6000_U_PHY_TEST 0x08 -#define TM6000_U_VCTL 0x09 -#define TM6000_U_VSTA 0x0A -#define TM6000_U_CX_CFG 0x0B -#define TM6000_U_ENDP0_REG0 0x0C -#define TM6000_U_GMASK 0x10 -#define TM6000_U_IMASK0 0x11 -#define TM6000_U_IMASK1 0x12 -#define TM6000_U_IMASK2 0x13 -#define TM6000_U_IMASK3 0x14 -#define TM6000_U_IMASK4 0x15 -#define TM6000_U_IMASK5 0x16 -#define TM6000_U_IMASK6 0x17 -#define TM6000_U_IMASK7 0x18 -#define TM6000_U_ZEROP0 0x19 -#define TM6000_U_ZEROP1 0x1A -#define TM6000_U_FIFO_EMP0 0x1C -#define TM6000_U_FIFO_EMP1 0x1D -#define TM6000_U_IRQ_GROUP 0x20 -#define TM6000_U_IRQ_SOURCE0 0x21 -#define TM6000_U_IRQ_SOURCE1 0x22 -#define TM6000_U_IRQ_SOURCE2 0x23 -#define TM6000_U_IRQ_SOURCE3 0x24 -#define TM6000_U_IRQ_SOURCE4 0x25 -#define TM6000_U_IRQ_SOURCE5 0x26 -#define TM6000_U_IRQ_SOURCE6 0x27 -#define TM6000_U_IRQ_SOURCE7 0x28 -#define TM6000_U_SEQ_ERR0 0x29 -#define TM6000_U_SEQ_ERR1 0x2A -#define TM6000_U_SEQ_ABORT0 0x2B -#define TM6000_U_SEQ_ABORT1 0x2C -#define TM6000_U_TX_ZERO0 0x2D -#define TM6000_U_TX_ZERO1 0x2E -#define TM6000_U_IDLE_CNT 0x2F -#define TM6000_U_FNO_P1 0x30 -#define TM6000_U_FNO_P2 0x31 -#define TM6000_U_FNO_P3 0x32 -#define TM6000_U_FNO_P4 0x33 -#define TM6000_U_FNO_P5 0x34 -#define TM6000_U_FNO_P6 0x35 -#define TM6000_U_FNO_P7 0x36 -#define TM6000_U_FNO_P8 0x37 -#define TM6000_U_FNO_P9 0x38 -#define TM6000_U_FNO_P10 0x39 -#define TM6000_U_FNO_P11 0x3A -#define TM6000_U_FNO_P12 0x3B -#define TM6000_U_FNO_P13 0x3C -#define TM6000_U_FNO_P14 0x3D -#define TM6000_U_FNO_P15 0x3E -#define TM6000_U_IN_MAXPS_LOW1 0x40 -#define TM6000_U_IN_MAXPS_HIGH1 0x41 -#define TM6000_U_IN_MAXPS_LOW2 0x42 -#define TM6000_U_IN_MAXPS_HIGH2 0x43 -#define TM6000_U_IN_MAXPS_LOW3 0x44 -#define TM6000_U_IN_MAXPS_HIGH3 0x45 -#define TM6000_U_IN_MAXPS_LOW4 0x46 -#define TM6000_U_IN_MAXPS_HIGH4 0x47 -#define TM6000_U_IN_MAXPS_LOW5 0x48 -#define TM6000_U_IN_MAXPS_HIGH5 0x49 -#define TM6000_U_IN_MAXPS_LOW6 0x4A -#define TM6000_U_IN_MAXPS_HIGH6 0x4B -#define TM6000_U_IN_MAXPS_LOW7 0x4C -#define TM6000_U_IN_MAXPS_HIGH7 0x4D -#define TM6000_U_IN_MAXPS_LOW8 0x4E -#define TM6000_U_IN_MAXPS_HIGH8 0x4F -#define TM6000_U_IN_MAXPS_LOW9 0x50 -#define TM6000_U_IN_MAXPS_HIGH9 0x51 -#define TM6000_U_IN_MAXPS_LOW10 0x52 -#define TM6000_U_IN_MAXPS_HIGH10 0x53 -#define TM6000_U_IN_MAXPS_LOW11 0x54 -#define TM6000_U_IN_MAXPS_HIGH11 0x55 -#define TM6000_U_IN_MAXPS_LOW12 0x56 -#define TM6000_U_IN_MAXPS_HIGH12 0x57 -#define TM6000_U_IN_MAXPS_LOW13 0x58 -#define TM6000_U_IN_MAXPS_HIGH13 0x59 -#define TM6000_U_IN_MAXPS_LOW14 0x5A -#define TM6000_U_IN_MAXPS_HIGH14 0x5B -#define TM6000_U_IN_MAXPS_LOW15 0x5C -#define TM6000_U_IN_MAXPS_HIGH15 0x5D -#define TM6000_U_OUT_MAXPS_LOW1 0x60 -#define TM6000_U_OUT_MAXPS_HIGH1 0x61 -#define TM6000_U_OUT_MAXPS_LOW2 0x62 -#define TM6000_U_OUT_MAXPS_HIGH2 0x63 -#define TM6000_U_OUT_MAXPS_LOW3 0x64 -#define TM6000_U_OUT_MAXPS_HIGH3 0x65 -#define TM6000_U_OUT_MAXPS_LOW4 0x66 -#define TM6000_U_OUT_MAXPS_HIGH4 0x67 -#define TM6000_U_OUT_MAXPS_LOW5 0x68 -#define TM6000_U_OUT_MAXPS_HIGH5 0x69 -#define TM6000_U_OUT_MAXPS_LOW6 0x6A -#define TM6000_U_OUT_MAXPS_HIGH6 0x6B -#define TM6000_U_OUT_MAXPS_LOW7 0x6C -#define TM6000_U_OUT_MAXPS_HIGH7 0x6D -#define TM6000_U_OUT_MAXPS_LOW8 0x6E -#define TM6000_U_OUT_MAXPS_HIGH8 0x6F -#define TM6000_U_OUT_MAXPS_LOW9 0x70 -#define TM6000_U_OUT_MAXPS_HIGH9 0x71 -#define TM6000_U_OUT_MAXPS_LOW10 0x72 -#define TM6000_U_OUT_MAXPS_HIGH10 0x73 -#define TM6000_U_OUT_MAXPS_LOW11 0x74 -#define TM6000_U_OUT_MAXPS_HIGH11 0x75 -#define TM6000_U_OUT_MAXPS_LOW12 0x76 -#define TM6000_U_OUT_MAXPS_HIGH12 0x77 -#define TM6000_U_OUT_MAXPS_LOW13 0x78 -#define TM6000_U_OUT_MAXPS_HIGH13 0x79 -#define TM6000_U_OUT_MAXPS_LOW14 0x7A -#define TM6000_U_OUT_MAXPS_HIGH14 0x7B -#define TM6000_U_OUT_MAXPS_LOW15 0x7C -#define TM6000_U_OUT_MAXPS_HIGH15 0x7D -#define TM6000_U_FIFO0 0x80 -#define TM6000_U_FIFO1 0x81 -#define TM6000_U_FIFO2 0x82 -#define TM6000_U_FIFO3 0x83 -#define TM6000_U_FIFO4 0x84 -#define TM6000_U_FIFO5 0x85 -#define TM6000_U_FIFO6 0x86 -#define TM6000_U_FIFO7 0x87 -#define TM6000_U_FIFO8 0x88 -#define TM6000_U_FIFO9 0x89 -#define TM6000_U_FIFO10 0x8A -#define TM6000_U_FIFO11 0x8B -#define TM6000_U_FIFO12 0x8C -#define TM6000_U_FIFO13 0x8D -#define TM6000_U_FIFO14 0x8E -#define TM6000_U_FIFO15 0x8F -#define TM6000_U_CFG_FIFO0 0x90 -#define TM6000_U_CFG_FIFO1 0x91 -#define TM6000_U_CFG_FIFO2 0x92 -#define TM6000_U_CFG_FIFO3 0x93 -#define TM6000_U_CFG_FIFO4 0x94 -#define TM6000_U_CFG_FIFO5 0x95 -#define TM6000_U_CFG_FIFO6 0x96 -#define TM6000_U_CFG_FIFO7 0x97 -#define TM6000_U_CFG_FIFO8 0x98 -#define TM6000_U_CFG_FIFO9 0x99 -#define TM6000_U_CFG_FIFO10 0x9A -#define TM6000_U_CFG_FIFO11 0x9B -#define TM6000_U_CFG_FIFO12 0x9C -#define TM6000_U_CFG_FIFO13 0x9D -#define TM6000_U_CFG_FIFO14 0x9E -#define TM6000_U_CFG_FIFO15 0x9F -#define TM6000_U_CTL_FIFO0 0xA0 -#define TM6000_U_CTL_FIFO1 0xA1 -#define TM6000_U_CTL_FIFO2 0xA2 -#define TM6000_U_CTL_FIFO3 0xA3 -#define TM6000_U_CTL_FIFO4 0xA4 -#define TM6000_U_CTL_FIFO5 0xA5 -#define TM6000_U_CTL_FIFO6 0xA6 -#define TM6000_U_CTL_FIFO7 0xA7 -#define TM6000_U_CTL_FIFO8 0xA8 -#define TM6000_U_CTL_FIFO9 0xA9 -#define TM6000_U_CTL_FIFO10 0xAA -#define TM6000_U_CTL_FIFO11 0xAB -#define TM6000_U_CTL_FIFO12 0xAC -#define TM6000_U_CTL_FIFO13 0xAD -#define TM6000_U_CTL_FIFO14 0xAE -#define TM6000_U_CTL_FIFO15 0xAF -#define TM6000_U_BC_LOW_FIFO0 0xB0 -#define TM6000_U_BC_LOW_FIFO1 0xB1 -#define TM6000_U_BC_LOW_FIFO2 0xB2 -#define TM6000_U_BC_LOW_FIFO3 0xB3 -#define TM6000_U_BC_LOW_FIFO4 0xB4 -#define TM6000_U_BC_LOW_FIFO5 0xB5 -#define TM6000_U_BC_LOW_FIFO6 0xB6 -#define TM6000_U_BC_LOW_FIFO7 0xB7 -#define TM6000_U_BC_LOW_FIFO8 0xB8 -#define TM6000_U_BC_LOW_FIFO9 0xB9 -#define TM6000_U_BC_LOW_FIFO10 0xBA -#define TM6000_U_BC_LOW_FIFO11 0xBB -#define TM6000_U_BC_LOW_FIFO12 0xBC -#define TM6000_U_BC_LOW_FIFO13 0xBD -#define TM6000_U_BC_LOW_FIFO14 0xBE -#define TM6000_U_BC_LOW_FIFO15 0xBF -#define TM6000_U_DATA_FIFO0 0xC0 -#define TM6000_U_DATA_FIFO1 0xC4 -#define TM6000_U_DATA_FIFO2 0xC8 -#define TM6000_U_DATA_FIFO3 0xCC -#define TM6000_U_DATA_FIFO4 0xD0 -#define TM6000_U_DATA_FIFO5 0xD4 -#define TM6000_U_DATA_FIFO6 0xD8 -#define TM6000_U_DATA_FIFO7 0xDC -#define TM6000_U_DATA_FIFO8 0xE0 -#define TM6000_U_DATA_FIFO9 0xE4 -#define TM6000_U_DATA_FIFO10 0xE8 -#define TM6000_U_DATA_FIFO11 0xEC -#define TM6000_U_DATA_FIFO12 0xF0 -#define TM6000_U_DATA_FIFO13 0xF4 -#define TM6000_U_DATA_FIFO14 0xF8 -#define TM6000_U_DATA_FIFO15 0xFC +#define TM6010_REQ05_R00_MAIN_CTRL 0x00 +#define TM6010_REQ05_R01_DEVADDR 0x01 +#define TM6010_REQ05_R02_TEST 0x02 +#define TM6010_REQ05_R04_SOFN0 0x04 +#define TM6010_REQ05_R05_SOFN1 0x05 +#define TM6010_REQ05_R06_SOFTM0 0x06 +#define TM6010_REQ05_R07_SOFTM1 0x07 +#define TM6010_REQ05_R08_PHY_TEST 0x08 +#define TM6010_REQ05_R09_VCTL 0x09 +#define TM6010_REQ05_R0A_VSTA 0x0A +#define TM6010_REQ05_R0B_CX_CFG 0x0B +#define TM6010_REQ05_R0C_ENDP0_REG0 0x0C +#define TM6010_REQ05_R10_GMASK 0x10 +#define TM6010_REQ05_R11_IMASK0 0x11 +#define TM6010_REQ05_R12_IMASK1 0x12 +#define TM6010_REQ05_R13_IMASK2 0x13 +#define TM6010_REQ05_R14_IMASK3 0x14 +#define TM6010_REQ05_R15_IMASK4 0x15 +#define TM6010_REQ05_R16_IMASK5 0x16 +#define TM6010_REQ05_R17_IMASK6 0x17 +#define TM6010_REQ05_R18_IMASK7 0x18 +#define TM6010_REQ05_R19_ZEROP0 0x19 +#define TM6010_REQ05_R1A_ZEROP1 0x1A +#define TM6010_REQ05_R1C_FIFO_EMP0 0x1C +#define TM6010_REQ05_R1D_FIFO_EMP1 0x1D +#define TM6010_REQ05_R20_IRQ_GROUP 0x20 +#define TM6010_REQ05_R21_IRQ_SOURCE0 0x21 +#define TM6010_REQ05_R22_IRQ_SOURCE1 0x22 +#define TM6010_REQ05_R23_IRQ_SOURCE2 0x23 +#define TM6010_REQ05_R24_IRQ_SOURCE3 0x24 +#define TM6010_REQ05_R25_IRQ_SOURCE4 0x25 +#define TM6010_REQ05_R26_IRQ_SOURCE5 0x26 +#define TM6010_REQ05_R27_IRQ_SOURCE6 0x27 +#define TM6010_REQ05_R28_IRQ_SOURCE7 0x28 +#define TM6010_REQ05_R29_SEQ_ERR0 0x29 +#define TM6010_REQ05_R2A_SEQ_ERR1 0x2A +#define TM6010_REQ05_R2B_SEQ_ABORT0 0x2B +#define TM6010_REQ05_R2C_SEQ_ABORT1 0x2C +#define TM6010_REQ05_R2D_TX_ZERO0 0x2D +#define TM6010_REQ05_R2E_TX_ZERO1 0x2E +#define TM6010_REQ05_R2F_IDLE_CNT 0x2F +#define TM6010_REQ05_R30_FNO_P1 0x30 +#define TM6010_REQ05_R31_FNO_P2 0x31 +#define TM6010_REQ05_R32_FNO_P3 0x32 +#define TM6010_REQ05_R33_FNO_P4 0x33 +#define TM6010_REQ05_R34_FNO_P5 0x34 +#define TM6010_REQ05_R35_FNO_P6 0x35 +#define TM6010_REQ05_R36_FNO_P7 0x36 +#define TM6010_REQ05_R37_FNO_P8 0x37 +#define TM6010_REQ05_R38_FNO_P9 0x38 +#define TM6010_REQ05_R30_FNO_P10 0x39 +#define TM6010_REQ05_R30_FNO_P11 0x3A +#define TM6010_REQ05_R30_FNO_P12 0x3B +#define TM6010_REQ05_R30_FNO_P13 0x3C +#define TM6010_REQ05_R30_FNO_P14 0x3D +#define TM6010_REQ05_R30_FNO_P15 0x3E +#define TM6010_REQ05_R40_IN_MAXPS_LOW1 0x40 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH1 0x41 +#define TM6010_REQ05_R42_IN_MAXPS_LOW2 0x42 +#define TM6010_REQ05_R43_IN_MAXPS_HIGH2 0x43 +#define TM6010_REQ05_R44_IN_MAXPS_LOW3 0x44 +#define TM6010_REQ05_R45_IN_MAXPS_HIGH3 0x45 +#define TM6010_REQ05_R46_IN_MAXPS_LOW4 0x46 +#define TM6010_REQ05_R47_IN_MAXPS_HIGH4 0x47 +#define TM6010_REQ05_R48_IN_MAXPS_LOW5 0x48 +#define TM6010_REQ05_R49_IN_MAXPS_HIGH5 0x49 +#define TM6010_REQ05_R4A_IN_MAXPS_LOW6 0x4A +#define TM6010_REQ05_R4B_IN_MAXPS_HIGH6 0x4B +#define TM6010_REQ05_R4C_IN_MAXPS_LOW7 0x4C +#define TM6010_REQ05_R4D_IN_MAXPS_HIGH7 0x4D +#define TM6010_REQ05_R4E_IN_MAXPS_LOW8 0x4E +#define TM6010_REQ05_R4F_IN_MAXPS_HIGH8 0x4F +#define TM6010_REQ05_R50_IN_MAXPS_LOW9 0x50 +#define TM6010_REQ05_R51_IN_MAXPS_HIGH9 0x51 +#define TM6010_REQ05_R40_IN_MAXPS_LOW10 0x52 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH10 0x53 +#define TM6010_REQ05_R40_IN_MAXPS_LOW11 0x54 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH11 0x55 +#define TM6010_REQ05_R40_IN_MAXPS_LOW12 0x56 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH12 0x57 +#define TM6010_REQ05_R40_IN_MAXPS_LOW13 0x58 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH13 0x59 +#define TM6010_REQ05_R40_IN_MAXPS_LOW14 0x5A +#define TM6010_REQ05_R41_IN_MAXPS_HIGH14 0x5B +#define TM6010_REQ05_R40_IN_MAXPS_LOW15 0x5C +#define TM6010_REQ05_R41_IN_MAXPS_HIGH15 0x5D +#define TM6010_REQ05_R60_OUT_MAXPS_LOW1 0x60 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH1 0x61 +#define TM6010_REQ05_R62_OUT_MAXPS_LOW2 0x62 +#define TM6010_REQ05_R63_OUT_MAXPS_HIGH2 0x63 +#define TM6010_REQ05_R64_OUT_MAXPS_LOW3 0x64 +#define TM6010_REQ05_R65_OUT_MAXPS_HIGH3 0x65 +#define TM6010_REQ05_R66_OUT_MAXPS_LOW4 0x66 +#define TM6010_REQ05_R67_OUT_MAXPS_HIGH4 0x67 +#define TM6010_REQ05_R68_OUT_MAXPS_LOW5 0x68 +#define TM6010_REQ05_R69_OUT_MAXPS_HIGH5 0x69 +#define TM6010_REQ05_R6A_OUT_MAXPS_LOW6 0x6A +#define TM6010_REQ05_R6B_OUT_MAXPS_HIGH6 0x6B +#define TM6010_REQ05_R6C_OUT_MAXPS_LOW7 0x6C +#define TM6010_REQ05_R6D_OUT_MAXPS_HIGH7 0x6D +#define TM6010_REQ05_R6E_OUT_MAXPS_LOW8 0x6E +#define TM6010_REQ05_R6F_OUT_MAXPS_HIGH8 0x6F +#define TM6010_REQ05_R70_OUT_MAXPS_LOW9 0x70 +#define TM6010_REQ05_R71_OUT_MAXPS_HIGH9 0x71 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW10 0x72 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH10 0x73 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW11 0x74 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH11 0x75 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW12 0x76 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH12 0x77 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW13 0x78 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH13 0x79 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW14 0x7A +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH14 0x7B +#define TM6010_REQ05_R60_OUT_MAXPS_LOW15 0x7C +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH15 0x7D +#define TM6010_REQ05_R80_FIFO0 0x80 +#define TM6010_REQ05_R81_FIFO1 0x81 +#define TM6010_REQ05_R82_FIFO2 0x82 +#define TM6010_REQ05_R83_FIFO3 0x83 +#define TM6010_REQ05_R84_FIFO4 0x84 +#define TM6010_REQ05_R85_FIFO5 0x85 +#define TM6010_REQ05_R86_FIFO6 0x86 +#define TM6010_REQ05_R87_FIFO7 0x87 +#define TM6010_REQ05_R88_FIFO8 0x88 +#define TM6010_REQ05_R89_FIFO9 0x89 +#define TM6010_REQ05_R81_FIFO10 0x8A +#define TM6010_REQ05_R81_FIFO11 0x8B +#define TM6010_REQ05_R81_FIFO12 0x8C +#define TM6010_REQ05_R81_FIFO13 0x8D +#define TM6010_REQ05_R81_FIFO14 0x8E +#define TM6010_REQ05_R81_FIFO15 0x8F +#define TM6010_REQ05_R90_CFG_FIFO0 0x90 +#define TM6010_REQ05_R91_CFG_FIFO1 0x91 +#define TM6010_REQ05_R92_CFG_FIFO2 0x92 +#define TM6010_REQ05_R93_CFG_FIFO3 0x93 +#define TM6010_REQ05_R94_CFG_FIFO4 0x94 +#define TM6010_REQ05_R95_CFG_FIFO5 0x95 +#define TM6010_REQ05_R96_CFG_FIFO6 0x96 +#define TM6010_REQ05_R97_CFG_FIFO7 0x97 +#define TM6010_REQ05_R98_CFG_FIFO8 0x98 +#define TM6010_REQ05_R99_CFG_FIFO9 0x99 +#define TM6010_REQ05_R91_CFG_FIFO10 0x9A +#define TM6010_REQ05_R91_CFG_FIFO11 0x9B +#define TM6010_REQ05_R91_CFG_FIFO12 0x9C +#define TM6010_REQ05_R91_CFG_FIFO13 0x9D +#define TM6010_REQ05_R91_CFG_FIFO14 0x9E +#define TM6010_REQ05_R91_CFG_FIFO15 0x9F +#define TM6010_REQ05_RA0_CTL_FIFO0 0xA0 +#define TM6010_REQ05_RA1_CTL_FIFO1 0xA1 +#define TM6010_REQ05_RA2_CTL_FIFO2 0xA2 +#define TM6010_REQ05_RA3_CTL_FIFO3 0xA3 +#define TM6010_REQ05_RA4_CTL_FIFO4 0xA4 +#define TM6010_REQ05_RA5_CTL_FIFO5 0xA5 +#define TM6010_REQ05_RA6_CTL_FIFO6 0xA6 +#define TM6010_REQ05_RA7_CTL_FIFO7 0xA7 +#define TM6010_REQ05_RA8_CTL_FIFO8 0xA8 +#define TM6010_REQ05_RA9_CTL_FIFO9 0xA9 +#define TM6010_REQ05_RA1_CTL_FIFO10 0xAA +#define TM6010_REQ05_RA1_CTL_FIFO11 0xAB +#define TM6010_REQ05_RA1_CTL_FIFO12 0xAC +#define TM6010_REQ05_RA1_CTL_FIFO13 0xAD +#define TM6010_REQ05_RA1_CTL_FIFO14 0xAE +#define TM6010_REQ05_RA1_CTL_FIFO15 0xAF +#define TM6010_REQ05_RB0_BC_LOW_FIFO0 0xB0 +#define TM6010_REQ05_RB1_BC_LOW_FIFO1 0xB1 +#define TM6010_REQ05_RB2_BC_LOW_FIFO2 0xB2 +#define TM6010_REQ05_RB3_BC_LOW_FIFO3 0xB3 +#define TM6010_REQ05_RB4_BC_LOW_FIFO4 0xB4 +#define TM6010_REQ05_RB5_BC_LOW_FIFO5 0xB5 +#define TM6010_REQ05_RB6_BC_LOW_FIFO6 0xB6 +#define TM6010_REQ05_RB7_BC_LOW_FIFO7 0xB7 +#define TM6010_REQ05_RB8_BC_LOW_FIFO8 0xB8 +#define TM6010_REQ05_RB9_BC_LOW_FIFO9 0xB9 +#define TM6010_REQ05_RB1_BC_LOW_FIFO10 0xBA +#define TM6010_REQ05_RB1_BC_LOW_FIFO11 0xBB +#define TM6010_REQ05_RB1_BC_LOW_FIFO12 0xBC +#define TM6010_REQ05_RB1_BC_LOW_FIFO13 0xBD +#define TM6010_REQ05_RB1_BC_LOW_FIFO14 0xBE +#define TM6010_REQ05_RB1_BC_LOW_FIFO15 0xBF +#define TM6010_REQ05_RC0_DATA_FIFO0 0xC0 +#define TM6010_REQ05_RC4_DATA_FIFO1 0xC4 +#define TM6010_REQ05_RC8_DATA_FIFO2 0xC8 +#define TM6010_REQ05_RCC_DATA_FIFO3 0xCC +#define TM6010_REQ05_RD0_DATA_FIFO4 0xD0 +#define TM6010_REQ05_RD4_DATA_FIFO5 0xD4 +#define TM6010_REQ05_RD8_DATA_FIFO6 0xD8 +#define TM6010_REQ05_RDC_DATA_FIFO7 0xDC +#define TM6010_REQ05_RE0_DATA_FIFO8 0xE0 +#define TM6010_REQ05_RE4_DATA_FIFO9 0xE4 +#define TM6010_REQ05_RC4_DATA_FIFO10 0xE8 +#define TM6010_REQ05_RC4_DATA_FIFO11 0xEC +#define TM6010_REQ05_RC4_DATA_FIFO12 0xF0 +#define TM6010_REQ05_RC4_DATA_FIFO13 0xF4 +#define TM6010_REQ05_RC4_DATA_FIFO14 0xF8 +#define TM6010_REQ05_RC4_DATA_FIFO15 0xFC /* Define TM6000/TM6010 Audio decoder registers */ #define TM6010_REQ08_R00_A_VERSION 0x08, 0x00 -- GitLab From d9a724073633605def45be1f879a7406af469c87 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 10:26:45 -0300 Subject: [PATCH 178/534] V4L/DVB: tm6000: add request to registers of the group 05 Yet another script magic. This time, the change were generated by this script: cat tm6000-regs.h |perl -ne 'if (m/^(\#define TM6010_REQ)(05)([^\s]+)(\s+)0x([A-F0-9].)/) { \ $name="$1$2$3"; $sp=$4; $req=$2; $val=$5; $val=~tr/A-F/a-f/; \ printf "$name%s0x%s, 0x%s\n", $sp, $req, $val; } else { print $_ }' \ >a; mv a tm6000-regs.h Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-regs.h | 392 +++++++++++++-------------- 1 file changed, 196 insertions(+), 196 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-regs.h b/drivers/staging/tm6000/tm6000-regs.h index 6be16b798f6b..1c5289c971fa 100644 --- a/drivers/staging/tm6000/tm6000-regs.h +++ b/drivers/staging/tm6000/tm6000-regs.h @@ -280,202 +280,202 @@ enum { #define TM6010_REQ07_RFF_SOFT_RESET 0x07, 0xff /* Define TM6000/TM6010 USB registers */ -#define TM6010_REQ05_R00_MAIN_CTRL 0x00 -#define TM6010_REQ05_R01_DEVADDR 0x01 -#define TM6010_REQ05_R02_TEST 0x02 -#define TM6010_REQ05_R04_SOFN0 0x04 -#define TM6010_REQ05_R05_SOFN1 0x05 -#define TM6010_REQ05_R06_SOFTM0 0x06 -#define TM6010_REQ05_R07_SOFTM1 0x07 -#define TM6010_REQ05_R08_PHY_TEST 0x08 -#define TM6010_REQ05_R09_VCTL 0x09 -#define TM6010_REQ05_R0A_VSTA 0x0A -#define TM6010_REQ05_R0B_CX_CFG 0x0B -#define TM6010_REQ05_R0C_ENDP0_REG0 0x0C -#define TM6010_REQ05_R10_GMASK 0x10 -#define TM6010_REQ05_R11_IMASK0 0x11 -#define TM6010_REQ05_R12_IMASK1 0x12 -#define TM6010_REQ05_R13_IMASK2 0x13 -#define TM6010_REQ05_R14_IMASK3 0x14 -#define TM6010_REQ05_R15_IMASK4 0x15 -#define TM6010_REQ05_R16_IMASK5 0x16 -#define TM6010_REQ05_R17_IMASK6 0x17 -#define TM6010_REQ05_R18_IMASK7 0x18 -#define TM6010_REQ05_R19_ZEROP0 0x19 -#define TM6010_REQ05_R1A_ZEROP1 0x1A -#define TM6010_REQ05_R1C_FIFO_EMP0 0x1C -#define TM6010_REQ05_R1D_FIFO_EMP1 0x1D -#define TM6010_REQ05_R20_IRQ_GROUP 0x20 -#define TM6010_REQ05_R21_IRQ_SOURCE0 0x21 -#define TM6010_REQ05_R22_IRQ_SOURCE1 0x22 -#define TM6010_REQ05_R23_IRQ_SOURCE2 0x23 -#define TM6010_REQ05_R24_IRQ_SOURCE3 0x24 -#define TM6010_REQ05_R25_IRQ_SOURCE4 0x25 -#define TM6010_REQ05_R26_IRQ_SOURCE5 0x26 -#define TM6010_REQ05_R27_IRQ_SOURCE6 0x27 -#define TM6010_REQ05_R28_IRQ_SOURCE7 0x28 -#define TM6010_REQ05_R29_SEQ_ERR0 0x29 -#define TM6010_REQ05_R2A_SEQ_ERR1 0x2A -#define TM6010_REQ05_R2B_SEQ_ABORT0 0x2B -#define TM6010_REQ05_R2C_SEQ_ABORT1 0x2C -#define TM6010_REQ05_R2D_TX_ZERO0 0x2D -#define TM6010_REQ05_R2E_TX_ZERO1 0x2E -#define TM6010_REQ05_R2F_IDLE_CNT 0x2F -#define TM6010_REQ05_R30_FNO_P1 0x30 -#define TM6010_REQ05_R31_FNO_P2 0x31 -#define TM6010_REQ05_R32_FNO_P3 0x32 -#define TM6010_REQ05_R33_FNO_P4 0x33 -#define TM6010_REQ05_R34_FNO_P5 0x34 -#define TM6010_REQ05_R35_FNO_P6 0x35 -#define TM6010_REQ05_R36_FNO_P7 0x36 -#define TM6010_REQ05_R37_FNO_P8 0x37 -#define TM6010_REQ05_R38_FNO_P9 0x38 -#define TM6010_REQ05_R30_FNO_P10 0x39 -#define TM6010_REQ05_R30_FNO_P11 0x3A -#define TM6010_REQ05_R30_FNO_P12 0x3B -#define TM6010_REQ05_R30_FNO_P13 0x3C -#define TM6010_REQ05_R30_FNO_P14 0x3D -#define TM6010_REQ05_R30_FNO_P15 0x3E -#define TM6010_REQ05_R40_IN_MAXPS_LOW1 0x40 -#define TM6010_REQ05_R41_IN_MAXPS_HIGH1 0x41 -#define TM6010_REQ05_R42_IN_MAXPS_LOW2 0x42 -#define TM6010_REQ05_R43_IN_MAXPS_HIGH2 0x43 -#define TM6010_REQ05_R44_IN_MAXPS_LOW3 0x44 -#define TM6010_REQ05_R45_IN_MAXPS_HIGH3 0x45 -#define TM6010_REQ05_R46_IN_MAXPS_LOW4 0x46 -#define TM6010_REQ05_R47_IN_MAXPS_HIGH4 0x47 -#define TM6010_REQ05_R48_IN_MAXPS_LOW5 0x48 -#define TM6010_REQ05_R49_IN_MAXPS_HIGH5 0x49 -#define TM6010_REQ05_R4A_IN_MAXPS_LOW6 0x4A -#define TM6010_REQ05_R4B_IN_MAXPS_HIGH6 0x4B -#define TM6010_REQ05_R4C_IN_MAXPS_LOW7 0x4C -#define TM6010_REQ05_R4D_IN_MAXPS_HIGH7 0x4D -#define TM6010_REQ05_R4E_IN_MAXPS_LOW8 0x4E -#define TM6010_REQ05_R4F_IN_MAXPS_HIGH8 0x4F -#define TM6010_REQ05_R50_IN_MAXPS_LOW9 0x50 -#define TM6010_REQ05_R51_IN_MAXPS_HIGH9 0x51 -#define TM6010_REQ05_R40_IN_MAXPS_LOW10 0x52 -#define TM6010_REQ05_R41_IN_MAXPS_HIGH10 0x53 -#define TM6010_REQ05_R40_IN_MAXPS_LOW11 0x54 -#define TM6010_REQ05_R41_IN_MAXPS_HIGH11 0x55 -#define TM6010_REQ05_R40_IN_MAXPS_LOW12 0x56 -#define TM6010_REQ05_R41_IN_MAXPS_HIGH12 0x57 -#define TM6010_REQ05_R40_IN_MAXPS_LOW13 0x58 -#define TM6010_REQ05_R41_IN_MAXPS_HIGH13 0x59 -#define TM6010_REQ05_R40_IN_MAXPS_LOW14 0x5A -#define TM6010_REQ05_R41_IN_MAXPS_HIGH14 0x5B -#define TM6010_REQ05_R40_IN_MAXPS_LOW15 0x5C -#define TM6010_REQ05_R41_IN_MAXPS_HIGH15 0x5D -#define TM6010_REQ05_R60_OUT_MAXPS_LOW1 0x60 -#define TM6010_REQ05_R61_OUT_MAXPS_HIGH1 0x61 -#define TM6010_REQ05_R62_OUT_MAXPS_LOW2 0x62 -#define TM6010_REQ05_R63_OUT_MAXPS_HIGH2 0x63 -#define TM6010_REQ05_R64_OUT_MAXPS_LOW3 0x64 -#define TM6010_REQ05_R65_OUT_MAXPS_HIGH3 0x65 -#define TM6010_REQ05_R66_OUT_MAXPS_LOW4 0x66 -#define TM6010_REQ05_R67_OUT_MAXPS_HIGH4 0x67 -#define TM6010_REQ05_R68_OUT_MAXPS_LOW5 0x68 -#define TM6010_REQ05_R69_OUT_MAXPS_HIGH5 0x69 -#define TM6010_REQ05_R6A_OUT_MAXPS_LOW6 0x6A -#define TM6010_REQ05_R6B_OUT_MAXPS_HIGH6 0x6B -#define TM6010_REQ05_R6C_OUT_MAXPS_LOW7 0x6C -#define TM6010_REQ05_R6D_OUT_MAXPS_HIGH7 0x6D -#define TM6010_REQ05_R6E_OUT_MAXPS_LOW8 0x6E -#define TM6010_REQ05_R6F_OUT_MAXPS_HIGH8 0x6F -#define TM6010_REQ05_R70_OUT_MAXPS_LOW9 0x70 -#define TM6010_REQ05_R71_OUT_MAXPS_HIGH9 0x71 -#define TM6010_REQ05_R60_OUT_MAXPS_LOW10 0x72 -#define TM6010_REQ05_R61_OUT_MAXPS_HIGH10 0x73 -#define TM6010_REQ05_R60_OUT_MAXPS_LOW11 0x74 -#define TM6010_REQ05_R61_OUT_MAXPS_HIGH11 0x75 -#define TM6010_REQ05_R60_OUT_MAXPS_LOW12 0x76 -#define TM6010_REQ05_R61_OUT_MAXPS_HIGH12 0x77 -#define TM6010_REQ05_R60_OUT_MAXPS_LOW13 0x78 -#define TM6010_REQ05_R61_OUT_MAXPS_HIGH13 0x79 -#define TM6010_REQ05_R60_OUT_MAXPS_LOW14 0x7A -#define TM6010_REQ05_R61_OUT_MAXPS_HIGH14 0x7B -#define TM6010_REQ05_R60_OUT_MAXPS_LOW15 0x7C -#define TM6010_REQ05_R61_OUT_MAXPS_HIGH15 0x7D -#define TM6010_REQ05_R80_FIFO0 0x80 -#define TM6010_REQ05_R81_FIFO1 0x81 -#define TM6010_REQ05_R82_FIFO2 0x82 -#define TM6010_REQ05_R83_FIFO3 0x83 -#define TM6010_REQ05_R84_FIFO4 0x84 -#define TM6010_REQ05_R85_FIFO5 0x85 -#define TM6010_REQ05_R86_FIFO6 0x86 -#define TM6010_REQ05_R87_FIFO7 0x87 -#define TM6010_REQ05_R88_FIFO8 0x88 -#define TM6010_REQ05_R89_FIFO9 0x89 -#define TM6010_REQ05_R81_FIFO10 0x8A -#define TM6010_REQ05_R81_FIFO11 0x8B -#define TM6010_REQ05_R81_FIFO12 0x8C -#define TM6010_REQ05_R81_FIFO13 0x8D -#define TM6010_REQ05_R81_FIFO14 0x8E -#define TM6010_REQ05_R81_FIFO15 0x8F -#define TM6010_REQ05_R90_CFG_FIFO0 0x90 -#define TM6010_REQ05_R91_CFG_FIFO1 0x91 -#define TM6010_REQ05_R92_CFG_FIFO2 0x92 -#define TM6010_REQ05_R93_CFG_FIFO3 0x93 -#define TM6010_REQ05_R94_CFG_FIFO4 0x94 -#define TM6010_REQ05_R95_CFG_FIFO5 0x95 -#define TM6010_REQ05_R96_CFG_FIFO6 0x96 -#define TM6010_REQ05_R97_CFG_FIFO7 0x97 -#define TM6010_REQ05_R98_CFG_FIFO8 0x98 -#define TM6010_REQ05_R99_CFG_FIFO9 0x99 -#define TM6010_REQ05_R91_CFG_FIFO10 0x9A -#define TM6010_REQ05_R91_CFG_FIFO11 0x9B -#define TM6010_REQ05_R91_CFG_FIFO12 0x9C -#define TM6010_REQ05_R91_CFG_FIFO13 0x9D -#define TM6010_REQ05_R91_CFG_FIFO14 0x9E -#define TM6010_REQ05_R91_CFG_FIFO15 0x9F -#define TM6010_REQ05_RA0_CTL_FIFO0 0xA0 -#define TM6010_REQ05_RA1_CTL_FIFO1 0xA1 -#define TM6010_REQ05_RA2_CTL_FIFO2 0xA2 -#define TM6010_REQ05_RA3_CTL_FIFO3 0xA3 -#define TM6010_REQ05_RA4_CTL_FIFO4 0xA4 -#define TM6010_REQ05_RA5_CTL_FIFO5 0xA5 -#define TM6010_REQ05_RA6_CTL_FIFO6 0xA6 -#define TM6010_REQ05_RA7_CTL_FIFO7 0xA7 -#define TM6010_REQ05_RA8_CTL_FIFO8 0xA8 -#define TM6010_REQ05_RA9_CTL_FIFO9 0xA9 -#define TM6010_REQ05_RA1_CTL_FIFO10 0xAA -#define TM6010_REQ05_RA1_CTL_FIFO11 0xAB -#define TM6010_REQ05_RA1_CTL_FIFO12 0xAC -#define TM6010_REQ05_RA1_CTL_FIFO13 0xAD -#define TM6010_REQ05_RA1_CTL_FIFO14 0xAE -#define TM6010_REQ05_RA1_CTL_FIFO15 0xAF -#define TM6010_REQ05_RB0_BC_LOW_FIFO0 0xB0 -#define TM6010_REQ05_RB1_BC_LOW_FIFO1 0xB1 -#define TM6010_REQ05_RB2_BC_LOW_FIFO2 0xB2 -#define TM6010_REQ05_RB3_BC_LOW_FIFO3 0xB3 -#define TM6010_REQ05_RB4_BC_LOW_FIFO4 0xB4 -#define TM6010_REQ05_RB5_BC_LOW_FIFO5 0xB5 -#define TM6010_REQ05_RB6_BC_LOW_FIFO6 0xB6 -#define TM6010_REQ05_RB7_BC_LOW_FIFO7 0xB7 -#define TM6010_REQ05_RB8_BC_LOW_FIFO8 0xB8 -#define TM6010_REQ05_RB9_BC_LOW_FIFO9 0xB9 -#define TM6010_REQ05_RB1_BC_LOW_FIFO10 0xBA -#define TM6010_REQ05_RB1_BC_LOW_FIFO11 0xBB -#define TM6010_REQ05_RB1_BC_LOW_FIFO12 0xBC -#define TM6010_REQ05_RB1_BC_LOW_FIFO13 0xBD -#define TM6010_REQ05_RB1_BC_LOW_FIFO14 0xBE -#define TM6010_REQ05_RB1_BC_LOW_FIFO15 0xBF -#define TM6010_REQ05_RC0_DATA_FIFO0 0xC0 -#define TM6010_REQ05_RC4_DATA_FIFO1 0xC4 -#define TM6010_REQ05_RC8_DATA_FIFO2 0xC8 -#define TM6010_REQ05_RCC_DATA_FIFO3 0xCC -#define TM6010_REQ05_RD0_DATA_FIFO4 0xD0 -#define TM6010_REQ05_RD4_DATA_FIFO5 0xD4 -#define TM6010_REQ05_RD8_DATA_FIFO6 0xD8 -#define TM6010_REQ05_RDC_DATA_FIFO7 0xDC -#define TM6010_REQ05_RE0_DATA_FIFO8 0xE0 -#define TM6010_REQ05_RE4_DATA_FIFO9 0xE4 -#define TM6010_REQ05_RC4_DATA_FIFO10 0xE8 -#define TM6010_REQ05_RC4_DATA_FIFO11 0xEC -#define TM6010_REQ05_RC4_DATA_FIFO12 0xF0 -#define TM6010_REQ05_RC4_DATA_FIFO13 0xF4 -#define TM6010_REQ05_RC4_DATA_FIFO14 0xF8 -#define TM6010_REQ05_RC4_DATA_FIFO15 0xFC +#define TM6010_REQ05_R00_MAIN_CTRL 0x05, 0x00 +#define TM6010_REQ05_R01_DEVADDR 0x05, 0x01 +#define TM6010_REQ05_R02_TEST 0x05, 0x02 +#define TM6010_REQ05_R04_SOFN0 0x05, 0x04 +#define TM6010_REQ05_R05_SOFN1 0x05, 0x05 +#define TM6010_REQ05_R06_SOFTM0 0x05, 0x06 +#define TM6010_REQ05_R07_SOFTM1 0x05, 0x07 +#define TM6010_REQ05_R08_PHY_TEST 0x05, 0x08 +#define TM6010_REQ05_R09_VCTL 0x05, 0x09 +#define TM6010_REQ05_R0A_VSTA 0x05, 0x0a +#define TM6010_REQ05_R0B_CX_CFG 0x05, 0x0b +#define TM6010_REQ05_R0C_ENDP0_REG0 0x05, 0x0c +#define TM6010_REQ05_R10_GMASK 0x05, 0x10 +#define TM6010_REQ05_R11_IMASK0 0x05, 0x11 +#define TM6010_REQ05_R12_IMASK1 0x05, 0x12 +#define TM6010_REQ05_R13_IMASK2 0x05, 0x13 +#define TM6010_REQ05_R14_IMASK3 0x05, 0x14 +#define TM6010_REQ05_R15_IMASK4 0x05, 0x15 +#define TM6010_REQ05_R16_IMASK5 0x05, 0x16 +#define TM6010_REQ05_R17_IMASK6 0x05, 0x17 +#define TM6010_REQ05_R18_IMASK7 0x05, 0x18 +#define TM6010_REQ05_R19_ZEROP0 0x05, 0x19 +#define TM6010_REQ05_R1A_ZEROP1 0x05, 0x1a +#define TM6010_REQ05_R1C_FIFO_EMP0 0x05, 0x1c +#define TM6010_REQ05_R1D_FIFO_EMP1 0x05, 0x1d +#define TM6010_REQ05_R20_IRQ_GROUP 0x05, 0x20 +#define TM6010_REQ05_R21_IRQ_SOURCE0 0x05, 0x21 +#define TM6010_REQ05_R22_IRQ_SOURCE1 0x05, 0x22 +#define TM6010_REQ05_R23_IRQ_SOURCE2 0x05, 0x23 +#define TM6010_REQ05_R24_IRQ_SOURCE3 0x05, 0x24 +#define TM6010_REQ05_R25_IRQ_SOURCE4 0x05, 0x25 +#define TM6010_REQ05_R26_IRQ_SOURCE5 0x05, 0x26 +#define TM6010_REQ05_R27_IRQ_SOURCE6 0x05, 0x27 +#define TM6010_REQ05_R28_IRQ_SOURCE7 0x05, 0x28 +#define TM6010_REQ05_R29_SEQ_ERR0 0x05, 0x29 +#define TM6010_REQ05_R2A_SEQ_ERR1 0x05, 0x2a +#define TM6010_REQ05_R2B_SEQ_ABORT0 0x05, 0x2b +#define TM6010_REQ05_R2C_SEQ_ABORT1 0x05, 0x2c +#define TM6010_REQ05_R2D_TX_ZERO0 0x05, 0x2d +#define TM6010_REQ05_R2E_TX_ZERO1 0x05, 0x2e +#define TM6010_REQ05_R2F_IDLE_CNT 0x05, 0x2f +#define TM6010_REQ05_R30_FNO_P1 0x05, 0x30 +#define TM6010_REQ05_R31_FNO_P2 0x05, 0x31 +#define TM6010_REQ05_R32_FNO_P3 0x05, 0x32 +#define TM6010_REQ05_R33_FNO_P4 0x05, 0x33 +#define TM6010_REQ05_R34_FNO_P5 0x05, 0x34 +#define TM6010_REQ05_R35_FNO_P6 0x05, 0x35 +#define TM6010_REQ05_R36_FNO_P7 0x05, 0x36 +#define TM6010_REQ05_R37_FNO_P8 0x05, 0x37 +#define TM6010_REQ05_R38_FNO_P9 0x05, 0x38 +#define TM6010_REQ05_R30_FNO_P10 0x05, 0x39 +#define TM6010_REQ05_R30_FNO_P11 0x05, 0x3a +#define TM6010_REQ05_R30_FNO_P12 0x05, 0x3b +#define TM6010_REQ05_R30_FNO_P13 0x05, 0x3c +#define TM6010_REQ05_R30_FNO_P14 0x05, 0x3d +#define TM6010_REQ05_R30_FNO_P15 0x05, 0x3e +#define TM6010_REQ05_R40_IN_MAXPS_LOW1 0x05, 0x40 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH1 0x05, 0x41 +#define TM6010_REQ05_R42_IN_MAXPS_LOW2 0x05, 0x42 +#define TM6010_REQ05_R43_IN_MAXPS_HIGH2 0x05, 0x43 +#define TM6010_REQ05_R44_IN_MAXPS_LOW3 0x05, 0x44 +#define TM6010_REQ05_R45_IN_MAXPS_HIGH3 0x05, 0x45 +#define TM6010_REQ05_R46_IN_MAXPS_LOW4 0x05, 0x46 +#define TM6010_REQ05_R47_IN_MAXPS_HIGH4 0x05, 0x47 +#define TM6010_REQ05_R48_IN_MAXPS_LOW5 0x05, 0x48 +#define TM6010_REQ05_R49_IN_MAXPS_HIGH5 0x05, 0x49 +#define TM6010_REQ05_R4A_IN_MAXPS_LOW6 0x05, 0x4a +#define TM6010_REQ05_R4B_IN_MAXPS_HIGH6 0x05, 0x4b +#define TM6010_REQ05_R4C_IN_MAXPS_LOW7 0x05, 0x4c +#define TM6010_REQ05_R4D_IN_MAXPS_HIGH7 0x05, 0x4d +#define TM6010_REQ05_R4E_IN_MAXPS_LOW8 0x05, 0x4e +#define TM6010_REQ05_R4F_IN_MAXPS_HIGH8 0x05, 0x4f +#define TM6010_REQ05_R50_IN_MAXPS_LOW9 0x05, 0x50 +#define TM6010_REQ05_R51_IN_MAXPS_HIGH9 0x05, 0x51 +#define TM6010_REQ05_R40_IN_MAXPS_LOW10 0x05, 0x52 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH10 0x05, 0x53 +#define TM6010_REQ05_R40_IN_MAXPS_LOW11 0x05, 0x54 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH11 0x05, 0x55 +#define TM6010_REQ05_R40_IN_MAXPS_LOW12 0x05, 0x56 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH12 0x05, 0x57 +#define TM6010_REQ05_R40_IN_MAXPS_LOW13 0x05, 0x58 +#define TM6010_REQ05_R41_IN_MAXPS_HIGH13 0x05, 0x59 +#define TM6010_REQ05_R40_IN_MAXPS_LOW14 0x05, 0x5a +#define TM6010_REQ05_R41_IN_MAXPS_HIGH14 0x05, 0x5b +#define TM6010_REQ05_R40_IN_MAXPS_LOW15 0x05, 0x5c +#define TM6010_REQ05_R41_IN_MAXPS_HIGH15 0x05, 0x5d +#define TM6010_REQ05_R60_OUT_MAXPS_LOW1 0x05, 0x60 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH1 0x05, 0x61 +#define TM6010_REQ05_R62_OUT_MAXPS_LOW2 0x05, 0x62 +#define TM6010_REQ05_R63_OUT_MAXPS_HIGH2 0x05, 0x63 +#define TM6010_REQ05_R64_OUT_MAXPS_LOW3 0x05, 0x64 +#define TM6010_REQ05_R65_OUT_MAXPS_HIGH3 0x05, 0x65 +#define TM6010_REQ05_R66_OUT_MAXPS_LOW4 0x05, 0x66 +#define TM6010_REQ05_R67_OUT_MAXPS_HIGH4 0x05, 0x67 +#define TM6010_REQ05_R68_OUT_MAXPS_LOW5 0x05, 0x68 +#define TM6010_REQ05_R69_OUT_MAXPS_HIGH5 0x05, 0x69 +#define TM6010_REQ05_R6A_OUT_MAXPS_LOW6 0x05, 0x6a +#define TM6010_REQ05_R6B_OUT_MAXPS_HIGH6 0x05, 0x6b +#define TM6010_REQ05_R6C_OUT_MAXPS_LOW7 0x05, 0x6c +#define TM6010_REQ05_R6D_OUT_MAXPS_HIGH7 0x05, 0x6d +#define TM6010_REQ05_R6E_OUT_MAXPS_LOW8 0x05, 0x6e +#define TM6010_REQ05_R6F_OUT_MAXPS_HIGH8 0x05, 0x6f +#define TM6010_REQ05_R70_OUT_MAXPS_LOW9 0x05, 0x70 +#define TM6010_REQ05_R71_OUT_MAXPS_HIGH9 0x05, 0x71 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW10 0x05, 0x72 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH10 0x05, 0x73 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW11 0x05, 0x74 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH11 0x05, 0x75 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW12 0x05, 0x76 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH12 0x05, 0x77 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW13 0x05, 0x78 +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH13 0x05, 0x79 +#define TM6010_REQ05_R60_OUT_MAXPS_LOW14 0x05, 0x7a +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH14 0x05, 0x7b +#define TM6010_REQ05_R60_OUT_MAXPS_LOW15 0x05, 0x7c +#define TM6010_REQ05_R61_OUT_MAXPS_HIGH15 0x05, 0x7d +#define TM6010_REQ05_R80_FIFO0 0x05, 0x80 +#define TM6010_REQ05_R81_FIFO1 0x05, 0x81 +#define TM6010_REQ05_R82_FIFO2 0x05, 0x82 +#define TM6010_REQ05_R83_FIFO3 0x05, 0x83 +#define TM6010_REQ05_R84_FIFO4 0x05, 0x84 +#define TM6010_REQ05_R85_FIFO5 0x05, 0x85 +#define TM6010_REQ05_R86_FIFO6 0x05, 0x86 +#define TM6010_REQ05_R87_FIFO7 0x05, 0x87 +#define TM6010_REQ05_R88_FIFO8 0x05, 0x88 +#define TM6010_REQ05_R89_FIFO9 0x05, 0x89 +#define TM6010_REQ05_R81_FIFO10 0x05, 0x8a +#define TM6010_REQ05_R81_FIFO11 0x05, 0x8b +#define TM6010_REQ05_R81_FIFO12 0x05, 0x8c +#define TM6010_REQ05_R81_FIFO13 0x05, 0x8d +#define TM6010_REQ05_R81_FIFO14 0x05, 0x8e +#define TM6010_REQ05_R81_FIFO15 0x05, 0x8f +#define TM6010_REQ05_R90_CFG_FIFO0 0x05, 0x90 +#define TM6010_REQ05_R91_CFG_FIFO1 0x05, 0x91 +#define TM6010_REQ05_R92_CFG_FIFO2 0x05, 0x92 +#define TM6010_REQ05_R93_CFG_FIFO3 0x05, 0x93 +#define TM6010_REQ05_R94_CFG_FIFO4 0x05, 0x94 +#define TM6010_REQ05_R95_CFG_FIFO5 0x05, 0x95 +#define TM6010_REQ05_R96_CFG_FIFO6 0x05, 0x96 +#define TM6010_REQ05_R97_CFG_FIFO7 0x05, 0x97 +#define TM6010_REQ05_R98_CFG_FIFO8 0x05, 0x98 +#define TM6010_REQ05_R99_CFG_FIFO9 0x05, 0x99 +#define TM6010_REQ05_R91_CFG_FIFO10 0x05, 0x9a +#define TM6010_REQ05_R91_CFG_FIFO11 0x05, 0x9b +#define TM6010_REQ05_R91_CFG_FIFO12 0x05, 0x9c +#define TM6010_REQ05_R91_CFG_FIFO13 0x05, 0x9d +#define TM6010_REQ05_R91_CFG_FIFO14 0x05, 0x9e +#define TM6010_REQ05_R91_CFG_FIFO15 0x05, 0x9f +#define TM6010_REQ05_RA0_CTL_FIFO0 0x05, 0xa0 +#define TM6010_REQ05_RA1_CTL_FIFO1 0x05, 0xa1 +#define TM6010_REQ05_RA2_CTL_FIFO2 0x05, 0xa2 +#define TM6010_REQ05_RA3_CTL_FIFO3 0x05, 0xa3 +#define TM6010_REQ05_RA4_CTL_FIFO4 0x05, 0xa4 +#define TM6010_REQ05_RA5_CTL_FIFO5 0x05, 0xa5 +#define TM6010_REQ05_RA6_CTL_FIFO6 0x05, 0xa6 +#define TM6010_REQ05_RA7_CTL_FIFO7 0x05, 0xa7 +#define TM6010_REQ05_RA8_CTL_FIFO8 0x05, 0xa8 +#define TM6010_REQ05_RA9_CTL_FIFO9 0x05, 0xa9 +#define TM6010_REQ05_RA1_CTL_FIFO10 0x05, 0xaa +#define TM6010_REQ05_RA1_CTL_FIFO11 0x05, 0xab +#define TM6010_REQ05_RA1_CTL_FIFO12 0x05, 0xac +#define TM6010_REQ05_RA1_CTL_FIFO13 0x05, 0xad +#define TM6010_REQ05_RA1_CTL_FIFO14 0x05, 0xae +#define TM6010_REQ05_RA1_CTL_FIFO15 0x05, 0xaf +#define TM6010_REQ05_RB0_BC_LOW_FIFO0 0x05, 0xb0 +#define TM6010_REQ05_RB1_BC_LOW_FIFO1 0x05, 0xb1 +#define TM6010_REQ05_RB2_BC_LOW_FIFO2 0x05, 0xb2 +#define TM6010_REQ05_RB3_BC_LOW_FIFO3 0x05, 0xb3 +#define TM6010_REQ05_RB4_BC_LOW_FIFO4 0x05, 0xb4 +#define TM6010_REQ05_RB5_BC_LOW_FIFO5 0x05, 0xb5 +#define TM6010_REQ05_RB6_BC_LOW_FIFO6 0x05, 0xb6 +#define TM6010_REQ05_RB7_BC_LOW_FIFO7 0x05, 0xb7 +#define TM6010_REQ05_RB8_BC_LOW_FIFO8 0x05, 0xb8 +#define TM6010_REQ05_RB9_BC_LOW_FIFO9 0x05, 0xb9 +#define TM6010_REQ05_RB1_BC_LOW_FIFO10 0x05, 0xba +#define TM6010_REQ05_RB1_BC_LOW_FIFO11 0x05, 0xbb +#define TM6010_REQ05_RB1_BC_LOW_FIFO12 0x05, 0xbc +#define TM6010_REQ05_RB1_BC_LOW_FIFO13 0x05, 0xbd +#define TM6010_REQ05_RB1_BC_LOW_FIFO14 0x05, 0xbe +#define TM6010_REQ05_RB1_BC_LOW_FIFO15 0x05, 0xbf +#define TM6010_REQ05_RC0_DATA_FIFO0 0x05, 0xc0 +#define TM6010_REQ05_RC4_DATA_FIFO1 0x05, 0xc4 +#define TM6010_REQ05_RC8_DATA_FIFO2 0x05, 0xc8 +#define TM6010_REQ05_RCC_DATA_FIFO3 0x05, 0xcc +#define TM6010_REQ05_RD0_DATA_FIFO4 0x05, 0xd0 +#define TM6010_REQ05_RD4_DATA_FIFO5 0x05, 0xd4 +#define TM6010_REQ05_RD8_DATA_FIFO6 0x05, 0xd8 +#define TM6010_REQ05_RDC_DATA_FIFO7 0x05, 0xdc +#define TM6010_REQ05_RE0_DATA_FIFO8 0x05, 0xe0 +#define TM6010_REQ05_RE4_DATA_FIFO9 0x05, 0xe4 +#define TM6010_REQ05_RC4_DATA_FIFO10 0x05, 0xe8 +#define TM6010_REQ05_RC4_DATA_FIFO11 0x05, 0xec +#define TM6010_REQ05_RC4_DATA_FIFO12 0x05, 0xf0 +#define TM6010_REQ05_RC4_DATA_FIFO13 0x05, 0xf4 +#define TM6010_REQ05_RC4_DATA_FIFO14 0x05, 0xf8 +#define TM6010_REQ05_RC4_DATA_FIFO15 0x05, 0xfc /* Define TM6000/TM6010 Audio decoder registers */ #define TM6010_REQ08_R00_A_VERSION 0x08, 0x00 -- GitLab From 2415a2c14ef5fde98d61e3af4c5ff6e019659799 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 11 Mar 2010 10:26:45 -0300 Subject: [PATCH 179/534] V4L/DVB: tm6000: replace occurences of req05 magic by a naming alias Yet another naming replace magic thanks to perl scripts. This time, it is done with: cat tm6000-regs.h |perl -ne 'if (m/(TM6010_REQ[^\s]+)\s+0x([a-f0-9]+)\, 0x([a-f0-9]+)/) { $name="$1"; $req=$2; $val=$3; printf "s/REQ_${req}_SET_GET_USBREG, 0x[0]*$3,/$1,/\n" }' >a; for i in tm*.c; do sed -f a $i >b && mv b $i; done Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/tm6000/tm6000-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c index b9640d74b916..d9cade00bc99 100644 --- a/drivers/staging/tm6000/tm6000-core.c +++ b/drivers/staging/tm6000/tm6000-core.c @@ -341,7 +341,7 @@ struct reg_init tm6000_init_tab[] = { { TM6010_REQ07_RC1_TRESHOLD, 0xd0 }, { TM6010_REQ07_RC3_HSTART1, 0x88 }, { TM6010_REQ07_R3F_RESET, 0x00 }, /* End of the soft reset */ - { REQ_05_SET_GET_USBREG, 0x18, 0x00 }, + { TM6010_REQ05_R18_IMASK7, 0x00 }, }; struct reg_init tm6010_init_tab[] = { @@ -414,7 +414,7 @@ struct reg_init tm6010_init_tab[] = { { TM6010_REQ07_RC3_HSTART1, 0x88 }, { TM6010_REQ07_R3F_RESET, 0x00 }, - { REQ_05_SET_GET_USBREG, 0x18, 0x00 }, + { TM6010_REQ05_R18_IMASK7, 0x00 }, { TM6010_REQ07_RD8_IR_LEADER1, 0xaa }, { TM6010_REQ07_RD8_IR_LEADER0, 0x30 }, -- GitLab From c6ebc6c4acbedcc766a8af147ccb9c39e77578ae Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 14 Mar 2010 22:57:56 -0300 Subject: [PATCH 180/534] V4L/DVB: saa7134: Fix IR support of some ASUS TV-FM 7135 variants Some variants of the ASUS TV-FM 7135 are handled as the ASUSTeK P7131 Analog (card=146). However, by the time we find out, some card-specific initialization is missed. In particular, the fact that the IR is GPIO-based. Set it when we change the card type, and run saa7134_input_init1(). Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-cards.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 297833fb3b4a..aa07cb11e104 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -7215,6 +7215,11 @@ int saa7134_board_init2(struct saa7134_dev *dev) printk(KERN_INFO "%s: P7131 analog only, using " "entry of %s\n", dev->name, saa7134_boards[dev->board].name); + + /* IR init has already happened for other cards, so + * we have to catch up. */ + dev->has_remote = SAA7134_REMOTE_GPIO; + saa7134_input_init1(dev); } break; case SAA7134_BOARD_HAUPPAUGE_HVR1150: -- GitLab From d9a325a865becc082d592d16a15f01a9684ef82e Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 13 Mar 2010 16:40:03 -0300 Subject: [PATCH 181/534] V4L/DVB: cx18: Add support for component video inputs Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx18/cx18-av-core.c | 33 ++++++++++++++++++++++--- drivers/media/video/cx18/cx18-av-core.h | 19 ++++++++++++++ drivers/media/video/cx18/cx18-cards.c | 2 +- drivers/media/video/cx18/cx18-cards.h | 4 +-- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c index 4392c76af5df..3ce45297e56a 100644 --- a/drivers/media/video/cx18/cx18-av-core.c +++ b/drivers/media/video/cx18/cx18-av-core.c @@ -579,6 +579,7 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, u8 afe_mux_cfg; u8 adc2_cfg; + u8 input_mode; u32 afe_cfg; int i; @@ -589,6 +590,30 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, vid_input <= CX18_AV_COMPOSITE8) { afe_mux_cfg = 0xf0 + (vid_input - CX18_AV_COMPOSITE1); ch[0] = CVBS; + input_mode = 0x0; + } else if (vid_input >= CX18_AV_COMPONENT_LUMA1) { + int luma = vid_input & 0xf000; + int r_chroma = vid_input & 0xf0000; + int b_chroma = vid_input & 0xf00000; + + if ((vid_input & ~0xfff000) || + luma < CX18_AV_COMPONENT_LUMA1 || + luma > CX18_AV_COMPONENT_LUMA8 || + r_chroma < CX18_AV_COMPONENT_R_CHROMA4 || + r_chroma > CX18_AV_COMPONENT_R_CHROMA6 || + b_chroma < CX18_AV_COMPONENT_B_CHROMA7 || + b_chroma > CX18_AV_COMPONENT_B_CHROMA8) { + CX18_ERR_DEV(sd, "0x%06x is not a valid video input!\n", + vid_input); + return -EINVAL; + } + afe_mux_cfg = (luma - CX18_AV_COMPONENT_LUMA1) >> 12; + ch[0] = Y; + afe_mux_cfg |= (r_chroma - CX18_AV_COMPONENT_R_CHROMA4) >> 12; + ch[1] = Pr; + afe_mux_cfg |= (b_chroma - CX18_AV_COMPONENT_B_CHROMA7) >> 14; + ch[2] = Pb; + input_mode = 0x6; } else { int luma = vid_input & 0xf0; int chroma = vid_input & 0xf00; @@ -598,7 +623,7 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, luma > CX18_AV_SVIDEO_LUMA8 || chroma < CX18_AV_SVIDEO_CHROMA4 || chroma > CX18_AV_SVIDEO_CHROMA8) { - CX18_ERR_DEV(sd, "0x%04x is not a valid video input!\n", + CX18_ERR_DEV(sd, "0x%06x is not a valid video input!\n", vid_input); return -EINVAL; } @@ -613,8 +638,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, afe_mux_cfg |= (chroma - CX18_AV_SVIDEO_CHROMA4) >> 4; ch[1] = C; } + input_mode = 0x2; } - /* TODO: LeadTek WinFast DVR3100 H & WinFast PVR2100 can do Y/Pb/Pr */ switch (aud_input) { case CX18_AV_AUDIO_SERIAL1: @@ -650,8 +675,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, /* Set up analog front end multiplexers */ cx18_av_write_expect(cx, 0x103, afe_mux_cfg, afe_mux_cfg, 0xf7); - /* Set INPUT_MODE to Composite (0) or S-Video (1) */ - cx18_av_and_or(cx, 0x401, ~0x6, ch[0] == CVBS ? 0 : 0x02); + /* Set INPUT_MODE to Composite, S-Video, or Component */ + cx18_av_and_or(cx, 0x401, ~0x6, input_mode); /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */ adc2_cfg = cx18_av_read(cx, 0x102); diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h index cafb7e99b9a0..74546806b03f 100644 --- a/drivers/media/video/cx18/cx18-av-core.h +++ b/drivers/media/video/cx18/cx18-av-core.h @@ -61,6 +61,25 @@ enum cx18_av_video_input { CX18_AV_SVIDEO2 = 0x620, CX18_AV_SVIDEO3 = 0x730, CX18_AV_SVIDEO4 = 0x840, + + /* Component Video inputs consist of one luma input (In1-In8) ORed + with a red chroma (In4-In6) and blue chroma input (In7-In8) */ + CX18_AV_COMPONENT_LUMA1 = 0x1000, + CX18_AV_COMPONENT_LUMA2 = 0x2000, + CX18_AV_COMPONENT_LUMA3 = 0x3000, + CX18_AV_COMPONENT_LUMA4 = 0x4000, + CX18_AV_COMPONENT_LUMA5 = 0x5000, + CX18_AV_COMPONENT_LUMA6 = 0x6000, + CX18_AV_COMPONENT_LUMA7 = 0x7000, + CX18_AV_COMPONENT_LUMA8 = 0x8000, + CX18_AV_COMPONENT_R_CHROMA4 = 0x40000, + CX18_AV_COMPONENT_R_CHROMA5 = 0x50000, + CX18_AV_COMPONENT_R_CHROMA6 = 0x60000, + CX18_AV_COMPONENT_B_CHROMA7 = 0x700000, + CX18_AV_COMPONENT_B_CHROMA8 = 0x800000, + + /* Component Video aliases for common combinations */ + CX18_AV_COMPONENT1 = 0x861000, }; enum cx18_av_audio_input { diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c index f808fb6fc1c1..3d35f58e3119 100644 --- a/drivers/media/video/cx18/cx18-cards.c +++ b/drivers/media/video/cx18/cx18-cards.c @@ -480,7 +480,7 @@ int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input) "S-Video 2", "Composite 1", "Composite 2", - "Composite 3" + "Component 1" }; memset(input, 0, sizeof(*input)); diff --git a/drivers/media/video/cx18/cx18-cards.h b/drivers/media/video/cx18/cx18-cards.h index af3d71607dc9..796e517300ac 100644 --- a/drivers/media/video/cx18/cx18-cards.h +++ b/drivers/media/video/cx18/cx18-cards.h @@ -43,7 +43,7 @@ #define CX18_CARD_INPUT_SVIDEO2 3 #define CX18_CARD_INPUT_COMPOSITE1 4 #define CX18_CARD_INPUT_COMPOSITE2 5 -#define CX18_CARD_INPUT_COMPOSITE3 6 +#define CX18_CARD_INPUT_COMPONENT1 6 /* audio inputs */ #define CX18_CARD_INPUT_AUD_TUNER 1 @@ -62,7 +62,7 @@ struct cx18_card_video_input { u8 video_type; /* video input type */ u8 audio_index; /* index in cx18_card_audio_input array */ - u16 video_input; /* hardware video input */ + u32 video_input; /* hardware video input */ }; struct cx18_card_audio_input { -- GitLab From f978ac90b2cfa79cb075f74fd5c403e9f9ec4246 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 13 Mar 2010 16:40:34 -0300 Subject: [PATCH 182/534] V4L/DVB: cx18: Add a component video input to the PVR2100 and DVR3200H card entries This is a guess at the proper configuration for component video on the Leadtek PVR2100 and DVR3100 H. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx18/cx18-cards.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c index 3d35f58e3119..74e122b5fc49 100644 --- a/drivers/media/video/cx18/cx18-cards.c +++ b/drivers/media/video/cx18/cx18-cards.c @@ -370,6 +370,7 @@ static const struct cx18_card cx18_card_leadtek_pvr2100 = { { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 }, { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 }, + { CX18_CARD_INPUT_COMPONENT1, 1, CX18_AV_COMPONENT1 }, }, .audio_inputs = { { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 }, @@ -422,6 +423,7 @@ static const struct cx18_card cx18_card_leadtek_dvr3100h = { { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 }, { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE7 }, + { CX18_CARD_INPUT_COMPONENT1, 1, CX18_AV_COMPONENT1 }, }, .audio_inputs = { { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 }, -- GitLab From 2443baeaa01388f56824c55c087510312b8d8197 Mon Sep 17 00:00:00 2001 From: Ian Armstrong Date: Sat, 13 Mar 2010 20:22:34 -0300 Subject: [PATCH 183/534] V4L/DVB: ivtv: Avoid hard system lock on decoder output mode change Changing the decoder video standard just prior to, or during, the output of the lower field may result in a hard system lock. To avoid this, try to ensure the firmware call occurs only during the first 100 lines of the top field. (Minor comment addition and a line break added Andy Walls .) Signed-off-by: Ian Armstrong Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-driver.c | 5 ++++- drivers/media/video/ivtv/ivtv-ioctl.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index 9a250548be4d..1b79475ca134 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c @@ -1293,7 +1293,6 @@ int ivtv_init_on_first_open(struct ivtv *itv) ivtv_call_hw(itv, IVTV_HW_SAA7127, video, s_stream, 1); ivtv_init_mpeg_decoder(itv); } - ivtv_s_std(NULL, &fh, &itv->tuner_std); /* On a cx23416 this seems to be able to enable DMA to the chip? */ if (!itv->has_cx23415) @@ -1310,6 +1309,10 @@ int ivtv_init_on_first_open(struct ivtv *itv) } else ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT); + + /* For cards with video out, this call needs interrupts enabled */ + ivtv_s_std(NULL, &fh, &itv->tuner_std); + return 0; } diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 99f3c39a118b..2192bc42c6b6 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c @@ -1087,8 +1087,10 @@ static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) { + DEFINE_WAIT(wait); struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; struct yuv_playback_info *yi = &itv->yuv_info; + int f; if ((*std & V4L2_STD_ALL) == 0) return -EINVAL; @@ -1128,6 +1130,25 @@ int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) itv->is_out_60hz = itv->is_60hz; itv->is_out_50hz = itv->is_50hz; ivtv_call_all(itv, video, s_std_output, itv->std_out); + + /* + * The next firmware call is time sensitive. Time it to + * avoid risk of a hard lock, by trying to ensure the call + * happens within the first 100 lines of the top field. + * Make 4 attempts to sync to the decoder before giving up. + */ + for (f = 0; f < 4; f++) { + prepare_to_wait(&itv->vsync_waitq, &wait, + TASK_UNINTERRUPTIBLE); + if ((read_reg(0x28c0) >> 16) < 100) + break; + schedule_timeout(msecs_to_jiffies(25)); + } + finish_wait(&itv->vsync_waitq, &wait); + + if (f == 4) + IVTV_WARN("Mode change failed to sync to decoder\n"); + ivtv_vapi(itv, CX2341X_DEC_SET_STANDARD, 1, itv->is_out_50hz); itv->main_rect.left = itv->main_rect.top = 0; itv->main_rect.width = 720; -- GitLab From 4e1af31aaaa8cc4a5cc1d894bdf04dfc7450d47f Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Sat, 13 Mar 2010 20:37:25 -0300 Subject: [PATCH 184/534] V4L/DVB: ivtv, ivtvfb: Use a define for the output line and field register address Get rid of the magic number 0x28c0 used in several places in the ivtv and ivtvfb driver and define the register address to a meaningful name. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-driver.h | 3 +++ drivers/media/video/ivtv/ivtv-ioctl.c | 2 +- drivers/media/video/ivtv/ivtv-irq.c | 8 +++++--- drivers/media/video/ivtv/ivtvfb.c | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 5028e31c564a..851f07de5296 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h @@ -116,6 +116,9 @@ #define IVTV_REG_VPU (0x9058) #define IVTV_REG_APU (0xA064) +/* Other registers */ +#define IVTV_REG_DEC_LINE_FIELD (0x28C0) + /* debugging */ extern int ivtv_debug; diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 2192bc42c6b6..c29ff983d43e 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c @@ -1140,7 +1140,7 @@ int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) for (f = 0; f < 4; f++) { prepare_to_wait(&itv->vsync_waitq, &wait, TASK_UNINTERRUPTIBLE); - if ((read_reg(0x28c0) >> 16) < 100) + if ((read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16) < 100) break; schedule_timeout(msecs_to_jiffies(25)); } diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index 12d36ca91d53..dbd46c5d6975 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c @@ -752,7 +752,7 @@ static void ivtv_irq_vsync(struct ivtv *itv) * to determine the line being displayed and ensure we handle * one vsync per frame. */ - unsigned int frame = read_reg(0x28c0) & 1; + unsigned int frame = read_reg(IVTV_REG_DEC_LINE_FIELD) & 1; struct yuv_playback_info *yi = &itv->yuv_info; int last_dma_frame = atomic_read(&yi->next_dma_frame); struct yuv_frame_info *f = &yi->new_frame_info[last_dma_frame]; @@ -852,9 +852,11 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id) */ if (~itv->irqmask & IVTV_IRQ_DEC_VSYNC) { /* vsync is enabled, see if we're in a new field */ - if ((itv->last_vsync_field & 1) != (read_reg(0x28c0) & 1)) { + if ((itv->last_vsync_field & 1) != + (read_reg(IVTV_REG_DEC_LINE_FIELD) & 1)) { /* New field, looks like we missed it */ - IVTV_DEBUG_YUV("VSync interrupt missed %d\n",read_reg(0x28c0)>>16); + IVTV_DEBUG_YUV("VSync interrupt missed %d\n", + read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16); vsync_force = 1; } } diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index de2ff1c6ac34..49e1a283ed36 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c @@ -460,7 +460,7 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar vblank.flags = FB_VBLANK_HAVE_COUNT |FB_VBLANK_HAVE_VCOUNT | FB_VBLANK_HAVE_VSYNC; - trace = read_reg(0x028c0) >> 16; + trace = read_reg(IVTV_REG_DEC_LINE_FIELD) >> 16; if (itv->is_50hz && trace > 312) trace -= 312; else if (itv->is_60hz && trace > 262) -- GitLab From 728385c4d31469b9124953f36fb42015435466c9 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Fri, 12 Mar 2010 06:15:32 -0300 Subject: [PATCH 185/534] V4L/DVB: drivers/media/video: move dereference after NULL test In quickcam_messenger.c, if the NULL test on uvd is needed, then the dereference should be after the NULL test. In vpif_display.c, std_info is initialized to the address of a structure field. This seems unlikely to be NULL. Test std_info->stdid instead. In saa7134-alsa.c, the function is only called from one place, where the chip argument has already been dereferenced. On the other hand, if it should be kept, then card should be initialized after it. A simplified version of the semantic match that detects this problem is as follows (http://coccinelle.lip6.fr/): // @match exists@ expression x, E; identifier fld; @@ * x->fld ... when != \(x = E\|&x\) * x == NULL // Signed-off-by: Julia Lawall Acked-by: Muralidharan Karicheri Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpif_display.c | 2 +- drivers/media/video/saa7134/saa7134-alsa.c | 2 -- drivers/media/video/usbvideo/quickcam_messenger.c | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index 13c3a1b97760..e5bab3d0d53f 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c @@ -384,7 +384,7 @@ static int vpif_get_std_info(struct channel_obj *ch) int index; std_info->stdid = vid_ch->stdid; - if (!std_info) + if (!std_info->stdid) return -1; for (index = 0; index < ARRAY_SIZE(ch_params); index++) { diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index d48c450ed77c..d3bd82ad010a 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -1011,8 +1011,6 @@ static int snd_card_saa7134_new_mixer(snd_card_saa7134_t * chip) unsigned int idx; int err, addr; - if (snd_BUG_ON(!chip)) - return -EINVAL; strcpy(card->mixername, "SAA7134 Mixer"); for (idx = 0; idx < ARRAY_SIZE(snd_saa7134_volume_controls); idx++) { diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c index fab48ec6c0ea..fbd665fa1979 100644 --- a/drivers/media/video/usbvideo/quickcam_messenger.c +++ b/drivers/media/video/usbvideo/quickcam_messenger.c @@ -693,12 +693,13 @@ static int qcm_start_data(struct uvd *uvd) static void qcm_stop_data(struct uvd *uvd) { - struct qcm *cam = (struct qcm *) uvd->user_data; + struct qcm *cam; int i, j; int ret; if ((uvd == NULL) || (!uvd->streaming) || (uvd->dev == NULL)) return; + cam = (struct qcm *) uvd->user_data; ret = qcm_camera_off(uvd); if (ret) -- GitLab From 4d36ec7fbf619a48c506eaa497d21619297a2b4f Mon Sep 17 00:00:00 2001 From: Huang Weiyi Date: Fri, 12 Mar 2010 11:12:22 -0300 Subject: [PATCH 186/534] V4L/DVB: tlg2300: remove unused #include Remove unused #include ('s) in drivers/media/video/tlg2300/pd-main.c Signed-off-by: Huang Weiyi Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/tlg2300/pd-main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/video/tlg2300/pd-main.c b/drivers/media/video/tlg2300/pd-main.c index 832b7c7b13d6..c267e0cfb54b 100644 --- a/drivers/media/video/tlg2300/pd-main.c +++ b/drivers/media/video/tlg2300/pd-main.c @@ -24,7 +24,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include #include #include #include -- GitLab From 8889a8a53e0144da5dee58e9693190bbdf1c3959 Mon Sep 17 00:00:00 2001 From: Olimpiu Pascariu Date: Sun, 14 Mar 2010 12:44:37 -0300 Subject: [PATCH 187/534] V4L/DVB: Staging: cx25821: fix coding style issues in cx25821-alsa.c >From 9473816c446a6ca91905fc49a73732f70b5223b4 Mon Sep 17 00:00:00 2001 This is a patch to the cx25821-alsa.c file that fixes up errors and warnings found by the checkpatch.pl tool [mchehab@redhat.com: a few adjustments on the comments to improve readability] Signed-off-by: Olimpiu Pascariu Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/cx25821/cx25821-alsa.c | 102 +++++++++++++------------ 1 file changed, 54 insertions(+), 48 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-alsa.c b/drivers/staging/cx25821/cx25821-alsa.c index 061add30ba8a..33e559d58b1b 100644 --- a/drivers/staging/cx25821/cx25821-alsa.c +++ b/drivers/staging/cx25821/cx25821-alsa.c @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include @@ -42,10 +42,10 @@ #define AUDIO_SRAM_CHANNEL SRAM_CH08 -#define dprintk(level,fmt, arg...) if (debug >= level) \ +#define dprintk(level, fmt, arg...) if (debug >= level) \ printk(KERN_INFO "%s/1: " fmt, chip->dev->name , ## arg) -#define dprintk_core(level,fmt, arg...) if (debug >= level) \ +#define dprintk_core(level, fmt, arg...) if (debug >= level) \ printk(KERN_DEBUG "%s/1: " fmt, chip->dev->name , ## arg) /**************************************************************************** @@ -81,7 +81,6 @@ struct cx25821_audio_dev { struct snd_pcm_substream *substream; }; -typedef struct cx25821_audio_dev snd_cx25821_card_t; /**************************************************************************** @@ -90,7 +89,7 @@ typedef struct cx25821_audio_dev snd_cx25821_card_t; static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = { 1,[1 ... (SNDRV_CARDS - 1)] = 1 }; +static int enable[SNDRV_CARDS] = { 1, [1 ... (SNDRV_CARDS - 1)] = 1 }; module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable cx25821 soundcard. default enabled."); @@ -105,7 +104,7 @@ MODULE_PARM_DESC(index, "Index value for cx25821 capture interface(s)."); MODULE_DESCRIPTION("ALSA driver module for cx25821 based capture cards"); MODULE_AUTHOR("Hiep Huynh"); MODULE_LICENSE("GPL"); -MODULE_SUPPORTED_DEVICE("{{Conexant,25821}"); //"{{Conexant,23881}," +MODULE_SUPPORTED_DEVICE("{{Conexant,25821}"); /* "{{Conexant,23881}," */ static unsigned int debug; module_param(debug, int, 0644); @@ -135,7 +134,7 @@ MODULE_PARM_DESC(debug, "enable debug messages"); * BOARD Specific: Sets audio DMA */ -static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) +static int _cx25821_start_audio_dma(struct cx25821_audio_dev *chip) { struct cx25821_buffer *buf = chip->buf; struct cx25821_dev *dev = chip->dev; @@ -143,7 +142,7 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) &cx25821_sram_channels[AUDIO_SRAM_CHANNEL]; u32 tmp = 0; - // enable output on the GPIO 0 for the MCLK ADC (Audio) + /* enable output on the GPIO 0 for the MCLK ADC (Audio) */ cx25821_set_gpiopin_direction(chip->dev, 0, 0); /* Make sure RISC/FIFO are off before changing FIFO/RISC settings */ @@ -158,18 +157,23 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) cx_write(AUD_A_LNGTH, buf->bpl); /* reset counter */ - cx_write(AUD_A_GPCNT_CTL, GP_COUNT_CONTROL_RESET); //GP_COUNT_CONTROL_RESET = 0x3 + /* GP_COUNT_CONTROL_RESET = 0x3 */ + cx_write(AUD_A_GPCNT_CTL, GP_COUNT_CONTROL_RESET); atomic_set(&chip->count, 0); - //Set the input mode to 16-bit + /* Set the input mode to 16-bit */ tmp = cx_read(AUD_A_CFG); cx_write(AUD_A_CFG, tmp | FLD_AUD_DST_PK_MODE | FLD_AUD_DST_ENABLE | FLD_AUD_CLK_ENABLE); - //printk(KERN_INFO "DEBUG: Start audio DMA, %d B/line, cmds_start(0x%x)= %d lines/FIFO, %d periods, %d " - // "byte buffer\n", buf->bpl, audio_ch->cmds_start, cx_read(audio_ch->cmds_start + 12)>>1, - // chip->num_periods, buf->bpl * chip->num_periods); + /* printk(KERN_INFO "DEBUG: Start audio DMA, %d B/line," + "cmds_start(0x%x)= %d lines/FIFO, %d periods, " + "%d byte buffer\n", buf->bpl, + audio_ch->cmds_start, + cx_read(audio_ch->cmds_start + 12)>>1, + chip->num_periods, buf->bpl *chip->num_periods); + */ /* Enables corresponding bits at AUD_INT_STAT */ cx_write(AUD_A_INT_MSK, @@ -182,7 +186,7 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) /* enable audio irqs */ cx_set(PCI_INT_MSK, chip->dev->pci_irqmask | PCI_MSK_AUD_INT); - // Turn on audio downstream fifo and risc enable 0x101 + /* Turn on audio downstream fifo and risc enable 0x101 */ tmp = cx_read(AUD_INT_DMA_CTL); cx_set(AUD_INT_DMA_CTL, tmp | (FLD_AUD_DST_A_RISC_EN | FLD_AUD_DST_A_FIFO_EN)); @@ -194,7 +198,7 @@ static int _cx25821_start_audio_dma(snd_cx25821_card_t * chip) /* * BOARD Specific: Resets audio DMA */ -static int _cx25821_stop_audio_dma(snd_cx25821_card_t * chip) +static int _cx25821_stop_audio_dma(struct cx25821_audio_dev *chip) { struct cx25821_dev *dev = chip->dev; @@ -232,13 +236,13 @@ static char *cx25821_aud_irqs[32] = { /* * BOARD Specific: Threats IRQ audio specific calls */ -static void cx25821_aud_irq(snd_cx25821_card_t * chip, u32 status, u32 mask) +static void cx25821_aud_irq(struct cx25821_audio_dev *chip, u32 status, + u32 mask) { struct cx25821_dev *dev = chip->dev; - if (0 == (status & mask)) { + if (0 == (status & mask)) return; - } cx_write(AUD_A_INT_STAT, status); if (debug > 1 || (status & mask & ~0xff)) @@ -277,7 +281,7 @@ static void cx25821_aud_irq(snd_cx25821_card_t * chip, u32 status, u32 mask) */ static irqreturn_t cx25821_irq(int irq, void *dev_id) { - snd_cx25821_card_t *chip = dev_id; + struct cx25821_audio_dev *chip = dev_id; struct cx25821_dev *dev = chip->dev; u32 status, pci_status; u32 audint_status, audint_mask; @@ -318,11 +322,11 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id) if (handled) cx_write(PCI_INT_STAT, pci_status); - out: +out: return IRQ_RETVAL(handled); } -static int dsp_buffer_free(snd_cx25821_card_t * chip) +static int dsp_buffer_free(struct cx25821_audio_dev *chip) { BUG_ON(!chip->dma_size); @@ -363,7 +367,8 @@ static struct snd_pcm_hardware snd_cx25821_digital_hw = { .period_bytes_max = DEFAULT_FIFO_SIZE / 3, .periods_min = 1, .periods_max = AUDIO_LINE_SIZE, - .buffer_bytes_max = (AUDIO_LINE_SIZE * AUDIO_LINE_SIZE), //128*128 = 16384 = 1024 * 16 + /* 128 * 128 = 16384 = 1024 * 16 */ + .buffer_bytes_max = (AUDIO_LINE_SIZE * AUDIO_LINE_SIZE), }; /* @@ -371,7 +376,7 @@ static struct snd_pcm_hardware snd_cx25821_digital_hw = { */ static int snd_cx25821_pcm_open(struct snd_pcm_substream *substream) { - snd_cx25821_card_t *chip = snd_pcm_substream_chip(substream); + struct cx25821_audio_dev *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; int err; unsigned int bpl = 0; @@ -393,18 +398,19 @@ static int snd_cx25821_pcm_open(struct snd_pcm_substream *substream) if (cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size != DEFAULT_FIFO_SIZE) { - bpl = cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size / 3; //since there are 3 audio Clusters + /* since there are 3 audio Clusters */ + bpl = cx25821_sram_channels[AUDIO_SRAM_CHANNEL].fifo_size / 3; bpl &= ~7; /* must be multiple of 8 */ - if (bpl > AUDIO_LINE_SIZE) { + if (bpl > AUDIO_LINE_SIZE) bpl = AUDIO_LINE_SIZE; - } + runtime->hw.period_bytes_min = bpl; runtime->hw.period_bytes_max = bpl; } return 0; - _error: +_error: dprintk(1, "Error opening PCM!\n"); return err; } @@ -423,7 +429,7 @@ static int snd_cx25821_close(struct snd_pcm_substream *substream) static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { - snd_cx25821_card_t *chip = snd_pcm_substream_chip(substream); + struct cx25821_audio_dev *chip = snd_pcm_substream_chip(substream); struct videobuf_dmabuf *dma; struct cx25821_buffer *buf; @@ -445,9 +451,8 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, if (NULL == buf) return -ENOMEM; - if (chip->period_size > AUDIO_LINE_SIZE) { + if (chip->period_size > AUDIO_LINE_SIZE) chip->period_size = AUDIO_LINE_SIZE; - } buf->vb.memory = V4L2_MEMORY_MMAP; buf->vb.field = V4L2_FIELD_NONE; @@ -474,7 +479,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, buf->vb.width, buf->vb.height, 1); if (ret < 0) { printk(KERN_INFO - "DEBUG: ERROR after cx25821_risc_databuffer_audio() \n"); + "DEBUG: ERROR after cx25821_risc_databuffer_audio()\n"); goto error; } @@ -494,7 +499,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, return 0; - error: +error: kfree(buf); return ret; } @@ -504,7 +509,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, */ static int snd_cx25821_hw_free(struct snd_pcm_substream *substream) { - snd_cx25821_card_t *chip = snd_pcm_substream_chip(substream); + struct cx25821_audio_dev *chip = snd_pcm_substream_chip(substream); if (substream->runtime->dma_area) { dsp_buffer_free(chip); @@ -528,7 +533,7 @@ static int snd_cx25821_prepare(struct snd_pcm_substream *substream) static int snd_cx25821_card_trigger(struct snd_pcm_substream *substream, int cmd) { - snd_cx25821_card_t *chip = snd_pcm_substream_chip(substream); + struct cx25821_audio_dev *chip = snd_pcm_substream_chip(substream); int err = 0; /* Local interrupts are already disabled by ALSA */ @@ -557,7 +562,7 @@ static int snd_cx25821_card_trigger(struct snd_pcm_substream *substream, static snd_pcm_uframes_t snd_cx25821_pointer(struct snd_pcm_substream *substream) { - snd_cx25821_card_t *chip = snd_pcm_substream_chip(substream); + struct cx25821_audio_dev *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; u16 count; @@ -593,10 +598,11 @@ static struct snd_pcm_ops snd_cx25821_pcm_ops = { }; /* - * ALSA create a PCM device: Called when initializing the board. Sets up the name and hooks up - * the callbacks + * ALSA create a PCM device: Called when initializing the board. + * Sets up the name and hooks up the callbacks */ -static int snd_cx25821_pcm(snd_cx25821_card_t * chip, int device, char *name) +static int snd_cx25821_pcm(struct cx25821_audio_dev *chip, int device, + char *name) { struct snd_pcm *pcm; int err; @@ -636,7 +642,7 @@ MODULE_DEVICE_TABLE(pci, cx25821_audio_pci_tbl); * from the file. */ /* -static int snd_cx25821_free(snd_cx25821_card_t *chip) +static int snd_cx25821_free(struct cx25821_audio_dev *chip) { if (chip->irq >= 0) free_irq(chip->irq, chip); @@ -653,9 +659,9 @@ static int snd_cx25821_free(snd_cx25821_card_t *chip) */ static void snd_cx25821_dev_free(struct snd_card *card) { - snd_cx25821_card_t *chip = card->private_data; + struct cx25821_audio_dev *chip = card->private_data; - //snd_cx25821_free(chip); + /* snd_cx25821_free(chip); */ snd_card_free(chip->card); } @@ -665,23 +671,23 @@ static void snd_cx25821_dev_free(struct snd_card *card) static int cx25821_audio_initdev(struct cx25821_dev *dev) { struct snd_card *card; - snd_cx25821_card_t *chip; + struct cx25821_audio_dev *chip; int err; if (devno >= SNDRV_CARDS) { printk(KERN_INFO "DEBUG ERROR: devno >= SNDRV_CARDS %s\n", __func__); - return (-ENODEV); + return -ENODEV; } if (!enable[devno]) { ++devno; printk(KERN_INFO "DEBUG ERROR: !enable[devno] %s\n", __func__); - return (-ENOENT); + return -ENOENT; } err = snd_card_create(index[devno], id[devno], THIS_MODULE, - sizeof(snd_cx25821_card_t), &card); + sizeof(struct cx25821_audio_dev), &card); if (err < 0) { printk(KERN_INFO "DEBUG ERROR: cannot create snd_card_new in %s\n", @@ -693,7 +699,7 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) /* Card "creation" */ card->private_free = snd_cx25821_dev_free; - chip = (snd_cx25821_card_t *) card->private_data; + chip = (struct cx25821_audio_dev *) card->private_data; spin_lock_init(&chip->reg_lock); chip->dev = dev; @@ -712,7 +718,7 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) goto error; } - if ((err = snd_cx25821_pcm(chip, 0, "cx25821 Digital")) < 0) { + if ((err == snd_cx25821_pcm(chip, 0, "cx25821 Digital")) < 0) { printk(KERN_INFO "DEBUG ERROR: cannot create snd_cx25821_pcm %s\n", __func__); @@ -741,7 +747,7 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev) devno++; return 0; - error: +error: snd_card_free(card); return err; } -- GitLab From a3415c15e1b5965c8efe0c0eb84b49689ed954ef Mon Sep 17 00:00:00 2001 From: Frank Schaefer Date: Sun, 14 Mar 2010 14:28:54 -0300 Subject: [PATCH 188/534] V4L/DVB: v4l2_ctrl_get_name(): add missing control names, and make title for V4L2_CID_BG_COLOR consistent v4l2_ctrl_get_name(): add missing control names, and make title for V4L2_CID_BG_COLOR consistent V4L2_CID_AUTOBRIGHTNESS was introduced with kernel 2.6.31 V4L2_CID_BAND_STOP_FILTER was introduced with kernel 2.6.32 Signed-off-by: Frank Schaefer Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 36b5cb86fb57..e67983461008 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -431,8 +431,10 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_CHROMA_AGC: return "Chroma AGC"; case V4L2_CID_COLOR_KILLER: return "Color Killer"; case V4L2_CID_COLORFX: return "Color Effects"; + case V4L2_CID_AUTOBRIGHTNESS: return "Brightness, Automatic"; + case V4L2_CID_BAND_STOP_FILTER: return "Band-Stop Filter"; case V4L2_CID_ROTATE: return "Rotate"; - case V4L2_CID_BG_COLOR: return "Background color"; + case V4L2_CID_BG_COLOR: return "Background Color"; /* MPEG controls */ case V4L2_CID_MPEG_CLASS: return "MPEG Encoder Controls"; -- GitLab From 8f27fd9605a28225bb71f2b3ade5d248231cd824 Mon Sep 17 00:00:00 2001 From: Vladimir Ermakov Date: Wed, 10 Mar 2010 12:44:57 -0300 Subject: [PATCH 189/534] V4L/DVB: saa7134: add capture boards Hawell HW-404M7 and HW-808M7 Adds new capture boards Hawell HW-404M7 and HW-808M7. Those cards have 4 or 8 SAA7130 chips and for the work it only needs initialize registers. The value of those registers were dumped under Windows using flytest. But board haven't EEPROM. For the first chip: SAA7130 (0x7130, SubVenID:1131, SubDevID:0000, Rev: 01) I2C slave devices found: No devices GPIO pins: Mode : 0x00389C00 Value: 0x00016C00 Video input: 3 Audio input: Analog Line1 For other chips: SAA7130 (0x7130, SubVenID:1131, SubDevID:0000, Rev: 01) I2C slave devices found: No devices GPIO pins: Mode : 0x00389200 Value: 0x00010000 Video input: 3 Audio input: Analog Line1 Signed-off-by: Vladimir Ermakov Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.saa7134 | 1 + drivers/media/video/saa7134/saa7134-cards.c | 17 +++++++++++++++++ drivers/media/video/saa7134/saa7134-input.c | 1 + drivers/media/video/saa7134/saa7134.h | 1 + 4 files changed, 20 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index b4a767060ed7..3de042a9c4f6 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -175,3 +175,4 @@ 174 -> Asus Europa Hybrid OEM [1043:4847] 175 -> Leadtek Winfast DTV1000S [107d:6655] 176 -> Beholder BeholdTV 505 RDS [0000:5051] +177 -> Hawell HW-404M7 / HW-808M7 diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index aa07cb11e104..655068f6c491 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -5355,6 +5355,23 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE2, }, }, + [SAA7134_BOARD_HAWELL_HW_404M7] = { + /* Hawell HW-404M7 & Hawell HW-808M7 */ + /* Bogoslovskiy Viktor */ + .name = "Hawell HW-404M7", + .audio_clock = 0x00200000, + .tuner_type = UNSET, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .gpiomask = 0x01fc00, + .inputs = {{ + .name = name_comp1, + .vmux = 3, + .amux = LINE1, + .gpio = 0x389c00, + } }, + }, }; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index c1fe7c9369b2..ac62b77e5edc 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -475,6 +475,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) switch (dev->board) { case SAA7134_BOARD_FLYVIDEO2000: case SAA7134_BOARD_FLYVIDEO3000: + case SAA7134_BOARD_HAWELL_HW_404M7: case SAA7134_BOARD_FLYTVPLATINUM_FM: case SAA7134_BOARD_FLYTVPLATINUM_MINI2: case SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM: diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index bf130967ed17..c3a1ae0adca0 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -300,6 +300,7 @@ struct saa7134_format { #define SAA7134_BOARD_ASUS_EUROPA_HYBRID 174 #define SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S 175 #define SAA7134_BOARD_BEHOLD_505RDS_MK3 176 +#define SAA7134_BOARD_HAWELL_HW_404M7 177 #define SAA7134_MAXBOARDS 32 #define SAA7134_INPUT_MAX 8 -- GitLab From 771075bb4667078687ae3c570a17c274f389e01e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 13 Mar 2010 11:47:06 -0300 Subject: [PATCH 190/534] V4L/DVB: videobuf-core: fix spelling mistake in debug message Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/videobuf-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index bb0a1c8de414..471178e17017 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -567,7 +567,7 @@ int videobuf_qbuf(struct videobuf_queue *q, q->ops->buf_queue(q, buf); spin_unlock_irqrestore(q->irqlock, flags); } - dprintk(1, "qbuf: succeded\n"); + dprintk(1, "qbuf: succeeded\n"); retval = 0; wake_up_interruptible_sync(&q->wait); -- GitLab From 9583183acbd40fc6e972ac39ae0a2173976f288e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 13 Mar 2010 19:03:21 -0300 Subject: [PATCH 191/534] V4L/DVB: v4l doc: fix font of field name The field 'reserved' was not tagged as a 'structfield' as it should. This made the text a bit confusing. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/v4l/vidioc-reqbufs.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/DocBook/v4l/vidioc-reqbufs.xml b/Documentation/DocBook/v4l/vidioc-reqbufs.xml index 1c0816372074..69800ae23348 100644 --- a/Documentation/DocBook/v4l/vidioc-reqbufs.xml +++ b/Documentation/DocBook/v4l/vidioc-reqbufs.xml @@ -61,7 +61,7 @@ fields of the v4l2_requestbuffers structure. They set the type field to the respective stream or buffer type, the count field to the desired number of buffers, memory -must be set to the requested I/O method and the reserved array +must be set to the requested I/O method and the reserved array must be zeroed. When the ioctl is called with a pointer to this structure the driver will attempt to allocate the requested number of buffers and it stores the actual number -- GitLab From 32208d444ab6ed427d18deebc4ad783602c695ba Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 14 Mar 2010 08:01:55 -0300 Subject: [PATCH 192/534] V4L/DVB: v4l2: sort chip IDs in v4l2-chip-ident.h This list should stay sorted to make it easy to find new ID ranges when adding new chip families. [mchehab@redhat.com: fixed bad whitespacing] Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-chip-ident.h | 120 +++++++++++++++++--------------- 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 56abf21dd786..bf937d3c6ba9 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h @@ -25,6 +25,10 @@ #define V4L2_CHIP_IDENT_H_ /* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */ + +/* KEEP THIS LIST ORDERED BY ID! + Otherwise it will be hard to see which ranges are already in use when + adding support to a new chip family. */ enum { /* general idents: reserved range 0-49 */ V4L2_IDENT_NONE = 0, /* No chip matched */ @@ -77,17 +81,14 @@ enum { V4L2_IDENT_CX23417 = 417, V4L2_IDENT_CX23418 = 418, - /* module au0828 */ - V4L2_IDENT_AU0828 = 828, - - /* module indycam: just ident 2000 */ - V4L2_IDENT_INDYCAM = 2000, - /* module bt819: reserved range 810-819 */ V4L2_IDENT_BT815A = 815, V4L2_IDENT_BT817A = 817, V4L2_IDENT_BT819A = 819, + /* module au0828 */ + V4L2_IDENT_AU0828 = 828, + /* module bt856: just ident 856 */ V4L2_IDENT_BT856 = 856, @@ -99,6 +100,9 @@ enum { V4L2_IDENT_KS0127 = 1127, V4L2_IDENT_KS0127B = 1128, + /* module indycam: just ident 2000 */ + V4L2_IDENT_INDYCAM = 2000, + /* module vp27smpx: just ident 2700 */ V4L2_IDENT_VP27SMPX = 2700, @@ -162,21 +166,18 @@ enum { /* module saa7706h: just ident 7706 */ V4L2_IDENT_SAA7706H = 7706, + /* module mt9v011, just ident 8243 */ + V4L2_IDENT_MT9V011 = 8243, + /* module wm8739: just ident 8739 */ V4L2_IDENT_WM8739 = 8739, /* module wm8775: just ident 8775 */ V4L2_IDENT_WM8775 = 8775, - /* module tda9840: just ident 9840 */ - V4L2_IDENT_TDA9840 = 9840, - /* module cafe_ccic, just ident 8801 */ V4L2_IDENT_CAFE = 8801, - /* module mt9v011, just ident 8243 */ - V4L2_IDENT_MT9V011 = 8243, - /* module cx23885 and cx25840 */ V4L2_IDENT_CX23885 = 8850, V4L2_IDENT_CX23885_AV = 8851, /* Integrated A/V decoder */ @@ -186,6 +187,9 @@ enum { V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */ V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */ + /* module tda9840: just ident 9840 */ + V4L2_IDENT_TDA9840 = 9840, + /* module tw9910: just ident 9910 */ V4L2_IDENT_TW9910 = 9910, @@ -198,72 +202,70 @@ enum { V4L2_IDENT_CX23101 = 23101, V4L2_IDENT_CX23102 = 23102, - /* module msp3400: reserved range 34000-34999 and 44000-44999 */ + /* module msp3400: reserved range 34000-34999 for msp34xx */ V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only use internally (tveeprom.c). */ V4L2_IDENT_MSP3400B = 34002, - V4L2_IDENT_MSP3410B = 34102, - V4L2_IDENT_MSP3400C = 34003, - V4L2_IDENT_MSP3410C = 34103, - V4L2_IDENT_MSP3400D = 34004, - V4L2_IDENT_MSP3410D = 34104, + V4L2_IDENT_MSP3400G = 34007, + V4L2_IDENT_MSP3401G = 34017, + V4L2_IDENT_MSP3402G = 34027, V4L2_IDENT_MSP3405D = 34054, - V4L2_IDENT_MSP3415D = 34154, + V4L2_IDENT_MSP3405G = 34057, V4L2_IDENT_MSP3407D = 34074, - V4L2_IDENT_MSP3417D = 34174, + V4L2_IDENT_MSP3407G = 34077, - V4L2_IDENT_MSP3400G = 34007, + V4L2_IDENT_MSP3410B = 34102, + V4L2_IDENT_MSP3410C = 34103, + V4L2_IDENT_MSP3410D = 34104, V4L2_IDENT_MSP3410G = 34107, - V4L2_IDENT_MSP3420G = 34207, - V4L2_IDENT_MSP3430G = 34307, - V4L2_IDENT_MSP3440G = 34407, - V4L2_IDENT_MSP3450G = 34507, - V4L2_IDENT_MSP3460G = 34607, - - V4L2_IDENT_MSP3401G = 34017, V4L2_IDENT_MSP3411G = 34117, - V4L2_IDENT_MSP3421G = 34217, - V4L2_IDENT_MSP3431G = 34317, - V4L2_IDENT_MSP3441G = 34417, - V4L2_IDENT_MSP3451G = 34517, - V4L2_IDENT_MSP3461G = 34617, - - V4L2_IDENT_MSP3402G = 34027, V4L2_IDENT_MSP3412G = 34127, - V4L2_IDENT_MSP3422G = 34227, - V4L2_IDENT_MSP3442G = 34427, - V4L2_IDENT_MSP3452G = 34527, - - V4L2_IDENT_MSP3405G = 34057, + V4L2_IDENT_MSP3415D = 34154, V4L2_IDENT_MSP3415G = 34157, - V4L2_IDENT_MSP3425G = 34257, - V4L2_IDENT_MSP3435G = 34357, - V4L2_IDENT_MSP3445G = 34457, - V4L2_IDENT_MSP3455G = 34557, - V4L2_IDENT_MSP3465G = 34657, - - V4L2_IDENT_MSP3407G = 34077, + V4L2_IDENT_MSP3417D = 34174, V4L2_IDENT_MSP3417G = 34177, + + V4L2_IDENT_MSP3420G = 34207, + V4L2_IDENT_MSP3421G = 34217, + V4L2_IDENT_MSP3422G = 34227, + V4L2_IDENT_MSP3425G = 34257, V4L2_IDENT_MSP3427G = 34277, + + V4L2_IDENT_MSP3430G = 34307, + V4L2_IDENT_MSP3431G = 34317, + V4L2_IDENT_MSP3435G = 34357, V4L2_IDENT_MSP3437G = 34377, + + V4L2_IDENT_MSP3440G = 34407, + V4L2_IDENT_MSP3441G = 34417, + V4L2_IDENT_MSP3442G = 34427, + V4L2_IDENT_MSP3445G = 34457, V4L2_IDENT_MSP3447G = 34477, + + V4L2_IDENT_MSP3450G = 34507, + V4L2_IDENT_MSP3451G = 34517, + V4L2_IDENT_MSP3452G = 34527, + V4L2_IDENT_MSP3455G = 34557, V4L2_IDENT_MSP3457G = 34577, + + V4L2_IDENT_MSP3460G = 34607, + V4L2_IDENT_MSP3461G = 34617, + V4L2_IDENT_MSP3465G = 34657, V4L2_IDENT_MSP3467G = 34677, - /* module msp3400: reserved range 34000-34999 and 44000-44999 */ + /* module msp3400: reserved range 44000-44999 for msp44xx */ V4L2_IDENT_MSP4400G = 44007, - V4L2_IDENT_MSP4410G = 44107, - V4L2_IDENT_MSP4420G = 44207, - V4L2_IDENT_MSP4440G = 44407, - V4L2_IDENT_MSP4450G = 44507, - V4L2_IDENT_MSP4408G = 44087, + V4L2_IDENT_MSP4410G = 44107, V4L2_IDENT_MSP4418G = 44187, + V4L2_IDENT_MSP4420G = 44207, V4L2_IDENT_MSP4428G = 44287, + V4L2_IDENT_MSP4440G = 44407, V4L2_IDENT_MSP4448G = 44487, + V4L2_IDENT_MSP4450G = 44507, V4L2_IDENT_MSP4458G = 44587, /* Micron CMOS sensor chips: 45000-45099 */ @@ -282,6 +284,12 @@ enum { /* HV7131R CMOS sensor: just ident 46000 */ V4L2_IDENT_HV7131R = 46000, + /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */ + V4L2_IDENT_RJ54N1CB0C = 51980, + + /* module m52790: just ident 52790 */ + V4L2_IDENT_M52790 = 52790, + /* module cs53132a: just ident 53132 */ V4L2_IDENT_CS53l32A = 53132, @@ -291,11 +299,7 @@ enum { /* module upd64083: just ident 64083 */ V4L2_IDENT_UPD64083 = 64083, - /* module m52790: just ident 52790 */ - V4L2_IDENT_M52790 = 52790, - - /* Sharp RJ54N1CB0C, 0xCB0C = 51980 */ - V4L2_IDENT_RJ54N1CB0C = 51980, + /* Don't just add new IDs at the end: KEEP THIS LIST ORDERED BY ID! */ }; #endif -- GitLab From 9c33afc6102517764fb5d308dcf49bf42893da2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Moine?= Date: Wed, 17 Mar 2010 15:25:32 -0300 Subject: [PATCH 193/534] V4L/DVB: gspca - sonixj: More static const and better array initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/sonixj.c | 136 +++++++++++++++++------------ 1 file changed, 78 insertions(+), 58 deletions(-) diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 1d61b92f6bfc..20ca161bc3d0 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c @@ -67,17 +67,19 @@ struct sd { #define BRIDGE_SN9C110 2 #define BRIDGE_SN9C120 3 u8 sensor; /* Type of image sensor chip */ -#define SENSOR_ADCM1700 0 -#define SENSOR_HV7131R 1 -#define SENSOR_MI0360 2 -#define SENSOR_MO4000 3 -#define SENSOR_MT9V111 4 -#define SENSOR_OM6802 5 -#define SENSOR_OV7630 6 -#define SENSOR_OV7648 7 -#define SENSOR_OV7660 8 -#define SENSOR_PO1030 9 -#define SENSOR_SP80708 10 +enum { + SENSOR_ADCM1700, + SENSOR_HV7131R, + SENSOR_MI0360, + SENSOR_MO4000, + SENSOR_MT9V111, + SENSOR_OM6802, + SENSOR_OV7630, + SENSOR_OV7648, + SENSOR_OV7660, + SENSOR_PO1030, + SENSOR_SP80708, +} sensors; u8 i2c_addr; u8 *jpeg_hdr; @@ -281,29 +283,47 @@ static const struct ctrl sd_ctrls[] = { }; /* table of the disabled controls */ -static __u32 ctrl_dis[] = { - (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX) | - (1 << AUTOGAIN_IDX), /* SENSOR_ADCM1700 0 */ - (1 << INFRARED_IDX) | (1 << FREQ_IDX), - /* SENSOR_HV7131R 1 */ - (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), - /* SENSOR_MI0360 2 */ - (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), - /* SENSOR_MO4000 3 */ - (1 << VFLIP_IDX) | (1 << FREQ_IDX), - /* SENSOR_MT9V111 4 */ - (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), - /* SENSOR_OM6802 5 */ - (1 << INFRARED_IDX), - /* SENSOR_OV7630 6 */ - (1 << INFRARED_IDX), - /* SENSOR_OV7648 7 */ - (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), - /* SENSOR_OV7660 8 */ - (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | - (1 << FREQ_IDX), /* SENSOR_PO1030 9 */ - (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | - (1 << FREQ_IDX), /* SENSOR_SP80708 10 */ +static const __u32 ctrl_dis[] = { +[SENSOR_ADCM1700] = (1 << AUTOGAIN_IDX) | + (1 << INFRARED_IDX) | + (1 << VFLIP_IDX) | + (1 << FREQ_IDX), + +[SENSOR_HV7131R] = (1 << INFRARED_IDX) | + (1 << FREQ_IDX), + +[SENSOR_MI0360] = (1 << INFRARED_IDX) | + (1 << VFLIP_IDX) | + (1 << FREQ_IDX), + +[SENSOR_MO4000] = (1 << INFRARED_IDX) | + (1 << VFLIP_IDX) | + (1 << FREQ_IDX), + +[SENSOR_MT9V111] = (1 << VFLIP_IDX) | + (1 << FREQ_IDX), + +[SENSOR_OM6802] = (1 << INFRARED_IDX) | + (1 << VFLIP_IDX) | + (1 << FREQ_IDX), + +[SENSOR_OV7630] = (1 << INFRARED_IDX), + +[SENSOR_OV7648] = (1 << INFRARED_IDX), + +[SENSOR_OV7660] = (1 << AUTOGAIN_IDX) | + (1 << INFRARED_IDX) | + (1 << VFLIP_IDX), + +[SENSOR_PO1030] = (1 << AUTOGAIN_IDX) | + (1 << INFRARED_IDX) | + (1 << VFLIP_IDX) | + (1 << FREQ_IDX), + +[SENSOR_SP80708] = (1 << AUTOGAIN_IDX) | + (1 << INFRARED_IDX) | + (1 << VFLIP_IDX) | + (1 << FREQ_IDX), }; static const struct v4l2_pix_format cif_mode[] = { @@ -456,17 +476,17 @@ static const u8 sn_sp80708[0x1c] = { /* sequence specific to the sensors - !! index = SENSOR_xxx */ static const u8 *sn_tb[] = { - sn_adcm1700, - sn_hv7131, - sn_mi0360, - sn_mo4000, - sn_mt9v111, - sn_om6802, - sn_ov7630, - sn_ov7648, - sn_ov7660, - sn_po1030, - sn_sp80708 +[SENSOR_ADCM1700] = sn_adcm1700, +[SENSOR_HV7131R] = sn_hv7131, +[SENSOR_MI0360] = sn_mi0360, +[SENSOR_MO4000] = sn_mo4000, +[SENSOR_MT9V111] = sn_mt9v111, +[SENSOR_OM6802] = sn_om6802, +[SENSOR_OV7630] = sn_ov7630, +[SENSOR_OV7648] = sn_ov7648, +[SENSOR_OV7660] = sn_ov7660, +[SENSOR_PO1030] = sn_po1030, +[SENSOR_SP80708] = sn_sp80708 }; /* default gamma table */ @@ -1069,18 +1089,18 @@ static const u8 sp80708_sensor_param1[][8] = { {} }; -static const u8 (*sensor_init[11])[8] = { - adcm1700_sensor_init, /* ADCM1700 0 */ - hv7131r_sensor_init, /* HV7131R 1 */ - mi0360_sensor_init, /* MI0360 2 */ - mo4000_sensor_init, /* MO4000 3 */ - mt9v111_sensor_init, /* MT9V111 4 */ - om6802_sensor_init, /* OM6802 5 */ - ov7630_sensor_init, /* OV7630 6 */ - ov7648_sensor_init, /* OV7648 7 */ - ov7660_sensor_init, /* OV7660 8 */ - po1030_sensor_init, /* PO1030 9 */ - sp80708_sensor_init, /* SP80708 10 */ +static const u8 (*sensor_init[])[8] = { +[SENSOR_ADCM1700] = adcm1700_sensor_init, +[SENSOR_HV7131R] = hv7131r_sensor_init, +[SENSOR_MI0360] = mi0360_sensor_init, +[SENSOR_MO4000] = mo4000_sensor_init, +[SENSOR_MT9V111] = mt9v111_sensor_init, +[SENSOR_OM6802] = om6802_sensor_init, +[SENSOR_OV7630] = ov7630_sensor_init, +[SENSOR_OV7648] = ov7648_sensor_init, +[SENSOR_OV7660] = ov7660_sensor_init, +[SENSOR_PO1030] = po1030_sensor_init, +[SENSOR_SP80708] = sp80708_sensor_init, }; /* read bytes to gspca_dev->usb_buf */ @@ -1703,7 +1723,7 @@ static void setcolors(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; int i, v; u8 reg8a[12]; /* U & V gains */ - static s16 uv[6] = { /* same as reg84 in signed decimal */ + static const s16 uv[6] = { /* same as reg84 in signed decimal */ -24, -38, 64, /* UR UG UB */ 62, -51, -9 /* VR VG VB */ }; -- GitLab From ad98c0f674796848c6fd8fe614ef83ef971ebfcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Moine?= Date: Thu, 18 Mar 2010 05:15:30 -0300 Subject: [PATCH 194/534] V4L/DVB: gspca - sonixj: Add webcam 0c45:6142 with sensors gc0307 and po2030n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/gspca.txt | 1 + drivers/media/video/gspca/sonixj.c | 297 +++++++++++++++++++++++++++- 2 files changed, 290 insertions(+), 8 deletions(-) diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 181b9e6fd984..9475e1e14411 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -305,6 +305,7 @@ sonixj 0c45:6138 Sn9c120 Mo4000 sonixj 0c45:613a Microdia Sonix PC Camera sonixj 0c45:613b Surfer SN-206 sonixj 0c45:613c Sonix Pccam168 +sonixj 0c45:6142 Hama PC-Webcam AC-150 sonixj 0c45:6143 Sonix Pccam168 sonixj 0c45:6148 Digitus DA-70811/ZSMC USB PC Camera ZS211/Microdia sonixj 0c45:614a Frontech E-Ccam (JIL-2225) diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 20ca161bc3d0..aaa68ddb1fb4 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c @@ -69,6 +69,7 @@ struct sd { u8 sensor; /* Type of image sensor chip */ enum { SENSOR_ADCM1700, + SENSOR_GC0307, SENSOR_HV7131R, SENSOR_MI0360, SENSOR_MO4000, @@ -78,6 +79,7 @@ enum { SENSOR_OV7648, SENSOR_OV7660, SENSOR_PO1030, + SENSOR_PO2030N, SENSOR_SP80708, } sensors; u8 i2c_addr; @@ -289,6 +291,11 @@ static const __u32 ctrl_dis[] = { (1 << VFLIP_IDX) | (1 << FREQ_IDX), +[SENSOR_GC0307] = (1 << AUTOGAIN_IDX) | + (1 << INFRARED_IDX) | + (1 << VFLIP_IDX) | + (1 << FREQ_IDX), + [SENSOR_HV7131R] = (1 << INFRARED_IDX) | (1 << FREQ_IDX), @@ -320,6 +327,11 @@ static const __u32 ctrl_dis[] = { (1 << VFLIP_IDX) | (1 << FREQ_IDX), +[SENSOR_PO2030N] = (1 << AUTOGAIN_IDX) | + (1 << INFRARED_IDX) | + (1 << VFLIP_IDX) | + (1 << FREQ_IDX), + [SENSOR_SP80708] = (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | @@ -363,7 +375,17 @@ static const u8 sn_adcm1700[0x1c] = { 0x06, 0x00, 0x00, 0x00 }; -/*Data from sn9c102p+hv7131r */ +static const u8 sn_gc0307[0x1c] = { +/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ + 0x00, 0x61, 0x62, 0x00, 0x1a, 0x00, 0x00, 0x00, +/* reg8 reg9 rega regb regc regd rege regf */ + 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ + 0x03, 0x00, 0x03, 0x01, 0x08, 0x28, 0x1e, 0x02, +/* reg18 reg19 reg1a reg1b */ + 0x06, 0x00, 0x00, 0x00 +}; + static const u8 sn_hv7131[0x1c] = { /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ 0x00, 0x03, 0x64, 0x00, 0x1a, 0x20, 0x20, 0x20, @@ -463,6 +485,17 @@ static const u8 sn_po1030[0x1c] = { 0x07, 0x00, 0x00, 0x00 }; +static const u8 sn_po2030n[0x1c] = { +/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ + 0x00, 0x63, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, +/* reg8 reg9 rega regb regc regd rege regf */ + 0x81, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */ + 0x03, 0x00, 0x00, 0x01, 0x14, 0x28, 0x1e, 0x00, +/* reg18 reg19 reg1a reg1b */ + 0x07, 0x00, 0x00, 0x00 +}; + static const u8 sn_sp80708[0x1c] = { /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */ 0x00, 0x63, 0x60, 0x00, 0x1a, 0x20, 0x20, 0x20, @@ -477,6 +510,7 @@ static const u8 sn_sp80708[0x1c] = { /* sequence specific to the sensors - !! index = SENSOR_xxx */ static const u8 *sn_tb[] = { [SENSOR_ADCM1700] = sn_adcm1700, +[SENSOR_GC0307] = sn_gc0307, [SENSOR_HV7131R] = sn_hv7131, [SENSOR_MI0360] = sn_mi0360, [SENSOR_MO4000] = sn_mo4000, @@ -486,6 +520,7 @@ static const u8 *sn_tb[] = { [SENSOR_OV7648] = sn_ov7648, [SENSOR_OV7660] = sn_ov7660, [SENSOR_PO1030] = sn_po1030, +[SENSOR_PO2030N] = sn_po2030n, [SENSOR_SP80708] = sn_sp80708 }; @@ -504,8 +539,13 @@ static const u8 gamma_spec_1[17] = { 0x08, 0x3a, 0x52, 0x65, 0x75, 0x83, 0x91, 0x9d, 0xa9, 0xb4, 0xbe, 0xc8, 0xd2, 0xdb, 0xe4, 0xed, 0xf5 }; -/* gamma for sensor SP80708 */ +/* gamma for sensor GC0307 */ static const u8 gamma_spec_2[17] = { + 0x14, 0x37, 0x50, 0x6a, 0x7c, 0x8d, 0x9d, 0xab, + 0xb5, 0xbf, 0xc2, 0xcb, 0xd1, 0xd6, 0xdb, 0xe1, 0xeb +}; +/* gamma for sensor SP80708 */ +static const u8 gamma_spec_3[17] = { 0x0a, 0x2d, 0x4e, 0x68, 0x7d, 0x8f, 0x9f, 0xab, 0xb7, 0xc2, 0xcc, 0xd3, 0xd8, 0xde, 0xe2, 0xe5, 0xe6 }; @@ -553,6 +593,64 @@ static const u8 adcm1700_sensor_param1[][8] = { {0xb0, 0x51, 0x32, 0x00, 0xa2, 0x00, 0x00, 0x10}, {} }; +static const u8 gc0307_sensor_init[][8] = { + {0xa0, 0x21, 0x43, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x44, 0xa2, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x01, 0x6a, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x02, 0x70, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x11, 0x05, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x08, 0x02, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x09, 0x01, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x0a, 0xe8, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x0b, 0x02, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x0d, 0x22, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x0f, 0xb2, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x12, 0x70, 0x00, 0x00, 0x00, 0x10}, + {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 10ms*/ + {0xa0, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x15, 0xb8, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x16, 0x13, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x17, 0x52, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x18, 0x50, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x1e, 0x0d, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x1f, 0x32, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x61, 0x90, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x63, 0x70, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x65, 0x98, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x67, 0x90, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x04, 0x96, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x45, 0x27, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x47, 0x2c, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x43, 0x47, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x44, 0xd8, 0x00, 0x00, 0x00, 0x10}, + {} +}; +static const u8 gc0307_sensor_param1[][8] = { + {0xa0, 0x21, 0x68, 0x13, 0x00, 0x00, 0x00, 0x10}, + {0xd0, 0x21, 0x61, 0x80, 0x00, 0x80, 0x00, 0x10}, + {0xc0, 0x21, 0x65, 0x80, 0x00, 0x80, 0x00, 0x10}, + {0xc0, 0x21, 0x63, 0xa0, 0x00, 0xa6, 0x00, 0x10}, +/*param3*/ + {0xa0, 0x21, 0x01, 0x6e, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x02, 0x88, 0x00, 0x00, 0x00, 0x10}, + + {0xa0, 0x21, 0x68, 0x22, 0x00, 0x00, 0x00, 0x10}, + {0xdd, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0xa0, 0x21, 0x03, 0x07, 0x00, 0x00, 0x00, 0x10}, + {0xdd, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0xa0, 0x21, 0x04, 0x91, 0x00, 0x00, 0x00, 0x10}, + {} +}; + static const u8 hv7131r_sensor_init[][8] = { {0xc1, 0x11, 0x01, 0x08, 0x01, 0x00, 0x00, 0x10}, {0xb1, 0x11, 0x34, 0x17, 0x7f, 0x00, 0x00, 0x10}, @@ -1004,6 +1102,82 @@ static const u8 po1030_sensor_param1[][8] = { {} }; +static const u8 po2030n_sensor_init[][8] = { + {0xa1, 0x6e, 0x1e, 0x1a, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x1f, 0x99, 0x00, 0x00, 0x00, 0x10}, + {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */ + {0xa1, 0x6e, 0x1e, 0x0a, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x1f, 0x19, 0x00, 0x00, 0x00, 0x10}, + {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */ + {0xa1, 0x6e, 0x20, 0x44, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x05, 0x70, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x08, 0x00, 0xd0, 0x00, 0x08, 0x10}, + {0xd1, 0x6e, 0x0c, 0x03, 0x50, 0x01, 0xe8, 0x10}, + {0xd1, 0x6e, 0x1d, 0x20, 0x0a, 0x19, 0x44, 0x10}, + {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x29, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x31, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x35, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x41, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x45, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x49, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x4d, 0x00, 0x00, 0x00, 0xed, 0x10}, + {0xd1, 0x6e, 0x51, 0x17, 0x4a, 0x2f, 0xc0, 0x10}, + {0xd1, 0x6e, 0x55, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x59, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x61, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x71, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x75, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x79, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x81, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x85, 0x00, 0x00, 0x00, 0x08, 0x10}, + {0xd1, 0x6e, 0x89, 0x01, 0xe8, 0x00, 0x01, 0x10}, + {0xa1, 0x6e, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x25, 0x00, 0x00, 0x00, 0x01, 0x10}, + {0xd1, 0x6e, 0x29, 0xe6, 0x00, 0xbd, 0x03, 0x10}, + {0xd1, 0x6e, 0x2d, 0x41, 0x38, 0x68, 0x40, 0x10}, + {0xd1, 0x6e, 0x31, 0x2b, 0x00, 0x36, 0x00, 0x10}, + {0xd1, 0x6e, 0x35, 0x30, 0x30, 0x08, 0x00, 0x10}, + {0xd1, 0x6e, 0x39, 0x00, 0x00, 0x33, 0x06, 0x10}, + {0xb1, 0x6e, 0x3d, 0x06, 0x02, 0x00, 0x00, 0x10}, + {} +}; +static const u8 po2030n_sensor_param1[][8] = { + {0xa1, 0x6e, 0x1a, 0x01, 0x00, 0x00, 0x00, 0x10}, + {0xdd, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 8ms */ + {0xa1, 0x6e, 0x1b, 0xf4, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10}, + {0xd1, 0x6e, 0x16, 0x50, 0x40, 0x49, 0x40, 0x10}, +/*param2*/ + {0xa1, 0x6e, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x05, 0x6f, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x07, 0x25, 0x00, 0x00, 0x00, 0x10}, + {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10}, + {0xc1, 0x6e, 0x16, 0x52, 0x40, 0x48, 0x00, 0x10}, +/*after start*/ + {0xa1, 0x6e, 0x15, 0x0f, 0x00, 0x00, 0x00, 0x10}, + {0xdd, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */ + {0xa1, 0x6e, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x10}, + {0xdd, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */ + {0xa1, 0x6e, 0x1b, 0x53, 0x00, 0x00, 0x00, 0x10}, + {} +}; + static const u8 sp80708_sensor_init[][8] = { {0xa1, 0x18, 0x06, 0xf9, 0x00, 0x00, 0x00, 0x10}, {0xa1, 0x18, 0x09, 0x1f, 0x00, 0x00, 0x00, 0x10}, @@ -1091,6 +1265,7 @@ static const u8 sp80708_sensor_param1[][8] = { static const u8 (*sensor_init[])[8] = { [SENSOR_ADCM1700] = adcm1700_sensor_init, +[SENSOR_GC0307] = gc0307_sensor_init, [SENSOR_HV7131R] = hv7131r_sensor_init, [SENSOR_MI0360] = mi0360_sensor_init, [SENSOR_MO4000] = mo4000_sensor_init, @@ -1100,6 +1275,7 @@ static const u8 (*sensor_init[])[8] = { [SENSOR_OV7648] = ov7648_sensor_init, [SENSOR_OV7660] = ov7660_sensor_init, [SENSOR_PO1030] = po1030_sensor_init, +[SENSOR_PO2030N] = po2030n_sensor_init, [SENSOR_SP80708] = sp80708_sensor_init, }; @@ -1169,7 +1345,8 @@ static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) PDEBUG(D_USBO, "i2c_w2 [%02x] = %02x", reg, val); switch (sd->sensor) { case SENSOR_ADCM1700: - case SENSOR_OM6802: /* i2c command = a0 (100 kHz) */ + case SENSOR_OM6802: + case SENSOR_GC0307: /* i2c command = a0 (100 kHz) */ gspca_dev->usb_buf[0] = 0x80 | (2 << 4); break; default: /* i2c command = a1 (400 kHz) */ @@ -1216,7 +1393,8 @@ static void i2c_r(struct gspca_dev *gspca_dev, u8 reg, int len) switch (sd->sensor) { case SENSOR_ADCM1700: - case SENSOR_OM6802: /* i2c command = 90 (100 kHz) */ + case SENSOR_OM6802: + case SENSOR_GC0307: /* i2c command = a0 (100 kHz) */ mode[0] = 0x80 | 0x10; break; default: /* i2c command = 91 (400 kHz) */ @@ -1355,6 +1533,46 @@ static void ov7648_probe(struct gspca_dev *gspca_dev) gspca_dev->usb_buf[3], gspca_dev->usb_buf[4]); } +/* 0c45:6142 sensor may be po2030n, gc0305 or gc0307 */ +static void po2030n_probe(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + /* check gc0307 */ + reg_w1(gspca_dev, 0x17, 0x62); + reg_w1(gspca_dev, 0x01, 0x08); + reg_w1(gspca_dev, 0x02, 0x22); + sd->i2c_addr = 0x21; + i2c_r(gspca_dev, 0x00, 1); + + reg_w1(gspca_dev, 0x01, 0x29); /* reset */ + reg_w1(gspca_dev, 0x17, 0x42); + + if (gspca_dev->usb_buf[4] == 0x99) { /* gc0307 (?) */ + PDEBUG(D_PROBE, "Sensor gc0307"); + sd->sensor = SENSOR_GC0307; + return; + } + + /* check po2030n */ + reg_w1(gspca_dev, 0x17, 0x62); + reg_w1(gspca_dev, 0x01, 0x0a); + sd->i2c_addr = 0x6e; + i2c_r(gspca_dev, 0x00, 2); + + reg_w1(gspca_dev, 0x01, 0x29); + reg_w1(gspca_dev, 0x17, 0x42); + + if (gspca_dev->usb_buf[3] == 0x20 + && gspca_dev->usb_buf[4] == 0x30) + PDEBUG(D_PROBE, "Sensor po2030n"); +/* sd->sensor = SENSOR_PO2030N; */ + else + PDEBUG(D_PROBE, "Unknown sensor ID %02x%02x", + gspca_dev->usb_buf[3], + gspca_dev->usb_buf[4]); +} + static void bridge_init(struct gspca_dev *gspca_dev, const u8 *sn9c1xx) { @@ -1375,8 +1593,10 @@ static void bridge_init(struct gspca_dev *gspca_dev, reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); switch (sd->sensor) { + case SENSOR_GC0307: case SENSOR_OV7660: case SENSOR_PO1030: + case SENSOR_PO2030N: case SENSOR_SP80708: reg9a = reg9a_spec; break; @@ -1397,6 +1617,14 @@ static void bridge_init(struct gspca_dev *gspca_dev, reg_w1(gspca_dev, 0x01, 0x42); reg_w1(gspca_dev, 0x01, 0x42); break; + case SENSOR_GC0307: + msleep(50); + reg_w1(gspca_dev, 0x01, 0x61); + reg_w1(gspca_dev, 0x17, 0x22); + reg_w1(gspca_dev, 0x01, 0x60); + reg_w1(gspca_dev, 0x01, 0x40); + msleep(50); + break; case SENSOR_MT9V111: reg_w1(gspca_dev, 0x01, 0x61); reg_w1(gspca_dev, 0x17, 0x61); @@ -1439,6 +1667,12 @@ static void bridge_init(struct gspca_dev *gspca_dev, reg_w1(gspca_dev, 0x01, 0x60); reg_w1(gspca_dev, 0x01, 0x40); break; + case SENSOR_PO2030N: + reg_w1(gspca_dev, 0x01, 0x63); + reg_w1(gspca_dev, 0x17, 0x20); + reg_w1(gspca_dev, 0x01, 0x62); + reg_w1(gspca_dev, 0x01, 0x42); + break; case SENSOR_OV7660: /* fall thru */ case SENSOR_SP80708: @@ -1546,6 +1780,9 @@ static int sd_init(struct gspca_dev *gspca_dev) case SENSOR_OV7648: ov7648_probe(gspca_dev); break; + case SENSOR_PO2030N: + po2030n_probe(gspca_dev); + break; } regGpio[1] = 0x70; reg_w(gspca_dev, 0x01, regGpio, 2); @@ -1764,9 +2001,12 @@ static void setgamma(struct gspca_dev *gspca_dev) case SENSOR_MT9V111: gamma_base = gamma_spec_1; break; - case SENSOR_SP80708: + case SENSOR_GC0307: gamma_base = gamma_spec_2; break; + case SENSOR_SP80708: + gamma_base = gamma_spec_3; + break; default: gamma_base = gamma_def; break; @@ -1957,9 +2197,15 @@ static int sd_start(struct gspca_dev *gspca_dev) static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; static const u8 CA_adcm1700[] = { 0x14, 0xec, 0x0a, 0xf6 }; + static const u8 CA_po2030n[] = + { 0x1e, 0xe2, 0x14, 0xec }; static const u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ + static const u8 CE_gc0307[] = + { 0x32, 0xce, 0x2d, 0xd3 }; static const u8 CE_ov76xx[] = { 0x32, 0xdd, 0x32, 0xdd }; + static const u8 CE_po2030n[] = + { 0x14, 0xe7, 0x1e, 0xdd }; /* create the JPEG header */ sd->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL); @@ -2016,6 +2262,9 @@ static int sd_start(struct gspca_dev *gspca_dev) } reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); switch (sd->sensor) { + case SENSOR_GC0307: + reg17 = 0xa2; + break; case SENSOR_MT9V111: reg17 = 0xe0; break; @@ -2030,6 +2279,7 @@ static int sd_start(struct gspca_dev *gspca_dev) reg17 = 0xa0; break; case SENSOR_PO1030: + case SENSOR_PO2030N: reg17 = 0xa0; break; default: @@ -2054,12 +2304,16 @@ static int sd_start(struct gspca_dev *gspca_dev) case SENSOR_SP80708: reg_w1(gspca_dev, 0x9a, 0x05); break; + case SENSOR_GC0307: case SENSOR_MT9V111: reg_w1(gspca_dev, 0x9a, 0x07); break; case SENSOR_OV7648: reg_w1(gspca_dev, 0x9a, 0x0a); break; + case SENSOR_PO2030N: + reg_w1(gspca_dev, 0x9a, 0x06); + break; default: reg_w1(gspca_dev, 0x9a, 0x08); break; @@ -2084,6 +2338,11 @@ static int sd_start(struct gspca_dev *gspca_dev) reg1 = 0x46; reg17 = 0xe2; break; + case SENSOR_GC0307: + init = gc0307_sensor_param1; + reg17 = 0xa2; + reg1 = 0x44; + break; case SENSOR_MO4000: if (mode) { /* reg1 = 0x46; * 320 clk 48Mhz 60fp/s */ @@ -2133,6 +2392,11 @@ static int sd_start(struct gspca_dev *gspca_dev) reg17 = 0xa2; reg1 = 0x44; break; + case SENSOR_PO2030N: + init = po2030n_sensor_param1; + reg1 = 0x46; + reg17 = 0xa2; + break; default: /* case SENSOR_SP80708: */ init = sp80708_sensor_param1; @@ -2152,10 +2416,18 @@ static int sd_start(struct gspca_dev *gspca_dev) } reg_w(gspca_dev, 0xc0, C0, 6); - if (sd->sensor == SENSOR_ADCM1700) + switch (sd->sensor) { + case SENSOR_ADCM1700: + case SENSOR_GC0307: reg_w(gspca_dev, 0xca, CA_adcm1700, 4); - else + break; + case SENSOR_PO2030N: + reg_w(gspca_dev, 0xca, CA_po2030n, 4); + break; + default: reg_w(gspca_dev, 0xca, CA, 4); + break; + } switch (sd->sensor) { case SENSOR_ADCM1700: case SENSOR_OV7630: @@ -2163,6 +2435,12 @@ static int sd_start(struct gspca_dev *gspca_dev) case SENSOR_OV7660: reg_w(gspca_dev, 0xce, CE_ov76xx, 4); break; + case SENSOR_GC0307: + reg_w(gspca_dev, 0xce, CE_gc0307, 4); + break; + case SENSOR_PO2030N: + reg_w(gspca_dev, 0xce, CE_po2030n, 4); + break; default: reg_w(gspca_dev, 0xce, CE, 4); /* ?? {0x1e, 0xdd, 0x2d, 0xe7} */ @@ -2200,6 +2478,9 @@ static void sd_stopN(struct gspca_dev *gspca_dev) data = 0x0b; switch (sd->sensor) { + case SENSOR_GC0307: + data = 0x29; + break; case SENSOR_HV7131R: i2c_w8(gspca_dev, stophv7131); data = 0x2b; @@ -2676,7 +2957,7 @@ static const __devinitdata struct usb_device_id device_table[] = { #endif {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)}, {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)}, -/* {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, *sn9c120b*/ + {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/ {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/ {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/ {USB_DEVICE(0x0c45, 0x614a), BS(SN9C120, ADCM1700)}, /*sn9c120b*/ -- GitLab From a39db27a08ef85ae37beab261744d8b38f21225c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 18 May 2010 00:49:44 -0300 Subject: [PATCH 195/534] V4L/DVB: gspca - sn9c20x: use gspca's input device handling Drop custom code for handling the input button in favor of using gspca's input hanlding mechinism. Signed-off-by: Brian Johnson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/Kconfig | 6 -- drivers/media/video/gspca/sn9c20x.c | 147 +++++++--------------------- 2 files changed, 34 insertions(+), 119 deletions(-) diff --git a/drivers/media/video/gspca/Kconfig b/drivers/media/video/gspca/Kconfig index e0060c1f0544..5d920e584de7 100644 --- a/drivers/media/video/gspca/Kconfig +++ b/drivers/media/video/gspca/Kconfig @@ -172,12 +172,6 @@ config USB_GSPCA_SN9C20X To compile this driver as a module, choose M here: the module will be called gspca_sn9c20x. -config USB_GSPCA_SN9C20X_EVDEV - bool "Enable evdev support" - depends on USB_GSPCA_SN9C20X && INPUT - ---help--- - Say Y here in order to enable evdev support for sn9c20x webcam button. - config USB_GSPCA_SONIXB tristate "SONIX Bayer USB Camera Driver" depends on VIDEO_V4L2 && USB_GSPCA diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 04bf80ddfbb8..1653567e992a 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c @@ -18,10 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef CONFIG_USB_GSPCA_SN9C20X_EVDEV -#include -#include -#include +#ifdef CONFIG_INPUT #include #include #endif @@ -55,6 +52,9 @@ MODULE_LICENSE("GPL"); #define SENSOR_HV7131R 10 #define SENSOR_MT9VPRB 20 +/* camera flags */ +#define HAS_BUTTON 0x1 + /* specific webcam descriptor */ struct sd { struct gspca_dev gspca_dev; @@ -88,11 +88,7 @@ struct sd { u8 *jpeg_hdr; u8 quality; -#ifdef CONFIG_USB_GSPCA_SN9C20X_EVDEV - struct input_dev *input_dev; - u8 input_gpio; - struct task_struct *input_task; -#endif + u8 flags; }; struct i2c_reg_u8 { @@ -1421,87 +1417,6 @@ static int hv7131r_init_sensor(struct gspca_dev *gspca_dev) return 0; } -#ifdef CONFIG_USB_GSPCA_SN9C20X_EVDEV -static int input_kthread(void *data) -{ - struct gspca_dev *gspca_dev = (struct gspca_dev *)data; - struct sd *sd = (struct sd *) gspca_dev; - - DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wait); - set_freezable(); - for (;;) { - if (kthread_should_stop()) - break; - - if (reg_r(gspca_dev, 0x1005, 1) < 0) - continue; - - input_report_key(sd->input_dev, - KEY_CAMERA, - gspca_dev->usb_buf[0] & sd->input_gpio); - input_sync(sd->input_dev); - - wait_event_freezable_timeout(wait, - kthread_should_stop(), - msecs_to_jiffies(100)); - } - return 0; -} - - -static int sn9c20x_input_init(struct gspca_dev *gspca_dev) -{ - struct sd *sd = (struct sd *) gspca_dev; - if (sd->input_gpio == 0) - return 0; - - sd->input_dev = input_allocate_device(); - if (!sd->input_dev) - return -ENOMEM; - - sd->input_dev->name = "SN9C20X Webcam"; - - sd->input_dev->phys = kasprintf(GFP_KERNEL, "usb-%s-%s", - gspca_dev->dev->bus->bus_name, - gspca_dev->dev->devpath); - - if (!sd->input_dev->phys) - return -ENOMEM; - - usb_to_input_id(gspca_dev->dev, &sd->input_dev->id); - sd->input_dev->dev.parent = &gspca_dev->dev->dev; - - set_bit(EV_KEY, sd->input_dev->evbit); - set_bit(KEY_CAMERA, sd->input_dev->keybit); - - if (input_register_device(sd->input_dev)) - return -EINVAL; - - sd->input_task = kthread_run(input_kthread, gspca_dev, "sn9c20x/%s-%s", - gspca_dev->dev->bus->bus_name, - gspca_dev->dev->devpath); - - if (IS_ERR(sd->input_task)) - return -EINVAL; - - return 0; -} - -static void sn9c20x_input_cleanup(struct gspca_dev *gspca_dev) -{ - struct sd *sd = (struct sd *) gspca_dev; - if (sd->input_task != NULL && !IS_ERR(sd->input_task)) - kthread_stop(sd->input_task); - - if (sd->input_dev != NULL) { - input_unregister_device(sd->input_dev); - kfree(sd->input_dev->phys); - input_free_device(sd->input_dev); - sd->input_dev = NULL; - } -} -#endif - static int set_cmatrix(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -2005,6 +1920,7 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->sensor = (id->driver_info >> 8) & 0xff; sd->i2c_addr = id->driver_info & 0xff; + sd->flags = (id->driver_info >> 16) & 0xff; switch (sd->sensor) { case SENSOR_MT9M111: @@ -2039,11 +1955,6 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->quality = 95; -#ifdef CONFIG_USB_GSPCA_SN9C20X_EVDEV - sd->input_gpio = (id->driver_info >> 16) & 0xff; - if (sn9c20x_input_init(gspca_dev) < 0) - return -ENODEV; -#endif return 0; } @@ -2343,6 +2254,24 @@ static void sd_dqcallback(struct gspca_dev *gspca_dev) do_autoexposure(gspca_dev, avg_lum); } +#ifdef CONFIG_INPUT +static int sd_int_pkt_scan(struct gspca_dev *gspca_dev, + u8 *data, /* interrupt packet */ + int len) /* interrupt packet length */ +{ + struct sd *sd = (struct sd *) gspca_dev; + int ret = -EINVAL; + if (sd->flags & HAS_BUTTON && len == 1) { + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); + input_sync(gspca_dev->input_dev); + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); + input_sync(gspca_dev->input_dev); + ret = 0; + } + return ret; +} +#endif + static void sd_pkt_scan(struct gspca_dev *gspca_dev, u8 *data, /* isoc packet */ int len) /* iso packet length */ @@ -2409,6 +2338,9 @@ static const struct sd_desc sd_desc = { .stopN = sd_stopN, .stop0 = sd_stop0, .pkt_scan = sd_pkt_scan, +#ifdef CONFIG_INPUT + .int_pkt_scan = sd_int_pkt_scan, +#endif .dq_callback = sd_dqcallback, #ifdef CONFIG_VIDEO_ADV_DEBUG .set_register = sd_dbg_s_register, @@ -2417,8 +2349,8 @@ static const struct sd_desc sd_desc = { .get_chip_ident = sd_chip_ident, }; -#define SN9C20X(sensor, i2c_addr, button_mask) \ - .driver_info = (button_mask << 16) \ +#define SN9C20X(sensor, i2c_addr, flags) \ + .driver_info = (flags << 16) \ | (SENSOR_ ## sensor << 8) \ | (i2c_addr) @@ -2426,7 +2358,7 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)}, - {USB_DEVICE(0x0c45, 0x624e), SN9C20X(SOI968, 0x30, 0x10)}, + {USB_DEVICE(0x0c45, 0x624e), SN9C20X(SOI968, 0x30, HAS_BUTTON)}, {USB_DEVICE(0x0c45, 0x624f), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x6251), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x6253), SN9C20X(OV9650, 0x30, 0)}, @@ -2437,13 +2369,13 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x0c45, 0x627f), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x6280), SN9C20X(MT9M001, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x6282), SN9C20X(MT9M111, 0x5d, 0)}, - {USB_DEVICE(0x0c45, 0x6288), SN9C20X(OV9655, 0x30, 0)}, + {USB_DEVICE(0x0c45, 0x6288), SN9C20X(OV9655, 0x30, HAS_BUTTON)}, {USB_DEVICE(0x0c45, 0x628e), SN9C20X(SOI968, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x628f), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x62a0), SN9C20X(OV7670, 0x21, 0)}, {USB_DEVICE(0x0c45, 0x62b0), SN9C20X(MT9VPRB, 0x00, 0)}, {USB_DEVICE(0x0c45, 0x62b3), SN9C20X(OV9655, 0x30, 0)}, - {USB_DEVICE(0x0c45, 0x62bb), SN9C20X(OV7660, 0x21, 0)}, + {USB_DEVICE(0x0c45, 0x62bb), SN9C20X(OV7660, 0x21, HAS_BUTTON)}, {USB_DEVICE(0x0c45, 0x62bc), SN9C20X(HV7131R, 0x11, 0)}, {USB_DEVICE(0x045e, 0x00f4), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x145f, 0x013d), SN9C20X(OV7660, 0x21, 0)}, @@ -2452,7 +2384,7 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0xa168, 0x0611), SN9C20X(HV7131R, 0x11, 0)}, {USB_DEVICE(0xa168, 0x0613), SN9C20X(HV7131R, 0x11, 0)}, {USB_DEVICE(0xa168, 0x0618), SN9C20X(HV7131R, 0x11, 0)}, - {USB_DEVICE(0xa168, 0x0614), SN9C20X(MT9M111, 0x5d, 0)}, + {USB_DEVICE(0xa168, 0x0614), SN9C20X(MT9M111, 0x5d, HAS_BUTTON)}, {USB_DEVICE(0xa168, 0x0615), SN9C20X(MT9M111, 0x5d, 0)}, {USB_DEVICE(0xa168, 0x0617), SN9C20X(MT9M111, 0x5d, 0)}, {} @@ -2467,22 +2399,11 @@ static int sd_probe(struct usb_interface *intf, THIS_MODULE); } -static void sd_disconnect(struct usb_interface *intf) -{ -#ifdef CONFIG_USB_GSPCA_SN9C20X_EVDEV - struct gspca_dev *gspca_dev = usb_get_intfdata(intf); - - sn9c20x_input_cleanup(gspca_dev); -#endif - - gspca_disconnect(intf); -} - static struct usb_driver sd_driver = { .name = MODULE_NAME, .id_table = device_table, .probe = sd_probe, - .disconnect = sd_disconnect, + .disconnect = gspca_disconnect, #ifdef CONFIG_PM .suspend = gspca_suspend, .resume = gspca_resume, -- GitLab From 0c045eb752259d4176eabacbdf28a627644a071a Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Tue, 16 Mar 2010 13:58:27 -0300 Subject: [PATCH 196/534] V4L/DVB: gspca - sn9c20x: Add support for camera LEDs Signed-off-by: Brian Johnson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/sn9c20x.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 1653567e992a..825d5b8dfd6f 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c @@ -54,6 +54,7 @@ MODULE_LICENSE("GPL"); /* camera flags */ #define HAS_BUTTON 0x1 +#define LED_REVERSE 0x2 /* some cameras unset gpio to turn on leds */ /* specific webcam descriptor */ struct sd { @@ -731,7 +732,8 @@ static u16 bridge_init[][2] = { {0x11be, 0xf0}, {0x11bf, 0x00}, {0x118c, 0x1f}, {0x118d, 0x1f}, {0x118e, 0x1f}, {0x118f, 0x1f}, {0x1180, 0x01}, {0x1181, 0x00}, {0x1182, 0x01}, - {0x1183, 0x00}, {0x1184, 0x50}, {0x1185, 0x80} + {0x1183, 0x00}, {0x1184, 0x50}, {0x1185, 0x80}, + {0x1007, 0x00} }; /* Gain = (bit[3:0] / 16 + 1) * (bit[4] + 1) * (bit[5] + 1) * (bit[6] + 1) */ @@ -1974,6 +1976,11 @@ static int sd_init(struct gspca_dev *gspca_dev) } } + if (sd->flags & LED_REVERSE) + reg_w1(gspca_dev, 0x1006, 0x00); + else + reg_w1(gspca_dev, 0x1006, 0x20); + if (reg_w(gspca_dev, 0x10c0, i2c_init, 9) < 0) { err("Device initialization failed"); return -ENODEV; @@ -2154,6 +2161,8 @@ static int sd_start(struct gspca_dev *gspca_dev) set_exposure(gspca_dev); set_hvflip(gspca_dev); + reg_w1(gspca_dev, 0x1007, 0x20); + reg_r(gspca_dev, 0x1061, 1); reg_w1(gspca_dev, 0x1061, gspca_dev->usb_buf[0] | 0x02); return 0; @@ -2161,6 +2170,8 @@ static int sd_start(struct gspca_dev *gspca_dev) static void sd_stopN(struct gspca_dev *gspca_dev) { + reg_w1(gspca_dev, 0x1007, 0x00); + reg_r(gspca_dev, 0x1061, 1); reg_w1(gspca_dev, 0x1061, gspca_dev->usb_buf[0] & ~0x02); } @@ -2350,7 +2361,7 @@ static const struct sd_desc sd_desc = { }; #define SN9C20X(sensor, i2c_addr, flags) \ - .driver_info = (flags << 16) \ + .driver_info = ((flags & 0xff) << 16) \ | (SENSOR_ ## sensor << 8) \ | (i2c_addr) @@ -2358,7 +2369,8 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)}, - {USB_DEVICE(0x0c45, 0x624e), SN9C20X(SOI968, 0x30, HAS_BUTTON)}, + {USB_DEVICE(0x0c45, 0x624e), SN9C20X(SOI968, 0x30, + (HAS_BUTTON | LED_REVERSE))}, {USB_DEVICE(0x0c45, 0x624f), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x6251), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x6253), SN9C20X(OV9650, 0x30, 0)}, -- GitLab From 7ddaac7fcb01eed38692f1bfa81f5f4348d848d7 Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Tue, 16 Mar 2010 13:58:27 -0300 Subject: [PATCH 197/534] V4L/DVB: gspca - sn9c20x: Add upside down detection Add support for detecting webcams that are mounted upside down in laptops. Currently the only two known are two MSI modesl using the 0c45:624f. Signed-off-by: Brian Johnson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/sn9c20x.c | 50 +++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 825d5b8dfd6f..06c75dbecaee 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c @@ -27,6 +27,7 @@ #include "jpeg.h" #include +#include MODULE_AUTHOR("Brian Johnson , " "microdia project "); @@ -55,6 +56,7 @@ MODULE_LICENSE("GPL"); /* camera flags */ #define HAS_BUTTON 0x1 #define LED_REVERSE 0x2 /* some cameras unset gpio to turn on leds */ +#define FLIP_DETECT 0x4 /* specific webcam descriptor */ struct sd { @@ -127,6 +129,25 @@ static int sd_getexposure(struct gspca_dev *gspca_dev, s32 *val); static int sd_setautoexposure(struct gspca_dev *gspca_dev, s32 val); static int sd_getautoexposure(struct gspca_dev *gspca_dev, s32 *val); +static const struct dmi_system_id flip_dmi_table[] = { + { + .ident = "MSI MS-1034", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "MS-1034"), + DMI_MATCH(DMI_PRODUCT_VERSION, "0341") + } + }, + { + .ident = "MSI MS-1632", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "MSI"), + DMI_MATCH(DMI_BOARD_NAME, "MS-1632") + } + }, + {} +}; + static const struct ctrl sd_ctrls[] = { { #define BRIGHTNESS_IDX 0 @@ -1496,17 +1517,26 @@ static int set_redblue(struct gspca_dev *gspca_dev) static int set_hvflip(struct gspca_dev *gspca_dev) { - u8 value, tslb; + u8 value, tslb, hflip, vflip; u16 value2; struct sd *sd = (struct sd *) gspca_dev; + + if ((sd->flags & FLIP_DETECT) && dmi_check_system(flip_dmi_table)) { + hflip = !sd->hflip; + vflip = !sd->vflip; + } else { + hflip = sd->hflip; + vflip = sd->vflip; + } + switch (sd->sensor) { case SENSOR_OV9650: i2c_r1(gspca_dev, 0x1e, &value); value &= ~0x30; tslb = 0x01; - if (sd->hflip) + if (hflip) value |= 0x20; - if (sd->vflip) { + if (vflip) { value |= 0x10; tslb = 0x49; } @@ -1517,9 +1547,9 @@ static int set_hvflip(struct gspca_dev *gspca_dev) case SENSOR_MT9V011: i2c_r2(gspca_dev, 0x20, &value2); value2 &= ~0xc0a0; - if (sd->hflip) + if (hflip) value2 |= 0x8080; - if (sd->vflip) + if (vflip) value2 |= 0x4020; i2c_w2(gspca_dev, 0x20, value2); break; @@ -1527,18 +1557,18 @@ static int set_hvflip(struct gspca_dev *gspca_dev) case SENSOR_MT9V112: i2c_r2(gspca_dev, 0x20, &value2); value2 &= ~0x0003; - if (sd->hflip) + if (hflip) value2 |= 0x0002; - if (sd->vflip) + if (vflip) value2 |= 0x0001; i2c_w2(gspca_dev, 0x20, value2); break; case SENSOR_HV7131R: i2c_r1(gspca_dev, 0x01, &value); value &= ~0x03; - if (sd->vflip) + if (vflip) value |= 0x01; - if (sd->hflip) + if (hflip) value |= 0x02; i2c_w1(gspca_dev, 0x01, value); break; @@ -2371,7 +2401,7 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x624e), SN9C20X(SOI968, 0x30, (HAS_BUTTON | LED_REVERSE))}, - {USB_DEVICE(0x0c45, 0x624f), SN9C20X(OV9650, 0x30, 0)}, + {USB_DEVICE(0x0c45, 0x624f), SN9C20X(OV9650, 0x30, FLIP_DETECT)}, {USB_DEVICE(0x0c45, 0x6251), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x6253), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x6260), SN9C20X(OV7670, 0x21, 0)}, -- GitLab From e99ac54da6d3e44e6152aaab693fa311279dec7c Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Tue, 16 Mar 2010 13:58:28 -0300 Subject: [PATCH 198/534] V4L/DVB: gspca - sn9c20x: Add support for cameras using the MT9M112 sensor Adds the following models: - 0c45:624c - 0c45:628c - 0458:704a - 0458:704c Signed-off-by: Brian Johnson Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/gspca.txt | 4 +++ drivers/media/video/gspca/sn9c20x.c | 44 +++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt index 9475e1e14411..8f3f5d33327c 100644 --- a/Documentation/video4linux/gspca.txt +++ b/Documentation/video4linux/gspca.txt @@ -50,6 +50,8 @@ zc3xx 0458:700f Genius VideoCam Web V2 sonixj 0458:7025 Genius Eye 311Q sn9c20x 0458:7029 Genius Look 320s sonixj 0458:702e Genius Slim 310 NB +sn9c20x 0458:704a Genius Slim 1320 +sn9c20x 0458:704c Genius i-Look 1321 sn9c20x 045e:00f4 LifeCam VX-6000 (SN9C20x + OV9650) sonixj 045e:00f5 MicroSoft VX3000 sonixj 045e:00f7 MicroSoft VX1000 @@ -312,6 +314,7 @@ sonixj 0c45:614a Frontech E-Ccam (JIL-2225) sn9c20x 0c45:6240 PC Camera (SN9C201 + MT9M001) sn9c20x 0c45:6242 PC Camera (SN9C201 + MT9M111) sn9c20x 0c45:6248 PC Camera (SN9C201 + OV9655) +sn9c20x 0c45:624c PC Camera (SN9C201 + MT9M112) sn9c20x 0c45:624e PC Camera (SN9C201 + SOI968) sn9c20x 0c45:624f PC Camera (SN9C201 + OV9650) sn9c20x 0c45:6251 PC Camera (SN9C201 + OV9650) @@ -324,6 +327,7 @@ sn9c20x 0c45:627f PC Camera (SN9C201 + OV9650) sn9c20x 0c45:6280 PC Camera (SN9C202 + MT9M001) sn9c20x 0c45:6282 PC Camera (SN9C202 + MT9M111) sn9c20x 0c45:6288 PC Camera (SN9C202 + OV9655) +sn9c20x 0c45:628c PC Camera (SN9C201 + MT9M112) sn9c20x 0c45:628e PC Camera (SN9C202 + SOI968) sn9c20x 0c45:628f PC Camera (SN9C202 + OV9650) sn9c20x 0c45:62a0 PC Camera (SN9C202 + OV7670) diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 06c75dbecaee..479fdbb9e673 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c @@ -50,7 +50,8 @@ MODULE_LICENSE("GPL"); #define SENSOR_MT9V112 7 #define SENSOR_MT9M001 8 #define SENSOR_MT9M111 9 -#define SENSOR_HV7131R 10 +#define SENSOR_MT9M112 10 +#define SENSOR_HV7131R 11 #define SENSOR_MT9VPRB 20 /* camera flags */ @@ -731,6 +732,7 @@ static u16 i2c_ident[] = { V4L2_IDENT_MT9V112, V4L2_IDENT_MT9M001C12ST, V4L2_IDENT_MT9M111, + V4L2_IDENT_MT9M112, V4L2_IDENT_HV7131R, }; @@ -1062,6 +1064,13 @@ static struct i2c_reg_u16 mt9m111_init[] = { {0xf0, 0x0000}, }; +static struct i2c_reg_u16 mt9m112_init[] = { + {0xf0, 0x0000}, {0x0d, 0x0021}, {0x0d, 0x0008}, + {0xf0, 0x0001}, {0x3a, 0x4300}, {0x9b, 0x4300}, + {0x06, 0x708e}, {0xf0, 0x0002}, {0x2e, 0x0a1e}, + {0xf0, 0x0000}, +}; + static struct i2c_reg_u8 hv7131r_init[] = { {0x02, 0x08}, {0x02, 0x00}, {0x01, 0x08}, {0x02, 0x00}, {0x20, 0x00}, {0x21, 0xd0}, @@ -1388,6 +1397,23 @@ static int mt9v_init_sensor(struct gspca_dev *gspca_dev) return -ENODEV; } +static int mt9m112_init_sensor(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + int i; + for (i = 0; i < ARRAY_SIZE(mt9m112_init); i++) { + if (i2c_w2(gspca_dev, mt9m112_init[i].reg, + mt9m112_init[i].val) < 0) { + err("MT9M112 sensor initialization failed"); + return -ENODEV; + } + } + gspca_dev->ctrl_dis = (1 << EXPOSURE_IDX) | (1 << AUTOGAIN_IDX) | (1 << GAIN_IDX); + sd->hstart = 0; + sd->vstart = 2; + return 0; +} + static int mt9m111_init_sensor(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -1553,6 +1579,7 @@ static int set_hvflip(struct gspca_dev *gspca_dev) value2 |= 0x4020; i2c_w2(gspca_dev, 0x20, value2); break; + case SENSOR_MT9M112: case SENSOR_MT9M111: case SENSOR_MT9V112: i2c_r2(gspca_dev, 0x20, &value2); @@ -1878,7 +1905,7 @@ static int sd_dbg_g_register(struct gspca_dev *gspca_dev, if (reg->match.addr != sd->i2c_addr) return -EINVAL; if (sd->sensor >= SENSOR_MT9V011 && - sd->sensor <= SENSOR_MT9M111) { + sd->sensor <= SENSOR_MT9M112) { if (i2c_r2(gspca_dev, reg->reg, (u16 *)®->val) < 0) return -EINVAL; } else { @@ -1907,7 +1934,7 @@ static int sd_dbg_s_register(struct gspca_dev *gspca_dev, if (reg->match.addr != sd->i2c_addr) return -EINVAL; if (sd->sensor >= SENSOR_MT9V011 && - sd->sensor <= SENSOR_MT9M111) { + sd->sensor <= SENSOR_MT9M112) { if (i2c_w2(gspca_dev, reg->reg, reg->val) < 0) return -EINVAL; } else { @@ -1955,6 +1982,7 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->flags = (id->driver_info >> 16) & 0xff; switch (sd->sensor) { + case SENSOR_MT9M112: case SENSOR_MT9M111: case SENSOR_OV9650: case SENSOR_SOI968: @@ -2051,6 +2079,11 @@ static int sd_init(struct gspca_dev *gspca_dev) return -ENODEV; info("MT9M111 sensor detected"); break; + case SENSOR_MT9M112: + if (mt9m112_init_sensor(gspca_dev) < 0) + return -ENODEV; + info("MT9M112 sensor detected"); + break; case SENSOR_MT9M001: if (mt9m001_init_sensor(gspca_dev) < 0) return -ENODEV; @@ -2110,6 +2143,7 @@ static void configure_sensor_output(struct gspca_dev *gspca_dev, int mode) i2c_w1(gspca_dev, 0x12, (value & 0x7) | 0x40); } break; + case SENSOR_MT9M112: case SENSOR_MT9M111: if (mode & MODE_SXGA) { i2c_w2(gspca_dev, 0xf0, 0x0002); @@ -2399,6 +2433,7 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)}, + {USB_DEVICE(0x0c45, 0x624c), SN9C20X(MT9M112, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x624e), SN9C20X(SOI968, 0x30, (HAS_BUTTON | LED_REVERSE))}, {USB_DEVICE(0x0c45, 0x624f), SN9C20X(OV9650, 0x30, FLIP_DETECT)}, @@ -2412,6 +2447,7 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x0c45, 0x6280), SN9C20X(MT9M001, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x6282), SN9C20X(MT9M111, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x6288), SN9C20X(OV9655, 0x30, HAS_BUTTON)}, + {USB_DEVICE(0x0c45, 0x628c), SN9C20X(MT9M112, 0x5d, 0)}, {USB_DEVICE(0x0c45, 0x628e), SN9C20X(SOI968, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x628f), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x0c45, 0x62a0), SN9C20X(OV7670, 0x21, 0)}, @@ -2422,6 +2458,8 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x045e, 0x00f4), SN9C20X(OV9650, 0x30, 0)}, {USB_DEVICE(0x145f, 0x013d), SN9C20X(OV7660, 0x21, 0)}, {USB_DEVICE(0x0458, 0x7029), SN9C20X(HV7131R, 0x11, 0)}, + {USB_DEVICE(0x0458, 0x704a), SN9C20X(MT9M112, 0x5d, 0)}, + {USB_DEVICE(0x0458, 0x704c), SN9C20X(MT9M112, 0x5d, 0)}, {USB_DEVICE(0xa168, 0x0610), SN9C20X(HV7131R, 0x11, 0)}, {USB_DEVICE(0xa168, 0x0611), SN9C20X(HV7131R, 0x11, 0)}, {USB_DEVICE(0xa168, 0x0613), SN9C20X(HV7131R, 0x11, 0)}, -- GitLab From cc2a833590e4bf4920383345cd61bc310ba84af0 Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Tue, 16 Mar 2010 13:58:28 -0300 Subject: [PATCH 199/534] V4L/DVB: gspca - sn9c20x: Fix bug with OV9655 code Fixed buggy init sequence for the OV9655 sensor. Tested with a 0c45:6288 and 0c45:62b3. Signed-off-by: Brian Johnson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/sn9c20x.c | 58 ++++++++++++----------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 479fdbb9e673..4069f72ac3ab 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c @@ -935,40 +935,30 @@ static struct i2c_reg_u8 ov9650_init[] = { }; static struct i2c_reg_u8 ov9655_init[] = { - {0x12, 0x80}, {0x12, 0x01}, {0x0d, 0x00}, {0x0e, 0x61}, - {0x11, 0x80}, {0x13, 0xba}, {0x14, 0x2e}, {0x16, 0x24}, - {0x1e, 0x04}, {0x1e, 0x04}, {0x1e, 0x04}, {0x27, 0x08}, - {0x28, 0x08}, {0x29, 0x15}, {0x2c, 0x08}, {0x32, 0xbf}, - {0x34, 0x3d}, {0x35, 0x00}, {0x36, 0xf8}, {0x38, 0x12}, - {0x39, 0x57}, {0x3a, 0x00}, {0x3b, 0xcc}, {0x3c, 0x0c}, - {0x3d, 0x19}, {0x3e, 0x0c}, {0x3f, 0x01}, {0x41, 0x40}, - {0x42, 0x80}, {0x45, 0x46}, {0x46, 0x62}, {0x47, 0x2a}, - {0x48, 0x3c}, {0x4a, 0xf0}, {0x4b, 0xdc}, {0x4c, 0xdc}, - {0x4d, 0xdc}, {0x4e, 0xdc}, {0x69, 0x02}, {0x6c, 0x04}, - {0x6f, 0x9e}, {0x70, 0x05}, {0x71, 0x78}, {0x77, 0x02}, - {0x8a, 0x23}, {0x8c, 0x0d}, {0x90, 0x7e}, {0x91, 0x7c}, - {0x9f, 0x6e}, {0xa0, 0x6e}, {0xa5, 0x68}, {0xa6, 0x60}, - {0xa8, 0xc1}, {0xa9, 0xfa}, {0xaa, 0x92}, {0xab, 0x04}, - {0xac, 0x80}, {0xad, 0x80}, {0xae, 0x80}, {0xaf, 0x80}, - {0xb2, 0xf2}, {0xb3, 0x20}, {0xb5, 0x00}, {0xb6, 0xaf}, - {0xbb, 0xae}, {0xbc, 0x44}, {0xbd, 0x44}, {0xbe, 0x3b}, - {0xbf, 0x3a}, {0xc0, 0xe2}, {0xc1, 0xc8}, {0xc2, 0x01}, + {0x12, 0x80}, {0x0e, 0x61}, {0x11, 0x80}, {0x13, 0xba}, + {0x14, 0x2e}, {0x16, 0x24}, {0x1e, 0x04}, {0x27, 0x08}, + {0x28, 0x08}, {0x29, 0x15}, {0x2c, 0x08}, {0x34, 0x3d}, + {0x35, 0x00}, {0x38, 0x12}, {0x0f, 0x42}, {0x39, 0x57}, + {0x3a, 0x00}, {0x3b, 0xcc}, {0x3c, 0x0c}, {0x3d, 0x19}, + {0x3e, 0x0c}, {0x3f, 0x01}, {0x41, 0x40}, {0x42, 0x80}, + {0x45, 0x46}, {0x46, 0x62}, {0x47, 0x2a}, {0x48, 0x3c}, + {0x4a, 0xf0}, {0x4b, 0xdc}, {0x4c, 0xdc}, {0x4d, 0xdc}, + {0x4e, 0xdc}, {0x6c, 0x04}, {0x6f, 0x9e}, {0x70, 0x05}, + {0x71, 0x78}, {0x77, 0x02}, {0x8a, 0x23}, {0x90, 0x7e}, + {0x91, 0x7c}, {0x9f, 0x6e}, {0xa0, 0x6e}, {0xa5, 0x68}, + {0xa6, 0x60}, {0xa8, 0xc1}, {0xa9, 0xfa}, {0xaa, 0x92}, + {0xab, 0x04}, {0xac, 0x80}, {0xad, 0x80}, {0xae, 0x80}, + {0xaf, 0x80}, {0xb2, 0xf2}, {0xb3, 0x20}, {0xb5, 0x00}, + {0xb6, 0xaf}, {0xbb, 0xae}, {0xbc, 0x44}, {0xbd, 0x44}, + {0xbe, 0x3b}, {0xbf, 0x3a}, {0xc1, 0xc8}, {0xc2, 0x01}, {0xc4, 0x00}, {0xc6, 0x85}, {0xc7, 0x81}, {0xc9, 0xe0}, - {0xca, 0xe8}, {0xcc, 0xd8}, {0xcd, 0x93}, {0x12, 0x61}, + {0xca, 0xe8}, {0xcc, 0xd8}, {0xcd, 0x93}, {0x2d, 0x00}, + {0x2e, 0x00}, {0x01, 0x80}, {0x02, 0x80}, {0x12, 0x61}, {0x36, 0xfa}, {0x8c, 0x8d}, {0xc0, 0xaa}, {0x69, 0x0a}, - {0x03, 0x12}, {0x17, 0x14}, {0x18, 0x00}, {0x19, 0x01}, - {0x1a, 0x3d}, {0x32, 0xbf}, {0x11, 0x80}, {0x2a, 0x10}, - {0x2b, 0x0a}, {0x92, 0x00}, {0x93, 0x00}, {0x1e, 0x04}, - {0x1e, 0x04}, {0x10, 0x7c}, {0x04, 0x03}, {0xa1, 0x00}, - {0x2d, 0x00}, {0x2e, 0x00}, {0x00, 0x00}, {0x01, 0x80}, - {0x02, 0x80}, {0x12, 0x61}, {0x36, 0xfa}, {0x8c, 0x8d}, - {0xc0, 0xaa}, {0x69, 0x0a}, {0x03, 0x12}, {0x17, 0x14}, - {0x18, 0x00}, {0x19, 0x01}, {0x1a, 0x3d}, {0x32, 0xbf}, - {0x11, 0x80}, {0x2a, 0x10}, {0x2b, 0x0a}, {0x92, 0x00}, - {0x93, 0x00}, {0x04, 0x01}, {0x10, 0x1f}, {0xa1, 0x00}, - {0x00, 0x0a}, {0xa1, 0x00}, {0x10, 0x5d}, {0x04, 0x03}, - {0x00, 0x01}, {0xa1, 0x00}, {0x10, 0x7c}, {0x04, 0x03}, - {0x00, 0x03}, {0x00, 0x0a}, {0x00, 0x10}, {0x00, 0x13}, + {0x03, 0x09}, {0x17, 0x16}, {0x18, 0x6e}, {0x19, 0x01}, + {0x1a, 0x3e}, {0x32, 0x09}, {0x2a, 0x10}, {0x2b, 0x0a}, + {0x92, 0x00}, {0x93, 0x00}, {0xa1, 0x00}, {0x10, 0x7c}, + {0x04, 0x03}, {0x00, 0x13}, }; static struct i2c_reg_u16 mt9v112_init[] = { @@ -1268,8 +1258,8 @@ static int ov9655_init_sensor(struct gspca_dev *gspca_dev) } /* disable hflip and vflip */ gspca_dev->ctrl_dis = (1 << HFLIP_IDX) | (1 << VFLIP_IDX); - sd->hstart = 0; - sd->vstart = 7; + sd->hstart = 1; + sd->vstart = 2; return 0; } -- GitLab From 6b33e5e7fe03c6577ccbaeeb028ab4ec1f26f2b0 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 27 Feb 2010 07:18:14 -0300 Subject: [PATCH 200/534] V4L/DVB: gspca_spca561: Fix LED on rev12a cameras Fix LED control on rev12a cameras and remove the unneeded sd_stop0 callback function. Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/spca561.c | 34 ++++++++++------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index b9c80e2103b9..6346ddc67967 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c @@ -249,9 +249,9 @@ static const __u16 Pb100_2map8300[][2] = { }; static const __u16 spca561_161rev12A_data1[][2] = { - {0x29, 0x8118}, /* white balance - was 21 */ - {0x08, 0x8114}, /* white balance - was 01 */ - {0x0e, 0x8112}, /* white balance - was 00 */ + {0x29, 0x8118}, /* Control register (various enable bits) */ + {0x08, 0x8114}, /* GPIO: Led off */ + {0x0e, 0x8112}, /* 0x0e stream off 0x3e stream on */ {0x00, 0x8102}, /* white balance - new */ {0x92, 0x8804}, {0x04, 0x8802}, /* windows uses 08 */ @@ -263,15 +263,11 @@ static const __u16 spca561_161rev12A_data2[][2] = { {0x07, 0x8601}, {0x07, 0x8602}, {0x04, 0x8501}, - {0x21, 0x8118}, {0x07, 0x8201}, /* windows uses 02 */ {0x08, 0x8200}, {0x01, 0x8200}, - {0x00, 0x8114}, - {0x01, 0x8114}, /* windows uses 00 */ - {0x90, 0x8604}, {0x00, 0x8605}, {0xb0, 0x8603}, @@ -302,6 +298,9 @@ static const __u16 spca561_161rev12A_data2[][2] = { {0xf0, 0x8505}, {0x32, 0x850a}, /* {0x99, 0x8700}, * - white balance - new (removed) */ + /* HDG we used to do this in stop0, making the init state and the state + after a start / stop different, so do this here instead. */ + {0x29, 0x8118}, {} }; @@ -645,6 +644,9 @@ static int sd_start_12a(struct gspca_dev *gspca_dev) setwhite(gspca_dev); setgain(gspca_dev); setexposure(gspca_dev); + + /* Led ON (bit 3 -> 0 */ + reg_w_val(gspca_dev->dev, 0x8114, 0x00); return 0; } static int sd_start_72a(struct gspca_dev *gspca_dev) @@ -691,26 +693,14 @@ static void sd_stopN(struct gspca_dev *gspca_dev) if (sd->chip_revision == Rev012A) { reg_w_val(gspca_dev->dev, 0x8112, 0x0e); + /* Led Off (bit 3 -> 1 */ + reg_w_val(gspca_dev->dev, 0x8114, 0x08); } else { reg_w_val(gspca_dev->dev, 0x8112, 0x20); /* reg_w_val(gspca_dev->dev, 0x8102, 0x00); ?? */ } } -/* called on streamoff with alt 0 and on disconnect */ -static void sd_stop0(struct gspca_dev *gspca_dev) -{ - struct sd *sd = (struct sd *) gspca_dev; - - if (!gspca_dev->present) - return; - if (sd->chip_revision == Rev012A) { - reg_w_val(gspca_dev->dev, 0x8118, 0x29); - reg_w_val(gspca_dev->dev, 0x8114, 0x08); - } -/* reg_w_val(gspca_dev->dev, 0x8114, 0); */ -} - static void do_autogain(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -1028,7 +1018,6 @@ static const struct sd_desc sd_desc_12a = { .init = sd_init_12a, .start = sd_start_12a, .stopN = sd_stopN, - .stop0 = sd_stop0, .pkt_scan = sd_pkt_scan, }; static const struct sd_desc sd_desc_72a = { @@ -1039,7 +1028,6 @@ static const struct sd_desc sd_desc_72a = { .init = sd_init_72a, .start = sd_start_72a, .stopN = sd_stopN, - .stop0 = sd_stop0, .pkt_scan = sd_pkt_scan, .dq_callback = do_autogain, }; -- GitLab From 436c2c533a2a2f98d95347f4d5b4022becb046f6 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 28 Feb 2010 09:41:04 -0300 Subject: [PATCH 201/534] V4L/DVB: gspca_spca561: Add support for camera button gspca_spca561: Add support for camera button Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/spca561.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c index 6346ddc67967..7bb2355005dc 100644 --- a/drivers/media/video/gspca/spca561.c +++ b/drivers/media/video/gspca/spca561.c @@ -22,6 +22,7 @@ #define MODULE_NAME "spca561" +#include #include "gspca.h" MODULE_AUTHOR("Michel Xhaard "); @@ -778,6 +779,23 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, switch (*data++) { /* sequence number */ case 0: /* start of frame */ gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0); + + /* This should never happen */ + if (len < 2) { + PDEBUG(D_ERR, "Short SOF packet, ignoring"); + gspca_dev->last_packet_type = DISCARD_PACKET; + return; + } + +#ifdef CONFIG_INPUT + if (data[0] & 0x20) { + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 1); + input_sync(gspca_dev->input_dev); + input_report_key(gspca_dev->input_dev, KEY_CAMERA, 0); + input_sync(gspca_dev->input_dev); + } +#endif + if (data[1] & 0x10) { /* compressed bayer */ gspca_frame_add(gspca_dev, FIRST_PACKET, data, len); @@ -1019,6 +1037,9 @@ static const struct sd_desc sd_desc_12a = { .start = sd_start_12a, .stopN = sd_stopN, .pkt_scan = sd_pkt_scan, +#ifdef CONFIG_INPUT + .other_input = 1, +#endif }; static const struct sd_desc sd_desc_72a = { .name = MODULE_NAME, @@ -1030,6 +1051,9 @@ static const struct sd_desc sd_desc_72a = { .stopN = sd_stopN, .pkt_scan = sd_pkt_scan, .dq_callback = do_autogain, +#ifdef CONFIG_INPUT + .other_input = 1, +#endif }; static const struct sd_desc *sd_desc[2] = { &sd_desc_12a, -- GitLab From f0dbf82bf1ff97c24af228328fb21c93fcfcb983 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 11 Mar 2010 06:12:39 -0300 Subject: [PATCH 202/534] V4L/DVB: sn9c102: Make hv7131d sensor code also recognize the HV7131E The hv7131d sensor code also works for the hv7131e, this patch changes it to also recognize the hv7131e sensor id. Tested-by: Frank Danapfel Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/sn9c102/sn9c102_hv7131d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/sn9c102/sn9c102_hv7131d.c b/drivers/media/video/sn9c102/sn9c102_hv7131d.c index db2434948939..2dce5c908c8e 100644 --- a/drivers/media/video/sn9c102/sn9c102_hv7131d.c +++ b/drivers/media/video/sn9c102/sn9c102_hv7131d.c @@ -255,7 +255,7 @@ int sn9c102_probe_hv7131d(struct sn9c102_device* cam) if (err || r0 < 0 || r1 < 0) return -EIO; - if (r0 != 0x00 || r1 != 0x04) + if ((r0 != 0x00 && r0 != 0x01) || r1 != 0x04) return -ENODEV; sn9c102_attach_sensor(cam, &hv7131d); -- GitLab From 33c02facb5a3123212587295cc1c241ee7e03adb Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Fri, 22 Jan 2010 01:53:17 -0300 Subject: [PATCH 203/534] V4L/DVB: em28xx: adjust number of packets per URB Increase the packets per URB count from 40 to 64. I suspect that whoever was looking at the usbsnoop captures saw "0x40" packets and mistook it for "40". As a result of this change, I can see a 25% reduction in the number of interrupts generated via powertop. This work was sponsored by EyeMagnet Limited. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index ba6fe5daff84..526c06582158 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -140,10 +140,10 @@ #define EM28XX_NUM_BUFS 5 /* number of packets for each buffer - windows requests only 40 packets .. so we better do the same + windows requests only 64 packets .. so we better do the same this is what I found out for all alternate numbers there! */ -#define EM28XX_NUM_PACKETS 40 +#define EM28XX_NUM_PACKETS 64 #define EM28XX_INTERLACED_DEFAULT 1 -- GitLab From 1744feab9a2241f2adf03be5ef8ecbd279f5944b Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Fri, 22 Jan 2010 02:05:24 -0300 Subject: [PATCH 204/534] V4L/DVB: em28xx: reduce cropping for VBI area It turns up we can reduce the starting line for the active area, which results in more data being captured when under PAL (while the full VBI capture window still stays properly encoded). This work was sponsored by EyeMagnet Limited. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index a41cc5566778..258041d0be9e 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c @@ -782,11 +782,15 @@ int em28xx_resolution_set(struct em28xx *dev) em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2); - /* If we don't set the start position to 4 in VBI mode, we end up - with line 21 being YUYV encoded instead of being in 8-bit - greyscale */ + /* If we don't set the start position to 2 in VBI mode, we end up + with line 20/21 being YUYV encoded instead of being in 8-bit + greyscale. The core of the issue is that line 21 (and line 23 for + PAL WSS) are inside of active video region, and as a result they + get the pixelformatting associated with that area. So by cropping + it out, we end up with the same format as the rest of the VBI + region */ if (em28xx_vbi_supported(dev) == 1) - em28xx_capture_area_set(dev, 0, 4, width >> 2, height >> 2); + em28xx_capture_area_set(dev, 0, 2, width >> 2, height >> 2); else em28xx_capture_area_set(dev, 0, 0, width >> 2, height >> 2); -- GitLab From 5fee334039550bdd5efed9e69af7860a66a9de37 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Fri, 22 Jan 2010 02:34:32 -0300 Subject: [PATCH 205/534] V4L/DVB: em28xx: rework buffer pointer tracking for offset to start of video Rework the logic for tracking the amount of data copied to the VBI buffer, to address problem found where the video lines are several bytes shifted to the right (and the leading pixels in the first line rendered are garbage). This would occur because the copy function would advance the pointer when detecting headers, but the caller would not adjust the length actually copied. This work was sponsored by EyeMagnet Limited. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-video.c | 61 +++++++++++++++-------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 0fe20110bfd6..b6ac99de97d2 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -203,12 +203,6 @@ static void em28xx_copy_video(struct em28xx *dev, if (dma_q->pos + len > buf->vb.size) len = buf->vb.size - dma_q->pos; - if (p[0] != 0x88 && p[0] != 0x22) { - em28xx_isocdbg("frame is not complete\n"); - len += 4; - } else - p += 4; - startread = p; remain = len; @@ -309,14 +303,6 @@ static void em28xx_copy_vbi(struct em28xx *dev, if (dma_q->pos + len > buf->vb.size) len = buf->vb.size - dma_q->pos; - if ((p[0] == 0x33 && p[1] == 0x95) || - (p[0] == 0x88 && p[1] == 0x88)) { - /* Header field, advance past it */ - p += 4; - } else { - len += 4; - } - startread = p; startwrite = outp + dma_q->pos; @@ -507,8 +493,15 @@ static inline int em28xx_isoc_copy(struct em28xx *dev, struct urb *urb) dma_q->pos = 0; } - if (buf != NULL) + if (buf != NULL) { + if (p[0] != 0x88 && p[0] != 0x22) { + em28xx_isocdbg("frame is not complete\n"); + len += 4; + } else { + p += 4; + } em28xx_copy_video(dev, dma_q, buf, p, outp, len); + } } return rc; } @@ -555,8 +548,7 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb) continue; } - len = urb->iso_frame_desc[i].actual_length - 4; - + len = urb->iso_frame_desc[i].actual_length; if (urb->iso_frame_desc[i].actual_length <= 0) { /* em28xx_isocdbg("packet %d is empty",i); - spammy */ continue; @@ -577,6 +569,17 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb) dev->vbi_read = 0; em28xx_isocdbg("VBI START HEADER!!!\n"); dev->cur_field = p[2]; + p += 4; + len -= 4; + } else if (p[0] == 0x88 && p[1] == 0x88 && + p[2] == 0x88 && p[3] == 0x88) { + /* continuation */ + p += 4; + len -= 4; + } else if (p[0] == 0x22 && p[1] == 0x5a) { + /* start video */ + p += 4; + len -= 4; } vbi_size = dev->vbi_width * dev->vbi_height; @@ -631,9 +634,6 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb) if (dev->capture_type == 1) { dev->capture_type = 2; - em28xx_isocdbg("Video frame %d, length=%i, %s\n", p[2], - len, (p[2] & 1) ? "odd" : "even"); - if (dev->progressive || !(dev->cur_field & 1)) { if (buf != NULL) buffer_filled(dev, dma_q, buf); @@ -652,8 +652,25 @@ static inline int em28xx_isoc_copy_vbi(struct em28xx *dev, struct urb *urb) dma_q->pos = 0; } - if (buf != NULL && dev->capture_type == 2) - em28xx_copy_video(dev, dma_q, buf, p, outp, len); + + if (buf != NULL && dev->capture_type == 2) { + if (len > 4 && p[0] == 0x88 && p[1] == 0x88 && + p[2] == 0x88 && p[3] == 0x88) { + p += 4; + len -= 4; + } + if (len > 4 && p[0] == 0x22 && p[1] == 0x5a) { + em28xx_isocdbg("Video frame %d, len=%i, %s\n", + p[2], len, (p[2] & 1) ? + "odd" : "even"); + p += 4; + len -= 4; + } + + if (len > 0) + em28xx_copy_video(dev, dma_q, buf, p, outp, + len); + } } return rc; } -- GitLab From fea551fae99c79f43e519cf53e35462ff5ce2a03 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Wed, 3 Feb 2010 00:33:48 -0300 Subject: [PATCH 206/534] V4L/DVB: saa7115: enable anti-alias filter This patch enables the anti-alias filter, which was originally enabled for the saa7113, but the saa7115_init_misc was trampling the value. Without this patch, there would be visible vertical bands in the chroma. Thanks to Andy Walls for helping test this change against other ivtv products. This work was sponsored by EyeMagnet Limited. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7115.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index c0a7f8a369f4..7d11660922f4 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -592,7 +592,7 @@ static const unsigned char saa7115_init_misc[] = { R_5D_DID, 0xbd, R_5E_SDID, 0x35, - R_02_INPUT_CNTL_1, 0x84, /* input tuner -> input 4, amplifier active */ + R_02_INPUT_CNTL_1, 0xc4, /* input tuner -> input 4, amplifier active */ R_80_GLOBAL_CNTL_1, 0x20, /* enable task B */ R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, -- GitLab From 7a01f6dbc7abb85a6ec048dd45db92ef1b91fe78 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Thu, 11 Mar 2010 21:27:59 -0300 Subject: [PATCH 207/534] V4L/DVB: videodev2: introduce a common control for chroma gain Introduce a new control for modifying the chroma gain. This allows for user intervention in abnormal signal conditions cases where the decoder's chroma AGC cannot compensate and the value needs to be adjusted manually. This work was sponsored by EyeMagnet Limited. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/v4l/controls.xml | 6 ++++++ include/linux/videodev2.h | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/v4l/controls.xml b/Documentation/DocBook/v4l/controls.xml index f46450610412..e1bdbb6eff84 100644 --- a/Documentation/DocBook/v4l/controls.xml +++ b/Documentation/DocBook/v4l/controls.xml @@ -266,6 +266,12 @@ minimum value disables backlight compensation. boolean Chroma automatic gain control. + + V4L2_CID_CHROMA_GAIN + integer + Adjusts the Chroma gain control (for use when chroma AGC + is disabled). + V4L2_CID_COLOR_KILLER boolean diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 3c265603d735..418dacf5261d 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1030,8 +1030,11 @@ enum v4l2_colorfx { #define V4L2_CID_ROTATE (V4L2_CID_BASE+34) #define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) + +#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36) + /* last CID + 1 */ -#define V4L2_CID_LASTP1 (V4L2_CID_BASE+36) +#define V4L2_CID_LASTP1 (V4L2_CID_BASE+37) /* MPEG-class control IDs defined by V4L2 */ #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) -- GitLab From 87a6fe4a530cc01081d19cdec4738433972fb0ee Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Thu, 11 Mar 2010 21:49:24 -0300 Subject: [PATCH 208/534] V4L/DVB: saa115: add support for chroma AGC and chroma gain Add support for chroma agc and gain to the saa7115 driver. This allows for users to do manual adjustment for abnormal signal conditions. This work was sponsored by EyeMagnet Limited. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7115.c | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index 7d11660922f4..f96071c66055 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -74,6 +74,7 @@ struct saa711x_state { int contrast; int hue; int sat; + int chroma_agc; int width; int height; u32 ident; @@ -743,6 +744,7 @@ static int saa711x_s_clock_freq(struct v4l2_subdev *sd, u32 freq) static int saa711x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { struct saa711x_state *state = to_state(sd); + u8 val; switch (ctrl->id) { case V4L2_CID_BRIGHTNESS: @@ -784,7 +786,21 @@ static int saa711x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) state->hue = ctrl->value; saa711x_write(sd, R_0D_CHROMA_HUE_CNTL, state->hue); break; - + case V4L2_CID_CHROMA_AGC: + val = saa711x_read(sd, R_0F_CHROMA_GAIN_CNTL); + state->chroma_agc = ctrl->value; + if (ctrl->value) + val &= 0x7f; + else + val |= 0x80; + saa711x_write(sd, R_0F_CHROMA_GAIN_CNTL, val); + break; + case V4L2_CID_CHROMA_GAIN: + /* Chroma gain cannot be set when AGC is enabled */ + if (state->chroma_agc == 1) + return -EINVAL; + saa711x_write(sd, R_0F_CHROMA_GAIN_CNTL, ctrl->value | 0x80); + break; default: return -EINVAL; } @@ -809,6 +825,12 @@ static int saa711x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) case V4L2_CID_HUE: ctrl->value = state->hue; break; + case V4L2_CID_CHROMA_AGC: + ctrl->value = state->chroma_agc; + break; + case V4L2_CID_CHROMA_GAIN: + ctrl->value = saa711x_read(sd, R_0F_CHROMA_GAIN_CNTL) & 0x7f; + break; default: return -EINVAL; } @@ -1209,6 +1231,19 @@ static int saa711x_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) return v4l2_ctrl_query_fill(qc, 0, 127, 1, 64); case V4L2_CID_HUE: return v4l2_ctrl_query_fill(qc, -128, 127, 1, 0); + case V4L2_CID_CHROMA_AGC: + return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1); + case V4L2_CID_CHROMA_GAIN: + qc->type = V4L2_CTRL_TYPE_INTEGER; + qc->flags = V4L2_CTRL_FLAG_SLIDER; + qc->minimum = 0; + qc->maximum = 127; + qc->step = 1; + qc->default_value = 0x30; + qc->reserved[0] = 0; + qc->reserved[1] = 0; + strlcpy(qc->name, "chroma_gain", sizeof(qc->name)); + return 0; default: return -EINVAL; } @@ -1593,6 +1628,7 @@ static int saa711x_probe(struct i2c_client *client, state->contrast = 64; state->hue = 0; state->sat = 64; + state->chroma_agc = 1; switch (chip_id) { case '1': state->ident = V4L2_IDENT_SAA7111; -- GitLab From f1a4f9eab2bac10d3145d75342eb372c0ef9f125 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Thu, 11 Mar 2010 22:00:13 -0300 Subject: [PATCH 209/534] V4L/DVB: v4l2-common: add ability to use v4l2_ctrl_query_fill for chroma gain Add the ability to use the v4l2_ctrl_query_fill() function for the newly introduced chroma gain control. Also, make use of the centralized function by the one caller. This work was sponsored by EyeMagnet Limited. Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7115.c | 11 +---------- drivers/media/video/v4l2-common.c | 2 ++ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index f96071c66055..72eaa662b66f 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -1234,16 +1234,7 @@ static int saa711x_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) case V4L2_CID_CHROMA_AGC: return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1); case V4L2_CID_CHROMA_GAIN: - qc->type = V4L2_CTRL_TYPE_INTEGER; - qc->flags = V4L2_CTRL_FLAG_SLIDER; - qc->minimum = 0; - qc->maximum = 127; - qc->step = 1; - qc->default_value = 0x30; - qc->reserved[0] = 0; - qc->reserved[1] = 0; - strlcpy(qc->name, "chroma_gain", sizeof(qc->name)); - return 0; + return v4l2_ctrl_query_fill(qc, 0, 127, 1, 48); default: return -EINVAL; } diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index e67983461008..6a3d0b71f78f 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -429,6 +429,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_SHARPNESS: return "Sharpness"; case V4L2_CID_BACKLIGHT_COMPENSATION: return "Backlight Compensation"; case V4L2_CID_CHROMA_AGC: return "Chroma AGC"; + case V4L2_CID_CHROMA_GAIN: return "Chroma Gain"; case V4L2_CID_COLOR_KILLER: return "Color Killer"; case V4L2_CID_COLORFX: return "Color Effects"; case V4L2_CID_AUTOBRIGHTNESS: return "Brightness, Automatic"; @@ -622,6 +623,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste case V4L2_CID_BLUE_BALANCE: case V4L2_CID_GAMMA: case V4L2_CID_SHARPNESS: + case V4L2_CID_CHROMA_GAIN: case V4L2_CID_RDS_TX_DEVIATION: case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: case V4L2_CID_AUDIO_LIMITER_DEVIATION: -- GitLab From 449adf94ada543026a0fc4d0139faf60304b899f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 22 Mar 2010 14:37:52 -0300 Subject: [PATCH 210/534] V4L/DVB: Fix cx88 and em28xx cardlists There are some missing entries there Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.cx88 | 1 + Documentation/video4linux/CARDLIST.em28xx | 1 + 2 files changed, 2 insertions(+) diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 7ec3c4e4b60f..f2510541373b 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 @@ -82,3 +82,4 @@ 81 -> Leadtek WinFast DTV1800 Hybrid [107d:6654] 82 -> WinFast DTV2000 H rev. J [107d:6f2b] 83 -> Prof 7301 DVB-S/S2 [b034:3034] + 84 -> Samsung SMT 7020 DVB-S [18ac:dc00,18ac:dccd] diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 0c166ff003a0..76c39081c29b 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx @@ -70,3 +70,4 @@ 72 -> Gadmei UTV330+ (em2861) 73 -> Reddo DVB-C USB TV Box (em2870) 74 -> Actionmaster/LinXcel/Digitus VC211A (em2800) + 75 -> Dikom DK300 (em2882) -- GitLab From 27e5842a9ad7a929f680ed151b5b1126456fb5f6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Mar 2010 09:34:39 -0300 Subject: [PATCH 211/534] V4L/DVB: saa7134: Use the same name on CARDLIST as found at the driver Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.saa7134 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 3de042a9c4f6..bb3d5faa34ed 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 @@ -175,4 +175,4 @@ 174 -> Asus Europa Hybrid OEM [1043:4847] 175 -> Leadtek Winfast DTV1000S [107d:6655] 176 -> Beholder BeholdTV 505 RDS [0000:5051] -177 -> Hawell HW-404M7 / HW-808M7 +177 -> Hawell HW-404M7 -- GitLab From a82437510256b83671e49a23774c9c5ce0d4ab00 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Mar 2010 09:35:47 -0300 Subject: [PATCH 212/534] V4L/DVB: stv0900: Whitespace cleanup Fixes sync with -hg tree Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/frontends/stv0900_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb/frontends/stv0900_core.c b/drivers/media/dvb/frontends/stv0900_core.c index a3cdca724634..4f5e7d3a0e61 100644 --- a/drivers/media/dvb/frontends/stv0900_core.c +++ b/drivers/media/dvb/frontends/stv0900_core.c @@ -1875,7 +1875,7 @@ static struct dvb_frontend_ops stv0900_ops = { }, .release = stv0900_release, .init = stv0900_init, - .get_frontend = stv0900_get_frontend, + .get_frontend = stv0900_get_frontend, .get_frontend_algo = stv0900_frontend_algo, .i2c_gate_ctrl = stv0900_i2c_gate_ctrl, .diseqc_send_master_cmd = stv0900_send_master_cmd, -- GitLab From d1875d65599e187feb92994af33f409612e05ca3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Mar 2010 09:36:32 -0300 Subject: [PATCH 213/534] V4L/DVB: gspca: fixes compilation when input is not selected It seems that I merged a wrong version of the patch or that changeset 4d770eeb926d0bc44c0bd68d051d3d2a5568ef41 got mangled somehow: It were missed the #else to avoid compilation troubles. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/gspca.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 415949526eec..1830ea9e73b0 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c @@ -279,10 +279,6 @@ static void gspca_input_destroy_urb(struct gspca_dev *gspca_dev) usb_free_urb(urb); } } -#else -#define gspca_input_connect(gspca_dev) 0 -#define gspca_input_create_urb(gspca_dev) -#define gspca_input_destroy_urb(gspca_dev) #endif /* get the current input frame buffer */ -- GitLab From 443fed9fa42bbeacdb8d336b8a5002a262cac15c Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Fri, 19 Mar 2010 23:53:12 -0300 Subject: [PATCH 214/534] V4L/DVB: em28xx: add em286x/tvp5150 reference design Add support for design which has an em2863/tvp5150 and uses the standard empia USB ID. In Sander's case, it was branded as an "Eminent model EM3705" Thanks to Sander Van Ginkel for testing and help debugging the support. [mchehab@redhat.com: move it to a vague card number slot (card=29)] Signed-off-by: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- Documentation/video4linux/CARDLIST.em28xx | 3 ++- drivers/media/video/em28xx/em28xx-cards.c | 17 +++++++++++++++++ drivers/media/video/em28xx/em28xx.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 76c39081c29b..3a623aaeae5f 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx @@ -1,5 +1,5 @@ 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] - 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2710,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2862,eb1a:2870,eb1a:2881,eb1a:2883,eb1a:2868] + 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2710,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2862,eb1a:2863,eb1a:2870,eb1a:2881,eb1a:2883,eb1a:2868] 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] @@ -27,6 +27,7 @@ 26 -> Hercules Smart TV USB 2.0 (em2820/em2840) 27 -> Pinnacle PCTV USB 2 (Philips FM1216ME) (em2820/em2840) 28 -> Leadtek Winfast USB II Deluxe (em2820/em2840) + 29 -> EM2860/TVP5150 Reference Design (em2860) 30 -> Videology 20K14XUSB USB2.0 (em2820/em2840) 31 -> Usbgear VD204v9 (em2821) 32 -> Supercomp USB 2.0 TV (em2821) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 5ed834ee7569..7b0ca583de55 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -681,6 +681,20 @@ struct em28xx_board em28xx_boards[] = { .amux = EM28XX_AMUX_LINE_IN, } }, }, + [EM2860_BOARD_TVP5150_REFERENCE_DESIGN] = { + .name = "EM2860/TVP5150 Reference Design", + .tuner_type = TUNER_ABSENT, /* Capture only device */ + .decoder = EM28XX_TVP5150, + .input = { { + .type = EM28XX_VMUX_COMPOSITE1, + .vmux = TVP5150_COMPOSITE1, + .amux = EM28XX_AMUX_LINE_IN, + }, { + .type = EM28XX_VMUX_SVIDEO, + .vmux = TVP5150_SVIDEO, + .amux = EM28XX_AMUX_LINE_IN, + } }, + }, [EM2861_BOARD_PLEXTOR_PX_TV100U] = { .name = "Plextor ConvertX PX-TV100U", .tuner_type = TUNER_TNF_5335MF, @@ -1676,6 +1690,8 @@ struct usb_device_id em28xx_id_table[] = { .driver_info = EM2820_BOARD_UNKNOWN }, { USB_DEVICE(0xeb1a, 0x2862), .driver_info = EM2820_BOARD_UNKNOWN }, + { USB_DEVICE(0xeb1a, 0x2863), + .driver_info = EM2820_BOARD_UNKNOWN }, { USB_DEVICE(0xeb1a, 0x2870), .driver_info = EM2820_BOARD_UNKNOWN }, { USB_DEVICE(0xeb1a, 0x2881), @@ -1796,6 +1812,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = { {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC}, {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC}, {0x1ba50080, EM2860_BOARD_SAA711X_REFERENCE_DESIGN, TUNER_ABSENT}, + {0x77800080, EM2860_BOARD_TVP5150_REFERENCE_DESIGN, TUNER_ABSENT}, {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC}, {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF}, }; diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 526c06582158..eec12910c8cf 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -68,6 +68,7 @@ #define EM2820_BOARD_HERCULES_SMART_TV_USB2 26 #define EM2820_BOARD_PINNACLE_USB_2_FM1216ME 27 #define EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE 28 +#define EM2860_BOARD_TVP5150_REFERENCE_DESIGN 29 #define EM2820_BOARD_VIDEOLOGY_20K14XUSB 30 #define EM2821_BOARD_USBGEAR_VD204 31 #define EM2821_BOARD_SUPERCOMP_USB_2 32 -- GitLab From 85e092190b5f7dfe9b78556440472c5590a32b4e Mon Sep 17 00:00:00 2001 From: Dmitri Belimov Date: Tue, 23 Mar 2010 11:23:29 -0300 Subject: [PATCH 215/534] V4L/DVB: Add SPI support to V4L2 Add support SPI bus to v4l2. Useful for control some device with SPI bus like hardware MPEG2 encoders and etc. Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-common.c | 63 +++++++++++++++++++++++++++++++ drivers/media/video/v4l2-device.c | 11 ++++++ include/media/v4l2-common.h | 19 ++++++++++ include/media/v4l2-subdev.h | 2 + 4 files changed, 95 insertions(+) diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 6a3d0b71f78f..cd1f21d9b079 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -51,6 +51,9 @@ #include #include #include +#if defined(CONFIG_SPI) +#include +#endif #include #include #include @@ -955,6 +958,66 @@ EXPORT_SYMBOL_GPL(v4l2_i2c_tuner_addrs); #endif /* defined(CONFIG_I2C) */ +#if defined(CONFIG_SPI) + +/* Load a spi sub-device. */ + +void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, + const struct v4l2_subdev_ops *ops) +{ + v4l2_subdev_init(sd, ops); + sd->flags |= V4L2_SUBDEV_FL_IS_SPI; + /* the owner is the same as the spi_device's driver owner */ + sd->owner = spi->dev.driver->owner; + /* spi_device and v4l2_subdev point to one another */ + v4l2_set_subdevdata(sd, spi); + spi_set_drvdata(spi, sd); + /* initialize name */ + strlcpy(sd->name, spi->dev.driver->name, sizeof(sd->name)); +} +EXPORT_SYMBOL_GPL(v4l2_spi_subdev_init); + +struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev, + struct spi_master *master, struct spi_board_info *info) +{ + struct v4l2_subdev *sd = NULL; + struct spi_device *spi = NULL; + + BUG_ON(!v4l2_dev); + + if (info->modalias) + request_module(info->modalias); + + spi = spi_new_device(master, info); + + if (spi == NULL || spi->dev.driver == NULL) + goto error; + + if (!try_module_get(spi->dev.driver->owner)) + goto error; + + sd = spi_get_drvdata(spi); + + /* Register with the v4l2_device which increases the module's + use count as well. */ + if (v4l2_device_register_subdev(v4l2_dev, sd)) + sd = NULL; + + /* Decrease the module use count to match the first try_module_get. */ + module_put(spi->dev.driver->owner); + +error: + /* If we have a client but no subdev, then something went wrong and + we must unregister the client. */ + if (spi && sd == NULL) + spi_unregister_device(spi); + + return sd; +} +EXPORT_SYMBOL_GPL(v4l2_spi_new_subdev); + +#endif /* defined(CONFIG_SPI) */ + /* Clamp x to be between min and max, aligned to a multiple of 2^align. min * and max don't have to be aligned, but there must be at least one valid * value. E.g., min=17,max=31,align=4 is not allowed as there are no multiples diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index 0d06e7cbd5b3..5a7dc4afe92a 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c @@ -21,6 +21,9 @@ #include #include #include +#if defined(CONFIG_SPI) +#include +#endif #include #include @@ -96,6 +99,14 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev) if (client) i2c_unregister_device(client); } +#endif +#if defined(CONFIG_SPI) + if (sd->flags & V4L2_SUBDEV_FL_IS_SPI) { + struct spi_device *spi = v4l2_get_subdevdata(sd); + + if (spi) + spi_unregister_device(spi); + } #endif } } diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 1c7b259f341c..3b2efdc6d065 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -184,6 +184,25 @@ const unsigned short *v4l2_i2c_tuner_addrs(enum v4l2_i2c_tuner_type type); /* ------------------------------------------------------------------------- */ +/* SPI Helper functions */ +#if defined(CONFIG_SPI) + +#include + +struct spi_device; + +/* Load an spi module and return an initialized v4l2_subdev struct. + The client_type argument is the name of the chip that's on the adapter. */ +struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev, + struct spi_master *master, struct spi_board_info *info); + +/* Initialize an v4l2_subdev with data from an spi_device struct */ +void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, + const struct v4l2_subdev_ops *ops); +#endif + +/* ------------------------------------------------------------------------- */ + /* Note: these remaining ioctls/structs should be removed as well, but they are still used in tuner-simple.c (TUNER_SET_CONFIG), cx18/ivtv (RESET) and v4l2-int-device.h (v4l2_routing). To remove these ioctls some more cleanup diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 2bcdca0a57fc..09758789be02 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -387,6 +387,8 @@ struct v4l2_subdev_ops { /* Set this flag if this subdev is a i2c device. */ #define V4L2_SUBDEV_FL_IS_I2C (1U << 0) +/* Set this flag if this subdev is a spi device. */ +#define V4L2_SUBDEV_FL_IS_SPI (1U << 1) /* Each instance of a subdev driver should create this struct, either stand-alone or embedded in a larger struct. -- GitLab From 7a02264ca9ec5409e22b9d41f32b431d08eadbce Mon Sep 17 00:00:00 2001 From: Pawel Osciak Date: Wed, 17 Mar 2010 04:01:04 -0300 Subject: [PATCH 216/534] V4L/DVB: v4l: videobuf: code cleanup Make videobuf pass checkpatch; minor code cleanups. Signed-off-by: Pawel Osciak Reviewed-by: Kyungmin Park Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/videobuf-core.c | 116 +++++------ drivers/media/video/videobuf-dma-sg.c | 276 +++++++++++++------------ drivers/media/video/videobuf-vmalloc.c | 112 +++++----- include/media/videobuf-core.h | 10 +- include/media/videobuf-dma-sg.h | 27 +-- include/media/videobuf-vmalloc.h | 12 +- 6 files changed, 272 insertions(+), 281 deletions(-) diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 471178e17017..63d7043502d6 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -24,10 +24,15 @@ #include #define MAGIC_BUFFER 0x20070728 -#define MAGIC_CHECK(is, should) do { \ - if (unlikely((is) != (should))) { \ - printk(KERN_ERR "magic mismatch: %x (expected %x)\n", is, should); \ - BUG(); } } while (0) +#define MAGIC_CHECK(is, should) \ + do { \ + if (unlikely((is) != (should))) { \ + printk(KERN_ERR \ + "magic mismatch: %x (expected %x)\n", \ + is, should); \ + BUG(); \ + } \ + } while (0) static int debug; module_param(debug, int, 0644); @@ -36,9 +41,11 @@ MODULE_DESCRIPTION("helper module to manage video4linux buffers"); MODULE_AUTHOR("Mauro Carvalho Chehab "); MODULE_LICENSE("GPL"); -#define dprintk(level, fmt, arg...) do { \ - if (debug >= level) \ - printk(KERN_DEBUG "vbuf: " fmt , ## arg); } while (0) +#define dprintk(level, fmt, arg...) \ + do { \ + if (debug >= level) \ + printk(KERN_DEBUG "vbuf: " fmt, ## arg); \ + } while (0) /* --------------------------------------------------------------------- */ @@ -57,14 +64,14 @@ void *videobuf_alloc(struct videobuf_queue *q) } vb = q->int_ops->alloc(q->msize); - if (NULL != vb) { init_waitqueue_head(&vb->done); - vb->magic = MAGIC_BUFFER; + vb->magic = MAGIC_BUFFER; } return vb; } +EXPORT_SYMBOL_GPL(videobuf_alloc); #define WAITON_CONDITION (vb->state != VIDEOBUF_ACTIVE &&\ vb->state != VIDEOBUF_QUEUED) @@ -86,6 +93,7 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr) return 0; } +EXPORT_SYMBOL_GPL(videobuf_waiton); int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, struct v4l2_framebuffer *fbuf) @@ -95,9 +103,10 @@ int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, return CALL(q, iolock, q, vb, fbuf); } +EXPORT_SYMBOL_GPL(videobuf_iolock); -void *videobuf_queue_to_vmalloc (struct videobuf_queue *q, - struct videobuf_buffer *buf) +void *videobuf_queue_to_vmalloc(struct videobuf_queue *q, + struct videobuf_buffer *buf) { if (q->int_ops->vmalloc) return q->int_ops->vmalloc(buf); @@ -146,6 +155,7 @@ void videobuf_queue_core_init(struct videobuf_queue *q, init_waitqueue_head(&q->wait); INIT_LIST_HEAD(&q->stream); } +EXPORT_SYMBOL_GPL(videobuf_queue_core_init); /* Locking: Only usage in bttv unsafe find way to remove */ int videobuf_queue_is_busy(struct videobuf_queue *q) @@ -184,6 +194,7 @@ int videobuf_queue_is_busy(struct videobuf_queue *q) } return 0; } +EXPORT_SYMBOL_GPL(videobuf_queue_is_busy); /* Locking: Caller holds q->vb_lock */ void videobuf_queue_cancel(struct videobuf_queue *q) @@ -216,6 +227,7 @@ void videobuf_queue_cancel(struct videobuf_queue *q) } INIT_LIST_HEAD(&q->stream); } +EXPORT_SYMBOL_GPL(videobuf_queue_cancel); /* --------------------------------------------------------------------- */ @@ -237,6 +249,7 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q) } return field; } +EXPORT_SYMBOL_GPL(videobuf_next_field); /* Locking: Caller holds q->vb_lock */ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, @@ -305,8 +318,7 @@ static int __videobuf_mmap_free(struct videobuf_queue *q) MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); - - rc = CALL(q, mmap_free, q); + rc = CALL(q, mmap_free, q); q->is_mmapped = 0; @@ -332,6 +344,7 @@ int videobuf_mmap_free(struct videobuf_queue *q) mutex_unlock(&q->vb_lock); return ret; } +EXPORT_SYMBOL_GPL(videobuf_mmap_free); /* Locking: Caller holds q->vb_lock */ int __videobuf_mmap_setup(struct videobuf_queue *q, @@ -351,7 +364,7 @@ int __videobuf_mmap_setup(struct videobuf_queue *q, for (i = 0; i < bcount; i++) { q->bufs[i] = videobuf_alloc(q); - if (q->bufs[i] == NULL) + if (NULL == q->bufs[i]) break; q->bufs[i]->i = i; @@ -372,11 +385,11 @@ int __videobuf_mmap_setup(struct videobuf_queue *q, if (!i) return -ENOMEM; - dprintk(1, "mmap setup: %d buffers, %d bytes each\n", - i, bsize); + dprintk(1, "mmap setup: %d buffers, %d bytes each\n", i, bsize); return i; } +EXPORT_SYMBOL_GPL(__videobuf_mmap_setup); int videobuf_mmap_setup(struct videobuf_queue *q, unsigned int bcount, unsigned int bsize, @@ -388,6 +401,7 @@ int videobuf_mmap_setup(struct videobuf_queue *q, mutex_unlock(&q->vb_lock); return ret; } +EXPORT_SYMBOL_GPL(videobuf_mmap_setup); int videobuf_reqbufs(struct videobuf_queue *q, struct v4l2_requestbuffers *req) @@ -432,7 +446,7 @@ int videobuf_reqbufs(struct videobuf_queue *q, q->ops->buf_setup(q, &count, &size); dprintk(1, "reqbufs: bufs=%d, size=0x%x [%u pages total]\n", count, size, - (unsigned int)((count*PAGE_ALIGN(size))>>PAGE_SHIFT) ); + (unsigned int)((count * PAGE_ALIGN(size)) >> PAGE_SHIFT)); retval = __videobuf_mmap_setup(q, count, size, req->memory); if (retval < 0) { @@ -447,6 +461,7 @@ int videobuf_reqbufs(struct videobuf_queue *q, mutex_unlock(&q->vb_lock); return retval; } +EXPORT_SYMBOL_GPL(videobuf_reqbufs); int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) { @@ -473,9 +488,9 @@ int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) mutex_unlock(&q->vb_lock); return ret; } +EXPORT_SYMBOL_GPL(videobuf_querybuf); -int videobuf_qbuf(struct videobuf_queue *q, - struct v4l2_buffer *b) +int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b) { struct videobuf_buffer *buf; enum v4l2_field field; @@ -571,7 +586,7 @@ int videobuf_qbuf(struct videobuf_queue *q, retval = 0; wake_up_interruptible_sync(&q->wait); - done: +done: mutex_unlock(&q->vb_lock); if (b->memory == V4L2_MEMORY_MMAP) @@ -579,7 +594,7 @@ int videobuf_qbuf(struct videobuf_queue *q, return retval; } - +EXPORT_SYMBOL_GPL(videobuf_qbuf); /* Locking: Caller holds q->vb_lock */ static int stream_next_buffer_check_queue(struct videobuf_queue *q, int noblock) @@ -624,7 +639,6 @@ static int stream_next_buffer_check_queue(struct videobuf_queue *q, int noblock) return retval; } - /* Locking: Caller holds q->vb_lock */ static int stream_next_buffer(struct videobuf_queue *q, struct videobuf_buffer **vb, int nonblocking) @@ -647,7 +661,7 @@ static int stream_next_buffer(struct videobuf_queue *q, } int videobuf_dqbuf(struct videobuf_queue *q, - struct v4l2_buffer *b, int nonblocking) + struct v4l2_buffer *b, int nonblocking) { struct videobuf_buffer *buf = NULL; int retval; @@ -682,11 +696,11 @@ int videobuf_dqbuf(struct videobuf_queue *q, list_del(&buf->stream); memset(b, 0, sizeof(*b)); videobuf_status(q, b, buf, q->type); - - done: +done: mutex_unlock(&q->vb_lock); return retval; } +EXPORT_SYMBOL_GPL(videobuf_dqbuf); int videobuf_streamon(struct videobuf_queue *q) { @@ -709,10 +723,11 @@ int videobuf_streamon(struct videobuf_queue *q) spin_unlock_irqrestore(q->irqlock, flags); wake_up_interruptible_sync(&q->wait); - done: +done: mutex_unlock(&q->vb_lock); return retval; } +EXPORT_SYMBOL_GPL(videobuf_streamon); /* Locking: Caller holds q->vb_lock */ static int __videobuf_streamoff(struct videobuf_queue *q) @@ -735,6 +750,7 @@ int videobuf_streamoff(struct videobuf_queue *q) return retval; } +EXPORT_SYMBOL_GPL(videobuf_streamoff); /* Locking: Caller holds q->vb_lock */ static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, @@ -774,7 +790,7 @@ static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, retval = q->read_buf->size; } - done: +done: /* cleanup */ q->ops->buf_release(q, q->read_buf); kfree(q->read_buf); @@ -862,10 +878,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, q->read_buf = NULL; } - done: +done: mutex_unlock(&q->vb_lock); return retval; } +EXPORT_SYMBOL_GPL(videobuf_read_one); /* Locking: Caller holds q->vb_lock */ static int __videobuf_read_start(struct videobuf_queue *q) @@ -917,7 +934,6 @@ static void __videobuf_read_stop(struct videobuf_queue *q) q->bufs[i] = NULL; } q->read_buf = NULL; - } int videobuf_read_start(struct videobuf_queue *q) @@ -930,6 +946,7 @@ int videobuf_read_start(struct videobuf_queue *q) return rc; } +EXPORT_SYMBOL_GPL(videobuf_read_start); void videobuf_read_stop(struct videobuf_queue *q) { @@ -937,6 +954,7 @@ void videobuf_read_stop(struct videobuf_queue *q) __videobuf_read_stop(q); mutex_unlock(&q->vb_lock); } +EXPORT_SYMBOL_GPL(videobuf_read_stop); void videobuf_stop(struct videobuf_queue *q) { @@ -950,7 +968,7 @@ void videobuf_stop(struct videobuf_queue *q) mutex_unlock(&q->vb_lock); } - +EXPORT_SYMBOL_GPL(videobuf_stop); ssize_t videobuf_read_stream(struct videobuf_queue *q, char __user *data, size_t count, loff_t *ppos, @@ -1019,10 +1037,11 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, break; } - done: +done: mutex_unlock(&q->vb_lock); return retval; } +EXPORT_SYMBOL_GPL(videobuf_read_stream); unsigned int videobuf_poll_stream(struct file *file, struct videobuf_queue *q, @@ -1062,9 +1081,9 @@ unsigned int videobuf_poll_stream(struct file *file, mutex_unlock(&q->vb_lock); return rc; } +EXPORT_SYMBOL_GPL(videobuf_poll_stream); -int videobuf_mmap_mapper(struct videobuf_queue *q, - struct vm_area_struct *vma) +int videobuf_mmap_mapper(struct videobuf_queue *q, struct vm_area_struct *vma) { int retval; @@ -1077,6 +1096,7 @@ int videobuf_mmap_mapper(struct videobuf_queue *q, return retval; } +EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); #ifdef CONFIG_VIDEO_V4L1_COMPAT int videobuf_cgmbuf(struct videobuf_queue *q, @@ -1107,33 +1127,3 @@ int videobuf_cgmbuf(struct videobuf_queue *q, EXPORT_SYMBOL_GPL(videobuf_cgmbuf); #endif -/* --------------------------------------------------------------------- */ - -EXPORT_SYMBOL_GPL(videobuf_waiton); -EXPORT_SYMBOL_GPL(videobuf_iolock); - -EXPORT_SYMBOL_GPL(videobuf_alloc); - -EXPORT_SYMBOL_GPL(videobuf_queue_core_init); -EXPORT_SYMBOL_GPL(videobuf_queue_cancel); -EXPORT_SYMBOL_GPL(videobuf_queue_is_busy); - -EXPORT_SYMBOL_GPL(videobuf_next_field); -EXPORT_SYMBOL_GPL(videobuf_reqbufs); -EXPORT_SYMBOL_GPL(videobuf_querybuf); -EXPORT_SYMBOL_GPL(videobuf_qbuf); -EXPORT_SYMBOL_GPL(videobuf_dqbuf); -EXPORT_SYMBOL_GPL(videobuf_streamon); -EXPORT_SYMBOL_GPL(videobuf_streamoff); - -EXPORT_SYMBOL_GPL(videobuf_read_start); -EXPORT_SYMBOL_GPL(videobuf_read_stop); -EXPORT_SYMBOL_GPL(videobuf_stop); -EXPORT_SYMBOL_GPL(videobuf_read_stream); -EXPORT_SYMBOL_GPL(videobuf_read_one); -EXPORT_SYMBOL_GPL(videobuf_poll_stream); - -EXPORT_SYMBOL_GPL(__videobuf_mmap_setup); -EXPORT_SYMBOL_GPL(videobuf_mmap_setup); -EXPORT_SYMBOL_GPL(videobuf_mmap_free); -EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index fcd045e7a1c1..c9d946a388e8 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c @@ -37,8 +37,12 @@ #define MAGIC_DMABUF 0x19721112 #define MAGIC_SG_MEM 0x17890714 -#define MAGIC_CHECK(is,should) if (unlikely((is) != (should))) \ - { printk(KERN_ERR "magic mismatch: %x (expected %x)\n",is,should); BUG(); } +#define MAGIC_CHECK(is, should) \ + if (unlikely((is) != (should))) { \ + printk(KERN_ERR "magic mismatch: %x (expected %x)\n", \ + is, should); \ + BUG(); \ + } static int debug; module_param(debug, int, 0644); @@ -47,13 +51,13 @@ MODULE_DESCRIPTION("helper module to manage video4linux dma sg buffers"); MODULE_AUTHOR("Mauro Carvalho Chehab "); MODULE_LICENSE("GPL"); -#define dprintk(level, fmt, arg...) if (debug >= level) \ - printk(KERN_DEBUG "vbuf-sg: " fmt , ## arg) +#define dprintk(level, fmt, arg...) \ + if (debug >= level) \ + printk(KERN_DEBUG "vbuf-sg: " fmt , ## arg) /* --------------------------------------------------------------------- */ -struct scatterlist* -videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages) +struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages) { struct scatterlist *sglist; struct page *pg; @@ -73,13 +77,14 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages) } return sglist; - err: +err: vfree(sglist); return NULL; } +EXPORT_SYMBOL_GPL(videobuf_vmalloc_to_sg); -struct scatterlist* -videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) +struct scatterlist *videobuf_pages_to_sg(struct page **pages, int nr_pages, + int offset) { struct scatterlist *sglist; int i; @@ -104,20 +109,20 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) } return sglist; - nopage: - dprintk(2,"sgl: oops - no page\n"); +nopage: + dprintk(2, "sgl: oops - no page\n"); vfree(sglist); return NULL; - highmem: - dprintk(2,"sgl: oops - highmem page\n"); +highmem: + dprintk(2, "sgl: oops - highmem page\n"); vfree(sglist); return NULL; } /* --------------------------------------------------------------------- */ -struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf) +struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf) { struct videobuf_dma_sg_memory *mem = buf->priv; BUG_ON(!mem); @@ -126,17 +131,19 @@ struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf) return &mem->dma; } +EXPORT_SYMBOL_GPL(videobuf_to_dma); void videobuf_dma_init(struct videobuf_dmabuf *dma) { - memset(dma,0,sizeof(*dma)); + memset(dma, 0, sizeof(*dma)); dma->magic = MAGIC_DMABUF; } +EXPORT_SYMBOL_GPL(videobuf_dma_init); static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, int direction, unsigned long data, unsigned long size) { - unsigned long first,last; + unsigned long first, last; int err, rw = 0; dma->direction = direction; @@ -155,21 +162,21 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, last = ((data+size-1) & PAGE_MASK) >> PAGE_SHIFT; dma->offset = data & ~PAGE_MASK; dma->nr_pages = last-first+1; - dma->pages = kmalloc(dma->nr_pages * sizeof(struct page*), - GFP_KERNEL); + dma->pages = kmalloc(dma->nr_pages * sizeof(struct page *), GFP_KERNEL); if (NULL == dma->pages) return -ENOMEM; - dprintk(1,"init user [0x%lx+0x%lx => %d pages]\n", - data,size,dma->nr_pages); - err = get_user_pages(current,current->mm, + dprintk(1, "init user [0x%lx+0x%lx => %d pages]\n", + data, size, dma->nr_pages); + + err = get_user_pages(current, current->mm, data & PAGE_MASK, dma->nr_pages, rw == READ, 1, /* force */ dma->pages, NULL); if (err != dma->nr_pages) { dma->nr_pages = (err >= 0) ? err : 0; - dprintk(1,"get_user_pages: err=%d [%d]\n",err,dma->nr_pages); + dprintk(1, "get_user_pages: err=%d [%d]\n", err, dma->nr_pages); return err < 0 ? err : -EINVAL; } return 0; @@ -179,48 +186,58 @@ int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, unsigned long data, unsigned long size) { int ret; + down_read(¤t->mm->mmap_sem); ret = videobuf_dma_init_user_locked(dma, direction, data, size); up_read(¤t->mm->mmap_sem); return ret; } +EXPORT_SYMBOL_GPL(videobuf_dma_init_user); int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, int nr_pages) { - dprintk(1,"init kernel [%d pages]\n",nr_pages); + dprintk(1, "init kernel [%d pages]\n", nr_pages); + dma->direction = direction; dma->vmalloc = vmalloc_32(nr_pages << PAGE_SHIFT); if (NULL == dma->vmalloc) { - dprintk(1,"vmalloc_32(%d pages) failed\n",nr_pages); + dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); return -ENOMEM; } - dprintk(1,"vmalloc is at addr 0x%08lx, size=%d\n", + + dprintk(1, "vmalloc is at addr 0x%08lx, size=%d\n", (unsigned long)dma->vmalloc, nr_pages << PAGE_SHIFT); - memset(dma->vmalloc,0,nr_pages << PAGE_SHIFT); + + memset(dma->vmalloc, 0, nr_pages << PAGE_SHIFT); dma->nr_pages = nr_pages; + return 0; } +EXPORT_SYMBOL_GPL(videobuf_dma_init_kernel); int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, dma_addr_t addr, int nr_pages) { - dprintk(1,"init overlay [%d pages @ bus 0x%lx]\n", - nr_pages,(unsigned long)addr); + dprintk(1, "init overlay [%d pages @ bus 0x%lx]\n", + nr_pages, (unsigned long)addr); dma->direction = direction; + if (0 == addr) return -EINVAL; dma->bus_addr = addr; dma->nr_pages = nr_pages; + return 0; } +EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay); -int videobuf_dma_map(struct videobuf_queue* q, struct videobuf_dmabuf *dma) +int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma) { - MAGIC_CHECK(dma->magic,MAGIC_DMABUF); + MAGIC_CHECK(dma->magic, MAGIC_DMABUF); BUG_ON(0 == dma->nr_pages); if (dma->pages) { @@ -228,20 +245,21 @@ int videobuf_dma_map(struct videobuf_queue* q, struct videobuf_dmabuf *dma) dma->offset); } if (dma->vmalloc) { - dma->sglist = videobuf_vmalloc_to_sg - (dma->vmalloc,dma->nr_pages); + dma->sglist = videobuf_vmalloc_to_sg(dma->vmalloc, + dma->nr_pages); } if (dma->bus_addr) { dma->sglist = vmalloc(sizeof(*dma->sglist)); if (NULL != dma->sglist) { - dma->sglen = 1; - sg_dma_address(&dma->sglist[0]) = dma->bus_addr & PAGE_MASK; - dma->sglist[0].offset = dma->bus_addr & ~PAGE_MASK; - sg_dma_len(&dma->sglist[0]) = dma->nr_pages * PAGE_SIZE; + dma->sglen = 1; + sg_dma_address(&dma->sglist[0]) = dma->bus_addr + & PAGE_MASK; + dma->sglist[0].offset = dma->bus_addr & ~PAGE_MASK; + sg_dma_len(&dma->sglist[0]) = dma->nr_pages * PAGE_SIZE; } } if (NULL == dma->sglist) { - dprintk(1,"scatterlist is NULL\n"); + dprintk(1, "scatterlist is NULL\n"); return -ENOMEM; } if (!dma->bus_addr) { @@ -249,15 +267,17 @@ int videobuf_dma_map(struct videobuf_queue* q, struct videobuf_dmabuf *dma) dma->nr_pages, dma->direction); if (0 == dma->sglen) { printk(KERN_WARNING - "%s: videobuf_map_sg failed\n",__func__); + "%s: videobuf_map_sg failed\n", __func__); vfree(dma->sglist); dma->sglist = NULL; dma->sglen = 0; return -ENOMEM; } } + return 0; } +EXPORT_SYMBOL_GPL(videobuf_dma_map); int videobuf_dma_sync(struct videobuf_queue *q, struct videobuf_dmabuf *dma) { @@ -265,12 +285,15 @@ int videobuf_dma_sync(struct videobuf_queue *q, struct videobuf_dmabuf *dma) BUG_ON(!dma->sglen); dma_sync_sg_for_cpu(q->dev, dma->sglist, dma->nr_pages, dma->direction); + return 0; } +EXPORT_SYMBOL_GPL(videobuf_dma_sync); -int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) +int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma) { MAGIC_CHECK(dma->magic, MAGIC_DMABUF); + if (!dma->sglen) return 0; @@ -279,17 +302,19 @@ int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) vfree(dma->sglist); dma->sglist = NULL; dma->sglen = 0; + return 0; } +EXPORT_SYMBOL_GPL(videobuf_dma_unmap); int videobuf_dma_free(struct videobuf_dmabuf *dma) { - MAGIC_CHECK(dma->magic,MAGIC_DMABUF); + int i; + MAGIC_CHECK(dma->magic, MAGIC_DMABUF); BUG_ON(dma->sglen); if (dma->pages) { - int i; - for (i=0; i < dma->nr_pages; i++) + for (i = 0; i < dma->nr_pages; i++) page_cache_release(dma->pages[i]); kfree(dma->pages); dma->pages = NULL; @@ -298,12 +323,13 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma) vfree(dma->vmalloc); dma->vmalloc = NULL; - if (dma->bus_addr) { + if (dma->bus_addr) dma->bus_addr = 0; - } dma->direction = DMA_NONE; + return 0; } +EXPORT_SYMBOL_GPL(videobuf_dma_free); /* --------------------------------------------------------------------- */ @@ -315,6 +341,7 @@ int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma) return videobuf_dma_map(&q, dma); } +EXPORT_SYMBOL_GPL(videobuf_sg_dma_map); int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma) { @@ -324,49 +351,48 @@ int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma) return videobuf_dma_unmap(&q, dma); } +EXPORT_SYMBOL_GPL(videobuf_sg_dma_unmap); /* --------------------------------------------------------------------- */ -static void -videobuf_vm_open(struct vm_area_struct *vma) +static void videobuf_vm_open(struct vm_area_struct *vma) { struct videobuf_mapping *map = vma->vm_private_data; - dprintk(2,"vm_open %p [count=%d,vma=%08lx-%08lx]\n",map, - map->count,vma->vm_start,vma->vm_end); + dprintk(2, "vm_open %p [count=%d,vma=%08lx-%08lx]\n", map, + map->count, vma->vm_start, vma->vm_end); + map->count++; } -static void -videobuf_vm_close(struct vm_area_struct *vma) +static void videobuf_vm_close(struct vm_area_struct *vma) { struct videobuf_mapping *map = vma->vm_private_data; struct videobuf_queue *q = map->q; struct videobuf_dma_sg_memory *mem; int i; - dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map, - map->count,vma->vm_start,vma->vm_end); + dprintk(2, "vm_close %p [count=%d,vma=%08lx-%08lx]\n", map, + map->count, vma->vm_start, vma->vm_end); map->count--; if (0 == map->count) { - dprintk(1,"munmap %p q=%p\n",map,q); + dprintk(1, "munmap %p q=%p\n", map, q); mutex_lock(&q->vb_lock); for (i = 0; i < VIDEO_MAX_FRAME; i++) { if (NULL == q->bufs[i]) continue; - mem=q->bufs[i]->priv; - + mem = q->bufs[i]->priv; if (!mem) continue; - MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); + MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); if (q->bufs[i]->map != map) continue; q->bufs[i]->map = NULL; q->bufs[i]->baddr = 0; - q->ops->buf_release(q,q->bufs[i]); + q->ops->buf_release(q, q->bufs[i]); } mutex_unlock(&q->vb_lock); kfree(map); @@ -380,26 +406,27 @@ videobuf_vm_close(struct vm_area_struct *vma) * now ...). Bounce buffers don't work very well for the data rates * video capture has. */ -static int -videobuf_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) +static int videobuf_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct page *page; - dprintk(3,"fault: fault @ %08lx [vma %08lx-%08lx]\n", - (unsigned long)vmf->virtual_address,vma->vm_start,vma->vm_end); + dprintk(3, "fault: fault @ %08lx [vma %08lx-%08lx]\n", + (unsigned long)vmf->virtual_address, + vma->vm_start, vma->vm_end); + page = alloc_page(GFP_USER | __GFP_DMA32); if (!page) return VM_FAULT_OOM; clear_user_highpage(page, (unsigned long)vmf->virtual_address); vmf->page = page; + return 0; } -static const struct vm_operations_struct videobuf_vm_ops = -{ - .open = videobuf_vm_open, - .close = videobuf_vm_close, - .fault = videobuf_vm_fault, +static const struct vm_operations_struct videobuf_vm_ops = { + .open = videobuf_vm_open, + .close = videobuf_vm_close, + .fault = videobuf_vm_fault, }; /* --------------------------------------------------------------------- @@ -417,23 +444,23 @@ static void *__videobuf_alloc(size_t size) struct videobuf_dma_sg_memory *mem; struct videobuf_buffer *vb; - vb = kzalloc(size+sizeof(*mem),GFP_KERNEL); + vb = kzalloc(size + sizeof(*mem), GFP_KERNEL); if (!vb) return vb; - mem = vb->priv = ((char *)vb)+size; - mem->magic=MAGIC_SG_MEM; + mem = vb->priv = ((char *)vb) + size; + mem->magic = MAGIC_SG_MEM; videobuf_dma_init(&mem->dma); - dprintk(1,"%s: allocated at %p(%ld+%ld) & %p(%ld)\n", - __func__,vb,(long)sizeof(*vb),(long)size-sizeof(*vb), - mem,(long)sizeof(*mem)); + dprintk(1, "%s: allocated at %p(%ld+%ld) & %p(%ld)\n", + __func__, vb, (long)sizeof(*vb), (long)size - sizeof(*vb), + mem, (long)sizeof(*mem)); return vb; } -static void *__videobuf_to_vmalloc (struct videobuf_buffer *buf) +static void *__videobuf_to_vmalloc(struct videobuf_buffer *buf) { struct videobuf_dma_sg_memory *mem = buf->priv; BUG_ON(!mem); @@ -443,11 +470,11 @@ static void *__videobuf_to_vmalloc (struct videobuf_buffer *buf) return mem->dma.vmalloc; } -static int __videobuf_iolock (struct videobuf_queue* q, - struct videobuf_buffer *vb, - struct v4l2_framebuffer *fbuf) +static int __videobuf_iolock(struct videobuf_queue *q, + struct videobuf_buffer *vb, + struct v4l2_framebuffer *fbuf) { - int err,pages; + int err, pages; dma_addr_t bus; struct videobuf_dma_sg_memory *mem = vb->priv; BUG_ON(!mem); @@ -460,16 +487,16 @@ static int __videobuf_iolock (struct videobuf_queue* q, if (0 == vb->baddr) { /* no userspace addr -- kernel bounce buffer */ pages = PAGE_ALIGN(vb->size) >> PAGE_SHIFT; - err = videobuf_dma_init_kernel( &mem->dma, - DMA_FROM_DEVICE, - pages ); + err = videobuf_dma_init_kernel(&mem->dma, + DMA_FROM_DEVICE, + pages); if (0 != err) return err; } else if (vb->memory == V4L2_MEMORY_USERPTR) { /* dma directly to userspace */ - err = videobuf_dma_init_user( &mem->dma, - DMA_FROM_DEVICE, - vb->baddr,vb->bsize ); + err = videobuf_dma_init_user(&mem->dma, + DMA_FROM_DEVICE, + vb->baddr, vb->bsize); if (0 != err) return err; } else { @@ -516,9 +543,9 @@ static int __videobuf_sync(struct videobuf_queue *q, { struct videobuf_dma_sg_memory *mem = buf->priv; BUG_ON(!mem); - MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); + MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); - return videobuf_dma_sync(q,&mem->dma); + return videobuf_dma_sync(q, &mem->dma); } static int __videobuf_mmap_free(struct videobuf_queue *q) @@ -540,16 +567,16 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, { struct videobuf_dma_sg_memory *mem; struct videobuf_mapping *map; - unsigned int first,last,size,i; + unsigned int first, last, size, i; int retval; retval = -EINVAL; if (!(vma->vm_flags & VM_WRITE)) { - dprintk(1,"mmap app bug: PROT_WRITE please\n"); + dprintk(1, "mmap app bug: PROT_WRITE please\n"); goto done; } if (!(vma->vm_flags & VM_SHARED)) { - dprintk(1,"mmap app bug: MAP_SHARED please\n"); + dprintk(1, "mmap app bug: MAP_SHARED please\n"); goto done; } @@ -565,9 +592,9 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, for (first = 0; first < VIDEO_MAX_FRAME; first++) { if (NULL == q->bufs[first]) continue; - mem=q->bufs[first]->priv; + mem = q->bufs[first]->priv; BUG_ON(!mem); - MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); + MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); if (V4L2_MEMORY_MMAP != q->bufs[first]->memory) continue; @@ -575,7 +602,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, break; } if (VIDEO_MAX_FRAME == first) { - dprintk(1,"mmap app bug: offset invalid [offset=0x%lx]\n", + dprintk(1, "mmap app bug: offset invalid [offset=0x%lx]\n", (vma->vm_pgoff << PAGE_SHIFT)); goto done; } @@ -595,14 +622,14 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, break; } if (VIDEO_MAX_FRAME == last) { - dprintk(1,"mmap app bug: size invalid [size=0x%lx]\n", + dprintk(1, "mmap app bug: size invalid [size=0x%lx]\n", (vma->vm_end - vma->vm_start)); goto done; } /* create mapping + update buffer list */ retval = -ENOMEM; - map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL); + map = kmalloc(sizeof(struct videobuf_mapping), GFP_KERNEL); if (NULL == map) goto done; @@ -623,21 +650,21 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, vma->vm_flags |= VM_DONTEXPAND | VM_RESERVED; vma->vm_flags &= ~VM_IO; /* using shared anonymous pages */ vma->vm_private_data = map; - dprintk(1,"mmap %p: q=%p %08lx-%08lx pgoff %08lx bufs %d-%d\n", - map,q,vma->vm_start,vma->vm_end,vma->vm_pgoff,first,last); + dprintk(1, "mmap %p: q=%p %08lx-%08lx pgoff %08lx bufs %d-%d\n", + map, q, vma->vm_start, vma->vm_end, vma->vm_pgoff, first, last); retval = 0; - done: +done: return retval; } -static int __videobuf_copy_to_user ( struct videobuf_queue *q, +static int __videobuf_copy_to_user(struct videobuf_queue *q, char __user *data, size_t count, - int nonblocking ) + int nonblocking) { struct videobuf_dma_sg_memory *mem = q->read_buf->priv; BUG_ON(!mem); - MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); + MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); /* copy to userspace */ if (count > q->read_buf->size - q->read_off) @@ -649,30 +676,30 @@ static int __videobuf_copy_to_user ( struct videobuf_queue *q, return count; } -static int __videobuf_copy_stream ( struct videobuf_queue *q, +static int __videobuf_copy_stream(struct videobuf_queue *q, char __user *data, size_t count, size_t pos, - int vbihack, int nonblocking ) + int vbihack, int nonblocking) { - unsigned int *fc; + unsigned int *fc; struct videobuf_dma_sg_memory *mem = q->read_buf->priv; BUG_ON(!mem); - MAGIC_CHECK(mem->magic,MAGIC_SG_MEM); + MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); if (vbihack) { /* dirty, undocumented hack -- pass the frame counter - * within the last four bytes of each vbi data block. - * We need that one to maintain backward compatibility - * to all vbi decoding software out there ... */ - fc = (unsigned int*)mem->dma.vmalloc; - fc += (q->read_buf->size>>2) -1; + * within the last four bytes of each vbi data block. + * We need that one to maintain backward compatibility + * to all vbi decoding software out there ... */ + fc = (unsigned int *)mem->dma.vmalloc; + fc += (q->read_buf->size >> 2) - 1; *fc = q->read_buf->field_count >> 1; - dprintk(1,"vbihack: %d\n",*fc); + dprintk(1, "vbihack: %d\n", *fc); } /* copy stuff using the common method */ - count = __videobuf_copy_to_user (q,data,count,nonblocking); + count = __videobuf_copy_to_user(q, data, count, nonblocking); - if ( (count==-EFAULT) && (0 == pos) ) + if ((count == -EFAULT) && (0 == pos)) return -EFAULT; return count; @@ -702,8 +729,9 @@ void *videobuf_sg_alloc(size_t size) return videobuf_alloc(&q); } +EXPORT_SYMBOL_GPL(videobuf_sg_alloc); -void videobuf_queue_sg_init(struct videobuf_queue* q, +void videobuf_queue_sg_init(struct videobuf_queue *q, const struct videobuf_queue_ops *ops, struct device *dev, spinlock_t *irqlock, @@ -715,29 +743,5 @@ void videobuf_queue_sg_init(struct videobuf_queue* q, videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize, priv, &sg_ops); } - -/* --------------------------------------------------------------------- */ - -EXPORT_SYMBOL_GPL(videobuf_vmalloc_to_sg); - -EXPORT_SYMBOL_GPL(videobuf_to_dma); -EXPORT_SYMBOL_GPL(videobuf_dma_init); -EXPORT_SYMBOL_GPL(videobuf_dma_init_user); -EXPORT_SYMBOL_GPL(videobuf_dma_init_kernel); -EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay); -EXPORT_SYMBOL_GPL(videobuf_dma_map); -EXPORT_SYMBOL_GPL(videobuf_dma_sync); -EXPORT_SYMBOL_GPL(videobuf_dma_unmap); -EXPORT_SYMBOL_GPL(videobuf_dma_free); - -EXPORT_SYMBOL_GPL(videobuf_sg_dma_map); -EXPORT_SYMBOL_GPL(videobuf_sg_dma_unmap); -EXPORT_SYMBOL_GPL(videobuf_sg_alloc); - EXPORT_SYMBOL_GPL(videobuf_queue_sg_init); -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c index 136e09383c06..d6a8a38dc9cb 100644 --- a/drivers/media/video/videobuf-vmalloc.c +++ b/drivers/media/video/videobuf-vmalloc.c @@ -30,8 +30,12 @@ #define MAGIC_DMABUF 0x17760309 #define MAGIC_VMAL_MEM 0x18221223 -#define MAGIC_CHECK(is,should) if (unlikely((is) != (should))) \ - { printk(KERN_ERR "magic mismatch: %x (expected %x)\n",is,should); BUG(); } +#define MAGIC_CHECK(is, should) \ + if (unlikely((is) != (should))) { \ + printk(KERN_ERR "magic mismatch: %x (expected %x)\n", \ + is, should); \ + BUG(); \ + } static int debug; module_param(debug, int, 0644); @@ -40,19 +44,19 @@ MODULE_DESCRIPTION("helper module to manage video4linux vmalloc buffers"); MODULE_AUTHOR("Mauro Carvalho Chehab "); MODULE_LICENSE("GPL"); -#define dprintk(level, fmt, arg...) if (debug >= level) \ - printk(KERN_DEBUG "vbuf-vmalloc: " fmt , ## arg) +#define dprintk(level, fmt, arg...) \ + if (debug >= level) \ + printk(KERN_DEBUG "vbuf-vmalloc: " fmt , ## arg) /***************************************************************************/ -static void -videobuf_vm_open(struct vm_area_struct *vma) +static void videobuf_vm_open(struct vm_area_struct *vma) { struct videobuf_mapping *map = vma->vm_private_data; - dprintk(2,"vm_open %p [count=%u,vma=%08lx-%08lx]\n",map, - map->count,vma->vm_start,vma->vm_end); + dprintk(2, "vm_open %p [count=%u,vma=%08lx-%08lx]\n", map, + map->count, vma->vm_start, vma->vm_end); map->count++; } @@ -63,7 +67,7 @@ static void videobuf_vm_close(struct vm_area_struct *vma) struct videobuf_queue *q = map->q; int i; - dprintk(2,"vm_close %p [count=%u,vma=%08lx-%08lx]\n", map, + dprintk(2, "vm_close %p [count=%u,vma=%08lx-%08lx]\n", map, map->count, vma->vm_start, vma->vm_end); map->count--; @@ -116,8 +120,7 @@ static void videobuf_vm_close(struct vm_area_struct *vma) return; } -static const struct vm_operations_struct videobuf_vm_ops = -{ +static const struct vm_operations_struct videobuf_vm_ops = { .open = videobuf_vm_open, .close = videobuf_vm_close, }; @@ -137,23 +140,23 @@ static void *__videobuf_alloc(size_t size) struct videobuf_vmalloc_memory *mem; struct videobuf_buffer *vb; - vb = kzalloc(size+sizeof(*mem),GFP_KERNEL); + vb = kzalloc(size + sizeof(*mem), GFP_KERNEL); if (!vb) return vb; - mem = vb->priv = ((char *)vb)+size; - mem->magic=MAGIC_VMAL_MEM; + mem = vb->priv = ((char *)vb) + size; + mem->magic = MAGIC_VMAL_MEM; - dprintk(1,"%s: allocated at %p(%ld+%ld) & %p(%ld)\n", - __func__,vb,(long)sizeof(*vb),(long)size-sizeof(*vb), - mem,(long)sizeof(*mem)); + dprintk(1, "%s: allocated at %p(%ld+%ld) & %p(%ld)\n", + __func__, vb, (long)sizeof(*vb), (long)size - sizeof(*vb), + mem, (long)sizeof(*mem)); return vb; } -static int __videobuf_iolock (struct videobuf_queue* q, - struct videobuf_buffer *vb, - struct v4l2_framebuffer *fbuf) +static int __videobuf_iolock(struct videobuf_queue *q, + struct videobuf_buffer *vb, + struct v4l2_framebuffer *fbuf) { struct videobuf_vmalloc_memory *mem = vb->priv; int pages; @@ -177,15 +180,13 @@ static int __videobuf_iolock (struct videobuf_queue* q, dprintk(1, "%s memory method USERPTR\n", __func__); -#if 1 if (vb->baddr) { printk(KERN_ERR "USERPTR is currently not supported\n"); return -EINVAL; } -#endif /* The only USERPTR currently supported is the one needed for - read() method. + * read() method. */ mem->vmalloc = vmalloc_user(pages); @@ -210,7 +211,7 @@ static int __videobuf_iolock (struct videobuf_queue* q, /* Try to remap memory */ rc = remap_vmalloc_range(mem->vma, (void *)vb->baddr, 0); if (rc < 0) { - printk(KERN_ERR "mmap: remap failed with error %d. ", rc); + printk(KERN_ERR "mmap: remap failed with error %d", rc); return -ENOMEM; } #endif @@ -273,7 +274,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, break; } if (VIDEO_MAX_FRAME == first) { - dprintk(1,"mmap app bug: offset invalid [offset=0x%lx]\n", + dprintk(1, "mmap app bug: offset invalid [offset=0x%lx]\n", (vma->vm_pgoff << PAGE_SHIFT)); return -EINVAL; } @@ -300,8 +301,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, printk(KERN_ERR "vmalloc (%d pages) failed\n", pages); goto error; } - dprintk(1, "vmalloc is at addr %p (%d pages)\n", - mem->vmalloc, pages); + dprintk(1, "vmalloc is at addr %p (%d pages)\n", mem->vmalloc, pages); /* Try to remap memory */ retval = remap_vmalloc_range(vma, mem->vmalloc, 0); @@ -315,7 +315,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, vma->vm_flags |= VM_DONTEXPAND | VM_RESERVED; vma->vm_private_data = map; - dprintk(1,"mmap %p: q=%p %08lx-%08lx (%lx) pgoff %08lx buf %d\n", + dprintk(1, "mmap %p: q=%p %08lx-%08lx (%lx) pgoff %08lx buf %d\n", map, q, vma->vm_start, vma->vm_end, (long int) q->bufs[first]->bsize, vma->vm_pgoff, first); @@ -330,15 +330,15 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, return -ENOMEM; } -static int __videobuf_copy_to_user ( struct videobuf_queue *q, - char __user *data, size_t count, - int nonblocking ) +static int __videobuf_copy_to_user(struct videobuf_queue *q, + char __user *data, size_t count, + int nonblocking) { - struct videobuf_vmalloc_memory *mem=q->read_buf->priv; - BUG_ON (!mem); - MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); + struct videobuf_vmalloc_memory *mem = q->read_buf->priv; + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM); - BUG_ON (!mem->vmalloc); + BUG_ON(!mem->vmalloc); /* copy to userspace */ if (count > q->read_buf->size - q->read_off) @@ -350,30 +350,30 @@ static int __videobuf_copy_to_user ( struct videobuf_queue *q, return count; } -static int __videobuf_copy_stream ( struct videobuf_queue *q, - char __user *data, size_t count, size_t pos, - int vbihack, int nonblocking ) +static int __videobuf_copy_stream(struct videobuf_queue *q, + char __user *data, size_t count, size_t pos, + int vbihack, int nonblocking) { - unsigned int *fc; - struct videobuf_vmalloc_memory *mem=q->read_buf->priv; - BUG_ON (!mem); - MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); + unsigned int *fc; + struct videobuf_vmalloc_memory *mem = q->read_buf->priv; + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM); if (vbihack) { /* dirty, undocumented hack -- pass the frame counter * within the last four bytes of each vbi data block. * We need that one to maintain backward compatibility * to all vbi decoding software out there ... */ - fc = (unsigned int*)mem->vmalloc; - fc += (q->read_buf->size>>2) -1; + fc = (unsigned int *)mem->vmalloc; + fc += (q->read_buf->size >> 2) - 1; *fc = q->read_buf->field_count >> 1; - dprintk(1,"vbihack: %d\n",*fc); + dprintk(1, "vbihack: %d\n", *fc); } /* copy stuff using the common method */ - count = __videobuf_copy_to_user (q,data,count,nonblocking); + count = __videobuf_copy_to_user(q, data, count, nonblocking); - if ( (count==-EFAULT) && (0 == pos) ) + if ((count == -EFAULT) && (0 == pos)) return -EFAULT; return count; @@ -392,7 +392,7 @@ static struct videobuf_qtype_ops qops = { .vmalloc = videobuf_to_vmalloc, }; -void videobuf_queue_vmalloc_init(struct videobuf_queue* q, +void videobuf_queue_vmalloc_init(struct videobuf_queue *q, const struct videobuf_queue_ops *ops, struct device *dev, spinlock_t *irqlock, @@ -404,20 +404,19 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue* q, videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize, priv, &qops); } - EXPORT_SYMBOL_GPL(videobuf_queue_vmalloc_init); -void *videobuf_to_vmalloc (struct videobuf_buffer *buf) +void *videobuf_to_vmalloc(struct videobuf_buffer *buf) { - struct videobuf_vmalloc_memory *mem=buf->priv; - BUG_ON (!mem); - MAGIC_CHECK(mem->magic,MAGIC_VMAL_MEM); + struct videobuf_vmalloc_memory *mem = buf->priv; + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_VMAL_MEM); return mem->vmalloc; } EXPORT_SYMBOL_GPL(videobuf_to_vmalloc); -void videobuf_vmalloc_free (struct videobuf_buffer *buf) +void videobuf_vmalloc_free(struct videobuf_buffer *buf) { struct videobuf_vmalloc_memory *mem = buf->priv; @@ -442,8 +441,3 @@ void videobuf_vmalloc_free (struct videobuf_buffer *buf) } EXPORT_SYMBOL_GPL(videobuf_vmalloc_free); -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index 316fdccdcaa0..b1f7bf423fd3 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h @@ -129,14 +129,14 @@ struct videobuf_qtype_ops { void *(*alloc) (size_t size); void *(*vmalloc) (struct videobuf_buffer *buf); - int (*iolock) (struct videobuf_queue* q, + int (*iolock) (struct videobuf_queue *q, struct videobuf_buffer *vb, struct v4l2_framebuffer *fbuf); int (*mmap) (struct videobuf_queue *q, unsigned int *count, unsigned int *size, enum v4l2_memory memory); - int (*sync) (struct videobuf_queue* q, + int (*sync) (struct videobuf_queue *q, struct videobuf_buffer *buf); int (*video_copy_to_user)(struct videobuf_queue *q, char __user *data, @@ -185,14 +185,14 @@ struct videobuf_queue { }; int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); -int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, +int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, struct v4l2_framebuffer *fbuf); void *videobuf_alloc(struct videobuf_queue* q); /* Used on videobuf-dvb */ -void *videobuf_queue_to_vmalloc (struct videobuf_queue* q, - struct videobuf_buffer *buf); +void *videobuf_queue_to_vmalloc(struct videobuf_queue *q, + struct videobuf_buffer *buf); void videobuf_queue_core_init(struct videobuf_queue *q, const struct videobuf_queue_ops *ops, diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h index 53e72f787175..dbfd8cf7b7cb 100644 --- a/include/media/videobuf-dma-sg.h +++ b/include/media/videobuf-dma-sg.h @@ -17,6 +17,8 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 */ +#ifndef _VIDEOBUF_DMA_SG_H +#define _VIDEOBUF_DMA_SG_H #include @@ -27,14 +29,14 @@ * block (NULL on errors). Memory for the scatterlist is allocated * using kmalloc. The caller must free the memory. */ -struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); +struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); /* * Return a scatterlist for a an array of userpages (NULL on errors). * Memory for the scatterlist is allocated using kmalloc. The caller * must free the memory. */ -struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, +struct scatterlist *videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset); /* --------------------------------------------------------------------- */ @@ -78,8 +80,7 @@ struct videobuf_dmabuf { int direction; }; -struct videobuf_dma_sg_memory -{ +struct videobuf_dma_sg_memory { u32 magic; /* for mmap'ed buffers */ @@ -95,14 +96,14 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, dma_addr_t addr, int nr_pages); int videobuf_dma_free(struct videobuf_dmabuf *dma); -int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); -int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); -int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); -struct videobuf_dmabuf *videobuf_to_dma (struct videobuf_buffer *buf); +int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma); +int videobuf_dma_sync(struct videobuf_queue *q, struct videobuf_dmabuf *dma); +int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma); +struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf); void *videobuf_sg_alloc(size_t size); -void videobuf_queue_sg_init(struct videobuf_queue* q, +void videobuf_queue_sg_init(struct videobuf_queue *q, const struct videobuf_queue_ops *ops, struct device *dev, spinlock_t *irqlock, @@ -111,9 +112,11 @@ void videobuf_queue_sg_init(struct videobuf_queue* q, unsigned int msize, void *priv); - /*FIXME: these variants are used only on *-alsa code, where videobuf is - * used without queue - */ +/*FIXME: these variants are used only on *-alsa code, where videobuf is + * used without queue + */ int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma); int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma); +#endif /* _VIDEOBUF_DMA_SG_H */ + diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h index 4b419a257a7d..851eb1a2ff2a 100644 --- a/include/media/videobuf-vmalloc.h +++ b/include/media/videobuf-vmalloc.h @@ -19,17 +19,17 @@ /* --------------------------------------------------------------------- */ -struct videobuf_vmalloc_memory -{ +struct videobuf_vmalloc_memory { u32 magic; void *vmalloc; - /* remap_vmalloc_range seems to need to run after mmap() on some cases */ + /* remap_vmalloc_range seems to need to run + * after mmap() on some cases */ struct vm_area_struct *vma; }; -void videobuf_queue_vmalloc_init(struct videobuf_queue* q, +void videobuf_queue_vmalloc_init(struct videobuf_queue *q, const struct videobuf_queue_ops *ops, struct device *dev, spinlock_t *irqlock, @@ -38,8 +38,8 @@ void videobuf_queue_vmalloc_init(struct videobuf_queue* q, unsigned int msize, void *priv); -void *videobuf_to_vmalloc (struct videobuf_buffer *buf); +void *videobuf_to_vmalloc(struct videobuf_buffer *buf); -void videobuf_vmalloc_free (struct videobuf_buffer *buf); +void videobuf_vmalloc_free(struct videobuf_buffer *buf); #endif -- GitLab From d72d7c1df98628315298102dd1d442bcf24dc44c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 17 Mar 2010 12:11:56 -0300 Subject: [PATCH 217/534] V4L/DVB: ivtv: sizeof() => ARRAY_SIZE() This fixes a smatch warning: drivers/media/video/ivtv/ivtv-vbi.c +138 ivtv_write_vbi(43) error: buffer overflow 'vi->cc_payload' 256 <= 1023 Signed-off-by: Dan Carpenter Reviewed-by: Andy Walls Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-vbi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/ivtv/ivtv-vbi.c b/drivers/media/video/ivtv/ivtv-vbi.c index f420d31b937d..d73af45dede6 100644 --- a/drivers/media/video/ivtv/ivtv-vbi.c +++ b/drivers/media/video/ivtv/ivtv-vbi.c @@ -134,7 +134,7 @@ void ivtv_write_vbi(struct ivtv *itv, const struct v4l2_sliced_vbi_data *sliced, } } } - if (found_cc && vi->cc_payload_idx < sizeof(vi->cc_payload)) { + if (found_cc && vi->cc_payload_idx < ARRAY_SIZE(vi->cc_payload)) { vi->cc_payload[vi->cc_payload_idx++] = cc; set_bit(IVTV_F_I_UPDATE_CC, &itv->i_flags); } -- GitLab From b5f11cc7037fad423877ac09a48f337829880a95 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 18 May 2010 00:51:02 -0300 Subject: [PATCH 218/534] V4L/DVB: cx25821-audio-upstream.c: Fixed some checkpatch.pl warnings/errors This patch fixes up some warnings&errors found by the checkpatch.pl script Signed-off-by: Olimpiu Pascariu CC: Palash Bandyopadhyay Signed-off-by: Mauro Carvalho Chehab --- .../staging/cx25821/cx25821-audio-upstream.c | 146 +++++++++--------- 1 file changed, 74 insertions(+), 72 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-audio-upstream.c b/drivers/staging/cx25821/cx25821-audio-upstream.c index 11c56bdb0ceb..6a4e8720b478 100644 --- a/drivers/staging/cx25821/cx25821-audio-upstream.c +++ b/drivers/staging/cx25821/cx25821-audio-upstream.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include MODULE_DESCRIPTION("v4l2 driver module for cx25821 based TV cards"); MODULE_AUTHOR("Hiep Huynh "); @@ -62,9 +62,8 @@ int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev, cdt = ch->cdt; lines = ch->fifo_size / bpl; - if (lines > 3) { + if (lines > 3) lines = 3; - } BUG_ON(lines < 2); @@ -84,7 +83,7 @@ int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev, cx_write(ch->cmds_start + 12, AUDIO_CDT_SIZE_QW); cx_write(ch->cmds_start + 16, ch->ctrl_start); - //IQ size + /* IQ size */ cx_write(ch->cmds_start + 20, AUDIO_IQ_SIZE_DW); for (i = 24; i < 80; i += 4) @@ -100,7 +99,7 @@ int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev, } static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev, - __le32 * rp, + __le32 *rp, dma_addr_t databuf_phys_addr, unsigned int bpl, int fifo_enable) @@ -116,8 +115,10 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev, *(rp++) = cpu_to_le32(databuf_phys_addr + offset); *(rp++) = cpu_to_le32(0); /* bits 63-32 */ - // Check if we need to enable the FIFO after the first 3 lines - // For the upstream audio channel, the risc engine will enable the FIFO. + /* Check if we need to enable the FIFO + * after the first 3 lines. + * For the upstream audio channel, + * the risc engine will enable the FIFO */ if (fifo_enable && line == 2) { *(rp++) = RISC_WRITECR; *(rp++) = sram_ch->dma_ctl; @@ -160,7 +161,7 @@ int cx25821_risc_buffer_upstream_audio(struct cx25821_dev *dev, risc_flag = RISC_CNT_INC; } - //Calculate physical jump address + /* Calculate physical jump address */ if ((frame + 1) == NUM_AUDIO_FRAMES) { risc_phys_jump_addr = dev->_risc_phys_start_addr + @@ -179,17 +180,17 @@ int cx25821_risc_buffer_upstream_audio(struct cx25821_dev *dev, fifo_enable); if (USE_RISC_NOOP_AUDIO) { - for (i = 0; i < NUM_NO_OPS; i++) { + for (i = 0; i < NUM_NO_OPS; i++) *(rp++) = cpu_to_le32(RISC_NOOP); - } } - // Loop to (Nth)FrameRISC or to Start of Risc program & generate IRQ + /* Loop to (Nth)FrameRISC or to Start of Risc program & + * generate IRQ */ *(rp++) = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | risc_flag); *(rp++) = cpu_to_le32(risc_phys_jump_addr); *(rp++) = cpu_to_le32(0); - //Recalculate virtual address based on frame index + /* Recalculate virtual address based on frame index */ rp = dev->_risc_virt_addr + RISC_SYNC_INSTRUCTION_SIZE / 4 + (AUDIO_RISC_DMA_BUF_SIZE * (frame + 1) / 4); } @@ -220,19 +221,19 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev) u32 tmp = 0; if (!dev->_audio_is_running) { - printk - ("cx25821: No audio file is currently running so return!\n"); + printk(KERN_DEBUG + "cx25821: No audio file is currently running so return!\n"); return; } - //Disable RISC interrupts + /* Disable RISC interrupts */ cx_write(sram_ch->int_msk, 0); - //Turn OFF risc and fifo enable in AUD_DMA_CNTRL + /* Turn OFF risc and fifo enable in AUD_DMA_CNTRL */ tmp = cx_read(sram_ch->dma_ctl); cx_write(sram_ch->dma_ctl, tmp & ~(sram_ch->fld_aud_fifo_en | sram_ch->fld_aud_risc_en)); - //Clear data buffer memory + /* Clear data buffer memory */ if (dev->_audiodata_buf_virt_addr) memset(dev->_audiodata_buf_virt_addr, 0, dev->_audiodata_buf_size); @@ -253,9 +254,8 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev) void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev) { - if (dev->_audio_is_running) { + if (dev->_audio_is_running) cx25821_stop_upstream_audio(dev); - } cx25821_free_memory_audio(dev); } @@ -282,7 +282,7 @@ int cx25821_get_audio_data(struct cx25821_dev *dev, if (IS_ERR(myfile)) { const int open_errno = -PTR_ERR(myfile); - printk("%s(): ERROR opening file(%s) with errno = %d! \n", + printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n", __func__, dev->_audiofilename, open_errno); return PTR_ERR(myfile); } else { @@ -294,7 +294,7 @@ int cx25821_get_audio_data(struct cx25821_dev *dev, } if (!myfile->f_op->read) { - printk("%s: File has no READ operations registered! \n", + printk("%s: File has no READ operations registered!\n", __func__); filp_close(myfile, NULL); return -EIO; @@ -347,7 +347,7 @@ static void cx25821_audioups_handler(struct work_struct *work) container_of(work, struct cx25821_dev, _audio_work_entry); if (!dev) { - printk("ERROR %s(): since container_of(work_struct) FAILED! \n", + printk(KERN_ERR "ERROR %s(): since container_of(work_struct) FAILED!\n", __func__); return; } @@ -373,19 +373,19 @@ int cx25821_openfile_audio(struct cx25821_dev *dev, if (IS_ERR(myfile)) { const int open_errno = -PTR_ERR(myfile); - printk("%s(): ERROR opening file(%s) with errno = %d! \n", + printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n", __func__, dev->_audiofilename, open_errno); return PTR_ERR(myfile); } else { if (!(myfile->f_op)) { - printk("%s: File has no file operations registered! \n", + printk("%s: File has no file operations registered!\n", __func__); filp_close(myfile, NULL); return -EIO; } if (!myfile->f_op->read) { - printk("%s: File has no READ operations registered! \n", + printk("%s: File has no READ operations registered!\n", __func__); filp_close(myfile, NULL); return -EIO; @@ -421,13 +421,11 @@ int cx25821_openfile_audio(struct cx25821_dev *dev, } } - if (i > 0) { + if (i > 0) dev->_audioframe_count++; - } - if (vfs_read_retval < line_size) { + if (vfs_read_retval < line_size) break; - } } dev->_audiofile_status = @@ -460,14 +458,14 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev, dev->_audiorisc_size = dev->audio_upstream_riscbuf_size; if (!dev->_risc_virt_addr) { - printk - ("cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for RISC program! Returning.\n"); + printk(KERN_DEBUG + "cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for RISC program! Returning.\n"); return -ENOMEM; } - //Clear out memory at address + /* Clear out memory at address */ memset(dev->_risc_virt_addr, 0, dev->_audiorisc_size); - //For Audio Data buffer allocation + /* For Audio Data buffer allocation */ dev->_audiodata_buf_virt_addr = pci_alloc_consistent(dev->pci, dev->audio_upstream_databuf_size, &data_dma_addr); @@ -475,30 +473,30 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev, dev->_audiodata_buf_size = dev->audio_upstream_databuf_size; if (!dev->_audiodata_buf_virt_addr) { - printk - ("cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for data buffer! Returning. \n"); + printk(KERN_DEBUG + "cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for data buffer! Returning.\n"); return -ENOMEM; } - //Clear out memory at address + /* Clear out memory at address */ memset(dev->_audiodata_buf_virt_addr, 0, dev->_audiodata_buf_size); ret = cx25821_openfile_audio(dev, sram_ch); if (ret < 0) return ret; - //Creating RISC programs + /* Creating RISC programs */ ret = cx25821_risc_buffer_upstream_audio(dev, dev->pci, bpl, dev->_audio_lines_count); if (ret < 0) { printk(KERN_DEBUG - "cx25821 ERROR creating audio upstream RISC programs! \n"); + "cx25821 ERROR creating audio upstream RISC programs!\n"); goto error; } return 0; - error: +error: return ret; } @@ -512,22 +510,22 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, __le32 *rp; if (status & FLD_AUD_SRC_RISCI1) { - //Get interrupt_index of the program that interrupted + /* Get interrupt_index of the program that interrupted */ u32 prog_cnt = cx_read(channel->gpcnt); - //Since we've identified our IRQ, clear our bits from the interrupt mask and interrupt status registers + /* Since we've identified our IRQ, clear our bits from the + * interrupt mask and interrupt status registers */ cx_write(channel->int_msk, 0); cx_write(channel->int_stat, cx_read(channel->int_stat)); spin_lock(&dev->slock); while (prog_cnt != dev->_last_index_irq) { - //Update _last_index_irq - if (dev->_last_index_irq < (NUMBER_OF_PROGRAMS - 1)) { + /* Update _last_index_irq */ + if (dev->_last_index_irq < (NUMBER_OF_PROGRAMS - 1)) dev->_last_index_irq++; - } else { + else dev->_last_index_irq = 0; - } dev->_audioframe_index = dev->_last_index_irq; @@ -559,7 +557,7 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, cpu_to_le32(RISC_NOOP); } } - // Jump to 2nd Audio Frame + /* Jump to 2nd Audio Frame */ *(rp++) = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_RESET); @@ -582,7 +580,8 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, printk("%s: Audio Received OpCode Error Interrupt!\n", __func__); - // Read and write back the interrupt status register to clear our bits + /* Read and write back the interrupt status register to clear + * our bits */ cx_write(channel->int_stat, cx_read(channel->int_stat)); } @@ -591,7 +590,7 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num, dev->_audioframe_count); return -1; } - //ElSE, set the interrupt mask register, re-enable irq. + /* ElSE, set the interrupt mask register, re-enable irq. */ int_msk_tmp = cx_read(channel->int_msk); cx_write(channel->int_msk, int_msk_tmp |= _intr_msk); @@ -613,7 +612,7 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id) msk_stat = cx_read(sram_ch->int_mstat); audio_status = cx_read(sram_ch->int_stat); - // Only deal with our interrupt + /* Only deal with our interrupt */ if (audio_status) { handled = cx25821_audio_upstream_irq(dev, @@ -622,11 +621,10 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id) audio_status); } - if (handled < 0) { + if (handled < 0) cx25821_stop_upstream_audio(dev); - } else { + else handled += handled; - } return IRQ_RETVAL(handled); } @@ -638,13 +636,14 @@ static void cx25821_wait_fifo_enable(struct cx25821_dev *dev, u32 tmp; do { - //Wait 10 microsecond before checking to see if the FIFO is turned ON. + /* Wait 10 microsecond before checking to see if the FIFO is + * turned ON. */ udelay(10); tmp = cx_read(sram_ch->dma_ctl); - if (count++ > 1000) //10 millisecond timeout - { + /* 10 millisecond timeout */ + if (count++ > 1000) { printk ("cx25821 ERROR: %s() fifo is NOT turned on. Timeout!\n", __func__); @@ -661,31 +660,34 @@ int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev, u32 tmp = 0; int err = 0; - // Set the physical start address of the RISC program in the initial program counter(IPC) member of the CMDS. + /* Set the physical start address of the RISC program in the initial + * program counter(IPC) member of the CMDS. */ cx_write(sram_ch->cmds_start + 0, dev->_risc_phys_addr); - cx_write(sram_ch->cmds_start + 4, 0); /* Risc IPC High 64 bits 63-32 */ + /* Risc IPC High 64 bits 63-32 */ + cx_write(sram_ch->cmds_start + 4, 0); /* reset counter */ cx_write(sram_ch->gpcnt_ctl, 3); - //Set the line length (It looks like we do not need to set the line length) + /* Set the line length (It looks like we do not need to set the + * line length) */ cx_write(sram_ch->aud_length, AUDIO_LINE_SIZE & FLD_AUD_DST_LN_LNGTH); - //Set the input mode to 16-bit + /* Set the input mode to 16-bit */ tmp = cx_read(sram_ch->aud_cfg); tmp |= FLD_AUD_SRC_ENABLE | FLD_AUD_DST_PK_MODE | FLD_AUD_CLK_ENABLE | FLD_AUD_MASTER_MODE | FLD_AUD_CLK_SELECT_PLL_D | FLD_AUD_SONY_MODE; cx_write(sram_ch->aud_cfg, tmp); - // Read and write back the interrupt status register to clear it + /* Read and write back the interrupt status register to clear it */ tmp = cx_read(sram_ch->int_stat); cx_write(sram_ch->int_stat, tmp); - // Clear our bits from the interrupt status register. + /* Clear our bits from the interrupt status register. */ cx_write(sram_ch->int_stat, _intr_msk); - //Set the interrupt mask register, enable irq. + /* Set the interrupt mask register, enable irq. */ cx_set(PCI_INT_MSK, cx_read(PCI_INT_MSK) | (1 << sram_ch->irq_bit)); tmp = cx_read(sram_ch->int_msk); cx_write(sram_ch->int_msk, tmp |= _intr_msk); @@ -699,19 +701,19 @@ int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev, goto fail_irq; } - // Start the DMA engine + /* Start the DMA engine */ tmp = cx_read(sram_ch->dma_ctl); cx_set(sram_ch->dma_ctl, tmp | sram_ch->fld_aud_risc_en); dev->_audio_is_running = 1; dev->_is_first_audio_frame = 1; - // The fifo_en bit turns on by the first Risc program + /* The fifo_en bit turns on by the first Risc program */ cx25821_wait_fifo_enable(dev, sram_ch); return 0; - fail_irq: +fail_irq: cx25821_dev_unregister(dev); return err; } @@ -731,14 +733,14 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) dev->_audio_upstream_channel_select = channel_select; sram_ch = &dev->sram_channels[channel_select]; - //Work queue + /* Work queue */ INIT_WORK(&dev->_audio_work_entry, cx25821_audioups_handler); dev->_irq_audio_queues = create_singlethread_workqueue("cx25821_audioworkqueue"); if (!dev->_irq_audio_queues) { - printk - ("cx25821 ERROR: create_singlethread_workqueue() for Audio FAILED!\n"); + printk(KERN_DEBUG + "cx25821 ERROR: create_singlethread_workqueue() for Audio FAILED!\n"); return -ENOMEM; } @@ -760,7 +762,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) memcpy(dev->_audiofilename, dev->input_audiofilename, str_length + 1); - //Default if filename is empty string + /* Default if filename is empty string */ if (strcmp(dev->input_audiofilename, "") == 0) { dev->_audiofilename = "/root/audioGOOD.wav"; } @@ -784,7 +786,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) RISC_SYNC_INSTRUCTION_SIZE; dev->audio_upstream_databuf_size = AUDIO_DATA_BUF_SZ * NUM_AUDIO_PROGS; - //Allocating buffers and prepare RISC program + /* Allocating buffers and prepare RISC program */ retval = cx25821_audio_upstream_buffer_prepare(dev, sram_ch, _line_size); if (retval < 0) { @@ -793,12 +795,12 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select) dev->name); goto error; } - //Start RISC engine + /* Start RISC engine */ cx25821_start_audio_dma_upstream(dev, sram_ch); return 0; - error: +error: cx25821_dev_unregister(dev); return err; -- GitLab From de2c43492017d705d3f7ffc7f89c9b5a93752871 Mon Sep 17 00:00:00 2001 From: Olimpiu Pascariu Date: Sun, 21 Mar 2010 14:18:19 -0300 Subject: [PATCH 219/534] V4L/DVB: cx25821: fix coding style issues in cx25821-core.c Fixes up warnings and errors found by the checkpatch.pl tool on cx25821-core.c. Signed-off-by: Olimpiu Pascariu CC: Palash Bandyopadhyay Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/cx25821/cx25821-core.c | 156 ++++++++++++------------- 1 file changed, 77 insertions(+), 79 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c index 9e9b8c3c9311..90090f4b5e76 100644 --- a/drivers/staging/cx25821/cx25821-core.c +++ b/drivers/staging/cx25821/cx25821-core.c @@ -32,6 +32,7 @@ MODULE_AUTHOR("Shu Lin - Hiep Huynh"); MODULE_LICENSE("GPL"); struct list_head cx25821_devlist; +EXPORT_SYMBOL(cx25821_devlist); static unsigned int debug; module_param(debug, int, 0644); @@ -313,6 +314,7 @@ struct sram_channel cx25821_sram_channels[] = { .irq_bit = 11, }, }; +EXPORT_SYMBOL(cx25821_sram_channels); struct sram_channel *channel0 = &cx25821_sram_channels[SRAM_CH00]; struct sram_channel *channel1 = &cx25821_sram_channels[SRAM_CH01]; @@ -388,70 +390,74 @@ static void cx25821_registers_init(struct cx25821_dev *dev) { u32 tmp; - // enable RUN_RISC in Pecos + /* enable RUN_RISC in Pecos */ cx_write(DEV_CNTRL2, 0x20); - // Set the master PCI interrupt masks to enable video, audio, MBIF, and GPIO interrupts - // I2C interrupt masking is handled by the I2C objects themselves. + /* Set the master PCI interrupt masks to enable video, audio, MBIF, + * and GPIO interrupts + * I2C interrupt masking is handled by the I2C objects themselves. */ cx_write(PCI_INT_MSK, 0x2001FFFF); tmp = cx_read(RDR_TLCTL0); - tmp &= ~FLD_CFG_RCB_CK_EN; // Clear the RCB_CK_EN bit + tmp &= ~FLD_CFG_RCB_CK_EN; /* Clear the RCB_CK_EN bit */ cx_write(RDR_TLCTL0, tmp); - // PLL-A setting for the Audio Master Clock + /* PLL-A setting for the Audio Master Clock */ cx_write(PLL_A_INT_FRAC, 0x9807A58B); - // PLL_A_POST = 0x1C, PLL_A_OUT_TO_PIN = 0x1 + /* PLL_A_POST = 0x1C, PLL_A_OUT_TO_PIN = 0x1 */ cx_write(PLL_A_POST_STAT_BIST, 0x8000019C); - // clear reset bit [31] + /* clear reset bit [31] */ tmp = cx_read(PLL_A_INT_FRAC); cx_write(PLL_A_INT_FRAC, tmp & 0x7FFFFFFF); - // PLL-B setting for Mobilygen Host Bus Interface + /* PLL-B setting for Mobilygen Host Bus Interface */ cx_write(PLL_B_INT_FRAC, 0x9883A86F); - // PLL_B_POST = 0xD, PLL_B_OUT_TO_PIN = 0x0 + /* PLL_B_POST = 0xD, PLL_B_OUT_TO_PIN = 0x0 */ cx_write(PLL_B_POST_STAT_BIST, 0x8000018D); - // clear reset bit [31] + /* clear reset bit [31] */ tmp = cx_read(PLL_B_INT_FRAC); cx_write(PLL_B_INT_FRAC, tmp & 0x7FFFFFFF); - // PLL-C setting for video upstream channel + /* PLL-C setting for video upstream channel */ cx_write(PLL_C_INT_FRAC, 0x96A0EA3F); - // PLL_C_POST = 0x3, PLL_C_OUT_TO_PIN = 0x0 + /* PLL_C_POST = 0x3, PLL_C_OUT_TO_PIN = 0x0 */ cx_write(PLL_C_POST_STAT_BIST, 0x80000103); - // clear reset bit [31] + /* clear reset bit [31] */ tmp = cx_read(PLL_C_INT_FRAC); cx_write(PLL_C_INT_FRAC, tmp & 0x7FFFFFFF); - // PLL-D setting for audio upstream channel + /* PLL-D setting for audio upstream channel */ cx_write(PLL_D_INT_FRAC, 0x98757F5B); - // PLL_D_POST = 0x13, PLL_D_OUT_TO_PIN = 0x0 + /* PLL_D_POST = 0x13, PLL_D_OUT_TO_PIN = 0x0 */ cx_write(PLL_D_POST_STAT_BIST, 0x80000113); - // clear reset bit [31] + /* clear reset bit [31] */ tmp = cx_read(PLL_D_INT_FRAC); cx_write(PLL_D_INT_FRAC, tmp & 0x7FFFFFFF); - // This selects the PLL C clock source for the video upstream channel I and J + /* This selects the PLL C clock source for the video upstream channel + * I and J */ tmp = cx_read(VID_CH_CLK_SEL); cx_write(VID_CH_CLK_SEL, (tmp & 0x00FFFFFF) | 0x24000000); - // 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for channel A-C - //select 656/VIP DST for downstream Channel A - C + /* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for + * channel A-C + * select 656/VIP DST for downstream Channel A - C */ tmp = cx_read(VID_CH_MODE_SEL); - //cx_write( VID_CH_MODE_SEL, tmp | 0x1B0001FF); + /* cx_write( VID_CH_MODE_SEL, tmp | 0x1B0001FF); */ cx_write(VID_CH_MODE_SEL, tmp & 0xFFFFFE00); - // enables 656 port I and J as output + /* enables 656 port I and J as output */ tmp = cx_read(CLK_RST); - tmp |= FLD_USE_ALT_PLL_REF; // use external ALT_PLL_REF pin as its reference clock instead + /* use external ALT_PLL_REF pin as its reference clock instead */ + tmp |= FLD_USE_ALT_PLL_REF; cx_write(CLK_RST, tmp & ~(FLD_VID_I_CLK_NOE | FLD_VID_J_CLK_NOE)); mdelay(100); @@ -476,9 +482,8 @@ int cx25821_sram_channel_setup(struct cx25821_dev *dev, cdt = ch->cdt; lines = ch->fifo_size / bpl; - if (lines > 4) { + if (lines > 4) lines = 4; - } BUG_ON(lines < 2); @@ -494,16 +499,15 @@ int cx25821_sram_channel_setup(struct cx25821_dev *dev, cx_write(cdt + 16 * i + 12, 0); } - //init the first cdt buffer + /* init the first cdt buffer */ for (i = 0; i < 128; i++) cx_write(ch->fifo_start + 4 * i, i); /* write CMDS */ - if (ch->jumponly) { + if (ch->jumponly) cx_write(ch->cmds_start + 0, 8); - } else { + else cx_write(ch->cmds_start + 0, risc); - } cx_write(ch->cmds_start + 4, 0); /* 64 bits 63-32 */ cx_write(ch->cmds_start + 8, cdt); @@ -526,6 +530,7 @@ int cx25821_sram_channel_setup(struct cx25821_dev *dev, return 0; } +EXPORT_SYMBOL(cx25821_sram_channel_setup); int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev, struct sram_channel *ch, @@ -546,9 +551,8 @@ int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev, cdt = ch->cdt; lines = ch->fifo_size / bpl; - if (lines > 3) { - lines = 3; //for AUDIO - } + if (lines > 3) + lines = 3; /* for AUDIO */ BUG_ON(lines < 2); @@ -565,25 +569,23 @@ int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev, } /* write CMDS */ - if (ch->jumponly) { + if (ch->jumponly) cx_write(ch->cmds_start + 0, 8); - } else { + else cx_write(ch->cmds_start + 0, risc); - } cx_write(ch->cmds_start + 4, 0); /* 64 bits 63-32 */ cx_write(ch->cmds_start + 8, cdt); cx_write(ch->cmds_start + 12, (lines * 16) >> 3); cx_write(ch->cmds_start + 16, ch->ctrl_start); - //IQ size - if (ch->jumponly) { + /* IQ size */ + if (ch->jumponly) cx_write(ch->cmds_start + 20, 0x80000000 | (64 >> 2)); - } else { + else cx_write(ch->cmds_start + 20, 64 >> 2); - } - //zero out + /* zero out */ for (i = 24; i < 80; i += 4) cx_write(ch->cmds_start + i, 0); @@ -595,6 +597,7 @@ int cx25821_sram_channel_setup_audio(struct cx25821_dev *dev, return 0; } +EXPORT_SYMBOL(cx25821_sram_channel_setup_audio); void cx25821_sram_channel_dump(struct cx25821_dev *dev, struct sram_channel *ch) { @@ -658,6 +661,7 @@ void cx25821_sram_channel_dump(struct cx25821_dev *dev, struct sram_channel *ch) printk(KERN_WARNING " : cnt2_reg: 0x%08x\n", cx_read(ch->cnt2_reg)); } +EXPORT_SYMBOL(cx25821_sram_channel_dump); void cx25821_sram_channel_dump_audio(struct cx25821_dev *dev, struct sram_channel *ch) @@ -731,7 +735,7 @@ void cx25821_sram_channel_dump_audio(struct cx25821_dev *dev, printk(KERN_WARNING "instruction %d = 0x%x\n", i, risc); } - //read data from the first cdt buffer + /* read data from the first cdt buffer */ risc = cx_read(AUD_A_CDT); printk(KERN_WARNING "\nread cdt loc=0x%x\n", risc); for (i = 0; i < 8; i++) { @@ -741,31 +745,32 @@ void cx25821_sram_channel_dump_audio(struct cx25821_dev *dev, printk(KERN_WARNING "\n\n"); value = cx_read(CLK_RST); - CX25821_INFO(" CLK_RST = 0x%x \n\n", value); + CX25821_INFO(" CLK_RST = 0x%x\n\n", value); value = cx_read(PLL_A_POST_STAT_BIST); - CX25821_INFO(" PLL_A_POST_STAT_BIST = 0x%x \n\n", value); + CX25821_INFO(" PLL_A_POST_STAT_BIST = 0x%x\n\n", value); value = cx_read(PLL_A_INT_FRAC); - CX25821_INFO(" PLL_A_INT_FRAC = 0x%x \n\n", value); + CX25821_INFO(" PLL_A_INT_FRAC = 0x%x\n\n", value); value = cx_read(PLL_B_POST_STAT_BIST); - CX25821_INFO(" PLL_B_POST_STAT_BIST = 0x%x \n\n", value); + CX25821_INFO(" PLL_B_POST_STAT_BIST = 0x%x\n\n", value); value = cx_read(PLL_B_INT_FRAC); - CX25821_INFO(" PLL_B_INT_FRAC = 0x%x \n\n", value); + CX25821_INFO(" PLL_B_INT_FRAC = 0x%x\n\n", value); value = cx_read(PLL_C_POST_STAT_BIST); - CX25821_INFO(" PLL_C_POST_STAT_BIST = 0x%x \n\n", value); + CX25821_INFO(" PLL_C_POST_STAT_BIST = 0x%x\n\n", value); value = cx_read(PLL_C_INT_FRAC); - CX25821_INFO(" PLL_C_INT_FRAC = 0x%x \n\n", value); + CX25821_INFO(" PLL_C_INT_FRAC = 0x%x\n\n", value); value = cx_read(PLL_D_POST_STAT_BIST); - CX25821_INFO(" PLL_D_POST_STAT_BIST = 0x%x \n\n", value); + CX25821_INFO(" PLL_D_POST_STAT_BIST = 0x%x\n\n", value); value = cx_read(PLL_D_INT_FRAC); - CX25821_INFO(" PLL_D_INT_FRAC = 0x%x \n\n", value); + CX25821_INFO(" PLL_D_INT_FRAC = 0x%x\n\n", value); value = cx25821_i2c_read(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, &tmp); - CX25821_INFO(" AFE_AB_DIAG_CTRL (0x10900090) = 0x%x \n\n", value); + CX25821_INFO(" AFE_AB_DIAG_CTRL (0x10900090) = 0x%x\n\n", value); } +EXPORT_SYMBOL(cx25821_sram_channel_dump_audio); static void cx25821_shutdown(struct cx25821_dev *dev) { @@ -835,8 +840,8 @@ static void cx25821_initialize(struct cx25821_dev *dev) cx_write(AUD_E_INT_STAT, 0xffffffff); cx_write(CLK_DELAY, cx_read(CLK_DELAY) & 0x80000000); - cx_write(PAD_CTRL, 0x12); //for I2C - cx25821_registers_init(dev); //init Pecos registers + cx_write(PAD_CTRL, 0x12); /* for I2C */ + cx25821_registers_init(dev); /* init Pecos registers */ mdelay(100); for (i = 0; i < VID_CHANNEL_NUM; i++) { @@ -847,7 +852,7 @@ static void cx25821_initialize(struct cx25821_dev *dev) dev->use_cif_resolution[i] = FALSE; } - //Probably only affect Downstream + /* Probably only affect Downstream */ for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J; i++) { cx25821_set_vip_mode(dev, &dev->sram_channels[i]); @@ -944,12 +949,11 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) dev->clk_freq = 28000000; dev->sram_channels = cx25821_sram_channels; - if (dev->nr > 1) { + if (dev->nr > 1) CX25821_INFO("dev->nr > 1!"); - } /* board config */ - dev->board = 1; //card[dev->nr]; + dev->board = 1; /* card[dev->nr]; */ dev->_max_num_decoders = MAX_DECODERS; dev->pci_bus = dev->pci->bus->number; @@ -1007,8 +1011,8 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) cx25821_initialize(dev); cx25821_i2c_register(&dev->i2c_bus[0]); -// cx25821_i2c_register(&dev->i2c_bus[1]); -// cx25821_i2c_register(&dev->i2c_bus[2]); +/* cx25821_i2c_register(&dev->i2c_bus[1]); + * cx25821_i2c_register(&dev->i2c_bus[2]); */ CX25821_INFO("i2c register! bus->i2c_rc = %d\n", dev->i2c_bus[0].i2c_rc); @@ -1026,7 +1030,7 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= AUDIO_UPSTREAM_SRAM_CHANNEL_B; i++) { - //Since we don't have template8 for Audio Downstream + /* Since we don't have template8 for Audio Downstream */ if (cx25821_video_register(dev, i, video_template[i - 1]) < 0) { printk(KERN_ERR "%s() Failed to register analog video adapters for Upstream channel %d.\n", @@ -1034,7 +1038,7 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) } } - // register IOCTL device + /* register IOCTL device */ dev->ioctl_dev = cx25821_vdev_init(dev, dev->pci, video_template[VIDEO_IOCTL_CH], "video"); @@ -1112,6 +1116,7 @@ void cx25821_dev_unregister(struct cx25821_dev *dev) cx25821_i2c_unregister(&dev->i2c_bus[0]); cx25821_iounmap(dev); } +EXPORT_SYMBOL(cx25821_dev_unregister); static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist, unsigned int offset, u32 sync_line, @@ -1122,9 +1127,8 @@ static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist, unsigned int line, todo; /* sync instruction */ - if (sync_line != NO_SYNC_LINE) { + if (sync_line != NO_SYNC_LINE) *(rp++) = cpu_to_le32(RISC_RESYNC | sync_line); - } /* scan lines */ sg = sglist; @@ -1299,7 +1303,8 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci, instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; instructions += 1; - if ((rc = btcx_riscmem_alloc(pci, risc, instructions * 12)) < 0) + rc = btcx_riscmem_alloc(pci, risc, instructions * 12); + if (rc < 0) return rc; /* write risc instructions */ @@ -1312,6 +1317,7 @@ int cx25821_risc_databuffer_audio(struct pci_dev *pci, BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); return 0; } +EXPORT_SYMBOL(cx25821_risc_databuffer_audio); int cx25821_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, u32 reg, u32 mask, u32 value) @@ -1375,7 +1381,7 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id) } } - out: +out: return IRQ_RETVAL(handled); } @@ -1399,12 +1405,14 @@ void cx25821_print_irqbits(char *name, char *tag, char **strings, } printk("\n"); } +EXPORT_SYMBOL(cx25821_print_irqbits); struct cx25821_dev *cx25821_dev_get(struct pci_dev *pci) { struct cx25821_dev *dev = pci_get_drvdata(pci); return dev; } +EXPORT_SYMBOL(cx25821_dev_get); static int __devinit cx25821_initdev(struct pci_dev *pci_dev, const struct pci_device_id *pci_id) @@ -1430,7 +1438,7 @@ static int __devinit cx25821_initdev(struct pci_dev *pci_dev, goto fail_unregister_device; } - printk(KERN_INFO "cx25821 Athena pci enable ! \n"); + printk(KERN_INFO "cx25821 Athena pci enable !\n"); if (cx25821_dev_setup(dev) < 0) { err = -EINVAL; @@ -1464,14 +1472,14 @@ static int __devinit cx25821_initdev(struct pci_dev *pci_dev, return 0; - fail_irq: - printk(KERN_INFO "cx25821 cx25821_initdev() can't get IRQ ! \n"); +fail_irq: + printk(KERN_INFO "cx25821 cx25821_initdev() can't get IRQ !\n"); cx25821_dev_unregister(dev); - fail_unregister_device: +fail_unregister_device: v4l2_device_unregister(&dev->v4l2_dev); - fail_free: +fail_free: kfree(dev); return err; } @@ -1536,16 +1544,6 @@ static void __exit cx25821_fini(void) pci_unregister_driver(&cx25821_pci_driver); } -EXPORT_SYMBOL(cx25821_devlist); -EXPORT_SYMBOL(cx25821_sram_channels); -EXPORT_SYMBOL(cx25821_print_irqbits); -EXPORT_SYMBOL(cx25821_dev_get); -EXPORT_SYMBOL(cx25821_dev_unregister); -EXPORT_SYMBOL(cx25821_sram_channel_setup); -EXPORT_SYMBOL(cx25821_sram_channel_dump); -EXPORT_SYMBOL(cx25821_sram_channel_setup_audio); -EXPORT_SYMBOL(cx25821_sram_channel_dump_audio); -EXPORT_SYMBOL(cx25821_risc_databuffer_audio); EXPORT_SYMBOL(cx25821_set_gpiopin_direction); module_init(cx25821_init); -- GitLab From 1c614239b6f11692087f9500465803adf710122f Mon Sep 17 00:00:00 2001 From: Olimpiu Pascariu Date: Sun, 21 Mar 2010 14:44:01 -0300 Subject: [PATCH 220/534] V4L/DVB: cx25821: fix coding style issues in cx25821-gpio.c Fixes up warnings and errors found by the checkpatch.pl tool on cx25821-gpio.c. Signed-off-by: Olimpiu Pascariu Cc: Palash Bandyopadhyay Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/cx25821/cx25821-gpio.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-gpio.c b/drivers/staging/cx25821/cx25821-gpio.c index e8a37b47e437..2f154b3658a1 100644 --- a/drivers/staging/cx25821/cx25821-gpio.c +++ b/drivers/staging/cx25821/cx25821-gpio.c @@ -31,7 +31,7 @@ void cx25821_set_gpiopin_direction(struct cx25821_dev *dev, u32 gpio_register = 0; u32 value = 0; - // Check for valid pinNumber + /* Check for valid pinNumber */ if (pin_number >= 47) return; @@ -39,14 +39,14 @@ void cx25821_set_gpiopin_direction(struct cx25821_dev *dev, bit = pin_number - 31; gpio_oe_reg = GPIO_HI_OE; } - // Here we will make sure that the GPIOs 0 and 1 are output. keep the rest as is + /* Here we will make sure that the GPIOs 0 and 1 are output. keep the + * rest as is */ gpio_register = cx_read(gpio_oe_reg); - if (pin_logic_value == 1) { + if (pin_logic_value == 1) value = gpio_register | Set_GPIO_Bit(bit); - } else { + else value = gpio_register & Clear_GPIO_Bit(bit); - } cx_write(gpio_oe_reg, value); } @@ -58,11 +58,12 @@ static void cx25821_set_gpiopin_logicvalue(struct cx25821_dev *dev, u32 gpio_reg = GPIO_LO; u32 value = 0; - // Check for valid pinNumber + /* Check for valid pinNumber */ if (pin_number >= 47) return; - cx25821_set_gpiopin_direction(dev, pin_number, 0); // change to output direction + /* change to output direction */ + cx25821_set_gpiopin_direction(dev, pin_number, 0); if (pin_number > 31) { bit = pin_number - 31; @@ -71,25 +72,23 @@ static void cx25821_set_gpiopin_logicvalue(struct cx25821_dev *dev, value = cx_read(gpio_reg); - if (pin_logic_value == 0) { + if (pin_logic_value == 0) value &= Clear_GPIO_Bit(bit); - } else { + else value |= Set_GPIO_Bit(bit); - } cx_write(gpio_reg, value); } void cx25821_gpio_init(struct cx25821_dev *dev) { - if (dev == NULL) { + if (dev == NULL) return; - } switch (dev->board) { case CX25821_BOARD_CONEXANT_ATHENA10: default: - //set GPIO 5 to select the path for Medusa/Athena + /* set GPIO 5 to select the path for Medusa/Athena */ cx25821_set_gpiopin_logicvalue(dev, 5, 1); mdelay(20); break; -- GitLab From 0dd8be8c94d0f273685092106daf0875d9287da0 Mon Sep 17 00:00:00 2001 From: Olimpiu Pascariu Date: Sun, 21 Mar 2010 15:46:26 -0300 Subject: [PATCH 221/534] V4L/DVB: cx25821: fix coding style issues in cx25821-medusa-video.c Fixes up warnings and errors found by the checkpatch.pl tool on cx25821-medusa-video.c Signed-off-by: Olimpiu Pascariu Acked-by: Dan Carpenter Cc: Palash Bandyopadhyay Signed-off-by: Mauro Carvalho Chehab --- .../staging/cx25821/cx25821-medusa-video.c | 207 +++++++++--------- 1 file changed, 108 insertions(+), 99 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-medusa-video.c b/drivers/staging/cx25821/cx25821-medusa-video.c index d6016200d699..0bb33ba7e99d 100644 --- a/drivers/staging/cx25821/cx25821-medusa-video.c +++ b/drivers/staging/cx25821/cx25821-medusa-video.c @@ -24,11 +24,12 @@ #include "cx25821-medusa-video.h" #include "cx25821-biffuncs.h" -///////////////////////////////////////////////////////////////////////////////////////// -//medusa_enable_bluefield_output() -// -// Enable the generation of blue filed output if no video -// +/* + * medusa_enable_bluefield_output() + * + * Enable the generation of blue filed output if no video + * + */ static void medusa_enable_bluefield_output(struct cx25821_dev *dev, int channel, int enable) { @@ -73,15 +74,15 @@ static void medusa_enable_bluefield_output(struct cx25821_dev *dev, int channel, } value = cx25821_i2c_read(&dev->i2c_bus[0], out_ctrl, &tmp); - value &= 0xFFFFFF7F; // clear BLUE_FIELD_EN + value &= 0xFFFFFF7F; /* clear BLUE_FIELD_EN */ if (enable) - value |= 0x00000080; // set BLUE_FIELD_EN + value |= 0x00000080; /* set BLUE_FIELD_EN */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], out_ctrl, value); value = cx25821_i2c_read(&dev->i2c_bus[0], out_ctrl_ns, &tmp); value &= 0xFFFFFF7F; if (enable) - value |= 0x00000080; // set BLUE_FIELD_EN + value |= 0x00000080; /* set BLUE_FIELD_EN */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], out_ctrl_ns, value); } @@ -95,17 +96,18 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) mutex_lock(&dev->lock); for (i = 0; i < MAX_DECODERS; i++) { - // set video format NTSC-M + /* set video format NTSC-M */ value = cx25821_i2c_read(&dev->i2c_bus[0], MODE_CTRL + (0x200 * i), &tmp); value &= 0xFFFFFFF0; - value |= 0x10001; // enable the fast locking mode bit[16] + /* enable the fast locking mode bit[16] */ + value |= 0x10001; ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MODE_CTRL + (0x200 * i), value); - // resolution NTSC 720x480 + /* resolution NTSC 720x480 */ value = cx25821_i2c_read(&dev->i2c_bus[0], HORIZ_TIM_CTRL + (0x200 * i), &tmp); @@ -119,17 +121,17 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) cx25821_i2c_read(&dev->i2c_bus[0], VERT_TIM_CTRL + (0x200 * i), &tmp); value &= 0x00C00C00; - value |= 0x1C1E001A; // vblank_cnt + 2 to get camera ID + value |= 0x1C1E001A; /* vblank_cnt + 2 to get camera ID */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], VERT_TIM_CTRL + (0x200 * i), value); - // chroma subcarrier step size + /* chroma subcarrier step size */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], SC_STEP_SIZE + (0x200 * i), 0x43E00000); - // enable VIP optional active + /* enable VIP optional active */ value = cx25821_i2c_read(&dev->i2c_bus[0], OUT_CTRL_NS + (0x200 * i), &tmp); @@ -139,7 +141,7 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], OUT_CTRL_NS + (0x200 * i), value); - // enable VIP optional active (VIP_OPT_AL) for direct output. + /* enable VIP optional active (VIP_OPT_AL) for direct output. */ value = cx25821_i2c_read(&dev->i2c_bus[0], OUT_CTRL1 + (0x200 * i), &tmp); @@ -149,19 +151,21 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], OUT_CTRL1 + (0x200 * i), value); - // clear VPRES_VERT_EN bit, fixes the chroma run away problem - // when the input switching rate < 16 fields - // + /* + * clear VPRES_VERT_EN bit, fixes the chroma run away problem + * when the input switching rate < 16 fields + */ value = cx25821_i2c_read(&dev->i2c_bus[0], MISC_TIM_CTRL + (0x200 * i), &tmp); - value = setBitAtPos(value, 14); // disable special play detection + /* disable special play detection */ + value = setBitAtPos(value, 14); value = clearBitAtPos(value, 15); ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MISC_TIM_CTRL + (0x200 * i), value); - // set vbi_gate_en to 0 + /* set vbi_gate_en to 0 */ value = cx25821_i2c_read(&dev->i2c_bus[0], DFE_CTRL1 + (0x200 * i), &tmp); @@ -170,12 +174,12 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], DFE_CTRL1 + (0x200 * i), value); - // Enable the generation of blue field output if no video + /* Enable the generation of blue field output if no video */ medusa_enable_bluefield_output(dev, i, 1); } for (i = 0; i < MAX_ENCODERS; i++) { - // NTSC hclock + /* NTSC hclock */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_A_REG_1 + (0x100 * i), &tmp); @@ -185,7 +189,7 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_1 + (0x100 * i), value); - // burst begin and burst end + /* burst begin and burst end */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_A_REG_2 + (0x100 * i), &tmp); @@ -204,7 +208,7 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_3 + (0x100 * i), value); - // set NTSC vblank, no phase alternation, 7.5 IRE pedestal + /* set NTSC vblank, no phase alternation, 7.5 IRE pedestal */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_A_REG_4 + (0x100 * i), &tmp); @@ -227,17 +231,19 @@ static int medusa_initialize_ntsc(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_6 + (0x100 * i), 0x009A89C1); - // Subcarrier Increment + /* Subcarrier Increment */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_7 + (0x100 * i), 0x21F07C1F); } - //set picture resolutions - ret_val = cx25821_i2c_write(&dev->i2c_bus[0], HSCALE_CTRL, 0x0); //0 - 720 - ret_val = cx25821_i2c_write(&dev->i2c_bus[0], VSCALE_CTRL, 0x0); //0 - 480 + /* set picture resolutions */ + /* 0 - 720 */ + ret_val = cx25821_i2c_write(&dev->i2c_bus[0], HSCALE_CTRL, 0x0); + /* 0 - 480 */ + ret_val = cx25821_i2c_write(&dev->i2c_bus[0], VSCALE_CTRL, 0x0); - // set Bypass input format to NTSC 525 lines + /* set Bypass input format to NTSC 525 lines */ value = cx25821_i2c_read(&dev->i2c_bus[0], BYP_AB_CTRL, &tmp); value |= 0x00080200; ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); @@ -252,7 +258,7 @@ static int medusa_PALCombInit(struct cx25821_dev *dev, int dec) int ret_val = -1; u32 value = 0, tmp = 0; - // Setup for 2D threshold + /* Setup for 2D threshold */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], COMB_2D_HFS_CFG + (0x200 * dec), 0x20002861); @@ -263,7 +269,7 @@ static int medusa_PALCombInit(struct cx25821_dev *dev, int dec) cx25821_i2c_write(&dev->i2c_bus[0], COMB_2D_LF_CFG + (0x200 * dec), 0x200A1023); - // Setup flat chroma and luma thresholds + /* Setup flat chroma and luma thresholds */ value = cx25821_i2c_read(&dev->i2c_bus[0], COMB_FLAT_THRESH_CTRL + (0x200 * dec), &tmp); @@ -272,12 +278,12 @@ static int medusa_PALCombInit(struct cx25821_dev *dev, int dec) cx25821_i2c_write(&dev->i2c_bus[0], COMB_FLAT_THRESH_CTRL + (0x200 * dec), value); - // set comb 2D blend + /* set comb 2D blend */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], COMB_2D_BLEND + (0x200 * dec), 0x210F0F0F); - // COMB MISC CONTROL + /* COMB MISC CONTROL */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], COMB_MISC_CTRL + (0x200 * dec), 0x41120A7F); @@ -295,17 +301,18 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) mutex_lock(&dev->lock); for (i = 0; i < MAX_DECODERS; i++) { - // set video format PAL-BDGHI + /* set video format PAL-BDGHI */ value = cx25821_i2c_read(&dev->i2c_bus[0], MODE_CTRL + (0x200 * i), &tmp); value &= 0xFFFFFFF0; - value |= 0x10004; // enable the fast locking mode bit[16] + /* enable the fast locking mode bit[16] */ + value |= 0x10004; ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MODE_CTRL + (0x200 * i), value); - // resolution PAL 720x576 + /* resolution PAL 720x576 */ value = cx25821_i2c_read(&dev->i2c_bus[0], HORIZ_TIM_CTRL + (0x200 * i), &tmp); @@ -315,22 +322,22 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], HORIZ_TIM_CTRL + (0x200 * i), value); - // vblank656_cnt=x26, vactive_cnt=240h, vblank_cnt=x24 + /* vblank656_cnt=x26, vactive_cnt=240h, vblank_cnt=x24 */ value = cx25821_i2c_read(&dev->i2c_bus[0], VERT_TIM_CTRL + (0x200 * i), &tmp); value &= 0x00C00C00; - value |= 0x28240026; // vblank_cnt + 2 to get camera ID + value |= 0x28240026; /* vblank_cnt + 2 to get camera ID */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], VERT_TIM_CTRL + (0x200 * i), value); - // chroma subcarrier step size + /* chroma subcarrier step size */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], SC_STEP_SIZE + (0x200 * i), 0x5411E2D0); - // enable VIP optional active + /* enable VIP optional active */ value = cx25821_i2c_read(&dev->i2c_bus[0], OUT_CTRL_NS + (0x200 * i), &tmp); @@ -340,7 +347,7 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], OUT_CTRL_NS + (0x200 * i), value); - // enable VIP optional active (VIP_OPT_AL) for direct output. + /* enable VIP optional active (VIP_OPT_AL) for direct output. */ value = cx25821_i2c_read(&dev->i2c_bus[0], OUT_CTRL1 + (0x200 * i), &tmp); @@ -350,18 +357,21 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], OUT_CTRL1 + (0x200 * i), value); - // clear VPRES_VERT_EN bit, fixes the chroma run away problem - // when the input switching rate < 16 fields + /* + * clear VPRES_VERT_EN bit, fixes the chroma run away problem + * when the input switching rate < 16 fields + */ value = cx25821_i2c_read(&dev->i2c_bus[0], MISC_TIM_CTRL + (0x200 * i), &tmp); - value = setBitAtPos(value, 14); // disable special play detection + /* disable special play detection */ + value = setBitAtPos(value, 14); value = clearBitAtPos(value, 15); ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MISC_TIM_CTRL + (0x200 * i), value); - // set vbi_gate_en to 0 + /* set vbi_gate_en to 0 */ value = cx25821_i2c_read(&dev->i2c_bus[0], DFE_CTRL1 + (0x200 * i), &tmp); @@ -372,12 +382,12 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) medusa_PALCombInit(dev, i); - // Enable the generation of blue field output if no video + /* Enable the generation of blue field output if no video */ medusa_enable_bluefield_output(dev, i, 1); } for (i = 0; i < MAX_ENCODERS; i++) { - // PAL hclock + /* PAL hclock */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_A_REG_1 + (0x100 * i), &tmp); @@ -387,7 +397,7 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_1 + (0x100 * i), value); - // burst begin and burst end + /* burst begin and burst end */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_A_REG_2 + (0x100 * i), &tmp); @@ -397,7 +407,7 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_2 + (0x100 * i), value); - // hblank and vactive + /* hblank and vactive */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_A_REG_3 + (0x100 * i), &tmp); @@ -407,7 +417,7 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_3 + (0x100 * i), value); - // set PAL vblank, phase alternation, 0 IRE pedestal + /* set PAL vblank, phase alternation, 0 IRE pedestal */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_A_REG_4 + (0x100 * i), &tmp); @@ -430,17 +440,19 @@ static int medusa_initialize_pal(struct cx25821_dev *dev) cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_6 + (0x100 * i), 0x00A493CF); - // Subcarrier Increment + /* Subcarrier Increment */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_7 + (0x100 * i), 0x2A098ACB); } - //set picture resolutions - ret_val = cx25821_i2c_write(&dev->i2c_bus[0], HSCALE_CTRL, 0x0); //0 - 720 - ret_val = cx25821_i2c_write(&dev->i2c_bus[0], VSCALE_CTRL, 0x0); //0 - 576 + /* set picture resolutions */ + /* 0 - 720 */ + ret_val = cx25821_i2c_write(&dev->i2c_bus[0], HSCALE_CTRL, 0x0); + /* 0 - 576 */ + ret_val = cx25821_i2c_write(&dev->i2c_bus[0], VSCALE_CTRL, 0x0); - // set Bypass input format to PAL 625 lines + /* set Bypass input format to PAL 625 lines */ value = cx25821_i2c_read(&dev->i2c_bus[0], BYP_AB_CTRL, &tmp); value &= 0xFFF7FDFF; ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); @@ -455,18 +467,17 @@ int medusa_set_videostandard(struct cx25821_dev *dev) int status = STATUS_SUCCESS; u32 value = 0, tmp = 0; - if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK) { + if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK) status = medusa_initialize_pal(dev); - } else { + else status = medusa_initialize_ntsc(dev); - } - // Enable DENC_A output + /* Enable DENC_A output */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_A_REG_4, &tmp); value = setBitAtPos(value, 4); status = cx25821_i2c_write(&dev->i2c_bus[0], DENC_A_REG_4, value); - // Enable DENC_B output + /* Enable DENC_B output */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_B_REG_4, &tmp); value = setBitAtPos(value, 4); status = cx25821_i2c_write(&dev->i2c_bus[0], DENC_B_REG_4, value); @@ -486,10 +497,10 @@ void medusa_set_resolution(struct cx25821_dev *dev, int width, mutex_lock(&dev->lock); - // validate the width - cannot be negative + /* validate the width - cannot be negative */ if (width > MAX_WIDTH) { printk - ("cx25821 %s() : width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH \n", + ("cx25821 %s() : width %d > MAX_WIDTH %d ! resetting to MAX_WIDTH\n", __func__, width, MAX_WIDTH); width = MAX_WIDTH; } @@ -523,14 +534,14 @@ void medusa_set_resolution(struct cx25821_dev *dev, int width, vscale = 0x1E00; break; - default: //720 + default: /* 720 */ hscale = 0x0; vscale = 0x0; break; } for (; decoder < decoder_count; decoder++) { - // write scaling values for each decoder + /* write scaling values for each decoder */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], HSCALE_CTRL + (0x200 * decoder), hscale); @@ -552,7 +563,7 @@ static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder, mutex_lock(&dev->lock); - // no support + /* no support */ if (decoder < VDEC_A && decoder > VDEC_H) { mutex_unlock(&dev->lock); return; @@ -577,11 +588,10 @@ static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder, _display_field_cnt[decoder] = duration; - // update hardware + /* update hardware */ fld_cnt = cx25821_i2c_read(&dev->i2c_bus[0], disp_cnt_reg, &tmp); - if (!(decoder % 2)) // EVEN decoder - { + if (!(decoder % 2)) { /* EVEN decoder */ fld_cnt &= 0xFFFF0000; fld_cnt |= duration; } else { @@ -594,8 +604,7 @@ static void medusa_set_decoderduration(struct cx25821_dev *dev, int decoder, mutex_unlock(&dev->lock); } -///////////////////////////////////////////////////////////////////////////////////////// -// Map to Medusa register setting +/* Map to Medusa register setting */ static int mapM(int srcMin, int srcMax, int srcVal, int dstMin, int dstMax, int *dstVal) { @@ -603,20 +612,21 @@ static int mapM(int srcMin, int denominator; int quotient; - if ((srcMin == srcMax) || (srcVal < srcMin) || (srcVal > srcMax)) { + if ((srcMin == srcMax) || (srcVal < srcMin) || (srcVal > srcMax)) return -1; - } - // This is the overall expression used: - // *dstVal = (srcVal - srcMin)*(dstMax - dstMin) / (srcMax - srcMin) + dstMin; - // but we need to account for rounding so below we use the modulus - // operator to find the remainder and increment if necessary. + /* + * This is the overall expression used: + * *dstVal = + * (srcVal - srcMin)*(dstMax - dstMin) / (srcMax - srcMin) + dstMin; + * but we need to account for rounding so below we use the modulus + * operator to find the remainder and increment if necessary. + */ numerator = (srcVal - srcMin) * (dstMax - dstMin); denominator = srcMax - srcMin; quotient = numerator / denominator; - if (2 * (numerator % denominator) >= denominator) { + if (2 * (numerator % denominator) >= denominator) quotient++; - } *dstVal = quotient + dstMin; @@ -636,7 +646,6 @@ static unsigned long convert_to_twos(long numeric, unsigned long bits_len) } } -///////////////////////////////////////////////////////////////////////////////////////// int medusa_set_brightness(struct cx25821_dev *dev, int brightness, int decoder) { int ret_val = 0; @@ -665,7 +674,6 @@ int medusa_set_brightness(struct cx25821_dev *dev, int brightness, int decoder) return ret_val; } -///////////////////////////////////////////////////////////////////////////////////////// int medusa_set_contrast(struct cx25821_dev *dev, int contrast, int decoder) { int ret_val = 0; @@ -695,7 +703,6 @@ int medusa_set_contrast(struct cx25821_dev *dev, int contrast, int decoder) return ret_val; } -///////////////////////////////////////////////////////////////////////////////////////// int medusa_set_hue(struct cx25821_dev *dev, int hue, int decoder) { int ret_val = 0; @@ -727,7 +734,6 @@ int medusa_set_hue(struct cx25821_dev *dev, int hue, int decoder) return ret_val; } -///////////////////////////////////////////////////////////////////////////////////////// int medusa_set_saturation(struct cx25821_dev *dev, int saturation, int decoder) { int ret_val = 0; @@ -768,9 +774,8 @@ int medusa_set_saturation(struct cx25821_dev *dev, int saturation, int decoder) return ret_val; } -///////////////////////////////////////////////////////////////////////////////////////// -// Program the display sequence and monitor output. -// +/* Program the display sequence and monitor output. */ + int medusa_video_init(struct cx25821_dev *dev) { u32 value = 0, tmp = 0; @@ -781,7 +786,7 @@ int medusa_video_init(struct cx25821_dev *dev) _num_decoders = dev->_max_num_decoders; - // disable Auto source selection on all video decoders + /* disable Auto source selection on all video decoders */ value = cx25821_i2c_read(&dev->i2c_bus[0], MON_A_CTRL, &tmp); value &= 0xFFFFF0FF; ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MON_A_CTRL, value); @@ -790,7 +795,7 @@ int medusa_video_init(struct cx25821_dev *dev) mutex_unlock(&dev->lock); return -EINVAL; } - // Turn off Master source switch enable + /* Turn off Master source switch enable */ value = cx25821_i2c_read(&dev->i2c_bus[0], MON_A_CTRL, &tmp); value &= 0xFFFFFFDF; ret_val = cx25821_i2c_write(&dev->i2c_bus[0], MON_A_CTRL, value); @@ -800,32 +805,31 @@ int medusa_video_init(struct cx25821_dev *dev) mutex_unlock(&dev->lock); - for (i = 0; i < _num_decoders; i++) { + for (i = 0; i < _num_decoders; i++) medusa_set_decoderduration(dev, i, _display_field_cnt[i]); - } mutex_lock(&dev->lock); - // Select monitor as DENC A input, power up the DAC + /* Select monitor as DENC A input, power up the DAC */ value = cx25821_i2c_read(&dev->i2c_bus[0], DENC_AB_CTRL, &tmp); value &= 0xFF70FF70; - value |= 0x00090008; // set en_active + value |= 0x00090008; /* set en_active */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], DENC_AB_CTRL, value); if (ret_val < 0) { mutex_unlock(&dev->lock); return -EINVAL; } - // enable input is VIP/656 + /* enable input is VIP/656 */ value = cx25821_i2c_read(&dev->i2c_bus[0], BYP_AB_CTRL, &tmp); - value |= 0x00040100; // enable VIP + value |= 0x00040100; /* enable VIP */ ret_val = cx25821_i2c_write(&dev->i2c_bus[0], BYP_AB_CTRL, value); if (ret_val < 0) { mutex_unlock(&dev->lock); return -EINVAL; } - // select AFE clock to output mode + /* select AFE clock to output mode */ value = cx25821_i2c_read(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, &tmp); value &= 0x83FFFFFF; ret_val = @@ -836,15 +840,20 @@ int medusa_video_init(struct cx25821_dev *dev) mutex_unlock(&dev->lock); return -EINVAL; } - // Turn on all of the data out and control output pins. + /* Turn on all of the data out and control output pins. */ value = cx25821_i2c_read(&dev->i2c_bus[0], PIN_OE_CTRL, &tmp); value &= 0xFEF0FE00; if (_num_decoders == MAX_DECODERS) { - // Note: The octal board does not support control pins(bit16-19). - // These bits are ignored in the octal board. - value |= 0x010001F8; // disable VDEC A-C port, default to Mobilygen Interface + /* + * Note: The octal board does not support control pins(bit16-19) + * These bits are ignored in the octal board. + * + * disable VDEC A-C port, default to Mobilygen Interface + */ + value |= 0x010001F8; } else { - value |= 0x010F0108; // disable VDEC A-C port, default to Mobilygen Interface + /* disable VDEC A-C port, default to Mobilygen Interface */ + value |= 0x010F0108; } value |= 7; -- GitLab From 51e9dd3249eba4654f12a9473b8bfb5ddbf00d00 Mon Sep 17 00:00:00 2001 From: Olimpiu Pascariu Date: Sun, 21 Mar 2010 14:52:31 -0300 Subject: [PATCH 222/534] V4L/DVB: cx25821: fix coding style issues in cx25821-i2c.c Fixes up warnings and errors found by the checkpatch.pl tool on cx25821-i2c.c Signed-off-by: Olimpiu Pascariu Cc: Palash Bandyopadhyay Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/cx25821/cx25821-i2c.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-i2c.c b/drivers/staging/cx25821/cx25821-i2c.c index f4f2681d8f1c..f727b85743ac 100644 --- a/drivers/staging/cx25821/cx25821-i2c.c +++ b/drivers/staging/cx25821/cx25821-i2c.c @@ -159,9 +159,9 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, return msg->len; - eio: +eio: retval = -EIO; - err: +err: if (i2c_debug) printk(KERN_ERR " ERR: %d\n", retval); return retval; @@ -223,9 +223,9 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, } return msg->len; - eio: +eio: retval = -EIO; - err: +err: if (i2c_debug) printk(KERN_ERR " ERR: %d\n", retval); return retval; @@ -266,7 +266,7 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) } return num; - err: +err: return retval; } @@ -319,7 +319,7 @@ int cx25821_i2c_register(struct cx25821_i2c *bus) bus->i2c_client.adapter = &bus->i2c_adap; - //set up the I2c + /* set up the I2c */ bus->i2c_client.addr = (0x88 >> 1); return bus->i2c_rc; -- GitLab From d7d93387421b52f8c9240ce82b368ad34bb40cd8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Mar 2010 14:23:25 -0300 Subject: [PATCH 223/534] V4L/DVB: cx25821-video.c: fix table indent Table indent were likely damaged by Lindent. Fix it. Signed-off-by: Mauro Carvalho Chehab Cc: Palash Bandyopadhyay --- drivers/staging/cx25821/cx25821-video.c | 48 ++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c index 8cd3986d2e5c..e3dff2eccfff 100644 --- a/drivers/staging/cx25821/cx25821-video.c +++ b/drivers/staging/cx25821/cx25821-video.c @@ -54,31 +54,31 @@ static void init_controls(struct cx25821_dev *dev, int chan_num); struct cx25821_fmt formats[] = { { - .name = "8 bpp, gray", - .fourcc = V4L2_PIX_FMT_GREY, - .depth = 8, - .flags = FORMAT_FLAGS_PACKED, + .name = "8 bpp, gray", + .fourcc = V4L2_PIX_FMT_GREY, + .depth = 8, + .flags = FORMAT_FLAGS_PACKED, }, { - .name = "4:1:1, packed, Y41P", - .fourcc = V4L2_PIX_FMT_Y41P, - .depth = 12, - .flags = FORMAT_FLAGS_PACKED, - }, { - .name = "4:2:2, packed, YUYV", - .fourcc = V4L2_PIX_FMT_YUYV, - .depth = 16, - .flags = FORMAT_FLAGS_PACKED, - }, { - .name = "4:2:2, packed, UYVY", - .fourcc = V4L2_PIX_FMT_UYVY, - .depth = 16, - .flags = FORMAT_FLAGS_PACKED, - }, { - .name = "4:2:0, YUV", - .fourcc = V4L2_PIX_FMT_YUV420, - .depth = 12, - .flags = FORMAT_FLAGS_PACKED, - }, + .name = "4:1:1, packed, Y41P", + .fourcc = V4L2_PIX_FMT_Y41P, + .depth = 12, + .flags = FORMAT_FLAGS_PACKED, + }, { + .name = "4:2:2, packed, YUYV", + .fourcc = V4L2_PIX_FMT_YUYV, + .depth = 16, + .flags = FORMAT_FLAGS_PACKED, + }, { + .name = "4:2:2, packed, UYVY", + .fourcc = V4L2_PIX_FMT_UYVY, + .depth = 16, + .flags = FORMAT_FLAGS_PACKED, + }, { + .name = "4:2:0, YUV", + .fourcc = V4L2_PIX_FMT_YUV420, + .depth = 12, + .flags = FORMAT_FLAGS_PACKED, + }, }; int get_format_size(void) -- GitLab From f2466d63a51db8244d3e78a4e6210d72a8930cfb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Mar 2010 16:33:40 -0300 Subject: [PATCH 224/534] V4L/DVB: cx25821: prepend cx25821_ to video exported symbols As reported by Randy Dunlap : drivers/staging/cx25821/cx25821-video.c:89:struct cx25821_fmt *format_by_fourcc(unsigned int fourcc) (not static) conflicts with (has the same non-static name as) drivers/media/common/saa7146_video.c:87:struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc) To solve, add cx25821_ prefix to the exported functions found on cx25821-video.h. This patch were generated by this little shell/perl script: cat drivers/staging/cx25821/cx25821-video.h|perl -ne \ 'if (m/extern.* ([^\s\*]+)\(/) { $n=$1; print "s/([^\d\w_\.])$1/\\1cx25821_$1/g;\n" if (!($n =~ m/cx25821/)); }' \ >changes; for i in drivers/staging/cx25821/*.[ch]; do sed -r -f changes $i >a && mv a $i; done Signed-off-by: Mauro Carvalho Chehab Cc: Palash Bandyopadhyay --- drivers/staging/cx25821/cx25821-audups11.c | 78 +++++++++---------- drivers/staging/cx25821/cx25821-core.c | 4 +- drivers/staging/cx25821/cx25821-video.c | 82 ++++++++++---------- drivers/staging/cx25821/cx25821-video.h | 78 +++++++++---------- drivers/staging/cx25821/cx25821-video0.c | 82 ++++++++++---------- drivers/staging/cx25821/cx25821-video1.c | 82 ++++++++++---------- drivers/staging/cx25821/cx25821-video2.c | 82 ++++++++++---------- drivers/staging/cx25821/cx25821-video3.c | 82 ++++++++++---------- drivers/staging/cx25821/cx25821-video4.c | 82 ++++++++++---------- drivers/staging/cx25821/cx25821-video5.c | 82 ++++++++++---------- drivers/staging/cx25821/cx25821-video6.c | 82 ++++++++++---------- drivers/staging/cx25821/cx25821-video7.c | 82 ++++++++++---------- drivers/staging/cx25821/cx25821-videoioctl.c | 78 +++++++++---------- drivers/staging/cx25821/cx25821-vidups10.c | 78 +++++++++---------- drivers/staging/cx25821/cx25821-vidups9.c | 78 +++++++++---------- 15 files changed, 566 insertions(+), 566 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-audups11.c b/drivers/staging/cx25821/cx25821-audups11.c index e76451c309f1..9193a6eb7cf2 100644 --- a/drivers/staging/cx25821/cx25821-audups11.c +++ b/drivers/staging/cx25821/cx25821-audups11.c @@ -88,10 +88,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -145,7 +145,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO11)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO11)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -163,7 +163,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO11)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO11)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -191,13 +191,13 @@ static int video_release(struct file *file) //cx_write(channel11->dma_ctl, 0); /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO11)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO11)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO11); + cx25821_res_free(dev, fh, RESOURCE_VIDEO11); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -224,7 +224,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO11)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO11)))) { return -EBUSY; } @@ -242,11 +242,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO11); + res = cx25821_get_resource(fh, RESOURCE_VIDEO11); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -264,7 +264,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -364,50 +364,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl_upstream11, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c index 90090f4b5e76..d90abb383fc8 100644 --- a/drivers/staging/cx25821/cx25821-core.c +++ b/drivers/staging/cx25821/cx25821-core.c @@ -864,7 +864,7 @@ static void cx25821_initialize(struct cx25821_dev *dev) cx25821_gpio_init(dev); } -static int get_resources(struct cx25821_dev *dev) +static int cx25821_get_resources(struct cx25821_dev *dev) { if (request_mem_region (pci_resource_start(dev->pci, 0), pci_resource_len(dev->pci, 0), @@ -971,7 +971,7 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) dev->i2c_bus[0].i2c_period = (0x07 << 24); /* 1.95MHz */ - if (get_resources(dev) < 0) { + if (cx25821_get_resources(dev) < 0) { printk(KERN_ERR "%s No more PCIe resources for " "subsystem: %04x:%04x\n", dev->name, dev->pci->subsystem_vendor, diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c index e3dff2eccfff..91e0db2e37f9 100644 --- a/drivers/staging/cx25821/cx25821-video.c +++ b/drivers/staging/cx25821/cx25821-video.c @@ -81,7 +81,7 @@ struct cx25821_fmt formats[] = { }, }; -int get_format_size(void) +int cx25821_get_format_size(void) { return ARRAY_SIZE(formats); } @@ -102,7 +102,7 @@ struct cx25821_fmt *format_by_fourcc(unsigned int fourcc) return NULL; } -void dump_video_queue(struct cx25821_dev *dev, struct cx25821_dmaqueue *q) +void cx25821_dump_video_queue(struct cx25821_dev *dev, struct cx25821_dmaqueue *q) { struct cx25821_buffer *buf; struct list_head *item; @@ -212,7 +212,7 @@ static int cx25821_ctrl_query(struct v4l2_queryctrl *qctrl) */ // resource management -int res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bit) +int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bit) { dprintk(1, "%s()\n", __func__); if (fh->resources & bit) @@ -234,17 +234,17 @@ int res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bit) return 1; } -int res_check(struct cx25821_fh *fh, unsigned int bit) +int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit) { return fh->resources & bit; } -int res_locked(struct cx25821_dev *dev, unsigned int bit) +int cx25821_res_locked(struct cx25821_dev *dev, unsigned int bit) { return dev->resources & bit; } -void res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bits) +void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bits) { BUG_ON((fh->resources & bits) != bits); dprintk(1, "%s()\n", __func__); @@ -506,7 +506,7 @@ int cx25821_video_register(struct cx25821_dev *dev, int chan_num, return err; } -int buffer_setup(struct videobuf_queue *q, unsigned int *count, +int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) { struct cx25821_fh *fh = q->priv_data; @@ -522,7 +522,7 @@ int buffer_setup(struct videobuf_queue *q, unsigned int *count, return 0; } -int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, +int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field) { struct cx25821_fh *fh = q->priv_data; @@ -648,7 +648,7 @@ int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, return rc; } -void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) +void cx25821_buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { struct cx25821_buffer *buf = container_of(vb, struct cx25821_buffer, vb); @@ -667,7 +667,7 @@ struct videobuf_queue *get_queue(struct cx25821_fh *fh) } } -int get_resource(struct cx25821_fh *fh, int resource) +int cx25821_get_resource(struct cx25821_fh *fh, int resource) { switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: @@ -678,7 +678,7 @@ int get_resource(struct cx25821_fh *fh, int resource) } } -int video_mmap(struct file *file, struct vm_area_struct *vma) +int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma) { struct cx25821_fh *fh = file->private_data; @@ -686,7 +686,7 @@ int video_mmap(struct file *file, struct vm_area_struct *vma) } /* VIDEO IOCTLS */ -int vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) +int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct cx25821_fh *fh = priv; @@ -700,7 +700,7 @@ int vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) return 0; } -int vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) +int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct cx25821_fmt *fmt; enum v4l2_field field; @@ -746,7 +746,7 @@ int vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) return 0; } -int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) +int cx25821_vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; @@ -761,7 +761,7 @@ int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) return 0; } -int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, +int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { if (unlikely(f->index >= ARRAY_SIZE(formats))) @@ -774,7 +774,7 @@ int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, } #ifdef CONFIG_VIDEO_V4L1_COMPAT -int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) +int cx25821_vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) { struct cx25821_fh *fh = priv; struct videobuf_queue *q; @@ -801,25 +801,25 @@ int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) } #endif -int vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) +int cx25821_vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) { struct cx25821_fh *fh = priv; return videobuf_reqbufs(get_queue(fh), p); } -int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *p) +int cx25821_vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *p) { struct cx25821_fh *fh = priv; return videobuf_querybuf(get_queue(fh), p); } -int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p) +int cx25821_vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p) { struct cx25821_fh *fh = priv; return videobuf_qbuf(get_queue(fh), p); } -int vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p) +int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p) { struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev; @@ -828,7 +828,7 @@ int vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p) return 0; } -int vidioc_s_priority(struct file *file, void *f, enum v4l2_priority prio) +int cx25821_vidioc_s_priority(struct file *file, void *f, enum v4l2_priority prio) { struct cx25821_fh *fh = f; struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev; @@ -837,7 +837,7 @@ int vidioc_s_priority(struct file *file, void *f, enum v4l2_priority prio) } #ifdef TUNER_FLAG -int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms) +int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms) { struct cx25821_fh *fh = priv; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; @@ -891,14 +891,14 @@ int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i) return 0; } -int vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *i) +int cx25821_vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *i) { struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; dprintk(1, "%s()\n", __func__); return cx25821_enum_input(dev, i); } -int vidioc_g_input(struct file *file, void *priv, unsigned int *i) +int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i) { struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; @@ -907,7 +907,7 @@ int vidioc_g_input(struct file *file, void *priv, unsigned int *i) return 0; } -int vidioc_s_input(struct file *file, void *priv, unsigned int i) +int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) { struct cx25821_fh *fh = priv; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; @@ -933,7 +933,7 @@ int vidioc_s_input(struct file *file, void *priv, unsigned int i) } #ifdef TUNER_FLAG -int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) +int cx25821_vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { struct cx25821_fh *fh = priv; struct cx25821_dev *dev = fh->dev; @@ -960,7 +960,7 @@ int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f) return 0; } -int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) +int cx25821_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { struct cx25821_fh *fh = priv; struct cx25821_dev *dev; @@ -978,7 +978,7 @@ int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) #endif #ifdef CONFIG_VIDEO_ADV_DEBUG -int vidioc_g_register(struct file *file, void *fh, +int cx25821_vidioc_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) { struct cx25821_dev *dev = ((struct cx25821_fh *)fh)->dev; @@ -991,7 +991,7 @@ int vidioc_g_register(struct file *file, void *fh, return 0; } -int vidioc_s_register(struct file *file, void *fh, +int cx25821_vidioc_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) { struct cx25821_dev *dev = ((struct cx25821_fh *)fh)->dev; @@ -1007,7 +1007,7 @@ int vidioc_s_register(struct file *file, void *fh, #endif #ifdef TUNER_FLAG -int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) +int cx25821_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) { struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; @@ -1025,7 +1025,7 @@ int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) return 0; } -int vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t) +int cx25821_vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t) { struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_fh *fh = priv; @@ -1108,7 +1108,7 @@ static int cx25821_ctrl_query(struct v4l2_queryctrl *qctrl) return 0; } -int vidioc_queryctrl(struct file *file, void *priv, +int cx25821_vidioc_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *qctrl) { return cx25821_ctrl_query(qctrl); @@ -1127,7 +1127,7 @@ static const struct v4l2_queryctrl *ctrl_by_id(unsigned int id) return NULL; } -int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctl) +int cx25821_vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctl) { struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; @@ -1216,7 +1216,7 @@ static void init_controls(struct cx25821_dev *dev, int chan_num) } } -int vidioc_cropcap(struct file *file, void *priv, struct v4l2_cropcap *cropcap) +int cx25821_vidioc_cropcap(struct file *file, void *priv, struct v4l2_cropcap *cropcap) { struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; @@ -1233,7 +1233,7 @@ int vidioc_cropcap(struct file *file, void *priv, struct v4l2_cropcap *cropcap) return 0; } -int vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) +int cx25821_vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) { struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_fh *fh = priv; @@ -1244,17 +1244,17 @@ int vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) if (0 != err) return err; } - // vidioc_s_crop not supported + // cx25821_vidioc_s_crop not supported return -EINVAL; } -int vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop) +int cx25821_vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop) { - // vidioc_g_crop not supported + // cx25821_vidioc_g_crop not supported return -EINVAL; } -int vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm) +int cx25821_vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm) { // medusa does not support video standard sensing of current input *norm = CX25821_NORMS; @@ -1262,7 +1262,7 @@ int vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm) return 0; } -int is_valid_width(u32 width, v4l2_std_id tvnorm) +int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm) { if (tvnorm == V4L2_STD_PAL_BG) { if (width == 352 || width == 720) @@ -1280,7 +1280,7 @@ int is_valid_width(u32 width, v4l2_std_id tvnorm) return 0; } -int is_valid_height(u32 height, v4l2_std_id tvnorm) +int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm) { if (tvnorm == V4L2_STD_PAL_BG) { if (height == 576 || height == 288) diff --git a/drivers/staging/cx25821/cx25821-video.h b/drivers/staging/cx25821/cx25821-video.h index 4417ff5d90d4..0bddc02be57d 100644 --- a/drivers/staging/cx25821/cx25821-video.h +++ b/drivers/staging/cx25821/cx25821-video.h @@ -101,7 +101,7 @@ extern struct cx25821_fmt formats[]; extern struct cx25821_fmt *format_by_fourcc(unsigned int fourcc); extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; -extern void dump_video_queue(struct cx25821_dev *dev, +extern void cx25821_dump_video_queue(struct cx25821_dev *dev, struct cx25821_dmaqueue *q); extern void cx25821_video_wakeup(struct cx25821_dev *dev, struct cx25821_dmaqueue *q, u32 count); @@ -110,11 +110,11 @@ extern void cx25821_video_wakeup(struct cx25821_dev *dev, extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm); #endif -extern int res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, +extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bit); -extern int res_check(struct cx25821_fh *fh, unsigned int bit); -extern int res_locked(struct cx25821_dev *dev, unsigned int bit); -extern void res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, +extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit); +extern int cx25821_res_locked(struct cx25821_dev *dev, unsigned int bit); +extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bits); extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input); extern int cx25821_start_video_dma(struct cx25821_dev *dev, @@ -128,67 +128,67 @@ extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status); extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num); extern int cx25821_video_register(struct cx25821_dev *dev, int chan_num, struct video_device *video_template); -extern int get_format_size(void); +extern int cx25821_get_format_size(void); -extern int buffer_setup(struct videobuf_queue *q, unsigned int *count, +extern int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size); -extern int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, +extern int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field); -extern void buffer_release(struct videobuf_queue *q, +extern void cx25821_buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb); extern struct videobuf_queue *get_queue(struct cx25821_fh *fh); -extern int get_resource(struct cx25821_fh *fh, int resource); -extern int video_mmap(struct file *file, struct vm_area_struct *vma); -extern int vidioc_try_fmt_vid_cap(struct file *file, void *priv, +extern int cx25821_get_resource(struct cx25821_fh *fh, int resource); +extern int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma); +extern int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f); -extern int vidioc_querycap(struct file *file, void *priv, +extern int cx25821_vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap); -extern int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, +extern int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f); -extern int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf); -extern int vidioc_reqbufs(struct file *file, void *priv, +extern int cx25821_vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf); +extern int cx25821_vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p); -extern int vidioc_querybuf(struct file *file, void *priv, +extern int cx25821_vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *p); -extern int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p); -extern int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms); +extern int cx25821_vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p); +extern int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms); extern int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i); -extern int vidioc_enum_input(struct file *file, void *priv, +extern int cx25821_vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *i); -extern int vidioc_g_input(struct file *file, void *priv, unsigned int *i); -extern int vidioc_s_input(struct file *file, void *priv, unsigned int i); -extern int vidioc_g_ctrl(struct file *file, void *priv, +extern int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i); +extern int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i); +extern int cx25821_vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctl); -extern int vidioc_g_fmt_vid_cap(struct file *file, void *priv, +extern int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f); -extern int vidioc_g_frequency(struct file *file, void *priv, +extern int cx25821_vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f); extern int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f); -extern int vidioc_s_frequency(struct file *file, void *priv, +extern int cx25821_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f); -extern int vidioc_g_register(struct file *file, void *fh, +extern int cx25821_vidioc_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg); -extern int vidioc_s_register(struct file *file, void *fh, +extern int cx25821_vidioc_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg); -extern int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t); -extern int vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t); +extern int cx25821_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t); +extern int cx25821_vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t); -extern int is_valid_width(u32 width, v4l2_std_id tvnorm); -extern int is_valid_height(u32 height, v4l2_std_id tvnorm); +extern int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm); +extern int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm); -extern int vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p); -extern int vidioc_s_priority(struct file *file, void *f, +extern int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p); +extern int cx25821_vidioc_s_priority(struct file *file, void *f, enum v4l2_priority prio); -extern int vidioc_queryctrl(struct file *file, void *priv, +extern int cx25821_vidioc_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *qctrl); extern int cx25821_set_control(struct cx25821_dev *dev, struct v4l2_control *ctrl, int chan_num); -extern int vidioc_cropcap(struct file *file, void *fh, +extern int cx25821_vidioc_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropcap); -extern int vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop); -extern int vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop); +extern int cx25821_vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop); +extern int cx25821_vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop); -extern int vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm); +extern int cx25821_vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm); #endif diff --git a/drivers/staging/cx25821/cx25821-video0.c b/drivers/staging/cx25821/cx25821-video0.c index ad7a69129118..1f95ddba8499 100644 --- a/drivers/staging/cx25821/cx25821-video0.c +++ b/drivers/staging/cx25821/cx25821-video0.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO0)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO0)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO0)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO0)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -207,13 +207,13 @@ static int video_release(struct file *file) cx_write(channel0->dma_ctl, 0); /* FIFO and RISC disable */ /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO0)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO0)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO0); + cx25821_res_free(dev, fh, RESOURCE_VIDEO0); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO0)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO0)))) { return -EBUSY; } @@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO0); + res = cx25821_get_resource(fh, RESOURCE_VIDEO0); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, fh->vidq.field = f->fmt.pix.field; // check if width and height is valid based on set standard - if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { + if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) { fh->width = f->fmt.pix.width; } - if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { + if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) { fh->height = f->fmt.pix.height; } @@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-video1.c b/drivers/staging/cx25821/cx25821-video1.c index e3f3c4ac7908..9b94462a62cf 100644 --- a/drivers/staging/cx25821/cx25821-video1.c +++ b/drivers/staging/cx25821/cx25821-video1.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO1)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO1)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO1)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO1)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -207,13 +207,13 @@ static int video_release(struct file *file) cx_write(channel1->dma_ctl, 0); /* FIFO and RISC disable */ /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO1)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO1)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO1); + cx25821_res_free(dev, fh, RESOURCE_VIDEO1); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO1)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO1)))) { return -EBUSY; } @@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO1); + res = cx25821_get_resource(fh, RESOURCE_VIDEO1); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, fh->vidq.field = f->fmt.pix.field; // check if width and height is valid based on set standard - if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { + if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) { fh->width = f->fmt.pix.width; } - if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { + if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) { fh->height = f->fmt.pix.height; } @@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-video2.c b/drivers/staging/cx25821/cx25821-video2.c index 36fb855a497e..31c46aa2e563 100644 --- a/drivers/staging/cx25821/cx25821-video2.c +++ b/drivers/staging/cx25821/cx25821-video2.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO2)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO2)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO2)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO2)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -207,13 +207,13 @@ static int video_release(struct file *file) cx_write(channel2->dma_ctl, 0); /* FIFO and RISC disable */ /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO2)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO2)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO2); + cx25821_res_free(dev, fh, RESOURCE_VIDEO2); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO2)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO2)))) { return -EBUSY; } @@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO2); + res = cx25821_get_resource(fh, RESOURCE_VIDEO2); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, fh->vidq.field = f->fmt.pix.field; // check if width and height is valid based on set standard - if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { + if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) { fh->width = f->fmt.pix.width; } - if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { + if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) { fh->height = f->fmt.pix.height; } @@ -380,50 +380,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-video3.c b/drivers/staging/cx25821/cx25821-video3.c index 1e0f10abdbcd..cbc5cad24a08 100644 --- a/drivers/staging/cx25821/cx25821-video3.c +++ b/drivers/staging/cx25821/cx25821-video3.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO3)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO3)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO3)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO3)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -207,13 +207,13 @@ static int video_release(struct file *file) cx_write(channel3->dma_ctl, 0); /* FIFO and RISC disable */ /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO3)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO3)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO3); + cx25821_res_free(dev, fh, RESOURCE_VIDEO3); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO3)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO3)))) { return -EBUSY; } @@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO3); + res = cx25821_get_resource(fh, RESOURCE_VIDEO3); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, fh->vidq.field = f->fmt.pix.field; // check if width and height is valid based on set standard - if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { + if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) { fh->width = f->fmt.pix.width; } - if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { + if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) { fh->height = f->fmt.pix.height; } @@ -379,50 +379,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-video4.c b/drivers/staging/cx25821/cx25821-video4.c index 0cbe7a79d8c0..101074ad742c 100644 --- a/drivers/staging/cx25821/cx25821-video4.c +++ b/drivers/staging/cx25821/cx25821-video4.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -146,7 +146,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO4)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO4)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -164,7 +164,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO4)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO4)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -206,13 +206,13 @@ static int video_release(struct file *file) cx_write(channel4->dma_ctl, 0); /* FIFO and RISC disable */ /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO4)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO4)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO4); + cx25821_res_free(dev, fh, RESOURCE_VIDEO4); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -238,7 +238,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO4)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO4)))) { return -EBUSY; } @@ -256,11 +256,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO4); + res = cx25821_get_resource(fh, RESOURCE_VIDEO4); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -279,7 +279,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, return err; } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -288,11 +288,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, fh->vidq.field = f->fmt.pix.field; // check if width and height is valid based on set standard - if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { + if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) { fh->width = f->fmt.pix.width; } - if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { + if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) { fh->height = f->fmt.pix.height; } @@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-video5.c b/drivers/staging/cx25821/cx25821-video5.c index 5dc08adc12e8..2019c5e3ea14 100644 --- a/drivers/staging/cx25821/cx25821-video5.c +++ b/drivers/staging/cx25821/cx25821-video5.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO5)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO5)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO5)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO5)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -207,13 +207,13 @@ static int video_release(struct file *file) cx_write(channel5->dma_ctl, 0); /* FIFO and RISC disable */ /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO5)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO5)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO5); + cx25821_res_free(dev, fh, RESOURCE_VIDEO5); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO5)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO5)))) { return -EBUSY; } @@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO5); + res = cx25821_get_resource(fh, RESOURCE_VIDEO5); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, fh->vidq.field = f->fmt.pix.field; // check if width and height is valid based on set standard - if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { + if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) { fh->width = f->fmt.pix.width; } - if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { + if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) { fh->height = f->fmt.pix.height; } @@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-video6.c b/drivers/staging/cx25821/cx25821-video6.c index 2938ad3ad3c5..d19c786e5a5f 100644 --- a/drivers/staging/cx25821/cx25821-video6.c +++ b/drivers/staging/cx25821/cx25821-video6.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO6)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO6)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO6)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO6)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -207,12 +207,12 @@ static int video_release(struct file *file) cx_write(channel6->dma_ctl, 0); /* FIFO and RISC disable */ /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO6)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO6)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO6); + cx25821_res_free(dev, fh, RESOURCE_VIDEO6); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -238,7 +238,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO6)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO6)))) { return -EBUSY; } @@ -256,11 +256,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO6); + res = cx25821_get_resource(fh, RESOURCE_VIDEO6); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -279,7 +279,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -288,11 +288,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, fh->vidq.field = f->fmt.pix.field; // check if width and height is valid based on set standard - if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { + if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) { fh->width = f->fmt.pix.width; } - if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { + if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) { fh->height = f->fmt.pix.height; } @@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-video7.c b/drivers/staging/cx25821/cx25821-video7.c index 458e525d72af..8a7c854a0fc8 100644 --- a/drivers/staging/cx25821/cx25821-video7.c +++ b/drivers/staging/cx25821/cx25821-video7.c @@ -85,10 +85,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -146,7 +146,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO7)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO7)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -164,7 +164,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO7)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO7)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -206,13 +206,13 @@ static int video_release(struct file *file) cx_write(channel7->dma_ctl, 0); /* FIFO and RISC disable */ /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO7)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO7)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO7); + cx25821_res_free(dev, fh, RESOURCE_VIDEO7); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -238,7 +238,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO7)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO7)))) { return -EBUSY; } @@ -256,11 +256,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO7); + res = cx25821_get_resource(fh, RESOURCE_VIDEO7); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -279,7 +279,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -288,11 +288,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, fh->vidq.field = f->fmt.pix.field; // check if width and height is valid based on set standard - if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { + if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) { fh->width = f->fmt.pix.width; } - if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { + if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) { fh->height = f->fmt.pix.height; } @@ -377,50 +377,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl2, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-videoioctl.c b/drivers/staging/cx25821/cx25821-videoioctl.c index 1da52b54a454..840714a9415f 100644 --- a/drivers/staging/cx25821/cx25821-videoioctl.c +++ b/drivers/staging/cx25821/cx25821-videoioctl.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -145,7 +145,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO_IOCTL)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO_IOCTL)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -163,7 +163,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO_IOCTL)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO_IOCTL)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -189,13 +189,13 @@ static int video_release(struct file *file) struct cx25821_dev *dev = fh->dev; /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO_IOCTL)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO_IOCTL)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO_IOCTL); + cx25821_res_free(dev, fh, RESOURCE_VIDEO_IOCTL); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -222,7 +222,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO_IOCTL)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO_IOCTL)))) { return -EBUSY; } @@ -240,11 +240,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO_IOCTL); + res = cx25821_get_resource(fh, RESOURCE_VIDEO_IOCTL); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -262,7 +262,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -424,50 +424,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl_set, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-vidups10.c b/drivers/staging/cx25821/cx25821-vidups10.c index b76d9f62c3d1..89c8592e5f02 100644 --- a/drivers/staging/cx25821/cx25821-vidups10.c +++ b/drivers/staging/cx25821/cx25821-vidups10.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -143,7 +143,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO10)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO10)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -161,7 +161,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO10)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO10)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -189,13 +189,13 @@ static int video_release(struct file *file) //cx_write(channel10->dma_ctl, 0); /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO10)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO10)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO10); + cx25821_res_free(dev, fh, RESOURCE_VIDEO10); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -222,7 +222,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO10)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO10)))) { return -EBUSY; } @@ -240,11 +240,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO10); + res = cx25821_get_resource(fh, RESOURCE_VIDEO10); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -305,7 +305,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -362,50 +362,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl_upstream10, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; diff --git a/drivers/staging/cx25821/cx25821-vidups9.c b/drivers/staging/cx25821/cx25821-vidups9.c index 1580da3b29aa..c8e8083c7934 100644 --- a/drivers/staging/cx25821/cx25821-vidups9.c +++ b/drivers/staging/cx25821/cx25821-vidups9.c @@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) } static struct videobuf_queue_ops cx25821_video_qops = { - .buf_setup = buffer_setup, - .buf_prepare = buffer_prepare, + .buf_setup = cx25821_buffer_setup, + .buf_prepare = cx25821_buffer_prepare, .buf_queue = buffer_queue, - .buf_release = buffer_release, + .buf_release = cx25821_buffer_release, }; static int video_open(struct file *file) @@ -143,7 +143,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count, switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (res_locked(fh->dev, RESOURCE_VIDEO9)) + if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO9)) return -EBUSY; return videobuf_read_one(&fh->vidq, data, count, ppos, @@ -161,7 +161,7 @@ static unsigned int video_poll(struct file *file, struct cx25821_fh *fh = file->private_data; struct cx25821_buffer *buf; - if (res_check(fh, RESOURCE_VIDEO9)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO9)) { /* streaming capture */ if (list_empty(&fh->vidq.stream)) return POLLERR; @@ -189,13 +189,13 @@ static int video_release(struct file *file) //cx_write(channel9->dma_ctl, 0); /* stop video capture */ - if (res_check(fh, RESOURCE_VIDEO9)) { + if (cx25821_res_check(fh, RESOURCE_VIDEO9)) { videobuf_queue_cancel(&fh->vidq); - res_free(dev, fh, RESOURCE_VIDEO9); + cx25821_res_free(dev, fh, RESOURCE_VIDEO9); } if (fh->vidq.read_buf) { - buffer_release(&fh->vidq, fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); kfree(fh->vidq.read_buf); } @@ -222,7 +222,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) return -EINVAL; } - if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO9)))) { + if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO9)))) { return -EBUSY; } @@ -240,11 +240,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) if (i != fh->type) return -EINVAL; - res = get_resource(fh, RESOURCE_VIDEO9); + res = cx25821_get_resource(fh, RESOURCE_VIDEO9); err = videobuf_streamoff(get_queue(fh)); if (err < 0) return err; - res_free(dev, fh, res); + cx25821_res_free(dev, fh, res); return 0; } @@ -305,7 +305,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, } dprintk(2, "%s()\n", __func__); - err = vidioc_try_fmt_vid_cap(file, priv, f); + err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) return err; @@ -360,50 +360,50 @@ static const struct v4l2_file_operations video_fops = { .release = video_release, .read = video_read, .poll = video_poll, - .mmap = video_mmap, + .mmap = cx25821_video_mmap, .ioctl = video_ioctl_upstream9, }; static const struct v4l2_ioctl_ops video_ioctl_ops = { - .vidioc_querycap = vidioc_querycap, - .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, - .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, - .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, + .vidioc_querycap = cx25821_vidioc_querycap, + .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap, .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, - .vidioc_reqbufs = vidioc_reqbufs, - .vidioc_querybuf = vidioc_querybuf, - .vidioc_qbuf = vidioc_qbuf, + .vidioc_reqbufs = cx25821_vidioc_reqbufs, + .vidioc_querybuf = cx25821_vidioc_querybuf, + .vidioc_qbuf = cx25821_vidioc_qbuf, .vidioc_dqbuf = vidioc_dqbuf, #ifdef TUNER_FLAG - .vidioc_s_std = vidioc_s_std, - .vidioc_querystd = vidioc_querystd, + .vidioc_s_std = cx25821_vidioc_s_std, + .vidioc_querystd = cx25821_vidioc_querystd, #endif - .vidioc_cropcap = vidioc_cropcap, - .vidioc_s_crop = vidioc_s_crop, - .vidioc_g_crop = vidioc_g_crop, - .vidioc_enum_input = vidioc_enum_input, - .vidioc_g_input = vidioc_g_input, - .vidioc_s_input = vidioc_s_input, - .vidioc_g_ctrl = vidioc_g_ctrl, + .vidioc_cropcap = cx25821_vidioc_cropcap, + .vidioc_s_crop = cx25821_vidioc_s_crop, + .vidioc_g_crop = cx25821_vidioc_g_crop, + .vidioc_enum_input = cx25821_vidioc_enum_input, + .vidioc_g_input = cx25821_vidioc_g_input, + .vidioc_s_input = cx25821_vidioc_s_input, + .vidioc_g_ctrl = cx25821_vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, - .vidioc_queryctrl = vidioc_queryctrl, + .vidioc_queryctrl = cx25821_vidioc_queryctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_log_status = vidioc_log_status, - .vidioc_g_priority = vidioc_g_priority, - .vidioc_s_priority = vidioc_s_priority, + .vidioc_g_priority = cx25821_vidioc_g_priority, + .vidioc_s_priority = cx25821_vidioc_s_priority, #ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, + .vidiocgmbuf = cx25821_vidiocgmbuf, #endif #ifdef TUNER_FLAG - .vidioc_g_tuner = vidioc_g_tuner, - .vidioc_s_tuner = vidioc_s_tuner, - .vidioc_g_frequency = vidioc_g_frequency, - .vidioc_s_frequency = vidioc_s_frequency, + .vidioc_g_tuner = cx25821_vidioc_g_tuner, + .vidioc_s_tuner = cx25821_vidioc_s_tuner, + .vidioc_g_frequency = cx25821_vidioc_g_frequency, + .vidioc_s_frequency = cx25821_vidioc_s_frequency, #endif #ifdef CONFIG_VIDEO_ADV_DEBUG - .vidioc_g_register = vidioc_g_register, - .vidioc_s_register = vidioc_s_register, + .vidioc_g_register = cx25821_vidioc_g_register, + .vidioc_s_register = cx25821_vidioc_s_register, #endif }; -- GitLab From 935539c97ed5f4f46867e7f44e42ad2048403f4e Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 22 Mar 2010 12:39:09 -0300 Subject: [PATCH 225/534] V4L/DVB: cx231xx: card->driver "Conexant cx231xx Audio" too long card->driver is 15 characters and a NULL, the original code could cause a buffer overflow. Signed-off-by: Dan Carpenter Acked-by: Takashi Iwai Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx231xx/cx231xx-audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/cx231xx/cx231xx-audio.c b/drivers/media/video/cx231xx/cx231xx-audio.c index 7793d60966db..7cae95a2245e 100644 --- a/drivers/media/video/cx231xx/cx231xx-audio.c +++ b/drivers/media/video/cx231xx/cx231xx-audio.c @@ -495,7 +495,7 @@ static int cx231xx_audio_init(struct cx231xx *dev) pcm->info_flags = 0; pcm->private_data = dev; strcpy(pcm->name, "Conexant cx231xx Capture"); - strcpy(card->driver, "Conexant cx231xx Audio"); + strcpy(card->driver, "Cx231xx-Audio"); strcpy(card->shortname, "Cx231xx Audio"); strcpy(card->longname, "Conexant cx231xx Audio"); -- GitLab From 4a3eaee4d0d2724d86cbb18ad4b0088ce0b7f8a2 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 23 Mar 2010 08:40:43 -0300 Subject: [PATCH 226/534] V4L/DVB: em28xx: "Empia Em28xx Audio" too long card->driver is 15 characters and a NULL. The original code goes past the end of the array. Signed-off-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index bd783387b37d..e182abf476c9 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -491,7 +491,7 @@ static int em28xx_audio_init(struct em28xx *dev) strcpy(pcm->name, "Empia 28xx Capture"); snd_card_set_dev(card, &dev->udev->dev); - strcpy(card->driver, "Empia Em28xx Audio"); + strcpy(card->driver, "Em28xx-Audio"); strcpy(card->shortname, "Em28xx Audio"); strcpy(card->longname, "Empia Em28xx Audio"); -- GitLab From 97693f9178ba83068f6b4e419a47ffd3d1a20897 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 21 Mar 2010 17:33:50 -0300 Subject: [PATCH 227/534] V4L/DVB: ov7670: Use CCIR601 in all video modes Also provide for a longer delay after reset - the XO 1.5 needs it. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov7670.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index aaa50f9b8e78..b44762adb1e9 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -351,7 +351,7 @@ static struct regval_list ov7670_default_regs[] = { static struct regval_list ov7670_fmt_yuv422[] = { { REG_COM7, 0x0 }, /* Selects YUV mode */ { REG_RGB444, 0 }, /* No RGB444 please */ - { REG_COM1, 0 }, + { REG_COM1, 0 }, /* CCIR601 */ { REG_COM15, COM15_R00FF }, { REG_COM9, 0x18 }, /* 4x gain ceiling; 0x8 is reserved bit */ { 0x4f, 0x80 }, /* "matrix coefficient 1" */ @@ -367,7 +367,7 @@ static struct regval_list ov7670_fmt_yuv422[] = { static struct regval_list ov7670_fmt_rgb565[] = { { REG_COM7, COM7_RGB }, /* Selects RGB mode */ { REG_RGB444, 0 }, /* No RGB444 please */ - { REG_COM1, 0x0 }, + { REG_COM1, 0x0 }, /* CCIR601 */ { REG_COM15, COM15_RGB565 }, { REG_COM9, 0x38 }, /* 16x gain ceiling; 0x8 is reserved bit */ { 0x4f, 0xb3 }, /* "matrix coefficient 1" */ @@ -383,7 +383,7 @@ static struct regval_list ov7670_fmt_rgb565[] = { static struct regval_list ov7670_fmt_rgb444[] = { { REG_COM7, COM7_RGB }, /* Selects RGB mode */ { REG_RGB444, R444_ENABLE }, /* Enable xxxxrrrr ggggbbbb */ - { REG_COM1, 0x40 }, /* Magic reserved bit */ + { REG_COM1, 0x0 }, /* CCIR601 */ { REG_COM15, COM15_R01FE|COM15_RGB565 }, /* Data range needed? */ { REG_COM9, 0x38 }, /* 16x gain ceiling; 0x8 is reserved bit */ { 0x4f, 0xb3 }, /* "matrix coefficient 1" */ @@ -432,7 +432,7 @@ static int ov7670_write(struct v4l2_subdev *sd, unsigned char reg, int ret = i2c_smbus_write_byte_data(client, reg, value); if (reg == REG_COM7 && (value & COM7_RESET)) - msleep(2); /* Wait for reset to run */ + msleep(5); /* Wait for reset to run */ return ret; } -- GitLab From d8d201552f518370d0a64cb758684f667fdd2012 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 20 Dec 2009 11:39:47 -0300 Subject: [PATCH 228/534] V4L/DVB: ov7670: Avoid reading clkrc Reading the clkrc register creates flaky behavior in some situations, and we can easily track its state separately. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov7670.c | 45 +++++++++++++++--------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index b44762adb1e9..b2e6f8e730a3 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -198,6 +198,7 @@ struct ov7670_info { struct ov7670_format_struct *fmt; /* Current format */ unsigned char sat; /* Saturation value */ int hue; /* Hue value */ + u8 clkrc; /* Clock divider value */ }; static inline struct ov7670_info *to_state(struct v4l2_subdev *sd) @@ -744,21 +745,11 @@ static int ov7670_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) struct ov7670_format_struct *ovfmt; struct ov7670_win_size *wsize; struct ov7670_info *info = to_state(sd); - unsigned char com7, clkrc = 0; + unsigned char com7; ret = ov7670_try_fmt_internal(sd, fmt, &ovfmt, &wsize); if (ret) return ret; - /* - * HACK: if we're running rgb565 we need to grab then rewrite - * CLKRC. If we're *not*, however, then rewriting clkrc hoses - * the colors. - */ - if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB565) { - ret = ov7670_read(sd, REG_CLKRC, &clkrc); - if (ret) - return ret; - } /* * COM7 is a pain in the ass, it doesn't like to be read then * quickly written afterward. But we have everything we need @@ -779,8 +770,14 @@ static int ov7670_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) ret = ov7670_write_array(sd, wsize->regs); info->fmt = ovfmt; + /* + * If we're running RGB565, we must rewrite clkrc after setting + * the other parameters or the image looks poor. If we're *not* + * doing RGB565, we must not rewrite clkrc or the image looks + * *really* poor. + */ if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB565 && ret == 0) - ret = ov7670_write(sd, REG_CLKRC, clkrc); + ret = ov7670_write(sd, REG_CLKRC, info->clkrc); return ret; } @@ -791,20 +788,17 @@ static int ov7670_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) static int ov7670_g_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) { struct v4l2_captureparm *cp = &parms->parm.capture; - unsigned char clkrc; - int ret; + struct ov7670_info *info = to_state(sd); if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - ret = ov7670_read(sd, REG_CLKRC, &clkrc); - if (ret < 0) - return ret; + memset(cp, 0, sizeof(struct v4l2_captureparm)); cp->capability = V4L2_CAP_TIMEPERFRAME; cp->timeperframe.numerator = 1; cp->timeperframe.denominator = OV7670_FRAME_RATE; - if ((clkrc & CLK_EXT) == 0 && (clkrc & CLK_SCALE) > 1) - cp->timeperframe.denominator /= (clkrc & CLK_SCALE); + if ((info->clkrc & CLK_EXT) == 0 && (info->clkrc & CLK_SCALE) > 1) + cp->timeperframe.denominator /= (info->clkrc & CLK_SCALE); return 0; } @@ -812,6 +806,7 @@ static int ov7670_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) { struct v4l2_captureparm *cp = &parms->parm.capture; struct v4l2_fract *tpf = &cp->timeperframe; + struct ov7670_info *info = to_state(sd); unsigned char clkrc; int ret, div; @@ -819,12 +814,7 @@ static int ov7670_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) return -EINVAL; if (cp->extendedmode != 0) return -EINVAL; - /* - * CLKRC has a reserved bit, so let's preserve it. - */ - ret = ov7670_read(sd, REG_CLKRC, &clkrc); - if (ret < 0) - return ret; + if (tpf->numerator == 0 || tpf->denominator == 0) div = 1; /* Reset to full rate */ else @@ -833,10 +823,10 @@ static int ov7670_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) div = 1; else if (div > CLK_SCALE) div = CLK_SCALE; - clkrc = (clkrc & 0x80) | div; + info->clkrc = (info->clkrc & 0x80) | div; tpf->numerator = 1; tpf->denominator = OV7670_FRAME_RATE/div; - return ov7670_write(sd, REG_CLKRC, clkrc); + return ov7670_write(sd, REG_CLKRC, info->clkrc); } @@ -1268,6 +1258,7 @@ static int ov7670_probe(struct i2c_client *client, info->fmt = &ov7670_formats[0]; info->sat = 128; /* Review this */ + info->clkrc = 1; /* 30fps */ return 0; } -- GitLab From 2bf7de48888fceed8d8e5cddd51f1d474bdbfae6 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Sun, 28 Feb 2010 21:02:55 -0300 Subject: [PATCH 229/534] V4L/DVB: ov7670: Don't use SMBUS I/O Contrary to my earlier belief, the ov7670 is not actually an SMBUS device, though it will pretend to be one if it's in a good mood. Unfortunately, it's rarely in a good mood, especially on the XO 1.5. So use low-level i2c I/O instead. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov7670.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index b2e6f8e730a3..95507770f120 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -410,16 +410,33 @@ static struct regval_list ov7670_fmt_raw[] = { /* * Low-level register I/O. */ - static int ov7670_read(struct v4l2_subdev *sd, unsigned char reg, unsigned char *value) { struct i2c_client *client = v4l2_get_subdevdata(sd); + u8 data = reg; + struct i2c_msg msg; int ret; - ret = i2c_smbus_read_byte_data(client, reg); + /* + * Send out the register address... + */ + msg.addr = client->addr; + msg.flags = 0; + msg.len = 1; + msg.buf = &data; + ret = i2c_transfer(client->adapter, &msg, 1); + if (ret < 0) { + printk(KERN_ERR "Error %d on register write\n", ret); + return ret; + } + /* + * ...then read back the result. + */ + msg.flags = I2C_M_RD; + ret = i2c_transfer(client->adapter, &msg, 1); if (ret >= 0) { - *value = (unsigned char)ret; + *value = data; ret = 0; } return ret; @@ -430,8 +447,17 @@ static int ov7670_write(struct v4l2_subdev *sd, unsigned char reg, unsigned char value) { struct i2c_client *client = v4l2_get_subdevdata(sd); - int ret = i2c_smbus_write_byte_data(client, reg, value); + struct i2c_msg msg; + unsigned char data[2] = { reg, value }; + int ret; + msg.addr = client->addr; + msg.flags = 0; + msg.len = 2; + msg.buf = data; + ret = i2c_transfer(client->adapter, &msg, 1); + if (ret > 0) + ret = 0; if (reg == REG_COM7 && (value & COM7_RESET)) msleep(5); /* Wait for reset to run */ return ret; -- GitLab From 81898671247a6cfa6bfd6a32faee18b3999b6610 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Thu, 4 Mar 2010 18:50:34 -0300 Subject: [PATCH 230/534] V4L/DVB: ov7670: Wire up V4L2_CID_GAIN and V4L2_CID_AUTOGAIN Allow applications to play with the gain settings. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov7670.c | 73 ++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index 95507770f120..e7555d1f90e6 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -1131,6 +1131,67 @@ static int ov7670_s_vflip(struct v4l2_subdev *sd, int value) return ret; } +/* + * GAIN is split between REG_GAIN and REG_VREF[7:6]. If one believes + * the data sheet, the VREF parts should be the most significant, but + * experience shows otherwise. There seems to be little value in + * messing with the VREF bits, so we leave them alone. + */ +static int ov7670_g_gain(struct v4l2_subdev *sd, __s32 *value) +{ + int ret; + unsigned char gain; + + ret = ov7670_read(sd, REG_GAIN, &gain); + *value = gain; + return ret; +} + +static int ov7670_s_gain(struct v4l2_subdev *sd, int value) +{ + int ret; + unsigned char com8; + + ret = ov7670_write(sd, REG_GAIN, value & 0xff); + /* Have to turn off AGC as well */ + if (ret == 0) { + ret = ov7670_read(sd, REG_COM8, &com8); + ret = ov7670_write(sd, REG_COM8, com8 & ~COM8_AGC); + } + return ret; +} + +/* + * Tweak autogain. + */ +static int ov7670_g_autogain(struct v4l2_subdev *sd, __s32 *value) +{ + int ret; + unsigned char com8; + + ret = ov7670_read(sd, REG_COM8, &com8); + *value = (com8 & COM8_AGC) != 0; + return ret; +} + +static int ov7670_s_autogain(struct v4l2_subdev *sd, int value) +{ + int ret; + unsigned char com8; + + ret = ov7670_read(sd, REG_COM8, &com8); + if (ret == 0) { + if (value) + com8 |= COM8_AGC; + else + com8 &= ~COM8_AGC; + ret = ov7670_write(sd, REG_COM8, com8); + } + return ret; +} + + + static int ov7670_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) { @@ -1147,6 +1208,10 @@ static int ov7670_queryctrl(struct v4l2_subdev *sd, return v4l2_ctrl_query_fill(qc, 0, 256, 1, 128); case V4L2_CID_HUE: return v4l2_ctrl_query_fill(qc, -180, 180, 5, 0); + case V4L2_CID_GAIN: + return v4l2_ctrl_query_fill(qc, 0, 255, 1, 128); + case V4L2_CID_AUTOGAIN: + return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1); } return -EINVAL; } @@ -1166,6 +1231,10 @@ static int ov7670_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) return ov7670_g_vflip(sd, &ctrl->value); case V4L2_CID_HFLIP: return ov7670_g_hflip(sd, &ctrl->value); + case V4L2_CID_GAIN: + return ov7670_g_gain(sd, &ctrl->value); + case V4L2_CID_AUTOGAIN: + return ov7670_g_autogain(sd, &ctrl->value); } return -EINVAL; } @@ -1185,6 +1254,10 @@ static int ov7670_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) return ov7670_s_vflip(sd, ctrl->value); case V4L2_CID_HFLIP: return ov7670_s_hflip(sd, ctrl->value); + case V4L2_CID_GAIN: + return ov7670_s_gain(sd, ctrl->value); + case V4L2_CID_AUTOGAIN: + return ov7670_s_autogain(sd, ctrl->value); } return -EINVAL; } -- GitLab From 364e93372fb21ef5de18d0122c78789f065ddbf5 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Fri, 5 Mar 2010 16:48:39 -0300 Subject: [PATCH 231/534] V4L/DVB: ov7670: wire up controls for exposure and autoexposure Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov7670.c | 86 ++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index e7555d1f90e6..90c44598dd51 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -1190,6 +1190,79 @@ static int ov7670_s_autogain(struct v4l2_subdev *sd, int value) return ret; } +/* + * Exposure is spread all over the place: top 6 bits in AECHH, middle + * 8 in AECH, and two stashed in COM1 just for the hell of it. + */ +static int ov7670_g_exp(struct v4l2_subdev *sd, __s32 *value) +{ + int ret; + unsigned char com1, aech, aechh; + + ret = ov7670_read(sd, REG_COM1, &com1) + + ov7670_read(sd, REG_AECH, &aech) + + ov7670_read(sd, REG_AECHH, &aechh); + *value = ((aechh & 0x3f) << 10) | (aech << 2) | (com1 & 0x03); + return ret; +} + +static int ov7670_s_exp(struct v4l2_subdev *sd, int value) +{ + int ret; + unsigned char com1, com8, aech, aechh; + + ret = ov7670_read(sd, REG_COM1, &com1) + + ov7670_read(sd, REG_COM8, &com8); + ov7670_read(sd, REG_AECHH, &aechh); + if (ret) + return ret; + + com1 = (com1 & 0xfc) | (value & 0x03); + aech = (value >> 2) & 0xff; + aechh = (aechh & 0xc0) | ((value >> 10) & 0x3f); + ret = ov7670_write(sd, REG_COM1, com1) + + ov7670_write(sd, REG_AECH, aech) + + ov7670_write(sd, REG_AECHH, aechh); + /* Have to turn off AEC as well */ + if (ret == 0) + ret = ov7670_write(sd, REG_COM8, com8 & ~COM8_AEC); + return ret; +} + +/* + * Tweak autoexposure. + */ +static int ov7670_g_autoexp(struct v4l2_subdev *sd, __s32 *value) +{ + int ret; + unsigned char com8; + enum v4l2_exposure_auto_type *atype = (enum v4l2_exposure_auto_type *) value; + + ret = ov7670_read(sd, REG_COM8, &com8); + if (com8 & COM8_AEC) + *value = V4L2_EXPOSURE_AUTO; + else + *value = V4L2_EXPOSURE_MANUAL; + return ret; +} + +static int ov7670_s_autoexp(struct v4l2_subdev *sd, + enum v4l2_exposure_auto_type value) +{ + int ret; + unsigned char com8; + + ret = ov7670_read(sd, REG_COM8, &com8); + if (ret == 0) { + if (value == V4L2_EXPOSURE_AUTO) + com8 |= COM8_AEC; + else + com8 &= ~COM8_AEC; + ret = ov7670_write(sd, REG_COM8, com8); + } + return ret; +} + static int ov7670_queryctrl(struct v4l2_subdev *sd, @@ -1212,6 +1285,10 @@ static int ov7670_queryctrl(struct v4l2_subdev *sd, return v4l2_ctrl_query_fill(qc, 0, 255, 1, 128); case V4L2_CID_AUTOGAIN: return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1); + case V4L2_CID_EXPOSURE: + return v4l2_ctrl_query_fill(qc, 0, 65535, 1, 500); + case V4L2_CID_EXPOSURE_AUTO: + return v4l2_ctrl_query_fill(qc, 0, 1, 1, 0); } return -EINVAL; } @@ -1235,6 +1312,10 @@ static int ov7670_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) return ov7670_g_gain(sd, &ctrl->value); case V4L2_CID_AUTOGAIN: return ov7670_g_autogain(sd, &ctrl->value); + case V4L2_CID_EXPOSURE: + return ov7670_g_exp(sd, &ctrl->value); + case V4L2_CID_EXPOSURE_AUTO: + return ov7670_g_autoexp(sd, &ctrl->value); } return -EINVAL; } @@ -1258,6 +1339,11 @@ static int ov7670_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) return ov7670_s_gain(sd, ctrl->value); case V4L2_CID_AUTOGAIN: return ov7670_s_autogain(sd, ctrl->value); + case V4L2_CID_EXPOSURE: + return ov7670_s_exp(sd, ctrl->value); + case V4L2_CID_EXPOSURE_AUTO: + return ov7670_s_autoexp(sd, + (enum v4l2_exposure_auto_type) ctrl->value); } return -EINVAL; } -- GitLab From 467142093de1507833a08c50740d74b3b8c8eaca Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Fri, 19 Mar 2010 13:16:28 -0300 Subject: [PATCH 232/534] V4L/DVB: ov7670: Restore SMBUS I/O for the XO 1.0 The Cafe controller doesn't do non-SMBUS I/O, so we have to use it there. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov7670.c | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index 90c44598dd51..21243303755f 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -409,6 +409,42 @@ static struct regval_list ov7670_fmt_raw[] = { /* * Low-level register I/O. + * + * Note that there are two versions of these. On the XO 1, the + * i2c controller only does SMBUS, so that's what we use. The + * ov7670 is not really an SMBUS device, though, so the communication + * is not always entirely reliable. + */ +#ifdef CONFIG_OLPC_XO_1 +static int ov7670_read(struct v4l2_subdev *sd, unsigned char reg, + unsigned char *value) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + int ret; + + ret = i2c_smbus_read_byte_data(client, reg); + if (ret >= 0) { + *value = (unsigned char)ret; + ret = 0; + } + return ret; +} + + +static int ov7670_write(struct v4l2_subdev *sd, unsigned char reg, + unsigned char value) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + int ret = i2c_smbus_write_byte_data(client, reg, value); + + if (reg == REG_COM7 && (value & COM7_RESET)) + msleep(5); /* Wait for reset to run */ + return ret; +} + +#else /* ! CONFIG_OLPC_XO_1 */ +/* + * On most platforms, we'd rather do straight i2c I/O. */ static int ov7670_read(struct v4l2_subdev *sd, unsigned char reg, unsigned char *value) @@ -462,6 +498,7 @@ static int ov7670_write(struct v4l2_subdev *sd, unsigned char reg, msleep(5); /* Wait for reset to run */ return ret; } +#endif /* CONFIG_OLPC_XO_1 */ /* -- GitLab From a8e68c37c846236499ac05e95af76dff2e9aa1eb Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Thu, 18 Mar 2010 19:10:18 -0300 Subject: [PATCH 233/534] V4L/DVB: ov7670: Always rewrite clkrc when setting format That makes frame rate configuration persistent. Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov7670.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index 21243303755f..82d37d925eb4 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -838,8 +838,12 @@ static int ov7670_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) * the other parameters or the image looks poor. If we're *not* * doing RGB565, we must not rewrite clkrc or the image looks * *really* poor. + * + * (Update) Now that we retain clkrc state, we should be able + * to write it unconditionally, and that will make the frame + * rate persistent too. */ - if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_RGB565 && ret == 0) + if (ret == 0) ret = ov7670_write(sd, REG_CLKRC, info->clkrc); return ret; } -- GitLab From 380de498e264cca27d19deafe4dc44f624820d09 Mon Sep 17 00:00:00 2001 From: Jonathan Corbet Date: Fri, 26 Mar 2010 13:09:34 -0300 Subject: [PATCH 234/534] V4L/DVB: ov7670: silence some compiler warnings Get rid of some "unused variable" warnings. These were the result of sloppiness and should not have happened; I'll go stand in the corner now. Reported-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov7670.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c index 82d37d925eb4..91c886ab15c6 100644 --- a/drivers/media/video/ov7670.c +++ b/drivers/media/video/ov7670.c @@ -874,8 +874,7 @@ static int ov7670_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *parms) struct v4l2_captureparm *cp = &parms->parm.capture; struct v4l2_fract *tpf = &cp->timeperframe; struct ov7670_info *info = to_state(sd); - unsigned char clkrc; - int ret, div; + int div; if (parms->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; @@ -1281,9 +1280,9 @@ static int ov7670_g_autoexp(struct v4l2_subdev *sd, __s32 *value) ret = ov7670_read(sd, REG_COM8, &com8); if (com8 & COM8_AEC) - *value = V4L2_EXPOSURE_AUTO; + *atype = V4L2_EXPOSURE_AUTO; else - *value = V4L2_EXPOSURE_MANUAL; + *atype = V4L2_EXPOSURE_MANUAL; return ret; } -- GitLab From 51224aa436238940e09e479db9c600cecfbebd20 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 04:33:56 -0300 Subject: [PATCH 235/534] V4L/DVB: c-qcam: coding style cleanup Clean up the coding style before we convert this driver to V4L2. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/c-qcam.c | 483 +++++++++++++++++------------------ 1 file changed, 237 insertions(+), 246 deletions(-) diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index e2cbebab959b..8f1dd88b32a6 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c @@ -79,17 +79,17 @@ static inline void qcam_set_ack(struct qcam_device *qcam, unsigned int i) { /* note: the QC specs refer to the PCAck pin by voltage, not software level. PC ports have builtin inverters. */ - parport_frob_control(qcam->pport, 8, i?8:0); + parport_frob_control(qcam->pport, 8, i ? 8 : 0); } static inline unsigned int qcam_ready1(struct qcam_device *qcam) { - return (parport_read_status(qcam->pport) & 0x8)?1:0; + return (parport_read_status(qcam->pport) & 0x8) ? 1 : 0; } static inline unsigned int qcam_ready2(struct qcam_device *qcam) { - return (parport_read_data(qcam->pport) & 0x1)?1:0; + return (parport_read_data(qcam->pport) & 0x1) ? 1 : 0; } static unsigned int qcam_await_ready1(struct qcam_device *qcam, @@ -99,14 +99,13 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam, unsigned int i; for (oldjiffies = jiffies; - time_before(jiffies, oldjiffies + msecs_to_jiffies(40)); ) + time_before(jiffies, oldjiffies + msecs_to_jiffies(40));) if (qcam_ready1(qcam) == value) return 0; /* If the camera didn't respond within 1/25 second, poll slowly for a while. */ - for (i = 0; i < 50; i++) - { + for (i = 0; i < 50; i++) { if (qcam_ready1(qcam) == value) return 0; msleep_interruptible(100); @@ -125,14 +124,13 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value) unsigned int i; for (oldjiffies = jiffies; - time_before(jiffies, oldjiffies + msecs_to_jiffies(40)); ) + time_before(jiffies, oldjiffies + msecs_to_jiffies(40));) if (qcam_ready2(qcam) == value) return 0; /* If the camera didn't respond within 1/25 second, poll slowly for a while. */ - for (i = 0; i < 50; i++) - { + for (i = 0; i < 50; i++) { if (qcam_ready2(qcam) == value) return 0; msleep_interruptible(100); @@ -149,22 +147,25 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value) static int qcam_read_data(struct qcam_device *qcam) { unsigned int idata; + qcam_set_ack(qcam, 0); - if (qcam_await_ready1(qcam, 1)) return -1; + if (qcam_await_ready1(qcam, 1)) + return -1; idata = parport_read_status(qcam->pport) & 0xf0; qcam_set_ack(qcam, 1); - if (qcam_await_ready1(qcam, 0)) return -1; - idata |= (parport_read_status(qcam->pport) >> 4); + if (qcam_await_ready1(qcam, 0)) + return -1; + idata |= parport_read_status(qcam->pport) >> 4; return idata; } static int qcam_write_data(struct qcam_device *qcam, unsigned int data) { unsigned int idata; + parport_write_data(qcam->pport, data); idata = qcam_read_data(qcam); - if (data != idata) - { + if (data != idata) { printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, idata); return 1; @@ -212,13 +213,12 @@ static int qc_detect(struct qcam_device *qcam) /* look for a heartbeat */ ostat = stat = parport_read_status(qcam->pport); - for (i=0; i<250; i++) - { + for (i = 0; i < 250; i++) { mdelay(1); stat = parport_read_status(qcam->pport); - if (ostat != stat) - { - if (++count >= 3) return 1; + if (ostat != stat) { + if (++count >= 3) + return 1; ostat = stat; } } @@ -232,13 +232,12 @@ static int qc_detect(struct qcam_device *qcam) count = 0; ostat = stat = parport_read_status(qcam->pport); - for (i=0; i<250; i++) - { + for (i = 0; i < 250; i++) { mdelay(1); stat = parport_read_status(qcam->pport); - if (ostat != stat) - { - if (++count >= 3) return 1; + if (ostat != stat) { + if (++count >= 3) + return 1; ostat = stat; } } @@ -263,7 +262,7 @@ static void qc_setup(struct qcam_device *q) { qc_reset(q); - /* Set the brightness. */ + /* Set the brightness. */ qcam_set(q, 11, q->brightness); /* Set the height and width. These refer to the actual @@ -292,25 +291,25 @@ static unsigned int qcam_read_bytes(struct qcam_device *q, unsigned char *buf, u unsigned int bytes = 0; qcam_set_ack(q, 0); - if (q->bidirectional) - { + if (q->bidirectional) { /* It's a bidirectional port */ - while (bytes < nbytes) - { + while (bytes < nbytes) { unsigned int lo1, hi1, lo2, hi2; unsigned char r, g, b; - if (qcam_await_ready2(q, 1)) return bytes; + if (qcam_await_ready2(q, 1)) + return bytes; lo1 = parport_read_data(q->pport) >> 1; hi1 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10; qcam_set_ack(q, 1); - if (qcam_await_ready2(q, 0)) return bytes; + if (qcam_await_ready2(q, 0)) + return bytes; lo2 = parport_read_data(q->pport) >> 1; hi2 = ((parport_read_status(q->pport) >> 3) & 0x1f) ^ 0x10; qcam_set_ack(q, 0); - r = (lo1 | ((hi1 & 1)<<7)); - g = ((hi1 & 0x1e)<<3) | ((hi2 & 0x1e)>>1); - b = (lo2 | ((hi2 & 1)<<7)); + r = lo1 | ((hi1 & 1) << 7); + g = ((hi1 & 0x1e) << 3) | ((hi2 & 0x1e) >> 1); + b = lo2 | ((hi2 & 1) << 7); if (force_rgb) { buf[bytes++] = r; buf[bytes++] = g; @@ -321,21 +320,20 @@ static unsigned int qcam_read_bytes(struct qcam_device *q, unsigned char *buf, u buf[bytes++] = r; } } - } - else - { + } else { /* It's a unidirectional port */ int i = 0, n = bytes; unsigned char rgb[3]; - while (bytes < nbytes) - { + while (bytes < nbytes) { unsigned int hi, lo; - if (qcam_await_ready1(q, 1)) return bytes; + if (qcam_await_ready1(q, 1)) + return bytes; hi = (parport_read_status(q->pport) & 0xf0); qcam_set_ack(q, 1); - if (qcam_await_ready1(q, 0)) return bytes; + if (qcam_await_ready1(q, 0)) + return bytes; lo = (parport_read_status(q->pport) & 0xf0); qcam_set_ack(q, 0); /* flip some bits */ @@ -374,28 +372,26 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le return -EFAULT; /* Wait for camera to become ready */ - for (;;) - { + for (;;) { int i = qcam_get(q, 41); + if (i == -1) { qc_setup(q); return -EIO; } if ((i & 0x80) == 0) break; - else - schedule(); + schedule(); } - if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1)) + if (qcam_set(q, 7, (q->mode | (is_bi_dir ? 1 : 0)) + 1)) return -EIO; lines = q->height; pixelsperline = q->width; bitsperxfer = (is_bi_dir) ? 24 : 8; - if (is_bi_dir) - { + if (is_bi_dir) { /* Turn the port around */ parport_data_reverse(q->pport); mdelay(3); @@ -413,16 +409,17 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le wantlen = lines * pixelsperline * 24 / 8; - while (wantlen) - { + while (wantlen) { size_t t, s; - s = (wantlen > BUFSZ)?BUFSZ:wantlen; + + s = (wantlen > BUFSZ) ? BUFSZ : wantlen; t = qcam_read_bytes(q, tmpbuf, s); - if (outptr < len) - { + if (outptr < len) { size_t sz = len - outptr; - if (sz > t) sz = t; - if (__copy_to_user(buf+outptr, tmpbuf, sz)) + + if (sz > t) + sz = t; + if (__copy_to_user(buf + outptr, tmpbuf, sz)) break; outptr += sz; } @@ -434,33 +431,31 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le len = outptr; - if (wantlen) - { - printk("qcam: short read.\n"); + if (wantlen) { + printk(KERN_ERR "qcam: short read.\n"); if (is_bi_dir) parport_data_forward(q->pport); qc_setup(q); return len; } - if (is_bi_dir) - { + if (is_bi_dir) { int l; + do { l = qcam_read_bytes(q, tmpbuf, 3); cond_resched(); } while (l && (tmpbuf[0] == 0x7e || tmpbuf[1] == 0x7e || tmpbuf[2] == 0x7e)); if (force_rgb) { if (tmpbuf[0] != 0xe || tmpbuf[1] != 0x0 || tmpbuf[2] != 0xf) - printk("qcam: bad EOF\n"); + printk(KERN_ERR "qcam: bad EOF\n"); } else { if (tmpbuf[0] != 0xf || tmpbuf[1] != 0x0 || tmpbuf[2] != 0xe) - printk("qcam: bad EOF\n"); + printk(KERN_ERR "qcam: bad EOF\n"); } qcam_set_ack(q, 0); - if (qcam_await_ready1(q, 1)) - { - printk("qcam: no ack after EOF\n"); + if (qcam_await_ready1(q, 1)) { + printk(KERN_ERR "qcam: no ack after EOF\n"); parport_data_forward(q->pport); qc_setup(q); return len; @@ -468,27 +463,25 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le parport_data_forward(q->pport); mdelay(3); qcam_set_ack(q, 1); - if (qcam_await_ready1(q, 0)) - { - printk("qcam: no ack to port turnaround\n"); + if (qcam_await_ready1(q, 0)) { + printk(KERN_ERR "qcam: no ack to port turnaround\n"); qc_setup(q); return len; } - } - else - { + } else { int l; + do { l = qcam_read_bytes(q, tmpbuf, 1); cond_resched(); } while (l && tmpbuf[0] == 0x7e); - l = qcam_read_bytes(q, tmpbuf+1, 2); + l = qcam_read_bytes(q, tmpbuf + 1, 2); if (force_rgb) { if (tmpbuf[0] != 0xe || tmpbuf[1] != 0x0 || tmpbuf[2] != 0xf) - printk("qcam: bad EOF\n"); + printk(KERN_ERR "qcam: bad EOF\n"); } else { if (tmpbuf[0] != 0xf || tmpbuf[1] != 0x0 || tmpbuf[2] != 0xe) - printk("qcam: bad EOF\n"); + printk(KERN_ERR "qcam: bad EOF\n"); } } @@ -503,164 +496,166 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct video_device *dev = video_devdata(file); - struct qcam_device *qcam=(struct qcam_device *)dev; + struct qcam_device *qcam = (struct qcam_device *)dev; - switch(cmd) + switch (cmd) { + case VIDIOCGCAP: { - case VIDIOCGCAP: - { - struct video_capability *b = arg; - strcpy(b->name, "Quickcam"); - b->type = VID_TYPE_CAPTURE|VID_TYPE_SCALES; - b->channels = 1; - b->audios = 0; - b->maxwidth = 320; - b->maxheight = 240; - b->minwidth = 80; - b->minheight = 60; - return 0; - } - case VIDIOCGCHAN: - { - struct video_channel *v = arg; - if(v->channel!=0) - return -EINVAL; - v->flags=0; - v->tuners=0; - /* Good question.. its composite or SVHS so.. */ - v->type = VIDEO_TYPE_CAMERA; - strcpy(v->name, "Camera"); - return 0; - } - case VIDIOCSCHAN: - { - struct video_channel *v = arg; - if(v->channel!=0) - return -EINVAL; - return 0; - } - case VIDIOCGTUNER: - { - struct video_tuner *v = arg; - if(v->tuner) - return -EINVAL; - memset(v,0,sizeof(*v)); - strcpy(v->name, "Format"); - v->mode = VIDEO_MODE_AUTO; - return 0; - } - case VIDIOCSTUNER: - { - struct video_tuner *v = arg; - if(v->tuner) - return -EINVAL; - if(v->mode!=VIDEO_MODE_AUTO) - return -EINVAL; - return 0; - } - case VIDIOCGPICT: - { - struct video_picture *p = arg; - p->colour=0x8000; - p->hue=0x8000; - p->brightness=qcam->brightness<<8; - p->contrast=qcam->contrast<<8; - p->whiteness=qcam->whitebal<<8; - p->depth=24; - p->palette=VIDEO_PALETTE_RGB24; - return 0; + struct video_capability *b = arg; + + strcpy(b->name, "Quickcam"); + b->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; + b->channels = 1; + b->audios = 0; + b->maxwidth = 320; + b->maxheight = 240; + b->minwidth = 80; + b->minheight = 60; + return 0; + } + case VIDIOCGCHAN: + { + struct video_channel *v = arg; + + if (v->channel != 0) + return -EINVAL; + v->flags = 0; + v->tuners = 0; + /* Good question.. its composite or SVHS so.. */ + v->type = VIDEO_TYPE_CAMERA; + strcpy(v->name, "Camera"); + return 0; + } + case VIDIOCSCHAN: + { + struct video_channel *v = arg; + + if (v->channel != 0) + return -EINVAL; + return 0; + } + case VIDIOCGTUNER: + { + struct video_tuner *v = arg; + + if (v->tuner) + return -EINVAL; + memset(v, 0, sizeof(*v)); + strcpy(v->name, "Format"); + v->mode = VIDEO_MODE_AUTO; + return 0; + } + case VIDIOCSTUNER: + { + struct video_tuner *v = arg; + + if (v->tuner) + return -EINVAL; + if (v->mode != VIDEO_MODE_AUTO) + return -EINVAL; + return 0; + } + case VIDIOCGPICT: + { + struct video_picture *p = arg; + + p->colour = 0x8000; + p->hue = 0x8000; + p->brightness = qcam->brightness << 8; + p->contrast = qcam->contrast << 8; + p->whiteness = qcam->whitebal << 8; + p->depth = 24; + p->palette = VIDEO_PALETTE_RGB24; + return 0; + } + case VIDIOCSPICT: + { + struct video_picture *p = arg; + + /* + * Sanity check args + */ + if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24) + return -EINVAL; + + /* + * Now load the camera. + */ + qcam->brightness = p->brightness >> 8; + qcam->contrast = p->contrast >> 8; + qcam->whitebal = p->whiteness >> 8; + + mutex_lock(&qcam->lock); + parport_claim_or_block(qcam->pdev); + qc_setup(qcam); + parport_release(qcam->pdev); + mutex_unlock(&qcam->lock); + return 0; + } + case VIDIOCSWIN: + { + struct video_window *vw = arg; + + if (vw->flags) + return -EINVAL; + if (vw->clipcount) + return -EINVAL; + if (vw->height < 60 || vw->height > 240) + return -EINVAL; + if (vw->width < 80 || vw->width > 320) + return -EINVAL; + + qcam->width = 80; + qcam->height = 60; + qcam->mode = QC_DECIMATION_4; + + if (vw->width >= 160 && vw->height >= 120) { + qcam->width = 160; + qcam->height = 120; + qcam->mode = QC_DECIMATION_2; } - case VIDIOCSPICT: - { - struct video_picture *p = arg; - - /* - * Sanity check args - */ - if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24) - return -EINVAL; - - /* - * Now load the camera. - */ - qcam->brightness = p->brightness>>8; - qcam->contrast = p->contrast>>8; - qcam->whitebal = p->whiteness>>8; - - mutex_lock(&qcam->lock); - parport_claim_or_block(qcam->pdev); - qc_setup(qcam); - parport_release(qcam->pdev); - mutex_unlock(&qcam->lock); - return 0; + if (vw->width >= 320 && vw->height >= 240) { + qcam->width = 320; + qcam->height = 240; + qcam->mode = QC_DECIMATION_1; } - case VIDIOCSWIN: - { - struct video_window *vw = arg; - - if(vw->flags) - return -EINVAL; - if(vw->clipcount) - return -EINVAL; - if(vw->height<60||vw->height>240) - return -EINVAL; - if(vw->width<80||vw->width>320) - return -EINVAL; - - qcam->width = 80; - qcam->height = 60; - qcam->mode = QC_DECIMATION_4; - - if(vw->width>=160 && vw->height>=120) - { - qcam->width = 160; - qcam->height = 120; - qcam->mode = QC_DECIMATION_2; - } - if(vw->width>=320 && vw->height>=240) - { - qcam->width = 320; - qcam->height = 240; - qcam->mode = QC_DECIMATION_1; - } - qcam->mode |= QC_MILLIONS; + qcam->mode |= QC_MILLIONS; #if 0 - if(vw->width>=640 && vw->height>=480) - { - qcam->width = 640; - qcam->height = 480; - qcam->mode = QC_BILLIONS | QC_DECIMATION_1; - } -#endif - /* Ok we figured out what to use from our - wide choice */ - mutex_lock(&qcam->lock); - parport_claim_or_block(qcam->pdev); - qc_setup(qcam); - parport_release(qcam->pdev); - mutex_unlock(&qcam->lock); - return 0; - } - case VIDIOCGWIN: - { - struct video_window *vw = arg; - memset(vw, 0, sizeof(*vw)); - vw->width=qcam->width; - vw->height=qcam->height; - return 0; + if (vw->width >= 640 && vw->height >= 480) { + qcam->width = 640; + qcam->height = 480; + qcam->mode = QC_BILLIONS | QC_DECIMATION_1; } - case VIDIOCKEY: - return 0; - case VIDIOCCAPTURE: - case VIDIOCGFBUF: - case VIDIOCSFBUF: - case VIDIOCGFREQ: - case VIDIOCSFREQ: - case VIDIOCGAUDIO: - case VIDIOCSAUDIO: - return -EINVAL; - default: - return -ENOIOCTLCMD; +#endif + /* Ok we figured out what to use from our + wide choice */ + mutex_lock(&qcam->lock); + parport_claim_or_block(qcam->pdev); + qc_setup(qcam); + parport_release(qcam->pdev); + mutex_unlock(&qcam->lock); + return 0; + } + case VIDIOCGWIN: + { + struct video_window *vw = arg; + memset(vw, 0, sizeof(*vw)); + vw->width = qcam->width; + vw->height = qcam->height; + return 0; + } + case VIDIOCKEY: + return 0; + case VIDIOCCAPTURE: + case VIDIOCGFBUF: + case VIDIOCSFBUF: + case VIDIOCGFREQ: + case VIDIOCSFREQ: + case VIDIOCGAUDIO: + case VIDIOCSAUDIO: + return -EINVAL; + default: + return -ENOIOCTLCMD; } return 0; } @@ -675,13 +670,13 @@ static ssize_t qcam_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct video_device *v = video_devdata(file); - struct qcam_device *qcam=(struct qcam_device *)v; + struct qcam_device *qcam = (struct qcam_device *)v; int len; mutex_lock(&qcam->lock); parport_claim_or_block(qcam->pdev); /* Probably should have a semaphore against multiple users */ - len = qc_capture(qcam, buf,count); + len = qc_capture(qcam, buf, count); parport_release(qcam->pdev); mutex_unlock(&qcam->lock); return len; @@ -713,8 +708,7 @@ static const struct v4l2_file_operations qcam_fops = { .read = qcam_read, }; -static struct video_device qcam_template= -{ +static struct video_device qcam_template = { .name = "Colour QuickCam", .fops = &qcam_fops, .release = video_device_release_empty, @@ -727,17 +721,16 @@ static struct qcam_device *qcam_init(struct parport *port) struct qcam_device *q; q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); - if(q==NULL) + if (q == NULL) return NULL; q->pport = port; q->pdev = parport_register_device(port, "c-qcam", NULL, NULL, NULL, 0, NULL); - q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0; + q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE) ? 1 : 0; - if (q->pdev == NULL) - { + if (q->pdev == NULL) { printk(KERN_ERR "c-qcam: couldn't register for %s.\n", port->name); kfree(q); @@ -765,12 +758,11 @@ static int init_cqcam(struct parport *port) { struct qcam_device *qcam; - if (parport[0] != -1) - { + if (parport[0] != -1) { /* The user gave specific instructions */ int i, found = 0; - for (i = 0; i < MAX_CAMS && parport[i] != -1; i++) - { + + for (i = 0; i < MAX_CAMS && parport[i] != -1; i++) { if (parport[0] == port->number) found = 1; } @@ -782,15 +774,14 @@ static int init_cqcam(struct parport *port) return -ENOSPC; qcam = qcam_init(port); - if (qcam==NULL) + if (qcam == NULL) return -ENODEV; parport_claim_or_block(qcam->pdev); qc_reset(qcam); - if (probe && qc_detect(qcam)==0) - { + if (probe && qc_detect(qcam) == 0) { parport_release(qcam->pdev); parport_unregister_device(qcam->pdev); kfree(qcam); @@ -840,14 +831,14 @@ static struct parport_driver cqcam_driver = { .detach = cq_detach, }; -static int __init cqcam_init (void) +static int __init cqcam_init(void) { printk(BANNER "\n"); return parport_register_driver(&cqcam_driver); } -static void __exit cqcam_cleanup (void) +static void __exit cqcam_cleanup(void) { unsigned int i; @@ -862,9 +853,9 @@ MODULE_DESCRIPTION(BANNER); MODULE_LICENSE("GPL"); /* FIXME: parport=auto would never have worked, surely? --RR */ -MODULE_PARM_DESC(parport ,"parport= for port detection method\n\ -probe=<0|1|2> for camera detection method\n\ -force_rgb=<0|1> for RGB data format (default BGR)"); +MODULE_PARM_DESC(parport, "parport= for port detection method\n" + "probe=<0|1|2> for camera detection method\n" + "force_rgb=<0|1> for RGB data format (default BGR)"); module_param_array(parport, int, NULL, 0); module_param(probe, int, 0); module_param(force_rgb, bool, 0); -- GitLab From 1d61aac0996d96847e17263a41d34ab54bf8e103 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 04:36:04 -0300 Subject: [PATCH 236/534] V4L/DVB: bw-qcam: coding style cleanup Clean up the coding style before we convert this driver to V4L2. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/bw-qcam.c | 452 ++++++++++++++++------------------ 1 file changed, 207 insertions(+), 245 deletions(-) diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 9e39bc5f7b00..3c9e754d73a0 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c @@ -80,8 +80,8 @@ OTHER DEALINGS IN THE SOFTWARE. #include "bw-qcam.h" -static unsigned int maxpoll=250; /* Maximum busy-loop count for qcam I/O */ -static unsigned int yieldlines=4; /* Yield after this many during capture */ +static unsigned int maxpoll = 250; /* Maximum busy-loop count for qcam I/O */ +static unsigned int yieldlines = 4; /* Yield after this many during capture */ static int video_nr = -1; static unsigned int force_init; /* Whether to probe aggressively */ @@ -156,7 +156,7 @@ static int qc_calibrate(struct qcam_device *q) mdelay(1); schedule(); count++; - } while (value == 0xff && count<2048); + } while (value == 0xff && count < 2048); q->whitebal = value; return value; @@ -170,16 +170,15 @@ static struct qcam_device *qcam_init(struct parport *port) struct qcam_device *q; q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); - if(q==NULL) + if (q == NULL) return NULL; q->pport = port; q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, - NULL, 0, NULL); - if (q->pdev == NULL) - { + NULL, 0, NULL); + if (q->pdev == NULL) { printk(KERN_ERR "bw-qcam: couldn't register for %s.\n", - port->name); + port->name); kfree(q); return NULL; } @@ -247,12 +246,10 @@ static int qc_readparam(struct qcam_device *q) static int qc_waithand(struct qcam_device *q, int val) { int status; - int runs=0; + int runs = 0; - if (val) - { - while (!((status = read_lpstatus(q)) & 8)) - { + if (val) { + while (!((status = read_lpstatus(q)) & 8)) { /* 1000 is enough spins on the I/O for all normal cases, at that point we start to poll slowly until the camera wakes up. However, we are @@ -260,18 +257,13 @@ static int qc_waithand(struct qcam_device *q, int val) setting it lower is much better for interactive response. */ - if(runs++>maxpoll) - { + if (runs++ > maxpoll) msleep_interruptible(5); - } - if(runs>(maxpoll+1000)) /* 5 seconds */ + if (runs > (maxpoll + 1000)) /* 5 seconds */ return -1; } - } - else - { - while (((status = read_lpstatus(q)) & 8)) - { + } else { + while (((status = read_lpstatus(q)) & 8)) { /* 1000 is enough spins on the I/O for all normal cases, at that point we start to poll slowly until the camera wakes up. However, we are @@ -279,11 +271,9 @@ static int qc_waithand(struct qcam_device *q, int val) setting it lower is much better for interactive response. */ - if(runs++>maxpoll) - { + if (runs++ > maxpoll) msleep_interruptible(5); - } - if(runs++>(maxpoll+1000)) /* 5 seconds */ + if (runs++ > (maxpoll + 1000)) /* 5 seconds */ return -1; } } @@ -299,10 +289,9 @@ static int qc_waithand(struct qcam_device *q, int val) static unsigned int qc_waithand2(struct qcam_device *q, int val) { unsigned int status; - int runs=0; + int runs = 0; - do - { + do { status = read_lpdata(q); /* 1000 is enough spins on the I/O for all normal cases, at that point we start to poll slowly @@ -311,14 +300,11 @@ static unsigned int qc_waithand2(struct qcam_device *q, int val) setting it lower is much better for interactive response. */ - if(runs++>maxpoll) - { + if (runs++ > maxpoll) msleep_interruptible(5); - } - if(runs++>(maxpoll+1000)) /* 5 seconds */ + if (runs++ > (maxpoll + 1000)) /* 5 seconds */ return 0; - } - while ((status & 1) != val); + } while ((status & 1) != val); return status; } @@ -342,8 +328,7 @@ static int qc_detect(struct qcam_device *q) lastreg = reg = read_lpstatus(q) & 0xf0; - for (i = 0; i < 500; i++) - { + for (i = 0; i < 500; i++) { reg = read_lpstatus(q) & 0xf0; if (reg != lastreg) count++; @@ -357,7 +342,7 @@ static int qc_detect(struct qcam_device *q) won't be flashing these bits. Possibly unloading the module in the middle of a grab? Or some timeout condition? I've seen this parameter as low as 19 on my 450Mhz box - mpc */ - printk("Debugging: QCam detection counter <30-200 counts as detected>: %d\n", count); + printk(KERN_DEBUG "Debugging: QCam detection counter <30-200 counts as detected>: %d\n", count); return 1; #endif @@ -367,7 +352,7 @@ static int qc_detect(struct qcam_device *q) return 1; /* found */ } else { printk(KERN_ERR "No Quickcam found on port %s\n", - q->pport->name); + q->pport->name); printk(KERN_DEBUG "Quickcam detection counter: %u\n", count); return 0; /* not found */ } @@ -381,26 +366,24 @@ static int qc_detect(struct qcam_device *q) static void qc_reset(struct qcam_device *q) { - switch (q->port_mode & QC_FORCE_MASK) - { - case QC_FORCE_UNIDIR: - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; - break; + switch (q->port_mode & QC_FORCE_MASK) { + case QC_FORCE_UNIDIR: + q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; + break; - case QC_FORCE_BIDIR: - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; - break; + case QC_FORCE_BIDIR: + q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; + break; - case QC_ANY: - write_lpcontrol(q, 0x20); - write_lpdata(q, 0x75); + case QC_ANY: + write_lpcontrol(q, 0x20); + write_lpdata(q, 0x75); - if (read_lpdata(q) != 0x75) { - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; - } else { - q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; - } - break; + if (read_lpdata(q) != 0x75) + q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; + else + q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; + break; } write_lpcontrol(q, 0xb); @@ -423,36 +406,33 @@ static int qc_setscanmode(struct qcam_device *q) { int old_mode = q->mode; - switch (q->transfer_scale) - { - case 1: - q->mode = 0; - break; - case 2: - q->mode = 4; - break; - case 4: - q->mode = 8; - break; + switch (q->transfer_scale) { + case 1: + q->mode = 0; + break; + case 2: + q->mode = 4; + break; + case 4: + q->mode = 8; + break; } - switch (q->bpp) - { - case 4: - break; - case 6: - q->mode += 2; - break; + switch (q->bpp) { + case 4: + break; + case 6: + q->mode += 2; + break; } - switch (q->port_mode & QC_MODE_MASK) - { - case QC_BIDIR: - q->mode += 1; - break; - case QC_NOTSET: - case QC_UNIDIR: - break; + switch (q->port_mode & QC_MODE_MASK) { + case QC_BIDIR: + q->mode += 1; + break; + case QC_NOTSET: + case QC_UNIDIR: + break; } if (q->mode != old_mode) @@ -493,7 +473,7 @@ static void qc_set(struct qcam_device *q) } else { val = q->width * q->bpp; val2 = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * - q->transfer_scale; + q->transfer_scale; } val = DIV_ROUND_UP(val, val2); qc_command(q, 0x13); @@ -521,85 +501,80 @@ static void qc_set(struct qcam_device *q) static inline int qc_readbytes(struct qcam_device *q, char buffer[]) { - int ret=1; + int ret = 1; unsigned int hi, lo; unsigned int hi2, lo2; static int state; - if (buffer == NULL) - { + if (buffer == NULL) { state = 0; return 0; } - switch (q->port_mode & QC_MODE_MASK) - { - case QC_BIDIR: /* Bi-directional Port */ - write_lpcontrol(q, 0x26); - lo = (qc_waithand2(q, 1) >> 1); - hi = (read_lpstatus(q) >> 3) & 0x1f; - write_lpcontrol(q, 0x2e); - lo2 = (qc_waithand2(q, 0) >> 1); - hi2 = (read_lpstatus(q) >> 3) & 0x1f; - switch (q->bpp) - { - case 4: - buffer[0] = lo & 0xf; - buffer[1] = ((lo & 0x70) >> 4) | ((hi & 1) << 3); - buffer[2] = (hi & 0x1e) >> 1; - buffer[3] = lo2 & 0xf; - buffer[4] = ((lo2 & 0x70) >> 4) | ((hi2 & 1) << 3); - buffer[5] = (hi2 & 0x1e) >> 1; - ret = 6; - break; - case 6: - buffer[0] = lo & 0x3f; - buffer[1] = ((lo & 0x40) >> 6) | (hi << 1); - buffer[2] = lo2 & 0x3f; - buffer[3] = ((lo2 & 0x40) >> 6) | (hi2 << 1); - ret = 4; - break; - } + switch (q->port_mode & QC_MODE_MASK) { + case QC_BIDIR: /* Bi-directional Port */ + write_lpcontrol(q, 0x26); + lo = (qc_waithand2(q, 1) >> 1); + hi = (read_lpstatus(q) >> 3) & 0x1f; + write_lpcontrol(q, 0x2e); + lo2 = (qc_waithand2(q, 0) >> 1); + hi2 = (read_lpstatus(q) >> 3) & 0x1f; + switch (q->bpp) { + case 4: + buffer[0] = lo & 0xf; + buffer[1] = ((lo & 0x70) >> 4) | ((hi & 1) << 3); + buffer[2] = (hi & 0x1e) >> 1; + buffer[3] = lo2 & 0xf; + buffer[4] = ((lo2 & 0x70) >> 4) | ((hi2 & 1) << 3); + buffer[5] = (hi2 & 0x1e) >> 1; + ret = 6; + break; + case 6: + buffer[0] = lo & 0x3f; + buffer[1] = ((lo & 0x40) >> 6) | (hi << 1); + buffer[2] = lo2 & 0x3f; + buffer[3] = ((lo2 & 0x40) >> 6) | (hi2 << 1); + ret = 4; break; + } + break; + + case QC_UNIDIR: /* Unidirectional Port */ + write_lpcontrol(q, 6); + lo = (qc_waithand(q, 1) & 0xf0) >> 4; + write_lpcontrol(q, 0xe); + hi = (qc_waithand(q, 0) & 0xf0) >> 4; - case QC_UNIDIR: /* Unidirectional Port */ - write_lpcontrol(q, 6); - lo = (qc_waithand(q, 1) & 0xf0) >> 4; - write_lpcontrol(q, 0xe); - hi = (qc_waithand(q, 0) & 0xf0) >> 4; - - switch (q->bpp) - { - case 4: - buffer[0] = lo; - buffer[1] = hi; - ret = 2; - break; - case 6: - switch (state) - { - case 0: - buffer[0] = (lo << 2) | ((hi & 0xc) >> 2); - q->saved_bits = (hi & 3) << 4; - state = 1; - ret = 1; - break; - case 1: - buffer[0] = lo | q->saved_bits; - q->saved_bits = hi << 2; - state = 2; - ret = 1; - break; - case 2: - buffer[0] = ((lo & 0xc) >> 2) | q->saved_bits; - buffer[1] = ((lo & 3) << 4) | hi; - state = 0; - ret = 2; - break; - } - break; + switch (q->bpp) { + case 4: + buffer[0] = lo; + buffer[1] = hi; + ret = 2; + break; + case 6: + switch (state) { + case 0: + buffer[0] = (lo << 2) | ((hi & 0xc) >> 2); + q->saved_bits = (hi & 3) << 4; + state = 1; + ret = 1; + break; + case 1: + buffer[0] = lo | q->saved_bits; + q->saved_bits = hi << 2; + state = 2; + ret = 1; + break; + case 2: + buffer[0] = ((lo & 0xc) >> 2) | q->saved_bits; + buffer[1] = ((lo & 3) << 4) | hi; + state = 0; + ret = 2; + break; } break; + } + break; } return ret; } @@ -615,7 +590,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) * n=2^(bit depth)-1. Ask me for more details if you don't understand * this. */ -static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long len) +static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long len) { int i, j, k, yield; int bytes; @@ -623,9 +598,9 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l int divisor; int pixels_per_line; int pixels_read = 0; - int got=0; + int got = 0; char buffer[6]; - int shift=8-q->bpp; + int shift = 8 - q->bpp; char invert; if (q->mode == -1) @@ -634,13 +609,12 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l qc_command(q, 0x7); qc_command(q, q->mode); - if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) - { + if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) { write_lpcontrol(q, 0x2e); /* turn port around */ write_lpcontrol(q, 0x26); - (void) qc_waithand(q, 1); + qc_waithand(q, 1); write_lpcontrol(q, 0x2e); - (void) qc_waithand(q, 0); + qc_waithand(q, 0); } /* strange -- should be 15:63 below, but 4bpp is odd */ @@ -650,33 +624,28 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l pixels_per_line = q->width / q->transfer_scale; transperline = q->width * q->bpp; divisor = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * - q->transfer_scale; + q->transfer_scale; transperline = DIV_ROUND_UP(transperline, divisor); - for (i = 0, yield = yieldlines; i < linestotrans; i++) - { - for (pixels_read = j = 0; j < transperline; j++) - { + for (i = 0, yield = yieldlines; i < linestotrans; i++) { + for (pixels_read = j = 0; j < transperline; j++) { bytes = qc_readbytes(q, buffer); - for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) - { + for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) { int o; - if (buffer[k] == 0 && invert == 16) - { + if (buffer[k] == 0 && invert == 16) { /* 4bpp is odd (again) -- inverter is 16, not 15, but output must be 0-15 -- bls */ buffer[k] = 16; } - o=i*pixels_per_line + pixels_read + k; - if(oport_mode & QC_MODE_MASK) == QC_BIDIR) - { + if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) { write_lpcontrol(q, 2); write_lpcontrol(q, 6); udelay(3); write_lpcontrol(q, 0xe); } - if(gotname, "Quickcam"); @@ -726,73 +693,73 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) b->minheight = 60; return 0; } - case VIDIOCGCHAN: + case VIDIOCGCHAN: { struct video_channel *v = arg; - if(v->channel!=0) + if (v->channel != 0) return -EINVAL; - v->flags=0; - v->tuners=0; + v->flags = 0; + v->tuners = 0; /* Good question.. its composite or SVHS so.. */ v->type = VIDEO_TYPE_CAMERA; strcpy(v->name, "Camera"); return 0; } - case VIDIOCSCHAN: + case VIDIOCSCHAN: { struct video_channel *v = arg; - if(v->channel!=0) + if (v->channel != 0) return -EINVAL; return 0; } - case VIDIOCGTUNER: + case VIDIOCGTUNER: { struct video_tuner *v = arg; - if(v->tuner) + if (v->tuner) return -EINVAL; strcpy(v->name, "Format"); - v->rangelow=0; - v->rangehigh=0; - v->flags= 0; + v->rangelow = 0; + v->rangehigh = 0; + v->flags = 0; v->mode = VIDEO_MODE_AUTO; return 0; } - case VIDIOCSTUNER: + case VIDIOCSTUNER: { struct video_tuner *v = arg; - if(v->tuner) + if (v->tuner) return -EINVAL; - if(v->mode!=VIDEO_MODE_AUTO) + if (v->mode != VIDEO_MODE_AUTO) return -EINVAL; return 0; } - case VIDIOCGPICT: + case VIDIOCGPICT: { struct video_picture *p = arg; - p->colour=0x8000; - p->hue=0x8000; - p->brightness=qcam->brightness<<8; - p->contrast=qcam->contrast<<8; - p->whiteness=qcam->whitebal<<8; - p->depth=qcam->bpp; - p->palette=VIDEO_PALETTE_GREY; + p->colour = 0x8000; + p->hue = 0x8000; + p->brightness = qcam->brightness << 8; + p->contrast = qcam->contrast << 8; + p->whiteness = qcam->whitebal << 8; + p->depth = qcam->bpp; + p->palette = VIDEO_PALETTE_GREY; return 0; } - case VIDIOCSPICT: + case VIDIOCSPICT: { struct video_picture *p = arg; - if(p->palette!=VIDEO_PALETTE_GREY) + if (p->palette != VIDEO_PALETTE_GREY) return -EINVAL; - if(p->depth!=4 && p->depth!=6) + if (p->depth != 4 && p->depth != 6) return -EINVAL; /* * Now load the camera. */ - qcam->brightness = p->brightness>>8; - qcam->contrast = p->contrast>>8; - qcam->whitebal = p->whiteness>>8; + qcam->brightness = p->brightness >> 8; + qcam->contrast = p->contrast >> 8; + qcam->whitebal = p->whiteness >> 8; qcam->bpp = p->depth; mutex_lock(&qcam->lock); @@ -802,28 +769,25 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) return 0; } - case VIDIOCSWIN: + case VIDIOCSWIN: { struct video_window *vw = arg; - if(vw->flags) + if (vw->flags) return -EINVAL; - if(vw->clipcount) + if (vw->clipcount) return -EINVAL; - if(vw->height<60||vw->height>240) + if (vw->height < 60 || vw->height > 240) return -EINVAL; - if(vw->width<80||vw->width>320) + if (vw->width < 80 || vw->width > 320) return -EINVAL; qcam->width = 320; qcam->height = 240; qcam->transfer_scale = 4; - if(vw->width>=160 && vw->height>=120) - { + if (vw->width >= 160 && vw->height >= 120) qcam->transfer_scale = 2; - } - if(vw->width>=320 && vw->height>=240) - { + if (vw->width >= 320 && vw->height >= 240) { qcam->width = 320; qcam->height = 240; qcam->transfer_scale = 1; @@ -839,41 +803,42 @@ static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) /* Ok we figured out what to use from our wide choice */ return 0; } - case VIDIOCGWIN: + case VIDIOCGWIN: { struct video_window *vw = arg; + memset(vw, 0, sizeof(*vw)); - vw->width=qcam->width/qcam->transfer_scale; - vw->height=qcam->height/qcam->transfer_scale; + vw->width = qcam->width / qcam->transfer_scale; + vw->height = qcam->height / qcam->transfer_scale; return 0; } - case VIDIOCKEY: - return 0; - case VIDIOCCAPTURE: - case VIDIOCGFBUF: - case VIDIOCSFBUF: - case VIDIOCGFREQ: - case VIDIOCSFREQ: - case VIDIOCGAUDIO: - case VIDIOCSAUDIO: - return -EINVAL; - default: - return -ENOIOCTLCMD; + case VIDIOCKEY: + return 0; + case VIDIOCCAPTURE: + case VIDIOCGFBUF: + case VIDIOCSFBUF: + case VIDIOCGFREQ: + case VIDIOCSFREQ: + case VIDIOCGAUDIO: + case VIDIOCSAUDIO: + return -EINVAL; + default: + return -ENOIOCTLCMD; } return 0; } static long qcam_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { return video_usercopy(file, cmd, arg, qcam_do_ioctl); } static ssize_t qcam_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { struct video_device *v = video_devdata(file); - struct qcam_device *qcam=(struct qcam_device *)v; + struct qcam_device *qcam = (struct qcam_device *)v; int len; parport_claim_or_block(qcam->pdev); @@ -885,7 +850,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, if (qcam->status & QC_PARAM_CHANGE) qc_set(qcam); - len=qc_capture(qcam, buf,count); + len = qc_capture(qcam, buf, count); mutex_unlock(&qcam->lock); @@ -917,8 +882,7 @@ static const struct v4l2_file_operations qcam_fops = { .ioctl = qcam_ioctl, .read = qcam_read, }; -static struct video_device qcam_template= -{ +static struct video_device qcam_template = { .name = "Connectix Quickcam", .fops = &qcam_fops, .release = video_device_release_empty, @@ -932,22 +896,20 @@ static int init_bwqcam(struct parport *port) { struct qcam_device *qcam; - if (num_cams == MAX_CAMS) - { + if (num_cams == MAX_CAMS) { printk(KERN_ERR "Too many Quickcams (max %d)\n", MAX_CAMS); return -ENOSPC; } - qcam=qcam_init(port); - if(qcam==NULL) + qcam = qcam_init(port); + if (qcam == NULL) return -ENODEV; parport_claim_or_block(qcam->pdev); qc_reset(qcam); - if(qc_detect(qcam)==0) - { + if (qc_detect(qcam) == 0) { parport_release(qcam->pdev); parport_unregister_device(qcam->pdev); kfree(qcam); @@ -1045,12 +1007,12 @@ static int __init init_bw_qcams(void) #ifdef MODULE /* Do some sanity checks on the module parameters. */ if (maxpoll > 5000) { - printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n"); + printk(KERN_INFO "Connectix Quickcam max-poll was above 5000. Using 5000.\n"); maxpoll = 5000; } if (yieldlines < 1) { - printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n"); + printk(KERN_INFO "Connectix Quickcam yieldlines was less than 1. Using 1.\n"); yieldlines = 1; } #endif -- GitLab From 88f4423454a23375f07bb4ff3a80d209930560d0 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 04:44:29 -0300 Subject: [PATCH 237/534] V4L/DVB: arv: coding style cleanup Clean up the coding style before we convert this driver to V4L2. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/arv.c | 153 +++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 77 deletions(-) diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index a356d6bd3131..9f88096a520c 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c @@ -39,7 +39,7 @@ #include #if 0 -#define DEBUG(n, args...) printk(args) +#define DEBUG(n, args...) printk(KERN_INFO args) #define CHECK_LOST 1 #else #define DEBUG(n, args...) @@ -55,7 +55,7 @@ #define VERSION "0.03" #define ar_inl(addr) inl((unsigned long)(addr)) -#define ar_outl(val, addr) outl((unsigned long)(val),(unsigned long)(addr)) +#define ar_outl(val, addr) outl((unsigned long)(val), (unsigned long)(addr)) extern struct cpuinfo_m32r boot_cpu_data; @@ -214,13 +214,12 @@ void init_iic(void) /* I2C CLK */ /* 50MH-100k */ - if (freq == 75) { + if (freq == 75) ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */ - } else if (freq == 50) { + else if (freq == 50) ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */ - } else { + else ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */ - } ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */ } @@ -260,7 +259,7 @@ static inline void wait_for_vertical_sync(int exp_line) break; } if (tmout < 0) - printk("arv: lost %d -> %d\n", exp_line, l); + printk(KERN_ERR "arv: lost %d -> %d\n", exp_line, l); #else while (ar_inl(ARVHCOUNT) != exp_line) cpu_relax(); @@ -277,7 +276,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) unsigned char *p; int h, w; unsigned char *py, *pu, *pv; -#if ! USE_INT +#if !USE_INT int l; #endif @@ -313,7 +312,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) /* .... AR interrupts .... */ interruptible_sleep_on(&ar->wait); if (signal_pending(current)) { - printk("arv: interrupted while get frame data.\n"); + printk(KERN_ERR "arv: interrupted while get frame data.\n"); ret = -EINTR; goto out_up; } @@ -386,7 +385,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) } } if (copy_to_user(buf, yuv, ar->frame_bytes)) { - printk("arv: failed while copy_to_user yuv.\n"); + printk(KERN_ERR "arv: failed while copy_to_user yuv.\n"); ret = -EFAULT; goto out_up; } @@ -402,7 +401,7 @@ static long ar_do_ioctl(struct file *file, unsigned int cmd, void *arg) struct ar_device *ar = video_get_drvdata(dev); DEBUG(1, "ar_ioctl()\n"); - switch(cmd) { + switch (cmd) { case VIDIOCGCAP: { struct video_capability *b = arg; @@ -559,11 +558,11 @@ static void ar_interrupt(int irq, void *dev) line_count = ar_inl(ARVHCOUNT); /* line number */ if (ar->mode == AR_MODE_INTERLACE && ar->size == AR_SIZE_VGA) { /* operations for interlace mode */ - if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */ + if (line_count < (AR_HEIGHT_VGA / 2)) /* even line */ line_number = (line_count << 1); else /* odd line */ line_number = - (((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1); + (((line_count - (AR_HEIGHT_VGA / 2)) << 1) + 1); } else { line_number = line_count; } @@ -627,7 +626,7 @@ static int ar_initialize(struct video_device *dev) { struct ar_device *ar = video_get_drvdata(dev); unsigned long cr = 0; - int i,found=0; + int i, found = 0; DEBUG(1, "ar_initialize:\n"); @@ -666,66 +665,66 @@ static int ar_initialize(struct video_device *dev) if (found == 0) return -ENODEV; - printk("arv: Initializing "); - - iic(2,0x78,0x11,0x01,0x00); /* start */ - iic(3,0x78,0x12,0x00,0x06); - iic(3,0x78,0x12,0x12,0x30); - iic(3,0x78,0x12,0x15,0x58); - iic(3,0x78,0x12,0x17,0x30); - printk("."); - iic(3,0x78,0x12,0x1a,0x97); - iic(3,0x78,0x12,0x1b,0xff); - iic(3,0x78,0x12,0x1c,0xff); - iic(3,0x78,0x12,0x26,0x10); - iic(3,0x78,0x12,0x27,0x00); - printk("."); - iic(2,0x78,0x34,0x02,0x00); - iic(2,0x78,0x7a,0x10,0x00); - iic(2,0x78,0x80,0x39,0x00); - iic(2,0x78,0x81,0xe6,0x00); - iic(2,0x78,0x8d,0x00,0x00); - printk("."); - iic(2,0x78,0x8e,0x0c,0x00); - iic(2,0x78,0x8f,0x00,0x00); + printk(KERN_INFO "arv: Initializing "); + + iic(2, 0x78, 0x11, 0x01, 0x00); /* start */ + iic(3, 0x78, 0x12, 0x00, 0x06); + iic(3, 0x78, 0x12, 0x12, 0x30); + iic(3, 0x78, 0x12, 0x15, 0x58); + iic(3, 0x78, 0x12, 0x17, 0x30); + printk(KERN_CONT "."); + iic(3, 0x78, 0x12, 0x1a, 0x97); + iic(3, 0x78, 0x12, 0x1b, 0xff); + iic(3, 0x78, 0x12, 0x1c, 0xff); + iic(3, 0x78, 0x12, 0x26, 0x10); + iic(3, 0x78, 0x12, 0x27, 0x00); + printk(KERN_CONT "."); + iic(2, 0x78, 0x34, 0x02, 0x00); + iic(2, 0x78, 0x7a, 0x10, 0x00); + iic(2, 0x78, 0x80, 0x39, 0x00); + iic(2, 0x78, 0x81, 0xe6, 0x00); + iic(2, 0x78, 0x8d, 0x00, 0x00); + printk(KERN_CONT "."); + iic(2, 0x78, 0x8e, 0x0c, 0x00); + iic(2, 0x78, 0x8f, 0x00, 0x00); #if 0 - iic(2,0x78,0x90,0x00,0x00); /* AWB on=1 off=0 */ + iic(2, 0x78, 0x90, 0x00, 0x00); /* AWB on=1 off=0 */ #endif - iic(2,0x78,0x93,0x01,0x00); - iic(2,0x78,0x94,0xcd,0x00); - iic(2,0x78,0x95,0x00,0x00); - printk("."); - iic(2,0x78,0x96,0xa0,0x00); - iic(2,0x78,0x97,0x00,0x00); - iic(2,0x78,0x98,0x60,0x00); - iic(2,0x78,0x99,0x01,0x00); - iic(2,0x78,0x9a,0x19,0x00); - printk("."); - iic(2,0x78,0x9b,0x02,0x00); - iic(2,0x78,0x9c,0xe8,0x00); - iic(2,0x78,0x9d,0x02,0x00); - iic(2,0x78,0x9e,0x2e,0x00); - iic(2,0x78,0xb8,0x78,0x00); - iic(2,0x78,0xba,0x05,0x00); + iic(2, 0x78, 0x93, 0x01, 0x00); + iic(2, 0x78, 0x94, 0xcd, 0x00); + iic(2, 0x78, 0x95, 0x00, 0x00); + printk(KERN_CONT "."); + iic(2, 0x78, 0x96, 0xa0, 0x00); + iic(2, 0x78, 0x97, 0x00, 0x00); + iic(2, 0x78, 0x98, 0x60, 0x00); + iic(2, 0x78, 0x99, 0x01, 0x00); + iic(2, 0x78, 0x9a, 0x19, 0x00); + printk(KERN_CONT "."); + iic(2, 0x78, 0x9b, 0x02, 0x00); + iic(2, 0x78, 0x9c, 0xe8, 0x00); + iic(2, 0x78, 0x9d, 0x02, 0x00); + iic(2, 0x78, 0x9e, 0x2e, 0x00); + iic(2, 0x78, 0xb8, 0x78, 0x00); + iic(2, 0x78, 0xba, 0x05, 0x00); #if 0 - iic(2,0x78,0x83,0x8c,0x00); /* brightness */ + iic(2, 0x78, 0x83, 0x8c, 0x00); /* brightness */ #endif - printk("."); + printk(KERN_CONT "."); /* color correction */ - iic(3,0x78,0x49,0x00,0x95); /* a */ - iic(3,0x78,0x49,0x01,0x96); /* b */ - iic(3,0x78,0x49,0x03,0x85); /* c */ - iic(3,0x78,0x49,0x04,0x97); /* d */ - iic(3,0x78,0x49,0x02,0x7e); /* e(Lo) */ - iic(3,0x78,0x49,0x05,0xa4); /* f(Lo) */ - iic(3,0x78,0x49,0x06,0x04); /* e(Hi) */ - iic(3,0x78,0x49,0x07,0x04); /* e(Hi) */ - iic(2,0x78,0x48,0x01,0x00); /* on=1 off=0 */ - - printk("."); - iic(2,0x78,0x11,0x00,0x00); /* end */ - printk(" done\n"); + iic(3, 0x78, 0x49, 0x00, 0x95); /* a */ + iic(3, 0x78, 0x49, 0x01, 0x96); /* b */ + iic(3, 0x78, 0x49, 0x03, 0x85); /* c */ + iic(3, 0x78, 0x49, 0x04, 0x97); /* d */ + iic(3, 0x78, 0x49, 0x02, 0x7e); /* e(Lo) */ + iic(3, 0x78, 0x49, 0x05, 0xa4); /* f(Lo) */ + iic(3, 0x78, 0x49, 0x06, 0x04); /* e(Hi) */ + iic(3, 0x78, 0x49, 0x07, 0x04); /* e(Hi) */ + iic(2, 0x78, 0x48, 0x01, 0x00); /* on=1 off=0 */ + + printk(KERN_CONT "."); + iic(2, 0x78, 0x11, 0x00, 0x00); /* end */ + printk(KERN_CONT " done\n"); return 0; } @@ -787,8 +786,8 @@ static int __init ar_init(void) #if USE_INT /* allocate a DMA buffer for 1 line. */ ar->line_buff = kmalloc(MAX_AR_LINE_BYTES, GFP_KERNEL | GFP_DMA); - if (ar->line_buff == NULL || ! ALIGN4(ar->line_buff)) { - printk("arv: buffer allocation failed for DMA.\n"); + if (ar->line_buff == NULL || !ALIGN4(ar->line_buff)) { + printk(KERN_ERR "arv: buffer allocation failed for DMA.\n"); ret = -ENOMEM; goto out_end; } @@ -796,8 +795,8 @@ static int __init ar_init(void) /* allocate buffers for a frame */ for (i = 0; i < MAX_AR_HEIGHT; i++) { ar->frame[i] = kmalloc(MAX_AR_LINE_BYTES, GFP_KERNEL); - if (ar->frame[i] == NULL || ! ALIGN4(ar->frame[i])) { - printk("arv: buffer allocation failed for frame.\n"); + if (ar->frame[i] == NULL || !ALIGN4(ar->frame[i])) { + printk(KERN_ERR "arv: buffer allocation failed for frame.\n"); ret = -ENOMEM; goto out_line_buff; } @@ -834,14 +833,14 @@ static int __init ar_init(void) #if USE_INT if (request_irq(M32R_IRQ_INT3, ar_interrupt, 0, "arv", ar)) { - printk("arv: request_irq(%d) failed.\n", M32R_IRQ_INT3); + printk(KERN_ERR "arv: request_irq(%d) failed.\n", M32R_IRQ_INT3); ret = -EIO; goto out_irq; } #endif if (ar_initialize(ar->vdev) != 0) { - printk("arv: M64278 not found.\n"); + printk(KERN_ERR "arv: M64278 not found.\n"); ret = -ENODEV; goto out_dev; } @@ -854,12 +853,12 @@ static int __init ar_init(void) */ if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) { /* return -1, -ENFILE(full) or others */ - printk("arv: register video (Colour AR) failed.\n"); + printk(KERN_ERR "arv: register video (Colour AR) failed.\n"); ret = -ENODEV; goto out_dev; } - printk("%s: Found M64278 VGA (IRQ %d, Freq %dMHz).\n", + printk(KERN_INFO "%s: Found M64278 VGA (IRQ %d, Freq %dMHz).\n", video_device_node_name(ar->vdev), M32R_IRQ_INT3, freq); return 0; @@ -886,7 +885,7 @@ static int __init ar_init(void) static int __init ar_init_module(void) { freq = (boot_cpu_data.bus_clock / 1000000); - printk("arv: Bus clock %d\n", freq); + printk(KERN_INFO "arv: Bus clock %d\n", freq); if (freq != 50 && freq != 75) freq = DEFAULT_FREQ; return ar_init(); -- GitLab From 4bfdd58604ead4d49b29630ee8f72c99b7803b7d Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 04:47:27 -0300 Subject: [PATCH 238/534] V4L/DVB: w9966: coding style cleanup Clean up the coding style before we convert this driver to V4L2. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/w9966.c | 461 +++++++++++++++++------------------- 1 file changed, 223 insertions(+), 238 deletions(-) diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index bf9bf650a317..25364b8f857b 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c @@ -76,12 +76,12 @@ */ #define W9966_DRIVERNAME "W9966CF Webcam" -#define W9966_MAXCAMS 4 // Maximum number of cameras -#define W9966_RBUFFER 2048 // Read buffer (must be an even number) -#define W9966_SRAMSIZE 131072 // 128kb -#define W9966_SRAMID 0x02 // check w9966cf.pdf +#define W9966_MAXCAMS 4 /* Maximum number of cameras */ +#define W9966_RBUFFER 2048 /* Read buffer (must be an even number) */ +#define W9966_SRAMSIZE 131072 /* 128kb */ +#define W9966_SRAMID 0x02 /* check w9966cf.pdf */ -// Empirically determined window limits +/* Empirically determined window limits */ #define W9966_WND_MIN_X 16 #define W9966_WND_MIN_Y 14 #define W9966_WND_MAX_X 705 @@ -89,7 +89,7 @@ #define W9966_WND_MAX_W (W9966_WND_MAX_X - W9966_WND_MIN_X) #define W9966_WND_MAX_H (W9966_WND_MAX_Y - W9966_WND_MIN_Y) -// Keep track of our current state +/* Keep track of our current state */ #define W9966_STATE_PDEV 0x01 #define W9966_STATE_CLAIMED 0x02 #define W9966_STATE_VDEV 0x04 @@ -105,8 +105,8 @@ struct w9966_dev { unsigned char dev_state; unsigned char i2c_state; unsigned short ppmode; - struct parport* pport; - struct pardevice* pdev; + struct parport *pport; + struct pardevice *pdev; struct video_device vdev; unsigned short width; unsigned short height; @@ -127,15 +127,15 @@ MODULE_LICENSE("GPL"); #ifdef MODULE -static const char* pardev[] = {[0 ... W9966_MAXCAMS] = ""}; +static const char *pardev[] = {[0 ... W9966_MAXCAMS] = ""}; #else -static const char* pardev[] = {[0 ... W9966_MAXCAMS] = "aggressive"}; +static const char *pardev[] = {[0 ... W9966_MAXCAMS] = "aggressive"}; #endif module_param_array(pardev, charp, NULL, 0); -MODULE_PARM_DESC(pardev, "pardev: where to search for\n\ -\teach camera. 'aggressive' means brute-force search.\n\ -\tEg: >pardev=parport3,aggressive,parport2,parport1< would assign\n\ -\tcam 1 to parport3 and search every parport for cam 2 etc..."); +MODULE_PARM_DESC(pardev, "pardev: where to search for\n" + "\teach camera. 'aggressive' means brute-force search.\n" + "\tEg: >pardev=parport3,aggressive,parport2,parport1< would assign\n" + "\tcam 1 to parport3 and search every parport for cam 2 etc..."); static int parmode; module_param(parmode, int, 0); @@ -154,31 +154,31 @@ static struct w9966_dev w9966_cams[W9966_MAXCAMS]; * Private function declares */ -static inline void w9966_setState(struct w9966_dev* cam, int mask, int val); -static inline int w9966_getState(struct w9966_dev* cam, int mask, int val); +static inline void w9966_setState(struct w9966_dev *cam, int mask, int val); +static inline int w9966_getState(struct w9966_dev *cam, int mask, int val); static inline void w9966_pdev_claim(struct w9966_dev *vdev); static inline void w9966_pdev_release(struct w9966_dev *vdev); -static int w9966_rReg(struct w9966_dev* cam, int reg); -static int w9966_wReg(struct w9966_dev* cam, int reg, int data); +static int w9966_rReg(struct w9966_dev *cam, int reg); +static int w9966_wReg(struct w9966_dev *cam, int reg, int data); #if 0 -static int w9966_rReg_i2c(struct w9966_dev* cam, int reg); +static int w9966_rReg_i2c(struct w9966_dev *cam, int reg); #endif -static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data); +static int w9966_wReg_i2c(struct w9966_dev *cam, int reg, int data); static int w9966_findlen(int near, int size, int maxlen); -static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor); -static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, int w, int h); +static int w9966_calcscale(int size, int min, int max, int *beg, int *end, unsigned char *factor); +static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, int w, int h); -static int w9966_init(struct w9966_dev* cam, struct parport* port); -static void w9966_term(struct w9966_dev* cam); +static int w9966_init(struct w9966_dev *cam, struct parport* port); +static void w9966_term(struct w9966_dev *cam); -static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state); -static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state); -static inline int w9966_i2c_getsda(struct w9966_dev* cam); -static inline int w9966_i2c_getscl(struct w9966_dev* cam); -static int w9966_i2c_wbyte(struct w9966_dev* cam, int data); +static inline void w9966_i2c_setsda(struct w9966_dev *cam, int state); +static inline int w9966_i2c_setscl(struct w9966_dev *cam, int state); +static inline int w9966_i2c_getsda(struct w9966_dev *cam); +static inline int w9966_i2c_getscl(struct w9966_dev *cam); +static int w9966_i2c_wbyte(struct w9966_dev *cam, int data); #if 0 -static int w9966_i2c_rbyte(struct w9966_dev* cam); +static int w9966_i2c_rbyte(struct w9966_dev *cam); #endif static long w9966_v4l_ioctl(struct file *file, @@ -219,20 +219,20 @@ static struct video_device w9966_template = { */ -// Set camera phase flags, so we know what to uninit when terminating -static inline void w9966_setState(struct w9966_dev* cam, int mask, int val) +/* Set camera phase flags, so we know what to uninit when terminating */ +static inline void w9966_setState(struct w9966_dev *cam, int mask, int val) { cam->dev_state = (cam->dev_state & ~mask) ^ val; } -// Get camera phase flags -static inline int w9966_getState(struct w9966_dev* cam, int mask, int val) +/* Get camera phase flags */ +static inline int w9966_getState(struct w9966_dev *cam, int mask, int val) { return ((cam->dev_state & mask) == val); } -// Claim parport for ourself -static inline void w9966_pdev_claim(struct w9966_dev* cam) +/* Claim parport for ourself */ +static inline void w9966_pdev_claim(struct w9966_dev *cam) { if (w9966_getState(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED)) return; @@ -240,8 +240,8 @@ static inline void w9966_pdev_claim(struct w9966_dev* cam) w9966_setState(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED); } -// Release parport for others to use -static inline void w9966_pdev_release(struct w9966_dev* cam) +/* Release parport for others to use */ +static inline void w9966_pdev_release(struct w9966_dev *cam) { if (w9966_getState(cam, W9966_STATE_CLAIMED, 0)) return; @@ -249,12 +249,12 @@ static inline void w9966_pdev_release(struct w9966_dev* cam) w9966_setState(cam, W9966_STATE_CLAIMED, 0); } -// Read register from W9966 interface-chip -// Expects a claimed pdev -// -1 on error, else register data (byte) -static int w9966_rReg(struct w9966_dev* cam, int reg) +/* Read register from W9966 interface-chip + Expects a claimed pdev + -1 on error, else register data (byte) */ +static int w9966_rReg(struct w9966_dev *cam, int reg) { - // ECP, read, regtransfer, REG, REG, REG, REG, REG + /* ECP, read, regtransfer, REG, REG, REG, REG, REG */ const unsigned char addr = 0x80 | (reg & 0x1f); unsigned char val; @@ -270,12 +270,12 @@ static int w9966_rReg(struct w9966_dev* cam, int reg) return val; } -// Write register to W9966 interface-chip -// Expects a claimed pdev -// -1 on error -static int w9966_wReg(struct w9966_dev* cam, int reg, int data) +/* Write register to W9966 interface-chip + Expects a claimed pdev + -1 on error */ +static int w9966_wReg(struct w9966_dev *cam, int reg, int data) { - // ECP, write, regtransfer, REG, REG, REG, REG, REG + /* ECP, write, regtransfer, REG, REG, REG, REG, REG */ const unsigned char addr = 0xc0 | (reg & 0x1f); const unsigned char val = data; @@ -291,11 +291,11 @@ static int w9966_wReg(struct w9966_dev* cam, int reg, int data) return 0; } -// Initialize camera device. Setup all internal flags, set a -// default video mode, setup ccd-chip, register v4l device etc.. -// Also used for 'probing' of hardware. -// -1 on error -static int w9966_init(struct w9966_dev* cam, struct parport* port) +/* Initialize camera device. Setup all internal flags, set a + default video mode, setup ccd-chip, register v4l device etc.. + Also used for 'probing' of hardware. + -1 on error */ +static int w9966_init(struct w9966_dev *cam, struct parport* port) { if (cam->dev_state != 0) return -1; @@ -306,10 +306,9 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) cam->color = 64; cam->hue = 0; -// Select requested transfer mode - switch(parmode) - { - default: // Auto-detect (priority: hw-ecp, hw-epp, sw-ecp) +/* Select requested transfer mode */ + switch (parmode) { + default: /* Auto-detect (priority: hw-ecp, hw-epp, sw-ecp) */ case 0: if (port->modes & PARPORT_MODE_ECP) cam->ppmode = IEEE1284_MODE_ECP; @@ -318,15 +317,15 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) else cam->ppmode = IEEE1284_MODE_ECP; break; - case 1: // hw- or sw-ecp + case 1: /* hw- or sw-ecp */ cam->ppmode = IEEE1284_MODE_ECP; break; - case 2: // hw- or sw-epp + case 2: /* hw- or sw-epp */ cam->ppmode = IEEE1284_MODE_EPP; break; } -// Tell the parport driver that we exists +/* Tell the parport driver that we exists */ cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); if (cam->pdev == NULL) { DPRINTF("parport_register_device() failed\n"); @@ -336,7 +335,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) w9966_pdev_claim(cam); -// Setup a default capture mode +/* Setup a default capture mode */ if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { DPRINTF("w9966_setup() failed.\n"); return -1; @@ -344,7 +343,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) w9966_pdev_release(cam); -// Fill in the video_device struct and register us to v4l +/* Fill in the video_device struct and register us to v4l */ memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); video_set_drvdata(&cam->vdev, cam); @@ -353,32 +352,30 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); - // All ok - printk( - "w9966cf: Found and initialized a webcam on %s.\n", - cam->pport->name - ); + /* All ok */ + printk(KERN_INFO "w9966cf: Found and initialized a webcam on %s.\n", + cam->pport->name); return 0; } -// Terminate everything gracefully -static void w9966_term(struct w9966_dev* cam) +/* Terminate everything gracefully */ +static void w9966_term(struct w9966_dev *cam) { -// Unregister from v4l +/* Unregister from v4l */ if (w9966_getState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) { video_unregister_device(&cam->vdev); w9966_setState(cam, W9966_STATE_VDEV, 0); } -// Terminate from IEEE1284 mode and release pdev block +/* Terminate from IEEE1284 mode and release pdev block */ if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { w9966_pdev_claim(cam); parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT); w9966_pdev_release(cam); } -// Unregister from parport +/* Unregister from parport */ if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { parport_unregister_device(cam->pdev); w9966_setState(cam, W9966_STATE_PDEV, 0); @@ -386,24 +383,23 @@ static void w9966_term(struct w9966_dev* cam) } -// Find a good length for capture window (used both for W and H) -// A bit ugly but pretty functional. The capture length -// have to match the downscale +/* Find a good length for capture window (used both for W and H) + A bit ugly but pretty functional. The capture length + have to match the downscale */ static int w9966_findlen(int near, int size, int maxlen) { int bestlen = size; int besterr = abs(near - bestlen); int len; - for(len = size+1;len < maxlen;len++) - { + for (len = size + 1; len < maxlen; len++) { int err; - if ( ((64*size) %len) != 0) + if (((64 * size) % len) != 0) continue; err = abs(near - len); - // Only continue as long as we keep getting better values + /* Only continue as long as we keep getting better values */ if (err > besterr) break; @@ -414,32 +410,32 @@ static int w9966_findlen(int near, int size, int maxlen) return bestlen; } -// Modify capture window (if necessary) -// and calculate downscaling -// Return -1 on error -static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor) +/* Modify capture window (if necessary) + and calculate downscaling + Return -1 on error */ +static int w9966_calcscale(int size, int min, int max, int *beg, int *end, unsigned char *factor) { int maxlen = max - min; int len = *end - *beg + 1; int newlen = w9966_findlen(len, size, maxlen); int err = newlen - len; - // Check for bad format + /* Check for bad format */ if (newlen > maxlen || newlen < size) return -1; - // Set factor (6 bit fixed) - *factor = (64*size) / newlen; + /* Set factor (6 bit fixed) */ + *factor = (64 * size) / newlen; if (*factor == 64) - *factor = 0x00; // downscale is disabled + *factor = 0x00; /* downscale is disabled */ else - *factor |= 0x80; // set downscale-enable bit + *factor |= 0x80; /* set downscale-enable bit */ - // Modify old beginning and end + /* Modify old beginning and end */ *beg -= err / 2; *end += err - (err / 2); - // Move window if outside borders + /* Move window if outside borders */ if (*beg < min) { *end += min - *beg; *beg += min - *beg; @@ -452,10 +448,10 @@ static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsig return 0; } -// Setup the cameras capture window etc. -// Expects a claimed pdev -// return -1 on error -static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, int w, int h) +/* Setup the cameras capture window etc. + Expects a claimed pdev + return -1 on error */ +static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, int w, int h) { unsigned int i; unsigned int enh_s, enh_e; @@ -469,84 +465,84 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in }; - if (w*h*2 > W9966_SRAMSIZE) - { + if (w * h * 2 > W9966_SRAMSIZE) { DPRINTF("capture window exceeds SRAM size!.\n"); - w = 200; h = 160; // Pick default values + w = 200; h = 160; /* Pick default values */ } w &= ~0x1; - if (w < 2) w = 2; - if (h < 1) h = 1; - if (w > W9966_WND_MAX_W) w = W9966_WND_MAX_W; - if (h > W9966_WND_MAX_H) h = W9966_WND_MAX_H; + if (w < 2) + w = 2; + if (h < 1) + h = 1; + if (w > W9966_WND_MAX_W) + w = W9966_WND_MAX_W; + if (h > W9966_WND_MAX_H) + h = W9966_WND_MAX_H; cam->width = w; cam->height = h; enh_s = 0; - enh_e = w*h*2; - -// Modify capture window if necessary and calculate downscaling - if ( - w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || - w9966_calcscale(h, W9966_WND_MIN_Y, W9966_WND_MAX_Y, &y1, &y2, &scale_y) != 0 - ) return -1; - - DPRINTF( - "%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", - w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80 - ); - -// Setup registers - regs[0x00] = 0x00; // Set normal operation - regs[0x01] = 0x18; // Capture mode - regs[0x02] = scale_y; // V-scaling - regs[0x03] = scale_x; // H-scaling - - // Capture window - regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits) - regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits) - regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits) - regs[0x07] = (y1 & 0x300)>>8; // Y-start (2 high bits) - regs[0x08] = (x2 & 0x0ff); // X-end (8 low bits) - regs[0x09] = (x2 & 0x300)>>8; // X-end (2 high bits) - regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits) - - regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb) - - // Enhancement layer - regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7) - regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15) - regs[0x0f] = (enh_s& 0x70000)>>16; // Enh. start (16-17/18??) - regs[0x10] = (enh_e& 0x000ff); // Enh. end (0-7) - regs[0x11] = (enh_e& 0x0ff00)>>8; // Enh. end (8-15) - regs[0x12] = (enh_e& 0x70000)>>16; // Enh. end (16-17/18??) - - // Misc - regs[0x13] = 0x40; // VEE control (raw 4:2:2) - regs[0x17] = 0x00; // ??? - regs[0x18] = cam->i2c_state = 0x00; // Serial bus - regs[0x19] = 0xff; // I/O port direction control - regs[0x1a] = 0xff; // I/O port data register - regs[0x1b] = 0x10; // ??? - - // SAA7111 chip settings + enh_e = w * h * 2; + +/* Modify capture window if necessary and calculate downscaling */ + if (w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || + w9966_calcscale(h, W9966_WND_MIN_Y, W9966_WND_MAX_Y, &y1, &y2, &scale_y) != 0) + return -1; + + DPRINTF("%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", + w, h, x1, x2, y1, y2, scale_x & ~0x80, scale_y & ~0x80); + +/* Setup registers */ + regs[0x00] = 0x00; /* Set normal operation */ + regs[0x01] = 0x18; /* Capture mode */ + regs[0x02] = scale_y; /* V-scaling */ + regs[0x03] = scale_x; /* H-scaling */ + + /* Capture window */ + regs[0x04] = (x1 & 0x0ff); /* X-start (8 low bits) */ + regs[0x05] = (x1 & 0x300)>>8; /* X-start (2 high bits) */ + regs[0x06] = (y1 & 0x0ff); /* Y-start (8 low bits) */ + regs[0x07] = (y1 & 0x300)>>8; /* Y-start (2 high bits) */ + regs[0x08] = (x2 & 0x0ff); /* X-end (8 low bits) */ + regs[0x09] = (x2 & 0x300)>>8; /* X-end (2 high bits) */ + regs[0x0a] = (y2 & 0x0ff); /* Y-end (8 low bits) */ + + regs[0x0c] = W9966_SRAMID; /* SRAM-banks (1x 128kb) */ + + /* Enhancement layer */ + regs[0x0d] = (enh_s & 0x000ff); /* Enh. start (0-7) */ + regs[0x0e] = (enh_s & 0x0ff00) >> 8; /* Enh. start (8-15) */ + regs[0x0f] = (enh_s & 0x70000) >> 16; /* Enh. start (16-17/18??) */ + regs[0x10] = (enh_e & 0x000ff); /* Enh. end (0-7) */ + regs[0x11] = (enh_e & 0x0ff00) >> 8; /* Enh. end (8-15) */ + regs[0x12] = (enh_e & 0x70000) >> 16; /* Enh. end (16-17/18??) */ + + /* Misc */ + regs[0x13] = 0x40; /* VEE control (raw 4:2:2) */ + regs[0x17] = 0x00; /* ??? */ + regs[0x18] = cam->i2c_state = 0x00; /* Serial bus */ + regs[0x19] = 0xff; /* I/O port direction control */ + regs[0x1a] = 0xff; /* I/O port data register */ + regs[0x1b] = 0x10; /* ??? */ + + /* SAA7111 chip settings */ saa7111_regs[0x0a] = cam->brightness; saa7111_regs[0x0b] = cam->contrast; saa7111_regs[0x0c] = cam->color; saa7111_regs[0x0d] = cam->hue; -// Reset (ECP-fifo & serial-bus) +/* Reset (ECP-fifo & serial-bus) */ if (w9966_wReg(cam, 0x00, 0x03) == -1) return -1; -// Write regs to w9966cf chip +/* Write regs to w9966cf chip */ for (i = 0; i < 0x1c; i++) if (w9966_wReg(cam, i, regs[i]) == -1) return -1; -// Write regs to saa7111 chip +/* Write regs to saa7111 chip */ for (i = 0; i < 0x20; i++) if (w9966_wReg_i2c(cam, i, saa7111_regs[i]) == -1) return -1; @@ -558,9 +554,9 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in * Ugly and primitive i2c protocol functions */ -// Sets the data line on the i2c bus. -// Expects a claimed pdev. -static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state) +/* Sets the data line on the i2c bus. + Expects a claimed pdev. */ +static inline void w9966_i2c_setsda(struct w9966_dev *cam, int state) { if (state) cam->i2c_state |= W9966_I2C_W_DATA; @@ -571,17 +567,17 @@ static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state) udelay(5); } -// Get peripheral clock line -// Expects a claimed pdev. -static inline int w9966_i2c_getscl(struct w9966_dev* cam) +/* Get peripheral clock line + Expects a claimed pdev. */ +static inline int w9966_i2c_getscl(struct w9966_dev *cam) { const unsigned char state = w9966_rReg(cam, 0x18); return ((state & W9966_I2C_R_CLOCK) > 0); } -// Sets the clock line on the i2c bus. -// Expects a claimed pdev. -1 on error -static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state) +/* Sets the clock line on the i2c bus. + Expects a claimed pdev. -1 on error */ +static inline int w9966_i2c_setscl(struct w9966_dev *cam, int state) { unsigned long timeout; @@ -593,7 +589,7 @@ static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state) w9966_wReg(cam, 0x18, cam->i2c_state); udelay(5); - // we go to high, we also expect the peripheral to ack. + /* we go to high, we also expect the peripheral to ack. */ if (state) { timeout = jiffies + 100; while (!w9966_i2c_getscl(cam)) { @@ -604,21 +600,21 @@ static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state) return 0; } -// Get peripheral data line -// Expects a claimed pdev. -static inline int w9966_i2c_getsda(struct w9966_dev* cam) +/* Get peripheral data line + Expects a claimed pdev. */ +static inline int w9966_i2c_getsda(struct w9966_dev *cam) { const unsigned char state = w9966_rReg(cam, 0x18); return ((state & W9966_I2C_R_DATA) > 0); } -// Write a byte with ack to the i2c bus. -// Expects a claimed pdev. -1 on error -static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) +/* Write a byte with ack to the i2c bus. + Expects a claimed pdev. -1 on error */ +static int w9966_i2c_wbyte(struct w9966_dev *cam, int data) { int i; - for (i = 7; i >= 0; i--) - { + + for (i = 7; i >= 0; i--) { w9966_i2c_setsda(cam, (data >> i) & 0x01); if (w9966_i2c_setscl(cam, 1) == -1) @@ -635,18 +631,17 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) return 0; } -// Read a data byte with ack from the i2c-bus -// Expects a claimed pdev. -1 on error +/* Read a data byte with ack from the i2c-bus + Expects a claimed pdev. -1 on error */ #if 0 -static int w9966_i2c_rbyte(struct w9966_dev* cam) +static int w9966_i2c_rbyte(struct w9966_dev *cam) { unsigned char data = 0x00; int i; w9966_i2c_setsda(cam, 1); - for (i = 0; i < 8; i++) - { + for (i = 0; i < 8; i++) { if (w9966_i2c_setscl(cam, 1) == -1) return -1; data = data << 1; @@ -659,20 +654,18 @@ static int w9966_i2c_rbyte(struct w9966_dev* cam) } #endif -// Read a register from the i2c device. -// Expects claimed pdev. -1 on error +/* Read a register from the i2c device. + Expects claimed pdev. -1 on error */ #if 0 -static int w9966_rReg_i2c(struct w9966_dev* cam, int reg) +static int w9966_rReg_i2c(struct w9966_dev *cam, int reg) { int data; w9966_i2c_setsda(cam, 0); w9966_i2c_setscl(cam, 0); - if ( - w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || - w9966_i2c_wbyte(cam, reg) == -1 - ) + if (w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || + w9966_i2c_wbyte(cam, reg) == -1) return -1; w9966_i2c_setsda(cam, 1); @@ -681,10 +674,10 @@ static int w9966_rReg_i2c(struct w9966_dev* cam, int reg) w9966_i2c_setsda(cam, 0); w9966_i2c_setscl(cam, 0); - if ( - w9966_i2c_wbyte(cam, W9966_I2C_R_ID) == -1 || - (data = w9966_i2c_rbyte(cam)) == -1 - ) + if (w9966_i2c_wbyte(cam, W9966_I2C_R_ID) == -1) + return -1; + data = w9966_i2c_rbyte(cam); + if (data == -1) return -1; w9966_i2c_setsda(cam, 0); @@ -697,18 +690,16 @@ static int w9966_rReg_i2c(struct w9966_dev* cam, int reg) } #endif -// Write a register to the i2c device. -// Expects claimed pdev. -1 on error -static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data) +/* Write a register to the i2c device. + Expects claimed pdev. -1 on error */ +static int w9966_wReg_i2c(struct w9966_dev *cam, int reg, int data) { w9966_i2c_setsda(cam, 0); w9966_i2c_setscl(cam, 0); - if ( - w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || - w9966_i2c_wbyte(cam, reg) == -1 || - w9966_i2c_wbyte(cam, data) == -1 - ) + if (w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || + w9966_i2c_wbyte(cam, reg) == -1 || + w9966_i2c_wbyte(cam, data) == -1) return -1; w9966_i2c_setsda(cam, 0); @@ -728,8 +719,7 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct w9966_dev *cam = video_drvdata(file); - switch(cmd) - { + switch (cmd) { case VIDIOCGCAP: { static struct video_capability vcap = { @@ -748,9 +738,9 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) case VIDIOCGCHAN: { struct video_channel *vch = arg; - if(vch->channel != 0) // We only support one channel (#0) + if (vch->channel != 0) /* We only support one channel (#0) */ return -EINVAL; - memset(vch,0,sizeof(*vch)); + memset(vch, 0, sizeof(*vch)); strcpy(vch->name, "CCD-input"); vch->type = VIDEO_TYPE_CAMERA; return 0; @@ -758,14 +748,14 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) case VIDIOCSCHAN: { struct video_channel *vch = arg; - if(vch->channel != 0) + if (vch->channel != 0) return -EINVAL; return 0; } case VIDIOCGTUNER: { struct video_tuner *vtune = arg; - if(vtune->tuner != 0) + if (vtune->tuner != 0) return -EINVAL; strcpy(vtune->name, "no tuner"); vtune->rangelow = 0; @@ -787,12 +777,12 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) case VIDIOCGPICT: { struct video_picture vpic = { - cam->brightness << 8, // brightness - (cam->hue + 128) << 8, // hue - cam->color << 9, // color - cam->contrast << 9, // contrast - 0x8000, // whiteness - 16, VIDEO_PALETTE_YUV422// bpp, palette format + cam->brightness << 8, /* brightness */ + (cam->hue + 128) << 8, /* hue */ + cam->color << 9, /* color */ + cam->contrast << 9, /* contrast */ + 0x8000, /* whiteness */ + 16, VIDEO_PALETTE_YUV422/* bpp, palette format */ }; struct video_picture *pic = arg; *pic = vpic; @@ -838,7 +828,7 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) return -EINVAL; - // Update camera regs + /* Update camera regs */ w9966_pdev_claim(cam); ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); w9966_pdev_release(cam); @@ -858,7 +848,7 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) vwin->height = cam->height; return 0; } - // Unimplemented + /* Unimplemented */ case VIDIOCCAPTURE: case VIDIOCGFBUF: case VIDIOCSFBUF: @@ -880,31 +870,29 @@ static long w9966_v4l_ioctl(struct file *file, return video_usercopy(file, cmd, arg, w9966_v4l_do_ioctl); } -// Capture data +/* Capture data */ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct w9966_dev *cam = video_drvdata(file); - unsigned char addr = 0xa0; // ECP, read, CCD-transfer, 00000 + unsigned char addr = 0xa0; /* ECP, read, CCD-transfer, 00000 */ unsigned char __user *dest = (unsigned char __user *)buf; unsigned long dleft = count; unsigned char *tbuf; - // Why would anyone want more than this?? + /* Why would anyone want more than this?? */ if (count > cam->width * cam->height * 2) return -EINVAL; w9966_pdev_claim(cam); - w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer - w9966_wReg(cam, 0x00, 0x00); // Return to normal operation - w9966_wReg(cam, 0x01, 0x98); // Enable capture - - // write special capture-addr and negotiate into data transfer - if ( - (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )|| - (parport_write(cam->pport, &addr, 1) != 1 )|| - (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_DATA) != 0 ) - ) { + w9966_wReg(cam, 0x00, 0x02); /* Reset ECP-FIFO buffer */ + w9966_wReg(cam, 0x00, 0x00); /* Return to normal operation */ + w9966_wReg(cam, 0x01, 0x98); /* Enable capture */ + + /* write special capture-addr and negotiate into data transfer */ + if ((parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0) || + (parport_write(cam->pport, &addr, 1) != 1) || + (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_DATA) != 0)) { w9966_pdev_release(cam); return -EFAULT; } @@ -915,8 +903,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, goto out; } - while(dleft > 0) - { + while (dleft > 0) { unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft; if (parport_read(cam->pport, tbuf, tsize) < tsize) { @@ -931,7 +918,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, dleft -= tsize; } - w9966_wReg(cam, 0x01, 0x18); // Disable capture + w9966_wReg(cam, 0x01, 0x18); /* Disable capture */ out: kfree(tbuf); @@ -941,33 +928,30 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, } -// Called once for every parport on init +/* Called once for every parport on init */ static void w9966_attach(struct parport *port) { int i; - for (i = 0; i < W9966_MAXCAMS; i++) - { - if (w9966_cams[i].dev_state != 0) // Cam is already assigned + for (i = 0; i < W9966_MAXCAMS; i++) { + if (w9966_cams[i].dev_state != 0) /* Cam is already assigned */ continue; - if ( - strcmp(pardev[i], "aggressive") == 0 || - strcmp(pardev[i], port->name) == 0 - ) { + if (strcmp(pardev[i], "aggressive") == 0 || strcmp(pardev[i], port->name) == 0) { if (w9966_init(&w9966_cams[i], port) != 0) - w9966_term(&w9966_cams[i]); - break; // return + w9966_term(&w9966_cams[i]); + break; /* return */ } } } -// Called once for every parport on termination +/* Called once for every parport on termination */ static void w9966_detach(struct parport *port) { int i; + for (i = 0; i < W9966_MAXCAMS; i++) - if (w9966_cams[i].dev_state != 0 && w9966_cams[i].pport == port) - w9966_term(&w9966_cams[i]); + if (w9966_cams[i].dev_state != 0 && w9966_cams[i].pport == port) + w9966_term(&w9966_cams[i]); } @@ -977,17 +961,18 @@ static struct parport_driver w9966_ppd = { .detach = w9966_detach, }; -// Module entry point +/* Module entry point */ static int __init w9966_mod_init(void) { int i; + for (i = 0; i < W9966_MAXCAMS; i++) w9966_cams[i].dev_state = 0; return parport_register_driver(&w9966_ppd); } -// Module cleanup +/* Module cleanup */ static void __exit w9966_mod_term(void) { parport_unregister_driver(&w9966_ppd); -- GitLab From b3e212dcbddb10b44d472a5f4c23d5aa0b5876ca Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 04:52:21 -0300 Subject: [PATCH 239/534] V4L/DVB: v4l: add V4L2_PIX_FMT_Y4 and V4L2_PIX_FMT_Y6 pixelformats Old 4 and 6 bit greyscale pixel formats for the old bw-qcam webcam. This is needed to convert it to V4L2. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/v4l/pixfmt.xml | 12 ++++++++++++ include/linux/videodev2.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/Documentation/DocBook/v4l/pixfmt.xml b/Documentation/DocBook/v4l/pixfmt.xml index 885968d6a2fc..c4ad0a8e42dc 100644 --- a/Documentation/DocBook/v4l/pixfmt.xml +++ b/Documentation/DocBook/v4l/pixfmt.xml @@ -792,6 +792,18 @@ http://www.thedirks.org/winnov/ 'YYUV' unknown + + V4L2_PIX_FMT_Y4 + 'Y04 ' + Old 4-bit greyscale format. Only the least significant 4 bits of each byte are used, +the other bits are set to 0. + + + V4L2_PIX_FMT_Y6 + 'Y06 ' + Old 6-bit greyscale format. Only the least significant 6 bits of each byte are used, +the other bits are set to 0. + diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 418dacf5261d..6fb0b2daa5b9 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -294,6 +294,8 @@ struct v4l2_pix_format { /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ +#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ +#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ -- GitLab From 467422678e9e73bff8d175024cdd89ed48483697 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 05:09:07 -0300 Subject: [PATCH 240/534] V4L/DVB: pms: remove unnecessary exclusive open/close Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/pms.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 0598bbd3f368..7129b50757db 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c @@ -61,7 +61,6 @@ struct pms { int depth; int input; s32 brightness, saturation, hue, contrast; - unsigned long in_use; struct mutex lock; int i2c_count; struct i2c_info i2cinfo[64]; @@ -931,25 +930,8 @@ static ssize_t pms_read(struct file *file, char __user *buf, return len; } -static int pms_exclusive_open(struct file *file) -{ - struct pms *dev = video_drvdata(file); - - return test_and_set_bit(0, &dev->in_use) ? -EBUSY : 0; -} - -static int pms_exclusive_release(struct file *file) -{ - struct pms *dev = video_drvdata(file); - - clear_bit(0, &dev->in_use); - return 0; -} - static const struct v4l2_file_operations pms_fops = { .owner = THIS_MODULE, - .open = pms_exclusive_open, - .release = pms_exclusive_release, .ioctl = video_ioctl2, .read = pms_read, }; -- GitLab From 271922c0cee0b086ca2fe9cec39d585a44a2358b Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 05:13:17 -0300 Subject: [PATCH 241/534] V4L/DVB: w9966: reorganize the order of functions Get rid of completely unnecessary function prototypes. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/w9966.c | 567 +++++++++++++++++------------------- 1 file changed, 265 insertions(+), 302 deletions(-) diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index 25364b8f857b..7d5be0700413 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c @@ -144,76 +144,8 @@ MODULE_PARM_DESC(parmode, "parmode: transfer mode (0=auto, 1=ecp, 2=epp"); static int video_nr = -1; module_param(video_nr, int, 0); -/* - * Private data - */ - static struct w9966_dev w9966_cams[W9966_MAXCAMS]; -/* - * Private function declares - */ - -static inline void w9966_setState(struct w9966_dev *cam, int mask, int val); -static inline int w9966_getState(struct w9966_dev *cam, int mask, int val); -static inline void w9966_pdev_claim(struct w9966_dev *vdev); -static inline void w9966_pdev_release(struct w9966_dev *vdev); - -static int w9966_rReg(struct w9966_dev *cam, int reg); -static int w9966_wReg(struct w9966_dev *cam, int reg, int data); -#if 0 -static int w9966_rReg_i2c(struct w9966_dev *cam, int reg); -#endif -static int w9966_wReg_i2c(struct w9966_dev *cam, int reg, int data); -static int w9966_findlen(int near, int size, int maxlen); -static int w9966_calcscale(int size, int min, int max, int *beg, int *end, unsigned char *factor); -static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, int w, int h); - -static int w9966_init(struct w9966_dev *cam, struct parport* port); -static void w9966_term(struct w9966_dev *cam); - -static inline void w9966_i2c_setsda(struct w9966_dev *cam, int state); -static inline int w9966_i2c_setscl(struct w9966_dev *cam, int state); -static inline int w9966_i2c_getsda(struct w9966_dev *cam); -static inline int w9966_i2c_getscl(struct w9966_dev *cam); -static int w9966_i2c_wbyte(struct w9966_dev *cam, int data); -#if 0 -static int w9966_i2c_rbyte(struct w9966_dev *cam); -#endif - -static long w9966_v4l_ioctl(struct file *file, - unsigned int cmd, unsigned long arg); -static ssize_t w9966_v4l_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos); - -static int w9966_exclusive_open(struct file *file) -{ - struct w9966_dev *cam = video_drvdata(file); - - return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0; -} - -static int w9966_exclusive_release(struct file *file) -{ - struct w9966_dev *cam = video_drvdata(file); - - clear_bit(0, &cam->in_use); - return 0; -} - -static const struct v4l2_file_operations w9966_fops = { - .owner = THIS_MODULE, - .open = w9966_exclusive_open, - .release = w9966_exclusive_release, - .ioctl = w9966_v4l_ioctl, - .read = w9966_v4l_read, -}; -static struct video_device w9966_template = { - .name = W9966_DRIVERNAME, - .fops = &w9966_fops, - .release = video_device_release_empty, -}; - /* * Private function defines */ @@ -232,7 +164,7 @@ static inline int w9966_getState(struct w9966_dev *cam, int mask, int val) } /* Claim parport for ourself */ -static inline void w9966_pdev_claim(struct w9966_dev *cam) +static void w9966_pdev_claim(struct w9966_dev *cam) { if (w9966_getState(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED)) return; @@ -241,7 +173,7 @@ static inline void w9966_pdev_claim(struct w9966_dev *cam) } /* Release parport for others to use */ -static inline void w9966_pdev_release(struct w9966_dev *cam) +static void w9966_pdev_release(struct w9966_dev *cam) { if (w9966_getState(cam, W9966_STATE_CLAIMED, 0)) return; @@ -291,97 +223,168 @@ static int w9966_wReg(struct w9966_dev *cam, int reg, int data) return 0; } -/* Initialize camera device. Setup all internal flags, set a - default video mode, setup ccd-chip, register v4l device etc.. - Also used for 'probing' of hardware. - -1 on error */ -static int w9966_init(struct w9966_dev *cam, struct parport* port) +/* + * Ugly and primitive i2c protocol functions + */ + +/* Sets the data line on the i2c bus. + Expects a claimed pdev. */ +static void w9966_i2c_setsda(struct w9966_dev *cam, int state) { - if (cam->dev_state != 0) - return -1; + if (state) + cam->i2c_state |= W9966_I2C_W_DATA; + else + cam->i2c_state &= ~W9966_I2C_W_DATA; - cam->pport = port; - cam->brightness = 128; - cam->contrast = 64; - cam->color = 64; - cam->hue = 0; + w9966_wReg(cam, 0x18, cam->i2c_state); + udelay(5); +} -/* Select requested transfer mode */ - switch (parmode) { - default: /* Auto-detect (priority: hw-ecp, hw-epp, sw-ecp) */ - case 0: - if (port->modes & PARPORT_MODE_ECP) - cam->ppmode = IEEE1284_MODE_ECP; - else if (port->modes & PARPORT_MODE_EPP) - cam->ppmode = IEEE1284_MODE_EPP; - else - cam->ppmode = IEEE1284_MODE_ECP; - break; - case 1: /* hw- or sw-ecp */ - cam->ppmode = IEEE1284_MODE_ECP; - break; - case 2: /* hw- or sw-epp */ - cam->ppmode = IEEE1284_MODE_EPP; - break; +/* Get peripheral clock line + Expects a claimed pdev. */ +static int w9966_i2c_getscl(struct w9966_dev *cam) +{ + const unsigned char state = w9966_rReg(cam, 0x18); + return ((state & W9966_I2C_R_CLOCK) > 0); +} + +/* Sets the clock line on the i2c bus. + Expects a claimed pdev. -1 on error */ +static int w9966_i2c_setscl(struct w9966_dev *cam, int state) +{ + unsigned long timeout; + + if (state) + cam->i2c_state |= W9966_I2C_W_CLOCK; + else + cam->i2c_state &= ~W9966_I2C_W_CLOCK; + + w9966_wReg(cam, 0x18, cam->i2c_state); + udelay(5); + + /* we go to high, we also expect the peripheral to ack. */ + if (state) { + timeout = jiffies + 100; + while (!w9966_i2c_getscl(cam)) { + if (time_after(jiffies, timeout)) + return -1; + } } + return 0; +} -/* Tell the parport driver that we exists */ - cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); - if (cam->pdev == NULL) { - DPRINTF("parport_register_device() failed\n"); - return -1; +#if 0 +/* Get peripheral data line + Expects a claimed pdev. */ +static int w9966_i2c_getsda(struct w9966_dev *cam) +{ + const unsigned char state = w9966_rReg(cam, 0x18); + return ((state & W9966_I2C_R_DATA) > 0); +} +#endif + +/* Write a byte with ack to the i2c bus. + Expects a claimed pdev. -1 on error */ +static int w9966_i2c_wbyte(struct w9966_dev *cam, int data) +{ + int i; + + for (i = 7; i >= 0; i--) { + w9966_i2c_setsda(cam, (data >> i) & 0x01); + + if (w9966_i2c_setscl(cam, 1) == -1) + return -1; + w9966_i2c_setscl(cam, 0); } - w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); - w9966_pdev_claim(cam); + w9966_i2c_setsda(cam, 1); -/* Setup a default capture mode */ - if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { - DPRINTF("w9966_setup() failed.\n"); + if (w9966_i2c_setscl(cam, 1) == -1) return -1; + w9966_i2c_setscl(cam, 0); + + return 0; +} + +/* Read a data byte with ack from the i2c-bus + Expects a claimed pdev. -1 on error */ +#if 0 +static int w9966_i2c_rbyte(struct w9966_dev *cam) +{ + unsigned char data = 0x00; + int i; + + w9966_i2c_setsda(cam, 1); + + for (i = 0; i < 8; i++) { + if (w9966_i2c_setscl(cam, 1) == -1) + return -1; + data = data << 1; + if (w9966_i2c_getsda(cam)) + data |= 0x01; + + w9966_i2c_setscl(cam, 0); } + return data; +} +#endif - w9966_pdev_release(cam); +/* Read a register from the i2c device. + Expects claimed pdev. -1 on error */ +#if 0 +static int w9966_rReg_i2c(struct w9966_dev *cam, int reg) +{ + int data; -/* Fill in the video_device struct and register us to v4l */ - memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); - video_set_drvdata(&cam->vdev, cam); + w9966_i2c_setsda(cam, 0); + w9966_i2c_setscl(cam, 0); - if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) + if (w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || + w9966_i2c_wbyte(cam, reg) == -1) return -1; - w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); + w9966_i2c_setsda(cam, 1); + if (w9966_i2c_setscl(cam, 1) == -1) + return -1; + w9966_i2c_setsda(cam, 0); + w9966_i2c_setscl(cam, 0); - /* All ok */ - printk(KERN_INFO "w9966cf: Found and initialized a webcam on %s.\n", - cam->pport->name); - return 0; -} + if (w9966_i2c_wbyte(cam, W9966_I2C_R_ID) == -1) + return -1; + data = w9966_i2c_rbyte(cam); + if (data == -1) + return -1; + w9966_i2c_setsda(cam, 0); -/* Terminate everything gracefully */ -static void w9966_term(struct w9966_dev *cam) + if (w9966_i2c_setscl(cam, 1) == -1) + return -1; + w9966_i2c_setsda(cam, 1); + + return data; +} +#endif + +/* Write a register to the i2c device. + Expects claimed pdev. -1 on error */ +static int w9966_wReg_i2c(struct w9966_dev *cam, int reg, int data) { -/* Unregister from v4l */ - if (w9966_getState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) { - video_unregister_device(&cam->vdev); - w9966_setState(cam, W9966_STATE_VDEV, 0); - } + w9966_i2c_setsda(cam, 0); + w9966_i2c_setscl(cam, 0); -/* Terminate from IEEE1284 mode and release pdev block */ - if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { - w9966_pdev_claim(cam); - parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT); - w9966_pdev_release(cam); - } + if (w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || + w9966_i2c_wbyte(cam, reg) == -1 || + w9966_i2c_wbyte(cam, data) == -1) + return -1; -/* Unregister from parport */ - if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { - parport_unregister_device(cam->pdev); - w9966_setState(cam, W9966_STATE_PDEV, 0); - } -} + w9966_i2c_setsda(cam, 0); + if (w9966_i2c_setscl(cam, 1) == -1) + return -1; + + w9966_i2c_setsda(cam, 1); + return 0; +} /* Find a good length for capture window (used both for W and H) A bit ugly but pretty functional. The capture length @@ -551,171 +554,10 @@ static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, in } /* - * Ugly and primitive i2c protocol functions + * Video4linux interfacing */ -/* Sets the data line on the i2c bus. - Expects a claimed pdev. */ -static inline void w9966_i2c_setsda(struct w9966_dev *cam, int state) -{ - if (state) - cam->i2c_state |= W9966_I2C_W_DATA; - else - cam->i2c_state &= ~W9966_I2C_W_DATA; - - w9966_wReg(cam, 0x18, cam->i2c_state); - udelay(5); -} - -/* Get peripheral clock line - Expects a claimed pdev. */ -static inline int w9966_i2c_getscl(struct w9966_dev *cam) -{ - const unsigned char state = w9966_rReg(cam, 0x18); - return ((state & W9966_I2C_R_CLOCK) > 0); -} - -/* Sets the clock line on the i2c bus. - Expects a claimed pdev. -1 on error */ -static inline int w9966_i2c_setscl(struct w9966_dev *cam, int state) -{ - unsigned long timeout; - - if (state) - cam->i2c_state |= W9966_I2C_W_CLOCK; - else - cam->i2c_state &= ~W9966_I2C_W_CLOCK; - - w9966_wReg(cam, 0x18, cam->i2c_state); - udelay(5); - - /* we go to high, we also expect the peripheral to ack. */ - if (state) { - timeout = jiffies + 100; - while (!w9966_i2c_getscl(cam)) { - if (time_after(jiffies, timeout)) - return -1; - } - } - return 0; -} - -/* Get peripheral data line - Expects a claimed pdev. */ -static inline int w9966_i2c_getsda(struct w9966_dev *cam) -{ - const unsigned char state = w9966_rReg(cam, 0x18); - return ((state & W9966_I2C_R_DATA) > 0); -} - -/* Write a byte with ack to the i2c bus. - Expects a claimed pdev. -1 on error */ -static int w9966_i2c_wbyte(struct w9966_dev *cam, int data) -{ - int i; - - for (i = 7; i >= 0; i--) { - w9966_i2c_setsda(cam, (data >> i) & 0x01); - - if (w9966_i2c_setscl(cam, 1) == -1) - return -1; - w9966_i2c_setscl(cam, 0); - } - - w9966_i2c_setsda(cam, 1); - - if (w9966_i2c_setscl(cam, 1) == -1) - return -1; - w9966_i2c_setscl(cam, 0); - - return 0; -} - -/* Read a data byte with ack from the i2c-bus - Expects a claimed pdev. -1 on error */ -#if 0 -static int w9966_i2c_rbyte(struct w9966_dev *cam) -{ - unsigned char data = 0x00; - int i; - - w9966_i2c_setsda(cam, 1); - - for (i = 0; i < 8; i++) { - if (w9966_i2c_setscl(cam, 1) == -1) - return -1; - data = data << 1; - if (w9966_i2c_getsda(cam)) - data |= 0x01; - - w9966_i2c_setscl(cam, 0); - } - return data; -} -#endif - -/* Read a register from the i2c device. - Expects claimed pdev. -1 on error */ -#if 0 -static int w9966_rReg_i2c(struct w9966_dev *cam, int reg) -{ - int data; - - w9966_i2c_setsda(cam, 0); - w9966_i2c_setscl(cam, 0); - - if (w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || - w9966_i2c_wbyte(cam, reg) == -1) - return -1; - - w9966_i2c_setsda(cam, 1); - if (w9966_i2c_setscl(cam, 1) == -1) - return -1; - w9966_i2c_setsda(cam, 0); - w9966_i2c_setscl(cam, 0); - - if (w9966_i2c_wbyte(cam, W9966_I2C_R_ID) == -1) - return -1; - data = w9966_i2c_rbyte(cam); - if (data == -1) - return -1; - - w9966_i2c_setsda(cam, 0); - - if (w9966_i2c_setscl(cam, 1) == -1) - return -1; - w9966_i2c_setsda(cam, 1); - - return data; -} -#endif - -/* Write a register to the i2c device. - Expects claimed pdev. -1 on error */ -static int w9966_wReg_i2c(struct w9966_dev *cam, int reg, int data) -{ - w9966_i2c_setsda(cam, 0); - w9966_i2c_setscl(cam, 0); - - if (w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || - w9966_i2c_wbyte(cam, reg) == -1 || - w9966_i2c_wbyte(cam, data) == -1) - return -1; - - w9966_i2c_setsda(cam, 0); - if (w9966_i2c_setscl(cam, 1) == -1) - return -1; - - w9966_i2c_setsda(cam, 1); - - return 0; -} - -/* - * Video4linux interfacing - */ - -static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) +static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) { struct w9966_dev *cam = video_drvdata(file); @@ -927,6 +769,127 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, return count; } +static int w9966_exclusive_open(struct file *file) +{ + struct w9966_dev *cam = video_drvdata(file); + + return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0; +} + +static int w9966_exclusive_release(struct file *file) +{ + struct w9966_dev *cam = video_drvdata(file); + + clear_bit(0, &cam->in_use); + return 0; +} + +static const struct v4l2_file_operations w9966_fops = { + .owner = THIS_MODULE, + .open = w9966_exclusive_open, + .release = w9966_exclusive_release, + .ioctl = w9966_v4l_ioctl, + .read = w9966_v4l_read, +}; + +static struct video_device w9966_template = { + .name = W9966_DRIVERNAME, + .fops = &w9966_fops, + .release = video_device_release_empty, +}; + + +/* Initialize camera device. Setup all internal flags, set a + default video mode, setup ccd-chip, register v4l device etc.. + Also used for 'probing' of hardware. + -1 on error */ +static int w9966_init(struct w9966_dev *cam, struct parport* port) +{ + if (cam->dev_state != 0) + return -1; + + cam->pport = port; + cam->brightness = 128; + cam->contrast = 64; + cam->color = 64; + cam->hue = 0; + +/* Select requested transfer mode */ + switch (parmode) { + default: /* Auto-detect (priority: hw-ecp, hw-epp, sw-ecp) */ + case 0: + if (port->modes & PARPORT_MODE_ECP) + cam->ppmode = IEEE1284_MODE_ECP; + else if (port->modes & PARPORT_MODE_EPP) + cam->ppmode = IEEE1284_MODE_EPP; + else + cam->ppmode = IEEE1284_MODE_ECP; + break; + case 1: /* hw- or sw-ecp */ + cam->ppmode = IEEE1284_MODE_ECP; + break; + case 2: /* hw- or sw-epp */ + cam->ppmode = IEEE1284_MODE_EPP; + break; + } + +/* Tell the parport driver that we exists */ + cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); + if (cam->pdev == NULL) { + DPRINTF("parport_register_device() failed\n"); + return -1; + } + w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); + + w9966_pdev_claim(cam); + +/* Setup a default capture mode */ + if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { + DPRINTF("w9966_setup() failed.\n"); + return -1; + } + + w9966_pdev_release(cam); + +/* Fill in the video_device struct and register us to v4l */ + memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); + video_set_drvdata(&cam->vdev, cam); + + if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) + return -1; + + w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); + + /* All ok */ + printk(KERN_INFO "w9966cf: Found and initialized a webcam on %s.\n", + cam->pport->name); + return 0; +} + + +/* Terminate everything gracefully */ +static void w9966_term(struct w9966_dev *cam) +{ +/* Unregister from v4l */ + if (w9966_getState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) { + video_unregister_device(&cam->vdev); + w9966_setState(cam, W9966_STATE_VDEV, 0); + } + +/* Terminate from IEEE1284 mode and release pdev block */ + if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { + w9966_pdev_claim(cam); + parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT); + w9966_pdev_release(cam); + } + +/* Unregister from parport */ + if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { + parport_unregister_device(cam->pdev); + w9966_setState(cam, W9966_STATE_PDEV, 0); + } +} + /* Called once for every parport on init */ static void w9966_attach(struct parport *port) -- GitLab From c1f2b0f29e51cf44eb6addff1b90f99988055a92 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 05:15:14 -0300 Subject: [PATCH 242/534] V4L/DVB: w9966: remove camelCase Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/w9966.c | 336 ++++++++++++++++++------------------ 1 file changed, 168 insertions(+), 168 deletions(-) diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index 7d5be0700413..b0719976845e 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c @@ -133,9 +133,9 @@ static const char *pardev[] = {[0 ... W9966_MAXCAMS] = "aggressive"}; #endif module_param_array(pardev, charp, NULL, 0); MODULE_PARM_DESC(pardev, "pardev: where to search for\n" - "\teach camera. 'aggressive' means brute-force search.\n" - "\tEg: >pardev=parport3,aggressive,parport2,parport1< would assign\n" - "\tcam 1 to parport3 and search every parport for cam 2 etc..."); + "\teach camera. 'aggressive' means brute-force search.\n" + "\tEg: >pardev=parport3,aggressive,parport2,parport1< would assign\n" + "\tcam 1 to parport3 and search every parport for cam 2 etc..."); static int parmode; module_param(parmode, int, 0); @@ -152,13 +152,13 @@ static struct w9966_dev w9966_cams[W9966_MAXCAMS]; /* Set camera phase flags, so we know what to uninit when terminating */ -static inline void w9966_setState(struct w9966_dev *cam, int mask, int val) +static inline void w9966_set_state(struct w9966_dev *cam, int mask, int val) { cam->dev_state = (cam->dev_state & ~mask) ^ val; } /* Get camera phase flags */ -static inline int w9966_getState(struct w9966_dev *cam, int mask, int val) +static inline int w9966_get_state(struct w9966_dev *cam, int mask, int val) { return ((cam->dev_state & mask) == val); } @@ -166,25 +166,25 @@ static inline int w9966_getState(struct w9966_dev *cam, int mask, int val) /* Claim parport for ourself */ static void w9966_pdev_claim(struct w9966_dev *cam) { - if (w9966_getState(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED)) + if (w9966_get_state(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED)) return; parport_claim_or_block(cam->pdev); - w9966_setState(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED); + w9966_set_state(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED); } /* Release parport for others to use */ static void w9966_pdev_release(struct w9966_dev *cam) { - if (w9966_getState(cam, W9966_STATE_CLAIMED, 0)) + if (w9966_get_state(cam, W9966_STATE_CLAIMED, 0)) return; parport_release(cam->pdev); - w9966_setState(cam, W9966_STATE_CLAIMED, 0); + w9966_set_state(cam, W9966_STATE_CLAIMED, 0); } /* Read register from W9966 interface-chip Expects a claimed pdev -1 on error, else register data (byte) */ -static int w9966_rReg(struct w9966_dev *cam, int reg) +static int w9966_read_reg(struct w9966_dev *cam, int reg) { /* ECP, read, regtransfer, REG, REG, REG, REG, REG */ const unsigned char addr = 0x80 | (reg & 0x1f); @@ -205,7 +205,7 @@ static int w9966_rReg(struct w9966_dev *cam, int reg) /* Write register to W9966 interface-chip Expects a claimed pdev -1 on error */ -static int w9966_wReg(struct w9966_dev *cam, int reg, int data) +static int w9966_write_reg(struct w9966_dev *cam, int reg, int data) { /* ECP, write, regtransfer, REG, REG, REG, REG, REG */ const unsigned char addr = 0xc0 | (reg & 0x1f); @@ -236,7 +236,7 @@ static void w9966_i2c_setsda(struct w9966_dev *cam, int state) else cam->i2c_state &= ~W9966_I2C_W_DATA; - w9966_wReg(cam, 0x18, cam->i2c_state); + w9966_write_reg(cam, 0x18, cam->i2c_state); udelay(5); } @@ -244,7 +244,7 @@ static void w9966_i2c_setsda(struct w9966_dev *cam, int state) Expects a claimed pdev. */ static int w9966_i2c_getscl(struct w9966_dev *cam) { - const unsigned char state = w9966_rReg(cam, 0x18); + const unsigned char state = w9966_read_reg(cam, 0x18); return ((state & W9966_I2C_R_CLOCK) > 0); } @@ -259,7 +259,7 @@ static int w9966_i2c_setscl(struct w9966_dev *cam, int state) else cam->i2c_state &= ~W9966_I2C_W_CLOCK; - w9966_wReg(cam, 0x18, cam->i2c_state); + w9966_write_reg(cam, 0x18, cam->i2c_state); udelay(5); /* we go to high, we also expect the peripheral to ack. */ @@ -278,7 +278,7 @@ static int w9966_i2c_setscl(struct w9966_dev *cam, int state) Expects a claimed pdev. */ static int w9966_i2c_getsda(struct w9966_dev *cam) { - const unsigned char state = w9966_rReg(cam, 0x18); + const unsigned char state = w9966_read_reg(cam, 0x18); return ((state & W9966_I2C_R_DATA) > 0); } #endif @@ -332,7 +332,7 @@ static int w9966_i2c_rbyte(struct w9966_dev *cam) /* Read a register from the i2c device. Expects claimed pdev. -1 on error */ #if 0 -static int w9966_rReg_i2c(struct w9966_dev *cam, int reg) +static int w9966_read_reg_i2c(struct w9966_dev *cam, int reg) { int data; @@ -367,14 +367,14 @@ static int w9966_rReg_i2c(struct w9966_dev *cam, int reg) /* Write a register to the i2c device. Expects claimed pdev. -1 on error */ -static int w9966_wReg_i2c(struct w9966_dev *cam, int reg, int data) +static int w9966_write_reg_i2c(struct w9966_dev *cam, int reg, int data) { w9966_i2c_setsda(cam, 0); w9966_i2c_setscl(cam, 0); if (w9966_i2c_wbyte(cam, W9966_I2C_W_ID) == -1 || - w9966_i2c_wbyte(cam, reg) == -1 || - w9966_i2c_wbyte(cam, data) == -1) + w9966_i2c_wbyte(cam, reg) == -1 || + w9966_i2c_wbyte(cam, data) == -1) return -1; w9966_i2c_setsda(cam, 0); @@ -489,15 +489,15 @@ static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, in enh_s = 0; enh_e = w * h * 2; -/* Modify capture window if necessary and calculate downscaling */ + /* Modify capture window if necessary and calculate downscaling */ if (w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || - w9966_calcscale(h, W9966_WND_MIN_Y, W9966_WND_MAX_Y, &y1, &y2, &scale_y) != 0) + w9966_calcscale(h, W9966_WND_MIN_Y, W9966_WND_MAX_Y, &y1, &y2, &scale_y) != 0) return -1; DPRINTF("%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", - w, h, x1, x2, y1, y2, scale_x & ~0x80, scale_y & ~0x80); + w, h, x1, x2, y1, y2, scale_x & ~0x80, scale_y & ~0x80); -/* Setup registers */ + /* Setup registers */ regs[0x00] = 0x00; /* Set normal operation */ regs[0x01] = 0x18; /* Capture mode */ regs[0x02] = scale_y; /* V-scaling */ @@ -536,18 +536,18 @@ static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, in saa7111_regs[0x0c] = cam->color; saa7111_regs[0x0d] = cam->hue; -/* Reset (ECP-fifo & serial-bus) */ - if (w9966_wReg(cam, 0x00, 0x03) == -1) + /* Reset (ECP-fifo & serial-bus) */ + if (w9966_write_reg(cam, 0x00, 0x03) == -1) return -1; -/* Write regs to w9966cf chip */ + /* Write regs to w9966cf chip */ for (i = 0; i < 0x1c; i++) - if (w9966_wReg(cam, i, regs[i]) == -1) + if (w9966_write_reg(cam, i, regs[i]) == -1) return -1; -/* Write regs to saa7111 chip */ + /* Write regs to saa7111 chip */ for (i = 0; i < 0x20; i++) - if (w9966_wReg_i2c(cam, i, saa7111_regs[i]) == -1) + if (w9966_write_reg_i2c(cam, i, saa7111_regs[i]) == -1) return -1; return 0; @@ -563,134 +563,134 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) switch (cmd) { case VIDIOCGCAP: - { - static struct video_capability vcap = { - .name = W9966_DRIVERNAME, - .type = VID_TYPE_CAPTURE | VID_TYPE_SCALES, - .channels = 1, - .maxwidth = W9966_WND_MAX_W, - .maxheight = W9966_WND_MAX_H, - .minwidth = 2, - .minheight = 1, - }; - struct video_capability *cap = arg; - *cap = vcap; - return 0; - } + { + static struct video_capability vcap = { + .name = W9966_DRIVERNAME, + .type = VID_TYPE_CAPTURE | VID_TYPE_SCALES, + .channels = 1, + .maxwidth = W9966_WND_MAX_W, + .maxheight = W9966_WND_MAX_H, + .minwidth = 2, + .minheight = 1, + }; + struct video_capability *cap = arg; + *cap = vcap; + return 0; + } case VIDIOCGCHAN: - { - struct video_channel *vch = arg; - if (vch->channel != 0) /* We only support one channel (#0) */ - return -EINVAL; - memset(vch, 0, sizeof(*vch)); - strcpy(vch->name, "CCD-input"); - vch->type = VIDEO_TYPE_CAMERA; - return 0; - } + { + struct video_channel *vch = arg; + if (vch->channel != 0) /* We only support one channel (#0) */ + return -EINVAL; + memset(vch, 0, sizeof(*vch)); + strcpy(vch->name, "CCD-input"); + vch->type = VIDEO_TYPE_CAMERA; + return 0; + } case VIDIOCSCHAN: - { - struct video_channel *vch = arg; - if (vch->channel != 0) - return -EINVAL; - return 0; - } + { + struct video_channel *vch = arg; + if (vch->channel != 0) + return -EINVAL; + return 0; + } case VIDIOCGTUNER: - { - struct video_tuner *vtune = arg; - if (vtune->tuner != 0) - return -EINVAL; - strcpy(vtune->name, "no tuner"); - vtune->rangelow = 0; - vtune->rangehigh = 0; - vtune->flags = VIDEO_TUNER_NORM; - vtune->mode = VIDEO_MODE_AUTO; - vtune->signal = 0xffff; - return 0; - } + { + struct video_tuner *vtune = arg; + if (vtune->tuner != 0) + return -EINVAL; + strcpy(vtune->name, "no tuner"); + vtune->rangelow = 0; + vtune->rangehigh = 0; + vtune->flags = VIDEO_TUNER_NORM; + vtune->mode = VIDEO_MODE_AUTO; + vtune->signal = 0xffff; + return 0; + } case VIDIOCSTUNER: - { - struct video_tuner *vtune = arg; - if (vtune->tuner != 0) - return -EINVAL; - if (vtune->mode != VIDEO_MODE_AUTO) - return -EINVAL; - return 0; - } + { + struct video_tuner *vtune = arg; + if (vtune->tuner != 0) + return -EINVAL; + if (vtune->mode != VIDEO_MODE_AUTO) + return -EINVAL; + return 0; + } case VIDIOCGPICT: - { - struct video_picture vpic = { - cam->brightness << 8, /* brightness */ - (cam->hue + 128) << 8, /* hue */ - cam->color << 9, /* color */ - cam->contrast << 9, /* contrast */ - 0x8000, /* whiteness */ - 16, VIDEO_PALETTE_YUV422/* bpp, palette format */ - }; - struct video_picture *pic = arg; - *pic = vpic; - return 0; - } + { + struct video_picture vpic = { + cam->brightness << 8, /* brightness */ + (cam->hue + 128) << 8, /* hue */ + cam->color << 9, /* color */ + cam->contrast << 9, /* contrast */ + 0x8000, /* whiteness */ + 16, VIDEO_PALETTE_YUV422/* bpp, palette format */ + }; + struct video_picture *pic = arg; + *pic = vpic; + return 0; + } case VIDIOCSPICT: - { - struct video_picture *vpic = arg; - if (vpic->depth != 16 || (vpic->palette != VIDEO_PALETTE_YUV422 && vpic->palette != VIDEO_PALETTE_YUYV)) - return -EINVAL; - - cam->brightness = vpic->brightness >> 8; - cam->hue = (vpic->hue >> 8) - 128; - cam->color = vpic->colour >> 9; - cam->contrast = vpic->contrast >> 9; + { + struct video_picture *vpic = arg; + if (vpic->depth != 16 || (vpic->palette != VIDEO_PALETTE_YUV422 && vpic->palette != VIDEO_PALETTE_YUYV)) + return -EINVAL; + + cam->brightness = vpic->brightness >> 8; + cam->hue = (vpic->hue >> 8) - 128; + cam->color = vpic->colour >> 9; + cam->contrast = vpic->contrast >> 9; + + w9966_pdev_claim(cam); + + if ( + w9966_write_reg_i2c(cam, 0x0a, cam->brightness) == -1 || + w9966_write_reg_i2c(cam, 0x0b, cam->contrast) == -1 || + w9966_write_reg_i2c(cam, 0x0c, cam->color) == -1 || + w9966_write_reg_i2c(cam, 0x0d, cam->hue) == -1 + ) { + w9966_pdev_release(cam); + return -EIO; + } - w9966_pdev_claim(cam); - - if ( - w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 || - w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 || - w9966_wReg_i2c(cam, 0x0c, cam->color) == -1 || - w9966_wReg_i2c(cam, 0x0d, cam->hue) == -1 - ) { w9966_pdev_release(cam); - return -EIO; + return 0; } - - w9966_pdev_release(cam); - return 0; - } case VIDIOCSWIN: - { - int ret; - struct video_window *vwin = arg; - - if (vwin->flags != 0) - return -EINVAL; - if (vwin->clipcount != 0) - return -EINVAL; - if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) - return -EINVAL; - if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) - return -EINVAL; - - /* Update camera regs */ - w9966_pdev_claim(cam); - ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); - w9966_pdev_release(cam); + { + int ret; + struct video_window *vwin = arg; + + if (vwin->flags != 0) + return -EINVAL; + if (vwin->clipcount != 0) + return -EINVAL; + if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) + return -EINVAL; + if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) + return -EINVAL; + + /* Update camera regs */ + w9966_pdev_claim(cam); + ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); + w9966_pdev_release(cam); - if (ret != 0) { - DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); - return -EIO; - } + if (ret != 0) { + DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); + return -EIO; + } - return 0; - } + return 0; + } case VIDIOCGWIN: - { - struct video_window *vwin = arg; - memset(vwin, 0, sizeof(*vwin)); - vwin->width = cam->width; - vwin->height = cam->height; - return 0; - } - /* Unimplemented */ + { + struct video_window *vwin = arg; + memset(vwin, 0, sizeof(*vwin)); + vwin->width = cam->width; + vwin->height = cam->height; + return 0; + } + /* Unimplemented */ case VIDIOCCAPTURE: case VIDIOCGFBUF: case VIDIOCSFBUF: @@ -707,14 +707,14 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) } static long w9966_v4l_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { return video_usercopy(file, cmd, arg, w9966_v4l_do_ioctl); } /* Capture data */ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) + size_t count, loff_t *ppos) { struct w9966_dev *cam = video_drvdata(file); unsigned char addr = 0xa0; /* ECP, read, CCD-transfer, 00000 */ @@ -727,14 +727,14 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, return -EINVAL; w9966_pdev_claim(cam); - w9966_wReg(cam, 0x00, 0x02); /* Reset ECP-FIFO buffer */ - w9966_wReg(cam, 0x00, 0x00); /* Return to normal operation */ - w9966_wReg(cam, 0x01, 0x98); /* Enable capture */ + w9966_write_reg(cam, 0x00, 0x02); /* Reset ECP-FIFO buffer */ + w9966_write_reg(cam, 0x00, 0x00); /* Return to normal operation */ + w9966_write_reg(cam, 0x01, 0x98); /* Enable capture */ /* write special capture-addr and negotiate into data transfer */ if ((parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0) || - (parport_write(cam->pport, &addr, 1) != 1) || - (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_DATA) != 0)) { + (parport_write(cam->pport, &addr, 1) != 1) || + (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_DATA) != 0)) { w9966_pdev_release(cam); return -EFAULT; } @@ -760,7 +760,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, dleft -= tsize; } - w9966_wReg(cam, 0x01, 0x18); /* Disable capture */ + w9966_write_reg(cam, 0x01, 0x18); /* Disable capture */ out: kfree(tbuf); @@ -814,7 +814,7 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port) cam->color = 64; cam->hue = 0; -/* Select requested transfer mode */ + /* Select requested transfer mode */ switch (parmode) { default: /* Auto-detect (priority: hw-ecp, hw-epp, sw-ecp) */ case 0: @@ -830,20 +830,20 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port) break; case 2: /* hw- or sw-epp */ cam->ppmode = IEEE1284_MODE_EPP; - break; + break; } -/* Tell the parport driver that we exists */ + /* Tell the parport driver that we exists */ cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); if (cam->pdev == NULL) { DPRINTF("parport_register_device() failed\n"); return -1; } - w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); + w9966_set_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); w9966_pdev_claim(cam); -/* Setup a default capture mode */ + /* Setup a default capture mode */ if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { DPRINTF("w9966_setup() failed.\n"); return -1; @@ -851,18 +851,18 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port) w9966_pdev_release(cam); -/* Fill in the video_device struct and register us to v4l */ + /* Fill in the video_device struct and register us to v4l */ memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); video_set_drvdata(&cam->vdev, cam); if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) return -1; - w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); + w9966_set_state(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); /* All ok */ printk(KERN_INFO "w9966cf: Found and initialized a webcam on %s.\n", - cam->pport->name); + cam->pport->name); return 0; } @@ -870,23 +870,23 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port) /* Terminate everything gracefully */ static void w9966_term(struct w9966_dev *cam) { -/* Unregister from v4l */ - if (w9966_getState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) { + /* Unregister from v4l */ + if (w9966_get_state(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) { video_unregister_device(&cam->vdev); - w9966_setState(cam, W9966_STATE_VDEV, 0); + w9966_set_state(cam, W9966_STATE_VDEV, 0); } -/* Terminate from IEEE1284 mode and release pdev block */ - if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { + /* Terminate from IEEE1284 mode and release pdev block */ + if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { w9966_pdev_claim(cam); parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT); w9966_pdev_release(cam); } -/* Unregister from parport */ - if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { + /* Unregister from parport */ + if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) { parport_unregister_device(cam->pdev); - w9966_setState(cam, W9966_STATE_PDEV, 0); + w9966_set_state(cam, W9966_STATE_PDEV, 0); } } -- GitLab From 51270617a52793c423ef68ddd3f18745e9abd15b Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 05:22:34 -0300 Subject: [PATCH 243/534] V4L/DVB: meye: remove last V4L1 remnants from the code and add v4l2_device Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/Kconfig | 2 +- drivers/media/video/meye.c | 78 +++++++++++++++++++------------------ drivers/media/video/meye.h | 10 +++-- include/linux/meye.h | 12 +++--- 4 files changed, 55 insertions(+), 47 deletions(-) diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 9644cf760aaa..2ed76f97bf6c 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -740,7 +740,7 @@ source "drivers/media/video/zoran/Kconfig" config VIDEO_MEYE tristate "Sony Vaio Picturebook Motion Eye Video For Linux" - depends on PCI && SONY_LAPTOP && VIDEO_V4L1 + depends on PCI && SONY_LAPTOP && VIDEO_V4L2 ---help--- This is the video4linux driver for the Motion Eye camera found in the Vaio Picturebook laptops. Please read the material in diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 4404e5ef818f..2be23bccd3c8 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c @@ -30,9 +30,10 @@ #include #include #include -#include #include +#include #include +#include #include #include #include @@ -1168,22 +1169,22 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c) case V4L2_CID_BRIGHTNESS: sony_pic_camera_command( SONY_PIC_COMMAND_SETCAMERABRIGHTNESS, c->value); - meye.picture.brightness = c->value << 10; + meye.brightness = c->value << 10; break; case V4L2_CID_HUE: sony_pic_camera_command( SONY_PIC_COMMAND_SETCAMERAHUE, c->value); - meye.picture.hue = c->value << 10; + meye.hue = c->value << 10; break; case V4L2_CID_CONTRAST: sony_pic_camera_command( SONY_PIC_COMMAND_SETCAMERACONTRAST, c->value); - meye.picture.contrast = c->value << 10; + meye.contrast = c->value << 10; break; case V4L2_CID_SATURATION: sony_pic_camera_command( SONY_PIC_COMMAND_SETCAMERACOLOR, c->value); - meye.picture.colour = c->value << 10; + meye.colour = c->value << 10; break; case V4L2_CID_AGC: sony_pic_camera_command( @@ -1221,16 +1222,16 @@ static int vidioc_g_ctrl(struct file *file, void *fh, struct v4l2_control *c) mutex_lock(&meye.lock); switch (c->id) { case V4L2_CID_BRIGHTNESS: - c->value = meye.picture.brightness >> 10; + c->value = meye.brightness >> 10; break; case V4L2_CID_HUE: - c->value = meye.picture.hue >> 10; + c->value = meye.hue >> 10; break; case V4L2_CID_CONTRAST: - c->value = meye.picture.contrast >> 10; + c->value = meye.contrast >> 10; break; case V4L2_CID_SATURATION: - c->value = meye.picture.colour >> 10; + c->value = meye.colour >> 10; break; case V4L2_CID_AGC: c->value = meye.params.agc; @@ -1729,6 +1730,7 @@ static int meye_resume(struct pci_dev *pdev) static int __devinit meye_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) { + struct v4l2_device *v4l2_dev = &meye.v4l2_dev; int ret = -EBUSY; unsigned long mchip_adr; @@ -1737,70 +1739,75 @@ static int __devinit meye_probe(struct pci_dev *pcidev, goto outnotdev; } + ret = v4l2_device_register(&pcidev->dev, v4l2_dev); + if (ret < 0) { + v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); + return ret; + } ret = -ENOMEM; meye.mchip_dev = pcidev; - meye.video_dev = video_device_alloc(); - if (!meye.video_dev) { - printk(KERN_ERR "meye: video_device_alloc() failed!\n"); + meye.vdev = video_device_alloc(); + if (!meye.vdev) { + v4l2_err(v4l2_dev, "video_device_alloc() failed!\n"); goto outnotdev; } meye.grab_temp = vmalloc(MCHIP_NB_PAGES_MJPEG * PAGE_SIZE); if (!meye.grab_temp) { - printk(KERN_ERR "meye: grab buffer allocation failed\n"); + v4l2_err(v4l2_dev, "grab buffer allocation failed\n"); goto outvmalloc; } spin_lock_init(&meye.grabq_lock); if (kfifo_alloc(&meye.grabq, sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL)) { - printk(KERN_ERR "meye: fifo allocation failed\n"); + v4l2_err(v4l2_dev, "fifo allocation failed\n"); goto outkfifoalloc1; } spin_lock_init(&meye.doneq_lock); if (kfifo_alloc(&meye.doneq, sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL)) { - printk(KERN_ERR "meye: fifo allocation failed\n"); + v4l2_err(v4l2_dev, "fifo allocation failed\n"); goto outkfifoalloc2; } - memcpy(meye.video_dev, &meye_template, sizeof(meye_template)); - meye.video_dev->parent = &meye.mchip_dev->dev; + memcpy(meye.vdev, &meye_template, sizeof(meye_template)); + meye.vdev->v4l2_dev = &meye.v4l2_dev; ret = -EIO; if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) { - printk(KERN_ERR "meye: unable to power on the camera\n"); - printk(KERN_ERR "meye: did you enable the camera in " + v4l2_err(v4l2_dev, "meye: unable to power on the camera\n"); + v4l2_err(v4l2_dev, "meye: did you enable the camera in " "sonypi using the module options ?\n"); goto outsonypienable; } if ((ret = pci_enable_device(meye.mchip_dev))) { - printk(KERN_ERR "meye: pci_enable_device failed\n"); + v4l2_err(v4l2_dev, "meye: pci_enable_device failed\n"); goto outenabledev; } mchip_adr = pci_resource_start(meye.mchip_dev,0); if (!mchip_adr) { - printk(KERN_ERR "meye: mchip has no device base address\n"); + v4l2_err(v4l2_dev, "meye: mchip has no device base address\n"); goto outregions; } if (!request_mem_region(pci_resource_start(meye.mchip_dev, 0), pci_resource_len(meye.mchip_dev, 0), "meye")) { - printk(KERN_ERR "meye: request_mem_region failed\n"); + v4l2_err(v4l2_dev, "meye: request_mem_region failed\n"); goto outregions; } meye.mchip_mmregs = ioremap(mchip_adr, MCHIP_MM_REGS); if (!meye.mchip_mmregs) { - printk(KERN_ERR "meye: ioremap failed\n"); + v4l2_err(v4l2_dev, "meye: ioremap failed\n"); goto outremap; } meye.mchip_irq = pcidev->irq; if (request_irq(meye.mchip_irq, meye_irq, IRQF_DISABLED | IRQF_SHARED, "meye", meye_irq)) { - printk(KERN_ERR "meye: request_irq failed\n"); + v4l2_err(v4l2_dev, "request_irq failed\n"); goto outreqirq; } @@ -1824,21 +1831,18 @@ static int __devinit meye_probe(struct pci_dev *pcidev, msleep(1); mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK); - if (video_register_device(meye.video_dev, VFL_TYPE_GRABBER, + if (video_register_device(meye.vdev, VFL_TYPE_GRABBER, video_nr) < 0) { - printk(KERN_ERR "meye: video_register_device failed\n"); + v4l2_err(v4l2_dev, "video_register_device failed\n"); goto outvideoreg; } mutex_init(&meye.lock); init_waitqueue_head(&meye.proc_list); - meye.picture.depth = 16; - meye.picture.palette = VIDEO_PALETTE_YUV422; - meye.picture.brightness = 32 << 10; - meye.picture.hue = 32 << 10; - meye.picture.colour = 32 << 10; - meye.picture.contrast = 32 << 10; - meye.picture.whiteness = 0; + meye.brightness = 32 << 10; + meye.hue = 32 << 10; + meye.colour = 32 << 10; + meye.contrast = 32 << 10; meye.params.subsample = 0; meye.params.quality = 8; meye.params.sharpness = 32; @@ -1854,9 +1858,9 @@ static int __devinit meye_probe(struct pci_dev *pcidev, sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE, 0); sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC, 48); - printk(KERN_INFO "meye: Motion Eye Camera Driver v%s.\n", + v4l2_info(v4l2_dev, "Motion Eye Camera Driver v%s.\n", MEYE_DRIVER_VERSION); - printk(KERN_INFO "meye: mchip KL5A72002 rev. %d, base %lx, irq %d\n", + v4l2_info(v4l2_dev, "mchip KL5A72002 rev. %d, base %lx, irq %d\n", meye.mchip_dev->revision, mchip_adr, meye.mchip_irq); return 0; @@ -1879,14 +1883,14 @@ static int __devinit meye_probe(struct pci_dev *pcidev, outkfifoalloc1: vfree(meye.grab_temp); outvmalloc: - video_device_release(meye.video_dev); + video_device_release(meye.vdev); outnotdev: return ret; } static void __devexit meye_remove(struct pci_dev *pcidev) { - video_unregister_device(meye.video_dev); + video_unregister_device(meye.vdev); mchip_hic_stop(); diff --git a/drivers/media/video/meye.h b/drivers/media/video/meye.h index 1321ad5d6597..4bdeb03f1644 100644 --- a/drivers/media/video/meye.h +++ b/drivers/media/video/meye.h @@ -31,7 +31,7 @@ #define _MEYE_PRIV_H_ #define MEYE_DRIVER_MAJORVERSION 1 -#define MEYE_DRIVER_MINORVERSION 13 +#define MEYE_DRIVER_MINORVERSION 14 #define MEYE_DRIVER_VERSION __stringify(MEYE_DRIVER_MAJORVERSION) "." \ __stringify(MEYE_DRIVER_MINORVERSION) @@ -289,6 +289,7 @@ struct meye_grab_buffer { /* Motion Eye device structure */ struct meye { + struct v4l2_device v4l2_dev; /* Main v4l2_device struct */ struct pci_dev *mchip_dev; /* pci device */ u8 mchip_irq; /* irq */ u8 mchip_mode; /* actual mchip mode: HIC_MODE... */ @@ -308,8 +309,11 @@ struct meye { struct kfifo doneq; /* queue for grabbed buffers */ spinlock_t doneq_lock; /* lock protecting the queue */ wait_queue_head_t proc_list; /* wait queue */ - struct video_device *video_dev; /* video device parameters */ - struct video_picture picture; /* video picture parameters */ + struct video_device *vdev; /* video device parameters */ + u16 brightness; + u16 hue; + u16 contrast; + u16 colour; struct meye_params params; /* additional parameters */ unsigned long in_use; /* set to 1 if the device is in use */ #ifdef CONFIG_PM diff --git a/include/linux/meye.h b/include/linux/meye.h index 12010ace1f04..0dd49954f746 100644 --- a/include/linux/meye.h +++ b/include/linux/meye.h @@ -44,17 +44,17 @@ struct meye_params { }; /* query the extended parameters */ -#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct meye_params) +#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params) /* set the extended parameters */ -#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOCPRIVATE+1, struct meye_params) +#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params) /* queue a buffer for mjpeg capture */ -#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+2, int) +#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+2, int) /* sync a previously queued mjpeg buffer */ -#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOCPRIVATE+3, int) +#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOC_PRIVATE+3, int) /* get a still uncompressed snapshot */ -#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOCPRIVATE+4) +#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOC_PRIVATE+4) /* get a jpeg compressed snapshot */ -#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOCPRIVATE+5, int) +#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOC_PRIVATE+5, int) /* V4L2 private controls */ #define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE -- GitLab From debff5a79595356b1d10063c5f5a7bcdf1b54bec Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 22 Mar 2010 05:25:46 -0300 Subject: [PATCH 244/534] V4L/DVB: zoran: remove V4L1 videodev.h include Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/zoran/zoran.h | 24 ++++++++++++++---------- drivers/media/video/zoran/zoran_driver.c | 16 ++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/drivers/media/video/zoran/zoran.h b/drivers/media/video/zoran/zoran.h index cb1de7ea197a..8997add1248e 100644 --- a/drivers/media/video/zoran/zoran.h +++ b/drivers/media/video/zoran/zoran.h @@ -33,6 +33,10 @@ #include +#define ZORAN_VIDMODE_PAL 0 +#define ZORAN_VIDMODE_NTSC 1 +#define ZORAN_VIDMODE_SECAM 2 + struct zoran_requestbuffers { unsigned long count; /* Number of buffers for MJPEG grabbing */ unsigned long size; /* Size PER BUFFER in bytes */ @@ -48,7 +52,7 @@ struct zoran_sync { struct zoran_status { int input; /* Input channel, has to be set prior to BUZIOC_G_STATUS */ int signal; /* Returned: 1 if valid video signal detected */ - int norm; /* Returned: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */ + int norm; /* Returned: ZORAN_VIDMODE_PAL or ZORAN_VIDMODE_NTSC */ int color; /* Returned: 1 if color signal detected */ }; @@ -62,7 +66,7 @@ struct zoran_params { /* Main control parameters */ int input; /* Input channel: 0 = Composite, 1 = S-VHS */ - int norm; /* Norm: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */ + int norm; /* Norm: ZORAN_VIDMODE_PAL or ZORAN_VIDMODE_NTSC */ int decimation; /* decimation of captured video, * enlargement of video played back. * Valid values are 1, 2, 4 or 0. @@ -131,13 +135,13 @@ struct zoran_params { /* Private IOCTL to set up for displaying MJPEG */ -#define BUZIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct zoran_params) -#define BUZIOC_S_PARAMS _IOWR('v', BASE_VIDIOCPRIVATE+1, struct zoran_params) -#define BUZIOC_REQBUFS _IOWR('v', BASE_VIDIOCPRIVATE+2, struct zoran_requestbuffers) -#define BUZIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+3, int) -#define BUZIOC_QBUF_PLAY _IOW ('v', BASE_VIDIOCPRIVATE+4, int) -#define BUZIOC_SYNC _IOR ('v', BASE_VIDIOCPRIVATE+5, struct zoran_sync) -#define BUZIOC_G_STATUS _IOWR('v', BASE_VIDIOCPRIVATE+6, struct zoran_status) +#define BUZIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct zoran_params) +#define BUZIOC_S_PARAMS _IOWR('v', BASE_VIDIOC_PRIVATE+1, struct zoran_params) +#define BUZIOC_REQBUFS _IOWR('v', BASE_VIDIOC_PRIVATE+2, struct zoran_requestbuffers) +#define BUZIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+3, int) +#define BUZIOC_QBUF_PLAY _IOW ('v', BASE_VIDIOC_PRIVATE+4, int) +#define BUZIOC_SYNC _IOR ('v', BASE_VIDIOC_PRIVATE+5, struct zoran_sync) +#define BUZIOC_G_STATUS _IOWR('v', BASE_VIDIOC_PRIVATE+6, struct zoran_status) #ifdef __KERNEL__ @@ -401,7 +405,7 @@ struct zoran { spinlock_t spinlock; /* Spinlock */ /* Video for Linux parameters */ - int input; /* card's norm and input - norm=VIDEO_MODE_* */ + int input; /* card's norm and input */ v4l2_std_id norm; /* Current buffer params */ diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index ec41303544e5..6f89d0a096ea 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c @@ -60,7 +60,7 @@ #include -#include +#include #include #include #include "videocodec.h" @@ -1549,11 +1549,11 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) mutex_lock(&zr->resource_lock); if (zr->norm & V4L2_STD_NTSC) - bparams->norm = VIDEO_MODE_NTSC; - else if (zr->norm & V4L2_STD_PAL) - bparams->norm = VIDEO_MODE_PAL; + bparams->norm = ZORAN_VIDMODE_NTSC; + else if (zr->norm & V4L2_STD_SECAM) + bparams->norm = ZORAN_VIDMODE_SECAM; else - bparams->norm = VIDEO_MODE_SECAM; + bparams->norm = ZORAN_VIDMODE_PAL; bparams->input = zr->input; @@ -1789,11 +1789,11 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) bstat->signal = (status & V4L2_IN_ST_NO_SIGNAL) ? 0 : 1; if (norm & V4L2_STD_NTSC) - bstat->norm = VIDEO_MODE_NTSC; + bstat->norm = ZORAN_VIDMODE_NTSC; else if (norm & V4L2_STD_SECAM) - bstat->norm = VIDEO_MODE_SECAM; + bstat->norm = ZORAN_VIDMODE_SECAM; else - bstat->norm = VIDEO_MODE_PAL; + bstat->norm = ZORAN_VIDMODE_PAL; bstat->color = (status & V4L2_IN_ST_NO_COLOR) ? 0 : 1; -- GitLab From b8e56b6f6e5b6c55d4d375cc9ebd79151b44db58 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 29 Mar 2010 16:05:33 -0300 Subject: [PATCH 245/534] V4L/DVB: arv: convert to V4L2 Converted this old V4L1 driver to V4L2. I would like to thank Takeo Takahashi who very kindly tested this driver for me. Much appreciated! Signed-off-by: Hans Verkuil Tested-by: Takeo Takahashi Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/Kconfig | 2 +- drivers/media/video/arv.c | 391 ++++++++++++++++-------------------- 2 files changed, 179 insertions(+), 214 deletions(-) diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 2ed76f97bf6c..fe6771271b2d 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -807,7 +807,7 @@ source "drivers/media/video/saa7164/Kconfig" config VIDEO_M32R_AR tristate "AR devices" - depends on M32R && VIDEO_V4L1 + depends on M32R && VIDEO_V4L2 ---help--- This is a video4linux driver for the Renesas AR (Artificial Retina) camera module. diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index 9f88096a520c..31e7a123d19a 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c @@ -27,8 +27,10 @@ #include #include #include -#include +#include +#include #include +#include #include #include @@ -52,7 +54,7 @@ */ #define USE_INT 0 /* Don't modify */ -#define VERSION "0.03" +#define VERSION "0.04" #define ar_inl(addr) inl((unsigned long)(addr)) #define ar_outl(val, addr) outl((unsigned long)(val), (unsigned long)(addr)) @@ -79,7 +81,7 @@ extern struct cpuinfo_m32r boot_cpu_data; /* bits & bytes per pixel */ #define AR_BITS_PER_PIXEL 16 -#define AR_BYTES_PER_PIXEL (AR_BITS_PER_PIXEL/8) +#define AR_BYTES_PER_PIXEL (AR_BITS_PER_PIXEL / 8) /* line buffer size */ #define AR_LINE_BYTES_VGA (AR_WIDTH_VGA * AR_BYTES_PER_PIXEL) @@ -104,8 +106,9 @@ extern struct cpuinfo_m32r boot_cpu_data; #define AR_MODE_INTERLACE 0 #define AR_MODE_NORMAL 1 -struct ar_device { - struct video_device *vdev; +struct ar { + struct v4l2_device v4l2_dev; + struct video_device vdev; unsigned int start_capture; /* duaring capture in INT. mode. */ #if USE_INT unsigned char *line_buff; /* DMA line buffer */ @@ -116,12 +119,13 @@ struct ar_device { int width, height; int frame_bytes, line_bytes; wait_queue_head_t wait; - unsigned long in_use; struct mutex lock; }; +static struct ar ardev; + static int video_nr = -1; /* video device number (first free) */ -static unsigned char yuv[MAX_AR_FRAME_BYTES]; +static unsigned char yuv[MAX_AR_FRAME_BYTES]; /* module parameters */ /* default frequency */ @@ -133,9 +137,7 @@ module_param(freq, int, 0); module_param(vga, int, 0); module_param(vga_interlace, int, 0); -static int ar_initialize(struct video_device *dev); - -static inline void wait_for_vsync(void) +static void wait_for_vsync(void) { while (ar_inl(ARVCR0) & ARVCR0_VDS) /* wait for VSYNC */ cpu_relax(); @@ -143,7 +145,7 @@ static inline void wait_for_vsync(void) cpu_relax(); } -static inline void wait_acknowledge(void) +static void wait_acknowledge(void) { int i; @@ -156,7 +158,7 @@ static inline void wait_acknowledge(void) /******************************************************************* * I2C functions *******************************************************************/ -void iic(int n, unsigned long addr, unsigned long data1, unsigned long data2, +static void iic(int n, unsigned long addr, unsigned long data1, unsigned long data2, unsigned long data3) { int i; @@ -200,7 +202,7 @@ void iic(int n, unsigned long addr, unsigned long data1, unsigned long data2, } -void init_iic(void) +static void init_iic(void) { DEBUG(1, "init_iic:\n"); @@ -244,7 +246,7 @@ static inline void clear_dma_status(void) ar_outl(0x8000, M32R_DMAEDET_PORTL); /* clear status */ } -static inline void wait_for_vertical_sync(int exp_line) +static void wait_for_vertical_sync(struct ar *ar, int exp_line) { #if CHECK_LOST int tmout = 10000; /* FIXME */ @@ -259,7 +261,7 @@ static inline void wait_for_vertical_sync(int exp_line) break; } if (tmout < 0) - printk(KERN_ERR "arv: lost %d -> %d\n", exp_line, l); + v4l2_err(&ar->v4l2_dev, "lost %d -> %d\n", exp_line, l); #else while (ar_inl(ARVHCOUNT) != exp_line) cpu_relax(); @@ -268,8 +270,7 @@ static inline void wait_for_vertical_sync(int exp_line) static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) { - struct video_device *v = video_devdata(file); - struct ar_device *ar = video_get_drvdata(v); + struct ar *ar = video_drvdata(file); long ret = ar->frame_bytes; /* return read bytes */ unsigned long arvcr1 = 0; unsigned long flags; @@ -304,7 +305,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) ar_outl(ar->line_bytes, M32R_DMA0RBCUT_PORTL); /* reload count (bytes) */ /* - * Okey , kicks AR LSI to invoke an interrupt + * Okay, kick AR LSI to invoke an interrupt */ ar->start_capture = 0; ar_outl(arvcr1 | ARVCR1_HIEN, ARVCR1); @@ -333,7 +334,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) cpu_relax(); if (ar->mode == AR_MODE_INTERLACE && ar->size == AR_SIZE_VGA) { for (h = 0; h < ar->height; h++) { - wait_for_vertical_sync(h); + wait_for_vertical_sync(ar, h); if (h < (AR_HEIGHT_VGA/2)) l = h << 1; else @@ -348,7 +349,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) } } else { for (h = 0; h < ar->height; h++) { - wait_for_vertical_sync(h); + wait_for_vertical_sync(ar, h); ar_outl(virt_to_phys(ar->frame[h]), M32R_DMA0CDA_PORTL); enable_dma(); while (!(ar_inl(M32R_DMAEDET_PORTL) & 0x8000)) @@ -385,7 +386,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) } } if (copy_to_user(buf, yuv, ar->frame_bytes)) { - printk(KERN_ERR "arv: failed while copy_to_user yuv.\n"); + v4l2_err(&ar->v4l2_dev, "failed while copy_to_user yuv.\n"); ret = -EFAULT; goto out_up; } @@ -395,153 +396,127 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) return ret; } -static long ar_do_ioctl(struct file *file, unsigned int cmd, void *arg) +static int ar_querycap(struct file *file, void *priv, + struct v4l2_capability *vcap) { - struct video_device *dev = video_devdata(file); - struct ar_device *ar = video_get_drvdata(dev); - - DEBUG(1, "ar_ioctl()\n"); - switch (cmd) { - case VIDIOCGCAP: - { - struct video_capability *b = arg; - DEBUG(1, "VIDIOCGCAP:\n"); - strcpy(b->name, ar->vdev->name); - b->type = VID_TYPE_CAPTURE; - b->channels = 0; - b->audios = 0; - b->maxwidth = MAX_AR_WIDTH; - b->maxheight = MAX_AR_HEIGHT; - b->minwidth = MIN_AR_WIDTH; - b->minheight = MIN_AR_HEIGHT; - return 0; - } - case VIDIOCGCHAN: - DEBUG(1, "VIDIOCGCHAN:\n"); - return 0; - case VIDIOCSCHAN: - DEBUG(1, "VIDIOCSCHAN:\n"); - return 0; - case VIDIOCGTUNER: - DEBUG(1, "VIDIOCGTUNER:\n"); - return 0; - case VIDIOCSTUNER: - DEBUG(1, "VIDIOCSTUNER:\n"); - return 0; - case VIDIOCGPICT: - DEBUG(1, "VIDIOCGPICT:\n"); - return 0; - case VIDIOCSPICT: - DEBUG(1, "VIDIOCSPICT:\n"); - return 0; - case VIDIOCCAPTURE: - DEBUG(1, "VIDIOCCAPTURE:\n"); + struct ar *ar = video_drvdata(file); + + strlcpy(vcap->driver, ar->vdev.name, sizeof(vcap->driver)); + strlcpy(vcap->card, "Colour AR VGA", sizeof(vcap->card)); + strlcpy(vcap->bus_info, "Platform", sizeof(vcap->bus_info)); + vcap->version = KERNEL_VERSION(0, 0, 4); + vcap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; + return 0; +} + +static int ar_enum_input(struct file *file, void *fh, struct v4l2_input *vin) +{ + if (vin->index > 0) return -EINVAL; - case VIDIOCGWIN: - { - struct video_window *w = arg; - DEBUG(1, "VIDIOCGWIN:\n"); - memset(w, 0, sizeof(*w)); - w->width = ar->width; - w->height = ar->height; - return 0; + strlcpy(vin->name, "Camera", sizeof(vin->name)); + vin->type = V4L2_INPUT_TYPE_CAMERA; + vin->audioset = 0; + vin->tuner = 0; + vin->std = V4L2_STD_ALL; + vin->status = 0; + return 0; +} + +static int ar_g_input(struct file *file, void *fh, unsigned int *inp) +{ + *inp = 0; + return 0; +} + +static int ar_s_input(struct file *file, void *fh, unsigned int inp) +{ + return inp ? -EINVAL : 0; +} + +static int ar_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) +{ + struct ar *ar = video_drvdata(file); + struct v4l2_pix_format *pix = &fmt->fmt.pix; + + pix->width = ar->width; + pix->height = ar->height; + pix->pixelformat = V4L2_PIX_FMT_YUV422P; + pix->field = (ar->mode == AR_MODE_NORMAL) ? V4L2_FIELD_NONE : V4L2_FIELD_INTERLACED; + pix->bytesperline = ar->width; + pix->sizeimage = 2 * ar->width * ar->height; + /* Just a guess */ + pix->colorspace = V4L2_COLORSPACE_SMPTE170M; + return 0; +} + +static int ar_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) +{ + struct ar *ar = video_drvdata(file); + struct v4l2_pix_format *pix = &fmt->fmt.pix; + + if (pix->height <= AR_HEIGHT_QVGA || pix->width <= AR_WIDTH_QVGA) { + pix->height = AR_HEIGHT_QVGA; + pix->width = AR_WIDTH_QVGA; + pix->field = V4L2_FIELD_INTERLACED; + } else { + pix->height = AR_HEIGHT_VGA; + pix->width = AR_WIDTH_VGA; + pix->field = vga_interlace ? V4L2_FIELD_INTERLACED : V4L2_FIELD_NONE; } - case VIDIOCSWIN: - { - struct video_window *w = arg; - DEBUG(1, "VIDIOCSWIN:\n"); - if ((w->width != AR_WIDTH_VGA || w->height != AR_HEIGHT_VGA) && - (w->width != AR_WIDTH_QVGA || w->height != AR_HEIGHT_QVGA)) - return -EINVAL; - - mutex_lock(&ar->lock); - ar->width = w->width; - ar->height = w->height; - if (ar->width == AR_WIDTH_VGA) { - ar->size = AR_SIZE_VGA; - ar->frame_bytes = AR_FRAME_BYTES_VGA; - ar->line_bytes = AR_LINE_BYTES_VGA; - if (vga_interlace) - ar->mode = AR_MODE_INTERLACE; - else - ar->mode = AR_MODE_NORMAL; - } else { - ar->size = AR_SIZE_QVGA; - ar->frame_bytes = AR_FRAME_BYTES_QVGA; - ar->line_bytes = AR_LINE_BYTES_QVGA; + pix->pixelformat = V4L2_PIX_FMT_YUV422P; + pix->bytesperline = ar->width; + pix->sizeimage = 2 * ar->width * ar->height; + /* Just a guess */ + pix->colorspace = V4L2_COLORSPACE_SMPTE170M; + return 0; +} + +static int ar_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) +{ + struct ar *ar = video_drvdata(file); + struct v4l2_pix_format *pix = &fmt->fmt.pix; + int ret = ar_try_fmt_vid_cap(file, fh, fmt); + + if (ret) + return ret; + mutex_lock(&ar->lock); + ar->width = pix->width; + ar->height = pix->height; + if (ar->width == AR_WIDTH_VGA) { + ar->size = AR_SIZE_VGA; + ar->frame_bytes = AR_FRAME_BYTES_VGA; + ar->line_bytes = AR_LINE_BYTES_VGA; + if (vga_interlace) ar->mode = AR_MODE_INTERLACE; - } - mutex_unlock(&ar->lock); - return 0; - } - case VIDIOCGFBUF: - DEBUG(1, "VIDIOCGFBUF:\n"); - return -EINVAL; - case VIDIOCSFBUF: - DEBUG(1, "VIDIOCSFBUF:\n"); - return -EINVAL; - case VIDIOCKEY: - DEBUG(1, "VIDIOCKEY:\n"); - return 0; - case VIDIOCGFREQ: - DEBUG(1, "VIDIOCGFREQ:\n"); - return -EINVAL; - case VIDIOCSFREQ: - DEBUG(1, "VIDIOCSFREQ:\n"); - return -EINVAL; - case VIDIOCGAUDIO: - DEBUG(1, "VIDIOCGAUDIO:\n"); - return -EINVAL; - case VIDIOCSAUDIO: - DEBUG(1, "VIDIOCSAUDIO:\n"); - return -EINVAL; - case VIDIOCSYNC: - DEBUG(1, "VIDIOCSYNC:\n"); - return -EINVAL; - case VIDIOCMCAPTURE: - DEBUG(1, "VIDIOCMCAPTURE:\n"); - return -EINVAL; - case VIDIOCGMBUF: - DEBUG(1, "VIDIOCGMBUF:\n"); - return -EINVAL; - case VIDIOCGUNIT: - DEBUG(1, "VIDIOCGUNIT:\n"); - return -EINVAL; - case VIDIOCGCAPTURE: - DEBUG(1, "VIDIOCGCAPTURE:\n"); - return -EINVAL; - case VIDIOCSCAPTURE: - DEBUG(1, "VIDIOCSCAPTURE:\n"); - return -EINVAL; - case VIDIOCSPLAYMODE: - DEBUG(1, "VIDIOCSPLAYMODE:\n"); - return -EINVAL; - case VIDIOCSWRITEMODE: - DEBUG(1, "VIDIOCSWRITEMODE:\n"); - return -EINVAL; - case VIDIOCGPLAYINFO: - DEBUG(1, "VIDIOCGPLAYINFO:\n"); - return -EINVAL; - case VIDIOCSMICROCODE: - DEBUG(1, "VIDIOCSMICROCODE:\n"); - return -EINVAL; - case VIDIOCGVBIFMT: - DEBUG(1, "VIDIOCGVBIFMT:\n"); - return -EINVAL; - case VIDIOCSVBIFMT: - DEBUG(1, "VIDIOCSVBIFMT:\n"); - return -EINVAL; - default: - DEBUG(1, "Unknown ioctl(0x%08x)\n", cmd); - return -ENOIOCTLCMD; + else + ar->mode = AR_MODE_NORMAL; + } else { + ar->size = AR_SIZE_QVGA; + ar->frame_bytes = AR_FRAME_BYTES_QVGA; + ar->line_bytes = AR_LINE_BYTES_QVGA; + ar->mode = AR_MODE_INTERLACE; } + /* Ok we figured out what to use from our wide choice */ + mutex_unlock(&ar->lock); return 0; } -static long ar_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) +static int ar_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) { - return video_usercopy(file, cmd, arg, ar_do_ioctl); + static struct v4l2_fmtdesc formats[] = { + { 0, 0, 0, + "YUV 4:2:2 Planar", V4L2_PIX_FMT_YUV422P, + { 0, 0, 0, 0 } + }, + }; + enum v4l2_buf_type type = fmt->type; + + if (fmt->index > 0) + return -EINVAL; + + *fmt = formats[fmt->index]; + fmt->type = type; + return 0; } #if USE_INT @@ -550,7 +525,7 @@ static long ar_ioctl(struct file *file, unsigned int cmd, */ static void ar_interrupt(int irq, void *dev) { - struct ar_device *ar = dev; + struct ar *ar = dev; unsigned int line_count; unsigned int line_number; unsigned int arvcr1; @@ -622,9 +597,8 @@ static void ar_interrupt(int irq, void *dev) * 0 is returned in success. * */ -static int ar_initialize(struct video_device *dev) +static int ar_initialize(struct ar *ar) { - struct ar_device *ar = video_get_drvdata(dev); unsigned long cr = 0; int i, found = 0; @@ -665,7 +639,7 @@ static int ar_initialize(struct video_device *dev) if (found == 0) return -ENODEV; - printk(KERN_INFO "arv: Initializing "); + v4l2_info(&ar->v4l2_dev, "Initializing "); iic(2, 0x78, 0x11, 0x01, 0x00); /* start */ iic(3, 0x78, 0x12, 0x00, 0x06); @@ -729,65 +703,55 @@ static int ar_initialize(struct video_device *dev) } -void ar_release(struct video_device *vfd) -{ - struct ar_device *ar = video_get_drvdata(vfd); - mutex_lock(&ar->lock); - video_device_release(vfd); -} - /**************************************************************************** * * Video4Linux Module functions * ****************************************************************************/ -static struct ar_device ardev; - -static int ar_exclusive_open(struct file *file) -{ - return test_and_set_bit(0, &ardev.in_use) ? -EBUSY : 0; -} - -static int ar_exclusive_release(struct file *file) -{ - clear_bit(0, &ardev.in_use); - return 0; -} static const struct v4l2_file_operations ar_fops = { .owner = THIS_MODULE, - .open = ar_exclusive_open, - .release = ar_exclusive_release, .read = ar_read, - .ioctl = ar_ioctl, + .ioctl = video_ioctl2, }; -static struct video_device ar_template = { - .name = "Colour AR VGA", - .fops = &ar_fops, - .release = ar_release, +static const struct v4l2_ioctl_ops ar_ioctl_ops = { + .vidioc_querycap = ar_querycap, + .vidioc_g_input = ar_g_input, + .vidioc_s_input = ar_s_input, + .vidioc_enum_input = ar_enum_input, + .vidioc_enum_fmt_vid_cap = ar_enum_fmt_vid_cap, + .vidioc_g_fmt_vid_cap = ar_g_fmt_vid_cap, + .vidioc_s_fmt_vid_cap = ar_s_fmt_vid_cap, + .vidioc_try_fmt_vid_cap = ar_try_fmt_vid_cap, }; #define ALIGN4(x) ((((int)(x)) & 0x3) == 0) static int __init ar_init(void) { - struct ar_device *ar; + struct ar *ar; + struct v4l2_device *v4l2_dev; int ret; int i; - DEBUG(1, "ar_init:\n"); - ret = -EIO; - printk(KERN_INFO "arv: Colour AR VGA driver %s\n", VERSION); - ar = &ardev; - memset(ar, 0, sizeof(struct ar_device)); + v4l2_dev = &ar->v4l2_dev; + strlcpy(v4l2_dev->name, "arv", sizeof(v4l2_dev->name)); + v4l2_info(v4l2_dev, "Colour AR VGA driver %s\n", VERSION); + + ret = v4l2_device_register(NULL, v4l2_dev); + if (ret < 0) { + v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); + return ret; + } + ret = -EIO; #if USE_INT /* allocate a DMA buffer for 1 line. */ ar->line_buff = kmalloc(MAX_AR_LINE_BYTES, GFP_KERNEL | GFP_DMA); if (ar->line_buff == NULL || !ALIGN4(ar->line_buff)) { - printk(KERN_ERR "arv: buffer allocation failed for DMA.\n"); + v4l2_err(v4l2_dev, "buffer allocation failed for DMA.\n"); ret = -ENOMEM; goto out_end; } @@ -796,19 +760,18 @@ static int __init ar_init(void) for (i = 0; i < MAX_AR_HEIGHT; i++) { ar->frame[i] = kmalloc(MAX_AR_LINE_BYTES, GFP_KERNEL); if (ar->frame[i] == NULL || !ALIGN4(ar->frame[i])) { - printk(KERN_ERR "arv: buffer allocation failed for frame.\n"); + v4l2_err(v4l2_dev, "buffer allocation failed for frame.\n"); ret = -ENOMEM; goto out_line_buff; } } - ar->vdev = video_device_alloc(); - if (!ar->vdev) { - printk(KERN_ERR "arv: video_device_alloc() failed\n"); - return -ENOMEM; - } - memcpy(ar->vdev, &ar_template, sizeof(ar_template)); - video_set_drvdata(ar->vdev, ar); + strlcpy(ar->vdev.name, "Colour AR VGA", sizeof(ar->vdev.name)); + ar->vdev.v4l2_dev = v4l2_dev; + ar->vdev.fops = &ar_fops; + ar->vdev.ioctl_ops = &ar_ioctl_ops; + ar->vdev.release = video_device_release_empty; + video_set_drvdata(&ar->vdev, ar); if (vga) { ar->width = AR_WIDTH_VGA; @@ -833,14 +796,14 @@ static int __init ar_init(void) #if USE_INT if (request_irq(M32R_IRQ_INT3, ar_interrupt, 0, "arv", ar)) { - printk(KERN_ERR "arv: request_irq(%d) failed.\n", M32R_IRQ_INT3); + v4l2_err("request_irq(%d) failed.\n", M32R_IRQ_INT3); ret = -EIO; goto out_irq; } #endif - if (ar_initialize(ar->vdev) != 0) { - printk(KERN_ERR "arv: M64278 not found.\n"); + if (ar_initialize(ar) != 0) { + v4l2_err(v4l2_dev, "M64278 not found.\n"); ret = -ENODEV; goto out_dev; } @@ -851,15 +814,15 @@ static int __init ar_init(void) * device is named "video[0-64]". * video_register_device() initializes h/w using ar_initialize(). */ - if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) { + if (video_register_device(&ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) { /* return -1, -ENFILE(full) or others */ - printk(KERN_ERR "arv: register video (Colour AR) failed.\n"); + v4l2_err(v4l2_dev, "register video (Colour AR) failed.\n"); ret = -ENODEV; goto out_dev; } - printk(KERN_INFO "%s: Found M64278 VGA (IRQ %d, Freq %dMHz).\n", - video_device_node_name(ar->vdev), M32R_IRQ_INT3, freq); + v4l2_info(v4l2_dev, "%s: Found M64278 VGA (IRQ %d, Freq %dMHz).\n", + video_device_node_name(&ar->vdev), M32R_IRQ_INT3, freq); return 0; @@ -878,6 +841,7 @@ static int __init ar_init(void) out_end: #endif + v4l2_device_unregister(&ar->v4l2_dev); return ret; } @@ -893,11 +857,11 @@ static int __init ar_init_module(void) static void __exit ar_cleanup_module(void) { - struct ar_device *ar; + struct ar *ar; int i; ar = &ardev; - video_unregister_device(ar->vdev); + video_unregister_device(&ar->vdev); #if USE_INT free_irq(M32R_IRQ_INT3, ar); #endif @@ -906,6 +870,7 @@ static void __exit ar_cleanup_module(void) #if USE_INT kfree(ar->line_buff); #endif + v4l2_device_unregister(&ar->v4l2_dev); } module_init(ar_init_module); -- GitLab From fcc63274e69f95aee9dbb7c1dc3af3d2961813cc Mon Sep 17 00:00:00 2001 From: Vaibhav Hiremath Date: Sat, 27 Mar 2010 09:37:03 -0300 Subject: [PATCH 246/534] V4L/DVB: V4L: dm644x_ccdc: Debug register read prints removed Signed-off-by: Vaibhav Hiremath Signed-off-by: Muralidharan Karicheri Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/dm644x_ccdc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/video/davinci/dm644x_ccdc.c b/drivers/media/video/davinci/dm644x_ccdc.c index b4cc96dc99ef..9876c1d8d590 100644 --- a/drivers/media/video/davinci/dm644x_ccdc.c +++ b/drivers/media/video/davinci/dm644x_ccdc.c @@ -435,7 +435,6 @@ void ccdc_config_ycbcr(void) ccdc_sbl_reset(); dev_dbg(ccdc_cfg.dev, "\nEnd of ccdc_config_ycbcr...\n"); - ccdc_readregs(); } static void ccdc_config_black_clamp(struct ccdc_black_clamp *bclamp) -- GitLab From 085b54a24fd0c7353cd1b2d462879b7a4a4070fa Mon Sep 17 00:00:00 2001 From: Vaibhav Hiremath Date: Sat, 27 Mar 2010 09:37:07 -0300 Subject: [PATCH 247/534] V4L/DVB: V4L: vpfe_capture: Add call back function for interrupt clear for vpfe_cfg For the devices like AM3517, it is expected that driver clears the interrupt in ISR. Since this is device spcific, callback function added to the platform_data. Signed-off-by: Vaibhav Hiremath Signed-off-by: Muralidharan Karicheri Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpfe_capture.c | 24 ++++++++++++++++++---- include/media/davinci/vpfe_capture.h | 2 ++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index 398dbe71cb82..caeac199d15b 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c @@ -475,6 +475,11 @@ static int vpfe_initialize_device(struct vpfe_device *vpfe_dev) ret = ccdc_dev->hw_ops.open(vpfe_dev->pdev); if (!ret) vpfe_dev->initialized = 1; + + /* Clear all VPFE/CCDC interrupts */ + if (vpfe_dev->cfg->clr_intr) + vpfe_dev->cfg->clr_intr(-1); + unlock: mutex_unlock(&ccdc_lock); return ret; @@ -562,7 +567,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id) /* if streaming not started, don't do anything */ if (!vpfe_dev->started) - return IRQ_HANDLED; + goto clear_intr; /* only for 6446 this will be applicable */ if (NULL != ccdc_dev->hw_ops.reset) @@ -574,7 +579,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id) "frame format is progressive...\n"); if (vpfe_dev->cur_frm != vpfe_dev->next_frm) vpfe_process_buffer_complete(vpfe_dev); - return IRQ_HANDLED; + goto clear_intr; } /* interlaced or TB capture check which field we are in hardware */ @@ -604,7 +609,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id) addr += vpfe_dev->field_off; ccdc_dev->hw_ops.setfbaddr(addr); } - return IRQ_HANDLED; + goto clear_intr; } /* * if one field is just being captured configure @@ -624,6 +629,10 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id) */ vpfe_dev->field_id = fid; } +clear_intr: + if (vpfe_dev->cfg->clr_intr) + vpfe_dev->cfg->clr_intr(irq); + return IRQ_HANDLED; } @@ -635,8 +644,11 @@ static irqreturn_t vdint1_isr(int irq, void *dev_id) v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "\nInside vdint1_isr...\n"); /* if streaming not started, don't do anything */ - if (!vpfe_dev->started) + if (!vpfe_dev->started) { + if (vpfe_dev->cfg->clr_intr) + vpfe_dev->cfg->clr_intr(irq); return IRQ_HANDLED; + } spin_lock(&vpfe_dev->dma_queue_lock); if ((vpfe_dev->fmt.fmt.pix.field == V4L2_FIELD_NONE) && @@ -644,6 +656,10 @@ static irqreturn_t vdint1_isr(int irq, void *dev_id) vpfe_dev->cur_frm == vpfe_dev->next_frm) vpfe_schedule_next_buffer(vpfe_dev); spin_unlock(&vpfe_dev->dma_queue_lock); + + if (vpfe_dev->cfg->clr_intr) + vpfe_dev->cfg->clr_intr(irq); + return IRQ_HANDLED; } diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h index 4314a5f6a087..cc973ed845a7 100644 --- a/include/media/davinci/vpfe_capture.h +++ b/include/media/davinci/vpfe_capture.h @@ -94,6 +94,8 @@ struct vpfe_config { /* vpfe clock */ struct clk *vpssclk; struct clk *slaveclk; + /* Function for Clearing the interrupt */ + void (*clr_intr)(int vdint); }; struct vpfe_device { -- GitLab From 21aa300e160f03c237d2153d9938e14a87f38e0d Mon Sep 17 00:00:00 2001 From: Vaibhav Hiremath Date: Sat, 27 Mar 2010 09:37:12 -0300 Subject: [PATCH 248/534] V4L/DVB: V4L: dm644x_ccdc: Add 10bit BT support Signed-off-by: Vaibhav Hiremath Signed-off-by: Muralidharan Karicheri Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/dm644x_ccdc.c | 16 +++++++++++++--- drivers/media/video/davinci/dm644x_ccdc_regs.h | 8 ++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/davinci/dm644x_ccdc.c b/drivers/media/video/davinci/dm644x_ccdc.c index 9876c1d8d590..a1d353125c84 100644 --- a/drivers/media/video/davinci/dm644x_ccdc.c +++ b/drivers/media/video/davinci/dm644x_ccdc.c @@ -400,7 +400,11 @@ void ccdc_config_ycbcr(void) * configure the FID, VD, HD pin polarity, * fld,hd pol positive, vd negative, 8-bit data */ - syn_mode |= CCDC_SYN_MODE_VD_POL_NEGATIVE | CCDC_SYN_MODE_8BITS; + syn_mode |= CCDC_SYN_MODE_VD_POL_NEGATIVE; + if (ccdc_cfg.if_type == VPFE_BT656_10BIT) + syn_mode |= CCDC_SYN_MODE_10BITS; + else + syn_mode |= CCDC_SYN_MODE_8BITS; } else { /* y/c external sync mode */ syn_mode |= (((params->fid_pol & CCDC_FID_POL_MASK) << @@ -419,8 +423,13 @@ void ccdc_config_ycbcr(void) * configure the order of y cb cr in SDRAM, and disable latch * internal register on vsync */ - regw((params->pix_order << CCDC_CCDCFG_Y8POS_SHIFT) | - CCDC_LATCH_ON_VSYNC_DISABLE, CCDC_CCDCFG); + if (ccdc_cfg.if_type == VPFE_BT656_10BIT) + regw((params->pix_order << CCDC_CCDCFG_Y8POS_SHIFT) | + CCDC_LATCH_ON_VSYNC_DISABLE | CCDC_CCDCFG_BW656_10BIT, + CCDC_CCDCFG); + else + regw((params->pix_order << CCDC_CCDCFG_Y8POS_SHIFT) | + CCDC_LATCH_ON_VSYNC_DISABLE, CCDC_CCDCFG); /* * configure the horizontal line offset. This should be a @@ -826,6 +835,7 @@ static int ccdc_set_hw_if_params(struct vpfe_hw_if_param *params) case VPFE_BT656: case VPFE_YCBCR_SYNC_16: case VPFE_YCBCR_SYNC_8: + case VPFE_BT656_10BIT: ccdc_cfg.ycbcr.vd_pol = params->vdpol; ccdc_cfg.ycbcr.hd_pol = params->hdpol; break; diff --git a/drivers/media/video/davinci/dm644x_ccdc_regs.h b/drivers/media/video/davinci/dm644x_ccdc_regs.h index 6e5d05324466..b18d166f1815 100644 --- a/drivers/media/video/davinci/dm644x_ccdc_regs.h +++ b/drivers/media/video/davinci/dm644x_ccdc_regs.h @@ -135,11 +135,19 @@ #define CCDC_SYN_MODE_INPMOD_SHIFT 12 #define CCDC_SYN_MODE_INPMOD_MASK 3 #define CCDC_SYN_MODE_8BITS (7 << 8) +#define CCDC_SYN_MODE_10BITS (6 << 8) +#define CCDC_SYN_MODE_11BITS (5 << 8) +#define CCDC_SYN_MODE_12BITS (4 << 8) +#define CCDC_SYN_MODE_13BITS (3 << 8) +#define CCDC_SYN_MODE_14BITS (2 << 8) +#define CCDC_SYN_MODE_15BITS (1 << 8) +#define CCDC_SYN_MODE_16BITS (0 << 8) #define CCDC_SYN_FLDMODE_MASK 1 #define CCDC_SYN_FLDMODE_SHIFT 7 #define CCDC_REC656IF_BT656_EN 3 #define CCDC_SYN_MODE_VD_POL_NEGATIVE (1 << 2) #define CCDC_CCDCFG_Y8POS_SHIFT 11 +#define CCDC_CCDCFG_BW656_10BIT (1 << 5) #define CCDC_SDOFST_FIELD_INTERLEAVED 0x249 #define CCDC_NO_CULLING 0xffff00ff #endif -- GitLab From aa2dc9034859531206889b6bf07b5f9adae487a6 Mon Sep 17 00:00:00 2001 From: Vaibhav Hiremath Date: Sat, 27 Mar 2010 09:37:16 -0300 Subject: [PATCH 249/534] V4L/DVB: V4L: vpfe_capture: Return 0 from suspend/resume Now Suspend/Resume functionality is being handled by respective CCDC code, so return true (0) from bridge suspend/resume function. Signed-off-by: Vaibhav Hiremath Signed-off-by: Muralidharan Karicheri Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpfe_capture.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index caeac199d15b..2b906753f13c 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c @@ -2031,18 +2031,14 @@ static int __devexit vpfe_remove(struct platform_device *pdev) return 0; } -static int -vpfe_suspend(struct device *dev) +static int vpfe_suspend(struct device *dev) { - /* add suspend code here later */ - return -1; + return 0; } -static int -vpfe_resume(struct device *dev) +static int vpfe_resume(struct device *dev) { - /* add resume code here later */ - return -1; + return 0; } static const struct dev_pm_ops vpfe_dev_pm_ops = { -- GitLab From e333bab73e848d72904f39c7a0f5ba6425ba41f3 Mon Sep 17 00:00:00 2001 From: Vaibhav Hiremath Date: Sat, 27 Mar 2010 09:37:19 -0300 Subject: [PATCH 250/534] V4L/DVB: V4L: dm644x_ccdc: Add Suspend/Resume Support Signed-off-by: Vaibhav Hiremath Signed-off-by: Muralidharan Karicheri Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/dm644x_ccdc.c | 114 ++++++++++++++++++ .../media/video/davinci/dm644x_ccdc_regs.h | 2 +- 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/davinci/dm644x_ccdc.c b/drivers/media/video/davinci/dm644x_ccdc.c index a1d353125c84..490aafb34e2f 100644 --- a/drivers/media/video/davinci/dm644x_ccdc.c +++ b/drivers/media/video/davinci/dm644x_ccdc.c @@ -101,6 +101,9 @@ static u32 ccdc_raw_bayer_pix_formats[] = static u32 ccdc_raw_yuv_pix_formats[] = {V4L2_PIX_FMT_UYVY, V4L2_PIX_FMT_YUYV}; +/* CCDC Save/Restore context */ +static u32 ccdc_ctx[CCDC_REG_END / sizeof(u32)]; + /* register access routines */ static inline u32 regr(u32 offset) { @@ -846,6 +849,87 @@ static int ccdc_set_hw_if_params(struct vpfe_hw_if_param *params) return 0; } +static void ccdc_save_context(void) +{ + ccdc_ctx[CCDC_PCR >> 2] = regr(CCDC_PCR); + ccdc_ctx[CCDC_SYN_MODE >> 2] = regr(CCDC_SYN_MODE); + ccdc_ctx[CCDC_HD_VD_WID >> 2] = regr(CCDC_HD_VD_WID); + ccdc_ctx[CCDC_PIX_LINES >> 2] = regr(CCDC_PIX_LINES); + ccdc_ctx[CCDC_HORZ_INFO >> 2] = regr(CCDC_HORZ_INFO); + ccdc_ctx[CCDC_VERT_START >> 2] = regr(CCDC_VERT_START); + ccdc_ctx[CCDC_VERT_LINES >> 2] = regr(CCDC_VERT_LINES); + ccdc_ctx[CCDC_CULLING >> 2] = regr(CCDC_CULLING); + ccdc_ctx[CCDC_HSIZE_OFF >> 2] = regr(CCDC_HSIZE_OFF); + ccdc_ctx[CCDC_SDOFST >> 2] = regr(CCDC_SDOFST); + ccdc_ctx[CCDC_SDR_ADDR >> 2] = regr(CCDC_SDR_ADDR); + ccdc_ctx[CCDC_CLAMP >> 2] = regr(CCDC_CLAMP); + ccdc_ctx[CCDC_DCSUB >> 2] = regr(CCDC_DCSUB); + ccdc_ctx[CCDC_COLPTN >> 2] = regr(CCDC_COLPTN); + ccdc_ctx[CCDC_BLKCMP >> 2] = regr(CCDC_BLKCMP); + ccdc_ctx[CCDC_FPC >> 2] = regr(CCDC_FPC); + ccdc_ctx[CCDC_FPC_ADDR >> 2] = regr(CCDC_FPC_ADDR); + ccdc_ctx[CCDC_VDINT >> 2] = regr(CCDC_VDINT); + ccdc_ctx[CCDC_ALAW >> 2] = regr(CCDC_ALAW); + ccdc_ctx[CCDC_REC656IF >> 2] = regr(CCDC_REC656IF); + ccdc_ctx[CCDC_CCDCFG >> 2] = regr(CCDC_CCDCFG); + ccdc_ctx[CCDC_FMTCFG >> 2] = regr(CCDC_FMTCFG); + ccdc_ctx[CCDC_FMT_HORZ >> 2] = regr(CCDC_FMT_HORZ); + ccdc_ctx[CCDC_FMT_VERT >> 2] = regr(CCDC_FMT_VERT); + ccdc_ctx[CCDC_FMT_ADDR0 >> 2] = regr(CCDC_FMT_ADDR0); + ccdc_ctx[CCDC_FMT_ADDR1 >> 2] = regr(CCDC_FMT_ADDR1); + ccdc_ctx[CCDC_FMT_ADDR2 >> 2] = regr(CCDC_FMT_ADDR2); + ccdc_ctx[CCDC_FMT_ADDR3 >> 2] = regr(CCDC_FMT_ADDR3); + ccdc_ctx[CCDC_FMT_ADDR4 >> 2] = regr(CCDC_FMT_ADDR4); + ccdc_ctx[CCDC_FMT_ADDR5 >> 2] = regr(CCDC_FMT_ADDR5); + ccdc_ctx[CCDC_FMT_ADDR6 >> 2] = regr(CCDC_FMT_ADDR6); + ccdc_ctx[CCDC_FMT_ADDR7 >> 2] = regr(CCDC_FMT_ADDR7); + ccdc_ctx[CCDC_PRGEVEN_0 >> 2] = regr(CCDC_PRGEVEN_0); + ccdc_ctx[CCDC_PRGEVEN_1 >> 2] = regr(CCDC_PRGEVEN_1); + ccdc_ctx[CCDC_PRGODD_0 >> 2] = regr(CCDC_PRGODD_0); + ccdc_ctx[CCDC_PRGODD_1 >> 2] = regr(CCDC_PRGODD_1); + ccdc_ctx[CCDC_VP_OUT >> 2] = regr(CCDC_VP_OUT); +} + +static void ccdc_restore_context(void) +{ + regw(ccdc_ctx[CCDC_SYN_MODE >> 2], CCDC_SYN_MODE); + regw(ccdc_ctx[CCDC_HD_VD_WID >> 2], CCDC_HD_VD_WID); + regw(ccdc_ctx[CCDC_PIX_LINES >> 2], CCDC_PIX_LINES); + regw(ccdc_ctx[CCDC_HORZ_INFO >> 2], CCDC_HORZ_INFO); + regw(ccdc_ctx[CCDC_VERT_START >> 2], CCDC_VERT_START); + regw(ccdc_ctx[CCDC_VERT_LINES >> 2], CCDC_VERT_LINES); + regw(ccdc_ctx[CCDC_CULLING >> 2], CCDC_CULLING); + regw(ccdc_ctx[CCDC_HSIZE_OFF >> 2], CCDC_HSIZE_OFF); + regw(ccdc_ctx[CCDC_SDOFST >> 2], CCDC_SDOFST); + regw(ccdc_ctx[CCDC_SDR_ADDR >> 2], CCDC_SDR_ADDR); + regw(ccdc_ctx[CCDC_CLAMP >> 2], CCDC_CLAMP); + regw(ccdc_ctx[CCDC_DCSUB >> 2], CCDC_DCSUB); + regw(ccdc_ctx[CCDC_COLPTN >> 2], CCDC_COLPTN); + regw(ccdc_ctx[CCDC_BLKCMP >> 2], CCDC_BLKCMP); + regw(ccdc_ctx[CCDC_FPC >> 2], CCDC_FPC); + regw(ccdc_ctx[CCDC_FPC_ADDR >> 2], CCDC_FPC_ADDR); + regw(ccdc_ctx[CCDC_VDINT >> 2], CCDC_VDINT); + regw(ccdc_ctx[CCDC_ALAW >> 2], CCDC_ALAW); + regw(ccdc_ctx[CCDC_REC656IF >> 2], CCDC_REC656IF); + regw(ccdc_ctx[CCDC_CCDCFG >> 2], CCDC_CCDCFG); + regw(ccdc_ctx[CCDC_FMTCFG >> 2], CCDC_FMTCFG); + regw(ccdc_ctx[CCDC_FMT_HORZ >> 2], CCDC_FMT_HORZ); + regw(ccdc_ctx[CCDC_FMT_VERT >> 2], CCDC_FMT_VERT); + regw(ccdc_ctx[CCDC_FMT_ADDR0 >> 2], CCDC_FMT_ADDR0); + regw(ccdc_ctx[CCDC_FMT_ADDR1 >> 2], CCDC_FMT_ADDR1); + regw(ccdc_ctx[CCDC_FMT_ADDR2 >> 2], CCDC_FMT_ADDR2); + regw(ccdc_ctx[CCDC_FMT_ADDR3 >> 2], CCDC_FMT_ADDR3); + regw(ccdc_ctx[CCDC_FMT_ADDR4 >> 2], CCDC_FMT_ADDR4); + regw(ccdc_ctx[CCDC_FMT_ADDR5 >> 2], CCDC_FMT_ADDR5); + regw(ccdc_ctx[CCDC_FMT_ADDR6 >> 2], CCDC_FMT_ADDR6); + regw(ccdc_ctx[CCDC_FMT_ADDR7 >> 2], CCDC_FMT_ADDR7); + regw(ccdc_ctx[CCDC_PRGEVEN_0 >> 2], CCDC_PRGEVEN_0); + regw(ccdc_ctx[CCDC_PRGEVEN_1 >> 2], CCDC_PRGEVEN_1); + regw(ccdc_ctx[CCDC_PRGODD_0 >> 2], CCDC_PRGODD_0); + regw(ccdc_ctx[CCDC_PRGODD_1 >> 2], CCDC_PRGODD_1); + regw(ccdc_ctx[CCDC_VP_OUT >> 2], CCDC_VP_OUT); + regw(ccdc_ctx[CCDC_PCR >> 2], CCDC_PCR); +} static struct ccdc_hw_device ccdc_hw_dev = { .name = "DM6446 CCDC", .owner = THIS_MODULE, @@ -954,10 +1038,40 @@ static int dm644x_ccdc_remove(struct platform_device *pdev) return 0; } +static int dm644x_ccdc_suspend(struct device *dev) +{ + /* Save CCDC context */ + ccdc_save_context(); + /* Disable CCDC */ + ccdc_enable(0); + /* Disable both master and slave clock */ + clk_disable(ccdc_cfg.mclk); + clk_disable(ccdc_cfg.sclk); + + return 0; +} + +static int dm644x_ccdc_resume(struct device *dev) +{ + /* Enable both master and slave clock */ + clk_enable(ccdc_cfg.mclk); + clk_enable(ccdc_cfg.sclk); + /* Restore CCDC context */ + ccdc_restore_context(); + + return 0; +} + +static const struct dev_pm_ops dm644x_ccdc_pm_ops = { + .suspend = dm644x_ccdc_suspend, + .resume = dm644x_ccdc_resume, +}; + static struct platform_driver dm644x_ccdc_driver = { .driver = { .name = "dm644x_ccdc", .owner = THIS_MODULE, + .pm = &dm644x_ccdc_pm_ops, }, .remove = __devexit_p(dm644x_ccdc_remove), .probe = dm644x_ccdc_probe, diff --git a/drivers/media/video/davinci/dm644x_ccdc_regs.h b/drivers/media/video/davinci/dm644x_ccdc_regs.h index b18d166f1815..90370e414e2c 100644 --- a/drivers/media/video/davinci/dm644x_ccdc_regs.h +++ b/drivers/media/video/davinci/dm644x_ccdc_regs.h @@ -59,7 +59,7 @@ #define CCDC_PRGODD_0 0x8c #define CCDC_PRGODD_1 0x90 #define CCDC_VP_OUT 0x94 - +#define CCDC_REG_END 0x98 /*************************************************************** * Define for various register bit mask and shifts for CCDC -- GitLab From 844cc0dcb588ee7005c70cffd92ee7a0c1270729 Mon Sep 17 00:00:00 2001 From: Vaibhav Hiremath Date: Sat, 27 Mar 2010 09:37:23 -0300 Subject: [PATCH 251/534] V4L/DVB: V4L: vpfe_capture: Add support for USERPTR mode of operation Signed-off-by: Vaibhav Hiremath Signed-off-by: Muralidharan Karicheri Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpfe_capture.c | 42 ++++++++++++++-------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index 2b906753f13c..d4676ad41f39 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c @@ -539,6 +539,16 @@ static void vpfe_schedule_next_buffer(struct vpfe_device *vpfe_dev) list_del(&vpfe_dev->next_frm->queue); vpfe_dev->next_frm->state = VIDEOBUF_ACTIVE; addr = videobuf_to_dma_contig(vpfe_dev->next_frm); + + ccdc_dev->hw_ops.setfbaddr(addr); +} + +static void vpfe_schedule_bottom_field(struct vpfe_device *vpfe_dev) +{ + unsigned long addr; + + addr = videobuf_to_dma_contig(vpfe_dev->cur_frm); + addr += vpfe_dev->field_off; ccdc_dev->hw_ops.setfbaddr(addr); } @@ -559,7 +569,6 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id) { struct vpfe_device *vpfe_dev = dev_id; enum v4l2_field field; - unsigned long addr; int fid; v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "\nStarting vpfe_isr...\n"); @@ -604,10 +613,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id) * the CCDC memory address */ if (field == V4L2_FIELD_SEQ_TB) { - addr = - videobuf_to_dma_contig(vpfe_dev->cur_frm); - addr += vpfe_dev->field_off; - ccdc_dev->hw_ops.setfbaddr(addr); + vpfe_schedule_bottom_field(vpfe_dev); } goto clear_intr; } @@ -1234,7 +1240,10 @@ static int vpfe_videobuf_setup(struct videobuf_queue *vq, struct vpfe_device *vpfe_dev = fh->vpfe_dev; v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_buffer_setup\n"); - *size = config_params.device_bufsize; + *size = vpfe_dev->fmt.fmt.pix.sizeimage; + if (vpfe_dev->memory == V4L2_MEMORY_MMAP && + vpfe_dev->fmt.fmt.pix.sizeimage > config_params.device_bufsize) + *size = config_params.device_bufsize; if (*count < config_params.min_numbuffers) *count = config_params.min_numbuffers; @@ -1249,6 +1258,8 @@ static int vpfe_videobuf_prepare(struct videobuf_queue *vq, { struct vpfe_fh *fh = vq->priv_data; struct vpfe_device *vpfe_dev = fh->vpfe_dev; + unsigned long addr; + int ret; v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_buffer_prepare\n"); @@ -1258,8 +1269,18 @@ static int vpfe_videobuf_prepare(struct videobuf_queue *vq, vb->height = vpfe_dev->fmt.fmt.pix.height; vb->size = vpfe_dev->fmt.fmt.pix.sizeimage; vb->field = field; + + ret = videobuf_iolock(vq, vb, NULL);; + if (ret < 0) + return ret; + + addr = videobuf_to_dma_contig(vb); + /* Make sure user addresses are aligned to 32 bytes */ + if (!ALIGN(addr, 32)) + return -EINVAL; + + vb->state = VIDEOBUF_PREPARED; } - vb->state = VIDEOBUF_PREPARED; return 0; } @@ -1327,13 +1348,6 @@ static int vpfe_reqbufs(struct file *file, void *priv, return -EINVAL; } - if (V4L2_MEMORY_USERPTR == req_buf->memory) { - /* we don't support user ptr IO */ - v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_reqbufs:" - " USERPTR IO not supported\n"); - return -EINVAL; - } - ret = mutex_lock_interruptible(&vpfe_dev->lock); if (ret) return ret; -- GitLab From 63b59cecb2fa0a274d1c7240112460816d826988 Mon Sep 17 00:00:00 2001 From: Vaibhav Hiremath Date: Sat, 27 Mar 2010 09:37:54 -0300 Subject: [PATCH 252/534] V4L/DVB: V4L: tvp514x: Add Powerup sequence during s_input to lock the signal properly For the sequence streamon -> streamoff and again s_input, it fails to lock the signal, since streamoff puts TVP514x into power off state which leads to failure in sub-sequent s_input. So add powerup sequence in s_routing (if disabled), since it is important to lock the signal at this stage. Signed-off-by: Vaibhav Hiremath Signed-off-by: Sudhakar Rajashekhara Signed-off-by: Muralidharan Karicheri Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/tvp514x.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/media/video/tvp514x.c b/drivers/media/video/tvp514x.c index e4815a1806e3..e826114b7fb8 100644 --- a/drivers/media/video/tvp514x.c +++ b/drivers/media/video/tvp514x.c @@ -79,6 +79,8 @@ struct tvp514x_std_info { }; static struct tvp514x_reg tvp514x_reg_list_default[0x40]; + +static int tvp514x_s_stream(struct v4l2_subdev *sd, int enable); /** * struct tvp514x_decoder - TVP5146/47 decoder object * @sd: Subdevice Slave handle @@ -644,6 +646,17 @@ static int tvp514x_s_routing(struct v4l2_subdev *sd, /* Index out of bound */ return -EINVAL; + /* + * For the sequence streamon -> streamoff and again s_input + * it fails to lock the signal, since streamoff puts TVP514x + * into power off state which leads to failure in sub-sequent s_input. + * + * So power up the TVP514x device here, since it is important to lock + * the signal at this stage. + */ + if (!decoder->streaming) + tvp514x_s_stream(sd, 1); + input_sel = input; output_sel = output; -- GitLab From be1da9ee83eb5c27a69b30577232d1ec72876e7a Mon Sep 17 00:00:00 2001 From: Costantino Leandro Date: Tue, 23 Mar 2010 12:31:16 -0300 Subject: [PATCH 253/534] V4L/DVB: gspca - t613: Add color controls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename controls to fit real behaviour - Add global gain , r/b balance. Signed-off-by: Costantino Leandro Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/gspca/t613.c | 159 +++++++++++++++++++++++++++++-- 1 file changed, 150 insertions(+), 9 deletions(-) diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index 8c7dadef8211..63014372adbc 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c @@ -44,7 +44,10 @@ struct sd { u8 gamma; u8 sharpness; u8 freq; - u8 whitebalance; + u8 red_balance; /* split balance */ + u8 blue_balance; + u8 global_gain; /* aka gain */ + u8 whitebalance; /* set default r/g/b and activate */ u8 mirror; u8 effect; @@ -70,8 +73,17 @@ static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); + + static int sd_setwhitebalance(struct gspca_dev *gspca_dev, __s32 val); static int sd_getwhitebalance(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setblue_balance(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getblue_balance(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setred_balance(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getred_balance(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setglobal_gain(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getglobal_gain(struct gspca_dev *gspca_dev, __s32 *val); + static int sd_setflip(struct gspca_dev *gspca_dev, __s32 val); static int sd_getflip(struct gspca_dev *gspca_dev, __s32 *val); static int sd_seteffect(struct gspca_dev *gspca_dev, __s32 val); @@ -79,6 +91,7 @@ static int sd_geteffect(struct gspca_dev *gspca_dev, __s32 *val); static int sd_querymenu(struct gspca_dev *gspca_dev, struct v4l2_querymenu *menu); + static const struct ctrl sd_ctrls[] = { { { @@ -139,7 +152,7 @@ static const struct ctrl sd_ctrls[] = { }, { { - .id = V4L2_CID_GAIN, /* here, i activate only the lowlight, + .id = V4L2_CID_BACKLIGHT_COMPENSATION, /* Activa lowlight, * some apps dont bring up the * backligth_compensation control) */ .type = V4L2_CTRL_TYPE_INTEGER, @@ -183,7 +196,7 @@ static const struct ctrl sd_ctrls[] = { { { - .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE, + .id = V4L2_CID_AUTO_WHITE_BALANCE, .type = V4L2_CTRL_TYPE_INTEGER, .name = "White Balance", .minimum = 0, @@ -223,6 +236,48 @@ static const struct ctrl sd_ctrls[] = { .set = sd_seteffect, .get = sd_geteffect }, + { + { + .id = V4L2_CID_BLUE_BALANCE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Blue Balance", + .minimum = 0x10, + .maximum = 0x40, + .step = 1, +#define BLUE_BALANCE_DEF 0x20 + .default_value = BLUE_BALANCE_DEF, + }, + .set = sd_setblue_balance, + .get = sd_getblue_balance, + }, + { + { + .id = V4L2_CID_RED_BALANCE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Red Balance", + .minimum = 0x10, + .maximum = 0x40, + .step = 1, +#define RED_BALANCE_DEF 0x20 + .default_value = RED_BALANCE_DEF, + }, + .set = sd_setred_balance, + .get = sd_getred_balance, + }, + { + { + .id = V4L2_CID_GAIN, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Gain", + .minimum = 0x10, + .maximum = 0x40, + .step = 1, +#define global_gain_DEF 0x20 + .default_value = global_gain_DEF, + }, + .set = sd_setglobal_gain, + .get = sd_getglobal_gain, + }, }; static char *effects_control[] = { @@ -651,6 +706,10 @@ static int sd_config(struct gspca_dev *gspca_dev, sd->whitebalance = WHITE_BALANCE_DEF; sd->sharpness = SHARPNESS_DEF; sd->effect = EFFECTS_DEF; + sd->red_balance = RED_BALANCE_DEF; + sd->blue_balance = BLUE_BALANCE_DEF; + sd->global_gain = global_gain_DEF; + return 0; } @@ -702,18 +761,40 @@ static void setgamma(struct gspca_dev *gspca_dev) reg_w_ixbuf(gspca_dev, 0x90, gamma_table[sd->gamma], sizeof gamma_table[0]); } +static void setglobalgain(struct gspca_dev *gspca_dev) +{ -static void setwhitebalance(struct gspca_dev *gspca_dev) + struct sd *sd = (struct sd *) gspca_dev; + reg_w(gspca_dev, (sd->red_balance << 8) + 0x87); + reg_w(gspca_dev, (sd->blue_balance << 8) + 0x88); + reg_w(gspca_dev, (sd->global_gain << 8) + 0x89); +} + +/* Generic fnc for r/b balance, exposure and whitebalance */ +static void setbalance(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - u8 white_balance[8] = - {0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38}; + /* on whitebalance leave defaults values */ + if (sd->whitebalance) { + reg_w(gspca_dev, 0x3c80); + } else { + reg_w(gspca_dev, 0x3880); + /* shoud we wait here.. */ + /* update and reset 'global gain' with webcam parameters */ + sd->red_balance = reg_r(gspca_dev, 0x0087); + sd->blue_balance = reg_r(gspca_dev, 0x0088); + sd->global_gain = reg_r(gspca_dev, 0x0089); + setglobalgain(gspca_dev); + } + +} - if (sd->whitebalance) - white_balance[7] = 0x3c; - reg_w_buf(gspca_dev, white_balance, sizeof white_balance); + +static void setwhitebalance(struct gspca_dev *gspca_dev) +{ + setbalance(gspca_dev); } static void setsharpness(struct gspca_dev *gspca_dev) @@ -1027,6 +1108,66 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, gspca_frame_add(gspca_dev, INTER_PACKET, data, len); } + +static int sd_setblue_balance(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->blue_balance = val; + if (gspca_dev->streaming) + reg_w(gspca_dev, (val << 8) + 0x88); + return 0; +} + +static int sd_getblue_balance(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->blue_balance; + return 0; +} + +static int sd_setred_balance(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->red_balance = val; + if (gspca_dev->streaming) + reg_w(gspca_dev, (val << 8) + 0x87); + + return 0; +} + +static int sd_getred_balance(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->red_balance; + return 0; +} + + + +static int sd_setglobal_gain(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->global_gain = val; + if (gspca_dev->streaming) + setglobalgain(gspca_dev); + + return 0; +} + +static int sd_getglobal_gain(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->global_gain; + return 0; +} + + static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; -- GitLab From dbad345e6a6159e5d8aec45533d299aa2a138aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Moine?= Date: Mon, 29 Mar 2010 03:51:18 -0300 Subject: [PATCH 254/534] V4L/DVB: sn9c102 / zc0301: Handle webcams when no gspca subdriver conflict MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some webcams handled by both sn9c102 or zc0301 and some gspca subdrivers (sonixb, sonixj and zc3xx) were not handled when gspca was generated but not the associated subdrivers. Signed-off-by: Jean-François Moine Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/sn9c102/sn9c102_devtable.h | 18 +++++++++--------- drivers/media/video/zc0301/zc0301_sensor.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/video/sn9c102/sn9c102_devtable.h b/drivers/media/video/sn9c102/sn9c102_devtable.h index cc40d6ba9f22..522ba3f4c285 100644 --- a/drivers/media/video/sn9c102/sn9c102_devtable.h +++ b/drivers/media/video/sn9c102/sn9c102_devtable.h @@ -40,12 +40,12 @@ struct sn9c102_device; static const struct usb_device_id sn9c102_id_table[] = { /* SN9C101 and SN9C102 */ -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE { SN9C102_USB_DEVICE(0x0c45, 0x6001, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x6005, BRIDGE_SN9C102), }, #endif { SN9C102_USB_DEVICE(0x0c45, 0x6007, BRIDGE_SN9C102), }, -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE { SN9C102_USB_DEVICE(0x0c45, 0x6009, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), }, /* { SN9C102_USB_DEVICE(0x0c45, 0x6011, BRIDGE_SN9C102), }, OV6650 */ @@ -53,13 +53,13 @@ static const struct usb_device_id sn9c102_id_table[] = { { SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x6025, BRIDGE_SN9C102), }, -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE { SN9C102_USB_DEVICE(0x0c45, 0x6028, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x6029, BRIDGE_SN9C102), }, #endif { SN9C102_USB_DEVICE(0x0c45, 0x602a, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x602b, BRIDGE_SN9C102), }, -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE { SN9C102_USB_DEVICE(0x0c45, 0x602c, BRIDGE_SN9C102), }, /* { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, HV7131R */ #endif @@ -74,7 +74,7 @@ static const struct usb_device_id sn9c102_id_table[] = { { SN9C102_USB_DEVICE(0x0c45, 0x608b, BRIDGE_SN9C103), }, { SN9C102_USB_DEVICE(0x0c45, 0x608c, BRIDGE_SN9C103), }, /* { SN9C102_USB_DEVICE(0x0c45, 0x608e, BRIDGE_SN9C103), }, CISVF10 */ -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE { SN9C102_USB_DEVICE(0x0c45, 0x608f, BRIDGE_SN9C103), }, #endif { SN9C102_USB_DEVICE(0x0c45, 0x60a0, BRIDGE_SN9C103), }, @@ -86,7 +86,7 @@ static const struct usb_device_id sn9c102_id_table[] = { { SN9C102_USB_DEVICE(0x0c45, 0x60ac, BRIDGE_SN9C103), }, { SN9C102_USB_DEVICE(0x0c45, 0x60ae, BRIDGE_SN9C103), }, { SN9C102_USB_DEVICE(0x0c45, 0x60af, BRIDGE_SN9C103), }, -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE { SN9C102_USB_DEVICE(0x0c45, 0x60b0, BRIDGE_SN9C103), }, #endif { SN9C102_USB_DEVICE(0x0c45, 0x60b2, BRIDGE_SN9C103), }, @@ -97,7 +97,7 @@ static const struct usb_device_id sn9c102_id_table[] = { { SN9C102_USB_DEVICE(0x0c45, 0x60bc, BRIDGE_SN9C103), }, { SN9C102_USB_DEVICE(0x0c45, 0x60be, BRIDGE_SN9C103), }, /* SN9C105 */ -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE { SN9C102_USB_DEVICE(0x045e, 0x00f5, BRIDGE_SN9C105), }, { SN9C102_USB_DEVICE(0x045e, 0x00f7, BRIDGE_SN9C105), }, { SN9C102_USB_DEVICE(0x0471, 0x0327, BRIDGE_SN9C105), }, @@ -121,11 +121,11 @@ static const struct usb_device_id sn9c102_id_table[] = { { SN9C102_USB_DEVICE(0x0c45, 0x610f, BRIDGE_SN9C120), }, { SN9C102_USB_DEVICE(0x0c45, 0x6130, BRIDGE_SN9C120), }, /* { SN9C102_USB_DEVICE(0x0c45, 0x6138, BRIDGE_SN9C120), }, MO8000 */ -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE { SN9C102_USB_DEVICE(0x0c45, 0x613a, BRIDGE_SN9C120), }, #endif { SN9C102_USB_DEVICE(0x0c45, 0x613b, BRIDGE_SN9C120), }, -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE { SN9C102_USB_DEVICE(0x0c45, 0x613c, BRIDGE_SN9C120), }, { SN9C102_USB_DEVICE(0x0c45, 0x613e, BRIDGE_SN9C120), }, #endif diff --git a/drivers/media/video/zc0301/zc0301_sensor.h b/drivers/media/video/zc0301/zc0301_sensor.h index 3a408de91b9c..0be783c203f7 100644 --- a/drivers/media/video/zc0301/zc0301_sensor.h +++ b/drivers/media/video/zc0301/zc0301_sensor.h @@ -58,7 +58,7 @@ zc0301_attach_sensor(struct zc0301_device* cam, struct zc0301_sensor* sensor); .idProduct = (prod), \ .bInterfaceClass = (intclass) -#if !defined CONFIG_USB_GSPCA && !defined CONFIG_USB_GSPCA_MODULE +#if !defined CONFIG_USB_GSPCA_ZC3XX && !defined CONFIG_USB_GSPCA_ZC3XX_MODULE #define ZC0301_ID_TABLE \ static const struct usb_device_id zc0301_id_table[] = { \ { ZC0301_USB_DEVICE(0x046d, 0x08ae, 0xff), }, /* PAS202 */ \ -- GitLab From 1e4d05bc95a0fe2972c5c91ed45466587d07cd2c Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 4 Mar 2010 07:51:25 -0300 Subject: [PATCH 255/534] V4L/DVB: uvcvideo: Add support for unbranded Arkmicro 18ec:3290 webcams The camera requires the PROBE_DEF quirk. Add a corresponding entry in the device IDs list. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/uvc/uvc_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index 86ff8c12ea58..aa334a33777e 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c @@ -2169,6 +2169,15 @@ static struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_QUIRK_PROBE_MINMAX }, + /* Arkmicro unbranded */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x18ec, + .idProduct = 0x3290, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_QUIRK_PROBE_DEF }, /* Bodelin ProScopeHR */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_HI -- GitLab From f129b03ba272c86c42ad476684caa0d6109cb383 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 13 Mar 2010 18:12:15 -0300 Subject: [PATCH 256/534] V4L/DVB: uvcvideo: Add support for Packard Bell EasyNote MX52 integrated webcam The camera requires the STREAM_NO_FID quirk. Add a corresponding entry in the device IDs list. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/uvc/uvc_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c index aa334a33777e..72a705802f18 100644 --- a/drivers/media/video/uvc/uvc_driver.c +++ b/drivers/media/video/uvc/uvc_driver.c @@ -2105,6 +2105,15 @@ static struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_QUIRK_STREAM_NO_FID }, + /* Syntek (Packard Bell EasyNote MX52 */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x174f, + .idProduct = 0x8a12, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_QUIRK_STREAM_NO_FID }, /* Syntek (Asus F9SG) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, -- GitLab From 48213fe3f981d2cbccd926d6858fa9cf8617beed Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 20 Jan 2010 12:12:57 -0300 Subject: [PATCH 257/534] V4L/DVB: v4l: Add V4L2_CID_IRIS_ABSOLUTE and V4L2_CID_IRIS_RELATIVE controls Those control, as their names imply, control the camera aperture settings. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/v4l/compat.xml | 11 +++++++++++ Documentation/DocBook/v4l/controls.xml | 19 +++++++++++++++++++ Documentation/DocBook/v4l/videodev2.h.xml | 3 +++ drivers/media/video/v4l2-common.c | 3 +++ include/linux/videodev2.h | 3 +++ 5 files changed, 39 insertions(+) diff --git a/Documentation/DocBook/v4l/compat.xml b/Documentation/DocBook/v4l/compat.xml index b9dbdf9e6d29..854235b5208e 100644 --- a/Documentation/DocBook/v4l/compat.xml +++ b/Documentation/DocBook/v4l/compat.xml @@ -2332,6 +2332,17 @@ more information. +
+ V4L2 in Linux 2.6.34 + + + Added +V4L2_CID_IRIS_ABSOLUTE and +V4L2_CID_IRIS_RELATIVE controls to the + Camera controls class. + + +
diff --git a/Documentation/DocBook/v4l/controls.xml b/Documentation/DocBook/v4l/controls.xml index e1bdbb6eff84..7e0c68747134 100644 --- a/Documentation/DocBook/v4l/controls.xml +++ b/Documentation/DocBook/v4l/controls.xml @@ -1830,6 +1830,25 @@ wide-angle direction. The zoom speed unit is driver-specific. + + V4L2_CID_IRIS_ABSOLUTE  + integer + This control sets the +camera's aperture to the specified value. The unit is undefined. +Larger values open the iris wider, smaller values close it. + + + + + V4L2_CID_IRIS_RELATIVE  + integer + This control modifies the +camera's aperture by the specified amount. The unit is undefined. +Positive values open the iris one step further, negative values close +it one step further. This is a write-only control. + + + V4L2_CID_PRIVACY  boolean diff --git a/Documentation/DocBook/v4l/videodev2.h.xml b/Documentation/DocBook/v4l/videodev2.h.xml index 068325940658..c18dfebedeff 100644 --- a/Documentation/DocBook/v4l/videodev2.h.xml +++ b/Documentation/DocBook/v4l/videodev2.h.xml @@ -1271,6 +1271,9 @@ enum v4l2_exposure_auto_type { #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) +#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) +#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index cd1f21d9b079..67944f53a79a 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -489,6 +489,8 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_FOCUS_ABSOLUTE: return "Focus, Absolute"; case V4L2_CID_FOCUS_RELATIVE: return "Focus, Relative"; case V4L2_CID_FOCUS_AUTO: return "Focus, Automatic"; + case V4L2_CID_IRIS_ABSOLUTE: return "Iris, Absolute"; + case V4L2_CID_IRIS_RELATIVE: return "Iris, Relative"; case V4L2_CID_ZOOM_ABSOLUTE: return "Zoom, Absolute"; case V4L2_CID_ZOOM_RELATIVE: return "Zoom, Relative"; case V4L2_CID_ZOOM_CONTINUOUS: return "Zoom, Continuous"; @@ -643,6 +645,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste case V4L2_CID_PAN_RELATIVE: case V4L2_CID_TILT_RELATIVE: case V4L2_CID_FOCUS_RELATIVE: + case V4L2_CID_IRIS_RELATIVE: case V4L2_CID_ZOOM_RELATIVE: qctrl->flags |= V4L2_CTRL_FLAG_WRITE_ONLY; break; diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 6fb0b2daa5b9..2559b182b8c4 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1282,6 +1282,9 @@ enum v4l2_exposure_auto_type { #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) +#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) +#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) -- GitLab From 35a00c41ea8b280cb629503c735daf20cdf0f9f8 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 20 Jan 2010 12:13:46 -0300 Subject: [PATCH 258/534] V4L/DVB: uvcvideo: Support iris absolute and relative controls Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/uvc/uvc_ctrl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c index 6d3850b37161..5d6d7bda2336 100644 --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c @@ -561,6 +561,26 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = { .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, .data_type = UVC_CTRL_DATA_TYPE_BOOLEAN, }, + { + .id = V4L2_CID_IRIS_ABSOLUTE, + .name = "Iris, Absolute", + .entity = UVC_GUID_UVC_CAMERA, + .selector = UVC_CT_IRIS_ABSOLUTE_CONTROL, + .size = 16, + .offset = 0, + .v4l2_type = V4L2_CTRL_TYPE_INTEGER, + .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, + }, + { + .id = V4L2_CID_IRIS_RELATIVE, + .name = "Iris, Relative", + .entity = UVC_GUID_UVC_CAMERA, + .selector = UVC_CT_IRIS_RELATIVE_CONTROL, + .size = 8, + .offset = 0, + .v4l2_type = V4L2_CTRL_TYPE_INTEGER, + .data_type = UVC_CTRL_DATA_TYPE_SIGNED, + }, { .id = V4L2_CID_ZOOM_ABSOLUTE, .name = "Zoom, Absolute", -- GitLab From ed3de6015a920c131fbcc770fb95097fde592d86 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 31 Mar 2010 12:29:26 -0300 Subject: [PATCH 259/534] V4L/DVB: uvcvideo: Use POLLOUT and POLLWRNORM for output devices The V4L2 specification requires drivers to use the write events in the file operations poll handler for output devices. The uvcvideo driver erroneously used read events for all devices. Fix this. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/uvc/uvc_queue.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c index 4a925a31b0e0..133c78d113ac 100644 --- a/drivers/media/video/uvc/uvc_queue.c +++ b/drivers/media/video/uvc/uvc_queue.c @@ -388,8 +388,12 @@ unsigned int uvc_queue_poll(struct uvc_video_queue *queue, struct file *file, poll_wait(file, &buf->wait, wait); if (buf->state == UVC_BUF_STATE_DONE || - buf->state == UVC_BUF_STATE_ERROR) - mask |= POLLIN | POLLRDNORM; + buf->state == UVC_BUF_STATE_ERROR) { + if (queue->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + mask |= POLLIN | POLLRDNORM; + else + mask |= POLLOUT | POLLWRNORM; + } done: mutex_unlock(&queue->mutex); -- GitLab From ecf6e72da31f951aed4618e422de62a72a1d76c6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 20 Mar 2010 00:17:58 -0300 Subject: [PATCH 260/534] V4L/DVB: ir-core: be less pedantic with RC protocol name Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 0592515a19f8..253e66999f18 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -93,7 +93,7 @@ static ssize_t store_protocol(struct device *d, buf = strsep((char **) &data, "\n"); - if (!strcasecmp(buf, "rc-5")) + if (!strcasecmp(buf, "rc-5") || !strcasecmp(buf, "rc5")) ir_type = IR_TYPE_RC5; else if (!strcasecmp(buf, "pd")) ir_type = IR_TYPE_PD; -- GitLab From d152b8b62421c441bea4eb5d92e9d1b4883fd201 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 20 Mar 2010 00:23:30 -0300 Subject: [PATCH 261/534] V4L/DVB: saa7134: use a full scancode table for M135A Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keymaps.c | 100 ++++++++++---------- drivers/media/video/saa7134/saa7134-input.c | 4 +- include/media/ir-common.h | 2 +- 3 files changed, 54 insertions(+), 52 deletions(-) diff --git a/drivers/media/IR/ir-keymaps.c b/drivers/media/IR/ir-keymaps.c index dfc777b78dea..55e7acd7209c 100644 --- a/drivers/media/IR/ir-keymaps.c +++ b/drivers/media/IR/ir-keymaps.c @@ -122,55 +122,57 @@ static struct ir_scancode ir_codes_avermedia_dvbt[] = { }; IR_TABLE(avermedia_dvbt, IR_TYPE_UNKNOWN, ir_codes_avermedia_dvbt); -/* Mauro Carvalho Chehab */ -static struct ir_scancode ir_codes_avermedia_m135a[] = { - { 0x00, KEY_POWER2 }, - { 0x2e, KEY_DOT }, /* '.' */ - { 0x01, KEY_MODE }, /* TV/FM */ - - { 0x05, KEY_1 }, - { 0x06, KEY_2 }, - { 0x07, KEY_3 }, - { 0x09, KEY_4 }, - { 0x0a, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x0d, KEY_7 }, - { 0x0e, KEY_8 }, - { 0x0f, KEY_9 }, - { 0x11, KEY_0 }, - - { 0x13, KEY_RIGHT }, /* -> */ - { 0x12, KEY_LEFT }, /* <- */ - - { 0x17, KEY_SLEEP }, /* Capturar Imagem */ - { 0x10, KEY_SHUFFLE }, /* Amostra */ - - /* FIXME: The keys bellow aren't ok */ - - { 0x43, KEY_CHANNELUP }, - { 0x42, KEY_CHANNELDOWN }, - { 0x1f, KEY_VOLUMEUP }, - { 0x1e, KEY_VOLUMEDOWN }, - { 0x0c, KEY_ENTER }, - - { 0x14, KEY_MUTE }, - { 0x08, KEY_AUDIO }, - - { 0x03, KEY_TEXT }, - { 0x04, KEY_EPG }, - { 0x2b, KEY_TV2 }, /* TV2 */ - - { 0x1d, KEY_RED }, - { 0x1c, KEY_YELLOW }, - { 0x41, KEY_GREEN }, - { 0x40, KEY_BLUE }, - - { 0x1a, KEY_PLAYPAUSE }, - { 0x19, KEY_RECORD }, - { 0x18, KEY_PLAY }, - { 0x1b, KEY_STOP }, -}; -IR_TABLE(avermedia_m135a, IR_TYPE_UNKNOWN, ir_codes_avermedia_m135a); +/* + * Avermedia M135A with IR model RM-JX + * The same codes exist on both Positivo (BR) and original IR + * Mauro Carvalho Chehab + */ +static struct ir_scancode ir_codes_avermedia_m135a_rm_jx[] = { + { 0x0200, KEY_POWER2 }, + { 0x022e, KEY_DOT }, /* '.' */ + { 0x0201, KEY_MODE }, /* TV/FM or SOURCE */ + + { 0x0205, KEY_1 }, + { 0x0206, KEY_2 }, + { 0x0207, KEY_3 }, + { 0x0209, KEY_4 }, + { 0x020a, KEY_5 }, + { 0x020b, KEY_6 }, + { 0x020d, KEY_7 }, + { 0x020e, KEY_8 }, + { 0x020f, KEY_9 }, + { 0x0211, KEY_0 }, + + { 0x0213, KEY_RIGHT }, /* -> or L */ + { 0x0212, KEY_LEFT }, /* <- or R */ + + { 0x0217, KEY_SLEEP }, /* Capturar Imagem or Snapshot */ + { 0x0210, KEY_SHUFFLE }, /* Amostra or 16 chan prev */ + + { 0x0303, KEY_CHANNELUP }, + { 0x0302, KEY_CHANNELDOWN }, + { 0x021f, KEY_VOLUMEUP }, + { 0x021e, KEY_VOLUMEDOWN }, + { 0x020c, KEY_ENTER }, /* Full Screen */ + + { 0x0214, KEY_MUTE }, + { 0x0208, KEY_AUDIO }, + + { 0x0203, KEY_TEXT }, /* Teletext */ + { 0x0204, KEY_EPG }, + { 0x022b, KEY_TV2 }, /* TV2 or PIP */ + + { 0x021d, KEY_RED }, + { 0x021c, KEY_YELLOW }, + { 0x0301, KEY_GREEN }, + { 0x0300, KEY_BLUE }, + + { 0x021a, KEY_PLAYPAUSE }, + { 0x0219, KEY_RECORD }, + { 0x0218, KEY_PLAY }, + { 0x021b, KEY_STOP }, +}; +IR_TABLE(aver-m135a-RM-JX, IR_TYPE_NEC, ir_codes_avermedia_m135a_rm_jx); /* Oldrich Jedlicka */ static struct ir_scancode ir_codes_avermedia_cardbus[] = { diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index ac62b77e5edc..241195e8be3d 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -525,9 +525,9 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); break; case SAA7134_BOARD_AVERMEDIA_M135A: - ir_codes = &ir_codes_avermedia_m135a_table; + ir_codes = &ir_codes_avermedia_m135a_rm_jx_table; mask_keydown = 0x0040000; - mask_keycode = 0x00013f; + mask_keycode = 0xffff; nec_gpio = 1; break; case SAA7134_BOARD_AVERMEDIA_777: diff --git a/include/media/ir-common.h b/include/media/ir-common.h index c66298062d39..c30b28384d8d 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -102,7 +102,7 @@ void ir_rc5_timer_keyup(unsigned long data); extern struct ir_scancode_table ir_codes_empty_table; extern struct ir_scancode_table ir_codes_avermedia_table; extern struct ir_scancode_table ir_codes_avermedia_dvbt_table; -extern struct ir_scancode_table ir_codes_avermedia_m135a_table; +extern struct ir_scancode_table ir_codes_avermedia_m135a_rm_jx_table; extern struct ir_scancode_table ir_codes_avermedia_cardbus_table; extern struct ir_scancode_table ir_codes_apac_viewcomp_table; extern struct ir_scancode_table ir_codes_pixelview_table; -- GitLab From 0210894956cf57d525d56341cc3e0f3d5d2db659 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 20 Mar 2010 00:25:37 -0300 Subject: [PATCH 262/534] V4L/DVB: saa7134: add code to allow changing IR protocol Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-input.c | 64 +++++++++++++++++++-- include/media/ir-common.h | 3 + 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 241195e8be3d..7e6f125e4e31 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -421,6 +421,10 @@ static void saa7134_input_timer(unsigned long data) void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) { + if (ir->running) + return; + + ir->running = 1; if (ir->polling) { setup_timer(&ir->timer, saa7134_input_timer, (unsigned long)dev); @@ -448,8 +452,50 @@ void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) void saa7134_ir_stop(struct saa7134_dev *dev) { + struct card_ir *ir = dev->remote; + + if (!ir->running) + return; if (dev->remote->polling) del_timer_sync(&dev->remote->timer); + else if (ir->rc5_gpio) + del_timer_sync(&ir->timer_end); + else if (ir->nec_gpio) + tasklet_kill(&ir->tlet); + ir->running = 0; +} + +int saa7134_ir_change_protocol(void *priv, u64 ir_type) +{ + struct saa7134_dev *dev = priv; + struct card_ir *ir = dev->remote; + u32 nec_gpio, rc5_gpio; + + if (ir_type == IR_TYPE_RC5) { + dprintk("Changing protocol to RC5\n"); + nec_gpio = 0; + rc5_gpio = 1; + } else if (ir_type == IR_TYPE_NEC) { + dprintk("Changing protocol to NEC\n"); + nec_gpio = 1; + rc5_gpio = 0; + } else { + dprintk("IR protocol type %ud is not supported\n", + (unsigned)ir_type); + return -EINVAL; + } + + if (ir->running) { + saa7134_ir_stop(dev); + ir->nec_gpio = nec_gpio; + ir->rc5_gpio = rc5_gpio; + saa7134_ir_start(dev, ir); + } else { + ir->nec_gpio = nec_gpio; + ir->rc5_gpio = rc5_gpio; + } + + return 0; } int saa7134_input_init1(struct saa7134_dev *dev) @@ -698,6 +744,9 @@ int saa7134_input_init1(struct saa7134_dev *dev) } ir->dev = input_dev; + dev->remote = ir; + + ir->running = 0; /* init hardware-specific stuff */ ir->mask_keycode = mask_keycode; @@ -713,6 +762,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); + if (ir_codes->ir_type != IR_TYPE_OTHER) { + ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; + ir->props.priv = dev; + ir->props.change_protocol = saa7134_ir_change_protocol; + + /* Set IR protocol */ + saa7134_ir_change_protocol(ir->props.priv, ir_codes->ir_type); + } err = ir_input_init(input_dev, &ir->ir, ir_type); if (err < 0) goto err_out_free; @@ -730,13 +787,12 @@ int saa7134_input_init1(struct saa7134_dev *dev) } input_dev->dev.parent = &dev->pci->dev; - dev->remote = ir; - saa7134_ir_start(dev, ir); - - err = ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME); + err = ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); if (err) goto err_out_stop; + saa7134_ir_start(dev, ir); + /* the remote isn't as bouncy as a keyboard */ ir->dev->rep[REP_DELAY] = repeat_delay; ir->dev->rep[REP_PERIOD] = repeat_period; diff --git a/include/media/ir-common.h b/include/media/ir-common.h index c30b28384d8d..41469b79ad11 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -51,6 +51,9 @@ struct card_ir { char name[32]; char phys[32]; + u32 running:1; + struct ir_dev_props props; + /* Usual gpio signalling */ u32 mask_keycode; -- GitLab From a3572c34da8dacc78a629211a91cf34e9b408701 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 20 Mar 2010 20:59:44 -0300 Subject: [PATCH 263/534] V4L/DVB: ir-core: Add logic to decode IR protocols at the IR core Adds a method to pass IR raw pulse/code events into ir-core. This is needed in order to support LIRC. It also helps to move common code from the drivers into the core. In order to allow testing, it implements a simple NEC protocol decoder at ir-nec-decoder.c file. The logic is about the same used at saa7134 driver that handles Avermedia M135A and Encore FM53 boards. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/Makefile | 2 +- drivers/media/IR/ir-nec-decoder.c | 131 ++++++++++++++++++++ drivers/media/IR/ir-raw-event.c | 117 +++++++++++++++++ drivers/media/video/saa7134/saa7134-input.c | 85 ++++++++++++- include/media/ir-common.h | 3 + include/media/ir-core.h | 32 +++++ 6 files changed, 365 insertions(+), 5 deletions(-) create mode 100644 drivers/media/IR/ir-nec-decoder.c create mode 100644 drivers/media/IR/ir-raw-event.c diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile index 171890e7a41d..18794c7b0ea6 100644 --- a/drivers/media/IR/Makefile +++ b/drivers/media/IR/Makefile @@ -1,5 +1,5 @@ ir-common-objs := ir-functions.o ir-keymaps.o -ir-core-objs := ir-keytable.o ir-sysfs.o +ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o ir-nec-decoder.o obj-$(CONFIG_IR_CORE) += ir-core.o obj-$(CONFIG_VIDEO_IR) += ir-common.o diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c new file mode 100644 index 000000000000..16360eb4055b --- /dev/null +++ b/drivers/media/IR/ir-nec-decoder.c @@ -0,0 +1,131 @@ +/* ir-raw-event.c - handle IR Pulse/Space event + * + * Copyright (C) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include + +/* Start time: 4.5 ms */ +#define MIN_START_TIME 3900000 +#define MAX_START_TIME 5100000 + +/* Pulse time: 560 us */ +#define MIN_PULSE_TIME 460000 +#define MAX_PULSE_TIME 660000 + +/* Bit 1 space time: 2.25ms-560 us */ +#define MIN_BIT1_TIME 1490000 +#define MAX_BIT1_TIME 1890000 + +/* Bit 0 space time: 1.12ms-560 us */ +#define MIN_BIT0_TIME 360000 +#define MAX_BIT0_TIME 760000 + + +/** Decode NEC pulsecode. This code can take up to 76.5 ms to run. + Unfortunately, using IRQ to decode pulse didn't work, since it uses + a pulse train of 38KHz. This means one pulse on each 52 us +*/ + +int ir_nec_decode(struct input_dev *input_dev, + struct ir_raw_event *evs, + int len) +{ + int i, count = -1; + int ircode = 0, not_code = 0; +#if 0 + /* Needed only after porting the event code to the decoder */ + struct ir_input_dev *ir = input_get_drvdata(input_dev); +#endif + + /* Be sure that the first event is an start one and is a pulse */ + for (i = 0; i < len; i++) { + if (evs[i].type & (IR_START_EVENT | IR_PULSE)) + break; + } + i++; /* First event doesn't contain data */ + + if (i >= len) + return 0; + + /* First space should have 4.5 ms otherwise is not NEC protocol */ + if ((evs[i].delta.tv_nsec < MIN_START_TIME) | + (evs[i].delta.tv_nsec > MAX_START_TIME) | + (evs[i].type != IR_SPACE)) + goto err; + + /* + * FIXME: need to implement the repeat sequence + */ + + count = 0; + for (i++; i < len; i++) { + int bit; + + if ((evs[i].delta.tv_nsec < MIN_PULSE_TIME) | + (evs[i].delta.tv_nsec > MAX_PULSE_TIME) | + (evs[i].type != IR_PULSE)) + goto err; + + if (++i >= len) + goto err; + if (evs[i].type != IR_SPACE) + goto err; + + if ((evs[i].delta.tv_nsec > MIN_BIT1_TIME) && + (evs[i].delta.tv_nsec < MAX_BIT1_TIME)) + bit = 1; + else if ((evs[i].delta.tv_nsec > MIN_BIT0_TIME) && + (evs[i].delta.tv_nsec < MAX_BIT0_TIME)) + bit = 0; + else + goto err; + + if (bit) { + int shift = count; + /* Address first, then command */ + if (shift < 8) { + shift += 8; + ircode |= 1 << shift; + } else if (shift < 16) { + not_code |= 1 << shift; + } else if (shift < 24) { + shift -= 16; + ircode |= 1 << shift; + } else { + shift -= 24; + not_code |= 1 << shift; + } + } + if (++count == 32) + break; + } + + /* + * Fixme: may need to accept Extended NEC protocol? + */ + if ((ircode & ~not_code) != ircode) { + IR_dprintk(1, "NEC checksum error: code 0x%04x, not-code 0x%04x\n", + ircode, not_code); + return -EINVAL; + } + + IR_dprintk(1, "NEC scancode 0x%04x\n", ircode); + + return ircode; +err: + IR_dprintk(1, "NEC decoded failed at bit %d while decoding %luus time\n", + count, (evs[i].delta.tv_nsec + 500) / 1000); + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(ir_nec_decode); diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c new file mode 100644 index 000000000000..9c71ac858923 --- /dev/null +++ b/drivers/media/IR/ir-raw-event.c @@ -0,0 +1,117 @@ +/* ir-raw-event.c - handle IR Pulse/Space event + * + * Copyright (C) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include + +/* Define the max number of bit transitions per IR keycode */ +#define MAX_IR_EVENT_SIZE 256 + +int ir_raw_event_register(struct input_dev *input_dev) +{ + struct ir_input_dev *ir = input_get_drvdata(input_dev); + int rc, size; + + ir->raw = kzalloc(sizeof(*ir->raw), GFP_KERNEL); + + size = sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE * 2; + size = roundup_pow_of_two(size); + + rc = kfifo_alloc(&ir->raw->kfifo, size, GFP_KERNEL); + + return rc; +} +EXPORT_SYMBOL_GPL(ir_raw_event_register); + +void ir_raw_event_unregister(struct input_dev *input_dev) +{ + struct ir_input_dev *ir = input_get_drvdata(input_dev); + + if (!ir->raw) + return; + + kfifo_free(&ir->raw->kfifo); + kfree(ir->raw); + ir->raw = NULL; +} +EXPORT_SYMBOL_GPL(ir_raw_event_unregister); + +int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type) +{ + struct ir_input_dev *ir = input_get_drvdata(input_dev); + struct timespec ts; + struct ir_raw_event event; + int rc; + + if (!ir->raw) + return -EINVAL; + + event.type = type; + event.delta.tv_sec = 0; + event.delta.tv_nsec = 0; + + ktime_get_ts(&ts); + + if (timespec_equal(&ir->raw->last_event, &event.delta)) + event.type |= IR_START_EVENT; + else + event.delta = timespec_sub(ts, ir->raw->last_event); + + memcpy(&ir->raw->last_event, &ts, sizeof(ts)); + + if (event.delta.tv_sec) { + event.type |= IR_START_EVENT; + event.delta.tv_sec = 0; + event.delta.tv_nsec = 0; + } + + kfifo_in(&ir->raw->kfifo, &event, sizeof(event)); + + return rc; +} +EXPORT_SYMBOL_GPL(ir_raw_event_store); + +int ir_raw_event_handle(struct input_dev *input_dev) +{ + struct ir_input_dev *ir = input_get_drvdata(input_dev); + int rc; + struct ir_raw_event *evs; + int len, i; + + /* + * Store the events into a temporary buffer. This allows calling more than + * one decoder to deal with the received data + */ + len = kfifo_len(&ir->raw->kfifo) / sizeof(*evs); + if (!len) + return 0; + evs = kmalloc(len * sizeof(*evs), GFP_ATOMIC); + + for (i = 0; i < len; i++) { + rc = kfifo_out(&ir->raw->kfifo, &evs[i], sizeof(*evs)); + if (rc != sizeof(*evs)) { + IR_dprintk(1, "overflow error: received %d instead of %zd\n", + rc, sizeof(*evs)); + return -EINVAL; + } + IR_dprintk(2, "event type %d, time before event: %07luus\n", + evs[i].type, (evs[i].delta.tv_nsec + 500) / 1000); + } + + rc = ir_nec_decode(input_dev, evs, len); + + kfree(evs); + + return rc; +} +EXPORT_SYMBOL_GPL(ir_raw_event_handle); diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 7e6f125e4e31..1a7cf9c8c68c 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -68,6 +68,7 @@ MODULE_PARM_DESC(disable_other_ir, "disable full codes of " /* Helper functions for RC5 and NEC decoding at GPIO16 or GPIO18 */ static int saa7134_rc5_irq(struct saa7134_dev *dev); static int saa7134_nec_irq(struct saa7134_dev *dev); +static int saa7134_raw_decode_irq(struct saa7134_dev *dev); static void nec_task(unsigned long data); static void saa7134_nec_timer(unsigned long data); @@ -403,10 +404,12 @@ void saa7134_input_irq(struct saa7134_dev *dev) if (ir->nec_gpio) { saa7134_nec_irq(dev); - } else if (!ir->polling && !ir->rc5_gpio) { + } else if (!ir->polling && !ir->rc5_gpio && !ir->raw_decode) { build_key(dev); } else if (ir->rc5_gpio) { saa7134_rc5_irq(dev); + } else if (ir->raw_decode) { + saa7134_raw_decode_irq(dev); } } @@ -419,6 +422,23 @@ static void saa7134_input_timer(unsigned long data) mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); } +void ir_raw_decode_timer_end(unsigned long data) +{ + struct saa7134_dev *dev = (struct saa7134_dev *)data; + struct card_ir *ir = dev->remote; + int rc; + + /* + * FIXME: the IR key handling code should be called by the decoder, + * after implementing the repeat mode + */ + rc = ir_raw_event_handle(dev->remote->dev); + if (rc >= 0) { + ir_input_keydown(ir->dev, &ir->ir, rc); + ir_input_nokey(ir->dev, &ir->ir); + } +} + void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) { if (ir->running) @@ -447,6 +467,11 @@ void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) setup_timer(&ir->timer_keyup, saa7134_nec_timer, (unsigned long)dev); tasklet_init(&ir->tlet, nec_task, (unsigned long)dev); + } else if (ir->raw_decode) { + /* set timer_end for code completion */ + init_timer(&ir->timer_end); + ir->timer_end.function = ir_raw_decode_timer_end; + ir->timer_end.data = (unsigned long)dev; } } @@ -462,6 +487,9 @@ void saa7134_ir_stop(struct saa7134_dev *dev) del_timer_sync(&ir->timer_end); else if (ir->nec_gpio) tasklet_kill(&ir->tlet); + else if (ir->raw_decode) + del_timer_sync(&ir->timer_end); + ir->running = 0; } @@ -509,6 +537,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) int polling = 0; int rc5_gpio = 0; int nec_gpio = 0; + int raw_decode = 0; u64 ir_type = IR_TYPE_OTHER; int err; @@ -574,7 +603,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir_codes = &ir_codes_avermedia_m135a_rm_jx_table; mask_keydown = 0x0040000; mask_keycode = 0xffff; - nec_gpio = 1; + raw_decode = 1; break; case SAA7134_BOARD_AVERMEDIA_777: case SAA7134_BOARD_AVERMEDIA_A16AR: @@ -755,6 +784,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->polling = polling; ir->rc5_gpio = rc5_gpio; ir->nec_gpio = nec_gpio; + ir->raw_decode = raw_decode; /* init input device */ snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)", @@ -762,7 +792,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); - if (ir_codes->ir_type != IR_TYPE_OTHER) { + if (ir_codes->ir_type != IR_TYPE_OTHER && !raw_decode) { ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; ir->props.priv = dev; ir->props.change_protocol = saa7134_ir_change_protocol; @@ -790,6 +820,11 @@ int saa7134_input_init1(struct saa7134_dev *dev) err = ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); if (err) goto err_out_stop; + if (ir_codes->ir_type != IR_TYPE_OTHER) { + err = ir_raw_event_register(ir->dev); + if (err) + goto err_out_stop; + } saa7134_ir_start(dev, ir); @@ -813,6 +848,7 @@ void saa7134_input_fini(struct saa7134_dev *dev) return; saa7134_ir_stop(dev); + ir_raw_event_unregister(dev->remote->dev); ir_input_unregister(dev->remote->dev); kfree(dev->remote); dev->remote = NULL; @@ -919,6 +955,48 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) i2c_new_device(&dev->i2c_adap, &info); } +static int saa7134_raw_decode_irq(struct saa7134_dev *dev) +{ + struct card_ir *ir = dev->remote; + unsigned long timeout; + int count, pulse, oldpulse; + + /* Disable IR IRQ line */ + saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); + + /* Generate initial event */ + saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); + saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); + pulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; + ir_raw_event_store(dev->remote->dev, pulse? IR_PULSE : IR_SPACE); + +#if 1 + /* Wait up to 10 ms for event change */ + oldpulse = pulse; + for (count = 0; count < 1000; count++) { + udelay(10); + /* rising SAA7134_GPIO_GPRESCAN reads the status */ + saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); + saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); + pulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) + & ir->mask_keydown; + if (pulse != oldpulse) + break; + } + + /* Store final event */ + ir_raw_event_store(dev->remote->dev, pulse? IR_PULSE : IR_SPACE); +#endif + /* Wait 15 ms before deciding to do something else */ + timeout = jiffies + jiffies_to_msecs(15); + mod_timer(&ir->timer_end, timeout); + + /* Enable IR IRQ line */ + saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); + + return 1; +} + static int saa7134_rc5_irq(struct saa7134_dev *dev) { struct card_ir *ir = dev->remote; @@ -961,7 +1039,6 @@ static int saa7134_rc5_irq(struct saa7134_dev *dev) return 1; } - /* On NEC protocol, One has 2.25 ms, and zero has 1.125 ms The first pulse (start) has 9 + 4.5 ms */ diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 41469b79ad11..87f2ec78deb8 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -82,6 +82,9 @@ struct card_ir { /* NEC decoding */ u32 nec_gpio; struct tasklet_struct tlet; + + /* IR core raw decoding */ + u32 raw_decode; }; /* Routines from ir-functions.c */ diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 1eae72d518e0..369969d90779 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -16,6 +16,8 @@ #include #include +#include +#include extern int ir_core_debug; #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ @@ -27,6 +29,13 @@ extern int ir_core_debug; #define IR_TYPE_NEC (1 << 2) #define IR_TYPE_OTHER (((u64)1) << 63l) +enum raw_event_type { + IR_SPACE = (1 << 0), + IR_PULSE = (1 << 1), + IR_START_EVENT = (1 << 2), + IR_STOP_EVENT = (1 << 3), +}; + struct ir_scancode { u16 scancode; u32 keycode; @@ -46,6 +55,15 @@ struct ir_dev_props { int (*change_protocol)(void *priv, u64 ir_type); }; +struct ir_raw_event { + struct timespec delta; /* Time spent before event */ + enum raw_event_type type; /* event type */ +}; + +struct ir_raw_event_ctrl { + struct kfifo kfifo; /* fifo for the pulse/space events */ + struct timespec last_event; /* when last event occurred */ +}; struct ir_input_dev { struct device dev; /* device */ @@ -53,7 +71,9 @@ struct ir_input_dev { struct ir_scancode_table rc_tab; /* scan/key table */ unsigned long devno; /* device number */ const struct ir_dev_props *props; /* Device properties */ + struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ }; + #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) /* Routines from ir-keytable.c */ @@ -72,4 +92,16 @@ void ir_input_unregister(struct input_dev *input_dev); int ir_register_class(struct input_dev *input_dev); void ir_unregister_class(struct input_dev *input_dev); +/* Routines from ir-raw-event.c */ +int ir_raw_event_register(struct input_dev *input_dev); +void ir_raw_event_unregister(struct input_dev *input_dev); +int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type); +int ir_raw_event_handle(struct input_dev *input_dev); + +/* from ir-nec-decoder.c */ +int ir_nec_decode(struct input_dev *input_dev, + struct ir_raw_event *evs, + int len); + + #endif -- GitLab From 6660de568d164e4eda6617dadcb999c96e62203f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 21 Mar 2010 12:15:16 -0300 Subject: [PATCH 264/534] V4L/DVB: ir-core: add two functions to report keyup/keydown events Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 57 +++++++++++++++++++++++++++++++++- include/media/ir-core.h | 4 +++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 73fe4bec83bc..e59290febf81 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -365,7 +365,7 @@ static int ir_setkeycode(struct input_dev *dev, * * This routine is used by the input routines when a key is pressed at the * IR. The scancode is received and needs to be converted into a keycode. - * If the key is not found, it returns KEY_UNKNOWN. Otherwise, returns the + * If the key is not found, it returns KEY_RESERVED. Otherwise, returns the * corresponding keycode from the table. */ u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) @@ -391,6 +391,61 @@ u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) } EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); +/** + * ir_keyup() - generates input event to cleanup a key press + * @input_dev: the struct input_dev descriptor of the device + * + * This routine is used by the input routines when a key is pressed at the + * IR. It reports a keyup input event via input_report_key(). + */ +void ir_keyup(struct input_dev *dev) +{ + struct ir_input_dev *ir = input_get_drvdata(dev); + + if (!ir->keypressed) + return; + + input_report_key(dev, ir->keycode, 0); + input_sync(dev); + ir->keypressed = 0; +} +EXPORT_SYMBOL_GPL(ir_keyup); + +/** + * ir_keydown() - generates input event for a key press + * @input_dev: the struct input_dev descriptor of the device + * @scancode: the scancode that we're seeking + * + * This routine is used by the input routines when a key is pressed at the + * IR. It gets the keycode for a scancode and reports an input event via + * input_report_key(). + */ +void ir_keydown(struct input_dev *dev, int scancode) +{ + struct ir_input_dev *ir = input_get_drvdata(dev); + + u32 keycode = ir_g_keycode_from_table(dev, scancode); + + /* If already sent a keydown, do a keyup */ + if (ir->keypressed) + ir_keyup(dev); + + if (KEY_RESERVED == keycode) + return; + + ir->keycode = keycode; + ir->keypressed = 1; + + IR_dprintk(1, "%s: key down event, key 0x%04x, scancode 0x%04x\n", + dev->name, keycode, scancode); + + input_report_key(dev, ir->keycode, 1); + input_sync(dev); + +} +EXPORT_SYMBOL_GPL(ir_keydown); + + /** * ir_input_register() - sets the IR keycode table and add the handlers * for keymap table get/set diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 369969d90779..198fd61f0da9 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -72,6 +72,10 @@ struct ir_input_dev { unsigned long devno; /* device number */ const struct ir_dev_props *props; /* Device properties */ struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ + + /* key info - needed by IR keycode handlers */ + u32 keycode; /* linux key code */ + int keypressed; /* current state */ }; #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) -- GitLab From ada39630c758c5c3098f4fc1361103ea2bc1afe0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 21 Mar 2010 12:24:24 -0300 Subject: [PATCH 265/534] V4L/DVB: ir-core/saa7134: Move ir keyup/keydown code to the ir-core Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-nec-decoder.c | 90 +++++++++++++-------- drivers/media/video/saa7134/saa7134-input.c | 12 +-- include/media/ir-core.h | 3 +- 3 files changed, 61 insertions(+), 44 deletions(-) diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 16360eb4055b..a58c717ec6b0 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -30,37 +30,35 @@ #define MIN_BIT0_TIME 360000 #define MAX_BIT0_TIME 760000 - -/** Decode NEC pulsecode. This code can take up to 76.5 ms to run. - Unfortunately, using IRQ to decode pulse didn't work, since it uses - a pulse train of 38KHz. This means one pulse on each 52 us -*/ - -int ir_nec_decode(struct input_dev *input_dev, - struct ir_raw_event *evs, - int len) +/** + * __ir_nec_decode() - Decode one NEC pulsecode + * @input_dev: the struct input_dev descriptor of the device + * @evs: event array with type/duration of pulse/space + * @len: length of the array + * @pos: position to start seeking for a code + * This function returns the decoded ircode or -EINVAL if no pulse got decoded + */ +static int __ir_nec_decode(struct input_dev *input_dev, + struct ir_raw_event *evs, + int len, int *pos) { - int i, count = -1; + int count = -1; int ircode = 0, not_code = 0; -#if 0 - /* Needed only after porting the event code to the decoder */ - struct ir_input_dev *ir = input_get_drvdata(input_dev); -#endif /* Be sure that the first event is an start one and is a pulse */ - for (i = 0; i < len; i++) { - if (evs[i].type & (IR_START_EVENT | IR_PULSE)) + for (; *pos < len; (*pos)++) { + if (evs[*pos].type & (IR_START_EVENT | IR_PULSE)) break; } - i++; /* First event doesn't contain data */ + (*pos)++; /* First event doesn't contain data */ - if (i >= len) + if (*pos >= len) return 0; /* First space should have 4.5 ms otherwise is not NEC protocol */ - if ((evs[i].delta.tv_nsec < MIN_START_TIME) | - (evs[i].delta.tv_nsec > MAX_START_TIME) | - (evs[i].type != IR_SPACE)) + if ((evs[*pos].delta.tv_nsec < MIN_START_TIME) | + (evs[*pos].delta.tv_nsec > MAX_START_TIME) | + (evs[*pos].type != IR_SPACE)) goto err; /* @@ -68,24 +66,24 @@ int ir_nec_decode(struct input_dev *input_dev, */ count = 0; - for (i++; i < len; i++) { + for ((*pos)++; *pos < len; (*pos)++) { int bit; - if ((evs[i].delta.tv_nsec < MIN_PULSE_TIME) | - (evs[i].delta.tv_nsec > MAX_PULSE_TIME) | - (evs[i].type != IR_PULSE)) + if ((evs[*pos].delta.tv_nsec < MIN_PULSE_TIME) | + (evs[*pos].delta.tv_nsec > MAX_PULSE_TIME) | + (evs[*pos].type != IR_PULSE)) goto err; - if (++i >= len) + if (++*pos >= len) goto err; - if (evs[i].type != IR_SPACE) + if (evs[*pos].type != IR_SPACE) goto err; - if ((evs[i].delta.tv_nsec > MIN_BIT1_TIME) && - (evs[i].delta.tv_nsec < MAX_BIT1_TIME)) + if ((evs[*pos].delta.tv_nsec > MIN_BIT1_TIME) && + (evs[*pos].delta.tv_nsec < MAX_BIT1_TIME)) bit = 1; - else if ((evs[i].delta.tv_nsec > MIN_BIT0_TIME) && - (evs[i].delta.tv_nsec < MAX_BIT0_TIME)) + else if ((evs[*pos].delta.tv_nsec > MIN_BIT0_TIME) && + (evs[*pos].delta.tv_nsec < MAX_BIT0_TIME)) bit = 0; else goto err; @@ -120,12 +118,40 @@ int ir_nec_decode(struct input_dev *input_dev, } IR_dprintk(1, "NEC scancode 0x%04x\n", ircode); + ir_keydown(input_dev, ircode); + ir_keyup(input_dev); return ircode; err: IR_dprintk(1, "NEC decoded failed at bit %d while decoding %luus time\n", - count, (evs[i].delta.tv_nsec + 500) / 1000); + count, (evs[*pos].delta.tv_nsec + 500) / 1000); return -EINVAL; } + +/** + * __ir_nec_decode() - Decodes all NEC pulsecodes on a given array + * @input_dev: the struct input_dev descriptor of the device + * @evs: event array with type/duration of pulse/space + * @len: length of the array + * This function returns the number of decoded pulses or -EINVAL if no + * pulse got decoded + */ +int ir_nec_decode(struct input_dev *input_dev, + struct ir_raw_event *evs, + int len) +{ + int pos = 0; + int rc = 0; + + while (pos < len) { + if (__ir_nec_decode(input_dev, evs, len, &pos) >= 0) + rc++; + } + + if (!rc) + return -EINVAL; + return rc; +} + EXPORT_SYMBOL_GPL(ir_nec_decode); diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 1a7cf9c8c68c..dff33279ab33 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -425,18 +425,8 @@ static void saa7134_input_timer(unsigned long data) void ir_raw_decode_timer_end(unsigned long data) { struct saa7134_dev *dev = (struct saa7134_dev *)data; - struct card_ir *ir = dev->remote; - int rc; - /* - * FIXME: the IR key handling code should be called by the decoder, - * after implementing the repeat mode - */ - rc = ir_raw_event_handle(dev->remote->dev); - if (rc >= 0) { - ir_input_keydown(ir->dev, &ir->ir, rc); - ir_input_nokey(ir->dev, &ir->ir); - } + ir_raw_event_handle(dev->remote->dev); } void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 198fd61f0da9..9e03528a767a 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -84,7 +84,8 @@ struct ir_input_dev { u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); - +void ir_keyup(struct input_dev *dev); +void ir_keydown(struct input_dev *dev, int scancode); int ir_input_register(struct input_dev *dev, const struct ir_scancode_table *ir_codes, const struct ir_dev_props *props, -- GitLab From 9f1547829a6f39fe6b2da22653dff40502f3d568 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 21 Mar 2010 13:00:55 -0300 Subject: [PATCH 266/534] V4L/DVB: saa7134: don't wait too much to generate an IR event on raw_decode At raw_decode mode, the key is processed after the end of a timer. The previous code resets the timer every time something is received at the IR port. While this works fine with IR's that don't implement repeat, like Avermedia RM-JX IR, it keeps waiting until keydown, on IR's that implement NEC repeat command, like the Terratec yellow. The solution is to change the behaviour to do the timeout after the first received data. The timeout is currently set to 15 ms, as it works fine with NEC protcocol. It may need some adjustments to support other protocols and to better handle spurious detections that may happen with some IR sensors. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 1 + drivers/media/IR/ir-nec-decoder.c | 122 +++++++++++++------- drivers/media/IR/ir-raw-event.c | 14 +++ drivers/media/video/saa7134/saa7134-input.c | 43 +++---- include/media/ir-core.h | 2 + 5 files changed, 117 insertions(+), 65 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index e59290febf81..fcb0f0cb1fe1 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -405,6 +405,7 @@ void ir_keyup(struct input_dev *dev) if (!ir->keypressed) return; + IR_dprintk(1, "keyup key 0x%04x\n", ir->keycode); input_report_key(dev, ir->keycode, 0); input_sync(dev); ir->keypressed = 0; diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index a58c717ec6b0..104482a6991e 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -14,21 +14,51 @@ #include -/* Start time: 4.5 ms */ -#define MIN_START_TIME 3900000 -#define MAX_START_TIME 5100000 +/* Start time: 4.5 ms + 560 us of the next pulse */ +#define MIN_START_TIME (3900000 + 560000) +#define MAX_START_TIME (5100000 + 560000) -/* Pulse time: 560 us */ -#define MIN_PULSE_TIME 460000 -#define MAX_PULSE_TIME 660000 +/* Bit 1 time: 2.25ms us */ +#define MIN_BIT1_TIME 2050000 +#define MAX_BIT1_TIME 2450000 -/* Bit 1 space time: 2.25ms-560 us */ -#define MIN_BIT1_TIME 1490000 -#define MAX_BIT1_TIME 1890000 +/* Bit 0 time: 1.12ms us */ +#define MIN_BIT0_TIME 920000 +#define MAX_BIT0_TIME 1320000 -/* Bit 0 space time: 1.12ms-560 us */ -#define MIN_BIT0_TIME 360000 -#define MAX_BIT0_TIME 760000 +/* Total IR code is 110 ms, including the 9 ms for the start pulse */ +#define MAX_NEC_TIME 4000000 + +/* Total IR code is 110 ms, including the 9 ms for the start pulse */ +#define MIN_REPEAT_TIME 99000000 +#define MAX_REPEAT_TIME 112000000 + +/* Repeat time: 2.25ms us */ +#define MIN_REPEAT_START_TIME 2050000 +#define MAX_REPEAT_START_TIME 3000000 + +#define REPEAT_TIME 240 /* ms */ + +/** is_repeat - Check if it is a NEC repeat event + * @input_dev: the struct input_dev descriptor of the device + * @pos: the position of the first event + * @len: the length of the buffer + */ +static int is_repeat(struct ir_raw_event *evs, int len, int pos) +{ + if ((evs[pos].delta.tv_nsec < MIN_REPEAT_START_TIME) || + (evs[pos].delta.tv_nsec > MAX_REPEAT_START_TIME)) + return 0; + + if (++pos >= len) + return 0; + + if ((evs[pos].delta.tv_nsec < MIN_REPEAT_TIME) || + (evs[pos].delta.tv_nsec > MAX_REPEAT_TIME)) + return 0; + + return 1; +} /** * __ir_nec_decode() - Decode one NEC pulsecode @@ -36,49 +66,59 @@ * @evs: event array with type/duration of pulse/space * @len: length of the array * @pos: position to start seeking for a code - * This function returns the decoded ircode or -EINVAL if no pulse got decoded + * This function returns -EINVAL if no pulse got decoded, + * 0 if buffer is empty and 1 if one keycode were handled. */ static int __ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event *evs, int len, int *pos) { + struct ir_input_dev *ir = input_get_drvdata(input_dev); int count = -1; int ircode = 0, not_code = 0; /* Be sure that the first event is an start one and is a pulse */ for (; *pos < len; (*pos)++) { - if (evs[*pos].type & (IR_START_EVENT | IR_PULSE)) + /* Very long delays are considered as start events */ + if (evs[*pos].delta.tv_nsec > MAX_NEC_TIME) break; - } - (*pos)++; /* First event doesn't contain data */ + if (evs[*pos].type & IR_START_EVENT) + break; + IR_dprintk(1, "%luus: Spurious NEC %s\n", + (evs[*pos].delta.tv_nsec + 500) / 1000, + (evs[*pos].type & IR_SPACE) ? "space" : "pulse"); + } if (*pos >= len) return 0; - /* First space should have 4.5 ms otherwise is not NEC protocol */ - if ((evs[*pos].delta.tv_nsec < MIN_START_TIME) | - (evs[*pos].delta.tv_nsec > MAX_START_TIME) | - (evs[*pos].type != IR_SPACE)) + (*pos)++; /* First event doesn't contain data */ + + if (evs[*pos].type != IR_PULSE) goto err; - /* - * FIXME: need to implement the repeat sequence - */ + /* Check if it is a NEC repeat event */ + if (is_repeat(evs, len, *pos)) { + *pos += 2; + if (ir->keypressed) { + mod_timer(&ir->raw->timer_keyup, + jiffies + msecs_to_jiffies(REPEAT_TIME)); + IR_dprintk(1, "NEC repeat event\n"); + return 1; + } else { + IR_dprintk(1, "missing NEC repeat event\n"); + return 0; + } + } + + /* First space should have 4.5 ms otherwise is not NEC protocol */ + if ((evs[*pos].delta.tv_nsec < MIN_START_TIME) || + (evs[*pos].delta.tv_nsec > MAX_START_TIME)) + goto err; count = 0; for ((*pos)++; *pos < len; (*pos)++) { int bit; - - if ((evs[*pos].delta.tv_nsec < MIN_PULSE_TIME) | - (evs[*pos].delta.tv_nsec > MAX_PULSE_TIME) | - (evs[*pos].type != IR_PULSE)) - goto err; - - if (++*pos >= len) - goto err; - if (evs[*pos].type != IR_SPACE) - goto err; - if ((evs[*pos].delta.tv_nsec > MIN_BIT1_TIME) && (evs[*pos].delta.tv_nsec < MAX_BIT1_TIME)) bit = 1; @@ -107,6 +147,7 @@ static int __ir_nec_decode(struct input_dev *input_dev, if (++count == 32) break; } + *pos++; /* * Fixme: may need to accept Extended NEC protocol? @@ -119,12 +160,15 @@ static int __ir_nec_decode(struct input_dev *input_dev, IR_dprintk(1, "NEC scancode 0x%04x\n", ircode); ir_keydown(input_dev, ircode); - ir_keyup(input_dev); + mod_timer(&ir->raw->timer_keyup, + jiffies + msecs_to_jiffies(REPEAT_TIME)); - return ircode; + return 1; err: - IR_dprintk(1, "NEC decoded failed at bit %d while decoding %luus time\n", - count, (evs[*pos].delta.tv_nsec + 500) / 1000); + IR_dprintk(1, "NEC decoded failed at bit %d (%s) while decoding %luus time\n", + count, + (evs[*pos].type & IR_SPACE) ? "space" : "pulse", + (evs[*pos].delta.tv_nsec + 500) / 1000); return -EINVAL; } @@ -145,7 +189,7 @@ int ir_nec_decode(struct input_dev *input_dev, int rc = 0; while (pos < len) { - if (__ir_nec_decode(input_dev, evs, len, &pos) >= 0) + if (__ir_nec_decode(input_dev, evs, len, &pos) > 0) rc++; } diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 9c71ac858923..0ae55433cef9 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -17,6 +17,13 @@ /* Define the max number of bit transitions per IR keycode */ #define MAX_IR_EVENT_SIZE 256 +static void ir_keyup_timer(unsigned long data) +{ + struct input_dev *input_dev = (struct input_dev *)data; + + ir_keyup(input_dev); +} + int ir_raw_event_register(struct input_dev *input_dev) { struct ir_input_dev *ir = input_get_drvdata(input_dev); @@ -27,6 +34,11 @@ int ir_raw_event_register(struct input_dev *input_dev) size = sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE * 2; size = roundup_pow_of_two(size); + init_timer(&ir->raw->timer_keyup); + ir->raw->timer_keyup.function = ir_keyup_timer; + ir->raw->timer_keyup.data = (unsigned long)input_dev; + set_bit(EV_REP, input_dev->evbit); + rc = kfifo_alloc(&ir->raw->kfifo, size, GFP_KERNEL); return rc; @@ -40,6 +52,8 @@ void ir_raw_event_unregister(struct input_dev *input_dev) if (!ir->raw) return; + del_timer_sync(&ir->raw->timer_keyup); + kfifo_free(&ir->raw->kfifo); kfree(ir->raw); ir->raw = NULL; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index dff33279ab33..32859e549afa 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -425,8 +425,11 @@ static void saa7134_input_timer(unsigned long data) void ir_raw_decode_timer_end(unsigned long data) { struct saa7134_dev *dev = (struct saa7134_dev *)data; + struct card_ir *ir = dev->remote; ir_raw_event_handle(dev->remote->dev); + + ir->active = 0; } void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) @@ -462,6 +465,7 @@ void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) init_timer(&ir->timer_end); ir->timer_end.function = ir_raw_decode_timer_end; ir->timer_end.data = (unsigned long)dev; + ir->active = 0; } } @@ -477,8 +481,10 @@ void saa7134_ir_stop(struct saa7134_dev *dev) del_timer_sync(&ir->timer_end); else if (ir->nec_gpio) tasklet_kill(&ir->tlet); - else if (ir->raw_decode) + else if (ir->raw_decode) { del_timer_sync(&ir->timer_end); + ir->active = 0; + } ir->running = 0; } @@ -951,38 +957,23 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) unsigned long timeout; int count, pulse, oldpulse; - /* Disable IR IRQ line */ - saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); - /* Generate initial event */ saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); pulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; ir_raw_event_store(dev->remote->dev, pulse? IR_PULSE : IR_SPACE); -#if 1 - /* Wait up to 10 ms for event change */ - oldpulse = pulse; - for (count = 0; count < 1000; count++) { - udelay(10); - /* rising SAA7134_GPIO_GPRESCAN reads the status */ - saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); - saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); - pulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) - & ir->mask_keydown; - if (pulse != oldpulse) - break; - } - - /* Store final event */ - ir_raw_event_store(dev->remote->dev, pulse? IR_PULSE : IR_SPACE); -#endif - /* Wait 15 ms before deciding to do something else */ - timeout = jiffies + jiffies_to_msecs(15); - mod_timer(&ir->timer_end, timeout); - /* Enable IR IRQ line */ - saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); + /* + * Wait 15 ms from the start of the first IR event before processing + * the event. This time is enough for NEC protocol. May need adjustments + * to work with other protocols. + */ + if (!ir->active) { + timeout = jiffies + jiffies_to_msecs(15); + mod_timer(&ir->timer_end, timeout); + ir->active = 1; + } return 1; } diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 9e03528a767a..8d8ed7e06cd5 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -18,6 +18,7 @@ #include #include #include +#include extern int ir_core_debug; #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ @@ -63,6 +64,7 @@ struct ir_raw_event { struct ir_raw_event_ctrl { struct kfifo kfifo; /* fifo for the pulse/space events */ struct timespec last_event; /* when last event occurred */ + struct timer_list timer_keyup; /* timer for key release */ }; struct ir_input_dev { -- GitLab From 995187bed30c0545e8da88372e9807da0a85911e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 24 Mar 2010 20:47:53 -0300 Subject: [PATCH 267/534] V4L/DVB: ir-core: dynamically load the compiled IR protocols Instead of hardcoding the protocols into ir-core, add a register interface for the IR protocol decoders, and convert ir-nec-decoder into a client of ir-core. With this approach, it is possible to dynamically load the needed IR protocols, and to add a RAW IR interface module, registered as one IR raw protocol decoder. This patch opens a way to register a lirc_dev interface to work as an userspace IR protocol decoder. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/Kconfig | 9 +++++ drivers/media/IR/Makefile | 3 +- drivers/media/IR/ir-nec-decoder.c | 35 +++++++++++++++---- drivers/media/IR/ir-raw-event.c | 57 ++++++++++++++++++++++++++++++- drivers/media/IR/ir-sysfs.c | 7 ++-- include/media/ir-core.h | 29 +++++++++++++--- 6 files changed, 125 insertions(+), 15 deletions(-) diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig index 4dde7d180a32..de410d46ae26 100644 --- a/drivers/media/IR/Kconfig +++ b/drivers/media/IR/Kconfig @@ -7,3 +7,12 @@ config VIDEO_IR tristate depends on IR_CORE default IR_CORE + +config IR_NEC_DECODER + tristate "Enable IR raw decoder for NEC protocol" + depends on IR_CORE + default y + + ---help--- + Enable this option if you have IR with NEC protocol, and + if the IR is decoded in software diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile index 18794c7b0ea6..6140b2712c8a 100644 --- a/drivers/media/IR/Makefile +++ b/drivers/media/IR/Makefile @@ -1,5 +1,6 @@ ir-common-objs := ir-functions.o ir-keymaps.o -ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o ir-nec-decoder.o +ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o obj-$(CONFIG_IR_CORE) += ir-core.o obj-$(CONFIG_VIDEO_IR) += ir-common.o +obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 104482a6991e..c9a986dd57fd 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -1,4 +1,4 @@ -/* ir-raw-event.c - handle IR Pulse/Space event +/* ir-nec-decoder.c - handle NEC IR Pulse/Space protocol * * Copyright (C) 2010 by Mauro Carvalho Chehab * @@ -147,7 +147,7 @@ static int __ir_nec_decode(struct input_dev *input_dev, if (++count == 32) break; } - *pos++; + (*pos)++; /* * Fixme: may need to accept Extended NEC protocol? @@ -181,9 +181,9 @@ static int __ir_nec_decode(struct input_dev *input_dev, * This function returns the number of decoded pulses or -EINVAL if no * pulse got decoded */ -int ir_nec_decode(struct input_dev *input_dev, - struct ir_raw_event *evs, - int len) +static int ir_nec_decode(struct input_dev *input_dev, + struct ir_raw_event *evs, + int len) { int pos = 0; int rc = 0; @@ -198,4 +198,27 @@ int ir_nec_decode(struct input_dev *input_dev, return rc; } -EXPORT_SYMBOL_GPL(ir_nec_decode); +static struct ir_raw_handler nec_handler = { + .decode = ir_nec_decode, +}; + +static int __init ir_nec_decode_init(void) +{ + ir_raw_handler_register(&nec_handler); + + printk(KERN_INFO "IR NEC protocol handler initialized\n"); + return 0; +} + +static void __exit ir_nec_decode_exit(void) +{ + ir_raw_handler_unregister(&nec_handler); +} + +module_init(ir_nec_decode_init); +module_exit(ir_nec_decode_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); +MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); +MODULE_DESCRIPTION("NEC IR protocol decoder"); diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 0ae55433cef9..3eae128400ea 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -13,10 +13,18 @@ */ #include +#include /* Define the max number of bit transitions per IR keycode */ #define MAX_IR_EVENT_SIZE 256 +/* Used to handle IR raw handler extensions */ +static LIST_HEAD(ir_raw_handler_list); +static DEFINE_MUTEX(ir_raw_handler_lock); + +/* Used to load the decoders */ +static struct work_struct wq_load; + static void ir_keyup_timer(unsigned long data) { struct input_dev *input_dev = (struct input_dev *)data; @@ -101,6 +109,7 @@ int ir_raw_event_handle(struct input_dev *input_dev) int rc; struct ir_raw_event *evs; int len, i; + struct ir_raw_handler *ir_raw_handler; /* * Store the events into a temporary buffer. This allows calling more than @@ -122,10 +131,56 @@ int ir_raw_event_handle(struct input_dev *input_dev) evs[i].type, (evs[i].delta.tv_nsec + 500) / 1000); } - rc = ir_nec_decode(input_dev, evs, len); + /* + * Call all ir decoders. This allows decoding the same event with + * more than one protocol handler. + * FIXME: better handle the returned code: does it make sense to use + * other decoders, if the first one already handled the IR? + */ + list_for_each_entry(ir_raw_handler, &ir_raw_handler_list, list) { + rc = ir_raw_handler->decode(input_dev, evs, len); + } kfree(evs); return rc; } EXPORT_SYMBOL_GPL(ir_raw_event_handle); + +/* + * Extension interface - used to register the IR decoders + */ + +int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler) +{ + mutex_lock(&ir_raw_handler_lock); + list_add_tail(&ir_raw_handler->list, &ir_raw_handler_list); + mutex_unlock(&ir_raw_handler_lock); + return 0; +} +EXPORT_SYMBOL(ir_raw_handler_register); + +void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler) +{ + mutex_lock(&ir_raw_handler_lock); + list_del(&ir_raw_handler->list); + mutex_unlock(&ir_raw_handler_lock); +} +EXPORT_SYMBOL(ir_raw_handler_unregister); + +static void init_decoders(struct work_struct *work) +{ + /* Load the decoder modules */ + + load_nec_decode(); + + /* If needed, we may later add some init code. In this case, + it is needed to change the CONFIG_MODULE test at ir-core.h + */ +} + +void ir_raw_init(void) +{ + INIT_WORK(&wq_load, init_decoders); + schedule_work(&wq_load); +} \ No newline at end of file diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 253e66999f18..2279d5594b05 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -1,6 +1,6 @@ /* ir-register.c - handle IR scancode->keycode tables * - * Copyright (C) 2009 by Mauro Carvalho Chehab + * Copyright (C) 2009-2010 by Mauro Carvalho Chehab * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ static char *ir_devnode(struct device *dev, mode_t *mode) return kasprintf(GFP_KERNEL, "irrcv/%s", dev_name(dev)); } -struct class ir_input_class = { +static struct class ir_input_class = { .name = "irrcv", .devnode = ir_devnode, }; @@ -251,6 +251,9 @@ static int __init ir_core_init(void) return rc; } + /* Initialize/load the decoders that will be used */ + ir_raw_init(); + return 0; } diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 8d8ed7e06cd5..c377bf47a059 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -1,6 +1,8 @@ /* * Remote Controller core header * + * Copyright (C) 2009-2010 by Mauro Carvalho Chehab + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation version 2 of the License. @@ -80,6 +82,14 @@ struct ir_input_dev { int keypressed; /* current state */ }; +struct ir_raw_handler { + struct list_head list; + + int (*decode)(struct input_dev *input_dev, + struct ir_raw_event *evs, + int len); +}; + #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) /* Routines from ir-keytable.c */ @@ -104,11 +114,20 @@ int ir_raw_event_register(struct input_dev *input_dev); void ir_raw_event_unregister(struct input_dev *input_dev); int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type); int ir_raw_event_handle(struct input_dev *input_dev); +int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler); +void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler); -/* from ir-nec-decoder.c */ -int ir_nec_decode(struct input_dev *input_dev, - struct ir_raw_event *evs, - int len); - +#ifdef MODULE +void ir_raw_init(void); +#else +#define ir_raw_init() 0 +#endif +/* from ir-nec-decoder.c */ +#ifdef CONFIG_IR_NEC_DECODER_MODULE +#define load_nec_decode() request_module("ir-nec-decoder") +#else +#define load_nec_decode() 0 #endif + +#endif /* _IR_CORE */ -- GitLab From 93c312ff21b0a53e701a45741887208297646a1a Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 25 Mar 2010 21:13:43 -0300 Subject: [PATCH 268/534] V4L/DVB: ir-core: prepare to add more operations for ir decoders Some decoders and a lirc_dev interface may need some other operations to work. For example: IR device register/unregister and ir_keydown events may need to be tracked. As some operations can occur in interrupt time, and a lock is needed to prevent un-registering a decode while decoding a key, the lock needed to be convert into a spin lock. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-nec-decoder.c | 6 +- drivers/media/IR/ir-raw-event.c | 71 +++++++++++++++++---- drivers/media/video/saa7134/saa7134-input.c | 2 +- include/media/ir-core.h | 7 +- 4 files changed, 62 insertions(+), 24 deletions(-) diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index c9a986dd57fd..cb57cc287734 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -178,8 +178,7 @@ static int __ir_nec_decode(struct input_dev *input_dev, * @input_dev: the struct input_dev descriptor of the device * @evs: event array with type/duration of pulse/space * @len: length of the array - * This function returns the number of decoded pulses or -EINVAL if no - * pulse got decoded + * This function returns the number of decoded pulses */ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event *evs, @@ -192,9 +191,6 @@ static int ir_nec_decode(struct input_dev *input_dev, if (__ir_nec_decode(input_dev, evs, len, &pos) > 0) rc++; } - - if (!rc) - return -EINVAL; return rc; } diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 3eae128400ea..11f23f4491b2 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -14,13 +14,41 @@ #include #include +#include /* Define the max number of bit transitions per IR keycode */ #define MAX_IR_EVENT_SIZE 256 /* Used to handle IR raw handler extensions */ static LIST_HEAD(ir_raw_handler_list); -static DEFINE_MUTEX(ir_raw_handler_lock); +static spinlock_t ir_raw_handler_lock; + +/** + * RUN_DECODER() - runs an operation on all IR decoders + * @ops: IR raw handler operation to be called + * @arg: arguments to be passed to the callback + * + * Calls ir_raw_handler::ops for all registered IR handlers. It prevents + * new decode addition/removal while running, by locking ir_raw_handler_lock + * mutex. If an error occurs, it stops the ops. Otherwise, it returns a sum + * of the return codes. + */ +#define RUN_DECODER(ops, ...) ({ \ + struct ir_raw_handler *_ir_raw_handler; \ + int _sumrc = 0, _rc; \ + spin_lock(&ir_raw_handler_lock); \ + list_for_each_entry(_ir_raw_handler, &ir_raw_handler_list, list) { \ + if (_ir_raw_handler->ops) { \ + _rc = _ir_raw_handler->ops(__VA_ARGS__); \ + if (_rc < 0) \ + break; \ + _sumrc += _rc; \ + } \ + } \ + spin_unlock(&ir_raw_handler_lock); \ + _sumrc; \ +}) + /* Used to load the decoders */ static struct work_struct wq_load; @@ -38,6 +66,8 @@ int ir_raw_event_register(struct input_dev *input_dev) int rc, size; ir->raw = kzalloc(sizeof(*ir->raw), GFP_KERNEL); + if (!ir->raw) + return -ENOMEM; size = sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE * 2; size = roundup_pow_of_two(size); @@ -48,6 +78,19 @@ int ir_raw_event_register(struct input_dev *input_dev) set_bit(EV_REP, input_dev->evbit); rc = kfifo_alloc(&ir->raw->kfifo, size, GFP_KERNEL); + if (rc < 0) { + kfree(ir->raw); + ir->raw = NULL; + return rc; + } + + rc = RUN_DECODER(raw_register, input_dev); + if (rc < 0) { + kfifo_free(&ir->raw->kfifo); + kfree(ir->raw); + ir->raw = NULL; + return rc; + } return rc; } @@ -62,6 +105,8 @@ void ir_raw_event_unregister(struct input_dev *input_dev) del_timer_sync(&ir->raw->timer_keyup); + RUN_DECODER(raw_unregister, input_dev); + kfifo_free(&ir->raw->kfifo); kfree(ir->raw); ir->raw = NULL; @@ -109,7 +154,6 @@ int ir_raw_event_handle(struct input_dev *input_dev) int rc; struct ir_raw_event *evs; int len, i; - struct ir_raw_handler *ir_raw_handler; /* * Store the events into a temporary buffer. This allows calling more than @@ -133,13 +177,10 @@ int ir_raw_event_handle(struct input_dev *input_dev) /* * Call all ir decoders. This allows decoding the same event with - * more than one protocol handler. - * FIXME: better handle the returned code: does it make sense to use - * other decoders, if the first one already handled the IR? + * more than one protocol handler. It returns the number of keystrokes + * sent to the event interface */ - list_for_each_entry(ir_raw_handler, &ir_raw_handler_list, list) { - rc = ir_raw_handler->decode(input_dev, evs, len); - } + rc = RUN_DECODER(decode, input_dev, evs, len); kfree(evs); @@ -153,18 +194,18 @@ EXPORT_SYMBOL_GPL(ir_raw_event_handle); int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler) { - mutex_lock(&ir_raw_handler_lock); + spin_lock(&ir_raw_handler_lock); list_add_tail(&ir_raw_handler->list, &ir_raw_handler_list); - mutex_unlock(&ir_raw_handler_lock); + spin_unlock(&ir_raw_handler_lock); return 0; } EXPORT_SYMBOL(ir_raw_handler_register); void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler) { - mutex_lock(&ir_raw_handler_lock); + spin_lock(&ir_raw_handler_lock); list_del(&ir_raw_handler->list); - mutex_unlock(&ir_raw_handler_lock); + spin_unlock(&ir_raw_handler_lock); } EXPORT_SYMBOL(ir_raw_handler_unregister); @@ -181,6 +222,10 @@ static void init_decoders(struct work_struct *work) void ir_raw_init(void) { + spin_lock_init(&ir_raw_handler_lock); + +#ifdef MODULE INIT_WORK(&wq_load, init_decoders); schedule_work(&wq_load); -} \ No newline at end of file +#endif +} diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 32859e549afa..39564db252fd 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -961,7 +961,7 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); pulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; - ir_raw_event_store(dev->remote->dev, pulse? IR_PULSE : IR_SPACE); + ir_raw_event_store(dev->remote->dev, pulse ? IR_PULSE : IR_SPACE); /* diff --git a/include/media/ir-core.h b/include/media/ir-core.h index c377bf47a059..c704fa7cc11e 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -88,6 +88,8 @@ struct ir_raw_handler { int (*decode)(struct input_dev *input_dev, struct ir_raw_event *evs, int len); + int (*raw_register)(struct input_dev *input_dev); + int (*raw_unregister)(struct input_dev *input_dev); }; #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) @@ -116,12 +118,7 @@ int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type); int ir_raw_event_handle(struct input_dev *input_dev); int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler); void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler); - -#ifdef MODULE void ir_raw_init(void); -#else -#define ir_raw_init() 0 -#endif /* from ir-nec-decoder.c */ #ifdef CONFIG_IR_NEC_DECODER_MODULE -- GitLab From 20d5f116ec777c9c7ce5b74f0d17ee1d01a0d833 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 25 Mar 2010 23:49:46 -0300 Subject: [PATCH 269/534] V4L/DVB: ir-nec-decoder: Add sysfs node to enable/disable per irrcv With the help of raw_register/raw_unregister, adds a sysfs group associated with the decoder, inside the corresponding irrcv node. Writing 1 to nec_decoder/enabled enables the decoder, while writing 0 disables it. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-nec-decoder.c | 133 +++++++++++++++++++++++++++++- drivers/media/IR/ir-raw-event.c | 2 +- 2 files changed, 133 insertions(+), 2 deletions(-) diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index cb57cc287734..83a9912722f4 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -39,6 +39,85 @@ #define REPEAT_TIME 240 /* ms */ +/* Used to register nec_decoder clients */ +static LIST_HEAD(decoder_list); +static spinlock_t decoder_lock; + +struct decoder_data { + struct list_head list; + struct ir_input_dev *ir_dev; + int enabled:1; +}; + + +/** + * get_decoder_data() - gets decoder data + * @input_dev: input device + * + * Returns the struct decoder_data that corresponds to a device + */ + +static struct decoder_data *get_decoder_data(struct ir_input_dev *ir_dev) +{ + struct decoder_data *data = NULL; + + spin_lock(&decoder_lock); + list_for_each_entry(data, &decoder_list, list) { + if (data->ir_dev == ir_dev) + break; + } + spin_unlock(&decoder_lock); + return data; +} + +static ssize_t store_enabled(struct device *d, + struct device_attribute *mattr, + const char *buf, + size_t len) +{ + unsigned long value; + struct ir_input_dev *ir_dev = dev_get_drvdata(d); + struct decoder_data *data = get_decoder_data(ir_dev); + + if (!data) + return -EINVAL; + + if (strict_strtoul(buf, 10, &value) || value > 1) + return -EINVAL; + + data->enabled = value; + + return len; +} + +static ssize_t show_enabled(struct device *d, + struct device_attribute *mattr, char *buf) +{ + struct ir_input_dev *ir_dev = dev_get_drvdata(d); + struct decoder_data *data = get_decoder_data(ir_dev); + + if (!data) + return -EINVAL; + + if (data->enabled) + return sprintf(buf, "1\n"); + else + return sprintf(buf, "0\n"); +} + +static DEVICE_ATTR(enabled, S_IRUGO | S_IWUSR, show_enabled, store_enabled); + +static struct attribute *decoder_attributes[] = { + &dev_attr_enabled.attr, + NULL +}; + +static struct attribute_group decoder_attribute_group = { + .name = "nec_decoder", + .attrs = decoder_attributes, +}; + + /** is_repeat - Check if it is a NEC repeat event * @input_dev: the struct input_dev descriptor of the device * @pos: the position of the first event @@ -184,9 +263,15 @@ static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event *evs, int len) { + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + struct decoder_data *data; int pos = 0; int rc = 0; + data = get_decoder_data(ir_dev); + if (!data || !data->enabled) + return 0; + while (pos < len) { if (__ir_nec_decode(input_dev, evs, len, &pos) > 0) rc++; @@ -194,8 +279,54 @@ static int ir_nec_decode(struct input_dev *input_dev, return rc; } +static int ir_nec_register(struct input_dev *input_dev) +{ + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + struct decoder_data *data; + int rc; + + rc = sysfs_create_group(&ir_dev->dev.kobj, &decoder_attribute_group); + if (rc < 0) + return rc; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) { + sysfs_remove_group(&ir_dev->dev.kobj, &decoder_attribute_group); + return -ENOMEM; + } + + data->ir_dev = ir_dev; + data->enabled = 1; + + spin_lock(&decoder_lock); + list_add_tail(&data->list, &decoder_list); + spin_unlock(&decoder_lock); + + return 0; +} + +static int ir_nec_unregister(struct input_dev *input_dev) +{ + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + static struct decoder_data *data; + + data = get_decoder_data(ir_dev); + if (!data) + return 0; + + sysfs_remove_group(&ir_dev->dev.kobj, &decoder_attribute_group); + + spin_lock(&decoder_lock); + list_del(&data->list); + spin_unlock(&decoder_lock); + + return 0; +} + static struct ir_raw_handler nec_handler = { - .decode = ir_nec_decode, + .decode = ir_nec_decode, + .raw_register = ir_nec_register, + .raw_unregister = ir_nec_unregister, }; static int __init ir_nec_decode_init(void) diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 11f23f4491b2..371d88e5a586 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -223,7 +223,7 @@ static void init_decoders(struct work_struct *work) void ir_raw_init(void) { spin_lock_init(&ir_raw_handler_lock); - + #ifdef MODULE INIT_WORK(&wq_load, init_decoders); schedule_work(&wq_load); -- GitLab From d89b4bd2b47395339d5b5b6a7e28f91dd0d21b7b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 26 Mar 2010 22:39:29 -0300 Subject: [PATCH 270/534] V4L/DVB: saa7134: clear warning noise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drivers/media/video/saa7134/saa7134-input.c: In function ‘saa7134_raw_decode_irq’: drivers/media/video/saa7134/saa7134-input.c:957: warning: unused variable ‘oldpulse’ drivers/media/video/saa7134/saa7134-input.c:957: warning: unused variable ‘count’ Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 39564db252fd..e278d7304b3a 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -955,7 +955,7 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) { struct card_ir *ir = dev->remote; unsigned long timeout; - int count, pulse, oldpulse; + int pulse; /* Generate initial event */ saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); -- GitLab From e202c15b4209f05fe109dd396463a524f4c2d3d8 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 26 Mar 2010 22:45:16 -0300 Subject: [PATCH 271/534] V4L/DVB: ir-core: rename sysfs remote controller class from ir to rc IR is an alias for Infrared Remote, while RC is an alias for Remote Controller. While currently all implementations are with Infrared Remote Controller, this subsystem is not meant to be used only by IR type of RC's. So, as discussed on both linux-media and linux-input, the better is to rename the subsystem as Remote Controller. While, currently, the only application that uses the /sys/class/irrcv is ir-keytable application, and its sysfs support works only with the current linux-next code, it is still possible to change the userspace API without the risk of breaking applications. So, better to rename this sooner than later. Later patches will be needed to rename the files and to move them away from drivers/media, but this is not a critical issue. So, for now, let's just change the name of the sysfs class/nodes. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-sysfs.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 2279d5594b05..36dfe51aad92 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -22,14 +22,14 @@ /* bit array to represent IR sysfs device number */ static unsigned long ir_core_dev_number; -/* class for /sys/class/irrcv */ +/* class for /sys/class/rc */ static char *ir_devnode(struct device *dev, mode_t *mode) { - return kasprintf(GFP_KERNEL, "irrcv/%s", dev_name(dev)); + return kasprintf(GFP_KERNEL, "rc/%s", dev_name(dev)); } static struct class ir_input_class = { - .name = "irrcv", + .name = "rc", .devnode = ir_devnode, }; @@ -40,7 +40,7 @@ static struct class ir_input_class = { * @buf: a pointer to the output buffer * * This routine is a callback routine for input read the IR protocol type. - * it is trigged by reading /sys/class/irrcv/irrcv?/current_protocol. + * it is trigged by reading /sys/class/rc/rcrcv?/current_protocol. * It returns the protocol name, as understood by the driver. */ static ssize_t show_protocol(struct device *d, @@ -75,7 +75,7 @@ static ssize_t show_protocol(struct device *d, * @len: length of the input buffer * * This routine is a callback routine for changing the IR protocol type. - * it is trigged by reading /sys/class/irrcv/irrcv?/current_protocol. + * it is trigged by reading /sys/class/rc/rcrcv?/current_protocol. * It changes the IR the protocol name, if the IR type is recognized * by the driver. * If an unknown protocol name is used, returns -EINVAL. @@ -172,7 +172,7 @@ static struct device_type ir_dev_type = { }; /** - * ir_register_class() - creates the sysfs for /sys/class/irrcv/irrcv? + * ir_register_class() - creates the sysfs for /sys/class/rc/rcrcv? * @input_dev: the struct input_dev descriptor of the device * * This routine is used to register the syfs code for IR class @@ -192,7 +192,7 @@ int ir_register_class(struct input_dev *input_dev) ir_dev->dev.type = &ir_dev_type; ir_dev->dev.class = &ir_input_class; ir_dev->dev.parent = input_dev->dev.parent; - dev_set_name(&ir_dev->dev, "irrcv%d", devno); + dev_set_name(&ir_dev->dev, "rcrcv%d", devno); dev_set_drvdata(&ir_dev->dev, ir_dev); rc = device_register(&ir_dev->dev); if (rc) @@ -223,7 +223,7 @@ int ir_register_class(struct input_dev *input_dev) /** * ir_unregister_class() - removes the sysfs for sysfs for - * /sys/class/irrcv/irrcv? + * /sys/class/rc/rcrcv? * @input_dev: the struct input_dev descriptor of the device * * This routine is used to unregister the syfs code for IR class @@ -240,14 +240,14 @@ void ir_unregister_class(struct input_dev *input_dev) } /* - * Init/exit code for the module. Basically, creates/removes /sys/class/irrcv + * Init/exit code for the module. Basically, creates/removes /sys/class/rc */ static int __init ir_core_init(void) { int rc = class_register(&ir_input_class); if (rc) { - printk(KERN_ERR "ir_core: unable to register irrcv class\n"); + printk(KERN_ERR "ir_core: unable to register rc class\n"); return rc; } -- GitLab From 716aab44df8bb9bdf16abea9013890274329b61f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Mar 2010 14:40:35 -0300 Subject: [PATCH 272/534] V4L/DVB: ir-core: Add callbacks for input/evdev open/close on IR core Especially when IR needs to do polling, it generates lots of wakeups per second. This makes no sense, if the input event device is closed. Adds a callback handler to the IR hardware driver, to allow registering an open/close ops. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 17 ++++ drivers/media/video/saa7134/saa7134-core.c | 2 +- drivers/media/video/saa7134/saa7134-input.c | 89 +++++++++++++++++---- drivers/media/video/saa7134/saa7134.h | 4 +- include/media/ir-common.h | 1 + include/media/ir-core.h | 2 + 6 files changed, 98 insertions(+), 17 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index fcb0f0cb1fe1..99cad829a18a 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -446,6 +446,19 @@ void ir_keydown(struct input_dev *dev, int scancode) } EXPORT_SYMBOL_GPL(ir_keydown); +static int ir_open(struct input_dev *input_dev) +{ + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + + return ir_dev->props->open(ir_dev->props->priv); +} + +static void ir_close(struct input_dev *input_dev) +{ + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + + ir_dev->props->close(ir_dev->props->priv); +} /** * ir_input_register() - sets the IR keycode table and add the handlers @@ -495,6 +508,10 @@ int ir_input_register(struct input_dev *input_dev, ir_copy_table(&ir_dev->rc_tab, rc_tab); ir_dev->props = props; + if (props && props->open) + input_dev->open = ir_open; + if (props && props->close) + input_dev->close = ir_close; /* set the bits for the keys */ IR_dprintk(1, "key map size: %d\n", rc_tab->size); diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index a7ad7810fddc..68cda10e0783 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -1227,7 +1227,7 @@ static int saa7134_resume(struct pci_dev *pci_dev) if (card_has_mpeg(dev)) saa7134_ts_init_hw(dev); if (dev->remote) - saa7134_ir_start(dev, dev->remote); + saa7134_ir_start(dev); saa7134_hw_enable1(dev); msleep(100); diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index e278d7304b3a..ae17b853f957 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -400,7 +400,14 @@ static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) void saa7134_input_irq(struct saa7134_dev *dev) { - struct card_ir *ir = dev->remote; + struct card_ir *ir; + + if (!dev || !dev->remote) + return; + + ir = dev->remote; + if (!ir->running) + return; if (ir->nec_gpio) { saa7134_nec_irq(dev); @@ -432,10 +439,20 @@ void ir_raw_decode_timer_end(unsigned long data) ir->active = 0; } -void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) +static int __saa7134_ir_start(void *priv) { + struct saa7134_dev *dev = priv; + struct card_ir *ir; + + if (!dev) + return -EINVAL; + + ir = dev->remote; + if (!ir) + return -EINVAL; + if (ir->running) - return; + return 0; ir->running = 1; if (ir->polling) { @@ -467,11 +484,21 @@ void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir) ir->timer_end.data = (unsigned long)dev; ir->active = 0; } + + return 0; } -void saa7134_ir_stop(struct saa7134_dev *dev) +static void __saa7134_ir_stop(void *priv) { - struct card_ir *ir = dev->remote; + struct saa7134_dev *dev = priv; + struct card_ir *ir; + + if (!dev) + return; + + ir = dev->remote; + if (!ir) + return; if (!ir->running) return; @@ -487,8 +514,42 @@ void saa7134_ir_stop(struct saa7134_dev *dev) } ir->running = 0; + + return; +} + +int saa7134_ir_start(struct saa7134_dev *dev) +{ + if (dev->remote->users) + return __saa7134_ir_start(dev); + + return 0; +} + +void saa7134_ir_stop(struct saa7134_dev *dev) +{ + if (dev->remote->users) + __saa7134_ir_stop(dev); +} + +static int saa7134_ir_open(void *priv) +{ + struct saa7134_dev *dev = priv; + + dev->remote->users++; + return __saa7134_ir_start(dev); +} + +static void saa7134_ir_close(void *priv) +{ + struct saa7134_dev *dev = priv; + + dev->remote->users--; + if (!dev->remote->users) + __saa7134_ir_stop(dev); } + int saa7134_ir_change_protocol(void *priv, u64 ir_type) { struct saa7134_dev *dev = priv; @@ -513,7 +574,7 @@ int saa7134_ir_change_protocol(void *priv, u64 ir_type) saa7134_ir_stop(dev); ir->nec_gpio = nec_gpio; ir->rc5_gpio = rc5_gpio; - saa7134_ir_start(dev, ir); + saa7134_ir_start(dev); } else { ir->nec_gpio = nec_gpio; ir->rc5_gpio = rc5_gpio; @@ -788,9 +849,13 @@ int saa7134_input_init1(struct saa7134_dev *dev) snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(dev->pci)); + + ir->props.priv = dev; + ir->props.open = saa7134_ir_open; + ir->props.close = saa7134_ir_close; + if (ir_codes->ir_type != IR_TYPE_OTHER && !raw_decode) { ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; - ir->props.priv = dev; ir->props.change_protocol = saa7134_ir_change_protocol; /* Set IR protocol */ @@ -815,25 +880,21 @@ int saa7134_input_init1(struct saa7134_dev *dev) err = ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); if (err) - goto err_out_stop; + goto err_out_free; if (ir_codes->ir_type != IR_TYPE_OTHER) { err = ir_raw_event_register(ir->dev); if (err) - goto err_out_stop; + goto err_out_free; } - saa7134_ir_start(dev, ir); - /* the remote isn't as bouncy as a keyboard */ ir->dev->rep[REP_DELAY] = repeat_delay; ir->dev->rep[REP_PERIOD] = repeat_period; return 0; - err_out_stop: - saa7134_ir_stop(dev); +err_out_free: dev->remote = NULL; - err_out_free: kfree(ir); return err; } diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index c3a1ae0adca0..cad8aee98e53 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -20,7 +20,7 @@ */ #include -#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,15) +#define SAA7134_VERSION_CODE KERNEL_VERSION(0, 2, 16) #include #include @@ -810,7 +810,7 @@ int saa7134_input_init1(struct saa7134_dev *dev); void saa7134_input_fini(struct saa7134_dev *dev); void saa7134_input_irq(struct saa7134_dev *dev); void saa7134_probe_i2c_ir(struct saa7134_dev *dev); -void saa7134_ir_start(struct saa7134_dev *dev, struct card_ir *ir); +int saa7134_ir_start(struct saa7134_dev *dev); void saa7134_ir_stop(struct saa7134_dev *dev); diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 87f2ec78deb8..e403a9a5281a 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -50,6 +50,7 @@ struct card_ir { struct ir_input_state ir; char name[32]; char phys[32]; + int users; u32 running:1; struct ir_dev_props props; diff --git a/include/media/ir-core.h b/include/media/ir-core.h index c704fa7cc11e..9a2f3084ffec 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -56,6 +56,8 @@ struct ir_dev_props { unsigned long allowed_protos; void *priv; int (*change_protocol)(void *priv, u64 ir_type); + int (*open)(void *priv); + void (*close)(void *priv); }; struct ir_raw_event { -- GitLab From 92f4fc10d7ba01fd84abbfae963d379c73ba5a0f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 31 Mar 2010 16:07:49 -0300 Subject: [PATCH 273/534] V4L/DVB: cx88: Only start IR if the input device is opened Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-input.c | 69 +++++++++++++++++++++++---- drivers/media/video/cx88/cx88-video.c | 6 +-- drivers/media/video/cx88/cx88.h | 6 +-- 3 files changed, 66 insertions(+), 15 deletions(-) diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 8b52546c6e1d..8bd95be89e67 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -40,6 +40,10 @@ struct cx88_IR { struct cx88_core *core; struct input_dev *input; struct ir_input_state ir; + struct ir_dev_props props; + + int users; + char name[32]; char phys[32]; @@ -161,8 +165,16 @@ static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer) return HRTIMER_RESTART; } -void cx88_ir_start(struct cx88_core *core, struct cx88_IR *ir) +static int __cx88_ir_start(void *priv) { + struct cx88_core *core = priv; + struct cx88_IR *ir; + + if (!core || !core->ir) + return -EINVAL; + + ir = core->ir; + if (ir->polling) { hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ir->timer.function = cx88_ir_work; @@ -175,10 +187,18 @@ void cx88_ir_start(struct cx88_core *core, struct cx88_IR *ir) cx_write(MO_DDS_IO, 0xa80a80); /* 4 kHz sample rate */ cx_write(MO_DDSCFG_IO, 0x5); /* enable */ } + return 0; } -void cx88_ir_stop(struct cx88_core *core, struct cx88_IR *ir) +static void __cx88_ir_stop(void *priv) { + struct cx88_core *core = priv; + struct cx88_IR *ir; + + if (!core || !core->ir) + return; + + ir = core->ir; if (ir->sampling) { cx_write(MO_DDSCFG_IO, 0x0); core->pci_irqmask &= ~PCI_INT_IR_SMPINT; @@ -188,6 +208,37 @@ void cx88_ir_stop(struct cx88_core *core, struct cx88_IR *ir) hrtimer_cancel(&ir->timer); } +int cx88_ir_start(struct cx88_core *core) +{ + if (core->ir->users) + return __cx88_ir_start(core); + + return 0; +} + +void cx88_ir_stop(struct cx88_core *core) +{ + if (core->ir->users) + __cx88_ir_stop(core); +} + +static int cx88_ir_open(void *priv) +{ + struct cx88_core *core = priv; + + core->ir->users++; + return __cx88_ir_start(core); +} + +static void cx88_ir_close(void *priv) +{ + struct cx88_core *core = priv; + + core->ir->users--; + if (!core->ir->users) + __cx88_ir_stop(core); +} + /* ---------------------------------------------------------------------- */ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) @@ -383,19 +434,19 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ir->core = core; core->ir = ir; - cx88_ir_start(core, ir); + ir->props.priv = core; + ir->props.open = cx88_ir_open; + ir->props.close = cx88_ir_close; /* all done */ - err = ir_input_register(ir->input, ir_codes, NULL, MODULE_NAME); + err = ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME); if (err) - goto err_out_stop; + goto err_out_free; return 0; - err_out_stop: - cx88_ir_stop(core, ir); - core->ir = NULL; err_out_free: + core->ir = NULL; kfree(ir); return err; } @@ -408,7 +459,7 @@ int cx88_ir_fini(struct cx88_core *core) if (NULL == ir) return 0; - cx88_ir_stop(core, ir); + cx88_ir_stop(core); ir_input_unregister(ir->input); kfree(ir); diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 48c450f4a85a..8e414f7aa76e 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1977,7 +1977,7 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev) } if (core->ir) - cx88_ir_stop(core, core->ir); + cx88_ir_stop(core); cx88_shutdown(core); /* FIXME */ pci_disable_device(pci_dev); @@ -2015,7 +2015,7 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) spin_unlock(&dev->slock); if (core->ir) - cx88_ir_stop(core, core->ir); + cx88_ir_stop(core); /* FIXME -- shutdown device */ cx88_shutdown(core); @@ -2056,7 +2056,7 @@ static int cx8800_resume(struct pci_dev *pci_dev) /* FIXME: re-initialize hardware */ cx88_reset(core); if (core->ir) - cx88_ir_start(core, core->ir); + cx88_ir_start(core); cx_set(MO_PCI_INTMSK, core->pci_irqmask); diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index b5f054d124f1..bdb03d336536 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -41,7 +41,7 @@ #include #include -#define CX88_VERSION_CODE KERNEL_VERSION(0,0,7) +#define CX88_VERSION_CODE KERNEL_VERSION(0, 0, 8) #define UNSET (-1U) @@ -683,8 +683,8 @@ s32 cx88_dsp_detect_stereo_sap(struct cx88_core *core); int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci); int cx88_ir_fini(struct cx88_core *core); void cx88_ir_irq(struct cx88_core *core); -void cx88_ir_start(struct cx88_core *core, struct cx88_IR *ir); -void cx88_ir_stop(struct cx88_core *core, struct cx88_IR *ir); +int cx88_ir_start(struct cx88_core *core); +void cx88_ir_stop(struct cx88_core *core); /* ----------------------------------------------------------- */ /* cx88-mpeg.c */ -- GitLab From 10991235177578ad3793b5d7569e70eb1c50aab2 Mon Sep 17 00:00:00 2001 From: Olimpiu Pascariu Date: Tue, 6 Apr 2010 02:09:00 -0300 Subject: [PATCH 274/534] V4L/DVB: cx25821: fix coding style issues in cx25821-video-upstream.c This is a patch to cx25821-video-upstream.c file that fixes up warnings and errors found by the checkpatch.pl tool Signed-off-by: Olimpiu Pascariu Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- .../staging/cx25821/cx25821-video-upstream.c | 121 +++++++++--------- 1 file changed, 63 insertions(+), 58 deletions(-) diff --git a/drivers/staging/cx25821/cx25821-video-upstream.c b/drivers/staging/cx25821/cx25821-video-upstream.c index 6d48a1e26d1b..a6eeb9aad29f 100644 --- a/drivers/staging/cx25821/cx25821-video-upstream.c +++ b/drivers/staging/cx25821/cx25821-video-upstream.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include MODULE_DESCRIPTION("v4l2 driver module for cx25821 based TV cards"); MODULE_AUTHOR("Hiep Huynh "); @@ -60,9 +60,8 @@ int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev, cdt = ch->cdt; lines = ch->fifo_size / bpl; - if (lines > 4) { + if (lines > 4) lines = 4; - } BUG_ON(lines < 2); @@ -97,7 +96,7 @@ int cx25821_sram_channel_setup_upstream(struct cx25821_dev *dev, } static __le32 *cx25821_update_riscprogram(struct cx25821_dev *dev, - __le32 * rp, unsigned int offset, + __le32 *rp, unsigned int offset, unsigned int bpl, u32 sync_line, unsigned int lines, int fifo_enable, int field_type) @@ -108,9 +107,8 @@ static __le32 *cx25821_update_riscprogram(struct cx25821_dev *dev, *(rp++) = cpu_to_le32(RISC_RESYNC | sync_line); if (USE_RISC_NOOP_VIDEO) { - for (i = 0; i < NUM_NO_OPS; i++) { + for (i = 0; i < NUM_NO_OPS; i++) *(rp++) = cpu_to_le32(RISC_NOOP); - } } /* scan lines */ @@ -140,14 +138,12 @@ static __le32 *cx25821_risc_field_upstream(struct cx25821_dev *dev, __le32 * rp, int dist_betwn_starts = bpl * 2; /* sync instruction */ - if (sync_line != NO_SYNC_LINE) { + if (sync_line != NO_SYNC_LINE) *(rp++) = cpu_to_le32(RISC_RESYNC | sync_line); - } if (USE_RISC_NOOP_VIDEO) { - for (i = 0; i < NUM_NO_OPS; i++) { + for (i = 0; i < NUM_NO_OPS; i++) *(rp++) = cpu_to_le32(RISC_NOOP); - } } /* scan lines */ @@ -157,12 +153,13 @@ static __le32 *cx25821_risc_field_upstream(struct cx25821_dev *dev, __le32 * rp, *(rp++) = cpu_to_le32(0); /* bits 63-32 */ if ((lines <= NTSC_FIELD_HEIGHT) - || (line < (NTSC_FIELD_HEIGHT - 1)) || !(dev->_isNTSC)) { - offset += dist_betwn_starts; //to skip the other field line - } + || (line < (NTSC_FIELD_HEIGHT - 1)) || !(dev->_isNTSC)) + /* to skip the other field line */ + offset += dist_betwn_starts; - // check if we need to enable the FIFO after the first 4 lines - // For the upstream video channel, the risc engine will enable the FIFO. + /* check if we need to enable the FIFO after the first 4 lines + * For the upstream video channel, the risc engine will enable + * the FIFO. */ if (fifo_enable && line == 3) { *(rp++) = RISC_WRITECR; *(rp++) = sram_ch->dma_ctl; @@ -181,7 +178,8 @@ int cx25821_risc_buffer_upstream(struct cx25821_dev *dev, { __le32 *rp; int fifo_enable = 0; - int singlefield_lines = lines >> 1; //get line count for single field + /* get line count for single field */ + int singlefield_lines = lines >> 1; int odd_num_lines = singlefield_lines; int frame = 0; int frame_size = 0; @@ -225,7 +223,7 @@ int cx25821_risc_buffer_upstream(struct cx25821_dev *dev, fifo_enable = FIFO_DISABLE; - //Even Field + /* Even Field */ rp = cx25821_risc_field_upstream(dev, rp, dev->_data_buf_phys_addr + databuf_offset, bottom_offset, @@ -241,7 +239,9 @@ int cx25821_risc_buffer_upstream(struct cx25821_dev *dev, risc_flag = RISC_CNT_INC; } - // Loop to 2ndFrameRISC or to Start of Risc program & generate IRQ + /* Loop to 2ndFrameRISC or to Start of Risc + * program & generate IRQ + */ *(rp++) = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | risc_flag); *(rp++) = cpu_to_le32(risc_phys_jump_addr); *(rp++) = cpu_to_le32(0); @@ -258,18 +258,18 @@ void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev) if (!dev->_is_running) { printk - ("cx25821: No video file is currently running so return!\n"); + ("cx25821: No video file is currently running so return!\n"); return; } - //Disable RISC interrupts + /* Disable RISC interrupts */ tmp = cx_read(sram_ch->int_msk); cx_write(sram_ch->int_msk, tmp & ~_intr_msk); - //Turn OFF risc and fifo enable + /* Turn OFF risc and fifo enable */ tmp = cx_read(sram_ch->dma_ctl); cx_write(sram_ch->dma_ctl, tmp & ~(FLD_VID_FIFO_EN | FLD_VID_RISC_EN)); - //Clear data buffer memory + /* Clear data buffer memory */ if (dev->_data_buf_virt_addr) memset(dev->_data_buf_virt_addr, 0, dev->_data_buf_size); @@ -292,9 +292,8 @@ void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev) void cx25821_free_mem_upstream_ch1(struct cx25821_dev *dev) { - if (dev->_is_running) { + if (dev->_is_running) cx25821_stop_upstream_video_ch1(dev); - } if (dev->_dma_virt_addr) { pci_free_consistent(dev->pci, dev->_risc_size, @@ -347,7 +346,7 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) if (IS_ERR(myfile)) { const int open_errno = -PTR_ERR(myfile); - printk("%s(): ERROR opening file(%s) with errno = %d! \n", + printk("%s(): ERROR opening file(%s) with errno = %d!\n", __func__, dev->_filename, open_errno); return PTR_ERR(myfile); } else { @@ -412,7 +411,7 @@ static void cx25821_vidups_handler(struct work_struct *work) container_of(work, struct cx25821_dev, _irq_work_entry); if (!dev) { - printk("ERROR %s(): since container_of(work_struct) FAILED! \n", + printk("ERROR %s(): since container_of(work_struct) FAILED!\n", __func__); return; } @@ -438,7 +437,7 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) if (IS_ERR(myfile)) { const int open_errno = -PTR_ERR(myfile); - printk("%s(): ERROR opening file(%s) with errno = %d! \n", + printk("%s(): ERROR opening file(%s) with errno = %d!\n", __func__, dev->_filename, open_errno); return PTR_ERR(myfile); } else { @@ -490,9 +489,8 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) if (i > 0) dev->_frame_count++; - if (vfs_read_retval < line_size) { + if (vfs_read_retval < line_size) break; - } } dev->_file_status = @@ -532,7 +530,7 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, return -ENOMEM; } - //Clear memory at address + /* Clear memory at address */ memset(dev->_dma_virt_addr, 0, dev->_risc_size); if (dev->_data_buf_virt_addr != NULL) { @@ -540,7 +538,7 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, dev->_data_buf_virt_addr, dev->_data_buf_phys_addr); } - //For Video Data buffer allocation + /* For Video Data buffer allocation */ dev->_data_buf_virt_addr = pci_alloc_consistent(dev->pci, dev->upstream_databuf_size, &data_dma_addr); @@ -553,26 +551,26 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, return -ENOMEM; } - //Clear memory at address + /* Clear memory at address */ memset(dev->_data_buf_virt_addr, 0, dev->_data_buf_size); ret = cx25821_openfile(dev, sram_ch); if (ret < 0) return ret; - //Create RISC programs + /* Create RISC programs */ ret = cx25821_risc_buffer_upstream(dev, dev->pci, 0, bpl, dev->_lines_count); if (ret < 0) { printk(KERN_INFO - "cx25821: Failed creating Video Upstream Risc programs! \n"); + "cx25821: Failed creating Video Upstream Risc programs!\n"); goto error; } return 0; - error: +error: return ret; } @@ -588,10 +586,11 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, __le32 *rp; if (status & FLD_VID_SRC_RISC1) { - // We should only process one program per call + /* We should only process one program per call */ u32 prog_cnt = cx_read(channel->gpcnt); - //Since we've identified our IRQ, clear our bits from the interrupt mask and interrupt status registers + /* Since we've identified our IRQ, clear our bits from the + * interrupt mask and interrupt status registers */ int_msk_tmp = cx_read(channel->int_msk); cx_write(channel->int_msk, int_msk_tmp & ~_intr_msk); cx_write(channel->int_stat, _intr_msk); @@ -632,7 +631,7 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, FIFO_DISABLE, ODD_FIELD); - // Jump to Even Risc program of 1st Frame + /* Jump to Even Risc program of 1st Frame */ *(rp++) = cpu_to_le32(RISC_JUMP); *(rp++) = cpu_to_le32(risc_phys_jump_addr); *(rp++) = cpu_to_le32(0); @@ -660,7 +659,7 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, dev->_frame_count); return -1; } - //ElSE, set the interrupt mask register, re-enable irq. + /* ElSE, set the interrupt mask register, re-enable irq. */ int_msk_tmp = cx_read(channel->int_msk); cx_write(channel->int_msk, int_msk_tmp |= _intr_msk); @@ -685,17 +684,16 @@ static irqreturn_t cx25821_upstream_irq(int irq, void *dev_id) msk_stat = cx_read(sram_ch->int_mstat); vid_status = cx_read(sram_ch->int_stat); - // Only deal with our interrupt + /* Only deal with our interrupt */ if (vid_status) { handled = cx25821_video_upstream_irq(dev, channel_num, vid_status); } - if (handled < 0) { + if (handled < 0) cx25821_stop_upstream_video_ch1(dev); - } else { + else handled += handled; - } return IRQ_RETVAL(handled); } @@ -714,19 +712,19 @@ void cx25821_set_pixelengine(struct cx25821_dev *dev, struct sram_channel *ch, value |= dev->_isNTSC ? 0 : 0x10; cx_write(ch->vid_fmt_ctl, value); - // set number of active pixels in each line. Default is 720 pixels in both NTSC and PAL format + /* set number of active pixels in each line. + * Default is 720 pixels in both NTSC and PAL format */ cx_write(ch->vid_active_ctl1, width); num_lines = (height / 2) & 0x3FF; odd_num_lines = num_lines; - if (dev->_isNTSC) { + if (dev->_isNTSC) odd_num_lines += 1; - } value = (num_lines << 16) | odd_num_lines; - // set number of active lines in field 0 (top) and field 1 (bottom) + /* set number of active lines in field 0 (top) and field 1 (bottom) */ cx_write(ch->vid_active_ctl2, value); cx_write(ch->vid_cdt_size, VID_CDT_SIZE >> 3); @@ -738,21 +736,26 @@ int cx25821_start_video_dma_upstream(struct cx25821_dev *dev, u32 tmp = 0; int err = 0; - // 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for channel A-C + /* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for + * channel A-C + */ tmp = cx_read(VID_CH_MODE_SEL); cx_write(VID_CH_MODE_SEL, tmp | 0x1B0001FF); - // Set the physical start address of the RISC program in the initial program counter(IPC) member of the cmds. + /* Set the physical start address of the RISC program in the initial + * program counter(IPC) member of the cmds. + */ cx_write(sram_ch->cmds_start + 0, dev->_dma_phys_addr); - cx_write(sram_ch->cmds_start + 4, 0); /* Risc IPC High 64 bits 63-32 */ + /* Risc IPC High 64 bits 63-32 */ + cx_write(sram_ch->cmds_start + 4, 0); /* reset counter */ cx_write(sram_ch->gpcnt_ctl, 3); - // Clear our bits from the interrupt status register. + /* Clear our bits from the interrupt status register. */ cx_write(sram_ch->int_stat, _intr_msk); - //Set the interrupt mask register, enable irq. + /* Set the interrupt mask register, enable irq. */ cx_set(PCI_INT_MSK, cx_read(PCI_INT_MSK) | (1 << sram_ch->irq_bit)); tmp = cx_read(sram_ch->int_msk); cx_write(sram_ch->int_msk, tmp |= _intr_msk); @@ -766,7 +769,7 @@ int cx25821_start_video_dma_upstream(struct cx25821_dev *dev, goto fail_irq; } - // Start the DMA engine + /* Start the DMA engine */ tmp = cx_read(sram_ch->dma_ctl); cx_set(sram_ch->dma_ctl, tmp | FLD_VID_RISC_EN); @@ -775,7 +778,7 @@ int cx25821_start_video_dma_upstream(struct cx25821_dev *dev, return 0; - fail_irq: +fail_irq: cx25821_dev_unregister(dev); return err; } @@ -807,7 +810,9 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, ("cx25821: create_singlethread_workqueue() for Video FAILED!\n"); return -ENOMEM; } - // 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for channel A-C + /* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for + * channel A-C + */ tmp = cx_read(VID_CH_MODE_SEL); cx_write(VID_CH_MODE_SEL, tmp | 0x1B0001FF); @@ -841,7 +846,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, memcpy(dev->_filename, dev->_defaultname, str_length + 1); } - //Default if filename is empty string + /* Default if filename is empty string */ if (strcmp(dev->input_filename, "") == 0) { if (dev->_isNTSC) { dev->_filename = @@ -875,7 +880,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, dev->upstream_riscbuf_size = risc_buffer_size * 2; dev->upstream_databuf_size = data_frame_size * 2; - //Allocating buffers and prepare RISC program + /* Allocating buffers and prepare RISC program */ retval = cx25821_upstream_buffer_prepare(dev, sram_ch, dev->_line_size); if (retval < 0) { printk(KERN_ERR @@ -888,7 +893,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, return 0; - error: +error: cx25821_dev_unregister(dev); return err; -- GitLab From b084307c750cb3de4a366aeced1b69ee768c81aa Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 6 Apr 2010 02:26:48 -0300 Subject: [PATCH 275/534] V4L/DVB: cx23885: strcpy() => strlcpy() cap->driver is a 16 char buffer and dev->name is a 32 char buffer. I don't see an actual problem, but we may as well make the static checkers happy. Signed-off-by: Dan Carpenter Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx23885/cx23885-417.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index a8ddc227cf86..abd64e89f60f 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c @@ -1356,7 +1356,7 @@ static int vidioc_querycap(struct file *file, void *priv, struct cx23885_dev *dev = fh->dev; struct cx23885_tsport *tsport = &dev->ts1; - strcpy(cap->driver, dev->name); + strlcpy(cap->driver, dev->name, sizeof(cap->driver)); strlcpy(cap->card, cx23885_boards[tsport->dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); -- GitLab From d49f7a240575937703f04d07cf41be1672ce2e25 Mon Sep 17 00:00:00 2001 From: Ricardo Maraschini Date: Tue, 6 Apr 2010 02:40:43 -0300 Subject: [PATCH 276/534] V4L/DVB: cx88-dvb: fix on switch identation [dougsland@redhat.com: fixed reject due changes in cx88-dvb.c] Signed-off-by: Ricardo Maraschini Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-dvb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 94ab862f0219..faa8e8163a4a 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -1231,7 +1231,7 @@ static int dvb_register(struct cx8802_dev *dev) fe->ops.tuner_ops.set_config(fe, &ctl); } break; - case CX88_BOARD_PINNACLE_HYBRID_PCTV: + case CX88_BOARD_PINNACLE_HYBRID_PCTV: case CX88_BOARD_WINFAST_DTV1800H: fe0->dvb.frontend = dvb_attach(zl10353_attach, &cx88_pinnacle_hybrid_pctv, -- GitLab From e20144770f5a119516f93959eca9818fa5ff065e Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 6 Apr 2010 02:51:04 -0300 Subject: [PATCH 277/534] V4L/DVB: drivers/media/video: avoid NULL dereference It seems impossible for ov to be NULL at this point. The semantic match that finds the problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ expression E, E1; identifier f; statement S1,S3; iterator iter; @@ if ((E == NULL && ...) || ...) { ... when != false ((E == NULL && ...) || ...) when != true ((E != NULL && ...) || ...) when != iter(E,...) S1 when != E = E1 ( sizeof(E->f) | * E->f ) ... when any return ...; } else S3 // Signed-off-by: Julia Lawall Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov511.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c index e0bce8dc74bf..dd1b1ac1a0ef 100644 --- a/drivers/media/video/ov511.c +++ b/drivers/media/video/ov511.c @@ -5916,11 +5916,6 @@ ov51x_disconnect(struct usb_interface *intf) mutex_lock(&ov->lock); usb_set_intfdata (intf, NULL); - if (!ov) { - mutex_unlock(&ov->lock); - return; - } - /* Free device number */ ov511_devused &= ~(1 << ov->nr); -- GitLab From e838326312bbacd6c320113711e2662568d4fc6c Mon Sep 17 00:00:00 2001 From: Vladimir Ermakov Date: Wed, 7 Apr 2010 02:23:31 -0300 Subject: [PATCH 278/534] V4L/DVB: saa7134: fix GPIO HW-404M7 Signed-off-by: Vladimir Ermakov Reviewed-by: hermann pitton Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-cards.c | 4 ++-- drivers/media/video/saa7134/saa7134-input.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 655068f6c491..b937d4da3136 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -5364,12 +5364,12 @@ struct saa7134_board saa7134_boards[] = { .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .gpiomask = 0x01fc00, + .gpiomask = 0x389c00, .inputs = {{ .name = name_comp1, .vmux = 3, .amux = LINE1, - .gpio = 0x389c00, + .gpio = 0x01fc00, } }, }, diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index ae17b853f957..c8c1c9ae6a79 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -607,7 +607,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) switch (dev->board) { case SAA7134_BOARD_FLYVIDEO2000: case SAA7134_BOARD_FLYVIDEO3000: - case SAA7134_BOARD_HAWELL_HW_404M7: case SAA7134_BOARD_FLYTVPLATINUM_FM: case SAA7134_BOARD_FLYTVPLATINUM_MINI2: case SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM: -- GitLab From 42397ce42cb0a56276abde767e1598af74ca0af2 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 7 Apr 2010 02:59:26 -0300 Subject: [PATCH 279/534] V4L/DVB: ov511: Fix continuation lines Signed-off-by: Joe Perches Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ov511.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c index dd1b1ac1a0ef..6085d5582555 100644 --- a/drivers/media/video/ov511.c +++ b/drivers/media/video/ov511.c @@ -57,8 +57,8 @@ #define DRIVER_VERSION "v1.64 for Linux 2.5" #define EMAIL "mark@alpha.dyndns.org" #define DRIVER_AUTHOR "Mark McClelland & Bret Wallach \ - & Orion Sky Lawlor & Kevin Moore & Charl P. Botha \ - & Claudio Matsuoka " +& Orion Sky Lawlor & Kevin Moore & Charl P. Botha \ + & Claudio Matsuoka " #define DRIVER_DESC "ov511 USB Camera Driver" #define OV511_I2C_RETRIES 3 -- GitLab From d53b213c5ca7d5a944d471b72b068714bb16e8dc Mon Sep 17 00:00:00 2001 From: Dmitri Belimov Date: Thu, 18 Mar 2010 04:00:19 -0300 Subject: [PATCH 280/534] V4L/DVB: Add CHIP ID of the uPD61151 Add CHIP ID of the NEC MPEG2 encoders uPD61151 and uPD61152. Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-chip-ident.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index bf937d3c6ba9..42759db6794e 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h @@ -293,6 +293,11 @@ enum { /* module cs53132a: just ident 53132 */ V4L2_IDENT_CS53l32A = 53132, + /* modules upd61151 MPEG2 encoder: just ident 54000 */ + V4L2_IDENT_UPD61161 = 54000, + /* modules upd61152 MPEG2 encoder with AC3: just ident 54001 */ + V4L2_IDENT_UPD61162 = 54001, + /* module upd64031a: just ident 64031 */ V4L2_IDENT_UPD64031A = 64031, -- GitLab From 8b75acb52f477099d7e5203994dac43cc5f599a0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Apr 2010 21:05:21 -0300 Subject: [PATCH 281/534] V4L/DVB: ir-common: Use a function to declare an IR table This is the first patch of a series of changes that will break the IR tables into a series of small modules that can be dynamically loaded, or just loaded from userspace. Signed-off-by: Mauro Carvalho Chehab --- include/media/ir-common.h | 136 ++++++++++++++++++++------------------ 1 file changed, 71 insertions(+), 65 deletions(-) diff --git a/include/media/ir-common.h b/include/media/ir-common.h index e403a9a5281a..800fc980e0e4 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -106,69 +106,75 @@ void ir_rc5_timer_keyup(unsigned long data); /* scancode->keycode map tables from ir-keymaps.c */ -extern struct ir_scancode_table ir_codes_empty_table; -extern struct ir_scancode_table ir_codes_avermedia_table; -extern struct ir_scancode_table ir_codes_avermedia_dvbt_table; -extern struct ir_scancode_table ir_codes_avermedia_m135a_rm_jx_table; -extern struct ir_scancode_table ir_codes_avermedia_cardbus_table; -extern struct ir_scancode_table ir_codes_apac_viewcomp_table; -extern struct ir_scancode_table ir_codes_pixelview_table; -extern struct ir_scancode_table ir_codes_pixelview_new_table; -extern struct ir_scancode_table ir_codes_nebula_table; -extern struct ir_scancode_table ir_codes_dntv_live_dvb_t_table; -extern struct ir_scancode_table ir_codes_iodata_bctv7e_table; -extern struct ir_scancode_table ir_codes_adstech_dvb_t_pci_table; -extern struct ir_scancode_table ir_codes_msi_tvanywhere_table; -extern struct ir_scancode_table ir_codes_cinergy_1400_table; -extern struct ir_scancode_table ir_codes_avertv_303_table; -extern struct ir_scancode_table ir_codes_dntv_live_dvbt_pro_table; -extern struct ir_scancode_table ir_codes_em_terratec_table; -extern struct ir_scancode_table ir_codes_pinnacle_grey_table; -extern struct ir_scancode_table ir_codes_flyvideo_table; -extern struct ir_scancode_table ir_codes_flydvb_table; -extern struct ir_scancode_table ir_codes_cinergy_table; -extern struct ir_scancode_table ir_codes_eztv_table; -extern struct ir_scancode_table ir_codes_avermedia_table; -extern struct ir_scancode_table ir_codes_videomate_tv_pvr_table; -extern struct ir_scancode_table ir_codes_manli_table; -extern struct ir_scancode_table ir_codes_gotview7135_table; -extern struct ir_scancode_table ir_codes_purpletv_table; -extern struct ir_scancode_table ir_codes_pctv_sedna_table; -extern struct ir_scancode_table ir_codes_pv951_table; -extern struct ir_scancode_table ir_codes_rc5_tv_table; -extern struct ir_scancode_table ir_codes_winfast_table; -extern struct ir_scancode_table ir_codes_pinnacle_color_table; -extern struct ir_scancode_table ir_codes_hauppauge_new_table; -extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table; -extern struct ir_scancode_table ir_codes_npgtech_table; -extern struct ir_scancode_table ir_codes_norwood_table; -extern struct ir_scancode_table ir_codes_proteus_2309_table; -extern struct ir_scancode_table ir_codes_budget_ci_old_table; -extern struct ir_scancode_table ir_codes_asus_pc39_table; -extern struct ir_scancode_table ir_codes_encore_enltv_table; -extern struct ir_scancode_table ir_codes_encore_enltv2_table; -extern struct ir_scancode_table ir_codes_tt_1500_table; -extern struct ir_scancode_table ir_codes_fusionhdtv_mce_table; -extern struct ir_scancode_table ir_codes_behold_table; -extern struct ir_scancode_table ir_codes_behold_columbus_table; -extern struct ir_scancode_table ir_codes_pinnacle_pctv_hd_table; -extern struct ir_scancode_table ir_codes_genius_tvgo_a11mce_table; -extern struct ir_scancode_table ir_codes_powercolor_real_angel_table; -extern struct ir_scancode_table ir_codes_avermedia_a16d_table; -extern struct ir_scancode_table ir_codes_encore_enltv_fm53_table; -extern struct ir_scancode_table ir_codes_real_audio_220_32_keys_table; -extern struct ir_scancode_table ir_codes_msi_tvanywhere_plus_table; -extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table; -extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; -extern struct ir_scancode_table ir_codes_kaiomy_table; -extern struct ir_scancode_table ir_codes_dm1105_nec_table; -extern struct ir_scancode_table ir_codes_tevii_nec_table; -extern struct ir_scancode_table ir_codes_tbs_nec_table; -extern struct ir_scancode_table ir_codes_evga_indtube_table; -extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; -extern struct ir_scancode_table ir_codes_videomate_s350_table; -extern struct ir_scancode_table ir_codes_gadmei_rm008z_table; -extern struct ir_scancode_table ir_codes_nec_terratec_cinergy_xs_table; -extern struct ir_scancode_table ir_codes_winfast_usbii_deluxe_table; -extern struct ir_scancode_table ir_codes_kworld_315u_table; +#define IR_KEYTABLE(a) \ +(ir_codes_ ## a ## _table) + +#define DECLARE_IR_KEYTABLE(a) \ +extern struct ir_scancode_table IR_KEYTABLE(a) + +DECLARE_IR_KEYTABLE(empty); +DECLARE_IR_KEYTABLE(avermedia); +DECLARE_IR_KEYTABLE(avermedia_dvbt); +DECLARE_IR_KEYTABLE(avermedia_m135a_rm_jx); +DECLARE_IR_KEYTABLE(avermedia_cardbus); +DECLARE_IR_KEYTABLE(apac_viewcomp); +DECLARE_IR_KEYTABLE(pixelview); +DECLARE_IR_KEYTABLE(pixelview_new); +DECLARE_IR_KEYTABLE(nebula); +DECLARE_IR_KEYTABLE(dntv_live_dvb_t); +DECLARE_IR_KEYTABLE(iodata_bctv7e); +DECLARE_IR_KEYTABLE(adstech_dvb_t_pci); +DECLARE_IR_KEYTABLE(msi_tvanywhere); +DECLARE_IR_KEYTABLE(cinergy_1400); +DECLARE_IR_KEYTABLE(avertv_303); +DECLARE_IR_KEYTABLE(dntv_live_dvbt_pro); +DECLARE_IR_KEYTABLE(em_terratec); +DECLARE_IR_KEYTABLE(pinnacle_grey); +DECLARE_IR_KEYTABLE(flyvideo); +DECLARE_IR_KEYTABLE(flydvb); +DECLARE_IR_KEYTABLE(cinergy); +DECLARE_IR_KEYTABLE(eztv); +DECLARE_IR_KEYTABLE(avermedia); +DECLARE_IR_KEYTABLE(videomate_tv_pvr); +DECLARE_IR_KEYTABLE(manli); +DECLARE_IR_KEYTABLE(gotview7135); +DECLARE_IR_KEYTABLE(purpletv); +DECLARE_IR_KEYTABLE(pctv_sedna); +DECLARE_IR_KEYTABLE(pv951); +DECLARE_IR_KEYTABLE(rc5_tv); +DECLARE_IR_KEYTABLE(winfast); +DECLARE_IR_KEYTABLE(pinnacle_color); +DECLARE_IR_KEYTABLE(hauppauge_new); +DECLARE_IR_KEYTABLE(rc5_hauppauge_new); +DECLARE_IR_KEYTABLE(npgtech); +DECLARE_IR_KEYTABLE(norwood); +DECLARE_IR_KEYTABLE(proteus_2309); +DECLARE_IR_KEYTABLE(budget_ci_old); +DECLARE_IR_KEYTABLE(asus_pc39); +DECLARE_IR_KEYTABLE(encore_enltv); +DECLARE_IR_KEYTABLE(encore_enltv2); +DECLARE_IR_KEYTABLE(tt_1500); +DECLARE_IR_KEYTABLE(fusionhdtv_mce); +DECLARE_IR_KEYTABLE(behold); +DECLARE_IR_KEYTABLE(behold_columbus); +DECLARE_IR_KEYTABLE(pinnacle_pctv_hd); +DECLARE_IR_KEYTABLE(genius_tvgo_a11mce); +DECLARE_IR_KEYTABLE(powercolor_real_angel); +DECLARE_IR_KEYTABLE(avermedia_a16d); +DECLARE_IR_KEYTABLE(encore_enltv_fm53); +DECLARE_IR_KEYTABLE(real_audio_220_32_keys); +DECLARE_IR_KEYTABLE(msi_tvanywhere_plus); +DECLARE_IR_KEYTABLE(ati_tv_wonder_hd_600); +DECLARE_IR_KEYTABLE(kworld_plus_tv_analog); +DECLARE_IR_KEYTABLE(kaiomy); +DECLARE_IR_KEYTABLE(dm1105_nec); +DECLARE_IR_KEYTABLE(tevii_nec); +DECLARE_IR_KEYTABLE(tbs_nec); +DECLARE_IR_KEYTABLE(evga_indtube); +DECLARE_IR_KEYTABLE(terratec_cinergy_xs); +DECLARE_IR_KEYTABLE(videomate_s350); +DECLARE_IR_KEYTABLE(gadmei_rm008z); +DECLARE_IR_KEYTABLE(nec_terratec_cinergy_xs); +DECLARE_IR_KEYTABLE(winfast_usbii_deluxe); +DECLARE_IR_KEYTABLE(kworld_315u); #endif -- GitLab From 165344bd43b1410d10dc9dc8a376da31178d1694 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Apr 2010 21:10:58 -0300 Subject: [PATCH 282/534] V4L/DVB: ir-common: re-order keytables by name and remove duplicates Signed-off-by: Mauro Carvalho Chehab --- include/media/ir-common.h | 96 +++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 800fc980e0e4..2e275154aef3 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -112,69 +112,69 @@ void ir_rc5_timer_keyup(unsigned long data); #define DECLARE_IR_KEYTABLE(a) \ extern struct ir_scancode_table IR_KEYTABLE(a) -DECLARE_IR_KEYTABLE(empty); +DECLARE_IR_KEYTABLE(adstech_dvb_t_pci); +DECLARE_IR_KEYTABLE(apac_viewcomp); +DECLARE_IR_KEYTABLE(asus_pc39); +DECLARE_IR_KEYTABLE(ati_tv_wonder_hd_600); DECLARE_IR_KEYTABLE(avermedia); +DECLARE_IR_KEYTABLE(avermedia_a16d); +DECLARE_IR_KEYTABLE(avermedia_cardbus); DECLARE_IR_KEYTABLE(avermedia_dvbt); DECLARE_IR_KEYTABLE(avermedia_m135a_rm_jx); -DECLARE_IR_KEYTABLE(avermedia_cardbus); -DECLARE_IR_KEYTABLE(apac_viewcomp); -DECLARE_IR_KEYTABLE(pixelview); -DECLARE_IR_KEYTABLE(pixelview_new); -DECLARE_IR_KEYTABLE(nebula); -DECLARE_IR_KEYTABLE(dntv_live_dvb_t); -DECLARE_IR_KEYTABLE(iodata_bctv7e); -DECLARE_IR_KEYTABLE(adstech_dvb_t_pci); -DECLARE_IR_KEYTABLE(msi_tvanywhere); -DECLARE_IR_KEYTABLE(cinergy_1400); DECLARE_IR_KEYTABLE(avertv_303); +DECLARE_IR_KEYTABLE(behold); +DECLARE_IR_KEYTABLE(behold_columbus); +DECLARE_IR_KEYTABLE(budget_ci_old); +DECLARE_IR_KEYTABLE(cinergy); +DECLARE_IR_KEYTABLE(cinergy_1400); +DECLARE_IR_KEYTABLE(dm1105_nec); +DECLARE_IR_KEYTABLE(dntv_live_dvb_t); DECLARE_IR_KEYTABLE(dntv_live_dvbt_pro); +DECLARE_IR_KEYTABLE(empty); DECLARE_IR_KEYTABLE(em_terratec); -DECLARE_IR_KEYTABLE(pinnacle_grey); -DECLARE_IR_KEYTABLE(flyvideo); -DECLARE_IR_KEYTABLE(flydvb); -DECLARE_IR_KEYTABLE(cinergy); +DECLARE_IR_KEYTABLE(encore_enltv); +DECLARE_IR_KEYTABLE(encore_enltv2); +DECLARE_IR_KEYTABLE(encore_enltv_fm53); +DECLARE_IR_KEYTABLE(evga_indtube); DECLARE_IR_KEYTABLE(eztv); -DECLARE_IR_KEYTABLE(avermedia); -DECLARE_IR_KEYTABLE(videomate_tv_pvr); -DECLARE_IR_KEYTABLE(manli); +DECLARE_IR_KEYTABLE(flydvb); +DECLARE_IR_KEYTABLE(flyvideo); +DECLARE_IR_KEYTABLE(fusionhdtv_mce); +DECLARE_IR_KEYTABLE(gadmei_rm008z); +DECLARE_IR_KEYTABLE(genius_tvgo_a11mce); DECLARE_IR_KEYTABLE(gotview7135); -DECLARE_IR_KEYTABLE(purpletv); -DECLARE_IR_KEYTABLE(pctv_sedna); -DECLARE_IR_KEYTABLE(pv951); -DECLARE_IR_KEYTABLE(rc5_tv); -DECLARE_IR_KEYTABLE(winfast); -DECLARE_IR_KEYTABLE(pinnacle_color); DECLARE_IR_KEYTABLE(hauppauge_new); -DECLARE_IR_KEYTABLE(rc5_hauppauge_new); -DECLARE_IR_KEYTABLE(npgtech); +DECLARE_IR_KEYTABLE(iodata_bctv7e); +DECLARE_IR_KEYTABLE(kaiomy); +DECLARE_IR_KEYTABLE(kworld_315u); +DECLARE_IR_KEYTABLE(kworld_plus_tv_analog); +DECLARE_IR_KEYTABLE(manli); +DECLARE_IR_KEYTABLE(msi_tvanywhere); +DECLARE_IR_KEYTABLE(msi_tvanywhere_plus); +DECLARE_IR_KEYTABLE(nebula); +DECLARE_IR_KEYTABLE(nec_terratec_cinergy_xs); DECLARE_IR_KEYTABLE(norwood); -DECLARE_IR_KEYTABLE(proteus_2309); -DECLARE_IR_KEYTABLE(budget_ci_old); -DECLARE_IR_KEYTABLE(asus_pc39); -DECLARE_IR_KEYTABLE(encore_enltv); -DECLARE_IR_KEYTABLE(encore_enltv2); -DECLARE_IR_KEYTABLE(tt_1500); -DECLARE_IR_KEYTABLE(fusionhdtv_mce); -DECLARE_IR_KEYTABLE(behold); -DECLARE_IR_KEYTABLE(behold_columbus); +DECLARE_IR_KEYTABLE(npgtech); +DECLARE_IR_KEYTABLE(pctv_sedna); +DECLARE_IR_KEYTABLE(pinnacle_color); +DECLARE_IR_KEYTABLE(pinnacle_grey); DECLARE_IR_KEYTABLE(pinnacle_pctv_hd); -DECLARE_IR_KEYTABLE(genius_tvgo_a11mce); +DECLARE_IR_KEYTABLE(pixelview); +DECLARE_IR_KEYTABLE(pixelview_new); DECLARE_IR_KEYTABLE(powercolor_real_angel); -DECLARE_IR_KEYTABLE(avermedia_a16d); -DECLARE_IR_KEYTABLE(encore_enltv_fm53); +DECLARE_IR_KEYTABLE(proteus_2309); +DECLARE_IR_KEYTABLE(purpletv); +DECLARE_IR_KEYTABLE(pv951); +DECLARE_IR_KEYTABLE(rc5_hauppauge_new); +DECLARE_IR_KEYTABLE(rc5_tv); DECLARE_IR_KEYTABLE(real_audio_220_32_keys); -DECLARE_IR_KEYTABLE(msi_tvanywhere_plus); -DECLARE_IR_KEYTABLE(ati_tv_wonder_hd_600); -DECLARE_IR_KEYTABLE(kworld_plus_tv_analog); -DECLARE_IR_KEYTABLE(kaiomy); -DECLARE_IR_KEYTABLE(dm1105_nec); -DECLARE_IR_KEYTABLE(tevii_nec); DECLARE_IR_KEYTABLE(tbs_nec); -DECLARE_IR_KEYTABLE(evga_indtube); DECLARE_IR_KEYTABLE(terratec_cinergy_xs); +DECLARE_IR_KEYTABLE(tevii_nec); +DECLARE_IR_KEYTABLE(tt_1500); DECLARE_IR_KEYTABLE(videomate_s350); -DECLARE_IR_KEYTABLE(gadmei_rm008z); -DECLARE_IR_KEYTABLE(nec_terratec_cinergy_xs); +DECLARE_IR_KEYTABLE(videomate_tv_pvr); +DECLARE_IR_KEYTABLE(winfast); DECLARE_IR_KEYTABLE(winfast_usbii_deluxe); -DECLARE_IR_KEYTABLE(kworld_315u); + #endif -- GitLab From d705d2ab7596b4661a2f13172f4f93ad11bd761f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Apr 2010 21:27:04 -0300 Subject: [PATCH 283/534] V4L/DVB: ir: use IR_KEYTABLE where an IR table is needed Replaces most of the occurences of IR keytables on V4L drivers by a macro that evaluates to provide the name of the exported symbol. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dm1105/dm1105.c | 2 +- drivers/media/dvb/ttpci/budget-ci.c | 6 +- drivers/media/video/bt8xx/bttv-input.c | 24 ++++---- drivers/media/video/cx18/cx18-i2c.c | 2 +- drivers/media/video/cx23885/cx23885-input.c | 2 +- drivers/media/video/cx88/cx88-input.c | 38 ++++++------ drivers/media/video/em28xx/em28xx-cards.c | 34 +++++------ drivers/media/video/ir-kbd-i2c.c | 18 +++--- drivers/media/video/ivtv/ivtv-i2c.c | 6 +- drivers/media/video/saa7134/saa7134-input.c | 68 ++++++++++----------- 10 files changed, 100 insertions(+), 100 deletions(-) diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 3229ff325c56..ff62dc8633c0 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -596,7 +596,7 @@ static irqreturn_t dm1105_irq(int irq, void *dev_id) int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) { struct input_dev *input_dev; - struct ir_scancode_table *ir_codes = &ir_codes_dm1105_nec_table; + struct ir_scancode_table *ir_codes = &IR_KEYTABLE(dm1105_nec); u64 ir_type = IR_TYPE_OTHER; int err = -ENOMEM; diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index ec89afd38917..75c640e5966c 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -232,7 +232,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1011: case 0x1012: /* The hauppauge keymap is a superset of these remotes */ - ir_codes = &ir_codes_hauppauge_new_table; + ir_codes = &IR_KEYTABLE(hauppauge_new); if (rc5_device < 0) budget_ci->ir.rc5_device = 0x1f; @@ -241,11 +241,11 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1017: case 0x101a: /* for the Technotrend 1500 bundled remote */ - ir_codes = &ir_codes_tt_1500_table; + ir_codes = &IR_KEYTABLE(tt_1500); break; default: /* unknown remote */ - ir_codes = &ir_codes_budget_ci_old_table; + ir_codes = &IR_KEYTABLE(budget_ci_old); break; } diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index d17a9b7911e5..e3d239da1bad 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -266,7 +266,7 @@ int bttv_input_init(struct bttv *btv) case BTTV_BOARD_AVERMEDIA: case BTTV_BOARD_AVPHONE98: case BTTV_BOARD_AVERMEDIA98: - ir_codes = &ir_codes_avermedia_table; + ir_codes = &IR_KEYTABLE(avermedia); ir->mask_keycode = 0xf88000; ir->mask_keydown = 0x010000; ir->polling = 50; // ms @@ -274,14 +274,14 @@ int bttv_input_init(struct bttv *btv) case BTTV_BOARD_AVDVBT_761: case BTTV_BOARD_AVDVBT_771: - ir_codes = &ir_codes_avermedia_dvbt_table; + ir_codes = &IR_KEYTABLE(avermedia_dvbt); ir->mask_keycode = 0x0f00c0; ir->mask_keydown = 0x000020; ir->polling = 50; // ms break; case BTTV_BOARD_PXELVWPLTVPAK: - ir_codes = &ir_codes_pixelview_table; + ir_codes = &IR_KEYTABLE(pixelview); ir->mask_keycode = 0x003e00; ir->mask_keyup = 0x010000; ir->polling = 50; // ms @@ -289,24 +289,24 @@ int bttv_input_init(struct bttv *btv) case BTTV_BOARD_PV_M4900: case BTTV_BOARD_PV_BT878P_9B: case BTTV_BOARD_PV_BT878P_PLUS: - ir_codes = &ir_codes_pixelview_table; + ir_codes = &IR_KEYTABLE(pixelview); ir->mask_keycode = 0x001f00; ir->mask_keyup = 0x008000; ir->polling = 50; // ms break; case BTTV_BOARD_WINFAST2000: - ir_codes = &ir_codes_winfast_table; + ir_codes = &IR_KEYTABLE(winfast); ir->mask_keycode = 0x1f8; break; case BTTV_BOARD_MAGICTVIEW061: case BTTV_BOARD_MAGICTVIEW063: - ir_codes = &ir_codes_winfast_table; + ir_codes = &IR_KEYTABLE(winfast); ir->mask_keycode = 0x0008e000; ir->mask_keydown = 0x00200000; break; case BTTV_BOARD_APAC_VIEWCOMP: - ir_codes = &ir_codes_apac_viewcomp_table; + ir_codes = &IR_KEYTABLE(apac_viewcomp); ir->mask_keycode = 0x001f00; ir->mask_keyup = 0x008000; ir->polling = 50; // ms @@ -314,30 +314,30 @@ int bttv_input_init(struct bttv *btv) case BTTV_BOARD_ASKEY_CPH03X: case BTTV_BOARD_CONCEPTRONIC_CTVFMI2: case BTTV_BOARD_CONTVFMI: - ir_codes = &ir_codes_pixelview_table; + ir_codes = &IR_KEYTABLE(pixelview); ir->mask_keycode = 0x001F00; ir->mask_keyup = 0x006000; ir->polling = 50; // ms break; case BTTV_BOARD_NEBULA_DIGITV: - ir_codes = &ir_codes_nebula_table; + ir_codes = &IR_KEYTABLE(nebula); btv->custom_irq = bttv_rc5_irq; ir->rc5_gpio = 1; break; case BTTV_BOARD_MACHTV_MAGICTV: - ir_codes = &ir_codes_apac_viewcomp_table; + ir_codes = &IR_KEYTABLE(apac_viewcomp); ir->mask_keycode = 0x001F00; ir->mask_keyup = 0x004000; ir->polling = 50; /* ms */ break; case BTTV_BOARD_KOZUMI_KTV_01C: - ir_codes = &ir_codes_pctv_sedna_table; + ir_codes = &IR_KEYTABLE(pctv_sedna); ir->mask_keycode = 0x001f00; ir->mask_keyup = 0x006000; ir->polling = 50; /* ms */ break; case BTTV_BOARD_ENLTV_FM_2: - ir_codes = &ir_codes_encore_enltv2_table; + ir_codes = &IR_KEYTABLE(encore_enltv2); ir->mask_keycode = 0x00fd00; ir->mask_keyup = 0x000080; ir->polling = 1; /* ms */ diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index eecf29af916c..476c016e63a8 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c @@ -109,7 +109,7 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, /* Our default information for ir-kbd-i2c.c to use */ switch (hw) { case CX18_HW_Z8F0811_IR_RX_HAUP: - init_data->ir_codes = &ir_codes_hauppauge_new_table; + init_data->ir_codes = &IR_KEYTABLE(hauppauge_new); init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; init_data->type = IR_TYPE_RC5; init_data->name = cx->card_name; diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index ef1db2d9668a..66d3e1c64ce6 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c @@ -355,7 +355,7 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: /* Parameters for the grey Hauppauge remote for the HVR-1850 */ - ir_codes = &ir_codes_hauppauge_new_table; + ir_codes = &IR_KEYTABLE(hauppauge_new); ir_type = IR_TYPE_RC5; ir_addr = 0x1e; /* RC-5 system bits emitted by the remote */ ir_start = RC5_START_BITS_NORMAL; /* A basic RC-5 remote */ diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 8bd95be89e67..48ca9805bb90 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -261,14 +261,14 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_DNTV_LIVE_DVB_T: case CX88_BOARD_KWORLD_DVB_T: case CX88_BOARD_KWORLD_DVB_T_CX22702: - ir_codes = &ir_codes_dntv_live_dvb_t_table; + ir_codes = &IR_KEYTABLE(dntv_live_dvb_t); ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x1f; ir->mask_keyup = 0x60; ir->polling = 50; /* ms */ break; case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: - ir_codes = &ir_codes_cinergy_1400_table; + ir_codes = &IR_KEYTABLE(cinergy_1400); ir_type = IR_TYPE_PD; ir->sampling = 0xeb04; /* address */ break; @@ -283,14 +283,14 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_PCHDTV_HD3000: case CX88_BOARD_PCHDTV_HD5500: case CX88_BOARD_HAUPPAUGE_IRONLY: - ir_codes = &ir_codes_hauppauge_new_table; + ir_codes = &IR_KEYTABLE(hauppauge_new); ir_type = IR_TYPE_RC5; ir->sampling = 1; break; case CX88_BOARD_WINFAST_DTV2000H: case CX88_BOARD_WINFAST_DTV2000H_J: case CX88_BOARD_WINFAST_DTV1800H: - ir_codes = &ir_codes_winfast_table; + ir_codes = &IR_KEYTABLE(winfast); ir->gpio_addr = MO_GP0_IO; ir->mask_keycode = 0x8f8; ir->mask_keyup = 0x100; @@ -299,14 +299,14 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_WINFAST2000XP_EXPERT: case CX88_BOARD_WINFAST_DTV1000: case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: - ir_codes = &ir_codes_winfast_table; + ir_codes = &IR_KEYTABLE(winfast); ir->gpio_addr = MO_GP0_IO; ir->mask_keycode = 0x8f8; ir->mask_keyup = 0x100; ir->polling = 1; /* ms */ break; case CX88_BOARD_IODATA_GVBCTV7E: - ir_codes = &ir_codes_iodata_bctv7e_table; + ir_codes = &IR_KEYTABLE(iodata_bctv7e); ir->gpio_addr = MO_GP0_IO; ir->mask_keycode = 0xfd; ir->mask_keydown = 0x02; @@ -314,7 +314,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_PROLINK_PLAYTVPVR: case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: - ir_codes = &ir_codes_pixelview_table; + ir_codes = &IR_KEYTABLE(pixelview); ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x1f; ir->mask_keyup = 0x80; @@ -322,28 +322,28 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_PROLINK_PV_8000GT: case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: - ir_codes = &ir_codes_pixelview_new_table; + ir_codes = &IR_KEYTABLE(pixelview_new); ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x3f; ir->mask_keyup = 0x80; ir->polling = 1; /* ms */ break; case CX88_BOARD_KWORLD_LTV883: - ir_codes = &ir_codes_pixelview_table; + ir_codes = &IR_KEYTABLE(pixelview); ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x1f; ir->mask_keyup = 0x60; ir->polling = 1; /* ms */ break; case CX88_BOARD_ADSTECH_DVB_T_PCI: - ir_codes = &ir_codes_adstech_dvb_t_pci_table; + ir_codes = &IR_KEYTABLE(adstech_dvb_t_pci); ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0xbf; ir->mask_keyup = 0x40; ir->polling = 50; /* ms */ break; case CX88_BOARD_MSI_TVANYWHERE_MASTER: - ir_codes = &ir_codes_msi_tvanywhere_table; + ir_codes = &IR_KEYTABLE(msi_tvanywhere); ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x1f; ir->mask_keyup = 0x40; @@ -351,7 +351,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_AVERTV_303: case CX88_BOARD_AVERTV_STUDIO_303: - ir_codes = &ir_codes_avertv_303_table; + ir_codes = &IR_KEYTABLE(avertv_303); ir->gpio_addr = MO_GP2_IO; ir->mask_keycode = 0xfb; ir->mask_keydown = 0x02; @@ -364,41 +364,41 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_PROF_7300: case CX88_BOARD_PROF_7301: case CX88_BOARD_PROF_6200: - ir_codes = &ir_codes_tbs_nec_table; + ir_codes = &IR_KEYTABLE(tbs_nec); ir_type = IR_TYPE_PD; ir->sampling = 0xff00; /* address */ break; case CX88_BOARD_TEVII_S460: case CX88_BOARD_TEVII_S420: - ir_codes = &ir_codes_tevii_nec_table; + ir_codes = &IR_KEYTABLE(tevii_nec); ir_type = IR_TYPE_PD; ir->sampling = 0xff00; /* address */ break; case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: - ir_codes = &ir_codes_dntv_live_dvbt_pro_table; + ir_codes = &IR_KEYTABLE(dntv_live_dvbt_pro); ir_type = IR_TYPE_PD; ir->sampling = 0xff00; /* address */ break; case CX88_BOARD_NORWOOD_MICRO: - ir_codes = &ir_codes_norwood_table; + ir_codes = &IR_KEYTABLE(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_table; + ir_codes = &IR_KEYTABLE(npgtech); ir->gpio_addr = MO_GP0_IO; ir->mask_keycode = 0xfa; ir->polling = 50; /* ms */ break; case CX88_BOARD_PINNACLE_PCTV_HD_800i: - ir_codes = &ir_codes_pinnacle_pctv_hd_table; + ir_codes = &IR_KEYTABLE(pinnacle_pctv_hd); ir_type = IR_TYPE_RC5; ir->sampling = 1; break; case CX88_BOARD_POWERCOLOR_REAL_ANGEL: - ir_codes = &ir_codes_powercolor_real_angel_table; + ir_codes = &IR_KEYTABLE(powercolor_real_angel); ir->gpio_addr = MO_GP2_IO; ir->mask_keycode = 0x7e; ir->polling = 100; /* ms */ diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 7b0ca583de55..29201438b45f 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -602,7 +602,7 @@ struct em28xx_board em28xx_boards[] = { .name = "Gadmei UTV330+", .tuner_type = TUNER_TNF_5335MF, .tda9887_conf = TDA9887_PRESENT, - .ir_codes = &ir_codes_gadmei_rm008z_table, + .ir_codes = &IR_KEYTABLE(gadmei_rm008z), .decoder = EM28XX_SAA711X, .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, .input = { { @@ -791,7 +791,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &ir_codes_hauppauge_new_table, + .ir_codes = &IR_KEYTABLE(hauppauge_new), .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -816,7 +816,7 @@ struct em28xx_board em28xx_boards[] = { .tuner_type = TUNER_XC2028, .tuner_gpio = default_tuner_gpio, .mts_firmware = 1, - .ir_codes = &ir_codes_hauppauge_new_table, + .ir_codes = &IR_KEYTABLE(hauppauge_new), .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -842,7 +842,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &ir_codes_hauppauge_new_table, + .ir_codes = &IR_KEYTABLE(hauppauge_new), .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -868,7 +868,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &ir_codes_rc5_hauppauge_new_table, + .ir_codes = &IR_KEYTABLE(rc5_hauppauge_new), .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -894,7 +894,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &ir_codes_pinnacle_pctv_hd_table, + .ir_codes = &IR_KEYTABLE(pinnacle_pctv_hd), .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -920,7 +920,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &ir_codes_ati_tv_wonder_hd_600_table, + .ir_codes = &IR_KEYTABLE(ati_tv_wonder_hd_600), .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -946,7 +946,7 @@ struct em28xx_board em28xx_boards[] = { .decoder = EM28XX_TVP5150, .has_dvb = 1, .dvb_gpio = default_digital, - .ir_codes = &ir_codes_terratec_cinergy_xs_table, + .ir_codes = &IR_KEYTABLE(terratec_cinergy_xs), .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */ .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -1296,7 +1296,7 @@ struct em28xx_board em28xx_boards[] = { .decoder = EM28XX_SAA711X, .has_dvb = 1, .dvb_gpio = em2882_kworld_315u_digital, - .ir_codes = &ir_codes_kworld_315u_table, + .ir_codes = &IR_KEYTABLE(kworld_315u), .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE, /* Analog mode - still not ready */ @@ -1425,7 +1425,7 @@ struct em28xx_board em28xx_boards[] = { .has_dvb = 1, .dvb_gpio = kworld_330u_digital, .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */ - .ir_codes = &ir_codes_kworld_315u_table, + .ir_codes = &IR_KEYTABLE(kworld_315u), .input = { { .type = EM28XX_VMUX_TELEVISION, .vmux = TVP5150_COMPOSITE0, @@ -1448,7 +1448,7 @@ struct em28xx_board em28xx_boards[] = { .decoder = EM28XX_TVP5150, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &ir_codes_terratec_cinergy_xs_table, + .ir_codes = &IR_KEYTABLE(terratec_cinergy_xs), .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -1541,7 +1541,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .decoder = EM28XX_TVP5150, .tuner_gpio = default_tuner_gpio, - .ir_codes = &ir_codes_kaiomy_table, + .ir_codes = &IR_KEYTABLE(kaiomy), .input = { { .type = EM28XX_VMUX_TELEVISION, .vmux = TVP5150_COMPOSITE0, @@ -1641,7 +1641,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = evga_indtube_digital, - .ir_codes = &ir_codes_evga_indtube_table, + .ir_codes = &IR_KEYTABLE(evga_indtube), .input = { { .type = EM28XX_VMUX_TELEVISION, .vmux = TVP5150_COMPOSITE0, @@ -2335,21 +2335,21 @@ void em28xx_register_i2c_ir(struct em28xx *dev) switch (dev->model) { case EM2800_BOARD_TERRATEC_CINERGY_200: case EM2820_BOARD_TERRATEC_CINERGY_250: - dev->init_data.ir_codes = &ir_codes_em_terratec_table; + dev->init_data.ir_codes = &IR_KEYTABLE(em_terratec); dev->init_data.get_key = em28xx_get_key_terratec; dev->init_data.name = "i2c IR (EM28XX Terratec)"; break; case EM2820_BOARD_PINNACLE_USB_2: - dev->init_data.ir_codes = &ir_codes_pinnacle_grey_table; + dev->init_data.ir_codes = &IR_KEYTABLE(pinnacle_grey); dev->init_data.get_key = em28xx_get_key_pinnacle_usb_grey; dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)"; break; case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2: - dev->init_data.ir_codes = &ir_codes_rc5_hauppauge_new_table; + dev->init_data.ir_codes = &IR_KEYTABLE(rc5_hauppauge_new); dev->init_data.get_key = em28xx_get_key_em_haup; dev->init_data.name = "i2c IR (EM2840 Hauppauge)"; case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE: - dev->init_data.ir_codes = &ir_codes_winfast_usbii_deluxe_table;; + dev->init_data.ir_codes = &IR_KEYTABLE(winfast_usbii_deluxe);; dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe; dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)"; break; diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 6af69d5c8499..607a0be2ec63 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -322,13 +322,13 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) name = "Pixelview"; ir->get_key = get_key_pixelview; ir_type = IR_TYPE_OTHER; - ir_codes = &ir_codes_empty_table; + ir_codes = &IR_KEYTABLE(empty); break; case 0x4b: name = "PV951"; ir->get_key = get_key_pv951; ir_type = IR_TYPE_OTHER; - ir_codes = &ir_codes_pv951_table; + ir_codes = &IR_KEYTABLE(pv951); break; case 0x18: case 0x1f: @@ -337,22 +337,22 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ir->get_key = get_key_haup; ir_type = IR_TYPE_RC5; if (hauppauge == 1) { - ir_codes = &ir_codes_hauppauge_new_table; + ir_codes = &IR_KEYTABLE(hauppauge_new); } else { - ir_codes = &ir_codes_rc5_tv_table; + ir_codes = &IR_KEYTABLE(rc5_tv); } break; case 0x30: name = "KNC One"; ir->get_key = get_key_knc1; ir_type = IR_TYPE_OTHER; - ir_codes = &ir_codes_empty_table; + ir_codes = &IR_KEYTABLE(empty); break; case 0x6b: name = "FusionHDTV"; ir->get_key = get_key_fusionhdtv; ir_type = IR_TYPE_RC5; - ir_codes = &ir_codes_fusionhdtv_mce_table; + ir_codes = &IR_KEYTABLE(fusionhdtv_mce); break; case 0x0b: case 0x47: @@ -365,9 +365,9 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ir_type = IR_TYPE_RC5; ir->get_key = get_key_haup_xvr; if (hauppauge == 1) { - ir_codes = &ir_codes_hauppauge_new_table; + ir_codes = &IR_KEYTABLE(hauppauge_new); } else { - ir_codes = &ir_codes_rc5_tv_table; + ir_codes = &IR_KEYTABLE(rc5_tv); } } else { /* Handled by saa7134-input */ @@ -379,7 +379,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) name = "AVerMedia Cardbus remote"; ir->get_key = get_key_avermedia_cardbus; ir_type = IR_TYPE_OTHER; - ir_codes = &ir_codes_avermedia_cardbus_table; + ir_codes = &IR_KEYTABLE(avermedia_cardbus); break; } diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 2ee03c2a1b58..a363e334a50e 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c @@ -193,7 +193,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) /* Our default information for ir-kbd-i2c.c to use */ switch (hw) { case IVTV_HW_I2C_IR_RX_AVER: - init_data->ir_codes = &ir_codes_avermedia_cardbus_table; + init_data->ir_codes = &IR_KEYTABLE(avermedia_cardbus); init_data->internal_get_key_func = IR_KBD_GET_KEY_AVERMEDIA_CARDBUS; init_data->type = IR_TYPE_OTHER; @@ -202,14 +202,14 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) case IVTV_HW_I2C_IR_RX_HAUP_EXT: case IVTV_HW_I2C_IR_RX_HAUP_INT: /* Default to old black remote */ - init_data->ir_codes = &ir_codes_rc5_tv_table; + init_data->ir_codes = &IR_KEYTABLE(rc5_tv); init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; init_data->type = IR_TYPE_RC5; init_data->name = itv->card_name; break; case IVTV_HW_Z8F0811_IR_RX_HAUP: /* Default to grey remote */ - init_data->ir_codes = &ir_codes_hauppauge_new_table; + init_data->ir_codes = &IR_KEYTABLE(hauppauge_new); init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; init_data->type = IR_TYPE_RC5; init_data->name = itv->card_name; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index c8c1c9ae6a79..eaafed181d50 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -610,27 +610,27 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_FLYTVPLATINUM_FM: case SAA7134_BOARD_FLYTVPLATINUM_MINI2: case SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM: - ir_codes = &ir_codes_flyvideo_table; + ir_codes = &IR_KEYTABLE(flyvideo); mask_keycode = 0xEC00000; mask_keydown = 0x0040000; break; case SAA7134_BOARD_CINERGY400: case SAA7134_BOARD_CINERGY600: case SAA7134_BOARD_CINERGY600_MK3: - ir_codes = &ir_codes_cinergy_table; + ir_codes = &IR_KEYTABLE(cinergy); mask_keycode = 0x00003f; mask_keyup = 0x040000; break; case SAA7134_BOARD_ECS_TVP3XP: case SAA7134_BOARD_ECS_TVP3XP_4CB5: - ir_codes = &ir_codes_eztv_table; + ir_codes = &IR_KEYTABLE(eztv); mask_keycode = 0x00017c; mask_keyup = 0x000002; polling = 50; // ms break; case SAA7134_BOARD_KWORLD_XPERT: case SAA7134_BOARD_AVACSSMARTTV: - ir_codes = &ir_codes_pixelview_table; + ir_codes = &IR_KEYTABLE(pixelview); mask_keycode = 0x00001F; mask_keyup = 0x000020; polling = 50; // ms @@ -647,7 +647,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_AVERMEDIA_GO_007_FM: case SAA7134_BOARD_AVERMEDIA_M102: case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS: - ir_codes = &ir_codes_avermedia_table; + ir_codes = &IR_KEYTABLE(avermedia); mask_keycode = 0x0007C8; mask_keydown = 0x000010; polling = 50; // ms @@ -656,14 +656,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); break; case SAA7134_BOARD_AVERMEDIA_M135A: - ir_codes = &ir_codes_avermedia_m135a_rm_jx_table; + ir_codes = &IR_KEYTABLE(avermedia_m135a_rm_jx); mask_keydown = 0x0040000; mask_keycode = 0xffff; raw_decode = 1; break; case SAA7134_BOARD_AVERMEDIA_777: case SAA7134_BOARD_AVERMEDIA_A16AR: - ir_codes = &ir_codes_avermedia_table; + ir_codes = &IR_KEYTABLE(avermedia); mask_keycode = 0x02F200; mask_keydown = 0x000400; polling = 50; // ms @@ -672,7 +672,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); break; case SAA7134_BOARD_AVERMEDIA_A16D: - ir_codes = &ir_codes_avermedia_a16d_table; + ir_codes = &IR_KEYTABLE(avermedia_a16d); mask_keycode = 0x02F200; mask_keydown = 0x000400; polling = 50; /* ms */ @@ -681,14 +681,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); break; case SAA7134_BOARD_KWORLD_TERMINATOR: - ir_codes = &ir_codes_pixelview_table; + ir_codes = &IR_KEYTABLE(pixelview); mask_keycode = 0x00001f; mask_keyup = 0x000060; polling = 50; // ms break; case SAA7134_BOARD_MANLI_MTV001: case SAA7134_BOARD_MANLI_MTV002: - ir_codes = &ir_codes_manli_table; + ir_codes = &IR_KEYTABLE(manli); mask_keycode = 0x001f00; mask_keyup = 0x004000; polling = 50; /* ms */ @@ -708,25 +708,25 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_BEHOLD_507_9FM: case SAA7134_BOARD_BEHOLD_507RDS_MK3: case SAA7134_BOARD_BEHOLD_507RDS_MK5: - ir_codes = &ir_codes_manli_table; + ir_codes = &IR_KEYTABLE(manli); mask_keycode = 0x003f00; mask_keyup = 0x004000; polling = 50; /* ms */ break; case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: - ir_codes = &ir_codes_behold_columbus_table; + ir_codes = &IR_KEYTABLE(behold_columbus); mask_keycode = 0x003f00; mask_keyup = 0x004000; polling = 50; // ms break; case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: - ir_codes = &ir_codes_pctv_sedna_table; + ir_codes = &IR_KEYTABLE(pctv_sedna); mask_keycode = 0x001f00; mask_keyup = 0x004000; polling = 50; // ms break; case SAA7134_BOARD_GOTVIEW_7135: - ir_codes = &ir_codes_gotview7135_table; + ir_codes = &IR_KEYTABLE(gotview7135); mask_keycode = 0x0003CC; mask_keydown = 0x000010; polling = 5; /* ms */ @@ -735,80 +735,80 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_VIDEOMATE_TV_PVR: case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: - ir_codes = &ir_codes_videomate_tv_pvr_table; + ir_codes = &IR_KEYTABLE(videomate_tv_pvr); mask_keycode = 0x00003F; mask_keyup = 0x400000; polling = 50; // ms break; case SAA7134_BOARD_PROTEUS_2309: - ir_codes = &ir_codes_proteus_2309_table; + ir_codes = &IR_KEYTABLE(proteus_2309); mask_keycode = 0x00007F; mask_keyup = 0x000080; polling = 50; // ms break; case SAA7134_BOARD_VIDEOMATE_DVBT_300: case SAA7134_BOARD_VIDEOMATE_DVBT_200: - ir_codes = &ir_codes_videomate_tv_pvr_table; + ir_codes = &IR_KEYTABLE(videomate_tv_pvr); mask_keycode = 0x003F00; mask_keyup = 0x040000; break; case SAA7134_BOARD_FLYDVBS_LR300: case SAA7134_BOARD_FLYDVBT_LR301: case SAA7134_BOARD_FLYDVBTDUO: - ir_codes = &ir_codes_flydvb_table; + ir_codes = &IR_KEYTABLE(flydvb); mask_keycode = 0x0001F00; mask_keydown = 0x0040000; break; case SAA7134_BOARD_ASUSTeK_P7131_DUAL: case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: case SAA7134_BOARD_ASUSTeK_P7131_ANALOG: - ir_codes = &ir_codes_asus_pc39_table; + ir_codes = &IR_KEYTABLE(asus_pc39); mask_keydown = 0x0040000; rc5_gpio = 1; break; case SAA7134_BOARD_ENCORE_ENLTV: case SAA7134_BOARD_ENCORE_ENLTV_FM: - ir_codes = &ir_codes_encore_enltv_table; + ir_codes = &IR_KEYTABLE(encore_enltv); mask_keycode = 0x00007f; mask_keyup = 0x040000; polling = 50; // ms break; case SAA7134_BOARD_ENCORE_ENLTV_FM53: - ir_codes = &ir_codes_encore_enltv_fm53_table; + ir_codes = &IR_KEYTABLE(encore_enltv_fm53); mask_keydown = 0x0040000; mask_keycode = 0x00007f; nec_gpio = 1; break; case SAA7134_BOARD_10MOONSTVMASTER3: - ir_codes = &ir_codes_encore_enltv_table; + ir_codes = &IR_KEYTABLE(encore_enltv); mask_keycode = 0x5f80000; mask_keyup = 0x8000000; polling = 50; //ms break; case SAA7134_BOARD_GENIUS_TVGO_A11MCE: - ir_codes = &ir_codes_genius_tvgo_a11mce_table; + ir_codes = &IR_KEYTABLE(genius_tvgo_a11mce); mask_keycode = 0xff; mask_keydown = 0xf00000; polling = 50; /* ms */ break; case SAA7134_BOARD_REAL_ANGEL_220: - ir_codes = &ir_codes_real_audio_220_32_keys_table; + ir_codes = &IR_KEYTABLE(real_audio_220_32_keys); mask_keycode = 0x3f00; mask_keyup = 0x4000; polling = 50; /* ms */ break; case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: - ir_codes = &ir_codes_kworld_plus_tv_analog_table; + ir_codes = &IR_KEYTABLE(kworld_plus_tv_analog); mask_keycode = 0x7f; polling = 40; /* ms */ break; case SAA7134_BOARD_VIDEOMATE_S350: - ir_codes = &ir_codes_videomate_s350_table; + ir_codes = &IR_KEYTABLE(videomate_s350); mask_keycode = 0x003f00; mask_keydown = 0x040000; break; case SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S: - ir_codes = &ir_codes_winfast_table; + ir_codes = &IR_KEYTABLE(winfast); mask_keycode = 0x5f00; mask_keyup = 0x020000; polling = 50; /* ms */ @@ -938,24 +938,24 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) dev->init_data.name = "Pinnacle PCTV"; if (pinnacle_remote == 0) { dev->init_data.get_key = get_key_pinnacle_color; - dev->init_data.ir_codes = &ir_codes_pinnacle_color_table; + dev->init_data.ir_codes = &IR_KEYTABLE(pinnacle_color); info.addr = 0x47; } else { dev->init_data.get_key = get_key_pinnacle_grey; - dev->init_data.ir_codes = &ir_codes_pinnacle_grey_table; + dev->init_data.ir_codes = &IR_KEYTABLE(pinnacle_grey); info.addr = 0x47; } break; case SAA7134_BOARD_UPMOST_PURPLE_TV: dev->init_data.name = "Purple TV"; dev->init_data.get_key = get_key_purpletv; - dev->init_data.ir_codes = &ir_codes_purpletv_table; + dev->init_data.ir_codes = &IR_KEYTABLE(purpletv); info.addr = 0x7a; break; case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: dev->init_data.name = "MSI TV@nywhere Plus"; dev->init_data.get_key = get_key_msi_tvanywhere_plus; - dev->init_data.ir_codes = &ir_codes_msi_tvanywhere_plus_table; + dev->init_data.ir_codes = &IR_KEYTABLE(msi_tvanywhere_plus); info.addr = 0x30; /* MSI TV@nywhere Plus controller doesn't seem to respond to probes unless we read something from @@ -969,7 +969,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) case SAA7134_BOARD_HAUPPAUGE_HVR1110: dev->init_data.name = "HVR 1110"; dev->init_data.get_key = get_key_hvr1110; - dev->init_data.ir_codes = &ir_codes_hauppauge_new_table; + dev->init_data.ir_codes = &IR_KEYTABLE(hauppauge_new); info.addr = 0x71; break; case SAA7134_BOARD_BEHOLD_607FM_MK3: @@ -987,7 +987,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) case SAA7134_BOARD_BEHOLD_X7: dev->init_data.name = "BeholdTV"; dev->init_data.get_key = get_key_beholdm6xx; - dev->init_data.ir_codes = &ir_codes_behold_table; + dev->init_data.ir_codes = &IR_KEYTABLE(behold); dev->init_data.type = IR_TYPE_NEC; info.addr = 0x2d; break; @@ -998,7 +998,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) case SAA7134_BOARD_FLYDVB_TRIO: dev->init_data.name = "FlyDVB Trio"; dev->init_data.get_key = get_key_flydvb_trio; - dev->init_data.ir_codes = &ir_codes_flydvb_table; + dev->init_data.ir_codes = &IR_KEYTABLE(flydvb); info.addr = 0x0b; break; default: -- GitLab From e27e971c69f87bd6c00c4cff973497de365229ef Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Apr 2010 21:35:32 -0300 Subject: [PATCH 284/534] V4L/DVB: rename all *_rc_keys to ir_codes_*_nec_table Several DVB drivers use a different name convention. As we're moving the keytables, we need to use the same convention on all places. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/a800.c | 6 +-- drivers/media/dvb/dvb-usb/af9005-remote.c | 16 +++--- drivers/media/dvb/dvb-usb/af9005.c | 8 +-- drivers/media/dvb/dvb-usb/af9005.h | 4 +- drivers/media/dvb/dvb-usb/af9015.c | 30 ++++++------ drivers/media/dvb/dvb-usb/af9015.h | 18 +++---- drivers/media/dvb/dvb-usb/anysee.c | 6 +-- drivers/media/dvb/dvb-usb/az6027.c | 6 +-- drivers/media/dvb/dvb-usb/cinergyT2-core.c | 6 +-- drivers/media/dvb/dvb-usb/cxusb.c | 46 +++++++++--------- drivers/media/dvb/dvb-usb/dib0700_devices.c | 54 ++++++++++----------- drivers/media/dvb/dvb-usb/dibusb-common.c | 4 +- drivers/media/dvb/dvb-usb/dibusb-mb.c | 8 +-- drivers/media/dvb/dvb-usb/dibusb-mc.c | 2 +- drivers/media/dvb/dvb-usb/dibusb.h | 2 +- drivers/media/dvb/dvb-usb/digitv.c | 6 +-- drivers/media/dvb/dvb-usb/dtt200u.c | 18 +++---- drivers/media/dvb/dvb-usb/dw2102.c | 44 ++++++++--------- drivers/media/dvb/dvb-usb/m920x.c | 18 +++---- drivers/media/dvb/dvb-usb/nova-t-usb2.c | 18 +++---- drivers/media/dvb/dvb-usb/opera1.c | 16 +++--- drivers/media/dvb/dvb-usb/vp702x.c | 12 ++--- drivers/media/dvb/dvb-usb/vp7045.c | 12 ++--- 23 files changed, 180 insertions(+), 180 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index 6247239982e9..b6cbb1dfc5f1 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c @@ -37,7 +37,7 @@ static int a800_identify_state(struct usb_device *udev, struct dvb_usb_device_pr return 0; } -static struct dvb_usb_rc_key a800_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_a800_table[] = { { 0x0201, KEY_PROG1 }, /* SOURCE */ { 0x0200, KEY_POWER }, /* POWER */ { 0x0205, KEY_1 }, /* 1 */ @@ -147,8 +147,8 @@ static struct dvb_usb_device_properties a800_properties = { .identify_state = a800_identify_state, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = a800_rc_keys, - .rc_key_map_size = ARRAY_SIZE(a800_rc_keys), + .rc_key_map = ir_codes_a800_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_a800_table), .rc_query = a800_rc_query, .i2c_algo = &dibusb_i2c_algo, diff --git a/drivers/media/dvb/dvb-usb/af9005-remote.c b/drivers/media/dvb/dvb-usb/af9005-remote.c index f4379c650a19..b41fa873b04d 100644 --- a/drivers/media/dvb/dvb-usb/af9005-remote.c +++ b/drivers/media/dvb/dvb-usb/af9005-remote.c @@ -33,7 +33,7 @@ MODULE_PARM_DESC(debug, #define deb_decode(args...) dprintk(dvb_usb_af9005_remote_debug,0x01,args) -struct dvb_usb_rc_key af9005_rc_keys[] = { +struct dvb_usb_rc_key ir_codes_af9005_table[] = { {0x01b7, KEY_POWER}, {0x01a7, KEY_VOLUMEUP}, @@ -74,7 +74,7 @@ struct dvb_usb_rc_key af9005_rc_keys[] = { {0x00d5, KEY_GOTO}, /* marked jump on the remote */ }; -int af9005_rc_keys_size = ARRAY_SIZE(af9005_rc_keys); +int ir_codes_af9005_table_size = ARRAY_SIZE(ir_codes_af9005_table); static int repeatable_keys[] = { KEY_VOLUMEUP, @@ -130,10 +130,10 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, deb_decode("code != inverted code\n"); return 0; } - for (i = 0; i < af9005_rc_keys_size; i++) { - if (rc5_custom(&af9005_rc_keys[i]) == cust - && rc5_data(&af9005_rc_keys[i]) == dat) { - *event = af9005_rc_keys[i].event; + for (i = 0; i < ir_codes_af9005_table_size; i++) { + if (rc5_custom(&ir_codes_af9005_table[i]) == cust + && rc5_data(&ir_codes_af9005_table[i]) == dat) { + *event = ir_codes_af9005_table[i].event; *state = REMOTE_KEY_PRESSED; deb_decode ("key pressed, event %x\n", *event); @@ -146,8 +146,8 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, return 0; } -EXPORT_SYMBOL(af9005_rc_keys); -EXPORT_SYMBOL(af9005_rc_keys_size); +EXPORT_SYMBOL(ir_codes_af9005_table); +EXPORT_SYMBOL(ir_codes_af9005_table_size); EXPORT_SYMBOL(af9005_rc_decode); MODULE_AUTHOR("Luca Olivetti "); diff --git a/drivers/media/dvb/dvb-usb/af9005.c b/drivers/media/dvb/dvb-usb/af9005.c index ca5a0a4d2a47..cfd6107d5349 100644 --- a/drivers/media/dvb/dvb-usb/af9005.c +++ b/drivers/media/dvb/dvb-usb/af9005.c @@ -1109,8 +1109,8 @@ static int __init af9005_usb_module_init(void) return result; } rc_decode = symbol_request(af9005_rc_decode); - rc_keys = symbol_request(af9005_rc_keys); - rc_keys_size = symbol_request(af9005_rc_keys_size); + rc_keys = symbol_request(ir_codes_af9005_table); + rc_keys_size = symbol_request(ir_codes_af9005_table_size); if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) { err("af9005_rc_decode function not found, disabling remote"); af9005_properties.rc_query = NULL; @@ -1128,9 +1128,9 @@ static void __exit af9005_usb_module_exit(void) if (rc_decode != NULL) symbol_put(af9005_rc_decode); if (rc_keys != NULL) - symbol_put(af9005_rc_keys); + symbol_put(ir_codes_af9005_table); if (rc_keys_size != NULL) - symbol_put(af9005_rc_keys_size); + symbol_put(ir_codes_af9005_table_size); /* deregister this driver from the USB subsystem */ usb_deregister(&af9005_usb_driver); } diff --git a/drivers/media/dvb/dvb-usb/af9005.h b/drivers/media/dvb/dvb-usb/af9005.h index 0bc48a012187..088e7083a39b 100644 --- a/drivers/media/dvb/dvb-usb/af9005.h +++ b/drivers/media/dvb/dvb-usb/af9005.h @@ -3490,7 +3490,7 @@ extern u8 regmask[8]; /* remote control decoder */ extern int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, int *state); -extern struct dvb_usb_rc_key af9005_rc_keys[]; -extern int af9005_rc_keys_size; +extern struct dvb_usb_rc_key ir_codes_af9005_table[]; +extern int ir_codes_af9005_table_size; #endif diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index d5ba1de8f074..66c7c3ea7990 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -752,19 +752,19 @@ static const struct af9015_setup *af9015_setup_match(unsigned int id, static const struct af9015_setup af9015_setup_modparam[] = { { AF9015_REMOTE_A_LINK_DTU_M, - af9015_rc_keys_a_link, ARRAY_SIZE(af9015_rc_keys_a_link), + ir_codes_af9015_table_a_link, ARRAY_SIZE(ir_codes_af9015_table_a_link), af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) }, { AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3, - af9015_rc_keys_msi, ARRAY_SIZE(af9015_rc_keys_msi), + ir_codes_af9015_table_msi, ARRAY_SIZE(ir_codes_af9015_table_msi), af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) }, { AF9015_REMOTE_MYGICTV_U718, - af9015_rc_keys_mygictv, ARRAY_SIZE(af9015_rc_keys_mygictv), + ir_codes_af9015_table_mygictv, ARRAY_SIZE(ir_codes_af9015_table_mygictv), af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) }, { AF9015_REMOTE_DIGITTRADE_DVB_T, - af9015_rc_keys_digittrade, ARRAY_SIZE(af9015_rc_keys_digittrade), + ir_codes_af9015_table_digittrade, ARRAY_SIZE(ir_codes_af9015_table_digittrade), af9015_ir_table_digittrade, ARRAY_SIZE(af9015_ir_table_digittrade) }, { AF9015_REMOTE_AVERMEDIA_KS, - af9015_rc_keys_avermedia, ARRAY_SIZE(af9015_rc_keys_avermedia), + ir_codes_af9015_table_avermedia, ARRAY_SIZE(ir_codes_af9015_table_avermedia), af9015_ir_table_avermedia_ks, ARRAY_SIZE(af9015_ir_table_avermedia_ks) }, { } }; @@ -772,32 +772,32 @@ static const struct af9015_setup af9015_setup_modparam[] = { /* don't add new entries here anymore, use hashes instead */ static const struct af9015_setup af9015_setup_usbids[] = { { USB_VID_LEADTEK, - af9015_rc_keys_leadtek, ARRAY_SIZE(af9015_rc_keys_leadtek), + ir_codes_af9015_table_leadtek, ARRAY_SIZE(ir_codes_af9015_table_leadtek), af9015_ir_table_leadtek, ARRAY_SIZE(af9015_ir_table_leadtek) }, { USB_VID_VISIONPLUS, - af9015_rc_keys_twinhan, ARRAY_SIZE(af9015_rc_keys_twinhan), + ir_codes_af9015_table_twinhan, ARRAY_SIZE(ir_codes_af9015_table_twinhan), af9015_ir_table_twinhan, ARRAY_SIZE(af9015_ir_table_twinhan) }, { USB_VID_KWORLD_2, /* TODO: use correct rc keys */ - af9015_rc_keys_twinhan, ARRAY_SIZE(af9015_rc_keys_twinhan), + ir_codes_af9015_table_twinhan, ARRAY_SIZE(ir_codes_af9015_table_twinhan), af9015_ir_table_kworld, ARRAY_SIZE(af9015_ir_table_kworld) }, { USB_VID_AVERMEDIA, - af9015_rc_keys_avermedia, ARRAY_SIZE(af9015_rc_keys_avermedia), + ir_codes_af9015_table_avermedia, ARRAY_SIZE(ir_codes_af9015_table_avermedia), af9015_ir_table_avermedia, ARRAY_SIZE(af9015_ir_table_avermedia) }, { USB_VID_MSI_2, - af9015_rc_keys_msi_digivox_iii, ARRAY_SIZE(af9015_rc_keys_msi_digivox_iii), + ir_codes_af9015_table_msi_digivox_iii, ARRAY_SIZE(ir_codes_af9015_table_msi_digivox_iii), af9015_ir_table_msi_digivox_iii, ARRAY_SIZE(af9015_ir_table_msi_digivox_iii) }, { } }; static const struct af9015_setup af9015_setup_hashes[] = { { 0xb8feb708, - af9015_rc_keys_msi, ARRAY_SIZE(af9015_rc_keys_msi), + ir_codes_af9015_table_msi, ARRAY_SIZE(ir_codes_af9015_table_msi), af9015_ir_table_msi, ARRAY_SIZE(af9015_ir_table_msi) }, { 0xa3703d00, - af9015_rc_keys_a_link, ARRAY_SIZE(af9015_rc_keys_a_link), + ir_codes_af9015_table_a_link, ARRAY_SIZE(ir_codes_af9015_table_a_link), af9015_ir_table_a_link, ARRAY_SIZE(af9015_ir_table_a_link) }, { 0x9b7dc64e, - af9015_rc_keys_mygictv, ARRAY_SIZE(af9015_rc_keys_mygictv), + ir_codes_af9015_table_mygictv, ARRAY_SIZE(ir_codes_af9015_table_mygictv), af9015_ir_table_mygictv, ARRAY_SIZE(af9015_ir_table_mygictv) }, { } }; @@ -836,8 +836,8 @@ static void af9015_set_remote_config(struct usb_device *udev, } else if (udev->descriptor.idProduct == cpu_to_le16(USB_PID_TREKSTOR_DVBT)) { table = &(const struct af9015_setup){ 0, - af9015_rc_keys_trekstor, - ARRAY_SIZE(af9015_rc_keys_trekstor), + ir_codes_af9015_table_trekstor, + ARRAY_SIZE(ir_codes_af9015_table_trekstor), af9015_ir_table_trekstor, ARRAY_SIZE(af9015_ir_table_trekstor) }; diff --git a/drivers/media/dvb/dvb-usb/af9015.h b/drivers/media/dvb/dvb-usb/af9015.h index ef36b1831490..63b2a4907b7e 100644 --- a/drivers/media/dvb/dvb-usb/af9015.h +++ b/drivers/media/dvb/dvb-usb/af9015.h @@ -123,7 +123,7 @@ enum af9015_remote { /* LeadTek - Y04G0051 */ /* Leadtek WinFast DTV Dongle Gold */ -static struct dvb_usb_rc_key af9015_rc_keys_leadtek[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_leadtek[] = { { 0x001e, KEY_1 }, { 0x001f, KEY_2 }, { 0x0020, KEY_3 }, @@ -227,7 +227,7 @@ static u8 af9015_ir_table_leadtek[] = { }; /* TwinHan AzureWave AD-TU700(704J) */ -static struct dvb_usb_rc_key af9015_rc_keys_twinhan[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_twinhan[] = { { 0x053f, KEY_POWER }, { 0x0019, KEY_FAVORITES }, /* Favorite List */ { 0x0004, KEY_TEXT }, /* Teletext */ @@ -338,7 +338,7 @@ static u8 af9015_ir_table_twinhan[] = { }; /* A-Link DTU(m) */ -static struct dvb_usb_rc_key af9015_rc_keys_a_link[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_a_link[] = { { 0x001e, KEY_1 }, { 0x001f, KEY_2 }, { 0x0020, KEY_3 }, @@ -381,7 +381,7 @@ static u8 af9015_ir_table_a_link[] = { }; /* MSI DIGIVOX mini II V3.0 */ -static struct dvb_usb_rc_key af9015_rc_keys_msi[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_msi[] = { { 0x001e, KEY_1 }, { 0x001f, KEY_2 }, { 0x0020, KEY_3 }, @@ -424,7 +424,7 @@ static u8 af9015_ir_table_msi[] = { }; /* MYGICTV U718 */ -static struct dvb_usb_rc_key af9015_rc_keys_mygictv[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_mygictv[] = { { 0x003d, KEY_SWITCHVIDEOMODE }, /* TV / AV */ { 0x0545, KEY_POWER }, @@ -550,7 +550,7 @@ static u8 af9015_ir_table_kworld[] = { }; /* AverMedia Volar X */ -static struct dvb_usb_rc_key af9015_rc_keys_avermedia[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_avermedia[] = { { 0x053d, KEY_PROG1 }, /* SOURCE */ { 0x0512, KEY_POWER }, /* POWER */ { 0x051e, KEY_1 }, /* 1 */ @@ -656,7 +656,7 @@ static u8 af9015_ir_table_avermedia_ks[] = { }; /* Digittrade DVB-T USB Stick */ -static struct dvb_usb_rc_key af9015_rc_keys_digittrade[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_digittrade[] = { { 0x010f, KEY_LAST }, /* RETURN */ { 0x0517, KEY_TEXT }, /* TELETEXT */ { 0x0108, KEY_EPG }, /* EPG */ @@ -719,7 +719,7 @@ static u8 af9015_ir_table_digittrade[] = { }; /* TREKSTOR DVB-T USB Stick */ -static struct dvb_usb_rc_key af9015_rc_keys_trekstor[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_trekstor[] = { { 0x0704, KEY_AGAIN }, /* Home */ { 0x0705, KEY_MUTE }, /* Mute */ { 0x0706, KEY_UP }, /* Up */ @@ -782,7 +782,7 @@ static u8 af9015_ir_table_trekstor[] = { }; /* MSI DIGIVOX mini III */ -static struct dvb_usb_rc_key af9015_rc_keys_msi_digivox_iii[] = { +static struct dvb_usb_rc_key ir_codes_af9015_table_msi_digivox_iii[] = { { 0x0713, KEY_POWER }, /* [red power button] */ { 0x073b, KEY_VIDEO }, /* Source */ { 0x073e, KEY_ZOOM }, /* Zoom */ diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index bb69f3719f9a..faca1ad88a67 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -399,7 +399,7 @@ static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } -static struct dvb_usb_rc_key anysee_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_anysee_table[] = { { 0x0100, KEY_0 }, { 0x0101, KEY_1 }, { 0x0102, KEY_2 }, @@ -518,8 +518,8 @@ static struct dvb_usb_device_properties anysee_properties = { } }, - .rc_key_map = anysee_rc_keys, - .rc_key_map_size = ARRAY_SIZE(anysee_rc_keys), + .rc_key_map = ir_codes_anysee_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_anysee_table), .rc_query = anysee_rc_query, .rc_interval = 200, /* windows driver uses 500ms */ diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 30ea3eff1ef7..8934788bd83b 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c @@ -386,7 +386,7 @@ static int az6027_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) } /* keys for the enclosed remote control */ -static struct dvb_usb_rc_key az6027_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_az6027_table[] = { { 0x01, KEY_1 }, { 0x02, KEY_2 }, }; @@ -1096,8 +1096,8 @@ static struct dvb_usb_device_properties az6027_properties = { .power_ctrl = az6027_power_ctrl, .read_mac_address = az6027_read_mac_addr, */ - .rc_key_map = az6027_rc_keys, - .rc_key_map_size = ARRAY_SIZE(az6027_rc_keys), + .rc_key_map = ir_codes_az6027_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_az6027_table), .rc_interval = 400, .rc_query = az6027_rc_query, .i2c_algo = &az6027_i2c_algo, diff --git a/drivers/media/dvb/dvb-usb/cinergyT2-core.c b/drivers/media/dvb/dvb-usb/cinergyT2-core.c index e37ac4d48602..5a9c14bdc980 100644 --- a/drivers/media/dvb/dvb-usb/cinergyT2-core.c +++ b/drivers/media/dvb/dvb-usb/cinergyT2-core.c @@ -84,7 +84,7 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) return 0; } -static struct dvb_usb_rc_key cinergyt2_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_cinergyt2_table[] = { { 0x0401, KEY_POWER }, { 0x0402, KEY_1 }, { 0x0403, KEY_2 }, @@ -218,8 +218,8 @@ static struct dvb_usb_device_properties cinergyt2_properties = { .power_ctrl = cinergyt2_power_ctrl, .rc_interval = 50, - .rc_key_map = cinergyt2_rc_keys, - .rc_key_map_size = ARRAY_SIZE(cinergyt2_rc_keys), + .rc_key_map = ir_codes_cinergyt2_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_cinergyt2_table), .rc_query = cinergyt2_rc_query, .generic_bulk_ctrl_endpoint = 1, diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 960376da7d59..33a83f93e7c9 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c @@ -461,7 +461,7 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, return 0; } -static struct dvb_usb_rc_key dvico_mce_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dvico_mce_table[] = { { 0xfe02, KEY_TV }, { 0xfe0e, KEY_MP3 }, { 0xfe1a, KEY_DVD }, @@ -509,7 +509,7 @@ static struct dvb_usb_rc_key dvico_mce_rc_keys[] = { { 0xfe4e, KEY_POWER }, }; -static struct dvb_usb_rc_key dvico_portable_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dvico_portable_table[] = { { 0xfc02, KEY_SETUP }, /* Profile */ { 0xfc43, KEY_POWER2 }, { 0xfc06, KEY_EPG }, @@ -548,7 +548,7 @@ static struct dvb_usb_rc_key dvico_portable_rc_keys[] = { { 0xfc00, KEY_UNKNOWN }, /* HD */ }; -static struct dvb_usb_rc_key d680_dmb_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_d680_dmb_table[] = { { 0x0038, KEY_UNKNOWN }, /* TV/AV */ { 0x080c, KEY_ZOOM }, { 0x0800, KEY_0 }, @@ -1449,8 +1449,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { .i2c_algo = &cxusb_i2c_algo, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -1500,8 +1500,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { .i2c_algo = &cxusb_i2c_algo, .rc_interval = 150, - .rc_key_map = dvico_mce_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), + .rc_key_map = ir_codes_dvico_mce_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), .rc_query = cxusb_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -1559,8 +1559,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { .i2c_algo = &cxusb_i2c_algo, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -1609,8 +1609,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { .i2c_algo = &cxusb_i2c_algo, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -1658,8 +1658,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = dvico_mce_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), + .rc_key_map = ir_codes_dvico_mce_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), .rc_query = cxusb_bluebird2_rc_query, .num_device_descs = 1, @@ -1706,8 +1706,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_bluebird2_rc_query, .num_device_descs = 1, @@ -1756,8 +1756,8 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = dvico_portable_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys), + .rc_key_map = ir_codes_dvico_portable_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), .rc_query = cxusb_rc_query, .num_device_descs = 1, @@ -1847,8 +1847,8 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = dvico_mce_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys), + .rc_key_map = ir_codes_dvico_mce_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), .rc_query = cxusb_rc_query, .num_device_descs = 1, @@ -1895,8 +1895,8 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = d680_dmb_rc_keys, - .rc_key_map_size = ARRAY_SIZE(d680_dmb_rc_keys), + .rc_key_map = ir_codes_d680_dmb_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), .rc_query = cxusb_d680_dmb_rc_query, .num_device_descs = 1, @@ -1944,8 +1944,8 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { .generic_bulk_ctrl_endpoint = 0x01, .rc_interval = 100, - .rc_key_map = d680_dmb_rc_keys, - .rc_key_map_size = ARRAY_SIZE(d680_dmb_rc_keys), + .rc_key_map = ir_codes_d680_dmb_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), .rc_query = cxusb_d680_dmb_rc_query, .num_device_descs = 1, diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 34eab05afc6c..2deca210d5a0 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -562,7 +562,7 @@ static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } -static struct dvb_usb_rc_key dib0700_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dib0700_table[] = { /* Key codes for the tiny Pinnacle remote*/ { 0x0700, KEY_MUTE }, { 0x0701, KEY_MENU }, /* Pinnacle logo */ @@ -2131,8 +2131,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2160,8 +2160,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2214,8 +2214,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2251,8 +2251,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2321,8 +2321,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2360,8 +2360,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2422,8 +2422,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { } }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2484,8 +2484,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2513,8 +2513,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2574,8 +2574,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2612,8 +2612,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, @@ -2656,8 +2656,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, @@ -2687,8 +2687,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { }, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dib0700_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_key_map = ir_codes_dib0700_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), .rc_query = dib0700_rc_query }, }; diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index 9143b5631e88..bc08bc0b723c 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c @@ -327,7 +327,7 @@ EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); /* * common remote control stuff */ -struct dvb_usb_rc_key dibusb_rc_keys[] = { +struct dvb_usb_rc_key ir_codes_dibusb_table[] = { /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ { 0x0016, KEY_POWER }, { 0x0010, KEY_MUTE }, @@ -456,7 +456,7 @@ struct dvb_usb_rc_key dibusb_rc_keys[] = { { 0x804e, KEY_ENTER }, { 0x804f, KEY_VOLUMEDOWN }, }; -EXPORT_SYMBOL(dibusb_rc_keys); +EXPORT_SYMBOL(ir_codes_dibusb_table); int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index 5c0126dc1ff9..eb2e6f050fbe 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c @@ -212,7 +212,7 @@ static struct dvb_usb_device_properties dibusb1_1_properties = { .power_ctrl = dibusb_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, @@ -296,7 +296,7 @@ static struct dvb_usb_device_properties dibusb1_1_an2235_properties = { .power_ctrl = dibusb_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, @@ -360,7 +360,7 @@ static struct dvb_usb_device_properties dibusb2_0b_properties = { .power_ctrl = dibusb2_0_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, @@ -417,7 +417,7 @@ static struct dvb_usb_device_properties artec_t1_usb2_properties = { .power_ctrl = dibusb2_0_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ .rc_query = dibusb_rc_query, diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index a05b9f875663..588308eb6638 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c @@ -82,7 +82,7 @@ static struct dvb_usb_device_properties dibusb_mc_properties = { .power_ctrl = dibusb2_0_power_ctrl, .rc_interval = DEFAULT_RC_INTERVAL, - .rc_key_map = dibusb_rc_keys, + .rc_key_map = ir_codes_dibusb_table, .rc_key_map_size = 111, /* FIXME */ .rc_query = dibusb_rc_query, diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h index 8e847aa73ba1..3d50ac59088f 100644 --- a/drivers/media/dvb/dvb-usb/dibusb.h +++ b/drivers/media/dvb/dvb-usb/dibusb.h @@ -124,7 +124,7 @@ extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int); #define DEFAULT_RC_INTERVAL 150 //#define DEFAULT_RC_INTERVAL 100000 -extern struct dvb_usb_rc_key dibusb_rc_keys[]; +extern struct dvb_usb_rc_key ir_codes_dibusb_table[]; extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index 955147d00756..e826077094fa 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c @@ -161,7 +161,7 @@ static int digitv_tuner_attach(struct dvb_usb_adapter *adap) return 0; } -static struct dvb_usb_rc_key digitv_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_digitv_table[] = { { 0x5f55, KEY_0 }, { 0x6f55, KEY_1 }, { 0x9f55, KEY_2 }, @@ -311,8 +311,8 @@ static struct dvb_usb_device_properties digitv_properties = { .identify_state = digitv_identify_state, .rc_interval = 1000, - .rc_key_map = digitv_rc_keys, - .rc_key_map_size = ARRAY_SIZE(digitv_rc_keys), + .rc_key_map = ir_codes_digitv_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_digitv_table), .rc_query = digitv_rc_query, .i2c_algo = &digitv_i2c_algo, diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index a1b12b01cbe4..f57e59044d4d 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c @@ -57,7 +57,7 @@ static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, /* remote control */ /* key list for the tiny remote control (Yakumo, don't know about the others) */ -static struct dvb_usb_rc_key dtt200u_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dtt200u_table[] = { { 0x8001, KEY_MUTE }, { 0x8002, KEY_CHANNELDOWN }, { 0x8003, KEY_VOLUMEDOWN }, @@ -162,8 +162,8 @@ static struct dvb_usb_device_properties dtt200u_properties = { .power_ctrl = dtt200u_power_ctrl, .rc_interval = 300, - .rc_key_map = dtt200u_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_key_map = ir_codes_dtt200u_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), .rc_query = dtt200u_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -207,8 +207,8 @@ static struct dvb_usb_device_properties wt220u_properties = { .power_ctrl = dtt200u_power_ctrl, .rc_interval = 300, - .rc_key_map = dtt200u_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_key_map = ir_codes_dtt200u_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), .rc_query = dtt200u_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -252,8 +252,8 @@ static struct dvb_usb_device_properties wt220u_fc_properties = { .power_ctrl = dtt200u_power_ctrl, .rc_interval = 300, - .rc_key_map = dtt200u_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_key_map = ir_codes_dtt200u_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), .rc_query = dtt200u_rc_query, .generic_bulk_ctrl_endpoint = 0x01, @@ -297,8 +297,8 @@ static struct dvb_usb_device_properties wt220u_zl0353_properties = { .power_ctrl = dtt200u_power_ctrl, .rc_interval = 300, - .rc_key_map = dtt200u_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys), + .rc_key_map = ir_codes_dtt200u_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), .rc_query = dtt200u_rc_query, .generic_bulk_ctrl_endpoint = 0x01, diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c index accc65509b07..e8fb85380672 100644 --- a/drivers/media/dvb/dvb-usb/dw2102.c +++ b/drivers/media/dvb/dvb-usb/dw2102.c @@ -73,7 +73,7 @@ "Please see linux/Documentation/dvb/ for more details " \ "on firmware-problems." -struct dvb_usb_rc_keys_table { +struct ir_codes_dvb_usb_table_table { struct dvb_usb_rc_key *rc_keys; int rc_keys_size; }; @@ -948,7 +948,7 @@ static int dw3101_tuner_attach(struct dvb_usb_adapter *adap) return 0; } -static struct dvb_usb_rc_key dw210x_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_dw210x_table[] = { { 0xf80a, KEY_Q }, /*power*/ { 0xf80c, KEY_M }, /*mute*/ { 0xf811, KEY_1 }, @@ -982,7 +982,7 @@ static struct dvb_usb_rc_key dw210x_rc_keys[] = { { 0xf81b, KEY_B }, /*recall*/ }; -static struct dvb_usb_rc_key tevii_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_tevii_table[] = { { 0xf80a, KEY_POWER }, { 0xf80c, KEY_MUTE }, { 0xf811, KEY_1 }, @@ -1032,7 +1032,7 @@ static struct dvb_usb_rc_key tevii_rc_keys[] = { { 0xf858, KEY_SWITCHVIDEOMODE }, }; -static struct dvb_usb_rc_key tbs_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_tbs_table[] = { { 0xf884, KEY_POWER }, { 0xf894, KEY_MUTE }, { 0xf887, KEY_1 }, @@ -1067,10 +1067,10 @@ static struct dvb_usb_rc_key tbs_rc_keys[] = { { 0xf89b, KEY_MODE } }; -static struct dvb_usb_rc_keys_table keys_tables[] = { - { dw210x_rc_keys, ARRAY_SIZE(dw210x_rc_keys) }, - { tevii_rc_keys, ARRAY_SIZE(tevii_rc_keys) }, - { tbs_rc_keys, ARRAY_SIZE(tbs_rc_keys) }, +static struct ir_codes_dvb_usb_table_table keys_tables[] = { + { ir_codes_dw210x_table, ARRAY_SIZE(ir_codes_dw210x_table) }, + { ir_codes_tevii_table, ARRAY_SIZE(ir_codes_tevii_table) }, + { ir_codes_tbs_table, ARRAY_SIZE(ir_codes_tbs_table) }, }; static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) @@ -1185,14 +1185,14 @@ static int dw2102_load_firmware(struct usb_device *dev, /* init registers */ switch (dev->descriptor.idProduct) { case USB_PID_PROF_1100: - s6x0_properties.rc_key_map = tbs_rc_keys; + s6x0_properties.rc_key_map = ir_codes_tbs_table; s6x0_properties.rc_key_map_size = - ARRAY_SIZE(tbs_rc_keys); + ARRAY_SIZE(ir_codes_tbs_table); break; case USB_PID_TEVII_S650: - dw2104_properties.rc_key_map = tevii_rc_keys; + dw2104_properties.rc_key_map = ir_codes_tevii_table; dw2104_properties.rc_key_map_size = - ARRAY_SIZE(tevii_rc_keys); + ARRAY_SIZE(ir_codes_tevii_table); case USB_PID_DW2104: reset = 1; dw210x_op_rw(dev, 0xc4, 0x0000, 0, &reset, 1, @@ -1255,8 +1255,8 @@ static struct dvb_usb_device_properties dw2102_properties = { .no_reconnect = 1, .i2c_algo = &dw2102_serit_i2c_algo, - .rc_key_map = dw210x_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dw210x_rc_keys), + .rc_key_map = ir_codes_dw210x_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), .rc_interval = 150, .rc_query = dw2102_rc_query, @@ -1306,8 +1306,8 @@ static struct dvb_usb_device_properties dw2104_properties = { .no_reconnect = 1, .i2c_algo = &dw2104_i2c_algo, - .rc_key_map = dw210x_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dw210x_rc_keys), + .rc_key_map = ir_codes_dw210x_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), .rc_interval = 150, .rc_query = dw2102_rc_query, @@ -1353,8 +1353,8 @@ static struct dvb_usb_device_properties dw3101_properties = { .no_reconnect = 1, .i2c_algo = &dw3101_i2c_algo, - .rc_key_map = dw210x_rc_keys, - .rc_key_map_size = ARRAY_SIZE(dw210x_rc_keys), + .rc_key_map = ir_codes_dw210x_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), .rc_interval = 150, .rc_query = dw2102_rc_query, @@ -1396,8 +1396,8 @@ static struct dvb_usb_device_properties s6x0_properties = { .no_reconnect = 1, .i2c_algo = &s6x0_i2c_algo, - .rc_key_map = tevii_rc_keys, - .rc_key_map_size = ARRAY_SIZE(tevii_rc_keys), + .rc_key_map = ir_codes_tevii_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_tevii_table), .rc_interval = 150, .rc_query = dw2102_rc_query, @@ -1459,8 +1459,8 @@ static int dw2102_probe(struct usb_interface *intf, /* fill only different fields */ p7500->firmware = "dvb-usb-p7500.fw"; p7500->devices[0] = d7500; - p7500->rc_key_map = tbs_rc_keys; - p7500->rc_key_map_size = ARRAY_SIZE(tbs_rc_keys); + p7500->rc_key_map = ir_codes_tbs_table; + p7500->rc_key_map_size = ARRAY_SIZE(ir_codes_tbs_table); p7500->adapter->frontend_attach = prof_7500_frontend_attach; if (0 == dvb_usb_device_init(intf, &dw2102_properties, diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index 737ffa36ac9c..c211fef45fc3 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c @@ -589,7 +589,7 @@ static struct m920x_inits pinnacle310e_init[] = { }; /* ir keymaps */ -static struct dvb_usb_rc_key megasky_rc_keys [] = { +static struct dvb_usb_rc_key ir_codes_megasky_table [] = { { 0x0012, KEY_POWER }, { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */ { 0x0002, KEY_CHANNELUP }, @@ -608,7 +608,7 @@ static struct dvb_usb_rc_key megasky_rc_keys [] = { { 0x000e, KEY_COFFEE }, /* "MTS" */ }; -static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = { +static struct dvb_usb_rc_key ir_codes_tvwalkertwin_table [] = { { 0x0001, KEY_ZOOM }, /* Full Screen */ { 0x0002, KEY_CAMERA }, /* snapshot */ { 0x0003, KEY_MUTE }, @@ -628,7 +628,7 @@ static struct dvb_usb_rc_key tvwalkertwin_rc_keys [] = { { 0x001e, KEY_VOLUMEUP }, }; -static struct dvb_usb_rc_key pinnacle310e_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_pinnacle310e_table[] = { { 0x16, KEY_POWER }, { 0x17, KEY_FAVORITES }, { 0x0f, KEY_TEXT }, @@ -785,8 +785,8 @@ static struct dvb_usb_device_properties megasky_properties = { .download_firmware = m920x_firmware_download, .rc_interval = 100, - .rc_key_map = megasky_rc_keys, - .rc_key_map_size = ARRAY_SIZE(megasky_rc_keys), + .rc_key_map = ir_codes_megasky_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_megasky_table), .rc_query = m920x_rc_query, .size_of_priv = sizeof(struct m920x_state), @@ -886,8 +886,8 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = { .download_firmware = m920x_firmware_download, .rc_interval = 100, - .rc_key_map = tvwalkertwin_rc_keys, - .rc_key_map_size = ARRAY_SIZE(tvwalkertwin_rc_keys), + .rc_key_map = ir_codes_tvwalkertwin_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_tvwalkertwin_table), .rc_query = m920x_rc_query, .size_of_priv = sizeof(struct m920x_state), @@ -993,8 +993,8 @@ static struct dvb_usb_device_properties pinnacle_pctv310e_properties = { .download_firmware = NULL, .rc_interval = 100, - .rc_key_map = pinnacle310e_rc_keys, - .rc_key_map_size = ARRAY_SIZE(pinnacle310e_rc_keys), + .rc_key_map = ir_codes_pinnacle310e_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_pinnacle310e_table), .rc_query = m920x_rc_query, .size_of_priv = sizeof(struct m920x_state), diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c index b41d66ef8325..d195a587cc65 100644 --- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c @@ -21,7 +21,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); #define deb_ee(args...) dprintk(debug,0x02,args) /* Hauppauge NOVA-T USB2 keys */ -static struct dvb_usb_rc_key haupp_rc_keys [] = { +static struct dvb_usb_rc_key ir_codes_haupp_table [] = { { 0x1e00, KEY_0 }, { 0x1e01, KEY_1 }, { 0x1e02, KEY_2 }, @@ -91,14 +91,14 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to c: %02x d: %02x toggle: %d\n",key[1],key[2],key[3],custom,data,toggle); - for (i = 0; i < ARRAY_SIZE(haupp_rc_keys); i++) { - if (rc5_data(&haupp_rc_keys[i]) == data && - rc5_custom(&haupp_rc_keys[i]) == custom) { + for (i = 0; i < ARRAY_SIZE(ir_codes_haupp_table); i++) { + if (rc5_data(&ir_codes_haupp_table[i]) == data && + rc5_custom(&ir_codes_haupp_table[i]) == custom) { - deb_rc("c: %x, d: %x\n", rc5_data(&haupp_rc_keys[i]), - rc5_custom(&haupp_rc_keys[i])); + deb_rc("c: %x, d: %x\n", rc5_data(&ir_codes_haupp_table[i]), + rc5_custom(&ir_codes_haupp_table[i])); - *event = haupp_rc_keys[i].event; + *event = ir_codes_haupp_table[i].event; *state = REMOTE_KEY_PRESSED; if (st->old_toggle == toggle) { if (st->last_repeat_count++ < 2) @@ -196,8 +196,8 @@ static struct dvb_usb_device_properties nova_t_properties = { .read_mac_address = nova_t_read_mac_address, .rc_interval = 100, - .rc_key_map = haupp_rc_keys, - .rc_key_map_size = ARRAY_SIZE(haupp_rc_keys), + .rc_key_map = ir_codes_haupp_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_haupp_table), .rc_query = nova_t_rc_query, .i2c_algo = &dibusb_i2c_algo, diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index 830557696ae6..dfb81ff1d9a7 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c @@ -35,7 +35,7 @@ struct opera1_state { u32 last_key_pressed; }; -struct opera_rc_keys { +struct ir_codes_opera_table { u32 keycode; u32 event; }; @@ -331,7 +331,7 @@ static int opera1_pid_filter_control(struct dvb_usb_adapter *adap, int onoff) return 0; } -static struct dvb_usb_rc_key opera1_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_opera1_table[] = { {0x5fa0, KEY_1}, {0x51af, KEY_2}, {0x5da2, KEY_3}, @@ -404,12 +404,12 @@ static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state) send_key = (send_key & 0xffff) | 0x0100; - for (i = 0; i < ARRAY_SIZE(opera1_rc_keys); i++) { - if (rc5_scan(&opera1_rc_keys[i]) == (send_key & 0xffff)) { + for (i = 0; i < ARRAY_SIZE(ir_codes_opera1_table); i++) { + if (rc5_scan(&ir_codes_opera1_table[i]) == (send_key & 0xffff)) { *state = REMOTE_KEY_PRESSED; - *event = opera1_rc_keys[i].event; + *event = ir_codes_opera1_table[i].event; opst->last_key_pressed = - opera1_rc_keys[i].event; + ir_codes_opera1_table[i].event; break; } opst->last_key_pressed = 0; @@ -498,8 +498,8 @@ static struct dvb_usb_device_properties opera1_properties = { .power_ctrl = opera1_power_ctrl, .i2c_algo = &opera1_i2c_algo, - .rc_key_map = opera1_rc_keys, - .rc_key_map_size = ARRAY_SIZE(opera1_rc_keys), + .rc_key_map = ir_codes_opera1_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_opera1_table), .rc_interval = 200, .rc_query = opera1_rc_query, .read_mac_address = opera1_read_mac_address, diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c index ef4e37d9c5ff..4d332451653b 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.c +++ b/drivers/media/dvb/dvb-usb/vp702x.c @@ -174,7 +174,7 @@ static int vp702x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) } /* keys for the enclosed remote control */ -static struct dvb_usb_rc_key vp702x_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_vp702x_table[] = { { 0x0001, KEY_1 }, { 0x0002, KEY_2 }, }; @@ -197,10 +197,10 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } - for (i = 0; i < ARRAY_SIZE(vp702x_rc_keys); i++) - if (rc5_custom(&vp702x_rc_keys[i]) == key[1]) { + for (i = 0; i < ARRAY_SIZE(ir_codes_vp702x_table); i++) + if (rc5_custom(&ir_codes_vp702x_table[i]) == key[1]) { *state = REMOTE_KEY_PRESSED; - *event = vp702x_rc_keys[i].event; + *event = ir_codes_vp702x_table[i].event; break; } return 0; @@ -283,8 +283,8 @@ static struct dvb_usb_device_properties vp702x_properties = { }, .read_mac_address = vp702x_read_mac_addr, - .rc_key_map = vp702x_rc_keys, - .rc_key_map_size = ARRAY_SIZE(vp702x_rc_keys), + .rc_key_map = ir_codes_vp702x_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_vp702x_table), .rc_interval = 400, .rc_query = vp702x_rc_query, diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index a59faa27912a..036893fa4480 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c @@ -99,7 +99,7 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) /* The keymapping struct. Somehow this should be loaded to the driver, but * currently it is hardcoded. */ -static struct dvb_usb_rc_key vp7045_rc_keys[] = { +static struct dvb_usb_rc_key ir_codes_vp7045_table[] = { { 0x0016, KEY_POWER }, { 0x0010, KEY_MUTE }, { 0x0003, KEY_1 }, @@ -165,10 +165,10 @@ static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return 0; } - for (i = 0; i < ARRAY_SIZE(vp7045_rc_keys); i++) - if (rc5_data(&vp7045_rc_keys[i]) == key) { + for (i = 0; i < ARRAY_SIZE(ir_codes_vp7045_table); i++) + if (rc5_data(&ir_codes_vp7045_table[i]) == key) { *state = REMOTE_KEY_PRESSED; - *event = vp7045_rc_keys[i].event; + *event = ir_codes_vp7045_table[i].event; break; } return 0; @@ -260,8 +260,8 @@ static struct dvb_usb_device_properties vp7045_properties = { .read_mac_address = vp7045_read_mac_addr, .rc_interval = 400, - .rc_key_map = vp7045_rc_keys, - .rc_key_map_size = ARRAY_SIZE(vp7045_rc_keys), + .rc_key_map = ir_codes_vp7045_table, + .rc_key_map_size = ARRAY_SIZE(ir_codes_vp7045_table), .rc_query = vp7045_rc_query, .num_device_descs = 2, -- GitLab From dce4a3e3b228fd31bcfd2d84e673bc08b553e6cc Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Apr 2010 22:23:38 -0300 Subject: [PATCH 285/534] V4L/DVB: ir-common: Use macros to define the keytables The usage of macros ensures that the proper namespace is being used by all tables. It also makes easier to associate a keytable with the name used inside the drivers. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keymaps.c | 265 ++++++++++++++++------------------ include/media/ir-common.h | 14 +- 2 files changed, 141 insertions(+), 138 deletions(-) diff --git a/drivers/media/IR/ir-keymaps.c b/drivers/media/IR/ir-keymaps.c index 55e7acd7209c..1ba928516cd2 100644 --- a/drivers/media/IR/ir-keymaps.c +++ b/drivers/media/IR/ir-keymaps.c @@ -35,24 +35,15 @@ * to define the proper IR_TYPE (IR_TYPE_RC5/IR_TYPE_NEC). * The deprecated tables should use IR_TYPE_UNKNOWN */ -#define IR_TABLE(irname, type, tabname) \ -struct ir_scancode_table tabname ## _table = { \ - .scan = tabname, \ - .size = ARRAY_SIZE(tabname), \ - .ir_type = type, \ - .name = #irname, \ -}; \ -EXPORT_SYMBOL_GPL(tabname ## _table) - /* empty keytable, can be used as placeholder for not-yet created keytables */ -static struct ir_scancode ir_codes_empty[] = { +static struct ir_scancode empty[] = { { 0x2a, KEY_COFFEE }, }; -IR_TABLE(empty, IR_TYPE_UNKNOWN, ir_codes_empty); +DEFINE_LEGACY_IR_KEYTABLE(empty); /* Michal Majchrowicz */ -static struct ir_scancode ir_codes_proteus_2309[] = { +static struct ir_scancode proteus_2309[] = { /* numeric */ { 0x00, KEY_0 }, { 0x01, KEY_1 }, @@ -80,10 +71,10 @@ static struct ir_scancode ir_codes_proteus_2309[] = { { 0x1e, KEY_VOLUMEUP }, /* volume + */ { 0x14, KEY_F1 }, }; -IR_TABLE(proteus_2309, IR_TYPE_UNKNOWN, ir_codes_proteus_2309); +DEFINE_LEGACY_IR_KEYTABLE(proteus_2309); /* Matt Jesson */ -static struct ir_scancode ir_codes_avermedia_m135a_rm_jx[] = { +static struct ir_scancode avermedia_m135a_rm_jx[] = { { 0x0200, KEY_POWER2 }, { 0x022e, KEY_DOT }, /* '.' */ { 0x0201, KEY_MODE }, /* TV/FM or SOURCE */ @@ -172,10 +163,10 @@ static struct ir_scancode ir_codes_avermedia_m135a_rm_jx[] = { { 0x0218, KEY_PLAY }, { 0x021b, KEY_STOP }, }; -IR_TABLE(aver-m135a-RM-JX, IR_TYPE_NEC, ir_codes_avermedia_m135a_rm_jx); +DEFINE_IR_KEYTABLE(avermedia_m135a_rm_jx, IR_TYPE_NEC); /* Oldrich Jedlicka */ -static struct ir_scancode ir_codes_avermedia_cardbus[] = { +static struct ir_scancode avermedia_cardbus[] = { { 0x00, KEY_POWER }, { 0x01, KEY_TUNER }, /* TV/FM */ { 0x03, KEY_TEXT }, /* Teletext */ @@ -231,10 +222,10 @@ static struct ir_scancode ir_codes_avermedia_cardbus[] = { { 0x42, KEY_CHANNELDOWN }, /* Channel down */ { 0x43, KEY_CHANNELUP }, /* Channel up */ }; -IR_TABLE(avermedia_cardbus, IR_TYPE_UNKNOWN, ir_codes_avermedia_cardbus); +DEFINE_LEGACY_IR_KEYTABLE(avermedia_cardbus); /* Attila Kondoros */ -static struct ir_scancode ir_codes_apac_viewcomp[] = { +static struct ir_scancode apac_viewcomp[] = { { 0x01, KEY_1 }, { 0x02, KEY_2 }, @@ -273,11 +264,11 @@ static struct ir_scancode ir_codes_apac_viewcomp[] = { { 0x0c, KEY_KPPLUS }, /* fine tune >>>> */ { 0x18, KEY_KPMINUS }, /* fine tune <<<< */ }; -IR_TABLE(apac_viewcomp, IR_TYPE_UNKNOWN, ir_codes_apac_viewcomp); +DEFINE_LEGACY_IR_KEYTABLE(apac_viewcomp); /* ---------------------------------------------------------------------- */ -static struct ir_scancode ir_codes_pixelview[] = { +static struct ir_scancode pixelview[] = { { 0x1e, KEY_POWER }, /* power */ { 0x07, KEY_MEDIA }, /* source */ @@ -320,13 +311,13 @@ static struct ir_scancode ir_codes_pixelview[] = { { 0x1d, KEY_REFRESH }, /* reset */ { 0x18, KEY_MUTE }, /* mute/unmute */ }; -IR_TABLE(pixelview, IR_TYPE_UNKNOWN, ir_codes_pixelview); +DEFINE_LEGACY_IR_KEYTABLE(pixelview); /* Mauro Carvalho Chehab present on PV MPEG 8000GT */ -static struct ir_scancode ir_codes_pixelview_new[] = { +static struct ir_scancode pixelview_new[] = { { 0x3c, KEY_TIME }, /* Timeshift */ { 0x12, KEY_POWER }, @@ -365,9 +356,9 @@ static struct ir_scancode ir_codes_pixelview_new[] = { { 0x31, KEY_TV }, { 0x34, KEY_RADIO }, }; -IR_TABLE(pixelview_new, IR_TYPE_UNKNOWN, ir_codes_pixelview_new); +DEFINE_LEGACY_IR_KEYTABLE(pixelview_new); -static struct ir_scancode ir_codes_nebula[] = { +static struct ir_scancode nebula[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, @@ -424,10 +415,10 @@ static struct ir_scancode ir_codes_nebula[] = { { 0x35, KEY_PHONE }, { 0x36, KEY_PC }, }; -IR_TABLE(nebula, IR_TYPE_UNKNOWN, ir_codes_nebula); +DEFINE_LEGACY_IR_KEYTABLE(nebula); /* DigitalNow DNTV Live DVB-T Remote */ -static struct ir_scancode ir_codes_dntv_live_dvb_t[] = { +static struct ir_scancode dntv_live_dvb_t[] = { { 0x00, KEY_ESC }, /* 'go up a level?' */ /* Keys 0 to 9 */ { 0x0a, KEY_0 }, @@ -464,12 +455,12 @@ static struct ir_scancode ir_codes_dntv_live_dvb_t[] = { { 0x1e, KEY_CHANNELDOWN }, { 0x1f, KEY_VOLUMEDOWN }, }; -IR_TABLE(dntv_live_dvb_t, IR_TYPE_UNKNOWN, ir_codes_dntv_live_dvb_t); +DEFINE_LEGACY_IR_KEYTABLE(dntv_live_dvb_t); /* ---------------------------------------------------------------------- */ /* IO-DATA BCTV7E Remote */ -static struct ir_scancode ir_codes_iodata_bctv7e[] = { +static struct ir_scancode iodata_bctv7e[] = { { 0x40, KEY_TV }, { 0x20, KEY_RADIO }, /* FM */ { 0x60, KEY_EPG }, @@ -516,12 +507,12 @@ static struct ir_scancode ir_codes_iodata_bctv7e[] = { { 0x61, KEY_FASTFORWARD }, /* forward >> */ { 0x01, KEY_NEXT }, /* skip >| */ }; -IR_TABLE(iodata_bctv7e, IR_TYPE_UNKNOWN, ir_codes_iodata_bctv7e); +DEFINE_LEGACY_IR_KEYTABLE(iodata_bctv7e); /* ---------------------------------------------------------------------- */ /* ADS Tech Instant TV DVB-T PCI Remote */ -static struct ir_scancode ir_codes_adstech_dvb_t_pci[] = { +static struct ir_scancode adstech_dvb_t_pci[] = { /* Keys 0 to 9 */ { 0x4d, KEY_0 }, { 0x57, KEY_1 }, @@ -569,13 +560,13 @@ static struct ir_scancode ir_codes_adstech_dvb_t_pci[] = { { 0x15, KEY_VOLUMEUP }, { 0x1c, KEY_VOLUMEDOWN }, }; -IR_TABLE(adstech_dvb_t_pci, IR_TYPE_UNKNOWN, ir_codes_adstech_dvb_t_pci); +DEFINE_LEGACY_IR_KEYTABLE(adstech_dvb_t_pci); /* ---------------------------------------------------------------------- */ /* MSI TV@nywhere MASTER remote */ -static struct ir_scancode ir_codes_msi_tvanywhere[] = { +static struct ir_scancode msi_tvanywhere[] = { /* Keys 0 to 9 */ { 0x00, KEY_0 }, { 0x01, KEY_1 }, @@ -603,7 +594,7 @@ static struct ir_scancode ir_codes_msi_tvanywhere[] = { { 0x1e, KEY_CHANNELDOWN }, { 0x1f, KEY_VOLUMEDOWN }, }; -IR_TABLE(msi_tvanywhere, IR_TYPE_UNKNOWN, ir_codes_msi_tvanywhere); +DEFINE_LEGACY_IR_KEYTABLE(msi_tvanywhere); /* ---------------------------------------------------------------------- */ @@ -622,7 +613,7 @@ IR_TABLE(msi_tvanywhere, IR_TYPE_UNKNOWN, ir_codes_msi_tvanywhere); */ -static struct ir_scancode ir_codes_msi_tvanywhere_plus[] = { +static struct ir_scancode msi_tvanywhere_plus[] = { /* ---- Remote Button Layout ---- @@ -692,12 +683,12 @@ static struct ir_scancode ir_codes_msi_tvanywhere_plus[] = { { 0x0c, KEY_FASTFORWARD }, /* >> */ { 0x1d, KEY_RESTART }, /* Reset */ }; -IR_TABLE(msi_tvanywhere_plus, IR_TYPE_UNKNOWN, ir_codes_msi_tvanywhere_plus); +DEFINE_LEGACY_IR_KEYTABLE(msi_tvanywhere_plus); /* ---------------------------------------------------------------------- */ /* Cinergy 1400 DVB-T */ -static struct ir_scancode ir_codes_cinergy_1400[] = { +static struct ir_scancode cinergy_1400[] = { { 0x01, KEY_POWER }, { 0x02, KEY_1 }, { 0x03, KEY_2 }, @@ -740,12 +731,12 @@ static struct ir_scancode ir_codes_cinergy_1400[] = { { 0x48, KEY_STOP }, { 0x5c, KEY_NEXT }, }; -IR_TABLE(cinergy_1400, IR_TYPE_UNKNOWN, ir_codes_cinergy_1400); +DEFINE_LEGACY_IR_KEYTABLE(cinergy_1400); /* ---------------------------------------------------------------------- */ /* AVERTV STUDIO 303 Remote */ -static struct ir_scancode ir_codes_avertv_303[] = { +static struct ir_scancode avertv_303[] = { { 0x2a, KEY_1 }, { 0x32, KEY_2 }, { 0x3a, KEY_3 }, @@ -789,12 +780,12 @@ static struct ir_scancode ir_codes_avertv_303[] = { { 0x13, KEY_DOWN }, { 0x1b, KEY_UP }, }; -IR_TABLE(avertv_303, IR_TYPE_UNKNOWN, ir_codes_avertv_303); +DEFINE_LEGACY_IR_KEYTABLE(avertv_303); /* ---------------------------------------------------------------------- */ /* DigitalNow DNTV Live! DVB-T Pro Remote */ -static struct ir_scancode ir_codes_dntv_live_dvbt_pro[] = { +static struct ir_scancode dntv_live_dvbt_pro[] = { { 0x16, KEY_POWER }, { 0x5b, KEY_HOME }, @@ -850,9 +841,9 @@ static struct ir_scancode ir_codes_dntv_live_dvbt_pro[] = { { 0x5c, KEY_YELLOW }, { 0x5d, KEY_BLUE }, }; -IR_TABLE(dntv_live_dvbt_pro, IR_TYPE_UNKNOWN, ir_codes_dntv_live_dvbt_pro); +DEFINE_LEGACY_IR_KEYTABLE(dntv_live_dvbt_pro); -static struct ir_scancode ir_codes_em_terratec[] = { +static struct ir_scancode em_terratec[] = { { 0x01, KEY_CHANNEL }, { 0x02, KEY_SELECT }, { 0x03, KEY_MUTE }, @@ -882,9 +873,9 @@ static struct ir_scancode ir_codes_em_terratec[] = { { 0x1e, KEY_STOP }, { 0x40, KEY_ZOOM }, }; -IR_TABLE(em_terratec, IR_TYPE_UNKNOWN, ir_codes_em_terratec); +DEFINE_LEGACY_IR_KEYTABLE(em_terratec); -static struct ir_scancode ir_codes_pinnacle_grey[] = { +static struct ir_scancode pinnacle_grey[] = { { 0x3a, KEY_0 }, { 0x31, KEY_1 }, { 0x32, KEY_2 }, @@ -934,9 +925,9 @@ static struct ir_scancode ir_codes_pinnacle_grey[] = { { 0x2a, KEY_MEDIA }, { 0x18, KEY_EPG }, }; -IR_TABLE(pinnacle_grey, IR_TYPE_UNKNOWN, ir_codes_pinnacle_grey); +DEFINE_LEGACY_IR_KEYTABLE(pinnacle_grey); -static struct ir_scancode ir_codes_flyvideo[] = { +static struct ir_scancode flyvideo[] = { { 0x0f, KEY_0 }, { 0x03, KEY_1 }, { 0x04, KEY_2 }, @@ -967,9 +958,9 @@ static struct ir_scancode ir_codes_flyvideo[] = { { 0x1f, KEY_FORWARD }, /* Forward ( >>> ) */ { 0x0a, KEY_ANGLE }, /* no label, may be used as the PAUSE button */ }; -IR_TABLE(flyvideo, IR_TYPE_UNKNOWN, ir_codes_flyvideo); +DEFINE_LEGACY_IR_KEYTABLE(flyvideo); -static struct ir_scancode ir_codes_flydvb[] = { +static struct ir_scancode flydvb[] = { { 0x01, KEY_ZOOM }, /* Full Screen */ { 0x00, KEY_POWER }, /* Power */ @@ -1007,9 +998,9 @@ static struct ir_scancode ir_codes_flydvb[] = { { 0x11, KEY_STOP }, /* Stop */ { 0x0e, KEY_NEXT }, /* End >>| */ }; -IR_TABLE(flydvb, IR_TYPE_UNKNOWN, ir_codes_flydvb); +DEFINE_LEGACY_IR_KEYTABLE(flydvb); -static struct ir_scancode ir_codes_cinergy[] = { +static struct ir_scancode cinergy[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, @@ -1048,11 +1039,11 @@ static struct ir_scancode ir_codes_cinergy[] = { { 0x22, KEY_PAUSE }, { 0x23, KEY_STOP }, }; -IR_TABLE(cinergy, IR_TYPE_UNKNOWN, ir_codes_cinergy); +DEFINE_LEGACY_IR_KEYTABLE(cinergy); /* Alfons Geser * updates from Job D. R. Borges */ -static struct ir_scancode ir_codes_eztv[] = { +static struct ir_scancode eztv[] = { { 0x12, KEY_POWER }, { 0x01, KEY_TV }, /* DVR */ { 0x15, KEY_DVD }, /* DVD */ @@ -1106,10 +1097,10 @@ static struct ir_scancode ir_codes_eztv[] = { { 0x13, KEY_ENTER }, /* enter */ { 0x21, KEY_DOT }, /* . (decimal dot) */ }; -IR_TABLE(eztv, IR_TYPE_UNKNOWN, ir_codes_eztv); +DEFINE_LEGACY_IR_KEYTABLE(eztv); /* Alex Hermann */ -static struct ir_scancode ir_codes_avermedia[] = { +static struct ir_scancode avermedia[] = { { 0x28, KEY_1 }, { 0x18, KEY_2 }, { 0x38, KEY_3 }, @@ -1154,9 +1145,9 @@ static struct ir_scancode ir_codes_avermedia[] = { { 0x11, KEY_CHANNELDOWN }, /* CHANNEL/PAGE- */ { 0x31, KEY_CHANNELUP } /* CHANNEL/PAGE+ */ }; -IR_TABLE(avermedia, IR_TYPE_UNKNOWN, ir_codes_avermedia); +DEFINE_LEGACY_IR_KEYTABLE(avermedia); -static struct ir_scancode ir_codes_videomate_tv_pvr[] = { +static struct ir_scancode videomate_tv_pvr[] = { { 0x14, KEY_MUTE }, { 0x24, KEY_ZOOM }, @@ -1204,7 +1195,7 @@ static struct ir_scancode ir_codes_videomate_tv_pvr[] = { { 0x20, KEY_LANGUAGE }, { 0x21, KEY_SLEEP }, }; -IR_TABLE(videomate_tv_pvr, IR_TYPE_UNKNOWN, ir_codes_videomate_tv_pvr); +DEFINE_LEGACY_IR_KEYTABLE(videomate_tv_pvr); /* Michael Tokarev http://www.corpit.ru/mjt/beholdTV/remote_control.jpg @@ -1215,7 +1206,7 @@ IR_TABLE(videomate_tv_pvr, IR_TYPE_UNKNOWN, ir_codes_videomate_tv_pvr); the button labels (several variants when appropriate) helps to descide which keycodes to assign to the buttons. */ -static struct ir_scancode ir_codes_manli[] = { +static struct ir_scancode manli[] = { /* 0x1c 0x12 * * FUNCTION POWER * @@ -1301,10 +1292,10 @@ static struct ir_scancode ir_codes_manli[] = { /* 0x1d unused ? */ }; -IR_TABLE(manli, IR_TYPE_UNKNOWN, ir_codes_manli); +DEFINE_LEGACY_IR_KEYTABLE(manli); /* Mike Baikov */ -static struct ir_scancode ir_codes_gotview7135[] = { +static struct ir_scancode gotview7135[] = { { 0x11, KEY_POWER }, { 0x35, KEY_TV }, @@ -1342,9 +1333,9 @@ static struct ir_scancode ir_codes_gotview7135[] = { { 0x1e, KEY_TIME }, /* TIMESHIFT */ { 0x38, KEY_F24 }, /* NORMAL TIMESHIFT */ }; -IR_TABLE(gotview7135, IR_TYPE_UNKNOWN, ir_codes_gotview7135); +DEFINE_LEGACY_IR_KEYTABLE(gotview7135); -static struct ir_scancode ir_codes_purpletv[] = { +static struct ir_scancode purpletv[] = { { 0x03, KEY_POWER }, { 0x6f, KEY_MUTE }, { 0x10, KEY_BACKSPACE }, /* Recall */ @@ -1386,13 +1377,13 @@ static struct ir_scancode ir_codes_purpletv[] = { { 0x42, KEY_REWIND }, /* Backward ? */ }; -IR_TABLE(purpletv, IR_TYPE_UNKNOWN, ir_codes_purpletv); +DEFINE_LEGACY_IR_KEYTABLE(purpletv); /* Mapping for the 28 key remote control as seen at http://www.sednacomputer.com/photo/cardbus-tv.jpg Pavel Mihaylov Also for the remote bundled with Kozumi KTV-01C card */ -static struct ir_scancode ir_codes_pctv_sedna[] = { +static struct ir_scancode pctv_sedna[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, @@ -1428,10 +1419,10 @@ static struct ir_scancode ir_codes_pctv_sedna[] = { { 0x17, KEY_DIGITS }, /* Plus */ { 0x1f, KEY_PLAY }, /* Play */ }; -IR_TABLE(pctv_sedna, IR_TYPE_UNKNOWN, ir_codes_pctv_sedna); +DEFINE_LEGACY_IR_KEYTABLE(pctv_sedna); /* Mark Phalan */ -static struct ir_scancode ir_codes_pv951[] = { +static struct ir_scancode pv951[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, @@ -1468,12 +1459,12 @@ static struct ir_scancode ir_codes_pv951[] = { { 0x14, KEY_EQUAL }, /* SYNC */ { 0x1c, KEY_MEDIA }, /* PC/TV */ }; -IR_TABLE(pv951, IR_TYPE_UNKNOWN, ir_codes_pv951); +DEFINE_LEGACY_IR_KEYTABLE(pv951); /* generic RC5 keytable */ /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ /* used by old (black) Hauppauge remotes */ -static struct ir_scancode ir_codes_rc5_tv[] = { +static struct ir_scancode rc5_tv[] = { /* Keys 0 to 9 */ { 0x00, KEY_0 }, { 0x01, KEY_1 }, @@ -1511,10 +1502,10 @@ static struct ir_scancode ir_codes_rc5_tv[] = { { 0x3d, KEY_SUSPEND }, /* system standby */ }; -IR_TABLE(rc5_tv, IR_TYPE_UNKNOWN, ir_codes_rc5_tv); +DEFINE_LEGACY_IR_KEYTABLE(rc5_tv); /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ -static struct ir_scancode ir_codes_winfast[] = { +static struct ir_scancode winfast[] = { /* Keys 0 to 9 */ { 0x12, KEY_0 }, { 0x05, KEY_1 }, @@ -1575,9 +1566,9 @@ static struct ir_scancode ir_codes_winfast[] = { { 0x3b, KEY_F23 }, /* MCE +CH, on Y04G0033 */ { 0x3f, KEY_F24 } /* MCE -CH, on Y04G0033 */ }; -IR_TABLE(winfast, IR_TYPE_UNKNOWN, ir_codes_winfast); +DEFINE_LEGACY_IR_KEYTABLE(winfast); -static struct ir_scancode ir_codes_pinnacle_color[] = { +static struct ir_scancode pinnacle_color[] = { { 0x59, KEY_MUTE }, { 0x4a, KEY_POWER }, @@ -1632,12 +1623,12 @@ static struct ir_scancode ir_codes_pinnacle_color[] = { { 0x74, KEY_CHANNEL }, { 0x0a, KEY_BACKSPACE }, }; -IR_TABLE(pinnacle_color, IR_TYPE_UNKNOWN, ir_codes_pinnacle_color); +DEFINE_LEGACY_IR_KEYTABLE(pinnacle_color); /* Hauppauge: the newer, gray remotes (seems there are multiple * slightly different versions), shipped with cx88+ivtv cards. * almost rc5 coding, but some non-standard keys */ -static struct ir_scancode ir_codes_hauppauge_new[] = { +static struct ir_scancode hauppauge_new[] = { /* Keys 0 to 9 */ { 0x00, KEY_0 }, { 0x01, KEY_1 }, @@ -1694,9 +1685,9 @@ static struct ir_scancode ir_codes_hauppauge_new[] = { { 0x3c, KEY_ZOOM }, /* full */ { 0x3d, KEY_POWER }, /* system power (green button) */ }; -IR_TABLE(hauppauge_new, IR_TYPE_UNKNOWN, ir_codes_hauppauge_new); +DEFINE_LEGACY_IR_KEYTABLE(hauppauge_new); -static struct ir_scancode ir_codes_npgtech[] = { +static struct ir_scancode npgtech[] = { { 0x1d, KEY_SWITCHVIDEOMODE }, /* switch inputs */ { 0x2a, KEY_FRONT }, @@ -1737,12 +1728,12 @@ static struct ir_scancode ir_codes_npgtech[] = { { 0x10, KEY_POWER }, }; -IR_TABLE(npgtech, IR_TYPE_UNKNOWN, ir_codes_npgtech); +DEFINE_LEGACY_IR_KEYTABLE(npgtech); /* Norwood Micro (non-Pro) TV Tuner By Peter Naulls Key comments are the functions given in the manual */ -static struct ir_scancode ir_codes_norwood[] = { +static struct ir_scancode norwood[] = { /* Keys 0 to 9 */ { 0x20, KEY_0 }, { 0x21, KEY_1 }, @@ -1784,14 +1775,14 @@ static struct ir_scancode ir_codes_norwood[] = { { 0x34, KEY_RADIO }, /* FM */ { 0x65, KEY_POWER }, /* Computer power */ }; -IR_TABLE(norwood, IR_TYPE_UNKNOWN, ir_codes_norwood); +DEFINE_LEGACY_IR_KEYTABLE(norwood); /* From reading the following remotes: * Zenith Universal 7 / TV Mode 807 / VCR Mode 837 * Hauppauge (from NOVA-CI-s box product) * This is a "middle of the road" approach, differences are noted */ -static struct ir_scancode ir_codes_budget_ci_old[] = { +static struct ir_scancode budget_ci_old[] = { { 0x00, KEY_0 }, { 0x01, KEY_1 }, { 0x02, KEY_2 }, @@ -1838,14 +1829,14 @@ static struct ir_scancode ir_codes_budget_ci_old[] = { { 0x3d, KEY_POWER2 }, { 0x3e, KEY_TUNER }, }; -IR_TABLE(budget_ci_old, IR_TYPE_UNKNOWN, ir_codes_budget_ci_old); +DEFINE_LEGACY_IR_KEYTABLE(budget_ci_old); /* * Marc Fargas * this is the remote control that comes with the asus p7131 * which has a label saying is "Model PC-39" */ -static struct ir_scancode ir_codes_asus_pc39[] = { +static struct ir_scancode asus_pc39[] = { /* Keys 0 to 9 */ { 0x15, KEY_0 }, { 0x29, KEY_1 }, @@ -1891,11 +1882,11 @@ static struct ir_scancode ir_codes_asus_pc39[] = { { 0x3d, KEY_MUTE }, /* mute */ { 0x01, KEY_DVD }, /* dvd */ }; -IR_TABLE(asus_pc39, IR_TYPE_UNKNOWN, ir_codes_asus_pc39); +DEFINE_LEGACY_IR_KEYTABLE(asus_pc39); /* Encore ENLTV-FM - black plastic, white front cover with white glowing buttons Juan Pablo Sormani */ -static struct ir_scancode ir_codes_encore_enltv[] = { +static struct ir_scancode encore_enltv[] = { /* Power button does nothing, neither in Windows app, although it sends data (used for BIOS wakeup?) */ @@ -1965,11 +1956,11 @@ static struct ir_scancode ir_codes_encore_enltv[] = { { 0x47, KEY_YELLOW }, /* AP3 */ { 0x57, KEY_BLUE }, /* AP4 */ }; -IR_TABLE(encore_enltv, IR_TYPE_UNKNOWN, ir_codes_encore_enltv); +DEFINE_LEGACY_IR_KEYTABLE(encore_enltv); /* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton Mauro Carvalho Chehab */ -static struct ir_scancode ir_codes_encore_enltv2[] = { +static struct ir_scancode encore_enltv2[] = { { 0x4c, KEY_POWER2 }, { 0x4a, KEY_TUNER }, { 0x40, KEY_1 }, @@ -2017,10 +2008,10 @@ static struct ir_scancode ir_codes_encore_enltv2[] = { { 0x7d, KEY_FORWARD }, { 0x79, KEY_STOP }, }; -IR_TABLE(encore_enltv2, IR_TYPE_UNKNOWN, ir_codes_encore_enltv2); +DEFINE_LEGACY_IR_KEYTABLE(encore_enltv2); /* for the Technotrend 1500 bundled remotes (grey and black): */ -static struct ir_scancode ir_codes_tt_1500[] = { +static struct ir_scancode tt_1500[] = { { 0x01, KEY_POWER }, { 0x02, KEY_SHUFFLE }, /* ? double-arrow key */ { 0x03, KEY_1 }, @@ -2061,10 +2052,10 @@ static struct ir_scancode ir_codes_tt_1500[] = { { 0x3e, KEY_PAUSE }, { 0x3f, KEY_FORWARD }, }; -IR_TABLE(tt_1500, IR_TYPE_UNKNOWN, ir_codes_tt_1500); +DEFINE_LEGACY_IR_KEYTABLE(tt_1500); /* DViCO FUSION HDTV MCE remote */ -static struct ir_scancode ir_codes_fusionhdtv_mce[] = { +static struct ir_scancode fusionhdtv_mce[] = { { 0x0b, KEY_1 }, { 0x17, KEY_2 }, @@ -2121,10 +2112,10 @@ static struct ir_scancode ir_codes_fusionhdtv_mce[] = { { 0x01, KEY_RECORD }, { 0x4e, KEY_POWER }, }; -IR_TABLE(fusionhdtv_mce, IR_TYPE_UNKNOWN, ir_codes_fusionhdtv_mce); +DEFINE_LEGACY_IR_KEYTABLE(fusionhdtv_mce); /* Pinnacle PCTV HD 800i mini remote */ -static struct ir_scancode ir_codes_pinnacle_pctv_hd[] = { +static struct ir_scancode pinnacle_pctv_hd[] = { { 0x0f, KEY_1 }, { 0x15, KEY_2 }, @@ -2156,7 +2147,7 @@ static struct ir_scancode ir_codes_pinnacle_pctv_hd[] = { { 0x36, KEY_RECORD }, { 0x3f, KEY_EPG }, /* Labeled "?" */ }; -IR_TABLE(pinnacle_pctv_hd, IR_TYPE_UNKNOWN, ir_codes_pinnacle_pctv_hd); +DEFINE_LEGACY_IR_KEYTABLE(pinnacle_pctv_hd); /* * Igor Kuznetsov @@ -2169,7 +2160,7 @@ IR_TABLE(pinnacle_pctv_hd, IR_TYPE_UNKNOWN, ir_codes_pinnacle_pctv_hd); * the button labels (several variants when appropriate) * helps to descide which keycodes to assign to the buttons. */ -static struct ir_scancode ir_codes_behold[] = { +static struct ir_scancode behold[] = { /* 0x1c 0x12 * * TV/FM POWER * @@ -2259,7 +2250,7 @@ static struct ir_scancode ir_codes_behold[] = { { 0x5c, KEY_CAMERA }, }; -IR_TABLE(behold, IR_TYPE_UNKNOWN, ir_codes_behold); +DEFINE_LEGACY_IR_KEYTABLE(behold); /* Beholder Intl. Ltd. 2008 * Dmitry Belimov d.belimov@google.com @@ -2269,7 +2260,7 @@ IR_TABLE(behold, IR_TYPE_UNKNOWN, ir_codes_behold); * the button labels (several variants when appropriate) * helps to descide which keycodes to assign to the buttons. */ -static struct ir_scancode ir_codes_behold_columbus[] = { +static struct ir_scancode behold_columbus[] = { /* 0x13 0x11 0x1C 0x12 * * Mute Source TV/FM Power * @@ -2329,13 +2320,13 @@ static struct ir_scancode ir_codes_behold_columbus[] = { { 0x1A, KEY_NEXT }, }; -IR_TABLE(behold_columbus, IR_TYPE_UNKNOWN, ir_codes_behold_columbus); +DEFINE_LEGACY_IR_KEYTABLE(behold_columbus); /* * Remote control for the Genius TVGO A11MCE * Adrian Pardini */ -static struct ir_scancode ir_codes_genius_tvgo_a11mce[] = { +static struct ir_scancode genius_tvgo_a11mce[] = { /* Keys 0 to 9 */ { 0x48, KEY_0 }, { 0x09, KEY_1 }, @@ -2375,13 +2366,13 @@ static struct ir_scancode ir_codes_genius_tvgo_a11mce[] = { { 0x13, KEY_YELLOW }, { 0x50, KEY_BLUE }, }; -IR_TABLE(genius_tvgo_a11mce, IR_TYPE_UNKNOWN, ir_codes_genius_tvgo_a11mce); +DEFINE_LEGACY_IR_KEYTABLE(genius_tvgo_a11mce); /* * Remote control for Powercolor Real Angel 330 * Daniel Fraga */ -static struct ir_scancode ir_codes_powercolor_real_angel[] = { +static struct ir_scancode powercolor_real_angel[] = { { 0x38, KEY_SWITCHVIDEOMODE }, /* switch inputs */ { 0x0c, KEY_MEDIA }, /* Turn ON/OFF App */ { 0x00, KEY_0 }, @@ -2418,12 +2409,12 @@ static struct ir_scancode ir_codes_powercolor_real_angel[] = { { 0x14, KEY_RADIO }, /* FM radio */ { 0x25, KEY_POWER }, /* power */ }; -IR_TABLE(powercolor_real_angel, IR_TYPE_UNKNOWN, ir_codes_powercolor_real_angel); +DEFINE_LEGACY_IR_KEYTABLE(powercolor_real_angel); /* Kworld Plus TV Analog Lite PCI IR Mauro Carvalho Chehab */ -static struct ir_scancode ir_codes_kworld_plus_tv_analog[] = { +static struct ir_scancode kworld_plus_tv_analog[] = { { 0x0c, KEY_PROG1 }, /* Kworld key */ { 0x16, KEY_CLOSECD }, /* -> ) */ { 0x1d, KEY_POWER2 }, @@ -2479,12 +2470,12 @@ static struct ir_scancode ir_codes_kworld_plus_tv_analog[] = { { 0x18, KEY_RED}, /* B */ { 0x23, KEY_GREEN}, /* C */ }; -IR_TABLE(kworld_plus_tv_analog, IR_TYPE_UNKNOWN, ir_codes_kworld_plus_tv_analog); +DEFINE_LEGACY_IR_KEYTABLE(kworld_plus_tv_analog); /* Kaiomy TVnPC U2 Mauro Carvalho Chehab */ -static struct ir_scancode ir_codes_kaiomy[] = { +static struct ir_scancode kaiomy[] = { { 0x43, KEY_POWER2}, { 0x01, KEY_LIST}, { 0x0b, KEY_ZOOM}, @@ -2528,9 +2519,9 @@ static struct ir_scancode ir_codes_kaiomy[] = { { 0x1e, KEY_YELLOW}, { 0x1f, KEY_BLUE}, }; -IR_TABLE(kaiomy, IR_TYPE_UNKNOWN, ir_codes_kaiomy); +DEFINE_LEGACY_IR_KEYTABLE(kaiomy); -static struct ir_scancode ir_codes_avermedia_a16d[] = { +static struct ir_scancode avermedia_a16d[] = { { 0x20, KEY_LIST}, { 0x00, KEY_POWER}, { 0x28, KEY_1}, @@ -2566,12 +2557,12 @@ static struct ir_scancode ir_codes_avermedia_a16d[] = { { 0x08, KEY_EPG}, { 0x2a, KEY_MENU}, }; -IR_TABLE(avermedia_a16d, IR_TYPE_UNKNOWN, ir_codes_avermedia_a16d); +DEFINE_LEGACY_IR_KEYTABLE(avermedia_a16d); /* Encore ENLTV-FM v5.3 Mauro Carvalho Chehab */ -static struct ir_scancode ir_codes_encore_enltv_fm53[] = { +static struct ir_scancode encore_enltv_fm53[] = { { 0x10, KEY_POWER2}, { 0x06, KEY_MUTE}, @@ -2609,10 +2600,10 @@ static struct ir_scancode ir_codes_encore_enltv_fm53[] = { { 0x0c, KEY_ZOOM}, /* hide pannel */ { 0x47, KEY_SLEEP}, /* shutdown */ }; -IR_TABLE(encore_enltv_fm53, IR_TYPE_UNKNOWN, ir_codes_encore_enltv_fm53); +DEFINE_LEGACY_IR_KEYTABLE(encore_enltv_fm53); /* Zogis Real Audio 220 - 32 keys IR */ -static struct ir_scancode ir_codes_real_audio_220_32_keys[] = { +static struct ir_scancode real_audio_220_32_keys[] = { { 0x1c, KEY_RADIO}, { 0x12, KEY_POWER2}, @@ -2649,12 +2640,12 @@ static struct ir_scancode ir_codes_real_audio_220_32_keys[] = { { 0x19, KEY_CAMERA}, /* Snapshot */ }; -IR_TABLE(real_audio_220_32_keys, IR_TYPE_UNKNOWN, ir_codes_real_audio_220_32_keys); +DEFINE_LEGACY_IR_KEYTABLE(real_audio_220_32_keys); /* ATI TV Wonder HD 600 USB Devin Heitmueller */ -static struct ir_scancode ir_codes_ati_tv_wonder_hd_600[] = { +static struct ir_scancode ati_tv_wonder_hd_600[] = { { 0x00, KEY_RECORD}, /* Row 1 */ { 0x01, KEY_PLAYPAUSE}, { 0x02, KEY_STOP}, @@ -2680,12 +2671,12 @@ static struct ir_scancode ir_codes_ati_tv_wonder_hd_600[] = { { 0x16, KEY_MUTE}, { 0x17, KEY_VOLUMEDOWN}, }; -IR_TABLE(ati_tv_wonder_hd_600, IR_TYPE_UNKNOWN, ir_codes_ati_tv_wonder_hd_600); +DEFINE_LEGACY_IR_KEYTABLE(ati_tv_wonder_hd_600); /* DVBWorld remotes Igor M. Liplianin */ -static struct ir_scancode ir_codes_dm1105_nec[] = { +static struct ir_scancode dm1105_nec[] = { { 0x0a, KEY_POWER2}, /* power */ { 0x0c, KEY_MUTE}, /* mute */ { 0x11, KEY_1}, @@ -2718,9 +2709,9 @@ static struct ir_scancode ir_codes_dm1105_nec[] = { { 0x1e, KEY_TV}, /* tvmode */ { 0x1b, KEY_B}, /* recall */ }; -IR_TABLE(dm1105_nec, IR_TYPE_UNKNOWN, ir_codes_dm1105_nec); +DEFINE_LEGACY_IR_KEYTABLE(dm1105_nec); -static struct ir_scancode ir_codes_tevii_nec[] = { +static struct ir_scancode tevii_nec[] = { { 0x0a, KEY_POWER2}, { 0x0c, KEY_MUTE}, { 0x11, KEY_1}, @@ -2769,9 +2760,9 @@ static struct ir_scancode ir_codes_tevii_nec[] = { { 0x56, KEY_MODE}, { 0x58, KEY_SWITCHVIDEOMODE}, }; -IR_TABLE(tevii_nec, IR_TYPE_UNKNOWN, ir_codes_tevii_nec); +DEFINE_LEGACY_IR_KEYTABLE(tevii_nec); -static struct ir_scancode ir_codes_tbs_nec[] = { +static struct ir_scancode tbs_nec[] = { { 0x04, KEY_POWER2}, /*power*/ { 0x14, KEY_MUTE}, /*mute*/ { 0x07, KEY_1}, @@ -2805,12 +2796,12 @@ static struct ir_scancode ir_codes_tbs_nec[] = { { 0x00, KEY_PREVIOUS}, { 0x1b, KEY_MODE}, }; -IR_TABLE(tbs_nec, IR_TYPE_UNKNOWN, ir_codes_tbs_nec); +DEFINE_LEGACY_IR_KEYTABLE(tbs_nec); /* Terratec Cinergy Hybrid T USB XS Devin Heitmueller */ -static struct ir_scancode ir_codes_terratec_cinergy_xs[] = { +static struct ir_scancode terratec_cinergy_xs[] = { { 0x41, KEY_HOME}, { 0x01, KEY_POWER}, { 0x42, KEY_MENU}, @@ -2859,12 +2850,12 @@ static struct ir_scancode ir_codes_terratec_cinergy_xs[] = { { 0x4f, KEY_FASTFORWARD}, { 0x5c, KEY_NEXT}, }; -IR_TABLE(terratec_cinergy_xs, IR_TYPE_UNKNOWN, ir_codes_terratec_cinergy_xs); +DEFINE_LEGACY_IR_KEYTABLE(terratec_cinergy_xs); /* EVGA inDtube Devin Heitmueller */ -static struct ir_scancode ir_codes_evga_indtube[] = { +static struct ir_scancode evga_indtube[] = { { 0x12, KEY_POWER}, { 0x02, KEY_MODE}, /* TV */ { 0x14, KEY_MUTE}, @@ -2882,9 +2873,9 @@ static struct ir_scancode ir_codes_evga_indtube[] = { { 0x1f, KEY_NEXT}, { 0x13, KEY_CAMERA}, }; -IR_TABLE(evga_indtube, IR_TYPE_UNKNOWN, ir_codes_evga_indtube); +DEFINE_LEGACY_IR_KEYTABLE(evga_indtube); -static struct ir_scancode ir_codes_videomate_s350[] = { +static struct ir_scancode videomate_s350[] = { { 0x00, KEY_TV}, { 0x01, KEY_DVD}, { 0x04, KEY_RECORD}, @@ -2930,12 +2921,12 @@ static struct ir_scancode ir_codes_videomate_s350[] = { { 0x11, KEY_ENTER}, { 0x20, KEY_TEXT}, }; -IR_TABLE(videomate_s350, IR_TYPE_UNKNOWN, ir_codes_videomate_s350); +DEFINE_LEGACY_IR_KEYTABLE(videomate_s350); /* GADMEI UTV330+ RM008Z remote Shine Liu */ -static struct ir_scancode ir_codes_gadmei_rm008z[] = { +static struct ir_scancode gadmei_rm008z[] = { { 0x14, KEY_POWER2}, /* POWER OFF */ { 0x0c, KEY_MUTE}, /* MUTE */ @@ -2973,7 +2964,7 @@ static struct ir_scancode ir_codes_gadmei_rm008z[] = { { 0x13, KEY_CHANNELDOWN}, /* CHANNELDOWN */ { 0x15, KEY_ENTER}, /* OK */ }; -IR_TABLE(gadmei_rm008z, IR_TYPE_UNKNOWN, ir_codes_gadmei_rm008z); +DEFINE_LEGACY_IR_KEYTABLE(gadmei_rm008z); /************************************************************* * COMPLETE SCANCODE TABLES @@ -2987,7 +2978,7 @@ IR_TABLE(gadmei_rm008z, IR_TYPE_UNKNOWN, ir_codes_gadmei_rm008z); * * This table contains the complete RC5 code, instead of just the data part */ -static struct ir_scancode ir_codes_rc5_hauppauge_new[] = { +static struct ir_scancode rc5_hauppauge_new[] = { /* Keys 0 to 9 */ { 0x1e00, KEY_0 }, { 0x1e01, KEY_1 }, @@ -3044,12 +3035,12 @@ static struct ir_scancode ir_codes_rc5_hauppauge_new[] = { { 0x1e3c, KEY_ZOOM }, /* full */ { 0x1e3d, KEY_POWER }, /* system power (green button) */ }; -IR_TABLE(rc5_hauppauge_new, IR_TYPE_RC5, ir_codes_rc5_hauppauge_new); +DEFINE_IR_KEYTABLE(rc5_hauppauge_new, IR_TYPE_RC5); /* Terratec Cinergy Hybrid T USB XS FM Mauro Carvalho Chehab */ -static struct ir_scancode ir_codes_nec_terratec_cinergy_xs[] = { +static struct ir_scancode nec_terratec_cinergy_xs[] = { { 0x1441, KEY_HOME}, { 0x1401, KEY_POWER2}, @@ -3111,12 +3102,12 @@ static struct ir_scancode ir_codes_nec_terratec_cinergy_xs[] = { { 0x144f, KEY_FASTFORWARD}, { 0x145c, KEY_NEXT}, }; -IR_TABLE(nec_terratec_cinergy_xs, IR_TYPE_NEC, ir_codes_nec_terratec_cinergy_xs); +DEFINE_IR_KEYTABLE(nec_terratec_cinergy_xs, IR_TYPE_NEC); /* Leadtek Winfast TV USB II Deluxe remote Magnus Alm */ -static struct ir_scancode ir_codes_winfast_usbii_deluxe[] = { +static struct ir_scancode winfast_usbii_deluxe[] = { { 0x62, KEY_0}, { 0x75, KEY_1}, { 0x76, KEY_2}, @@ -3155,11 +3146,11 @@ static struct ir_scancode ir_codes_winfast_usbii_deluxe[] = { { 0x63, KEY_ENTER}, /* ENTER */ }; -IR_TABLE(winfast_usbii_deluxe, IR_TYPE_UNKNOWN, ir_codes_winfast_usbii_deluxe); +DEFINE_LEGACY_IR_KEYTABLE(winfast_usbii_deluxe); /* Kworld 315U */ -static struct ir_scancode ir_codes_kworld_315u[] = { +static struct ir_scancode kworld_315u[] = { { 0x6143, KEY_POWER }, { 0x6101, KEY_TUNER }, /* source */ { 0x610b, KEY_ZOOM }, @@ -3200,4 +3191,4 @@ static struct ir_scancode ir_codes_kworld_315u[] = { { 0x611e, KEY_YELLOW }, { 0x611f, KEY_BLUE }, }; -IR_TABLE(kworld_315u, IR_TYPE_NEC, ir_codes_kworld_315u); +DEFINE_IR_KEYTABLE(kworld_315u, IR_TYPE_NEC); diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 2e275154aef3..e8a64761df56 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -107,11 +107,23 @@ void ir_rc5_timer_keyup(unsigned long data); /* scancode->keycode map tables from ir-keymaps.c */ #define IR_KEYTABLE(a) \ -(ir_codes_ ## a ## _table) +ir_codes_ ## a ## _table #define DECLARE_IR_KEYTABLE(a) \ extern struct ir_scancode_table IR_KEYTABLE(a) +#define DEFINE_IR_KEYTABLE(tabname, type) \ +struct ir_scancode_table IR_KEYTABLE(tabname) = { \ + .scan = tabname, \ + .size = ARRAY_SIZE(tabname), \ + .ir_type = type, \ + .name = #tabname, \ +}; \ +EXPORT_SYMBOL_GPL(IR_KEYTABLE(tabname)) + +#define DEFINE_LEGACY_IR_KEYTABLE(tabname) \ + DEFINE_IR_KEYTABLE(tabname, IR_TYPE_UNKNOWN) + DECLARE_IR_KEYTABLE(adstech_dvb_t_pci); DECLARE_IR_KEYTABLE(apac_viewcomp); DECLARE_IR_KEYTABLE(asus_pc39); -- GitLab From 77b7422d48cda9b8e5dabb7f4bc056861c5ed4fe Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 1 Apr 2010 22:43:29 -0300 Subject: [PATCH 286/534] V4L/DVB: ir-common: move IR tables from ir-keymaps.c to a separate file Instead of having one big file with lots of keytables, create one include file for each IR keymap. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keymaps.c | 3171 +---------------- include/media/ir-common.h | 150 +- include/media/ir-core.h | 18 + include/media/keycodes/adstech-dvb-t-pci.h | 65 + include/media/keycodes/apac-viewcomp.h | 56 + include/media/keycodes/asus-pc39.h | 67 + include/media/keycodes/ati-tv-wonder-hd-600.h | 45 + include/media/keycodes/avermedia-a16d.h | 52 + include/media/keycodes/avermedia-cardbus.h | 73 + include/media/keycodes/avermedia-dvbt.h | 54 + .../media/keycodes/avermedia-m135a-rm-jx.h | 66 + include/media/keycodes/avermedia.h | 62 + include/media/keycodes/avertv-303.h | 61 + include/media/keycodes/behold-columbus.h | 84 + include/media/keycodes/behold.h | 117 + include/media/keycodes/budget-ci-old.h | 68 + include/media/keycodes/cinergy-1400.h | 60 + include/media/keycodes/cinergy.h | 55 + include/media/keycodes/dm1105-nec.h | 52 + include/media/keycodes/dntv-live-dvb-t.h | 54 + include/media/keycodes/dntv-live-dvbt-pro.h | 73 + include/media/keycodes/em-terratec.h | 46 + include/media/keycodes/empty.h | 20 + include/media/keycodes/encore-enltv-fm53.h | 57 + include/media/keycodes/encore-enltv.h | 88 + include/media/keycodes/encore-enltv2.h | 66 + include/media/keycodes/evga-indtube.h | 37 + include/media/keycodes/eztv.h | 72 + include/media/keycodes/flydvb.h | 54 + include/media/keycodes/flyvideo.h | 47 + include/media/keycodes/fusionhdtv-mce.h | 74 + include/media/keycodes/gadmei-rm008z.h | 57 + include/media/keycodes/genius-tvgo-a11mce.h | 60 + include/media/keycodes/gotview7135.h | 55 + include/media/keycodes/hauppauge-new.h | 76 + include/media/keycodes/iodata-bctv7e.h | 64 + include/media/keycodes/kaiomy.h | 63 + include/media/keycodes/kworld-315u.h | 59 + .../media/keycodes/kworld-plus-tv-analog.h | 75 + include/media/keycodes/manli.h | 111 + include/media/keycodes/msi-tvanywhere-plus.h | 100 + include/media/keycodes/msi-tvanywhere.h | 44 + include/media/keycodes/nebula.h | 73 + .../media/keycodes/nec-terratec-cinergy-xs.h | 81 + include/media/keycodes/norwood.h | 61 + include/media/keycodes/npgtech.h | 57 + include/media/keycodes/pctv-sedna.h | 56 + include/media/keycodes/pinnacle-color.h | 71 + include/media/keycodes/pinnacle-grey.h | 66 + include/media/keycodes/pinnacle-pctv-hd.h | 49 + include/media/keycodes/pixelview-new.h | 59 + include/media/keycodes/pixelview.h | 59 + .../media/keycodes/powercolor-real-angel.h | 57 + include/media/keycodes/proteus-2309.h | 45 + include/media/keycodes/purpletv.h | 58 + include/media/keycodes/pv951.h | 54 + include/media/keycodes/rc5-hauppauge-new.h | 79 + include/media/keycodes/rc5-tv.h | 57 + .../media/keycodes/real-audio-220-32-keys.h | 54 + include/media/keycodes/tbs-nec.h | 50 + include/media/keycodes/terratec-cinergy-xs.h | 68 + include/media/keycodes/tevii-nec.h | 65 + include/media/keycodes/tt-1500.h | 58 + include/media/keycodes/videomate-s350.h | 62 + include/media/keycodes/videomate-tv-pvr.h | 64 + include/media/keycodes/winfast-usbii-deluxe.h | 58 + include/media/keycodes/winfast.h | 78 + 67 files changed, 4122 insertions(+), 3245 deletions(-) create mode 100644 include/media/keycodes/adstech-dvb-t-pci.h create mode 100644 include/media/keycodes/apac-viewcomp.h create mode 100644 include/media/keycodes/asus-pc39.h create mode 100644 include/media/keycodes/ati-tv-wonder-hd-600.h create mode 100644 include/media/keycodes/avermedia-a16d.h create mode 100644 include/media/keycodes/avermedia-cardbus.h create mode 100644 include/media/keycodes/avermedia-dvbt.h create mode 100644 include/media/keycodes/avermedia-m135a-rm-jx.h create mode 100644 include/media/keycodes/avermedia.h create mode 100644 include/media/keycodes/avertv-303.h create mode 100644 include/media/keycodes/behold-columbus.h create mode 100644 include/media/keycodes/behold.h create mode 100644 include/media/keycodes/budget-ci-old.h create mode 100644 include/media/keycodes/cinergy-1400.h create mode 100644 include/media/keycodes/cinergy.h create mode 100644 include/media/keycodes/dm1105-nec.h create mode 100644 include/media/keycodes/dntv-live-dvb-t.h create mode 100644 include/media/keycodes/dntv-live-dvbt-pro.h create mode 100644 include/media/keycodes/em-terratec.h create mode 100644 include/media/keycodes/empty.h create mode 100644 include/media/keycodes/encore-enltv-fm53.h create mode 100644 include/media/keycodes/encore-enltv.h create mode 100644 include/media/keycodes/encore-enltv2.h create mode 100644 include/media/keycodes/evga-indtube.h create mode 100644 include/media/keycodes/eztv.h create mode 100644 include/media/keycodes/flydvb.h create mode 100644 include/media/keycodes/flyvideo.h create mode 100644 include/media/keycodes/fusionhdtv-mce.h create mode 100644 include/media/keycodes/gadmei-rm008z.h create mode 100644 include/media/keycodes/genius-tvgo-a11mce.h create mode 100644 include/media/keycodes/gotview7135.h create mode 100644 include/media/keycodes/hauppauge-new.h create mode 100644 include/media/keycodes/iodata-bctv7e.h create mode 100644 include/media/keycodes/kaiomy.h create mode 100644 include/media/keycodes/kworld-315u.h create mode 100644 include/media/keycodes/kworld-plus-tv-analog.h create mode 100644 include/media/keycodes/manli.h create mode 100644 include/media/keycodes/msi-tvanywhere-plus.h create mode 100644 include/media/keycodes/msi-tvanywhere.h create mode 100644 include/media/keycodes/nebula.h create mode 100644 include/media/keycodes/nec-terratec-cinergy-xs.h create mode 100644 include/media/keycodes/norwood.h create mode 100644 include/media/keycodes/npgtech.h create mode 100644 include/media/keycodes/pctv-sedna.h create mode 100644 include/media/keycodes/pinnacle-color.h create mode 100644 include/media/keycodes/pinnacle-grey.h create mode 100644 include/media/keycodes/pinnacle-pctv-hd.h create mode 100644 include/media/keycodes/pixelview-new.h create mode 100644 include/media/keycodes/pixelview.h create mode 100644 include/media/keycodes/powercolor-real-angel.h create mode 100644 include/media/keycodes/proteus-2309.h create mode 100644 include/media/keycodes/purpletv.h create mode 100644 include/media/keycodes/pv951.h create mode 100644 include/media/keycodes/rc5-hauppauge-new.h create mode 100644 include/media/keycodes/rc5-tv.h create mode 100644 include/media/keycodes/real-audio-220-32-keys.h create mode 100644 include/media/keycodes/tbs-nec.h create mode 100644 include/media/keycodes/terratec-cinergy-xs.h create mode 100644 include/media/keycodes/tevii-nec.h create mode 100644 include/media/keycodes/tt-1500.h create mode 100644 include/media/keycodes/videomate-s350.h create mode 100644 include/media/keycodes/videomate-tv-pvr.h create mode 100644 include/media/keycodes/winfast-usbii-deluxe.h create mode 100644 include/media/keycodes/winfast.h diff --git a/drivers/media/IR/ir-keymaps.c b/drivers/media/IR/ir-keymaps.c index 1ba928516cd2..eb2553192789 100644 --- a/drivers/media/IR/ir-keymaps.c +++ b/drivers/media/IR/ir-keymaps.c @@ -17,3178 +17,29 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define IR_KEYMAPS + /* * NOTICE FOR DEVELOPERS: * The IR mappings should be as close as possible to what's * specified at: * http://linuxtv.org/wiki/index.php/Remote_Controllers - */ -#include - -#include -#include - - -/* + * * The usage of tables with just the command part is deprecated. * All new IR keytables should contain address+command and need * to define the proper IR_TYPE (IR_TYPE_RC5/IR_TYPE_NEC). * The deprecated tables should use IR_TYPE_UNKNOWN */ +#include -/* empty keytable, can be used as placeholder for not-yet created keytables */ -static struct ir_scancode empty[] = { - { 0x2a, KEY_COFFEE }, -}; -DEFINE_LEGACY_IR_KEYTABLE(empty); - -/* Michal Majchrowicz */ -static struct ir_scancode proteus_2309[] = { - /* numeric */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x5c, KEY_POWER }, /* power */ - { 0x20, KEY_ZOOM }, /* full screen */ - { 0x0f, KEY_BACKSPACE }, /* recall */ - { 0x1b, KEY_ENTER }, /* mute */ - { 0x41, KEY_RECORD }, /* record */ - { 0x43, KEY_STOP }, /* stop */ - { 0x16, KEY_S }, - { 0x1a, KEY_POWER2 }, /* off */ - { 0x2e, KEY_RED }, - { 0x1f, KEY_CHANNELDOWN }, /* channel - */ - { 0x1c, KEY_CHANNELUP }, /* channel + */ - { 0x10, KEY_VOLUMEDOWN }, /* volume - */ - { 0x1e, KEY_VOLUMEUP }, /* volume + */ - { 0x14, KEY_F1 }, -}; -DEFINE_LEGACY_IR_KEYTABLE(proteus_2309); - -/* Matt Jesson >' */ - { 0x3a, KEY_RECORD }, /* 'capture' */ - { 0x0a, KEY_MUTE }, /* 'mute' */ - { 0x2c, KEY_RECORD }, /* 'record' */ - { 0x1c, KEY_PAUSE }, /* 'pause' */ - { 0x3c, KEY_STOP }, /* 'stop' */ - { 0x0c, KEY_PLAY }, /* 'play' */ - { 0x2e, KEY_RED }, /* 'red' */ - { 0x01, KEY_BLUE }, /* 'blue' / 'cancel' */ - { 0x0e, KEY_YELLOW }, /* 'yellow' / 'ok' */ - { 0x21, KEY_GREEN }, /* 'green' */ - { 0x11, KEY_CHANNELDOWN }, /* 'channel -' */ - { 0x31, KEY_CHANNELUP }, /* 'channel +' */ - { 0x1e, KEY_VOLUMEDOWN }, /* 'volume -' */ - { 0x3e, KEY_VOLUMEUP }, /* 'volume +' */ -}; -DEFINE_LEGACY_IR_KEYTABLE(avermedia_dvbt); - -/* - * Avermedia M135A with IR model RM-JX - * The same codes exist on both Positivo (BR) and original IR - * Mauro Carvalho Chehab - */ -static struct ir_scancode avermedia_m135a_rm_jx[] = { - { 0x0200, KEY_POWER2 }, - { 0x022e, KEY_DOT }, /* '.' */ - { 0x0201, KEY_MODE }, /* TV/FM or SOURCE */ - - { 0x0205, KEY_1 }, - { 0x0206, KEY_2 }, - { 0x0207, KEY_3 }, - { 0x0209, KEY_4 }, - { 0x020a, KEY_5 }, - { 0x020b, KEY_6 }, - { 0x020d, KEY_7 }, - { 0x020e, KEY_8 }, - { 0x020f, KEY_9 }, - { 0x0211, KEY_0 }, - - { 0x0213, KEY_RIGHT }, /* -> or L */ - { 0x0212, KEY_LEFT }, /* <- or R */ - - { 0x0217, KEY_SLEEP }, /* Capturar Imagem or Snapshot */ - { 0x0210, KEY_SHUFFLE }, /* Amostra or 16 chan prev */ - - { 0x0303, KEY_CHANNELUP }, - { 0x0302, KEY_CHANNELDOWN }, - { 0x021f, KEY_VOLUMEUP }, - { 0x021e, KEY_VOLUMEDOWN }, - { 0x020c, KEY_ENTER }, /* Full Screen */ - - { 0x0214, KEY_MUTE }, - { 0x0208, KEY_AUDIO }, - - { 0x0203, KEY_TEXT }, /* Teletext */ - { 0x0204, KEY_EPG }, - { 0x022b, KEY_TV2 }, /* TV2 or PIP */ - - { 0x021d, KEY_RED }, - { 0x021c, KEY_YELLOW }, - { 0x0301, KEY_GREEN }, - { 0x0300, KEY_BLUE }, - - { 0x021a, KEY_PLAYPAUSE }, - { 0x0219, KEY_RECORD }, - { 0x0218, KEY_PLAY }, - { 0x021b, KEY_STOP }, -}; -DEFINE_IR_KEYTABLE(avermedia_m135a_rm_jx, IR_TYPE_NEC); - -/* Oldrich Jedlicka */ -static struct ir_scancode avermedia_cardbus[] = { - { 0x00, KEY_POWER }, - { 0x01, KEY_TUNER }, /* TV/FM */ - { 0x03, KEY_TEXT }, /* Teletext */ - { 0x04, KEY_EPG }, - { 0x05, KEY_1 }, - { 0x06, KEY_2 }, - { 0x07, KEY_3 }, - { 0x08, KEY_AUDIO }, - { 0x09, KEY_4 }, - { 0x0a, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x0c, KEY_ZOOM }, /* Full screen */ - { 0x0d, KEY_7 }, - { 0x0e, KEY_8 }, - { 0x0f, KEY_9 }, - { 0x10, KEY_PAGEUP }, /* 16-CH PREV */ - { 0x11, KEY_0 }, - { 0x12, KEY_INFO }, - { 0x13, KEY_AGAIN }, /* CH RTN - channel return */ - { 0x14, KEY_MUTE }, - { 0x15, KEY_EDIT }, /* Autoscan */ - { 0x17, KEY_SAVE }, /* Screenshot */ - { 0x18, KEY_PLAYPAUSE }, - { 0x19, KEY_RECORD }, - { 0x1a, KEY_PLAY }, - { 0x1b, KEY_STOP }, - { 0x1c, KEY_FASTFORWARD }, - { 0x1d, KEY_REWIND }, - { 0x1e, KEY_VOLUMEDOWN }, - { 0x1f, KEY_VOLUMEUP }, - { 0x22, KEY_SLEEP }, /* Sleep */ - { 0x23, KEY_ZOOM }, /* Aspect */ - { 0x26, KEY_SCREEN }, /* Pos */ - { 0x27, KEY_ANGLE }, /* Size */ - { 0x28, KEY_SELECT }, /* Select */ - { 0x29, KEY_BLUE }, /* Blue/Picture */ - { 0x2a, KEY_BACKSPACE }, /* Back */ - { 0x2b, KEY_MEDIA }, /* PIP (Picture-in-picture) */ - { 0x2c, KEY_DOWN }, - { 0x2e, KEY_DOT }, - { 0x2f, KEY_TV }, /* Live TV */ - { 0x32, KEY_LEFT }, - { 0x33, KEY_CLEAR }, /* Clear */ - { 0x35, KEY_RED }, /* Red/TV */ - { 0x36, KEY_UP }, - { 0x37, KEY_HOME }, /* Home */ - { 0x39, KEY_GREEN }, /* Green/Video */ - { 0x3d, KEY_YELLOW }, /* Yellow/Music */ - { 0x3e, KEY_OK }, /* Ok */ - { 0x3f, KEY_RIGHT }, - { 0x40, KEY_NEXT }, /* Next */ - { 0x41, KEY_PREVIOUS }, /* Previous */ - { 0x42, KEY_CHANNELDOWN }, /* Channel down */ - { 0x43, KEY_CHANNELUP }, /* Channel up */ -}; -DEFINE_LEGACY_IR_KEYTABLE(avermedia_cardbus); - -/* Attila Kondoros */ -static struct ir_scancode apac_viewcomp[] = { - - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x00, KEY_0 }, - { 0x17, KEY_LAST }, /* +100 */ - { 0x0a, KEY_LIST }, /* recall */ - - - { 0x1c, KEY_TUNER }, /* TV/FM */ - { 0x15, KEY_SEARCH }, /* scan */ - { 0x12, KEY_POWER }, /* power */ - { 0x1f, KEY_VOLUMEDOWN }, /* vol up */ - { 0x1b, KEY_VOLUMEUP }, /* vol down */ - { 0x1e, KEY_CHANNELDOWN }, /* chn up */ - { 0x1a, KEY_CHANNELUP }, /* chn down */ - - { 0x11, KEY_VIDEO }, /* video */ - { 0x0f, KEY_ZOOM }, /* full screen */ - { 0x13, KEY_MUTE }, /* mute/unmute */ - { 0x10, KEY_TEXT }, /* min */ - - { 0x0d, KEY_STOP }, /* freeze */ - { 0x0e, KEY_RECORD }, /* record */ - { 0x1d, KEY_PLAYPAUSE }, /* stop */ - { 0x19, KEY_PLAY }, /* play */ - - { 0x16, KEY_GOTO }, /* osd */ - { 0x14, KEY_REFRESH }, /* default */ - { 0x0c, KEY_KPPLUS }, /* fine tune >>>> */ - { 0x18, KEY_KPMINUS }, /* fine tune <<<< */ -}; -DEFINE_LEGACY_IR_KEYTABLE(apac_viewcomp); - -/* ---------------------------------------------------------------------- */ - -static struct ir_scancode pixelview[] = { - - { 0x1e, KEY_POWER }, /* power */ - { 0x07, KEY_MEDIA }, /* source */ - { 0x1c, KEY_SEARCH }, /* scan */ - - - { 0x03, KEY_TUNER }, /* TV/FM */ - - { 0x00, KEY_RECORD }, - { 0x08, KEY_STOP }, - { 0x11, KEY_PLAY }, - - { 0x1a, KEY_PLAYPAUSE }, /* freeze */ - { 0x19, KEY_ZOOM }, /* zoom */ - { 0x0f, KEY_TEXT }, /* min */ - - { 0x01, KEY_1 }, - { 0x0b, KEY_2 }, - { 0x1b, KEY_3 }, - { 0x05, KEY_4 }, - { 0x09, KEY_5 }, - { 0x15, KEY_6 }, - { 0x06, KEY_7 }, - { 0x0a, KEY_8 }, - { 0x12, KEY_9 }, - { 0x02, KEY_0 }, - { 0x10, KEY_LAST }, /* +100 */ - { 0x13, KEY_LIST }, /* recall */ - - { 0x1f, KEY_CHANNELUP }, /* chn down */ - { 0x17, KEY_CHANNELDOWN }, /* chn up */ - { 0x16, KEY_VOLUMEUP }, /* vol down */ - { 0x14, KEY_VOLUMEDOWN }, /* vol up */ - - { 0x04, KEY_KPMINUS }, /* <<< */ - { 0x0e, KEY_SETUP }, /* function */ - { 0x0c, KEY_KPPLUS }, /* >>> */ - - { 0x0d, KEY_GOTO }, /* mts */ - { 0x1d, KEY_REFRESH }, /* reset */ - { 0x18, KEY_MUTE }, /* mute/unmute */ -}; -DEFINE_LEGACY_IR_KEYTABLE(pixelview); - -/* - Mauro Carvalho Chehab - present on PV MPEG 8000GT - */ -static struct ir_scancode pixelview_new[] = { - { 0x3c, KEY_TIME }, /* Timeshift */ - { 0x12, KEY_POWER }, - - { 0x3d, KEY_1 }, - { 0x38, KEY_2 }, - { 0x18, KEY_3 }, - { 0x35, KEY_4 }, - { 0x39, KEY_5 }, - { 0x15, KEY_6 }, - { 0x36, KEY_7 }, - { 0x3a, KEY_8 }, - { 0x1e, KEY_9 }, - { 0x3e, KEY_0 }, - - { 0x1c, KEY_AGAIN }, /* LOOP */ - { 0x3f, KEY_MEDIA }, /* Source */ - { 0x1f, KEY_LAST }, /* +100 */ - { 0x1b, KEY_MUTE }, - - { 0x17, KEY_CHANNELDOWN }, - { 0x16, KEY_CHANNELUP }, - { 0x10, KEY_VOLUMEUP }, - { 0x14, KEY_VOLUMEDOWN }, - { 0x13, KEY_ZOOM }, - - { 0x19, KEY_CAMERA }, /* SNAPSHOT */ - { 0x1a, KEY_SEARCH }, /* scan */ - - { 0x37, KEY_REWIND }, /* << */ - { 0x32, KEY_RECORD }, /* o (red) */ - { 0x33, KEY_FORWARD }, /* >> */ - { 0x11, KEY_STOP }, /* square */ - { 0x3b, KEY_PLAY }, /* > */ - { 0x30, KEY_PLAYPAUSE }, /* || */ - - { 0x31, KEY_TV }, - { 0x34, KEY_RADIO }, -}; -DEFINE_LEGACY_IR_KEYTABLE(pixelview_new); - -static struct ir_scancode nebula[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x0a, KEY_TV }, - { 0x0b, KEY_AUX }, - { 0x0c, KEY_DVD }, - { 0x0d, KEY_POWER }, - { 0x0e, KEY_MHP }, /* labelled 'Picture' */ - { 0x0f, KEY_AUDIO }, - { 0x10, KEY_INFO }, - { 0x11, KEY_F13 }, /* 16:9 */ - { 0x12, KEY_F14 }, /* 14:9 */ - { 0x13, KEY_EPG }, - { 0x14, KEY_EXIT }, - { 0x15, KEY_MENU }, - { 0x16, KEY_UP }, - { 0x17, KEY_DOWN }, - { 0x18, KEY_LEFT }, - { 0x19, KEY_RIGHT }, - { 0x1a, KEY_ENTER }, - { 0x1b, KEY_CHANNELUP }, - { 0x1c, KEY_CHANNELDOWN }, - { 0x1d, KEY_VOLUMEUP }, - { 0x1e, KEY_VOLUMEDOWN }, - { 0x1f, KEY_RED }, - { 0x20, KEY_GREEN }, - { 0x21, KEY_YELLOW }, - { 0x22, KEY_BLUE }, - { 0x23, KEY_SUBTITLE }, - { 0x24, KEY_F15 }, /* AD */ - { 0x25, KEY_TEXT }, - { 0x26, KEY_MUTE }, - { 0x27, KEY_REWIND }, - { 0x28, KEY_STOP }, - { 0x29, KEY_PLAY }, - { 0x2a, KEY_FASTFORWARD }, - { 0x2b, KEY_F16 }, /* chapter */ - { 0x2c, KEY_PAUSE }, - { 0x2d, KEY_PLAY }, - { 0x2e, KEY_RECORD }, - { 0x2f, KEY_F17 }, /* picture in picture */ - { 0x30, KEY_KPPLUS }, /* zoom in */ - { 0x31, KEY_KPMINUS }, /* zoom out */ - { 0x32, KEY_F18 }, /* capture */ - { 0x33, KEY_F19 }, /* web */ - { 0x34, KEY_EMAIL }, - { 0x35, KEY_PHONE }, - { 0x36, KEY_PC }, -}; -DEFINE_LEGACY_IR_KEYTABLE(nebula); - -/* DigitalNow DNTV Live DVB-T Remote */ -static struct ir_scancode dntv_live_dvb_t[] = { - { 0x00, KEY_ESC }, /* 'go up a level?' */ - /* Keys 0 to 9 */ - { 0x0a, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0b, KEY_TUNER }, /* tv/fm */ - { 0x0c, KEY_SEARCH }, /* scan */ - { 0x0d, KEY_STOP }, - { 0x0e, KEY_PAUSE }, - { 0x0f, KEY_LIST }, /* source */ - - { 0x10, KEY_MUTE }, - { 0x11, KEY_REWIND }, /* backward << */ - { 0x12, KEY_POWER }, - { 0x13, KEY_CAMERA }, /* snap */ - { 0x14, KEY_AUDIO }, /* stereo */ - { 0x15, KEY_CLEAR }, /* reset */ - { 0x16, KEY_PLAY }, - { 0x17, KEY_ENTER }, - { 0x18, KEY_ZOOM }, /* full screen */ - { 0x19, KEY_FASTFORWARD }, /* forward >> */ - { 0x1a, KEY_CHANNELUP }, - { 0x1b, KEY_VOLUMEUP }, - { 0x1c, KEY_INFO }, /* preview */ - { 0x1d, KEY_RECORD }, /* record */ - { 0x1e, KEY_CHANNELDOWN }, - { 0x1f, KEY_VOLUMEDOWN }, -}; -DEFINE_LEGACY_IR_KEYTABLE(dntv_live_dvb_t); - -/* ---------------------------------------------------------------------- */ - -/* IO-DATA BCTV7E Remote */ -static struct ir_scancode iodata_bctv7e[] = { - { 0x40, KEY_TV }, - { 0x20, KEY_RADIO }, /* FM */ - { 0x60, KEY_EPG }, - { 0x00, KEY_POWER }, - - /* Keys 0 to 9 */ - { 0x44, KEY_0 }, /* 10 */ - { 0x50, KEY_1 }, - { 0x30, KEY_2 }, - { 0x70, KEY_3 }, - { 0x48, KEY_4 }, - { 0x28, KEY_5 }, - { 0x68, KEY_6 }, - { 0x58, KEY_7 }, - { 0x38, KEY_8 }, - { 0x78, KEY_9 }, - - { 0x10, KEY_L }, /* Live */ - { 0x08, KEY_TIME }, /* Time Shift */ - - { 0x18, KEY_PLAYPAUSE }, /* Play */ - - { 0x24, KEY_ENTER }, /* 11 */ - { 0x64, KEY_ESC }, /* 12 */ - { 0x04, KEY_M }, /* Multi */ - - { 0x54, KEY_VIDEO }, - { 0x34, KEY_CHANNELUP }, - { 0x74, KEY_VOLUMEUP }, - { 0x14, KEY_MUTE }, - - { 0x4c, KEY_VCR }, /* SVIDEO */ - { 0x2c, KEY_CHANNELDOWN }, - { 0x6c, KEY_VOLUMEDOWN }, - { 0x0c, KEY_ZOOM }, - - { 0x5c, KEY_PAUSE }, - { 0x3c, KEY_RED }, /* || (red) */ - { 0x7c, KEY_RECORD }, /* recording */ - { 0x1c, KEY_STOP }, - - { 0x41, KEY_REWIND }, /* backward << */ - { 0x21, KEY_PLAY }, - { 0x61, KEY_FASTFORWARD }, /* forward >> */ - { 0x01, KEY_NEXT }, /* skip >| */ -}; -DEFINE_LEGACY_IR_KEYTABLE(iodata_bctv7e); - -/* ---------------------------------------------------------------------- */ - -/* ADS Tech Instant TV DVB-T PCI Remote */ -static struct ir_scancode adstech_dvb_t_pci[] = { - /* Keys 0 to 9 */ - { 0x4d, KEY_0 }, - { 0x57, KEY_1 }, - { 0x4f, KEY_2 }, - { 0x53, KEY_3 }, - { 0x56, KEY_4 }, - { 0x4e, KEY_5 }, - { 0x5e, KEY_6 }, - { 0x54, KEY_7 }, - { 0x4c, KEY_8 }, - { 0x5c, KEY_9 }, - - { 0x5b, KEY_POWER }, - { 0x5f, KEY_MUTE }, - { 0x55, KEY_GOTO }, - { 0x5d, KEY_SEARCH }, - { 0x17, KEY_EPG }, /* Guide */ - { 0x1f, KEY_MENU }, - { 0x0f, KEY_UP }, - { 0x46, KEY_DOWN }, - { 0x16, KEY_LEFT }, - { 0x1e, KEY_RIGHT }, - { 0x0e, KEY_SELECT }, /* Enter */ - { 0x5a, KEY_INFO }, - { 0x52, KEY_EXIT }, - { 0x59, KEY_PREVIOUS }, - { 0x51, KEY_NEXT }, - { 0x58, KEY_REWIND }, - { 0x50, KEY_FORWARD }, - { 0x44, KEY_PLAYPAUSE }, - { 0x07, KEY_STOP }, - { 0x1b, KEY_RECORD }, - { 0x13, KEY_TUNER }, /* Live */ - { 0x0a, KEY_A }, - { 0x12, KEY_B }, - { 0x03, KEY_PROG1 }, /* 1 */ - { 0x01, KEY_PROG2 }, /* 2 */ - { 0x00, KEY_PROG3 }, /* 3 */ - { 0x06, KEY_DVD }, - { 0x48, KEY_AUX }, /* Photo */ - { 0x40, KEY_VIDEO }, - { 0x19, KEY_AUDIO }, /* Music */ - { 0x0b, KEY_CHANNELUP }, - { 0x08, KEY_CHANNELDOWN }, - { 0x15, KEY_VOLUMEUP }, - { 0x1c, KEY_VOLUMEDOWN }, -}; -DEFINE_LEGACY_IR_KEYTABLE(adstech_dvb_t_pci); - -/* ---------------------------------------------------------------------- */ - -/* MSI TV@nywhere MASTER remote */ - -static struct ir_scancode msi_tvanywhere[] = { - /* Keys 0 to 9 */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0c, KEY_MUTE }, - { 0x0f, KEY_SCREEN }, /* Full Screen */ - { 0x10, KEY_FN }, /* Funtion */ - { 0x11, KEY_TIME }, /* Time shift */ - { 0x12, KEY_POWER }, - { 0x13, KEY_MEDIA }, /* MTS */ - { 0x14, KEY_SLOW }, - { 0x16, KEY_REWIND }, /* backward << */ - { 0x17, KEY_ENTER }, /* Return */ - { 0x18, KEY_FASTFORWARD }, /* forward >> */ - { 0x1a, KEY_CHANNELUP }, - { 0x1b, KEY_VOLUMEUP }, - { 0x1e, KEY_CHANNELDOWN }, - { 0x1f, KEY_VOLUMEDOWN }, -}; -DEFINE_LEGACY_IR_KEYTABLE(msi_tvanywhere); - -/* ---------------------------------------------------------------------- */ - -/* - Keycodes for remote on the MSI TV@nywhere Plus. The controller IC on the card - is marked "KS003". The controller is I2C at address 0x30, but does not seem - to respond to probes until a read is performed from a valid device. - I don't know why... - - Note: This remote may be of similar or identical design to the - Pixelview remote (?). The raw codes and duplicate button codes - appear to be the same. - - Henry Wong - Some changes to formatting and keycodes by Mark Schultz - -*/ - -static struct ir_scancode msi_tvanywhere_plus[] = { - -/* ---- Remote Button Layout ---- - - POWER SOURCE SCAN MUTE - TV/FM 1 2 3 - |> 4 5 6 - <| 7 8 9 - ^^UP 0 + RECALL - vvDN RECORD STOP PLAY - - MINIMIZE ZOOM - - CH+ - VOL- VOL+ - CH- - - SNAPSHOT MTS - - << FUNC >> RESET -*/ - - { 0x01, KEY_1 }, /* 1 */ - { 0x0b, KEY_2 }, /* 2 */ - { 0x1b, KEY_3 }, /* 3 */ - { 0x05, KEY_4 }, /* 4 */ - { 0x09, KEY_5 }, /* 5 */ - { 0x15, KEY_6 }, /* 6 */ - { 0x06, KEY_7 }, /* 7 */ - { 0x0a, KEY_8 }, /* 8 */ - { 0x12, KEY_9 }, /* 9 */ - { 0x02, KEY_0 }, /* 0 */ - { 0x10, KEY_KPPLUS }, /* + */ - { 0x13, KEY_AGAIN }, /* Recall */ - - { 0x1e, KEY_POWER }, /* Power */ - { 0x07, KEY_TUNER }, /* Source */ - { 0x1c, KEY_SEARCH }, /* Scan */ - { 0x18, KEY_MUTE }, /* Mute */ - - { 0x03, KEY_RADIO }, /* TV/FM */ - /* The next four keys are duplicates that appear to send the - same IR code as Ch+, Ch-, >>, and << . The raw code assigned - to them is the actual code + 0x20 - they will never be - detected as such unless some way is discovered to distinguish - these buttons from those that have the same code. */ - { 0x3f, KEY_RIGHT }, /* |> and Ch+ */ - { 0x37, KEY_LEFT }, /* <| and Ch- */ - { 0x2c, KEY_UP }, /* ^^Up and >> */ - { 0x24, KEY_DOWN }, /* vvDn and << */ - - { 0x00, KEY_RECORD }, /* Record */ - { 0x08, KEY_STOP }, /* Stop */ - { 0x11, KEY_PLAY }, /* Play */ - - { 0x0f, KEY_CLOSE }, /* Minimize */ - { 0x19, KEY_ZOOM }, /* Zoom */ - { 0x1a, KEY_CAMERA }, /* Snapshot */ - { 0x0d, KEY_LANGUAGE }, /* MTS */ - - { 0x14, KEY_VOLUMEDOWN }, /* Vol- */ - { 0x16, KEY_VOLUMEUP }, /* Vol+ */ - { 0x17, KEY_CHANNELDOWN }, /* Ch- */ - { 0x1f, KEY_CHANNELUP }, /* Ch+ */ - - { 0x04, KEY_REWIND }, /* << */ - { 0x0e, KEY_MENU }, /* Function */ - { 0x0c, KEY_FASTFORWARD }, /* >> */ - { 0x1d, KEY_RESTART }, /* Reset */ -}; -DEFINE_LEGACY_IR_KEYTABLE(msi_tvanywhere_plus); - -/* ---------------------------------------------------------------------- */ - -/* Cinergy 1400 DVB-T */ -static struct ir_scancode cinergy_1400[] = { - { 0x01, KEY_POWER }, - { 0x02, KEY_1 }, - { 0x03, KEY_2 }, - { 0x04, KEY_3 }, - { 0x05, KEY_4 }, - { 0x06, KEY_5 }, - { 0x07, KEY_6 }, - { 0x08, KEY_7 }, - { 0x09, KEY_8 }, - { 0x0a, KEY_9 }, - { 0x0c, KEY_0 }, - - { 0x0b, KEY_VIDEO }, - { 0x0d, KEY_REFRESH }, - { 0x0e, KEY_SELECT }, - { 0x0f, KEY_EPG }, - { 0x10, KEY_UP }, - { 0x11, KEY_LEFT }, - { 0x12, KEY_OK }, - { 0x13, KEY_RIGHT }, - { 0x14, KEY_DOWN }, - { 0x15, KEY_TEXT }, - { 0x16, KEY_INFO }, - - { 0x17, KEY_RED }, - { 0x18, KEY_GREEN }, - { 0x19, KEY_YELLOW }, - { 0x1a, KEY_BLUE }, - - { 0x1b, KEY_CHANNELUP }, - { 0x1c, KEY_VOLUMEUP }, - { 0x1d, KEY_MUTE }, - { 0x1e, KEY_VOLUMEDOWN }, - { 0x1f, KEY_CHANNELDOWN }, - - { 0x40, KEY_PAUSE }, - { 0x4c, KEY_PLAY }, - { 0x58, KEY_RECORD }, - { 0x54, KEY_PREVIOUS }, - { 0x48, KEY_STOP }, - { 0x5c, KEY_NEXT }, -}; -DEFINE_LEGACY_IR_KEYTABLE(cinergy_1400); - -/* ---------------------------------------------------------------------- */ - -/* AVERTV STUDIO 303 Remote */ -static struct ir_scancode avertv_303[] = { - { 0x2a, KEY_1 }, - { 0x32, KEY_2 }, - { 0x3a, KEY_3 }, - { 0x4a, KEY_4 }, - { 0x52, KEY_5 }, - { 0x5a, KEY_6 }, - { 0x6a, KEY_7 }, - { 0x72, KEY_8 }, - { 0x7a, KEY_9 }, - { 0x0e, KEY_0 }, - - { 0x02, KEY_POWER }, - { 0x22, KEY_VIDEO }, - { 0x42, KEY_AUDIO }, - { 0x62, KEY_ZOOM }, - { 0x0a, KEY_TV }, - { 0x12, KEY_CD }, - { 0x1a, KEY_TEXT }, - - { 0x16, KEY_SUBTITLE }, - { 0x1e, KEY_REWIND }, - { 0x06, KEY_PRINT }, - - { 0x2e, KEY_SEARCH }, - { 0x36, KEY_SLEEP }, - { 0x3e, KEY_SHUFFLE }, - { 0x26, KEY_MUTE }, - - { 0x4e, KEY_RECORD }, - { 0x56, KEY_PAUSE }, - { 0x5e, KEY_STOP }, - { 0x46, KEY_PLAY }, - - { 0x6e, KEY_RED }, - { 0x0b, KEY_GREEN }, - { 0x66, KEY_YELLOW }, - { 0x03, KEY_BLUE }, - - { 0x76, KEY_LEFT }, - { 0x7e, KEY_RIGHT }, - { 0x13, KEY_DOWN }, - { 0x1b, KEY_UP }, -}; -DEFINE_LEGACY_IR_KEYTABLE(avertv_303); - -/* ---------------------------------------------------------------------- */ - -/* DigitalNow DNTV Live! DVB-T Pro Remote */ -static struct ir_scancode dntv_live_dvbt_pro[] = { - { 0x16, KEY_POWER }, - { 0x5b, KEY_HOME }, - - { 0x55, KEY_TV }, /* live tv */ - { 0x58, KEY_TUNER }, /* digital Radio */ - { 0x5a, KEY_RADIO }, /* FM radio */ - { 0x59, KEY_DVD }, /* dvd menu */ - { 0x03, KEY_1 }, - { 0x01, KEY_2 }, - { 0x06, KEY_3 }, - { 0x09, KEY_4 }, - { 0x1d, KEY_5 }, - { 0x1f, KEY_6 }, - { 0x0d, KEY_7 }, - { 0x19, KEY_8 }, - { 0x1b, KEY_9 }, - { 0x0c, KEY_CANCEL }, - { 0x15, KEY_0 }, - { 0x4a, KEY_CLEAR }, - { 0x13, KEY_BACK }, - { 0x00, KEY_TAB }, - { 0x4b, KEY_UP }, - { 0x4e, KEY_LEFT }, - { 0x4f, KEY_OK }, - { 0x52, KEY_RIGHT }, - { 0x51, KEY_DOWN }, - { 0x1e, KEY_VOLUMEUP }, - { 0x0a, KEY_VOLUMEDOWN }, - { 0x02, KEY_CHANNELDOWN }, - { 0x05, KEY_CHANNELUP }, - { 0x11, KEY_RECORD }, - { 0x14, KEY_PLAY }, - { 0x4c, KEY_PAUSE }, - { 0x1a, KEY_STOP }, - { 0x40, KEY_REWIND }, - { 0x12, KEY_FASTFORWARD }, - { 0x41, KEY_PREVIOUSSONG }, /* replay |< */ - { 0x42, KEY_NEXTSONG }, /* skip >| */ - { 0x54, KEY_CAMERA }, /* capture */ - { 0x50, KEY_LANGUAGE }, /* sap */ - { 0x47, KEY_TV2 }, /* pip */ - { 0x4d, KEY_SCREEN }, - { 0x43, KEY_SUBTITLE }, - { 0x10, KEY_MUTE }, - { 0x49, KEY_AUDIO }, /* l/r */ - { 0x07, KEY_SLEEP }, - { 0x08, KEY_VIDEO }, /* a/v */ - { 0x0e, KEY_PREVIOUS }, /* recall */ - { 0x45, KEY_ZOOM }, /* zoom + */ - { 0x46, KEY_ANGLE }, /* zoom - */ - { 0x56, KEY_RED }, - { 0x57, KEY_GREEN }, - { 0x5c, KEY_YELLOW }, - { 0x5d, KEY_BLUE }, -}; -DEFINE_LEGACY_IR_KEYTABLE(dntv_live_dvbt_pro); - -static struct ir_scancode em_terratec[] = { - { 0x01, KEY_CHANNEL }, - { 0x02, KEY_SELECT }, - { 0x03, KEY_MUTE }, - { 0x04, KEY_POWER }, - { 0x05, KEY_1 }, - { 0x06, KEY_2 }, - { 0x07, KEY_3 }, - { 0x08, KEY_CHANNELUP }, - { 0x09, KEY_4 }, - { 0x0a, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x0c, KEY_CHANNELDOWN }, - { 0x0d, KEY_7 }, - { 0x0e, KEY_8 }, - { 0x0f, KEY_9 }, - { 0x10, KEY_VOLUMEUP }, - { 0x11, KEY_0 }, - { 0x12, KEY_MENU }, - { 0x13, KEY_PRINT }, - { 0x14, KEY_VOLUMEDOWN }, - { 0x16, KEY_PAUSE }, - { 0x18, KEY_RECORD }, - { 0x19, KEY_REWIND }, - { 0x1a, KEY_PLAY }, - { 0x1b, KEY_FORWARD }, - { 0x1c, KEY_BACKSPACE }, - { 0x1e, KEY_STOP }, - { 0x40, KEY_ZOOM }, -}; -DEFINE_LEGACY_IR_KEYTABLE(em_terratec); - -static struct ir_scancode pinnacle_grey[] = { - { 0x3a, KEY_0 }, - { 0x31, KEY_1 }, - { 0x32, KEY_2 }, - { 0x33, KEY_3 }, - { 0x34, KEY_4 }, - { 0x35, KEY_5 }, - { 0x36, KEY_6 }, - { 0x37, KEY_7 }, - { 0x38, KEY_8 }, - { 0x39, KEY_9 }, - - { 0x2f, KEY_POWER }, - - { 0x2e, KEY_P }, - { 0x1f, KEY_L }, - { 0x2b, KEY_I }, - - { 0x2d, KEY_SCREEN }, - { 0x1e, KEY_ZOOM }, - { 0x1b, KEY_VOLUMEUP }, - { 0x0f, KEY_VOLUMEDOWN }, - { 0x17, KEY_CHANNELUP }, - { 0x1c, KEY_CHANNELDOWN }, - { 0x25, KEY_INFO }, - - { 0x3c, KEY_MUTE }, - - { 0x3d, KEY_LEFT }, - { 0x3b, KEY_RIGHT }, - - { 0x3f, KEY_UP }, - { 0x3e, KEY_DOWN }, - { 0x1a, KEY_ENTER }, - - { 0x1d, KEY_MENU }, - { 0x19, KEY_AGAIN }, - { 0x16, KEY_PREVIOUSSONG }, - { 0x13, KEY_NEXTSONG }, - { 0x15, KEY_PAUSE }, - { 0x0e, KEY_REWIND }, - { 0x0d, KEY_PLAY }, - { 0x0b, KEY_STOP }, - { 0x07, KEY_FORWARD }, - { 0x27, KEY_RECORD }, - { 0x26, KEY_TUNER }, - { 0x29, KEY_TEXT }, - { 0x2a, KEY_MEDIA }, - { 0x18, KEY_EPG }, -}; -DEFINE_LEGACY_IR_KEYTABLE(pinnacle_grey); - -static struct ir_scancode flyvideo[] = { - { 0x0f, KEY_0 }, - { 0x03, KEY_1 }, - { 0x04, KEY_2 }, - { 0x05, KEY_3 }, - { 0x07, KEY_4 }, - { 0x08, KEY_5 }, - { 0x09, KEY_6 }, - { 0x0b, KEY_7 }, - { 0x0c, KEY_8 }, - { 0x0d, KEY_9 }, - - { 0x0e, KEY_MODE }, /* Air/Cable */ - { 0x11, KEY_VIDEO }, /* Video */ - { 0x15, KEY_AUDIO }, /* Audio */ - { 0x00, KEY_POWER }, /* Power */ - { 0x18, KEY_TUNER }, /* AV Source */ - { 0x02, KEY_ZOOM }, /* Fullscreen */ - { 0x1a, KEY_LANGUAGE }, /* Stereo */ - { 0x1b, KEY_MUTE }, /* Mute */ - { 0x14, KEY_VOLUMEUP }, /* Volume + */ - { 0x17, KEY_VOLUMEDOWN },/* Volume - */ - { 0x12, KEY_CHANNELUP },/* Channel + */ - { 0x13, KEY_CHANNELDOWN },/* Channel - */ - { 0x06, KEY_AGAIN }, /* Recall */ - { 0x10, KEY_ENTER }, /* Enter */ - - { 0x19, KEY_BACK }, /* Rewind ( <<< ) */ - { 0x1f, KEY_FORWARD }, /* Forward ( >>> ) */ - { 0x0a, KEY_ANGLE }, /* no label, may be used as the PAUSE button */ -}; -DEFINE_LEGACY_IR_KEYTABLE(flyvideo); - -static struct ir_scancode flydvb[] = { - { 0x01, KEY_ZOOM }, /* Full Screen */ - { 0x00, KEY_POWER }, /* Power */ - - { 0x03, KEY_1 }, - { 0x04, KEY_2 }, - { 0x05, KEY_3 }, - { 0x07, KEY_4 }, - { 0x08, KEY_5 }, - { 0x09, KEY_6 }, - { 0x0b, KEY_7 }, - { 0x0c, KEY_8 }, - { 0x0d, KEY_9 }, - { 0x06, KEY_AGAIN }, /* Recall */ - { 0x0f, KEY_0 }, - { 0x10, KEY_MUTE }, /* Mute */ - { 0x02, KEY_RADIO }, /* TV/Radio */ - { 0x1b, KEY_LANGUAGE }, /* SAP (Second Audio Program) */ - - { 0x14, KEY_VOLUMEUP }, /* VOL+ */ - { 0x17, KEY_VOLUMEDOWN }, /* VOL- */ - { 0x12, KEY_CHANNELUP }, /* CH+ */ - { 0x13, KEY_CHANNELDOWN }, /* CH- */ - { 0x1d, KEY_ENTER }, /* Enter */ - - { 0x1a, KEY_MODE }, /* PIP */ - { 0x18, KEY_TUNER }, /* Source */ - - { 0x1e, KEY_RECORD }, /* Record/Pause */ - { 0x15, KEY_ANGLE }, /* Swap (no label on key) */ - { 0x1c, KEY_PAUSE }, /* Timeshift/Pause */ - { 0x19, KEY_BACK }, /* Rewind << */ - { 0x0a, KEY_PLAYPAUSE }, /* Play/Pause */ - { 0x1f, KEY_FORWARD }, /* Forward >> */ - { 0x16, KEY_PREVIOUS }, /* Back |<< */ - { 0x11, KEY_STOP }, /* Stop */ - { 0x0e, KEY_NEXT }, /* End >>| */ -}; -DEFINE_LEGACY_IR_KEYTABLE(flydvb); - -static struct ir_scancode cinergy[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0a, KEY_POWER }, - { 0x0b, KEY_PROG1 }, /* app */ - { 0x0c, KEY_ZOOM }, /* zoom/fullscreen */ - { 0x0d, KEY_CHANNELUP }, /* channel */ - { 0x0e, KEY_CHANNELDOWN }, /* channel- */ - { 0x0f, KEY_VOLUMEUP }, - { 0x10, KEY_VOLUMEDOWN }, - { 0x11, KEY_TUNER }, /* AV */ - { 0x12, KEY_NUMLOCK }, /* -/-- */ - { 0x13, KEY_AUDIO }, /* audio */ - { 0x14, KEY_MUTE }, - { 0x15, KEY_UP }, - { 0x16, KEY_DOWN }, - { 0x17, KEY_LEFT }, - { 0x18, KEY_RIGHT }, - { 0x19, BTN_LEFT, }, - { 0x1a, BTN_RIGHT, }, - { 0x1b, KEY_WWW }, /* text */ - { 0x1c, KEY_REWIND }, - { 0x1d, KEY_FORWARD }, - { 0x1e, KEY_RECORD }, - { 0x1f, KEY_PLAY }, - { 0x20, KEY_PREVIOUSSONG }, - { 0x21, KEY_NEXTSONG }, - { 0x22, KEY_PAUSE }, - { 0x23, KEY_STOP }, -}; -DEFINE_LEGACY_IR_KEYTABLE(cinergy); - -/* Alfons Geser - * updates from Job D. R. Borges */ -static struct ir_scancode eztv[] = { - { 0x12, KEY_POWER }, - { 0x01, KEY_TV }, /* DVR */ - { 0x15, KEY_DVD }, /* DVD */ - { 0x17, KEY_AUDIO }, /* music */ - /* DVR mode / DVD mode / music mode */ - - { 0x1b, KEY_MUTE }, /* mute */ - { 0x02, KEY_LANGUAGE }, /* MTS/SAP / audio / autoseek */ - { 0x1e, KEY_SUBTITLE }, /* closed captioning / subtitle / seek */ - { 0x16, KEY_ZOOM }, /* full screen */ - { 0x1c, KEY_VIDEO }, /* video source / eject / delall */ - { 0x1d, KEY_RESTART }, /* playback / angle / del */ - { 0x2f, KEY_SEARCH }, /* scan / menu / playlist */ - { 0x30, KEY_CHANNEL }, /* CH surfing / bookmark / memo */ - - { 0x31, KEY_HELP }, /* help */ - { 0x32, KEY_MODE }, /* num/memo */ - { 0x33, KEY_ESC }, /* cancel */ - - { 0x0c, KEY_UP }, /* up */ - { 0x10, KEY_DOWN }, /* down */ - { 0x08, KEY_LEFT }, /* left */ - { 0x04, KEY_RIGHT }, /* right */ - { 0x03, KEY_SELECT }, /* select */ - - { 0x1f, KEY_REWIND }, /* rewind */ - { 0x20, KEY_PLAYPAUSE },/* play/pause */ - { 0x29, KEY_FORWARD }, /* forward */ - { 0x14, KEY_AGAIN }, /* repeat */ - { 0x2b, KEY_RECORD }, /* recording */ - { 0x2c, KEY_STOP }, /* stop */ - { 0x2d, KEY_PLAY }, /* play */ - { 0x2e, KEY_CAMERA }, /* snapshot / shuffle */ - - { 0x00, KEY_0 }, - { 0x05, KEY_1 }, - { 0x06, KEY_2 }, - { 0x07, KEY_3 }, - { 0x09, KEY_4 }, - { 0x0a, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x0d, KEY_7 }, - { 0x0e, KEY_8 }, - { 0x0f, KEY_9 }, - - { 0x2a, KEY_VOLUMEUP }, - { 0x11, KEY_VOLUMEDOWN }, - { 0x18, KEY_CHANNELUP },/* CH.tracking up */ - { 0x19, KEY_CHANNELDOWN },/* CH.tracking down */ - - { 0x13, KEY_ENTER }, /* enter */ - { 0x21, KEY_DOT }, /* . (decimal dot) */ -}; -DEFINE_LEGACY_IR_KEYTABLE(eztv); - -/* Alex Hermann */ -static struct ir_scancode avermedia[] = { - { 0x28, KEY_1 }, - { 0x18, KEY_2 }, - { 0x38, KEY_3 }, - { 0x24, KEY_4 }, - { 0x14, KEY_5 }, - { 0x34, KEY_6 }, - { 0x2c, KEY_7 }, - { 0x1c, KEY_8 }, - { 0x3c, KEY_9 }, - { 0x22, KEY_0 }, - - { 0x20, KEY_TV }, /* TV/FM */ - { 0x10, KEY_CD }, /* CD */ - { 0x30, KEY_TEXT }, /* TELETEXT */ - { 0x00, KEY_POWER }, /* POWER */ - - { 0x08, KEY_VIDEO }, /* VIDEO */ - { 0x04, KEY_AUDIO }, /* AUDIO */ - { 0x0c, KEY_ZOOM }, /* FULL SCREEN */ - - { 0x12, KEY_SUBTITLE }, /* DISPLAY */ - { 0x32, KEY_REWIND }, /* LOOP */ - { 0x02, KEY_PRINT }, /* PREVIEW */ - - { 0x2a, KEY_SEARCH }, /* AUTOSCAN */ - { 0x1a, KEY_SLEEP }, /* FREEZE */ - { 0x3a, KEY_CAMERA }, /* SNAPSHOT */ - { 0x0a, KEY_MUTE }, /* MUTE */ - - { 0x26, KEY_RECORD }, /* RECORD */ - { 0x16, KEY_PAUSE }, /* PAUSE */ - { 0x36, KEY_STOP }, /* STOP */ - { 0x06, KEY_PLAY }, /* PLAY */ - - { 0x2e, KEY_RED }, /* RED */ - { 0x21, KEY_GREEN }, /* GREEN */ - { 0x0e, KEY_YELLOW }, /* YELLOW */ - { 0x01, KEY_BLUE }, /* BLUE */ - - { 0x1e, KEY_VOLUMEDOWN }, /* VOLUME- */ - { 0x3e, KEY_VOLUMEUP }, /* VOLUME+ */ - { 0x11, KEY_CHANNELDOWN }, /* CHANNEL/PAGE- */ - { 0x31, KEY_CHANNELUP } /* CHANNEL/PAGE+ */ -}; -DEFINE_LEGACY_IR_KEYTABLE(avermedia); - -static struct ir_scancode videomate_tv_pvr[] = { - { 0x14, KEY_MUTE }, - { 0x24, KEY_ZOOM }, - - { 0x01, KEY_DVD }, - { 0x23, KEY_RADIO }, - { 0x00, KEY_TV }, - - { 0x0a, KEY_REWIND }, - { 0x08, KEY_PLAYPAUSE }, - { 0x0f, KEY_FORWARD }, - - { 0x02, KEY_PREVIOUS }, - { 0x07, KEY_STOP }, - { 0x06, KEY_NEXT }, - - { 0x0c, KEY_UP }, - { 0x0e, KEY_DOWN }, - { 0x0b, KEY_LEFT }, - { 0x0d, KEY_RIGHT }, - { 0x11, KEY_OK }, - - { 0x03, KEY_MENU }, - { 0x09, KEY_SETUP }, - { 0x05, KEY_VIDEO }, - { 0x22, KEY_CHANNEL }, - - { 0x12, KEY_VOLUMEUP }, - { 0x15, KEY_VOLUMEDOWN }, - { 0x10, KEY_CHANNELUP }, - { 0x13, KEY_CHANNELDOWN }, - - { 0x04, KEY_RECORD }, - - { 0x16, KEY_1 }, - { 0x17, KEY_2 }, - { 0x18, KEY_3 }, - { 0x19, KEY_4 }, - { 0x1a, KEY_5 }, - { 0x1b, KEY_6 }, - { 0x1c, KEY_7 }, - { 0x1d, KEY_8 }, - { 0x1e, KEY_9 }, - { 0x1f, KEY_0 }, - - { 0x20, KEY_LANGUAGE }, - { 0x21, KEY_SLEEP }, -}; -DEFINE_LEGACY_IR_KEYTABLE(videomate_tv_pvr); - -/* Michael Tokarev - http://www.corpit.ru/mjt/beholdTV/remote_control.jpg - keytable is used by MANLI MTV00[0x0c] and BeholdTV 40[13] at - least, and probably other cards too. - The "ascii-art picture" below (in comments, first row - is the keycode in hex, and subsequent row(s) shows - the button labels (several variants when appropriate) - helps to descide which keycodes to assign to the buttons. - */ -static struct ir_scancode manli[] = { - - /* 0x1c 0x12 * - * FUNCTION POWER * - * FM (|) * - * */ - { 0x1c, KEY_RADIO }, /*XXX*/ - { 0x12, KEY_POWER }, - - /* 0x01 0x02 0x03 * - * 1 2 3 * - * * - * 0x04 0x05 0x06 * - * 4 5 6 * - * * - * 0x07 0x08 0x09 * - * 7 8 9 * - * */ - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - /* 0x0a 0x00 0x17 * - * RECALL 0 +100 * - * PLUS * - * */ - { 0x0a, KEY_AGAIN }, /*XXX KEY_REWIND? */ - { 0x00, KEY_0 }, - { 0x17, KEY_DIGITS }, /*XXX*/ - - /* 0x14 0x10 * - * MENU INFO * - * OSD */ - { 0x14, KEY_MENU }, - { 0x10, KEY_INFO }, - - /* 0x0b * - * Up * - * * - * 0x18 0x16 0x0c * - * Left Ok Right * - * * - * 0x015 * - * Down * - * */ - { 0x0b, KEY_UP }, - { 0x18, KEY_LEFT }, - { 0x16, KEY_OK }, /*XXX KEY_SELECT? KEY_ENTER? */ - { 0x0c, KEY_RIGHT }, - { 0x15, KEY_DOWN }, - - /* 0x11 0x0d * - * TV/AV MODE * - * SOURCE STEREO * - * */ - { 0x11, KEY_TV }, /*XXX*/ - { 0x0d, KEY_MODE }, /*XXX there's no KEY_STEREO */ - - /* 0x0f 0x1b 0x1a * - * AUDIO Vol+ Chan+ * - * TIMESHIFT??? * - * * - * 0x0e 0x1f 0x1e * - * SLEEP Vol- Chan- * - * */ - { 0x0f, KEY_AUDIO }, - { 0x1b, KEY_VOLUMEUP }, - { 0x1a, KEY_CHANNELUP }, - { 0x0e, KEY_TIME }, - { 0x1f, KEY_VOLUMEDOWN }, - { 0x1e, KEY_CHANNELDOWN }, - - /* 0x13 0x19 * - * MUTE SNAPSHOT* - * */ - { 0x13, KEY_MUTE }, - { 0x19, KEY_CAMERA }, - - /* 0x1d unused ? */ -}; -DEFINE_LEGACY_IR_KEYTABLE(manli); - -/* Mike Baikov */ -static struct ir_scancode gotview7135[] = { - - { 0x11, KEY_POWER }, - { 0x35, KEY_TV }, - { 0x1b, KEY_0 }, - { 0x29, KEY_1 }, - { 0x19, KEY_2 }, - { 0x39, KEY_3 }, - { 0x1f, KEY_4 }, - { 0x2c, KEY_5 }, - { 0x21, KEY_6 }, - { 0x24, KEY_7 }, - { 0x18, KEY_8 }, - { 0x2b, KEY_9 }, - { 0x3b, KEY_AGAIN }, /* LOOP */ - { 0x06, KEY_AUDIO }, - { 0x31, KEY_PRINT }, /* PREVIEW */ - { 0x3e, KEY_VIDEO }, - { 0x10, KEY_CHANNELUP }, - { 0x20, KEY_CHANNELDOWN }, - { 0x0c, KEY_VOLUMEDOWN }, - { 0x28, KEY_VOLUMEUP }, - { 0x08, KEY_MUTE }, - { 0x26, KEY_SEARCH }, /* SCAN */ - { 0x3f, KEY_CAMERA }, /* SNAPSHOT */ - { 0x12, KEY_RECORD }, - { 0x32, KEY_STOP }, - { 0x3c, KEY_PLAY }, - { 0x1d, KEY_REWIND }, - { 0x2d, KEY_PAUSE }, - { 0x0d, KEY_FORWARD }, - { 0x05, KEY_ZOOM }, /*FULL*/ - - { 0x2a, KEY_F21 }, /* LIVE TIMESHIFT */ - { 0x0e, KEY_F22 }, /* MIN TIMESHIFT */ - { 0x1e, KEY_TIME }, /* TIMESHIFT */ - { 0x38, KEY_F24 }, /* NORMAL TIMESHIFT */ -}; -DEFINE_LEGACY_IR_KEYTABLE(gotview7135); - -static struct ir_scancode purpletv[] = { - { 0x03, KEY_POWER }, - { 0x6f, KEY_MUTE }, - { 0x10, KEY_BACKSPACE }, /* Recall */ - - { 0x11, KEY_0 }, - { 0x04, KEY_1 }, - { 0x05, KEY_2 }, - { 0x06, KEY_3 }, - { 0x08, KEY_4 }, - { 0x09, KEY_5 }, - { 0x0a, KEY_6 }, - { 0x0c, KEY_7 }, - { 0x0d, KEY_8 }, - { 0x0e, KEY_9 }, - { 0x12, KEY_DOT }, /* 100+ */ - - { 0x07, KEY_VOLUMEUP }, - { 0x0b, KEY_VOLUMEDOWN }, - { 0x1a, KEY_KPPLUS }, - { 0x18, KEY_KPMINUS }, - { 0x15, KEY_UP }, - { 0x1d, KEY_DOWN }, - { 0x0f, KEY_CHANNELUP }, - { 0x13, KEY_CHANNELDOWN }, - { 0x48, KEY_ZOOM }, - - { 0x1b, KEY_VIDEO }, /* Video source */ - { 0x1f, KEY_CAMERA }, /* Snapshot */ - { 0x49, KEY_LANGUAGE }, /* MTS Select */ - { 0x19, KEY_SEARCH }, /* Auto Scan */ - - { 0x4b, KEY_RECORD }, - { 0x46, KEY_PLAY }, - { 0x45, KEY_PAUSE }, /* Pause */ - { 0x44, KEY_STOP }, - { 0x43, KEY_TIME }, /* Time Shift */ - { 0x17, KEY_CHANNEL }, /* SURF CH */ - { 0x40, KEY_FORWARD }, /* Forward ? */ - { 0x42, KEY_REWIND }, /* Backward ? */ - -}; -DEFINE_LEGACY_IR_KEYTABLE(purpletv); - -/* Mapping for the 28 key remote control as seen at - http://www.sednacomputer.com/photo/cardbus-tv.jpg - Pavel Mihaylov - Also for the remote bundled with Kozumi KTV-01C card */ -static struct ir_scancode pctv_sedna[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0a, KEY_AGAIN }, /* Recall */ - { 0x0b, KEY_CHANNELUP }, - { 0x0c, KEY_VOLUMEUP }, - { 0x0d, KEY_MODE }, /* Stereo */ - { 0x0e, KEY_STOP }, - { 0x0f, KEY_PREVIOUSSONG }, - { 0x10, KEY_ZOOM }, - { 0x11, KEY_TUNER }, /* Source */ - { 0x12, KEY_POWER }, - { 0x13, KEY_MUTE }, - { 0x15, KEY_CHANNELDOWN }, - { 0x18, KEY_VOLUMEDOWN }, - { 0x19, KEY_CAMERA }, /* Snapshot */ - { 0x1a, KEY_NEXTSONG }, - { 0x1b, KEY_TIME }, /* Time Shift */ - { 0x1c, KEY_RADIO }, /* FM Radio */ - { 0x1d, KEY_RECORD }, - { 0x1e, KEY_PAUSE }, - /* additional codes for Kozumi's remote */ - { 0x14, KEY_INFO }, /* OSD */ - { 0x16, KEY_OK }, /* OK */ - { 0x17, KEY_DIGITS }, /* Plus */ - { 0x1f, KEY_PLAY }, /* Play */ -}; -DEFINE_LEGACY_IR_KEYTABLE(pctv_sedna); - -/* Mark Phalan */ -static struct ir_scancode pv951[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x12, KEY_POWER }, - { 0x10, KEY_MUTE }, - { 0x1f, KEY_VOLUMEDOWN }, - { 0x1b, KEY_VOLUMEUP }, - { 0x1a, KEY_CHANNELUP }, - { 0x1e, KEY_CHANNELDOWN }, - { 0x0e, KEY_PAGEUP }, - { 0x1d, KEY_PAGEDOWN }, - { 0x13, KEY_SOUND }, - - { 0x18, KEY_KPPLUSMINUS }, /* CH +/- */ - { 0x16, KEY_SUBTITLE }, /* CC */ - { 0x0d, KEY_TEXT }, /* TTX */ - { 0x0b, KEY_TV }, /* AIR/CBL */ - { 0x11, KEY_PC }, /* PC/TV */ - { 0x17, KEY_OK }, /* CH RTN */ - { 0x19, KEY_MODE }, /* FUNC */ - { 0x0c, KEY_SEARCH }, /* AUTOSCAN */ - - /* Not sure what to do with these ones! */ - { 0x0f, KEY_SELECT }, /* SOURCE */ - { 0x0a, KEY_KPPLUS }, /* +100 */ - { 0x14, KEY_EQUAL }, /* SYNC */ - { 0x1c, KEY_MEDIA }, /* PC/TV */ -}; -DEFINE_LEGACY_IR_KEYTABLE(pv951); - -/* generic RC5 keytable */ -/* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ -/* used by old (black) Hauppauge remotes */ -static struct ir_scancode rc5_tv[] = { - /* Keys 0 to 9 */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0b, KEY_CHANNEL }, /* channel / program (japan: 11) */ - { 0x0c, KEY_POWER }, /* standby */ - { 0x0d, KEY_MUTE }, /* mute / demute */ - { 0x0f, KEY_TV }, /* display */ - { 0x10, KEY_VOLUMEUP }, - { 0x11, KEY_VOLUMEDOWN }, - { 0x12, KEY_BRIGHTNESSUP }, - { 0x13, KEY_BRIGHTNESSDOWN }, - { 0x1e, KEY_SEARCH }, /* search + */ - { 0x20, KEY_CHANNELUP }, /* channel / program + */ - { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x22, KEY_CHANNEL }, /* alt / channel */ - { 0x23, KEY_LANGUAGE }, /* 1st / 2nd language */ - { 0x26, KEY_SLEEP }, /* sleeptimer */ - { 0x2e, KEY_MENU }, /* 2nd controls (USA: menu) */ - { 0x30, KEY_PAUSE }, - { 0x32, KEY_REWIND }, - { 0x33, KEY_GOTO }, - { 0x35, KEY_PLAY }, - { 0x36, KEY_STOP }, - { 0x37, KEY_RECORD }, /* recording */ - { 0x3c, KEY_TEXT }, /* teletext submode (Japan: 12) */ - { 0x3d, KEY_SUSPEND }, /* system standby */ - -}; -DEFINE_LEGACY_IR_KEYTABLE(rc5_tv); - -/* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ -static struct ir_scancode winfast[] = { - /* Keys 0 to 9 */ - { 0x12, KEY_0 }, - { 0x05, KEY_1 }, - { 0x06, KEY_2 }, - { 0x07, KEY_3 }, - { 0x09, KEY_4 }, - { 0x0a, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x0d, KEY_7 }, - { 0x0e, KEY_8 }, - { 0x0f, KEY_9 }, - - { 0x00, KEY_POWER }, - { 0x1b, KEY_AUDIO }, /* Audio Source */ - { 0x02, KEY_TUNER }, /* TV/FM, not on Y0400052 */ - { 0x1e, KEY_VIDEO }, /* Video Source */ - { 0x16, KEY_INFO }, /* Display information */ - { 0x04, KEY_VOLUMEUP }, - { 0x08, KEY_VOLUMEDOWN }, - { 0x0c, KEY_CHANNELUP }, - { 0x10, KEY_CHANNELDOWN }, - { 0x03, KEY_ZOOM }, /* fullscreen */ - { 0x1f, KEY_TEXT }, /* closed caption/teletext */ - { 0x20, KEY_SLEEP }, - { 0x29, KEY_CLEAR }, /* boss key */ - { 0x14, KEY_MUTE }, - { 0x2b, KEY_RED }, - { 0x2c, KEY_GREEN }, - { 0x2d, KEY_YELLOW }, - { 0x2e, KEY_BLUE }, - { 0x18, KEY_KPPLUS }, /* fine tune + , not on Y040052 */ - { 0x19, KEY_KPMINUS }, /* fine tune - , not on Y040052 */ - { 0x2a, KEY_MEDIA }, /* PIP (Picture in picture */ - { 0x21, KEY_DOT }, - { 0x13, KEY_ENTER }, - { 0x11, KEY_LAST }, /* Recall (last channel */ - { 0x22, KEY_PREVIOUS }, - { 0x23, KEY_PLAYPAUSE }, - { 0x24, KEY_NEXT }, - { 0x25, KEY_TIME }, /* Time Shifting */ - { 0x26, KEY_STOP }, - { 0x27, KEY_RECORD }, - { 0x28, KEY_SAVE }, /* Screenshot */ - { 0x2f, KEY_MENU }, - { 0x30, KEY_CANCEL }, - { 0x31, KEY_CHANNEL }, /* Channel Surf */ - { 0x32, KEY_SUBTITLE }, - { 0x33, KEY_LANGUAGE }, - { 0x34, KEY_REWIND }, - { 0x35, KEY_FASTFORWARD }, - { 0x36, KEY_TV }, - { 0x37, KEY_RADIO }, /* FM */ - { 0x38, KEY_DVD }, - - { 0x1a, KEY_MODE}, /* change to MCE mode on Y04G0051 */ - { 0x3e, KEY_F21 }, /* MCE +VOL, on Y04G0033 */ - { 0x3a, KEY_F22 }, /* MCE -VOL, on Y04G0033 */ - { 0x3b, KEY_F23 }, /* MCE +CH, on Y04G0033 */ - { 0x3f, KEY_F24 } /* MCE -CH, on Y04G0033 */ -}; -DEFINE_LEGACY_IR_KEYTABLE(winfast); - -static struct ir_scancode pinnacle_color[] = { - { 0x59, KEY_MUTE }, - { 0x4a, KEY_POWER }, - - { 0x18, KEY_TEXT }, - { 0x26, KEY_TV }, - { 0x3d, KEY_PRINT }, - - { 0x48, KEY_RED }, - { 0x04, KEY_GREEN }, - { 0x11, KEY_YELLOW }, - { 0x00, KEY_BLUE }, - - { 0x2d, KEY_VOLUMEUP }, - { 0x1e, KEY_VOLUMEDOWN }, - - { 0x49, KEY_MENU }, - - { 0x16, KEY_CHANNELUP }, - { 0x17, KEY_CHANNELDOWN }, - - { 0x20, KEY_UP }, - { 0x21, KEY_DOWN }, - { 0x22, KEY_LEFT }, - { 0x23, KEY_RIGHT }, - { 0x0d, KEY_SELECT }, - - { 0x08, KEY_BACK }, - { 0x07, KEY_REFRESH }, - - { 0x2f, KEY_ZOOM }, - { 0x29, KEY_RECORD }, - - { 0x4b, KEY_PAUSE }, - { 0x4d, KEY_REWIND }, - { 0x2e, KEY_PLAY }, - { 0x4e, KEY_FORWARD }, - { 0x53, KEY_PREVIOUS }, - { 0x4c, KEY_STOP }, - { 0x54, KEY_NEXT }, - - { 0x69, KEY_0 }, - { 0x6a, KEY_1 }, - { 0x6b, KEY_2 }, - { 0x6c, KEY_3 }, - { 0x6d, KEY_4 }, - { 0x6e, KEY_5 }, - { 0x6f, KEY_6 }, - { 0x70, KEY_7 }, - { 0x71, KEY_8 }, - { 0x72, KEY_9 }, - - { 0x74, KEY_CHANNEL }, - { 0x0a, KEY_BACKSPACE }, -}; -DEFINE_LEGACY_IR_KEYTABLE(pinnacle_color); - -/* Hauppauge: the newer, gray remotes (seems there are multiple - * slightly different versions), shipped with cx88+ivtv cards. - * almost rc5 coding, but some non-standard keys */ -static struct ir_scancode hauppauge_new[] = { - /* Keys 0 to 9 */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0a, KEY_TEXT }, /* keypad asterisk as well */ - { 0x0b, KEY_RED }, /* red button */ - { 0x0c, KEY_RADIO }, - { 0x0d, KEY_MENU }, - { 0x0e, KEY_SUBTITLE }, /* also the # key */ - { 0x0f, KEY_MUTE }, - { 0x10, KEY_VOLUMEUP }, - { 0x11, KEY_VOLUMEDOWN }, - { 0x12, KEY_PREVIOUS }, /* previous channel */ - { 0x14, KEY_UP }, - { 0x15, KEY_DOWN }, - { 0x16, KEY_LEFT }, - { 0x17, KEY_RIGHT }, - { 0x18, KEY_VIDEO }, /* Videos */ - { 0x19, KEY_AUDIO }, /* Music */ - /* 0x1a: Pictures - presume this means - "Multimedia Home Platform" - - no "PICTURES" key in input.h - */ - { 0x1a, KEY_MHP }, - - { 0x1b, KEY_EPG }, /* Guide */ - { 0x1c, KEY_TV }, - { 0x1e, KEY_NEXTSONG }, /* skip >| */ - { 0x1f, KEY_EXIT }, /* back/exit */ - { 0x20, KEY_CHANNELUP }, /* channel / program + */ - { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x22, KEY_CHANNEL }, /* source (old black remote) */ - { 0x24, KEY_PREVIOUSSONG }, /* replay |< */ - { 0x25, KEY_ENTER }, /* OK */ - { 0x26, KEY_SLEEP }, /* minimize (old black remote) */ - { 0x29, KEY_BLUE }, /* blue key */ - { 0x2e, KEY_GREEN }, /* green button */ - { 0x30, KEY_PAUSE }, /* pause */ - { 0x32, KEY_REWIND }, /* backward << */ - { 0x34, KEY_FASTFORWARD }, /* forward >> */ - { 0x35, KEY_PLAY }, - { 0x36, KEY_STOP }, - { 0x37, KEY_RECORD }, /* recording */ - { 0x38, KEY_YELLOW }, /* yellow key */ - { 0x3b, KEY_SELECT }, /* top right button */ - { 0x3c, KEY_ZOOM }, /* full */ - { 0x3d, KEY_POWER }, /* system power (green button) */ -}; -DEFINE_LEGACY_IR_KEYTABLE(hauppauge_new); - -static struct ir_scancode npgtech[] = { - { 0x1d, KEY_SWITCHVIDEOMODE }, /* switch inputs */ - { 0x2a, KEY_FRONT }, - - { 0x3e, KEY_1 }, - { 0x02, KEY_2 }, - { 0x06, KEY_3 }, - { 0x0a, KEY_4 }, - { 0x0e, KEY_5 }, - { 0x12, KEY_6 }, - { 0x16, KEY_7 }, - { 0x1a, KEY_8 }, - { 0x1e, KEY_9 }, - { 0x3a, KEY_0 }, - { 0x22, KEY_NUMLOCK }, /* -/-- */ - { 0x20, KEY_REFRESH }, - - { 0x03, KEY_BRIGHTNESSDOWN }, - { 0x28, KEY_AUDIO }, - { 0x3c, KEY_CHANNELUP }, - { 0x3f, KEY_VOLUMEDOWN }, - { 0x2e, KEY_MUTE }, - { 0x3b, KEY_VOLUMEUP }, - { 0x00, KEY_CHANNELDOWN }, - { 0x07, KEY_BRIGHTNESSUP }, - { 0x2c, KEY_TEXT }, - - { 0x37, KEY_RECORD }, - { 0x17, KEY_PLAY }, - { 0x13, KEY_PAUSE }, - { 0x26, KEY_STOP }, - { 0x18, KEY_FASTFORWARD }, - { 0x14, KEY_REWIND }, - { 0x33, KEY_ZOOM }, - { 0x32, KEY_KEYBOARD }, - { 0x30, KEY_GOTO }, /* Pointing arrow */ - { 0x36, KEY_MACRO }, /* Maximize/Minimize (yellow) */ - { 0x0b, KEY_RADIO }, - { 0x10, KEY_POWER }, - -}; -DEFINE_LEGACY_IR_KEYTABLE(npgtech); - -/* Norwood Micro (non-Pro) TV Tuner - By Peter Naulls - Key comments are the functions given in the manual */ -static struct ir_scancode norwood[] = { - /* 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 */ -}; -DEFINE_LEGACY_IR_KEYTABLE(norwood); - -/* From reading the following remotes: - * Zenith Universal 7 / TV Mode 807 / VCR Mode 837 - * Hauppauge (from NOVA-CI-s box product) - * This is a "middle of the road" approach, differences are noted - */ -static struct ir_scancode budget_ci_old[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x0a, KEY_ENTER }, - { 0x0b, KEY_RED }, - { 0x0c, KEY_POWER }, /* RADIO on Hauppauge */ - { 0x0d, KEY_MUTE }, - { 0x0f, KEY_A }, /* TV on Hauppauge */ - { 0x10, KEY_VOLUMEUP }, - { 0x11, KEY_VOLUMEDOWN }, - { 0x14, KEY_B }, - { 0x1c, KEY_UP }, - { 0x1d, KEY_DOWN }, - { 0x1e, KEY_OPTION }, /* RESERVED on Hauppauge */ - { 0x1f, KEY_BREAK }, - { 0x20, KEY_CHANNELUP }, - { 0x21, KEY_CHANNELDOWN }, - { 0x22, KEY_PREVIOUS }, /* Prev Ch on Zenith, SOURCE on Hauppauge */ - { 0x24, KEY_RESTART }, - { 0x25, KEY_OK }, - { 0x26, KEY_CYCLEWINDOWS }, /* MINIMIZE on Hauppauge */ - { 0x28, KEY_ENTER }, /* VCR mode on Zenith */ - { 0x29, KEY_PAUSE }, - { 0x2b, KEY_RIGHT }, - { 0x2c, KEY_LEFT }, - { 0x2e, KEY_MENU }, /* FULL SCREEN on Hauppauge */ - { 0x30, KEY_SLOW }, - { 0x31, KEY_PREVIOUS }, /* VCR mode on Zenith */ - { 0x32, KEY_REWIND }, - { 0x34, KEY_FASTFORWARD }, - { 0x35, KEY_PLAY }, - { 0x36, KEY_STOP }, - { 0x37, KEY_RECORD }, - { 0x38, KEY_TUNER }, /* TV/VCR on Zenith */ - { 0x3a, KEY_C }, - { 0x3c, KEY_EXIT }, - { 0x3d, KEY_POWER2 }, - { 0x3e, KEY_TUNER }, -}; -DEFINE_LEGACY_IR_KEYTABLE(budget_ci_old); - -/* - * Marc Fargas - * this is the remote control that comes with the asus p7131 - * which has a label saying is "Model PC-39" - */ -static struct ir_scancode asus_pc39[] = { - /* Keys 0 to 9 */ - { 0x15, KEY_0 }, - { 0x29, KEY_1 }, - { 0x2d, KEY_2 }, - { 0x2b, KEY_3 }, - { 0x09, KEY_4 }, - { 0x0d, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x31, KEY_7 }, - { 0x35, KEY_8 }, - { 0x33, KEY_9 }, - - { 0x3e, KEY_RADIO }, /* radio */ - { 0x03, KEY_MENU }, /* dvd/menu */ - { 0x2a, KEY_VOLUMEUP }, - { 0x19, KEY_VOLUMEDOWN }, - { 0x37, KEY_UP }, - { 0x3b, KEY_DOWN }, - { 0x27, KEY_LEFT }, - { 0x2f, KEY_RIGHT }, - { 0x25, KEY_VIDEO }, /* video */ - { 0x39, KEY_AUDIO }, /* music */ - - { 0x21, KEY_TV }, /* tv */ - { 0x1d, KEY_EXIT }, /* back */ - { 0x0a, KEY_CHANNELUP }, /* channel / program + */ - { 0x1b, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x1a, KEY_ENTER }, /* enter */ - - { 0x06, KEY_PAUSE }, /* play/pause */ - { 0x1e, KEY_PREVIOUS }, /* rew */ - { 0x26, KEY_NEXT }, /* forward */ - { 0x0e, KEY_REWIND }, /* backward << */ - { 0x3a, KEY_FASTFORWARD }, /* forward >> */ - { 0x36, KEY_STOP }, - { 0x2e, KEY_RECORD }, /* recording */ - { 0x16, KEY_POWER }, /* the button that reads "close" */ - - { 0x11, KEY_ZOOM }, /* full screen */ - { 0x13, KEY_MACRO }, /* recall */ - { 0x23, KEY_HOME }, /* home */ - { 0x05, KEY_PVR }, /* picture */ - { 0x3d, KEY_MUTE }, /* mute */ - { 0x01, KEY_DVD }, /* dvd */ -}; -DEFINE_LEGACY_IR_KEYTABLE(asus_pc39); - -/* Encore ENLTV-FM - black plastic, white front cover with white glowing buttons - Juan Pablo Sormani */ -static struct ir_scancode encore_enltv[] = { - - /* Power button does nothing, neither in Windows app, - although it sends data (used for BIOS wakeup?) */ - { 0x0d, KEY_MUTE }, - - { 0x1e, KEY_TV }, - { 0x00, KEY_VIDEO }, - { 0x01, KEY_AUDIO }, /* music */ - { 0x02, KEY_MHP }, /* picture */ - - { 0x1f, KEY_1 }, - { 0x03, KEY_2 }, - { 0x04, KEY_3 }, - { 0x05, KEY_4 }, - { 0x1c, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x1d, KEY_9 }, - { 0x0a, KEY_0 }, - - { 0x09, KEY_LIST }, /* -/-- */ - { 0x0b, KEY_LAST }, /* recall */ - - { 0x14, KEY_HOME }, /* win start menu */ - { 0x15, KEY_EXIT }, /* exit */ - { 0x16, KEY_CHANNELUP }, /* UP */ - { 0x12, KEY_CHANNELDOWN }, /* DOWN */ - { 0x0c, KEY_VOLUMEUP }, /* RIGHT */ - { 0x17, KEY_VOLUMEDOWN }, /* LEFT */ - - { 0x18, KEY_ENTER }, /* OK */ - - { 0x0e, KEY_ESC }, - { 0x13, KEY_CYCLEWINDOWS }, /* desktop */ - { 0x11, KEY_TAB }, - { 0x19, KEY_SWITCHVIDEOMODE }, /* switch */ - - { 0x1a, KEY_MENU }, - { 0x1b, KEY_ZOOM }, /* fullscreen */ - { 0x44, KEY_TIME }, /* time shift */ - { 0x40, KEY_MODE }, /* source */ - - { 0x5a, KEY_RECORD }, - { 0x42, KEY_PLAY }, /* play/pause */ - { 0x45, KEY_STOP }, - { 0x43, KEY_CAMERA }, /* camera icon */ - - { 0x48, KEY_REWIND }, - { 0x4a, KEY_FASTFORWARD }, - { 0x49, KEY_PREVIOUS }, - { 0x4b, KEY_NEXT }, - - { 0x4c, KEY_FAVORITES }, /* tv wall */ - { 0x4d, KEY_SOUND }, /* DVD sound */ - { 0x4e, KEY_LANGUAGE }, /* DVD lang */ - { 0x4f, KEY_TEXT }, /* DVD text */ - - { 0x50, KEY_SLEEP }, /* shutdown */ - { 0x51, KEY_MODE }, /* stereo > main */ - { 0x52, KEY_SELECT }, /* stereo > sap */ - { 0x53, KEY_PROG1 }, /* teletext */ - - - { 0x59, KEY_RED }, /* AP1 */ - { 0x41, KEY_GREEN }, /* AP2 */ - { 0x47, KEY_YELLOW }, /* AP3 */ - { 0x57, KEY_BLUE }, /* AP4 */ -}; -DEFINE_LEGACY_IR_KEYTABLE(encore_enltv); - -/* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton - Mauro Carvalho Chehab */ -static struct ir_scancode encore_enltv2[] = { - { 0x4c, KEY_POWER2 }, - { 0x4a, KEY_TUNER }, - { 0x40, KEY_1 }, - { 0x60, KEY_2 }, - { 0x50, KEY_3 }, - { 0x70, KEY_4 }, - { 0x48, KEY_5 }, - { 0x68, KEY_6 }, - { 0x58, KEY_7 }, - { 0x78, KEY_8 }, - { 0x44, KEY_9 }, - { 0x54, KEY_0 }, - - { 0x64, KEY_LAST }, /* +100 */ - { 0x4e, KEY_AGAIN }, /* Recall */ - - { 0x6c, KEY_SWITCHVIDEOMODE }, /* Video Source */ - { 0x5e, KEY_MENU }, - { 0x56, KEY_SCREEN }, - { 0x7a, KEY_SETUP }, - - { 0x46, KEY_MUTE }, - { 0x5c, KEY_MODE }, /* Stereo */ - { 0x74, KEY_INFO }, - { 0x7c, KEY_CLEAR }, - - { 0x55, KEY_UP }, - { 0x49, KEY_DOWN }, - { 0x7e, KEY_LEFT }, - { 0x59, KEY_RIGHT }, - { 0x6a, KEY_ENTER }, - - { 0x42, KEY_VOLUMEUP }, - { 0x62, KEY_VOLUMEDOWN }, - { 0x52, KEY_CHANNELUP }, - { 0x72, KEY_CHANNELDOWN }, - - { 0x41, KEY_RECORD }, - { 0x51, KEY_CAMERA }, /* Snapshot */ - { 0x75, KEY_TIME }, /* Timeshift */ - { 0x71, KEY_TV2 }, /* PIP */ - - { 0x45, KEY_REWIND }, - { 0x6f, KEY_PAUSE }, - { 0x7d, KEY_FORWARD }, - { 0x79, KEY_STOP }, -}; -DEFINE_LEGACY_IR_KEYTABLE(encore_enltv2); - -/* for the Technotrend 1500 bundled remotes (grey and black): */ -static struct ir_scancode tt_1500[] = { - { 0x01, KEY_POWER }, - { 0x02, KEY_SHUFFLE }, /* ? double-arrow key */ - { 0x03, KEY_1 }, - { 0x04, KEY_2 }, - { 0x05, KEY_3 }, - { 0x06, KEY_4 }, - { 0x07, KEY_5 }, - { 0x08, KEY_6 }, - { 0x09, KEY_7 }, - { 0x0a, KEY_8 }, - { 0x0b, KEY_9 }, - { 0x0c, KEY_0 }, - { 0x0d, KEY_UP }, - { 0x0e, KEY_LEFT }, - { 0x0f, KEY_OK }, - { 0x10, KEY_RIGHT }, - { 0x11, KEY_DOWN }, - { 0x12, KEY_INFO }, - { 0x13, KEY_EXIT }, - { 0x14, KEY_RED }, - { 0x15, KEY_GREEN }, - { 0x16, KEY_YELLOW }, - { 0x17, KEY_BLUE }, - { 0x18, KEY_MUTE }, - { 0x19, KEY_TEXT }, - { 0x1a, KEY_MODE }, /* ? TV/Radio */ - { 0x21, KEY_OPTION }, - { 0x22, KEY_EPG }, - { 0x23, KEY_CHANNELUP }, - { 0x24, KEY_CHANNELDOWN }, - { 0x25, KEY_VOLUMEUP }, - { 0x26, KEY_VOLUMEDOWN }, - { 0x27, KEY_SETUP }, - { 0x3a, KEY_RECORD }, /* these keys are only in the black remote */ - { 0x3b, KEY_PLAY }, - { 0x3c, KEY_STOP }, - { 0x3d, KEY_REWIND }, - { 0x3e, KEY_PAUSE }, - { 0x3f, KEY_FORWARD }, -}; -DEFINE_LEGACY_IR_KEYTABLE(tt_1500); - -/* DViCO FUSION HDTV MCE remote */ -static struct ir_scancode fusionhdtv_mce[] = { - - { 0x0b, KEY_1 }, - { 0x17, KEY_2 }, - { 0x1b, KEY_3 }, - { 0x07, KEY_4 }, - { 0x50, KEY_5 }, - { 0x54, KEY_6 }, - { 0x48, KEY_7 }, - { 0x4c, KEY_8 }, - { 0x58, KEY_9 }, - { 0x03, KEY_0 }, - - { 0x5e, KEY_OK }, - { 0x51, KEY_UP }, - { 0x53, KEY_DOWN }, - { 0x5b, KEY_LEFT }, - { 0x5f, KEY_RIGHT }, - - { 0x02, KEY_TV }, /* Labeled DTV on remote */ - { 0x0e, KEY_MP3 }, - { 0x1a, KEY_DVD }, - { 0x1e, KEY_FAVORITES }, /* Labeled CPF on remote */ - { 0x16, KEY_SETUP }, - { 0x46, KEY_POWER2 }, /* TV On/Off button on remote */ - { 0x0a, KEY_EPG }, /* Labeled Guide on remote */ - - { 0x49, KEY_BACK }, - { 0x59, KEY_INFO }, /* Labeled MORE on remote */ - { 0x4d, KEY_MENU }, /* Labeled DVDMENU on remote */ - { 0x55, KEY_CYCLEWINDOWS }, /* Labeled ALT-TAB on remote */ - - { 0x0f, KEY_PREVIOUSSONG }, /* Labeled |<< REPLAY on remote */ - { 0x12, KEY_NEXTSONG }, /* Labeled >>| SKIP on remote */ - { 0x42, KEY_ENTER }, /* Labeled START with a green - MS windows logo on remote */ - - { 0x15, KEY_VOLUMEUP }, - { 0x05, KEY_VOLUMEDOWN }, - { 0x11, KEY_CHANNELUP }, - { 0x09, KEY_CHANNELDOWN }, - - { 0x52, KEY_CAMERA }, - { 0x5a, KEY_TUNER }, - { 0x19, KEY_OPEN }, - - { 0x13, KEY_MODE }, /* 4:3 16:9 select */ - { 0x1f, KEY_ZOOM }, - - { 0x43, KEY_REWIND }, - { 0x47, KEY_PLAYPAUSE }, - { 0x4f, KEY_FASTFORWARD }, - { 0x57, KEY_MUTE }, - { 0x0d, KEY_STOP }, - { 0x01, KEY_RECORD }, - { 0x4e, KEY_POWER }, -}; -DEFINE_LEGACY_IR_KEYTABLE(fusionhdtv_mce); - -/* Pinnacle PCTV HD 800i mini remote */ -static struct ir_scancode pinnacle_pctv_hd[] = { - - { 0x0f, KEY_1 }, - { 0x15, KEY_2 }, - { 0x10, KEY_3 }, - { 0x18, KEY_4 }, - { 0x1b, KEY_5 }, - { 0x1e, KEY_6 }, - { 0x11, KEY_7 }, - { 0x21, KEY_8 }, - { 0x12, KEY_9 }, - { 0x27, KEY_0 }, - - { 0x24, KEY_ZOOM }, - { 0x2a, KEY_SUBTITLE }, - - { 0x00, KEY_MUTE }, - { 0x01, KEY_ENTER }, /* Pinnacle Logo */ - { 0x39, KEY_POWER }, - - { 0x03, KEY_VOLUMEUP }, - { 0x09, KEY_VOLUMEDOWN }, - { 0x06, KEY_CHANNELUP }, - { 0x0c, KEY_CHANNELDOWN }, - - { 0x2d, KEY_REWIND }, - { 0x30, KEY_PLAYPAUSE }, - { 0x33, KEY_FASTFORWARD }, - { 0x3c, KEY_STOP }, - { 0x36, KEY_RECORD }, - { 0x3f, KEY_EPG }, /* Labeled "?" */ -}; -DEFINE_LEGACY_IR_KEYTABLE(pinnacle_pctv_hd); - -/* - * Igor Kuznetsov - * Andrey J. Melnikov - * - * Keytable is used by BeholdTV 60x series, M6 series at - * least, and probably other cards too. - * The "ascii-art picture" below (in comments, first row - * is the keycode in hex, and subsequent row(s) shows - * the button labels (several variants when appropriate) - * helps to descide which keycodes to assign to the buttons. - */ -static struct ir_scancode behold[] = { - - /* 0x1c 0x12 * - * TV/FM POWER * - * */ - { 0x1c, KEY_TUNER }, /* XXX KEY_TV / KEY_RADIO */ - { 0x12, KEY_POWER }, - - /* 0x01 0x02 0x03 * - * 1 2 3 * - * * - * 0x04 0x05 0x06 * - * 4 5 6 * - * * - * 0x07 0x08 0x09 * - * 7 8 9 * - * */ - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - /* 0x0a 0x00 0x17 * - * RECALL 0 MODE * - * */ - { 0x0a, KEY_AGAIN }, - { 0x00, KEY_0 }, - { 0x17, KEY_MODE }, - - /* 0x14 0x10 * - * ASPECT FULLSCREEN * - * */ - { 0x14, KEY_SCREEN }, - { 0x10, KEY_ZOOM }, - - /* 0x0b * - * Up * - * * - * 0x18 0x16 0x0c * - * Left Ok Right * - * * - * 0x015 * - * Down * - * */ - { 0x0b, KEY_CHANNELUP }, - { 0x18, KEY_VOLUMEDOWN }, - { 0x16, KEY_OK }, /* XXX KEY_ENTER */ - { 0x0c, KEY_VOLUMEUP }, - { 0x15, KEY_CHANNELDOWN }, - - /* 0x11 0x0d * - * MUTE INFO * - * */ - { 0x11, KEY_MUTE }, - { 0x0d, KEY_INFO }, - - /* 0x0f 0x1b 0x1a * - * RECORD PLAY/PAUSE STOP * - * * - * 0x0e 0x1f 0x1e * - *TELETEXT AUDIO SOURCE * - * RED YELLOW * - * */ - { 0x0f, KEY_RECORD }, - { 0x1b, KEY_PLAYPAUSE }, - { 0x1a, KEY_STOP }, - { 0x0e, KEY_TEXT }, - { 0x1f, KEY_RED }, /*XXX KEY_AUDIO */ - { 0x1e, KEY_YELLOW }, /*XXX KEY_SOURCE */ - - /* 0x1d 0x13 0x19 * - * SLEEP PREVIEW DVB * - * GREEN BLUE * - * */ - { 0x1d, KEY_SLEEP }, - { 0x13, KEY_GREEN }, - { 0x19, KEY_BLUE }, /* XXX KEY_SAT */ - - /* 0x58 0x5c * - * FREEZE SNAPSHOT * - * */ - { 0x58, KEY_SLOW }, - { 0x5c, KEY_CAMERA }, - -}; -DEFINE_LEGACY_IR_KEYTABLE(behold); - -/* Beholder Intl. Ltd. 2008 - * Dmitry Belimov d.belimov@google.com - * Keytable is used by BeholdTV Columbus - * The "ascii-art picture" below (in comments, first row - * is the keycode in hex, and subsequent row(s) shows - * the button labels (several variants when appropriate) - * helps to descide which keycodes to assign to the buttons. - */ -static struct ir_scancode behold_columbus[] = { - - /* 0x13 0x11 0x1C 0x12 * - * Mute Source TV/FM Power * - * */ - - { 0x13, KEY_MUTE }, - { 0x11, KEY_PROPS }, - { 0x1C, KEY_TUNER }, /* KEY_TV/KEY_RADIO */ - { 0x12, KEY_POWER }, - - /* 0x01 0x02 0x03 0x0D * - * 1 2 3 Stereo * - * * - * 0x04 0x05 0x06 0x19 * - * 4 5 6 Snapshot * - * * - * 0x07 0x08 0x09 0x10 * - * 7 8 9 Zoom * - * */ - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x0D, KEY_SETUP }, /* Setup key */ - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x19, KEY_CAMERA }, /* Snapshot key */ - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x10, KEY_ZOOM }, - - /* 0x0A 0x00 0x0B 0x0C * - * RECALL 0 ChannelUp VolumeUp * - * */ - { 0x0A, KEY_AGAIN }, - { 0x00, KEY_0 }, - { 0x0B, KEY_CHANNELUP }, - { 0x0C, KEY_VOLUMEUP }, - - /* 0x1B 0x1D 0x15 0x18 * - * Timeshift Record ChannelDown VolumeDown * - * */ - - { 0x1B, KEY_TIME }, - { 0x1D, KEY_RECORD }, - { 0x15, KEY_CHANNELDOWN }, - { 0x18, KEY_VOLUMEDOWN }, - - /* 0x0E 0x1E 0x0F 0x1A * - * Stop Pause Previouse Next * - * */ - - { 0x0E, KEY_STOP }, - { 0x1E, KEY_PAUSE }, - { 0x0F, KEY_PREVIOUS }, - { 0x1A, KEY_NEXT }, - -}; -DEFINE_LEGACY_IR_KEYTABLE(behold_columbus); - -/* - * Remote control for the Genius TVGO A11MCE - * Adrian Pardini - */ -static struct ir_scancode genius_tvgo_a11mce[] = { - /* Keys 0 to 9 */ - { 0x48, KEY_0 }, - { 0x09, KEY_1 }, - { 0x1d, KEY_2 }, - { 0x1f, KEY_3 }, - { 0x19, KEY_4 }, - { 0x1b, KEY_5 }, - { 0x11, KEY_6 }, - { 0x17, KEY_7 }, - { 0x12, KEY_8 }, - { 0x16, KEY_9 }, - - { 0x54, KEY_RECORD }, /* recording */ - { 0x06, KEY_MUTE }, /* mute */ - { 0x10, KEY_POWER }, - { 0x40, KEY_LAST }, /* recall */ - { 0x4c, KEY_CHANNELUP }, /* channel / program + */ - { 0x00, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x0d, KEY_VOLUMEUP }, - { 0x15, KEY_VOLUMEDOWN }, - { 0x4d, KEY_OK }, /* also labeled as Pause */ - { 0x1c, KEY_ZOOM }, /* full screen and Stop*/ - { 0x02, KEY_MODE }, /* AV Source or Rewind*/ - { 0x04, KEY_LIST }, /* -/-- */ - /* small arrows above numbers */ - { 0x1a, KEY_NEXT }, /* also Fast Forward */ - { 0x0e, KEY_PREVIOUS }, /* also Rewind */ - /* these are in a rather non standard layout and have - an alternate name written */ - { 0x1e, KEY_UP }, /* Video Setting */ - { 0x0a, KEY_DOWN }, /* Video Default */ - { 0x05, KEY_CAMERA }, /* Snapshot */ - { 0x0c, KEY_RIGHT }, /* Hide Panel */ - /* Four buttons without label */ - { 0x49, KEY_RED }, - { 0x0b, KEY_GREEN }, - { 0x13, KEY_YELLOW }, - { 0x50, KEY_BLUE }, -}; -DEFINE_LEGACY_IR_KEYTABLE(genius_tvgo_a11mce); - -/* - * Remote control for Powercolor Real Angel 330 - * Daniel Fraga - */ -static struct ir_scancode powercolor_real_angel[] = { - { 0x38, KEY_SWITCHVIDEOMODE }, /* switch inputs */ - { 0x0c, KEY_MEDIA }, /* Turn ON/OFF App */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x0a, KEY_DIGITS }, /* single, double, tripple digit */ - { 0x29, KEY_PREVIOUS }, /* previous channel */ - { 0x12, KEY_BRIGHTNESSUP }, - { 0x13, KEY_BRIGHTNESSDOWN }, - { 0x2b, KEY_MODE }, /* stereo/mono */ - { 0x2c, KEY_TEXT }, /* teletext */ - { 0x20, KEY_CHANNELUP }, /* channel up */ - { 0x21, KEY_CHANNELDOWN }, /* channel down */ - { 0x10, KEY_VOLUMEUP }, /* volume up */ - { 0x11, KEY_VOLUMEDOWN }, /* volume down */ - { 0x0d, KEY_MUTE }, - { 0x1f, KEY_RECORD }, - { 0x17, KEY_PLAY }, - { 0x16, KEY_PAUSE }, - { 0x0b, KEY_STOP }, - { 0x27, KEY_FASTFORWARD }, - { 0x26, KEY_REWIND }, - { 0x1e, KEY_SEARCH }, /* autoscan */ - { 0x0e, KEY_CAMERA }, /* snapshot */ - { 0x2d, KEY_SETUP }, - { 0x0f, KEY_SCREEN }, /* full screen */ - { 0x14, KEY_RADIO }, /* FM radio */ - { 0x25, KEY_POWER }, /* power */ -}; -DEFINE_LEGACY_IR_KEYTABLE(powercolor_real_angel); - -/* Kworld Plus TV Analog Lite PCI IR - Mauro Carvalho Chehab - */ -static struct ir_scancode kworld_plus_tv_analog[] = { - { 0x0c, KEY_PROG1 }, /* Kworld key */ - { 0x16, KEY_CLOSECD }, /* -> ) */ - { 0x1d, KEY_POWER2 }, - - { 0x00, KEY_1 }, - { 0x01, KEY_2 }, - { 0x02, KEY_3 }, /* Two keys have the same code: 3 and left */ - { 0x03, KEY_4 }, /* Two keys have the same code: 3 and right */ - { 0x04, KEY_5 }, - { 0x05, KEY_6 }, - { 0x06, KEY_7 }, - { 0x07, KEY_8 }, - { 0x08, KEY_9 }, - { 0x0a, KEY_0 }, - - { 0x09, KEY_AGAIN }, - { 0x14, KEY_MUTE }, - - { 0x20, KEY_UP }, - { 0x21, KEY_DOWN }, - { 0x0b, KEY_ENTER }, - - { 0x10, KEY_CHANNELUP }, - { 0x11, KEY_CHANNELDOWN }, - - /* Couldn't map key left/key right since those - conflict with '3' and '4' scancodes - I dunno what the original driver does - */ - - { 0x13, KEY_VOLUMEUP }, - { 0x12, KEY_VOLUMEDOWN }, - - /* The lower part of the IR - There are several duplicated keycodes there. - Most of them conflict with digits. - Add mappings just to the unused scancodes. - Somehow, the original driver has a way to know, - but this doesn't seem to be on some GPIO. - Also, it is not related to the time between keyup - and keydown. - */ - { 0x19, KEY_TIME}, /* Timeshift */ - { 0x1a, KEY_STOP}, - { 0x1b, KEY_RECORD}, - - { 0x22, KEY_TEXT}, - - { 0x15, KEY_AUDIO}, /* ((*)) */ - { 0x0f, KEY_ZOOM}, - { 0x1c, KEY_CAMERA}, /* snapshot */ - - { 0x18, KEY_RED}, /* B */ - { 0x23, KEY_GREEN}, /* C */ -}; -DEFINE_LEGACY_IR_KEYTABLE(kworld_plus_tv_analog); - -/* Kaiomy TVnPC U2 - Mauro Carvalho Chehab - */ -static struct ir_scancode kaiomy[] = { - { 0x43, KEY_POWER2}, - { 0x01, KEY_LIST}, - { 0x0b, KEY_ZOOM}, - { 0x03, KEY_POWER}, - - { 0x04, KEY_1}, - { 0x08, KEY_2}, - { 0x02, KEY_3}, - - { 0x0f, KEY_4}, - { 0x05, KEY_5}, - { 0x06, KEY_6}, - - { 0x0c, KEY_7}, - { 0x0d, KEY_8}, - { 0x0a, KEY_9}, - - { 0x11, KEY_0}, - - { 0x09, KEY_CHANNELUP}, - { 0x07, KEY_CHANNELDOWN}, - - { 0x0e, KEY_VOLUMEUP}, - { 0x13, KEY_VOLUMEDOWN}, - - { 0x10, KEY_HOME}, - { 0x12, KEY_ENTER}, - - { 0x14, KEY_RECORD}, - { 0x15, KEY_STOP}, - { 0x16, KEY_PLAY}, - { 0x17, KEY_MUTE}, - - { 0x18, KEY_UP}, - { 0x19, KEY_DOWN}, - { 0x1a, KEY_LEFT}, - { 0x1b, KEY_RIGHT}, - - { 0x1c, KEY_RED}, - { 0x1d, KEY_GREEN}, - { 0x1e, KEY_YELLOW}, - { 0x1f, KEY_BLUE}, -}; -DEFINE_LEGACY_IR_KEYTABLE(kaiomy); - -static struct ir_scancode avermedia_a16d[] = { - { 0x20, KEY_LIST}, - { 0x00, KEY_POWER}, - { 0x28, KEY_1}, - { 0x18, KEY_2}, - { 0x38, KEY_3}, - { 0x24, KEY_4}, - { 0x14, KEY_5}, - { 0x34, KEY_6}, - { 0x2c, KEY_7}, - { 0x1c, KEY_8}, - { 0x3c, KEY_9}, - { 0x12, KEY_SUBTITLE}, - { 0x22, KEY_0}, - { 0x32, KEY_REWIND}, - { 0x3a, KEY_SHUFFLE}, - { 0x02, KEY_PRINT}, - { 0x11, KEY_CHANNELDOWN}, - { 0x31, KEY_CHANNELUP}, - { 0x0c, KEY_ZOOM}, - { 0x1e, KEY_VOLUMEDOWN}, - { 0x3e, KEY_VOLUMEUP}, - { 0x0a, KEY_MUTE}, - { 0x04, KEY_AUDIO}, - { 0x26, KEY_RECORD}, - { 0x06, KEY_PLAY}, - { 0x36, KEY_STOP}, - { 0x16, KEY_PAUSE}, - { 0x2e, KEY_REWIND}, - { 0x0e, KEY_FASTFORWARD}, - { 0x30, KEY_TEXT}, - { 0x21, KEY_GREEN}, - { 0x01, KEY_BLUE}, - { 0x08, KEY_EPG}, - { 0x2a, KEY_MENU}, -}; -DEFINE_LEGACY_IR_KEYTABLE(avermedia_a16d); - -/* Encore ENLTV-FM v5.3 - Mauro Carvalho Chehab - */ -static struct ir_scancode encore_enltv_fm53[] = { - { 0x10, KEY_POWER2}, - { 0x06, KEY_MUTE}, - - { 0x09, KEY_1}, - { 0x1d, KEY_2}, - { 0x1f, KEY_3}, - { 0x19, KEY_4}, - { 0x1b, KEY_5}, - { 0x11, KEY_6}, - { 0x17, KEY_7}, - { 0x12, KEY_8}, - { 0x16, KEY_9}, - { 0x48, KEY_0}, - - { 0x04, KEY_LIST}, /* -/-- */ - { 0x40, KEY_LAST}, /* recall */ - - { 0x02, KEY_MODE}, /* TV/AV */ - { 0x05, KEY_CAMERA}, /* SNAPSHOT */ - - { 0x4c, KEY_CHANNELUP}, /* UP */ - { 0x00, KEY_CHANNELDOWN}, /* DOWN */ - { 0x0d, KEY_VOLUMEUP}, /* RIGHT */ - { 0x15, KEY_VOLUMEDOWN}, /* LEFT */ - { 0x49, KEY_ENTER}, /* OK */ - - { 0x54, KEY_RECORD}, - { 0x4d, KEY_PLAY}, /* pause */ - - { 0x1e, KEY_MENU}, /* video setting */ - { 0x0e, KEY_RIGHT}, /* <- */ - { 0x1a, KEY_LEFT}, /* -> */ - - { 0x0a, KEY_CLEAR}, /* video default */ - { 0x0c, KEY_ZOOM}, /* hide pannel */ - { 0x47, KEY_SLEEP}, /* shutdown */ -}; -DEFINE_LEGACY_IR_KEYTABLE(encore_enltv_fm53); - -/* Zogis Real Audio 220 - 32 keys IR */ -static struct ir_scancode real_audio_220_32_keys[] = { - { 0x1c, KEY_RADIO}, - { 0x12, KEY_POWER2}, - - { 0x01, KEY_1}, - { 0x02, KEY_2}, - { 0x03, KEY_3}, - { 0x04, KEY_4}, - { 0x05, KEY_5}, - { 0x06, KEY_6}, - { 0x07, KEY_7}, - { 0x08, KEY_8}, - { 0x09, KEY_9}, - { 0x00, KEY_0}, - - { 0x0c, KEY_VOLUMEUP}, - { 0x18, KEY_VOLUMEDOWN}, - { 0x0b, KEY_CHANNELUP}, - { 0x15, KEY_CHANNELDOWN}, - { 0x16, KEY_ENTER}, - - { 0x11, KEY_LIST}, /* Source */ - { 0x0d, KEY_AUDIO}, /* stereo */ - - { 0x0f, KEY_PREVIOUS}, /* Prev */ - { 0x1b, KEY_TIME}, /* Timeshift */ - { 0x1a, KEY_NEXT}, /* Next */ - - { 0x0e, KEY_STOP}, - { 0x1f, KEY_PLAY}, - { 0x1e, KEY_PLAYPAUSE}, /* Pause */ - - { 0x1d, KEY_RECORD}, - { 0x13, KEY_MUTE}, - { 0x19, KEY_CAMERA}, /* Snapshot */ - -}; -DEFINE_LEGACY_IR_KEYTABLE(real_audio_220_32_keys); - -/* ATI TV Wonder HD 600 USB - Devin Heitmueller - */ -static struct ir_scancode ati_tv_wonder_hd_600[] = { - { 0x00, KEY_RECORD}, /* Row 1 */ - { 0x01, KEY_PLAYPAUSE}, - { 0x02, KEY_STOP}, - { 0x03, KEY_POWER}, - { 0x04, KEY_PREVIOUS}, /* Row 2 */ - { 0x05, KEY_REWIND}, - { 0x06, KEY_FORWARD}, - { 0x07, KEY_NEXT}, - { 0x08, KEY_EPG}, /* Row 3 */ - { 0x09, KEY_HOME}, - { 0x0a, KEY_MENU}, - { 0x0b, KEY_CHANNELUP}, - { 0x0c, KEY_BACK}, /* Row 4 */ - { 0x0d, KEY_UP}, - { 0x0e, KEY_INFO}, - { 0x0f, KEY_CHANNELDOWN}, - { 0x10, KEY_LEFT}, /* Row 5 */ - { 0x11, KEY_SELECT}, - { 0x12, KEY_RIGHT}, - { 0x13, KEY_VOLUMEUP}, - { 0x14, KEY_LAST}, /* Row 6 */ - { 0x15, KEY_DOWN}, - { 0x16, KEY_MUTE}, - { 0x17, KEY_VOLUMEDOWN}, -}; -DEFINE_LEGACY_IR_KEYTABLE(ati_tv_wonder_hd_600); - -/* DVBWorld remotes - Igor M. Liplianin - */ -static struct ir_scancode dm1105_nec[] = { - { 0x0a, KEY_POWER2}, /* power */ - { 0x0c, KEY_MUTE}, /* mute */ - { 0x11, KEY_1}, - { 0x12, KEY_2}, - { 0x13, KEY_3}, - { 0x14, KEY_4}, - { 0x15, KEY_5}, - { 0x16, KEY_6}, - { 0x17, KEY_7}, - { 0x18, KEY_8}, - { 0x19, KEY_9}, - { 0x10, KEY_0}, - { 0x1c, KEY_CHANNELUP}, /* ch+ */ - { 0x0f, KEY_CHANNELDOWN}, /* ch- */ - { 0x1a, KEY_VOLUMEUP}, /* vol+ */ - { 0x0e, KEY_VOLUMEDOWN}, /* vol- */ - { 0x04, KEY_RECORD}, /* rec */ - { 0x09, KEY_CHANNEL}, /* fav */ - { 0x08, KEY_BACKSPACE}, /* rewind */ - { 0x07, KEY_FASTFORWARD}, /* fast */ - { 0x0b, KEY_PAUSE}, /* pause */ - { 0x02, KEY_ESC}, /* cancel */ - { 0x03, KEY_TAB}, /* tab */ - { 0x00, KEY_UP}, /* up */ - { 0x1f, KEY_ENTER}, /* ok */ - { 0x01, KEY_DOWN}, /* down */ - { 0x05, KEY_RECORD}, /* cap */ - { 0x06, KEY_STOP}, /* stop */ - { 0x40, KEY_ZOOM}, /* full */ - { 0x1e, KEY_TV}, /* tvmode */ - { 0x1b, KEY_B}, /* recall */ -}; -DEFINE_LEGACY_IR_KEYTABLE(dm1105_nec); - -static struct ir_scancode tevii_nec[] = { - { 0x0a, KEY_POWER2}, - { 0x0c, KEY_MUTE}, - { 0x11, KEY_1}, - { 0x12, KEY_2}, - { 0x13, KEY_3}, - { 0x14, KEY_4}, - { 0x15, KEY_5}, - { 0x16, KEY_6}, - { 0x17, KEY_7}, - { 0x18, KEY_8}, - { 0x19, KEY_9}, - { 0x10, KEY_0}, - { 0x1c, KEY_MENU}, - { 0x0f, KEY_VOLUMEDOWN}, - { 0x1a, KEY_LAST}, - { 0x0e, KEY_OPEN}, - { 0x04, KEY_RECORD}, - { 0x09, KEY_VOLUMEUP}, - { 0x08, KEY_CHANNELUP}, - { 0x07, KEY_PVR}, - { 0x0b, KEY_TIME}, - { 0x02, KEY_RIGHT}, - { 0x03, KEY_LEFT}, - { 0x00, KEY_UP}, - { 0x1f, KEY_OK}, - { 0x01, KEY_DOWN}, - { 0x05, KEY_TUNER}, - { 0x06, KEY_CHANNELDOWN}, - { 0x40, KEY_PLAYPAUSE}, - { 0x1e, KEY_REWIND}, - { 0x1b, KEY_FAVORITES}, - { 0x1d, KEY_BACK}, - { 0x4d, KEY_FASTFORWARD}, - { 0x44, KEY_EPG}, - { 0x4c, KEY_INFO}, - { 0x41, KEY_AB}, - { 0x43, KEY_AUDIO}, - { 0x45, KEY_SUBTITLE}, - { 0x4a, KEY_LIST}, - { 0x46, KEY_F1}, - { 0x47, KEY_F2}, - { 0x5e, KEY_F3}, - { 0x5c, KEY_F4}, - { 0x52, KEY_F5}, - { 0x5a, KEY_F6}, - { 0x56, KEY_MODE}, - { 0x58, KEY_SWITCHVIDEOMODE}, -}; -DEFINE_LEGACY_IR_KEYTABLE(tevii_nec); - -static struct ir_scancode tbs_nec[] = { - { 0x04, KEY_POWER2}, /*power*/ - { 0x14, KEY_MUTE}, /*mute*/ - { 0x07, KEY_1}, - { 0x06, KEY_2}, - { 0x05, KEY_3}, - { 0x0b, KEY_4}, - { 0x0a, KEY_5}, - { 0x09, KEY_6}, - { 0x0f, KEY_7}, - { 0x0e, KEY_8}, - { 0x0d, KEY_9}, - { 0x12, KEY_0}, - { 0x16, KEY_CHANNELUP}, /*ch+*/ - { 0x11, KEY_CHANNELDOWN},/*ch-*/ - { 0x13, KEY_VOLUMEUP}, /*vol+*/ - { 0x0c, KEY_VOLUMEDOWN},/*vol-*/ - { 0x03, KEY_RECORD}, /*rec*/ - { 0x18, KEY_PAUSE}, /*pause*/ - { 0x19, KEY_OK}, /*ok*/ - { 0x1a, KEY_CAMERA}, /* snapshot */ - { 0x01, KEY_UP}, - { 0x10, KEY_LEFT}, - { 0x02, KEY_RIGHT}, - { 0x08, KEY_DOWN}, - { 0x15, KEY_FAVORITES}, - { 0x17, KEY_SUBTITLE}, - { 0x1d, KEY_ZOOM}, - { 0x1f, KEY_EXIT}, - { 0x1e, KEY_MENU}, - { 0x1c, KEY_EPG}, - { 0x00, KEY_PREVIOUS}, - { 0x1b, KEY_MODE}, -}; -DEFINE_LEGACY_IR_KEYTABLE(tbs_nec); - -/* Terratec Cinergy Hybrid T USB XS - Devin Heitmueller - */ -static struct ir_scancode terratec_cinergy_xs[] = { - { 0x41, KEY_HOME}, - { 0x01, KEY_POWER}, - { 0x42, KEY_MENU}, - { 0x02, KEY_1}, - { 0x03, KEY_2}, - { 0x04, KEY_3}, - { 0x43, KEY_SUBTITLE}, - { 0x05, KEY_4}, - { 0x06, KEY_5}, - { 0x07, KEY_6}, - { 0x44, KEY_TEXT}, - { 0x08, KEY_7}, - { 0x09, KEY_8}, - { 0x0a, KEY_9}, - { 0x45, KEY_DELETE}, - { 0x0b, KEY_TUNER}, - { 0x0c, KEY_0}, - { 0x0d, KEY_MODE}, - { 0x46, KEY_TV}, - { 0x47, KEY_DVD}, - { 0x49, KEY_VIDEO}, - { 0x4b, KEY_AUX}, - { 0x10, KEY_UP}, - { 0x11, KEY_LEFT}, - { 0x12, KEY_OK}, - { 0x13, KEY_RIGHT}, - { 0x14, KEY_DOWN}, - { 0x0f, KEY_EPG}, - { 0x16, KEY_INFO}, - { 0x4d, KEY_BACKSPACE}, - { 0x1c, KEY_VOLUMEUP}, - { 0x4c, KEY_PLAY}, - { 0x1b, KEY_CHANNELUP}, - { 0x1e, KEY_VOLUMEDOWN}, - { 0x1d, KEY_MUTE}, - { 0x1f, KEY_CHANNELDOWN}, - { 0x17, KEY_RED}, - { 0x18, KEY_GREEN}, - { 0x19, KEY_YELLOW}, - { 0x1a, KEY_BLUE}, - { 0x58, KEY_RECORD}, - { 0x48, KEY_STOP}, - { 0x40, KEY_PAUSE}, - { 0x54, KEY_LAST}, - { 0x4e, KEY_REWIND}, - { 0x4f, KEY_FASTFORWARD}, - { 0x5c, KEY_NEXT}, -}; -DEFINE_LEGACY_IR_KEYTABLE(terratec_cinergy_xs); - -/* EVGA inDtube - Devin Heitmueller - */ -static struct ir_scancode evga_indtube[] = { - { 0x12, KEY_POWER}, - { 0x02, KEY_MODE}, /* TV */ - { 0x14, KEY_MUTE}, - { 0x1a, KEY_CHANNELUP}, - { 0x16, KEY_TV2}, /* PIP */ - { 0x1d, KEY_VOLUMEUP}, - { 0x05, KEY_CHANNELDOWN}, - { 0x0f, KEY_PLAYPAUSE}, - { 0x19, KEY_VOLUMEDOWN}, - { 0x1c, KEY_REWIND}, - { 0x0d, KEY_RECORD}, - { 0x18, KEY_FORWARD}, - { 0x1e, KEY_PREVIOUS}, - { 0x1b, KEY_STOP}, - { 0x1f, KEY_NEXT}, - { 0x13, KEY_CAMERA}, -}; -DEFINE_LEGACY_IR_KEYTABLE(evga_indtube); - -static struct ir_scancode videomate_s350[] = { - { 0x00, KEY_TV}, - { 0x01, KEY_DVD}, - { 0x04, KEY_RECORD}, - { 0x05, KEY_VIDEO}, /* TV/Video */ - { 0x07, KEY_STOP}, - { 0x08, KEY_PLAYPAUSE}, - { 0x0a, KEY_REWIND}, - { 0x0f, KEY_FASTFORWARD}, - { 0x10, KEY_CHANNELUP}, - { 0x12, KEY_VOLUMEUP}, - { 0x13, KEY_CHANNELDOWN}, - { 0x14, KEY_MUTE}, - { 0x15, KEY_VOLUMEDOWN}, - { 0x16, KEY_1}, - { 0x17, KEY_2}, - { 0x18, KEY_3}, - { 0x19, KEY_4}, - { 0x1a, KEY_5}, - { 0x1b, KEY_6}, - { 0x1c, KEY_7}, - { 0x1d, KEY_8}, - { 0x1e, KEY_9}, - { 0x1f, KEY_0}, - { 0x21, KEY_SLEEP}, - { 0x24, KEY_ZOOM}, - { 0x25, KEY_LAST}, /* Recall */ - { 0x26, KEY_SUBTITLE}, /* CC */ - { 0x27, KEY_LANGUAGE}, /* MTS */ - { 0x29, KEY_CHANNEL}, /* SURF */ - { 0x2b, KEY_A}, - { 0x2c, KEY_B}, - { 0x2f, KEY_CAMERA}, /* Snapshot */ - { 0x23, KEY_RADIO}, - { 0x02, KEY_PREVIOUSSONG}, - { 0x06, KEY_NEXTSONG}, - { 0x03, KEY_EPG}, - { 0x09, KEY_SETUP}, - { 0x22, KEY_BACKSPACE}, - { 0x0c, KEY_UP}, - { 0x0e, KEY_DOWN}, - { 0x0b, KEY_LEFT}, - { 0x0d, KEY_RIGHT}, - { 0x11, KEY_ENTER}, - { 0x20, KEY_TEXT}, -}; -DEFINE_LEGACY_IR_KEYTABLE(videomate_s350); - -/* GADMEI UTV330+ RM008Z remote - Shine Liu - */ -static struct ir_scancode gadmei_rm008z[] = { - { 0x14, KEY_POWER2}, /* POWER OFF */ - { 0x0c, KEY_MUTE}, /* MUTE */ - - { 0x18, KEY_TV}, /* TV */ - { 0x0e, KEY_VIDEO}, /* AV */ - { 0x0b, KEY_AUDIO}, /* SV */ - { 0x0f, KEY_RADIO}, /* FM */ - - { 0x00, KEY_1}, - { 0x01, KEY_2}, - { 0x02, KEY_3}, - { 0x03, KEY_4}, - { 0x04, KEY_5}, - { 0x05, KEY_6}, - { 0x06, KEY_7}, - { 0x07, KEY_8}, - { 0x08, KEY_9}, - { 0x09, KEY_0}, - { 0x0a, KEY_INFO}, /* OSD */ - { 0x1c, KEY_BACKSPACE}, /* LAST */ - - { 0x0d, KEY_PLAY}, /* PLAY */ - { 0x1e, KEY_CAMERA}, /* SNAPSHOT */ - { 0x1a, KEY_RECORD}, /* RECORD */ - { 0x17, KEY_STOP}, /* STOP */ - - { 0x1f, KEY_UP}, /* UP */ - { 0x44, KEY_DOWN}, /* DOWN */ - { 0x46, KEY_TAB}, /* BACK */ - { 0x4a, KEY_ZOOM}, /* FULLSECREEN */ - - { 0x10, KEY_VOLUMEUP}, /* VOLUMEUP */ - { 0x11, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ - { 0x12, KEY_CHANNELUP}, /* CHANNELUP */ - { 0x13, KEY_CHANNELDOWN}, /* CHANNELDOWN */ - { 0x15, KEY_ENTER}, /* OK */ -}; -DEFINE_LEGACY_IR_KEYTABLE(gadmei_rm008z); - -/************************************************************* - * COMPLETE SCANCODE TABLES - * Instead of just a partial scancode, the tables bellow - * contains the complete scancode and the receiver protocol - *************************************************************/ +#include +#include /* - * Hauppauge:the newer, gray remotes (seems there are multiple - * slightly different versions), shipped with cx88+ivtv cards. - * - * This table contains the complete RC5 code, instead of just the data part - */ -static struct ir_scancode rc5_hauppauge_new[] = { - /* Keys 0 to 9 */ - { 0x1e00, KEY_0 }, - { 0x1e01, KEY_1 }, - { 0x1e02, KEY_2 }, - { 0x1e03, KEY_3 }, - { 0x1e04, KEY_4 }, - { 0x1e05, KEY_5 }, - { 0x1e06, KEY_6 }, - { 0x1e07, KEY_7 }, - { 0x1e08, KEY_8 }, - { 0x1e09, KEY_9 }, - - { 0x1e0a, KEY_TEXT }, /* keypad asterisk as well */ - { 0x1e0b, KEY_RED }, /* red button */ - { 0x1e0c, KEY_RADIO }, - { 0x1e0d, KEY_MENU }, - { 0x1e0e, KEY_SUBTITLE }, /* also the # key */ - { 0x1e0f, KEY_MUTE }, - { 0x1e10, KEY_VOLUMEUP }, - { 0x1e11, KEY_VOLUMEDOWN }, - { 0x1e12, KEY_PREVIOUS }, /* previous channel */ - { 0x1e14, KEY_UP }, - { 0x1e15, KEY_DOWN }, - { 0x1e16, KEY_LEFT }, - { 0x1e17, KEY_RIGHT }, - { 0x1e18, KEY_VIDEO }, /* Videos */ - { 0x1e19, KEY_AUDIO }, /* Music */ - /* 0x1e1a: Pictures - presume this means - "Multimedia Home Platform" - - no "PICTURES" key in input.h - */ - { 0x1e1a, KEY_MHP }, - - { 0x1e1b, KEY_EPG }, /* Guide */ - { 0x1e1c, KEY_TV }, - { 0x1e1e, KEY_NEXTSONG }, /* skip >| */ - { 0x1e1f, KEY_EXIT }, /* back/exit */ - { 0x1e20, KEY_CHANNELUP }, /* channel / program + */ - { 0x1e21, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x1e22, KEY_CHANNEL }, /* source (old black remote) */ - { 0x1e24, KEY_PREVIOUSSONG }, /* replay |< */ - { 0x1e25, KEY_ENTER }, /* OK */ - { 0x1e26, KEY_SLEEP }, /* minimize (old black remote) */ - { 0x1e29, KEY_BLUE }, /* blue key */ - { 0x1e2e, KEY_GREEN }, /* green button */ - { 0x1e30, KEY_PAUSE }, /* pause */ - { 0x1e32, KEY_REWIND }, /* backward << */ - { 0x1e34, KEY_FASTFORWARD }, /* forward >> */ - { 0x1e35, KEY_PLAY }, - { 0x1e36, KEY_STOP }, - { 0x1e37, KEY_RECORD }, /* recording */ - { 0x1e38, KEY_YELLOW }, /* yellow key */ - { 0x1e3b, KEY_SELECT }, /* top right button */ - { 0x1e3c, KEY_ZOOM }, /* full */ - { 0x1e3d, KEY_POWER }, /* system power (green button) */ -}; -DEFINE_IR_KEYTABLE(rc5_hauppauge_new, IR_TYPE_RC5); - -/* Terratec Cinergy Hybrid T USB XS FM - Mauro Carvalho Chehab + * All keytables got moved to include/media/keytables directory. + * This file is still needed - at least for now, as their data is + * dynamically inserted here by the media/ir-common.h, due to the + * #define IR_KEYMAPS line, at the beginning of this file. The + * plans are to get rid of this file completely in a near future. */ -static struct ir_scancode nec_terratec_cinergy_xs[] = { - { 0x1441, KEY_HOME}, - { 0x1401, KEY_POWER2}, - - { 0x1442, KEY_MENU}, /* DVD menu */ - { 0x1443, KEY_SUBTITLE}, - { 0x1444, KEY_TEXT}, /* Teletext */ - { 0x1445, KEY_DELETE}, - - { 0x1402, KEY_1}, - { 0x1403, KEY_2}, - { 0x1404, KEY_3}, - { 0x1405, KEY_4}, - { 0x1406, KEY_5}, - { 0x1407, KEY_6}, - { 0x1408, KEY_7}, - { 0x1409, KEY_8}, - { 0x140a, KEY_9}, - { 0x140c, KEY_0}, - - { 0x140b, KEY_TUNER}, /* AV */ - { 0x140d, KEY_MODE}, /* A.B */ - - { 0x1446, KEY_TV}, - { 0x1447, KEY_DVD}, - { 0x1449, KEY_VIDEO}, - { 0x144a, KEY_RADIO}, /* Music */ - { 0x144b, KEY_CAMERA}, /* PIC */ - - { 0x1410, KEY_UP}, - { 0x1411, KEY_LEFT}, - { 0x1412, KEY_OK}, - { 0x1413, KEY_RIGHT}, - { 0x1414, KEY_DOWN}, - - { 0x140f, KEY_EPG}, - { 0x1416, KEY_INFO}, - { 0x144d, KEY_BACKSPACE}, - - { 0x141c, KEY_VOLUMEUP}, - { 0x141e, KEY_VOLUMEDOWN}, - - { 0x144c, KEY_PLAY}, - { 0x141d, KEY_MUTE}, - - { 0x141b, KEY_CHANNELUP}, - { 0x141f, KEY_CHANNELDOWN}, - - { 0x1417, KEY_RED}, - { 0x1418, KEY_GREEN}, - { 0x1419, KEY_YELLOW}, - { 0x141a, KEY_BLUE}, - - { 0x1458, KEY_RECORD}, - { 0x1448, KEY_STOP}, - { 0x1440, KEY_PAUSE}, - - { 0x1454, KEY_LAST}, - { 0x144e, KEY_REWIND}, - { 0x144f, KEY_FASTFORWARD}, - { 0x145c, KEY_NEXT}, -}; -DEFINE_IR_KEYTABLE(nec_terratec_cinergy_xs, IR_TYPE_NEC); - -/* Leadtek Winfast TV USB II Deluxe remote - Magnus Alm - */ -static struct ir_scancode winfast_usbii_deluxe[] = { - { 0x62, KEY_0}, - { 0x75, KEY_1}, - { 0x76, KEY_2}, - { 0x77, KEY_3}, - { 0x79, KEY_4}, - { 0x7a, KEY_5}, - { 0x7b, KEY_6}, - { 0x7d, KEY_7}, - { 0x7e, KEY_8}, - { 0x7f, KEY_9}, - - { 0x38, KEY_CAMERA}, /* SNAPSHOT */ - { 0x37, KEY_RECORD}, /* RECORD */ - { 0x35, KEY_TIME}, /* TIMESHIFT */ - - { 0x74, KEY_VOLUMEUP}, /* VOLUMEUP */ - { 0x78, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ - { 0x64, KEY_MUTE}, /* MUTE */ - - { 0x21, KEY_CHANNEL}, /* SURF */ - { 0x7c, KEY_CHANNELUP}, /* CHANNELUP */ - { 0x60, KEY_CHANNELDOWN}, /* CHANNELDOWN */ - { 0x61, KEY_LAST}, /* LAST CHANNEL (RECALL) */ - - { 0x72, KEY_VIDEO}, /* INPUT MODES (TV/FM) */ - - { 0x70, KEY_POWER2}, /* TV ON/OFF */ - - { 0x39, KEY_CYCLEWINDOWS}, /* MINIMIZE (BOSS) */ - { 0x3a, KEY_NEW}, /* PIP */ - { 0x73, KEY_ZOOM}, /* FULLSECREEN */ - - { 0x66, KEY_INFO}, /* OSD (DISPLAY) */ - - { 0x31, KEY_DOT}, /* '.' */ - { 0x63, KEY_ENTER}, /* ENTER */ - -}; -DEFINE_LEGACY_IR_KEYTABLE(winfast_usbii_deluxe); - -/* Kworld 315U - */ -static struct ir_scancode kworld_315u[] = { - { 0x6143, KEY_POWER }, - { 0x6101, KEY_TUNER }, /* source */ - { 0x610b, KEY_ZOOM }, - { 0x6103, KEY_POWER2 }, /* shutdown */ - - { 0x6104, KEY_1 }, - { 0x6108, KEY_2 }, - { 0x6102, KEY_3 }, - { 0x6109, KEY_CHANNELUP }, - - { 0x610f, KEY_4 }, - { 0x6105, KEY_5 }, - { 0x6106, KEY_6 }, - { 0x6107, KEY_CHANNELDOWN }, - - { 0x610c, KEY_7 }, - { 0x610d, KEY_8 }, - { 0x610a, KEY_9 }, - { 0x610e, KEY_VOLUMEUP }, - - { 0x6110, KEY_LAST }, - { 0x6111, KEY_0 }, - { 0x6112, KEY_ENTER }, - { 0x6113, KEY_VOLUMEDOWN }, - - { 0x6114, KEY_RECORD }, - { 0x6115, KEY_STOP }, - { 0x6116, KEY_PLAY }, - { 0x6117, KEY_MUTE }, - - { 0x6118, KEY_UP }, - { 0x6119, KEY_DOWN }, - { 0x611a, KEY_LEFT }, - { 0x611b, KEY_RIGHT }, - { 0x611c, KEY_RED }, - { 0x611d, KEY_GREEN }, - { 0x611e, KEY_YELLOW }, - { 0x611f, KEY_BLUE }, -}; -DEFINE_IR_KEYTABLE(kworld_315u, IR_TYPE_NEC); diff --git a/include/media/ir-common.h b/include/media/ir-common.h index e8a64761df56..59ce30280b72 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -28,6 +28,71 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #define RC5_START(x) (((x)>>12)&3) #define RC5_TOGGLE(x) (((x)>>11)&1) #define RC5_ADDR(x) (((x)>>6)&31) @@ -104,89 +169,4 @@ u32 ir_rc5_decode(unsigned int code); void ir_rc5_timer_end(unsigned long data); void ir_rc5_timer_keyup(unsigned long data); -/* scancode->keycode map tables from ir-keymaps.c */ - -#define IR_KEYTABLE(a) \ -ir_codes_ ## a ## _table - -#define DECLARE_IR_KEYTABLE(a) \ -extern struct ir_scancode_table IR_KEYTABLE(a) - -#define DEFINE_IR_KEYTABLE(tabname, type) \ -struct ir_scancode_table IR_KEYTABLE(tabname) = { \ - .scan = tabname, \ - .size = ARRAY_SIZE(tabname), \ - .ir_type = type, \ - .name = #tabname, \ -}; \ -EXPORT_SYMBOL_GPL(IR_KEYTABLE(tabname)) - -#define DEFINE_LEGACY_IR_KEYTABLE(tabname) \ - DEFINE_IR_KEYTABLE(tabname, IR_TYPE_UNKNOWN) - -DECLARE_IR_KEYTABLE(adstech_dvb_t_pci); -DECLARE_IR_KEYTABLE(apac_viewcomp); -DECLARE_IR_KEYTABLE(asus_pc39); -DECLARE_IR_KEYTABLE(ati_tv_wonder_hd_600); -DECLARE_IR_KEYTABLE(avermedia); -DECLARE_IR_KEYTABLE(avermedia_a16d); -DECLARE_IR_KEYTABLE(avermedia_cardbus); -DECLARE_IR_KEYTABLE(avermedia_dvbt); -DECLARE_IR_KEYTABLE(avermedia_m135a_rm_jx); -DECLARE_IR_KEYTABLE(avertv_303); -DECLARE_IR_KEYTABLE(behold); -DECLARE_IR_KEYTABLE(behold_columbus); -DECLARE_IR_KEYTABLE(budget_ci_old); -DECLARE_IR_KEYTABLE(cinergy); -DECLARE_IR_KEYTABLE(cinergy_1400); -DECLARE_IR_KEYTABLE(dm1105_nec); -DECLARE_IR_KEYTABLE(dntv_live_dvb_t); -DECLARE_IR_KEYTABLE(dntv_live_dvbt_pro); -DECLARE_IR_KEYTABLE(empty); -DECLARE_IR_KEYTABLE(em_terratec); -DECLARE_IR_KEYTABLE(encore_enltv); -DECLARE_IR_KEYTABLE(encore_enltv2); -DECLARE_IR_KEYTABLE(encore_enltv_fm53); -DECLARE_IR_KEYTABLE(evga_indtube); -DECLARE_IR_KEYTABLE(eztv); -DECLARE_IR_KEYTABLE(flydvb); -DECLARE_IR_KEYTABLE(flyvideo); -DECLARE_IR_KEYTABLE(fusionhdtv_mce); -DECLARE_IR_KEYTABLE(gadmei_rm008z); -DECLARE_IR_KEYTABLE(genius_tvgo_a11mce); -DECLARE_IR_KEYTABLE(gotview7135); -DECLARE_IR_KEYTABLE(hauppauge_new); -DECLARE_IR_KEYTABLE(iodata_bctv7e); -DECLARE_IR_KEYTABLE(kaiomy); -DECLARE_IR_KEYTABLE(kworld_315u); -DECLARE_IR_KEYTABLE(kworld_plus_tv_analog); -DECLARE_IR_KEYTABLE(manli); -DECLARE_IR_KEYTABLE(msi_tvanywhere); -DECLARE_IR_KEYTABLE(msi_tvanywhere_plus); -DECLARE_IR_KEYTABLE(nebula); -DECLARE_IR_KEYTABLE(nec_terratec_cinergy_xs); -DECLARE_IR_KEYTABLE(norwood); -DECLARE_IR_KEYTABLE(npgtech); -DECLARE_IR_KEYTABLE(pctv_sedna); -DECLARE_IR_KEYTABLE(pinnacle_color); -DECLARE_IR_KEYTABLE(pinnacle_grey); -DECLARE_IR_KEYTABLE(pinnacle_pctv_hd); -DECLARE_IR_KEYTABLE(pixelview); -DECLARE_IR_KEYTABLE(pixelview_new); -DECLARE_IR_KEYTABLE(powercolor_real_angel); -DECLARE_IR_KEYTABLE(proteus_2309); -DECLARE_IR_KEYTABLE(purpletv); -DECLARE_IR_KEYTABLE(pv951); -DECLARE_IR_KEYTABLE(rc5_hauppauge_new); -DECLARE_IR_KEYTABLE(rc5_tv); -DECLARE_IR_KEYTABLE(real_audio_220_32_keys); -DECLARE_IR_KEYTABLE(tbs_nec); -DECLARE_IR_KEYTABLE(terratec_cinergy_xs); -DECLARE_IR_KEYTABLE(tevii_nec); -DECLARE_IR_KEYTABLE(tt_1500); -DECLARE_IR_KEYTABLE(videomate_s350); -DECLARE_IR_KEYTABLE(videomate_tv_pvr); -DECLARE_IR_KEYTABLE(winfast); -DECLARE_IR_KEYTABLE(winfast_usbii_deluxe); - #endif diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 9a2f3084ffec..643ff25daa89 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -96,6 +96,24 @@ struct ir_raw_handler { #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) +#define IR_KEYTABLE(a) \ +ir_codes_ ## a ## _table + +#define DECLARE_IR_KEYTABLE(a) \ +extern struct ir_scancode_table IR_KEYTABLE(a) + +#define DEFINE_IR_KEYTABLE(tabname, type) \ +struct ir_scancode_table IR_KEYTABLE(tabname) = { \ + .scan = tabname, \ + .size = ARRAY_SIZE(tabname), \ + .ir_type = type, \ + .name = #tabname, \ +}; \ +EXPORT_SYMBOL_GPL(IR_KEYTABLE(tabname)) + +#define DEFINE_LEGACY_IR_KEYTABLE(tabname) \ + DEFINE_IR_KEYTABLE(tabname, IR_TYPE_UNKNOWN) + /* Routines from ir-keytable.c */ u32 ir_g_keycode_from_table(struct input_dev *input_dev, diff --git a/include/media/keycodes/adstech-dvb-t-pci.h b/include/media/keycodes/adstech-dvb-t-pci.h new file mode 100644 index 000000000000..cfca5262d431 --- /dev/null +++ b/include/media/keycodes/adstech-dvb-t-pci.h @@ -0,0 +1,65 @@ +/* adstech-dvb-t-pci.h - Keytable for adstech_dvb_t_pci Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* ADS Tech Instant TV DVB-T PCI Remote */ + +#ifdef IR_KEYMAPS +static struct ir_scancode adstech_dvb_t_pci[] = { + /* Keys 0 to 9 */ + { 0x4d, KEY_0 }, + { 0x57, KEY_1 }, + { 0x4f, KEY_2 }, + { 0x53, KEY_3 }, + { 0x56, KEY_4 }, + { 0x4e, KEY_5 }, + { 0x5e, KEY_6 }, + { 0x54, KEY_7 }, + { 0x4c, KEY_8 }, + { 0x5c, KEY_9 }, + + { 0x5b, KEY_POWER }, + { 0x5f, KEY_MUTE }, + { 0x55, KEY_GOTO }, + { 0x5d, KEY_SEARCH }, + { 0x17, KEY_EPG }, /* Guide */ + { 0x1f, KEY_MENU }, + { 0x0f, KEY_UP }, + { 0x46, KEY_DOWN }, + { 0x16, KEY_LEFT }, + { 0x1e, KEY_RIGHT }, + { 0x0e, KEY_SELECT }, /* Enter */ + { 0x5a, KEY_INFO }, + { 0x52, KEY_EXIT }, + { 0x59, KEY_PREVIOUS }, + { 0x51, KEY_NEXT }, + { 0x58, KEY_REWIND }, + { 0x50, KEY_FORWARD }, + { 0x44, KEY_PLAYPAUSE }, + { 0x07, KEY_STOP }, + { 0x1b, KEY_RECORD }, + { 0x13, KEY_TUNER }, /* Live */ + { 0x0a, KEY_A }, + { 0x12, KEY_B }, + { 0x03, KEY_PROG1 }, /* 1 */ + { 0x01, KEY_PROG2 }, /* 2 */ + { 0x00, KEY_PROG3 }, /* 3 */ + { 0x06, KEY_DVD }, + { 0x48, KEY_AUX }, /* Photo */ + { 0x40, KEY_VIDEO }, + { 0x19, KEY_AUDIO }, /* Music */ + { 0x0b, KEY_CHANNELUP }, + { 0x08, KEY_CHANNELDOWN }, + { 0x15, KEY_VOLUMEUP }, + { 0x1c, KEY_VOLUMEDOWN }, +}; +DEFINE_LEGACY_IR_KEYTABLE(adstech_dvb_t_pci); +#else +DECLARE_IR_KEYTABLE(adstech_dvb_t_pci); +#endif diff --git a/include/media/keycodes/apac-viewcomp.h b/include/media/keycodes/apac-viewcomp.h new file mode 100644 index 000000000000..69460c2266ea --- /dev/null +++ b/include/media/keycodes/apac-viewcomp.h @@ -0,0 +1,56 @@ +/* apac-viewcomp.h - Keytable for apac_viewcomp Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Attila Kondoros */ + +#ifdef IR_KEYMAPS +static struct ir_scancode apac_viewcomp[] = { + + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x00, KEY_0 }, + { 0x17, KEY_LAST }, /* +100 */ + { 0x0a, KEY_LIST }, /* recall */ + + + { 0x1c, KEY_TUNER }, /* TV/FM */ + { 0x15, KEY_SEARCH }, /* scan */ + { 0x12, KEY_POWER }, /* power */ + { 0x1f, KEY_VOLUMEDOWN }, /* vol up */ + { 0x1b, KEY_VOLUMEUP }, /* vol down */ + { 0x1e, KEY_CHANNELDOWN }, /* chn up */ + { 0x1a, KEY_CHANNELUP }, /* chn down */ + + { 0x11, KEY_VIDEO }, /* video */ + { 0x0f, KEY_ZOOM }, /* full screen */ + { 0x13, KEY_MUTE }, /* mute/unmute */ + { 0x10, KEY_TEXT }, /* min */ + + { 0x0d, KEY_STOP }, /* freeze */ + { 0x0e, KEY_RECORD }, /* record */ + { 0x1d, KEY_PLAYPAUSE }, /* stop */ + { 0x19, KEY_PLAY }, /* play */ + + { 0x16, KEY_GOTO }, /* osd */ + { 0x14, KEY_REFRESH }, /* default */ + { 0x0c, KEY_KPPLUS }, /* fine tune >>>> */ + { 0x18, KEY_KPMINUS }, /* fine tune <<<< */ +}; +DEFINE_LEGACY_IR_KEYTABLE(apac_viewcomp); +#else +DECLARE_IR_KEYTABLE(apac_viewcomp); +#endif diff --git a/include/media/keycodes/asus-pc39.h b/include/media/keycodes/asus-pc39.h new file mode 100644 index 000000000000..3e89ccd40893 --- /dev/null +++ b/include/media/keycodes/asus-pc39.h @@ -0,0 +1,67 @@ +/* asus-pc39.h - Keytable for asus_pc39 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* + * Marc Fargas + * this is the remote control that comes with the asus p7131 + * which has a label saying is "Model PC-39" + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode asus_pc39[] = { + /* Keys 0 to 9 */ + { 0x15, KEY_0 }, + { 0x29, KEY_1 }, + { 0x2d, KEY_2 }, + { 0x2b, KEY_3 }, + { 0x09, KEY_4 }, + { 0x0d, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x31, KEY_7 }, + { 0x35, KEY_8 }, + { 0x33, KEY_9 }, + + { 0x3e, KEY_RADIO }, /* radio */ + { 0x03, KEY_MENU }, /* dvd/menu */ + { 0x2a, KEY_VOLUMEUP }, + { 0x19, KEY_VOLUMEDOWN }, + { 0x37, KEY_UP }, + { 0x3b, KEY_DOWN }, + { 0x27, KEY_LEFT }, + { 0x2f, KEY_RIGHT }, + { 0x25, KEY_VIDEO }, /* video */ + { 0x39, KEY_AUDIO }, /* music */ + + { 0x21, KEY_TV }, /* tv */ + { 0x1d, KEY_EXIT }, /* back */ + { 0x0a, KEY_CHANNELUP }, /* channel / program + */ + { 0x1b, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x1a, KEY_ENTER }, /* enter */ + + { 0x06, KEY_PAUSE }, /* play/pause */ + { 0x1e, KEY_PREVIOUS }, /* rew */ + { 0x26, KEY_NEXT }, /* forward */ + { 0x0e, KEY_REWIND }, /* backward << */ + { 0x3a, KEY_FASTFORWARD }, /* forward >> */ + { 0x36, KEY_STOP }, + { 0x2e, KEY_RECORD }, /* recording */ + { 0x16, KEY_POWER }, /* the button that reads "close" */ + + { 0x11, KEY_ZOOM }, /* full screen */ + { 0x13, KEY_MACRO }, /* recall */ + { 0x23, KEY_HOME }, /* home */ + { 0x05, KEY_PVR }, /* picture */ + { 0x3d, KEY_MUTE }, /* mute */ + { 0x01, KEY_DVD }, /* dvd */ +}; +DEFINE_LEGACY_IR_KEYTABLE(asus_pc39); +#else +DECLARE_IR_KEYTABLE(asus_pc39); +#endif diff --git a/include/media/keycodes/ati-tv-wonder-hd-600.h b/include/media/keycodes/ati-tv-wonder-hd-600.h new file mode 100644 index 000000000000..25db7bfcc1a9 --- /dev/null +++ b/include/media/keycodes/ati-tv-wonder-hd-600.h @@ -0,0 +1,45 @@ +/* ati-tv-wonder-hd-600.h - Keytable for ati_tv_wonder_hd_600 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* ATI TV Wonder HD 600 USB + Devin Heitmueller + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode ati_tv_wonder_hd_600[] = { + { 0x00, KEY_RECORD}, /* Row 1 */ + { 0x01, KEY_PLAYPAUSE}, + { 0x02, KEY_STOP}, + { 0x03, KEY_POWER}, + { 0x04, KEY_PREVIOUS}, /* Row 2 */ + { 0x05, KEY_REWIND}, + { 0x06, KEY_FORWARD}, + { 0x07, KEY_NEXT}, + { 0x08, KEY_EPG}, /* Row 3 */ + { 0x09, KEY_HOME}, + { 0x0a, KEY_MENU}, + { 0x0b, KEY_CHANNELUP}, + { 0x0c, KEY_BACK}, /* Row 4 */ + { 0x0d, KEY_UP}, + { 0x0e, KEY_INFO}, + { 0x0f, KEY_CHANNELDOWN}, + { 0x10, KEY_LEFT}, /* Row 5 */ + { 0x11, KEY_SELECT}, + { 0x12, KEY_RIGHT}, + { 0x13, KEY_VOLUMEUP}, + { 0x14, KEY_LAST}, /* Row 6 */ + { 0x15, KEY_DOWN}, + { 0x16, KEY_MUTE}, + { 0x17, KEY_VOLUMEDOWN}, +}; +DEFINE_LEGACY_IR_KEYTABLE(ati_tv_wonder_hd_600); +#else +DECLARE_IR_KEYTABLE(ati_tv_wonder_hd_600); +#endif diff --git a/include/media/keycodes/avermedia-a16d.h b/include/media/keycodes/avermedia-a16d.h new file mode 100644 index 000000000000..d267951665db --- /dev/null +++ b/include/media/keycodes/avermedia-a16d.h @@ -0,0 +1,52 @@ +/* avermedia-a16d.h - Keytable for avermedia_a16d Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode avermedia_a16d[] = { + { 0x20, KEY_LIST}, + { 0x00, KEY_POWER}, + { 0x28, KEY_1}, + { 0x18, KEY_2}, + { 0x38, KEY_3}, + { 0x24, KEY_4}, + { 0x14, KEY_5}, + { 0x34, KEY_6}, + { 0x2c, KEY_7}, + { 0x1c, KEY_8}, + { 0x3c, KEY_9}, + { 0x12, KEY_SUBTITLE}, + { 0x22, KEY_0}, + { 0x32, KEY_REWIND}, + { 0x3a, KEY_SHUFFLE}, + { 0x02, KEY_PRINT}, + { 0x11, KEY_CHANNELDOWN}, + { 0x31, KEY_CHANNELUP}, + { 0x0c, KEY_ZOOM}, + { 0x1e, KEY_VOLUMEDOWN}, + { 0x3e, KEY_VOLUMEUP}, + { 0x0a, KEY_MUTE}, + { 0x04, KEY_AUDIO}, + { 0x26, KEY_RECORD}, + { 0x06, KEY_PLAY}, + { 0x36, KEY_STOP}, + { 0x16, KEY_PAUSE}, + { 0x2e, KEY_REWIND}, + { 0x0e, KEY_FASTFORWARD}, + { 0x30, KEY_TEXT}, + { 0x21, KEY_GREEN}, + { 0x01, KEY_BLUE}, + { 0x08, KEY_EPG}, + { 0x2a, KEY_MENU}, +}; +DEFINE_LEGACY_IR_KEYTABLE(avermedia_a16d); +#else +DECLARE_IR_KEYTABLE(avermedia_a16d); +#endif diff --git a/include/media/keycodes/avermedia-cardbus.h b/include/media/keycodes/avermedia-cardbus.h new file mode 100644 index 000000000000..221049d1a57b --- /dev/null +++ b/include/media/keycodes/avermedia-cardbus.h @@ -0,0 +1,73 @@ +/* avermedia-cardbus.h - Keytable for avermedia_cardbus Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Oldrich Jedlicka */ + +#ifdef IR_KEYMAPS +static struct ir_scancode avermedia_cardbus[] = { + { 0x00, KEY_POWER }, + { 0x01, KEY_TUNER }, /* TV/FM */ + { 0x03, KEY_TEXT }, /* Teletext */ + { 0x04, KEY_EPG }, + { 0x05, KEY_1 }, + { 0x06, KEY_2 }, + { 0x07, KEY_3 }, + { 0x08, KEY_AUDIO }, + { 0x09, KEY_4 }, + { 0x0a, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x0c, KEY_ZOOM }, /* Full screen */ + { 0x0d, KEY_7 }, + { 0x0e, KEY_8 }, + { 0x0f, KEY_9 }, + { 0x10, KEY_PAGEUP }, /* 16-CH PREV */ + { 0x11, KEY_0 }, + { 0x12, KEY_INFO }, + { 0x13, KEY_AGAIN }, /* CH RTN - channel return */ + { 0x14, KEY_MUTE }, + { 0x15, KEY_EDIT }, /* Autoscan */ + { 0x17, KEY_SAVE }, /* Screenshot */ + { 0x18, KEY_PLAYPAUSE }, + { 0x19, KEY_RECORD }, + { 0x1a, KEY_PLAY }, + { 0x1b, KEY_STOP }, + { 0x1c, KEY_FASTFORWARD }, + { 0x1d, KEY_REWIND }, + { 0x1e, KEY_VOLUMEDOWN }, + { 0x1f, KEY_VOLUMEUP }, + { 0x22, KEY_SLEEP }, /* Sleep */ + { 0x23, KEY_ZOOM }, /* Aspect */ + { 0x26, KEY_SCREEN }, /* Pos */ + { 0x27, KEY_ANGLE }, /* Size */ + { 0x28, KEY_SELECT }, /* Select */ + { 0x29, KEY_BLUE }, /* Blue/Picture */ + { 0x2a, KEY_BACKSPACE }, /* Back */ + { 0x2b, KEY_MEDIA }, /* PIP (Picture-in-picture) */ + { 0x2c, KEY_DOWN }, + { 0x2e, KEY_DOT }, + { 0x2f, KEY_TV }, /* Live TV */ + { 0x32, KEY_LEFT }, + { 0x33, KEY_CLEAR }, /* Clear */ + { 0x35, KEY_RED }, /* Red/TV */ + { 0x36, KEY_UP }, + { 0x37, KEY_HOME }, /* Home */ + { 0x39, KEY_GREEN }, /* Green/Video */ + { 0x3d, KEY_YELLOW }, /* Yellow/Music */ + { 0x3e, KEY_OK }, /* Ok */ + { 0x3f, KEY_RIGHT }, + { 0x40, KEY_NEXT }, /* Next */ + { 0x41, KEY_PREVIOUS }, /* Previous */ + { 0x42, KEY_CHANNELDOWN }, /* Channel down */ + { 0x43, KEY_CHANNELUP }, /* Channel up */ +}; +DEFINE_LEGACY_IR_KEYTABLE(avermedia_cardbus); +#else +DECLARE_IR_KEYTABLE(avermedia_cardbus); +#endif diff --git a/include/media/keycodes/avermedia-dvbt.h b/include/media/keycodes/avermedia-dvbt.h new file mode 100644 index 000000000000..bdaadf40d2c2 --- /dev/null +++ b/include/media/keycodes/avermedia-dvbt.h @@ -0,0 +1,54 @@ +/* avermedia-dvbt.h - Keytable for avermedia_dvbt Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Matt Jesson >' */ + { 0x3a, KEY_RECORD }, /* 'capture' */ + { 0x0a, KEY_MUTE }, /* 'mute' */ + { 0x2c, KEY_RECORD }, /* 'record' */ + { 0x1c, KEY_PAUSE }, /* 'pause' */ + { 0x3c, KEY_STOP }, /* 'stop' */ + { 0x0c, KEY_PLAY }, /* 'play' */ + { 0x2e, KEY_RED }, /* 'red' */ + { 0x01, KEY_BLUE }, /* 'blue' / 'cancel' */ + { 0x0e, KEY_YELLOW }, /* 'yellow' / 'ok' */ + { 0x21, KEY_GREEN }, /* 'green' */ + { 0x11, KEY_CHANNELDOWN }, /* 'channel -' */ + { 0x31, KEY_CHANNELUP }, /* 'channel +' */ + { 0x1e, KEY_VOLUMEDOWN }, /* 'volume -' */ + { 0x3e, KEY_VOLUMEUP }, /* 'volume +' */ +}; +DEFINE_LEGACY_IR_KEYTABLE(avermedia_dvbt); +#else +DECLARE_IR_KEYTABLE(avermedia_dvbt); +#endif diff --git a/include/media/keycodes/avermedia-m135a-rm-jx.h b/include/media/keycodes/avermedia-m135a-rm-jx.h new file mode 100644 index 000000000000..1158598994cf --- /dev/null +++ b/include/media/keycodes/avermedia-m135a-rm-jx.h @@ -0,0 +1,66 @@ +/* avermedia-m135a-rm-jx.h - Keytable for avermedia_m135a_rm_jx Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* + * Avermedia M135A with IR model RM-JX + * The same codes exist on both Positivo (BR) and original IR + * Mauro Carvalho Chehab + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode avermedia_m135a_rm_jx[] = { + { 0x0200, KEY_POWER2 }, + { 0x022e, KEY_DOT }, /* '.' */ + { 0x0201, KEY_MODE }, /* TV/FM or SOURCE */ + + { 0x0205, KEY_1 }, + { 0x0206, KEY_2 }, + { 0x0207, KEY_3 }, + { 0x0209, KEY_4 }, + { 0x020a, KEY_5 }, + { 0x020b, KEY_6 }, + { 0x020d, KEY_7 }, + { 0x020e, KEY_8 }, + { 0x020f, KEY_9 }, + { 0x0211, KEY_0 }, + + { 0x0213, KEY_RIGHT }, /* -> or L */ + { 0x0212, KEY_LEFT }, /* <- or R */ + + { 0x0217, KEY_SLEEP }, /* Capturar Imagem or Snapshot */ + { 0x0210, KEY_SHUFFLE }, /* Amostra or 16 chan prev */ + + { 0x0303, KEY_CHANNELUP }, + { 0x0302, KEY_CHANNELDOWN }, + { 0x021f, KEY_VOLUMEUP }, + { 0x021e, KEY_VOLUMEDOWN }, + { 0x020c, KEY_ENTER }, /* Full Screen */ + + { 0x0214, KEY_MUTE }, + { 0x0208, KEY_AUDIO }, + + { 0x0203, KEY_TEXT }, /* Teletext */ + { 0x0204, KEY_EPG }, + { 0x022b, KEY_TV2 }, /* TV2 or PIP */ + + { 0x021d, KEY_RED }, + { 0x021c, KEY_YELLOW }, + { 0x0301, KEY_GREEN }, + { 0x0300, KEY_BLUE }, + + { 0x021a, KEY_PLAYPAUSE }, + { 0x0219, KEY_RECORD }, + { 0x0218, KEY_PLAY }, + { 0x021b, KEY_STOP }, +}; +DEFINE_IR_KEYTABLE(avermedia_m135a_rm_jx, IR_TYPE_NEC); +#else +DECLARE_IR_KEYTABLE(avermedia_m135a_rm_jx); +#endif diff --git a/include/media/keycodes/avermedia.h b/include/media/keycodes/avermedia.h new file mode 100644 index 000000000000..a4834528a8ed --- /dev/null +++ b/include/media/keycodes/avermedia.h @@ -0,0 +1,62 @@ +/* avermedia.h - Keytable for avermedia Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Alex Hermann */ + +#ifdef IR_KEYMAPS +static struct ir_scancode avermedia[] = { + { 0x28, KEY_1 }, + { 0x18, KEY_2 }, + { 0x38, KEY_3 }, + { 0x24, KEY_4 }, + { 0x14, KEY_5 }, + { 0x34, KEY_6 }, + { 0x2c, KEY_7 }, + { 0x1c, KEY_8 }, + { 0x3c, KEY_9 }, + { 0x22, KEY_0 }, + + { 0x20, KEY_TV }, /* TV/FM */ + { 0x10, KEY_CD }, /* CD */ + { 0x30, KEY_TEXT }, /* TELETEXT */ + { 0x00, KEY_POWER }, /* POWER */ + + { 0x08, KEY_VIDEO }, /* VIDEO */ + { 0x04, KEY_AUDIO }, /* AUDIO */ + { 0x0c, KEY_ZOOM }, /* FULL SCREEN */ + + { 0x12, KEY_SUBTITLE }, /* DISPLAY */ + { 0x32, KEY_REWIND }, /* LOOP */ + { 0x02, KEY_PRINT }, /* PREVIEW */ + + { 0x2a, KEY_SEARCH }, /* AUTOSCAN */ + { 0x1a, KEY_SLEEP }, /* FREEZE */ + { 0x3a, KEY_CAMERA }, /* SNAPSHOT */ + { 0x0a, KEY_MUTE }, /* MUTE */ + + { 0x26, KEY_RECORD }, /* RECORD */ + { 0x16, KEY_PAUSE }, /* PAUSE */ + { 0x36, KEY_STOP }, /* STOP */ + { 0x06, KEY_PLAY }, /* PLAY */ + + { 0x2e, KEY_RED }, /* RED */ + { 0x21, KEY_GREEN }, /* GREEN */ + { 0x0e, KEY_YELLOW }, /* YELLOW */ + { 0x01, KEY_BLUE }, /* BLUE */ + + { 0x1e, KEY_VOLUMEDOWN }, /* VOLUME- */ + { 0x3e, KEY_VOLUMEUP }, /* VOLUME+ */ + { 0x11, KEY_CHANNELDOWN }, /* CHANNEL/PAGE- */ + { 0x31, KEY_CHANNELUP } /* CHANNEL/PAGE+ */ +}; +DEFINE_LEGACY_IR_KEYTABLE(avermedia); +#else +DECLARE_IR_KEYTABLE(avermedia); +#endif diff --git a/include/media/keycodes/avertv-303.h b/include/media/keycodes/avertv-303.h new file mode 100644 index 000000000000..1ef10af78020 --- /dev/null +++ b/include/media/keycodes/avertv-303.h @@ -0,0 +1,61 @@ +/* avertv-303.h - Keytable for avertv_303 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* AVERTV STUDIO 303 Remote */ + +#ifdef IR_KEYMAPS +static struct ir_scancode avertv_303[] = { + { 0x2a, KEY_1 }, + { 0x32, KEY_2 }, + { 0x3a, KEY_3 }, + { 0x4a, KEY_4 }, + { 0x52, KEY_5 }, + { 0x5a, KEY_6 }, + { 0x6a, KEY_7 }, + { 0x72, KEY_8 }, + { 0x7a, KEY_9 }, + { 0x0e, KEY_0 }, + + { 0x02, KEY_POWER }, + { 0x22, KEY_VIDEO }, + { 0x42, KEY_AUDIO }, + { 0x62, KEY_ZOOM }, + { 0x0a, KEY_TV }, + { 0x12, KEY_CD }, + { 0x1a, KEY_TEXT }, + + { 0x16, KEY_SUBTITLE }, + { 0x1e, KEY_REWIND }, + { 0x06, KEY_PRINT }, + + { 0x2e, KEY_SEARCH }, + { 0x36, KEY_SLEEP }, + { 0x3e, KEY_SHUFFLE }, + { 0x26, KEY_MUTE }, + + { 0x4e, KEY_RECORD }, + { 0x56, KEY_PAUSE }, + { 0x5e, KEY_STOP }, + { 0x46, KEY_PLAY }, + + { 0x6e, KEY_RED }, + { 0x0b, KEY_GREEN }, + { 0x66, KEY_YELLOW }, + { 0x03, KEY_BLUE }, + + { 0x76, KEY_LEFT }, + { 0x7e, KEY_RIGHT }, + { 0x13, KEY_DOWN }, + { 0x1b, KEY_UP }, +}; +DEFINE_LEGACY_IR_KEYTABLE(avertv_303); +#else +DECLARE_IR_KEYTABLE(avertv_303); +#endif diff --git a/include/media/keycodes/behold-columbus.h b/include/media/keycodes/behold-columbus.h new file mode 100644 index 000000000000..fb68e75585f1 --- /dev/null +++ b/include/media/keycodes/behold-columbus.h @@ -0,0 +1,84 @@ +/* behold-columbus.h - Keytable for behold_columbus Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Beholder Intl. Ltd. 2008 + * Dmitry Belimov d.belimov@google.com + * Keytable is used by BeholdTV Columbus + * The "ascii-art picture" below (in comments, first row + * is the keycode in hex, and subsequent row(s) shows + * the button labels (several variants when appropriate) + * helps to descide which keycodes to assign to the buttons. + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode behold_columbus[] = { + + /* 0x13 0x11 0x1C 0x12 * + * Mute Source TV/FM Power * + * */ + + { 0x13, KEY_MUTE }, + { 0x11, KEY_PROPS }, + { 0x1C, KEY_TUNER }, /* KEY_TV/KEY_RADIO */ + { 0x12, KEY_POWER }, + + /* 0x01 0x02 0x03 0x0D * + * 1 2 3 Stereo * + * * + * 0x04 0x05 0x06 0x19 * + * 4 5 6 Snapshot * + * * + * 0x07 0x08 0x09 0x10 * + * 7 8 9 Zoom * + * */ + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x0D, KEY_SETUP }, /* Setup key */ + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x19, KEY_CAMERA }, /* Snapshot key */ + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x10, KEY_ZOOM }, + + /* 0x0A 0x00 0x0B 0x0C * + * RECALL 0 ChannelUp VolumeUp * + * */ + { 0x0A, KEY_AGAIN }, + { 0x00, KEY_0 }, + { 0x0B, KEY_CHANNELUP }, + { 0x0C, KEY_VOLUMEUP }, + + /* 0x1B 0x1D 0x15 0x18 * + * Timeshift Record ChannelDown VolumeDown * + * */ + + { 0x1B, KEY_TIME }, + { 0x1D, KEY_RECORD }, + { 0x15, KEY_CHANNELDOWN }, + { 0x18, KEY_VOLUMEDOWN }, + + /* 0x0E 0x1E 0x0F 0x1A * + * Stop Pause Previouse Next * + * */ + + { 0x0E, KEY_STOP }, + { 0x1E, KEY_PAUSE }, + { 0x0F, KEY_PREVIOUS }, + { 0x1A, KEY_NEXT }, + +}; +DEFINE_LEGACY_IR_KEYTABLE(behold_columbus); +#else +DECLARE_IR_KEYTABLE(behold_columbus); +#endif diff --git a/include/media/keycodes/behold.h b/include/media/keycodes/behold.h new file mode 100644 index 000000000000..57a2dae49b6c --- /dev/null +++ b/include/media/keycodes/behold.h @@ -0,0 +1,117 @@ +/* behold.h - Keytable for behold Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* + * Igor Kuznetsov + * Andrey J. Melnikov + * + * Keytable is used by BeholdTV 60x series, M6 series at + * least, and probably other cards too. + * The "ascii-art picture" below (in comments, first row + * is the keycode in hex, and subsequent row(s) shows + * the button labels (several variants when appropriate) + * helps to descide which keycodes to assign to the buttons. + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode behold[] = { + + /* 0x1c 0x12 * + * TV/FM POWER * + * */ + { 0x1c, KEY_TUNER }, /* XXX KEY_TV / KEY_RADIO */ + { 0x12, KEY_POWER }, + + /* 0x01 0x02 0x03 * + * 1 2 3 * + * * + * 0x04 0x05 0x06 * + * 4 5 6 * + * * + * 0x07 0x08 0x09 * + * 7 8 9 * + * */ + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + /* 0x0a 0x00 0x17 * + * RECALL 0 MODE * + * */ + { 0x0a, KEY_AGAIN }, + { 0x00, KEY_0 }, + { 0x17, KEY_MODE }, + + /* 0x14 0x10 * + * ASPECT FULLSCREEN * + * */ + { 0x14, KEY_SCREEN }, + { 0x10, KEY_ZOOM }, + + /* 0x0b * + * Up * + * * + * 0x18 0x16 0x0c * + * Left Ok Right * + * * + * 0x015 * + * Down * + * */ + { 0x0b, KEY_CHANNELUP }, + { 0x18, KEY_VOLUMEDOWN }, + { 0x16, KEY_OK }, /* XXX KEY_ENTER */ + { 0x0c, KEY_VOLUMEUP }, + { 0x15, KEY_CHANNELDOWN }, + + /* 0x11 0x0d * + * MUTE INFO * + * */ + { 0x11, KEY_MUTE }, + { 0x0d, KEY_INFO }, + + /* 0x0f 0x1b 0x1a * + * RECORD PLAY/PAUSE STOP * + * * + * 0x0e 0x1f 0x1e * + *TELETEXT AUDIO SOURCE * + * RED YELLOW * + * */ + { 0x0f, KEY_RECORD }, + { 0x1b, KEY_PLAYPAUSE }, + { 0x1a, KEY_STOP }, + { 0x0e, KEY_TEXT }, + { 0x1f, KEY_RED }, /*XXX KEY_AUDIO */ + { 0x1e, KEY_YELLOW }, /*XXX KEY_SOURCE */ + + /* 0x1d 0x13 0x19 * + * SLEEP PREVIEW DVB * + * GREEN BLUE * + * */ + { 0x1d, KEY_SLEEP }, + { 0x13, KEY_GREEN }, + { 0x19, KEY_BLUE }, /* XXX KEY_SAT */ + + /* 0x58 0x5c * + * FREEZE SNAPSHOT * + * */ + { 0x58, KEY_SLOW }, + { 0x5c, KEY_CAMERA }, + +}; +DEFINE_LEGACY_IR_KEYTABLE(behold); +#else +DECLARE_IR_KEYTABLE(behold); +#endif diff --git a/include/media/keycodes/budget-ci-old.h b/include/media/keycodes/budget-ci-old.h new file mode 100644 index 000000000000..03ada4710cfc --- /dev/null +++ b/include/media/keycodes/budget-ci-old.h @@ -0,0 +1,68 @@ +/* budget-ci-old.h - Keytable for budget_ci_old Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* From reading the following remotes: + * Zenith Universal 7 / TV Mode 807 / VCR Mode 837 + * Hauppauge (from NOVA-CI-s box product) + * This is a "middle of the road" approach, differences are noted + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode budget_ci_old[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x0a, KEY_ENTER }, + { 0x0b, KEY_RED }, + { 0x0c, KEY_POWER }, /* RADIO on Hauppauge */ + { 0x0d, KEY_MUTE }, + { 0x0f, KEY_A }, /* TV on Hauppauge */ + { 0x10, KEY_VOLUMEUP }, + { 0x11, KEY_VOLUMEDOWN }, + { 0x14, KEY_B }, + { 0x1c, KEY_UP }, + { 0x1d, KEY_DOWN }, + { 0x1e, KEY_OPTION }, /* RESERVED on Hauppauge */ + { 0x1f, KEY_BREAK }, + { 0x20, KEY_CHANNELUP }, + { 0x21, KEY_CHANNELDOWN }, + { 0x22, KEY_PREVIOUS }, /* Prev Ch on Zenith, SOURCE on Hauppauge */ + { 0x24, KEY_RESTART }, + { 0x25, KEY_OK }, + { 0x26, KEY_CYCLEWINDOWS }, /* MINIMIZE on Hauppauge */ + { 0x28, KEY_ENTER }, /* VCR mode on Zenith */ + { 0x29, KEY_PAUSE }, + { 0x2b, KEY_RIGHT }, + { 0x2c, KEY_LEFT }, + { 0x2e, KEY_MENU }, /* FULL SCREEN on Hauppauge */ + { 0x30, KEY_SLOW }, + { 0x31, KEY_PREVIOUS }, /* VCR mode on Zenith */ + { 0x32, KEY_REWIND }, + { 0x34, KEY_FASTFORWARD }, + { 0x35, KEY_PLAY }, + { 0x36, KEY_STOP }, + { 0x37, KEY_RECORD }, + { 0x38, KEY_TUNER }, /* TV/VCR on Zenith */ + { 0x3a, KEY_C }, + { 0x3c, KEY_EXIT }, + { 0x3d, KEY_POWER2 }, + { 0x3e, KEY_TUNER }, +}; +DEFINE_LEGACY_IR_KEYTABLE(budget_ci_old); +#else +DECLARE_IR_KEYTABLE(budget_ci_old); +#endif diff --git a/include/media/keycodes/cinergy-1400.h b/include/media/keycodes/cinergy-1400.h new file mode 100644 index 000000000000..9b562eab7715 --- /dev/null +++ b/include/media/keycodes/cinergy-1400.h @@ -0,0 +1,60 @@ +/* cinergy-1400.h - Keytable for cinergy_1400 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Cinergy 1400 DVB-T */ + +#ifdef IR_KEYMAPS +static struct ir_scancode cinergy_1400[] = { + { 0x01, KEY_POWER }, + { 0x02, KEY_1 }, + { 0x03, KEY_2 }, + { 0x04, KEY_3 }, + { 0x05, KEY_4 }, + { 0x06, KEY_5 }, + { 0x07, KEY_6 }, + { 0x08, KEY_7 }, + { 0x09, KEY_8 }, + { 0x0a, KEY_9 }, + { 0x0c, KEY_0 }, + + { 0x0b, KEY_VIDEO }, + { 0x0d, KEY_REFRESH }, + { 0x0e, KEY_SELECT }, + { 0x0f, KEY_EPG }, + { 0x10, KEY_UP }, + { 0x11, KEY_LEFT }, + { 0x12, KEY_OK }, + { 0x13, KEY_RIGHT }, + { 0x14, KEY_DOWN }, + { 0x15, KEY_TEXT }, + { 0x16, KEY_INFO }, + + { 0x17, KEY_RED }, + { 0x18, KEY_GREEN }, + { 0x19, KEY_YELLOW }, + { 0x1a, KEY_BLUE }, + + { 0x1b, KEY_CHANNELUP }, + { 0x1c, KEY_VOLUMEUP }, + { 0x1d, KEY_MUTE }, + { 0x1e, KEY_VOLUMEDOWN }, + { 0x1f, KEY_CHANNELDOWN }, + + { 0x40, KEY_PAUSE }, + { 0x4c, KEY_PLAY }, + { 0x58, KEY_RECORD }, + { 0x54, KEY_PREVIOUS }, + { 0x48, KEY_STOP }, + { 0x5c, KEY_NEXT }, +}; +DEFINE_LEGACY_IR_KEYTABLE(cinergy_1400); +#else +DECLARE_IR_KEYTABLE(cinergy_1400); +#endif diff --git a/include/media/keycodes/cinergy.h b/include/media/keycodes/cinergy.h new file mode 100644 index 000000000000..7884696bc683 --- /dev/null +++ b/include/media/keycodes/cinergy.h @@ -0,0 +1,55 @@ +/* cinergy.h - Keytable for cinergy Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode cinergy[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0a, KEY_POWER }, + { 0x0b, KEY_PROG1 }, /* app */ + { 0x0c, KEY_ZOOM }, /* zoom/fullscreen */ + { 0x0d, KEY_CHANNELUP }, /* channel */ + { 0x0e, KEY_CHANNELDOWN }, /* channel- */ + { 0x0f, KEY_VOLUMEUP }, + { 0x10, KEY_VOLUMEDOWN }, + { 0x11, KEY_TUNER }, /* AV */ + { 0x12, KEY_NUMLOCK }, /* -/-- */ + { 0x13, KEY_AUDIO }, /* audio */ + { 0x14, KEY_MUTE }, + { 0x15, KEY_UP }, + { 0x16, KEY_DOWN }, + { 0x17, KEY_LEFT }, + { 0x18, KEY_RIGHT }, + { 0x19, BTN_LEFT, }, + { 0x1a, BTN_RIGHT, }, + { 0x1b, KEY_WWW }, /* text */ + { 0x1c, KEY_REWIND }, + { 0x1d, KEY_FORWARD }, + { 0x1e, KEY_RECORD }, + { 0x1f, KEY_PLAY }, + { 0x20, KEY_PREVIOUSSONG }, + { 0x21, KEY_NEXTSONG }, + { 0x22, KEY_PAUSE }, + { 0x23, KEY_STOP }, +}; +DEFINE_LEGACY_IR_KEYTABLE(cinergy); +#else +DECLARE_IR_KEYTABLE(cinergy); +#endif diff --git a/include/media/keycodes/dm1105-nec.h b/include/media/keycodes/dm1105-nec.h new file mode 100644 index 000000000000..b87d770747a2 --- /dev/null +++ b/include/media/keycodes/dm1105-nec.h @@ -0,0 +1,52 @@ +/* dm1105-nec.h - Keytable for dm1105_nec Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* DVBWorld remotes + Igor M. Liplianin + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode dm1105_nec[] = { + { 0x0a, KEY_POWER2}, /* power */ + { 0x0c, KEY_MUTE}, /* mute */ + { 0x11, KEY_1}, + { 0x12, KEY_2}, + { 0x13, KEY_3}, + { 0x14, KEY_4}, + { 0x15, KEY_5}, + { 0x16, KEY_6}, + { 0x17, KEY_7}, + { 0x18, KEY_8}, + { 0x19, KEY_9}, + { 0x10, KEY_0}, + { 0x1c, KEY_CHANNELUP}, /* ch+ */ + { 0x0f, KEY_CHANNELDOWN}, /* ch- */ + { 0x1a, KEY_VOLUMEUP}, /* vol+ */ + { 0x0e, KEY_VOLUMEDOWN}, /* vol- */ + { 0x04, KEY_RECORD}, /* rec */ + { 0x09, KEY_CHANNEL}, /* fav */ + { 0x08, KEY_BACKSPACE}, /* rewind */ + { 0x07, KEY_FASTFORWARD}, /* fast */ + { 0x0b, KEY_PAUSE}, /* pause */ + { 0x02, KEY_ESC}, /* cancel */ + { 0x03, KEY_TAB}, /* tab */ + { 0x00, KEY_UP}, /* up */ + { 0x1f, KEY_ENTER}, /* ok */ + { 0x01, KEY_DOWN}, /* down */ + { 0x05, KEY_RECORD}, /* cap */ + { 0x06, KEY_STOP}, /* stop */ + { 0x40, KEY_ZOOM}, /* full */ + { 0x1e, KEY_TV}, /* tvmode */ + { 0x1b, KEY_B}, /* recall */ +}; +DEFINE_LEGACY_IR_KEYTABLE(dm1105_nec); +#else +DECLARE_IR_KEYTABLE(dm1105_nec); +#endif diff --git a/include/media/keycodes/dntv-live-dvb-t.h b/include/media/keycodes/dntv-live-dvb-t.h new file mode 100644 index 000000000000..4431ae6e206c --- /dev/null +++ b/include/media/keycodes/dntv-live-dvb-t.h @@ -0,0 +1,54 @@ +/* dntv-live-dvb-t.h - Keytable for dntv_live_dvb_t Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* DigitalNow DNTV Live DVB-T Remote */ + +#ifdef IR_KEYMAPS +static struct ir_scancode dntv_live_dvb_t[] = { + { 0x00, KEY_ESC }, /* 'go up a level?' */ + /* Keys 0 to 9 */ + { 0x0a, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0b, KEY_TUNER }, /* tv/fm */ + { 0x0c, KEY_SEARCH }, /* scan */ + { 0x0d, KEY_STOP }, + { 0x0e, KEY_PAUSE }, + { 0x0f, KEY_LIST }, /* source */ + + { 0x10, KEY_MUTE }, + { 0x11, KEY_REWIND }, /* backward << */ + { 0x12, KEY_POWER }, + { 0x13, KEY_CAMERA }, /* snap */ + { 0x14, KEY_AUDIO }, /* stereo */ + { 0x15, KEY_CLEAR }, /* reset */ + { 0x16, KEY_PLAY }, + { 0x17, KEY_ENTER }, + { 0x18, KEY_ZOOM }, /* full screen */ + { 0x19, KEY_FASTFORWARD }, /* forward >> */ + { 0x1a, KEY_CHANNELUP }, + { 0x1b, KEY_VOLUMEUP }, + { 0x1c, KEY_INFO }, /* preview */ + { 0x1d, KEY_RECORD }, /* record */ + { 0x1e, KEY_CHANNELDOWN }, + { 0x1f, KEY_VOLUMEDOWN }, +}; +DEFINE_LEGACY_IR_KEYTABLE(dntv_live_dvb_t); +#else +DECLARE_IR_KEYTABLE(dntv_live_dvb_t); +#endif diff --git a/include/media/keycodes/dntv-live-dvbt-pro.h b/include/media/keycodes/dntv-live-dvbt-pro.h new file mode 100644 index 000000000000..d64fa26503cc --- /dev/null +++ b/include/media/keycodes/dntv-live-dvbt-pro.h @@ -0,0 +1,73 @@ +/* dntv-live-dvbt-pro.h - Keytable for dntv_live_dvbt_pro Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* DigitalNow DNTV Live! DVB-T Pro Remote */ + +#ifdef IR_KEYMAPS +static struct ir_scancode dntv_live_dvbt_pro[] = { + { 0x16, KEY_POWER }, + { 0x5b, KEY_HOME }, + + { 0x55, KEY_TV }, /* live tv */ + { 0x58, KEY_TUNER }, /* digital Radio */ + { 0x5a, KEY_RADIO }, /* FM radio */ + { 0x59, KEY_DVD }, /* dvd menu */ + { 0x03, KEY_1 }, + { 0x01, KEY_2 }, + { 0x06, KEY_3 }, + { 0x09, KEY_4 }, + { 0x1d, KEY_5 }, + { 0x1f, KEY_6 }, + { 0x0d, KEY_7 }, + { 0x19, KEY_8 }, + { 0x1b, KEY_9 }, + { 0x0c, KEY_CANCEL }, + { 0x15, KEY_0 }, + { 0x4a, KEY_CLEAR }, + { 0x13, KEY_BACK }, + { 0x00, KEY_TAB }, + { 0x4b, KEY_UP }, + { 0x4e, KEY_LEFT }, + { 0x4f, KEY_OK }, + { 0x52, KEY_RIGHT }, + { 0x51, KEY_DOWN }, + { 0x1e, KEY_VOLUMEUP }, + { 0x0a, KEY_VOLUMEDOWN }, + { 0x02, KEY_CHANNELDOWN }, + { 0x05, KEY_CHANNELUP }, + { 0x11, KEY_RECORD }, + { 0x14, KEY_PLAY }, + { 0x4c, KEY_PAUSE }, + { 0x1a, KEY_STOP }, + { 0x40, KEY_REWIND }, + { 0x12, KEY_FASTFORWARD }, + { 0x41, KEY_PREVIOUSSONG }, /* replay |< */ + { 0x42, KEY_NEXTSONG }, /* skip >| */ + { 0x54, KEY_CAMERA }, /* capture */ + { 0x50, KEY_LANGUAGE }, /* sap */ + { 0x47, KEY_TV2 }, /* pip */ + { 0x4d, KEY_SCREEN }, + { 0x43, KEY_SUBTITLE }, + { 0x10, KEY_MUTE }, + { 0x49, KEY_AUDIO }, /* l/r */ + { 0x07, KEY_SLEEP }, + { 0x08, KEY_VIDEO }, /* a/v */ + { 0x0e, KEY_PREVIOUS }, /* recall */ + { 0x45, KEY_ZOOM }, /* zoom + */ + { 0x46, KEY_ANGLE }, /* zoom - */ + { 0x56, KEY_RED }, + { 0x57, KEY_GREEN }, + { 0x5c, KEY_YELLOW }, + { 0x5d, KEY_BLUE }, +}; +DEFINE_LEGACY_IR_KEYTABLE(dntv_live_dvbt_pro); +#else +DECLARE_IR_KEYTABLE(dntv_live_dvbt_pro); +#endif diff --git a/include/media/keycodes/em-terratec.h b/include/media/keycodes/em-terratec.h new file mode 100644 index 000000000000..906557d06143 --- /dev/null +++ b/include/media/keycodes/em-terratec.h @@ -0,0 +1,46 @@ +/* em-terratec.h - Keytable for em_terratec Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode em_terratec[] = { + { 0x01, KEY_CHANNEL }, + { 0x02, KEY_SELECT }, + { 0x03, KEY_MUTE }, + { 0x04, KEY_POWER }, + { 0x05, KEY_1 }, + { 0x06, KEY_2 }, + { 0x07, KEY_3 }, + { 0x08, KEY_CHANNELUP }, + { 0x09, KEY_4 }, + { 0x0a, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x0c, KEY_CHANNELDOWN }, + { 0x0d, KEY_7 }, + { 0x0e, KEY_8 }, + { 0x0f, KEY_9 }, + { 0x10, KEY_VOLUMEUP }, + { 0x11, KEY_0 }, + { 0x12, KEY_MENU }, + { 0x13, KEY_PRINT }, + { 0x14, KEY_VOLUMEDOWN }, + { 0x16, KEY_PAUSE }, + { 0x18, KEY_RECORD }, + { 0x19, KEY_REWIND }, + { 0x1a, KEY_PLAY }, + { 0x1b, KEY_FORWARD }, + { 0x1c, KEY_BACKSPACE }, + { 0x1e, KEY_STOP }, + { 0x40, KEY_ZOOM }, +}; +DEFINE_LEGACY_IR_KEYTABLE(em_terratec); +#else +DECLARE_IR_KEYTABLE(em_terratec); +#endif diff --git a/include/media/keycodes/empty.h b/include/media/keycodes/empty.h new file mode 100644 index 000000000000..aea866c42b22 --- /dev/null +++ b/include/media/keycodes/empty.h @@ -0,0 +1,20 @@ +/* empty.h - Keytable for empty Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* empty keytable, can be used as placeholder for not-yet created keytables */ + +#ifdef IR_KEYMAPS +static struct ir_scancode empty[] = { + { 0x2a, KEY_COFFEE }, +}; +DEFINE_LEGACY_IR_KEYTABLE(empty); +#else +DECLARE_IR_KEYTABLE(empty); +#endif diff --git a/include/media/keycodes/encore-enltv-fm53.h b/include/media/keycodes/encore-enltv-fm53.h new file mode 100644 index 000000000000..bccb7440676b --- /dev/null +++ b/include/media/keycodes/encore-enltv-fm53.h @@ -0,0 +1,57 @@ +/* encore-enltv-fm53.h - Keytable for encore_enltv_fm53 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Encore ENLTV-FM v5.3 + Mauro Carvalho Chehab + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode encore_enltv_fm53[] = { + { 0x10, KEY_POWER2}, + { 0x06, KEY_MUTE}, + + { 0x09, KEY_1}, + { 0x1d, KEY_2}, + { 0x1f, KEY_3}, + { 0x19, KEY_4}, + { 0x1b, KEY_5}, + { 0x11, KEY_6}, + { 0x17, KEY_7}, + { 0x12, KEY_8}, + { 0x16, KEY_9}, + { 0x48, KEY_0}, + + { 0x04, KEY_LIST}, /* -/-- */ + { 0x40, KEY_LAST}, /* recall */ + + { 0x02, KEY_MODE}, /* TV/AV */ + { 0x05, KEY_CAMERA}, /* SNAPSHOT */ + + { 0x4c, KEY_CHANNELUP}, /* UP */ + { 0x00, KEY_CHANNELDOWN}, /* DOWN */ + { 0x0d, KEY_VOLUMEUP}, /* RIGHT */ + { 0x15, KEY_VOLUMEDOWN}, /* LEFT */ + { 0x49, KEY_ENTER}, /* OK */ + + { 0x54, KEY_RECORD}, + { 0x4d, KEY_PLAY}, /* pause */ + + { 0x1e, KEY_MENU}, /* video setting */ + { 0x0e, KEY_RIGHT}, /* <- */ + { 0x1a, KEY_LEFT}, /* -> */ + + { 0x0a, KEY_CLEAR}, /* video default */ + { 0x0c, KEY_ZOOM}, /* hide pannel */ + { 0x47, KEY_SLEEP}, /* shutdown */ +}; +DEFINE_LEGACY_IR_KEYTABLE(encore_enltv_fm53); +#else +DECLARE_IR_KEYTABLE(encore_enltv_fm53); +#endif diff --git a/include/media/keycodes/encore-enltv.h b/include/media/keycodes/encore-enltv.h new file mode 100644 index 000000000000..4c55b526129c --- /dev/null +++ b/include/media/keycodes/encore-enltv.h @@ -0,0 +1,88 @@ +/* encore-enltv.h - Keytable for encore_enltv Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Encore ENLTV-FM - black plastic, white front cover with white glowing buttons + Juan Pablo Sormani */ + +#ifdef IR_KEYMAPS +static struct ir_scancode encore_enltv[] = { + + /* Power button does nothing, neither in Windows app, + although it sends data (used for BIOS wakeup?) */ + { 0x0d, KEY_MUTE }, + + { 0x1e, KEY_TV }, + { 0x00, KEY_VIDEO }, + { 0x01, KEY_AUDIO }, /* music */ + { 0x02, KEY_MHP }, /* picture */ + + { 0x1f, KEY_1 }, + { 0x03, KEY_2 }, + { 0x04, KEY_3 }, + { 0x05, KEY_4 }, + { 0x1c, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x1d, KEY_9 }, + { 0x0a, KEY_0 }, + + { 0x09, KEY_LIST }, /* -/-- */ + { 0x0b, KEY_LAST }, /* recall */ + + { 0x14, KEY_HOME }, /* win start menu */ + { 0x15, KEY_EXIT }, /* exit */ + { 0x16, KEY_CHANNELUP }, /* UP */ + { 0x12, KEY_CHANNELDOWN }, /* DOWN */ + { 0x0c, KEY_VOLUMEUP }, /* RIGHT */ + { 0x17, KEY_VOLUMEDOWN }, /* LEFT */ + + { 0x18, KEY_ENTER }, /* OK */ + + { 0x0e, KEY_ESC }, + { 0x13, KEY_CYCLEWINDOWS }, /* desktop */ + { 0x11, KEY_TAB }, + { 0x19, KEY_SWITCHVIDEOMODE }, /* switch */ + + { 0x1a, KEY_MENU }, + { 0x1b, KEY_ZOOM }, /* fullscreen */ + { 0x44, KEY_TIME }, /* time shift */ + { 0x40, KEY_MODE }, /* source */ + + { 0x5a, KEY_RECORD }, + { 0x42, KEY_PLAY }, /* play/pause */ + { 0x45, KEY_STOP }, + { 0x43, KEY_CAMERA }, /* camera icon */ + + { 0x48, KEY_REWIND }, + { 0x4a, KEY_FASTFORWARD }, + { 0x49, KEY_PREVIOUS }, + { 0x4b, KEY_NEXT }, + + { 0x4c, KEY_FAVORITES }, /* tv wall */ + { 0x4d, KEY_SOUND }, /* DVD sound */ + { 0x4e, KEY_LANGUAGE }, /* DVD lang */ + { 0x4f, KEY_TEXT }, /* DVD text */ + + { 0x50, KEY_SLEEP }, /* shutdown */ + { 0x51, KEY_MODE }, /* stereo > main */ + { 0x52, KEY_SELECT }, /* stereo > sap */ + { 0x53, KEY_PROG1 }, /* teletext */ + + + { 0x59, KEY_RED }, /* AP1 */ + { 0x41, KEY_GREEN }, /* AP2 */ + { 0x47, KEY_YELLOW }, /* AP3 */ + { 0x57, KEY_BLUE }, /* AP4 */ +}; +DEFINE_LEGACY_IR_KEYTABLE(encore_enltv); +#else +DECLARE_IR_KEYTABLE(encore_enltv); +#endif diff --git a/include/media/keycodes/encore-enltv2.h b/include/media/keycodes/encore-enltv2.h new file mode 100644 index 000000000000..6b37fbcfc4aa --- /dev/null +++ b/include/media/keycodes/encore-enltv2.h @@ -0,0 +1,66 @@ +/* encore-enltv2.h - Keytable for encore_enltv2 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton + Mauro Carvalho Chehab */ + +#ifdef IR_KEYMAPS +static struct ir_scancode encore_enltv2[] = { + { 0x4c, KEY_POWER2 }, + { 0x4a, KEY_TUNER }, + { 0x40, KEY_1 }, + { 0x60, KEY_2 }, + { 0x50, KEY_3 }, + { 0x70, KEY_4 }, + { 0x48, KEY_5 }, + { 0x68, KEY_6 }, + { 0x58, KEY_7 }, + { 0x78, KEY_8 }, + { 0x44, KEY_9 }, + { 0x54, KEY_0 }, + + { 0x64, KEY_LAST }, /* +100 */ + { 0x4e, KEY_AGAIN }, /* Recall */ + + { 0x6c, KEY_SWITCHVIDEOMODE }, /* Video Source */ + { 0x5e, KEY_MENU }, + { 0x56, KEY_SCREEN }, + { 0x7a, KEY_SETUP }, + + { 0x46, KEY_MUTE }, + { 0x5c, KEY_MODE }, /* Stereo */ + { 0x74, KEY_INFO }, + { 0x7c, KEY_CLEAR }, + + { 0x55, KEY_UP }, + { 0x49, KEY_DOWN }, + { 0x7e, KEY_LEFT }, + { 0x59, KEY_RIGHT }, + { 0x6a, KEY_ENTER }, + + { 0x42, KEY_VOLUMEUP }, + { 0x62, KEY_VOLUMEDOWN }, + { 0x52, KEY_CHANNELUP }, + { 0x72, KEY_CHANNELDOWN }, + + { 0x41, KEY_RECORD }, + { 0x51, KEY_CAMERA }, /* Snapshot */ + { 0x75, KEY_TIME }, /* Timeshift */ + { 0x71, KEY_TV2 }, /* PIP */ + + { 0x45, KEY_REWIND }, + { 0x6f, KEY_PAUSE }, + { 0x7d, KEY_FORWARD }, + { 0x79, KEY_STOP }, +}; +DEFINE_LEGACY_IR_KEYTABLE(encore_enltv2); +#else +DECLARE_IR_KEYTABLE(encore_enltv2); +#endif diff --git a/include/media/keycodes/evga-indtube.h b/include/media/keycodes/evga-indtube.h new file mode 100644 index 000000000000..2aab58d75037 --- /dev/null +++ b/include/media/keycodes/evga-indtube.h @@ -0,0 +1,37 @@ +/* evga-indtube.h - Keytable for evga_indtube Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* EVGA inDtube + Devin Heitmueller + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode evga_indtube[] = { + { 0x12, KEY_POWER}, + { 0x02, KEY_MODE}, /* TV */ + { 0x14, KEY_MUTE}, + { 0x1a, KEY_CHANNELUP}, + { 0x16, KEY_TV2}, /* PIP */ + { 0x1d, KEY_VOLUMEUP}, + { 0x05, KEY_CHANNELDOWN}, + { 0x0f, KEY_PLAYPAUSE}, + { 0x19, KEY_VOLUMEDOWN}, + { 0x1c, KEY_REWIND}, + { 0x0d, KEY_RECORD}, + { 0x18, KEY_FORWARD}, + { 0x1e, KEY_PREVIOUS}, + { 0x1b, KEY_STOP}, + { 0x1f, KEY_NEXT}, + { 0x13, KEY_CAMERA}, +}; +DEFINE_LEGACY_IR_KEYTABLE(evga_indtube); +#else +DECLARE_IR_KEYTABLE(evga_indtube); +#endif diff --git a/include/media/keycodes/eztv.h b/include/media/keycodes/eztv.h new file mode 100644 index 000000000000..030f57a61349 --- /dev/null +++ b/include/media/keycodes/eztv.h @@ -0,0 +1,72 @@ +/* eztv.h - Keytable for eztv Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Alfons Geser + * updates from Job D. R. Borges */ + +#ifdef IR_KEYMAPS +static struct ir_scancode eztv[] = { + { 0x12, KEY_POWER }, + { 0x01, KEY_TV }, /* DVR */ + { 0x15, KEY_DVD }, /* DVD */ + { 0x17, KEY_AUDIO }, /* music */ + /* DVR mode / DVD mode / music mode */ + + { 0x1b, KEY_MUTE }, /* mute */ + { 0x02, KEY_LANGUAGE }, /* MTS/SAP / audio / autoseek */ + { 0x1e, KEY_SUBTITLE }, /* closed captioning / subtitle / seek */ + { 0x16, KEY_ZOOM }, /* full screen */ + { 0x1c, KEY_VIDEO }, /* video source / eject / delall */ + { 0x1d, KEY_RESTART }, /* playback / angle / del */ + { 0x2f, KEY_SEARCH }, /* scan / menu / playlist */ + { 0x30, KEY_CHANNEL }, /* CH surfing / bookmark / memo */ + + { 0x31, KEY_HELP }, /* help */ + { 0x32, KEY_MODE }, /* num/memo */ + { 0x33, KEY_ESC }, /* cancel */ + + { 0x0c, KEY_UP }, /* up */ + { 0x10, KEY_DOWN }, /* down */ + { 0x08, KEY_LEFT }, /* left */ + { 0x04, KEY_RIGHT }, /* right */ + { 0x03, KEY_SELECT }, /* select */ + + { 0x1f, KEY_REWIND }, /* rewind */ + { 0x20, KEY_PLAYPAUSE },/* play/pause */ + { 0x29, KEY_FORWARD }, /* forward */ + { 0x14, KEY_AGAIN }, /* repeat */ + { 0x2b, KEY_RECORD }, /* recording */ + { 0x2c, KEY_STOP }, /* stop */ + { 0x2d, KEY_PLAY }, /* play */ + { 0x2e, KEY_CAMERA }, /* snapshot / shuffle */ + + { 0x00, KEY_0 }, + { 0x05, KEY_1 }, + { 0x06, KEY_2 }, + { 0x07, KEY_3 }, + { 0x09, KEY_4 }, + { 0x0a, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x0d, KEY_7 }, + { 0x0e, KEY_8 }, + { 0x0f, KEY_9 }, + + { 0x2a, KEY_VOLUMEUP }, + { 0x11, KEY_VOLUMEDOWN }, + { 0x18, KEY_CHANNELUP },/* CH.tracking up */ + { 0x19, KEY_CHANNELDOWN },/* CH.tracking down */ + + { 0x13, KEY_ENTER }, /* enter */ + { 0x21, KEY_DOT }, /* . (decimal dot) */ +}; +DEFINE_LEGACY_IR_KEYTABLE(eztv); +#else +DECLARE_IR_KEYTABLE(eztv); +#endif diff --git a/include/media/keycodes/flydvb.h b/include/media/keycodes/flydvb.h new file mode 100644 index 000000000000..b270cc058b7c --- /dev/null +++ b/include/media/keycodes/flydvb.h @@ -0,0 +1,54 @@ +/* flydvb.h - Keytable for flydvb Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode flydvb[] = { + { 0x01, KEY_ZOOM }, /* Full Screen */ + { 0x00, KEY_POWER }, /* Power */ + + { 0x03, KEY_1 }, + { 0x04, KEY_2 }, + { 0x05, KEY_3 }, + { 0x07, KEY_4 }, + { 0x08, KEY_5 }, + { 0x09, KEY_6 }, + { 0x0b, KEY_7 }, + { 0x0c, KEY_8 }, + { 0x0d, KEY_9 }, + { 0x06, KEY_AGAIN }, /* Recall */ + { 0x0f, KEY_0 }, + { 0x10, KEY_MUTE }, /* Mute */ + { 0x02, KEY_RADIO }, /* TV/Radio */ + { 0x1b, KEY_LANGUAGE }, /* SAP (Second Audio Program) */ + + { 0x14, KEY_VOLUMEUP }, /* VOL+ */ + { 0x17, KEY_VOLUMEDOWN }, /* VOL- */ + { 0x12, KEY_CHANNELUP }, /* CH+ */ + { 0x13, KEY_CHANNELDOWN }, /* CH- */ + { 0x1d, KEY_ENTER }, /* Enter */ + + { 0x1a, KEY_MODE }, /* PIP */ + { 0x18, KEY_TUNER }, /* Source */ + + { 0x1e, KEY_RECORD }, /* Record/Pause */ + { 0x15, KEY_ANGLE }, /* Swap (no label on key) */ + { 0x1c, KEY_PAUSE }, /* Timeshift/Pause */ + { 0x19, KEY_BACK }, /* Rewind << */ + { 0x0a, KEY_PLAYPAUSE }, /* Play/Pause */ + { 0x1f, KEY_FORWARD }, /* Forward >> */ + { 0x16, KEY_PREVIOUS }, /* Back |<< */ + { 0x11, KEY_STOP }, /* Stop */ + { 0x0e, KEY_NEXT }, /* End >>| */ +}; +DEFINE_LEGACY_IR_KEYTABLE(flydvb); +#else +DECLARE_IR_KEYTABLE(flydvb); +#endif diff --git a/include/media/keycodes/flyvideo.h b/include/media/keycodes/flyvideo.h new file mode 100644 index 000000000000..5c52f92d039c --- /dev/null +++ b/include/media/keycodes/flyvideo.h @@ -0,0 +1,47 @@ +/* flyvideo.h - Keytable for flyvideo Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode flyvideo[] = { + { 0x0f, KEY_0 }, + { 0x03, KEY_1 }, + { 0x04, KEY_2 }, + { 0x05, KEY_3 }, + { 0x07, KEY_4 }, + { 0x08, KEY_5 }, + { 0x09, KEY_6 }, + { 0x0b, KEY_7 }, + { 0x0c, KEY_8 }, + { 0x0d, KEY_9 }, + + { 0x0e, KEY_MODE }, /* Air/Cable */ + { 0x11, KEY_VIDEO }, /* Video */ + { 0x15, KEY_AUDIO }, /* Audio */ + { 0x00, KEY_POWER }, /* Power */ + { 0x18, KEY_TUNER }, /* AV Source */ + { 0x02, KEY_ZOOM }, /* Fullscreen */ + { 0x1a, KEY_LANGUAGE }, /* Stereo */ + { 0x1b, KEY_MUTE }, /* Mute */ + { 0x14, KEY_VOLUMEUP }, /* Volume + */ + { 0x17, KEY_VOLUMEDOWN },/* Volume - */ + { 0x12, KEY_CHANNELUP },/* Channel + */ + { 0x13, KEY_CHANNELDOWN },/* Channel - */ + { 0x06, KEY_AGAIN }, /* Recall */ + { 0x10, KEY_ENTER }, /* Enter */ + + { 0x19, KEY_BACK }, /* Rewind ( <<< ) */ + { 0x1f, KEY_FORWARD }, /* Forward ( >>> ) */ + { 0x0a, KEY_ANGLE }, /* no label, may be used as the PAUSE button */ +}; +DEFINE_LEGACY_IR_KEYTABLE(flyvideo); +#else +DECLARE_IR_KEYTABLE(flyvideo); +#endif diff --git a/include/media/keycodes/fusionhdtv-mce.h b/include/media/keycodes/fusionhdtv-mce.h new file mode 100644 index 000000000000..bf2998f6a9d2 --- /dev/null +++ b/include/media/keycodes/fusionhdtv-mce.h @@ -0,0 +1,74 @@ +/* fusionhdtv-mce.h - Keytable for fusionhdtv_mce Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* DViCO FUSION HDTV MCE remote */ + +#ifdef IR_KEYMAPS +static struct ir_scancode fusionhdtv_mce[] = { + + { 0x0b, KEY_1 }, + { 0x17, KEY_2 }, + { 0x1b, KEY_3 }, + { 0x07, KEY_4 }, + { 0x50, KEY_5 }, + { 0x54, KEY_6 }, + { 0x48, KEY_7 }, + { 0x4c, KEY_8 }, + { 0x58, KEY_9 }, + { 0x03, KEY_0 }, + + { 0x5e, KEY_OK }, + { 0x51, KEY_UP }, + { 0x53, KEY_DOWN }, + { 0x5b, KEY_LEFT }, + { 0x5f, KEY_RIGHT }, + + { 0x02, KEY_TV }, /* Labeled DTV on remote */ + { 0x0e, KEY_MP3 }, + { 0x1a, KEY_DVD }, + { 0x1e, KEY_FAVORITES }, /* Labeled CPF on remote */ + { 0x16, KEY_SETUP }, + { 0x46, KEY_POWER2 }, /* TV On/Off button on remote */ + { 0x0a, KEY_EPG }, /* Labeled Guide on remote */ + + { 0x49, KEY_BACK }, + { 0x59, KEY_INFO }, /* Labeled MORE on remote */ + { 0x4d, KEY_MENU }, /* Labeled DVDMENU on remote */ + { 0x55, KEY_CYCLEWINDOWS }, /* Labeled ALT-TAB on remote */ + + { 0x0f, KEY_PREVIOUSSONG }, /* Labeled |<< REPLAY on remote */ + { 0x12, KEY_NEXTSONG }, /* Labeled >>| SKIP on remote */ + { 0x42, KEY_ENTER }, /* Labeled START with a green + MS windows logo on remote */ + + { 0x15, KEY_VOLUMEUP }, + { 0x05, KEY_VOLUMEDOWN }, + { 0x11, KEY_CHANNELUP }, + { 0x09, KEY_CHANNELDOWN }, + + { 0x52, KEY_CAMERA }, + { 0x5a, KEY_TUNER }, + { 0x19, KEY_OPEN }, + + { 0x13, KEY_MODE }, /* 4:3 16:9 select */ + { 0x1f, KEY_ZOOM }, + + { 0x43, KEY_REWIND }, + { 0x47, KEY_PLAYPAUSE }, + { 0x4f, KEY_FASTFORWARD }, + { 0x57, KEY_MUTE }, + { 0x0d, KEY_STOP }, + { 0x01, KEY_RECORD }, + { 0x4e, KEY_POWER }, +}; +DEFINE_LEGACY_IR_KEYTABLE(fusionhdtv_mce); +#else +DECLARE_IR_KEYTABLE(fusionhdtv_mce); +#endif diff --git a/include/media/keycodes/gadmei-rm008z.h b/include/media/keycodes/gadmei-rm008z.h new file mode 100644 index 000000000000..b73d3e5d7292 --- /dev/null +++ b/include/media/keycodes/gadmei-rm008z.h @@ -0,0 +1,57 @@ +/* gadmei-rm008z.h - Keytable for gadmei_rm008z Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* GADMEI UTV330+ RM008Z remote + Shine Liu + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode gadmei_rm008z[] = { + { 0x14, KEY_POWER2}, /* POWER OFF */ + { 0x0c, KEY_MUTE}, /* MUTE */ + + { 0x18, KEY_TV}, /* TV */ + { 0x0e, KEY_VIDEO}, /* AV */ + { 0x0b, KEY_AUDIO}, /* SV */ + { 0x0f, KEY_RADIO}, /* FM */ + + { 0x00, KEY_1}, + { 0x01, KEY_2}, + { 0x02, KEY_3}, + { 0x03, KEY_4}, + { 0x04, KEY_5}, + { 0x05, KEY_6}, + { 0x06, KEY_7}, + { 0x07, KEY_8}, + { 0x08, KEY_9}, + { 0x09, KEY_0}, + { 0x0a, KEY_INFO}, /* OSD */ + { 0x1c, KEY_BACKSPACE}, /* LAST */ + + { 0x0d, KEY_PLAY}, /* PLAY */ + { 0x1e, KEY_CAMERA}, /* SNAPSHOT */ + { 0x1a, KEY_RECORD}, /* RECORD */ + { 0x17, KEY_STOP}, /* STOP */ + + { 0x1f, KEY_UP}, /* UP */ + { 0x44, KEY_DOWN}, /* DOWN */ + { 0x46, KEY_TAB}, /* BACK */ + { 0x4a, KEY_ZOOM}, /* FULLSECREEN */ + + { 0x10, KEY_VOLUMEUP}, /* VOLUMEUP */ + { 0x11, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ + { 0x12, KEY_CHANNELUP}, /* CHANNELUP */ + { 0x13, KEY_CHANNELDOWN}, /* CHANNELDOWN */ + { 0x15, KEY_ENTER}, /* OK */ +}; +DEFINE_LEGACY_IR_KEYTABLE(gadmei_rm008z); +#else +DECLARE_IR_KEYTABLE(gadmei_rm008z); +#endif diff --git a/include/media/keycodes/genius-tvgo-a11mce.h b/include/media/keycodes/genius-tvgo-a11mce.h new file mode 100644 index 000000000000..b0aad3b489b0 --- /dev/null +++ b/include/media/keycodes/genius-tvgo-a11mce.h @@ -0,0 +1,60 @@ +/* genius-tvgo-a11mce.h - Keytable for genius_tvgo_a11mce Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* + * Remote control for the Genius TVGO A11MCE + * Adrian Pardini + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode genius_tvgo_a11mce[] = { + /* Keys 0 to 9 */ + { 0x48, KEY_0 }, + { 0x09, KEY_1 }, + { 0x1d, KEY_2 }, + { 0x1f, KEY_3 }, + { 0x19, KEY_4 }, + { 0x1b, KEY_5 }, + { 0x11, KEY_6 }, + { 0x17, KEY_7 }, + { 0x12, KEY_8 }, + { 0x16, KEY_9 }, + + { 0x54, KEY_RECORD }, /* recording */ + { 0x06, KEY_MUTE }, /* mute */ + { 0x10, KEY_POWER }, + { 0x40, KEY_LAST }, /* recall */ + { 0x4c, KEY_CHANNELUP }, /* channel / program + */ + { 0x00, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x0d, KEY_VOLUMEUP }, + { 0x15, KEY_VOLUMEDOWN }, + { 0x4d, KEY_OK }, /* also labeled as Pause */ + { 0x1c, KEY_ZOOM }, /* full screen and Stop*/ + { 0x02, KEY_MODE }, /* AV Source or Rewind*/ + { 0x04, KEY_LIST }, /* -/-- */ + /* small arrows above numbers */ + { 0x1a, KEY_NEXT }, /* also Fast Forward */ + { 0x0e, KEY_PREVIOUS }, /* also Rewind */ + /* these are in a rather non standard layout and have + an alternate name written */ + { 0x1e, KEY_UP }, /* Video Setting */ + { 0x0a, KEY_DOWN }, /* Video Default */ + { 0x05, KEY_CAMERA }, /* Snapshot */ + { 0x0c, KEY_RIGHT }, /* Hide Panel */ + /* Four buttons without label */ + { 0x49, KEY_RED }, + { 0x0b, KEY_GREEN }, + { 0x13, KEY_YELLOW }, + { 0x50, KEY_BLUE }, +}; +DEFINE_LEGACY_IR_KEYTABLE(genius_tvgo_a11mce); +#else +DECLARE_IR_KEYTABLE(genius_tvgo_a11mce); +#endif diff --git a/include/media/keycodes/gotview7135.h b/include/media/keycodes/gotview7135.h new file mode 100644 index 000000000000..1d108e85a342 --- /dev/null +++ b/include/media/keycodes/gotview7135.h @@ -0,0 +1,55 @@ +/* gotview7135.h - Keytable for gotview7135 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Mike Baikov */ + +#ifdef IR_KEYMAPS +static struct ir_scancode gotview7135[] = { + + { 0x11, KEY_POWER }, + { 0x35, KEY_TV }, + { 0x1b, KEY_0 }, + { 0x29, KEY_1 }, + { 0x19, KEY_2 }, + { 0x39, KEY_3 }, + { 0x1f, KEY_4 }, + { 0x2c, KEY_5 }, + { 0x21, KEY_6 }, + { 0x24, KEY_7 }, + { 0x18, KEY_8 }, + { 0x2b, KEY_9 }, + { 0x3b, KEY_AGAIN }, /* LOOP */ + { 0x06, KEY_AUDIO }, + { 0x31, KEY_PRINT }, /* PREVIEW */ + { 0x3e, KEY_VIDEO }, + { 0x10, KEY_CHANNELUP }, + { 0x20, KEY_CHANNELDOWN }, + { 0x0c, KEY_VOLUMEDOWN }, + { 0x28, KEY_VOLUMEUP }, + { 0x08, KEY_MUTE }, + { 0x26, KEY_SEARCH }, /* SCAN */ + { 0x3f, KEY_CAMERA }, /* SNAPSHOT */ + { 0x12, KEY_RECORD }, + { 0x32, KEY_STOP }, + { 0x3c, KEY_PLAY }, + { 0x1d, KEY_REWIND }, + { 0x2d, KEY_PAUSE }, + { 0x0d, KEY_FORWARD }, + { 0x05, KEY_ZOOM }, /*FULL*/ + + { 0x2a, KEY_F21 }, /* LIVE TIMESHIFT */ + { 0x0e, KEY_F22 }, /* MIN TIMESHIFT */ + { 0x1e, KEY_TIME }, /* TIMESHIFT */ + { 0x38, KEY_F24 }, /* NORMAL TIMESHIFT */ +}; +DEFINE_LEGACY_IR_KEYTABLE(gotview7135); +#else +DECLARE_IR_KEYTABLE(gotview7135); +#endif diff --git a/include/media/keycodes/hauppauge-new.h b/include/media/keycodes/hauppauge-new.h new file mode 100644 index 000000000000..f06702d0ebd2 --- /dev/null +++ b/include/media/keycodes/hauppauge-new.h @@ -0,0 +1,76 @@ +/* hauppauge-new.h - Keytable for hauppauge_new Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Hauppauge: the newer, gray remotes (seems there are multiple + * slightly different versions), shipped with cx88+ivtv cards. + * almost rc5 coding, but some non-standard keys */ + +#ifdef IR_KEYMAPS +static struct ir_scancode hauppauge_new[] = { + /* Keys 0 to 9 */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0a, KEY_TEXT }, /* keypad asterisk as well */ + { 0x0b, KEY_RED }, /* red button */ + { 0x0c, KEY_RADIO }, + { 0x0d, KEY_MENU }, + { 0x0e, KEY_SUBTITLE }, /* also the # key */ + { 0x0f, KEY_MUTE }, + { 0x10, KEY_VOLUMEUP }, + { 0x11, KEY_VOLUMEDOWN }, + { 0x12, KEY_PREVIOUS }, /* previous channel */ + { 0x14, KEY_UP }, + { 0x15, KEY_DOWN }, + { 0x16, KEY_LEFT }, + { 0x17, KEY_RIGHT }, + { 0x18, KEY_VIDEO }, /* Videos */ + { 0x19, KEY_AUDIO }, /* Music */ + /* 0x1a: Pictures - presume this means + "Multimedia Home Platform" - + no "PICTURES" key in input.h + */ + { 0x1a, KEY_MHP }, + + { 0x1b, KEY_EPG }, /* Guide */ + { 0x1c, KEY_TV }, + { 0x1e, KEY_NEXTSONG }, /* skip >| */ + { 0x1f, KEY_EXIT }, /* back/exit */ + { 0x20, KEY_CHANNELUP }, /* channel / program + */ + { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x22, KEY_CHANNEL }, /* source (old black remote) */ + { 0x24, KEY_PREVIOUSSONG }, /* replay |< */ + { 0x25, KEY_ENTER }, /* OK */ + { 0x26, KEY_SLEEP }, /* minimize (old black remote) */ + { 0x29, KEY_BLUE }, /* blue key */ + { 0x2e, KEY_GREEN }, /* green button */ + { 0x30, KEY_PAUSE }, /* pause */ + { 0x32, KEY_REWIND }, /* backward << */ + { 0x34, KEY_FASTFORWARD }, /* forward >> */ + { 0x35, KEY_PLAY }, + { 0x36, KEY_STOP }, + { 0x37, KEY_RECORD }, /* recording */ + { 0x38, KEY_YELLOW }, /* yellow key */ + { 0x3b, KEY_SELECT }, /* top right button */ + { 0x3c, KEY_ZOOM }, /* full */ + { 0x3d, KEY_POWER }, /* system power (green button) */ +}; +DEFINE_LEGACY_IR_KEYTABLE(hauppauge_new); +#else +DECLARE_IR_KEYTABLE(hauppauge_new); +#endif diff --git a/include/media/keycodes/iodata-bctv7e.h b/include/media/keycodes/iodata-bctv7e.h new file mode 100644 index 000000000000..6dea92a8f3a7 --- /dev/null +++ b/include/media/keycodes/iodata-bctv7e.h @@ -0,0 +1,64 @@ +/* iodata-bctv7e.h - Keytable for iodata_bctv7e Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* IO-DATA BCTV7E Remote */ + +#ifdef IR_KEYMAPS +static struct ir_scancode iodata_bctv7e[] = { + { 0x40, KEY_TV }, + { 0x20, KEY_RADIO }, /* FM */ + { 0x60, KEY_EPG }, + { 0x00, KEY_POWER }, + + /* Keys 0 to 9 */ + { 0x44, KEY_0 }, /* 10 */ + { 0x50, KEY_1 }, + { 0x30, KEY_2 }, + { 0x70, KEY_3 }, + { 0x48, KEY_4 }, + { 0x28, KEY_5 }, + { 0x68, KEY_6 }, + { 0x58, KEY_7 }, + { 0x38, KEY_8 }, + { 0x78, KEY_9 }, + + { 0x10, KEY_L }, /* Live */ + { 0x08, KEY_TIME }, /* Time Shift */ + + { 0x18, KEY_PLAYPAUSE }, /* Play */ + + { 0x24, KEY_ENTER }, /* 11 */ + { 0x64, KEY_ESC }, /* 12 */ + { 0x04, KEY_M }, /* Multi */ + + { 0x54, KEY_VIDEO }, + { 0x34, KEY_CHANNELUP }, + { 0x74, KEY_VOLUMEUP }, + { 0x14, KEY_MUTE }, + + { 0x4c, KEY_VCR }, /* SVIDEO */ + { 0x2c, KEY_CHANNELDOWN }, + { 0x6c, KEY_VOLUMEDOWN }, + { 0x0c, KEY_ZOOM }, + + { 0x5c, KEY_PAUSE }, + { 0x3c, KEY_RED }, /* || (red) */ + { 0x7c, KEY_RECORD }, /* recording */ + { 0x1c, KEY_STOP }, + + { 0x41, KEY_REWIND }, /* backward << */ + { 0x21, KEY_PLAY }, + { 0x61, KEY_FASTFORWARD }, /* forward >> */ + { 0x01, KEY_NEXT }, /* skip >| */ +}; +DEFINE_LEGACY_IR_KEYTABLE(iodata_bctv7e); +#else +DECLARE_IR_KEYTABLE(iodata_bctv7e); +#endif diff --git a/include/media/keycodes/kaiomy.h b/include/media/keycodes/kaiomy.h new file mode 100644 index 000000000000..2d6dbbc073a8 --- /dev/null +++ b/include/media/keycodes/kaiomy.h @@ -0,0 +1,63 @@ +/* kaiomy.h - Keytable for kaiomy Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Kaiomy TVnPC U2 + Mauro Carvalho Chehab + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode kaiomy[] = { + { 0x43, KEY_POWER2}, + { 0x01, KEY_LIST}, + { 0x0b, KEY_ZOOM}, + { 0x03, KEY_POWER}, + + { 0x04, KEY_1}, + { 0x08, KEY_2}, + { 0x02, KEY_3}, + + { 0x0f, KEY_4}, + { 0x05, KEY_5}, + { 0x06, KEY_6}, + + { 0x0c, KEY_7}, + { 0x0d, KEY_8}, + { 0x0a, KEY_9}, + + { 0x11, KEY_0}, + + { 0x09, KEY_CHANNELUP}, + { 0x07, KEY_CHANNELDOWN}, + + { 0x0e, KEY_VOLUMEUP}, + { 0x13, KEY_VOLUMEDOWN}, + + { 0x10, KEY_HOME}, + { 0x12, KEY_ENTER}, + + { 0x14, KEY_RECORD}, + { 0x15, KEY_STOP}, + { 0x16, KEY_PLAY}, + { 0x17, KEY_MUTE}, + + { 0x18, KEY_UP}, + { 0x19, KEY_DOWN}, + { 0x1a, KEY_LEFT}, + { 0x1b, KEY_RIGHT}, + + { 0x1c, KEY_RED}, + { 0x1d, KEY_GREEN}, + { 0x1e, KEY_YELLOW}, + { 0x1f, KEY_BLUE}, +}; +DEFINE_LEGACY_IR_KEYTABLE(kaiomy); +#else +DECLARE_IR_KEYTABLE(kaiomy); +#endif diff --git a/include/media/keycodes/kworld-315u.h b/include/media/keycodes/kworld-315u.h new file mode 100644 index 000000000000..44e29b61cb6f --- /dev/null +++ b/include/media/keycodes/kworld-315u.h @@ -0,0 +1,59 @@ +/* kworld-315u.h - Keytable for kworld_315u Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Kworld 315U + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode kworld_315u[] = { + { 0x6143, KEY_POWER }, + { 0x6101, KEY_TUNER }, /* source */ + { 0x610b, KEY_ZOOM }, + { 0x6103, KEY_POWER2 }, /* shutdown */ + + { 0x6104, KEY_1 }, + { 0x6108, KEY_2 }, + { 0x6102, KEY_3 }, + { 0x6109, KEY_CHANNELUP }, + + { 0x610f, KEY_4 }, + { 0x6105, KEY_5 }, + { 0x6106, KEY_6 }, + { 0x6107, KEY_CHANNELDOWN }, + + { 0x610c, KEY_7 }, + { 0x610d, KEY_8 }, + { 0x610a, KEY_9 }, + { 0x610e, KEY_VOLUMEUP }, + + { 0x6110, KEY_LAST }, + { 0x6111, KEY_0 }, + { 0x6112, KEY_ENTER }, + { 0x6113, KEY_VOLUMEDOWN }, + + { 0x6114, KEY_RECORD }, + { 0x6115, KEY_STOP }, + { 0x6116, KEY_PLAY }, + { 0x6117, KEY_MUTE }, + + { 0x6118, KEY_UP }, + { 0x6119, KEY_DOWN }, + { 0x611a, KEY_LEFT }, + { 0x611b, KEY_RIGHT }, + + { 0x611c, KEY_RED }, + { 0x611d, KEY_GREEN }, + { 0x611e, KEY_YELLOW }, + { 0x611f, KEY_BLUE }, +}; +DEFINE_IR_KEYTABLE(kworld_315u, IR_TYPE_NEC); +#else +DECLARE_IR_KEYTABLE(kworld_315u); +#endif diff --git a/include/media/keycodes/kworld-plus-tv-analog.h b/include/media/keycodes/kworld-plus-tv-analog.h new file mode 100644 index 000000000000..2b4ae0b75e52 --- /dev/null +++ b/include/media/keycodes/kworld-plus-tv-analog.h @@ -0,0 +1,75 @@ +/* kworld-plus-tv-analog.h - Keytable for kworld_plus_tv_analog Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Kworld Plus TV Analog Lite PCI IR + Mauro Carvalho Chehab + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode kworld_plus_tv_analog[] = { + { 0x0c, KEY_PROG1 }, /* Kworld key */ + { 0x16, KEY_CLOSECD }, /* -> ) */ + { 0x1d, KEY_POWER2 }, + + { 0x00, KEY_1 }, + { 0x01, KEY_2 }, + { 0x02, KEY_3 }, /* Two keys have the same code: 3 and left */ + { 0x03, KEY_4 }, /* Two keys have the same code: 3 and right */ + { 0x04, KEY_5 }, + { 0x05, KEY_6 }, + { 0x06, KEY_7 }, + { 0x07, KEY_8 }, + { 0x08, KEY_9 }, + { 0x0a, KEY_0 }, + + { 0x09, KEY_AGAIN }, + { 0x14, KEY_MUTE }, + + { 0x20, KEY_UP }, + { 0x21, KEY_DOWN }, + { 0x0b, KEY_ENTER }, + + { 0x10, KEY_CHANNELUP }, + { 0x11, KEY_CHANNELDOWN }, + + /* Couldn't map key left/key right since those + conflict with '3' and '4' scancodes + I dunno what the original driver does + */ + + { 0x13, KEY_VOLUMEUP }, + { 0x12, KEY_VOLUMEDOWN }, + + /* The lower part of the IR + There are several duplicated keycodes there. + Most of them conflict with digits. + Add mappings just to the unused scancodes. + Somehow, the original driver has a way to know, + but this doesn't seem to be on some GPIO. + Also, it is not related to the time between keyup + and keydown. + */ + { 0x19, KEY_TIME}, /* Timeshift */ + { 0x1a, KEY_STOP}, + { 0x1b, KEY_RECORD}, + + { 0x22, KEY_TEXT}, + + { 0x15, KEY_AUDIO}, /* ((*)) */ + { 0x0f, KEY_ZOOM}, + { 0x1c, KEY_CAMERA}, /* snapshot */ + + { 0x18, KEY_RED}, /* B */ + { 0x23, KEY_GREEN}, /* C */ +}; +DEFINE_LEGACY_IR_KEYTABLE(kworld_plus_tv_analog); +#else +DECLARE_IR_KEYTABLE(kworld_plus_tv_analog); +#endif diff --git a/include/media/keycodes/manli.h b/include/media/keycodes/manli.h new file mode 100644 index 000000000000..9f8e752505c8 --- /dev/null +++ b/include/media/keycodes/manli.h @@ -0,0 +1,111 @@ +/* manli.h - Keytable for manli Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Michael Tokarev + http://www.corpit.ru/mjt/beholdTV/remote_control.jpg + keytable is used by MANLI MTV00[0x0c] and BeholdTV 40[13] at + least, and probably other cards too. + The "ascii-art picture" below (in comments, first row + is the keycode in hex, and subsequent row(s) shows + the button labels (several variants when appropriate) + helps to descide which keycodes to assign to the buttons. + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode manli[] = { + + /* 0x1c 0x12 * + * FUNCTION POWER * + * FM (|) * + * */ + { 0x1c, KEY_RADIO }, /*XXX*/ + { 0x12, KEY_POWER }, + + /* 0x01 0x02 0x03 * + * 1 2 3 * + * * + * 0x04 0x05 0x06 * + * 4 5 6 * + * * + * 0x07 0x08 0x09 * + * 7 8 9 * + * */ + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + /* 0x0a 0x00 0x17 * + * RECALL 0 +100 * + * PLUS * + * */ + { 0x0a, KEY_AGAIN }, /*XXX KEY_REWIND? */ + { 0x00, KEY_0 }, + { 0x17, KEY_DIGITS }, /*XXX*/ + + /* 0x14 0x10 * + * MENU INFO * + * OSD */ + { 0x14, KEY_MENU }, + { 0x10, KEY_INFO }, + + /* 0x0b * + * Up * + * * + * 0x18 0x16 0x0c * + * Left Ok Right * + * * + * 0x015 * + * Down * + * */ + { 0x0b, KEY_UP }, + { 0x18, KEY_LEFT }, + { 0x16, KEY_OK }, /*XXX KEY_SELECT? KEY_ENTER? */ + { 0x0c, KEY_RIGHT }, + { 0x15, KEY_DOWN }, + + /* 0x11 0x0d * + * TV/AV MODE * + * SOURCE STEREO * + * */ + { 0x11, KEY_TV }, /*XXX*/ + { 0x0d, KEY_MODE }, /*XXX there's no KEY_STEREO */ + + /* 0x0f 0x1b 0x1a * + * AUDIO Vol+ Chan+ * + * TIMESHIFT??? * + * * + * 0x0e 0x1f 0x1e * + * SLEEP Vol- Chan- * + * */ + { 0x0f, KEY_AUDIO }, + { 0x1b, KEY_VOLUMEUP }, + { 0x1a, KEY_CHANNELUP }, + { 0x0e, KEY_TIME }, + { 0x1f, KEY_VOLUMEDOWN }, + { 0x1e, KEY_CHANNELDOWN }, + + /* 0x13 0x19 * + * MUTE SNAPSHOT* + * */ + { 0x13, KEY_MUTE }, + { 0x19, KEY_CAMERA }, + + /* 0x1d unused ? */ +}; +DEFINE_LEGACY_IR_KEYTABLE(manli); +#else +DECLARE_IR_KEYTABLE(manli); +#endif diff --git a/include/media/keycodes/msi-tvanywhere-plus.h b/include/media/keycodes/msi-tvanywhere-plus.h new file mode 100644 index 000000000000..c5e51ad55976 --- /dev/null +++ b/include/media/keycodes/msi-tvanywhere-plus.h @@ -0,0 +1,100 @@ +/* msi-tvanywhere-plus.h - Keytable for msi_tvanywhere_plus Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* + Keycodes for remote on the MSI TV@nywhere Plus. The controller IC on the card + is marked "KS003". The controller is I2C at address 0x30, but does not seem + to respond to probes until a read is performed from a valid device. + I don't know why... + + Note: This remote may be of similar or identical design to the + Pixelview remote (?). The raw codes and duplicate button codes + appear to be the same. + + Henry Wong + Some changes to formatting and keycodes by Mark Schultz + +*/ + +#ifdef IR_KEYMAPS +static struct ir_scancode msi_tvanywhere_plus[] = { + +/* ---- Remote Button Layout ---- + + POWER SOURCE SCAN MUTE + TV/FM 1 2 3 + |> 4 5 6 + <| 7 8 9 + ^^UP 0 + RECALL + vvDN RECORD STOP PLAY + + MINIMIZE ZOOM + + CH+ + VOL- VOL+ + CH- + + SNAPSHOT MTS + + << FUNC >> RESET +*/ + + { 0x01, KEY_1 }, /* 1 */ + { 0x0b, KEY_2 }, /* 2 */ + { 0x1b, KEY_3 }, /* 3 */ + { 0x05, KEY_4 }, /* 4 */ + { 0x09, KEY_5 }, /* 5 */ + { 0x15, KEY_6 }, /* 6 */ + { 0x06, KEY_7 }, /* 7 */ + { 0x0a, KEY_8 }, /* 8 */ + { 0x12, KEY_9 }, /* 9 */ + { 0x02, KEY_0 }, /* 0 */ + { 0x10, KEY_KPPLUS }, /* + */ + { 0x13, KEY_AGAIN }, /* Recall */ + + { 0x1e, KEY_POWER }, /* Power */ + { 0x07, KEY_TUNER }, /* Source */ + { 0x1c, KEY_SEARCH }, /* Scan */ + { 0x18, KEY_MUTE }, /* Mute */ + + { 0x03, KEY_RADIO }, /* TV/FM */ + /* The next four keys are duplicates that appear to send the + same IR code as Ch+, Ch-, >>, and << . The raw code assigned + to them is the actual code + 0x20 - they will never be + detected as such unless some way is discovered to distinguish + these buttons from those that have the same code. */ + { 0x3f, KEY_RIGHT }, /* |> and Ch+ */ + { 0x37, KEY_LEFT }, /* <| and Ch- */ + { 0x2c, KEY_UP }, /* ^^Up and >> */ + { 0x24, KEY_DOWN }, /* vvDn and << */ + + { 0x00, KEY_RECORD }, /* Record */ + { 0x08, KEY_STOP }, /* Stop */ + { 0x11, KEY_PLAY }, /* Play */ + + { 0x0f, KEY_CLOSE }, /* Minimize */ + { 0x19, KEY_ZOOM }, /* Zoom */ + { 0x1a, KEY_CAMERA }, /* Snapshot */ + { 0x0d, KEY_LANGUAGE }, /* MTS */ + + { 0x14, KEY_VOLUMEDOWN }, /* Vol- */ + { 0x16, KEY_VOLUMEUP }, /* Vol+ */ + { 0x17, KEY_CHANNELDOWN }, /* Ch- */ + { 0x1f, KEY_CHANNELUP }, /* Ch+ */ + + { 0x04, KEY_REWIND }, /* << */ + { 0x0e, KEY_MENU }, /* Function */ + { 0x0c, KEY_FASTFORWARD }, /* >> */ + { 0x1d, KEY_RESTART }, /* Reset */ +}; +DEFINE_LEGACY_IR_KEYTABLE(msi_tvanywhere_plus); +#else +DECLARE_IR_KEYTABLE(msi_tvanywhere_plus); +#endif diff --git a/include/media/keycodes/msi-tvanywhere.h b/include/media/keycodes/msi-tvanywhere.h new file mode 100644 index 000000000000..2f4cfe100ab2 --- /dev/null +++ b/include/media/keycodes/msi-tvanywhere.h @@ -0,0 +1,44 @@ +/* msi-tvanywhere.h - Keytable for msi_tvanywhere Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode msi_tvanywhere[] = { + /* Keys 0 to 9 */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0c, KEY_MUTE }, + { 0x0f, KEY_SCREEN }, /* Full Screen */ + { 0x10, KEY_FN }, /* Funtion */ + { 0x11, KEY_TIME }, /* Time shift */ + { 0x12, KEY_POWER }, + { 0x13, KEY_MEDIA }, /* MTS */ + { 0x14, KEY_SLOW }, + { 0x16, KEY_REWIND }, /* backward << */ + { 0x17, KEY_ENTER }, /* Return */ + { 0x18, KEY_FASTFORWARD }, /* forward >> */ + { 0x1a, KEY_CHANNELUP }, + { 0x1b, KEY_VOLUMEUP }, + { 0x1e, KEY_CHANNELDOWN }, + { 0x1f, KEY_VOLUMEDOWN }, +}; +DEFINE_LEGACY_IR_KEYTABLE(msi_tvanywhere); +#else +DECLARE_IR_KEYTABLE(msi_tvanywhere); +#endif diff --git a/include/media/keycodes/nebula.h b/include/media/keycodes/nebula.h new file mode 100644 index 000000000000..4e2eb1f13685 --- /dev/null +++ b/include/media/keycodes/nebula.h @@ -0,0 +1,73 @@ +/* nebula.h - Keytable for nebula Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode nebula[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x0a, KEY_TV }, + { 0x0b, KEY_AUX }, + { 0x0c, KEY_DVD }, + { 0x0d, KEY_POWER }, + { 0x0e, KEY_MHP }, /* labelled 'Picture' */ + { 0x0f, KEY_AUDIO }, + { 0x10, KEY_INFO }, + { 0x11, KEY_F13 }, /* 16:9 */ + { 0x12, KEY_F14 }, /* 14:9 */ + { 0x13, KEY_EPG }, + { 0x14, KEY_EXIT }, + { 0x15, KEY_MENU }, + { 0x16, KEY_UP }, + { 0x17, KEY_DOWN }, + { 0x18, KEY_LEFT }, + { 0x19, KEY_RIGHT }, + { 0x1a, KEY_ENTER }, + { 0x1b, KEY_CHANNELUP }, + { 0x1c, KEY_CHANNELDOWN }, + { 0x1d, KEY_VOLUMEUP }, + { 0x1e, KEY_VOLUMEDOWN }, + { 0x1f, KEY_RED }, + { 0x20, KEY_GREEN }, + { 0x21, KEY_YELLOW }, + { 0x22, KEY_BLUE }, + { 0x23, KEY_SUBTITLE }, + { 0x24, KEY_F15 }, /* AD */ + { 0x25, KEY_TEXT }, + { 0x26, KEY_MUTE }, + { 0x27, KEY_REWIND }, + { 0x28, KEY_STOP }, + { 0x29, KEY_PLAY }, + { 0x2a, KEY_FASTFORWARD }, + { 0x2b, KEY_F16 }, /* chapter */ + { 0x2c, KEY_PAUSE }, + { 0x2d, KEY_PLAY }, + { 0x2e, KEY_RECORD }, + { 0x2f, KEY_F17 }, /* picture in picture */ + { 0x30, KEY_KPPLUS }, /* zoom in */ + { 0x31, KEY_KPMINUS }, /* zoom out */ + { 0x32, KEY_F18 }, /* capture */ + { 0x33, KEY_F19 }, /* web */ + { 0x34, KEY_EMAIL }, + { 0x35, KEY_PHONE }, + { 0x36, KEY_PC }, +}; +DEFINE_LEGACY_IR_KEYTABLE(nebula); +#else +DECLARE_IR_KEYTABLE(nebula); +#endif diff --git a/include/media/keycodes/nec-terratec-cinergy-xs.h b/include/media/keycodes/nec-terratec-cinergy-xs.h new file mode 100644 index 000000000000..39ede1ebc764 --- /dev/null +++ b/include/media/keycodes/nec-terratec-cinergy-xs.h @@ -0,0 +1,81 @@ +/* nec-terratec-cinergy-xs.h - Keytable for nec_terratec_cinergy_xs Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Terratec Cinergy Hybrid T USB XS FM + Mauro Carvalho Chehab + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode nec_terratec_cinergy_xs[] = { + { 0x1441, KEY_HOME}, + { 0x1401, KEY_POWER2}, + + { 0x1442, KEY_MENU}, /* DVD menu */ + { 0x1443, KEY_SUBTITLE}, + { 0x1444, KEY_TEXT}, /* Teletext */ + { 0x1445, KEY_DELETE}, + + { 0x1402, KEY_1}, + { 0x1403, KEY_2}, + { 0x1404, KEY_3}, + { 0x1405, KEY_4}, + { 0x1406, KEY_5}, + { 0x1407, KEY_6}, + { 0x1408, KEY_7}, + { 0x1409, KEY_8}, + { 0x140a, KEY_9}, + { 0x140c, KEY_0}, + + { 0x140b, KEY_TUNER}, /* AV */ + { 0x140d, KEY_MODE}, /* A.B */ + + { 0x1446, KEY_TV}, + { 0x1447, KEY_DVD}, + { 0x1449, KEY_VIDEO}, + { 0x144a, KEY_RADIO}, /* Music */ + { 0x144b, KEY_CAMERA}, /* PIC */ + + { 0x1410, KEY_UP}, + { 0x1411, KEY_LEFT}, + { 0x1412, KEY_OK}, + { 0x1413, KEY_RIGHT}, + { 0x1414, KEY_DOWN}, + + { 0x140f, KEY_EPG}, + { 0x1416, KEY_INFO}, + { 0x144d, KEY_BACKSPACE}, + + { 0x141c, KEY_VOLUMEUP}, + { 0x141e, KEY_VOLUMEDOWN}, + + { 0x144c, KEY_PLAY}, + { 0x141d, KEY_MUTE}, + + { 0x141b, KEY_CHANNELUP}, + { 0x141f, KEY_CHANNELDOWN}, + + { 0x1417, KEY_RED}, + { 0x1418, KEY_GREEN}, + { 0x1419, KEY_YELLOW}, + { 0x141a, KEY_BLUE}, + + { 0x1458, KEY_RECORD}, + { 0x1448, KEY_STOP}, + { 0x1440, KEY_PAUSE}, + + { 0x1454, KEY_LAST}, + { 0x144e, KEY_REWIND}, + { 0x144f, KEY_FASTFORWARD}, + { 0x145c, KEY_NEXT}, +}; +DEFINE_IR_KEYTABLE(nec_terratec_cinergy_xs, IR_TYPE_NEC); +#else +DECLARE_IR_KEYTABLE(nec_terratec_cinergy_xs); +#endif diff --git a/include/media/keycodes/norwood.h b/include/media/keycodes/norwood.h new file mode 100644 index 000000000000..7f6cc4c243e6 --- /dev/null +++ b/include/media/keycodes/norwood.h @@ -0,0 +1,61 @@ +/* norwood.h - Keytable for norwood Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Norwood Micro (non-Pro) TV Tuner + By Peter Naulls + Key comments are the functions given in the manual */ + +#ifdef IR_KEYMAPS +static struct ir_scancode norwood[] = { + /* 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 */ +}; +DEFINE_LEGACY_IR_KEYTABLE(norwood); +#else +DECLARE_IR_KEYTABLE(norwood); +#endif diff --git a/include/media/keycodes/npgtech.h b/include/media/keycodes/npgtech.h new file mode 100644 index 000000000000..dd1ba828181b --- /dev/null +++ b/include/media/keycodes/npgtech.h @@ -0,0 +1,57 @@ +/* npgtech.h - Keytable for npgtech Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode npgtech[] = { + { 0x1d, KEY_SWITCHVIDEOMODE }, /* switch inputs */ + { 0x2a, KEY_FRONT }, + + { 0x3e, KEY_1 }, + { 0x02, KEY_2 }, + { 0x06, KEY_3 }, + { 0x0a, KEY_4 }, + { 0x0e, KEY_5 }, + { 0x12, KEY_6 }, + { 0x16, KEY_7 }, + { 0x1a, KEY_8 }, + { 0x1e, KEY_9 }, + { 0x3a, KEY_0 }, + { 0x22, KEY_NUMLOCK }, /* -/-- */ + { 0x20, KEY_REFRESH }, + + { 0x03, KEY_BRIGHTNESSDOWN }, + { 0x28, KEY_AUDIO }, + { 0x3c, KEY_CHANNELUP }, + { 0x3f, KEY_VOLUMEDOWN }, + { 0x2e, KEY_MUTE }, + { 0x3b, KEY_VOLUMEUP }, + { 0x00, KEY_CHANNELDOWN }, + { 0x07, KEY_BRIGHTNESSUP }, + { 0x2c, KEY_TEXT }, + + { 0x37, KEY_RECORD }, + { 0x17, KEY_PLAY }, + { 0x13, KEY_PAUSE }, + { 0x26, KEY_STOP }, + { 0x18, KEY_FASTFORWARD }, + { 0x14, KEY_REWIND }, + { 0x33, KEY_ZOOM }, + { 0x32, KEY_KEYBOARD }, + { 0x30, KEY_GOTO }, /* Pointing arrow */ + { 0x36, KEY_MACRO }, /* Maximize/Minimize (yellow) */ + { 0x0b, KEY_RADIO }, + { 0x10, KEY_POWER }, + +}; +DEFINE_LEGACY_IR_KEYTABLE(npgtech); +#else +DECLARE_IR_KEYTABLE(npgtech); +#endif diff --git a/include/media/keycodes/pctv-sedna.h b/include/media/keycodes/pctv-sedna.h new file mode 100644 index 000000000000..b1d511f2f567 --- /dev/null +++ b/include/media/keycodes/pctv-sedna.h @@ -0,0 +1,56 @@ +/* pctv-sedna.h - Keytable for pctv_sedna Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Mapping for the 28 key remote control as seen at + http://www.sednacomputer.com/photo/cardbus-tv.jpg + Pavel Mihaylov + Also for the remote bundled with Kozumi KTV-01C card */ + +#ifdef IR_KEYMAPS +static struct ir_scancode pctv_sedna[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0a, KEY_AGAIN }, /* Recall */ + { 0x0b, KEY_CHANNELUP }, + { 0x0c, KEY_VOLUMEUP }, + { 0x0d, KEY_MODE }, /* Stereo */ + { 0x0e, KEY_STOP }, + { 0x0f, KEY_PREVIOUSSONG }, + { 0x10, KEY_ZOOM }, + { 0x11, KEY_TUNER }, /* Source */ + { 0x12, KEY_POWER }, + { 0x13, KEY_MUTE }, + { 0x15, KEY_CHANNELDOWN }, + { 0x18, KEY_VOLUMEDOWN }, + { 0x19, KEY_CAMERA }, /* Snapshot */ + { 0x1a, KEY_NEXTSONG }, + { 0x1b, KEY_TIME }, /* Time Shift */ + { 0x1c, KEY_RADIO }, /* FM Radio */ + { 0x1d, KEY_RECORD }, + { 0x1e, KEY_PAUSE }, + /* additional codes for Kozumi's remote */ + { 0x14, KEY_INFO }, /* OSD */ + { 0x16, KEY_OK }, /* OK */ + { 0x17, KEY_DIGITS }, /* Plus */ + { 0x1f, KEY_PLAY }, /* Play */ +}; +DEFINE_LEGACY_IR_KEYTABLE(pctv_sedna); +#else +DECLARE_IR_KEYTABLE(pctv_sedna); +#endif diff --git a/include/media/keycodes/pinnacle-color.h b/include/media/keycodes/pinnacle-color.h new file mode 100644 index 000000000000..a08eaeb74062 --- /dev/null +++ b/include/media/keycodes/pinnacle-color.h @@ -0,0 +1,71 @@ +/* pinnacle-color.h - Keytable for pinnacle_color Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode pinnacle_color[] = { + { 0x59, KEY_MUTE }, + { 0x4a, KEY_POWER }, + + { 0x18, KEY_TEXT }, + { 0x26, KEY_TV }, + { 0x3d, KEY_PRINT }, + + { 0x48, KEY_RED }, + { 0x04, KEY_GREEN }, + { 0x11, KEY_YELLOW }, + { 0x00, KEY_BLUE }, + + { 0x2d, KEY_VOLUMEUP }, + { 0x1e, KEY_VOLUMEDOWN }, + + { 0x49, KEY_MENU }, + + { 0x16, KEY_CHANNELUP }, + { 0x17, KEY_CHANNELDOWN }, + + { 0x20, KEY_UP }, + { 0x21, KEY_DOWN }, + { 0x22, KEY_LEFT }, + { 0x23, KEY_RIGHT }, + { 0x0d, KEY_SELECT }, + + { 0x08, KEY_BACK }, + { 0x07, KEY_REFRESH }, + + { 0x2f, KEY_ZOOM }, + { 0x29, KEY_RECORD }, + + { 0x4b, KEY_PAUSE }, + { 0x4d, KEY_REWIND }, + { 0x2e, KEY_PLAY }, + { 0x4e, KEY_FORWARD }, + { 0x53, KEY_PREVIOUS }, + { 0x4c, KEY_STOP }, + { 0x54, KEY_NEXT }, + + { 0x69, KEY_0 }, + { 0x6a, KEY_1 }, + { 0x6b, KEY_2 }, + { 0x6c, KEY_3 }, + { 0x6d, KEY_4 }, + { 0x6e, KEY_5 }, + { 0x6f, KEY_6 }, + { 0x70, KEY_7 }, + { 0x71, KEY_8 }, + { 0x72, KEY_9 }, + + { 0x74, KEY_CHANNEL }, + { 0x0a, KEY_BACKSPACE }, +}; +DEFINE_LEGACY_IR_KEYTABLE(pinnacle_color); +#else +DECLARE_IR_KEYTABLE(pinnacle_color); +#endif diff --git a/include/media/keycodes/pinnacle-grey.h b/include/media/keycodes/pinnacle-grey.h new file mode 100644 index 000000000000..3fd250483ce4 --- /dev/null +++ b/include/media/keycodes/pinnacle-grey.h @@ -0,0 +1,66 @@ +/* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode pinnacle_grey[] = { + { 0x3a, KEY_0 }, + { 0x31, KEY_1 }, + { 0x32, KEY_2 }, + { 0x33, KEY_3 }, + { 0x34, KEY_4 }, + { 0x35, KEY_5 }, + { 0x36, KEY_6 }, + { 0x37, KEY_7 }, + { 0x38, KEY_8 }, + { 0x39, KEY_9 }, + + { 0x2f, KEY_POWER }, + + { 0x2e, KEY_P }, + { 0x1f, KEY_L }, + { 0x2b, KEY_I }, + + { 0x2d, KEY_SCREEN }, + { 0x1e, KEY_ZOOM }, + { 0x1b, KEY_VOLUMEUP }, + { 0x0f, KEY_VOLUMEDOWN }, + { 0x17, KEY_CHANNELUP }, + { 0x1c, KEY_CHANNELDOWN }, + { 0x25, KEY_INFO }, + + { 0x3c, KEY_MUTE }, + + { 0x3d, KEY_LEFT }, + { 0x3b, KEY_RIGHT }, + + { 0x3f, KEY_UP }, + { 0x3e, KEY_DOWN }, + { 0x1a, KEY_ENTER }, + + { 0x1d, KEY_MENU }, + { 0x19, KEY_AGAIN }, + { 0x16, KEY_PREVIOUSSONG }, + { 0x13, KEY_NEXTSONG }, + { 0x15, KEY_PAUSE }, + { 0x0e, KEY_REWIND }, + { 0x0d, KEY_PLAY }, + { 0x0b, KEY_STOP }, + { 0x07, KEY_FORWARD }, + { 0x27, KEY_RECORD }, + { 0x26, KEY_TUNER }, + { 0x29, KEY_TEXT }, + { 0x2a, KEY_MEDIA }, + { 0x18, KEY_EPG }, +}; +DEFINE_LEGACY_IR_KEYTABLE(pinnacle_grey); +#else +DECLARE_IR_KEYTABLE(pinnacle_grey); +#endif diff --git a/include/media/keycodes/pinnacle-pctv-hd.h b/include/media/keycodes/pinnacle-pctv-hd.h new file mode 100644 index 000000000000..be72d50269dc --- /dev/null +++ b/include/media/keycodes/pinnacle-pctv-hd.h @@ -0,0 +1,49 @@ +/* pinnacle-pctv-hd.h - Keytable for pinnacle_pctv_hd Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Pinnacle PCTV HD 800i mini remote */ + +#ifdef IR_KEYMAPS +static struct ir_scancode pinnacle_pctv_hd[] = { + + { 0x0f, KEY_1 }, + { 0x15, KEY_2 }, + { 0x10, KEY_3 }, + { 0x18, KEY_4 }, + { 0x1b, KEY_5 }, + { 0x1e, KEY_6 }, + { 0x11, KEY_7 }, + { 0x21, KEY_8 }, + { 0x12, KEY_9 }, + { 0x27, KEY_0 }, + + { 0x24, KEY_ZOOM }, + { 0x2a, KEY_SUBTITLE }, + + { 0x00, KEY_MUTE }, + { 0x01, KEY_ENTER }, /* Pinnacle Logo */ + { 0x39, KEY_POWER }, + + { 0x03, KEY_VOLUMEUP }, + { 0x09, KEY_VOLUMEDOWN }, + { 0x06, KEY_CHANNELUP }, + { 0x0c, KEY_CHANNELDOWN }, + + { 0x2d, KEY_REWIND }, + { 0x30, KEY_PLAYPAUSE }, + { 0x33, KEY_FASTFORWARD }, + { 0x3c, KEY_STOP }, + { 0x36, KEY_RECORD }, + { 0x3f, KEY_EPG }, /* Labeled "?" */ +}; +DEFINE_LEGACY_IR_KEYTABLE(pinnacle_pctv_hd); +#else +DECLARE_IR_KEYTABLE(pinnacle_pctv_hd); +#endif diff --git a/include/media/keycodes/pixelview-new.h b/include/media/keycodes/pixelview-new.h new file mode 100644 index 000000000000..76ed0c35752b --- /dev/null +++ b/include/media/keycodes/pixelview-new.h @@ -0,0 +1,59 @@ +/* pixelview-new.h - Keytable for pixelview_new Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* + Mauro Carvalho Chehab + present on PV MPEG 8000GT + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode pixelview_new[] = { + { 0x3c, KEY_TIME }, /* Timeshift */ + { 0x12, KEY_POWER }, + + { 0x3d, KEY_1 }, + { 0x38, KEY_2 }, + { 0x18, KEY_3 }, + { 0x35, KEY_4 }, + { 0x39, KEY_5 }, + { 0x15, KEY_6 }, + { 0x36, KEY_7 }, + { 0x3a, KEY_8 }, + { 0x1e, KEY_9 }, + { 0x3e, KEY_0 }, + + { 0x1c, KEY_AGAIN }, /* LOOP */ + { 0x3f, KEY_MEDIA }, /* Source */ + { 0x1f, KEY_LAST }, /* +100 */ + { 0x1b, KEY_MUTE }, + + { 0x17, KEY_CHANNELDOWN }, + { 0x16, KEY_CHANNELUP }, + { 0x10, KEY_VOLUMEUP }, + { 0x14, KEY_VOLUMEDOWN }, + { 0x13, KEY_ZOOM }, + + { 0x19, KEY_CAMERA }, /* SNAPSHOT */ + { 0x1a, KEY_SEARCH }, /* scan */ + + { 0x37, KEY_REWIND }, /* << */ + { 0x32, KEY_RECORD }, /* o (red) */ + { 0x33, KEY_FORWARD }, /* >> */ + { 0x11, KEY_STOP }, /* square */ + { 0x3b, KEY_PLAY }, /* > */ + { 0x30, KEY_PLAYPAUSE }, /* || */ + + { 0x31, KEY_TV }, + { 0x34, KEY_RADIO }, +}; +DEFINE_LEGACY_IR_KEYTABLE(pixelview_new); +#else +DECLARE_IR_KEYTABLE(pixelview_new); +#endif diff --git a/include/media/keycodes/pixelview.h b/include/media/keycodes/pixelview.h new file mode 100644 index 000000000000..e048277db895 --- /dev/null +++ b/include/media/keycodes/pixelview.h @@ -0,0 +1,59 @@ +/* pixelview.h - Keytable for pixelview Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode pixelview[] = { + + { 0x1e, KEY_POWER }, /* power */ + { 0x07, KEY_MEDIA }, /* source */ + { 0x1c, KEY_SEARCH }, /* scan */ + + + { 0x03, KEY_TUNER }, /* TV/FM */ + + { 0x00, KEY_RECORD }, + { 0x08, KEY_STOP }, + { 0x11, KEY_PLAY }, + + { 0x1a, KEY_PLAYPAUSE }, /* freeze */ + { 0x19, KEY_ZOOM }, /* zoom */ + { 0x0f, KEY_TEXT }, /* min */ + + { 0x01, KEY_1 }, + { 0x0b, KEY_2 }, + { 0x1b, KEY_3 }, + { 0x05, KEY_4 }, + { 0x09, KEY_5 }, + { 0x15, KEY_6 }, + { 0x06, KEY_7 }, + { 0x0a, KEY_8 }, + { 0x12, KEY_9 }, + { 0x02, KEY_0 }, + { 0x10, KEY_LAST }, /* +100 */ + { 0x13, KEY_LIST }, /* recall */ + + { 0x1f, KEY_CHANNELUP }, /* chn down */ + { 0x17, KEY_CHANNELDOWN }, /* chn up */ + { 0x16, KEY_VOLUMEUP }, /* vol down */ + { 0x14, KEY_VOLUMEDOWN }, /* vol up */ + + { 0x04, KEY_KPMINUS }, /* <<< */ + { 0x0e, KEY_SETUP }, /* function */ + { 0x0c, KEY_KPPLUS }, /* >>> */ + + { 0x0d, KEY_GOTO }, /* mts */ + { 0x1d, KEY_REFRESH }, /* reset */ + { 0x18, KEY_MUTE }, /* mute/unmute */ +}; +DEFINE_LEGACY_IR_KEYTABLE(pixelview); +#else +DECLARE_IR_KEYTABLE(pixelview); +#endif diff --git a/include/media/keycodes/powercolor-real-angel.h b/include/media/keycodes/powercolor-real-angel.h new file mode 100644 index 000000000000..098c4a992bfa --- /dev/null +++ b/include/media/keycodes/powercolor-real-angel.h @@ -0,0 +1,57 @@ +/* powercolor-real-angel.h - Keytable for powercolor_real_angel Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* + * Remote control for Powercolor Real Angel 330 + * Daniel Fraga + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode powercolor_real_angel[] = { + { 0x38, KEY_SWITCHVIDEOMODE }, /* switch inputs */ + { 0x0c, KEY_MEDIA }, /* Turn ON/OFF App */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x0a, KEY_DIGITS }, /* single, double, tripple digit */ + { 0x29, KEY_PREVIOUS }, /* previous channel */ + { 0x12, KEY_BRIGHTNESSUP }, + { 0x13, KEY_BRIGHTNESSDOWN }, + { 0x2b, KEY_MODE }, /* stereo/mono */ + { 0x2c, KEY_TEXT }, /* teletext */ + { 0x20, KEY_CHANNELUP }, /* channel up */ + { 0x21, KEY_CHANNELDOWN }, /* channel down */ + { 0x10, KEY_VOLUMEUP }, /* volume up */ + { 0x11, KEY_VOLUMEDOWN }, /* volume down */ + { 0x0d, KEY_MUTE }, + { 0x1f, KEY_RECORD }, + { 0x17, KEY_PLAY }, + { 0x16, KEY_PAUSE }, + { 0x0b, KEY_STOP }, + { 0x27, KEY_FASTFORWARD }, + { 0x26, KEY_REWIND }, + { 0x1e, KEY_SEARCH }, /* autoscan */ + { 0x0e, KEY_CAMERA }, /* snapshot */ + { 0x2d, KEY_SETUP }, + { 0x0f, KEY_SCREEN }, /* full screen */ + { 0x14, KEY_RADIO }, /* FM radio */ + { 0x25, KEY_POWER }, /* power */ +}; +DEFINE_LEGACY_IR_KEYTABLE(powercolor_real_angel); +#else +DECLARE_IR_KEYTABLE(powercolor_real_angel); +#endif diff --git a/include/media/keycodes/proteus-2309.h b/include/media/keycodes/proteus-2309.h new file mode 100644 index 000000000000..1993702ca557 --- /dev/null +++ b/include/media/keycodes/proteus-2309.h @@ -0,0 +1,45 @@ +/* proteus-2309.h - Keytable for proteus_2309 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Michal Majchrowicz */ + +#ifdef IR_KEYMAPS +static struct ir_scancode proteus_2309[] = { + /* numeric */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x5c, KEY_POWER }, /* power */ + { 0x20, KEY_ZOOM }, /* full screen */ + { 0x0f, KEY_BACKSPACE }, /* recall */ + { 0x1b, KEY_ENTER }, /* mute */ + { 0x41, KEY_RECORD }, /* record */ + { 0x43, KEY_STOP }, /* stop */ + { 0x16, KEY_S }, + { 0x1a, KEY_POWER2 }, /* off */ + { 0x2e, KEY_RED }, + { 0x1f, KEY_CHANNELDOWN }, /* channel - */ + { 0x1c, KEY_CHANNELUP }, /* channel + */ + { 0x10, KEY_VOLUMEDOWN }, /* volume - */ + { 0x1e, KEY_VOLUMEUP }, /* volume + */ + { 0x14, KEY_F1 }, +}; +DEFINE_LEGACY_IR_KEYTABLE(proteus_2309); +#else +DECLARE_IR_KEYTABLE(proteus_2309); +#endif diff --git a/include/media/keycodes/purpletv.h b/include/media/keycodes/purpletv.h new file mode 100644 index 000000000000..14962649a926 --- /dev/null +++ b/include/media/keycodes/purpletv.h @@ -0,0 +1,58 @@ +/* purpletv.h - Keytable for purpletv Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode purpletv[] = { + { 0x03, KEY_POWER }, + { 0x6f, KEY_MUTE }, + { 0x10, KEY_BACKSPACE }, /* Recall */ + + { 0x11, KEY_0 }, + { 0x04, KEY_1 }, + { 0x05, KEY_2 }, + { 0x06, KEY_3 }, + { 0x08, KEY_4 }, + { 0x09, KEY_5 }, + { 0x0a, KEY_6 }, + { 0x0c, KEY_7 }, + { 0x0d, KEY_8 }, + { 0x0e, KEY_9 }, + { 0x12, KEY_DOT }, /* 100+ */ + + { 0x07, KEY_VOLUMEUP }, + { 0x0b, KEY_VOLUMEDOWN }, + { 0x1a, KEY_KPPLUS }, + { 0x18, KEY_KPMINUS }, + { 0x15, KEY_UP }, + { 0x1d, KEY_DOWN }, + { 0x0f, KEY_CHANNELUP }, + { 0x13, KEY_CHANNELDOWN }, + { 0x48, KEY_ZOOM }, + + { 0x1b, KEY_VIDEO }, /* Video source */ + { 0x1f, KEY_CAMERA }, /* Snapshot */ + { 0x49, KEY_LANGUAGE }, /* MTS Select */ + { 0x19, KEY_SEARCH }, /* Auto Scan */ + + { 0x4b, KEY_RECORD }, + { 0x46, KEY_PLAY }, + { 0x45, KEY_PAUSE }, /* Pause */ + { 0x44, KEY_STOP }, + { 0x43, KEY_TIME }, /* Time Shift */ + { 0x17, KEY_CHANNEL }, /* SURF CH */ + { 0x40, KEY_FORWARD }, /* Forward ? */ + { 0x42, KEY_REWIND }, /* Backward ? */ + +}; +DEFINE_LEGACY_IR_KEYTABLE(purpletv); +#else +DECLARE_IR_KEYTABLE(purpletv); +#endif diff --git a/include/media/keycodes/pv951.h b/include/media/keycodes/pv951.h new file mode 100644 index 000000000000..33a8bf7b9080 --- /dev/null +++ b/include/media/keycodes/pv951.h @@ -0,0 +1,54 @@ +/* pv951.h - Keytable for pv951 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Mark Phalan */ + +#ifdef IR_KEYMAPS +static struct ir_scancode pv951[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x12, KEY_POWER }, + { 0x10, KEY_MUTE }, + { 0x1f, KEY_VOLUMEDOWN }, + { 0x1b, KEY_VOLUMEUP }, + { 0x1a, KEY_CHANNELUP }, + { 0x1e, KEY_CHANNELDOWN }, + { 0x0e, KEY_PAGEUP }, + { 0x1d, KEY_PAGEDOWN }, + { 0x13, KEY_SOUND }, + + { 0x18, KEY_KPPLUSMINUS }, /* CH +/- */ + { 0x16, KEY_SUBTITLE }, /* CC */ + { 0x0d, KEY_TEXT }, /* TTX */ + { 0x0b, KEY_TV }, /* AIR/CBL */ + { 0x11, KEY_PC }, /* PC/TV */ + { 0x17, KEY_OK }, /* CH RTN */ + { 0x19, KEY_MODE }, /* FUNC */ + { 0x0c, KEY_SEARCH }, /* AUTOSCAN */ + + /* Not sure what to do with these ones! */ + { 0x0f, KEY_SELECT }, /* SOURCE */ + { 0x0a, KEY_KPPLUS }, /* +100 */ + { 0x14, KEY_EQUAL }, /* SYNC */ + { 0x1c, KEY_MEDIA }, /* PC/TV */ +}; +DEFINE_LEGACY_IR_KEYTABLE(pv951); +#else +DECLARE_IR_KEYTABLE(pv951); +#endif diff --git a/include/media/keycodes/rc5-hauppauge-new.h b/include/media/keycodes/rc5-hauppauge-new.h new file mode 100644 index 000000000000..f02b59ab4f91 --- /dev/null +++ b/include/media/keycodes/rc5-hauppauge-new.h @@ -0,0 +1,79 @@ +/* rc5-hauppauge-new.h - Keytable for rc5_hauppauge_new Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* + * Hauppauge:the newer, gray remotes (seems there are multiple + * slightly different versions), shipped with cx88+ivtv cards. + * + * This table contains the complete RC5 code, instead of just the data part + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode rc5_hauppauge_new[] = { + /* Keys 0 to 9 */ + { 0x1e00, KEY_0 }, + { 0x1e01, KEY_1 }, + { 0x1e02, KEY_2 }, + { 0x1e03, KEY_3 }, + { 0x1e04, KEY_4 }, + { 0x1e05, KEY_5 }, + { 0x1e06, KEY_6 }, + { 0x1e07, KEY_7 }, + { 0x1e08, KEY_8 }, + { 0x1e09, KEY_9 }, + + { 0x1e0a, KEY_TEXT }, /* keypad asterisk as well */ + { 0x1e0b, KEY_RED }, /* red button */ + { 0x1e0c, KEY_RADIO }, + { 0x1e0d, KEY_MENU }, + { 0x1e0e, KEY_SUBTITLE }, /* also the # key */ + { 0x1e0f, KEY_MUTE }, + { 0x1e10, KEY_VOLUMEUP }, + { 0x1e11, KEY_VOLUMEDOWN }, + { 0x1e12, KEY_PREVIOUS }, /* previous channel */ + { 0x1e14, KEY_UP }, + { 0x1e15, KEY_DOWN }, + { 0x1e16, KEY_LEFT }, + { 0x1e17, KEY_RIGHT }, + { 0x1e18, KEY_VIDEO }, /* Videos */ + { 0x1e19, KEY_AUDIO }, /* Music */ + /* 0x1e1a: Pictures - presume this means + "Multimedia Home Platform" - + no "PICTURES" key in input.h + */ + { 0x1e1a, KEY_MHP }, + + { 0x1e1b, KEY_EPG }, /* Guide */ + { 0x1e1c, KEY_TV }, + { 0x1e1e, KEY_NEXTSONG }, /* skip >| */ + { 0x1e1f, KEY_EXIT }, /* back/exit */ + { 0x1e20, KEY_CHANNELUP }, /* channel / program + */ + { 0x1e21, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x1e22, KEY_CHANNEL }, /* source (old black remote) */ + { 0x1e24, KEY_PREVIOUSSONG }, /* replay |< */ + { 0x1e25, KEY_ENTER }, /* OK */ + { 0x1e26, KEY_SLEEP }, /* minimize (old black remote) */ + { 0x1e29, KEY_BLUE }, /* blue key */ + { 0x1e2e, KEY_GREEN }, /* green button */ + { 0x1e30, KEY_PAUSE }, /* pause */ + { 0x1e32, KEY_REWIND }, /* backward << */ + { 0x1e34, KEY_FASTFORWARD }, /* forward >> */ + { 0x1e35, KEY_PLAY }, + { 0x1e36, KEY_STOP }, + { 0x1e37, KEY_RECORD }, /* recording */ + { 0x1e38, KEY_YELLOW }, /* yellow key */ + { 0x1e3b, KEY_SELECT }, /* top right button */ + { 0x1e3c, KEY_ZOOM }, /* full */ + { 0x1e3d, KEY_POWER }, /* system power (green button) */ +}; +DEFINE_IR_KEYTABLE(rc5_hauppauge_new, IR_TYPE_RC5); +#else +DECLARE_IR_KEYTABLE(rc5_hauppauge_new); +#endif diff --git a/include/media/keycodes/rc5-tv.h b/include/media/keycodes/rc5-tv.h new file mode 100644 index 000000000000..a429a54e808c --- /dev/null +++ b/include/media/keycodes/rc5-tv.h @@ -0,0 +1,57 @@ +/* rc5-tv.h - Keytable for rc5_tv Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* generic RC5 keytable */ +/* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ +/* used by old (black) Hauppauge remotes */ + +#ifdef IR_KEYMAPS +static struct ir_scancode rc5_tv[] = { + /* Keys 0 to 9 */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0b, KEY_CHANNEL }, /* channel / program (japan: 11) */ + { 0x0c, KEY_POWER }, /* standby */ + { 0x0d, KEY_MUTE }, /* mute / demute */ + { 0x0f, KEY_TV }, /* display */ + { 0x10, KEY_VOLUMEUP }, + { 0x11, KEY_VOLUMEDOWN }, + { 0x12, KEY_BRIGHTNESSUP }, + { 0x13, KEY_BRIGHTNESSDOWN }, + { 0x1e, KEY_SEARCH }, /* search + */ + { 0x20, KEY_CHANNELUP }, /* channel / program + */ + { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x22, KEY_CHANNEL }, /* alt / channel */ + { 0x23, KEY_LANGUAGE }, /* 1st / 2nd language */ + { 0x26, KEY_SLEEP }, /* sleeptimer */ + { 0x2e, KEY_MENU }, /* 2nd controls (USA: menu) */ + { 0x30, KEY_PAUSE }, + { 0x32, KEY_REWIND }, + { 0x33, KEY_GOTO }, + { 0x35, KEY_PLAY }, + { 0x36, KEY_STOP }, + { 0x37, KEY_RECORD }, /* recording */ + { 0x3c, KEY_TEXT }, /* teletext submode (Japan: 12) */ + { 0x3d, KEY_SUSPEND }, /* system standby */ + +}; +DEFINE_LEGACY_IR_KEYTABLE(rc5_tv); +#else +DECLARE_IR_KEYTABLE(rc5_tv); +#endif diff --git a/include/media/keycodes/real-audio-220-32-keys.h b/include/media/keycodes/real-audio-220-32-keys.h new file mode 100644 index 000000000000..5f6835dbe4c9 --- /dev/null +++ b/include/media/keycodes/real-audio-220-32-keys.h @@ -0,0 +1,54 @@ +/* real-audio-220-32-keys.h - Keytable for real_audio_220_32_keys Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Zogis Real Audio 220 - 32 keys IR */ + +#ifdef IR_KEYMAPS +static struct ir_scancode real_audio_220_32_keys[] = { + { 0x1c, KEY_RADIO}, + { 0x12, KEY_POWER2}, + + { 0x01, KEY_1}, + { 0x02, KEY_2}, + { 0x03, KEY_3}, + { 0x04, KEY_4}, + { 0x05, KEY_5}, + { 0x06, KEY_6}, + { 0x07, KEY_7}, + { 0x08, KEY_8}, + { 0x09, KEY_9}, + { 0x00, KEY_0}, + + { 0x0c, KEY_VOLUMEUP}, + { 0x18, KEY_VOLUMEDOWN}, + { 0x0b, KEY_CHANNELUP}, + { 0x15, KEY_CHANNELDOWN}, + { 0x16, KEY_ENTER}, + + { 0x11, KEY_LIST}, /* Source */ + { 0x0d, KEY_AUDIO}, /* stereo */ + + { 0x0f, KEY_PREVIOUS}, /* Prev */ + { 0x1b, KEY_TIME}, /* Timeshift */ + { 0x1a, KEY_NEXT}, /* Next */ + + { 0x0e, KEY_STOP}, + { 0x1f, KEY_PLAY}, + { 0x1e, KEY_PLAYPAUSE}, /* Pause */ + + { 0x1d, KEY_RECORD}, + { 0x13, KEY_MUTE}, + { 0x19, KEY_CAMERA}, /* Snapshot */ + +}; +DEFINE_LEGACY_IR_KEYTABLE(real_audio_220_32_keys); +#else +DECLARE_IR_KEYTABLE(real_audio_220_32_keys); +#endif diff --git a/include/media/keycodes/tbs-nec.h b/include/media/keycodes/tbs-nec.h new file mode 100644 index 000000000000..156985e122a5 --- /dev/null +++ b/include/media/keycodes/tbs-nec.h @@ -0,0 +1,50 @@ +/* tbs-nec.h - Keytable for tbs_nec Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode tbs_nec[] = { + { 0x04, KEY_POWER2}, /*power*/ + { 0x14, KEY_MUTE}, /*mute*/ + { 0x07, KEY_1}, + { 0x06, KEY_2}, + { 0x05, KEY_3}, + { 0x0b, KEY_4}, + { 0x0a, KEY_5}, + { 0x09, KEY_6}, + { 0x0f, KEY_7}, + { 0x0e, KEY_8}, + { 0x0d, KEY_9}, + { 0x12, KEY_0}, + { 0x16, KEY_CHANNELUP}, /*ch+*/ + { 0x11, KEY_CHANNELDOWN},/*ch-*/ + { 0x13, KEY_VOLUMEUP}, /*vol+*/ + { 0x0c, KEY_VOLUMEDOWN},/*vol-*/ + { 0x03, KEY_RECORD}, /*rec*/ + { 0x18, KEY_PAUSE}, /*pause*/ + { 0x19, KEY_OK}, /*ok*/ + { 0x1a, KEY_CAMERA}, /* snapshot */ + { 0x01, KEY_UP}, + { 0x10, KEY_LEFT}, + { 0x02, KEY_RIGHT}, + { 0x08, KEY_DOWN}, + { 0x15, KEY_FAVORITES}, + { 0x17, KEY_SUBTITLE}, + { 0x1d, KEY_ZOOM}, + { 0x1f, KEY_EXIT}, + { 0x1e, KEY_MENU}, + { 0x1c, KEY_EPG}, + { 0x00, KEY_PREVIOUS}, + { 0x1b, KEY_MODE}, +}; +DEFINE_LEGACY_IR_KEYTABLE(tbs_nec); +#else +DECLARE_IR_KEYTABLE(tbs_nec); +#endif diff --git a/include/media/keycodes/terratec-cinergy-xs.h b/include/media/keycodes/terratec-cinergy-xs.h new file mode 100644 index 000000000000..8f50fae05d8f --- /dev/null +++ b/include/media/keycodes/terratec-cinergy-xs.h @@ -0,0 +1,68 @@ +/* terratec-cinergy-xs.h - Keytable for terratec_cinergy_xs Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Terratec Cinergy Hybrid T USB XS + Devin Heitmueller + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode terratec_cinergy_xs[] = { + { 0x41, KEY_HOME}, + { 0x01, KEY_POWER}, + { 0x42, KEY_MENU}, + { 0x02, KEY_1}, + { 0x03, KEY_2}, + { 0x04, KEY_3}, + { 0x43, KEY_SUBTITLE}, + { 0x05, KEY_4}, + { 0x06, KEY_5}, + { 0x07, KEY_6}, + { 0x44, KEY_TEXT}, + { 0x08, KEY_7}, + { 0x09, KEY_8}, + { 0x0a, KEY_9}, + { 0x45, KEY_DELETE}, + { 0x0b, KEY_TUNER}, + { 0x0c, KEY_0}, + { 0x0d, KEY_MODE}, + { 0x46, KEY_TV}, + { 0x47, KEY_DVD}, + { 0x49, KEY_VIDEO}, + { 0x4b, KEY_AUX}, + { 0x10, KEY_UP}, + { 0x11, KEY_LEFT}, + { 0x12, KEY_OK}, + { 0x13, KEY_RIGHT}, + { 0x14, KEY_DOWN}, + { 0x0f, KEY_EPG}, + { 0x16, KEY_INFO}, + { 0x4d, KEY_BACKSPACE}, + { 0x1c, KEY_VOLUMEUP}, + { 0x4c, KEY_PLAY}, + { 0x1b, KEY_CHANNELUP}, + { 0x1e, KEY_VOLUMEDOWN}, + { 0x1d, KEY_MUTE}, + { 0x1f, KEY_CHANNELDOWN}, + { 0x17, KEY_RED}, + { 0x18, KEY_GREEN}, + { 0x19, KEY_YELLOW}, + { 0x1a, KEY_BLUE}, + { 0x58, KEY_RECORD}, + { 0x48, KEY_STOP}, + { 0x40, KEY_PAUSE}, + { 0x54, KEY_LAST}, + { 0x4e, KEY_REWIND}, + { 0x4f, KEY_FASTFORWARD}, + { 0x5c, KEY_NEXT}, +}; +DEFINE_LEGACY_IR_KEYTABLE(terratec_cinergy_xs); +#else +DECLARE_IR_KEYTABLE(terratec_cinergy_xs); +#endif diff --git a/include/media/keycodes/tevii-nec.h b/include/media/keycodes/tevii-nec.h new file mode 100644 index 000000000000..6a8ea03a9be1 --- /dev/null +++ b/include/media/keycodes/tevii-nec.h @@ -0,0 +1,65 @@ +/* tevii-nec.h - Keytable for tevii_nec Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode tevii_nec[] = { + { 0x0a, KEY_POWER2}, + { 0x0c, KEY_MUTE}, + { 0x11, KEY_1}, + { 0x12, KEY_2}, + { 0x13, KEY_3}, + { 0x14, KEY_4}, + { 0x15, KEY_5}, + { 0x16, KEY_6}, + { 0x17, KEY_7}, + { 0x18, KEY_8}, + { 0x19, KEY_9}, + { 0x10, KEY_0}, + { 0x1c, KEY_MENU}, + { 0x0f, KEY_VOLUMEDOWN}, + { 0x1a, KEY_LAST}, + { 0x0e, KEY_OPEN}, + { 0x04, KEY_RECORD}, + { 0x09, KEY_VOLUMEUP}, + { 0x08, KEY_CHANNELUP}, + { 0x07, KEY_PVR}, + { 0x0b, KEY_TIME}, + { 0x02, KEY_RIGHT}, + { 0x03, KEY_LEFT}, + { 0x00, KEY_UP}, + { 0x1f, KEY_OK}, + { 0x01, KEY_DOWN}, + { 0x05, KEY_TUNER}, + { 0x06, KEY_CHANNELDOWN}, + { 0x40, KEY_PLAYPAUSE}, + { 0x1e, KEY_REWIND}, + { 0x1b, KEY_FAVORITES}, + { 0x1d, KEY_BACK}, + { 0x4d, KEY_FASTFORWARD}, + { 0x44, KEY_EPG}, + { 0x4c, KEY_INFO}, + { 0x41, KEY_AB}, + { 0x43, KEY_AUDIO}, + { 0x45, KEY_SUBTITLE}, + { 0x4a, KEY_LIST}, + { 0x46, KEY_F1}, + { 0x47, KEY_F2}, + { 0x5e, KEY_F3}, + { 0x5c, KEY_F4}, + { 0x52, KEY_F5}, + { 0x5a, KEY_F6}, + { 0x56, KEY_MODE}, + { 0x58, KEY_SWITCHVIDEOMODE}, +}; +DEFINE_LEGACY_IR_KEYTABLE(tevii_nec); +#else +DECLARE_IR_KEYTABLE(tevii_nec); +#endif diff --git a/include/media/keycodes/tt-1500.h b/include/media/keycodes/tt-1500.h new file mode 100644 index 000000000000..45ffcba17373 --- /dev/null +++ b/include/media/keycodes/tt-1500.h @@ -0,0 +1,58 @@ +/* tt-1500.h - Keytable for tt_1500 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* for the Technotrend 1500 bundled remotes (grey and black): */ + +#ifdef IR_KEYMAPS +static struct ir_scancode tt_1500[] = { + { 0x01, KEY_POWER }, + { 0x02, KEY_SHUFFLE }, /* ? double-arrow key */ + { 0x03, KEY_1 }, + { 0x04, KEY_2 }, + { 0x05, KEY_3 }, + { 0x06, KEY_4 }, + { 0x07, KEY_5 }, + { 0x08, KEY_6 }, + { 0x09, KEY_7 }, + { 0x0a, KEY_8 }, + { 0x0b, KEY_9 }, + { 0x0c, KEY_0 }, + { 0x0d, KEY_UP }, + { 0x0e, KEY_LEFT }, + { 0x0f, KEY_OK }, + { 0x10, KEY_RIGHT }, + { 0x11, KEY_DOWN }, + { 0x12, KEY_INFO }, + { 0x13, KEY_EXIT }, + { 0x14, KEY_RED }, + { 0x15, KEY_GREEN }, + { 0x16, KEY_YELLOW }, + { 0x17, KEY_BLUE }, + { 0x18, KEY_MUTE }, + { 0x19, KEY_TEXT }, + { 0x1a, KEY_MODE }, /* ? TV/Radio */ + { 0x21, KEY_OPTION }, + { 0x22, KEY_EPG }, + { 0x23, KEY_CHANNELUP }, + { 0x24, KEY_CHANNELDOWN }, + { 0x25, KEY_VOLUMEUP }, + { 0x26, KEY_VOLUMEDOWN }, + { 0x27, KEY_SETUP }, + { 0x3a, KEY_RECORD }, /* these keys are only in the black remote */ + { 0x3b, KEY_PLAY }, + { 0x3c, KEY_STOP }, + { 0x3d, KEY_REWIND }, + { 0x3e, KEY_PAUSE }, + { 0x3f, KEY_FORWARD }, +}; +DEFINE_LEGACY_IR_KEYTABLE(tt_1500); +#else +DECLARE_IR_KEYTABLE(tt_1500); +#endif diff --git a/include/media/keycodes/videomate-s350.h b/include/media/keycodes/videomate-s350.h new file mode 100644 index 000000000000..ff38424b4f66 --- /dev/null +++ b/include/media/keycodes/videomate-s350.h @@ -0,0 +1,62 @@ +/* videomate-s350.h - Keytable for videomate_s350 Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode videomate_s350[] = { + { 0x00, KEY_TV}, + { 0x01, KEY_DVD}, + { 0x04, KEY_RECORD}, + { 0x05, KEY_VIDEO}, /* TV/Video */ + { 0x07, KEY_STOP}, + { 0x08, KEY_PLAYPAUSE}, + { 0x0a, KEY_REWIND}, + { 0x0f, KEY_FASTFORWARD}, + { 0x10, KEY_CHANNELUP}, + { 0x12, KEY_VOLUMEUP}, + { 0x13, KEY_CHANNELDOWN}, + { 0x14, KEY_MUTE}, + { 0x15, KEY_VOLUMEDOWN}, + { 0x16, KEY_1}, + { 0x17, KEY_2}, + { 0x18, KEY_3}, + { 0x19, KEY_4}, + { 0x1a, KEY_5}, + { 0x1b, KEY_6}, + { 0x1c, KEY_7}, + { 0x1d, KEY_8}, + { 0x1e, KEY_9}, + { 0x1f, KEY_0}, + { 0x21, KEY_SLEEP}, + { 0x24, KEY_ZOOM}, + { 0x25, KEY_LAST}, /* Recall */ + { 0x26, KEY_SUBTITLE}, /* CC */ + { 0x27, KEY_LANGUAGE}, /* MTS */ + { 0x29, KEY_CHANNEL}, /* SURF */ + { 0x2b, KEY_A}, + { 0x2c, KEY_B}, + { 0x2f, KEY_CAMERA}, /* Snapshot */ + { 0x23, KEY_RADIO}, + { 0x02, KEY_PREVIOUSSONG}, + { 0x06, KEY_NEXTSONG}, + { 0x03, KEY_EPG}, + { 0x09, KEY_SETUP}, + { 0x22, KEY_BACKSPACE}, + { 0x0c, KEY_UP}, + { 0x0e, KEY_DOWN}, + { 0x0b, KEY_LEFT}, + { 0x0d, KEY_RIGHT}, + { 0x11, KEY_ENTER}, + { 0x20, KEY_TEXT}, +}; +DEFINE_LEGACY_IR_KEYTABLE(videomate_s350); +#else +DECLARE_IR_KEYTABLE(videomate_s350); +#endif diff --git a/include/media/keycodes/videomate-tv-pvr.h b/include/media/keycodes/videomate-tv-pvr.h new file mode 100644 index 000000000000..f77375d3ba44 --- /dev/null +++ b/include/media/keycodes/videomate-tv-pvr.h @@ -0,0 +1,64 @@ +/* videomate-tv-pvr.h - Keytable for videomate_tv_pvr Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + + +#ifdef IR_KEYMAPS +static struct ir_scancode videomate_tv_pvr[] = { + { 0x14, KEY_MUTE }, + { 0x24, KEY_ZOOM }, + + { 0x01, KEY_DVD }, + { 0x23, KEY_RADIO }, + { 0x00, KEY_TV }, + + { 0x0a, KEY_REWIND }, + { 0x08, KEY_PLAYPAUSE }, + { 0x0f, KEY_FORWARD }, + + { 0x02, KEY_PREVIOUS }, + { 0x07, KEY_STOP }, + { 0x06, KEY_NEXT }, + + { 0x0c, KEY_UP }, + { 0x0e, KEY_DOWN }, + { 0x0b, KEY_LEFT }, + { 0x0d, KEY_RIGHT }, + { 0x11, KEY_OK }, + + { 0x03, KEY_MENU }, + { 0x09, KEY_SETUP }, + { 0x05, KEY_VIDEO }, + { 0x22, KEY_CHANNEL }, + + { 0x12, KEY_VOLUMEUP }, + { 0x15, KEY_VOLUMEDOWN }, + { 0x10, KEY_CHANNELUP }, + { 0x13, KEY_CHANNELDOWN }, + + { 0x04, KEY_RECORD }, + + { 0x16, KEY_1 }, + { 0x17, KEY_2 }, + { 0x18, KEY_3 }, + { 0x19, KEY_4 }, + { 0x1a, KEY_5 }, + { 0x1b, KEY_6 }, + { 0x1c, KEY_7 }, + { 0x1d, KEY_8 }, + { 0x1e, KEY_9 }, + { 0x1f, KEY_0 }, + + { 0x20, KEY_LANGUAGE }, + { 0x21, KEY_SLEEP }, +}; +DEFINE_LEGACY_IR_KEYTABLE(videomate_tv_pvr); +#else +DECLARE_IR_KEYTABLE(videomate_tv_pvr); +#endif diff --git a/include/media/keycodes/winfast-usbii-deluxe.h b/include/media/keycodes/winfast-usbii-deluxe.h new file mode 100644 index 000000000000..0d2c14f2fed4 --- /dev/null +++ b/include/media/keycodes/winfast-usbii-deluxe.h @@ -0,0 +1,58 @@ +/* winfast-usbii-deluxe.h - Keytable for winfast_usbii_deluxe Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Leadtek Winfast TV USB II Deluxe remote + Magnus Alm + */ + +#ifdef IR_KEYMAPS +static struct ir_scancode winfast_usbii_deluxe[] = { + { 0x62, KEY_0}, + { 0x75, KEY_1}, + { 0x76, KEY_2}, + { 0x77, KEY_3}, + { 0x79, KEY_4}, + { 0x7a, KEY_5}, + { 0x7b, KEY_6}, + { 0x7d, KEY_7}, + { 0x7e, KEY_8}, + { 0x7f, KEY_9}, + + { 0x38, KEY_CAMERA}, /* SNAPSHOT */ + { 0x37, KEY_RECORD}, /* RECORD */ + { 0x35, KEY_TIME}, /* TIMESHIFT */ + + { 0x74, KEY_VOLUMEUP}, /* VOLUMEUP */ + { 0x78, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ + { 0x64, KEY_MUTE}, /* MUTE */ + + { 0x21, KEY_CHANNEL}, /* SURF */ + { 0x7c, KEY_CHANNELUP}, /* CHANNELUP */ + { 0x60, KEY_CHANNELDOWN}, /* CHANNELDOWN */ + { 0x61, KEY_LAST}, /* LAST CHANNEL (RECALL) */ + + { 0x72, KEY_VIDEO}, /* INPUT MODES (TV/FM) */ + + { 0x70, KEY_POWER2}, /* TV ON/OFF */ + + { 0x39, KEY_CYCLEWINDOWS}, /* MINIMIZE (BOSS) */ + { 0x3a, KEY_NEW}, /* PIP */ + { 0x73, KEY_ZOOM}, /* FULLSECREEN */ + + { 0x66, KEY_INFO}, /* OSD (DISPLAY) */ + + { 0x31, KEY_DOT}, /* '.' */ + { 0x63, KEY_ENTER}, /* ENTER */ + +}; +DEFINE_LEGACY_IR_KEYTABLE(winfast_usbii_deluxe); +#else +DECLARE_IR_KEYTABLE(winfast_usbii_deluxe); +#endif diff --git a/include/media/keycodes/winfast.h b/include/media/keycodes/winfast.h new file mode 100644 index 000000000000..4f42e24efd4d --- /dev/null +++ b/include/media/keycodes/winfast.h @@ -0,0 +1,78 @@ +/* winfast.h - Keytable for winfast Remote Controller + * + * Imported from ir-keymaps.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +/* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ + +#ifdef IR_KEYMAPS +static struct ir_scancode winfast[] = { + /* Keys 0 to 9 */ + { 0x12, KEY_0 }, + { 0x05, KEY_1 }, + { 0x06, KEY_2 }, + { 0x07, KEY_3 }, + { 0x09, KEY_4 }, + { 0x0a, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x0d, KEY_7 }, + { 0x0e, KEY_8 }, + { 0x0f, KEY_9 }, + + { 0x00, KEY_POWER }, + { 0x1b, KEY_AUDIO }, /* Audio Source */ + { 0x02, KEY_TUNER }, /* TV/FM, not on Y0400052 */ + { 0x1e, KEY_VIDEO }, /* Video Source */ + { 0x16, KEY_INFO }, /* Display information */ + { 0x04, KEY_VOLUMEUP }, + { 0x08, KEY_VOLUMEDOWN }, + { 0x0c, KEY_CHANNELUP }, + { 0x10, KEY_CHANNELDOWN }, + { 0x03, KEY_ZOOM }, /* fullscreen */ + { 0x1f, KEY_TEXT }, /* closed caption/teletext */ + { 0x20, KEY_SLEEP }, + { 0x29, KEY_CLEAR }, /* boss key */ + { 0x14, KEY_MUTE }, + { 0x2b, KEY_RED }, + { 0x2c, KEY_GREEN }, + { 0x2d, KEY_YELLOW }, + { 0x2e, KEY_BLUE }, + { 0x18, KEY_KPPLUS }, /* fine tune + , not on Y040052 */ + { 0x19, KEY_KPMINUS }, /* fine tune - , not on Y040052 */ + { 0x2a, KEY_MEDIA }, /* PIP (Picture in picture */ + { 0x21, KEY_DOT }, + { 0x13, KEY_ENTER }, + { 0x11, KEY_LAST }, /* Recall (last channel */ + { 0x22, KEY_PREVIOUS }, + { 0x23, KEY_PLAYPAUSE }, + { 0x24, KEY_NEXT }, + { 0x25, KEY_TIME }, /* Time Shifting */ + { 0x26, KEY_STOP }, + { 0x27, KEY_RECORD }, + { 0x28, KEY_SAVE }, /* Screenshot */ + { 0x2f, KEY_MENU }, + { 0x30, KEY_CANCEL }, + { 0x31, KEY_CHANNEL }, /* Channel Surf */ + { 0x32, KEY_SUBTITLE }, + { 0x33, KEY_LANGUAGE }, + { 0x34, KEY_REWIND }, + { 0x35, KEY_FASTFORWARD }, + { 0x36, KEY_TV }, + { 0x37, KEY_RADIO }, /* FM */ + { 0x38, KEY_DVD }, + + { 0x1a, KEY_MODE}, /* change to MCE mode on Y04G0051 */ + { 0x3e, KEY_F21 }, /* MCE +VOL, on Y04G0033 */ + { 0x3a, KEY_F22 }, /* MCE -VOL, on Y04G0033 */ + { 0x3b, KEY_F23 }, /* MCE +CH, on Y04G0033 */ + { 0x3f, KEY_F24 } /* MCE -CH, on Y04G0033 */ +}; +DEFINE_LEGACY_IR_KEYTABLE(winfast); +#else +DECLARE_IR_KEYTABLE(winfast); +#endif -- GitLab From 9ce50c1a5faad80cf6100ea4e8970416ee3b8b59 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Apr 2010 02:33:35 -0300 Subject: [PATCH 287/534] V4L/DVB: ir-core: Add support for RC map code register Instead of having all RC tables hardcoded on one file with all tables there, add infrastructure for registering and dynamically load the table(s) when needed. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/Makefile | 2 +- drivers/media/IR/rc-map.c | 75 +++++++++++++++++++++++++++++++++++++++ include/media/ir-core.h | 11 ++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 drivers/media/IR/rc-map.c diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile index 6140b2712c8a..3a4f590d0bbb 100644 --- a/drivers/media/IR/Makefile +++ b/drivers/media/IR/Makefile @@ -1,5 +1,5 @@ ir-common-objs := ir-functions.o ir-keymaps.o -ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o +ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o rc-map.o obj-$(CONFIG_IR_CORE) += ir-core.o obj-$(CONFIG_VIDEO_IR) += ir-common.o diff --git a/drivers/media/IR/rc-map.c b/drivers/media/IR/rc-map.c new file mode 100644 index 000000000000..aa269f5ef3fe --- /dev/null +++ b/drivers/media/IR/rc-map.c @@ -0,0 +1,75 @@ +/* ir-raw-event.c - handle IR Pulse/Space event + * + * Copyright (C) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include + +/* Used to handle IR raw handler extensions */ +static LIST_HEAD(rc_map_list); +static spinlock_t rc_map_lock; + + +static struct rc_keymap *seek_rc_map(const char *name) +{ + struct rc_keymap *map = NULL; + + spin_lock(&rc_map_lock); + list_for_each_entry(map, &rc_map_list, list) { + if (!strcmp(name, map->map.name)) + break; + } + spin_unlock(&rc_map_lock); + + return map; +} + +struct ir_scancode_table *get_rc_map(const char *name) +{ + int rc = 0; + + struct rc_keymap *map; + + map = seek_rc_map(name); +#ifdef MODULE + if (!map) { + rc = request_module("name"); + if (rc < 0) + return NULL; + + map = seek_rc_map(name); + } +#endif + if (!map) + return NULL; + + return &map->map; +} +EXPORT_SYMBOL_GPL(get_rc_map); + +int ir_register_map(struct rc_keymap *map) +{ + spin_lock(&rc_map_lock); + list_add_tail(&map->list, &rc_map_list); + spin_unlock(&rc_map_lock); + return 0; +} +EXPORT_SYMBOL_GPL(ir_raw_handler_register); + +void ir_unregister_map(struct rc_keymap *map) +{ + spin_lock(&rc_map_lock); + list_del(&map->list); + spin_unlock(&rc_map_lock); +} +EXPORT_SYMBOL_GPL(ir_raw_handler_unregister); diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 643ff25daa89..39df3cf9e845 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -52,6 +52,11 @@ struct ir_scancode_table { spinlock_t lock; }; +struct rc_keymap { + struct list_head list; + struct ir_scancode_table map; +}; + struct ir_dev_props { unsigned long allowed_protos; void *priv; @@ -126,6 +131,12 @@ int ir_input_register(struct input_dev *dev, const char *driver_name); void ir_input_unregister(struct input_dev *input_dev); +/* Routines from rc-map.c */ + +int ir_register_map(struct rc_keymap *map); +void ir_unregister_map(struct rc_keymap *map); +struct ir_scancode_table *get_rc_map(const char *name); + /* Routines from ir-sysfs.c */ int ir_register_class(struct input_dev *input_dev); -- GitLab From 6686fa6917caaaaf3d595df6accedb87607517c9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Apr 2010 03:05:46 -0300 Subject: [PATCH 288/534] V4L/DVB: Break Remote Controller keymaps into modules The original Remote Controller approach were very messy: a big file, that were part of ir-common kernel module, containing 64 different RC keymap tables, used by the V4L/DVB drivers. Better to break each RC keymap table into a separate module, registering them into rc core on a process similar to the fs/nls tables. As an userspace program is now in charge of loading those tables, adds an option to allow the complete removal of those tables from kernelspace. Yet, on embedded devices like Set Top Boxes and TV sets, maybe the only available input device is the IR. So, we should keep allowing the usage of in-kernel tables, but a latter patch should change the default to 'n', after giving some time for distros to add the v4l-utils with the ir-keytable program, to allow the table load via userspace. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/Kconfig | 2 + drivers/media/IR/keymaps/Kconfig | 15 ++ drivers/media/IR/keymaps/Makefile | 64 ++++++++ .../media/IR/keymaps/rc-adstech-dvb-t-pci.c | 89 +++++++++++ drivers/media/IR/keymaps/rc-apac-viewcomp.c | 80 ++++++++++ drivers/media/IR/keymaps/rc-asus-pc39.c | 91 +++++++++++ .../IR/keymaps/rc-ati-tv-wonder-hd-600.c | 69 +++++++++ drivers/media/IR/keymaps/rc-avermedia-a16d.c | 75 ++++++++++ .../media/IR/keymaps/rc-avermedia-cardbus.c | 97 ++++++++++++ drivers/media/IR/keymaps/rc-avermedia-dvbt.c | 78 ++++++++++ .../IR/keymaps/rc-avermedia-m135a-rm-jx.c | 90 +++++++++++ drivers/media/IR/keymaps/rc-avermedia.c | 86 +++++++++++ drivers/media/IR/keymaps/rc-avertv-303.c | 85 +++++++++++ drivers/media/IR/keymaps/rc-behold-columbus.c | 108 ++++++++++++++ drivers/media/IR/keymaps/rc-behold.c | 141 ++++++++++++++++++ drivers/media/IR/keymaps/rc-budget-ci-old.c | 92 ++++++++++++ drivers/media/IR/keymaps/rc-cinergy-1400.c | 84 +++++++++++ drivers/media/IR/keymaps/rc-cinergy.c | 78 ++++++++++ drivers/media/IR/keymaps/rc-dm1105-nec.c | 76 ++++++++++ drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c | 78 ++++++++++ .../media/IR/keymaps/rc-dntv-live-dvbt-pro.c | 97 ++++++++++++ drivers/media/IR/keymaps/rc-em-terratec.c | 69 +++++++++ drivers/media/IR/keymaps/rc-empty.c | 44 ++++++ .../media/IR/keymaps/rc-encore-enltv-fm53.c | 81 ++++++++++ drivers/media/IR/keymaps/rc-encore-enltv.c | 112 ++++++++++++++ drivers/media/IR/keymaps/rc-encore-enltv2.c | 90 +++++++++++ drivers/media/IR/keymaps/rc-evga-indtube.c | 61 ++++++++ drivers/media/IR/keymaps/rc-eztv.c | 96 ++++++++++++ drivers/media/IR/keymaps/rc-flydvb.c | 77 ++++++++++ drivers/media/IR/keymaps/rc-flyvideo.c | 70 +++++++++ drivers/media/IR/keymaps/rc-fusionhdtv-mce.c | 98 ++++++++++++ drivers/media/IR/keymaps/rc-gadmei-rm008z.c | 81 ++++++++++ .../media/IR/keymaps/rc-genius-tvgo-a11mce.c | 84 +++++++++++ drivers/media/IR/keymaps/rc-gotview7135.c | 79 ++++++++++ drivers/media/IR/keymaps/rc-hauppauge-new.c | 100 +++++++++++++ drivers/media/IR/keymaps/rc-iodata-bctv7e.c | 88 +++++++++++ drivers/media/IR/keymaps/rc-kaiomy.c | 87 +++++++++++ drivers/media/IR/keymaps/rc-kworld-315u.c | 83 +++++++++++ .../IR/keymaps/rc-kworld-plus-tv-analog.c | 99 ++++++++++++ drivers/media/IR/keymaps/rc-manli.c | 135 +++++++++++++++++ .../media/IR/keymaps/rc-msi-tvanywhere-plus.c | 123 +++++++++++++++ drivers/media/IR/keymaps/rc-msi-tvanywhere.c | 69 +++++++++ drivers/media/IR/keymaps/rc-nebula.c | 96 ++++++++++++ .../IR/keymaps/rc-nec-terratec-cinergy-xs.c | 105 +++++++++++++ drivers/media/IR/keymaps/rc-norwood.c | 85 +++++++++++ drivers/media/IR/keymaps/rc-npgtech.c | 80 ++++++++++ drivers/media/IR/keymaps/rc-pctv-sedna.c | 80 ++++++++++ drivers/media/IR/keymaps/rc-pinnacle-color.c | 94 ++++++++++++ drivers/media/IR/keymaps/rc-pinnacle-grey.c | 89 +++++++++++ .../media/IR/keymaps/rc-pinnacle-pctv-hd.c | 73 +++++++++ drivers/media/IR/keymaps/rc-pixelview-new.c | 83 +++++++++++ drivers/media/IR/keymaps/rc-pixelview.c | 82 ++++++++++ .../IR/keymaps/rc-powercolor-real-angel.c | 81 ++++++++++ drivers/media/IR/keymaps/rc-proteus-2309.c | 69 +++++++++ drivers/media/IR/keymaps/rc-purpletv.c | 81 ++++++++++ drivers/media/IR/keymaps/rc-pv951.c | 78 ++++++++++ .../media/IR/keymaps/rc-rc5-hauppauge-new.c | 103 +++++++++++++ drivers/media/IR/keymaps/rc-rc5-tv.c | 81 ++++++++++ .../IR/keymaps/rc-real-audio-220-32-keys.c | 78 ++++++++++ drivers/media/IR/keymaps/rc-tbs-nec.c | 73 +++++++++ .../media/IR/keymaps/rc-terratec-cinergy-xs.c | 92 ++++++++++++ drivers/media/IR/keymaps/rc-tevii-nec.c | 88 +++++++++++ drivers/media/IR/keymaps/rc-tt-1500.c | 82 ++++++++++ drivers/media/IR/keymaps/rc-videomate-s350.c | 85 +++++++++++ .../media/IR/keymaps/rc-videomate-tv-pvr.c | 87 +++++++++++ .../IR/keymaps/rc-winfast-usbii-deluxe.c | 82 ++++++++++ drivers/media/IR/keymaps/rc-winfast.c | 102 +++++++++++++ drivers/media/IR/rc-map.c | 4 +- 68 files changed, 5632 insertions(+), 2 deletions(-) create mode 100644 drivers/media/IR/keymaps/Kconfig create mode 100644 drivers/media/IR/keymaps/Makefile create mode 100644 drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c create mode 100644 drivers/media/IR/keymaps/rc-apac-viewcomp.c create mode 100644 drivers/media/IR/keymaps/rc-asus-pc39.c create mode 100644 drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c create mode 100644 drivers/media/IR/keymaps/rc-avermedia-a16d.c create mode 100644 drivers/media/IR/keymaps/rc-avermedia-cardbus.c create mode 100644 drivers/media/IR/keymaps/rc-avermedia-dvbt.c create mode 100644 drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c create mode 100644 drivers/media/IR/keymaps/rc-avermedia.c create mode 100644 drivers/media/IR/keymaps/rc-avertv-303.c create mode 100644 drivers/media/IR/keymaps/rc-behold-columbus.c create mode 100644 drivers/media/IR/keymaps/rc-behold.c create mode 100644 drivers/media/IR/keymaps/rc-budget-ci-old.c create mode 100644 drivers/media/IR/keymaps/rc-cinergy-1400.c create mode 100644 drivers/media/IR/keymaps/rc-cinergy.c create mode 100644 drivers/media/IR/keymaps/rc-dm1105-nec.c create mode 100644 drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c create mode 100644 drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c create mode 100644 drivers/media/IR/keymaps/rc-em-terratec.c create mode 100644 drivers/media/IR/keymaps/rc-empty.c create mode 100644 drivers/media/IR/keymaps/rc-encore-enltv-fm53.c create mode 100644 drivers/media/IR/keymaps/rc-encore-enltv.c create mode 100644 drivers/media/IR/keymaps/rc-encore-enltv2.c create mode 100644 drivers/media/IR/keymaps/rc-evga-indtube.c create mode 100644 drivers/media/IR/keymaps/rc-eztv.c create mode 100644 drivers/media/IR/keymaps/rc-flydvb.c create mode 100644 drivers/media/IR/keymaps/rc-flyvideo.c create mode 100644 drivers/media/IR/keymaps/rc-fusionhdtv-mce.c create mode 100644 drivers/media/IR/keymaps/rc-gadmei-rm008z.c create mode 100644 drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c create mode 100644 drivers/media/IR/keymaps/rc-gotview7135.c create mode 100644 drivers/media/IR/keymaps/rc-hauppauge-new.c create mode 100644 drivers/media/IR/keymaps/rc-iodata-bctv7e.c create mode 100644 drivers/media/IR/keymaps/rc-kaiomy.c create mode 100644 drivers/media/IR/keymaps/rc-kworld-315u.c create mode 100644 drivers/media/IR/keymaps/rc-kworld-plus-tv-analog.c create mode 100644 drivers/media/IR/keymaps/rc-manli.c create mode 100644 drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c create mode 100644 drivers/media/IR/keymaps/rc-msi-tvanywhere.c create mode 100644 drivers/media/IR/keymaps/rc-nebula.c create mode 100644 drivers/media/IR/keymaps/rc-nec-terratec-cinergy-xs.c create mode 100644 drivers/media/IR/keymaps/rc-norwood.c create mode 100644 drivers/media/IR/keymaps/rc-npgtech.c create mode 100644 drivers/media/IR/keymaps/rc-pctv-sedna.c create mode 100644 drivers/media/IR/keymaps/rc-pinnacle-color.c create mode 100644 drivers/media/IR/keymaps/rc-pinnacle-grey.c create mode 100644 drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c create mode 100644 drivers/media/IR/keymaps/rc-pixelview-new.c create mode 100644 drivers/media/IR/keymaps/rc-pixelview.c create mode 100644 drivers/media/IR/keymaps/rc-powercolor-real-angel.c create mode 100644 drivers/media/IR/keymaps/rc-proteus-2309.c create mode 100644 drivers/media/IR/keymaps/rc-purpletv.c create mode 100644 drivers/media/IR/keymaps/rc-pv951.c create mode 100644 drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c create mode 100644 drivers/media/IR/keymaps/rc-rc5-tv.c create mode 100644 drivers/media/IR/keymaps/rc-real-audio-220-32-keys.c create mode 100644 drivers/media/IR/keymaps/rc-tbs-nec.c create mode 100644 drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c create mode 100644 drivers/media/IR/keymaps/rc-tevii-nec.c create mode 100644 drivers/media/IR/keymaps/rc-tt-1500.c create mode 100644 drivers/media/IR/keymaps/rc-videomate-s350.c create mode 100644 drivers/media/IR/keymaps/rc-videomate-tv-pvr.c create mode 100644 drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c create mode 100644 drivers/media/IR/keymaps/rc-winfast.c diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig index de410d46ae26..0c557b8cc932 100644 --- a/drivers/media/IR/Kconfig +++ b/drivers/media/IR/Kconfig @@ -8,6 +8,8 @@ config VIDEO_IR depends on IR_CORE default IR_CORE +source "drivers/media/IR/keymaps/Kconfig" + config IR_NEC_DECODER tristate "Enable IR raw decoder for NEC protocol" depends on IR_CORE diff --git a/drivers/media/IR/keymaps/Kconfig b/drivers/media/IR/keymaps/Kconfig new file mode 100644 index 000000000000..14b22f58f823 --- /dev/null +++ b/drivers/media/IR/keymaps/Kconfig @@ -0,0 +1,15 @@ +config RC_MAP + tristate "Compile Remote Controller keymap modules" + depends on IR_CORE + default y + + ---help--- + This option enables the compilation of lots of Remote + Controller tables. They are short tables, but if you + don't use a remote controller, or prefer to load the + tables on userspace, you should disable it. + + The ir-keytable program, available at v4l-utils package + provide the tool and the same RC maps for load from + userspace. Its available at + http://git.linuxtv.org/v4l-utils diff --git a/drivers/media/IR/keymaps/Makefile b/drivers/media/IR/keymaps/Makefile new file mode 100644 index 000000000000..937b7db9c9d2 --- /dev/null +++ b/drivers/media/IR/keymaps/Makefile @@ -0,0 +1,64 @@ +obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + rc-apac-viewcomp.o \ + rc-asus-pc39.o \ + rc-ati-tv-wonder-hd-600.o \ + rc-avermedia-a16d.o \ + rc-avermedia.o \ + rc-avermedia-cardbus.o \ + rc-avermedia-dvbt.o \ + rc-avermedia-m135a-rm-jx.o \ + rc-avertv-303.o \ + rc-behold.o \ + rc-behold-columbus.o \ + rc-budget-ci-old.o \ + rc-cinergy-1400.o \ + rc-cinergy.o \ + rc-dm1105-nec.o \ + rc-dntv-live-dvb-t.o \ + rc-dntv-live-dvbt-pro.o \ + rc-empty.o \ + rc-em-terratec.o \ + rc-encore-enltv2.o \ + rc-encore-enltv.o \ + rc-encore-enltv-fm53.o \ + rc-evga-indtube.o \ + rc-eztv.o \ + rc-flydvb.o \ + rc-flyvideo.o \ + rc-fusionhdtv-mce.o \ + rc-gadmei-rm008z.o \ + rc-genius-tvgo-a11mce.o \ + rc-gotview7135.o \ + rc-hauppauge-new.o \ + rc-iodata-bctv7e.o \ + rc-kaiomy.o \ + rc-kworld-315u.o \ + rc-kworld-plus-tv-analog.o \ + rc-manli.o \ + rc-msi-tvanywhere.o \ + rc-msi-tvanywhere-plus.o \ + rc-nebula.o \ + rc-nec-terratec-cinergy-xs.o \ + rc-norwood.o \ + rc-npgtech.o \ + rc-pctv-sedna.o \ + rc-pinnacle-color.o \ + rc-pinnacle-grey.o \ + rc-pinnacle-pctv-hd.o \ + rc-pixelview.o \ + rc-pixelview-new.o \ + rc-powercolor-real-angel.o \ + rc-proteus-2309.o \ + rc-purpletv.o \ + rc-pv951.o \ + rc-rc5-hauppauge-new.o \ + rc-rc5-tv.o \ + rc-real-audio-220-32-keys.o \ + rc-tbs-nec.o \ + rc-terratec-cinergy-xs.o \ + rc-tevii-nec.o \ + rc-tt-1500.o \ + rc-videomate-s350.o \ + rc-videomate-tv-pvr.o \ + rc-winfast.o \ + rc-winfast-usbii-deluxe.o diff --git a/drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c b/drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c new file mode 100644 index 000000000000..b17283176ecd --- /dev/null +++ b/drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c @@ -0,0 +1,89 @@ +/* adstech-dvb-t-pci.h - Keytable for adstech_dvb_t_pci Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* ADS Tech Instant TV DVB-T PCI Remote */ + +static struct ir_scancode adstech_dvb_t_pci[] = { + /* Keys 0 to 9 */ + { 0x4d, KEY_0 }, + { 0x57, KEY_1 }, + { 0x4f, KEY_2 }, + { 0x53, KEY_3 }, + { 0x56, KEY_4 }, + { 0x4e, KEY_5 }, + { 0x5e, KEY_6 }, + { 0x54, KEY_7 }, + { 0x4c, KEY_8 }, + { 0x5c, KEY_9 }, + + { 0x5b, KEY_POWER }, + { 0x5f, KEY_MUTE }, + { 0x55, KEY_GOTO }, + { 0x5d, KEY_SEARCH }, + { 0x17, KEY_EPG }, /* Guide */ + { 0x1f, KEY_MENU }, + { 0x0f, KEY_UP }, + { 0x46, KEY_DOWN }, + { 0x16, KEY_LEFT }, + { 0x1e, KEY_RIGHT }, + { 0x0e, KEY_SELECT }, /* Enter */ + { 0x5a, KEY_INFO }, + { 0x52, KEY_EXIT }, + { 0x59, KEY_PREVIOUS }, + { 0x51, KEY_NEXT }, + { 0x58, KEY_REWIND }, + { 0x50, KEY_FORWARD }, + { 0x44, KEY_PLAYPAUSE }, + { 0x07, KEY_STOP }, + { 0x1b, KEY_RECORD }, + { 0x13, KEY_TUNER }, /* Live */ + { 0x0a, KEY_A }, + { 0x12, KEY_B }, + { 0x03, KEY_PROG1 }, /* 1 */ + { 0x01, KEY_PROG2 }, /* 2 */ + { 0x00, KEY_PROG3 }, /* 3 */ + { 0x06, KEY_DVD }, + { 0x48, KEY_AUX }, /* Photo */ + { 0x40, KEY_VIDEO }, + { 0x19, KEY_AUDIO }, /* Music */ + { 0x0b, KEY_CHANNELUP }, + { 0x08, KEY_CHANNELDOWN }, + { 0x15, KEY_VOLUMEUP }, + { 0x1c, KEY_VOLUMEDOWN }, +}; + +static struct rc_keymap adstech_dvb_t_pci_map = { + .map = { + .scan = adstech_dvb_t_pci, + .size = ARRAY_SIZE(adstech_dvb_t_pci), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_ADSTECH_DVB_T_PCI, + } +}; + +static int __init init_rc_map_adstech_dvb_t_pci(void) +{ + return ir_register_map(&adstech_dvb_t_pci_map); +} + +static void __exit exit_rc_map_adstech_dvb_t_pci(void) +{ + ir_unregister_map(&adstech_dvb_t_pci_map); +} + +module_init(init_rc_map_adstech_dvb_t_pci) +module_exit(exit_rc_map_adstech_dvb_t_pci) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-apac-viewcomp.c b/drivers/media/IR/keymaps/rc-apac-viewcomp.c new file mode 100644 index 000000000000..0ef2b562baf0 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-apac-viewcomp.c @@ -0,0 +1,80 @@ +/* apac-viewcomp.h - Keytable for apac_viewcomp Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Attila Kondoros */ + +static struct ir_scancode apac_viewcomp[] = { + + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x00, KEY_0 }, + { 0x17, KEY_LAST }, /* +100 */ + { 0x0a, KEY_LIST }, /* recall */ + + + { 0x1c, KEY_TUNER }, /* TV/FM */ + { 0x15, KEY_SEARCH }, /* scan */ + { 0x12, KEY_POWER }, /* power */ + { 0x1f, KEY_VOLUMEDOWN }, /* vol up */ + { 0x1b, KEY_VOLUMEUP }, /* vol down */ + { 0x1e, KEY_CHANNELDOWN }, /* chn up */ + { 0x1a, KEY_CHANNELUP }, /* chn down */ + + { 0x11, KEY_VIDEO }, /* video */ + { 0x0f, KEY_ZOOM }, /* full screen */ + { 0x13, KEY_MUTE }, /* mute/unmute */ + { 0x10, KEY_TEXT }, /* min */ + + { 0x0d, KEY_STOP }, /* freeze */ + { 0x0e, KEY_RECORD }, /* record */ + { 0x1d, KEY_PLAYPAUSE }, /* stop */ + { 0x19, KEY_PLAY }, /* play */ + + { 0x16, KEY_GOTO }, /* osd */ + { 0x14, KEY_REFRESH }, /* default */ + { 0x0c, KEY_KPPLUS }, /* fine tune >>>> */ + { 0x18, KEY_KPMINUS }, /* fine tune <<<< */ +}; + +static struct rc_keymap apac_viewcomp_map = { + .map = { + .scan = apac_viewcomp, + .size = ARRAY_SIZE(apac_viewcomp), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_APAC_VIEWCOMP, + } +}; + +static int __init init_rc_map_apac_viewcomp(void) +{ + return ir_register_map(&apac_viewcomp_map); +} + +static void __exit exit_rc_map_apac_viewcomp(void) +{ + ir_unregister_map(&apac_viewcomp_map); +} + +module_init(init_rc_map_apac_viewcomp) +module_exit(exit_rc_map_apac_viewcomp) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-asus-pc39.c b/drivers/media/IR/keymaps/rc-asus-pc39.c new file mode 100644 index 000000000000..2aa068cd6c75 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-asus-pc39.c @@ -0,0 +1,91 @@ +/* asus-pc39.h - Keytable for asus_pc39 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + * Marc Fargas + * this is the remote control that comes with the asus p7131 + * which has a label saying is "Model PC-39" + */ + +static struct ir_scancode asus_pc39[] = { + /* Keys 0 to 9 */ + { 0x15, KEY_0 }, + { 0x29, KEY_1 }, + { 0x2d, KEY_2 }, + { 0x2b, KEY_3 }, + { 0x09, KEY_4 }, + { 0x0d, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x31, KEY_7 }, + { 0x35, KEY_8 }, + { 0x33, KEY_9 }, + + { 0x3e, KEY_RADIO }, /* radio */ + { 0x03, KEY_MENU }, /* dvd/menu */ + { 0x2a, KEY_VOLUMEUP }, + { 0x19, KEY_VOLUMEDOWN }, + { 0x37, KEY_UP }, + { 0x3b, KEY_DOWN }, + { 0x27, KEY_LEFT }, + { 0x2f, KEY_RIGHT }, + { 0x25, KEY_VIDEO }, /* video */ + { 0x39, KEY_AUDIO }, /* music */ + + { 0x21, KEY_TV }, /* tv */ + { 0x1d, KEY_EXIT }, /* back */ + { 0x0a, KEY_CHANNELUP }, /* channel / program + */ + { 0x1b, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x1a, KEY_ENTER }, /* enter */ + + { 0x06, KEY_PAUSE }, /* play/pause */ + { 0x1e, KEY_PREVIOUS }, /* rew */ + { 0x26, KEY_NEXT }, /* forward */ + { 0x0e, KEY_REWIND }, /* backward << */ + { 0x3a, KEY_FASTFORWARD }, /* forward >> */ + { 0x36, KEY_STOP }, + { 0x2e, KEY_RECORD }, /* recording */ + { 0x16, KEY_POWER }, /* the button that reads "close" */ + + { 0x11, KEY_ZOOM }, /* full screen */ + { 0x13, KEY_MACRO }, /* recall */ + { 0x23, KEY_HOME }, /* home */ + { 0x05, KEY_PVR }, /* picture */ + { 0x3d, KEY_MUTE }, /* mute */ + { 0x01, KEY_DVD }, /* dvd */ +}; + +static struct rc_keymap asus_pc39_map = { + .map = { + .scan = asus_pc39, + .size = ARRAY_SIZE(asus_pc39), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_ASUS_PC39, + } +}; + +static int __init init_rc_map_asus_pc39(void) +{ + return ir_register_map(&asus_pc39_map); +} + +static void __exit exit_rc_map_asus_pc39(void) +{ + ir_unregister_map(&asus_pc39_map); +} + +module_init(init_rc_map_asus_pc39) +module_exit(exit_rc_map_asus_pc39) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c b/drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c new file mode 100644 index 000000000000..8edfd293d010 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c @@ -0,0 +1,69 @@ +/* ati-tv-wonder-hd-600.h - Keytable for ati_tv_wonder_hd_600 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* ATI TV Wonder HD 600 USB + Devin Heitmueller + */ + +static struct ir_scancode ati_tv_wonder_hd_600[] = { + { 0x00, KEY_RECORD}, /* Row 1 */ + { 0x01, KEY_PLAYPAUSE}, + { 0x02, KEY_STOP}, + { 0x03, KEY_POWER}, + { 0x04, KEY_PREVIOUS}, /* Row 2 */ + { 0x05, KEY_REWIND}, + { 0x06, KEY_FORWARD}, + { 0x07, KEY_NEXT}, + { 0x08, KEY_EPG}, /* Row 3 */ + { 0x09, KEY_HOME}, + { 0x0a, KEY_MENU}, + { 0x0b, KEY_CHANNELUP}, + { 0x0c, KEY_BACK}, /* Row 4 */ + { 0x0d, KEY_UP}, + { 0x0e, KEY_INFO}, + { 0x0f, KEY_CHANNELDOWN}, + { 0x10, KEY_LEFT}, /* Row 5 */ + { 0x11, KEY_SELECT}, + { 0x12, KEY_RIGHT}, + { 0x13, KEY_VOLUMEUP}, + { 0x14, KEY_LAST}, /* Row 6 */ + { 0x15, KEY_DOWN}, + { 0x16, KEY_MUTE}, + { 0x17, KEY_VOLUMEDOWN}, +}; + +static struct rc_keymap ati_tv_wonder_hd_600_map = { + .map = { + .scan = ati_tv_wonder_hd_600, + .size = ARRAY_SIZE(ati_tv_wonder_hd_600), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_ATI_TV_WONDER_HD_600, + } +}; + +static int __init init_rc_map_ati_tv_wonder_hd_600(void) +{ + return ir_register_map(&ati_tv_wonder_hd_600_map); +} + +static void __exit exit_rc_map_ati_tv_wonder_hd_600(void) +{ + ir_unregister_map(&ati_tv_wonder_hd_600_map); +} + +module_init(init_rc_map_ati_tv_wonder_hd_600) +module_exit(exit_rc_map_ati_tv_wonder_hd_600) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-avermedia-a16d.c b/drivers/media/IR/keymaps/rc-avermedia-a16d.c new file mode 100644 index 000000000000..12f043587f2e --- /dev/null +++ b/drivers/media/IR/keymaps/rc-avermedia-a16d.c @@ -0,0 +1,75 @@ +/* avermedia-a16d.h - Keytable for avermedia_a16d Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode avermedia_a16d[] = { + { 0x20, KEY_LIST}, + { 0x00, KEY_POWER}, + { 0x28, KEY_1}, + { 0x18, KEY_2}, + { 0x38, KEY_3}, + { 0x24, KEY_4}, + { 0x14, KEY_5}, + { 0x34, KEY_6}, + { 0x2c, KEY_7}, + { 0x1c, KEY_8}, + { 0x3c, KEY_9}, + { 0x12, KEY_SUBTITLE}, + { 0x22, KEY_0}, + { 0x32, KEY_REWIND}, + { 0x3a, KEY_SHUFFLE}, + { 0x02, KEY_PRINT}, + { 0x11, KEY_CHANNELDOWN}, + { 0x31, KEY_CHANNELUP}, + { 0x0c, KEY_ZOOM}, + { 0x1e, KEY_VOLUMEDOWN}, + { 0x3e, KEY_VOLUMEUP}, + { 0x0a, KEY_MUTE}, + { 0x04, KEY_AUDIO}, + { 0x26, KEY_RECORD}, + { 0x06, KEY_PLAY}, + { 0x36, KEY_STOP}, + { 0x16, KEY_PAUSE}, + { 0x2e, KEY_REWIND}, + { 0x0e, KEY_FASTFORWARD}, + { 0x30, KEY_TEXT}, + { 0x21, KEY_GREEN}, + { 0x01, KEY_BLUE}, + { 0x08, KEY_EPG}, + { 0x2a, KEY_MENU}, +}; + +static struct rc_keymap avermedia_a16d_map = { + .map = { + .scan = avermedia_a16d, + .size = ARRAY_SIZE(avermedia_a16d), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_AVERMEDIA_A16D, + } +}; + +static int __init init_rc_map_avermedia_a16d(void) +{ + return ir_register_map(&avermedia_a16d_map); +} + +static void __exit exit_rc_map_avermedia_a16d(void) +{ + ir_unregister_map(&avermedia_a16d_map); +} + +module_init(init_rc_map_avermedia_a16d) +module_exit(exit_rc_map_avermedia_a16d) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-avermedia-cardbus.c b/drivers/media/IR/keymaps/rc-avermedia-cardbus.c new file mode 100644 index 000000000000..2a945b02e8ca --- /dev/null +++ b/drivers/media/IR/keymaps/rc-avermedia-cardbus.c @@ -0,0 +1,97 @@ +/* avermedia-cardbus.h - Keytable for avermedia_cardbus Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Oldrich Jedlicka */ + +static struct ir_scancode avermedia_cardbus[] = { + { 0x00, KEY_POWER }, + { 0x01, KEY_TUNER }, /* TV/FM */ + { 0x03, KEY_TEXT }, /* Teletext */ + { 0x04, KEY_EPG }, + { 0x05, KEY_1 }, + { 0x06, KEY_2 }, + { 0x07, KEY_3 }, + { 0x08, KEY_AUDIO }, + { 0x09, KEY_4 }, + { 0x0a, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x0c, KEY_ZOOM }, /* Full screen */ + { 0x0d, KEY_7 }, + { 0x0e, KEY_8 }, + { 0x0f, KEY_9 }, + { 0x10, KEY_PAGEUP }, /* 16-CH PREV */ + { 0x11, KEY_0 }, + { 0x12, KEY_INFO }, + { 0x13, KEY_AGAIN }, /* CH RTN - channel return */ + { 0x14, KEY_MUTE }, + { 0x15, KEY_EDIT }, /* Autoscan */ + { 0x17, KEY_SAVE }, /* Screenshot */ + { 0x18, KEY_PLAYPAUSE }, + { 0x19, KEY_RECORD }, + { 0x1a, KEY_PLAY }, + { 0x1b, KEY_STOP }, + { 0x1c, KEY_FASTFORWARD }, + { 0x1d, KEY_REWIND }, + { 0x1e, KEY_VOLUMEDOWN }, + { 0x1f, KEY_VOLUMEUP }, + { 0x22, KEY_SLEEP }, /* Sleep */ + { 0x23, KEY_ZOOM }, /* Aspect */ + { 0x26, KEY_SCREEN }, /* Pos */ + { 0x27, KEY_ANGLE }, /* Size */ + { 0x28, KEY_SELECT }, /* Select */ + { 0x29, KEY_BLUE }, /* Blue/Picture */ + { 0x2a, KEY_BACKSPACE }, /* Back */ + { 0x2b, KEY_MEDIA }, /* PIP (Picture-in-picture) */ + { 0x2c, KEY_DOWN }, + { 0x2e, KEY_DOT }, + { 0x2f, KEY_TV }, /* Live TV */ + { 0x32, KEY_LEFT }, + { 0x33, KEY_CLEAR }, /* Clear */ + { 0x35, KEY_RED }, /* Red/TV */ + { 0x36, KEY_UP }, + { 0x37, KEY_HOME }, /* Home */ + { 0x39, KEY_GREEN }, /* Green/Video */ + { 0x3d, KEY_YELLOW }, /* Yellow/Music */ + { 0x3e, KEY_OK }, /* Ok */ + { 0x3f, KEY_RIGHT }, + { 0x40, KEY_NEXT }, /* Next */ + { 0x41, KEY_PREVIOUS }, /* Previous */ + { 0x42, KEY_CHANNELDOWN }, /* Channel down */ + { 0x43, KEY_CHANNELUP }, /* Channel up */ +}; + +static struct rc_keymap avermedia_cardbus_map = { + .map = { + .scan = avermedia_cardbus, + .size = ARRAY_SIZE(avermedia_cardbus), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_AVERMEDIA_CARDBUS, + } +}; + +static int __init init_rc_map_avermedia_cardbus(void) +{ + return ir_register_map(&avermedia_cardbus_map); +} + +static void __exit exit_rc_map_avermedia_cardbus(void) +{ + ir_unregister_map(&avermedia_cardbus_map); +} + +module_init(init_rc_map_avermedia_cardbus) +module_exit(exit_rc_map_avermedia_cardbus) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-avermedia-dvbt.c b/drivers/media/IR/keymaps/rc-avermedia-dvbt.c new file mode 100644 index 000000000000..39dde6222875 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-avermedia-dvbt.c @@ -0,0 +1,78 @@ +/* avermedia-dvbt.h - Keytable for avermedia_dvbt Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Matt Jesson >' */ + { 0x3a, KEY_RECORD }, /* 'capture' */ + { 0x0a, KEY_MUTE }, /* 'mute' */ + { 0x2c, KEY_RECORD }, /* 'record' */ + { 0x1c, KEY_PAUSE }, /* 'pause' */ + { 0x3c, KEY_STOP }, /* 'stop' */ + { 0x0c, KEY_PLAY }, /* 'play' */ + { 0x2e, KEY_RED }, /* 'red' */ + { 0x01, KEY_BLUE }, /* 'blue' / 'cancel' */ + { 0x0e, KEY_YELLOW }, /* 'yellow' / 'ok' */ + { 0x21, KEY_GREEN }, /* 'green' */ + { 0x11, KEY_CHANNELDOWN }, /* 'channel -' */ + { 0x31, KEY_CHANNELUP }, /* 'channel +' */ + { 0x1e, KEY_VOLUMEDOWN }, /* 'volume -' */ + { 0x3e, KEY_VOLUMEUP }, /* 'volume +' */ +}; + +static struct rc_keymap avermedia_dvbt_map = { + .map = { + .scan = avermedia_dvbt, + .size = ARRAY_SIZE(avermedia_dvbt), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_AVERMEDIA_DVBT, + } +}; + +static int __init init_rc_map_avermedia_dvbt(void) +{ + return ir_register_map(&avermedia_dvbt_map); +} + +static void __exit exit_rc_map_avermedia_dvbt(void) +{ + ir_unregister_map(&avermedia_dvbt_map); +} + +module_init(init_rc_map_avermedia_dvbt) +module_exit(exit_rc_map_avermedia_dvbt) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c b/drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c new file mode 100644 index 000000000000..101e7ea85941 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-avermedia-m135a-rm-jx.c @@ -0,0 +1,90 @@ +/* avermedia-m135a-rm-jx.h - Keytable for avermedia_m135a_rm_jx Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + * Avermedia M135A with IR model RM-JX + * The same codes exist on both Positivo (BR) and original IR + * Mauro Carvalho Chehab + */ + +static struct ir_scancode avermedia_m135a_rm_jx[] = { + { 0x0200, KEY_POWER2 }, + { 0x022e, KEY_DOT }, /* '.' */ + { 0x0201, KEY_MODE }, /* TV/FM or SOURCE */ + + { 0x0205, KEY_1 }, + { 0x0206, KEY_2 }, + { 0x0207, KEY_3 }, + { 0x0209, KEY_4 }, + { 0x020a, KEY_5 }, + { 0x020b, KEY_6 }, + { 0x020d, KEY_7 }, + { 0x020e, KEY_8 }, + { 0x020f, KEY_9 }, + { 0x0211, KEY_0 }, + + { 0x0213, KEY_RIGHT }, /* -> or L */ + { 0x0212, KEY_LEFT }, /* <- or R */ + + { 0x0217, KEY_SLEEP }, /* Capturar Imagem or Snapshot */ + { 0x0210, KEY_SHUFFLE }, /* Amostra or 16 chan prev */ + + { 0x0303, KEY_CHANNELUP }, + { 0x0302, KEY_CHANNELDOWN }, + { 0x021f, KEY_VOLUMEUP }, + { 0x021e, KEY_VOLUMEDOWN }, + { 0x020c, KEY_ENTER }, /* Full Screen */ + + { 0x0214, KEY_MUTE }, + { 0x0208, KEY_AUDIO }, + + { 0x0203, KEY_TEXT }, /* Teletext */ + { 0x0204, KEY_EPG }, + { 0x022b, KEY_TV2 }, /* TV2 or PIP */ + + { 0x021d, KEY_RED }, + { 0x021c, KEY_YELLOW }, + { 0x0301, KEY_GREEN }, + { 0x0300, KEY_BLUE }, + + { 0x021a, KEY_PLAYPAUSE }, + { 0x0219, KEY_RECORD }, + { 0x0218, KEY_PLAY }, + { 0x021b, KEY_STOP }, +}; + +static struct rc_keymap avermedia_m135a_rm_jx_map = { + .map = { + .scan = avermedia_m135a_rm_jx, + .size = ARRAY_SIZE(avermedia_m135a_rm_jx), + .ir_type = IR_TYPE_NEC, + .name = RC_MAP_AVERMEDIA_M135A_RM_JX, + } +}; + +static int __init init_rc_map_avermedia_m135a_rm_jx(void) +{ + return ir_register_map(&avermedia_m135a_rm_jx_map); +} + +static void __exit exit_rc_map_avermedia_m135a_rm_jx(void) +{ + ir_unregister_map(&avermedia_m135a_rm_jx_map); +} + +module_init(init_rc_map_avermedia_m135a_rm_jx) +module_exit(exit_rc_map_avermedia_m135a_rm_jx) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-avermedia.c b/drivers/media/IR/keymaps/rc-avermedia.c new file mode 100644 index 000000000000..21effd5bfb0d --- /dev/null +++ b/drivers/media/IR/keymaps/rc-avermedia.c @@ -0,0 +1,86 @@ +/* avermedia.h - Keytable for avermedia Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Alex Hermann */ + +static struct ir_scancode avermedia[] = { + { 0x28, KEY_1 }, + { 0x18, KEY_2 }, + { 0x38, KEY_3 }, + { 0x24, KEY_4 }, + { 0x14, KEY_5 }, + { 0x34, KEY_6 }, + { 0x2c, KEY_7 }, + { 0x1c, KEY_8 }, + { 0x3c, KEY_9 }, + { 0x22, KEY_0 }, + + { 0x20, KEY_TV }, /* TV/FM */ + { 0x10, KEY_CD }, /* CD */ + { 0x30, KEY_TEXT }, /* TELETEXT */ + { 0x00, KEY_POWER }, /* POWER */ + + { 0x08, KEY_VIDEO }, /* VIDEO */ + { 0x04, KEY_AUDIO }, /* AUDIO */ + { 0x0c, KEY_ZOOM }, /* FULL SCREEN */ + + { 0x12, KEY_SUBTITLE }, /* DISPLAY */ + { 0x32, KEY_REWIND }, /* LOOP */ + { 0x02, KEY_PRINT }, /* PREVIEW */ + + { 0x2a, KEY_SEARCH }, /* AUTOSCAN */ + { 0x1a, KEY_SLEEP }, /* FREEZE */ + { 0x3a, KEY_CAMERA }, /* SNAPSHOT */ + { 0x0a, KEY_MUTE }, /* MUTE */ + + { 0x26, KEY_RECORD }, /* RECORD */ + { 0x16, KEY_PAUSE }, /* PAUSE */ + { 0x36, KEY_STOP }, /* STOP */ + { 0x06, KEY_PLAY }, /* PLAY */ + + { 0x2e, KEY_RED }, /* RED */ + { 0x21, KEY_GREEN }, /* GREEN */ + { 0x0e, KEY_YELLOW }, /* YELLOW */ + { 0x01, KEY_BLUE }, /* BLUE */ + + { 0x1e, KEY_VOLUMEDOWN }, /* VOLUME- */ + { 0x3e, KEY_VOLUMEUP }, /* VOLUME+ */ + { 0x11, KEY_CHANNELDOWN }, /* CHANNEL/PAGE- */ + { 0x31, KEY_CHANNELUP } /* CHANNEL/PAGE+ */ +}; + +static struct rc_keymap avermedia_map = { + .map = { + .scan = avermedia, + .size = ARRAY_SIZE(avermedia), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_AVERMEDIA, + } +}; + +static int __init init_rc_map_avermedia(void) +{ + return ir_register_map(&avermedia_map); +} + +static void __exit exit_rc_map_avermedia(void) +{ + ir_unregister_map(&avermedia_map); +} + +module_init(init_rc_map_avermedia) +module_exit(exit_rc_map_avermedia) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-avertv-303.c b/drivers/media/IR/keymaps/rc-avertv-303.c new file mode 100644 index 000000000000..971c59d6f9d6 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-avertv-303.c @@ -0,0 +1,85 @@ +/* avertv-303.h - Keytable for avertv_303 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* AVERTV STUDIO 303 Remote */ + +static struct ir_scancode avertv_303[] = { + { 0x2a, KEY_1 }, + { 0x32, KEY_2 }, + { 0x3a, KEY_3 }, + { 0x4a, KEY_4 }, + { 0x52, KEY_5 }, + { 0x5a, KEY_6 }, + { 0x6a, KEY_7 }, + { 0x72, KEY_8 }, + { 0x7a, KEY_9 }, + { 0x0e, KEY_0 }, + + { 0x02, KEY_POWER }, + { 0x22, KEY_VIDEO }, + { 0x42, KEY_AUDIO }, + { 0x62, KEY_ZOOM }, + { 0x0a, KEY_TV }, + { 0x12, KEY_CD }, + { 0x1a, KEY_TEXT }, + + { 0x16, KEY_SUBTITLE }, + { 0x1e, KEY_REWIND }, + { 0x06, KEY_PRINT }, + + { 0x2e, KEY_SEARCH }, + { 0x36, KEY_SLEEP }, + { 0x3e, KEY_SHUFFLE }, + { 0x26, KEY_MUTE }, + + { 0x4e, KEY_RECORD }, + { 0x56, KEY_PAUSE }, + { 0x5e, KEY_STOP }, + { 0x46, KEY_PLAY }, + + { 0x6e, KEY_RED }, + { 0x0b, KEY_GREEN }, + { 0x66, KEY_YELLOW }, + { 0x03, KEY_BLUE }, + + { 0x76, KEY_LEFT }, + { 0x7e, KEY_RIGHT }, + { 0x13, KEY_DOWN }, + { 0x1b, KEY_UP }, +}; + +static struct rc_keymap avertv_303_map = { + .map = { + .scan = avertv_303, + .size = ARRAY_SIZE(avertv_303), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_AVERTV_303, + } +}; + +static int __init init_rc_map_avertv_303(void) +{ + return ir_register_map(&avertv_303_map); +} + +static void __exit exit_rc_map_avertv_303(void) +{ + ir_unregister_map(&avertv_303_map); +} + +module_init(init_rc_map_avertv_303) +module_exit(exit_rc_map_avertv_303) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-behold-columbus.c b/drivers/media/IR/keymaps/rc-behold-columbus.c new file mode 100644 index 000000000000..9f56c98fef5b --- /dev/null +++ b/drivers/media/IR/keymaps/rc-behold-columbus.c @@ -0,0 +1,108 @@ +/* behold-columbus.h - Keytable for behold_columbus Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Beholder Intl. Ltd. 2008 + * Dmitry Belimov d.belimov@google.com + * Keytable is used by BeholdTV Columbus + * The "ascii-art picture" below (in comments, first row + * is the keycode in hex, and subsequent row(s) shows + * the button labels (several variants when appropriate) + * helps to descide which keycodes to assign to the buttons. + */ + +static struct ir_scancode behold_columbus[] = { + + /* 0x13 0x11 0x1C 0x12 * + * Mute Source TV/FM Power * + * */ + + { 0x13, KEY_MUTE }, + { 0x11, KEY_PROPS }, + { 0x1C, KEY_TUNER }, /* KEY_TV/KEY_RADIO */ + { 0x12, KEY_POWER }, + + /* 0x01 0x02 0x03 0x0D * + * 1 2 3 Stereo * + * * + * 0x04 0x05 0x06 0x19 * + * 4 5 6 Snapshot * + * * + * 0x07 0x08 0x09 0x10 * + * 7 8 9 Zoom * + * */ + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x0D, KEY_SETUP }, /* Setup key */ + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x19, KEY_CAMERA }, /* Snapshot key */ + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x10, KEY_ZOOM }, + + /* 0x0A 0x00 0x0B 0x0C * + * RECALL 0 ChannelUp VolumeUp * + * */ + { 0x0A, KEY_AGAIN }, + { 0x00, KEY_0 }, + { 0x0B, KEY_CHANNELUP }, + { 0x0C, KEY_VOLUMEUP }, + + /* 0x1B 0x1D 0x15 0x18 * + * Timeshift Record ChannelDown VolumeDown * + * */ + + { 0x1B, KEY_TIME }, + { 0x1D, KEY_RECORD }, + { 0x15, KEY_CHANNELDOWN }, + { 0x18, KEY_VOLUMEDOWN }, + + /* 0x0E 0x1E 0x0F 0x1A * + * Stop Pause Previouse Next * + * */ + + { 0x0E, KEY_STOP }, + { 0x1E, KEY_PAUSE }, + { 0x0F, KEY_PREVIOUS }, + { 0x1A, KEY_NEXT }, + +}; + +static struct rc_keymap behold_columbus_map = { + .map = { + .scan = behold_columbus, + .size = ARRAY_SIZE(behold_columbus), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_BEHOLD_COLUMBUS, + } +}; + +static int __init init_rc_map_behold_columbus(void) +{ + return ir_register_map(&behold_columbus_map); +} + +static void __exit exit_rc_map_behold_columbus(void) +{ + ir_unregister_map(&behold_columbus_map); +} + +module_init(init_rc_map_behold_columbus) +module_exit(exit_rc_map_behold_columbus) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-behold.c b/drivers/media/IR/keymaps/rc-behold.c new file mode 100644 index 000000000000..abc140b2098b --- /dev/null +++ b/drivers/media/IR/keymaps/rc-behold.c @@ -0,0 +1,141 @@ +/* behold.h - Keytable for behold Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + * Igor Kuznetsov + * Andrey J. Melnikov + * + * Keytable is used by BeholdTV 60x series, M6 series at + * least, and probably other cards too. + * The "ascii-art picture" below (in comments, first row + * is the keycode in hex, and subsequent row(s) shows + * the button labels (several variants when appropriate) + * helps to descide which keycodes to assign to the buttons. + */ + +static struct ir_scancode behold[] = { + + /* 0x1c 0x12 * + * TV/FM POWER * + * */ + { 0x1c, KEY_TUNER }, /* XXX KEY_TV / KEY_RADIO */ + { 0x12, KEY_POWER }, + + /* 0x01 0x02 0x03 * + * 1 2 3 * + * * + * 0x04 0x05 0x06 * + * 4 5 6 * + * * + * 0x07 0x08 0x09 * + * 7 8 9 * + * */ + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + /* 0x0a 0x00 0x17 * + * RECALL 0 MODE * + * */ + { 0x0a, KEY_AGAIN }, + { 0x00, KEY_0 }, + { 0x17, KEY_MODE }, + + /* 0x14 0x10 * + * ASPECT FULLSCREEN * + * */ + { 0x14, KEY_SCREEN }, + { 0x10, KEY_ZOOM }, + + /* 0x0b * + * Up * + * * + * 0x18 0x16 0x0c * + * Left Ok Right * + * * + * 0x015 * + * Down * + * */ + { 0x0b, KEY_CHANNELUP }, + { 0x18, KEY_VOLUMEDOWN }, + { 0x16, KEY_OK }, /* XXX KEY_ENTER */ + { 0x0c, KEY_VOLUMEUP }, + { 0x15, KEY_CHANNELDOWN }, + + /* 0x11 0x0d * + * MUTE INFO * + * */ + { 0x11, KEY_MUTE }, + { 0x0d, KEY_INFO }, + + /* 0x0f 0x1b 0x1a * + * RECORD PLAY/PAUSE STOP * + * * + * 0x0e 0x1f 0x1e * + *TELETEXT AUDIO SOURCE * + * RED YELLOW * + * */ + { 0x0f, KEY_RECORD }, + { 0x1b, KEY_PLAYPAUSE }, + { 0x1a, KEY_STOP }, + { 0x0e, KEY_TEXT }, + { 0x1f, KEY_RED }, /*XXX KEY_AUDIO */ + { 0x1e, KEY_YELLOW }, /*XXX KEY_SOURCE */ + + /* 0x1d 0x13 0x19 * + * SLEEP PREVIEW DVB * + * GREEN BLUE * + * */ + { 0x1d, KEY_SLEEP }, + { 0x13, KEY_GREEN }, + { 0x19, KEY_BLUE }, /* XXX KEY_SAT */ + + /* 0x58 0x5c * + * FREEZE SNAPSHOT * + * */ + { 0x58, KEY_SLOW }, + { 0x5c, KEY_CAMERA }, + +}; + +static struct rc_keymap behold_map = { + .map = { + .scan = behold, + .size = ARRAY_SIZE(behold), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_BEHOLD, + } +}; + +static int __init init_rc_map_behold(void) +{ + return ir_register_map(&behold_map); +} + +static void __exit exit_rc_map_behold(void) +{ + ir_unregister_map(&behold_map); +} + +module_init(init_rc_map_behold) +module_exit(exit_rc_map_behold) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-budget-ci-old.c b/drivers/media/IR/keymaps/rc-budget-ci-old.c new file mode 100644 index 000000000000..64c2ac913338 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-budget-ci-old.c @@ -0,0 +1,92 @@ +/* budget-ci-old.h - Keytable for budget_ci_old Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* From reading the following remotes: + * Zenith Universal 7 / TV Mode 807 / VCR Mode 837 + * Hauppauge (from NOVA-CI-s box product) + * This is a "middle of the road" approach, differences are noted + */ + +static struct ir_scancode budget_ci_old[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x0a, KEY_ENTER }, + { 0x0b, KEY_RED }, + { 0x0c, KEY_POWER }, /* RADIO on Hauppauge */ + { 0x0d, KEY_MUTE }, + { 0x0f, KEY_A }, /* TV on Hauppauge */ + { 0x10, KEY_VOLUMEUP }, + { 0x11, KEY_VOLUMEDOWN }, + { 0x14, KEY_B }, + { 0x1c, KEY_UP }, + { 0x1d, KEY_DOWN }, + { 0x1e, KEY_OPTION }, /* RESERVED on Hauppauge */ + { 0x1f, KEY_BREAK }, + { 0x20, KEY_CHANNELUP }, + { 0x21, KEY_CHANNELDOWN }, + { 0x22, KEY_PREVIOUS }, /* Prev Ch on Zenith, SOURCE on Hauppauge */ + { 0x24, KEY_RESTART }, + { 0x25, KEY_OK }, + { 0x26, KEY_CYCLEWINDOWS }, /* MINIMIZE on Hauppauge */ + { 0x28, KEY_ENTER }, /* VCR mode on Zenith */ + { 0x29, KEY_PAUSE }, + { 0x2b, KEY_RIGHT }, + { 0x2c, KEY_LEFT }, + { 0x2e, KEY_MENU }, /* FULL SCREEN on Hauppauge */ + { 0x30, KEY_SLOW }, + { 0x31, KEY_PREVIOUS }, /* VCR mode on Zenith */ + { 0x32, KEY_REWIND }, + { 0x34, KEY_FASTFORWARD }, + { 0x35, KEY_PLAY }, + { 0x36, KEY_STOP }, + { 0x37, KEY_RECORD }, + { 0x38, KEY_TUNER }, /* TV/VCR on Zenith */ + { 0x3a, KEY_C }, + { 0x3c, KEY_EXIT }, + { 0x3d, KEY_POWER2 }, + { 0x3e, KEY_TUNER }, +}; + +static struct rc_keymap budget_ci_old_map = { + .map = { + .scan = budget_ci_old, + .size = ARRAY_SIZE(budget_ci_old), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_BUDGET_CI_OLD, + } +}; + +static int __init init_rc_map_budget_ci_old(void) +{ + return ir_register_map(&budget_ci_old_map); +} + +static void __exit exit_rc_map_budget_ci_old(void) +{ + ir_unregister_map(&budget_ci_old_map); +} + +module_init(init_rc_map_budget_ci_old) +module_exit(exit_rc_map_budget_ci_old) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-cinergy-1400.c b/drivers/media/IR/keymaps/rc-cinergy-1400.c new file mode 100644 index 000000000000..074f2c2c2c61 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-cinergy-1400.c @@ -0,0 +1,84 @@ +/* cinergy-1400.h - Keytable for cinergy_1400 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Cinergy 1400 DVB-T */ + +static struct ir_scancode cinergy_1400[] = { + { 0x01, KEY_POWER }, + { 0x02, KEY_1 }, + { 0x03, KEY_2 }, + { 0x04, KEY_3 }, + { 0x05, KEY_4 }, + { 0x06, KEY_5 }, + { 0x07, KEY_6 }, + { 0x08, KEY_7 }, + { 0x09, KEY_8 }, + { 0x0a, KEY_9 }, + { 0x0c, KEY_0 }, + + { 0x0b, KEY_VIDEO }, + { 0x0d, KEY_REFRESH }, + { 0x0e, KEY_SELECT }, + { 0x0f, KEY_EPG }, + { 0x10, KEY_UP }, + { 0x11, KEY_LEFT }, + { 0x12, KEY_OK }, + { 0x13, KEY_RIGHT }, + { 0x14, KEY_DOWN }, + { 0x15, KEY_TEXT }, + { 0x16, KEY_INFO }, + + { 0x17, KEY_RED }, + { 0x18, KEY_GREEN }, + { 0x19, KEY_YELLOW }, + { 0x1a, KEY_BLUE }, + + { 0x1b, KEY_CHANNELUP }, + { 0x1c, KEY_VOLUMEUP }, + { 0x1d, KEY_MUTE }, + { 0x1e, KEY_VOLUMEDOWN }, + { 0x1f, KEY_CHANNELDOWN }, + + { 0x40, KEY_PAUSE }, + { 0x4c, KEY_PLAY }, + { 0x58, KEY_RECORD }, + { 0x54, KEY_PREVIOUS }, + { 0x48, KEY_STOP }, + { 0x5c, KEY_NEXT }, +}; + +static struct rc_keymap cinergy_1400_map = { + .map = { + .scan = cinergy_1400, + .size = ARRAY_SIZE(cinergy_1400), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_CINERGY_1400, + } +}; + +static int __init init_rc_map_cinergy_1400(void) +{ + return ir_register_map(&cinergy_1400_map); +} + +static void __exit exit_rc_map_cinergy_1400(void) +{ + ir_unregister_map(&cinergy_1400_map); +} + +module_init(init_rc_map_cinergy_1400) +module_exit(exit_rc_map_cinergy_1400) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-cinergy.c b/drivers/media/IR/keymaps/rc-cinergy.c new file mode 100644 index 000000000000..cf84c3dba742 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-cinergy.c @@ -0,0 +1,78 @@ +/* cinergy.h - Keytable for cinergy Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode cinergy[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0a, KEY_POWER }, + { 0x0b, KEY_PROG1 }, /* app */ + { 0x0c, KEY_ZOOM }, /* zoom/fullscreen */ + { 0x0d, KEY_CHANNELUP }, /* channel */ + { 0x0e, KEY_CHANNELDOWN }, /* channel- */ + { 0x0f, KEY_VOLUMEUP }, + { 0x10, KEY_VOLUMEDOWN }, + { 0x11, KEY_TUNER }, /* AV */ + { 0x12, KEY_NUMLOCK }, /* -/-- */ + { 0x13, KEY_AUDIO }, /* audio */ + { 0x14, KEY_MUTE }, + { 0x15, KEY_UP }, + { 0x16, KEY_DOWN }, + { 0x17, KEY_LEFT }, + { 0x18, KEY_RIGHT }, + { 0x19, BTN_LEFT, }, + { 0x1a, BTN_RIGHT, }, + { 0x1b, KEY_WWW }, /* text */ + { 0x1c, KEY_REWIND }, + { 0x1d, KEY_FORWARD }, + { 0x1e, KEY_RECORD }, + { 0x1f, KEY_PLAY }, + { 0x20, KEY_PREVIOUSSONG }, + { 0x21, KEY_NEXTSONG }, + { 0x22, KEY_PAUSE }, + { 0x23, KEY_STOP }, +}; + +static struct rc_keymap cinergy_map = { + .map = { + .scan = cinergy, + .size = ARRAY_SIZE(cinergy), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_CINERGY, + } +}; + +static int __init init_rc_map_cinergy(void) +{ + return ir_register_map(&cinergy_map); +} + +static void __exit exit_rc_map_cinergy(void) +{ + ir_unregister_map(&cinergy_map); +} + +module_init(init_rc_map_cinergy) +module_exit(exit_rc_map_cinergy) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-dm1105-nec.c b/drivers/media/IR/keymaps/rc-dm1105-nec.c new file mode 100644 index 000000000000..90684d0efea3 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-dm1105-nec.c @@ -0,0 +1,76 @@ +/* dm1105-nec.h - Keytable for dm1105_nec Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* DVBWorld remotes + Igor M. Liplianin + */ + +static struct ir_scancode dm1105_nec[] = { + { 0x0a, KEY_POWER2}, /* power */ + { 0x0c, KEY_MUTE}, /* mute */ + { 0x11, KEY_1}, + { 0x12, KEY_2}, + { 0x13, KEY_3}, + { 0x14, KEY_4}, + { 0x15, KEY_5}, + { 0x16, KEY_6}, + { 0x17, KEY_7}, + { 0x18, KEY_8}, + { 0x19, KEY_9}, + { 0x10, KEY_0}, + { 0x1c, KEY_CHANNELUP}, /* ch+ */ + { 0x0f, KEY_CHANNELDOWN}, /* ch- */ + { 0x1a, KEY_VOLUMEUP}, /* vol+ */ + { 0x0e, KEY_VOLUMEDOWN}, /* vol- */ + { 0x04, KEY_RECORD}, /* rec */ + { 0x09, KEY_CHANNEL}, /* fav */ + { 0x08, KEY_BACKSPACE}, /* rewind */ + { 0x07, KEY_FASTFORWARD}, /* fast */ + { 0x0b, KEY_PAUSE}, /* pause */ + { 0x02, KEY_ESC}, /* cancel */ + { 0x03, KEY_TAB}, /* tab */ + { 0x00, KEY_UP}, /* up */ + { 0x1f, KEY_ENTER}, /* ok */ + { 0x01, KEY_DOWN}, /* down */ + { 0x05, KEY_RECORD}, /* cap */ + { 0x06, KEY_STOP}, /* stop */ + { 0x40, KEY_ZOOM}, /* full */ + { 0x1e, KEY_TV}, /* tvmode */ + { 0x1b, KEY_B}, /* recall */ +}; + +static struct rc_keymap dm1105_nec_map = { + .map = { + .scan = dm1105_nec, + .size = ARRAY_SIZE(dm1105_nec), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_DM1105_NEC, + } +}; + +static int __init init_rc_map_dm1105_nec(void) +{ + return ir_register_map(&dm1105_nec_map); +} + +static void __exit exit_rc_map_dm1105_nec(void) +{ + ir_unregister_map(&dm1105_nec_map); +} + +module_init(init_rc_map_dm1105_nec) +module_exit(exit_rc_map_dm1105_nec) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c b/drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c new file mode 100644 index 000000000000..8a4027af964a --- /dev/null +++ b/drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c @@ -0,0 +1,78 @@ +/* dntv-live-dvb-t.h - Keytable for dntv_live_dvb_t Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* DigitalNow DNTV Live DVB-T Remote */ + +static struct ir_scancode dntv_live_dvb_t[] = { + { 0x00, KEY_ESC }, /* 'go up a level?' */ + /* Keys 0 to 9 */ + { 0x0a, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0b, KEY_TUNER }, /* tv/fm */ + { 0x0c, KEY_SEARCH }, /* scan */ + { 0x0d, KEY_STOP }, + { 0x0e, KEY_PAUSE }, + { 0x0f, KEY_LIST }, /* source */ + + { 0x10, KEY_MUTE }, + { 0x11, KEY_REWIND }, /* backward << */ + { 0x12, KEY_POWER }, + { 0x13, KEY_CAMERA }, /* snap */ + { 0x14, KEY_AUDIO }, /* stereo */ + { 0x15, KEY_CLEAR }, /* reset */ + { 0x16, KEY_PLAY }, + { 0x17, KEY_ENTER }, + { 0x18, KEY_ZOOM }, /* full screen */ + { 0x19, KEY_FASTFORWARD }, /* forward >> */ + { 0x1a, KEY_CHANNELUP }, + { 0x1b, KEY_VOLUMEUP }, + { 0x1c, KEY_INFO }, /* preview */ + { 0x1d, KEY_RECORD }, /* record */ + { 0x1e, KEY_CHANNELDOWN }, + { 0x1f, KEY_VOLUMEDOWN }, +}; + +static struct rc_keymap dntv_live_dvb_t_map = { + .map = { + .scan = dntv_live_dvb_t, + .size = ARRAY_SIZE(dntv_live_dvb_t), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_DNTV_LIVE_DVB_T, + } +}; + +static int __init init_rc_map_dntv_live_dvb_t(void) +{ + return ir_register_map(&dntv_live_dvb_t_map); +} + +static void __exit exit_rc_map_dntv_live_dvb_t(void) +{ + ir_unregister_map(&dntv_live_dvb_t_map); +} + +module_init(init_rc_map_dntv_live_dvb_t) +module_exit(exit_rc_map_dntv_live_dvb_t) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c b/drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c new file mode 100644 index 000000000000..6f4d60764d59 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c @@ -0,0 +1,97 @@ +/* dntv-live-dvbt-pro.h - Keytable for dntv_live_dvbt_pro Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* DigitalNow DNTV Live! DVB-T Pro Remote */ + +static struct ir_scancode dntv_live_dvbt_pro[] = { + { 0x16, KEY_POWER }, + { 0x5b, KEY_HOME }, + + { 0x55, KEY_TV }, /* live tv */ + { 0x58, KEY_TUNER }, /* digital Radio */ + { 0x5a, KEY_RADIO }, /* FM radio */ + { 0x59, KEY_DVD }, /* dvd menu */ + { 0x03, KEY_1 }, + { 0x01, KEY_2 }, + { 0x06, KEY_3 }, + { 0x09, KEY_4 }, + { 0x1d, KEY_5 }, + { 0x1f, KEY_6 }, + { 0x0d, KEY_7 }, + { 0x19, KEY_8 }, + { 0x1b, KEY_9 }, + { 0x0c, KEY_CANCEL }, + { 0x15, KEY_0 }, + { 0x4a, KEY_CLEAR }, + { 0x13, KEY_BACK }, + { 0x00, KEY_TAB }, + { 0x4b, KEY_UP }, + { 0x4e, KEY_LEFT }, + { 0x4f, KEY_OK }, + { 0x52, KEY_RIGHT }, + { 0x51, KEY_DOWN }, + { 0x1e, KEY_VOLUMEUP }, + { 0x0a, KEY_VOLUMEDOWN }, + { 0x02, KEY_CHANNELDOWN }, + { 0x05, KEY_CHANNELUP }, + { 0x11, KEY_RECORD }, + { 0x14, KEY_PLAY }, + { 0x4c, KEY_PAUSE }, + { 0x1a, KEY_STOP }, + { 0x40, KEY_REWIND }, + { 0x12, KEY_FASTFORWARD }, + { 0x41, KEY_PREVIOUSSONG }, /* replay |< */ + { 0x42, KEY_NEXTSONG }, /* skip >| */ + { 0x54, KEY_CAMERA }, /* capture */ + { 0x50, KEY_LANGUAGE }, /* sap */ + { 0x47, KEY_TV2 }, /* pip */ + { 0x4d, KEY_SCREEN }, + { 0x43, KEY_SUBTITLE }, + { 0x10, KEY_MUTE }, + { 0x49, KEY_AUDIO }, /* l/r */ + { 0x07, KEY_SLEEP }, + { 0x08, KEY_VIDEO }, /* a/v */ + { 0x0e, KEY_PREVIOUS }, /* recall */ + { 0x45, KEY_ZOOM }, /* zoom + */ + { 0x46, KEY_ANGLE }, /* zoom - */ + { 0x56, KEY_RED }, + { 0x57, KEY_GREEN }, + { 0x5c, KEY_YELLOW }, + { 0x5d, KEY_BLUE }, +}; + +static struct rc_keymap dntv_live_dvbt_pro_map = { + .map = { + .scan = dntv_live_dvbt_pro, + .size = ARRAY_SIZE(dntv_live_dvbt_pro), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_DNTV_LIVE_DVBT_PRO, + } +}; + +static int __init init_rc_map_dntv_live_dvbt_pro(void) +{ + return ir_register_map(&dntv_live_dvbt_pro_map); +} + +static void __exit exit_rc_map_dntv_live_dvbt_pro(void) +{ + ir_unregister_map(&dntv_live_dvbt_pro_map); +} + +module_init(init_rc_map_dntv_live_dvbt_pro) +module_exit(exit_rc_map_dntv_live_dvbt_pro) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-em-terratec.c b/drivers/media/IR/keymaps/rc-em-terratec.c new file mode 100644 index 000000000000..3130c9c29e6b --- /dev/null +++ b/drivers/media/IR/keymaps/rc-em-terratec.c @@ -0,0 +1,69 @@ +/* em-terratec.h - Keytable for em_terratec Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode em_terratec[] = { + { 0x01, KEY_CHANNEL }, + { 0x02, KEY_SELECT }, + { 0x03, KEY_MUTE }, + { 0x04, KEY_POWER }, + { 0x05, KEY_1 }, + { 0x06, KEY_2 }, + { 0x07, KEY_3 }, + { 0x08, KEY_CHANNELUP }, + { 0x09, KEY_4 }, + { 0x0a, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x0c, KEY_CHANNELDOWN }, + { 0x0d, KEY_7 }, + { 0x0e, KEY_8 }, + { 0x0f, KEY_9 }, + { 0x10, KEY_VOLUMEUP }, + { 0x11, KEY_0 }, + { 0x12, KEY_MENU }, + { 0x13, KEY_PRINT }, + { 0x14, KEY_VOLUMEDOWN }, + { 0x16, KEY_PAUSE }, + { 0x18, KEY_RECORD }, + { 0x19, KEY_REWIND }, + { 0x1a, KEY_PLAY }, + { 0x1b, KEY_FORWARD }, + { 0x1c, KEY_BACKSPACE }, + { 0x1e, KEY_STOP }, + { 0x40, KEY_ZOOM }, +}; + +static struct rc_keymap em_terratec_map = { + .map = { + .scan = em_terratec, + .size = ARRAY_SIZE(em_terratec), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_EM_TERRATEC, + } +}; + +static int __init init_rc_map_em_terratec(void) +{ + return ir_register_map(&em_terratec_map); +} + +static void __exit exit_rc_map_em_terratec(void) +{ + ir_unregister_map(&em_terratec_map); +} + +module_init(init_rc_map_em_terratec) +module_exit(exit_rc_map_em_terratec) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-empty.c b/drivers/media/IR/keymaps/rc-empty.c new file mode 100644 index 000000000000..3b338d84b476 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-empty.c @@ -0,0 +1,44 @@ +/* empty.h - Keytable for empty Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* empty keytable, can be used as placeholder for not-yet created keytables */ + +static struct ir_scancode empty[] = { + { 0x2a, KEY_COFFEE }, +}; + +static struct rc_keymap empty_map = { + .map = { + .scan = empty, + .size = ARRAY_SIZE(empty), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_EMPTY, + } +}; + +static int __init init_rc_map_empty(void) +{ + return ir_register_map(&empty_map); +} + +static void __exit exit_rc_map_empty(void) +{ + ir_unregister_map(&empty_map); +} + +module_init(init_rc_map_empty) +module_exit(exit_rc_map_empty) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-encore-enltv-fm53.c b/drivers/media/IR/keymaps/rc-encore-enltv-fm53.c new file mode 100644 index 000000000000..4b816967877e --- /dev/null +++ b/drivers/media/IR/keymaps/rc-encore-enltv-fm53.c @@ -0,0 +1,81 @@ +/* encore-enltv-fm53.h - Keytable for encore_enltv_fm53 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Encore ENLTV-FM v5.3 + Mauro Carvalho Chehab + */ + +static struct ir_scancode encore_enltv_fm53[] = { + { 0x10, KEY_POWER2}, + { 0x06, KEY_MUTE}, + + { 0x09, KEY_1}, + { 0x1d, KEY_2}, + { 0x1f, KEY_3}, + { 0x19, KEY_4}, + { 0x1b, KEY_5}, + { 0x11, KEY_6}, + { 0x17, KEY_7}, + { 0x12, KEY_8}, + { 0x16, KEY_9}, + { 0x48, KEY_0}, + + { 0x04, KEY_LIST}, /* -/-- */ + { 0x40, KEY_LAST}, /* recall */ + + { 0x02, KEY_MODE}, /* TV/AV */ + { 0x05, KEY_CAMERA}, /* SNAPSHOT */ + + { 0x4c, KEY_CHANNELUP}, /* UP */ + { 0x00, KEY_CHANNELDOWN}, /* DOWN */ + { 0x0d, KEY_VOLUMEUP}, /* RIGHT */ + { 0x15, KEY_VOLUMEDOWN}, /* LEFT */ + { 0x49, KEY_ENTER}, /* OK */ + + { 0x54, KEY_RECORD}, + { 0x4d, KEY_PLAY}, /* pause */ + + { 0x1e, KEY_MENU}, /* video setting */ + { 0x0e, KEY_RIGHT}, /* <- */ + { 0x1a, KEY_LEFT}, /* -> */ + + { 0x0a, KEY_CLEAR}, /* video default */ + { 0x0c, KEY_ZOOM}, /* hide pannel */ + { 0x47, KEY_SLEEP}, /* shutdown */ +}; + +static struct rc_keymap encore_enltv_fm53_map = { + .map = { + .scan = encore_enltv_fm53, + .size = ARRAY_SIZE(encore_enltv_fm53), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_ENCORE_ENLTV_FM53, + } +}; + +static int __init init_rc_map_encore_enltv_fm53(void) +{ + return ir_register_map(&encore_enltv_fm53_map); +} + +static void __exit exit_rc_map_encore_enltv_fm53(void) +{ + ir_unregister_map(&encore_enltv_fm53_map); +} + +module_init(init_rc_map_encore_enltv_fm53) +module_exit(exit_rc_map_encore_enltv_fm53) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-encore-enltv.c b/drivers/media/IR/keymaps/rc-encore-enltv.c new file mode 100644 index 000000000000..9fabffd28cc9 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-encore-enltv.c @@ -0,0 +1,112 @@ +/* encore-enltv.h - Keytable for encore_enltv Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Encore ENLTV-FM - black plastic, white front cover with white glowing buttons + Juan Pablo Sormani */ + +static struct ir_scancode encore_enltv[] = { + + /* Power button does nothing, neither in Windows app, + although it sends data (used for BIOS wakeup?) */ + { 0x0d, KEY_MUTE }, + + { 0x1e, KEY_TV }, + { 0x00, KEY_VIDEO }, + { 0x01, KEY_AUDIO }, /* music */ + { 0x02, KEY_MHP }, /* picture */ + + { 0x1f, KEY_1 }, + { 0x03, KEY_2 }, + { 0x04, KEY_3 }, + { 0x05, KEY_4 }, + { 0x1c, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x1d, KEY_9 }, + { 0x0a, KEY_0 }, + + { 0x09, KEY_LIST }, /* -/-- */ + { 0x0b, KEY_LAST }, /* recall */ + + { 0x14, KEY_HOME }, /* win start menu */ + { 0x15, KEY_EXIT }, /* exit */ + { 0x16, KEY_CHANNELUP }, /* UP */ + { 0x12, KEY_CHANNELDOWN }, /* DOWN */ + { 0x0c, KEY_VOLUMEUP }, /* RIGHT */ + { 0x17, KEY_VOLUMEDOWN }, /* LEFT */ + + { 0x18, KEY_ENTER }, /* OK */ + + { 0x0e, KEY_ESC }, + { 0x13, KEY_CYCLEWINDOWS }, /* desktop */ + { 0x11, KEY_TAB }, + { 0x19, KEY_SWITCHVIDEOMODE }, /* switch */ + + { 0x1a, KEY_MENU }, + { 0x1b, KEY_ZOOM }, /* fullscreen */ + { 0x44, KEY_TIME }, /* time shift */ + { 0x40, KEY_MODE }, /* source */ + + { 0x5a, KEY_RECORD }, + { 0x42, KEY_PLAY }, /* play/pause */ + { 0x45, KEY_STOP }, + { 0x43, KEY_CAMERA }, /* camera icon */ + + { 0x48, KEY_REWIND }, + { 0x4a, KEY_FASTFORWARD }, + { 0x49, KEY_PREVIOUS }, + { 0x4b, KEY_NEXT }, + + { 0x4c, KEY_FAVORITES }, /* tv wall */ + { 0x4d, KEY_SOUND }, /* DVD sound */ + { 0x4e, KEY_LANGUAGE }, /* DVD lang */ + { 0x4f, KEY_TEXT }, /* DVD text */ + + { 0x50, KEY_SLEEP }, /* shutdown */ + { 0x51, KEY_MODE }, /* stereo > main */ + { 0x52, KEY_SELECT }, /* stereo > sap */ + { 0x53, KEY_PROG1 }, /* teletext */ + + + { 0x59, KEY_RED }, /* AP1 */ + { 0x41, KEY_GREEN }, /* AP2 */ + { 0x47, KEY_YELLOW }, /* AP3 */ + { 0x57, KEY_BLUE }, /* AP4 */ +}; + +static struct rc_keymap encore_enltv_map = { + .map = { + .scan = encore_enltv, + .size = ARRAY_SIZE(encore_enltv), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_ENCORE_ENLTV, + } +}; + +static int __init init_rc_map_encore_enltv(void) +{ + return ir_register_map(&encore_enltv_map); +} + +static void __exit exit_rc_map_encore_enltv(void) +{ + ir_unregister_map(&encore_enltv_map); +} + +module_init(init_rc_map_encore_enltv) +module_exit(exit_rc_map_encore_enltv) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-encore-enltv2.c b/drivers/media/IR/keymaps/rc-encore-enltv2.c new file mode 100644 index 000000000000..efefd5166618 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-encore-enltv2.c @@ -0,0 +1,90 @@ +/* encore-enltv2.h - Keytable for encore_enltv2 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton + Mauro Carvalho Chehab */ + +static struct ir_scancode encore_enltv2[] = { + { 0x4c, KEY_POWER2 }, + { 0x4a, KEY_TUNER }, + { 0x40, KEY_1 }, + { 0x60, KEY_2 }, + { 0x50, KEY_3 }, + { 0x70, KEY_4 }, + { 0x48, KEY_5 }, + { 0x68, KEY_6 }, + { 0x58, KEY_7 }, + { 0x78, KEY_8 }, + { 0x44, KEY_9 }, + { 0x54, KEY_0 }, + + { 0x64, KEY_LAST }, /* +100 */ + { 0x4e, KEY_AGAIN }, /* Recall */ + + { 0x6c, KEY_SWITCHVIDEOMODE }, /* Video Source */ + { 0x5e, KEY_MENU }, + { 0x56, KEY_SCREEN }, + { 0x7a, KEY_SETUP }, + + { 0x46, KEY_MUTE }, + { 0x5c, KEY_MODE }, /* Stereo */ + { 0x74, KEY_INFO }, + { 0x7c, KEY_CLEAR }, + + { 0x55, KEY_UP }, + { 0x49, KEY_DOWN }, + { 0x7e, KEY_LEFT }, + { 0x59, KEY_RIGHT }, + { 0x6a, KEY_ENTER }, + + { 0x42, KEY_VOLUMEUP }, + { 0x62, KEY_VOLUMEDOWN }, + { 0x52, KEY_CHANNELUP }, + { 0x72, KEY_CHANNELDOWN }, + + { 0x41, KEY_RECORD }, + { 0x51, KEY_CAMERA }, /* Snapshot */ + { 0x75, KEY_TIME }, /* Timeshift */ + { 0x71, KEY_TV2 }, /* PIP */ + + { 0x45, KEY_REWIND }, + { 0x6f, KEY_PAUSE }, + { 0x7d, KEY_FORWARD }, + { 0x79, KEY_STOP }, +}; + +static struct rc_keymap encore_enltv2_map = { + .map = { + .scan = encore_enltv2, + .size = ARRAY_SIZE(encore_enltv2), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_ENCORE_ENLTV2, + } +}; + +static int __init init_rc_map_encore_enltv2(void) +{ + return ir_register_map(&encore_enltv2_map); +} + +static void __exit exit_rc_map_encore_enltv2(void) +{ + ir_unregister_map(&encore_enltv2_map); +} + +module_init(init_rc_map_encore_enltv2) +module_exit(exit_rc_map_encore_enltv2) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-evga-indtube.c b/drivers/media/IR/keymaps/rc-evga-indtube.c new file mode 100644 index 000000000000..3f3fb13813b3 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-evga-indtube.c @@ -0,0 +1,61 @@ +/* evga-indtube.h - Keytable for evga_indtube Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* EVGA inDtube + Devin Heitmueller + */ + +static struct ir_scancode evga_indtube[] = { + { 0x12, KEY_POWER}, + { 0x02, KEY_MODE}, /* TV */ + { 0x14, KEY_MUTE}, + { 0x1a, KEY_CHANNELUP}, + { 0x16, KEY_TV2}, /* PIP */ + { 0x1d, KEY_VOLUMEUP}, + { 0x05, KEY_CHANNELDOWN}, + { 0x0f, KEY_PLAYPAUSE}, + { 0x19, KEY_VOLUMEDOWN}, + { 0x1c, KEY_REWIND}, + { 0x0d, KEY_RECORD}, + { 0x18, KEY_FORWARD}, + { 0x1e, KEY_PREVIOUS}, + { 0x1b, KEY_STOP}, + { 0x1f, KEY_NEXT}, + { 0x13, KEY_CAMERA}, +}; + +static struct rc_keymap evga_indtube_map = { + .map = { + .scan = evga_indtube, + .size = ARRAY_SIZE(evga_indtube), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_EVGA_INDTUBE, + } +}; + +static int __init init_rc_map_evga_indtube(void) +{ + return ir_register_map(&evga_indtube_map); +} + +static void __exit exit_rc_map_evga_indtube(void) +{ + ir_unregister_map(&evga_indtube_map); +} + +module_init(init_rc_map_evga_indtube) +module_exit(exit_rc_map_evga_indtube) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-eztv.c b/drivers/media/IR/keymaps/rc-eztv.c new file mode 100644 index 000000000000..660907a78db9 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-eztv.c @@ -0,0 +1,96 @@ +/* eztv.h - Keytable for eztv Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Alfons Geser + * updates from Job D. R. Borges */ + +static struct ir_scancode eztv[] = { + { 0x12, KEY_POWER }, + { 0x01, KEY_TV }, /* DVR */ + { 0x15, KEY_DVD }, /* DVD */ + { 0x17, KEY_AUDIO }, /* music */ + /* DVR mode / DVD mode / music mode */ + + { 0x1b, KEY_MUTE }, /* mute */ + { 0x02, KEY_LANGUAGE }, /* MTS/SAP / audio / autoseek */ + { 0x1e, KEY_SUBTITLE }, /* closed captioning / subtitle / seek */ + { 0x16, KEY_ZOOM }, /* full screen */ + { 0x1c, KEY_VIDEO }, /* video source / eject / delall */ + { 0x1d, KEY_RESTART }, /* playback / angle / del */ + { 0x2f, KEY_SEARCH }, /* scan / menu / playlist */ + { 0x30, KEY_CHANNEL }, /* CH surfing / bookmark / memo */ + + { 0x31, KEY_HELP }, /* help */ + { 0x32, KEY_MODE }, /* num/memo */ + { 0x33, KEY_ESC }, /* cancel */ + + { 0x0c, KEY_UP }, /* up */ + { 0x10, KEY_DOWN }, /* down */ + { 0x08, KEY_LEFT }, /* left */ + { 0x04, KEY_RIGHT }, /* right */ + { 0x03, KEY_SELECT }, /* select */ + + { 0x1f, KEY_REWIND }, /* rewind */ + { 0x20, KEY_PLAYPAUSE },/* play/pause */ + { 0x29, KEY_FORWARD }, /* forward */ + { 0x14, KEY_AGAIN }, /* repeat */ + { 0x2b, KEY_RECORD }, /* recording */ + { 0x2c, KEY_STOP }, /* stop */ + { 0x2d, KEY_PLAY }, /* play */ + { 0x2e, KEY_CAMERA }, /* snapshot / shuffle */ + + { 0x00, KEY_0 }, + { 0x05, KEY_1 }, + { 0x06, KEY_2 }, + { 0x07, KEY_3 }, + { 0x09, KEY_4 }, + { 0x0a, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x0d, KEY_7 }, + { 0x0e, KEY_8 }, + { 0x0f, KEY_9 }, + + { 0x2a, KEY_VOLUMEUP }, + { 0x11, KEY_VOLUMEDOWN }, + { 0x18, KEY_CHANNELUP },/* CH.tracking up */ + { 0x19, KEY_CHANNELDOWN },/* CH.tracking down */ + + { 0x13, KEY_ENTER }, /* enter */ + { 0x21, KEY_DOT }, /* . (decimal dot) */ +}; + +static struct rc_keymap eztv_map = { + .map = { + .scan = eztv, + .size = ARRAY_SIZE(eztv), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_EZTV, + } +}; + +static int __init init_rc_map_eztv(void) +{ + return ir_register_map(&eztv_map); +} + +static void __exit exit_rc_map_eztv(void) +{ + ir_unregister_map(&eztv_map); +} + +module_init(init_rc_map_eztv) +module_exit(exit_rc_map_eztv) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-flydvb.c b/drivers/media/IR/keymaps/rc-flydvb.c new file mode 100644 index 000000000000..a173c81035f4 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-flydvb.c @@ -0,0 +1,77 @@ +/* flydvb.h - Keytable for flydvb Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode flydvb[] = { + { 0x01, KEY_ZOOM }, /* Full Screen */ + { 0x00, KEY_POWER }, /* Power */ + + { 0x03, KEY_1 }, + { 0x04, KEY_2 }, + { 0x05, KEY_3 }, + { 0x07, KEY_4 }, + { 0x08, KEY_5 }, + { 0x09, KEY_6 }, + { 0x0b, KEY_7 }, + { 0x0c, KEY_8 }, + { 0x0d, KEY_9 }, + { 0x06, KEY_AGAIN }, /* Recall */ + { 0x0f, KEY_0 }, + { 0x10, KEY_MUTE }, /* Mute */ + { 0x02, KEY_RADIO }, /* TV/Radio */ + { 0x1b, KEY_LANGUAGE }, /* SAP (Second Audio Program) */ + + { 0x14, KEY_VOLUMEUP }, /* VOL+ */ + { 0x17, KEY_VOLUMEDOWN }, /* VOL- */ + { 0x12, KEY_CHANNELUP }, /* CH+ */ + { 0x13, KEY_CHANNELDOWN }, /* CH- */ + { 0x1d, KEY_ENTER }, /* Enter */ + + { 0x1a, KEY_MODE }, /* PIP */ + { 0x18, KEY_TUNER }, /* Source */ + + { 0x1e, KEY_RECORD }, /* Record/Pause */ + { 0x15, KEY_ANGLE }, /* Swap (no label on key) */ + { 0x1c, KEY_PAUSE }, /* Timeshift/Pause */ + { 0x19, KEY_BACK }, /* Rewind << */ + { 0x0a, KEY_PLAYPAUSE }, /* Play/Pause */ + { 0x1f, KEY_FORWARD }, /* Forward >> */ + { 0x16, KEY_PREVIOUS }, /* Back |<< */ + { 0x11, KEY_STOP }, /* Stop */ + { 0x0e, KEY_NEXT }, /* End >>| */ +}; + +static struct rc_keymap flydvb_map = { + .map = { + .scan = flydvb, + .size = ARRAY_SIZE(flydvb), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_FLYDVB, + } +}; + +static int __init init_rc_map_flydvb(void) +{ + return ir_register_map(&flydvb_map); +} + +static void __exit exit_rc_map_flydvb(void) +{ + ir_unregister_map(&flydvb_map); +} + +module_init(init_rc_map_flydvb) +module_exit(exit_rc_map_flydvb) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-flyvideo.c b/drivers/media/IR/keymaps/rc-flyvideo.c new file mode 100644 index 000000000000..9c73043cbdba --- /dev/null +++ b/drivers/media/IR/keymaps/rc-flyvideo.c @@ -0,0 +1,70 @@ +/* flyvideo.h - Keytable for flyvideo Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode flyvideo[] = { + { 0x0f, KEY_0 }, + { 0x03, KEY_1 }, + { 0x04, KEY_2 }, + { 0x05, KEY_3 }, + { 0x07, KEY_4 }, + { 0x08, KEY_5 }, + { 0x09, KEY_6 }, + { 0x0b, KEY_7 }, + { 0x0c, KEY_8 }, + { 0x0d, KEY_9 }, + + { 0x0e, KEY_MODE }, /* Air/Cable */ + { 0x11, KEY_VIDEO }, /* Video */ + { 0x15, KEY_AUDIO }, /* Audio */ + { 0x00, KEY_POWER }, /* Power */ + { 0x18, KEY_TUNER }, /* AV Source */ + { 0x02, KEY_ZOOM }, /* Fullscreen */ + { 0x1a, KEY_LANGUAGE }, /* Stereo */ + { 0x1b, KEY_MUTE }, /* Mute */ + { 0x14, KEY_VOLUMEUP }, /* Volume + */ + { 0x17, KEY_VOLUMEDOWN },/* Volume - */ + { 0x12, KEY_CHANNELUP },/* Channel + */ + { 0x13, KEY_CHANNELDOWN },/* Channel - */ + { 0x06, KEY_AGAIN }, /* Recall */ + { 0x10, KEY_ENTER }, /* Enter */ + + { 0x19, KEY_BACK }, /* Rewind ( <<< ) */ + { 0x1f, KEY_FORWARD }, /* Forward ( >>> ) */ + { 0x0a, KEY_ANGLE }, /* no label, may be used as the PAUSE button */ +}; + +static struct rc_keymap flyvideo_map = { + .map = { + .scan = flyvideo, + .size = ARRAY_SIZE(flyvideo), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_FLYVIDEO, + } +}; + +static int __init init_rc_map_flyvideo(void) +{ + return ir_register_map(&flyvideo_map); +} + +static void __exit exit_rc_map_flyvideo(void) +{ + ir_unregister_map(&flyvideo_map); +} + +module_init(init_rc_map_flyvideo) +module_exit(exit_rc_map_flyvideo) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-fusionhdtv-mce.c b/drivers/media/IR/keymaps/rc-fusionhdtv-mce.c new file mode 100644 index 000000000000..cdb10389b10e --- /dev/null +++ b/drivers/media/IR/keymaps/rc-fusionhdtv-mce.c @@ -0,0 +1,98 @@ +/* fusionhdtv-mce.h - Keytable for fusionhdtv_mce Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* DViCO FUSION HDTV MCE remote */ + +static struct ir_scancode fusionhdtv_mce[] = { + + { 0x0b, KEY_1 }, + { 0x17, KEY_2 }, + { 0x1b, KEY_3 }, + { 0x07, KEY_4 }, + { 0x50, KEY_5 }, + { 0x54, KEY_6 }, + { 0x48, KEY_7 }, + { 0x4c, KEY_8 }, + { 0x58, KEY_9 }, + { 0x03, KEY_0 }, + + { 0x5e, KEY_OK }, + { 0x51, KEY_UP }, + { 0x53, KEY_DOWN }, + { 0x5b, KEY_LEFT }, + { 0x5f, KEY_RIGHT }, + + { 0x02, KEY_TV }, /* Labeled DTV on remote */ + { 0x0e, KEY_MP3 }, + { 0x1a, KEY_DVD }, + { 0x1e, KEY_FAVORITES }, /* Labeled CPF on remote */ + { 0x16, KEY_SETUP }, + { 0x46, KEY_POWER2 }, /* TV On/Off button on remote */ + { 0x0a, KEY_EPG }, /* Labeled Guide on remote */ + + { 0x49, KEY_BACK }, + { 0x59, KEY_INFO }, /* Labeled MORE on remote */ + { 0x4d, KEY_MENU }, /* Labeled DVDMENU on remote */ + { 0x55, KEY_CYCLEWINDOWS }, /* Labeled ALT-TAB on remote */ + + { 0x0f, KEY_PREVIOUSSONG }, /* Labeled |<< REPLAY on remote */ + { 0x12, KEY_NEXTSONG }, /* Labeled >>| SKIP on remote */ + { 0x42, KEY_ENTER }, /* Labeled START with a green + MS windows logo on remote */ + + { 0x15, KEY_VOLUMEUP }, + { 0x05, KEY_VOLUMEDOWN }, + { 0x11, KEY_CHANNELUP }, + { 0x09, KEY_CHANNELDOWN }, + + { 0x52, KEY_CAMERA }, + { 0x5a, KEY_TUNER }, + { 0x19, KEY_OPEN }, + + { 0x13, KEY_MODE }, /* 4:3 16:9 select */ + { 0x1f, KEY_ZOOM }, + + { 0x43, KEY_REWIND }, + { 0x47, KEY_PLAYPAUSE }, + { 0x4f, KEY_FASTFORWARD }, + { 0x57, KEY_MUTE }, + { 0x0d, KEY_STOP }, + { 0x01, KEY_RECORD }, + { 0x4e, KEY_POWER }, +}; + +static struct rc_keymap fusionhdtv_mce_map = { + .map = { + .scan = fusionhdtv_mce, + .size = ARRAY_SIZE(fusionhdtv_mce), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_FUSIONHDTV_MCE, + } +}; + +static int __init init_rc_map_fusionhdtv_mce(void) +{ + return ir_register_map(&fusionhdtv_mce_map); +} + +static void __exit exit_rc_map_fusionhdtv_mce(void) +{ + ir_unregister_map(&fusionhdtv_mce_map); +} + +module_init(init_rc_map_fusionhdtv_mce) +module_exit(exit_rc_map_fusionhdtv_mce) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-gadmei-rm008z.c b/drivers/media/IR/keymaps/rc-gadmei-rm008z.c new file mode 100644 index 000000000000..c16c0d1263ac --- /dev/null +++ b/drivers/media/IR/keymaps/rc-gadmei-rm008z.c @@ -0,0 +1,81 @@ +/* gadmei-rm008z.h - Keytable for gadmei_rm008z Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* GADMEI UTV330+ RM008Z remote + Shine Liu + */ + +static struct ir_scancode gadmei_rm008z[] = { + { 0x14, KEY_POWER2}, /* POWER OFF */ + { 0x0c, KEY_MUTE}, /* MUTE */ + + { 0x18, KEY_TV}, /* TV */ + { 0x0e, KEY_VIDEO}, /* AV */ + { 0x0b, KEY_AUDIO}, /* SV */ + { 0x0f, KEY_RADIO}, /* FM */ + + { 0x00, KEY_1}, + { 0x01, KEY_2}, + { 0x02, KEY_3}, + { 0x03, KEY_4}, + { 0x04, KEY_5}, + { 0x05, KEY_6}, + { 0x06, KEY_7}, + { 0x07, KEY_8}, + { 0x08, KEY_9}, + { 0x09, KEY_0}, + { 0x0a, KEY_INFO}, /* OSD */ + { 0x1c, KEY_BACKSPACE}, /* LAST */ + + { 0x0d, KEY_PLAY}, /* PLAY */ + { 0x1e, KEY_CAMERA}, /* SNAPSHOT */ + { 0x1a, KEY_RECORD}, /* RECORD */ + { 0x17, KEY_STOP}, /* STOP */ + + { 0x1f, KEY_UP}, /* UP */ + { 0x44, KEY_DOWN}, /* DOWN */ + { 0x46, KEY_TAB}, /* BACK */ + { 0x4a, KEY_ZOOM}, /* FULLSECREEN */ + + { 0x10, KEY_VOLUMEUP}, /* VOLUMEUP */ + { 0x11, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ + { 0x12, KEY_CHANNELUP}, /* CHANNELUP */ + { 0x13, KEY_CHANNELDOWN}, /* CHANNELDOWN */ + { 0x15, KEY_ENTER}, /* OK */ +}; + +static struct rc_keymap gadmei_rm008z_map = { + .map = { + .scan = gadmei_rm008z, + .size = ARRAY_SIZE(gadmei_rm008z), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_GADMEI_RM008Z, + } +}; + +static int __init init_rc_map_gadmei_rm008z(void) +{ + return ir_register_map(&gadmei_rm008z_map); +} + +static void __exit exit_rc_map_gadmei_rm008z(void) +{ + ir_unregister_map(&gadmei_rm008z_map); +} + +module_init(init_rc_map_gadmei_rm008z) +module_exit(exit_rc_map_gadmei_rm008z) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c b/drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c new file mode 100644 index 000000000000..89f8e384e52a --- /dev/null +++ b/drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c @@ -0,0 +1,84 @@ +/* genius-tvgo-a11mce.h - Keytable for genius_tvgo_a11mce Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + * Remote control for the Genius TVGO A11MCE + * Adrian Pardini + */ + +static struct ir_scancode genius_tvgo_a11mce[] = { + /* Keys 0 to 9 */ + { 0x48, KEY_0 }, + { 0x09, KEY_1 }, + { 0x1d, KEY_2 }, + { 0x1f, KEY_3 }, + { 0x19, KEY_4 }, + { 0x1b, KEY_5 }, + { 0x11, KEY_6 }, + { 0x17, KEY_7 }, + { 0x12, KEY_8 }, + { 0x16, KEY_9 }, + + { 0x54, KEY_RECORD }, /* recording */ + { 0x06, KEY_MUTE }, /* mute */ + { 0x10, KEY_POWER }, + { 0x40, KEY_LAST }, /* recall */ + { 0x4c, KEY_CHANNELUP }, /* channel / program + */ + { 0x00, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x0d, KEY_VOLUMEUP }, + { 0x15, KEY_VOLUMEDOWN }, + { 0x4d, KEY_OK }, /* also labeled as Pause */ + { 0x1c, KEY_ZOOM }, /* full screen and Stop*/ + { 0x02, KEY_MODE }, /* AV Source or Rewind*/ + { 0x04, KEY_LIST }, /* -/-- */ + /* small arrows above numbers */ + { 0x1a, KEY_NEXT }, /* also Fast Forward */ + { 0x0e, KEY_PREVIOUS }, /* also Rewind */ + /* these are in a rather non standard layout and have + an alternate name written */ + { 0x1e, KEY_UP }, /* Video Setting */ + { 0x0a, KEY_DOWN }, /* Video Default */ + { 0x05, KEY_CAMERA }, /* Snapshot */ + { 0x0c, KEY_RIGHT }, /* Hide Panel */ + /* Four buttons without label */ + { 0x49, KEY_RED }, + { 0x0b, KEY_GREEN }, + { 0x13, KEY_YELLOW }, + { 0x50, KEY_BLUE }, +}; + +static struct rc_keymap genius_tvgo_a11mce_map = { + .map = { + .scan = genius_tvgo_a11mce, + .size = ARRAY_SIZE(genius_tvgo_a11mce), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_GENIUS_TVGO_A11MCE, + } +}; + +static int __init init_rc_map_genius_tvgo_a11mce(void) +{ + return ir_register_map(&genius_tvgo_a11mce_map); +} + +static void __exit exit_rc_map_genius_tvgo_a11mce(void) +{ + ir_unregister_map(&genius_tvgo_a11mce_map); +} + +module_init(init_rc_map_genius_tvgo_a11mce) +module_exit(exit_rc_map_genius_tvgo_a11mce) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-gotview7135.c b/drivers/media/IR/keymaps/rc-gotview7135.c new file mode 100644 index 000000000000..52f025bb35f6 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-gotview7135.c @@ -0,0 +1,79 @@ +/* gotview7135.h - Keytable for gotview7135 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Mike Baikov */ + +static struct ir_scancode gotview7135[] = { + + { 0x11, KEY_POWER }, + { 0x35, KEY_TV }, + { 0x1b, KEY_0 }, + { 0x29, KEY_1 }, + { 0x19, KEY_2 }, + { 0x39, KEY_3 }, + { 0x1f, KEY_4 }, + { 0x2c, KEY_5 }, + { 0x21, KEY_6 }, + { 0x24, KEY_7 }, + { 0x18, KEY_8 }, + { 0x2b, KEY_9 }, + { 0x3b, KEY_AGAIN }, /* LOOP */ + { 0x06, KEY_AUDIO }, + { 0x31, KEY_PRINT }, /* PREVIEW */ + { 0x3e, KEY_VIDEO }, + { 0x10, KEY_CHANNELUP }, + { 0x20, KEY_CHANNELDOWN }, + { 0x0c, KEY_VOLUMEDOWN }, + { 0x28, KEY_VOLUMEUP }, + { 0x08, KEY_MUTE }, + { 0x26, KEY_SEARCH }, /* SCAN */ + { 0x3f, KEY_CAMERA }, /* SNAPSHOT */ + { 0x12, KEY_RECORD }, + { 0x32, KEY_STOP }, + { 0x3c, KEY_PLAY }, + { 0x1d, KEY_REWIND }, + { 0x2d, KEY_PAUSE }, + { 0x0d, KEY_FORWARD }, + { 0x05, KEY_ZOOM }, /*FULL*/ + + { 0x2a, KEY_F21 }, /* LIVE TIMESHIFT */ + { 0x0e, KEY_F22 }, /* MIN TIMESHIFT */ + { 0x1e, KEY_TIME }, /* TIMESHIFT */ + { 0x38, KEY_F24 }, /* NORMAL TIMESHIFT */ +}; + +static struct rc_keymap gotview7135_map = { + .map = { + .scan = gotview7135, + .size = ARRAY_SIZE(gotview7135), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_GOTVIEW7135, + } +}; + +static int __init init_rc_map_gotview7135(void) +{ + return ir_register_map(&gotview7135_map); +} + +static void __exit exit_rc_map_gotview7135(void) +{ + ir_unregister_map(&gotview7135_map); +} + +module_init(init_rc_map_gotview7135) +module_exit(exit_rc_map_gotview7135) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-hauppauge-new.c b/drivers/media/IR/keymaps/rc-hauppauge-new.c new file mode 100644 index 000000000000..c6f8cd7c5186 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-hauppauge-new.c @@ -0,0 +1,100 @@ +/* hauppauge-new.h - Keytable for hauppauge_new Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Hauppauge: the newer, gray remotes (seems there are multiple + * slightly different versions), shipped with cx88+ivtv cards. + * almost rc5 coding, but some non-standard keys */ + +static struct ir_scancode hauppauge_new[] = { + /* Keys 0 to 9 */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0a, KEY_TEXT }, /* keypad asterisk as well */ + { 0x0b, KEY_RED }, /* red button */ + { 0x0c, KEY_RADIO }, + { 0x0d, KEY_MENU }, + { 0x0e, KEY_SUBTITLE }, /* also the # key */ + { 0x0f, KEY_MUTE }, + { 0x10, KEY_VOLUMEUP }, + { 0x11, KEY_VOLUMEDOWN }, + { 0x12, KEY_PREVIOUS }, /* previous channel */ + { 0x14, KEY_UP }, + { 0x15, KEY_DOWN }, + { 0x16, KEY_LEFT }, + { 0x17, KEY_RIGHT }, + { 0x18, KEY_VIDEO }, /* Videos */ + { 0x19, KEY_AUDIO }, /* Music */ + /* 0x1a: Pictures - presume this means + "Multimedia Home Platform" - + no "PICTURES" key in input.h + */ + { 0x1a, KEY_MHP }, + + { 0x1b, KEY_EPG }, /* Guide */ + { 0x1c, KEY_TV }, + { 0x1e, KEY_NEXTSONG }, /* skip >| */ + { 0x1f, KEY_EXIT }, /* back/exit */ + { 0x20, KEY_CHANNELUP }, /* channel / program + */ + { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x22, KEY_CHANNEL }, /* source (old black remote) */ + { 0x24, KEY_PREVIOUSSONG }, /* replay |< */ + { 0x25, KEY_ENTER }, /* OK */ + { 0x26, KEY_SLEEP }, /* minimize (old black remote) */ + { 0x29, KEY_BLUE }, /* blue key */ + { 0x2e, KEY_GREEN }, /* green button */ + { 0x30, KEY_PAUSE }, /* pause */ + { 0x32, KEY_REWIND }, /* backward << */ + { 0x34, KEY_FASTFORWARD }, /* forward >> */ + { 0x35, KEY_PLAY }, + { 0x36, KEY_STOP }, + { 0x37, KEY_RECORD }, /* recording */ + { 0x38, KEY_YELLOW }, /* yellow key */ + { 0x3b, KEY_SELECT }, /* top right button */ + { 0x3c, KEY_ZOOM }, /* full */ + { 0x3d, KEY_POWER }, /* system power (green button) */ +}; + +static struct rc_keymap hauppauge_new_map = { + .map = { + .scan = hauppauge_new, + .size = ARRAY_SIZE(hauppauge_new), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_HAUPPAUGE_NEW, + } +}; + +static int __init init_rc_map_hauppauge_new(void) +{ + return ir_register_map(&hauppauge_new_map); +} + +static void __exit exit_rc_map_hauppauge_new(void) +{ + ir_unregister_map(&hauppauge_new_map); +} + +module_init(init_rc_map_hauppauge_new) +module_exit(exit_rc_map_hauppauge_new) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-iodata-bctv7e.c b/drivers/media/IR/keymaps/rc-iodata-bctv7e.c new file mode 100644 index 000000000000..ef6600259fc0 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-iodata-bctv7e.c @@ -0,0 +1,88 @@ +/* iodata-bctv7e.h - Keytable for iodata_bctv7e Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* IO-DATA BCTV7E Remote */ + +static struct ir_scancode iodata_bctv7e[] = { + { 0x40, KEY_TV }, + { 0x20, KEY_RADIO }, /* FM */ + { 0x60, KEY_EPG }, + { 0x00, KEY_POWER }, + + /* Keys 0 to 9 */ + { 0x44, KEY_0 }, /* 10 */ + { 0x50, KEY_1 }, + { 0x30, KEY_2 }, + { 0x70, KEY_3 }, + { 0x48, KEY_4 }, + { 0x28, KEY_5 }, + { 0x68, KEY_6 }, + { 0x58, KEY_7 }, + { 0x38, KEY_8 }, + { 0x78, KEY_9 }, + + { 0x10, KEY_L }, /* Live */ + { 0x08, KEY_TIME }, /* Time Shift */ + + { 0x18, KEY_PLAYPAUSE }, /* Play */ + + { 0x24, KEY_ENTER }, /* 11 */ + { 0x64, KEY_ESC }, /* 12 */ + { 0x04, KEY_M }, /* Multi */ + + { 0x54, KEY_VIDEO }, + { 0x34, KEY_CHANNELUP }, + { 0x74, KEY_VOLUMEUP }, + { 0x14, KEY_MUTE }, + + { 0x4c, KEY_VCR }, /* SVIDEO */ + { 0x2c, KEY_CHANNELDOWN }, + { 0x6c, KEY_VOLUMEDOWN }, + { 0x0c, KEY_ZOOM }, + + { 0x5c, KEY_PAUSE }, + { 0x3c, KEY_RED }, /* || (red) */ + { 0x7c, KEY_RECORD }, /* recording */ + { 0x1c, KEY_STOP }, + + { 0x41, KEY_REWIND }, /* backward << */ + { 0x21, KEY_PLAY }, + { 0x61, KEY_FASTFORWARD }, /* forward >> */ + { 0x01, KEY_NEXT }, /* skip >| */ +}; + +static struct rc_keymap iodata_bctv7e_map = { + .map = { + .scan = iodata_bctv7e, + .size = ARRAY_SIZE(iodata_bctv7e), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_IODATA_BCTV7E, + } +}; + +static int __init init_rc_map_iodata_bctv7e(void) +{ + return ir_register_map(&iodata_bctv7e_map); +} + +static void __exit exit_rc_map_iodata_bctv7e(void) +{ + ir_unregister_map(&iodata_bctv7e_map); +} + +module_init(init_rc_map_iodata_bctv7e) +module_exit(exit_rc_map_iodata_bctv7e) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-kaiomy.c b/drivers/media/IR/keymaps/rc-kaiomy.c new file mode 100644 index 000000000000..4c7883ba0f15 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-kaiomy.c @@ -0,0 +1,87 @@ +/* kaiomy.h - Keytable for kaiomy Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Kaiomy TVnPC U2 + Mauro Carvalho Chehab + */ + +static struct ir_scancode kaiomy[] = { + { 0x43, KEY_POWER2}, + { 0x01, KEY_LIST}, + { 0x0b, KEY_ZOOM}, + { 0x03, KEY_POWER}, + + { 0x04, KEY_1}, + { 0x08, KEY_2}, + { 0x02, KEY_3}, + + { 0x0f, KEY_4}, + { 0x05, KEY_5}, + { 0x06, KEY_6}, + + { 0x0c, KEY_7}, + { 0x0d, KEY_8}, + { 0x0a, KEY_9}, + + { 0x11, KEY_0}, + + { 0x09, KEY_CHANNELUP}, + { 0x07, KEY_CHANNELDOWN}, + + { 0x0e, KEY_VOLUMEUP}, + { 0x13, KEY_VOLUMEDOWN}, + + { 0x10, KEY_HOME}, + { 0x12, KEY_ENTER}, + + { 0x14, KEY_RECORD}, + { 0x15, KEY_STOP}, + { 0x16, KEY_PLAY}, + { 0x17, KEY_MUTE}, + + { 0x18, KEY_UP}, + { 0x19, KEY_DOWN}, + { 0x1a, KEY_LEFT}, + { 0x1b, KEY_RIGHT}, + + { 0x1c, KEY_RED}, + { 0x1d, KEY_GREEN}, + { 0x1e, KEY_YELLOW}, + { 0x1f, KEY_BLUE}, +}; + +static struct rc_keymap kaiomy_map = { + .map = { + .scan = kaiomy, + .size = ARRAY_SIZE(kaiomy), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_KAIOMY, + } +}; + +static int __init init_rc_map_kaiomy(void) +{ + return ir_register_map(&kaiomy_map); +} + +static void __exit exit_rc_map_kaiomy(void) +{ + ir_unregister_map(&kaiomy_map); +} + +module_init(init_rc_map_kaiomy) +module_exit(exit_rc_map_kaiomy) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-kworld-315u.c b/drivers/media/IR/keymaps/rc-kworld-315u.c new file mode 100644 index 000000000000..618c817374e6 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-kworld-315u.c @@ -0,0 +1,83 @@ +/* kworld-315u.h - Keytable for kworld_315u Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Kworld 315U + */ + +static struct ir_scancode kworld_315u[] = { + { 0x6143, KEY_POWER }, + { 0x6101, KEY_TUNER }, /* source */ + { 0x610b, KEY_ZOOM }, + { 0x6103, KEY_POWER2 }, /* shutdown */ + + { 0x6104, KEY_1 }, + { 0x6108, KEY_2 }, + { 0x6102, KEY_3 }, + { 0x6109, KEY_CHANNELUP }, + + { 0x610f, KEY_4 }, + { 0x6105, KEY_5 }, + { 0x6106, KEY_6 }, + { 0x6107, KEY_CHANNELDOWN }, + + { 0x610c, KEY_7 }, + { 0x610d, KEY_8 }, + { 0x610a, KEY_9 }, + { 0x610e, KEY_VOLUMEUP }, + + { 0x6110, KEY_LAST }, + { 0x6111, KEY_0 }, + { 0x6112, KEY_ENTER }, + { 0x6113, KEY_VOLUMEDOWN }, + + { 0x6114, KEY_RECORD }, + { 0x6115, KEY_STOP }, + { 0x6116, KEY_PLAY }, + { 0x6117, KEY_MUTE }, + + { 0x6118, KEY_UP }, + { 0x6119, KEY_DOWN }, + { 0x611a, KEY_LEFT }, + { 0x611b, KEY_RIGHT }, + + { 0x611c, KEY_RED }, + { 0x611d, KEY_GREEN }, + { 0x611e, KEY_YELLOW }, + { 0x611f, KEY_BLUE }, +}; + +static struct rc_keymap kworld_315u_map = { + .map = { + .scan = kworld_315u, + .size = ARRAY_SIZE(kworld_315u), + .ir_type = IR_TYPE_NEC, + .name = RC_MAP_KWORLD_315U, + } +}; + +static int __init init_rc_map_kworld_315u(void) +{ + return ir_register_map(&kworld_315u_map); +} + +static void __exit exit_rc_map_kworld_315u(void) +{ + ir_unregister_map(&kworld_315u_map); +} + +module_init(init_rc_map_kworld_315u) +module_exit(exit_rc_map_kworld_315u) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-kworld-plus-tv-analog.c b/drivers/media/IR/keymaps/rc-kworld-plus-tv-analog.c new file mode 100644 index 000000000000..366732f1f7b7 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-kworld-plus-tv-analog.c @@ -0,0 +1,99 @@ +/* kworld-plus-tv-analog.h - Keytable for kworld_plus_tv_analog Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Kworld Plus TV Analog Lite PCI IR + Mauro Carvalho Chehab + */ + +static struct ir_scancode kworld_plus_tv_analog[] = { + { 0x0c, KEY_PROG1 }, /* Kworld key */ + { 0x16, KEY_CLOSECD }, /* -> ) */ + { 0x1d, KEY_POWER2 }, + + { 0x00, KEY_1 }, + { 0x01, KEY_2 }, + { 0x02, KEY_3 }, /* Two keys have the same code: 3 and left */ + { 0x03, KEY_4 }, /* Two keys have the same code: 3 and right */ + { 0x04, KEY_5 }, + { 0x05, KEY_6 }, + { 0x06, KEY_7 }, + { 0x07, KEY_8 }, + { 0x08, KEY_9 }, + { 0x0a, KEY_0 }, + + { 0x09, KEY_AGAIN }, + { 0x14, KEY_MUTE }, + + { 0x20, KEY_UP }, + { 0x21, KEY_DOWN }, + { 0x0b, KEY_ENTER }, + + { 0x10, KEY_CHANNELUP }, + { 0x11, KEY_CHANNELDOWN }, + + /* Couldn't map key left/key right since those + conflict with '3' and '4' scancodes + I dunno what the original driver does + */ + + { 0x13, KEY_VOLUMEUP }, + { 0x12, KEY_VOLUMEDOWN }, + + /* The lower part of the IR + There are several duplicated keycodes there. + Most of them conflict with digits. + Add mappings just to the unused scancodes. + Somehow, the original driver has a way to know, + but this doesn't seem to be on some GPIO. + Also, it is not related to the time between keyup + and keydown. + */ + { 0x19, KEY_TIME}, /* Timeshift */ + { 0x1a, KEY_STOP}, + { 0x1b, KEY_RECORD}, + + { 0x22, KEY_TEXT}, + + { 0x15, KEY_AUDIO}, /* ((*)) */ + { 0x0f, KEY_ZOOM}, + { 0x1c, KEY_CAMERA}, /* snapshot */ + + { 0x18, KEY_RED}, /* B */ + { 0x23, KEY_GREEN}, /* C */ +}; + +static struct rc_keymap kworld_plus_tv_analog_map = { + .map = { + .scan = kworld_plus_tv_analog, + .size = ARRAY_SIZE(kworld_plus_tv_analog), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_KWORLD_PLUS_TV_ANALOG, + } +}; + +static int __init init_rc_map_kworld_plus_tv_analog(void) +{ + return ir_register_map(&kworld_plus_tv_analog_map); +} + +static void __exit exit_rc_map_kworld_plus_tv_analog(void) +{ + ir_unregister_map(&kworld_plus_tv_analog_map); +} + +module_init(init_rc_map_kworld_plus_tv_analog) +module_exit(exit_rc_map_kworld_plus_tv_analog) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-manli.c b/drivers/media/IR/keymaps/rc-manli.c new file mode 100644 index 000000000000..1e9fbfa90a1e --- /dev/null +++ b/drivers/media/IR/keymaps/rc-manli.c @@ -0,0 +1,135 @@ +/* manli.h - Keytable for manli Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Michael Tokarev + http://www.corpit.ru/mjt/beholdTV/remote_control.jpg + keytable is used by MANLI MTV00[0x0c] and BeholdTV 40[13] at + least, and probably other cards too. + The "ascii-art picture" below (in comments, first row + is the keycode in hex, and subsequent row(s) shows + the button labels (several variants when appropriate) + helps to descide which keycodes to assign to the buttons. + */ + +static struct ir_scancode manli[] = { + + /* 0x1c 0x12 * + * FUNCTION POWER * + * FM (|) * + * */ + { 0x1c, KEY_RADIO }, /*XXX*/ + { 0x12, KEY_POWER }, + + /* 0x01 0x02 0x03 * + * 1 2 3 * + * * + * 0x04 0x05 0x06 * + * 4 5 6 * + * * + * 0x07 0x08 0x09 * + * 7 8 9 * + * */ + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + /* 0x0a 0x00 0x17 * + * RECALL 0 +100 * + * PLUS * + * */ + { 0x0a, KEY_AGAIN }, /*XXX KEY_REWIND? */ + { 0x00, KEY_0 }, + { 0x17, KEY_DIGITS }, /*XXX*/ + + /* 0x14 0x10 * + * MENU INFO * + * OSD */ + { 0x14, KEY_MENU }, + { 0x10, KEY_INFO }, + + /* 0x0b * + * Up * + * * + * 0x18 0x16 0x0c * + * Left Ok Right * + * * + * 0x015 * + * Down * + * */ + { 0x0b, KEY_UP }, + { 0x18, KEY_LEFT }, + { 0x16, KEY_OK }, /*XXX KEY_SELECT? KEY_ENTER? */ + { 0x0c, KEY_RIGHT }, + { 0x15, KEY_DOWN }, + + /* 0x11 0x0d * + * TV/AV MODE * + * SOURCE STEREO * + * */ + { 0x11, KEY_TV }, /*XXX*/ + { 0x0d, KEY_MODE }, /*XXX there's no KEY_STEREO */ + + /* 0x0f 0x1b 0x1a * + * AUDIO Vol+ Chan+ * + * TIMESHIFT??? * + * * + * 0x0e 0x1f 0x1e * + * SLEEP Vol- Chan- * + * */ + { 0x0f, KEY_AUDIO }, + { 0x1b, KEY_VOLUMEUP }, + { 0x1a, KEY_CHANNELUP }, + { 0x0e, KEY_TIME }, + { 0x1f, KEY_VOLUMEDOWN }, + { 0x1e, KEY_CHANNELDOWN }, + + /* 0x13 0x19 * + * MUTE SNAPSHOT* + * */ + { 0x13, KEY_MUTE }, + { 0x19, KEY_CAMERA }, + + /* 0x1d unused ? */ +}; + +static struct rc_keymap manli_map = { + .map = { + .scan = manli, + .size = ARRAY_SIZE(manli), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_MANLI, + } +}; + +static int __init init_rc_map_manli(void) +{ + return ir_register_map(&manli_map); +} + +static void __exit exit_rc_map_manli(void) +{ + ir_unregister_map(&manli_map); +} + +module_init(init_rc_map_manli) +module_exit(exit_rc_map_manli) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c b/drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c new file mode 100644 index 000000000000..eb8e42c18ff9 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c @@ -0,0 +1,123 @@ +/* msi-tvanywhere-plus.h - Keytable for msi_tvanywhere_plus Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + Keycodes for remote on the MSI TV@nywhere Plus. The controller IC on the card + is marked "KS003". The controller is I2C at address 0x30, but does not seem + to respond to probes until a read is performed from a valid device. + I don't know why... + + Note: This remote may be of similar or identical design to the + Pixelview remote (?). The raw codes and duplicate button codes + appear to be the same. + + Henry Wong + Some changes to formatting and keycodes by Mark Schultz +*/ + +static struct ir_scancode msi_tvanywhere_plus[] = { + +/* ---- Remote Button Layout ---- + + POWER SOURCE SCAN MUTE + TV/FM 1 2 3 + |> 4 5 6 + <| 7 8 9 + ^^UP 0 + RECALL + vvDN RECORD STOP PLAY + + MINIMIZE ZOOM + + CH+ + VOL- VOL+ + CH- + + SNAPSHOT MTS + + << FUNC >> RESET +*/ + + { 0x01, KEY_1 }, /* 1 */ + { 0x0b, KEY_2 }, /* 2 */ + { 0x1b, KEY_3 }, /* 3 */ + { 0x05, KEY_4 }, /* 4 */ + { 0x09, KEY_5 }, /* 5 */ + { 0x15, KEY_6 }, /* 6 */ + { 0x06, KEY_7 }, /* 7 */ + { 0x0a, KEY_8 }, /* 8 */ + { 0x12, KEY_9 }, /* 9 */ + { 0x02, KEY_0 }, /* 0 */ + { 0x10, KEY_KPPLUS }, /* + */ + { 0x13, KEY_AGAIN }, /* Recall */ + + { 0x1e, KEY_POWER }, /* Power */ + { 0x07, KEY_TUNER }, /* Source */ + { 0x1c, KEY_SEARCH }, /* Scan */ + { 0x18, KEY_MUTE }, /* Mute */ + + { 0x03, KEY_RADIO }, /* TV/FM */ + /* The next four keys are duplicates that appear to send the + same IR code as Ch+, Ch-, >>, and << . The raw code assigned + to them is the actual code + 0x20 - they will never be + detected as such unless some way is discovered to distinguish + these buttons from those that have the same code. */ + { 0x3f, KEY_RIGHT }, /* |> and Ch+ */ + { 0x37, KEY_LEFT }, /* <| and Ch- */ + { 0x2c, KEY_UP }, /* ^^Up and >> */ + { 0x24, KEY_DOWN }, /* vvDn and << */ + + { 0x00, KEY_RECORD }, /* Record */ + { 0x08, KEY_STOP }, /* Stop */ + { 0x11, KEY_PLAY }, /* Play */ + + { 0x0f, KEY_CLOSE }, /* Minimize */ + { 0x19, KEY_ZOOM }, /* Zoom */ + { 0x1a, KEY_CAMERA }, /* Snapshot */ + { 0x0d, KEY_LANGUAGE }, /* MTS */ + + { 0x14, KEY_VOLUMEDOWN }, /* Vol- */ + { 0x16, KEY_VOLUMEUP }, /* Vol+ */ + { 0x17, KEY_CHANNELDOWN }, /* Ch- */ + { 0x1f, KEY_CHANNELUP }, /* Ch+ */ + + { 0x04, KEY_REWIND }, /* << */ + { 0x0e, KEY_MENU }, /* Function */ + { 0x0c, KEY_FASTFORWARD }, /* >> */ + { 0x1d, KEY_RESTART }, /* Reset */ +}; + +static struct rc_keymap msi_tvanywhere_plus_map = { + .map = { + .scan = msi_tvanywhere_plus, + .size = ARRAY_SIZE(msi_tvanywhere_plus), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_MSI_TVANYWHERE_PLUS, + } +}; + +static int __init init_rc_map_msi_tvanywhere_plus(void) +{ + return ir_register_map(&msi_tvanywhere_plus_map); +} + +static void __exit exit_rc_map_msi_tvanywhere_plus(void) +{ + ir_unregister_map(&msi_tvanywhere_plus_map); +} + +module_init(init_rc_map_msi_tvanywhere_plus) +module_exit(exit_rc_map_msi_tvanywhere_plus) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-msi-tvanywhere.c b/drivers/media/IR/keymaps/rc-msi-tvanywhere.c new file mode 100644 index 000000000000..ef411854f067 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-msi-tvanywhere.c @@ -0,0 +1,69 @@ +/* msi-tvanywhere.h - Keytable for msi_tvanywhere Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* MSI TV@nywhere MASTER remote */ + +static struct ir_scancode msi_tvanywhere[] = { + /* Keys 0 to 9 */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0c, KEY_MUTE }, + { 0x0f, KEY_SCREEN }, /* Full Screen */ + { 0x10, KEY_FN }, /* Funtion */ + { 0x11, KEY_TIME }, /* Time shift */ + { 0x12, KEY_POWER }, + { 0x13, KEY_MEDIA }, /* MTS */ + { 0x14, KEY_SLOW }, + { 0x16, KEY_REWIND }, /* backward << */ + { 0x17, KEY_ENTER }, /* Return */ + { 0x18, KEY_FASTFORWARD }, /* forward >> */ + { 0x1a, KEY_CHANNELUP }, + { 0x1b, KEY_VOLUMEUP }, + { 0x1e, KEY_CHANNELDOWN }, + { 0x1f, KEY_VOLUMEDOWN }, +}; + +static struct rc_keymap msi_tvanywhere_map = { + .map = { + .scan = msi_tvanywhere, + .size = ARRAY_SIZE(msi_tvanywhere), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_MSI_TVANYWHERE, + } +}; + +static int __init init_rc_map_msi_tvanywhere(void) +{ + return ir_register_map(&msi_tvanywhere_map); +} + +static void __exit exit_rc_map_msi_tvanywhere(void) +{ + ir_unregister_map(&msi_tvanywhere_map); +} + +module_init(init_rc_map_msi_tvanywhere) +module_exit(exit_rc_map_msi_tvanywhere) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-nebula.c b/drivers/media/IR/keymaps/rc-nebula.c new file mode 100644 index 000000000000..ccc50eb402ec --- /dev/null +++ b/drivers/media/IR/keymaps/rc-nebula.c @@ -0,0 +1,96 @@ +/* nebula.h - Keytable for nebula Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode nebula[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x0a, KEY_TV }, + { 0x0b, KEY_AUX }, + { 0x0c, KEY_DVD }, + { 0x0d, KEY_POWER }, + { 0x0e, KEY_MHP }, /* labelled 'Picture' */ + { 0x0f, KEY_AUDIO }, + { 0x10, KEY_INFO }, + { 0x11, KEY_F13 }, /* 16:9 */ + { 0x12, KEY_F14 }, /* 14:9 */ + { 0x13, KEY_EPG }, + { 0x14, KEY_EXIT }, + { 0x15, KEY_MENU }, + { 0x16, KEY_UP }, + { 0x17, KEY_DOWN }, + { 0x18, KEY_LEFT }, + { 0x19, KEY_RIGHT }, + { 0x1a, KEY_ENTER }, + { 0x1b, KEY_CHANNELUP }, + { 0x1c, KEY_CHANNELDOWN }, + { 0x1d, KEY_VOLUMEUP }, + { 0x1e, KEY_VOLUMEDOWN }, + { 0x1f, KEY_RED }, + { 0x20, KEY_GREEN }, + { 0x21, KEY_YELLOW }, + { 0x22, KEY_BLUE }, + { 0x23, KEY_SUBTITLE }, + { 0x24, KEY_F15 }, /* AD */ + { 0x25, KEY_TEXT }, + { 0x26, KEY_MUTE }, + { 0x27, KEY_REWIND }, + { 0x28, KEY_STOP }, + { 0x29, KEY_PLAY }, + { 0x2a, KEY_FASTFORWARD }, + { 0x2b, KEY_F16 }, /* chapter */ + { 0x2c, KEY_PAUSE }, + { 0x2d, KEY_PLAY }, + { 0x2e, KEY_RECORD }, + { 0x2f, KEY_F17 }, /* picture in picture */ + { 0x30, KEY_KPPLUS }, /* zoom in */ + { 0x31, KEY_KPMINUS }, /* zoom out */ + { 0x32, KEY_F18 }, /* capture */ + { 0x33, KEY_F19 }, /* web */ + { 0x34, KEY_EMAIL }, + { 0x35, KEY_PHONE }, + { 0x36, KEY_PC }, +}; + +static struct rc_keymap nebula_map = { + .map = { + .scan = nebula, + .size = ARRAY_SIZE(nebula), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_NEBULA, + } +}; + +static int __init init_rc_map_nebula(void) +{ + return ir_register_map(&nebula_map); +} + +static void __exit exit_rc_map_nebula(void) +{ + ir_unregister_map(&nebula_map); +} + +module_init(init_rc_map_nebula) +module_exit(exit_rc_map_nebula) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-nec-terratec-cinergy-xs.c b/drivers/media/IR/keymaps/rc-nec-terratec-cinergy-xs.c new file mode 100644 index 000000000000..e1b54d20db60 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-nec-terratec-cinergy-xs.c @@ -0,0 +1,105 @@ +/* nec-terratec-cinergy-xs.h - Keytable for nec_terratec_cinergy_xs Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Terratec Cinergy Hybrid T USB XS FM + Mauro Carvalho Chehab + */ + +static struct ir_scancode nec_terratec_cinergy_xs[] = { + { 0x1441, KEY_HOME}, + { 0x1401, KEY_POWER2}, + + { 0x1442, KEY_MENU}, /* DVD menu */ + { 0x1443, KEY_SUBTITLE}, + { 0x1444, KEY_TEXT}, /* Teletext */ + { 0x1445, KEY_DELETE}, + + { 0x1402, KEY_1}, + { 0x1403, KEY_2}, + { 0x1404, KEY_3}, + { 0x1405, KEY_4}, + { 0x1406, KEY_5}, + { 0x1407, KEY_6}, + { 0x1408, KEY_7}, + { 0x1409, KEY_8}, + { 0x140a, KEY_9}, + { 0x140c, KEY_0}, + + { 0x140b, KEY_TUNER}, /* AV */ + { 0x140d, KEY_MODE}, /* A.B */ + + { 0x1446, KEY_TV}, + { 0x1447, KEY_DVD}, + { 0x1449, KEY_VIDEO}, + { 0x144a, KEY_RADIO}, /* Music */ + { 0x144b, KEY_CAMERA}, /* PIC */ + + { 0x1410, KEY_UP}, + { 0x1411, KEY_LEFT}, + { 0x1412, KEY_OK}, + { 0x1413, KEY_RIGHT}, + { 0x1414, KEY_DOWN}, + + { 0x140f, KEY_EPG}, + { 0x1416, KEY_INFO}, + { 0x144d, KEY_BACKSPACE}, + + { 0x141c, KEY_VOLUMEUP}, + { 0x141e, KEY_VOLUMEDOWN}, + + { 0x144c, KEY_PLAY}, + { 0x141d, KEY_MUTE}, + + { 0x141b, KEY_CHANNELUP}, + { 0x141f, KEY_CHANNELDOWN}, + + { 0x1417, KEY_RED}, + { 0x1418, KEY_GREEN}, + { 0x1419, KEY_YELLOW}, + { 0x141a, KEY_BLUE}, + + { 0x1458, KEY_RECORD}, + { 0x1448, KEY_STOP}, + { 0x1440, KEY_PAUSE}, + + { 0x1454, KEY_LAST}, + { 0x144e, KEY_REWIND}, + { 0x144f, KEY_FASTFORWARD}, + { 0x145c, KEY_NEXT}, +}; + +static struct rc_keymap nec_terratec_cinergy_xs_map = { + .map = { + .scan = nec_terratec_cinergy_xs, + .size = ARRAY_SIZE(nec_terratec_cinergy_xs), + .ir_type = IR_TYPE_NEC, + .name = RC_MAP_NEC_TERRATEC_CINERGY_XS, + } +}; + +static int __init init_rc_map_nec_terratec_cinergy_xs(void) +{ + return ir_register_map(&nec_terratec_cinergy_xs_map); +} + +static void __exit exit_rc_map_nec_terratec_cinergy_xs(void) +{ + ir_unregister_map(&nec_terratec_cinergy_xs_map); +} + +module_init(init_rc_map_nec_terratec_cinergy_xs) +module_exit(exit_rc_map_nec_terratec_cinergy_xs) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-norwood.c b/drivers/media/IR/keymaps/rc-norwood.c new file mode 100644 index 000000000000..e5849a6b3f05 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-norwood.c @@ -0,0 +1,85 @@ +/* norwood.h - Keytable for norwood Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Norwood Micro (non-Pro) TV Tuner + By Peter Naulls + Key comments are the functions given in the manual */ + +static struct ir_scancode norwood[] = { + /* 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 */ +}; + +static struct rc_keymap norwood_map = { + .map = { + .scan = norwood, + .size = ARRAY_SIZE(norwood), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_NORWOOD, + } +}; + +static int __init init_rc_map_norwood(void) +{ + return ir_register_map(&norwood_map); +} + +static void __exit exit_rc_map_norwood(void) +{ + ir_unregister_map(&norwood_map); +} + +module_init(init_rc_map_norwood) +module_exit(exit_rc_map_norwood) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-npgtech.c b/drivers/media/IR/keymaps/rc-npgtech.c new file mode 100644 index 000000000000..b9ece1e90296 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-npgtech.c @@ -0,0 +1,80 @@ +/* npgtech.h - Keytable for npgtech Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode npgtech[] = { + { 0x1d, KEY_SWITCHVIDEOMODE }, /* switch inputs */ + { 0x2a, KEY_FRONT }, + + { 0x3e, KEY_1 }, + { 0x02, KEY_2 }, + { 0x06, KEY_3 }, + { 0x0a, KEY_4 }, + { 0x0e, KEY_5 }, + { 0x12, KEY_6 }, + { 0x16, KEY_7 }, + { 0x1a, KEY_8 }, + { 0x1e, KEY_9 }, + { 0x3a, KEY_0 }, + { 0x22, KEY_NUMLOCK }, /* -/-- */ + { 0x20, KEY_REFRESH }, + + { 0x03, KEY_BRIGHTNESSDOWN }, + { 0x28, KEY_AUDIO }, + { 0x3c, KEY_CHANNELUP }, + { 0x3f, KEY_VOLUMEDOWN }, + { 0x2e, KEY_MUTE }, + { 0x3b, KEY_VOLUMEUP }, + { 0x00, KEY_CHANNELDOWN }, + { 0x07, KEY_BRIGHTNESSUP }, + { 0x2c, KEY_TEXT }, + + { 0x37, KEY_RECORD }, + { 0x17, KEY_PLAY }, + { 0x13, KEY_PAUSE }, + { 0x26, KEY_STOP }, + { 0x18, KEY_FASTFORWARD }, + { 0x14, KEY_REWIND }, + { 0x33, KEY_ZOOM }, + { 0x32, KEY_KEYBOARD }, + { 0x30, KEY_GOTO }, /* Pointing arrow */ + { 0x36, KEY_MACRO }, /* Maximize/Minimize (yellow) */ + { 0x0b, KEY_RADIO }, + { 0x10, KEY_POWER }, + +}; + +static struct rc_keymap npgtech_map = { + .map = { + .scan = npgtech, + .size = ARRAY_SIZE(npgtech), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_NPGTECH, + } +}; + +static int __init init_rc_map_npgtech(void) +{ + return ir_register_map(&npgtech_map); +} + +static void __exit exit_rc_map_npgtech(void) +{ + ir_unregister_map(&npgtech_map); +} + +module_init(init_rc_map_npgtech) +module_exit(exit_rc_map_npgtech) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-pctv-sedna.c b/drivers/media/IR/keymaps/rc-pctv-sedna.c new file mode 100644 index 000000000000..4129bb44a25b --- /dev/null +++ b/drivers/media/IR/keymaps/rc-pctv-sedna.c @@ -0,0 +1,80 @@ +/* pctv-sedna.h - Keytable for pctv_sedna Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Mapping for the 28 key remote control as seen at + http://www.sednacomputer.com/photo/cardbus-tv.jpg + Pavel Mihaylov + Also for the remote bundled with Kozumi KTV-01C card */ + +static struct ir_scancode pctv_sedna[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0a, KEY_AGAIN }, /* Recall */ + { 0x0b, KEY_CHANNELUP }, + { 0x0c, KEY_VOLUMEUP }, + { 0x0d, KEY_MODE }, /* Stereo */ + { 0x0e, KEY_STOP }, + { 0x0f, KEY_PREVIOUSSONG }, + { 0x10, KEY_ZOOM }, + { 0x11, KEY_TUNER }, /* Source */ + { 0x12, KEY_POWER }, + { 0x13, KEY_MUTE }, + { 0x15, KEY_CHANNELDOWN }, + { 0x18, KEY_VOLUMEDOWN }, + { 0x19, KEY_CAMERA }, /* Snapshot */ + { 0x1a, KEY_NEXTSONG }, + { 0x1b, KEY_TIME }, /* Time Shift */ + { 0x1c, KEY_RADIO }, /* FM Radio */ + { 0x1d, KEY_RECORD }, + { 0x1e, KEY_PAUSE }, + /* additional codes for Kozumi's remote */ + { 0x14, KEY_INFO }, /* OSD */ + { 0x16, KEY_OK }, /* OK */ + { 0x17, KEY_DIGITS }, /* Plus */ + { 0x1f, KEY_PLAY }, /* Play */ +}; + +static struct rc_keymap pctv_sedna_map = { + .map = { + .scan = pctv_sedna, + .size = ARRAY_SIZE(pctv_sedna), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_PCTV_SEDNA, + } +}; + +static int __init init_rc_map_pctv_sedna(void) +{ + return ir_register_map(&pctv_sedna_map); +} + +static void __exit exit_rc_map_pctv_sedna(void) +{ + ir_unregister_map(&pctv_sedna_map); +} + +module_init(init_rc_map_pctv_sedna) +module_exit(exit_rc_map_pctv_sedna) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-pinnacle-color.c b/drivers/media/IR/keymaps/rc-pinnacle-color.c new file mode 100644 index 000000000000..326e023ce126 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-pinnacle-color.c @@ -0,0 +1,94 @@ +/* pinnacle-color.h - Keytable for pinnacle_color Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode pinnacle_color[] = { + { 0x59, KEY_MUTE }, + { 0x4a, KEY_POWER }, + + { 0x18, KEY_TEXT }, + { 0x26, KEY_TV }, + { 0x3d, KEY_PRINT }, + + { 0x48, KEY_RED }, + { 0x04, KEY_GREEN }, + { 0x11, KEY_YELLOW }, + { 0x00, KEY_BLUE }, + + { 0x2d, KEY_VOLUMEUP }, + { 0x1e, KEY_VOLUMEDOWN }, + + { 0x49, KEY_MENU }, + + { 0x16, KEY_CHANNELUP }, + { 0x17, KEY_CHANNELDOWN }, + + { 0x20, KEY_UP }, + { 0x21, KEY_DOWN }, + { 0x22, KEY_LEFT }, + { 0x23, KEY_RIGHT }, + { 0x0d, KEY_SELECT }, + + { 0x08, KEY_BACK }, + { 0x07, KEY_REFRESH }, + + { 0x2f, KEY_ZOOM }, + { 0x29, KEY_RECORD }, + + { 0x4b, KEY_PAUSE }, + { 0x4d, KEY_REWIND }, + { 0x2e, KEY_PLAY }, + { 0x4e, KEY_FORWARD }, + { 0x53, KEY_PREVIOUS }, + { 0x4c, KEY_STOP }, + { 0x54, KEY_NEXT }, + + { 0x69, KEY_0 }, + { 0x6a, KEY_1 }, + { 0x6b, KEY_2 }, + { 0x6c, KEY_3 }, + { 0x6d, KEY_4 }, + { 0x6e, KEY_5 }, + { 0x6f, KEY_6 }, + { 0x70, KEY_7 }, + { 0x71, KEY_8 }, + { 0x72, KEY_9 }, + + { 0x74, KEY_CHANNEL }, + { 0x0a, KEY_BACKSPACE }, +}; + +static struct rc_keymap pinnacle_color_map = { + .map = { + .scan = pinnacle_color, + .size = ARRAY_SIZE(pinnacle_color), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_PINNACLE_COLOR, + } +}; + +static int __init init_rc_map_pinnacle_color(void) +{ + return ir_register_map(&pinnacle_color_map); +} + +static void __exit exit_rc_map_pinnacle_color(void) +{ + ir_unregister_map(&pinnacle_color_map); +} + +module_init(init_rc_map_pinnacle_color) +module_exit(exit_rc_map_pinnacle_color) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-pinnacle-grey.c b/drivers/media/IR/keymaps/rc-pinnacle-grey.c new file mode 100644 index 000000000000..14cb772515c6 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-pinnacle-grey.c @@ -0,0 +1,89 @@ +/* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode pinnacle_grey[] = { + { 0x3a, KEY_0 }, + { 0x31, KEY_1 }, + { 0x32, KEY_2 }, + { 0x33, KEY_3 }, + { 0x34, KEY_4 }, + { 0x35, KEY_5 }, + { 0x36, KEY_6 }, + { 0x37, KEY_7 }, + { 0x38, KEY_8 }, + { 0x39, KEY_9 }, + + { 0x2f, KEY_POWER }, + + { 0x2e, KEY_P }, + { 0x1f, KEY_L }, + { 0x2b, KEY_I }, + + { 0x2d, KEY_SCREEN }, + { 0x1e, KEY_ZOOM }, + { 0x1b, KEY_VOLUMEUP }, + { 0x0f, KEY_VOLUMEDOWN }, + { 0x17, KEY_CHANNELUP }, + { 0x1c, KEY_CHANNELDOWN }, + { 0x25, KEY_INFO }, + + { 0x3c, KEY_MUTE }, + + { 0x3d, KEY_LEFT }, + { 0x3b, KEY_RIGHT }, + + { 0x3f, KEY_UP }, + { 0x3e, KEY_DOWN }, + { 0x1a, KEY_ENTER }, + + { 0x1d, KEY_MENU }, + { 0x19, KEY_AGAIN }, + { 0x16, KEY_PREVIOUSSONG }, + { 0x13, KEY_NEXTSONG }, + { 0x15, KEY_PAUSE }, + { 0x0e, KEY_REWIND }, + { 0x0d, KEY_PLAY }, + { 0x0b, KEY_STOP }, + { 0x07, KEY_FORWARD }, + { 0x27, KEY_RECORD }, + { 0x26, KEY_TUNER }, + { 0x29, KEY_TEXT }, + { 0x2a, KEY_MEDIA }, + { 0x18, KEY_EPG }, +}; + +static struct rc_keymap pinnacle_grey_map = { + .map = { + .scan = pinnacle_grey, + .size = ARRAY_SIZE(pinnacle_grey), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_PINNACLE_GREY, + } +}; + +static int __init init_rc_map_pinnacle_grey(void) +{ + return ir_register_map(&pinnacle_grey_map); +} + +static void __exit exit_rc_map_pinnacle_grey(void) +{ + ir_unregister_map(&pinnacle_grey_map); +} + +module_init(init_rc_map_pinnacle_grey) +module_exit(exit_rc_map_pinnacle_grey) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c b/drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c new file mode 100644 index 000000000000..835bf4ef8de7 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c @@ -0,0 +1,73 @@ +/* pinnacle-pctv-hd.h - Keytable for pinnacle_pctv_hd Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Pinnacle PCTV HD 800i mini remote */ + +static struct ir_scancode pinnacle_pctv_hd[] = { + + { 0x0f, KEY_1 }, + { 0x15, KEY_2 }, + { 0x10, KEY_3 }, + { 0x18, KEY_4 }, + { 0x1b, KEY_5 }, + { 0x1e, KEY_6 }, + { 0x11, KEY_7 }, + { 0x21, KEY_8 }, + { 0x12, KEY_9 }, + { 0x27, KEY_0 }, + + { 0x24, KEY_ZOOM }, + { 0x2a, KEY_SUBTITLE }, + + { 0x00, KEY_MUTE }, + { 0x01, KEY_ENTER }, /* Pinnacle Logo */ + { 0x39, KEY_POWER }, + + { 0x03, KEY_VOLUMEUP }, + { 0x09, KEY_VOLUMEDOWN }, + { 0x06, KEY_CHANNELUP }, + { 0x0c, KEY_CHANNELDOWN }, + + { 0x2d, KEY_REWIND }, + { 0x30, KEY_PLAYPAUSE }, + { 0x33, KEY_FASTFORWARD }, + { 0x3c, KEY_STOP }, + { 0x36, KEY_RECORD }, + { 0x3f, KEY_EPG }, /* Labeled "?" */ +}; + +static struct rc_keymap pinnacle_pctv_hd_map = { + .map = { + .scan = pinnacle_pctv_hd, + .size = ARRAY_SIZE(pinnacle_pctv_hd), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_PINNACLE_PCTV_HD, + } +}; + +static int __init init_rc_map_pinnacle_pctv_hd(void) +{ + return ir_register_map(&pinnacle_pctv_hd_map); +} + +static void __exit exit_rc_map_pinnacle_pctv_hd(void) +{ + ir_unregister_map(&pinnacle_pctv_hd_map); +} + +module_init(init_rc_map_pinnacle_pctv_hd) +module_exit(exit_rc_map_pinnacle_pctv_hd) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-pixelview-new.c b/drivers/media/IR/keymaps/rc-pixelview-new.c new file mode 100644 index 000000000000..7bbbbf5735e6 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-pixelview-new.c @@ -0,0 +1,83 @@ +/* pixelview-new.h - Keytable for pixelview_new Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + Mauro Carvalho Chehab + present on PV MPEG 8000GT + */ + +static struct ir_scancode pixelview_new[] = { + { 0x3c, KEY_TIME }, /* Timeshift */ + { 0x12, KEY_POWER }, + + { 0x3d, KEY_1 }, + { 0x38, KEY_2 }, + { 0x18, KEY_3 }, + { 0x35, KEY_4 }, + { 0x39, KEY_5 }, + { 0x15, KEY_6 }, + { 0x36, KEY_7 }, + { 0x3a, KEY_8 }, + { 0x1e, KEY_9 }, + { 0x3e, KEY_0 }, + + { 0x1c, KEY_AGAIN }, /* LOOP */ + { 0x3f, KEY_MEDIA }, /* Source */ + { 0x1f, KEY_LAST }, /* +100 */ + { 0x1b, KEY_MUTE }, + + { 0x17, KEY_CHANNELDOWN }, + { 0x16, KEY_CHANNELUP }, + { 0x10, KEY_VOLUMEUP }, + { 0x14, KEY_VOLUMEDOWN }, + { 0x13, KEY_ZOOM }, + + { 0x19, KEY_CAMERA }, /* SNAPSHOT */ + { 0x1a, KEY_SEARCH }, /* scan */ + + { 0x37, KEY_REWIND }, /* << */ + { 0x32, KEY_RECORD }, /* o (red) */ + { 0x33, KEY_FORWARD }, /* >> */ + { 0x11, KEY_STOP }, /* square */ + { 0x3b, KEY_PLAY }, /* > */ + { 0x30, KEY_PLAYPAUSE }, /* || */ + + { 0x31, KEY_TV }, + { 0x34, KEY_RADIO }, +}; + +static struct rc_keymap pixelview_new_map = { + .map = { + .scan = pixelview_new, + .size = ARRAY_SIZE(pixelview_new), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_PIXELVIEW_NEW, + } +}; + +static int __init init_rc_map_pixelview_new(void) +{ + return ir_register_map(&pixelview_new_map); +} + +static void __exit exit_rc_map_pixelview_new(void) +{ + ir_unregister_map(&pixelview_new_map); +} + +module_init(init_rc_map_pixelview_new) +module_exit(exit_rc_map_pixelview_new) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-pixelview.c b/drivers/media/IR/keymaps/rc-pixelview.c new file mode 100644 index 000000000000..82ff12e182a0 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-pixelview.c @@ -0,0 +1,82 @@ +/* pixelview.h - Keytable for pixelview Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode pixelview[] = { + + { 0x1e, KEY_POWER }, /* power */ + { 0x07, KEY_MEDIA }, /* source */ + { 0x1c, KEY_SEARCH }, /* scan */ + + + { 0x03, KEY_TUNER }, /* TV/FM */ + + { 0x00, KEY_RECORD }, + { 0x08, KEY_STOP }, + { 0x11, KEY_PLAY }, + + { 0x1a, KEY_PLAYPAUSE }, /* freeze */ + { 0x19, KEY_ZOOM }, /* zoom */ + { 0x0f, KEY_TEXT }, /* min */ + + { 0x01, KEY_1 }, + { 0x0b, KEY_2 }, + { 0x1b, KEY_3 }, + { 0x05, KEY_4 }, + { 0x09, KEY_5 }, + { 0x15, KEY_6 }, + { 0x06, KEY_7 }, + { 0x0a, KEY_8 }, + { 0x12, KEY_9 }, + { 0x02, KEY_0 }, + { 0x10, KEY_LAST }, /* +100 */ + { 0x13, KEY_LIST }, /* recall */ + + { 0x1f, KEY_CHANNELUP }, /* chn down */ + { 0x17, KEY_CHANNELDOWN }, /* chn up */ + { 0x16, KEY_VOLUMEUP }, /* vol down */ + { 0x14, KEY_VOLUMEDOWN }, /* vol up */ + + { 0x04, KEY_KPMINUS }, /* <<< */ + { 0x0e, KEY_SETUP }, /* function */ + { 0x0c, KEY_KPPLUS }, /* >>> */ + + { 0x0d, KEY_GOTO }, /* mts */ + { 0x1d, KEY_REFRESH }, /* reset */ + { 0x18, KEY_MUTE }, /* mute/unmute */ +}; + +static struct rc_keymap pixelview_map = { + .map = { + .scan = pixelview, + .size = ARRAY_SIZE(pixelview), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_PIXELVIEW, + } +}; + +static int __init init_rc_map_pixelview(void) +{ + return ir_register_map(&pixelview_map); +} + +static void __exit exit_rc_map_pixelview(void) +{ + ir_unregister_map(&pixelview_map); +} + +module_init(init_rc_map_pixelview) +module_exit(exit_rc_map_pixelview) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-powercolor-real-angel.c b/drivers/media/IR/keymaps/rc-powercolor-real-angel.c new file mode 100644 index 000000000000..7cef8190a224 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-powercolor-real-angel.c @@ -0,0 +1,81 @@ +/* powercolor-real-angel.h - Keytable for powercolor_real_angel Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + * Remote control for Powercolor Real Angel 330 + * Daniel Fraga + */ + +static struct ir_scancode powercolor_real_angel[] = { + { 0x38, KEY_SWITCHVIDEOMODE }, /* switch inputs */ + { 0x0c, KEY_MEDIA }, /* Turn ON/OFF App */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + { 0x0a, KEY_DIGITS }, /* single, double, tripple digit */ + { 0x29, KEY_PREVIOUS }, /* previous channel */ + { 0x12, KEY_BRIGHTNESSUP }, + { 0x13, KEY_BRIGHTNESSDOWN }, + { 0x2b, KEY_MODE }, /* stereo/mono */ + { 0x2c, KEY_TEXT }, /* teletext */ + { 0x20, KEY_CHANNELUP }, /* channel up */ + { 0x21, KEY_CHANNELDOWN }, /* channel down */ + { 0x10, KEY_VOLUMEUP }, /* volume up */ + { 0x11, KEY_VOLUMEDOWN }, /* volume down */ + { 0x0d, KEY_MUTE }, + { 0x1f, KEY_RECORD }, + { 0x17, KEY_PLAY }, + { 0x16, KEY_PAUSE }, + { 0x0b, KEY_STOP }, + { 0x27, KEY_FASTFORWARD }, + { 0x26, KEY_REWIND }, + { 0x1e, KEY_SEARCH }, /* autoscan */ + { 0x0e, KEY_CAMERA }, /* snapshot */ + { 0x2d, KEY_SETUP }, + { 0x0f, KEY_SCREEN }, /* full screen */ + { 0x14, KEY_RADIO }, /* FM radio */ + { 0x25, KEY_POWER }, /* power */ +}; + +static struct rc_keymap powercolor_real_angel_map = { + .map = { + .scan = powercolor_real_angel, + .size = ARRAY_SIZE(powercolor_real_angel), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_POWERCOLOR_REAL_ANGEL, + } +}; + +static int __init init_rc_map_powercolor_real_angel(void) +{ + return ir_register_map(&powercolor_real_angel_map); +} + +static void __exit exit_rc_map_powercolor_real_angel(void) +{ + ir_unregister_map(&powercolor_real_angel_map); +} + +module_init(init_rc_map_powercolor_real_angel) +module_exit(exit_rc_map_powercolor_real_angel) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-proteus-2309.c b/drivers/media/IR/keymaps/rc-proteus-2309.c new file mode 100644 index 000000000000..22e92d39dee5 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-proteus-2309.c @@ -0,0 +1,69 @@ +/* proteus-2309.h - Keytable for proteus_2309 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Michal Majchrowicz */ + +static struct ir_scancode proteus_2309[] = { + /* numeric */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x5c, KEY_POWER }, /* power */ + { 0x20, KEY_ZOOM }, /* full screen */ + { 0x0f, KEY_BACKSPACE }, /* recall */ + { 0x1b, KEY_ENTER }, /* mute */ + { 0x41, KEY_RECORD }, /* record */ + { 0x43, KEY_STOP }, /* stop */ + { 0x16, KEY_S }, + { 0x1a, KEY_POWER2 }, /* off */ + { 0x2e, KEY_RED }, + { 0x1f, KEY_CHANNELDOWN }, /* channel - */ + { 0x1c, KEY_CHANNELUP }, /* channel + */ + { 0x10, KEY_VOLUMEDOWN }, /* volume - */ + { 0x1e, KEY_VOLUMEUP }, /* volume + */ + { 0x14, KEY_F1 }, +}; + +static struct rc_keymap proteus_2309_map = { + .map = { + .scan = proteus_2309, + .size = ARRAY_SIZE(proteus_2309), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_PROTEUS_2309, + } +}; + +static int __init init_rc_map_proteus_2309(void) +{ + return ir_register_map(&proteus_2309_map); +} + +static void __exit exit_rc_map_proteus_2309(void) +{ + ir_unregister_map(&proteus_2309_map); +} + +module_init(init_rc_map_proteus_2309) +module_exit(exit_rc_map_proteus_2309) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-purpletv.c b/drivers/media/IR/keymaps/rc-purpletv.c new file mode 100644 index 000000000000..4e20fc2269f7 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-purpletv.c @@ -0,0 +1,81 @@ +/* purpletv.h - Keytable for purpletv Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode purpletv[] = { + { 0x03, KEY_POWER }, + { 0x6f, KEY_MUTE }, + { 0x10, KEY_BACKSPACE }, /* Recall */ + + { 0x11, KEY_0 }, + { 0x04, KEY_1 }, + { 0x05, KEY_2 }, + { 0x06, KEY_3 }, + { 0x08, KEY_4 }, + { 0x09, KEY_5 }, + { 0x0a, KEY_6 }, + { 0x0c, KEY_7 }, + { 0x0d, KEY_8 }, + { 0x0e, KEY_9 }, + { 0x12, KEY_DOT }, /* 100+ */ + + { 0x07, KEY_VOLUMEUP }, + { 0x0b, KEY_VOLUMEDOWN }, + { 0x1a, KEY_KPPLUS }, + { 0x18, KEY_KPMINUS }, + { 0x15, KEY_UP }, + { 0x1d, KEY_DOWN }, + { 0x0f, KEY_CHANNELUP }, + { 0x13, KEY_CHANNELDOWN }, + { 0x48, KEY_ZOOM }, + + { 0x1b, KEY_VIDEO }, /* Video source */ + { 0x1f, KEY_CAMERA }, /* Snapshot */ + { 0x49, KEY_LANGUAGE }, /* MTS Select */ + { 0x19, KEY_SEARCH }, /* Auto Scan */ + + { 0x4b, KEY_RECORD }, + { 0x46, KEY_PLAY }, + { 0x45, KEY_PAUSE }, /* Pause */ + { 0x44, KEY_STOP }, + { 0x43, KEY_TIME }, /* Time Shift */ + { 0x17, KEY_CHANNEL }, /* SURF CH */ + { 0x40, KEY_FORWARD }, /* Forward ? */ + { 0x42, KEY_REWIND }, /* Backward ? */ + +}; + +static struct rc_keymap purpletv_map = { + .map = { + .scan = purpletv, + .size = ARRAY_SIZE(purpletv), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_PURPLETV, + } +}; + +static int __init init_rc_map_purpletv(void) +{ + return ir_register_map(&purpletv_map); +} + +static void __exit exit_rc_map_purpletv(void) +{ + ir_unregister_map(&purpletv_map); +} + +module_init(init_rc_map_purpletv) +module_exit(exit_rc_map_purpletv) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-pv951.c b/drivers/media/IR/keymaps/rc-pv951.c new file mode 100644 index 000000000000..36679e706cf3 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-pv951.c @@ -0,0 +1,78 @@ +/* pv951.h - Keytable for pv951 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Mark Phalan */ + +static struct ir_scancode pv951[] = { + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x12, KEY_POWER }, + { 0x10, KEY_MUTE }, + { 0x1f, KEY_VOLUMEDOWN }, + { 0x1b, KEY_VOLUMEUP }, + { 0x1a, KEY_CHANNELUP }, + { 0x1e, KEY_CHANNELDOWN }, + { 0x0e, KEY_PAGEUP }, + { 0x1d, KEY_PAGEDOWN }, + { 0x13, KEY_SOUND }, + + { 0x18, KEY_KPPLUSMINUS }, /* CH +/- */ + { 0x16, KEY_SUBTITLE }, /* CC */ + { 0x0d, KEY_TEXT }, /* TTX */ + { 0x0b, KEY_TV }, /* AIR/CBL */ + { 0x11, KEY_PC }, /* PC/TV */ + { 0x17, KEY_OK }, /* CH RTN */ + { 0x19, KEY_MODE }, /* FUNC */ + { 0x0c, KEY_SEARCH }, /* AUTOSCAN */ + + /* Not sure what to do with these ones! */ + { 0x0f, KEY_SELECT }, /* SOURCE */ + { 0x0a, KEY_KPPLUS }, /* +100 */ + { 0x14, KEY_EQUAL }, /* SYNC */ + { 0x1c, KEY_MEDIA }, /* PC/TV */ +}; + +static struct rc_keymap pv951_map = { + .map = { + .scan = pv951, + .size = ARRAY_SIZE(pv951), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_PV951, + } +}; + +static int __init init_rc_map_pv951(void) +{ + return ir_register_map(&pv951_map); +} + +static void __exit exit_rc_map_pv951(void) +{ + ir_unregister_map(&pv951_map); +} + +module_init(init_rc_map_pv951) +module_exit(exit_rc_map_pv951) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c b/drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c new file mode 100644 index 000000000000..cc6b8f548747 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c @@ -0,0 +1,103 @@ +/* rc5-hauppauge-new.h - Keytable for rc5_hauppauge_new Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + * Hauppauge:the newer, gray remotes (seems there are multiple + * slightly different versions), shipped with cx88+ivtv cards. + * + * This table contains the complete RC5 code, instead of just the data part + */ + +static struct ir_scancode rc5_hauppauge_new[] = { + /* Keys 0 to 9 */ + { 0x1e00, KEY_0 }, + { 0x1e01, KEY_1 }, + { 0x1e02, KEY_2 }, + { 0x1e03, KEY_3 }, + { 0x1e04, KEY_4 }, + { 0x1e05, KEY_5 }, + { 0x1e06, KEY_6 }, + { 0x1e07, KEY_7 }, + { 0x1e08, KEY_8 }, + { 0x1e09, KEY_9 }, + + { 0x1e0a, KEY_TEXT }, /* keypad asterisk as well */ + { 0x1e0b, KEY_RED }, /* red button */ + { 0x1e0c, KEY_RADIO }, + { 0x1e0d, KEY_MENU }, + { 0x1e0e, KEY_SUBTITLE }, /* also the # key */ + { 0x1e0f, KEY_MUTE }, + { 0x1e10, KEY_VOLUMEUP }, + { 0x1e11, KEY_VOLUMEDOWN }, + { 0x1e12, KEY_PREVIOUS }, /* previous channel */ + { 0x1e14, KEY_UP }, + { 0x1e15, KEY_DOWN }, + { 0x1e16, KEY_LEFT }, + { 0x1e17, KEY_RIGHT }, + { 0x1e18, KEY_VIDEO }, /* Videos */ + { 0x1e19, KEY_AUDIO }, /* Music */ + /* 0x1e1a: Pictures - presume this means + "Multimedia Home Platform" - + no "PICTURES" key in input.h + */ + { 0x1e1a, KEY_MHP }, + + { 0x1e1b, KEY_EPG }, /* Guide */ + { 0x1e1c, KEY_TV }, + { 0x1e1e, KEY_NEXTSONG }, /* skip >| */ + { 0x1e1f, KEY_EXIT }, /* back/exit */ + { 0x1e20, KEY_CHANNELUP }, /* channel / program + */ + { 0x1e21, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x1e22, KEY_CHANNEL }, /* source (old black remote) */ + { 0x1e24, KEY_PREVIOUSSONG }, /* replay |< */ + { 0x1e25, KEY_ENTER }, /* OK */ + { 0x1e26, KEY_SLEEP }, /* minimize (old black remote) */ + { 0x1e29, KEY_BLUE }, /* blue key */ + { 0x1e2e, KEY_GREEN }, /* green button */ + { 0x1e30, KEY_PAUSE }, /* pause */ + { 0x1e32, KEY_REWIND }, /* backward << */ + { 0x1e34, KEY_FASTFORWARD }, /* forward >> */ + { 0x1e35, KEY_PLAY }, + { 0x1e36, KEY_STOP }, + { 0x1e37, KEY_RECORD }, /* recording */ + { 0x1e38, KEY_YELLOW }, /* yellow key */ + { 0x1e3b, KEY_SELECT }, /* top right button */ + { 0x1e3c, KEY_ZOOM }, /* full */ + { 0x1e3d, KEY_POWER }, /* system power (green button) */ +}; + +static struct rc_keymap rc5_hauppauge_new_map = { + .map = { + .scan = rc5_hauppauge_new, + .size = ARRAY_SIZE(rc5_hauppauge_new), + .ir_type = IR_TYPE_RC5, + .name = RC_MAP_RC5_HAUPPAUGE_NEW, + } +}; + +static int __init init_rc_map_rc5_hauppauge_new(void) +{ + return ir_register_map(&rc5_hauppauge_new_map); +} + +static void __exit exit_rc_map_rc5_hauppauge_new(void) +{ + ir_unregister_map(&rc5_hauppauge_new_map); +} + +module_init(init_rc_map_rc5_hauppauge_new) +module_exit(exit_rc_map_rc5_hauppauge_new) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-rc5-tv.c b/drivers/media/IR/keymaps/rc-rc5-tv.c new file mode 100644 index 000000000000..73cce2f8ddfb --- /dev/null +++ b/drivers/media/IR/keymaps/rc-rc5-tv.c @@ -0,0 +1,81 @@ +/* rc5-tv.h - Keytable for rc5_tv Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* generic RC5 keytable */ +/* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ +/* used by old (black) Hauppauge remotes */ + +static struct ir_scancode rc5_tv[] = { + /* Keys 0 to 9 */ + { 0x00, KEY_0 }, + { 0x01, KEY_1 }, + { 0x02, KEY_2 }, + { 0x03, KEY_3 }, + { 0x04, KEY_4 }, + { 0x05, KEY_5 }, + { 0x06, KEY_6 }, + { 0x07, KEY_7 }, + { 0x08, KEY_8 }, + { 0x09, KEY_9 }, + + { 0x0b, KEY_CHANNEL }, /* channel / program (japan: 11) */ + { 0x0c, KEY_POWER }, /* standby */ + { 0x0d, KEY_MUTE }, /* mute / demute */ + { 0x0f, KEY_TV }, /* display */ + { 0x10, KEY_VOLUMEUP }, + { 0x11, KEY_VOLUMEDOWN }, + { 0x12, KEY_BRIGHTNESSUP }, + { 0x13, KEY_BRIGHTNESSDOWN }, + { 0x1e, KEY_SEARCH }, /* search + */ + { 0x20, KEY_CHANNELUP }, /* channel / program + */ + { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ + { 0x22, KEY_CHANNEL }, /* alt / channel */ + { 0x23, KEY_LANGUAGE }, /* 1st / 2nd language */ + { 0x26, KEY_SLEEP }, /* sleeptimer */ + { 0x2e, KEY_MENU }, /* 2nd controls (USA: menu) */ + { 0x30, KEY_PAUSE }, + { 0x32, KEY_REWIND }, + { 0x33, KEY_GOTO }, + { 0x35, KEY_PLAY }, + { 0x36, KEY_STOP }, + { 0x37, KEY_RECORD }, /* recording */ + { 0x3c, KEY_TEXT }, /* teletext submode (Japan: 12) */ + { 0x3d, KEY_SUSPEND }, /* system standby */ + +}; + +static struct rc_keymap rc5_tv_map = { + .map = { + .scan = rc5_tv, + .size = ARRAY_SIZE(rc5_tv), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_RC5_TV, + } +}; + +static int __init init_rc_map_rc5_tv(void) +{ + return ir_register_map(&rc5_tv_map); +} + +static void __exit exit_rc_map_rc5_tv(void) +{ + ir_unregister_map(&rc5_tv_map); +} + +module_init(init_rc_map_rc5_tv) +module_exit(exit_rc_map_rc5_tv) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-real-audio-220-32-keys.c b/drivers/media/IR/keymaps/rc-real-audio-220-32-keys.c new file mode 100644 index 000000000000..ab1a6d2baf72 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-real-audio-220-32-keys.c @@ -0,0 +1,78 @@ +/* real-audio-220-32-keys.h - Keytable for real_audio_220_32_keys Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Zogis Real Audio 220 - 32 keys IR */ + +static struct ir_scancode real_audio_220_32_keys[] = { + { 0x1c, KEY_RADIO}, + { 0x12, KEY_POWER2}, + + { 0x01, KEY_1}, + { 0x02, KEY_2}, + { 0x03, KEY_3}, + { 0x04, KEY_4}, + { 0x05, KEY_5}, + { 0x06, KEY_6}, + { 0x07, KEY_7}, + { 0x08, KEY_8}, + { 0x09, KEY_9}, + { 0x00, KEY_0}, + + { 0x0c, KEY_VOLUMEUP}, + { 0x18, KEY_VOLUMEDOWN}, + { 0x0b, KEY_CHANNELUP}, + { 0x15, KEY_CHANNELDOWN}, + { 0x16, KEY_ENTER}, + + { 0x11, KEY_LIST}, /* Source */ + { 0x0d, KEY_AUDIO}, /* stereo */ + + { 0x0f, KEY_PREVIOUS}, /* Prev */ + { 0x1b, KEY_TIME}, /* Timeshift */ + { 0x1a, KEY_NEXT}, /* Next */ + + { 0x0e, KEY_STOP}, + { 0x1f, KEY_PLAY}, + { 0x1e, KEY_PLAYPAUSE}, /* Pause */ + + { 0x1d, KEY_RECORD}, + { 0x13, KEY_MUTE}, + { 0x19, KEY_CAMERA}, /* Snapshot */ + +}; + +static struct rc_keymap real_audio_220_32_keys_map = { + .map = { + .scan = real_audio_220_32_keys, + .size = ARRAY_SIZE(real_audio_220_32_keys), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_REAL_AUDIO_220_32_KEYS, + } +}; + +static int __init init_rc_map_real_audio_220_32_keys(void) +{ + return ir_register_map(&real_audio_220_32_keys_map); +} + +static void __exit exit_rc_map_real_audio_220_32_keys(void) +{ + ir_unregister_map(&real_audio_220_32_keys_map); +} + +module_init(init_rc_map_real_audio_220_32_keys) +module_exit(exit_rc_map_real_audio_220_32_keys) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-tbs-nec.c b/drivers/media/IR/keymaps/rc-tbs-nec.c new file mode 100644 index 000000000000..3309631e6f80 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-tbs-nec.c @@ -0,0 +1,73 @@ +/* tbs-nec.h - Keytable for tbs_nec Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode tbs_nec[] = { + { 0x04, KEY_POWER2}, /*power*/ + { 0x14, KEY_MUTE}, /*mute*/ + { 0x07, KEY_1}, + { 0x06, KEY_2}, + { 0x05, KEY_3}, + { 0x0b, KEY_4}, + { 0x0a, KEY_5}, + { 0x09, KEY_6}, + { 0x0f, KEY_7}, + { 0x0e, KEY_8}, + { 0x0d, KEY_9}, + { 0x12, KEY_0}, + { 0x16, KEY_CHANNELUP}, /*ch+*/ + { 0x11, KEY_CHANNELDOWN},/*ch-*/ + { 0x13, KEY_VOLUMEUP}, /*vol+*/ + { 0x0c, KEY_VOLUMEDOWN},/*vol-*/ + { 0x03, KEY_RECORD}, /*rec*/ + { 0x18, KEY_PAUSE}, /*pause*/ + { 0x19, KEY_OK}, /*ok*/ + { 0x1a, KEY_CAMERA}, /* snapshot */ + { 0x01, KEY_UP}, + { 0x10, KEY_LEFT}, + { 0x02, KEY_RIGHT}, + { 0x08, KEY_DOWN}, + { 0x15, KEY_FAVORITES}, + { 0x17, KEY_SUBTITLE}, + { 0x1d, KEY_ZOOM}, + { 0x1f, KEY_EXIT}, + { 0x1e, KEY_MENU}, + { 0x1c, KEY_EPG}, + { 0x00, KEY_PREVIOUS}, + { 0x1b, KEY_MODE}, +}; + +static struct rc_keymap tbs_nec_map = { + .map = { + .scan = tbs_nec, + .size = ARRAY_SIZE(tbs_nec), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_TBS_NEC, + } +}; + +static int __init init_rc_map_tbs_nec(void) +{ + return ir_register_map(&tbs_nec_map); +} + +static void __exit exit_rc_map_tbs_nec(void) +{ + ir_unregister_map(&tbs_nec_map); +} + +module_init(init_rc_map_tbs_nec) +module_exit(exit_rc_map_tbs_nec) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c b/drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c new file mode 100644 index 000000000000..5326a0b444c1 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c @@ -0,0 +1,92 @@ +/* terratec-cinergy-xs.h - Keytable for terratec_cinergy_xs Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Terratec Cinergy Hybrid T USB XS + Devin Heitmueller + */ + +static struct ir_scancode terratec_cinergy_xs[] = { + { 0x41, KEY_HOME}, + { 0x01, KEY_POWER}, + { 0x42, KEY_MENU}, + { 0x02, KEY_1}, + { 0x03, KEY_2}, + { 0x04, KEY_3}, + { 0x43, KEY_SUBTITLE}, + { 0x05, KEY_4}, + { 0x06, KEY_5}, + { 0x07, KEY_6}, + { 0x44, KEY_TEXT}, + { 0x08, KEY_7}, + { 0x09, KEY_8}, + { 0x0a, KEY_9}, + { 0x45, KEY_DELETE}, + { 0x0b, KEY_TUNER}, + { 0x0c, KEY_0}, + { 0x0d, KEY_MODE}, + { 0x46, KEY_TV}, + { 0x47, KEY_DVD}, + { 0x49, KEY_VIDEO}, + { 0x4b, KEY_AUX}, + { 0x10, KEY_UP}, + { 0x11, KEY_LEFT}, + { 0x12, KEY_OK}, + { 0x13, KEY_RIGHT}, + { 0x14, KEY_DOWN}, + { 0x0f, KEY_EPG}, + { 0x16, KEY_INFO}, + { 0x4d, KEY_BACKSPACE}, + { 0x1c, KEY_VOLUMEUP}, + { 0x4c, KEY_PLAY}, + { 0x1b, KEY_CHANNELUP}, + { 0x1e, KEY_VOLUMEDOWN}, + { 0x1d, KEY_MUTE}, + { 0x1f, KEY_CHANNELDOWN}, + { 0x17, KEY_RED}, + { 0x18, KEY_GREEN}, + { 0x19, KEY_YELLOW}, + { 0x1a, KEY_BLUE}, + { 0x58, KEY_RECORD}, + { 0x48, KEY_STOP}, + { 0x40, KEY_PAUSE}, + { 0x54, KEY_LAST}, + { 0x4e, KEY_REWIND}, + { 0x4f, KEY_FASTFORWARD}, + { 0x5c, KEY_NEXT}, +}; + +static struct rc_keymap terratec_cinergy_xs_map = { + .map = { + .scan = terratec_cinergy_xs, + .size = ARRAY_SIZE(terratec_cinergy_xs), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_TERRATEC_CINERGY_XS, + } +}; + +static int __init init_rc_map_terratec_cinergy_xs(void) +{ + return ir_register_map(&terratec_cinergy_xs_map); +} + +static void __exit exit_rc_map_terratec_cinergy_xs(void) +{ + ir_unregister_map(&terratec_cinergy_xs_map); +} + +module_init(init_rc_map_terratec_cinergy_xs) +module_exit(exit_rc_map_terratec_cinergy_xs) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-tevii-nec.c b/drivers/media/IR/keymaps/rc-tevii-nec.c new file mode 100644 index 000000000000..e30d411c07bb --- /dev/null +++ b/drivers/media/IR/keymaps/rc-tevii-nec.c @@ -0,0 +1,88 @@ +/* tevii-nec.h - Keytable for tevii_nec Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode tevii_nec[] = { + { 0x0a, KEY_POWER2}, + { 0x0c, KEY_MUTE}, + { 0x11, KEY_1}, + { 0x12, KEY_2}, + { 0x13, KEY_3}, + { 0x14, KEY_4}, + { 0x15, KEY_5}, + { 0x16, KEY_6}, + { 0x17, KEY_7}, + { 0x18, KEY_8}, + { 0x19, KEY_9}, + { 0x10, KEY_0}, + { 0x1c, KEY_MENU}, + { 0x0f, KEY_VOLUMEDOWN}, + { 0x1a, KEY_LAST}, + { 0x0e, KEY_OPEN}, + { 0x04, KEY_RECORD}, + { 0x09, KEY_VOLUMEUP}, + { 0x08, KEY_CHANNELUP}, + { 0x07, KEY_PVR}, + { 0x0b, KEY_TIME}, + { 0x02, KEY_RIGHT}, + { 0x03, KEY_LEFT}, + { 0x00, KEY_UP}, + { 0x1f, KEY_OK}, + { 0x01, KEY_DOWN}, + { 0x05, KEY_TUNER}, + { 0x06, KEY_CHANNELDOWN}, + { 0x40, KEY_PLAYPAUSE}, + { 0x1e, KEY_REWIND}, + { 0x1b, KEY_FAVORITES}, + { 0x1d, KEY_BACK}, + { 0x4d, KEY_FASTFORWARD}, + { 0x44, KEY_EPG}, + { 0x4c, KEY_INFO}, + { 0x41, KEY_AB}, + { 0x43, KEY_AUDIO}, + { 0x45, KEY_SUBTITLE}, + { 0x4a, KEY_LIST}, + { 0x46, KEY_F1}, + { 0x47, KEY_F2}, + { 0x5e, KEY_F3}, + { 0x5c, KEY_F4}, + { 0x52, KEY_F5}, + { 0x5a, KEY_F6}, + { 0x56, KEY_MODE}, + { 0x58, KEY_SWITCHVIDEOMODE}, +}; + +static struct rc_keymap tevii_nec_map = { + .map = { + .scan = tevii_nec, + .size = ARRAY_SIZE(tevii_nec), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_TEVII_NEC, + } +}; + +static int __init init_rc_map_tevii_nec(void) +{ + return ir_register_map(&tevii_nec_map); +} + +static void __exit exit_rc_map_tevii_nec(void) +{ + ir_unregister_map(&tevii_nec_map); +} + +module_init(init_rc_map_tevii_nec) +module_exit(exit_rc_map_tevii_nec) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-tt-1500.c b/drivers/media/IR/keymaps/rc-tt-1500.c new file mode 100644 index 000000000000..bc88de011d5d --- /dev/null +++ b/drivers/media/IR/keymaps/rc-tt-1500.c @@ -0,0 +1,82 @@ +/* tt-1500.h - Keytable for tt_1500 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* for the Technotrend 1500 bundled remotes (grey and black): */ + +static struct ir_scancode tt_1500[] = { + { 0x01, KEY_POWER }, + { 0x02, KEY_SHUFFLE }, /* ? double-arrow key */ + { 0x03, KEY_1 }, + { 0x04, KEY_2 }, + { 0x05, KEY_3 }, + { 0x06, KEY_4 }, + { 0x07, KEY_5 }, + { 0x08, KEY_6 }, + { 0x09, KEY_7 }, + { 0x0a, KEY_8 }, + { 0x0b, KEY_9 }, + { 0x0c, KEY_0 }, + { 0x0d, KEY_UP }, + { 0x0e, KEY_LEFT }, + { 0x0f, KEY_OK }, + { 0x10, KEY_RIGHT }, + { 0x11, KEY_DOWN }, + { 0x12, KEY_INFO }, + { 0x13, KEY_EXIT }, + { 0x14, KEY_RED }, + { 0x15, KEY_GREEN }, + { 0x16, KEY_YELLOW }, + { 0x17, KEY_BLUE }, + { 0x18, KEY_MUTE }, + { 0x19, KEY_TEXT }, + { 0x1a, KEY_MODE }, /* ? TV/Radio */ + { 0x21, KEY_OPTION }, + { 0x22, KEY_EPG }, + { 0x23, KEY_CHANNELUP }, + { 0x24, KEY_CHANNELDOWN }, + { 0x25, KEY_VOLUMEUP }, + { 0x26, KEY_VOLUMEDOWN }, + { 0x27, KEY_SETUP }, + { 0x3a, KEY_RECORD }, /* these keys are only in the black remote */ + { 0x3b, KEY_PLAY }, + { 0x3c, KEY_STOP }, + { 0x3d, KEY_REWIND }, + { 0x3e, KEY_PAUSE }, + { 0x3f, KEY_FORWARD }, +}; + +static struct rc_keymap tt_1500_map = { + .map = { + .scan = tt_1500, + .size = ARRAY_SIZE(tt_1500), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_TT_1500, + } +}; + +static int __init init_rc_map_tt_1500(void) +{ + return ir_register_map(&tt_1500_map); +} + +static void __exit exit_rc_map_tt_1500(void) +{ + ir_unregister_map(&tt_1500_map); +} + +module_init(init_rc_map_tt_1500) +module_exit(exit_rc_map_tt_1500) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-videomate-s350.c b/drivers/media/IR/keymaps/rc-videomate-s350.c new file mode 100644 index 000000000000..4df7fcd1d2fc --- /dev/null +++ b/drivers/media/IR/keymaps/rc-videomate-s350.c @@ -0,0 +1,85 @@ +/* videomate-s350.h - Keytable for videomate_s350 Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode videomate_s350[] = { + { 0x00, KEY_TV}, + { 0x01, KEY_DVD}, + { 0x04, KEY_RECORD}, + { 0x05, KEY_VIDEO}, /* TV/Video */ + { 0x07, KEY_STOP}, + { 0x08, KEY_PLAYPAUSE}, + { 0x0a, KEY_REWIND}, + { 0x0f, KEY_FASTFORWARD}, + { 0x10, KEY_CHANNELUP}, + { 0x12, KEY_VOLUMEUP}, + { 0x13, KEY_CHANNELDOWN}, + { 0x14, KEY_MUTE}, + { 0x15, KEY_VOLUMEDOWN}, + { 0x16, KEY_1}, + { 0x17, KEY_2}, + { 0x18, KEY_3}, + { 0x19, KEY_4}, + { 0x1a, KEY_5}, + { 0x1b, KEY_6}, + { 0x1c, KEY_7}, + { 0x1d, KEY_8}, + { 0x1e, KEY_9}, + { 0x1f, KEY_0}, + { 0x21, KEY_SLEEP}, + { 0x24, KEY_ZOOM}, + { 0x25, KEY_LAST}, /* Recall */ + { 0x26, KEY_SUBTITLE}, /* CC */ + { 0x27, KEY_LANGUAGE}, /* MTS */ + { 0x29, KEY_CHANNEL}, /* SURF */ + { 0x2b, KEY_A}, + { 0x2c, KEY_B}, + { 0x2f, KEY_CAMERA}, /* Snapshot */ + { 0x23, KEY_RADIO}, + { 0x02, KEY_PREVIOUSSONG}, + { 0x06, KEY_NEXTSONG}, + { 0x03, KEY_EPG}, + { 0x09, KEY_SETUP}, + { 0x22, KEY_BACKSPACE}, + { 0x0c, KEY_UP}, + { 0x0e, KEY_DOWN}, + { 0x0b, KEY_LEFT}, + { 0x0d, KEY_RIGHT}, + { 0x11, KEY_ENTER}, + { 0x20, KEY_TEXT}, +}; + +static struct rc_keymap videomate_s350_map = { + .map = { + .scan = videomate_s350, + .size = ARRAY_SIZE(videomate_s350), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_VIDEOMATE_S350, + } +}; + +static int __init init_rc_map_videomate_s350(void) +{ + return ir_register_map(&videomate_s350_map); +} + +static void __exit exit_rc_map_videomate_s350(void) +{ + ir_unregister_map(&videomate_s350_map); +} + +module_init(init_rc_map_videomate_s350) +module_exit(exit_rc_map_videomate_s350) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-videomate-tv-pvr.c b/drivers/media/IR/keymaps/rc-videomate-tv-pvr.c new file mode 100644 index 000000000000..776b0a638d87 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-videomate-tv-pvr.c @@ -0,0 +1,87 @@ +/* videomate-tv-pvr.h - Keytable for videomate_tv_pvr Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +static struct ir_scancode videomate_tv_pvr[] = { + { 0x14, KEY_MUTE }, + { 0x24, KEY_ZOOM }, + + { 0x01, KEY_DVD }, + { 0x23, KEY_RADIO }, + { 0x00, KEY_TV }, + + { 0x0a, KEY_REWIND }, + { 0x08, KEY_PLAYPAUSE }, + { 0x0f, KEY_FORWARD }, + + { 0x02, KEY_PREVIOUS }, + { 0x07, KEY_STOP }, + { 0x06, KEY_NEXT }, + + { 0x0c, KEY_UP }, + { 0x0e, KEY_DOWN }, + { 0x0b, KEY_LEFT }, + { 0x0d, KEY_RIGHT }, + { 0x11, KEY_OK }, + + { 0x03, KEY_MENU }, + { 0x09, KEY_SETUP }, + { 0x05, KEY_VIDEO }, + { 0x22, KEY_CHANNEL }, + + { 0x12, KEY_VOLUMEUP }, + { 0x15, KEY_VOLUMEDOWN }, + { 0x10, KEY_CHANNELUP }, + { 0x13, KEY_CHANNELDOWN }, + + { 0x04, KEY_RECORD }, + + { 0x16, KEY_1 }, + { 0x17, KEY_2 }, + { 0x18, KEY_3 }, + { 0x19, KEY_4 }, + { 0x1a, KEY_5 }, + { 0x1b, KEY_6 }, + { 0x1c, KEY_7 }, + { 0x1d, KEY_8 }, + { 0x1e, KEY_9 }, + { 0x1f, KEY_0 }, + + { 0x20, KEY_LANGUAGE }, + { 0x21, KEY_SLEEP }, +}; + +static struct rc_keymap videomate_tv_pvr_map = { + .map = { + .scan = videomate_tv_pvr, + .size = ARRAY_SIZE(videomate_tv_pvr), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_VIDEOMATE_TV_PVR, + } +}; + +static int __init init_rc_map_videomate_tv_pvr(void) +{ + return ir_register_map(&videomate_tv_pvr_map); +} + +static void __exit exit_rc_map_videomate_tv_pvr(void) +{ + ir_unregister_map(&videomate_tv_pvr_map); +} + +module_init(init_rc_map_videomate_tv_pvr) +module_exit(exit_rc_map_videomate_tv_pvr) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c b/drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c new file mode 100644 index 000000000000..9d2d550aaa90 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c @@ -0,0 +1,82 @@ +/* winfast-usbii-deluxe.h - Keytable for winfast_usbii_deluxe Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Leadtek Winfast TV USB II Deluxe remote + Magnus Alm + */ + +static struct ir_scancode winfast_usbii_deluxe[] = { + { 0x62, KEY_0}, + { 0x75, KEY_1}, + { 0x76, KEY_2}, + { 0x77, KEY_3}, + { 0x79, KEY_4}, + { 0x7a, KEY_5}, + { 0x7b, KEY_6}, + { 0x7d, KEY_7}, + { 0x7e, KEY_8}, + { 0x7f, KEY_9}, + + { 0x38, KEY_CAMERA}, /* SNAPSHOT */ + { 0x37, KEY_RECORD}, /* RECORD */ + { 0x35, KEY_TIME}, /* TIMESHIFT */ + + { 0x74, KEY_VOLUMEUP}, /* VOLUMEUP */ + { 0x78, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ + { 0x64, KEY_MUTE}, /* MUTE */ + + { 0x21, KEY_CHANNEL}, /* SURF */ + { 0x7c, KEY_CHANNELUP}, /* CHANNELUP */ + { 0x60, KEY_CHANNELDOWN}, /* CHANNELDOWN */ + { 0x61, KEY_LAST}, /* LAST CHANNEL (RECALL) */ + + { 0x72, KEY_VIDEO}, /* INPUT MODES (TV/FM) */ + + { 0x70, KEY_POWER2}, /* TV ON/OFF */ + + { 0x39, KEY_CYCLEWINDOWS}, /* MINIMIZE (BOSS) */ + { 0x3a, KEY_NEW}, /* PIP */ + { 0x73, KEY_ZOOM}, /* FULLSECREEN */ + + { 0x66, KEY_INFO}, /* OSD (DISPLAY) */ + + { 0x31, KEY_DOT}, /* '.' */ + { 0x63, KEY_ENTER}, /* ENTER */ + +}; + +static struct rc_keymap winfast_usbii_deluxe_map = { + .map = { + .scan = winfast_usbii_deluxe, + .size = ARRAY_SIZE(winfast_usbii_deluxe), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_WINFAST_USBII_DELUXE, + } +}; + +static int __init init_rc_map_winfast_usbii_deluxe(void) +{ + return ir_register_map(&winfast_usbii_deluxe_map); +} + +static void __exit exit_rc_map_winfast_usbii_deluxe(void) +{ + ir_unregister_map(&winfast_usbii_deluxe_map); +} + +module_init(init_rc_map_winfast_usbii_deluxe) +module_exit(exit_rc_map_winfast_usbii_deluxe) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/keymaps/rc-winfast.c b/drivers/media/IR/keymaps/rc-winfast.c new file mode 100644 index 000000000000..0e90a3bd9499 --- /dev/null +++ b/drivers/media/IR/keymaps/rc-winfast.c @@ -0,0 +1,102 @@ +/* winfast.h - Keytable for winfast Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ + +static struct ir_scancode winfast[] = { + /* Keys 0 to 9 */ + { 0x12, KEY_0 }, + { 0x05, KEY_1 }, + { 0x06, KEY_2 }, + { 0x07, KEY_3 }, + { 0x09, KEY_4 }, + { 0x0a, KEY_5 }, + { 0x0b, KEY_6 }, + { 0x0d, KEY_7 }, + { 0x0e, KEY_8 }, + { 0x0f, KEY_9 }, + + { 0x00, KEY_POWER }, + { 0x1b, KEY_AUDIO }, /* Audio Source */ + { 0x02, KEY_TUNER }, /* TV/FM, not on Y0400052 */ + { 0x1e, KEY_VIDEO }, /* Video Source */ + { 0x16, KEY_INFO }, /* Display information */ + { 0x04, KEY_VOLUMEUP }, + { 0x08, KEY_VOLUMEDOWN }, + { 0x0c, KEY_CHANNELUP }, + { 0x10, KEY_CHANNELDOWN }, + { 0x03, KEY_ZOOM }, /* fullscreen */ + { 0x1f, KEY_TEXT }, /* closed caption/teletext */ + { 0x20, KEY_SLEEP }, + { 0x29, KEY_CLEAR }, /* boss key */ + { 0x14, KEY_MUTE }, + { 0x2b, KEY_RED }, + { 0x2c, KEY_GREEN }, + { 0x2d, KEY_YELLOW }, + { 0x2e, KEY_BLUE }, + { 0x18, KEY_KPPLUS }, /* fine tune + , not on Y040052 */ + { 0x19, KEY_KPMINUS }, /* fine tune - , not on Y040052 */ + { 0x2a, KEY_MEDIA }, /* PIP (Picture in picture */ + { 0x21, KEY_DOT }, + { 0x13, KEY_ENTER }, + { 0x11, KEY_LAST }, /* Recall (last channel */ + { 0x22, KEY_PREVIOUS }, + { 0x23, KEY_PLAYPAUSE }, + { 0x24, KEY_NEXT }, + { 0x25, KEY_TIME }, /* Time Shifting */ + { 0x26, KEY_STOP }, + { 0x27, KEY_RECORD }, + { 0x28, KEY_SAVE }, /* Screenshot */ + { 0x2f, KEY_MENU }, + { 0x30, KEY_CANCEL }, + { 0x31, KEY_CHANNEL }, /* Channel Surf */ + { 0x32, KEY_SUBTITLE }, + { 0x33, KEY_LANGUAGE }, + { 0x34, KEY_REWIND }, + { 0x35, KEY_FASTFORWARD }, + { 0x36, KEY_TV }, + { 0x37, KEY_RADIO }, /* FM */ + { 0x38, KEY_DVD }, + + { 0x1a, KEY_MODE}, /* change to MCE mode on Y04G0051 */ + { 0x3e, KEY_F21 }, /* MCE +VOL, on Y04G0033 */ + { 0x3a, KEY_F22 }, /* MCE -VOL, on Y04G0033 */ + { 0x3b, KEY_F23 }, /* MCE +CH, on Y04G0033 */ + { 0x3f, KEY_F24 } /* MCE -CH, on Y04G0033 */ +}; + +static struct rc_keymap winfast_map = { + .map = { + .scan = winfast, + .size = ARRAY_SIZE(winfast), + .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ + .name = RC_MAP_WINFAST, + } +}; + +static int __init init_rc_map_winfast(void) +{ + return ir_register_map(&winfast_map); +} + +static void __exit exit_rc_map_winfast(void) +{ + ir_unregister_map(&winfast_map); +} + +module_init(init_rc_map_winfast) +module_exit(exit_rc_map_winfast) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/IR/rc-map.c b/drivers/media/IR/rc-map.c index aa269f5ef3fe..02c72f086fe0 100644 --- a/drivers/media/IR/rc-map.c +++ b/drivers/media/IR/rc-map.c @@ -64,7 +64,7 @@ int ir_register_map(struct rc_keymap *map) spin_unlock(&rc_map_lock); return 0; } -EXPORT_SYMBOL_GPL(ir_raw_handler_register); +EXPORT_SYMBOL_GPL(ir_register_map); void ir_unregister_map(struct rc_keymap *map) { @@ -72,4 +72,4 @@ void ir_unregister_map(struct rc_keymap *map) list_del(&map->list); spin_unlock(&rc_map_lock); } -EXPORT_SYMBOL_GPL(ir_raw_handler_unregister); +EXPORT_SYMBOL_GPL(ir_unregister_map); -- GitLab From b2245ba1644eb1eba400fd04c6e7bb3ab2d4a8fa Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Apr 2010 13:18:42 -0300 Subject: [PATCH 289/534] V4L/DVB: ir: prepare IR code for a parameter change at register function A latter patch will reuse the ir_input_register with a different meaning. Before it, change all occurrences to a temporary name. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 6 ++--- drivers/media/dvb/dm1105/dm1105.c | 2 +- drivers/media/dvb/mantis/mantis_input.c | 2 +- drivers/media/dvb/ttpci/budget-ci.c | 2 +- drivers/media/video/bt8xx/bttv-input.c | 2 +- drivers/media/video/cx231xx/cx231xx-input.c | 2 +- drivers/media/video/cx23885/cx23885-input.c | 2 +- drivers/media/video/cx88/cx88-input.c | 2 +- drivers/media/video/em28xx/em28xx-input.c | 2 +- drivers/media/video/ir-kbd-i2c.c | 2 +- drivers/media/video/saa7134/saa7134-input.c | 2 +- include/media/ir-core.h | 26 ++++++++++++++++----- 12 files changed, 33 insertions(+), 19 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 99cad829a18a..5d4ddc9f4cab 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -461,7 +461,7 @@ static void ir_close(struct input_dev *input_dev) } /** - * ir_input_register() - sets the IR keycode table and add the handlers + * __ir_input_register() - sets the IR keycode table and add the handlers * for keymap table get/set * @input_dev: the struct input_dev descriptor of the device * @rc_tab: the struct ir_scancode_table table of scancode/keymap @@ -471,7 +471,7 @@ static void ir_close(struct input_dev *input_dev) * It will register the input/evdev interface for the device and * register the syfs code for IR class */ -int ir_input_register(struct input_dev *input_dev, +int __ir_input_register(struct input_dev *input_dev, const struct ir_scancode_table *rc_tab, const struct ir_dev_props *props, const char *driver_name) @@ -539,7 +539,7 @@ int ir_input_register(struct input_dev *input_dev, kfree(ir_dev); return rc; } -EXPORT_SYMBOL_GPL(ir_input_register); +EXPORT_SYMBOL_GPL(__ir_input_register); /** * ir_input_unregister() - unregisters IR and frees resources diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index ff62dc8633c0..416c29bf78d9 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -630,7 +630,7 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) INIT_WORK(&dm1105->ir.work, dm1105_emit_key); - err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + err = __ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); return err; } diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index 6baf30229689..3d4e4663220c 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c @@ -128,7 +128,7 @@ int mantis_input_init(struct mantis_pci *mantis) rc->id.version = 1; rc->dev = mantis->pdev->dev; - err = ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME); + err = __ir_input_register(rc, &ir_mantis, NULL, MODULE_NAME); if (err) { dprintk(MANTIS_ERROR, 1, "IR device registration failed, ret = %d", err); input_free_device(rc); diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index 75c640e5966c..ab7479ad592f 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -256,7 +256,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) budget_ci->ir.timer_keyup.function = msp430_ir_keyup; budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; budget_ci->ir.last_raw = 0xffff; /* An impossible value */ - error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + error = __ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); return error; diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index e3d239da1bad..71a0047ca7b2 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -392,7 +392,7 @@ int bttv_input_init(struct bttv *btv) bttv_ir_start(btv, ir); /* all done */ - err = ir_input_register(btv->remote->dev, ir_codes, NULL, MODULE_NAME); + err = __ir_input_register(btv->remote->dev, ir_codes, NULL, MODULE_NAME); if (err) goto err_out_stop; diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c index a0e8bb88d67e..04ae0839deaa 100644 --- a/drivers/media/video/cx231xx/cx231xx-input.c +++ b/drivers/media/video/cx231xx/cx231xx-input.c @@ -219,7 +219,7 @@ int cx231xx_ir_init(struct cx231xx *dev) cx231xx_ir_start(ir); /* all done */ - err = ir_input_register(ir->input, dev->board.ir_codes, + err = __ir_input_register(ir->input, dev->board.ir_codes, NULL, MODULE_NAME); if (err) goto err_out_stop; diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index 66d3e1c64ce6..cef36f6b93e3 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c @@ -400,7 +400,7 @@ int cx23885_input_init(struct cx23885_dev *dev) dev->ir_input = ir; cx23885_input_ir_start(dev); - ret = ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME); + ret = __ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME); if (ret) goto err_out_stop; diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 48ca9805bb90..30af956a9eaa 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -439,7 +439,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ir->props.close = cx88_ir_close; /* all done */ - err = ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME); + err = __ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME); if (err) goto err_out_free; diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 32f376654c0c..6f1fc695c561 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -475,7 +475,7 @@ int em28xx_ir_init(struct em28xx *dev) em28xx_ir_start(ir); /* all done */ - err = ir_input_register(ir->input, dev->board.ir_codes, + err = __ir_input_register(ir->input, dev->board.ir_codes, &ir->props, MODULE_NAME); if (err) goto err_out_stop; diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 607a0be2ec63..e6ada5e46dfc 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -447,7 +447,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) input_dev->name = ir->name; input_dev->phys = ir->phys; - err = ir_input_register(ir->input, ir->ir_codes, NULL, MODULE_NAME); + err = __ir_input_register(ir->input, ir->ir_codes, NULL, MODULE_NAME); if (err) goto err_out_free; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index eaafed181d50..bf6751c760b4 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -877,7 +877,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) } input_dev->dev.parent = &dev->pci->dev; - err = ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); + err = __ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); if (err) goto err_out_free; if (ir_codes->ir_type != IR_TYPE_OTHER) { diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 39df3cf9e845..8e975f24dae1 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -119,23 +119,37 @@ EXPORT_SYMBOL_GPL(IR_KEYTABLE(tabname)) #define DEFINE_LEGACY_IR_KEYTABLE(tabname) \ DEFINE_IR_KEYTABLE(tabname, IR_TYPE_UNKNOWN) +/* Routines from rc-map.c */ + +int ir_register_map(struct rc_keymap *map); +void ir_unregister_map(struct rc_keymap *map); +struct ir_scancode_table *get_rc_map(const char *name); + /* Routines from ir-keytable.c */ u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); void ir_keyup(struct input_dev *dev); void ir_keydown(struct input_dev *dev, int scancode); -int ir_input_register(struct input_dev *dev, +int __ir_input_register(struct input_dev *dev, const struct ir_scancode_table *ir_codes, const struct ir_dev_props *props, const char *driver_name); -void ir_input_unregister(struct input_dev *input_dev); -/* Routines from rc-map.c */ +static inline int ir_input_register(struct input_dev *dev, + const char *map_name, + const struct ir_dev_props *props, + const char *driver_name) { + struct ir_scancode_table *ir_codes; -int ir_register_map(struct rc_keymap *map); -void ir_unregister_map(struct rc_keymap *map); -struct ir_scancode_table *get_rc_map(const char *name); + ir_codes = get_rc_map(map_name); + if (!ir_codes) + return -EINVAL; + + return __ir_input_register(dev, ir_codes, props, driver_name); +} + + void ir_input_unregister(struct input_dev *input_dev); /* Routines from ir-sysfs.c */ -- GitLab From 02858eedcb78a664215b918d98cdb753ce432ce6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Apr 2010 20:01:00 -0300 Subject: [PATCH 290/534] V4L/DVB: ir-core: Make use of the new IR keymap modules Instead of using the ugly keymap sequences, use the new rc-*.ko keymap files. For now, it is still needed to have one keymap loaded, for the RC code to work. Later patches will remove this depenency. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/Makefile | 2 + drivers/media/IR/ir-sysfs.c | 4 +- drivers/media/IR/rc-map.c | 27 +++++-- drivers/media/dvb/dm1105/dm1105.c | 4 +- drivers/media/dvb/ttpci/budget-ci.c | 10 +-- drivers/media/video/bt8xx/bttv-input.c | 28 +++---- drivers/media/video/cx18/cx18-i2c.c | 2 +- drivers/media/video/cx23885/cx23885-input.c | 6 +- drivers/media/video/cx88/cx88-input.c | 42 +++++------ drivers/media/video/em28xx/em28xx-cards.c | 34 ++++----- drivers/media/video/em28xx/em28xx-input.c | 6 +- drivers/media/video/em28xx/em28xx.h | 2 +- drivers/media/video/ir-kbd-i2c.c | 22 +++--- drivers/media/video/ivtv/ivtv-i2c.c | 6 +- drivers/media/video/saa7134/saa7134-input.c | 81 ++++++++++----------- include/media/ir-core.h | 21 +++++- include/media/ir-kbd-i2c.h | 4 +- include/media/rc-map.h | 81 +++++++++++++++++++++ 18 files changed, 247 insertions(+), 135 deletions(-) create mode 100644 include/media/rc-map.h diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile index 3a4f590d0bbb..3d8dd306df46 100644 --- a/drivers/media/IR/Makefile +++ b/drivers/media/IR/Makefile @@ -1,6 +1,8 @@ ir-common-objs := ir-functions.o ir-keymaps.o ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o rc-map.o +obj-y += keymaps/ + obj-$(CONFIG_IR_CORE) += ir-core.o obj-$(CONFIG_VIDEO_IR) += ir-common.o obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 36dfe51aad92..58ecca2003a4 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -251,8 +251,10 @@ static int __init ir_core_init(void) return rc; } - /* Initialize/load the decoders that will be used */ + /* Initialize/load the decoders/keymap code that will be used */ ir_raw_init(); + rc_map_init(); + return 0; } diff --git a/drivers/media/IR/rc-map.c b/drivers/media/IR/rc-map.c index 02c72f086fe0..2f6201ce1898 100644 --- a/drivers/media/IR/rc-map.c +++ b/drivers/media/IR/rc-map.c @@ -26,12 +26,14 @@ static struct rc_keymap *seek_rc_map(const char *name) spin_lock(&rc_map_lock); list_for_each_entry(map, &rc_map_list, list) { - if (!strcmp(name, map->map.name)) - break; + if (!strcmp(name, map->map.name)) { + spin_unlock(&rc_map_lock); + return map; + } } spin_unlock(&rc_map_lock); - return map; + return NULL; } struct ir_scancode_table *get_rc_map(const char *name) @@ -43,15 +45,22 @@ struct ir_scancode_table *get_rc_map(const char *name) map = seek_rc_map(name); #ifdef MODULE if (!map) { - rc = request_module("name"); - if (rc < 0) + rc = request_module(name); + if (rc < 0) { + printk(KERN_ERR "Couldn't load IR keymap %s\n", name); return NULL; + } + msleep(20); /* Give some time for IR to register */ map = seek_rc_map(name); } #endif - if (!map) + if (!map) { + printk(KERN_ERR "IR keymap %s not found\n", name); return NULL; + } + + printk(KERN_INFO "Registered IR keymap %s\n", map->map.name); return &map->map; } @@ -73,3 +82,9 @@ void ir_unregister_map(struct rc_keymap *map) spin_unlock(&rc_map_lock); } EXPORT_SYMBOL_GPL(ir_unregister_map); + +void rc_map_init(void) +{ + spin_lock_init(&rc_map_lock); + +} diff --git a/drivers/media/dvb/dm1105/dm1105.c b/drivers/media/dvb/dm1105/dm1105.c index 416c29bf78d9..9d389bdaca41 100644 --- a/drivers/media/dvb/dm1105/dm1105.c +++ b/drivers/media/dvb/dm1105/dm1105.c @@ -596,7 +596,7 @@ static irqreturn_t dm1105_irq(int irq, void *dev_id) int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) { struct input_dev *input_dev; - struct ir_scancode_table *ir_codes = &IR_KEYTABLE(dm1105_nec); + char *ir_codes = NULL; u64 ir_type = IR_TYPE_OTHER; int err = -ENOMEM; @@ -630,7 +630,7 @@ int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) INIT_WORK(&dm1105->ir.work, dm1105_emit_key); - err = __ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + err = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); return err; } diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index ab7479ad592f..be2074995a0d 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -192,7 +192,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) struct saa7146_dev *saa = budget_ci->budget.dev; struct input_dev *input_dev = budget_ci->ir.dev; int error; - struct ir_scancode_table *ir_codes; + char *ir_codes = NULL; budget_ci->ir.dev = input_dev = input_allocate_device(); @@ -232,7 +232,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1011: case 0x1012: /* The hauppauge keymap is a superset of these remotes */ - ir_codes = &IR_KEYTABLE(hauppauge_new); + ir_codes = RC_MAP_HAUPPAUGE_NEW; if (rc5_device < 0) budget_ci->ir.rc5_device = 0x1f; @@ -241,11 +241,11 @@ static int msp430_ir_init(struct budget_ci *budget_ci) case 0x1017: case 0x101a: /* for the Technotrend 1500 bundled remote */ - ir_codes = &IR_KEYTABLE(tt_1500); + ir_codes = RC_MAP_TT_1500; break; default: /* unknown remote */ - ir_codes = &IR_KEYTABLE(budget_ci_old); + ir_codes = RC_MAP_BUDGET_CI_OLD; break; } @@ -256,7 +256,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci) budget_ci->ir.timer_keyup.function = msp430_ir_keyup; budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; budget_ci->ir.last_raw = 0xffff; /* An impossible value */ - error = __ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); + error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); return error; diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index 71a0047ca7b2..f68717a4bdec 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -248,7 +248,7 @@ static void bttv_ir_stop(struct bttv *btv) int bttv_input_init(struct bttv *btv) { struct card_ir *ir; - struct ir_scancode_table *ir_codes = NULL; + char *ir_codes = NULL; struct input_dev *input_dev; u64 ir_type = IR_TYPE_OTHER; int err = -ENOMEM; @@ -266,7 +266,7 @@ int bttv_input_init(struct bttv *btv) case BTTV_BOARD_AVERMEDIA: case BTTV_BOARD_AVPHONE98: case BTTV_BOARD_AVERMEDIA98: - ir_codes = &IR_KEYTABLE(avermedia); + ir_codes = RC_MAP_AVERMEDIA; ir->mask_keycode = 0xf88000; ir->mask_keydown = 0x010000; ir->polling = 50; // ms @@ -274,14 +274,14 @@ int bttv_input_init(struct bttv *btv) case BTTV_BOARD_AVDVBT_761: case BTTV_BOARD_AVDVBT_771: - ir_codes = &IR_KEYTABLE(avermedia_dvbt); + ir_codes = RC_MAP_AVERMEDIA_DVBT; ir->mask_keycode = 0x0f00c0; ir->mask_keydown = 0x000020; ir->polling = 50; // ms break; case BTTV_BOARD_PXELVWPLTVPAK: - ir_codes = &IR_KEYTABLE(pixelview); + ir_codes = RC_MAP_PIXELVIEW; ir->mask_keycode = 0x003e00; ir->mask_keyup = 0x010000; ir->polling = 50; // ms @@ -289,24 +289,24 @@ int bttv_input_init(struct bttv *btv) case BTTV_BOARD_PV_M4900: case BTTV_BOARD_PV_BT878P_9B: case BTTV_BOARD_PV_BT878P_PLUS: - ir_codes = &IR_KEYTABLE(pixelview); + ir_codes = RC_MAP_PIXELVIEW; ir->mask_keycode = 0x001f00; ir->mask_keyup = 0x008000; ir->polling = 50; // ms break; case BTTV_BOARD_WINFAST2000: - ir_codes = &IR_KEYTABLE(winfast); + ir_codes = RC_MAP_WINFAST; ir->mask_keycode = 0x1f8; break; case BTTV_BOARD_MAGICTVIEW061: case BTTV_BOARD_MAGICTVIEW063: - ir_codes = &IR_KEYTABLE(winfast); + ir_codes = RC_MAP_WINFAST; ir->mask_keycode = 0x0008e000; ir->mask_keydown = 0x00200000; break; case BTTV_BOARD_APAC_VIEWCOMP: - ir_codes = &IR_KEYTABLE(apac_viewcomp); + ir_codes = RC_MAP_APAC_VIEWCOMP; ir->mask_keycode = 0x001f00; ir->mask_keyup = 0x008000; ir->polling = 50; // ms @@ -314,30 +314,30 @@ int bttv_input_init(struct bttv *btv) case BTTV_BOARD_ASKEY_CPH03X: case BTTV_BOARD_CONCEPTRONIC_CTVFMI2: case BTTV_BOARD_CONTVFMI: - ir_codes = &IR_KEYTABLE(pixelview); + ir_codes = RC_MAP_PIXELVIEW; ir->mask_keycode = 0x001F00; ir->mask_keyup = 0x006000; ir->polling = 50; // ms break; case BTTV_BOARD_NEBULA_DIGITV: - ir_codes = &IR_KEYTABLE(nebula); + ir_codes = RC_MAP_NEBULA; btv->custom_irq = bttv_rc5_irq; ir->rc5_gpio = 1; break; case BTTV_BOARD_MACHTV_MAGICTV: - ir_codes = &IR_KEYTABLE(apac_viewcomp); + ir_codes = RC_MAP_APAC_VIEWCOMP; ir->mask_keycode = 0x001F00; ir->mask_keyup = 0x004000; ir->polling = 50; /* ms */ break; case BTTV_BOARD_KOZUMI_KTV_01C: - ir_codes = &IR_KEYTABLE(pctv_sedna); + ir_codes = RC_MAP_PCTV_SEDNA; ir->mask_keycode = 0x001f00; ir->mask_keyup = 0x006000; ir->polling = 50; /* ms */ break; case BTTV_BOARD_ENLTV_FM_2: - ir_codes = &IR_KEYTABLE(encore_enltv2); + ir_codes = RC_MAP_ENCORE_ENLTV2; ir->mask_keycode = 0x00fd00; ir->mask_keyup = 0x000080; ir->polling = 1; /* ms */ @@ -392,7 +392,7 @@ int bttv_input_init(struct bttv *btv) bttv_ir_start(btv, ir); /* all done */ - err = __ir_input_register(btv->remote->dev, ir_codes, NULL, MODULE_NAME); + err = ir_input_register(btv->remote->dev, ir_codes, NULL, MODULE_NAME); if (err) goto err_out_stop; diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index 476c016e63a8..cfa1f289b0f5 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c @@ -109,7 +109,7 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, /* Our default information for ir-kbd-i2c.c to use */ switch (hw) { case CX18_HW_Z8F0811_IR_RX_HAUP: - init_data->ir_codes = &IR_KEYTABLE(hauppauge_new); + init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; init_data->type = IR_TYPE_RC5; init_data->name = cx->card_name; diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c index cef36f6b93e3..8d306d8bb61c 100644 --- a/drivers/media/video/cx23885/cx23885-input.c +++ b/drivers/media/video/cx23885/cx23885-input.c @@ -340,7 +340,7 @@ int cx23885_input_init(struct cx23885_dev *dev) { struct card_ir *ir; struct input_dev *input_dev; - struct ir_scancode_table *ir_codes = NULL; + char *ir_codes = NULL; int ir_type, ir_addr, ir_start; int ret; @@ -355,7 +355,7 @@ int cx23885_input_init(struct cx23885_dev *dev) case CX23885_BOARD_HAUPPAUGE_HVR1850: case CX23885_BOARD_HAUPPAUGE_HVR1290: /* Parameters for the grey Hauppauge remote for the HVR-1850 */ - ir_codes = &IR_KEYTABLE(hauppauge_new); + ir_codes = RC_MAP_HAUPPAUGE_NEW; ir_type = IR_TYPE_RC5; ir_addr = 0x1e; /* RC-5 system bits emitted by the remote */ ir_start = RC5_START_BITS_NORMAL; /* A basic RC-5 remote */ @@ -400,7 +400,7 @@ int cx23885_input_init(struct cx23885_dev *dev) dev->ir_input = ir; cx23885_input_ir_start(dev); - ret = __ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME); + ret = ir_input_register(ir->dev, ir_codes, NULL, MODULE_NAME); if (ret) goto err_out_stop; diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 30af956a9eaa..6efad1da65bf 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -245,7 +245,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) { struct cx88_IR *ir; struct input_dev *input_dev; - struct ir_scancode_table *ir_codes = NULL; + char *ir_codes = NULL; u64 ir_type = IR_TYPE_OTHER; int err = -ENOMEM; @@ -261,14 +261,14 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_DNTV_LIVE_DVB_T: case CX88_BOARD_KWORLD_DVB_T: case CX88_BOARD_KWORLD_DVB_T_CX22702: - ir_codes = &IR_KEYTABLE(dntv_live_dvb_t); + ir_codes = RC_MAP_DNTV_LIVE_DVB_T; ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x1f; ir->mask_keyup = 0x60; ir->polling = 50; /* ms */ break; case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: - ir_codes = &IR_KEYTABLE(cinergy_1400); + ir_codes = RC_MAP_CINERGY_1400; ir_type = IR_TYPE_PD; ir->sampling = 0xeb04; /* address */ break; @@ -283,14 +283,14 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_PCHDTV_HD3000: case CX88_BOARD_PCHDTV_HD5500: case CX88_BOARD_HAUPPAUGE_IRONLY: - ir_codes = &IR_KEYTABLE(hauppauge_new); + ir_codes = RC_MAP_HAUPPAUGE_NEW; ir_type = IR_TYPE_RC5; ir->sampling = 1; break; case CX88_BOARD_WINFAST_DTV2000H: case CX88_BOARD_WINFAST_DTV2000H_J: case CX88_BOARD_WINFAST_DTV1800H: - ir_codes = &IR_KEYTABLE(winfast); + ir_codes = RC_MAP_WINFAST; ir->gpio_addr = MO_GP0_IO; ir->mask_keycode = 0x8f8; ir->mask_keyup = 0x100; @@ -299,14 +299,14 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_WINFAST2000XP_EXPERT: case CX88_BOARD_WINFAST_DTV1000: case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL: - ir_codes = &IR_KEYTABLE(winfast); + ir_codes = RC_MAP_WINFAST; ir->gpio_addr = MO_GP0_IO; ir->mask_keycode = 0x8f8; ir->mask_keyup = 0x100; ir->polling = 1; /* ms */ break; case CX88_BOARD_IODATA_GVBCTV7E: - ir_codes = &IR_KEYTABLE(iodata_bctv7e); + ir_codes = RC_MAP_IODATA_BCTV7E; ir->gpio_addr = MO_GP0_IO; ir->mask_keycode = 0xfd; ir->mask_keydown = 0x02; @@ -314,7 +314,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_PROLINK_PLAYTVPVR: case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: - ir_codes = &IR_KEYTABLE(pixelview); + ir_codes = RC_MAP_PIXELVIEW; ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x1f; ir->mask_keyup = 0x80; @@ -322,28 +322,28 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_PROLINK_PV_8000GT: case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: - ir_codes = &IR_KEYTABLE(pixelview_new); + ir_codes = RC_MAP_PIXELVIEW_NEW; ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x3f; ir->mask_keyup = 0x80; ir->polling = 1; /* ms */ break; case CX88_BOARD_KWORLD_LTV883: - ir_codes = &IR_KEYTABLE(pixelview); + ir_codes = RC_MAP_PIXELVIEW; ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x1f; ir->mask_keyup = 0x60; ir->polling = 1; /* ms */ break; case CX88_BOARD_ADSTECH_DVB_T_PCI: - ir_codes = &IR_KEYTABLE(adstech_dvb_t_pci); + ir_codes = RC_MAP_ADSTECH_DVB_T_PCI; ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0xbf; ir->mask_keyup = 0x40; ir->polling = 50; /* ms */ break; case CX88_BOARD_MSI_TVANYWHERE_MASTER: - ir_codes = &IR_KEYTABLE(msi_tvanywhere); + ir_codes = RC_MAP_MSI_TVANYWHERE; ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x1f; ir->mask_keyup = 0x40; @@ -351,7 +351,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_AVERTV_303: case CX88_BOARD_AVERTV_STUDIO_303: - ir_codes = &IR_KEYTABLE(avertv_303); + ir_codes = RC_MAP_AVERTV_303; ir->gpio_addr = MO_GP2_IO; ir->mask_keycode = 0xfb; ir->mask_keydown = 0x02; @@ -364,41 +364,41 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_PROF_7300: case CX88_BOARD_PROF_7301: case CX88_BOARD_PROF_6200: - ir_codes = &IR_KEYTABLE(tbs_nec); + ir_codes = RC_MAP_TBS_NEC; ir_type = IR_TYPE_PD; ir->sampling = 0xff00; /* address */ break; case CX88_BOARD_TEVII_S460: case CX88_BOARD_TEVII_S420: - ir_codes = &IR_KEYTABLE(tevii_nec); + ir_codes = RC_MAP_TEVII_NEC; ir_type = IR_TYPE_PD; ir->sampling = 0xff00; /* address */ break; case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: - ir_codes = &IR_KEYTABLE(dntv_live_dvbt_pro); + ir_codes = RC_MAP_DNTV_LIVE_DVBT_PRO; ir_type = IR_TYPE_PD; ir->sampling = 0xff00; /* address */ break; case CX88_BOARD_NORWOOD_MICRO: - ir_codes = &IR_KEYTABLE(norwood); + ir_codes = RC_MAP_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_KEYTABLE(npgtech); + ir_codes = RC_MAP_NPGTECH; ir->gpio_addr = MO_GP0_IO; ir->mask_keycode = 0xfa; ir->polling = 50; /* ms */ break; case CX88_BOARD_PINNACLE_PCTV_HD_800i: - ir_codes = &IR_KEYTABLE(pinnacle_pctv_hd); + ir_codes = RC_MAP_PINNACLE_PCTV_HD; ir_type = IR_TYPE_RC5; ir->sampling = 1; break; case CX88_BOARD_POWERCOLOR_REAL_ANGEL: - ir_codes = &IR_KEYTABLE(powercolor_real_angel); + ir_codes = RC_MAP_POWERCOLOR_REAL_ANGEL; ir->gpio_addr = MO_GP2_IO; ir->mask_keycode = 0x7e; ir->polling = 100; /* ms */ @@ -439,7 +439,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ir->props.close = cx88_ir_close; /* all done */ - err = __ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME); + err = ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME); if (err) goto err_out_free; diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 29201438b45f..3a4fd8514511 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -602,7 +602,7 @@ struct em28xx_board em28xx_boards[] = { .name = "Gadmei UTV330+", .tuner_type = TUNER_TNF_5335MF, .tda9887_conf = TDA9887_PRESENT, - .ir_codes = &IR_KEYTABLE(gadmei_rm008z), + .ir_codes = RC_MAP_GADMEI_RM008Z, .decoder = EM28XX_SAA711X, .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, .input = { { @@ -791,7 +791,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &IR_KEYTABLE(hauppauge_new), + .ir_codes = RC_MAP_HAUPPAUGE_NEW, .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -816,7 +816,7 @@ struct em28xx_board em28xx_boards[] = { .tuner_type = TUNER_XC2028, .tuner_gpio = default_tuner_gpio, .mts_firmware = 1, - .ir_codes = &IR_KEYTABLE(hauppauge_new), + .ir_codes = RC_MAP_HAUPPAUGE_NEW, .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -842,7 +842,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &IR_KEYTABLE(hauppauge_new), + .ir_codes = RC_MAP_HAUPPAUGE_NEW, .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -868,7 +868,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &IR_KEYTABLE(rc5_hauppauge_new), + .ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW, .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -894,7 +894,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &IR_KEYTABLE(pinnacle_pctv_hd), + .ir_codes = RC_MAP_PINNACLE_PCTV_HD, .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -920,7 +920,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &IR_KEYTABLE(ati_tv_wonder_hd_600), + .ir_codes = RC_MAP_ATI_TV_WONDER_HD_600, .decoder = EM28XX_TVP5150, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -946,7 +946,7 @@ struct em28xx_board em28xx_boards[] = { .decoder = EM28XX_TVP5150, .has_dvb = 1, .dvb_gpio = default_digital, - .ir_codes = &IR_KEYTABLE(terratec_cinergy_xs), + .ir_codes = RC_MAP_TERRATEC_CINERGY_XS, .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */ .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -1296,7 +1296,7 @@ struct em28xx_board em28xx_boards[] = { .decoder = EM28XX_SAA711X, .has_dvb = 1, .dvb_gpio = em2882_kworld_315u_digital, - .ir_codes = &IR_KEYTABLE(kworld_315u), + .ir_codes = RC_MAP_KWORLD_315U, .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE, /* Analog mode - still not ready */ @@ -1425,7 +1425,7 @@ struct em28xx_board em28xx_boards[] = { .has_dvb = 1, .dvb_gpio = kworld_330u_digital, .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */ - .ir_codes = &IR_KEYTABLE(kworld_315u), + .ir_codes = RC_MAP_KWORLD_315U, .input = { { .type = EM28XX_VMUX_TELEVISION, .vmux = TVP5150_COMPOSITE0, @@ -1448,7 +1448,7 @@ struct em28xx_board em28xx_boards[] = { .decoder = EM28XX_TVP5150, .has_dvb = 1, .dvb_gpio = hauppauge_wintv_hvr_900_digital, - .ir_codes = &IR_KEYTABLE(terratec_cinergy_xs), + .ir_codes = RC_MAP_TERRATEC_CINERGY_XS, .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, .input = { { .type = EM28XX_VMUX_TELEVISION, @@ -1541,7 +1541,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .decoder = EM28XX_TVP5150, .tuner_gpio = default_tuner_gpio, - .ir_codes = &IR_KEYTABLE(kaiomy), + .ir_codes = RC_MAP_KAIOMY, .input = { { .type = EM28XX_VMUX_TELEVISION, .vmux = TVP5150_COMPOSITE0, @@ -1641,7 +1641,7 @@ struct em28xx_board em28xx_boards[] = { .mts_firmware = 1, .has_dvb = 1, .dvb_gpio = evga_indtube_digital, - .ir_codes = &IR_KEYTABLE(evga_indtube), + .ir_codes = RC_MAP_EVGA_INDTUBE, .input = { { .type = EM28XX_VMUX_TELEVISION, .vmux = TVP5150_COMPOSITE0, @@ -2335,21 +2335,21 @@ void em28xx_register_i2c_ir(struct em28xx *dev) switch (dev->model) { case EM2800_BOARD_TERRATEC_CINERGY_200: case EM2820_BOARD_TERRATEC_CINERGY_250: - dev->init_data.ir_codes = &IR_KEYTABLE(em_terratec); + dev->init_data.ir_codes = RC_MAP_EM_TERRATEC; dev->init_data.get_key = em28xx_get_key_terratec; dev->init_data.name = "i2c IR (EM28XX Terratec)"; break; case EM2820_BOARD_PINNACLE_USB_2: - dev->init_data.ir_codes = &IR_KEYTABLE(pinnacle_grey); + dev->init_data.ir_codes = RC_MAP_PINNACLE_GREY; dev->init_data.get_key = em28xx_get_key_pinnacle_usb_grey; dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)"; break; case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2: - dev->init_data.ir_codes = &IR_KEYTABLE(rc5_hauppauge_new); + dev->init_data.ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW; dev->init_data.get_key = em28xx_get_key_em_haup; dev->init_data.name = "i2c IR (EM2840 Hauppauge)"; case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE: - dev->init_data.ir_codes = &IR_KEYTABLE(winfast_usbii_deluxe);; + dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE;; dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe; dev->init_data.name = "i2c IR (EM2820 Winfast TV USBII Deluxe)"; break; diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index 6f1fc695c561..e2772a1470cb 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -382,7 +382,6 @@ int em28xx_ir_change_protocol(void *priv, u64 ir_type) /* Adjust xclk based o IR table for RC5/NEC tables */ - dev->board.ir_codes->ir_type = IR_TYPE_OTHER; if (ir_type == IR_TYPE_RC5) { dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE; ir->full_code = 1; @@ -393,8 +392,6 @@ int em28xx_ir_change_protocol(void *priv, u64 ir_type) } else rc = -EINVAL; - dev->board.ir_codes->ir_type = ir_type; - em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, EM28XX_XCLK_IR_RC5_MODE); @@ -457,7 +454,6 @@ int em28xx_ir_init(struct em28xx *dev) strlcat(ir->phys, "/input0", sizeof(ir->phys)); /* Set IR protocol */ - em28xx_ir_change_protocol(ir, dev->board.ir_codes->ir_type); err = ir_input_init(input_dev, &ir->ir, IR_TYPE_OTHER); if (err < 0) goto err_out_free; @@ -475,7 +471,7 @@ int em28xx_ir_init(struct em28xx *dev) em28xx_ir_start(ir); /* all done */ - err = __ir_input_register(ir->input, dev->board.ir_codes, + err = ir_input_register(ir->input, dev->board.ir_codes, &ir->props, MODULE_NAME); if (err) goto err_out_stop; diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index eec12910c8cf..b252d1b1b2a7 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h @@ -412,7 +412,7 @@ struct em28xx_board { struct em28xx_input input[MAX_EM28XX_INPUT]; struct em28xx_input radio; - struct ir_scancode_table *ir_codes; + char *ir_codes; }; struct em28xx_eeprom { diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index e6ada5e46dfc..29d439742653 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -297,7 +297,7 @@ static void ir_work(struct work_struct *work) static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct ir_scancode_table *ir_codes = NULL; + char *ir_codes = NULL; const char *name = NULL; u64 ir_type = 0; struct IR_i2c *ir; @@ -322,13 +322,13 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) name = "Pixelview"; ir->get_key = get_key_pixelview; ir_type = IR_TYPE_OTHER; - ir_codes = &IR_KEYTABLE(empty); + ir_codes = RC_MAP_EMPTY; break; case 0x4b: name = "PV951"; ir->get_key = get_key_pv951; ir_type = IR_TYPE_OTHER; - ir_codes = &IR_KEYTABLE(pv951); + ir_codes = RC_MAP_PV951; break; case 0x18: case 0x1f: @@ -337,22 +337,22 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ir->get_key = get_key_haup; ir_type = IR_TYPE_RC5; if (hauppauge == 1) { - ir_codes = &IR_KEYTABLE(hauppauge_new); + ir_codes = RC_MAP_HAUPPAUGE_NEW; } else { - ir_codes = &IR_KEYTABLE(rc5_tv); + ir_codes = RC_MAP_RC5_TV; } break; case 0x30: name = "KNC One"; ir->get_key = get_key_knc1; ir_type = IR_TYPE_OTHER; - ir_codes = &IR_KEYTABLE(empty); + ir_codes = RC_MAP_EMPTY; break; case 0x6b: name = "FusionHDTV"; ir->get_key = get_key_fusionhdtv; ir_type = IR_TYPE_RC5; - ir_codes = &IR_KEYTABLE(fusionhdtv_mce); + ir_codes = RC_MAP_FUSIONHDTV_MCE; break; case 0x0b: case 0x47: @@ -365,9 +365,9 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) ir_type = IR_TYPE_RC5; ir->get_key = get_key_haup_xvr; if (hauppauge == 1) { - ir_codes = &IR_KEYTABLE(hauppauge_new); + ir_codes = RC_MAP_HAUPPAUGE_NEW; } else { - ir_codes = &IR_KEYTABLE(rc5_tv); + ir_codes = RC_MAP_RC5_TV; } } else { /* Handled by saa7134-input */ @@ -379,7 +379,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) name = "AVerMedia Cardbus remote"; ir->get_key = get_key_avermedia_cardbus; ir_type = IR_TYPE_OTHER; - ir_codes = &IR_KEYTABLE(avermedia_cardbus); + ir_codes = RC_MAP_AVERMEDIA_CARDBUS; break; } @@ -447,7 +447,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) input_dev->name = ir->name; input_dev->phys = ir->phys; - err = __ir_input_register(ir->input, ir->ir_codes, NULL, MODULE_NAME); + err = ir_input_register(ir->input, ir->ir_codes, NULL, MODULE_NAME); if (err) goto err_out_free; diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index a363e334a50e..a5b92d109c6c 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c @@ -193,7 +193,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) /* Our default information for ir-kbd-i2c.c to use */ switch (hw) { case IVTV_HW_I2C_IR_RX_AVER: - init_data->ir_codes = &IR_KEYTABLE(avermedia_cardbus); + init_data->ir_codes = RC_MAP_AVERMEDIA_CARDBUS; init_data->internal_get_key_func = IR_KBD_GET_KEY_AVERMEDIA_CARDBUS; init_data->type = IR_TYPE_OTHER; @@ -202,14 +202,14 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr) case IVTV_HW_I2C_IR_RX_HAUP_EXT: case IVTV_HW_I2C_IR_RX_HAUP_INT: /* Default to old black remote */ - init_data->ir_codes = &IR_KEYTABLE(rc5_tv); + init_data->ir_codes = RC_MAP_RC5_TV; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; init_data->type = IR_TYPE_RC5; init_data->name = itv->card_name; break; case IVTV_HW_Z8F0811_IR_RX_HAUP: /* Default to grey remote */ - init_data->ir_codes = &IR_KEYTABLE(hauppauge_new); + init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; init_data->type = IR_TYPE_RC5; init_data->name = itv->card_name; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index bf6751c760b4..f46dca3ccf79 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -587,7 +587,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) { struct card_ir *ir; struct input_dev *input_dev; - struct ir_scancode_table *ir_codes = NULL; + char *ir_codes = NULL; u32 mask_keycode = 0; u32 mask_keydown = 0; u32 mask_keyup = 0; @@ -595,6 +595,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) int rc5_gpio = 0; int nec_gpio = 0; int raw_decode = 0; + int allow_protocol_change = 0; u64 ir_type = IR_TYPE_OTHER; int err; @@ -610,27 +611,27 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_FLYTVPLATINUM_FM: case SAA7134_BOARD_FLYTVPLATINUM_MINI2: case SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM: - ir_codes = &IR_KEYTABLE(flyvideo); + ir_codes = RC_MAP_FLYVIDEO; mask_keycode = 0xEC00000; mask_keydown = 0x0040000; break; case SAA7134_BOARD_CINERGY400: case SAA7134_BOARD_CINERGY600: case SAA7134_BOARD_CINERGY600_MK3: - ir_codes = &IR_KEYTABLE(cinergy); + ir_codes = RC_MAP_CINERGY; mask_keycode = 0x00003f; mask_keyup = 0x040000; break; case SAA7134_BOARD_ECS_TVP3XP: case SAA7134_BOARD_ECS_TVP3XP_4CB5: - ir_codes = &IR_KEYTABLE(eztv); + ir_codes = RC_MAP_EZTV; mask_keycode = 0x00017c; mask_keyup = 0x000002; polling = 50; // ms break; case SAA7134_BOARD_KWORLD_XPERT: case SAA7134_BOARD_AVACSSMARTTV: - ir_codes = &IR_KEYTABLE(pixelview); + ir_codes = RC_MAP_PIXELVIEW; mask_keycode = 0x00001F; mask_keyup = 0x000020; polling = 50; // ms @@ -647,7 +648,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_AVERMEDIA_GO_007_FM: case SAA7134_BOARD_AVERMEDIA_M102: case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS: - ir_codes = &IR_KEYTABLE(avermedia); + ir_codes = RC_MAP_AVERMEDIA; mask_keycode = 0x0007C8; mask_keydown = 0x000010; polling = 50; // ms @@ -656,14 +657,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); break; case SAA7134_BOARD_AVERMEDIA_M135A: - ir_codes = &IR_KEYTABLE(avermedia_m135a_rm_jx); + ir_codes = RC_MAP_AVERMEDIA_M135A_RM_JX; mask_keydown = 0x0040000; mask_keycode = 0xffff; raw_decode = 1; break; case SAA7134_BOARD_AVERMEDIA_777: case SAA7134_BOARD_AVERMEDIA_A16AR: - ir_codes = &IR_KEYTABLE(avermedia); + ir_codes = RC_MAP_AVERMEDIA; mask_keycode = 0x02F200; mask_keydown = 0x000400; polling = 50; // ms @@ -672,7 +673,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); break; case SAA7134_BOARD_AVERMEDIA_A16D: - ir_codes = &IR_KEYTABLE(avermedia_a16d); + ir_codes = RC_MAP_AVERMEDIA_A16D; mask_keycode = 0x02F200; mask_keydown = 0x000400; polling = 50; /* ms */ @@ -681,14 +682,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1); break; case SAA7134_BOARD_KWORLD_TERMINATOR: - ir_codes = &IR_KEYTABLE(pixelview); + ir_codes = RC_MAP_PIXELVIEW; mask_keycode = 0x00001f; mask_keyup = 0x000060; polling = 50; // ms break; case SAA7134_BOARD_MANLI_MTV001: case SAA7134_BOARD_MANLI_MTV002: - ir_codes = &IR_KEYTABLE(manli); + ir_codes = RC_MAP_MANLI; mask_keycode = 0x001f00; mask_keyup = 0x004000; polling = 50; /* ms */ @@ -708,25 +709,25 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_BEHOLD_507_9FM: case SAA7134_BOARD_BEHOLD_507RDS_MK3: case SAA7134_BOARD_BEHOLD_507RDS_MK5: - ir_codes = &IR_KEYTABLE(manli); + ir_codes = RC_MAP_MANLI; mask_keycode = 0x003f00; mask_keyup = 0x004000; polling = 50; /* ms */ break; case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM: - ir_codes = &IR_KEYTABLE(behold_columbus); + ir_codes = RC_MAP_BEHOLD_COLUMBUS; mask_keycode = 0x003f00; mask_keyup = 0x004000; polling = 50; // ms break; case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: - ir_codes = &IR_KEYTABLE(pctv_sedna); + ir_codes = RC_MAP_PCTV_SEDNA; mask_keycode = 0x001f00; mask_keyup = 0x004000; polling = 50; // ms break; case SAA7134_BOARD_GOTVIEW_7135: - ir_codes = &IR_KEYTABLE(gotview7135); + ir_codes = RC_MAP_GOTVIEW7135; mask_keycode = 0x0003CC; mask_keydown = 0x000010; polling = 5; /* ms */ @@ -735,80 +736,80 @@ int saa7134_input_init1(struct saa7134_dev *dev) case SAA7134_BOARD_VIDEOMATE_TV_PVR: case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS: case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII: - ir_codes = &IR_KEYTABLE(videomate_tv_pvr); + ir_codes = RC_MAP_VIDEOMATE_TV_PVR; mask_keycode = 0x00003F; mask_keyup = 0x400000; polling = 50; // ms break; case SAA7134_BOARD_PROTEUS_2309: - ir_codes = &IR_KEYTABLE(proteus_2309); + ir_codes = RC_MAP_PROTEUS_2309; mask_keycode = 0x00007F; mask_keyup = 0x000080; polling = 50; // ms break; case SAA7134_BOARD_VIDEOMATE_DVBT_300: case SAA7134_BOARD_VIDEOMATE_DVBT_200: - ir_codes = &IR_KEYTABLE(videomate_tv_pvr); + ir_codes = RC_MAP_VIDEOMATE_TV_PVR; mask_keycode = 0x003F00; mask_keyup = 0x040000; break; case SAA7134_BOARD_FLYDVBS_LR300: case SAA7134_BOARD_FLYDVBT_LR301: case SAA7134_BOARD_FLYDVBTDUO: - ir_codes = &IR_KEYTABLE(flydvb); + ir_codes = RC_MAP_FLYDVB; mask_keycode = 0x0001F00; mask_keydown = 0x0040000; break; case SAA7134_BOARD_ASUSTeK_P7131_DUAL: case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: case SAA7134_BOARD_ASUSTeK_P7131_ANALOG: - ir_codes = &IR_KEYTABLE(asus_pc39); + ir_codes = RC_MAP_ASUS_PC39; mask_keydown = 0x0040000; rc5_gpio = 1; break; case SAA7134_BOARD_ENCORE_ENLTV: case SAA7134_BOARD_ENCORE_ENLTV_FM: - ir_codes = &IR_KEYTABLE(encore_enltv); + ir_codes = RC_MAP_ENCORE_ENLTV; mask_keycode = 0x00007f; mask_keyup = 0x040000; polling = 50; // ms break; case SAA7134_BOARD_ENCORE_ENLTV_FM53: - ir_codes = &IR_KEYTABLE(encore_enltv_fm53); + ir_codes = RC_MAP_ENCORE_ENLTV_FM53; mask_keydown = 0x0040000; mask_keycode = 0x00007f; nec_gpio = 1; break; case SAA7134_BOARD_10MOONSTVMASTER3: - ir_codes = &IR_KEYTABLE(encore_enltv); + ir_codes = RC_MAP_ENCORE_ENLTV; mask_keycode = 0x5f80000; mask_keyup = 0x8000000; polling = 50; //ms break; case SAA7134_BOARD_GENIUS_TVGO_A11MCE: - ir_codes = &IR_KEYTABLE(genius_tvgo_a11mce); + ir_codes = RC_MAP_GENIUS_TVGO_A11MCE; mask_keycode = 0xff; mask_keydown = 0xf00000; polling = 50; /* ms */ break; case SAA7134_BOARD_REAL_ANGEL_220: - ir_codes = &IR_KEYTABLE(real_audio_220_32_keys); + ir_codes = RC_MAP_REAL_AUDIO_220_32_KEYS; mask_keycode = 0x3f00; mask_keyup = 0x4000; polling = 50; /* ms */ break; case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: - ir_codes = &IR_KEYTABLE(kworld_plus_tv_analog); + ir_codes = RC_MAP_KWORLD_PLUS_TV_ANALOG; mask_keycode = 0x7f; polling = 40; /* ms */ break; case SAA7134_BOARD_VIDEOMATE_S350: - ir_codes = &IR_KEYTABLE(videomate_s350); + ir_codes = RC_MAP_VIDEOMATE_S350; mask_keycode = 0x003f00; mask_keydown = 0x040000; break; case SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S: - ir_codes = &IR_KEYTABLE(winfast); + ir_codes = RC_MAP_WINFAST; mask_keycode = 0x5f00; mask_keyup = 0x020000; polling = 50; /* ms */ @@ -853,13 +854,11 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->props.open = saa7134_ir_open; ir->props.close = saa7134_ir_close; - if (ir_codes->ir_type != IR_TYPE_OTHER && !raw_decode) { + if (!raw_decode && allow_protocol_change) { ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; ir->props.change_protocol = saa7134_ir_change_protocol; - - /* Set IR protocol */ - saa7134_ir_change_protocol(ir->props.priv, ir_codes->ir_type); } + err = ir_input_init(input_dev, &ir->ir, ir_type); if (err < 0) goto err_out_free; @@ -877,10 +876,10 @@ int saa7134_input_init1(struct saa7134_dev *dev) } input_dev->dev.parent = &dev->pci->dev; - err = __ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); + err = ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); if (err) goto err_out_free; - if (ir_codes->ir_type != IR_TYPE_OTHER) { + if (raw_decode) { err = ir_raw_event_register(ir->dev); if (err) goto err_out_free; @@ -938,24 +937,24 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) dev->init_data.name = "Pinnacle PCTV"; if (pinnacle_remote == 0) { dev->init_data.get_key = get_key_pinnacle_color; - dev->init_data.ir_codes = &IR_KEYTABLE(pinnacle_color); + dev->init_data.ir_codes = RC_MAP_PINNACLE_COLOR; info.addr = 0x47; } else { dev->init_data.get_key = get_key_pinnacle_grey; - dev->init_data.ir_codes = &IR_KEYTABLE(pinnacle_grey); + dev->init_data.ir_codes = RC_MAP_PINNACLE_GREY; info.addr = 0x47; } break; case SAA7134_BOARD_UPMOST_PURPLE_TV: dev->init_data.name = "Purple TV"; dev->init_data.get_key = get_key_purpletv; - dev->init_data.ir_codes = &IR_KEYTABLE(purpletv); + dev->init_data.ir_codes = RC_MAP_PURPLETV; info.addr = 0x7a; break; case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS: dev->init_data.name = "MSI TV@nywhere Plus"; dev->init_data.get_key = get_key_msi_tvanywhere_plus; - dev->init_data.ir_codes = &IR_KEYTABLE(msi_tvanywhere_plus); + dev->init_data.ir_codes = RC_MAP_MSI_TVANYWHERE_PLUS; info.addr = 0x30; /* MSI TV@nywhere Plus controller doesn't seem to respond to probes unless we read something from @@ -969,7 +968,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) case SAA7134_BOARD_HAUPPAUGE_HVR1110: dev->init_data.name = "HVR 1110"; dev->init_data.get_key = get_key_hvr1110; - dev->init_data.ir_codes = &IR_KEYTABLE(hauppauge_new); + dev->init_data.ir_codes = RC_MAP_HAUPPAUGE_NEW; info.addr = 0x71; break; case SAA7134_BOARD_BEHOLD_607FM_MK3: @@ -987,7 +986,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) case SAA7134_BOARD_BEHOLD_X7: dev->init_data.name = "BeholdTV"; dev->init_data.get_key = get_key_beholdm6xx; - dev->init_data.ir_codes = &IR_KEYTABLE(behold); + dev->init_data.ir_codes = RC_MAP_BEHOLD; dev->init_data.type = IR_TYPE_NEC; info.addr = 0x2d; break; @@ -998,7 +997,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) case SAA7134_BOARD_FLYDVB_TRIO: dev->init_data.name = "FlyDVB Trio"; dev->init_data.get_key = get_key_flydvb_trio; - dev->init_data.ir_codes = &IR_KEYTABLE(flydvb); + dev->init_data.ir_codes = RC_MAP_FLYDVB; info.addr = 0x0b; break; default: diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 8e975f24dae1..e1772b8230c9 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -21,6 +21,7 @@ #include #include #include +#include extern int ir_core_debug; #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ @@ -124,6 +125,7 @@ EXPORT_SYMBOL_GPL(IR_KEYTABLE(tabname)) int ir_register_map(struct rc_keymap *map); void ir_unregister_map(struct rc_keymap *map); struct ir_scancode_table *get_rc_map(const char *name); +void rc_map_init(void); /* Routines from ir-keytable.c */ @@ -141,15 +143,30 @@ static inline int ir_input_register(struct input_dev *dev, const struct ir_dev_props *props, const char *driver_name) { struct ir_scancode_table *ir_codes; + struct ir_input_dev *ir_dev; + int rc; + + if (!map_name) + return -EINVAL; ir_codes = get_rc_map(map_name); if (!ir_codes) return -EINVAL; - return __ir_input_register(dev, ir_codes, props, driver_name); + rc = __ir_input_register(dev, ir_codes, props, driver_name); + if (rc < 0) + return -EINVAL; + + ir_dev = input_get_drvdata(dev); + + if (!rc && ir_dev->props && ir_dev->props->change_protocol) + rc = ir_dev->props->change_protocol(ir_dev->props->priv, + ir_codes->ir_type); + + return rc; } - void ir_input_unregister(struct input_dev *input_dev); +void ir_input_unregister(struct input_dev *input_dev); /* Routines from ir-sysfs.c */ diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 9142936603cc..057ff64f349d 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h @@ -6,7 +6,7 @@ struct IR_i2c; struct IR_i2c { - struct ir_scancode_table *ir_codes; + char *ir_codes; struct i2c_client *c; struct input_dev *input; @@ -34,7 +34,7 @@ enum ir_kbd_get_key_fn { /* Can be passed when instantiating an ir_video i2c device */ struct IR_i2c_init_data { - struct ir_scancode_table *ir_codes; + char *ir_codes; const char *name; u64 type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ /* diff --git a/include/media/rc-map.h b/include/media/rc-map.h new file mode 100644 index 000000000000..9ea0033fa3cc --- /dev/null +++ b/include/media/rc-map.h @@ -0,0 +1,81 @@ +/* + * rc-map.h - define RC map names used by RC drivers + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +#define RC_MAP_ADSTECH_DVB_T_PCI "rc-adstech-dvb-t-pci" +#define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp" +#define RC_MAP_ASUS_PC39 "rc-asus-pc39" +#define RC_MAP_ATI_TV_WONDER_HD_600 "rc-ati-tv-wonder-hd-600" +#define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d" +#define RC_MAP_AVERMEDIA_CARDBUS "rc-avermedia-cardbus" +#define RC_MAP_AVERMEDIA_DVBT "rc-avermedia-dvbt" +#define RC_MAP_AVERMEDIA_M135A_RM_JX "rc-avermedia-m135a-rm-jx" +#define RC_MAP_AVERMEDIA "rc-avermedia" +#define RC_MAP_AVERTV_303 "rc-avertv-303" +#define RC_MAP_BEHOLD_COLUMBUS "rc-behold-columbus" +#define RC_MAP_BEHOLD "rc-behold" +#define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old" +#define RC_MAP_CINERGY_1400 "rc-cinergy-1400" +#define RC_MAP_CINERGY "rc-cinergy" +#define RC_MAP_DM1105_NEC "rc-dm1105-nec" +#define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro" +#define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t" +#define RC_MAP_EMPTY "rc-empty" +#define RC_MAP_EM_TERRATEC "rc-em-terratec" +#define RC_MAP_ENCORE_ENLTV2 "rc-encore-enltv2" +#define RC_MAP_ENCORE_ENLTV_FM53 "rc-encore-enltv-fm53" +#define RC_MAP_ENCORE_ENLTV "rc-encore-enltv" +#define RC_MAP_EVGA_INDTUBE "rc-evga-indtube" +#define RC_MAP_EZTV "rc-eztv" +#define RC_MAP_FLYDVB "rc-flydvb" +#define RC_MAP_FLYVIDEO "rc-flyvideo" +#define RC_MAP_FUSIONHDTV_MCE "rc-fusionhdtv-mce" +#define RC_MAP_GADMEI_RM008Z "rc-gadmei-rm008z" +#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce" +#define RC_MAP_GOTVIEW7135 "rc-gotview7135" +#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge-new" +#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e" +#define RC_MAP_KAIOMY "rc-kaiomy" +#define RC_MAP_KWORLD_315U "rc-kworld-315u" +#define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" +#define RC_MAP_MANLI "rc-manli" +#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus" +#define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere" +#define RC_MAP_NEBULA "rc-nebula" +#define RC_MAP_NEC_TERRATEC_CINERGY_XS "rc-nec-terratec-cinergy-xs" +#define RC_MAP_NORWOOD "rc-norwood" +#define RC_MAP_NPGTECH "rc-npgtech" +#define RC_MAP_PCTV_SEDNA "rc-pctv-sedna" +#define RC_MAP_PINNACLE_COLOR "rc-pinnacle-color" +#define RC_MAP_PINNACLE_GREY "rc-pinnacle-grey" +#define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd" +#define RC_MAP_PIXELVIEW_NEW "rc-pixelview-new" +#define RC_MAP_PIXELVIEW "rc-pixelview" +#define RC_MAP_POWERCOLOR_REAL_ANGEL "rc-powercolor-real-angel" +#define RC_MAP_PROTEUS_2309 "rc-proteus-2309" +#define RC_MAP_PURPLETV "rc-purpletv" +#define RC_MAP_PV951 "rc-pv951" +#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" +#define RC_MAP_RC5_TV "rc-rc5-tv" +#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" +#define RC_MAP_TBS_NEC "rc-tbs-nec" +#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs" +#define RC_MAP_TEVII_NEC "rc-tevii-nec" +#define RC_MAP_TT_1500 "rc-tt-1500" +#define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350" +#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" +#define RC_MAP_WINFAST "rc-winfast" +#define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe" +/* + * Please, do not just append newer Remote Controller names at the end. + * The names should be ordered in alphabetical order + */ -- GitLab From bd7261d3d7dfe61e8bf8945051c1905ba4dba3b5 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 2 Apr 2010 20:11:45 -0300 Subject: [PATCH 291/534] V4L/DVB: ir-common: remove keymap tables from the module Now that the remote keymaps were broken into separate modules, get rid of the keycode tables that were hardcoded into ir-common. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/Makefile | 2 +- drivers/media/IR/ir-keymaps.c | 45 ------- include/media/ir-common.h | 65 ---------- include/media/ir-core.h | 18 --- include/media/keycodes/adstech-dvb-t-pci.h | 65 ---------- include/media/keycodes/apac-viewcomp.h | 56 --------- include/media/keycodes/asus-pc39.h | 67 ---------- include/media/keycodes/ati-tv-wonder-hd-600.h | 45 ------- include/media/keycodes/avermedia-a16d.h | 52 -------- include/media/keycodes/avermedia-cardbus.h | 73 ----------- include/media/keycodes/avermedia-dvbt.h | 54 -------- .../media/keycodes/avermedia-m135a-rm-jx.h | 66 ---------- include/media/keycodes/avermedia.h | 62 ---------- include/media/keycodes/avertv-303.h | 61 --------- include/media/keycodes/behold-columbus.h | 84 ------------- include/media/keycodes/behold.h | 117 ------------------ include/media/keycodes/budget-ci-old.h | 68 ---------- include/media/keycodes/cinergy-1400.h | 60 --------- include/media/keycodes/cinergy.h | 55 -------- include/media/keycodes/dm1105-nec.h | 52 -------- include/media/keycodes/dntv-live-dvb-t.h | 54 -------- include/media/keycodes/dntv-live-dvbt-pro.h | 73 ----------- include/media/keycodes/em-terratec.h | 46 ------- include/media/keycodes/empty.h | 20 --- include/media/keycodes/encore-enltv-fm53.h | 57 --------- include/media/keycodes/encore-enltv.h | 88 ------------- include/media/keycodes/encore-enltv2.h | 66 ---------- include/media/keycodes/evga-indtube.h | 37 ------ include/media/keycodes/eztv.h | 72 ----------- include/media/keycodes/flydvb.h | 54 -------- include/media/keycodes/flyvideo.h | 47 ------- include/media/keycodes/fusionhdtv-mce.h | 74 ----------- include/media/keycodes/gadmei-rm008z.h | 57 --------- include/media/keycodes/genius-tvgo-a11mce.h | 60 --------- include/media/keycodes/gotview7135.h | 55 -------- include/media/keycodes/hauppauge-new.h | 76 ------------ include/media/keycodes/iodata-bctv7e.h | 64 ---------- include/media/keycodes/kaiomy.h | 63 ---------- include/media/keycodes/kworld-315u.h | 59 --------- .../media/keycodes/kworld-plus-tv-analog.h | 75 ----------- include/media/keycodes/manli.h | 111 ----------------- include/media/keycodes/msi-tvanywhere-plus.h | 100 --------------- include/media/keycodes/msi-tvanywhere.h | 44 ------- include/media/keycodes/nebula.h | 73 ----------- .../media/keycodes/nec-terratec-cinergy-xs.h | 81 ------------ include/media/keycodes/norwood.h | 61 --------- include/media/keycodes/npgtech.h | 57 --------- include/media/keycodes/pctv-sedna.h | 56 --------- include/media/keycodes/pinnacle-color.h | 71 ----------- include/media/keycodes/pinnacle-grey.h | 66 ---------- include/media/keycodes/pinnacle-pctv-hd.h | 49 -------- include/media/keycodes/pixelview-new.h | 59 --------- include/media/keycodes/pixelview.h | 59 --------- .../media/keycodes/powercolor-real-angel.h | 57 --------- include/media/keycodes/proteus-2309.h | 45 ------- include/media/keycodes/purpletv.h | 58 --------- include/media/keycodes/pv951.h | 54 -------- include/media/keycodes/rc5-hauppauge-new.h | 79 ------------ include/media/keycodes/rc5-tv.h | 57 --------- .../media/keycodes/real-audio-220-32-keys.h | 54 -------- include/media/keycodes/tbs-nec.h | 50 -------- include/media/keycodes/terratec-cinergy-xs.h | 68 ---------- include/media/keycodes/tevii-nec.h | 65 ---------- include/media/keycodes/tt-1500.h | 58 --------- include/media/keycodes/videomate-s350.h | 62 ---------- include/media/keycodes/videomate-tv-pvr.h | 64 ---------- include/media/keycodes/winfast-usbii-deluxe.h | 58 --------- include/media/keycodes/winfast.h | 78 ------------ 68 files changed, 1 insertion(+), 4157 deletions(-) delete mode 100644 drivers/media/IR/ir-keymaps.c delete mode 100644 include/media/keycodes/adstech-dvb-t-pci.h delete mode 100644 include/media/keycodes/apac-viewcomp.h delete mode 100644 include/media/keycodes/asus-pc39.h delete mode 100644 include/media/keycodes/ati-tv-wonder-hd-600.h delete mode 100644 include/media/keycodes/avermedia-a16d.h delete mode 100644 include/media/keycodes/avermedia-cardbus.h delete mode 100644 include/media/keycodes/avermedia-dvbt.h delete mode 100644 include/media/keycodes/avermedia-m135a-rm-jx.h delete mode 100644 include/media/keycodes/avermedia.h delete mode 100644 include/media/keycodes/avertv-303.h delete mode 100644 include/media/keycodes/behold-columbus.h delete mode 100644 include/media/keycodes/behold.h delete mode 100644 include/media/keycodes/budget-ci-old.h delete mode 100644 include/media/keycodes/cinergy-1400.h delete mode 100644 include/media/keycodes/cinergy.h delete mode 100644 include/media/keycodes/dm1105-nec.h delete mode 100644 include/media/keycodes/dntv-live-dvb-t.h delete mode 100644 include/media/keycodes/dntv-live-dvbt-pro.h delete mode 100644 include/media/keycodes/em-terratec.h delete mode 100644 include/media/keycodes/empty.h delete mode 100644 include/media/keycodes/encore-enltv-fm53.h delete mode 100644 include/media/keycodes/encore-enltv.h delete mode 100644 include/media/keycodes/encore-enltv2.h delete mode 100644 include/media/keycodes/evga-indtube.h delete mode 100644 include/media/keycodes/eztv.h delete mode 100644 include/media/keycodes/flydvb.h delete mode 100644 include/media/keycodes/flyvideo.h delete mode 100644 include/media/keycodes/fusionhdtv-mce.h delete mode 100644 include/media/keycodes/gadmei-rm008z.h delete mode 100644 include/media/keycodes/genius-tvgo-a11mce.h delete mode 100644 include/media/keycodes/gotview7135.h delete mode 100644 include/media/keycodes/hauppauge-new.h delete mode 100644 include/media/keycodes/iodata-bctv7e.h delete mode 100644 include/media/keycodes/kaiomy.h delete mode 100644 include/media/keycodes/kworld-315u.h delete mode 100644 include/media/keycodes/kworld-plus-tv-analog.h delete mode 100644 include/media/keycodes/manli.h delete mode 100644 include/media/keycodes/msi-tvanywhere-plus.h delete mode 100644 include/media/keycodes/msi-tvanywhere.h delete mode 100644 include/media/keycodes/nebula.h delete mode 100644 include/media/keycodes/nec-terratec-cinergy-xs.h delete mode 100644 include/media/keycodes/norwood.h delete mode 100644 include/media/keycodes/npgtech.h delete mode 100644 include/media/keycodes/pctv-sedna.h delete mode 100644 include/media/keycodes/pinnacle-color.h delete mode 100644 include/media/keycodes/pinnacle-grey.h delete mode 100644 include/media/keycodes/pinnacle-pctv-hd.h delete mode 100644 include/media/keycodes/pixelview-new.h delete mode 100644 include/media/keycodes/pixelview.h delete mode 100644 include/media/keycodes/powercolor-real-angel.h delete mode 100644 include/media/keycodes/proteus-2309.h delete mode 100644 include/media/keycodes/purpletv.h delete mode 100644 include/media/keycodes/pv951.h delete mode 100644 include/media/keycodes/rc5-hauppauge-new.h delete mode 100644 include/media/keycodes/rc5-tv.h delete mode 100644 include/media/keycodes/real-audio-220-32-keys.h delete mode 100644 include/media/keycodes/tbs-nec.h delete mode 100644 include/media/keycodes/terratec-cinergy-xs.h delete mode 100644 include/media/keycodes/tevii-nec.h delete mode 100644 include/media/keycodes/tt-1500.h delete mode 100644 include/media/keycodes/videomate-s350.h delete mode 100644 include/media/keycodes/videomate-tv-pvr.h delete mode 100644 include/media/keycodes/winfast-usbii-deluxe.h delete mode 100644 include/media/keycodes/winfast.h diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile index 3d8dd306df46..0e3f912054ca 100644 --- a/drivers/media/IR/Makefile +++ b/drivers/media/IR/Makefile @@ -1,4 +1,4 @@ -ir-common-objs := ir-functions.o ir-keymaps.o +ir-common-objs := ir-functions.o ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o rc-map.o obj-y += keymaps/ diff --git a/drivers/media/IR/ir-keymaps.c b/drivers/media/IR/ir-keymaps.c deleted file mode 100644 index eb2553192789..000000000000 --- a/drivers/media/IR/ir-keymaps.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - Keytables for supported remote controls, used on drivers/media - devices. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#define IR_KEYMAPS - -/* - * NOTICE FOR DEVELOPERS: - * The IR mappings should be as close as possible to what's - * specified at: - * http://linuxtv.org/wiki/index.php/Remote_Controllers - * - * The usage of tables with just the command part is deprecated. - * All new IR keytables should contain address+command and need - * to define the proper IR_TYPE (IR_TYPE_RC5/IR_TYPE_NEC). - * The deprecated tables should use IR_TYPE_UNKNOWN - */ -#include - -#include -#include - -/* - * All keytables got moved to include/media/keytables directory. - * This file is still needed - at least for now, as their data is - * dynamically inserted here by the media/ir-common.h, due to the - * #define IR_KEYMAPS line, at the beginning of this file. The - * plans are to get rid of this file completely in a near future. - */ - diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 59ce30280b72..528050e39ad9 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h @@ -28,71 +28,6 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #define RC5_START(x) (((x)>>12)&3) #define RC5_TOGGLE(x) (((x)>>11)&1) #define RC5_ADDR(x) (((x)>>6)&31) diff --git a/include/media/ir-core.h b/include/media/ir-core.h index e1772b8230c9..c6b8e179dfe0 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -102,24 +102,6 @@ struct ir_raw_handler { #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) -#define IR_KEYTABLE(a) \ -ir_codes_ ## a ## _table - -#define DECLARE_IR_KEYTABLE(a) \ -extern struct ir_scancode_table IR_KEYTABLE(a) - -#define DEFINE_IR_KEYTABLE(tabname, type) \ -struct ir_scancode_table IR_KEYTABLE(tabname) = { \ - .scan = tabname, \ - .size = ARRAY_SIZE(tabname), \ - .ir_type = type, \ - .name = #tabname, \ -}; \ -EXPORT_SYMBOL_GPL(IR_KEYTABLE(tabname)) - -#define DEFINE_LEGACY_IR_KEYTABLE(tabname) \ - DEFINE_IR_KEYTABLE(tabname, IR_TYPE_UNKNOWN) - /* Routines from rc-map.c */ int ir_register_map(struct rc_keymap *map); diff --git a/include/media/keycodes/adstech-dvb-t-pci.h b/include/media/keycodes/adstech-dvb-t-pci.h deleted file mode 100644 index cfca5262d431..000000000000 --- a/include/media/keycodes/adstech-dvb-t-pci.h +++ /dev/null @@ -1,65 +0,0 @@ -/* adstech-dvb-t-pci.h - Keytable for adstech_dvb_t_pci Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* ADS Tech Instant TV DVB-T PCI Remote */ - -#ifdef IR_KEYMAPS -static struct ir_scancode adstech_dvb_t_pci[] = { - /* Keys 0 to 9 */ - { 0x4d, KEY_0 }, - { 0x57, KEY_1 }, - { 0x4f, KEY_2 }, - { 0x53, KEY_3 }, - { 0x56, KEY_4 }, - { 0x4e, KEY_5 }, - { 0x5e, KEY_6 }, - { 0x54, KEY_7 }, - { 0x4c, KEY_8 }, - { 0x5c, KEY_9 }, - - { 0x5b, KEY_POWER }, - { 0x5f, KEY_MUTE }, - { 0x55, KEY_GOTO }, - { 0x5d, KEY_SEARCH }, - { 0x17, KEY_EPG }, /* Guide */ - { 0x1f, KEY_MENU }, - { 0x0f, KEY_UP }, - { 0x46, KEY_DOWN }, - { 0x16, KEY_LEFT }, - { 0x1e, KEY_RIGHT }, - { 0x0e, KEY_SELECT }, /* Enter */ - { 0x5a, KEY_INFO }, - { 0x52, KEY_EXIT }, - { 0x59, KEY_PREVIOUS }, - { 0x51, KEY_NEXT }, - { 0x58, KEY_REWIND }, - { 0x50, KEY_FORWARD }, - { 0x44, KEY_PLAYPAUSE }, - { 0x07, KEY_STOP }, - { 0x1b, KEY_RECORD }, - { 0x13, KEY_TUNER }, /* Live */ - { 0x0a, KEY_A }, - { 0x12, KEY_B }, - { 0x03, KEY_PROG1 }, /* 1 */ - { 0x01, KEY_PROG2 }, /* 2 */ - { 0x00, KEY_PROG3 }, /* 3 */ - { 0x06, KEY_DVD }, - { 0x48, KEY_AUX }, /* Photo */ - { 0x40, KEY_VIDEO }, - { 0x19, KEY_AUDIO }, /* Music */ - { 0x0b, KEY_CHANNELUP }, - { 0x08, KEY_CHANNELDOWN }, - { 0x15, KEY_VOLUMEUP }, - { 0x1c, KEY_VOLUMEDOWN }, -}; -DEFINE_LEGACY_IR_KEYTABLE(adstech_dvb_t_pci); -#else -DECLARE_IR_KEYTABLE(adstech_dvb_t_pci); -#endif diff --git a/include/media/keycodes/apac-viewcomp.h b/include/media/keycodes/apac-viewcomp.h deleted file mode 100644 index 69460c2266ea..000000000000 --- a/include/media/keycodes/apac-viewcomp.h +++ /dev/null @@ -1,56 +0,0 @@ -/* apac-viewcomp.h - Keytable for apac_viewcomp Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Attila Kondoros */ - -#ifdef IR_KEYMAPS -static struct ir_scancode apac_viewcomp[] = { - - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x00, KEY_0 }, - { 0x17, KEY_LAST }, /* +100 */ - { 0x0a, KEY_LIST }, /* recall */ - - - { 0x1c, KEY_TUNER }, /* TV/FM */ - { 0x15, KEY_SEARCH }, /* scan */ - { 0x12, KEY_POWER }, /* power */ - { 0x1f, KEY_VOLUMEDOWN }, /* vol up */ - { 0x1b, KEY_VOLUMEUP }, /* vol down */ - { 0x1e, KEY_CHANNELDOWN }, /* chn up */ - { 0x1a, KEY_CHANNELUP }, /* chn down */ - - { 0x11, KEY_VIDEO }, /* video */ - { 0x0f, KEY_ZOOM }, /* full screen */ - { 0x13, KEY_MUTE }, /* mute/unmute */ - { 0x10, KEY_TEXT }, /* min */ - - { 0x0d, KEY_STOP }, /* freeze */ - { 0x0e, KEY_RECORD }, /* record */ - { 0x1d, KEY_PLAYPAUSE }, /* stop */ - { 0x19, KEY_PLAY }, /* play */ - - { 0x16, KEY_GOTO }, /* osd */ - { 0x14, KEY_REFRESH }, /* default */ - { 0x0c, KEY_KPPLUS }, /* fine tune >>>> */ - { 0x18, KEY_KPMINUS }, /* fine tune <<<< */ -}; -DEFINE_LEGACY_IR_KEYTABLE(apac_viewcomp); -#else -DECLARE_IR_KEYTABLE(apac_viewcomp); -#endif diff --git a/include/media/keycodes/asus-pc39.h b/include/media/keycodes/asus-pc39.h deleted file mode 100644 index 3e89ccd40893..000000000000 --- a/include/media/keycodes/asus-pc39.h +++ /dev/null @@ -1,67 +0,0 @@ -/* asus-pc39.h - Keytable for asus_pc39 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - * Marc Fargas - * this is the remote control that comes with the asus p7131 - * which has a label saying is "Model PC-39" - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode asus_pc39[] = { - /* Keys 0 to 9 */ - { 0x15, KEY_0 }, - { 0x29, KEY_1 }, - { 0x2d, KEY_2 }, - { 0x2b, KEY_3 }, - { 0x09, KEY_4 }, - { 0x0d, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x31, KEY_7 }, - { 0x35, KEY_8 }, - { 0x33, KEY_9 }, - - { 0x3e, KEY_RADIO }, /* radio */ - { 0x03, KEY_MENU }, /* dvd/menu */ - { 0x2a, KEY_VOLUMEUP }, - { 0x19, KEY_VOLUMEDOWN }, - { 0x37, KEY_UP }, - { 0x3b, KEY_DOWN }, - { 0x27, KEY_LEFT }, - { 0x2f, KEY_RIGHT }, - { 0x25, KEY_VIDEO }, /* video */ - { 0x39, KEY_AUDIO }, /* music */ - - { 0x21, KEY_TV }, /* tv */ - { 0x1d, KEY_EXIT }, /* back */ - { 0x0a, KEY_CHANNELUP }, /* channel / program + */ - { 0x1b, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x1a, KEY_ENTER }, /* enter */ - - { 0x06, KEY_PAUSE }, /* play/pause */ - { 0x1e, KEY_PREVIOUS }, /* rew */ - { 0x26, KEY_NEXT }, /* forward */ - { 0x0e, KEY_REWIND }, /* backward << */ - { 0x3a, KEY_FASTFORWARD }, /* forward >> */ - { 0x36, KEY_STOP }, - { 0x2e, KEY_RECORD }, /* recording */ - { 0x16, KEY_POWER }, /* the button that reads "close" */ - - { 0x11, KEY_ZOOM }, /* full screen */ - { 0x13, KEY_MACRO }, /* recall */ - { 0x23, KEY_HOME }, /* home */ - { 0x05, KEY_PVR }, /* picture */ - { 0x3d, KEY_MUTE }, /* mute */ - { 0x01, KEY_DVD }, /* dvd */ -}; -DEFINE_LEGACY_IR_KEYTABLE(asus_pc39); -#else -DECLARE_IR_KEYTABLE(asus_pc39); -#endif diff --git a/include/media/keycodes/ati-tv-wonder-hd-600.h b/include/media/keycodes/ati-tv-wonder-hd-600.h deleted file mode 100644 index 25db7bfcc1a9..000000000000 --- a/include/media/keycodes/ati-tv-wonder-hd-600.h +++ /dev/null @@ -1,45 +0,0 @@ -/* ati-tv-wonder-hd-600.h - Keytable for ati_tv_wonder_hd_600 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* ATI TV Wonder HD 600 USB - Devin Heitmueller - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode ati_tv_wonder_hd_600[] = { - { 0x00, KEY_RECORD}, /* Row 1 */ - { 0x01, KEY_PLAYPAUSE}, - { 0x02, KEY_STOP}, - { 0x03, KEY_POWER}, - { 0x04, KEY_PREVIOUS}, /* Row 2 */ - { 0x05, KEY_REWIND}, - { 0x06, KEY_FORWARD}, - { 0x07, KEY_NEXT}, - { 0x08, KEY_EPG}, /* Row 3 */ - { 0x09, KEY_HOME}, - { 0x0a, KEY_MENU}, - { 0x0b, KEY_CHANNELUP}, - { 0x0c, KEY_BACK}, /* Row 4 */ - { 0x0d, KEY_UP}, - { 0x0e, KEY_INFO}, - { 0x0f, KEY_CHANNELDOWN}, - { 0x10, KEY_LEFT}, /* Row 5 */ - { 0x11, KEY_SELECT}, - { 0x12, KEY_RIGHT}, - { 0x13, KEY_VOLUMEUP}, - { 0x14, KEY_LAST}, /* Row 6 */ - { 0x15, KEY_DOWN}, - { 0x16, KEY_MUTE}, - { 0x17, KEY_VOLUMEDOWN}, -}; -DEFINE_LEGACY_IR_KEYTABLE(ati_tv_wonder_hd_600); -#else -DECLARE_IR_KEYTABLE(ati_tv_wonder_hd_600); -#endif diff --git a/include/media/keycodes/avermedia-a16d.h b/include/media/keycodes/avermedia-a16d.h deleted file mode 100644 index d267951665db..000000000000 --- a/include/media/keycodes/avermedia-a16d.h +++ /dev/null @@ -1,52 +0,0 @@ -/* avermedia-a16d.h - Keytable for avermedia_a16d Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode avermedia_a16d[] = { - { 0x20, KEY_LIST}, - { 0x00, KEY_POWER}, - { 0x28, KEY_1}, - { 0x18, KEY_2}, - { 0x38, KEY_3}, - { 0x24, KEY_4}, - { 0x14, KEY_5}, - { 0x34, KEY_6}, - { 0x2c, KEY_7}, - { 0x1c, KEY_8}, - { 0x3c, KEY_9}, - { 0x12, KEY_SUBTITLE}, - { 0x22, KEY_0}, - { 0x32, KEY_REWIND}, - { 0x3a, KEY_SHUFFLE}, - { 0x02, KEY_PRINT}, - { 0x11, KEY_CHANNELDOWN}, - { 0x31, KEY_CHANNELUP}, - { 0x0c, KEY_ZOOM}, - { 0x1e, KEY_VOLUMEDOWN}, - { 0x3e, KEY_VOLUMEUP}, - { 0x0a, KEY_MUTE}, - { 0x04, KEY_AUDIO}, - { 0x26, KEY_RECORD}, - { 0x06, KEY_PLAY}, - { 0x36, KEY_STOP}, - { 0x16, KEY_PAUSE}, - { 0x2e, KEY_REWIND}, - { 0x0e, KEY_FASTFORWARD}, - { 0x30, KEY_TEXT}, - { 0x21, KEY_GREEN}, - { 0x01, KEY_BLUE}, - { 0x08, KEY_EPG}, - { 0x2a, KEY_MENU}, -}; -DEFINE_LEGACY_IR_KEYTABLE(avermedia_a16d); -#else -DECLARE_IR_KEYTABLE(avermedia_a16d); -#endif diff --git a/include/media/keycodes/avermedia-cardbus.h b/include/media/keycodes/avermedia-cardbus.h deleted file mode 100644 index 221049d1a57b..000000000000 --- a/include/media/keycodes/avermedia-cardbus.h +++ /dev/null @@ -1,73 +0,0 @@ -/* avermedia-cardbus.h - Keytable for avermedia_cardbus Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Oldrich Jedlicka */ - -#ifdef IR_KEYMAPS -static struct ir_scancode avermedia_cardbus[] = { - { 0x00, KEY_POWER }, - { 0x01, KEY_TUNER }, /* TV/FM */ - { 0x03, KEY_TEXT }, /* Teletext */ - { 0x04, KEY_EPG }, - { 0x05, KEY_1 }, - { 0x06, KEY_2 }, - { 0x07, KEY_3 }, - { 0x08, KEY_AUDIO }, - { 0x09, KEY_4 }, - { 0x0a, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x0c, KEY_ZOOM }, /* Full screen */ - { 0x0d, KEY_7 }, - { 0x0e, KEY_8 }, - { 0x0f, KEY_9 }, - { 0x10, KEY_PAGEUP }, /* 16-CH PREV */ - { 0x11, KEY_0 }, - { 0x12, KEY_INFO }, - { 0x13, KEY_AGAIN }, /* CH RTN - channel return */ - { 0x14, KEY_MUTE }, - { 0x15, KEY_EDIT }, /* Autoscan */ - { 0x17, KEY_SAVE }, /* Screenshot */ - { 0x18, KEY_PLAYPAUSE }, - { 0x19, KEY_RECORD }, - { 0x1a, KEY_PLAY }, - { 0x1b, KEY_STOP }, - { 0x1c, KEY_FASTFORWARD }, - { 0x1d, KEY_REWIND }, - { 0x1e, KEY_VOLUMEDOWN }, - { 0x1f, KEY_VOLUMEUP }, - { 0x22, KEY_SLEEP }, /* Sleep */ - { 0x23, KEY_ZOOM }, /* Aspect */ - { 0x26, KEY_SCREEN }, /* Pos */ - { 0x27, KEY_ANGLE }, /* Size */ - { 0x28, KEY_SELECT }, /* Select */ - { 0x29, KEY_BLUE }, /* Blue/Picture */ - { 0x2a, KEY_BACKSPACE }, /* Back */ - { 0x2b, KEY_MEDIA }, /* PIP (Picture-in-picture) */ - { 0x2c, KEY_DOWN }, - { 0x2e, KEY_DOT }, - { 0x2f, KEY_TV }, /* Live TV */ - { 0x32, KEY_LEFT }, - { 0x33, KEY_CLEAR }, /* Clear */ - { 0x35, KEY_RED }, /* Red/TV */ - { 0x36, KEY_UP }, - { 0x37, KEY_HOME }, /* Home */ - { 0x39, KEY_GREEN }, /* Green/Video */ - { 0x3d, KEY_YELLOW }, /* Yellow/Music */ - { 0x3e, KEY_OK }, /* Ok */ - { 0x3f, KEY_RIGHT }, - { 0x40, KEY_NEXT }, /* Next */ - { 0x41, KEY_PREVIOUS }, /* Previous */ - { 0x42, KEY_CHANNELDOWN }, /* Channel down */ - { 0x43, KEY_CHANNELUP }, /* Channel up */ -}; -DEFINE_LEGACY_IR_KEYTABLE(avermedia_cardbus); -#else -DECLARE_IR_KEYTABLE(avermedia_cardbus); -#endif diff --git a/include/media/keycodes/avermedia-dvbt.h b/include/media/keycodes/avermedia-dvbt.h deleted file mode 100644 index bdaadf40d2c2..000000000000 --- a/include/media/keycodes/avermedia-dvbt.h +++ /dev/null @@ -1,54 +0,0 @@ -/* avermedia-dvbt.h - Keytable for avermedia_dvbt Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Matt Jesson >' */ - { 0x3a, KEY_RECORD }, /* 'capture' */ - { 0x0a, KEY_MUTE }, /* 'mute' */ - { 0x2c, KEY_RECORD }, /* 'record' */ - { 0x1c, KEY_PAUSE }, /* 'pause' */ - { 0x3c, KEY_STOP }, /* 'stop' */ - { 0x0c, KEY_PLAY }, /* 'play' */ - { 0x2e, KEY_RED }, /* 'red' */ - { 0x01, KEY_BLUE }, /* 'blue' / 'cancel' */ - { 0x0e, KEY_YELLOW }, /* 'yellow' / 'ok' */ - { 0x21, KEY_GREEN }, /* 'green' */ - { 0x11, KEY_CHANNELDOWN }, /* 'channel -' */ - { 0x31, KEY_CHANNELUP }, /* 'channel +' */ - { 0x1e, KEY_VOLUMEDOWN }, /* 'volume -' */ - { 0x3e, KEY_VOLUMEUP }, /* 'volume +' */ -}; -DEFINE_LEGACY_IR_KEYTABLE(avermedia_dvbt); -#else -DECLARE_IR_KEYTABLE(avermedia_dvbt); -#endif diff --git a/include/media/keycodes/avermedia-m135a-rm-jx.h b/include/media/keycodes/avermedia-m135a-rm-jx.h deleted file mode 100644 index 1158598994cf..000000000000 --- a/include/media/keycodes/avermedia-m135a-rm-jx.h +++ /dev/null @@ -1,66 +0,0 @@ -/* avermedia-m135a-rm-jx.h - Keytable for avermedia_m135a_rm_jx Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - * Avermedia M135A with IR model RM-JX - * The same codes exist on both Positivo (BR) and original IR - * Mauro Carvalho Chehab - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode avermedia_m135a_rm_jx[] = { - { 0x0200, KEY_POWER2 }, - { 0x022e, KEY_DOT }, /* '.' */ - { 0x0201, KEY_MODE }, /* TV/FM or SOURCE */ - - { 0x0205, KEY_1 }, - { 0x0206, KEY_2 }, - { 0x0207, KEY_3 }, - { 0x0209, KEY_4 }, - { 0x020a, KEY_5 }, - { 0x020b, KEY_6 }, - { 0x020d, KEY_7 }, - { 0x020e, KEY_8 }, - { 0x020f, KEY_9 }, - { 0x0211, KEY_0 }, - - { 0x0213, KEY_RIGHT }, /* -> or L */ - { 0x0212, KEY_LEFT }, /* <- or R */ - - { 0x0217, KEY_SLEEP }, /* Capturar Imagem or Snapshot */ - { 0x0210, KEY_SHUFFLE }, /* Amostra or 16 chan prev */ - - { 0x0303, KEY_CHANNELUP }, - { 0x0302, KEY_CHANNELDOWN }, - { 0x021f, KEY_VOLUMEUP }, - { 0x021e, KEY_VOLUMEDOWN }, - { 0x020c, KEY_ENTER }, /* Full Screen */ - - { 0x0214, KEY_MUTE }, - { 0x0208, KEY_AUDIO }, - - { 0x0203, KEY_TEXT }, /* Teletext */ - { 0x0204, KEY_EPG }, - { 0x022b, KEY_TV2 }, /* TV2 or PIP */ - - { 0x021d, KEY_RED }, - { 0x021c, KEY_YELLOW }, - { 0x0301, KEY_GREEN }, - { 0x0300, KEY_BLUE }, - - { 0x021a, KEY_PLAYPAUSE }, - { 0x0219, KEY_RECORD }, - { 0x0218, KEY_PLAY }, - { 0x021b, KEY_STOP }, -}; -DEFINE_IR_KEYTABLE(avermedia_m135a_rm_jx, IR_TYPE_NEC); -#else -DECLARE_IR_KEYTABLE(avermedia_m135a_rm_jx); -#endif diff --git a/include/media/keycodes/avermedia.h b/include/media/keycodes/avermedia.h deleted file mode 100644 index a4834528a8ed..000000000000 --- a/include/media/keycodes/avermedia.h +++ /dev/null @@ -1,62 +0,0 @@ -/* avermedia.h - Keytable for avermedia Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Alex Hermann */ - -#ifdef IR_KEYMAPS -static struct ir_scancode avermedia[] = { - { 0x28, KEY_1 }, - { 0x18, KEY_2 }, - { 0x38, KEY_3 }, - { 0x24, KEY_4 }, - { 0x14, KEY_5 }, - { 0x34, KEY_6 }, - { 0x2c, KEY_7 }, - { 0x1c, KEY_8 }, - { 0x3c, KEY_9 }, - { 0x22, KEY_0 }, - - { 0x20, KEY_TV }, /* TV/FM */ - { 0x10, KEY_CD }, /* CD */ - { 0x30, KEY_TEXT }, /* TELETEXT */ - { 0x00, KEY_POWER }, /* POWER */ - - { 0x08, KEY_VIDEO }, /* VIDEO */ - { 0x04, KEY_AUDIO }, /* AUDIO */ - { 0x0c, KEY_ZOOM }, /* FULL SCREEN */ - - { 0x12, KEY_SUBTITLE }, /* DISPLAY */ - { 0x32, KEY_REWIND }, /* LOOP */ - { 0x02, KEY_PRINT }, /* PREVIEW */ - - { 0x2a, KEY_SEARCH }, /* AUTOSCAN */ - { 0x1a, KEY_SLEEP }, /* FREEZE */ - { 0x3a, KEY_CAMERA }, /* SNAPSHOT */ - { 0x0a, KEY_MUTE }, /* MUTE */ - - { 0x26, KEY_RECORD }, /* RECORD */ - { 0x16, KEY_PAUSE }, /* PAUSE */ - { 0x36, KEY_STOP }, /* STOP */ - { 0x06, KEY_PLAY }, /* PLAY */ - - { 0x2e, KEY_RED }, /* RED */ - { 0x21, KEY_GREEN }, /* GREEN */ - { 0x0e, KEY_YELLOW }, /* YELLOW */ - { 0x01, KEY_BLUE }, /* BLUE */ - - { 0x1e, KEY_VOLUMEDOWN }, /* VOLUME- */ - { 0x3e, KEY_VOLUMEUP }, /* VOLUME+ */ - { 0x11, KEY_CHANNELDOWN }, /* CHANNEL/PAGE- */ - { 0x31, KEY_CHANNELUP } /* CHANNEL/PAGE+ */ -}; -DEFINE_LEGACY_IR_KEYTABLE(avermedia); -#else -DECLARE_IR_KEYTABLE(avermedia); -#endif diff --git a/include/media/keycodes/avertv-303.h b/include/media/keycodes/avertv-303.h deleted file mode 100644 index 1ef10af78020..000000000000 --- a/include/media/keycodes/avertv-303.h +++ /dev/null @@ -1,61 +0,0 @@ -/* avertv-303.h - Keytable for avertv_303 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* AVERTV STUDIO 303 Remote */ - -#ifdef IR_KEYMAPS -static struct ir_scancode avertv_303[] = { - { 0x2a, KEY_1 }, - { 0x32, KEY_2 }, - { 0x3a, KEY_3 }, - { 0x4a, KEY_4 }, - { 0x52, KEY_5 }, - { 0x5a, KEY_6 }, - { 0x6a, KEY_7 }, - { 0x72, KEY_8 }, - { 0x7a, KEY_9 }, - { 0x0e, KEY_0 }, - - { 0x02, KEY_POWER }, - { 0x22, KEY_VIDEO }, - { 0x42, KEY_AUDIO }, - { 0x62, KEY_ZOOM }, - { 0x0a, KEY_TV }, - { 0x12, KEY_CD }, - { 0x1a, KEY_TEXT }, - - { 0x16, KEY_SUBTITLE }, - { 0x1e, KEY_REWIND }, - { 0x06, KEY_PRINT }, - - { 0x2e, KEY_SEARCH }, - { 0x36, KEY_SLEEP }, - { 0x3e, KEY_SHUFFLE }, - { 0x26, KEY_MUTE }, - - { 0x4e, KEY_RECORD }, - { 0x56, KEY_PAUSE }, - { 0x5e, KEY_STOP }, - { 0x46, KEY_PLAY }, - - { 0x6e, KEY_RED }, - { 0x0b, KEY_GREEN }, - { 0x66, KEY_YELLOW }, - { 0x03, KEY_BLUE }, - - { 0x76, KEY_LEFT }, - { 0x7e, KEY_RIGHT }, - { 0x13, KEY_DOWN }, - { 0x1b, KEY_UP }, -}; -DEFINE_LEGACY_IR_KEYTABLE(avertv_303); -#else -DECLARE_IR_KEYTABLE(avertv_303); -#endif diff --git a/include/media/keycodes/behold-columbus.h b/include/media/keycodes/behold-columbus.h deleted file mode 100644 index fb68e75585f1..000000000000 --- a/include/media/keycodes/behold-columbus.h +++ /dev/null @@ -1,84 +0,0 @@ -/* behold-columbus.h - Keytable for behold_columbus Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Beholder Intl. Ltd. 2008 - * Dmitry Belimov d.belimov@google.com - * Keytable is used by BeholdTV Columbus - * The "ascii-art picture" below (in comments, first row - * is the keycode in hex, and subsequent row(s) shows - * the button labels (several variants when appropriate) - * helps to descide which keycodes to assign to the buttons. - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode behold_columbus[] = { - - /* 0x13 0x11 0x1C 0x12 * - * Mute Source TV/FM Power * - * */ - - { 0x13, KEY_MUTE }, - { 0x11, KEY_PROPS }, - { 0x1C, KEY_TUNER }, /* KEY_TV/KEY_RADIO */ - { 0x12, KEY_POWER }, - - /* 0x01 0x02 0x03 0x0D * - * 1 2 3 Stereo * - * * - * 0x04 0x05 0x06 0x19 * - * 4 5 6 Snapshot * - * * - * 0x07 0x08 0x09 0x10 * - * 7 8 9 Zoom * - * */ - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x0D, KEY_SETUP }, /* Setup key */ - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x19, KEY_CAMERA }, /* Snapshot key */ - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x10, KEY_ZOOM }, - - /* 0x0A 0x00 0x0B 0x0C * - * RECALL 0 ChannelUp VolumeUp * - * */ - { 0x0A, KEY_AGAIN }, - { 0x00, KEY_0 }, - { 0x0B, KEY_CHANNELUP }, - { 0x0C, KEY_VOLUMEUP }, - - /* 0x1B 0x1D 0x15 0x18 * - * Timeshift Record ChannelDown VolumeDown * - * */ - - { 0x1B, KEY_TIME }, - { 0x1D, KEY_RECORD }, - { 0x15, KEY_CHANNELDOWN }, - { 0x18, KEY_VOLUMEDOWN }, - - /* 0x0E 0x1E 0x0F 0x1A * - * Stop Pause Previouse Next * - * */ - - { 0x0E, KEY_STOP }, - { 0x1E, KEY_PAUSE }, - { 0x0F, KEY_PREVIOUS }, - { 0x1A, KEY_NEXT }, - -}; -DEFINE_LEGACY_IR_KEYTABLE(behold_columbus); -#else -DECLARE_IR_KEYTABLE(behold_columbus); -#endif diff --git a/include/media/keycodes/behold.h b/include/media/keycodes/behold.h deleted file mode 100644 index 57a2dae49b6c..000000000000 --- a/include/media/keycodes/behold.h +++ /dev/null @@ -1,117 +0,0 @@ -/* behold.h - Keytable for behold Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - * Igor Kuznetsov - * Andrey J. Melnikov - * - * Keytable is used by BeholdTV 60x series, M6 series at - * least, and probably other cards too. - * The "ascii-art picture" below (in comments, first row - * is the keycode in hex, and subsequent row(s) shows - * the button labels (several variants when appropriate) - * helps to descide which keycodes to assign to the buttons. - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode behold[] = { - - /* 0x1c 0x12 * - * TV/FM POWER * - * */ - { 0x1c, KEY_TUNER }, /* XXX KEY_TV / KEY_RADIO */ - { 0x12, KEY_POWER }, - - /* 0x01 0x02 0x03 * - * 1 2 3 * - * * - * 0x04 0x05 0x06 * - * 4 5 6 * - * * - * 0x07 0x08 0x09 * - * 7 8 9 * - * */ - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - /* 0x0a 0x00 0x17 * - * RECALL 0 MODE * - * */ - { 0x0a, KEY_AGAIN }, - { 0x00, KEY_0 }, - { 0x17, KEY_MODE }, - - /* 0x14 0x10 * - * ASPECT FULLSCREEN * - * */ - { 0x14, KEY_SCREEN }, - { 0x10, KEY_ZOOM }, - - /* 0x0b * - * Up * - * * - * 0x18 0x16 0x0c * - * Left Ok Right * - * * - * 0x015 * - * Down * - * */ - { 0x0b, KEY_CHANNELUP }, - { 0x18, KEY_VOLUMEDOWN }, - { 0x16, KEY_OK }, /* XXX KEY_ENTER */ - { 0x0c, KEY_VOLUMEUP }, - { 0x15, KEY_CHANNELDOWN }, - - /* 0x11 0x0d * - * MUTE INFO * - * */ - { 0x11, KEY_MUTE }, - { 0x0d, KEY_INFO }, - - /* 0x0f 0x1b 0x1a * - * RECORD PLAY/PAUSE STOP * - * * - * 0x0e 0x1f 0x1e * - *TELETEXT AUDIO SOURCE * - * RED YELLOW * - * */ - { 0x0f, KEY_RECORD }, - { 0x1b, KEY_PLAYPAUSE }, - { 0x1a, KEY_STOP }, - { 0x0e, KEY_TEXT }, - { 0x1f, KEY_RED }, /*XXX KEY_AUDIO */ - { 0x1e, KEY_YELLOW }, /*XXX KEY_SOURCE */ - - /* 0x1d 0x13 0x19 * - * SLEEP PREVIEW DVB * - * GREEN BLUE * - * */ - { 0x1d, KEY_SLEEP }, - { 0x13, KEY_GREEN }, - { 0x19, KEY_BLUE }, /* XXX KEY_SAT */ - - /* 0x58 0x5c * - * FREEZE SNAPSHOT * - * */ - { 0x58, KEY_SLOW }, - { 0x5c, KEY_CAMERA }, - -}; -DEFINE_LEGACY_IR_KEYTABLE(behold); -#else -DECLARE_IR_KEYTABLE(behold); -#endif diff --git a/include/media/keycodes/budget-ci-old.h b/include/media/keycodes/budget-ci-old.h deleted file mode 100644 index 03ada4710cfc..000000000000 --- a/include/media/keycodes/budget-ci-old.h +++ /dev/null @@ -1,68 +0,0 @@ -/* budget-ci-old.h - Keytable for budget_ci_old Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* From reading the following remotes: - * Zenith Universal 7 / TV Mode 807 / VCR Mode 837 - * Hauppauge (from NOVA-CI-s box product) - * This is a "middle of the road" approach, differences are noted - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode budget_ci_old[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x0a, KEY_ENTER }, - { 0x0b, KEY_RED }, - { 0x0c, KEY_POWER }, /* RADIO on Hauppauge */ - { 0x0d, KEY_MUTE }, - { 0x0f, KEY_A }, /* TV on Hauppauge */ - { 0x10, KEY_VOLUMEUP }, - { 0x11, KEY_VOLUMEDOWN }, - { 0x14, KEY_B }, - { 0x1c, KEY_UP }, - { 0x1d, KEY_DOWN }, - { 0x1e, KEY_OPTION }, /* RESERVED on Hauppauge */ - { 0x1f, KEY_BREAK }, - { 0x20, KEY_CHANNELUP }, - { 0x21, KEY_CHANNELDOWN }, - { 0x22, KEY_PREVIOUS }, /* Prev Ch on Zenith, SOURCE on Hauppauge */ - { 0x24, KEY_RESTART }, - { 0x25, KEY_OK }, - { 0x26, KEY_CYCLEWINDOWS }, /* MINIMIZE on Hauppauge */ - { 0x28, KEY_ENTER }, /* VCR mode on Zenith */ - { 0x29, KEY_PAUSE }, - { 0x2b, KEY_RIGHT }, - { 0x2c, KEY_LEFT }, - { 0x2e, KEY_MENU }, /* FULL SCREEN on Hauppauge */ - { 0x30, KEY_SLOW }, - { 0x31, KEY_PREVIOUS }, /* VCR mode on Zenith */ - { 0x32, KEY_REWIND }, - { 0x34, KEY_FASTFORWARD }, - { 0x35, KEY_PLAY }, - { 0x36, KEY_STOP }, - { 0x37, KEY_RECORD }, - { 0x38, KEY_TUNER }, /* TV/VCR on Zenith */ - { 0x3a, KEY_C }, - { 0x3c, KEY_EXIT }, - { 0x3d, KEY_POWER2 }, - { 0x3e, KEY_TUNER }, -}; -DEFINE_LEGACY_IR_KEYTABLE(budget_ci_old); -#else -DECLARE_IR_KEYTABLE(budget_ci_old); -#endif diff --git a/include/media/keycodes/cinergy-1400.h b/include/media/keycodes/cinergy-1400.h deleted file mode 100644 index 9b562eab7715..000000000000 --- a/include/media/keycodes/cinergy-1400.h +++ /dev/null @@ -1,60 +0,0 @@ -/* cinergy-1400.h - Keytable for cinergy_1400 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Cinergy 1400 DVB-T */ - -#ifdef IR_KEYMAPS -static struct ir_scancode cinergy_1400[] = { - { 0x01, KEY_POWER }, - { 0x02, KEY_1 }, - { 0x03, KEY_2 }, - { 0x04, KEY_3 }, - { 0x05, KEY_4 }, - { 0x06, KEY_5 }, - { 0x07, KEY_6 }, - { 0x08, KEY_7 }, - { 0x09, KEY_8 }, - { 0x0a, KEY_9 }, - { 0x0c, KEY_0 }, - - { 0x0b, KEY_VIDEO }, - { 0x0d, KEY_REFRESH }, - { 0x0e, KEY_SELECT }, - { 0x0f, KEY_EPG }, - { 0x10, KEY_UP }, - { 0x11, KEY_LEFT }, - { 0x12, KEY_OK }, - { 0x13, KEY_RIGHT }, - { 0x14, KEY_DOWN }, - { 0x15, KEY_TEXT }, - { 0x16, KEY_INFO }, - - { 0x17, KEY_RED }, - { 0x18, KEY_GREEN }, - { 0x19, KEY_YELLOW }, - { 0x1a, KEY_BLUE }, - - { 0x1b, KEY_CHANNELUP }, - { 0x1c, KEY_VOLUMEUP }, - { 0x1d, KEY_MUTE }, - { 0x1e, KEY_VOLUMEDOWN }, - { 0x1f, KEY_CHANNELDOWN }, - - { 0x40, KEY_PAUSE }, - { 0x4c, KEY_PLAY }, - { 0x58, KEY_RECORD }, - { 0x54, KEY_PREVIOUS }, - { 0x48, KEY_STOP }, - { 0x5c, KEY_NEXT }, -}; -DEFINE_LEGACY_IR_KEYTABLE(cinergy_1400); -#else -DECLARE_IR_KEYTABLE(cinergy_1400); -#endif diff --git a/include/media/keycodes/cinergy.h b/include/media/keycodes/cinergy.h deleted file mode 100644 index 7884696bc683..000000000000 --- a/include/media/keycodes/cinergy.h +++ /dev/null @@ -1,55 +0,0 @@ -/* cinergy.h - Keytable for cinergy Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode cinergy[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0a, KEY_POWER }, - { 0x0b, KEY_PROG1 }, /* app */ - { 0x0c, KEY_ZOOM }, /* zoom/fullscreen */ - { 0x0d, KEY_CHANNELUP }, /* channel */ - { 0x0e, KEY_CHANNELDOWN }, /* channel- */ - { 0x0f, KEY_VOLUMEUP }, - { 0x10, KEY_VOLUMEDOWN }, - { 0x11, KEY_TUNER }, /* AV */ - { 0x12, KEY_NUMLOCK }, /* -/-- */ - { 0x13, KEY_AUDIO }, /* audio */ - { 0x14, KEY_MUTE }, - { 0x15, KEY_UP }, - { 0x16, KEY_DOWN }, - { 0x17, KEY_LEFT }, - { 0x18, KEY_RIGHT }, - { 0x19, BTN_LEFT, }, - { 0x1a, BTN_RIGHT, }, - { 0x1b, KEY_WWW }, /* text */ - { 0x1c, KEY_REWIND }, - { 0x1d, KEY_FORWARD }, - { 0x1e, KEY_RECORD }, - { 0x1f, KEY_PLAY }, - { 0x20, KEY_PREVIOUSSONG }, - { 0x21, KEY_NEXTSONG }, - { 0x22, KEY_PAUSE }, - { 0x23, KEY_STOP }, -}; -DEFINE_LEGACY_IR_KEYTABLE(cinergy); -#else -DECLARE_IR_KEYTABLE(cinergy); -#endif diff --git a/include/media/keycodes/dm1105-nec.h b/include/media/keycodes/dm1105-nec.h deleted file mode 100644 index b87d770747a2..000000000000 --- a/include/media/keycodes/dm1105-nec.h +++ /dev/null @@ -1,52 +0,0 @@ -/* dm1105-nec.h - Keytable for dm1105_nec Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* DVBWorld remotes - Igor M. Liplianin - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode dm1105_nec[] = { - { 0x0a, KEY_POWER2}, /* power */ - { 0x0c, KEY_MUTE}, /* mute */ - { 0x11, KEY_1}, - { 0x12, KEY_2}, - { 0x13, KEY_3}, - { 0x14, KEY_4}, - { 0x15, KEY_5}, - { 0x16, KEY_6}, - { 0x17, KEY_7}, - { 0x18, KEY_8}, - { 0x19, KEY_9}, - { 0x10, KEY_0}, - { 0x1c, KEY_CHANNELUP}, /* ch+ */ - { 0x0f, KEY_CHANNELDOWN}, /* ch- */ - { 0x1a, KEY_VOLUMEUP}, /* vol+ */ - { 0x0e, KEY_VOLUMEDOWN}, /* vol- */ - { 0x04, KEY_RECORD}, /* rec */ - { 0x09, KEY_CHANNEL}, /* fav */ - { 0x08, KEY_BACKSPACE}, /* rewind */ - { 0x07, KEY_FASTFORWARD}, /* fast */ - { 0x0b, KEY_PAUSE}, /* pause */ - { 0x02, KEY_ESC}, /* cancel */ - { 0x03, KEY_TAB}, /* tab */ - { 0x00, KEY_UP}, /* up */ - { 0x1f, KEY_ENTER}, /* ok */ - { 0x01, KEY_DOWN}, /* down */ - { 0x05, KEY_RECORD}, /* cap */ - { 0x06, KEY_STOP}, /* stop */ - { 0x40, KEY_ZOOM}, /* full */ - { 0x1e, KEY_TV}, /* tvmode */ - { 0x1b, KEY_B}, /* recall */ -}; -DEFINE_LEGACY_IR_KEYTABLE(dm1105_nec); -#else -DECLARE_IR_KEYTABLE(dm1105_nec); -#endif diff --git a/include/media/keycodes/dntv-live-dvb-t.h b/include/media/keycodes/dntv-live-dvb-t.h deleted file mode 100644 index 4431ae6e206c..000000000000 --- a/include/media/keycodes/dntv-live-dvb-t.h +++ /dev/null @@ -1,54 +0,0 @@ -/* dntv-live-dvb-t.h - Keytable for dntv_live_dvb_t Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* DigitalNow DNTV Live DVB-T Remote */ - -#ifdef IR_KEYMAPS -static struct ir_scancode dntv_live_dvb_t[] = { - { 0x00, KEY_ESC }, /* 'go up a level?' */ - /* Keys 0 to 9 */ - { 0x0a, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0b, KEY_TUNER }, /* tv/fm */ - { 0x0c, KEY_SEARCH }, /* scan */ - { 0x0d, KEY_STOP }, - { 0x0e, KEY_PAUSE }, - { 0x0f, KEY_LIST }, /* source */ - - { 0x10, KEY_MUTE }, - { 0x11, KEY_REWIND }, /* backward << */ - { 0x12, KEY_POWER }, - { 0x13, KEY_CAMERA }, /* snap */ - { 0x14, KEY_AUDIO }, /* stereo */ - { 0x15, KEY_CLEAR }, /* reset */ - { 0x16, KEY_PLAY }, - { 0x17, KEY_ENTER }, - { 0x18, KEY_ZOOM }, /* full screen */ - { 0x19, KEY_FASTFORWARD }, /* forward >> */ - { 0x1a, KEY_CHANNELUP }, - { 0x1b, KEY_VOLUMEUP }, - { 0x1c, KEY_INFO }, /* preview */ - { 0x1d, KEY_RECORD }, /* record */ - { 0x1e, KEY_CHANNELDOWN }, - { 0x1f, KEY_VOLUMEDOWN }, -}; -DEFINE_LEGACY_IR_KEYTABLE(dntv_live_dvb_t); -#else -DECLARE_IR_KEYTABLE(dntv_live_dvb_t); -#endif diff --git a/include/media/keycodes/dntv-live-dvbt-pro.h b/include/media/keycodes/dntv-live-dvbt-pro.h deleted file mode 100644 index d64fa26503cc..000000000000 --- a/include/media/keycodes/dntv-live-dvbt-pro.h +++ /dev/null @@ -1,73 +0,0 @@ -/* dntv-live-dvbt-pro.h - Keytable for dntv_live_dvbt_pro Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* DigitalNow DNTV Live! DVB-T Pro Remote */ - -#ifdef IR_KEYMAPS -static struct ir_scancode dntv_live_dvbt_pro[] = { - { 0x16, KEY_POWER }, - { 0x5b, KEY_HOME }, - - { 0x55, KEY_TV }, /* live tv */ - { 0x58, KEY_TUNER }, /* digital Radio */ - { 0x5a, KEY_RADIO }, /* FM radio */ - { 0x59, KEY_DVD }, /* dvd menu */ - { 0x03, KEY_1 }, - { 0x01, KEY_2 }, - { 0x06, KEY_3 }, - { 0x09, KEY_4 }, - { 0x1d, KEY_5 }, - { 0x1f, KEY_6 }, - { 0x0d, KEY_7 }, - { 0x19, KEY_8 }, - { 0x1b, KEY_9 }, - { 0x0c, KEY_CANCEL }, - { 0x15, KEY_0 }, - { 0x4a, KEY_CLEAR }, - { 0x13, KEY_BACK }, - { 0x00, KEY_TAB }, - { 0x4b, KEY_UP }, - { 0x4e, KEY_LEFT }, - { 0x4f, KEY_OK }, - { 0x52, KEY_RIGHT }, - { 0x51, KEY_DOWN }, - { 0x1e, KEY_VOLUMEUP }, - { 0x0a, KEY_VOLUMEDOWN }, - { 0x02, KEY_CHANNELDOWN }, - { 0x05, KEY_CHANNELUP }, - { 0x11, KEY_RECORD }, - { 0x14, KEY_PLAY }, - { 0x4c, KEY_PAUSE }, - { 0x1a, KEY_STOP }, - { 0x40, KEY_REWIND }, - { 0x12, KEY_FASTFORWARD }, - { 0x41, KEY_PREVIOUSSONG }, /* replay |< */ - { 0x42, KEY_NEXTSONG }, /* skip >| */ - { 0x54, KEY_CAMERA }, /* capture */ - { 0x50, KEY_LANGUAGE }, /* sap */ - { 0x47, KEY_TV2 }, /* pip */ - { 0x4d, KEY_SCREEN }, - { 0x43, KEY_SUBTITLE }, - { 0x10, KEY_MUTE }, - { 0x49, KEY_AUDIO }, /* l/r */ - { 0x07, KEY_SLEEP }, - { 0x08, KEY_VIDEO }, /* a/v */ - { 0x0e, KEY_PREVIOUS }, /* recall */ - { 0x45, KEY_ZOOM }, /* zoom + */ - { 0x46, KEY_ANGLE }, /* zoom - */ - { 0x56, KEY_RED }, - { 0x57, KEY_GREEN }, - { 0x5c, KEY_YELLOW }, - { 0x5d, KEY_BLUE }, -}; -DEFINE_LEGACY_IR_KEYTABLE(dntv_live_dvbt_pro); -#else -DECLARE_IR_KEYTABLE(dntv_live_dvbt_pro); -#endif diff --git a/include/media/keycodes/em-terratec.h b/include/media/keycodes/em-terratec.h deleted file mode 100644 index 906557d06143..000000000000 --- a/include/media/keycodes/em-terratec.h +++ /dev/null @@ -1,46 +0,0 @@ -/* em-terratec.h - Keytable for em_terratec Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode em_terratec[] = { - { 0x01, KEY_CHANNEL }, - { 0x02, KEY_SELECT }, - { 0x03, KEY_MUTE }, - { 0x04, KEY_POWER }, - { 0x05, KEY_1 }, - { 0x06, KEY_2 }, - { 0x07, KEY_3 }, - { 0x08, KEY_CHANNELUP }, - { 0x09, KEY_4 }, - { 0x0a, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x0c, KEY_CHANNELDOWN }, - { 0x0d, KEY_7 }, - { 0x0e, KEY_8 }, - { 0x0f, KEY_9 }, - { 0x10, KEY_VOLUMEUP }, - { 0x11, KEY_0 }, - { 0x12, KEY_MENU }, - { 0x13, KEY_PRINT }, - { 0x14, KEY_VOLUMEDOWN }, - { 0x16, KEY_PAUSE }, - { 0x18, KEY_RECORD }, - { 0x19, KEY_REWIND }, - { 0x1a, KEY_PLAY }, - { 0x1b, KEY_FORWARD }, - { 0x1c, KEY_BACKSPACE }, - { 0x1e, KEY_STOP }, - { 0x40, KEY_ZOOM }, -}; -DEFINE_LEGACY_IR_KEYTABLE(em_terratec); -#else -DECLARE_IR_KEYTABLE(em_terratec); -#endif diff --git a/include/media/keycodes/empty.h b/include/media/keycodes/empty.h deleted file mode 100644 index aea866c42b22..000000000000 --- a/include/media/keycodes/empty.h +++ /dev/null @@ -1,20 +0,0 @@ -/* empty.h - Keytable for empty Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* empty keytable, can be used as placeholder for not-yet created keytables */ - -#ifdef IR_KEYMAPS -static struct ir_scancode empty[] = { - { 0x2a, KEY_COFFEE }, -}; -DEFINE_LEGACY_IR_KEYTABLE(empty); -#else -DECLARE_IR_KEYTABLE(empty); -#endif diff --git a/include/media/keycodes/encore-enltv-fm53.h b/include/media/keycodes/encore-enltv-fm53.h deleted file mode 100644 index bccb7440676b..000000000000 --- a/include/media/keycodes/encore-enltv-fm53.h +++ /dev/null @@ -1,57 +0,0 @@ -/* encore-enltv-fm53.h - Keytable for encore_enltv_fm53 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Encore ENLTV-FM v5.3 - Mauro Carvalho Chehab - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode encore_enltv_fm53[] = { - { 0x10, KEY_POWER2}, - { 0x06, KEY_MUTE}, - - { 0x09, KEY_1}, - { 0x1d, KEY_2}, - { 0x1f, KEY_3}, - { 0x19, KEY_4}, - { 0x1b, KEY_5}, - { 0x11, KEY_6}, - { 0x17, KEY_7}, - { 0x12, KEY_8}, - { 0x16, KEY_9}, - { 0x48, KEY_0}, - - { 0x04, KEY_LIST}, /* -/-- */ - { 0x40, KEY_LAST}, /* recall */ - - { 0x02, KEY_MODE}, /* TV/AV */ - { 0x05, KEY_CAMERA}, /* SNAPSHOT */ - - { 0x4c, KEY_CHANNELUP}, /* UP */ - { 0x00, KEY_CHANNELDOWN}, /* DOWN */ - { 0x0d, KEY_VOLUMEUP}, /* RIGHT */ - { 0x15, KEY_VOLUMEDOWN}, /* LEFT */ - { 0x49, KEY_ENTER}, /* OK */ - - { 0x54, KEY_RECORD}, - { 0x4d, KEY_PLAY}, /* pause */ - - { 0x1e, KEY_MENU}, /* video setting */ - { 0x0e, KEY_RIGHT}, /* <- */ - { 0x1a, KEY_LEFT}, /* -> */ - - { 0x0a, KEY_CLEAR}, /* video default */ - { 0x0c, KEY_ZOOM}, /* hide pannel */ - { 0x47, KEY_SLEEP}, /* shutdown */ -}; -DEFINE_LEGACY_IR_KEYTABLE(encore_enltv_fm53); -#else -DECLARE_IR_KEYTABLE(encore_enltv_fm53); -#endif diff --git a/include/media/keycodes/encore-enltv.h b/include/media/keycodes/encore-enltv.h deleted file mode 100644 index 4c55b526129c..000000000000 --- a/include/media/keycodes/encore-enltv.h +++ /dev/null @@ -1,88 +0,0 @@ -/* encore-enltv.h - Keytable for encore_enltv Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Encore ENLTV-FM - black plastic, white front cover with white glowing buttons - Juan Pablo Sormani */ - -#ifdef IR_KEYMAPS -static struct ir_scancode encore_enltv[] = { - - /* Power button does nothing, neither in Windows app, - although it sends data (used for BIOS wakeup?) */ - { 0x0d, KEY_MUTE }, - - { 0x1e, KEY_TV }, - { 0x00, KEY_VIDEO }, - { 0x01, KEY_AUDIO }, /* music */ - { 0x02, KEY_MHP }, /* picture */ - - { 0x1f, KEY_1 }, - { 0x03, KEY_2 }, - { 0x04, KEY_3 }, - { 0x05, KEY_4 }, - { 0x1c, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x1d, KEY_9 }, - { 0x0a, KEY_0 }, - - { 0x09, KEY_LIST }, /* -/-- */ - { 0x0b, KEY_LAST }, /* recall */ - - { 0x14, KEY_HOME }, /* win start menu */ - { 0x15, KEY_EXIT }, /* exit */ - { 0x16, KEY_CHANNELUP }, /* UP */ - { 0x12, KEY_CHANNELDOWN }, /* DOWN */ - { 0x0c, KEY_VOLUMEUP }, /* RIGHT */ - { 0x17, KEY_VOLUMEDOWN }, /* LEFT */ - - { 0x18, KEY_ENTER }, /* OK */ - - { 0x0e, KEY_ESC }, - { 0x13, KEY_CYCLEWINDOWS }, /* desktop */ - { 0x11, KEY_TAB }, - { 0x19, KEY_SWITCHVIDEOMODE }, /* switch */ - - { 0x1a, KEY_MENU }, - { 0x1b, KEY_ZOOM }, /* fullscreen */ - { 0x44, KEY_TIME }, /* time shift */ - { 0x40, KEY_MODE }, /* source */ - - { 0x5a, KEY_RECORD }, - { 0x42, KEY_PLAY }, /* play/pause */ - { 0x45, KEY_STOP }, - { 0x43, KEY_CAMERA }, /* camera icon */ - - { 0x48, KEY_REWIND }, - { 0x4a, KEY_FASTFORWARD }, - { 0x49, KEY_PREVIOUS }, - { 0x4b, KEY_NEXT }, - - { 0x4c, KEY_FAVORITES }, /* tv wall */ - { 0x4d, KEY_SOUND }, /* DVD sound */ - { 0x4e, KEY_LANGUAGE }, /* DVD lang */ - { 0x4f, KEY_TEXT }, /* DVD text */ - - { 0x50, KEY_SLEEP }, /* shutdown */ - { 0x51, KEY_MODE }, /* stereo > main */ - { 0x52, KEY_SELECT }, /* stereo > sap */ - { 0x53, KEY_PROG1 }, /* teletext */ - - - { 0x59, KEY_RED }, /* AP1 */ - { 0x41, KEY_GREEN }, /* AP2 */ - { 0x47, KEY_YELLOW }, /* AP3 */ - { 0x57, KEY_BLUE }, /* AP4 */ -}; -DEFINE_LEGACY_IR_KEYTABLE(encore_enltv); -#else -DECLARE_IR_KEYTABLE(encore_enltv); -#endif diff --git a/include/media/keycodes/encore-enltv2.h b/include/media/keycodes/encore-enltv2.h deleted file mode 100644 index 6b37fbcfc4aa..000000000000 --- a/include/media/keycodes/encore-enltv2.h +++ /dev/null @@ -1,66 +0,0 @@ -/* encore-enltv2.h - Keytable for encore_enltv2 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton - Mauro Carvalho Chehab */ - -#ifdef IR_KEYMAPS -static struct ir_scancode encore_enltv2[] = { - { 0x4c, KEY_POWER2 }, - { 0x4a, KEY_TUNER }, - { 0x40, KEY_1 }, - { 0x60, KEY_2 }, - { 0x50, KEY_3 }, - { 0x70, KEY_4 }, - { 0x48, KEY_5 }, - { 0x68, KEY_6 }, - { 0x58, KEY_7 }, - { 0x78, KEY_8 }, - { 0x44, KEY_9 }, - { 0x54, KEY_0 }, - - { 0x64, KEY_LAST }, /* +100 */ - { 0x4e, KEY_AGAIN }, /* Recall */ - - { 0x6c, KEY_SWITCHVIDEOMODE }, /* Video Source */ - { 0x5e, KEY_MENU }, - { 0x56, KEY_SCREEN }, - { 0x7a, KEY_SETUP }, - - { 0x46, KEY_MUTE }, - { 0x5c, KEY_MODE }, /* Stereo */ - { 0x74, KEY_INFO }, - { 0x7c, KEY_CLEAR }, - - { 0x55, KEY_UP }, - { 0x49, KEY_DOWN }, - { 0x7e, KEY_LEFT }, - { 0x59, KEY_RIGHT }, - { 0x6a, KEY_ENTER }, - - { 0x42, KEY_VOLUMEUP }, - { 0x62, KEY_VOLUMEDOWN }, - { 0x52, KEY_CHANNELUP }, - { 0x72, KEY_CHANNELDOWN }, - - { 0x41, KEY_RECORD }, - { 0x51, KEY_CAMERA }, /* Snapshot */ - { 0x75, KEY_TIME }, /* Timeshift */ - { 0x71, KEY_TV2 }, /* PIP */ - - { 0x45, KEY_REWIND }, - { 0x6f, KEY_PAUSE }, - { 0x7d, KEY_FORWARD }, - { 0x79, KEY_STOP }, -}; -DEFINE_LEGACY_IR_KEYTABLE(encore_enltv2); -#else -DECLARE_IR_KEYTABLE(encore_enltv2); -#endif diff --git a/include/media/keycodes/evga-indtube.h b/include/media/keycodes/evga-indtube.h deleted file mode 100644 index 2aab58d75037..000000000000 --- a/include/media/keycodes/evga-indtube.h +++ /dev/null @@ -1,37 +0,0 @@ -/* evga-indtube.h - Keytable for evga_indtube Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* EVGA inDtube - Devin Heitmueller - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode evga_indtube[] = { - { 0x12, KEY_POWER}, - { 0x02, KEY_MODE}, /* TV */ - { 0x14, KEY_MUTE}, - { 0x1a, KEY_CHANNELUP}, - { 0x16, KEY_TV2}, /* PIP */ - { 0x1d, KEY_VOLUMEUP}, - { 0x05, KEY_CHANNELDOWN}, - { 0x0f, KEY_PLAYPAUSE}, - { 0x19, KEY_VOLUMEDOWN}, - { 0x1c, KEY_REWIND}, - { 0x0d, KEY_RECORD}, - { 0x18, KEY_FORWARD}, - { 0x1e, KEY_PREVIOUS}, - { 0x1b, KEY_STOP}, - { 0x1f, KEY_NEXT}, - { 0x13, KEY_CAMERA}, -}; -DEFINE_LEGACY_IR_KEYTABLE(evga_indtube); -#else -DECLARE_IR_KEYTABLE(evga_indtube); -#endif diff --git a/include/media/keycodes/eztv.h b/include/media/keycodes/eztv.h deleted file mode 100644 index 030f57a61349..000000000000 --- a/include/media/keycodes/eztv.h +++ /dev/null @@ -1,72 +0,0 @@ -/* eztv.h - Keytable for eztv Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Alfons Geser - * updates from Job D. R. Borges */ - -#ifdef IR_KEYMAPS -static struct ir_scancode eztv[] = { - { 0x12, KEY_POWER }, - { 0x01, KEY_TV }, /* DVR */ - { 0x15, KEY_DVD }, /* DVD */ - { 0x17, KEY_AUDIO }, /* music */ - /* DVR mode / DVD mode / music mode */ - - { 0x1b, KEY_MUTE }, /* mute */ - { 0x02, KEY_LANGUAGE }, /* MTS/SAP / audio / autoseek */ - { 0x1e, KEY_SUBTITLE }, /* closed captioning / subtitle / seek */ - { 0x16, KEY_ZOOM }, /* full screen */ - { 0x1c, KEY_VIDEO }, /* video source / eject / delall */ - { 0x1d, KEY_RESTART }, /* playback / angle / del */ - { 0x2f, KEY_SEARCH }, /* scan / menu / playlist */ - { 0x30, KEY_CHANNEL }, /* CH surfing / bookmark / memo */ - - { 0x31, KEY_HELP }, /* help */ - { 0x32, KEY_MODE }, /* num/memo */ - { 0x33, KEY_ESC }, /* cancel */ - - { 0x0c, KEY_UP }, /* up */ - { 0x10, KEY_DOWN }, /* down */ - { 0x08, KEY_LEFT }, /* left */ - { 0x04, KEY_RIGHT }, /* right */ - { 0x03, KEY_SELECT }, /* select */ - - { 0x1f, KEY_REWIND }, /* rewind */ - { 0x20, KEY_PLAYPAUSE },/* play/pause */ - { 0x29, KEY_FORWARD }, /* forward */ - { 0x14, KEY_AGAIN }, /* repeat */ - { 0x2b, KEY_RECORD }, /* recording */ - { 0x2c, KEY_STOP }, /* stop */ - { 0x2d, KEY_PLAY }, /* play */ - { 0x2e, KEY_CAMERA }, /* snapshot / shuffle */ - - { 0x00, KEY_0 }, - { 0x05, KEY_1 }, - { 0x06, KEY_2 }, - { 0x07, KEY_3 }, - { 0x09, KEY_4 }, - { 0x0a, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x0d, KEY_7 }, - { 0x0e, KEY_8 }, - { 0x0f, KEY_9 }, - - { 0x2a, KEY_VOLUMEUP }, - { 0x11, KEY_VOLUMEDOWN }, - { 0x18, KEY_CHANNELUP },/* CH.tracking up */ - { 0x19, KEY_CHANNELDOWN },/* CH.tracking down */ - - { 0x13, KEY_ENTER }, /* enter */ - { 0x21, KEY_DOT }, /* . (decimal dot) */ -}; -DEFINE_LEGACY_IR_KEYTABLE(eztv); -#else -DECLARE_IR_KEYTABLE(eztv); -#endif diff --git a/include/media/keycodes/flydvb.h b/include/media/keycodes/flydvb.h deleted file mode 100644 index b270cc058b7c..000000000000 --- a/include/media/keycodes/flydvb.h +++ /dev/null @@ -1,54 +0,0 @@ -/* flydvb.h - Keytable for flydvb Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode flydvb[] = { - { 0x01, KEY_ZOOM }, /* Full Screen */ - { 0x00, KEY_POWER }, /* Power */ - - { 0x03, KEY_1 }, - { 0x04, KEY_2 }, - { 0x05, KEY_3 }, - { 0x07, KEY_4 }, - { 0x08, KEY_5 }, - { 0x09, KEY_6 }, - { 0x0b, KEY_7 }, - { 0x0c, KEY_8 }, - { 0x0d, KEY_9 }, - { 0x06, KEY_AGAIN }, /* Recall */ - { 0x0f, KEY_0 }, - { 0x10, KEY_MUTE }, /* Mute */ - { 0x02, KEY_RADIO }, /* TV/Radio */ - { 0x1b, KEY_LANGUAGE }, /* SAP (Second Audio Program) */ - - { 0x14, KEY_VOLUMEUP }, /* VOL+ */ - { 0x17, KEY_VOLUMEDOWN }, /* VOL- */ - { 0x12, KEY_CHANNELUP }, /* CH+ */ - { 0x13, KEY_CHANNELDOWN }, /* CH- */ - { 0x1d, KEY_ENTER }, /* Enter */ - - { 0x1a, KEY_MODE }, /* PIP */ - { 0x18, KEY_TUNER }, /* Source */ - - { 0x1e, KEY_RECORD }, /* Record/Pause */ - { 0x15, KEY_ANGLE }, /* Swap (no label on key) */ - { 0x1c, KEY_PAUSE }, /* Timeshift/Pause */ - { 0x19, KEY_BACK }, /* Rewind << */ - { 0x0a, KEY_PLAYPAUSE }, /* Play/Pause */ - { 0x1f, KEY_FORWARD }, /* Forward >> */ - { 0x16, KEY_PREVIOUS }, /* Back |<< */ - { 0x11, KEY_STOP }, /* Stop */ - { 0x0e, KEY_NEXT }, /* End >>| */ -}; -DEFINE_LEGACY_IR_KEYTABLE(flydvb); -#else -DECLARE_IR_KEYTABLE(flydvb); -#endif diff --git a/include/media/keycodes/flyvideo.h b/include/media/keycodes/flyvideo.h deleted file mode 100644 index 5c52f92d039c..000000000000 --- a/include/media/keycodes/flyvideo.h +++ /dev/null @@ -1,47 +0,0 @@ -/* flyvideo.h - Keytable for flyvideo Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode flyvideo[] = { - { 0x0f, KEY_0 }, - { 0x03, KEY_1 }, - { 0x04, KEY_2 }, - { 0x05, KEY_3 }, - { 0x07, KEY_4 }, - { 0x08, KEY_5 }, - { 0x09, KEY_6 }, - { 0x0b, KEY_7 }, - { 0x0c, KEY_8 }, - { 0x0d, KEY_9 }, - - { 0x0e, KEY_MODE }, /* Air/Cable */ - { 0x11, KEY_VIDEO }, /* Video */ - { 0x15, KEY_AUDIO }, /* Audio */ - { 0x00, KEY_POWER }, /* Power */ - { 0x18, KEY_TUNER }, /* AV Source */ - { 0x02, KEY_ZOOM }, /* Fullscreen */ - { 0x1a, KEY_LANGUAGE }, /* Stereo */ - { 0x1b, KEY_MUTE }, /* Mute */ - { 0x14, KEY_VOLUMEUP }, /* Volume + */ - { 0x17, KEY_VOLUMEDOWN },/* Volume - */ - { 0x12, KEY_CHANNELUP },/* Channel + */ - { 0x13, KEY_CHANNELDOWN },/* Channel - */ - { 0x06, KEY_AGAIN }, /* Recall */ - { 0x10, KEY_ENTER }, /* Enter */ - - { 0x19, KEY_BACK }, /* Rewind ( <<< ) */ - { 0x1f, KEY_FORWARD }, /* Forward ( >>> ) */ - { 0x0a, KEY_ANGLE }, /* no label, may be used as the PAUSE button */ -}; -DEFINE_LEGACY_IR_KEYTABLE(flyvideo); -#else -DECLARE_IR_KEYTABLE(flyvideo); -#endif diff --git a/include/media/keycodes/fusionhdtv-mce.h b/include/media/keycodes/fusionhdtv-mce.h deleted file mode 100644 index bf2998f6a9d2..000000000000 --- a/include/media/keycodes/fusionhdtv-mce.h +++ /dev/null @@ -1,74 +0,0 @@ -/* fusionhdtv-mce.h - Keytable for fusionhdtv_mce Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* DViCO FUSION HDTV MCE remote */ - -#ifdef IR_KEYMAPS -static struct ir_scancode fusionhdtv_mce[] = { - - { 0x0b, KEY_1 }, - { 0x17, KEY_2 }, - { 0x1b, KEY_3 }, - { 0x07, KEY_4 }, - { 0x50, KEY_5 }, - { 0x54, KEY_6 }, - { 0x48, KEY_7 }, - { 0x4c, KEY_8 }, - { 0x58, KEY_9 }, - { 0x03, KEY_0 }, - - { 0x5e, KEY_OK }, - { 0x51, KEY_UP }, - { 0x53, KEY_DOWN }, - { 0x5b, KEY_LEFT }, - { 0x5f, KEY_RIGHT }, - - { 0x02, KEY_TV }, /* Labeled DTV on remote */ - { 0x0e, KEY_MP3 }, - { 0x1a, KEY_DVD }, - { 0x1e, KEY_FAVORITES }, /* Labeled CPF on remote */ - { 0x16, KEY_SETUP }, - { 0x46, KEY_POWER2 }, /* TV On/Off button on remote */ - { 0x0a, KEY_EPG }, /* Labeled Guide on remote */ - - { 0x49, KEY_BACK }, - { 0x59, KEY_INFO }, /* Labeled MORE on remote */ - { 0x4d, KEY_MENU }, /* Labeled DVDMENU on remote */ - { 0x55, KEY_CYCLEWINDOWS }, /* Labeled ALT-TAB on remote */ - - { 0x0f, KEY_PREVIOUSSONG }, /* Labeled |<< REPLAY on remote */ - { 0x12, KEY_NEXTSONG }, /* Labeled >>| SKIP on remote */ - { 0x42, KEY_ENTER }, /* Labeled START with a green - MS windows logo on remote */ - - { 0x15, KEY_VOLUMEUP }, - { 0x05, KEY_VOLUMEDOWN }, - { 0x11, KEY_CHANNELUP }, - { 0x09, KEY_CHANNELDOWN }, - - { 0x52, KEY_CAMERA }, - { 0x5a, KEY_TUNER }, - { 0x19, KEY_OPEN }, - - { 0x13, KEY_MODE }, /* 4:3 16:9 select */ - { 0x1f, KEY_ZOOM }, - - { 0x43, KEY_REWIND }, - { 0x47, KEY_PLAYPAUSE }, - { 0x4f, KEY_FASTFORWARD }, - { 0x57, KEY_MUTE }, - { 0x0d, KEY_STOP }, - { 0x01, KEY_RECORD }, - { 0x4e, KEY_POWER }, -}; -DEFINE_LEGACY_IR_KEYTABLE(fusionhdtv_mce); -#else -DECLARE_IR_KEYTABLE(fusionhdtv_mce); -#endif diff --git a/include/media/keycodes/gadmei-rm008z.h b/include/media/keycodes/gadmei-rm008z.h deleted file mode 100644 index b73d3e5d7292..000000000000 --- a/include/media/keycodes/gadmei-rm008z.h +++ /dev/null @@ -1,57 +0,0 @@ -/* gadmei-rm008z.h - Keytable for gadmei_rm008z Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* GADMEI UTV330+ RM008Z remote - Shine Liu - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode gadmei_rm008z[] = { - { 0x14, KEY_POWER2}, /* POWER OFF */ - { 0x0c, KEY_MUTE}, /* MUTE */ - - { 0x18, KEY_TV}, /* TV */ - { 0x0e, KEY_VIDEO}, /* AV */ - { 0x0b, KEY_AUDIO}, /* SV */ - { 0x0f, KEY_RADIO}, /* FM */ - - { 0x00, KEY_1}, - { 0x01, KEY_2}, - { 0x02, KEY_3}, - { 0x03, KEY_4}, - { 0x04, KEY_5}, - { 0x05, KEY_6}, - { 0x06, KEY_7}, - { 0x07, KEY_8}, - { 0x08, KEY_9}, - { 0x09, KEY_0}, - { 0x0a, KEY_INFO}, /* OSD */ - { 0x1c, KEY_BACKSPACE}, /* LAST */ - - { 0x0d, KEY_PLAY}, /* PLAY */ - { 0x1e, KEY_CAMERA}, /* SNAPSHOT */ - { 0x1a, KEY_RECORD}, /* RECORD */ - { 0x17, KEY_STOP}, /* STOP */ - - { 0x1f, KEY_UP}, /* UP */ - { 0x44, KEY_DOWN}, /* DOWN */ - { 0x46, KEY_TAB}, /* BACK */ - { 0x4a, KEY_ZOOM}, /* FULLSECREEN */ - - { 0x10, KEY_VOLUMEUP}, /* VOLUMEUP */ - { 0x11, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ - { 0x12, KEY_CHANNELUP}, /* CHANNELUP */ - { 0x13, KEY_CHANNELDOWN}, /* CHANNELDOWN */ - { 0x15, KEY_ENTER}, /* OK */ -}; -DEFINE_LEGACY_IR_KEYTABLE(gadmei_rm008z); -#else -DECLARE_IR_KEYTABLE(gadmei_rm008z); -#endif diff --git a/include/media/keycodes/genius-tvgo-a11mce.h b/include/media/keycodes/genius-tvgo-a11mce.h deleted file mode 100644 index b0aad3b489b0..000000000000 --- a/include/media/keycodes/genius-tvgo-a11mce.h +++ /dev/null @@ -1,60 +0,0 @@ -/* genius-tvgo-a11mce.h - Keytable for genius_tvgo_a11mce Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - * Remote control for the Genius TVGO A11MCE - * Adrian Pardini - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode genius_tvgo_a11mce[] = { - /* Keys 0 to 9 */ - { 0x48, KEY_0 }, - { 0x09, KEY_1 }, - { 0x1d, KEY_2 }, - { 0x1f, KEY_3 }, - { 0x19, KEY_4 }, - { 0x1b, KEY_5 }, - { 0x11, KEY_6 }, - { 0x17, KEY_7 }, - { 0x12, KEY_8 }, - { 0x16, KEY_9 }, - - { 0x54, KEY_RECORD }, /* recording */ - { 0x06, KEY_MUTE }, /* mute */ - { 0x10, KEY_POWER }, - { 0x40, KEY_LAST }, /* recall */ - { 0x4c, KEY_CHANNELUP }, /* channel / program + */ - { 0x00, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x0d, KEY_VOLUMEUP }, - { 0x15, KEY_VOLUMEDOWN }, - { 0x4d, KEY_OK }, /* also labeled as Pause */ - { 0x1c, KEY_ZOOM }, /* full screen and Stop*/ - { 0x02, KEY_MODE }, /* AV Source or Rewind*/ - { 0x04, KEY_LIST }, /* -/-- */ - /* small arrows above numbers */ - { 0x1a, KEY_NEXT }, /* also Fast Forward */ - { 0x0e, KEY_PREVIOUS }, /* also Rewind */ - /* these are in a rather non standard layout and have - an alternate name written */ - { 0x1e, KEY_UP }, /* Video Setting */ - { 0x0a, KEY_DOWN }, /* Video Default */ - { 0x05, KEY_CAMERA }, /* Snapshot */ - { 0x0c, KEY_RIGHT }, /* Hide Panel */ - /* Four buttons without label */ - { 0x49, KEY_RED }, - { 0x0b, KEY_GREEN }, - { 0x13, KEY_YELLOW }, - { 0x50, KEY_BLUE }, -}; -DEFINE_LEGACY_IR_KEYTABLE(genius_tvgo_a11mce); -#else -DECLARE_IR_KEYTABLE(genius_tvgo_a11mce); -#endif diff --git a/include/media/keycodes/gotview7135.h b/include/media/keycodes/gotview7135.h deleted file mode 100644 index 1d108e85a342..000000000000 --- a/include/media/keycodes/gotview7135.h +++ /dev/null @@ -1,55 +0,0 @@ -/* gotview7135.h - Keytable for gotview7135 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Mike Baikov */ - -#ifdef IR_KEYMAPS -static struct ir_scancode gotview7135[] = { - - { 0x11, KEY_POWER }, - { 0x35, KEY_TV }, - { 0x1b, KEY_0 }, - { 0x29, KEY_1 }, - { 0x19, KEY_2 }, - { 0x39, KEY_3 }, - { 0x1f, KEY_4 }, - { 0x2c, KEY_5 }, - { 0x21, KEY_6 }, - { 0x24, KEY_7 }, - { 0x18, KEY_8 }, - { 0x2b, KEY_9 }, - { 0x3b, KEY_AGAIN }, /* LOOP */ - { 0x06, KEY_AUDIO }, - { 0x31, KEY_PRINT }, /* PREVIEW */ - { 0x3e, KEY_VIDEO }, - { 0x10, KEY_CHANNELUP }, - { 0x20, KEY_CHANNELDOWN }, - { 0x0c, KEY_VOLUMEDOWN }, - { 0x28, KEY_VOLUMEUP }, - { 0x08, KEY_MUTE }, - { 0x26, KEY_SEARCH }, /* SCAN */ - { 0x3f, KEY_CAMERA }, /* SNAPSHOT */ - { 0x12, KEY_RECORD }, - { 0x32, KEY_STOP }, - { 0x3c, KEY_PLAY }, - { 0x1d, KEY_REWIND }, - { 0x2d, KEY_PAUSE }, - { 0x0d, KEY_FORWARD }, - { 0x05, KEY_ZOOM }, /*FULL*/ - - { 0x2a, KEY_F21 }, /* LIVE TIMESHIFT */ - { 0x0e, KEY_F22 }, /* MIN TIMESHIFT */ - { 0x1e, KEY_TIME }, /* TIMESHIFT */ - { 0x38, KEY_F24 }, /* NORMAL TIMESHIFT */ -}; -DEFINE_LEGACY_IR_KEYTABLE(gotview7135); -#else -DECLARE_IR_KEYTABLE(gotview7135); -#endif diff --git a/include/media/keycodes/hauppauge-new.h b/include/media/keycodes/hauppauge-new.h deleted file mode 100644 index f06702d0ebd2..000000000000 --- a/include/media/keycodes/hauppauge-new.h +++ /dev/null @@ -1,76 +0,0 @@ -/* hauppauge-new.h - Keytable for hauppauge_new Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Hauppauge: the newer, gray remotes (seems there are multiple - * slightly different versions), shipped with cx88+ivtv cards. - * almost rc5 coding, but some non-standard keys */ - -#ifdef IR_KEYMAPS -static struct ir_scancode hauppauge_new[] = { - /* Keys 0 to 9 */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0a, KEY_TEXT }, /* keypad asterisk as well */ - { 0x0b, KEY_RED }, /* red button */ - { 0x0c, KEY_RADIO }, - { 0x0d, KEY_MENU }, - { 0x0e, KEY_SUBTITLE }, /* also the # key */ - { 0x0f, KEY_MUTE }, - { 0x10, KEY_VOLUMEUP }, - { 0x11, KEY_VOLUMEDOWN }, - { 0x12, KEY_PREVIOUS }, /* previous channel */ - { 0x14, KEY_UP }, - { 0x15, KEY_DOWN }, - { 0x16, KEY_LEFT }, - { 0x17, KEY_RIGHT }, - { 0x18, KEY_VIDEO }, /* Videos */ - { 0x19, KEY_AUDIO }, /* Music */ - /* 0x1a: Pictures - presume this means - "Multimedia Home Platform" - - no "PICTURES" key in input.h - */ - { 0x1a, KEY_MHP }, - - { 0x1b, KEY_EPG }, /* Guide */ - { 0x1c, KEY_TV }, - { 0x1e, KEY_NEXTSONG }, /* skip >| */ - { 0x1f, KEY_EXIT }, /* back/exit */ - { 0x20, KEY_CHANNELUP }, /* channel / program + */ - { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x22, KEY_CHANNEL }, /* source (old black remote) */ - { 0x24, KEY_PREVIOUSSONG }, /* replay |< */ - { 0x25, KEY_ENTER }, /* OK */ - { 0x26, KEY_SLEEP }, /* minimize (old black remote) */ - { 0x29, KEY_BLUE }, /* blue key */ - { 0x2e, KEY_GREEN }, /* green button */ - { 0x30, KEY_PAUSE }, /* pause */ - { 0x32, KEY_REWIND }, /* backward << */ - { 0x34, KEY_FASTFORWARD }, /* forward >> */ - { 0x35, KEY_PLAY }, - { 0x36, KEY_STOP }, - { 0x37, KEY_RECORD }, /* recording */ - { 0x38, KEY_YELLOW }, /* yellow key */ - { 0x3b, KEY_SELECT }, /* top right button */ - { 0x3c, KEY_ZOOM }, /* full */ - { 0x3d, KEY_POWER }, /* system power (green button) */ -}; -DEFINE_LEGACY_IR_KEYTABLE(hauppauge_new); -#else -DECLARE_IR_KEYTABLE(hauppauge_new); -#endif diff --git a/include/media/keycodes/iodata-bctv7e.h b/include/media/keycodes/iodata-bctv7e.h deleted file mode 100644 index 6dea92a8f3a7..000000000000 --- a/include/media/keycodes/iodata-bctv7e.h +++ /dev/null @@ -1,64 +0,0 @@ -/* iodata-bctv7e.h - Keytable for iodata_bctv7e Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* IO-DATA BCTV7E Remote */ - -#ifdef IR_KEYMAPS -static struct ir_scancode iodata_bctv7e[] = { - { 0x40, KEY_TV }, - { 0x20, KEY_RADIO }, /* FM */ - { 0x60, KEY_EPG }, - { 0x00, KEY_POWER }, - - /* Keys 0 to 9 */ - { 0x44, KEY_0 }, /* 10 */ - { 0x50, KEY_1 }, - { 0x30, KEY_2 }, - { 0x70, KEY_3 }, - { 0x48, KEY_4 }, - { 0x28, KEY_5 }, - { 0x68, KEY_6 }, - { 0x58, KEY_7 }, - { 0x38, KEY_8 }, - { 0x78, KEY_9 }, - - { 0x10, KEY_L }, /* Live */ - { 0x08, KEY_TIME }, /* Time Shift */ - - { 0x18, KEY_PLAYPAUSE }, /* Play */ - - { 0x24, KEY_ENTER }, /* 11 */ - { 0x64, KEY_ESC }, /* 12 */ - { 0x04, KEY_M }, /* Multi */ - - { 0x54, KEY_VIDEO }, - { 0x34, KEY_CHANNELUP }, - { 0x74, KEY_VOLUMEUP }, - { 0x14, KEY_MUTE }, - - { 0x4c, KEY_VCR }, /* SVIDEO */ - { 0x2c, KEY_CHANNELDOWN }, - { 0x6c, KEY_VOLUMEDOWN }, - { 0x0c, KEY_ZOOM }, - - { 0x5c, KEY_PAUSE }, - { 0x3c, KEY_RED }, /* || (red) */ - { 0x7c, KEY_RECORD }, /* recording */ - { 0x1c, KEY_STOP }, - - { 0x41, KEY_REWIND }, /* backward << */ - { 0x21, KEY_PLAY }, - { 0x61, KEY_FASTFORWARD }, /* forward >> */ - { 0x01, KEY_NEXT }, /* skip >| */ -}; -DEFINE_LEGACY_IR_KEYTABLE(iodata_bctv7e); -#else -DECLARE_IR_KEYTABLE(iodata_bctv7e); -#endif diff --git a/include/media/keycodes/kaiomy.h b/include/media/keycodes/kaiomy.h deleted file mode 100644 index 2d6dbbc073a8..000000000000 --- a/include/media/keycodes/kaiomy.h +++ /dev/null @@ -1,63 +0,0 @@ -/* kaiomy.h - Keytable for kaiomy Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Kaiomy TVnPC U2 - Mauro Carvalho Chehab - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode kaiomy[] = { - { 0x43, KEY_POWER2}, - { 0x01, KEY_LIST}, - { 0x0b, KEY_ZOOM}, - { 0x03, KEY_POWER}, - - { 0x04, KEY_1}, - { 0x08, KEY_2}, - { 0x02, KEY_3}, - - { 0x0f, KEY_4}, - { 0x05, KEY_5}, - { 0x06, KEY_6}, - - { 0x0c, KEY_7}, - { 0x0d, KEY_8}, - { 0x0a, KEY_9}, - - { 0x11, KEY_0}, - - { 0x09, KEY_CHANNELUP}, - { 0x07, KEY_CHANNELDOWN}, - - { 0x0e, KEY_VOLUMEUP}, - { 0x13, KEY_VOLUMEDOWN}, - - { 0x10, KEY_HOME}, - { 0x12, KEY_ENTER}, - - { 0x14, KEY_RECORD}, - { 0x15, KEY_STOP}, - { 0x16, KEY_PLAY}, - { 0x17, KEY_MUTE}, - - { 0x18, KEY_UP}, - { 0x19, KEY_DOWN}, - { 0x1a, KEY_LEFT}, - { 0x1b, KEY_RIGHT}, - - { 0x1c, KEY_RED}, - { 0x1d, KEY_GREEN}, - { 0x1e, KEY_YELLOW}, - { 0x1f, KEY_BLUE}, -}; -DEFINE_LEGACY_IR_KEYTABLE(kaiomy); -#else -DECLARE_IR_KEYTABLE(kaiomy); -#endif diff --git a/include/media/keycodes/kworld-315u.h b/include/media/keycodes/kworld-315u.h deleted file mode 100644 index 44e29b61cb6f..000000000000 --- a/include/media/keycodes/kworld-315u.h +++ /dev/null @@ -1,59 +0,0 @@ -/* kworld-315u.h - Keytable for kworld_315u Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Kworld 315U - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode kworld_315u[] = { - { 0x6143, KEY_POWER }, - { 0x6101, KEY_TUNER }, /* source */ - { 0x610b, KEY_ZOOM }, - { 0x6103, KEY_POWER2 }, /* shutdown */ - - { 0x6104, KEY_1 }, - { 0x6108, KEY_2 }, - { 0x6102, KEY_3 }, - { 0x6109, KEY_CHANNELUP }, - - { 0x610f, KEY_4 }, - { 0x6105, KEY_5 }, - { 0x6106, KEY_6 }, - { 0x6107, KEY_CHANNELDOWN }, - - { 0x610c, KEY_7 }, - { 0x610d, KEY_8 }, - { 0x610a, KEY_9 }, - { 0x610e, KEY_VOLUMEUP }, - - { 0x6110, KEY_LAST }, - { 0x6111, KEY_0 }, - { 0x6112, KEY_ENTER }, - { 0x6113, KEY_VOLUMEDOWN }, - - { 0x6114, KEY_RECORD }, - { 0x6115, KEY_STOP }, - { 0x6116, KEY_PLAY }, - { 0x6117, KEY_MUTE }, - - { 0x6118, KEY_UP }, - { 0x6119, KEY_DOWN }, - { 0x611a, KEY_LEFT }, - { 0x611b, KEY_RIGHT }, - - { 0x611c, KEY_RED }, - { 0x611d, KEY_GREEN }, - { 0x611e, KEY_YELLOW }, - { 0x611f, KEY_BLUE }, -}; -DEFINE_IR_KEYTABLE(kworld_315u, IR_TYPE_NEC); -#else -DECLARE_IR_KEYTABLE(kworld_315u); -#endif diff --git a/include/media/keycodes/kworld-plus-tv-analog.h b/include/media/keycodes/kworld-plus-tv-analog.h deleted file mode 100644 index 2b4ae0b75e52..000000000000 --- a/include/media/keycodes/kworld-plus-tv-analog.h +++ /dev/null @@ -1,75 +0,0 @@ -/* kworld-plus-tv-analog.h - Keytable for kworld_plus_tv_analog Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Kworld Plus TV Analog Lite PCI IR - Mauro Carvalho Chehab - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode kworld_plus_tv_analog[] = { - { 0x0c, KEY_PROG1 }, /* Kworld key */ - { 0x16, KEY_CLOSECD }, /* -> ) */ - { 0x1d, KEY_POWER2 }, - - { 0x00, KEY_1 }, - { 0x01, KEY_2 }, - { 0x02, KEY_3 }, /* Two keys have the same code: 3 and left */ - { 0x03, KEY_4 }, /* Two keys have the same code: 3 and right */ - { 0x04, KEY_5 }, - { 0x05, KEY_6 }, - { 0x06, KEY_7 }, - { 0x07, KEY_8 }, - { 0x08, KEY_9 }, - { 0x0a, KEY_0 }, - - { 0x09, KEY_AGAIN }, - { 0x14, KEY_MUTE }, - - { 0x20, KEY_UP }, - { 0x21, KEY_DOWN }, - { 0x0b, KEY_ENTER }, - - { 0x10, KEY_CHANNELUP }, - { 0x11, KEY_CHANNELDOWN }, - - /* Couldn't map key left/key right since those - conflict with '3' and '4' scancodes - I dunno what the original driver does - */ - - { 0x13, KEY_VOLUMEUP }, - { 0x12, KEY_VOLUMEDOWN }, - - /* The lower part of the IR - There are several duplicated keycodes there. - Most of them conflict with digits. - Add mappings just to the unused scancodes. - Somehow, the original driver has a way to know, - but this doesn't seem to be on some GPIO. - Also, it is not related to the time between keyup - and keydown. - */ - { 0x19, KEY_TIME}, /* Timeshift */ - { 0x1a, KEY_STOP}, - { 0x1b, KEY_RECORD}, - - { 0x22, KEY_TEXT}, - - { 0x15, KEY_AUDIO}, /* ((*)) */ - { 0x0f, KEY_ZOOM}, - { 0x1c, KEY_CAMERA}, /* snapshot */ - - { 0x18, KEY_RED}, /* B */ - { 0x23, KEY_GREEN}, /* C */ -}; -DEFINE_LEGACY_IR_KEYTABLE(kworld_plus_tv_analog); -#else -DECLARE_IR_KEYTABLE(kworld_plus_tv_analog); -#endif diff --git a/include/media/keycodes/manli.h b/include/media/keycodes/manli.h deleted file mode 100644 index 9f8e752505c8..000000000000 --- a/include/media/keycodes/manli.h +++ /dev/null @@ -1,111 +0,0 @@ -/* manli.h - Keytable for manli Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Michael Tokarev - http://www.corpit.ru/mjt/beholdTV/remote_control.jpg - keytable is used by MANLI MTV00[0x0c] and BeholdTV 40[13] at - least, and probably other cards too. - The "ascii-art picture" below (in comments, first row - is the keycode in hex, and subsequent row(s) shows - the button labels (several variants when appropriate) - helps to descide which keycodes to assign to the buttons. - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode manli[] = { - - /* 0x1c 0x12 * - * FUNCTION POWER * - * FM (|) * - * */ - { 0x1c, KEY_RADIO }, /*XXX*/ - { 0x12, KEY_POWER }, - - /* 0x01 0x02 0x03 * - * 1 2 3 * - * * - * 0x04 0x05 0x06 * - * 4 5 6 * - * * - * 0x07 0x08 0x09 * - * 7 8 9 * - * */ - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - /* 0x0a 0x00 0x17 * - * RECALL 0 +100 * - * PLUS * - * */ - { 0x0a, KEY_AGAIN }, /*XXX KEY_REWIND? */ - { 0x00, KEY_0 }, - { 0x17, KEY_DIGITS }, /*XXX*/ - - /* 0x14 0x10 * - * MENU INFO * - * OSD */ - { 0x14, KEY_MENU }, - { 0x10, KEY_INFO }, - - /* 0x0b * - * Up * - * * - * 0x18 0x16 0x0c * - * Left Ok Right * - * * - * 0x015 * - * Down * - * */ - { 0x0b, KEY_UP }, - { 0x18, KEY_LEFT }, - { 0x16, KEY_OK }, /*XXX KEY_SELECT? KEY_ENTER? */ - { 0x0c, KEY_RIGHT }, - { 0x15, KEY_DOWN }, - - /* 0x11 0x0d * - * TV/AV MODE * - * SOURCE STEREO * - * */ - { 0x11, KEY_TV }, /*XXX*/ - { 0x0d, KEY_MODE }, /*XXX there's no KEY_STEREO */ - - /* 0x0f 0x1b 0x1a * - * AUDIO Vol+ Chan+ * - * TIMESHIFT??? * - * * - * 0x0e 0x1f 0x1e * - * SLEEP Vol- Chan- * - * */ - { 0x0f, KEY_AUDIO }, - { 0x1b, KEY_VOLUMEUP }, - { 0x1a, KEY_CHANNELUP }, - { 0x0e, KEY_TIME }, - { 0x1f, KEY_VOLUMEDOWN }, - { 0x1e, KEY_CHANNELDOWN }, - - /* 0x13 0x19 * - * MUTE SNAPSHOT* - * */ - { 0x13, KEY_MUTE }, - { 0x19, KEY_CAMERA }, - - /* 0x1d unused ? */ -}; -DEFINE_LEGACY_IR_KEYTABLE(manli); -#else -DECLARE_IR_KEYTABLE(manli); -#endif diff --git a/include/media/keycodes/msi-tvanywhere-plus.h b/include/media/keycodes/msi-tvanywhere-plus.h deleted file mode 100644 index c5e51ad55976..000000000000 --- a/include/media/keycodes/msi-tvanywhere-plus.h +++ /dev/null @@ -1,100 +0,0 @@ -/* msi-tvanywhere-plus.h - Keytable for msi_tvanywhere_plus Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - Keycodes for remote on the MSI TV@nywhere Plus. The controller IC on the card - is marked "KS003". The controller is I2C at address 0x30, but does not seem - to respond to probes until a read is performed from a valid device. - I don't know why... - - Note: This remote may be of similar or identical design to the - Pixelview remote (?). The raw codes and duplicate button codes - appear to be the same. - - Henry Wong - Some changes to formatting and keycodes by Mark Schultz - -*/ - -#ifdef IR_KEYMAPS -static struct ir_scancode msi_tvanywhere_plus[] = { - -/* ---- Remote Button Layout ---- - - POWER SOURCE SCAN MUTE - TV/FM 1 2 3 - |> 4 5 6 - <| 7 8 9 - ^^UP 0 + RECALL - vvDN RECORD STOP PLAY - - MINIMIZE ZOOM - - CH+ - VOL- VOL+ - CH- - - SNAPSHOT MTS - - << FUNC >> RESET -*/ - - { 0x01, KEY_1 }, /* 1 */ - { 0x0b, KEY_2 }, /* 2 */ - { 0x1b, KEY_3 }, /* 3 */ - { 0x05, KEY_4 }, /* 4 */ - { 0x09, KEY_5 }, /* 5 */ - { 0x15, KEY_6 }, /* 6 */ - { 0x06, KEY_7 }, /* 7 */ - { 0x0a, KEY_8 }, /* 8 */ - { 0x12, KEY_9 }, /* 9 */ - { 0x02, KEY_0 }, /* 0 */ - { 0x10, KEY_KPPLUS }, /* + */ - { 0x13, KEY_AGAIN }, /* Recall */ - - { 0x1e, KEY_POWER }, /* Power */ - { 0x07, KEY_TUNER }, /* Source */ - { 0x1c, KEY_SEARCH }, /* Scan */ - { 0x18, KEY_MUTE }, /* Mute */ - - { 0x03, KEY_RADIO }, /* TV/FM */ - /* The next four keys are duplicates that appear to send the - same IR code as Ch+, Ch-, >>, and << . The raw code assigned - to them is the actual code + 0x20 - they will never be - detected as such unless some way is discovered to distinguish - these buttons from those that have the same code. */ - { 0x3f, KEY_RIGHT }, /* |> and Ch+ */ - { 0x37, KEY_LEFT }, /* <| and Ch- */ - { 0x2c, KEY_UP }, /* ^^Up and >> */ - { 0x24, KEY_DOWN }, /* vvDn and << */ - - { 0x00, KEY_RECORD }, /* Record */ - { 0x08, KEY_STOP }, /* Stop */ - { 0x11, KEY_PLAY }, /* Play */ - - { 0x0f, KEY_CLOSE }, /* Minimize */ - { 0x19, KEY_ZOOM }, /* Zoom */ - { 0x1a, KEY_CAMERA }, /* Snapshot */ - { 0x0d, KEY_LANGUAGE }, /* MTS */ - - { 0x14, KEY_VOLUMEDOWN }, /* Vol- */ - { 0x16, KEY_VOLUMEUP }, /* Vol+ */ - { 0x17, KEY_CHANNELDOWN }, /* Ch- */ - { 0x1f, KEY_CHANNELUP }, /* Ch+ */ - - { 0x04, KEY_REWIND }, /* << */ - { 0x0e, KEY_MENU }, /* Function */ - { 0x0c, KEY_FASTFORWARD }, /* >> */ - { 0x1d, KEY_RESTART }, /* Reset */ -}; -DEFINE_LEGACY_IR_KEYTABLE(msi_tvanywhere_plus); -#else -DECLARE_IR_KEYTABLE(msi_tvanywhere_plus); -#endif diff --git a/include/media/keycodes/msi-tvanywhere.h b/include/media/keycodes/msi-tvanywhere.h deleted file mode 100644 index 2f4cfe100ab2..000000000000 --- a/include/media/keycodes/msi-tvanywhere.h +++ /dev/null @@ -1,44 +0,0 @@ -/* msi-tvanywhere.h - Keytable for msi_tvanywhere Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode msi_tvanywhere[] = { - /* Keys 0 to 9 */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0c, KEY_MUTE }, - { 0x0f, KEY_SCREEN }, /* Full Screen */ - { 0x10, KEY_FN }, /* Funtion */ - { 0x11, KEY_TIME }, /* Time shift */ - { 0x12, KEY_POWER }, - { 0x13, KEY_MEDIA }, /* MTS */ - { 0x14, KEY_SLOW }, - { 0x16, KEY_REWIND }, /* backward << */ - { 0x17, KEY_ENTER }, /* Return */ - { 0x18, KEY_FASTFORWARD }, /* forward >> */ - { 0x1a, KEY_CHANNELUP }, - { 0x1b, KEY_VOLUMEUP }, - { 0x1e, KEY_CHANNELDOWN }, - { 0x1f, KEY_VOLUMEDOWN }, -}; -DEFINE_LEGACY_IR_KEYTABLE(msi_tvanywhere); -#else -DECLARE_IR_KEYTABLE(msi_tvanywhere); -#endif diff --git a/include/media/keycodes/nebula.h b/include/media/keycodes/nebula.h deleted file mode 100644 index 4e2eb1f13685..000000000000 --- a/include/media/keycodes/nebula.h +++ /dev/null @@ -1,73 +0,0 @@ -/* nebula.h - Keytable for nebula Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode nebula[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x0a, KEY_TV }, - { 0x0b, KEY_AUX }, - { 0x0c, KEY_DVD }, - { 0x0d, KEY_POWER }, - { 0x0e, KEY_MHP }, /* labelled 'Picture' */ - { 0x0f, KEY_AUDIO }, - { 0x10, KEY_INFO }, - { 0x11, KEY_F13 }, /* 16:9 */ - { 0x12, KEY_F14 }, /* 14:9 */ - { 0x13, KEY_EPG }, - { 0x14, KEY_EXIT }, - { 0x15, KEY_MENU }, - { 0x16, KEY_UP }, - { 0x17, KEY_DOWN }, - { 0x18, KEY_LEFT }, - { 0x19, KEY_RIGHT }, - { 0x1a, KEY_ENTER }, - { 0x1b, KEY_CHANNELUP }, - { 0x1c, KEY_CHANNELDOWN }, - { 0x1d, KEY_VOLUMEUP }, - { 0x1e, KEY_VOLUMEDOWN }, - { 0x1f, KEY_RED }, - { 0x20, KEY_GREEN }, - { 0x21, KEY_YELLOW }, - { 0x22, KEY_BLUE }, - { 0x23, KEY_SUBTITLE }, - { 0x24, KEY_F15 }, /* AD */ - { 0x25, KEY_TEXT }, - { 0x26, KEY_MUTE }, - { 0x27, KEY_REWIND }, - { 0x28, KEY_STOP }, - { 0x29, KEY_PLAY }, - { 0x2a, KEY_FASTFORWARD }, - { 0x2b, KEY_F16 }, /* chapter */ - { 0x2c, KEY_PAUSE }, - { 0x2d, KEY_PLAY }, - { 0x2e, KEY_RECORD }, - { 0x2f, KEY_F17 }, /* picture in picture */ - { 0x30, KEY_KPPLUS }, /* zoom in */ - { 0x31, KEY_KPMINUS }, /* zoom out */ - { 0x32, KEY_F18 }, /* capture */ - { 0x33, KEY_F19 }, /* web */ - { 0x34, KEY_EMAIL }, - { 0x35, KEY_PHONE }, - { 0x36, KEY_PC }, -}; -DEFINE_LEGACY_IR_KEYTABLE(nebula); -#else -DECLARE_IR_KEYTABLE(nebula); -#endif diff --git a/include/media/keycodes/nec-terratec-cinergy-xs.h b/include/media/keycodes/nec-terratec-cinergy-xs.h deleted file mode 100644 index 39ede1ebc764..000000000000 --- a/include/media/keycodes/nec-terratec-cinergy-xs.h +++ /dev/null @@ -1,81 +0,0 @@ -/* nec-terratec-cinergy-xs.h - Keytable for nec_terratec_cinergy_xs Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Terratec Cinergy Hybrid T USB XS FM - Mauro Carvalho Chehab - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode nec_terratec_cinergy_xs[] = { - { 0x1441, KEY_HOME}, - { 0x1401, KEY_POWER2}, - - { 0x1442, KEY_MENU}, /* DVD menu */ - { 0x1443, KEY_SUBTITLE}, - { 0x1444, KEY_TEXT}, /* Teletext */ - { 0x1445, KEY_DELETE}, - - { 0x1402, KEY_1}, - { 0x1403, KEY_2}, - { 0x1404, KEY_3}, - { 0x1405, KEY_4}, - { 0x1406, KEY_5}, - { 0x1407, KEY_6}, - { 0x1408, KEY_7}, - { 0x1409, KEY_8}, - { 0x140a, KEY_9}, - { 0x140c, KEY_0}, - - { 0x140b, KEY_TUNER}, /* AV */ - { 0x140d, KEY_MODE}, /* A.B */ - - { 0x1446, KEY_TV}, - { 0x1447, KEY_DVD}, - { 0x1449, KEY_VIDEO}, - { 0x144a, KEY_RADIO}, /* Music */ - { 0x144b, KEY_CAMERA}, /* PIC */ - - { 0x1410, KEY_UP}, - { 0x1411, KEY_LEFT}, - { 0x1412, KEY_OK}, - { 0x1413, KEY_RIGHT}, - { 0x1414, KEY_DOWN}, - - { 0x140f, KEY_EPG}, - { 0x1416, KEY_INFO}, - { 0x144d, KEY_BACKSPACE}, - - { 0x141c, KEY_VOLUMEUP}, - { 0x141e, KEY_VOLUMEDOWN}, - - { 0x144c, KEY_PLAY}, - { 0x141d, KEY_MUTE}, - - { 0x141b, KEY_CHANNELUP}, - { 0x141f, KEY_CHANNELDOWN}, - - { 0x1417, KEY_RED}, - { 0x1418, KEY_GREEN}, - { 0x1419, KEY_YELLOW}, - { 0x141a, KEY_BLUE}, - - { 0x1458, KEY_RECORD}, - { 0x1448, KEY_STOP}, - { 0x1440, KEY_PAUSE}, - - { 0x1454, KEY_LAST}, - { 0x144e, KEY_REWIND}, - { 0x144f, KEY_FASTFORWARD}, - { 0x145c, KEY_NEXT}, -}; -DEFINE_IR_KEYTABLE(nec_terratec_cinergy_xs, IR_TYPE_NEC); -#else -DECLARE_IR_KEYTABLE(nec_terratec_cinergy_xs); -#endif diff --git a/include/media/keycodes/norwood.h b/include/media/keycodes/norwood.h deleted file mode 100644 index 7f6cc4c243e6..000000000000 --- a/include/media/keycodes/norwood.h +++ /dev/null @@ -1,61 +0,0 @@ -/* norwood.h - Keytable for norwood Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Norwood Micro (non-Pro) TV Tuner - By Peter Naulls - Key comments are the functions given in the manual */ - -#ifdef IR_KEYMAPS -static struct ir_scancode norwood[] = { - /* 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 */ -}; -DEFINE_LEGACY_IR_KEYTABLE(norwood); -#else -DECLARE_IR_KEYTABLE(norwood); -#endif diff --git a/include/media/keycodes/npgtech.h b/include/media/keycodes/npgtech.h deleted file mode 100644 index dd1ba828181b..000000000000 --- a/include/media/keycodes/npgtech.h +++ /dev/null @@ -1,57 +0,0 @@ -/* npgtech.h - Keytable for npgtech Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode npgtech[] = { - { 0x1d, KEY_SWITCHVIDEOMODE }, /* switch inputs */ - { 0x2a, KEY_FRONT }, - - { 0x3e, KEY_1 }, - { 0x02, KEY_2 }, - { 0x06, KEY_3 }, - { 0x0a, KEY_4 }, - { 0x0e, KEY_5 }, - { 0x12, KEY_6 }, - { 0x16, KEY_7 }, - { 0x1a, KEY_8 }, - { 0x1e, KEY_9 }, - { 0x3a, KEY_0 }, - { 0x22, KEY_NUMLOCK }, /* -/-- */ - { 0x20, KEY_REFRESH }, - - { 0x03, KEY_BRIGHTNESSDOWN }, - { 0x28, KEY_AUDIO }, - { 0x3c, KEY_CHANNELUP }, - { 0x3f, KEY_VOLUMEDOWN }, - { 0x2e, KEY_MUTE }, - { 0x3b, KEY_VOLUMEUP }, - { 0x00, KEY_CHANNELDOWN }, - { 0x07, KEY_BRIGHTNESSUP }, - { 0x2c, KEY_TEXT }, - - { 0x37, KEY_RECORD }, - { 0x17, KEY_PLAY }, - { 0x13, KEY_PAUSE }, - { 0x26, KEY_STOP }, - { 0x18, KEY_FASTFORWARD }, - { 0x14, KEY_REWIND }, - { 0x33, KEY_ZOOM }, - { 0x32, KEY_KEYBOARD }, - { 0x30, KEY_GOTO }, /* Pointing arrow */ - { 0x36, KEY_MACRO }, /* Maximize/Minimize (yellow) */ - { 0x0b, KEY_RADIO }, - { 0x10, KEY_POWER }, - -}; -DEFINE_LEGACY_IR_KEYTABLE(npgtech); -#else -DECLARE_IR_KEYTABLE(npgtech); -#endif diff --git a/include/media/keycodes/pctv-sedna.h b/include/media/keycodes/pctv-sedna.h deleted file mode 100644 index b1d511f2f567..000000000000 --- a/include/media/keycodes/pctv-sedna.h +++ /dev/null @@ -1,56 +0,0 @@ -/* pctv-sedna.h - Keytable for pctv_sedna Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Mapping for the 28 key remote control as seen at - http://www.sednacomputer.com/photo/cardbus-tv.jpg - Pavel Mihaylov - Also for the remote bundled with Kozumi KTV-01C card */ - -#ifdef IR_KEYMAPS -static struct ir_scancode pctv_sedna[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0a, KEY_AGAIN }, /* Recall */ - { 0x0b, KEY_CHANNELUP }, - { 0x0c, KEY_VOLUMEUP }, - { 0x0d, KEY_MODE }, /* Stereo */ - { 0x0e, KEY_STOP }, - { 0x0f, KEY_PREVIOUSSONG }, - { 0x10, KEY_ZOOM }, - { 0x11, KEY_TUNER }, /* Source */ - { 0x12, KEY_POWER }, - { 0x13, KEY_MUTE }, - { 0x15, KEY_CHANNELDOWN }, - { 0x18, KEY_VOLUMEDOWN }, - { 0x19, KEY_CAMERA }, /* Snapshot */ - { 0x1a, KEY_NEXTSONG }, - { 0x1b, KEY_TIME }, /* Time Shift */ - { 0x1c, KEY_RADIO }, /* FM Radio */ - { 0x1d, KEY_RECORD }, - { 0x1e, KEY_PAUSE }, - /* additional codes for Kozumi's remote */ - { 0x14, KEY_INFO }, /* OSD */ - { 0x16, KEY_OK }, /* OK */ - { 0x17, KEY_DIGITS }, /* Plus */ - { 0x1f, KEY_PLAY }, /* Play */ -}; -DEFINE_LEGACY_IR_KEYTABLE(pctv_sedna); -#else -DECLARE_IR_KEYTABLE(pctv_sedna); -#endif diff --git a/include/media/keycodes/pinnacle-color.h b/include/media/keycodes/pinnacle-color.h deleted file mode 100644 index a08eaeb74062..000000000000 --- a/include/media/keycodes/pinnacle-color.h +++ /dev/null @@ -1,71 +0,0 @@ -/* pinnacle-color.h - Keytable for pinnacle_color Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode pinnacle_color[] = { - { 0x59, KEY_MUTE }, - { 0x4a, KEY_POWER }, - - { 0x18, KEY_TEXT }, - { 0x26, KEY_TV }, - { 0x3d, KEY_PRINT }, - - { 0x48, KEY_RED }, - { 0x04, KEY_GREEN }, - { 0x11, KEY_YELLOW }, - { 0x00, KEY_BLUE }, - - { 0x2d, KEY_VOLUMEUP }, - { 0x1e, KEY_VOLUMEDOWN }, - - { 0x49, KEY_MENU }, - - { 0x16, KEY_CHANNELUP }, - { 0x17, KEY_CHANNELDOWN }, - - { 0x20, KEY_UP }, - { 0x21, KEY_DOWN }, - { 0x22, KEY_LEFT }, - { 0x23, KEY_RIGHT }, - { 0x0d, KEY_SELECT }, - - { 0x08, KEY_BACK }, - { 0x07, KEY_REFRESH }, - - { 0x2f, KEY_ZOOM }, - { 0x29, KEY_RECORD }, - - { 0x4b, KEY_PAUSE }, - { 0x4d, KEY_REWIND }, - { 0x2e, KEY_PLAY }, - { 0x4e, KEY_FORWARD }, - { 0x53, KEY_PREVIOUS }, - { 0x4c, KEY_STOP }, - { 0x54, KEY_NEXT }, - - { 0x69, KEY_0 }, - { 0x6a, KEY_1 }, - { 0x6b, KEY_2 }, - { 0x6c, KEY_3 }, - { 0x6d, KEY_4 }, - { 0x6e, KEY_5 }, - { 0x6f, KEY_6 }, - { 0x70, KEY_7 }, - { 0x71, KEY_8 }, - { 0x72, KEY_9 }, - - { 0x74, KEY_CHANNEL }, - { 0x0a, KEY_BACKSPACE }, -}; -DEFINE_LEGACY_IR_KEYTABLE(pinnacle_color); -#else -DECLARE_IR_KEYTABLE(pinnacle_color); -#endif diff --git a/include/media/keycodes/pinnacle-grey.h b/include/media/keycodes/pinnacle-grey.h deleted file mode 100644 index 3fd250483ce4..000000000000 --- a/include/media/keycodes/pinnacle-grey.h +++ /dev/null @@ -1,66 +0,0 @@ -/* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode pinnacle_grey[] = { - { 0x3a, KEY_0 }, - { 0x31, KEY_1 }, - { 0x32, KEY_2 }, - { 0x33, KEY_3 }, - { 0x34, KEY_4 }, - { 0x35, KEY_5 }, - { 0x36, KEY_6 }, - { 0x37, KEY_7 }, - { 0x38, KEY_8 }, - { 0x39, KEY_9 }, - - { 0x2f, KEY_POWER }, - - { 0x2e, KEY_P }, - { 0x1f, KEY_L }, - { 0x2b, KEY_I }, - - { 0x2d, KEY_SCREEN }, - { 0x1e, KEY_ZOOM }, - { 0x1b, KEY_VOLUMEUP }, - { 0x0f, KEY_VOLUMEDOWN }, - { 0x17, KEY_CHANNELUP }, - { 0x1c, KEY_CHANNELDOWN }, - { 0x25, KEY_INFO }, - - { 0x3c, KEY_MUTE }, - - { 0x3d, KEY_LEFT }, - { 0x3b, KEY_RIGHT }, - - { 0x3f, KEY_UP }, - { 0x3e, KEY_DOWN }, - { 0x1a, KEY_ENTER }, - - { 0x1d, KEY_MENU }, - { 0x19, KEY_AGAIN }, - { 0x16, KEY_PREVIOUSSONG }, - { 0x13, KEY_NEXTSONG }, - { 0x15, KEY_PAUSE }, - { 0x0e, KEY_REWIND }, - { 0x0d, KEY_PLAY }, - { 0x0b, KEY_STOP }, - { 0x07, KEY_FORWARD }, - { 0x27, KEY_RECORD }, - { 0x26, KEY_TUNER }, - { 0x29, KEY_TEXT }, - { 0x2a, KEY_MEDIA }, - { 0x18, KEY_EPG }, -}; -DEFINE_LEGACY_IR_KEYTABLE(pinnacle_grey); -#else -DECLARE_IR_KEYTABLE(pinnacle_grey); -#endif diff --git a/include/media/keycodes/pinnacle-pctv-hd.h b/include/media/keycodes/pinnacle-pctv-hd.h deleted file mode 100644 index be72d50269dc..000000000000 --- a/include/media/keycodes/pinnacle-pctv-hd.h +++ /dev/null @@ -1,49 +0,0 @@ -/* pinnacle-pctv-hd.h - Keytable for pinnacle_pctv_hd Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Pinnacle PCTV HD 800i mini remote */ - -#ifdef IR_KEYMAPS -static struct ir_scancode pinnacle_pctv_hd[] = { - - { 0x0f, KEY_1 }, - { 0x15, KEY_2 }, - { 0x10, KEY_3 }, - { 0x18, KEY_4 }, - { 0x1b, KEY_5 }, - { 0x1e, KEY_6 }, - { 0x11, KEY_7 }, - { 0x21, KEY_8 }, - { 0x12, KEY_9 }, - { 0x27, KEY_0 }, - - { 0x24, KEY_ZOOM }, - { 0x2a, KEY_SUBTITLE }, - - { 0x00, KEY_MUTE }, - { 0x01, KEY_ENTER }, /* Pinnacle Logo */ - { 0x39, KEY_POWER }, - - { 0x03, KEY_VOLUMEUP }, - { 0x09, KEY_VOLUMEDOWN }, - { 0x06, KEY_CHANNELUP }, - { 0x0c, KEY_CHANNELDOWN }, - - { 0x2d, KEY_REWIND }, - { 0x30, KEY_PLAYPAUSE }, - { 0x33, KEY_FASTFORWARD }, - { 0x3c, KEY_STOP }, - { 0x36, KEY_RECORD }, - { 0x3f, KEY_EPG }, /* Labeled "?" */ -}; -DEFINE_LEGACY_IR_KEYTABLE(pinnacle_pctv_hd); -#else -DECLARE_IR_KEYTABLE(pinnacle_pctv_hd); -#endif diff --git a/include/media/keycodes/pixelview-new.h b/include/media/keycodes/pixelview-new.h deleted file mode 100644 index 76ed0c35752b..000000000000 --- a/include/media/keycodes/pixelview-new.h +++ /dev/null @@ -1,59 +0,0 @@ -/* pixelview-new.h - Keytable for pixelview_new Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - Mauro Carvalho Chehab - present on PV MPEG 8000GT - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode pixelview_new[] = { - { 0x3c, KEY_TIME }, /* Timeshift */ - { 0x12, KEY_POWER }, - - { 0x3d, KEY_1 }, - { 0x38, KEY_2 }, - { 0x18, KEY_3 }, - { 0x35, KEY_4 }, - { 0x39, KEY_5 }, - { 0x15, KEY_6 }, - { 0x36, KEY_7 }, - { 0x3a, KEY_8 }, - { 0x1e, KEY_9 }, - { 0x3e, KEY_0 }, - - { 0x1c, KEY_AGAIN }, /* LOOP */ - { 0x3f, KEY_MEDIA }, /* Source */ - { 0x1f, KEY_LAST }, /* +100 */ - { 0x1b, KEY_MUTE }, - - { 0x17, KEY_CHANNELDOWN }, - { 0x16, KEY_CHANNELUP }, - { 0x10, KEY_VOLUMEUP }, - { 0x14, KEY_VOLUMEDOWN }, - { 0x13, KEY_ZOOM }, - - { 0x19, KEY_CAMERA }, /* SNAPSHOT */ - { 0x1a, KEY_SEARCH }, /* scan */ - - { 0x37, KEY_REWIND }, /* << */ - { 0x32, KEY_RECORD }, /* o (red) */ - { 0x33, KEY_FORWARD }, /* >> */ - { 0x11, KEY_STOP }, /* square */ - { 0x3b, KEY_PLAY }, /* > */ - { 0x30, KEY_PLAYPAUSE }, /* || */ - - { 0x31, KEY_TV }, - { 0x34, KEY_RADIO }, -}; -DEFINE_LEGACY_IR_KEYTABLE(pixelview_new); -#else -DECLARE_IR_KEYTABLE(pixelview_new); -#endif diff --git a/include/media/keycodes/pixelview.h b/include/media/keycodes/pixelview.h deleted file mode 100644 index e048277db895..000000000000 --- a/include/media/keycodes/pixelview.h +++ /dev/null @@ -1,59 +0,0 @@ -/* pixelview.h - Keytable for pixelview Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode pixelview[] = { - - { 0x1e, KEY_POWER }, /* power */ - { 0x07, KEY_MEDIA }, /* source */ - { 0x1c, KEY_SEARCH }, /* scan */ - - - { 0x03, KEY_TUNER }, /* TV/FM */ - - { 0x00, KEY_RECORD }, - { 0x08, KEY_STOP }, - { 0x11, KEY_PLAY }, - - { 0x1a, KEY_PLAYPAUSE }, /* freeze */ - { 0x19, KEY_ZOOM }, /* zoom */ - { 0x0f, KEY_TEXT }, /* min */ - - { 0x01, KEY_1 }, - { 0x0b, KEY_2 }, - { 0x1b, KEY_3 }, - { 0x05, KEY_4 }, - { 0x09, KEY_5 }, - { 0x15, KEY_6 }, - { 0x06, KEY_7 }, - { 0x0a, KEY_8 }, - { 0x12, KEY_9 }, - { 0x02, KEY_0 }, - { 0x10, KEY_LAST }, /* +100 */ - { 0x13, KEY_LIST }, /* recall */ - - { 0x1f, KEY_CHANNELUP }, /* chn down */ - { 0x17, KEY_CHANNELDOWN }, /* chn up */ - { 0x16, KEY_VOLUMEUP }, /* vol down */ - { 0x14, KEY_VOLUMEDOWN }, /* vol up */ - - { 0x04, KEY_KPMINUS }, /* <<< */ - { 0x0e, KEY_SETUP }, /* function */ - { 0x0c, KEY_KPPLUS }, /* >>> */ - - { 0x0d, KEY_GOTO }, /* mts */ - { 0x1d, KEY_REFRESH }, /* reset */ - { 0x18, KEY_MUTE }, /* mute/unmute */ -}; -DEFINE_LEGACY_IR_KEYTABLE(pixelview); -#else -DECLARE_IR_KEYTABLE(pixelview); -#endif diff --git a/include/media/keycodes/powercolor-real-angel.h b/include/media/keycodes/powercolor-real-angel.h deleted file mode 100644 index 098c4a992bfa..000000000000 --- a/include/media/keycodes/powercolor-real-angel.h +++ /dev/null @@ -1,57 +0,0 @@ -/* powercolor-real-angel.h - Keytable for powercolor_real_angel Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - * Remote control for Powercolor Real Angel 330 - * Daniel Fraga - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode powercolor_real_angel[] = { - { 0x38, KEY_SWITCHVIDEOMODE }, /* switch inputs */ - { 0x0c, KEY_MEDIA }, /* Turn ON/OFF App */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - { 0x0a, KEY_DIGITS }, /* single, double, tripple digit */ - { 0x29, KEY_PREVIOUS }, /* previous channel */ - { 0x12, KEY_BRIGHTNESSUP }, - { 0x13, KEY_BRIGHTNESSDOWN }, - { 0x2b, KEY_MODE }, /* stereo/mono */ - { 0x2c, KEY_TEXT }, /* teletext */ - { 0x20, KEY_CHANNELUP }, /* channel up */ - { 0x21, KEY_CHANNELDOWN }, /* channel down */ - { 0x10, KEY_VOLUMEUP }, /* volume up */ - { 0x11, KEY_VOLUMEDOWN }, /* volume down */ - { 0x0d, KEY_MUTE }, - { 0x1f, KEY_RECORD }, - { 0x17, KEY_PLAY }, - { 0x16, KEY_PAUSE }, - { 0x0b, KEY_STOP }, - { 0x27, KEY_FASTFORWARD }, - { 0x26, KEY_REWIND }, - { 0x1e, KEY_SEARCH }, /* autoscan */ - { 0x0e, KEY_CAMERA }, /* snapshot */ - { 0x2d, KEY_SETUP }, - { 0x0f, KEY_SCREEN }, /* full screen */ - { 0x14, KEY_RADIO }, /* FM radio */ - { 0x25, KEY_POWER }, /* power */ -}; -DEFINE_LEGACY_IR_KEYTABLE(powercolor_real_angel); -#else -DECLARE_IR_KEYTABLE(powercolor_real_angel); -#endif diff --git a/include/media/keycodes/proteus-2309.h b/include/media/keycodes/proteus-2309.h deleted file mode 100644 index 1993702ca557..000000000000 --- a/include/media/keycodes/proteus-2309.h +++ /dev/null @@ -1,45 +0,0 @@ -/* proteus-2309.h - Keytable for proteus_2309 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Michal Majchrowicz */ - -#ifdef IR_KEYMAPS -static struct ir_scancode proteus_2309[] = { - /* numeric */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x5c, KEY_POWER }, /* power */ - { 0x20, KEY_ZOOM }, /* full screen */ - { 0x0f, KEY_BACKSPACE }, /* recall */ - { 0x1b, KEY_ENTER }, /* mute */ - { 0x41, KEY_RECORD }, /* record */ - { 0x43, KEY_STOP }, /* stop */ - { 0x16, KEY_S }, - { 0x1a, KEY_POWER2 }, /* off */ - { 0x2e, KEY_RED }, - { 0x1f, KEY_CHANNELDOWN }, /* channel - */ - { 0x1c, KEY_CHANNELUP }, /* channel + */ - { 0x10, KEY_VOLUMEDOWN }, /* volume - */ - { 0x1e, KEY_VOLUMEUP }, /* volume + */ - { 0x14, KEY_F1 }, -}; -DEFINE_LEGACY_IR_KEYTABLE(proteus_2309); -#else -DECLARE_IR_KEYTABLE(proteus_2309); -#endif diff --git a/include/media/keycodes/purpletv.h b/include/media/keycodes/purpletv.h deleted file mode 100644 index 14962649a926..000000000000 --- a/include/media/keycodes/purpletv.h +++ /dev/null @@ -1,58 +0,0 @@ -/* purpletv.h - Keytable for purpletv Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode purpletv[] = { - { 0x03, KEY_POWER }, - { 0x6f, KEY_MUTE }, - { 0x10, KEY_BACKSPACE }, /* Recall */ - - { 0x11, KEY_0 }, - { 0x04, KEY_1 }, - { 0x05, KEY_2 }, - { 0x06, KEY_3 }, - { 0x08, KEY_4 }, - { 0x09, KEY_5 }, - { 0x0a, KEY_6 }, - { 0x0c, KEY_7 }, - { 0x0d, KEY_8 }, - { 0x0e, KEY_9 }, - { 0x12, KEY_DOT }, /* 100+ */ - - { 0x07, KEY_VOLUMEUP }, - { 0x0b, KEY_VOLUMEDOWN }, - { 0x1a, KEY_KPPLUS }, - { 0x18, KEY_KPMINUS }, - { 0x15, KEY_UP }, - { 0x1d, KEY_DOWN }, - { 0x0f, KEY_CHANNELUP }, - { 0x13, KEY_CHANNELDOWN }, - { 0x48, KEY_ZOOM }, - - { 0x1b, KEY_VIDEO }, /* Video source */ - { 0x1f, KEY_CAMERA }, /* Snapshot */ - { 0x49, KEY_LANGUAGE }, /* MTS Select */ - { 0x19, KEY_SEARCH }, /* Auto Scan */ - - { 0x4b, KEY_RECORD }, - { 0x46, KEY_PLAY }, - { 0x45, KEY_PAUSE }, /* Pause */ - { 0x44, KEY_STOP }, - { 0x43, KEY_TIME }, /* Time Shift */ - { 0x17, KEY_CHANNEL }, /* SURF CH */ - { 0x40, KEY_FORWARD }, /* Forward ? */ - { 0x42, KEY_REWIND }, /* Backward ? */ - -}; -DEFINE_LEGACY_IR_KEYTABLE(purpletv); -#else -DECLARE_IR_KEYTABLE(purpletv); -#endif diff --git a/include/media/keycodes/pv951.h b/include/media/keycodes/pv951.h deleted file mode 100644 index 33a8bf7b9080..000000000000 --- a/include/media/keycodes/pv951.h +++ /dev/null @@ -1,54 +0,0 @@ -/* pv951.h - Keytable for pv951 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Mark Phalan */ - -#ifdef IR_KEYMAPS -static struct ir_scancode pv951[] = { - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x12, KEY_POWER }, - { 0x10, KEY_MUTE }, - { 0x1f, KEY_VOLUMEDOWN }, - { 0x1b, KEY_VOLUMEUP }, - { 0x1a, KEY_CHANNELUP }, - { 0x1e, KEY_CHANNELDOWN }, - { 0x0e, KEY_PAGEUP }, - { 0x1d, KEY_PAGEDOWN }, - { 0x13, KEY_SOUND }, - - { 0x18, KEY_KPPLUSMINUS }, /* CH +/- */ - { 0x16, KEY_SUBTITLE }, /* CC */ - { 0x0d, KEY_TEXT }, /* TTX */ - { 0x0b, KEY_TV }, /* AIR/CBL */ - { 0x11, KEY_PC }, /* PC/TV */ - { 0x17, KEY_OK }, /* CH RTN */ - { 0x19, KEY_MODE }, /* FUNC */ - { 0x0c, KEY_SEARCH }, /* AUTOSCAN */ - - /* Not sure what to do with these ones! */ - { 0x0f, KEY_SELECT }, /* SOURCE */ - { 0x0a, KEY_KPPLUS }, /* +100 */ - { 0x14, KEY_EQUAL }, /* SYNC */ - { 0x1c, KEY_MEDIA }, /* PC/TV */ -}; -DEFINE_LEGACY_IR_KEYTABLE(pv951); -#else -DECLARE_IR_KEYTABLE(pv951); -#endif diff --git a/include/media/keycodes/rc5-hauppauge-new.h b/include/media/keycodes/rc5-hauppauge-new.h deleted file mode 100644 index f02b59ab4f91..000000000000 --- a/include/media/keycodes/rc5-hauppauge-new.h +++ /dev/null @@ -1,79 +0,0 @@ -/* rc5-hauppauge-new.h - Keytable for rc5_hauppauge_new Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* - * Hauppauge:the newer, gray remotes (seems there are multiple - * slightly different versions), shipped with cx88+ivtv cards. - * - * This table contains the complete RC5 code, instead of just the data part - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode rc5_hauppauge_new[] = { - /* Keys 0 to 9 */ - { 0x1e00, KEY_0 }, - { 0x1e01, KEY_1 }, - { 0x1e02, KEY_2 }, - { 0x1e03, KEY_3 }, - { 0x1e04, KEY_4 }, - { 0x1e05, KEY_5 }, - { 0x1e06, KEY_6 }, - { 0x1e07, KEY_7 }, - { 0x1e08, KEY_8 }, - { 0x1e09, KEY_9 }, - - { 0x1e0a, KEY_TEXT }, /* keypad asterisk as well */ - { 0x1e0b, KEY_RED }, /* red button */ - { 0x1e0c, KEY_RADIO }, - { 0x1e0d, KEY_MENU }, - { 0x1e0e, KEY_SUBTITLE }, /* also the # key */ - { 0x1e0f, KEY_MUTE }, - { 0x1e10, KEY_VOLUMEUP }, - { 0x1e11, KEY_VOLUMEDOWN }, - { 0x1e12, KEY_PREVIOUS }, /* previous channel */ - { 0x1e14, KEY_UP }, - { 0x1e15, KEY_DOWN }, - { 0x1e16, KEY_LEFT }, - { 0x1e17, KEY_RIGHT }, - { 0x1e18, KEY_VIDEO }, /* Videos */ - { 0x1e19, KEY_AUDIO }, /* Music */ - /* 0x1e1a: Pictures - presume this means - "Multimedia Home Platform" - - no "PICTURES" key in input.h - */ - { 0x1e1a, KEY_MHP }, - - { 0x1e1b, KEY_EPG }, /* Guide */ - { 0x1e1c, KEY_TV }, - { 0x1e1e, KEY_NEXTSONG }, /* skip >| */ - { 0x1e1f, KEY_EXIT }, /* back/exit */ - { 0x1e20, KEY_CHANNELUP }, /* channel / program + */ - { 0x1e21, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x1e22, KEY_CHANNEL }, /* source (old black remote) */ - { 0x1e24, KEY_PREVIOUSSONG }, /* replay |< */ - { 0x1e25, KEY_ENTER }, /* OK */ - { 0x1e26, KEY_SLEEP }, /* minimize (old black remote) */ - { 0x1e29, KEY_BLUE }, /* blue key */ - { 0x1e2e, KEY_GREEN }, /* green button */ - { 0x1e30, KEY_PAUSE }, /* pause */ - { 0x1e32, KEY_REWIND }, /* backward << */ - { 0x1e34, KEY_FASTFORWARD }, /* forward >> */ - { 0x1e35, KEY_PLAY }, - { 0x1e36, KEY_STOP }, - { 0x1e37, KEY_RECORD }, /* recording */ - { 0x1e38, KEY_YELLOW }, /* yellow key */ - { 0x1e3b, KEY_SELECT }, /* top right button */ - { 0x1e3c, KEY_ZOOM }, /* full */ - { 0x1e3d, KEY_POWER }, /* system power (green button) */ -}; -DEFINE_IR_KEYTABLE(rc5_hauppauge_new, IR_TYPE_RC5); -#else -DECLARE_IR_KEYTABLE(rc5_hauppauge_new); -#endif diff --git a/include/media/keycodes/rc5-tv.h b/include/media/keycodes/rc5-tv.h deleted file mode 100644 index a429a54e808c..000000000000 --- a/include/media/keycodes/rc5-tv.h +++ /dev/null @@ -1,57 +0,0 @@ -/* rc5-tv.h - Keytable for rc5_tv Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* generic RC5 keytable */ -/* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ -/* used by old (black) Hauppauge remotes */ - -#ifdef IR_KEYMAPS -static struct ir_scancode rc5_tv[] = { - /* Keys 0 to 9 */ - { 0x00, KEY_0 }, - { 0x01, KEY_1 }, - { 0x02, KEY_2 }, - { 0x03, KEY_3 }, - { 0x04, KEY_4 }, - { 0x05, KEY_5 }, - { 0x06, KEY_6 }, - { 0x07, KEY_7 }, - { 0x08, KEY_8 }, - { 0x09, KEY_9 }, - - { 0x0b, KEY_CHANNEL }, /* channel / program (japan: 11) */ - { 0x0c, KEY_POWER }, /* standby */ - { 0x0d, KEY_MUTE }, /* mute / demute */ - { 0x0f, KEY_TV }, /* display */ - { 0x10, KEY_VOLUMEUP }, - { 0x11, KEY_VOLUMEDOWN }, - { 0x12, KEY_BRIGHTNESSUP }, - { 0x13, KEY_BRIGHTNESSDOWN }, - { 0x1e, KEY_SEARCH }, /* search + */ - { 0x20, KEY_CHANNELUP }, /* channel / program + */ - { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ - { 0x22, KEY_CHANNEL }, /* alt / channel */ - { 0x23, KEY_LANGUAGE }, /* 1st / 2nd language */ - { 0x26, KEY_SLEEP }, /* sleeptimer */ - { 0x2e, KEY_MENU }, /* 2nd controls (USA: menu) */ - { 0x30, KEY_PAUSE }, - { 0x32, KEY_REWIND }, - { 0x33, KEY_GOTO }, - { 0x35, KEY_PLAY }, - { 0x36, KEY_STOP }, - { 0x37, KEY_RECORD }, /* recording */ - { 0x3c, KEY_TEXT }, /* teletext submode (Japan: 12) */ - { 0x3d, KEY_SUSPEND }, /* system standby */ - -}; -DEFINE_LEGACY_IR_KEYTABLE(rc5_tv); -#else -DECLARE_IR_KEYTABLE(rc5_tv); -#endif diff --git a/include/media/keycodes/real-audio-220-32-keys.h b/include/media/keycodes/real-audio-220-32-keys.h deleted file mode 100644 index 5f6835dbe4c9..000000000000 --- a/include/media/keycodes/real-audio-220-32-keys.h +++ /dev/null @@ -1,54 +0,0 @@ -/* real-audio-220-32-keys.h - Keytable for real_audio_220_32_keys Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Zogis Real Audio 220 - 32 keys IR */ - -#ifdef IR_KEYMAPS -static struct ir_scancode real_audio_220_32_keys[] = { - { 0x1c, KEY_RADIO}, - { 0x12, KEY_POWER2}, - - { 0x01, KEY_1}, - { 0x02, KEY_2}, - { 0x03, KEY_3}, - { 0x04, KEY_4}, - { 0x05, KEY_5}, - { 0x06, KEY_6}, - { 0x07, KEY_7}, - { 0x08, KEY_8}, - { 0x09, KEY_9}, - { 0x00, KEY_0}, - - { 0x0c, KEY_VOLUMEUP}, - { 0x18, KEY_VOLUMEDOWN}, - { 0x0b, KEY_CHANNELUP}, - { 0x15, KEY_CHANNELDOWN}, - { 0x16, KEY_ENTER}, - - { 0x11, KEY_LIST}, /* Source */ - { 0x0d, KEY_AUDIO}, /* stereo */ - - { 0x0f, KEY_PREVIOUS}, /* Prev */ - { 0x1b, KEY_TIME}, /* Timeshift */ - { 0x1a, KEY_NEXT}, /* Next */ - - { 0x0e, KEY_STOP}, - { 0x1f, KEY_PLAY}, - { 0x1e, KEY_PLAYPAUSE}, /* Pause */ - - { 0x1d, KEY_RECORD}, - { 0x13, KEY_MUTE}, - { 0x19, KEY_CAMERA}, /* Snapshot */ - -}; -DEFINE_LEGACY_IR_KEYTABLE(real_audio_220_32_keys); -#else -DECLARE_IR_KEYTABLE(real_audio_220_32_keys); -#endif diff --git a/include/media/keycodes/tbs-nec.h b/include/media/keycodes/tbs-nec.h deleted file mode 100644 index 156985e122a5..000000000000 --- a/include/media/keycodes/tbs-nec.h +++ /dev/null @@ -1,50 +0,0 @@ -/* tbs-nec.h - Keytable for tbs_nec Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode tbs_nec[] = { - { 0x04, KEY_POWER2}, /*power*/ - { 0x14, KEY_MUTE}, /*mute*/ - { 0x07, KEY_1}, - { 0x06, KEY_2}, - { 0x05, KEY_3}, - { 0x0b, KEY_4}, - { 0x0a, KEY_5}, - { 0x09, KEY_6}, - { 0x0f, KEY_7}, - { 0x0e, KEY_8}, - { 0x0d, KEY_9}, - { 0x12, KEY_0}, - { 0x16, KEY_CHANNELUP}, /*ch+*/ - { 0x11, KEY_CHANNELDOWN},/*ch-*/ - { 0x13, KEY_VOLUMEUP}, /*vol+*/ - { 0x0c, KEY_VOLUMEDOWN},/*vol-*/ - { 0x03, KEY_RECORD}, /*rec*/ - { 0x18, KEY_PAUSE}, /*pause*/ - { 0x19, KEY_OK}, /*ok*/ - { 0x1a, KEY_CAMERA}, /* snapshot */ - { 0x01, KEY_UP}, - { 0x10, KEY_LEFT}, - { 0x02, KEY_RIGHT}, - { 0x08, KEY_DOWN}, - { 0x15, KEY_FAVORITES}, - { 0x17, KEY_SUBTITLE}, - { 0x1d, KEY_ZOOM}, - { 0x1f, KEY_EXIT}, - { 0x1e, KEY_MENU}, - { 0x1c, KEY_EPG}, - { 0x00, KEY_PREVIOUS}, - { 0x1b, KEY_MODE}, -}; -DEFINE_LEGACY_IR_KEYTABLE(tbs_nec); -#else -DECLARE_IR_KEYTABLE(tbs_nec); -#endif diff --git a/include/media/keycodes/terratec-cinergy-xs.h b/include/media/keycodes/terratec-cinergy-xs.h deleted file mode 100644 index 8f50fae05d8f..000000000000 --- a/include/media/keycodes/terratec-cinergy-xs.h +++ /dev/null @@ -1,68 +0,0 @@ -/* terratec-cinergy-xs.h - Keytable for terratec_cinergy_xs Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Terratec Cinergy Hybrid T USB XS - Devin Heitmueller - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode terratec_cinergy_xs[] = { - { 0x41, KEY_HOME}, - { 0x01, KEY_POWER}, - { 0x42, KEY_MENU}, - { 0x02, KEY_1}, - { 0x03, KEY_2}, - { 0x04, KEY_3}, - { 0x43, KEY_SUBTITLE}, - { 0x05, KEY_4}, - { 0x06, KEY_5}, - { 0x07, KEY_6}, - { 0x44, KEY_TEXT}, - { 0x08, KEY_7}, - { 0x09, KEY_8}, - { 0x0a, KEY_9}, - { 0x45, KEY_DELETE}, - { 0x0b, KEY_TUNER}, - { 0x0c, KEY_0}, - { 0x0d, KEY_MODE}, - { 0x46, KEY_TV}, - { 0x47, KEY_DVD}, - { 0x49, KEY_VIDEO}, - { 0x4b, KEY_AUX}, - { 0x10, KEY_UP}, - { 0x11, KEY_LEFT}, - { 0x12, KEY_OK}, - { 0x13, KEY_RIGHT}, - { 0x14, KEY_DOWN}, - { 0x0f, KEY_EPG}, - { 0x16, KEY_INFO}, - { 0x4d, KEY_BACKSPACE}, - { 0x1c, KEY_VOLUMEUP}, - { 0x4c, KEY_PLAY}, - { 0x1b, KEY_CHANNELUP}, - { 0x1e, KEY_VOLUMEDOWN}, - { 0x1d, KEY_MUTE}, - { 0x1f, KEY_CHANNELDOWN}, - { 0x17, KEY_RED}, - { 0x18, KEY_GREEN}, - { 0x19, KEY_YELLOW}, - { 0x1a, KEY_BLUE}, - { 0x58, KEY_RECORD}, - { 0x48, KEY_STOP}, - { 0x40, KEY_PAUSE}, - { 0x54, KEY_LAST}, - { 0x4e, KEY_REWIND}, - { 0x4f, KEY_FASTFORWARD}, - { 0x5c, KEY_NEXT}, -}; -DEFINE_LEGACY_IR_KEYTABLE(terratec_cinergy_xs); -#else -DECLARE_IR_KEYTABLE(terratec_cinergy_xs); -#endif diff --git a/include/media/keycodes/tevii-nec.h b/include/media/keycodes/tevii-nec.h deleted file mode 100644 index 6a8ea03a9be1..000000000000 --- a/include/media/keycodes/tevii-nec.h +++ /dev/null @@ -1,65 +0,0 @@ -/* tevii-nec.h - Keytable for tevii_nec Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode tevii_nec[] = { - { 0x0a, KEY_POWER2}, - { 0x0c, KEY_MUTE}, - { 0x11, KEY_1}, - { 0x12, KEY_2}, - { 0x13, KEY_3}, - { 0x14, KEY_4}, - { 0x15, KEY_5}, - { 0x16, KEY_6}, - { 0x17, KEY_7}, - { 0x18, KEY_8}, - { 0x19, KEY_9}, - { 0x10, KEY_0}, - { 0x1c, KEY_MENU}, - { 0x0f, KEY_VOLUMEDOWN}, - { 0x1a, KEY_LAST}, - { 0x0e, KEY_OPEN}, - { 0x04, KEY_RECORD}, - { 0x09, KEY_VOLUMEUP}, - { 0x08, KEY_CHANNELUP}, - { 0x07, KEY_PVR}, - { 0x0b, KEY_TIME}, - { 0x02, KEY_RIGHT}, - { 0x03, KEY_LEFT}, - { 0x00, KEY_UP}, - { 0x1f, KEY_OK}, - { 0x01, KEY_DOWN}, - { 0x05, KEY_TUNER}, - { 0x06, KEY_CHANNELDOWN}, - { 0x40, KEY_PLAYPAUSE}, - { 0x1e, KEY_REWIND}, - { 0x1b, KEY_FAVORITES}, - { 0x1d, KEY_BACK}, - { 0x4d, KEY_FASTFORWARD}, - { 0x44, KEY_EPG}, - { 0x4c, KEY_INFO}, - { 0x41, KEY_AB}, - { 0x43, KEY_AUDIO}, - { 0x45, KEY_SUBTITLE}, - { 0x4a, KEY_LIST}, - { 0x46, KEY_F1}, - { 0x47, KEY_F2}, - { 0x5e, KEY_F3}, - { 0x5c, KEY_F4}, - { 0x52, KEY_F5}, - { 0x5a, KEY_F6}, - { 0x56, KEY_MODE}, - { 0x58, KEY_SWITCHVIDEOMODE}, -}; -DEFINE_LEGACY_IR_KEYTABLE(tevii_nec); -#else -DECLARE_IR_KEYTABLE(tevii_nec); -#endif diff --git a/include/media/keycodes/tt-1500.h b/include/media/keycodes/tt-1500.h deleted file mode 100644 index 45ffcba17373..000000000000 --- a/include/media/keycodes/tt-1500.h +++ /dev/null @@ -1,58 +0,0 @@ -/* tt-1500.h - Keytable for tt_1500 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* for the Technotrend 1500 bundled remotes (grey and black): */ - -#ifdef IR_KEYMAPS -static struct ir_scancode tt_1500[] = { - { 0x01, KEY_POWER }, - { 0x02, KEY_SHUFFLE }, /* ? double-arrow key */ - { 0x03, KEY_1 }, - { 0x04, KEY_2 }, - { 0x05, KEY_3 }, - { 0x06, KEY_4 }, - { 0x07, KEY_5 }, - { 0x08, KEY_6 }, - { 0x09, KEY_7 }, - { 0x0a, KEY_8 }, - { 0x0b, KEY_9 }, - { 0x0c, KEY_0 }, - { 0x0d, KEY_UP }, - { 0x0e, KEY_LEFT }, - { 0x0f, KEY_OK }, - { 0x10, KEY_RIGHT }, - { 0x11, KEY_DOWN }, - { 0x12, KEY_INFO }, - { 0x13, KEY_EXIT }, - { 0x14, KEY_RED }, - { 0x15, KEY_GREEN }, - { 0x16, KEY_YELLOW }, - { 0x17, KEY_BLUE }, - { 0x18, KEY_MUTE }, - { 0x19, KEY_TEXT }, - { 0x1a, KEY_MODE }, /* ? TV/Radio */ - { 0x21, KEY_OPTION }, - { 0x22, KEY_EPG }, - { 0x23, KEY_CHANNELUP }, - { 0x24, KEY_CHANNELDOWN }, - { 0x25, KEY_VOLUMEUP }, - { 0x26, KEY_VOLUMEDOWN }, - { 0x27, KEY_SETUP }, - { 0x3a, KEY_RECORD }, /* these keys are only in the black remote */ - { 0x3b, KEY_PLAY }, - { 0x3c, KEY_STOP }, - { 0x3d, KEY_REWIND }, - { 0x3e, KEY_PAUSE }, - { 0x3f, KEY_FORWARD }, -}; -DEFINE_LEGACY_IR_KEYTABLE(tt_1500); -#else -DECLARE_IR_KEYTABLE(tt_1500); -#endif diff --git a/include/media/keycodes/videomate-s350.h b/include/media/keycodes/videomate-s350.h deleted file mode 100644 index ff38424b4f66..000000000000 --- a/include/media/keycodes/videomate-s350.h +++ /dev/null @@ -1,62 +0,0 @@ -/* videomate-s350.h - Keytable for videomate_s350 Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode videomate_s350[] = { - { 0x00, KEY_TV}, - { 0x01, KEY_DVD}, - { 0x04, KEY_RECORD}, - { 0x05, KEY_VIDEO}, /* TV/Video */ - { 0x07, KEY_STOP}, - { 0x08, KEY_PLAYPAUSE}, - { 0x0a, KEY_REWIND}, - { 0x0f, KEY_FASTFORWARD}, - { 0x10, KEY_CHANNELUP}, - { 0x12, KEY_VOLUMEUP}, - { 0x13, KEY_CHANNELDOWN}, - { 0x14, KEY_MUTE}, - { 0x15, KEY_VOLUMEDOWN}, - { 0x16, KEY_1}, - { 0x17, KEY_2}, - { 0x18, KEY_3}, - { 0x19, KEY_4}, - { 0x1a, KEY_5}, - { 0x1b, KEY_6}, - { 0x1c, KEY_7}, - { 0x1d, KEY_8}, - { 0x1e, KEY_9}, - { 0x1f, KEY_0}, - { 0x21, KEY_SLEEP}, - { 0x24, KEY_ZOOM}, - { 0x25, KEY_LAST}, /* Recall */ - { 0x26, KEY_SUBTITLE}, /* CC */ - { 0x27, KEY_LANGUAGE}, /* MTS */ - { 0x29, KEY_CHANNEL}, /* SURF */ - { 0x2b, KEY_A}, - { 0x2c, KEY_B}, - { 0x2f, KEY_CAMERA}, /* Snapshot */ - { 0x23, KEY_RADIO}, - { 0x02, KEY_PREVIOUSSONG}, - { 0x06, KEY_NEXTSONG}, - { 0x03, KEY_EPG}, - { 0x09, KEY_SETUP}, - { 0x22, KEY_BACKSPACE}, - { 0x0c, KEY_UP}, - { 0x0e, KEY_DOWN}, - { 0x0b, KEY_LEFT}, - { 0x0d, KEY_RIGHT}, - { 0x11, KEY_ENTER}, - { 0x20, KEY_TEXT}, -}; -DEFINE_LEGACY_IR_KEYTABLE(videomate_s350); -#else -DECLARE_IR_KEYTABLE(videomate_s350); -#endif diff --git a/include/media/keycodes/videomate-tv-pvr.h b/include/media/keycodes/videomate-tv-pvr.h deleted file mode 100644 index f77375d3ba44..000000000000 --- a/include/media/keycodes/videomate-tv-pvr.h +++ /dev/null @@ -1,64 +0,0 @@ -/* videomate-tv-pvr.h - Keytable for videomate_tv_pvr Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - - -#ifdef IR_KEYMAPS -static struct ir_scancode videomate_tv_pvr[] = { - { 0x14, KEY_MUTE }, - { 0x24, KEY_ZOOM }, - - { 0x01, KEY_DVD }, - { 0x23, KEY_RADIO }, - { 0x00, KEY_TV }, - - { 0x0a, KEY_REWIND }, - { 0x08, KEY_PLAYPAUSE }, - { 0x0f, KEY_FORWARD }, - - { 0x02, KEY_PREVIOUS }, - { 0x07, KEY_STOP }, - { 0x06, KEY_NEXT }, - - { 0x0c, KEY_UP }, - { 0x0e, KEY_DOWN }, - { 0x0b, KEY_LEFT }, - { 0x0d, KEY_RIGHT }, - { 0x11, KEY_OK }, - - { 0x03, KEY_MENU }, - { 0x09, KEY_SETUP }, - { 0x05, KEY_VIDEO }, - { 0x22, KEY_CHANNEL }, - - { 0x12, KEY_VOLUMEUP }, - { 0x15, KEY_VOLUMEDOWN }, - { 0x10, KEY_CHANNELUP }, - { 0x13, KEY_CHANNELDOWN }, - - { 0x04, KEY_RECORD }, - - { 0x16, KEY_1 }, - { 0x17, KEY_2 }, - { 0x18, KEY_3 }, - { 0x19, KEY_4 }, - { 0x1a, KEY_5 }, - { 0x1b, KEY_6 }, - { 0x1c, KEY_7 }, - { 0x1d, KEY_8 }, - { 0x1e, KEY_9 }, - { 0x1f, KEY_0 }, - - { 0x20, KEY_LANGUAGE }, - { 0x21, KEY_SLEEP }, -}; -DEFINE_LEGACY_IR_KEYTABLE(videomate_tv_pvr); -#else -DECLARE_IR_KEYTABLE(videomate_tv_pvr); -#endif diff --git a/include/media/keycodes/winfast-usbii-deluxe.h b/include/media/keycodes/winfast-usbii-deluxe.h deleted file mode 100644 index 0d2c14f2fed4..000000000000 --- a/include/media/keycodes/winfast-usbii-deluxe.h +++ /dev/null @@ -1,58 +0,0 @@ -/* winfast-usbii-deluxe.h - Keytable for winfast_usbii_deluxe Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Leadtek Winfast TV USB II Deluxe remote - Magnus Alm - */ - -#ifdef IR_KEYMAPS -static struct ir_scancode winfast_usbii_deluxe[] = { - { 0x62, KEY_0}, - { 0x75, KEY_1}, - { 0x76, KEY_2}, - { 0x77, KEY_3}, - { 0x79, KEY_4}, - { 0x7a, KEY_5}, - { 0x7b, KEY_6}, - { 0x7d, KEY_7}, - { 0x7e, KEY_8}, - { 0x7f, KEY_9}, - - { 0x38, KEY_CAMERA}, /* SNAPSHOT */ - { 0x37, KEY_RECORD}, /* RECORD */ - { 0x35, KEY_TIME}, /* TIMESHIFT */ - - { 0x74, KEY_VOLUMEUP}, /* VOLUMEUP */ - { 0x78, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ - { 0x64, KEY_MUTE}, /* MUTE */ - - { 0x21, KEY_CHANNEL}, /* SURF */ - { 0x7c, KEY_CHANNELUP}, /* CHANNELUP */ - { 0x60, KEY_CHANNELDOWN}, /* CHANNELDOWN */ - { 0x61, KEY_LAST}, /* LAST CHANNEL (RECALL) */ - - { 0x72, KEY_VIDEO}, /* INPUT MODES (TV/FM) */ - - { 0x70, KEY_POWER2}, /* TV ON/OFF */ - - { 0x39, KEY_CYCLEWINDOWS}, /* MINIMIZE (BOSS) */ - { 0x3a, KEY_NEW}, /* PIP */ - { 0x73, KEY_ZOOM}, /* FULLSECREEN */ - - { 0x66, KEY_INFO}, /* OSD (DISPLAY) */ - - { 0x31, KEY_DOT}, /* '.' */ - { 0x63, KEY_ENTER}, /* ENTER */ - -}; -DEFINE_LEGACY_IR_KEYTABLE(winfast_usbii_deluxe); -#else -DECLARE_IR_KEYTABLE(winfast_usbii_deluxe); -#endif diff --git a/include/media/keycodes/winfast.h b/include/media/keycodes/winfast.h deleted file mode 100644 index 4f42e24efd4d..000000000000 --- a/include/media/keycodes/winfast.h +++ /dev/null @@ -1,78 +0,0 @@ -/* winfast.h - Keytable for winfast Remote Controller - * - * Imported from ir-keymaps.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -/* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ - -#ifdef IR_KEYMAPS -static struct ir_scancode winfast[] = { - /* Keys 0 to 9 */ - { 0x12, KEY_0 }, - { 0x05, KEY_1 }, - { 0x06, KEY_2 }, - { 0x07, KEY_3 }, - { 0x09, KEY_4 }, - { 0x0a, KEY_5 }, - { 0x0b, KEY_6 }, - { 0x0d, KEY_7 }, - { 0x0e, KEY_8 }, - { 0x0f, KEY_9 }, - - { 0x00, KEY_POWER }, - { 0x1b, KEY_AUDIO }, /* Audio Source */ - { 0x02, KEY_TUNER }, /* TV/FM, not on Y0400052 */ - { 0x1e, KEY_VIDEO }, /* Video Source */ - { 0x16, KEY_INFO }, /* Display information */ - { 0x04, KEY_VOLUMEUP }, - { 0x08, KEY_VOLUMEDOWN }, - { 0x0c, KEY_CHANNELUP }, - { 0x10, KEY_CHANNELDOWN }, - { 0x03, KEY_ZOOM }, /* fullscreen */ - { 0x1f, KEY_TEXT }, /* closed caption/teletext */ - { 0x20, KEY_SLEEP }, - { 0x29, KEY_CLEAR }, /* boss key */ - { 0x14, KEY_MUTE }, - { 0x2b, KEY_RED }, - { 0x2c, KEY_GREEN }, - { 0x2d, KEY_YELLOW }, - { 0x2e, KEY_BLUE }, - { 0x18, KEY_KPPLUS }, /* fine tune + , not on Y040052 */ - { 0x19, KEY_KPMINUS }, /* fine tune - , not on Y040052 */ - { 0x2a, KEY_MEDIA }, /* PIP (Picture in picture */ - { 0x21, KEY_DOT }, - { 0x13, KEY_ENTER }, - { 0x11, KEY_LAST }, /* Recall (last channel */ - { 0x22, KEY_PREVIOUS }, - { 0x23, KEY_PLAYPAUSE }, - { 0x24, KEY_NEXT }, - { 0x25, KEY_TIME }, /* Time Shifting */ - { 0x26, KEY_STOP }, - { 0x27, KEY_RECORD }, - { 0x28, KEY_SAVE }, /* Screenshot */ - { 0x2f, KEY_MENU }, - { 0x30, KEY_CANCEL }, - { 0x31, KEY_CHANNEL }, /* Channel Surf */ - { 0x32, KEY_SUBTITLE }, - { 0x33, KEY_LANGUAGE }, - { 0x34, KEY_REWIND }, - { 0x35, KEY_FASTFORWARD }, - { 0x36, KEY_TV }, - { 0x37, KEY_RADIO }, /* FM */ - { 0x38, KEY_DVD }, - - { 0x1a, KEY_MODE}, /* change to MCE mode on Y04G0051 */ - { 0x3e, KEY_F21 }, /* MCE +VOL, on Y04G0033 */ - { 0x3a, KEY_F22 }, /* MCE -VOL, on Y04G0033 */ - { 0x3b, KEY_F23 }, /* MCE +CH, on Y04G0033 */ - { 0x3f, KEY_F24 } /* MCE -CH, on Y04G0033 */ -}; -DEFINE_LEGACY_IR_KEYTABLE(winfast); -#else -DECLARE_IR_KEYTABLE(winfast); -#endif -- GitLab From 3629e1dadff88d22f35f88d53edbac14fd8931de Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Apr 2010 01:43:36 -0300 Subject: [PATCH 292/534] V4L/DVB: saa7134: Fix IRQ2 bit names for the register map There's an error at the IRQ2 bit map registers. Also, it doesn't show what bits are needed for positive and for negative edge. In the case of IR raw decoding, for some protocols, it is important to detect both positive and negative edges. So, a latter patch will need to use the other values. Also, the code that detects problems on IRQ handling is incomplete, as it disables only one of the IRQ bits for GPIO16 and GPIO18. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-core.c | 14 ++++++------ drivers/media/video/saa7134/saa7134-input.c | 4 ++-- drivers/media/video/saa7134/saa7134-reg.h | 24 ++++++++++----------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 68cda10e0783..0612fffdd1fe 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -471,7 +471,7 @@ static char *irqbits[] = { "DONE_RA0", "DONE_RA1", "DONE_RA2", "DONE_RA3", "AR", "PE", "PWR_ON", "RDCAP", "INTL", "FIDT", "MMC", "TRIG_ERR", "CONF_ERR", "LOAD_ERR", - "GPIO16?", "GPIO18", "GPIO22", "GPIO23" + "GPIO16", "GPIO18", "GPIO22", "GPIO23" }; #define IRQBITS ARRAY_SIZE(irqbits) @@ -601,12 +601,14 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id) /* disable gpio16 IRQ */ printk(KERN_WARNING "%s/irq: looping -- " "clearing GPIO16 enable bit\n",dev->name); - saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16); + saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16_P); + saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16_N); } else if (report & SAA7134_IRQ_REPORT_GPIO18) { /* disable gpio18 IRQs */ printk(KERN_WARNING "%s/irq: looping -- " "clearing GPIO18 enable bit\n",dev->name); - saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); + saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_P); + saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_N); } else { /* disable all irqs */ printk(KERN_WARNING "%s/irq: looping -- " @@ -698,11 +700,11 @@ static int saa7134_hw_enable2(struct saa7134_dev *dev) if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) { if (dev->remote->mask_keydown & 0x10000) - irq2_mask |= SAA7134_IRQ2_INTE_GPIO16; + irq2_mask |= SAA7134_IRQ2_INTE_GPIO16_N; else if (dev->remote->mask_keydown & 0x40000) - irq2_mask |= SAA7134_IRQ2_INTE_GPIO18; + irq2_mask |= SAA7134_IRQ2_INTE_GPIO18_P; else if (dev->remote->mask_keyup & 0x40000) - irq2_mask |= SAA7134_IRQ2_INTE_GPIO18A; + irq2_mask |= SAA7134_IRQ2_INTE_GPIO18_N; } if (dev->has_remote == SAA7134_REMOTE_I2C) { diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index f46dca3ccf79..a51ba83fb6c4 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -1188,14 +1188,14 @@ static void nec_task(unsigned long data) /* Keep repeating the last key */ mod_timer(&ir->timer_keyup, jiffies + msecs_to_jiffies(150)); - saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); + saa_setl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_P); } static int saa7134_nec_irq(struct saa7134_dev *dev) { struct card_ir *ir = dev->remote; - saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); + saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18_P); tasklet_schedule(&ir->tlet); return 1; diff --git a/drivers/media/video/saa7134/saa7134-reg.h b/drivers/media/video/saa7134/saa7134-reg.h index cf89d96d7295..e7e0af101fa7 100644 --- a/drivers/media/video/saa7134/saa7134-reg.h +++ b/drivers/media/video/saa7134/saa7134-reg.h @@ -112,17 +112,17 @@ #define SAA7134_IRQ1_INTE_RA0_0 (1 << 0) #define SAA7134_IRQ2 (0x2c8 >> 2) -#define SAA7134_IRQ2_INTE_GPIO23A (1 << 17) -#define SAA7134_IRQ2_INTE_GPIO23 (1 << 16) -#define SAA7134_IRQ2_INTE_GPIO22A (1 << 15) -#define SAA7134_IRQ2_INTE_GPIO22 (1 << 14) -#define SAA7134_IRQ2_INTE_GPIO18A (1 << 13) -#define SAA7134_IRQ2_INTE_GPIO18 (1 << 12) -#define SAA7134_IRQ2_INTE_GPIO16 (1 << 11) /* not certain */ -#define SAA7134_IRQ2_INTE_SC2 (1 << 10) -#define SAA7134_IRQ2_INTE_SC1 (1 << 9) -#define SAA7134_IRQ2_INTE_SC0 (1 << 8) -#define SAA7134_IRQ2_INTE_DEC5 (1 << 7) +#define SAA7134_IRQ2_INTE_GPIO23_N (1 << 17) /* negative edge */ +#define SAA7134_IRQ2_INTE_GPIO23_P (1 << 16) /* positive edge */ +#define SAA7134_IRQ2_INTE_GPIO22_N (1 << 15) /* negative edge */ +#define SAA7134_IRQ2_INTE_GPIO22_P (1 << 14) /* positive edge */ +#define SAA7134_IRQ2_INTE_GPIO18_N (1 << 13) /* negative edge */ +#define SAA7134_IRQ2_INTE_GPIO18_P (1 << 12) /* positive edge */ +#define SAA7134_IRQ2_INTE_GPIO16_N (1 << 11) /* negative edge */ +#define SAA7134_IRQ2_INTE_GPIO16_P (1 << 10) /* positive edge */ +#define SAA7134_IRQ2_INTE_SC2 (1 << 9) +#define SAA7134_IRQ2_INTE_SC1 (1 << 8) +#define SAA7134_IRQ2_INTE_SC0 (1 << 7) #define SAA7134_IRQ2_INTE_DEC4 (1 << 6) #define SAA7134_IRQ2_INTE_DEC3 (1 << 5) #define SAA7134_IRQ2_INTE_DEC2 (1 << 4) @@ -135,7 +135,7 @@ #define SAA7134_IRQ_REPORT_GPIO23 (1 << 17) #define SAA7134_IRQ_REPORT_GPIO22 (1 << 16) #define SAA7134_IRQ_REPORT_GPIO18 (1 << 15) -#define SAA7134_IRQ_REPORT_GPIO16 (1 << 14) /* not certain */ +#define SAA7134_IRQ_REPORT_GPIO16 (1 << 14) #define SAA7134_IRQ_REPORT_LOAD_ERR (1 << 13) #define SAA7134_IRQ_REPORT_CONF_ERR (1 << 12) #define SAA7134_IRQ_REPORT_TRIG_ERR (1 << 11) -- GitLab From bdf1c98e4205832c07d6dedbfd0ec6eab83df358 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Apr 2010 11:26:01 -0300 Subject: [PATCH 293/534] V4L/DVB: saa7134: Add support for both positive and negative edge IRQ The code that enables IRQ for the Remote Controller on saa7134 is a little messy: it is outside saa7134-input, it checks if RC is GPIO based, and it mixes both serial raw decode with parallel reads from a hardware-based IR decoder. Also, currently, it doesn't allow to trigger both transition edges at GPIO16 and GPIO18 lines. A rework on the code is needed to provide a better way to specify what saa7134-input needs, maybe even moving part of the code from saa7134-core and saa7134-cards into saa7134-input. Yet, as a large rework is happening at RC core, it is better to wait until the core changes stablize, in order to rework saa7134 RC internals.While this don't happen, let's just change the logic a little bit to allow enabling IRQ to be generated on both edge transitions, in order to better support pulse/space raw decoders. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/saa7134/saa7134-core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 0612fffdd1fe..90f231881297 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -701,10 +701,12 @@ static int saa7134_hw_enable2(struct saa7134_dev *dev) if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) { if (dev->remote->mask_keydown & 0x10000) irq2_mask |= SAA7134_IRQ2_INTE_GPIO16_N; - else if (dev->remote->mask_keydown & 0x40000) - irq2_mask |= SAA7134_IRQ2_INTE_GPIO18_P; - else if (dev->remote->mask_keyup & 0x40000) - irq2_mask |= SAA7134_IRQ2_INTE_GPIO18_N; + else { /* Allow enabling both IRQ edge triggers */ + if (dev->remote->mask_keydown & 0x40000) + irq2_mask |= SAA7134_IRQ2_INTE_GPIO18_P; + if (dev->remote->mask_keyup & 0x40000) + irq2_mask |= SAA7134_IRQ2_INTE_GPIO18_N; + } } if (dev->has_remote == SAA7134_REMOTE_I2C) { -- GitLab From b3074c0a3f020766c05c1249a31212bff4a77bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Fri, 2 Apr 2010 15:58:28 -0300 Subject: [PATCH 294/534] V4L/DVB: drivers/media/IR - improve keytable code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The attached patch rewrites much of the keytable code in drivers/media/IR/ir-keytable.c. The scancodes are now inserted into the array in sorted order which allows for a binary search on lookup. The code has also been shrunk by about 150 lines. In addition it fixes the following bugs: Any use of ir_seek_table() was racy. ir_dev->driver_name is leaked between ir_input_register() and ir_input_unregister(). ir_setkeycode() unconditionally does clear_bit() on dev->keybit when removing a mapping, but there might be another mapping with a different scancode and the same keycode. This version has been updated to incorporate patch feedback from Mauro Carvalho Chehab. [mchehab@redhat.com: Fix a conflict with RC keytable breakup patches and input changes] Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 518 ++++++++++++--------------------- include/media/ir-core.h | 4 +- 2 files changed, 191 insertions(+), 331 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 5d4ddc9f4cab..10e4be22dbfd 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -17,344 +17,214 @@ #include #include -#define IR_TAB_MIN_SIZE 32 -#define IR_TAB_MAX_SIZE 1024 +/* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */ +#define IR_TAB_MIN_SIZE 256 +#define IR_TAB_MAX_SIZE 8192 /** - * ir_seek_table() - returns the element order on the table - * @rc_tab: the ir_scancode_table with the keymap to be used - * @scancode: the scancode that we're seeking + * ir_resize_table() - resizes a scancode table if necessary + * @rc_tab: the ir_scancode_table to resize + * @return: zero on success or a negative error code * - * This routine is used by the input routines when a key is pressed at the - * IR. The scancode is received and needs to be converted into a keycode. - * If the key is not found, it returns KEY_UNKNOWN. Otherwise, returns the - * corresponding keycode from the table. + * This routine will shrink the ir_scancode_table if it has lots of + * unused entries and grow it if it is full. */ -static int ir_seek_table(struct ir_scancode_table *rc_tab, u32 scancode) +static int ir_resize_table(struct ir_scancode_table *rc_tab) { - int rc; - unsigned long flags; - struct ir_scancode *keymap = rc_tab->scan; + unsigned int oldalloc = rc_tab->alloc; + unsigned int newalloc = oldalloc; + struct ir_scancode *oldscan = rc_tab->scan; + struct ir_scancode *newscan; + + if (rc_tab->size == rc_tab->len) { + /* All entries in use -> grow keytable */ + if (rc_tab->alloc >= IR_TAB_MAX_SIZE) + return -ENOMEM; - spin_lock_irqsave(&rc_tab->lock, flags); + newalloc *= 2; + IR_dprintk(1, "Growing table to %u bytes\n", newalloc); + } - /* FIXME: replace it by a binary search */ + if ((rc_tab->len * 3 < rc_tab->size) && (oldalloc > IR_TAB_MIN_SIZE)) { + /* Less than 1/3 of entries in use -> shrink keytable */ + newalloc /= 2; + IR_dprintk(1, "Shrinking table to %u bytes\n", newalloc); + } - for (rc = 0; rc < rc_tab->size; rc++) - if (keymap[rc].scancode == scancode) - goto exit; + if (newalloc == oldalloc) + return 0; - /* Not found */ - rc = -EINVAL; + newscan = kmalloc(newalloc, GFP_ATOMIC); + if (!newscan) { + IR_dprintk(1, "Failed to kmalloc %u bytes\n", newalloc); + return -ENOMEM; + } -exit: - spin_unlock_irqrestore(&rc_tab->lock, flags); - return rc; + memcpy(newscan, rc_tab->scan, rc_tab->len * sizeof(struct ir_scancode)); + rc_tab->scan = newscan; + rc_tab->alloc = newalloc; + rc_tab->size = rc_tab->alloc / sizeof(struct ir_scancode); + kfree(oldscan); + return 0; } /** - * ir_roundup_tablesize() - gets an optimum value for the table size - * @n_elems: minimum number of entries to store keycodes - * - * This routine is used to choose the keycode table size. + * ir_do_setkeycode() - internal function to set a keycode in the + * scancode->keycode table + * @dev: the struct input_dev device descriptor + * @rc_tab: the struct ir_scancode_table to set the keycode in + * @scancode: the scancode for the ir command + * @keycode: the keycode for the ir command + * @return: -EINVAL if the keycode could not be inserted, otherwise zero. * - * In order to have some empty space for new keycodes, - * and knowing in advance that kmalloc allocates only power of two - * segments, it optimizes the allocated space to have some spare space - * for those new keycodes by using the maximum number of entries that - * will be effectively be allocated by kmalloc. - * In order to reduce the quantity of table resizes, it has a minimum - * table size of IR_TAB_MIN_SIZE. + * This routine is used internally to manipulate the scancode->keycode table. + * The caller has to hold @rc_tab->lock. */ -static int ir_roundup_tablesize(int n_elems) +static int ir_do_setkeycode(struct input_dev *dev, + struct ir_scancode_table *rc_tab, + unsigned scancode, unsigned keycode) { - size_t size; + unsigned int i; + int old_keycode = KEY_RESERVED; + + /* First check if we already have a mapping for this ir command */ + for (i = 0; i < rc_tab->len; i++) { + /* Keytable is sorted from lowest to highest scancode */ + if (rc_tab->scan[i].scancode > scancode) + break; + else if (rc_tab->scan[i].scancode < scancode) + continue; - if (n_elems < IR_TAB_MIN_SIZE) - n_elems = IR_TAB_MIN_SIZE; + old_keycode = rc_tab->scan[i].keycode; + rc_tab->scan[i].keycode = keycode; - /* - * As kmalloc only allocates sizes of power of two, get as - * much entries as possible for the allocated memory segment - */ - size = roundup_pow_of_two(n_elems * sizeof(struct ir_scancode)); - n_elems = size / sizeof(struct ir_scancode); + /* Did the user wish to remove the mapping? */ + if (keycode == KEY_RESERVED || keycode == KEY_UNKNOWN) { + rc_tab->len--; + memmove(&rc_tab->scan[i], &rc_tab->scan[i + 1], + (rc_tab->len - i) * sizeof(struct ir_scancode)); + } - return n_elems; -} - -/** - * ir_copy_table() - copies a keytable, discarding the unused entries - * @destin: destin table - * @origin: origin table - * - * Copies all entries where the keycode is not KEY_UNKNOWN/KEY_RESERVED - * Also copies table size and table protocol. - * NOTE: It shouldn't copy the lock field - */ - -static int ir_copy_table(struct ir_scancode_table *destin, - const struct ir_scancode_table *origin) -{ - int i, j = 0; + /* Possibly shrink the keytable, failure is not a problem */ + ir_resize_table(rc_tab); + break; + } - for (i = 0; i < origin->size; i++) { - if (origin->scan[i].keycode == KEY_UNKNOWN || - origin->scan[i].keycode == KEY_RESERVED) - continue; + if (old_keycode == KEY_RESERVED) { + /* No previous mapping found, we might need to grow the table */ + if (ir_resize_table(rc_tab)) + return -ENOMEM; - memcpy(&destin->scan[j], &origin->scan[i], sizeof(struct ir_scancode)); - j++; + /* i is the proper index to insert our new keycode */ + memmove(&rc_tab->scan[i + 1], &rc_tab->scan[i], + (rc_tab->len - i) * sizeof(struct ir_scancode)); + rc_tab->scan[i].scancode = scancode; + rc_tab->scan[i].keycode = keycode; + rc_tab->len++; + set_bit(keycode, dev->keybit); + } else { + /* A previous mapping was updated... */ + clear_bit(old_keycode, dev->keybit); + /* ...but another scancode might use the same keycode */ + for (i = 0; i < rc_tab->len; i++) { + if (rc_tab->scan[i].keycode == old_keycode) { + set_bit(old_keycode, dev->keybit); + break; + } + } } - destin->size = j; - destin->ir_type = origin->ir_type; - - IR_dprintk(1, "Copied %d scancodes to the new keycode table\n", destin->size); return 0; } /** - * ir_getkeycode() - get a keycode at the evdev scancode ->keycode table + * ir_setkeycode() - set a keycode in the scancode->keycode table * @dev: the struct input_dev device descriptor * @scancode: the desired scancode - * @keycode: the keycode to be retorned. + * @keycode: result + * @return: -EINVAL if the keycode could not be inserted, otherwise zero. * - * This routine is used to handle evdev EVIOCGKEY ioctl. - * If the key is not found, returns -EINVAL, otherwise, returns 0. + * This routine is used to handle evdev EVIOCSKEY ioctl. */ -static int ir_getkeycode(struct input_dev *dev, - unsigned int scancode, unsigned int *keycode) +static int ir_setkeycode(struct input_dev *dev, + unsigned int scancode, unsigned int keycode) { - int elem; + int rc; + unsigned long flags; struct ir_input_dev *ir_dev = input_get_drvdata(dev); struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; - elem = ir_seek_table(rc_tab, scancode); - if (elem >= 0) { - *keycode = rc_tab->scan[elem].keycode; - return 0; - } - - /* - * Scancode not found and table can't be expanded - */ - if (elem < 0 && rc_tab->size == IR_TAB_MAX_SIZE) - return -EINVAL; - - /* - * If is there extra space, returns KEY_RESERVED, - * otherwise, input core won't let ir_setkeycode to work - */ - *keycode = KEY_RESERVED; - return 0; -} - -/** - * ir_is_resize_needed() - Check if the table needs rezise - * @table: keycode table that may need to resize - * @n_elems: minimum number of entries to store keycodes - * - * Considering that kmalloc uses power of two storage areas, this - * routine detects if the real alloced size will change. If not, it - * just returns without doing nothing. Otherwise, it will extend or - * reduce the table size to meet the new needs. - * - * It returns 0 if no resize is needed, 1 otherwise. - */ -static int ir_is_resize_needed(struct ir_scancode_table *table, int n_elems) -{ - int cur_size = ir_roundup_tablesize(table->size); - int new_size = ir_roundup_tablesize(n_elems); - - if (cur_size == new_size) - return 0; - - /* Resize is needed */ - return 1; -} - -/** - * ir_delete_key() - remove a keycode from the table - * @rc_tab: keycode table - * @elem: element to be removed - * - */ -static void ir_delete_key(struct ir_scancode_table *rc_tab, int elem) -{ - unsigned long flags = 0; - int newsize = rc_tab->size - 1; - int resize = ir_is_resize_needed(rc_tab, newsize); - struct ir_scancode *oldkeymap = rc_tab->scan; - struct ir_scancode *newkeymap = NULL; - - if (resize) - newkeymap = kzalloc(ir_roundup_tablesize(newsize) * - sizeof(*newkeymap), GFP_ATOMIC); - - /* There's no memory for resize. Keep the old table */ - if (!resize || !newkeymap) { - newkeymap = oldkeymap; - - /* We'll modify the live table. Lock it */ - spin_lock_irqsave(&rc_tab->lock, flags); - } - - /* - * Copy the elements before the one that will be deleted - * if (!resize), both oldkeymap and newkeymap points - * to the same place, so, there's no need to copy - */ - if (resize && elem > 0) - memcpy(newkeymap, oldkeymap, - elem * sizeof(*newkeymap)); - - /* - * Copy the other elements overwriting the element to be removed - * This operation applies to both resize and non-resize case - */ - if (elem < newsize) - memcpy(&newkeymap[elem], &oldkeymap[elem + 1], - (newsize - elem) * sizeof(*newkeymap)); - - if (resize) { - /* - * As the copy happened to a temporary table, only here - * it needs to lock while replacing the table pointers - * to use the new table - */ - spin_lock_irqsave(&rc_tab->lock, flags); - rc_tab->size = newsize; - rc_tab->scan = newkeymap; - spin_unlock_irqrestore(&rc_tab->lock, flags); - - /* Frees the old keytable */ - kfree(oldkeymap); - } else { - rc_tab->size = newsize; - spin_unlock_irqrestore(&rc_tab->lock, flags); - } + spin_lock_irqsave(&rc_tab->lock, flags); + rc = ir_do_setkeycode(dev, rc_tab, scancode, keycode); + spin_unlock_irqrestore(&rc_tab->lock, flags); + return rc; } /** - * ir_insert_key() - insert a keycode at the table - * @rc_tab: keycode table - * @scancode: the desired scancode - * @keycode: the keycode to be retorned. + * ir_setkeytable() - sets several entries in the scancode->keycode table + * @dev: the struct input_dev device descriptor + * @to: the struct ir_scancode_table to copy entries to + * @from: the struct ir_scancode_table to copy entries from + * @return: -EINVAL if all keycodes could not be inserted, otherwise zero. * + * This routine is used to handle table initialization. */ -static int ir_insert_key(struct ir_scancode_table *rc_tab, - int scancode, int keycode) +static int ir_setkeytable(struct input_dev *dev, + struct ir_scancode_table *to, + const struct ir_scancode_table *from) { + struct ir_input_dev *ir_dev = input_get_drvdata(dev); + struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; unsigned long flags; - int elem = rc_tab->size; - int newsize = rc_tab->size + 1; - int resize = ir_is_resize_needed(rc_tab, newsize); - struct ir_scancode *oldkeymap = rc_tab->scan; - struct ir_scancode *newkeymap; - - if (resize) { - newkeymap = kzalloc(ir_roundup_tablesize(newsize) * - sizeof(*newkeymap), GFP_ATOMIC); - if (!newkeymap) - return -ENOMEM; - - memcpy(newkeymap, oldkeymap, - rc_tab->size * sizeof(*newkeymap)); - } else - newkeymap = oldkeymap; - - /* Stores the new code at the table */ - IR_dprintk(1, "#%d: New scan 0x%04x with key 0x%04x\n", - rc_tab->size, scancode, keycode); + unsigned int i; + int rc = 0; spin_lock_irqsave(&rc_tab->lock, flags); - rc_tab->size = newsize; - if (resize) { - rc_tab->scan = newkeymap; - kfree(oldkeymap); + for (i = 0; i < from->size; i++) { + rc = ir_do_setkeycode(dev, to, from->scan[i].scancode, + from->scan[i].keycode); + if (rc) + break; } - newkeymap[elem].scancode = scancode; - newkeymap[elem].keycode = keycode; spin_unlock_irqrestore(&rc_tab->lock, flags); - - return 0; + return rc; } /** - * ir_setkeycode() - set a keycode at the evdev scancode ->keycode table + * ir_getkeycode() - get a keycode from the scancode->keycode table * @dev: the struct input_dev device descriptor * @scancode: the desired scancode - * @keycode: the keycode to be retorned. + * @keycode: used to return the keycode, if found, or KEY_RESERVED + * @return: always returns zero. * - * This routine is used to handle evdev EVIOCSKEY ioctl. - * There's one caveat here: how can we increase the size of the table? - * If the key is not found, returns -EINVAL, otherwise, returns 0. + * This routine is used to handle evdev EVIOCGKEY ioctl. */ -static int ir_setkeycode(struct input_dev *dev, - unsigned int scancode, unsigned int keycode) +static int ir_getkeycode(struct input_dev *dev, + unsigned int scancode, unsigned int *keycode) { - int rc = 0; + int start, end, mid; + unsigned long flags; + int key = KEY_RESERVED; struct ir_input_dev *ir_dev = input_get_drvdata(dev); struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; - struct ir_scancode *keymap = rc_tab->scan; - unsigned long flags; - - /* - * Handle keycode table deletions - * - * If userspace is adding a KEY_UNKNOWN or KEY_RESERVED, - * deal as a trial to remove an existing scancode attribution - * if table become too big, reduce it to save space - */ - if (keycode == KEY_UNKNOWN || keycode == KEY_RESERVED) { - rc = ir_seek_table(rc_tab, scancode); - if (rc < 0) - return 0; - - IR_dprintk(1, "#%d: Deleting scan 0x%04x\n", rc, scancode); - clear_bit(keymap[rc].keycode, dev->keybit); - ir_delete_key(rc_tab, rc); - - return 0; - } - - /* - * Handle keycode replacements - * - * If the scancode exists, just replace by the new value - */ - rc = ir_seek_table(rc_tab, scancode); - if (rc >= 0) { - IR_dprintk(1, "#%d: Replacing scan 0x%04x with key 0x%04x\n", - rc, scancode, keycode); - clear_bit(keymap[rc].keycode, dev->keybit); - - spin_lock_irqsave(&rc_tab->lock, flags); - keymap[rc].keycode = keycode; - spin_unlock_irqrestore(&rc_tab->lock, flags); - - set_bit(keycode, dev->keybit); - - return 0; + spin_lock_irqsave(&rc_tab->lock, flags); + start = 0; + end = rc_tab->len - 1; + while (start <= end) { + mid = (start + end) / 2; + if (rc_tab->scan[mid].scancode < scancode) + start = mid + 1; + else if (rc_tab->scan[mid].scancode > scancode) + end = mid - 1; + else { + key = rc_tab->scan[mid].keycode; + break; + } } + spin_unlock_irqrestore(&rc_tab->lock, flags); - /* - * Handle new scancode inserts - * - * reallocate table if needed and insert a new keycode - */ - - /* Avoid growing the table indefinitely */ - if (rc_tab->size + 1 > IR_TAB_MAX_SIZE) - return -EINVAL; - - rc = ir_insert_key(rc_tab, scancode, keycode); - if (rc < 0) - return rc; - set_bit(keycode, dev->keybit); - + *keycode = key; return 0; } @@ -370,24 +240,12 @@ static int ir_setkeycode(struct input_dev *dev, */ u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) { - struct ir_input_dev *ir_dev = input_get_drvdata(dev); - struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; - struct ir_scancode *keymap = rc_tab->scan; - int elem; - - elem = ir_seek_table(rc_tab, scancode); - if (elem >= 0) { - IR_dprintk(1, "%s: scancode 0x%04x keycode 0x%02x\n", - dev->name, scancode, keymap[elem].keycode); - - return rc_tab->scan[elem].keycode; - } + int keycode; - printk(KERN_INFO "%s: unknown key for scancode 0x%04x\n", - dev->name, scancode); - - /* Reports userspace that an unknown keycode were got */ - return KEY_RESERVED; + ir_getkeycode(dev, scancode, &keycode); + IR_dprintk(1, "%s: scancode 0x%04x keycode 0x%02x\n", + dev->name, scancode, keycode); + return keycode; } EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); @@ -477,8 +335,7 @@ int __ir_input_register(struct input_dev *input_dev, const char *driver_name) { struct ir_input_dev *ir_dev; - struct ir_scancode *keymap = rc_tab->scan; - int i, rc; + int rc; if (rc_tab->scan == NULL || !rc_tab->size) return -EINVAL; @@ -487,55 +344,55 @@ int __ir_input_register(struct input_dev *input_dev, if (!ir_dev) return -ENOMEM; - spin_lock_init(&ir_dev->rc_tab.lock); + ir_dev->driver_name = kasprintf(GFP_KERNEL, "%s", driver_name); + if (!ir_dev->driver_name) { + rc = -ENOMEM; + goto out_dev; + } - ir_dev->driver_name = kmalloc(strlen(driver_name) + 1, GFP_KERNEL); - if (!ir_dev->driver_name) - return -ENOMEM; - strcpy(ir_dev->driver_name, driver_name); + input_dev->getkeycode = ir_getkeycode; + input_dev->setkeycode = ir_setkeycode; + input_set_drvdata(input_dev, ir_dev); + + spin_lock_init(&ir_dev->rc_tab.lock); ir_dev->rc_tab.name = rc_tab->name; - ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size); - ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size * - sizeof(struct ir_scancode), GFP_KERNEL); + ir_dev->rc_tab.ir_type = rc_tab->ir_type; + ir_dev->rc_tab.alloc = roundup_pow_of_two(rc_tab->size * + sizeof(struct ir_scancode)); + ir_dev->rc_tab.scan = kmalloc(ir_dev->rc_tab.alloc, GFP_KERNEL); + ir_dev->rc_tab.size = ir_dev->rc_tab.alloc / sizeof(struct ir_scancode); + if (!ir_dev->rc_tab.scan) { - kfree(ir_dev); - return -ENOMEM; + rc = -ENOMEM; + goto out_name; } - IR_dprintk(1, "Allocated space for %d keycode entries (%zd bytes)\n", - ir_dev->rc_tab.size, - ir_dev->rc_tab.size * sizeof(ir_dev->rc_tab.scan)); + IR_dprintk(1, "Allocated space for %u keycode entries (%u bytes)\n", + ir_dev->rc_tab.size, ir_dev->rc_tab.alloc); + + set_bit(EV_KEY, input_dev->evbit); + if (ir_setkeytable(input_dev, &ir_dev->rc_tab, rc_tab)) { + rc = -ENOMEM; + goto out_table; + } - ir_copy_table(&ir_dev->rc_tab, rc_tab); ir_dev->props = props; if (props && props->open) input_dev->open = ir_open; if (props && props->close) input_dev->close = ir_close; - /* set the bits for the keys */ - IR_dprintk(1, "key map size: %d\n", rc_tab->size); - for (i = 0; i < rc_tab->size; i++) { - IR_dprintk(1, "#%d: setting bit for keycode 0x%04x\n", - i, keymap[i].keycode); - set_bit(keymap[i].keycode, input_dev->keybit); - } - clear_bit(0, input_dev->keybit); - - set_bit(EV_KEY, input_dev->evbit); - - input_dev->getkeycode = ir_getkeycode; - input_dev->setkeycode = ir_setkeycode; - input_set_drvdata(input_dev, ir_dev); - rc = ir_register_class(input_dev); if (rc < 0) - goto err; + goto out_table; return 0; -err: - kfree(rc_tab->scan); +out_table: + kfree(ir_dev->rc_tab.scan); +out_name: + kfree(ir_dev->driver_name); +out_dev: kfree(ir_dev); return rc; } @@ -564,6 +421,7 @@ void ir_input_unregister(struct input_dev *dev) ir_unregister_class(dev); + kfree(ir_dev->driver_name); kfree(ir_dev); } EXPORT_SYMBOL_GPL(ir_input_unregister); diff --git a/include/media/ir-core.h b/include/media/ir-core.h index c6b8e179dfe0..7a0be8d4999d 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -47,7 +47,9 @@ struct ir_scancode { struct ir_scancode_table { struct ir_scancode *scan; - int size; + unsigned int size; /* Max number of entries */ + unsigned int len; /* Used number of entries */ + unsigned int alloc; /* Size of *scan in bytes */ u64 ir_type; char *name; spinlock_t lock; -- GitLab From 354389467b6b2a3b36666b6e933d78bbd9e23577 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Apr 2010 16:53:16 -0300 Subject: [PATCH 295/534] V4L/DVB: ir-core: re-add some debug functions for keytable changes Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 10e4be22dbfd..a0aa5c1b6b41 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -100,6 +100,8 @@ static int ir_do_setkeycode(struct input_dev *dev, /* Did the user wish to remove the mapping? */ if (keycode == KEY_RESERVED || keycode == KEY_UNKNOWN) { + IR_dprintk(1, "#%d: Deleting scan 0x%04x\n", + i, scancode); rc_tab->len--; memmove(&rc_tab->scan[i], &rc_tab->scan[i + 1], (rc_tab->len - i) * sizeof(struct ir_scancode)); @@ -115,6 +117,9 @@ static int ir_do_setkeycode(struct input_dev *dev, if (ir_resize_table(rc_tab)) return -ENOMEM; + IR_dprintk(1, "#%d: New scan 0x%04x with key 0x%04x\n", + i, scancode, keycode); + /* i is the proper index to insert our new keycode */ memmove(&rc_tab->scan[i + 1], &rc_tab->scan[i], (rc_tab->len - i) * sizeof(struct ir_scancode)); @@ -123,6 +128,8 @@ static int ir_do_setkeycode(struct input_dev *dev, rc_tab->len++; set_bit(keycode, dev->keybit); } else { + IR_dprintk(1, "#%d: Replacing scan 0x%04x with key 0x%04x\n", + i, scancode, keycode); /* A previous mapping was updated... */ clear_bit(old_keycode, dev->keybit); /* ...but another scancode might use the same keycode */ @@ -224,6 +231,10 @@ static int ir_getkeycode(struct input_dev *dev, } spin_unlock_irqrestore(&rc_tab->lock, flags); + if (key == KEY_RESERVED) + IR_dprintk(1, "unknown key for scancode 0x%04x\n", + scancode); + *keycode = key; return 0; } @@ -243,8 +254,9 @@ u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) int keycode; ir_getkeycode(dev, scancode, &keycode); - IR_dprintk(1, "%s: scancode 0x%04x keycode 0x%02x\n", - dev->name, scancode, keycode); + if (keycode != KEY_RESERVED) + IR_dprintk(1, "%s: scancode 0x%04x keycode 0x%02x\n", + dev->name, scancode, keycode); return keycode; } EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); @@ -386,6 +398,9 @@ int __ir_input_register(struct input_dev *input_dev, if (rc < 0) goto out_table; + IR_dprintk(1, "Registered input device on %s for %s remote.\n", + driver_name, rc_tab->name); + return 0; out_table: -- GitLab From a374fef4437abd0a1ee27afe0cca7a55425c1c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Fri, 2 Apr 2010 15:58:29 -0300 Subject: [PATCH 296/534] V4L/DVB: ir-core: improve keyup/keydown logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rewrites the keyup/keydown logic in drivers/media/IR/ir-keytable.c. All knowledge of keystates etc is now internal to ir-keytable.c and not scattered around ir-raw-event.c and ir-nec-decoder.c (where it doesn't belong). In addition, I've changed the API slightly so that ir_input_dev is passed as the first argument rather than input_dev. If we're ever going to support multiple keytables we need to move towards making ir_input_dev the main interface from a driver POV and obscure away the input_dev as an implementational detail in ir-core. Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 125 ++++++++++++++++++++++++------ drivers/media/IR/ir-nec-decoder.c | 7 +- drivers/media/IR/ir-raw-event.c | 14 ---- include/media/ir-core.h | 15 ++-- 4 files changed, 113 insertions(+), 48 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index a0aa5c1b6b41..a89456932f7c 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -21,6 +21,9 @@ #define IR_TAB_MIN_SIZE 256 #define IR_TAB_MAX_SIZE 8192 +/* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */ +#define IR_KEYPRESS_TIMEOUT 250 + /** * ir_resize_table() - resizes a scancode table if necessary * @rc_tab: the ir_scancode_table to resize @@ -263,56 +266,124 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); /** * ir_keyup() - generates input event to cleanup a key press - * @input_dev: the struct input_dev descriptor of the device + * @ir: the struct ir_input_dev descriptor of the device * - * This routine is used by the input routines when a key is pressed at the - * IR. It reports a keyup input event via input_report_key(). + * This routine is used to signal that a key has been released on the + * remote control. It reports a keyup input event via input_report_key(). + */ +static void ir_keyup(struct ir_input_dev *ir) +{ + if (!ir->keypressed) + return; + + IR_dprintk(1, "keyup key 0x%04x\n", ir->last_keycode); + input_report_key(ir->input_dev, ir->last_keycode, 0); + input_sync(ir->input_dev); + ir->keypressed = false; +} + +/** + * ir_timer_keyup() - generates a keyup event after a timeout + * @cookie: a pointer to struct ir_input_dev passed to setup_timer() + * + * This routine will generate a keyup event some time after a keydown event + * is generated when no further activity has been detected. */ -void ir_keyup(struct input_dev *dev) +static void ir_timer_keyup(unsigned long cookie) { + struct ir_input_dev *ir = (struct ir_input_dev *)cookie; + unsigned long flags; + + /* + * ir->keyup_jiffies is used to prevent a race condition if a + * hardware interrupt occurs at this point and the keyup timer + * event is moved further into the future as a result. + * + * The timer will then be reactivated and this function called + * again in the future. We need to exit gracefully in that case + * to allow the input subsystem to do its auto-repeat magic or + * a keyup event might follow immediately after the keydown. + */ + spin_lock_irqsave(&ir->keylock, flags); + if (time_is_after_eq_jiffies(ir->keyup_jiffies)) + ir_keyup(ir); + spin_unlock_irqrestore(&ir->keylock, flags); +} + +/** + * ir_repeat() - notifies the IR core that a key is still pressed + * @dev: the struct input_dev descriptor of the device + * + * This routine is used by IR decoders when a repeat message which does + * not include the necessary bits to reproduce the scancode has been + * received. + */ +void ir_repeat(struct input_dev *dev) +{ + unsigned long flags; struct ir_input_dev *ir = input_get_drvdata(dev); + spin_lock_irqsave(&ir->keylock, flags); + if (!ir->keypressed) - return; + goto out; - IR_dprintk(1, "keyup key 0x%04x\n", ir->keycode); - input_report_key(dev, ir->keycode, 0); - input_sync(dev); - ir->keypressed = 0; + ir->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); + mod_timer(&ir->timer_keyup, ir->keyup_jiffies); + +out: + spin_unlock_irqrestore(&ir->keylock, flags); } -EXPORT_SYMBOL_GPL(ir_keyup); +EXPORT_SYMBOL_GPL(ir_repeat); /** * ir_keydown() - generates input event for a key press - * @input_dev: the struct input_dev descriptor of the device - * @scancode: the scancode that we're seeking + * @dev: the struct input_dev descriptor of the device + * @scancode: the scancode that we're seeking + * @toggle: the toggle value (protocol dependent, if the protocol doesn't + * support toggle values, this should be set to zero) * * This routine is used by the input routines when a key is pressed at the * IR. It gets the keycode for a scancode and reports an input event via * input_report_key(). */ -void ir_keydown(struct input_dev *dev, int scancode) +void ir_keydown(struct input_dev *dev, int scancode, u8 toggle) { + unsigned long flags; struct ir_input_dev *ir = input_get_drvdata(dev); u32 keycode = ir_g_keycode_from_table(dev, scancode); - /* If already sent a keydown, do a keyup */ - if (ir->keypressed) - ir_keyup(dev); + spin_lock_irqsave(&ir->keylock, flags); - if (KEY_RESERVED == keycode) - return; + /* Repeat event? */ + if (ir->keypressed && + ir->last_scancode == scancode && + ir->last_toggle == toggle) + goto set_timer; - ir->keycode = keycode; - ir->keypressed = 1; + /* Release old keypress */ + ir_keyup(ir); - IR_dprintk(1, "%s: key down event, key 0x%04x, scancode 0x%04x\n", - dev->name, keycode, scancode); + ir->last_scancode = scancode; + ir->last_toggle = toggle; + ir->last_keycode = keycode; + + if (keycode == KEY_RESERVED) + goto out; - input_report_key(dev, ir->keycode, 1); + /* Register a keypress */ + ir->keypressed = true; + IR_dprintk(1, "%s: key down event, key 0x%04x, scancode 0x%04x\n", + dev->name, keycode, scancode); + input_report_key(dev, ir->last_keycode, 1); input_sync(dev); +set_timer: + ir->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); + mod_timer(&ir->timer_keyup, ir->keyup_jiffies); +out: + spin_unlock_irqrestore(&ir->keylock, flags); } EXPORT_SYMBOL_GPL(ir_keydown); @@ -365,8 +436,12 @@ int __ir_input_register(struct input_dev *input_dev, input_dev->getkeycode = ir_getkeycode; input_dev->setkeycode = ir_setkeycode; input_set_drvdata(input_dev, ir_dev); + ir_dev->input_dev = input_dev; spin_lock_init(&ir_dev->rc_tab.lock); + spin_lock_init(&ir_dev->keylock); + setup_timer(&ir_dev->timer_keyup, ir_timer_keyup, (unsigned long)ir_dev); + ir_dev->rc_tab.name = rc_tab->name; ir_dev->rc_tab.ir_type = rc_tab->ir_type; ir_dev->rc_tab.alloc = roundup_pow_of_two(rc_tab->size * @@ -383,6 +458,8 @@ int __ir_input_register(struct input_dev *input_dev, ir_dev->rc_tab.size, ir_dev->rc_tab.alloc); set_bit(EV_KEY, input_dev->evbit); + set_bit(EV_REP, input_dev->evbit); + if (ir_setkeytable(input_dev, &ir_dev->rc_tab, rc_tab)) { rc = -ENOMEM; goto out_table; @@ -428,7 +505,7 @@ void ir_input_unregister(struct input_dev *dev) return; IR_dprintk(1, "Freed keycode table\n"); - + del_timer_sync(&ir_dev->timer_keyup); rc_tab = &ir_dev->rc_tab; rc_tab->size = 0; kfree(rc_tab->scan); diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 83a9912722f4..0b50060ffbaf 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -180,8 +180,7 @@ static int __ir_nec_decode(struct input_dev *input_dev, if (is_repeat(evs, len, *pos)) { *pos += 2; if (ir->keypressed) { - mod_timer(&ir->raw->timer_keyup, - jiffies + msecs_to_jiffies(REPEAT_TIME)); + ir_repeat(input_dev); IR_dprintk(1, "NEC repeat event\n"); return 1; } else { @@ -238,9 +237,7 @@ static int __ir_nec_decode(struct input_dev *input_dev, } IR_dprintk(1, "NEC scancode 0x%04x\n", ircode); - ir_keydown(input_dev, ircode); - mod_timer(&ir->raw->timer_keyup, - jiffies + msecs_to_jiffies(REPEAT_TIME)); + ir_keydown(input_dev, ircode, 0); return 1; err: diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 371d88e5a586..59f20541b03e 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -53,13 +53,6 @@ static spinlock_t ir_raw_handler_lock; /* Used to load the decoders */ static struct work_struct wq_load; -static void ir_keyup_timer(unsigned long data) -{ - struct input_dev *input_dev = (struct input_dev *)data; - - ir_keyup(input_dev); -} - int ir_raw_event_register(struct input_dev *input_dev) { struct ir_input_dev *ir = input_get_drvdata(input_dev); @@ -72,11 +65,6 @@ int ir_raw_event_register(struct input_dev *input_dev) size = sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE * 2; size = roundup_pow_of_two(size); - init_timer(&ir->raw->timer_keyup); - ir->raw->timer_keyup.function = ir_keyup_timer; - ir->raw->timer_keyup.data = (unsigned long)input_dev; - set_bit(EV_REP, input_dev->evbit); - rc = kfifo_alloc(&ir->raw->kfifo, size, GFP_KERNEL); if (rc < 0) { kfree(ir->raw); @@ -103,8 +91,6 @@ void ir_raw_event_unregister(struct input_dev *input_dev) if (!ir->raw) return; - del_timer_sync(&ir->raw->timer_keyup); - RUN_DECODER(raw_unregister, input_dev); kfifo_free(&ir->raw->kfifo); diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 7a0be8d4999d..b452a478c12c 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -76,7 +76,6 @@ struct ir_raw_event { struct ir_raw_event_ctrl { struct kfifo kfifo; /* fifo for the pulse/space events */ struct timespec last_event; /* when last event occurred */ - struct timer_list timer_keyup; /* timer for key release */ }; struct ir_input_dev { @@ -86,10 +85,16 @@ struct ir_input_dev { unsigned long devno; /* device number */ const struct ir_dev_props *props; /* Device properties */ struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ + struct input_dev *input_dev; /* the input device associated with this device */ /* key info - needed by IR keycode handlers */ - u32 keycode; /* linux key code */ - int keypressed; /* current state */ + spinlock_t keylock; /* protects the below members */ + bool keypressed; /* current state */ + unsigned long keyup_jiffies; /* when should the current keypress be released? */ + struct timer_list timer_keyup; /* timer for releasing a keypress */ + u32 last_keycode; /* keycode of last command */ + u32 last_scancode; /* scancode of last command */ + u8 last_toggle; /* toggle of last command */ }; struct ir_raw_handler { @@ -115,8 +120,8 @@ void rc_map_init(void); u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); -void ir_keyup(struct input_dev *dev); -void ir_keydown(struct input_dev *dev, int scancode); +void ir_repeat(struct input_dev *dev); +void ir_keydown(struct input_dev *dev, int scancode, u8 toggle); int __ir_input_register(struct input_dev *dev, const struct ir_scancode_table *ir_codes, const struct ir_dev_props *props, -- GitLab From 13c24497086418010bf4f76378bcae241d7f59cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Fri, 2 Apr 2010 15:58:30 -0300 Subject: [PATCH 297/534] V4L/DVB: Convert drivers/media/dvb/ttpci/budget-ci.c to use ir-core MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Converts drivers/media/dvb/ttpci/budget-ci.c to use ir-core rather than rolling its own keydown timeout handler and reporting keys via drivers/media/IR/ir-functions.c. [mchehab@redhat.com: Drop the call to ir_input_init() as it is no longer needed] Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/ttpci/budget-ci.c | 40 +++-------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index be2074995a0d..461714396331 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include "budget.h" @@ -82,12 +82,6 @@ #define SLOTSTATUS_READY 8 #define SLOTSTATUS_OCCUPIED (SLOTSTATUS_PRESENT|SLOTSTATUS_RESET|SLOTSTATUS_READY) -/* - * Milliseconds during which a key is regarded as pressed. - * If an identical command arrives within this time, the timer will start over. - */ -#define IR_KEYPRESS_TIMEOUT 250 - /* RC5 device wildcard */ #define IR_DEVICE_ANY 255 @@ -104,12 +98,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); struct budget_ci_ir { struct input_dev *dev; struct tasklet_struct msp430_irq_tasklet; - struct timer_list timer_keyup; char name[72]; /* 40 + 32 for (struct saa7146_dev).name */ char phys[32]; - struct ir_input_state state; int rc5_device; - u32 last_raw; u32 ir_key; bool have_command; }; @@ -124,18 +115,11 @@ struct budget_ci { u8 tuner_pll_address; /* used for philips_tdm1316l configs */ }; -static void msp430_ir_keyup(unsigned long data) -{ - struct budget_ci_ir *ir = (struct budget_ci_ir *) data; - ir_input_nokey(ir->dev, &ir->state); -} - static void msp430_ir_interrupt(unsigned long data) { struct budget_ci *budget_ci = (struct budget_ci *) data; struct input_dev *dev = budget_ci->ir.dev; u32 command = ttpci_budget_debiread(&budget_ci->budget, DEBINOSWAP, DEBIADDR_IR, 2, 1, 0) >> 8; - u32 raw; /* * The msp430 chip can generate two different bytes, command and device @@ -171,20 +155,12 @@ static void msp430_ir_interrupt(unsigned long data) return; budget_ci->ir.have_command = false; + /* FIXME: We should generate complete scancodes with device info */ if (budget_ci->ir.rc5_device != IR_DEVICE_ANY && budget_ci->ir.rc5_device != (command & 0x1f)) return; - /* Is this a repeated key sequence? (same device, command, toggle) */ - raw = budget_ci->ir.ir_key | (command << 8); - if (budget_ci->ir.last_raw != raw || !timer_pending(&budget_ci->ir.timer_keyup)) { - ir_input_nokey(dev, &budget_ci->ir.state); - ir_input_keydown(dev, &budget_ci->ir.state, - budget_ci->ir.ir_key); - budget_ci->ir.last_raw = raw; - } - - mod_timer(&budget_ci->ir.timer_keyup, jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT)); + ir_keydown(dev, budget_ci->ir.ir_key, (command & 0x20) ? 1 : 0); } static int msp430_ir_init(struct budget_ci *budget_ci) @@ -249,13 +225,6 @@ static int msp430_ir_init(struct budget_ci *budget_ci) break; } - ir_input_init(input_dev, &budget_ci->ir.state, IR_TYPE_RC5); - - /* initialise the key-up timeout handler */ - init_timer(&budget_ci->ir.timer_keyup); - budget_ci->ir.timer_keyup.function = msp430_ir_keyup; - budget_ci->ir.timer_keyup.data = (unsigned long) &budget_ci->ir; - budget_ci->ir.last_raw = 0xffff; /* An impossible value */ error = ir_input_register(input_dev, ir_codes, NULL, MODULE_NAME); if (error) { printk(KERN_ERR "budget_ci: could not init driver for IR device (code %d)\n", error); @@ -284,9 +253,6 @@ static void msp430_ir_deinit(struct budget_ci *budget_ci) saa7146_setgpio(saa, 3, SAA7146_GPIO_INPUT); tasklet_kill(&budget_ci->ir.msp430_irq_tasklet); - del_timer_sync(&dev->timer); - ir_input_nokey(dev, &budget_ci->ir.state); - ir_input_unregister(dev); } -- GitLab From 2f16f6315f583964732bc23c873d4024281d763c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Apr 2010 18:51:50 -0300 Subject: [PATCH 298/534] V4L/DVB: ir-nec-decoder: Reimplement the entire decoder Thanks to Andy Walls for pointing me his code, that gave me some ideas to better implement it. After some work with saa7134 bits, I found a way to catch both IRQ edge pulses. By enabling it, the NEC decoder can now take both pulse and spaces into account, making it more precise. Instead of the old strategy of handling the events all at once, this code implements a state machine. Due to that, it handles individual pulse or space events, validating them against the protocol, producing a much more reliable decoding. With the new implementation, the protocol trailer bits are properly handled, making possible for the repeat key to work. Also, the code is now capable of handling both NEC and NEC extended IR devices. With NEC, it produces a 16 bits code, while with NEC extended, a 24 bits code is returned. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-nec-decoder.c | 271 ++++++++++++-------- drivers/media/video/saa7134/saa7134-input.c | 9 +- 2 files changed, 172 insertions(+), 108 deletions(-) diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 0b50060ffbaf..33b260f517f5 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -14,6 +14,14 @@ #include +#define NEC_UNIT 559979 /* ns */ +#define NEC_HEADER_MARK (16 * NEC_UNIT) +#define NEC_HEADER_SPACE (8 * NEC_UNIT) +#define NEC_REPEAT_SPACE (4 * NEC_UNIT) +#define NEC_MARK (NEC_UNIT) +#define NEC_0_SYMBOL (NEC_UNIT) +#define NEC_1_SYMBOL (3 * NEC_UNIT) + /* Start time: 4.5 ms + 560 us of the next pulse */ #define MIN_START_TIME (3900000 + 560000) #define MAX_START_TIME (5100000 + 560000) @@ -43,10 +51,32 @@ static LIST_HEAD(decoder_list); static spinlock_t decoder_lock; +enum nec_state { + STATE_INACTIVE, + STATE_HEADER_MARK, + STATE_HEADER_SPACE, + STATE_MARK, + STATE_SPACE, + STATE_TRAILER_MARK, + STATE_TRAILER_SPACE, +}; + +struct nec_code { + u8 address; + u8 not_address; + u8 command; + u8 not_command; +}; + struct decoder_data { struct list_head list; struct ir_input_dev *ir_dev; int enabled:1; + + /* State machine control */ + enum nec_state state; + struct nec_code nec_code; + unsigned count; }; @@ -118,139 +148,173 @@ static struct attribute_group decoder_attribute_group = { }; -/** is_repeat - Check if it is a NEC repeat event +/** + * handle_event() - Decode one NEC pulse or space * @input_dev: the struct input_dev descriptor of the device - * @pos: the position of the first event - * @len: the length of the buffer + * @ev: event array with type/duration of pulse/space + * + * This function returns -EINVAL if the pulse violates the state machine */ -static int is_repeat(struct ir_raw_event *evs, int len, int pos) +static int handle_event(struct input_dev *input_dev, + struct ir_raw_event *ev) { - if ((evs[pos].delta.tv_nsec < MIN_REPEAT_START_TIME) || - (evs[pos].delta.tv_nsec > MAX_REPEAT_START_TIME)) - return 0; + struct decoder_data *data; + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + int bit, last_bit; - if (++pos >= len) - return 0; + data = get_decoder_data(ir_dev); + if (!data) + return -EINVAL; - if ((evs[pos].delta.tv_nsec < MIN_REPEAT_TIME) || - (evs[pos].delta.tv_nsec > MAX_REPEAT_TIME)) - return 0; + /* Except for the initial event, what matters is the previous bit */ + bit = (ev->type & IR_PULSE) ? 1 : 0; - return 1; -} + last_bit = !bit; -/** - * __ir_nec_decode() - Decode one NEC pulsecode - * @input_dev: the struct input_dev descriptor of the device - * @evs: event array with type/duration of pulse/space - * @len: length of the array - * @pos: position to start seeking for a code - * This function returns -EINVAL if no pulse got decoded, - * 0 if buffer is empty and 1 if one keycode were handled. - */ -static int __ir_nec_decode(struct input_dev *input_dev, - struct ir_raw_event *evs, - int len, int *pos) -{ - struct ir_input_dev *ir = input_get_drvdata(input_dev); - int count = -1; - int ircode = 0, not_code = 0; - - /* Be sure that the first event is an start one and is a pulse */ - for (; *pos < len; (*pos)++) { - /* Very long delays are considered as start events */ - if (evs[*pos].delta.tv_nsec > MAX_NEC_TIME) - break; - if (evs[*pos].type & IR_START_EVENT) - break; - IR_dprintk(1, "%luus: Spurious NEC %s\n", - (evs[*pos].delta.tv_nsec + 500) / 1000, - (evs[*pos].type & IR_SPACE) ? "space" : "pulse"); + /* Discards spurious space last_bits when inactive */ - } - if (*pos >= len) - return 0; + /* Very long delays are considered as start events */ + if (ev->delta.tv_nsec > NEC_HEADER_MARK + NEC_HEADER_SPACE - NEC_UNIT / 2) + data->state = STATE_INACTIVE; - (*pos)++; /* First event doesn't contain data */ + if (ev->type & IR_START_EVENT) + data->state = STATE_INACTIVE; - if (evs[*pos].type != IR_PULSE) - goto err; + switch (data->state) { + case STATE_INACTIVE: + if (!bit) /* PULSE marks the start event */ + return 0; - /* Check if it is a NEC repeat event */ - if (is_repeat(evs, len, *pos)) { - *pos += 2; - if (ir->keypressed) { - ir_repeat(input_dev); - IR_dprintk(1, "NEC repeat event\n"); - return 1; - } else { - IR_dprintk(1, "missing NEC repeat event\n"); + data->count = 0; + data->state = STATE_HEADER_MARK; + memset (&data->nec_code, 0, sizeof(data->nec_code)); + return 0; + case STATE_HEADER_MARK: + if (!last_bit) + goto err; + if (ev->delta.tv_nsec < NEC_HEADER_MARK - 6 * NEC_UNIT) + goto err; + data->state = STATE_HEADER_SPACE; + return 0; + case STATE_HEADER_SPACE: + if (last_bit) + goto err; + if (ev->delta.tv_nsec >= NEC_HEADER_SPACE - NEC_UNIT / 2) { + data->state = STATE_MARK; return 0; } - } - /* First space should have 4.5 ms otherwise is not NEC protocol */ - if ((evs[*pos].delta.tv_nsec < MIN_START_TIME) || - (evs[*pos].delta.tv_nsec > MAX_START_TIME)) + if (ev->delta.tv_nsec >= NEC_REPEAT_SPACE - NEC_UNIT / 2) { + ir_repeat(input_dev); + IR_dprintk(1, "Repeat last key\n"); + data->state = STATE_TRAILER_MARK; + return 0; + } goto err; + case STATE_MARK: + if (!last_bit) + goto err; + if ((ev->delta.tv_nsec > NEC_MARK + NEC_UNIT / 2) || + (ev->delta.tv_nsec < NEC_MARK - NEC_UNIT / 2)) + goto err; + data->state = STATE_SPACE; + return 0; + case STATE_SPACE: + if (last_bit) + goto err; - count = 0; - for ((*pos)++; *pos < len; (*pos)++) { - int bit; - if ((evs[*pos].delta.tv_nsec > MIN_BIT1_TIME) && - (evs[*pos].delta.tv_nsec < MAX_BIT1_TIME)) - bit = 1; - else if ((evs[*pos].delta.tv_nsec > MIN_BIT0_TIME) && - (evs[*pos].delta.tv_nsec < MAX_BIT0_TIME)) + if ((ev->delta.tv_nsec >= NEC_0_SYMBOL - NEC_UNIT / 2) && + (ev->delta.tv_nsec < NEC_0_SYMBOL + NEC_UNIT / 2)) bit = 0; - else - goto err; + else if ((ev->delta.tv_nsec >= NEC_1_SYMBOL - NEC_UNIT / 2) && + (ev->delta.tv_nsec < NEC_1_SYMBOL + NEC_UNIT / 2)) + bit = 1; + else { + IR_dprintk(1, "Decode failed at %d-th bit (%s) @%luus\n", + data->count, + last_bit ? "pulse" : "space", + (ev->delta.tv_nsec + 500) / 1000); + + goto err2; + } + /* Ok, we've got a valid bit. proccess it */ if (bit) { - int shift = count; - /* Address first, then command */ + int shift = data->count; + + /* + * NEC transmit bytes on this temporal order: + * address | not address | command | not command + */ if (shift < 8) { - shift += 8; - ircode |= 1 << shift; + data->nec_code.address |= 1 << shift; } else if (shift < 16) { - not_code |= 1 << shift; + data->nec_code.not_address |= 1 << (shift - 8); } else if (shift < 24) { - shift -= 16; - ircode |= 1 << shift; + data->nec_code.command |= 1 << (shift - 16); } else { - shift -= 24; - not_code |= 1 << shift; + data->nec_code.not_command |= 1 << (shift - 24); } } - if (++count == 32) - break; - } - (*pos)++; - - /* - * Fixme: may need to accept Extended NEC protocol? - */ - if ((ircode & ~not_code) != ircode) { - IR_dprintk(1, "NEC checksum error: code 0x%04x, not-code 0x%04x\n", - ircode, not_code); - return -EINVAL; - } + if (++data->count == 32) { + u32 scancode; + /* + * Fixme: may need to accept Extended NEC protocol? + */ + if ((data->nec_code.command ^ data->nec_code.not_command) != 0xff) + goto checksum_err; + + if ((data->nec_code.address ^ data->nec_code.not_address) != 0xff) { + /* Extended NEC */ + scancode = data->nec_code.address << 16 | + data->nec_code.not_address << 8 | + data->nec_code.command; + IR_dprintk(1, "NEC scancode 0x%06x\n", scancode); + } else { + /* normal NEC */ + scancode = data->nec_code.address << 8 | + data->nec_code.command; + IR_dprintk(1, "NEC scancode 0x%04x\n", scancode); + } + ir_keydown(input_dev, scancode, 0); - IR_dprintk(1, "NEC scancode 0x%04x\n", ircode); - ir_keydown(input_dev, ircode, 0); + data->state = STATE_TRAILER_MARK; + } else + data->state = STATE_MARK; + return 0; + case STATE_TRAILER_MARK: + if (!last_bit) + goto err; + data->state = STATE_TRAILER_SPACE; + return 0; + case STATE_TRAILER_SPACE: + if (last_bit) + goto err; + data->state = STATE_INACTIVE; + return 0; + } - return 1; err: - IR_dprintk(1, "NEC decoded failed at bit %d (%s) while decoding %luus time\n", - count, - (evs[*pos].type & IR_SPACE) ? "space" : "pulse", - (evs[*pos].delta.tv_nsec + 500) / 1000); + IR_dprintk(1, "NEC decoded failed at state %d (%s) @ %luus\n", + data->state, + bit ? "pulse" : "space", + (ev->delta.tv_nsec + 500) / 1000); +err2: + data->state = STATE_INACTIVE; + return -EINVAL; +checksum_err: + data->state = STATE_INACTIVE; + IR_dprintk(1, "NEC checksum error: received 0x%02x%02x%02x%02x\n", + data->nec_code.address, + data->nec_code.not_address, + data->nec_code.command, + data->nec_code.not_command); return -EINVAL; } /** - * __ir_nec_decode() - Decodes all NEC pulsecodes on a given array + * ir_nec_decode() - Decodes all NEC pulsecodes on a given array * @input_dev: the struct input_dev descriptor of the device * @evs: event array with type/duration of pulse/space * @len: length of the array @@ -269,10 +333,9 @@ static int ir_nec_decode(struct input_dev *input_dev, if (!data || !data->enabled) return 0; - while (pos < len) { - if (__ir_nec_decode(input_dev, evs, len, &pos) > 0) - rc++; - } + for (pos = 0; pos < len; pos++) + handle_event(input_dev, &evs[pos]); + return rc; } diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index a51ba83fb6c4..867f027c3feb 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -658,7 +658,8 @@ int saa7134_input_init1(struct saa7134_dev *dev) break; case SAA7134_BOARD_AVERMEDIA_M135A: ir_codes = RC_MAP_AVERMEDIA_M135A_RM_JX; - mask_keydown = 0x0040000; + mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */ + mask_keyup = 0x0040000; mask_keycode = 0xffff; raw_decode = 1; break; @@ -1014,13 +1015,13 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) { struct card_ir *ir = dev->remote; unsigned long timeout; - int pulse; + int space; /* Generate initial event */ saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); - pulse = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; - ir_raw_event_store(dev->remote->dev, pulse ? IR_PULSE : IR_SPACE); + space = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; + ir_raw_event_store(dev->remote->dev, space ? IR_SPACE : IR_PULSE); /* -- GitLab From 67780d6a2347d03b640f22295f8df7f00fbc829f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 3 Apr 2010 20:33:00 -0300 Subject: [PATCH 299/534] V4L/DVB: ir-nec-decoder: Cleanups Remove dead code and properly name a few constants Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-nec-decoder.c | 40 +++++++------------------------ 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 33b260f517f5..087211c5496a 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -14,38 +14,14 @@ #include +#define NEC_NBITS 32 #define NEC_UNIT 559979 /* ns */ #define NEC_HEADER_MARK (16 * NEC_UNIT) #define NEC_HEADER_SPACE (8 * NEC_UNIT) #define NEC_REPEAT_SPACE (4 * NEC_UNIT) #define NEC_MARK (NEC_UNIT) -#define NEC_0_SYMBOL (NEC_UNIT) -#define NEC_1_SYMBOL (3 * NEC_UNIT) - -/* Start time: 4.5 ms + 560 us of the next pulse */ -#define MIN_START_TIME (3900000 + 560000) -#define MAX_START_TIME (5100000 + 560000) - -/* Bit 1 time: 2.25ms us */ -#define MIN_BIT1_TIME 2050000 -#define MAX_BIT1_TIME 2450000 - -/* Bit 0 time: 1.12ms us */ -#define MIN_BIT0_TIME 920000 -#define MAX_BIT0_TIME 1320000 - -/* Total IR code is 110 ms, including the 9 ms for the start pulse */ -#define MAX_NEC_TIME 4000000 - -/* Total IR code is 110 ms, including the 9 ms for the start pulse */ -#define MIN_REPEAT_TIME 99000000 -#define MAX_REPEAT_TIME 112000000 - -/* Repeat time: 2.25ms us */ -#define MIN_REPEAT_START_TIME 2050000 -#define MAX_REPEAT_START_TIME 3000000 - -#define REPEAT_TIME 240 /* ms */ +#define NEC_0_SPACE (NEC_UNIT) +#define NEC_1_SPACE (3 * NEC_UNIT) /* Used to register nec_decoder clients */ static LIST_HEAD(decoder_list); @@ -223,11 +199,11 @@ static int handle_event(struct input_dev *input_dev, if (last_bit) goto err; - if ((ev->delta.tv_nsec >= NEC_0_SYMBOL - NEC_UNIT / 2) && - (ev->delta.tv_nsec < NEC_0_SYMBOL + NEC_UNIT / 2)) + if ((ev->delta.tv_nsec >= NEC_0_SPACE - NEC_UNIT / 2) && + (ev->delta.tv_nsec < NEC_0_SPACE + NEC_UNIT / 2)) bit = 0; - else if ((ev->delta.tv_nsec >= NEC_1_SYMBOL - NEC_UNIT / 2) && - (ev->delta.tv_nsec < NEC_1_SYMBOL + NEC_UNIT / 2)) + else if ((ev->delta.tv_nsec >= NEC_1_SPACE - NEC_UNIT / 2) && + (ev->delta.tv_nsec < NEC_1_SPACE + NEC_UNIT / 2)) bit = 1; else { IR_dprintk(1, "Decode failed at %d-th bit (%s) @%luus\n", @@ -256,7 +232,7 @@ static int handle_event(struct input_dev *input_dev, data->nec_code.not_command |= 1 << (shift - 24); } } - if (++data->count == 32) { + if (++data->count == NEC_NBITS) { u32 scancode; /* * Fixme: may need to accept Extended NEC protocol? -- GitLab From db1423a6c79f66db2b1846614c13bde9c2db7ad2 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Apr 2010 10:27:20 -0300 Subject: [PATCH 300/534] V4L-DVB: ir-rc5-decoder: Add a decoder for RC-5 IR protocol This decoder is also based on a state machine, just like the NEC protocol decoder. It is pedantic in the sense that accepts only 14 bits. As there are some variants that outputs less bits, it needs to be improved to also handle those. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/Kconfig | 9 + drivers/media/IR/Makefile | 1 + drivers/media/IR/ir-raw-event.c | 1 + drivers/media/IR/ir-rc5-decoder.c | 371 ++++++++++++++++++++++++++++++ include/media/ir-core.h | 7 + 5 files changed, 389 insertions(+) create mode 100644 drivers/media/IR/ir-rc5-decoder.c diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig index 0c557b8cc932..ba81bda3513d 100644 --- a/drivers/media/IR/Kconfig +++ b/drivers/media/IR/Kconfig @@ -18,3 +18,12 @@ config IR_NEC_DECODER ---help--- Enable this option if you have IR with NEC protocol, and if the IR is decoded in software + +config IR_RC5_DECODER + tristate "Enable IR raw decoder for RC-5 protocol" + depends on IR_CORE + default y + + ---help--- + Enable this option if you have IR with RC-5 protocol, and + if the IR is decoded in software diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile index 0e3f912054ca..62e12d5c443a 100644 --- a/drivers/media/IR/Makefile +++ b/drivers/media/IR/Makefile @@ -6,3 +6,4 @@ obj-y += keymaps/ obj-$(CONFIG_IR_CORE) += ir-core.o obj-$(CONFIG_VIDEO_IR) += ir-common.o obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o +obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 59f20541b03e..617e437e2beb 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -200,6 +200,7 @@ static void init_decoders(struct work_struct *work) /* Load the decoder modules */ load_nec_decode(); + load_rc5_decode(); /* If needed, we may later add some init code. In this case, it is needed to change the CONFIG_MODULE test at ir-core.h diff --git a/drivers/media/IR/ir-rc5-decoder.c b/drivers/media/IR/ir-rc5-decoder.c new file mode 100644 index 000000000000..4b7eafecd842 --- /dev/null +++ b/drivers/media/IR/ir-rc5-decoder.c @@ -0,0 +1,371 @@ +/* ir-rc5-decoder.c - handle RC-5 IR Pulse/Space protocol + * + * Copyright (C) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +/* + * This code only handles 14 bits RC-5 protocols. There are other variants + * that use a different number of bits. This is currently unsupported + */ + +#include + +#define RC5_NBITS 14 +#define RC5_HALFBIT 888888 /* ns */ +#define RC5_BIT (RC5_HALFBIT * 2) +#define RC5_DURATION (RC5_BIT * RC5_NBITS) + +#define is_rc5_halfbit(nsec) ((ev->delta.tv_nsec >= RC5_HALFBIT / 2) && \ + (ev->delta.tv_nsec < RC5_HALFBIT + RC5_HALFBIT / 2)) + +#define n_half(nsec) ((ev->delta.tv_nsec + RC5_HALFBIT / 2) / RC5_HALFBIT) + +/* Used to register rc5_decoder clients */ +static LIST_HEAD(decoder_list); +static spinlock_t decoder_lock; + +enum rc5_state { + STATE_INACTIVE, + STATE_START2_SPACE, + STATE_START2_MARK, + STATE_MARKSPACE, + STATE_TRAILER_MARK, +}; + +static char *st_name[] = { + "Inactive", + "start2 sapce", + "start2 mark", + "mark", + "space", + "trailer" +}; + +struct rc5_code { + u8 address; + u8 command; +}; + +struct decoder_data { + struct list_head list; + struct ir_input_dev *ir_dev; + int enabled:1; + + /* State machine control */ + enum rc5_state state; + struct rc5_code rc5_code; + unsigned n_half; + unsigned count; +}; + + +/** + * get_decoder_data() - gets decoder data + * @input_dev: input device + * + * Returns the struct decoder_data that corresponds to a device + */ + +static struct decoder_data *get_decoder_data(struct ir_input_dev *ir_dev) +{ + struct decoder_data *data = NULL; + + spin_lock(&decoder_lock); + list_for_each_entry(data, &decoder_list, list) { + if (data->ir_dev == ir_dev) + break; + } + spin_unlock(&decoder_lock); + return data; +} + +static ssize_t store_enabled(struct device *d, + struct device_attribute *mattr, + const char *buf, + size_t len) +{ + unsigned long value; + struct ir_input_dev *ir_dev = dev_get_drvdata(d); + struct decoder_data *data = get_decoder_data(ir_dev); + + if (!data) + return -EINVAL; + + if (strict_strtoul(buf, 10, &value) || value > 1) + return -EINVAL; + + data->enabled = value; + + return len; +} + +static ssize_t show_enabled(struct device *d, + struct device_attribute *mattr, char *buf) +{ + struct ir_input_dev *ir_dev = dev_get_drvdata(d); + struct decoder_data *data = get_decoder_data(ir_dev); + + if (!data) + return -EINVAL; + + if (data->enabled) + return sprintf(buf, "1\n"); + else + return sprintf(buf, "0\n"); +} + +static DEVICE_ATTR(enabled, S_IRUGO | S_IWUSR, show_enabled, store_enabled); + +static struct attribute *decoder_attributes[] = { + &dev_attr_enabled.attr, + NULL +}; + +static struct attribute_group decoder_attribute_group = { + .name = "rc5_decoder", + .attrs = decoder_attributes, +}; + +/** + * handle_event() - Decode one RC-5 pulse or space + * @input_dev: the struct input_dev descriptor of the device + * @ev: event array with type/duration of pulse/space + * + * This function returns -EINVAL if the pulse violates the state machine + */ +static int handle_event(struct input_dev *input_dev, + struct ir_raw_event *ev) +{ + struct decoder_data *data; + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + int bit, last_bit, n_half; + + data = get_decoder_data(ir_dev); + if (!data) + return -EINVAL; + + /* Except for the initial event, what matters is the previous bit */ + bit = (ev->type & IR_PULSE) ? 1 : 0; + + last_bit = !bit; + + /* Discards spurious space last_bits when inactive */ + + /* Very long delays are considered as start events */ + if (ev->delta.tv_nsec > RC5_DURATION + RC5_HALFBIT / 2) + data->state = STATE_INACTIVE; + + if (ev->type & IR_START_EVENT) + data->state = STATE_INACTIVE; + + switch (data->state) { + case STATE_INACTIVE: +IR_dprintk(1, "currently inative. Received bit (%s) @%luus\n", + last_bit ? "pulse" : "space", + (ev->delta.tv_nsec + 500) / 1000); + + /* Discards the initial start space */ + if (bit) + return 0; + data->count = 0; + data->n_half = 0; + memset (&data->rc5_code, 0, sizeof(data->rc5_code)); + + data->state = STATE_START2_SPACE; + return 0; + case STATE_START2_SPACE: + if (last_bit) + goto err; + if (!is_rc5_halfbit(ev->delta.tv_nsec)) + goto err; + data->state = STATE_START2_MARK; + return 0; + case STATE_START2_MARK: + if (!last_bit) + goto err; + + if (!is_rc5_halfbit(ev->delta.tv_nsec)) + goto err; + + data->state = STATE_MARKSPACE; + return 0; + case STATE_MARKSPACE: + n_half = n_half(ev->delta.tv_nsec); + if (n_half < 1 || n_half > 3) { + IR_dprintk(1, "Decode failed at %d-th bit (%s) @%luus\n", + data->count, + last_bit ? "pulse" : "space", + (ev->delta.tv_nsec + 500) / 1000); +printk("%d halves\n", n_half); + goto err2; + } + data->n_half += n_half; + + if (!last_bit) + return 0; + + /* Got one complete mark/space cycle */ + + bit = ((data->count + 1) * 2)/ data->n_half; + +printk("%d halves, %d bits\n", n_half, bit); + +#if 1 /* SANITY check - while testing the decoder */ + if (bit > 1) { + IR_dprintk(1, "Decoder HAS failed at %d-th bit (%s) @%luus\n", + data->count, + last_bit ? "pulse" : "space", + (ev->delta.tv_nsec + 500) / 1000); + + goto err2; + } +#endif + /* Ok, we've got a valid bit. proccess it */ + if (bit) { + int shift = data->count; + + /* + * RC-5 transmit bytes on this temporal order: + * address | not address | command | not command + */ + if (shift < 8) { + data->rc5_code.address |= 1 << shift; + } else { + data->rc5_code.command |= 1 << (shift - 8); + } + } + IR_dprintk(1, "RC-5: bit #%d: %d (%d)\n", + data->count, bit, data->n_half); + if (++data->count >= RC5_NBITS) { + u32 scancode; + scancode = data->rc5_code.address << 8 | + data->rc5_code.command; + IR_dprintk(1, "RC-5 scancode 0x%04x\n", scancode); + + ir_keydown(input_dev, scancode, 0); + + data->state = STATE_TRAILER_MARK; + } + return 0; + case STATE_TRAILER_MARK: + if (!last_bit) + goto err; + data->state = STATE_INACTIVE; + return 0; + } + +err: + IR_dprintk(1, "RC-5 decoded failed at state %s (%s) @ %luus\n", + st_name[data->state], + bit ? "pulse" : "space", + (ev->delta.tv_nsec + 500) / 1000); +err2: + data->state = STATE_INACTIVE; + return -EINVAL; +} + +/** + * ir_rc5_decode() - Decodes all RC-5 pulsecodes on a given array + * @input_dev: the struct input_dev descriptor of the device + * @evs: event array with type/duration of pulse/space + * @len: length of the array + * This function returns the number of decoded pulses + */ +static int ir_rc5_decode(struct input_dev *input_dev, + struct ir_raw_event *evs, + int len) +{ + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + struct decoder_data *data; + int pos = 0; + int rc = 0; + + data = get_decoder_data(ir_dev); + if (!data || !data->enabled) + return 0; + + for (pos = 0; pos < len; pos++) + handle_event(input_dev, &evs[pos]); + + return rc; +} + +static int ir_rc5_register(struct input_dev *input_dev) +{ + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + struct decoder_data *data; + int rc; + + rc = sysfs_create_group(&ir_dev->dev.kobj, &decoder_attribute_group); + if (rc < 0) + return rc; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) { + sysfs_remove_group(&ir_dev->dev.kobj, &decoder_attribute_group); + return -ENOMEM; + } + + data->ir_dev = ir_dev; + data->enabled = 1; + + spin_lock(&decoder_lock); + list_add_tail(&data->list, &decoder_list); + spin_unlock(&decoder_lock); + + return 0; +} + +static int ir_rc5_unregister(struct input_dev *input_dev) +{ + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); + static struct decoder_data *data; + + data = get_decoder_data(ir_dev); + if (!data) + return 0; + + sysfs_remove_group(&ir_dev->dev.kobj, &decoder_attribute_group); + + spin_lock(&decoder_lock); + list_del(&data->list); + spin_unlock(&decoder_lock); + + return 0; +} + +static struct ir_raw_handler rc5_handler = { + .decode = ir_rc5_decode, + .raw_register = ir_rc5_register, + .raw_unregister = ir_rc5_unregister, +}; + +static int __init ir_rc5_decode_init(void) +{ + ir_raw_handler_register(&rc5_handler); + + printk(KERN_INFO "IR RC-5 protocol handler initialized\n"); + return 0; +} + +static void __exit ir_rc5_decode_exit(void) +{ + ir_raw_handler_unregister(&rc5_handler); +} + +module_init(ir_rc5_decode_init); +module_exit(ir_rc5_decode_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); +MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); +MODULE_DESCRIPTION("RC-5 IR protocol decoder"); diff --git a/include/media/ir-core.h b/include/media/ir-core.h index b452a478c12c..40900739cb84 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -178,4 +178,11 @@ void ir_raw_init(void); #define load_nec_decode() 0 #endif +/* from ir-rc5-decoder.c */ +#ifdef CONFIG_IR_RC5_DECODER_MODULE +#define load_rc5_decode() request_module("ir-rc5-decoder") +#else +#define load_rc5_decode() 0 +#endif + #endif /* _IR_CORE */ -- GitLab From 26d5683d36729f11f5764909ae37c69488596d36 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Apr 2010 10:32:04 -0300 Subject: [PATCH 301/534] V4L/DVB: cx88: don't handle IR on Pixelview too fast Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 6efad1da65bf..7ddc8bb463f8 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -316,9 +316,9 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: ir_codes = RC_MAP_PIXELVIEW; ir->gpio_addr = MO_GP1_IO; - ir->mask_keycode = 0x1f; + ir->mask_keycode = 0x1f; /* Only command is retrieved */ ir->mask_keyup = 0x80; - ir->polling = 1; /* ms */ + ir->polling = 10; /* ms */ break; case CX88_BOARD_PROLINK_PV_8000GT: case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: -- GitLab From 587835a4b0ada7d78c4f3300e3ab26b7b2495705 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Apr 2010 10:44:51 -0300 Subject: [PATCH 302/534] V4L-DVB: ir-core: remove the ancillary buffer Now that the decoders are state machine, there's no need to create an ancillary buffer while decoding the protocol. Just call the decoders code directly, event by event. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-nec-decoder.c | 32 +++---------------------------- drivers/media/IR/ir-raw-event.c | 20 ++++++++----------- drivers/media/IR/ir-rc5-decoder.c | 28 +-------------------------- include/media/ir-core.h | 3 +-- 4 files changed, 13 insertions(+), 70 deletions(-) diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 087211c5496a..28d773563556 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -125,14 +125,14 @@ static struct attribute_group decoder_attribute_group = { /** - * handle_event() - Decode one NEC pulse or space + * ir_nec_decode() - Decode one NEC pulse or space * @input_dev: the struct input_dev descriptor of the device * @ev: event array with type/duration of pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ -static int handle_event(struct input_dev *input_dev, - struct ir_raw_event *ev) +static int ir_nec_decode(struct input_dev *input_dev, + struct ir_raw_event *ev) { struct decoder_data *data; struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); @@ -289,32 +289,6 @@ static int handle_event(struct input_dev *input_dev, return -EINVAL; } -/** - * ir_nec_decode() - Decodes all NEC pulsecodes on a given array - * @input_dev: the struct input_dev descriptor of the device - * @evs: event array with type/duration of pulse/space - * @len: length of the array - * This function returns the number of decoded pulses - */ -static int ir_nec_decode(struct input_dev *input_dev, - struct ir_raw_event *evs, - int len) -{ - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - struct decoder_data *data; - int pos = 0; - int rc = 0; - - data = get_decoder_data(ir_dev); - if (!data || !data->enabled) - return 0; - - for (pos = 0; pos < len; pos++) - handle_event(input_dev, &evs[pos]); - - return rc; -} - static int ir_nec_register(struct input_dev *input_dev) { struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 617e437e2beb..57990a337922 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -138,37 +138,33 @@ int ir_raw_event_handle(struct input_dev *input_dev) { struct ir_input_dev *ir = input_get_drvdata(input_dev); int rc; - struct ir_raw_event *evs; + struct ir_raw_event ev; int len, i; /* * Store the events into a temporary buffer. This allows calling more than * one decoder to deal with the received data */ - len = kfifo_len(&ir->raw->kfifo) / sizeof(*evs); + len = kfifo_len(&ir->raw->kfifo) / sizeof(ev); if (!len) return 0; - evs = kmalloc(len * sizeof(*evs), GFP_ATOMIC); for (i = 0; i < len; i++) { - rc = kfifo_out(&ir->raw->kfifo, &evs[i], sizeof(*evs)); - if (rc != sizeof(*evs)) { + rc = kfifo_out(&ir->raw->kfifo, &ev, sizeof(ev)); + if (rc != sizeof(ev)) { IR_dprintk(1, "overflow error: received %d instead of %zd\n", - rc, sizeof(*evs)); + rc, sizeof(ev)); return -EINVAL; } IR_dprintk(2, "event type %d, time before event: %07luus\n", - evs[i].type, (evs[i].delta.tv_nsec + 500) / 1000); + ev.type, (ev.delta.tv_nsec + 500) / 1000); + rc = RUN_DECODER(decode, input_dev, &ev); } /* * Call all ir decoders. This allows decoding the same event with - * more than one protocol handler. It returns the number of keystrokes - * sent to the event interface + * more than one protocol handler. */ - rc = RUN_DECODER(decode, input_dev, evs, len); - - kfree(evs); return rc; } diff --git a/drivers/media/IR/ir-rc5-decoder.c b/drivers/media/IR/ir-rc5-decoder.c index 4b7eafecd842..61b58397a3c2 100644 --- a/drivers/media/IR/ir-rc5-decoder.c +++ b/drivers/media/IR/ir-rc5-decoder.c @@ -142,7 +142,7 @@ static struct attribute_group decoder_attribute_group = { * * This function returns -EINVAL if the pulse violates the state machine */ -static int handle_event(struct input_dev *input_dev, +static int ir_rc5_decode(struct input_dev *input_dev, struct ir_raw_event *ev) { struct decoder_data *data; @@ -273,32 +273,6 @@ printk("%d halves, %d bits\n", n_half, bit); return -EINVAL; } -/** - * ir_rc5_decode() - Decodes all RC-5 pulsecodes on a given array - * @input_dev: the struct input_dev descriptor of the device - * @evs: event array with type/duration of pulse/space - * @len: length of the array - * This function returns the number of decoded pulses - */ -static int ir_rc5_decode(struct input_dev *input_dev, - struct ir_raw_event *evs, - int len) -{ - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - struct decoder_data *data; - int pos = 0; - int rc = 0; - - data = get_decoder_data(ir_dev); - if (!data || !data->enabled) - return 0; - - for (pos = 0; pos < len; pos++) - handle_event(input_dev, &evs[pos]); - - return rc; -} - static int ir_rc5_register(struct input_dev *input_dev) { struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 40900739cb84..1c1e8d9bd10a 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -101,8 +101,7 @@ struct ir_raw_handler { struct list_head list; int (*decode)(struct input_dev *input_dev, - struct ir_raw_event *evs, - int len); + struct ir_raw_event *ev); int (*raw_register)(struct input_dev *input_dev); int (*raw_unregister)(struct input_dev *input_dev); }; -- GitLab From 4f9256b496677adf799342cee7d406dd46e566d9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Apr 2010 12:38:57 -0300 Subject: [PATCH 303/534] V4L/DVB: ir-core: move rc map code to rc-map.h The keymaps don't need to be recompiled every time a change at ir-core.h happens, since it only depends on rc-map defines. By moving those definitions to the proper header, the code became cleaner, and avoids needing to recompile all the RC maps every time a non-related change is introduced. Signed-off-by: Mauro Carvalho Chehab --- include/media/ir-core.h | 34 ---------------------------------- include/media/rc-map.h | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 1c1e8d9bd10a..0f64b48ecd90 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -16,7 +16,6 @@ #ifndef _IR_CORE #define _IR_CORE -#include #include #include #include @@ -27,12 +26,6 @@ extern int ir_core_debug; #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) -#define IR_TYPE_UNKNOWN 0 -#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ -#define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */ -#define IR_TYPE_NEC (1 << 2) -#define IR_TYPE_OTHER (((u64)1) << 63l) - enum raw_event_type { IR_SPACE = (1 << 0), IR_PULSE = (1 << 1), @@ -40,26 +33,6 @@ enum raw_event_type { IR_STOP_EVENT = (1 << 3), }; -struct ir_scancode { - u16 scancode; - u32 keycode; -}; - -struct ir_scancode_table { - struct ir_scancode *scan; - unsigned int size; /* Max number of entries */ - unsigned int len; /* Used number of entries */ - unsigned int alloc; /* Size of *scan in bytes */ - u64 ir_type; - char *name; - spinlock_t lock; -}; - -struct rc_keymap { - struct list_head list; - struct ir_scancode_table map; -}; - struct ir_dev_props { unsigned long allowed_protos; void *priv; @@ -108,13 +81,6 @@ struct ir_raw_handler { #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) -/* Routines from rc-map.c */ - -int ir_register_map(struct rc_keymap *map); -void ir_unregister_map(struct rc_keymap *map); -struct ir_scancode_table *get_rc_map(const char *name); -void rc_map_init(void); - /* Routines from ir-keytable.c */ u32 ir_g_keycode_from_table(struct input_dev *input_dev, diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 9ea0033fa3cc..b10990d1749d 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -9,7 +9,42 @@ * (at your option) any later version. */ -#include +#include + +#define IR_TYPE_UNKNOWN 0 +#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ +#define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */ +#define IR_TYPE_NEC (1 << 2) +#define IR_TYPE_OTHER (1u << 31) + +struct ir_scancode { + u16 scancode; + u32 keycode; +}; + +struct ir_scancode_table { + struct ir_scancode *scan; + unsigned int size; /* Max number of entries */ + unsigned int len; /* Used number of entries */ + unsigned int alloc; /* Size of *scan in bytes */ + u64 ir_type; + char *name; + spinlock_t lock; +}; + +struct rc_keymap { + struct list_head list; + struct ir_scancode_table map; +}; + +/* Routines from rc-map.c */ + +int ir_register_map(struct rc_keymap *map); +void ir_unregister_map(struct rc_keymap *map); +struct ir_scancode_table *get_rc_map(const char *name); +void rc_map_init(void); + +/* Names of the several keytables defined in-kernel */ #define RC_MAP_ADSTECH_DVB_T_PCI "rc-adstech-dvb-t-pci" #define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp" -- GitLab From 9dfe4e8339499bfe8e9a362fefc290b4cb9c3803 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Apr 2010 14:06:55 -0300 Subject: [PATCH 304/534] V4L/DVB: ir-core: Add support for badly-implemented hardware decoders A few hardware Remote Controller decoders, even using a standard protocol, aren't able to provide the entire scancode. Due to that, the capability of using other IR's are limited on those hardware. Adds a way to indicate to ir-core what are the bits that the hardware provides, from a scancode, allowing the addition of a complete IR table to the kernel and allowing a limited support for changing the Remote Controller on those devices. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 25 ++++-- drivers/media/IR/keymaps/Makefile | 1 + drivers/media/IR/keymaps/rc-pixelview-mk12.c | 83 ++++++++++++++++++++ drivers/media/video/cx88/cx88-input.c | 30 ++++++- include/media/ir-core.h | 24 +++++- include/media/rc-map.h | 3 +- 6 files changed, 153 insertions(+), 13 deletions(-) create mode 100644 drivers/media/IR/keymaps/rc-pixelview-mk12.c diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index a89456932f7c..af7400bc906f 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -89,6 +89,18 @@ static int ir_do_setkeycode(struct input_dev *dev, { unsigned int i; int old_keycode = KEY_RESERVED; + struct ir_input_dev *ir_dev = input_get_drvdata(dev); + + /* + * Unfortunately, some hardware-based IR decoders don't provide + * all bits for the complete IR code. In general, they provide only + * the command part of the IR code. Yet, as it is possible to replace + * the provided IR with another one, it is needed to allow loading + * IR tables from other remotes. So, + */ + if (ir_dev->props && ir_dev->props->scanmask) { + scancode &= ir_dev->props->scanmask; + } /* First check if we already have a mapping for this ir command */ for (i = 0; i < rc_tab->len; i++) { @@ -448,6 +460,13 @@ int __ir_input_register(struct input_dev *input_dev, sizeof(struct ir_scancode)); ir_dev->rc_tab.scan = kmalloc(ir_dev->rc_tab.alloc, GFP_KERNEL); ir_dev->rc_tab.size = ir_dev->rc_tab.alloc / sizeof(struct ir_scancode); + if (props) { + ir_dev->props = props; + if (props->open) + input_dev->open = ir_open; + if (props->close) + input_dev->close = ir_close; + } if (!ir_dev->rc_tab.scan) { rc = -ENOMEM; @@ -465,12 +484,6 @@ int __ir_input_register(struct input_dev *input_dev, goto out_table; } - ir_dev->props = props; - if (props && props->open) - input_dev->open = ir_open; - if (props && props->close) - input_dev->close = ir_close; - rc = ir_register_class(input_dev); if (rc < 0) goto out_table; diff --git a/drivers/media/IR/keymaps/Makefile b/drivers/media/IR/keymaps/Makefile index 937b7db9c9d2..c4d891d79491 100644 --- a/drivers/media/IR/keymaps/Makefile +++ b/drivers/media/IR/keymaps/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-pinnacle-grey.o \ rc-pinnacle-pctv-hd.o \ rc-pixelview.o \ + rc-pixelview-mk12.o \ rc-pixelview-new.o \ rc-powercolor-real-angel.o \ rc-proteus-2309.o \ diff --git a/drivers/media/IR/keymaps/rc-pixelview-mk12.c b/drivers/media/IR/keymaps/rc-pixelview-mk12.c new file mode 100644 index 000000000000..5a735d569a8b --- /dev/null +++ b/drivers/media/IR/keymaps/rc-pixelview-mk12.c @@ -0,0 +1,83 @@ +/* rc-pixelview-mk12.h - Keytable for pixelview Remote Controller + * + * keymap imported from ir-keymaps.c + * + * Copyright (c) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include + +/* + * Keytable for MK-F12 IR remote provided together with Pixelview + * Ultra Pro Remote Controller. Uses NEC extended format. + */ +static struct ir_scancode pixelview_mk12[] = { + { 0x866b03, KEY_TUNER }, /* Timeshift */ + { 0x866b1e, KEY_POWER2 }, /* power */ + + { 0x866b01, KEY_1 }, + { 0x866b0b, KEY_2 }, + { 0x866b1b, KEY_3 }, + { 0x866b05, KEY_4 }, + { 0x866b09, KEY_5 }, + { 0x866b15, KEY_6 }, + { 0x866b06, KEY_7 }, + { 0x866b0a, KEY_8 }, + { 0x866b12, KEY_9 }, + { 0x866b02, KEY_0 }, + + { 0x866b13, KEY_AGAIN }, /* loop */ + { 0x866b10, KEY_DIGITS }, /* +100 */ + + { 0x866b00, KEY_MEDIA }, /* source */ + { 0x866b18, KEY_MUTE }, /* mute */ + { 0x866b19, KEY_CAMERA }, /* snapshot */ + { 0x866b1a, KEY_SEARCH }, /* scan */ + + { 0x866b16, KEY_CHANNELUP }, /* chn + */ + { 0x866b14, KEY_CHANNELDOWN }, /* chn - */ + { 0x866b1f, KEY_VOLUMEUP }, /* vol + */ + { 0x866b17, KEY_VOLUMEDOWN }, /* vol - */ + { 0x866b1c, KEY_ZOOM }, /* zoom */ + + { 0x866b04, KEY_REWIND }, + { 0x866b0e, KEY_RECORD }, + { 0x866b0c, KEY_FORWARD }, + + { 0x866b1d, KEY_STOP }, + { 0x866b08, KEY_PLAY }, + { 0x866b0f, KEY_PAUSE }, + + { 0x866b0d, KEY_TV }, + { 0x866b07, KEY_RADIO }, /* FM */ +}; + +static struct rc_keymap pixelview_map = { + .map = { + .scan = pixelview_mk12, + .size = ARRAY_SIZE(pixelview_mk12), + .ir_type = IR_TYPE_NEC, + .name = RC_MAP_PIXELVIEW_MK12, + } +}; + +static int __init init_rc_map_pixelview(void) +{ + return ir_register_map(&pixelview_map); +} + +static void __exit exit_rc_map_pixelview(void) +{ + ir_unregister_map(&pixelview_map); +} + +module_init(init_rc_map_pixelview) +module_exit(exit_rc_map_pixelview) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mauro Carvalho Chehab "); diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index 7ddc8bb463f8..76733349c6cc 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -248,6 +248,9 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) char *ir_codes = NULL; u64 ir_type = IR_TYPE_OTHER; int err = -ENOMEM; + u32 hardware_mask = 0; /* For devices with a hardware mask, when + * used with a full-code IR table + */ ir = kzalloc(sizeof(*ir), GFP_KERNEL); input_dev = input_allocate_device(); @@ -314,11 +317,18 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) break; case CX88_BOARD_PROLINK_PLAYTVPVR: case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: - ir_codes = RC_MAP_PIXELVIEW; + /* + * It seems that this hardware is paired with NEC extended + * address 0x866b. So, unfortunately, its usage with other + * IR's with different address won't work. Still, there are + * other IR's from the same manufacturer that works, like the + * 002-T mini RC, provided with newer PV hardware + */ + ir_codes = RC_MAP_PIXELVIEW_MK12; ir->gpio_addr = MO_GP1_IO; - ir->mask_keycode = 0x1f; /* Only command is retrieved */ ir->mask_keyup = 0x80; ir->polling = 10; /* ms */ + hardware_mask = 0x3f; /* Hardware returns only 6 bits from command part */ break; case CX88_BOARD_PROLINK_PV_8000GT: case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME: @@ -410,6 +420,21 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) goto err_out_free; } + /* + * The usage of mask_keycode were very convenient, due to several + * reasons. Among others, the scancode tables were using the scancode + * as the index elements. So, the less bits it was used, the smaller + * the table were stored. After the input changes, the better is to use + * the full scancodes, since it allows replacing the IR remote by + * another one. Unfortunately, there are still some hardware, like + * Pixelview Ultra Pro, where only part of the scancode is sent via + * GPIO. So, there's no way to get the full scancode. Due to that, + * hardware_mask were introduced here: it represents those hardware + * that has such limits. + */ + if (hardware_mask && !ir->mask_keycode) + ir->mask_keycode = hardware_mask; + /* init input device */ snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name); snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci)); @@ -437,6 +462,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ir->props.priv = core; ir->props.open = cx88_ir_open; ir->props.close = cx88_ir_close; + ir->props.scanmask = hardware_mask; /* all done */ err = ir_input_register(ir->input, ir_codes, &ir->props, MODULE_NAME); diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 0f64b48ecd90..4397ea3d9754 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -33,12 +33,28 @@ enum raw_event_type { IR_STOP_EVENT = (1 << 3), }; +/** + * struct ir_dev_props - Allow caller drivers to set special properties + * @allowed_protos: bitmask with the supported IR_TYPE_* protocols + * @scanmask: some hardware decoders are not capable of providing the full + * scancode to the application. As this is a hardware limit, we can't do + * anything with it. Yet, as the same keycode table can be used with other + * devices, a mask is provided to allow its usage. Drivers should generally + * leave this field in blank + * @priv: driver-specific data, to be used on the callbacks + * @change_protocol: allow changing the protocol used on hardware decoders + * @open: callback to allow drivers to enable polling/irq when IR input device + * is opened. + * @close: callback to allow drivers to disable polling/irq when IR input device + * is opened. + */ struct ir_dev_props { - unsigned long allowed_protos; + unsigned long allowed_protos; + u32 scanmask; void *priv; - int (*change_protocol)(void *priv, u64 ir_type); - int (*open)(void *priv); - void (*close)(void *priv); + int (*change_protocol)(void *priv, u64 ir_type); + int (*open)(void *priv); + void (*close)(void *priv); }; struct ir_raw_event { diff --git a/include/media/rc-map.h b/include/media/rc-map.h index b10990d1749d..3b7fe5a0dc72 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -18,7 +18,7 @@ #define IR_TYPE_OTHER (1u << 31) struct ir_scancode { - u16 scancode; + u32 scancode; u32 keycode; }; @@ -95,6 +95,7 @@ void rc_map_init(void); #define RC_MAP_PINNACLE_PCTV_HD "rc-pinnacle-pctv-hd" #define RC_MAP_PIXELVIEW_NEW "rc-pixelview-new" #define RC_MAP_PIXELVIEW "rc-pixelview" +#define RC_MAP_PIXELVIEW_MK12 "rc-pixelview-mk12" #define RC_MAP_POWERCOLOR_REAL_ANGEL "rc-powercolor-real-angel" #define RC_MAP_PROTEUS_2309 "rc-proteus-2309" #define RC_MAP_PURPLETV "rc-purpletv" -- GitLab From 7f20d32d446097789ade5ada6b645742ddac4ece Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Apr 2010 14:45:04 -0300 Subject: [PATCH 305/534] V4L/DVB: re-add enable/disable check to the IR decoders A previous cleanup patch removed more than needed. Re-add the logic that disable the decoders. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-nec-decoder.c | 3 +++ drivers/media/IR/ir-rc5-decoder.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 28d773563556..9d1ada95aa72 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -142,6 +142,9 @@ static int ir_nec_decode(struct input_dev *input_dev, if (!data) return -EINVAL; + if (!data->enabled) + return 0; + /* Except for the initial event, what matters is the previous bit */ bit = (ev->type & IR_PULSE) ? 1 : 0; diff --git a/drivers/media/IR/ir-rc5-decoder.c b/drivers/media/IR/ir-rc5-decoder.c index 61b58397a3c2..4fb3ce410e24 100644 --- a/drivers/media/IR/ir-rc5-decoder.c +++ b/drivers/media/IR/ir-rc5-decoder.c @@ -153,6 +153,9 @@ static int ir_rc5_decode(struct input_dev *input_dev, if (!data) return -EINVAL; + if (!data->enabled) + return 0; + /* Except for the initial event, what matters is the previous bit */ bit = (ev->type & IR_PULSE) ? 1 : 0; -- GitLab From 9b09df51b8c2b4615376e5ada3e2eb7eeed3cf5d Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 6 Apr 2010 02:29:42 -0300 Subject: [PATCH 306/534] V4L/DVB: ir-rc5-decoder: fix state machine Reimplement the RC-5 decoder state machine. Code is now clear, and works properly. It is also simpler than the previous implementations. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-rc5-decoder.c | 161 ++++++++++-------------------- 1 file changed, 52 insertions(+), 109 deletions(-) diff --git a/drivers/media/IR/ir-rc5-decoder.c b/drivers/media/IR/ir-rc5-decoder.c index 4fb3ce410e24..a62277b625a8 100644 --- a/drivers/media/IR/ir-rc5-decoder.c +++ b/drivers/media/IR/ir-rc5-decoder.c @@ -15,19 +15,17 @@ /* * This code only handles 14 bits RC-5 protocols. There are other variants * that use a different number of bits. This is currently unsupported + * It considers a carrier of 36 kHz, with a total of 14 bits, where + * the first two bits are start bits, and a third one is a filing bit */ #include -#define RC5_NBITS 14 -#define RC5_HALFBIT 888888 /* ns */ -#define RC5_BIT (RC5_HALFBIT * 2) -#define RC5_DURATION (RC5_BIT * RC5_NBITS) - -#define is_rc5_halfbit(nsec) ((ev->delta.tv_nsec >= RC5_HALFBIT / 2) && \ - (ev->delta.tv_nsec < RC5_HALFBIT + RC5_HALFBIT / 2)) +static unsigned int ir_rc5_remote_gap = 888888; -#define n_half(nsec) ((ev->delta.tv_nsec + RC5_HALFBIT / 2) / RC5_HALFBIT) +#define RC5_NBITS 14 +#define RC5_BIT (ir_rc5_remote_gap * 2) +#define RC5_DURATION (ir_rc5_remote_gap * RC5_NBITS) /* Used to register rc5_decoder clients */ static LIST_HEAD(decoder_list); @@ -35,19 +33,8 @@ static spinlock_t decoder_lock; enum rc5_state { STATE_INACTIVE, - STATE_START2_SPACE, - STATE_START2_MARK, STATE_MARKSPACE, - STATE_TRAILER_MARK, -}; - -static char *st_name[] = { - "Inactive", - "start2 sapce", - "start2 mark", - "mark", - "space", - "trailer" + STATE_TRAILER, }; struct rc5_code { @@ -63,8 +50,7 @@ struct decoder_data { /* State machine control */ enum rc5_state state; struct rc5_code rc5_code; - unsigned n_half; - unsigned count; + unsigned code, elapsed, last_bit, last_code; }; @@ -147,7 +133,7 @@ static int ir_rc5_decode(struct input_dev *input_dev, { struct decoder_data *data; struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - int bit, last_bit, n_half; + int is_pulse, scancode, delta, toggle; data = get_decoder_data(ir_dev); if (!data) @@ -156,122 +142,79 @@ static int ir_rc5_decode(struct input_dev *input_dev, if (!data->enabled) return 0; - /* Except for the initial event, what matters is the previous bit */ - bit = (ev->type & IR_PULSE) ? 1 : 0; - - last_bit = !bit; + delta = DIV_ROUND_CLOSEST(ev->delta.tv_nsec, ir_rc5_remote_gap); - /* Discards spurious space last_bits when inactive */ + /* The duration time refers to the last bit time */ + is_pulse = (ev->type & IR_PULSE) ? 1 : 0; /* Very long delays are considered as start events */ - if (ev->delta.tv_nsec > RC5_DURATION + RC5_HALFBIT / 2) - data->state = STATE_INACTIVE; - - if (ev->type & IR_START_EVENT) + if (delta > RC5_DURATION || (ev->type & IR_START_EVENT)) data->state = STATE_INACTIVE; switch (data->state) { case STATE_INACTIVE: -IR_dprintk(1, "currently inative. Received bit (%s) @%luus\n", - last_bit ? "pulse" : "space", - (ev->delta.tv_nsec + 500) / 1000); + IR_dprintk(2, "currently inative. Start bit (%s) @%uus\n", + is_pulse ? "pulse" : "space", + (unsigned)(ev->delta.tv_nsec + 500) / 1000); /* Discards the initial start space */ - if (bit) - return 0; - data->count = 0; - data->n_half = 0; - memset (&data->rc5_code, 0, sizeof(data->rc5_code)); - - data->state = STATE_START2_SPACE; - return 0; - case STATE_START2_SPACE: - if (last_bit) - goto err; - if (!is_rc5_halfbit(ev->delta.tv_nsec)) - goto err; - data->state = STATE_START2_MARK; - return 0; - case STATE_START2_MARK: - if (!last_bit) + if (!is_pulse) goto err; - - if (!is_rc5_halfbit(ev->delta.tv_nsec)) - goto err; - + data->code = 1; + data->last_bit = 1; + data->elapsed = 0; + memset(&data->rc5_code, 0, sizeof(data->rc5_code)); data->state = STATE_MARKSPACE; return 0; case STATE_MARKSPACE: - n_half = n_half(ev->delta.tv_nsec); - if (n_half < 1 || n_half > 3) { - IR_dprintk(1, "Decode failed at %d-th bit (%s) @%luus\n", - data->count, - last_bit ? "pulse" : "space", - (ev->delta.tv_nsec + 500) / 1000); -printk("%d halves\n", n_half); - goto err2; - } - data->n_half += n_half; + if (delta != 1) + data->last_bit = data->last_bit ? 0 : 1; - if (!last_bit) - return 0; + data->elapsed += delta; - /* Got one complete mark/space cycle */ + if ((data->elapsed % 2) == 1) + return 0; - bit = ((data->count + 1) * 2)/ data->n_half; + data->code <<= 1; + data->code |= data->last_bit; -printk("%d halves, %d bits\n", n_half, bit); + /* Fill the 2 unused bits at the command with 0 */ + if (data->elapsed / 2 == 6) + data->code <<= 2; -#if 1 /* SANITY check - while testing the decoder */ - if (bit > 1) { - IR_dprintk(1, "Decoder HAS failed at %d-th bit (%s) @%luus\n", - data->count, - last_bit ? "pulse" : "space", - (ev->delta.tv_nsec + 500) / 1000); + if (data->elapsed >= (RC5_NBITS - 1) * 2) { + scancode = data->code; - goto err2; - } -#endif - /* Ok, we've got a valid bit. proccess it */ - if (bit) { - int shift = data->count; - - /* - * RC-5 transmit bytes on this temporal order: - * address | not address | command | not command - */ - if (shift < 8) { - data->rc5_code.address |= 1 << shift; - } else { - data->rc5_code.command |= 1 << (shift - 8); + /* Check for the start bits */ + if ((scancode & 0xc000) != 0xc000) { + IR_dprintk(1, "Code 0x%04x doesn't have two start bits. It is not RC-5\n", scancode); + goto err; } - } - IR_dprintk(1, "RC-5: bit #%d: %d (%d)\n", - data->count, bit, data->n_half); - if (++data->count >= RC5_NBITS) { - u32 scancode; - scancode = data->rc5_code.address << 8 | - data->rc5_code.command; - IR_dprintk(1, "RC-5 scancode 0x%04x\n", scancode); - ir_keydown(input_dev, scancode, 0); + toggle = (scancode & 0x2000) ? 1 : 0; + + if (scancode == data->last_code) { + IR_dprintk(1, "RC-5 repeat\n"); + ir_repeat(input_dev); + } else { + data->last_code = scancode; + scancode &= 0x1fff; + IR_dprintk(1, "RC-5 scancode 0x%04x\n", scancode); - data->state = STATE_TRAILER_MARK; + ir_keydown(input_dev, scancode, 0); + } + data->state = STATE_TRAILER; } return 0; - case STATE_TRAILER_MARK: - if (!last_bit) - goto err; + case STATE_TRAILER: data->state = STATE_INACTIVE; return 0; } err: - IR_dprintk(1, "RC-5 decoded failed at state %s (%s) @ %luus\n", - st_name[data->state], - bit ? "pulse" : "space", + IR_dprintk(1, "RC-5 decoded failed at %s @ %luus\n", + is_pulse ? "pulse" : "space", (ev->delta.tv_nsec + 500) / 1000); -err2: data->state = STATE_INACTIVE; return -EINVAL; } -- GitLab From c373cabfbbb7631526003f17d470c0d1e5915a4c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 7 Apr 2010 22:57:04 -0300 Subject: [PATCH 307/534] V4L/DVB: em28xx: fix a regression caused by the rc-map changes The patch that adds the rc-map changes didn't take into account that an a table with IR_TYPE_UNKNOWN would make change_protocol to return -EINVAL. As this function is fundamental to initialize some data, including a callback to the getkey function, this caused the driver to stop working, hanging the machine most of the times. The fix were simply to add a handler for the IR type, but, to avoid further issues, explicitly call change_protocol and handle the error before initializing the IR. Also, let input_dev to start/stop IR handling, after the opening of the input device. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/em28xx/em28xx-input.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index e2772a1470cb..5c3fd9411b1f 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c @@ -362,14 +362,20 @@ static void em28xx_ir_work(struct work_struct *work) schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); } -static void em28xx_ir_start(struct em28xx_IR *ir) +static int em28xx_ir_start(void *priv) { + struct em28xx_IR *ir = priv; + INIT_DELAYED_WORK(&ir->work, em28xx_ir_work); schedule_delayed_work(&ir->work, 0); + + return 0; } -static void em28xx_ir_stop(struct em28xx_IR *ir) +static void em28xx_ir_stop(void *priv) { + struct em28xx_IR *ir = priv; + cancel_delayed_work_sync(&ir->work); } @@ -389,7 +395,7 @@ int em28xx_ir_change_protocol(void *priv, u64 ir_type) dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; ir_config = EM2874_IR_NEC; ir->full_code = 1; - } else + } else if (ir_type != IR_TYPE_UNKNOWN) rc = -EINVAL; em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, @@ -442,6 +448,13 @@ int em28xx_ir_init(struct em28xx *dev) ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; ir->props.priv = ir; ir->props.change_protocol = em28xx_ir_change_protocol; + ir->props.open = em28xx_ir_start; + ir->props.close = em28xx_ir_stop; + + /* By default, keep protocol field untouched */ + err = em28xx_ir_change_protocol(ir, IR_TYPE_UNKNOWN); + if (err) + goto err_out_free; /* This is how often we ask the chip for IR information */ ir->polling = 100; /* ms */ @@ -468,7 +481,6 @@ int em28xx_ir_init(struct em28xx *dev) input_dev->dev.parent = &dev->udev->dev; - em28xx_ir_start(ir); /* all done */ err = ir_input_register(ir->input, dev->board.ir_codes, @@ -478,7 +490,6 @@ int em28xx_ir_init(struct em28xx *dev) return 0; err_out_stop: - em28xx_ir_stop(ir); dev->ir = NULL; err_out_free: kfree(ir); -- GitLab From 6eb9435b874ae5ff56d56952167a8e9be5c5deeb Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 7 Apr 2010 16:19:36 -0300 Subject: [PATCH 308/534] V4L/DVB: ir: Make sure that the spinlocks are properly initialized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some spinlocks are not properly initialized on ir core: [ 471.714132] BUG: spinlock bad magic on CPU#0, modprobe/1899 [ 471.719838] lock: f92a08ac, .magic: 00000000, .owner: /-1, .owner_cpu: 0 [ 471.727301] Pid: 1899, comm: modprobe Not tainted 2.6.33 #36 [ 471.733062] Call Trace: [ 471.735537] [] ? printk+0x1d/0x22 [ 471.739866] [] spin_bug+0xa3/0xf0 [ 471.744224] [] do_raw_spin_lock+0x7d/0x160 [ 471.749364] [] ? ir_rc5_register+0x6f/0xf0 [ir_rc5_decoder] So, use static initialization for the static spinlocks, instead of the dynamic ones (currently used), as proposed by David Härdeman on one of his RFC patches. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-nec-decoder.c | 2 +- drivers/media/IR/ir-raw-event.c | 4 +--- drivers/media/IR/ir-rc5-decoder.c | 2 +- drivers/media/IR/rc-map.c | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 9d1ada95aa72..18918e52c0c0 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -25,7 +25,7 @@ /* Used to register nec_decoder clients */ static LIST_HEAD(decoder_list); -static spinlock_t decoder_lock; +static DEFINE_SPINLOCK(decoder_lock); enum nec_state { STATE_INACTIVE, diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index 57990a337922..ddb3365adc82 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -21,7 +21,7 @@ /* Used to handle IR raw handler extensions */ static LIST_HEAD(ir_raw_handler_list); -static spinlock_t ir_raw_handler_lock; +static DEFINE_SPINLOCK(ir_raw_handler_lock); /** * RUN_DECODER() - runs an operation on all IR decoders @@ -205,8 +205,6 @@ static void init_decoders(struct work_struct *work) void ir_raw_init(void) { - spin_lock_init(&ir_raw_handler_lock); - #ifdef MODULE INIT_WORK(&wq_load, init_decoders); schedule_work(&wq_load); diff --git a/drivers/media/IR/ir-rc5-decoder.c b/drivers/media/IR/ir-rc5-decoder.c index a62277b625a8..6323066438b5 100644 --- a/drivers/media/IR/ir-rc5-decoder.c +++ b/drivers/media/IR/ir-rc5-decoder.c @@ -29,7 +29,7 @@ static unsigned int ir_rc5_remote_gap = 888888; /* Used to register rc5_decoder clients */ static LIST_HEAD(decoder_list); -static spinlock_t decoder_lock; +static DEFINE_SPINLOCK(decoder_lock); enum rc5_state { STATE_INACTIVE, diff --git a/drivers/media/IR/rc-map.c b/drivers/media/IR/rc-map.c index 2f6201ce1898..ff185c054267 100644 --- a/drivers/media/IR/rc-map.c +++ b/drivers/media/IR/rc-map.c @@ -17,8 +17,7 @@ /* Used to handle IR raw handler extensions */ static LIST_HEAD(rc_map_list); -static spinlock_t rc_map_lock; - +static DEFINE_SPINLOCK(rc_map_lock); static struct rc_keymap *seek_rc_map(const char *name) { -- GitLab From de88f31cef8fee7c890cf2128bec8dae06bb20f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Sun, 28 Mar 2010 18:38:49 -0300 Subject: [PATCH 309/534] V4L/DVB: rename sysfs remote controller devices from rcrcv to rc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the remote controller class is anyway being renamed from ir to rc this would be a good time to also rename the devices from rcrcvX to rcX. I know we haven't reached any agreement on whether transmission will eventually be handled by the same device, but this change will at least make the device name non-receive-specific which will make it possible in the future (and if a different approach is finally agreed upon, the device name still works). Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-sysfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 58ecca2003a4..c33333f1f60e 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -40,7 +40,7 @@ static struct class ir_input_class = { * @buf: a pointer to the output buffer * * This routine is a callback routine for input read the IR protocol type. - * it is trigged by reading /sys/class/rc/rcrcv?/current_protocol. + * it is trigged by reading /sys/class/rc/rc?/current_protocol. * It returns the protocol name, as understood by the driver. */ static ssize_t show_protocol(struct device *d, @@ -75,7 +75,7 @@ static ssize_t show_protocol(struct device *d, * @len: length of the input buffer * * This routine is a callback routine for changing the IR protocol type. - * it is trigged by reading /sys/class/rc/rcrcv?/current_protocol. + * it is trigged by reading /sys/class/rc/rc?/current_protocol. * It changes the IR the protocol name, if the IR type is recognized * by the driver. * If an unknown protocol name is used, returns -EINVAL. @@ -172,7 +172,7 @@ static struct device_type ir_dev_type = { }; /** - * ir_register_class() - creates the sysfs for /sys/class/rc/rcrcv? + * ir_register_class() - creates the sysfs for /sys/class/rc/rc? * @input_dev: the struct input_dev descriptor of the device * * This routine is used to register the syfs code for IR class @@ -192,7 +192,7 @@ int ir_register_class(struct input_dev *input_dev) ir_dev->dev.type = &ir_dev_type; ir_dev->dev.class = &ir_input_class; ir_dev->dev.parent = input_dev->dev.parent; - dev_set_name(&ir_dev->dev, "rcrcv%d", devno); + dev_set_name(&ir_dev->dev, "rc%d", devno); dev_set_drvdata(&ir_dev->dev, ir_dev); rc = device_register(&ir_dev->dev); if (rc) @@ -223,7 +223,7 @@ int ir_register_class(struct input_dev *input_dev) /** * ir_unregister_class() - removes the sysfs for sysfs for - * /sys/class/rc/rcrcv? + * /sys/class/rc/rc? * @input_dev: the struct input_dev descriptor of the device * * This routine is used to unregister the syfs code for IR class -- GitLab From 626cf6979e99bf2c642456308bed7bb25a37569b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 6 Apr 2010 23:21:46 -0300 Subject: [PATCH 310/534] V4L/DVB: ir-core: Distinguish sysfs attributes for in-hardware and raw decoders Some devices have in-hardware Remote Controller decoder, while others need a software decoder to get the IR code. As each software decoder can be enabled/disabled individually, allowing multiple protocol decoding capability. On the other hand, hardware decoders have a limited protocol support, often being able of decoding just one protocol each time. So, each type needs a different set of capabilities to control the supported protocol(s). Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-keytable.c | 17 +++++++++++--- drivers/media/IR/ir-raw-event.c | 2 -- drivers/media/IR/ir-sysfs.c | 25 +++++++++++++-------- drivers/media/video/saa7134/saa7134-input.c | 9 +++----- include/media/ir-core.h | 20 ++++++++++++----- 5 files changed, 47 insertions(+), 26 deletions(-) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index af7400bc906f..1fdb528737fe 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -488,11 +488,19 @@ int __ir_input_register(struct input_dev *input_dev, if (rc < 0) goto out_table; + if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) { + rc = ir_raw_event_register(input_dev); + if (rc < 0) + goto out_event; + } + IR_dprintk(1, "Registered input device on %s for %s remote.\n", driver_name, rc_tab->name); return 0; +out_event: + ir_unregister_class(input_dev); out_table: kfree(ir_dev->rc_tab.scan); out_name: @@ -509,22 +517,25 @@ EXPORT_SYMBOL_GPL(__ir_input_register); * This routine is used to free memory and de-register interfaces. */ -void ir_input_unregister(struct input_dev *dev) +void ir_input_unregister(struct input_dev *input_dev) { - struct ir_input_dev *ir_dev = input_get_drvdata(dev); + struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); struct ir_scancode_table *rc_tab; if (!ir_dev) return; IR_dprintk(1, "Freed keycode table\n"); + del_timer_sync(&ir_dev->timer_keyup); + if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) + ir_raw_event_unregister(input_dev); rc_tab = &ir_dev->rc_tab; rc_tab->size = 0; kfree(rc_tab->scan); rc_tab->scan = NULL; - ir_unregister_class(dev); + ir_unregister_class(input_dev); kfree(ir_dev->driver_name); kfree(ir_dev); diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index ddb3365adc82..bc4ca08adf4a 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -82,7 +82,6 @@ int ir_raw_event_register(struct input_dev *input_dev) return rc; } -EXPORT_SYMBOL_GPL(ir_raw_event_register); void ir_raw_event_unregister(struct input_dev *input_dev) { @@ -97,7 +96,6 @@ void ir_raw_event_unregister(struct input_dev *input_dev) kfree(ir->raw); ir->raw = NULL; } -EXPORT_SYMBOL_GPL(ir_raw_event_unregister); int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type) { diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index c33333f1f60e..81eebd8eae5a 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -152,22 +152,26 @@ static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env) static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR, show_protocol, store_protocol); -static struct attribute *ir_dev_attrs[] = { +static struct attribute *ir_hw_dev_attrs[] = { &dev_attr_current_protocol.attr, NULL, }; -static struct attribute_group ir_dev_attr_grp = { - .attrs = ir_dev_attrs, +static struct attribute_group ir_hw_dev_attr_grp = { + .attrs = ir_hw_dev_attrs, }; -static const struct attribute_group *ir_dev_attr_groups[] = { - &ir_dev_attr_grp, +static const struct attribute_group *ir_hw_dev_attr_groups[] = { + &ir_hw_dev_attr_grp, NULL }; -static struct device_type ir_dev_type = { - .groups = ir_dev_attr_groups, +static struct device_type rc_dev_type = { + .groups = ir_hw_dev_attr_groups, + .uevent = ir_dev_uevent, +}; + +static struct device_type ir_raw_dev_type = { .uevent = ir_dev_uevent, }; @@ -181,7 +185,6 @@ int ir_register_class(struct input_dev *input_dev) { int rc; const char *path; - struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); int devno = find_first_zero_bit(&ir_core_dev_number, IRRCV_NUM_DEVICES); @@ -189,7 +192,11 @@ int ir_register_class(struct input_dev *input_dev) if (unlikely(devno < 0)) return devno; - ir_dev->dev.type = &ir_dev_type; + if (ir_dev->props->driver_type == RC_DRIVER_SCANCODE) + ir_dev->dev.type = &rc_dev_type; + else + ir_dev->dev.type = &ir_raw_dev_type; + ir_dev->dev.class = &ir_input_class; ir_dev->dev.parent = input_dev->dev.parent; dev_set_name(&ir_dev->dev, "rc%d", devno); diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 867f027c3feb..6d5fe596245d 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -855,6 +855,9 @@ int saa7134_input_init1(struct saa7134_dev *dev) ir->props.open = saa7134_ir_open; ir->props.close = saa7134_ir_close; + if (raw_decode) + ir->props.driver_type = RC_DRIVER_IR_RAW; + if (!raw_decode && allow_protocol_change) { ir->props.allowed_protos = IR_TYPE_RC5 | IR_TYPE_NEC; ir->props.change_protocol = saa7134_ir_change_protocol; @@ -880,11 +883,6 @@ int saa7134_input_init1(struct saa7134_dev *dev) err = ir_input_register(ir->dev, ir_codes, &ir->props, MODULE_NAME); if (err) goto err_out_free; - if (raw_decode) { - err = ir_raw_event_register(ir->dev); - if (err) - goto err_out_free; - } /* the remote isn't as bouncy as a keyboard */ ir->dev->rep[REP_DELAY] = repeat_delay; @@ -904,7 +902,6 @@ void saa7134_input_fini(struct saa7134_dev *dev) return; saa7134_ir_stop(dev); - ir_raw_event_unregister(dev->remote->dev); ir_input_unregister(dev->remote->dev); kfree(dev->remote); dev->remote = NULL; diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 4397ea3d9754..e9fa94fe2ef5 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -26,6 +26,11 @@ extern int ir_core_debug; #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) +enum rc_driver_type { + RC_DRIVER_SCANCODE = 0, /* Driver or hardware generates a scancode */ + RC_DRIVER_IR_RAW, /* Needs a Infra-Red pulse/space decoder */ +}; + enum raw_event_type { IR_SPACE = (1 << 0), IR_PULSE = (1 << 1), @@ -35,6 +40,8 @@ enum raw_event_type { /** * struct ir_dev_props - Allow caller drivers to set special properties + * @driver_type: specifies if the driver or hardware have already a decoder, + * or if it needs to use the IR raw event decoders to produce a scancode * @allowed_protos: bitmask with the supported IR_TYPE_* protocols * @scanmask: some hardware decoders are not capable of providing the full * scancode to the application. As this is a hardware limit, we can't do @@ -49,12 +56,13 @@ enum raw_event_type { * is opened. */ struct ir_dev_props { - unsigned long allowed_protos; - u32 scanmask; - void *priv; - int (*change_protocol)(void *priv, u64 ir_type); - int (*open)(void *priv); - void (*close)(void *priv); + enum rc_driver_type driver_type; + unsigned long allowed_protos; + u32 scanmask; + void *priv; + int (*change_protocol)(void *priv, u64 ir_type); + int (*open)(void *priv); + void (*close)(void *priv); }; struct ir_raw_event { -- GitLab From b320f80a6a02bbf31f7ed6ab3332f7c4ebaaac2c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Apr 2010 01:02:49 -0300 Subject: [PATCH 311/534] V4L/DVB: ir-core: properly present the supported and current protocols Hardware decoders have a more limited set of decoders than software ones. In general, they support just one protocol at a given time, but allow changing between a few options. Rename the previous badly named "current_protocol" as just "protocol", meaning the current protocol(s) accepted by the driver, and add a "support_protocols" to represent the entire universe of supported protocols by that specific hardware. As commented on http://lwn.net/Articles/378884/, the "one file, one value" rule doesn't fit nor does make much sense for bitmap or enum values. So, the supported_protocols will enum all supported protocols, and the protocol will present all active protocols. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-sysfs.c | 63 ++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index 81eebd8eae5a..e47a4f102637 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -56,13 +56,13 @@ static ssize_t show_protocol(struct device *d, if (ir_type == IR_TYPE_UNKNOWN) s = "Unknown"; else if (ir_type == IR_TYPE_RC5) - s = "RC-5"; + s = "rc-5"; else if (ir_type == IR_TYPE_PD) - s = "Pulse/distance"; + s = "pulse-distance"; else if (ir_type == IR_TYPE_NEC) - s = "NEC"; + s = "nec"; else - s = "Other"; + s = "other"; return sprintf(buf, "%s\n", s); } @@ -86,23 +86,22 @@ static ssize_t store_protocol(struct device *d, size_t len) { struct ir_input_dev *ir_dev = dev_get_drvdata(d); - u64 ir_type = IR_TYPE_UNKNOWN; + u64 ir_type = 0; int rc = -EINVAL; unsigned long flags; char *buf; - buf = strsep((char **) &data, "\n"); - - if (!strcasecmp(buf, "rc-5") || !strcasecmp(buf, "rc5")) - ir_type = IR_TYPE_RC5; - else if (!strcasecmp(buf, "pd")) - ir_type = IR_TYPE_PD; - else if (!strcasecmp(buf, "nec")) - ir_type = IR_TYPE_NEC; + while (buf = strsep((char **) &data, " \n")) { + if (!strcasecmp(buf, "rc-5") || !strcasecmp(buf, "rc5")) + ir_type |= IR_TYPE_RC5; + if (!strcasecmp(buf, "pd") || !strcasecmp(buf, "pulse-distance")) + ir_type |= IR_TYPE_PD; + if (!strcasecmp(buf, "nec")) + ir_type |= IR_TYPE_NEC; + } - if (ir_type == IR_TYPE_UNKNOWN) { - IR_dprintk(1, "Error setting protocol to %lld\n", - (long long)ir_type); + if (!ir_type) { + IR_dprintk(1, "Unknown protocol\n"); return -EINVAL; } @@ -120,12 +119,34 @@ static ssize_t store_protocol(struct device *d, ir_dev->rc_tab.ir_type = ir_type; spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags); - IR_dprintk(1, "Current protocol is %lld\n", + IR_dprintk(1, "Current protocol(s) is(are) %lld\n", (long long)ir_type); return len; } +static ssize_t show_supported_protocols(struct device *d, + struct device_attribute *mattr, char *buf) +{ + char *orgbuf = buf; + struct ir_input_dev *ir_dev = dev_get_drvdata(d); + + /* FIXME: doesn't support multiple protocols at the same time */ + if (ir_dev->props->allowed_protos == IR_TYPE_UNKNOWN) + buf += sprintf(buf, "unknown "); + if (ir_dev->props->allowed_protos & IR_TYPE_RC5) + buf += sprintf(buf, "rc-5 "); + if (ir_dev->props->allowed_protos & IR_TYPE_PD) + buf += sprintf(buf, "pulse-distance "); + if (ir_dev->props->allowed_protos & IR_TYPE_NEC) + buf += sprintf(buf, "nec "); + if (buf == orgbuf) + buf += sprintf(buf, "other "); + + buf += sprintf(buf - 1, "\n"); + + return buf - orgbuf; +} #define ADD_HOTPLUG_VAR(fmt, val...) \ do { \ @@ -149,11 +170,15 @@ static int ir_dev_uevent(struct device *device, struct kobj_uevent_env *env) /* * Static device attribute struct with the sysfs attributes for IR's */ -static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(protocol, S_IRUGO | S_IWUSR, show_protocol, store_protocol); +static DEVICE_ATTR(supported_protocols, S_IRUGO | S_IWUSR, + show_supported_protocols, NULL); + static struct attribute *ir_hw_dev_attrs[] = { - &dev_attr_current_protocol.attr, + &dev_attr_protocol.attr, + &dev_attr_supported_protocols.attr, NULL, }; -- GitLab From d22e546ea18ee66c255af906f2714d3ee82d4b42 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Apr 2010 09:33:45 -0300 Subject: [PATCH 312/534] V4L/DVB: ir-core: fix gcc warning noise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drivers/media/IR/ir-sysfs.c: In function ‘store_protocol’: drivers/media/IR/ir-sysfs.c:93: warning: suggest parentheses around assignment used as truth value Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index e47a4f102637..af1edd073b16 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -91,7 +91,7 @@ static ssize_t store_protocol(struct device *d, unsigned long flags; char *buf; - while (buf = strsep((char **) &data, " \n")) { + while ((buf = strsep((char **) &data, " \n")) != NULL) { if (!strcasecmp(buf, "rc-5") || !strcasecmp(buf, "rc5")) ir_type |= IR_TYPE_RC5; if (!strcasecmp(buf, "pd") || !strcasecmp(buf, "pulse-distance")) -- GitLab From 724e2495502a98aaa3f93c404472a991da8ff857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Thu, 8 Apr 2010 13:10:00 -0300 Subject: [PATCH 313/534] V4L/DVB: Teach drivers/media/IR/ir-raw-event.c to use durations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drivers/media/IR/ir-raw-event.c is currently written with the assumption that all "raw" hardware will generate events only on state change (i.e. when a pulse or space starts). However, some hardware (like mceusb, probably the most popular IR receiver out there) only generates duration data (and that data is buffered so using any kind of timing on the data is futile). Furthermore, using signed int's to represent pulse/space durations is a well-known approach when writing ir decoders. With this patch: - s64 int's are used to represent pulse/space durations in ns - a workqueue is used to decode the ir protocols outside of interrupt context - #defines are added to make decoders clearer - decoder reset is implemented by passing a zero duration to the kfifo queue and decoders are updated accordingly Signed-off-by: David Härdeman Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-nec-decoder.c | 247 ++++++++------------ drivers/media/IR/ir-raw-event.c | 143 +++++++----- drivers/media/IR/ir-rc5-decoder.c | 150 ++++++------ drivers/media/video/saa7134/saa7134-input.c | 2 +- include/media/ir-core.h | 47 +++- 5 files changed, 296 insertions(+), 293 deletions(-) diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 18918e52c0c0..02682e617fae 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -13,15 +13,16 @@ */ #include +#include #define NEC_NBITS 32 -#define NEC_UNIT 559979 /* ns */ -#define NEC_HEADER_MARK (16 * NEC_UNIT) -#define NEC_HEADER_SPACE (8 * NEC_UNIT) -#define NEC_REPEAT_SPACE (4 * NEC_UNIT) -#define NEC_MARK (NEC_UNIT) -#define NEC_0_SPACE (NEC_UNIT) -#define NEC_1_SPACE (3 * NEC_UNIT) +#define NEC_UNIT 562500 /* ns */ +#define NEC_HEADER_PULSE PULSE(16) +#define NEC_HEADER_SPACE SPACE(8) +#define NEC_REPEAT_SPACE SPACE(4) +#define NEC_BIT_PULSE PULSE(1) +#define NEC_BIT_0_SPACE SPACE(1) +#define NEC_BIT_1_SPACE SPACE(3) /* Used to register nec_decoder clients */ static LIST_HEAD(decoder_list); @@ -29,21 +30,13 @@ static DEFINE_SPINLOCK(decoder_lock); enum nec_state { STATE_INACTIVE, - STATE_HEADER_MARK, STATE_HEADER_SPACE, - STATE_MARK, - STATE_SPACE, - STATE_TRAILER_MARK, + STATE_BIT_PULSE, + STATE_BIT_SPACE, + STATE_TRAILER_PULSE, STATE_TRAILER_SPACE, }; -struct nec_code { - u8 address; - u8 not_address; - u8 command; - u8 not_command; -}; - struct decoder_data { struct list_head list; struct ir_input_dev *ir_dev; @@ -51,7 +44,7 @@ struct decoder_data { /* State machine control */ enum nec_state state; - struct nec_code nec_code; + u32 nec_bits; unsigned count; }; @@ -62,7 +55,6 @@ struct decoder_data { * * Returns the struct decoder_data that corresponds to a device */ - static struct decoder_data *get_decoder_data(struct ir_input_dev *ir_dev) { struct decoder_data *data = NULL; @@ -123,20 +115,20 @@ static struct attribute_group decoder_attribute_group = { .attrs = decoder_attributes, }; - /** * ir_nec_decode() - Decode one NEC pulse or space * @input_dev: the struct input_dev descriptor of the device - * @ev: event array with type/duration of pulse/space + * @duration: duration in ns of pulse/space * * This function returns -EINVAL if the pulse violates the state machine */ -static int ir_nec_decode(struct input_dev *input_dev, - struct ir_raw_event *ev) +static int ir_nec_decode(struct input_dev *input_dev, s64 duration) { struct decoder_data *data; struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - int bit, last_bit; + int u; + u32 scancode; + u8 address, not_address, command, not_command; data = get_decoder_data(ir_dev); if (!data) @@ -145,150 +137,107 @@ static int ir_nec_decode(struct input_dev *input_dev, if (!data->enabled) return 0; - /* Except for the initial event, what matters is the previous bit */ - bit = (ev->type & IR_PULSE) ? 1 : 0; - - last_bit = !bit; - - /* Discards spurious space last_bits when inactive */ - - /* Very long delays are considered as start events */ - if (ev->delta.tv_nsec > NEC_HEADER_MARK + NEC_HEADER_SPACE - NEC_UNIT / 2) + if (IS_RESET(duration)) { data->state = STATE_INACTIVE; + return 0; + } - if (ev->type & IR_START_EVENT) - data->state = STATE_INACTIVE; + u = TO_UNITS(duration, NEC_UNIT); + if (DURATION(u) == 0) + goto out; + + IR_dprintk(2, "NEC decode started at state %d (%i units, %ius)\n", + data->state, u, TO_US(duration)); switch (data->state) { - case STATE_INACTIVE: - if (!bit) /* PULSE marks the start event */ - return 0; - data->count = 0; - data->state = STATE_HEADER_MARK; - memset (&data->nec_code, 0, sizeof(data->nec_code)); - return 0; - case STATE_HEADER_MARK: - if (!last_bit) - goto err; - if (ev->delta.tv_nsec < NEC_HEADER_MARK - 6 * NEC_UNIT) - goto err; - data->state = STATE_HEADER_SPACE; + case STATE_INACTIVE: + if (u == NEC_HEADER_PULSE) { + data->count = 0; + data->state = STATE_HEADER_SPACE; + } return 0; + case STATE_HEADER_SPACE: - if (last_bit) - goto err; - if (ev->delta.tv_nsec >= NEC_HEADER_SPACE - NEC_UNIT / 2) { - data->state = STATE_MARK; + if (u == NEC_HEADER_SPACE) { + data->state = STATE_BIT_PULSE; return 0; - } - - if (ev->delta.tv_nsec >= NEC_REPEAT_SPACE - NEC_UNIT / 2) { + } else if (u == NEC_REPEAT_SPACE) { ir_repeat(input_dev); IR_dprintk(1, "Repeat last key\n"); - data->state = STATE_TRAILER_MARK; + data->state = STATE_TRAILER_PULSE; return 0; } - goto err; - case STATE_MARK: - if (!last_bit) - goto err; - if ((ev->delta.tv_nsec > NEC_MARK + NEC_UNIT / 2) || - (ev->delta.tv_nsec < NEC_MARK - NEC_UNIT / 2)) - goto err; - data->state = STATE_SPACE; - return 0; - case STATE_SPACE: - if (last_bit) - goto err; - - if ((ev->delta.tv_nsec >= NEC_0_SPACE - NEC_UNIT / 2) && - (ev->delta.tv_nsec < NEC_0_SPACE + NEC_UNIT / 2)) - bit = 0; - else if ((ev->delta.tv_nsec >= NEC_1_SPACE - NEC_UNIT / 2) && - (ev->delta.tv_nsec < NEC_1_SPACE + NEC_UNIT / 2)) - bit = 1; - else { - IR_dprintk(1, "Decode failed at %d-th bit (%s) @%luus\n", - data->count, - last_bit ? "pulse" : "space", - (ev->delta.tv_nsec + 500) / 1000); - - goto err2; + break; + + case STATE_BIT_PULSE: + if (u == NEC_BIT_PULSE) { + data->state = STATE_BIT_SPACE; + return 0; + } + break; + + case STATE_BIT_SPACE: + if (u != NEC_BIT_0_SPACE && u != NEC_BIT_1_SPACE) + break; + + data->nec_bits <<= 1; + if (u == NEC_BIT_1_SPACE) + data->nec_bits |= 1; + data->count++; + + if (data->count != NEC_NBITS) { + data->state = STATE_BIT_PULSE; + return 0; + } + + address = bitrev8((data->nec_bits >> 24) & 0xff); + not_address = bitrev8((data->nec_bits >> 16) & 0xff); + command = bitrev8((data->nec_bits >> 8) & 0xff); + not_command = bitrev8((data->nec_bits >> 0) & 0xff); + + if ((command ^ not_command) != 0xff) { + IR_dprintk(1, "NEC checksum error: received 0x%08x\n", + data->nec_bits); + break; } - /* Ok, we've got a valid bit. proccess it */ - if (bit) { - int shift = data->count; - - /* - * NEC transmit bytes on this temporal order: - * address | not address | command | not command - */ - if (shift < 8) { - data->nec_code.address |= 1 << shift; - } else if (shift < 16) { - data->nec_code.not_address |= 1 << (shift - 8); - } else if (shift < 24) { - data->nec_code.command |= 1 << (shift - 16); - } else { - data->nec_code.not_command |= 1 << (shift - 24); - } + if ((address ^ not_address) != 0xff) { + /* Extended NEC */ + scancode = address << 16 | + not_address << 8 | + command; + IR_dprintk(1, "NEC (Ext) scancode 0x%06x\n", scancode); + } else { + /* normal NEC */ + scancode = address << 8 | command; + IR_dprintk(1, "NEC scancode 0x%04x\n", scancode); } - if (++data->count == NEC_NBITS) { - u32 scancode; - /* - * Fixme: may need to accept Extended NEC protocol? - */ - if ((data->nec_code.command ^ data->nec_code.not_command) != 0xff) - goto checksum_err; - - if ((data->nec_code.address ^ data->nec_code.not_address) != 0xff) { - /* Extended NEC */ - scancode = data->nec_code.address << 16 | - data->nec_code.not_address << 8 | - data->nec_code.command; - IR_dprintk(1, "NEC scancode 0x%06x\n", scancode); - } else { - /* normal NEC */ - scancode = data->nec_code.address << 8 | - data->nec_code.command; - IR_dprintk(1, "NEC scancode 0x%04x\n", scancode); - } - ir_keydown(input_dev, scancode, 0); - - data->state = STATE_TRAILER_MARK; - } else - data->state = STATE_MARK; - return 0; - case STATE_TRAILER_MARK: - if (!last_bit) - goto err; - data->state = STATE_TRAILER_SPACE; + + ir_keydown(input_dev, scancode, 0); + data->state = STATE_TRAILER_PULSE; return 0; + + case STATE_TRAILER_PULSE: + if (u > 0) { + data->state = STATE_TRAILER_SPACE; + return 0; + } + break; + case STATE_TRAILER_SPACE: - if (last_bit) - goto err; - data->state = STATE_INACTIVE; - return 0; - } + if (u < 0) { + data->state = STATE_INACTIVE; + return 0; + } -err: - IR_dprintk(1, "NEC decoded failed at state %d (%s) @ %luus\n", - data->state, - bit ? "pulse" : "space", - (ev->delta.tv_nsec + 500) / 1000); -err2: - data->state = STATE_INACTIVE; - return -EINVAL; + break; + } -checksum_err: +out: + IR_dprintk(1, "NEC decode failed at state %d (%i units, %ius)\n", + data->state, u, TO_US(duration)); data->state = STATE_INACTIVE; - IR_dprintk(1, "NEC checksum error: received 0x%02x%02x%02x%02x\n", - data->nec_code.address, - data->nec_code.not_address, - data->nec_code.command, - data->nec_code.not_command); return -EINVAL; } diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index bc4ca08adf4a..e144f1522962 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -15,9 +15,10 @@ #include #include #include +#include -/* Define the max number of bit transitions per IR keycode */ -#define MAX_IR_EVENT_SIZE 256 +/* Define the max number of pulse/space transitions to buffer */ +#define MAX_IR_EVENT_SIZE 512 /* Used to handle IR raw handler extensions */ static LIST_HEAD(ir_raw_handler_list); @@ -53,19 +54,30 @@ static DEFINE_SPINLOCK(ir_raw_handler_lock); /* Used to load the decoders */ static struct work_struct wq_load; +static void ir_raw_event_work(struct work_struct *work) +{ + s64 d; + struct ir_raw_event_ctrl *raw = + container_of(work, struct ir_raw_event_ctrl, rx_work); + + while (kfifo_out(&raw->kfifo, &d, sizeof(d)) == sizeof(d)) + RUN_DECODER(decode, raw->input_dev, d); +} + int ir_raw_event_register(struct input_dev *input_dev) { struct ir_input_dev *ir = input_get_drvdata(input_dev); - int rc, size; + int rc; ir->raw = kzalloc(sizeof(*ir->raw), GFP_KERNEL); if (!ir->raw) return -ENOMEM; - size = sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE * 2; - size = roundup_pow_of_two(size); + ir->raw->input_dev = input_dev; + INIT_WORK(&ir->raw->rx_work, ir_raw_event_work); - rc = kfifo_alloc(&ir->raw->kfifo, size, GFP_KERNEL); + rc = kfifo_alloc(&ir->raw->kfifo, sizeof(s64) * MAX_IR_EVENT_SIZE, + GFP_KERNEL); if (rc < 0) { kfree(ir->raw); ir->raw = NULL; @@ -90,6 +102,7 @@ void ir_raw_event_unregister(struct input_dev *input_dev) if (!ir->raw) return; + cancel_work_sync(&ir->raw->rx_work); RUN_DECODER(raw_unregister, input_dev); kfifo_free(&ir->raw->kfifo); @@ -97,74 +110,90 @@ void ir_raw_event_unregister(struct input_dev *input_dev) ir->raw = NULL; } -int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type) +/** + * ir_raw_event_store() - pass a pulse/space duration to the raw ir decoders + * @input_dev: the struct input_dev device descriptor + * @duration: duration of the pulse or space in ns + * + * This routine (which may be called from an interrupt context) stores a + * pulse/space duration for the raw ir decoding state machines. Pulses are + * signalled as positive values and spaces as negative values. A zero value + * will reset the decoding state machines. + */ +int ir_raw_event_store(struct input_dev *input_dev, s64 duration) { - struct ir_input_dev *ir = input_get_drvdata(input_dev); - struct timespec ts; - struct ir_raw_event event; - int rc; + struct ir_input_dev *ir = input_get_drvdata(input_dev); if (!ir->raw) return -EINVAL; - event.type = type; - event.delta.tv_sec = 0; - event.delta.tv_nsec = 0; + if (kfifo_in(&ir->raw->kfifo, &duration, sizeof(duration)) != sizeof(duration)) + return -ENOMEM; - ktime_get_ts(&ts); + return 0; +} +EXPORT_SYMBOL_GPL(ir_raw_event_store); - if (timespec_equal(&ir->raw->last_event, &event.delta)) - event.type |= IR_START_EVENT; - else - event.delta = timespec_sub(ts, ir->raw->last_event); +/** + * ir_raw_event_store_edge() - notify raw ir decoders of the start of a pulse/space + * @input_dev: the struct input_dev device descriptor + * @type: the type of the event that has occurred + * + * This routine (which may be called from an interrupt context) is used to + * store the beginning of an ir pulse or space (or the start/end of ir + * reception) for the raw ir decoding state machines. This is used by + * hardware which does not provide durations directly but only interrupts + * (or similar events) on state change. + */ +int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type) +{ + struct ir_input_dev *ir = input_get_drvdata(input_dev); + ktime_t now; + s64 delta; /* ns */ + int rc = 0; - memcpy(&ir->raw->last_event, &ts, sizeof(ts)); + if (!ir->raw) + return -EINVAL; - if (event.delta.tv_sec) { - event.type |= IR_START_EVENT; - event.delta.tv_sec = 0; - event.delta.tv_nsec = 0; - } + now = ktime_get(); + delta = ktime_to_ns(ktime_sub(now, ir->raw->last_event)); - kfifo_in(&ir->raw->kfifo, &event, sizeof(event)); + /* Check for a long duration since last event or if we're + * being called for the first time, note that delta can't + * possibly be negative. + */ + if (delta > NSEC_PER_SEC || !ir->raw->last_type) + type |= IR_START_EVENT; + + if (type & IR_START_EVENT) + ir_raw_event_reset(input_dev); + else if (ir->raw->last_type & IR_SPACE) + rc = ir_raw_event_store(input_dev, -delta); + else if (ir->raw->last_type & IR_PULSE) + rc = ir_raw_event_store(input_dev, delta); + else + return 0; + ir->raw->last_event = now; + ir->raw->last_type = type; return rc; } -EXPORT_SYMBOL_GPL(ir_raw_event_store); +EXPORT_SYMBOL_GPL(ir_raw_event_store_edge); -int ir_raw_event_handle(struct input_dev *input_dev) +/** + * ir_raw_event_handle() - schedules the decoding of stored ir data + * @input_dev: the struct input_dev device descriptor + * + * This routine will signal the workqueue to start decoding stored ir data. + */ +void ir_raw_event_handle(struct input_dev *input_dev) { - struct ir_input_dev *ir = input_get_drvdata(input_dev); - int rc; - struct ir_raw_event ev; - int len, i; - - /* - * Store the events into a temporary buffer. This allows calling more than - * one decoder to deal with the received data - */ - len = kfifo_len(&ir->raw->kfifo) / sizeof(ev); - if (!len) - return 0; - - for (i = 0; i < len; i++) { - rc = kfifo_out(&ir->raw->kfifo, &ev, sizeof(ev)); - if (rc != sizeof(ev)) { - IR_dprintk(1, "overflow error: received %d instead of %zd\n", - rc, sizeof(ev)); - return -EINVAL; - } - IR_dprintk(2, "event type %d, time before event: %07luus\n", - ev.type, (ev.delta.tv_nsec + 500) / 1000); - rc = RUN_DECODER(decode, input_dev, &ev); - } + struct ir_input_dev *ir = input_get_drvdata(input_dev); - /* - * Call all ir decoders. This allows decoding the same event with - * more than one protocol handler. - */ + if (!ir->raw) + return; - return rc; + schedule_work(&ir->raw->rx_work); } EXPORT_SYMBOL_GPL(ir_raw_event_handle); diff --git a/drivers/media/IR/ir-rc5-decoder.c b/drivers/media/IR/ir-rc5-decoder.c index 6323066438b5..1d0857b69089 100644 --- a/drivers/media/IR/ir-rc5-decoder.c +++ b/drivers/media/IR/ir-rc5-decoder.c @@ -21,11 +21,8 @@ #include -static unsigned int ir_rc5_remote_gap = 888888; - #define RC5_NBITS 14 -#define RC5_BIT (ir_rc5_remote_gap * 2) -#define RC5_DURATION (ir_rc5_remote_gap * RC5_NBITS) +#define RC5_UNIT 888888 /* ns */ /* Used to register rc5_decoder clients */ static LIST_HEAD(decoder_list); @@ -33,13 +30,9 @@ static DEFINE_SPINLOCK(decoder_lock); enum rc5_state { STATE_INACTIVE, - STATE_MARKSPACE, - STATE_TRAILER, -}; - -struct rc5_code { - u8 address; - u8 command; + STATE_BIT_START, + STATE_BIT_END, + STATE_FINISHED, }; struct decoder_data { @@ -49,8 +42,9 @@ struct decoder_data { /* State machine control */ enum rc5_state state; - struct rc5_code rc5_code; - unsigned code, elapsed, last_bit, last_code; + u32 rc5_bits; + int last_unit; + unsigned count; }; @@ -122,18 +116,19 @@ static struct attribute_group decoder_attribute_group = { }; /** - * handle_event() - Decode one RC-5 pulse or space + * ir_rc5_decode() - Decode one RC-5 pulse or space * @input_dev: the struct input_dev descriptor of the device - * @ev: event array with type/duration of pulse/space + * @duration: duration of pulse/space in ns * * This function returns -EINVAL if the pulse violates the state machine */ -static int ir_rc5_decode(struct input_dev *input_dev, - struct ir_raw_event *ev) +static int ir_rc5_decode(struct input_dev *input_dev, s64 duration) { struct decoder_data *data; struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); - int is_pulse, scancode, delta, toggle; + u8 command, system, toggle; + u32 scancode; + int u; data = get_decoder_data(ir_dev); if (!data) @@ -142,79 +137,84 @@ static int ir_rc5_decode(struct input_dev *input_dev, if (!data->enabled) return 0; - delta = DIV_ROUND_CLOSEST(ev->delta.tv_nsec, ir_rc5_remote_gap); - - /* The duration time refers to the last bit time */ - is_pulse = (ev->type & IR_PULSE) ? 1 : 0; - - /* Very long delays are considered as start events */ - if (delta > RC5_DURATION || (ev->type & IR_START_EVENT)) + if (IS_RESET(duration)) { data->state = STATE_INACTIVE; - - switch (data->state) { - case STATE_INACTIVE: - IR_dprintk(2, "currently inative. Start bit (%s) @%uus\n", - is_pulse ? "pulse" : "space", - (unsigned)(ev->delta.tv_nsec + 500) / 1000); - - /* Discards the initial start space */ - if (!is_pulse) - goto err; - data->code = 1; - data->last_bit = 1; - data->elapsed = 0; - memset(&data->rc5_code, 0, sizeof(data->rc5_code)); - data->state = STATE_MARKSPACE; return 0; - case STATE_MARKSPACE: - if (delta != 1) - data->last_bit = data->last_bit ? 0 : 1; + } - data->elapsed += delta; + u = TO_UNITS(duration, RC5_UNIT); + if (DURATION(u) == 0) + goto out; - if ((data->elapsed % 2) == 1) - return 0; +again: + IR_dprintk(2, "RC5 decode started at state %i (%i units, %ius)\n", + data->state, u, TO_US(duration)); - data->code <<= 1; - data->code |= data->last_bit; - - /* Fill the 2 unused bits at the command with 0 */ - if (data->elapsed / 2 == 6) - data->code <<= 2; + if (DURATION(u) == 0 && data->state != STATE_FINISHED) + return 0; - if (data->elapsed >= (RC5_NBITS - 1) * 2) { - scancode = data->code; + switch (data->state) { - /* Check for the start bits */ - if ((scancode & 0xc000) != 0xc000) { - IR_dprintk(1, "Code 0x%04x doesn't have two start bits. It is not RC-5\n", scancode); - goto err; + case STATE_INACTIVE: + if (IS_PULSE(u)) { + data->state = STATE_BIT_START; + data->count = 1; + DECREASE_DURATION(u, 1); + goto again; + } + break; + + case STATE_BIT_START: + if (DURATION(u) == 1) { + data->rc5_bits <<= 1; + if (IS_SPACE(u)) + data->rc5_bits |= 1; + data->count++; + data->last_unit = u; + + /* + * If the last bit is zero, a space will merge + * with the silence after the command. + */ + if (IS_PULSE(u) && data->count == RC5_NBITS) { + data->state = STATE_FINISHED; + goto again; } - toggle = (scancode & 0x2000) ? 1 : 0; + data->state = STATE_BIT_END; + return 0; + } + break; - if (scancode == data->last_code) { - IR_dprintk(1, "RC-5 repeat\n"); - ir_repeat(input_dev); - } else { - data->last_code = scancode; - scancode &= 0x1fff; - IR_dprintk(1, "RC-5 scancode 0x%04x\n", scancode); + case STATE_BIT_END: + if (IS_TRANSITION(u, data->last_unit)) { + if (data->count == RC5_NBITS) + data->state = STATE_FINISHED; + else + data->state = STATE_BIT_START; - ir_keydown(input_dev, scancode, 0); - } - data->state = STATE_TRAILER; + DECREASE_DURATION(u, 1); + goto again; } - return 0; - case STATE_TRAILER: + break; + + case STATE_FINISHED: + command = (data->rc5_bits & 0x0003F) >> 0; + system = (data->rc5_bits & 0x007C0) >> 6; + toggle = (data->rc5_bits & 0x00800) ? 1 : 0; + command += (data->rc5_bits & 0x01000) ? 0 : 0x40; + scancode = system << 8 | command; + + IR_dprintk(1, "RC5 scancode 0x%04x (toggle: %u)\n", + scancode, toggle); + ir_keydown(input_dev, scancode, toggle); data->state = STATE_INACTIVE; return 0; } -err: - IR_dprintk(1, "RC-5 decoded failed at %s @ %luus\n", - is_pulse ? "pulse" : "space", - (ev->delta.tv_nsec + 500) / 1000); +out: + IR_dprintk(1, "RC5 decode failed at state %i (%i units, %ius)\n", + data->state, u, TO_US(duration)); data->state = STATE_INACTIVE; return -EINVAL; } diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 6d5fe596245d..e4681eda01f9 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -1018,7 +1018,7 @@ static int saa7134_raw_decode_irq(struct saa7134_dev *dev) saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); space = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown; - ir_raw_event_store(dev->remote->dev, space ? IR_SPACE : IR_PULSE); + ir_raw_event_store_edge(dev->remote->dev, space ? IR_SPACE : IR_PULSE); /* diff --git a/include/media/ir-core.h b/include/media/ir-core.h index e9fa94fe2ef5..e9a0cbf67ff6 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -65,14 +65,12 @@ struct ir_dev_props { void (*close)(void *priv); }; -struct ir_raw_event { - struct timespec delta; /* Time spent before event */ - enum raw_event_type type; /* event type */ -}; - struct ir_raw_event_ctrl { - struct kfifo kfifo; /* fifo for the pulse/space events */ - struct timespec last_event; /* when last event occurred */ + struct work_struct rx_work; /* for the rx decoding workqueue */ + struct kfifo kfifo; /* fifo for the pulse/space durations */ + ktime_t last_event; /* when last event occurred */ + enum raw_event_type last_type; /* last event type */ + struct input_dev *input_dev; /* pointer to the parent input_dev */ }; struct ir_input_dev { @@ -97,8 +95,7 @@ struct ir_input_dev { struct ir_raw_handler { struct list_head list; - int (*decode)(struct input_dev *input_dev, - struct ir_raw_event *ev); + int (*decode)(struct input_dev *input_dev, s64 duration); int (*raw_register)(struct input_dev *input_dev); int (*raw_unregister)(struct input_dev *input_dev); }; @@ -154,8 +151,14 @@ void ir_unregister_class(struct input_dev *input_dev); /* Routines from ir-raw-event.c */ int ir_raw_event_register(struct input_dev *input_dev); void ir_raw_event_unregister(struct input_dev *input_dev); -int ir_raw_event_store(struct input_dev *input_dev, enum raw_event_type type); -int ir_raw_event_handle(struct input_dev *input_dev); +void ir_raw_event_handle(struct input_dev *input_dev); +int ir_raw_event_store(struct input_dev *input_dev, s64 duration); +int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); +static inline void ir_raw_event_reset(struct input_dev *input_dev) +{ + ir_raw_event_store(input_dev, 0); + ir_raw_event_handle(input_dev); +} int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler); void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler); void ir_raw_init(void); @@ -174,4 +177,26 @@ void ir_raw_init(void); #define load_rc5_decode() 0 #endif +/* macros for ir decoders */ +#define PULSE(units) ((units)) +#define SPACE(units) (-(units)) +#define IS_RESET(duration) ((duration) == 0) +#define IS_PULSE(duration) ((duration) > 0) +#define IS_SPACE(duration) ((duration) < 0) +#define DURATION(duration) (abs((duration))) +#define IS_TRANSITION(x, y) ((x) * (y) < 0) +#define DECREASE_DURATION(duration, amount) \ + do { \ + if (IS_SPACE(duration)) \ + duration += (amount); \ + else if (IS_PULSE(duration)) \ + duration -= (amount); \ + } while (0) + +#define TO_UNITS(duration, unit_len) \ + ((int)((duration) > 0 ? \ + DIV_ROUND_CLOSEST(abs((duration)), (unit_len)) :\ + -DIV_ROUND_CLOSEST(abs((duration)), (unit_len)))) +#define TO_US(duration) ((int)TO_UNITS(duration, 1000)) + #endif /* _IR_CORE */ -- GitLab From 3f113e36106f133752de47208816b28aa8e60f88 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 8 Apr 2010 15:10:27 -0300 Subject: [PATCH 314/534] V4L/DVB: ir-core: move subsystem internal calls to ir-core-priv.h ir-core.h has the kABI to be used by the bridge drivers, when needing to register IR protocols and pass IR events. However, the same file also contains IR subsystem internal calls, meant to be used inside ir-core and between ir-core and the raw decoders. Better to move those functions to an internal header, for some reasons: 1) Header will be a little more cleaner; 2) It avoids the need of recompile everything (bridge/hardware drivers, etc), just because a new decoder were added, or some other internal change were needed; 3) Better organize the ir-core API, splitting the functions that are internal to IR core and the ancillary drivers (decoders, lirc_dev) from the features that should be exported to IR subsystem clients. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/ir-core-priv.h | 111 ++++++++++++++++++++++++++++++ drivers/media/IR/ir-functions.c | 1 + drivers/media/IR/ir-keytable.c | 2 +- drivers/media/IR/ir-nec-decoder.c | 2 +- drivers/media/IR/ir-raw-event.c | 2 +- drivers/media/IR/ir-rc5-decoder.c | 2 +- drivers/media/IR/ir-sysfs.c | 2 +- include/media/ir-core.h | 87 +++-------------------- 8 files changed, 127 insertions(+), 82 deletions(-) create mode 100644 drivers/media/IR/ir-core-priv.h diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h new file mode 100644 index 000000000000..ea546659e4ce --- /dev/null +++ b/drivers/media/IR/ir-core-priv.h @@ -0,0 +1,111 @@ +/* + * Remote Controller core raw events header + * + * Copyright (C) 2010 by Mauro Carvalho Chehab + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _IR_RAW_EVENT +#define _IR_RAW_EVENT + +#include +#include + +struct ir_raw_handler { + struct list_head list; + + int (*decode)(struct input_dev *input_dev, s64 duration); + int (*raw_register)(struct input_dev *input_dev); + int (*raw_unregister)(struct input_dev *input_dev); +}; + +struct ir_raw_event_ctrl { + struct work_struct rx_work; /* for the rx decoding workqueue */ + struct kfifo kfifo; /* fifo for the pulse/space durations */ + ktime_t last_event; /* when last event occurred */ + enum raw_event_type last_type; /* last event type */ + struct input_dev *input_dev; /* pointer to the parent input_dev */ +}; + +/* macros for IR decoders */ +#define PULSE(units) ((units)) +#define SPACE(units) (-(units)) +#define IS_RESET(duration) ((duration) == 0) +#define IS_PULSE(duration) ((duration) > 0) +#define IS_SPACE(duration) ((duration) < 0) +#define DURATION(duration) (abs((duration))) +#define IS_TRANSITION(x, y) ((x) * (y) < 0) +#define DECREASE_DURATION(duration, amount) \ + do { \ + if (IS_SPACE(duration)) \ + duration += (amount); \ + else if (IS_PULSE(duration)) \ + duration -= (amount); \ + } while (0) + +#define TO_UNITS(duration, unit_len) \ + ((int)((duration) > 0 ? \ + DIV_ROUND_CLOSEST(abs((duration)), (unit_len)) :\ + -DIV_ROUND_CLOSEST(abs((duration)), (unit_len)))) +#define TO_US(duration) ((int)TO_UNITS(duration, 1000)) + +/* + * Routines from ir-keytable.c to be used internally on ir-core and decoders + */ + +u32 ir_g_keycode_from_table(struct input_dev *input_dev, + u32 scancode); + +/* + * Routines from ir-sysfs.c - Meant to be called only internally inside + * ir-core + */ + +int ir_register_class(struct input_dev *input_dev); +void ir_unregister_class(struct input_dev *input_dev); + +/* + * Routines from ir-raw-event.c to be used internally and by decoders + */ +int ir_raw_event_register(struct input_dev *input_dev); +void ir_raw_event_unregister(struct input_dev *input_dev); +static inline void ir_raw_event_reset(struct input_dev *input_dev) +{ + ir_raw_event_store(input_dev, 0); + ir_raw_event_handle(input_dev); +} +int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler); +void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler); +void ir_raw_init(void); + + +/* + * Decoder initialization code + * + * Those load logic are called during ir-core init, and automatically + * loads the compiled decoders for their usage with IR raw events + */ + +/* from ir-nec-decoder.c */ +#ifdef CONFIG_IR_NEC_DECODER_MODULE +#define load_nec_decode() request_module("ir-nec-decoder") +#else +#define load_nec_decode() 0 +#endif + +/* from ir-rc5-decoder.c */ +#ifdef CONFIG_IR_RC5_DECODER_MODULE +#define load_rc5_decode() request_module("ir-rc5-decoder") +#else +#define load_rc5_decode() 0 +#endif + +#endif /* _IR_RAW_EVENT */ diff --git a/drivers/media/IR/ir-functions.c b/drivers/media/IR/ir-functions.c index ab06919ad5fc..db591e421887 100644 --- a/drivers/media/IR/ir-functions.c +++ b/drivers/media/IR/ir-functions.c @@ -24,6 +24,7 @@ #include #include #include +#include "ir-core-priv.h" /* -------------------------------------------------------------------------- */ diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 1fdb528737fe..599e39c34445 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -15,7 +15,7 @@ #include #include -#include +#include "ir-core-priv.h" /* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */ #define IR_TAB_MIN_SIZE 256 diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c index 02682e617fae..4c223f611a5e 100644 --- a/drivers/media/IR/ir-nec-decoder.c +++ b/drivers/media/IR/ir-nec-decoder.c @@ -12,8 +12,8 @@ * GNU General Public License for more details. */ -#include #include +#include "ir-core-priv.h" #define NEC_NBITS 32 #define NEC_UNIT 562500 /* ns */ diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c index e144f1522962..6a4445e5db1a 100644 --- a/drivers/media/IR/ir-raw-event.c +++ b/drivers/media/IR/ir-raw-event.c @@ -12,10 +12,10 @@ * GNU General Public License for more details. */ -#include #include #include #include +#include "ir-core-priv.h" /* Define the max number of pulse/space transitions to buffer */ #define MAX_IR_EVENT_SIZE 512 diff --git a/drivers/media/IR/ir-rc5-decoder.c b/drivers/media/IR/ir-rc5-decoder.c index 1d0857b69089..d8f0760890fa 100644 --- a/drivers/media/IR/ir-rc5-decoder.c +++ b/drivers/media/IR/ir-rc5-decoder.c @@ -19,7 +19,7 @@ * the first two bits are start bits, and a third one is a filing bit */ -#include +#include "ir-core-priv.h" #define RC5_NBITS 14 #define RC5_UNIT 888888 /* ns */ diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c index af1edd073b16..57f09c4ca9fb 100644 --- a/drivers/media/IR/ir-sysfs.c +++ b/drivers/media/IR/ir-sysfs.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include "ir-core-priv.h" #define IRRCV_NUM_DEVICES 256 diff --git a/include/media/ir-core.h b/include/media/ir-core.h index e9a0cbf67ff6..ab3bd30d43f1 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -31,13 +31,6 @@ enum rc_driver_type { RC_DRIVER_IR_RAW, /* Needs a Infra-Red pulse/space decoder */ }; -enum raw_event_type { - IR_SPACE = (1 << 0), - IR_PULSE = (1 << 1), - IR_START_EVENT = (1 << 2), - IR_STOP_EVENT = (1 << 3), -}; - /** * struct ir_dev_props - Allow caller drivers to set special properties * @driver_type: specifies if the driver or hardware have already a decoder, @@ -65,14 +58,6 @@ struct ir_dev_props { void (*close)(void *priv); }; -struct ir_raw_event_ctrl { - struct work_struct rx_work; /* for the rx decoding workqueue */ - struct kfifo kfifo; /* fifo for the pulse/space durations */ - ktime_t last_event; /* when last event occurred */ - enum raw_event_type last_type; /* last event type */ - struct input_dev *input_dev; /* pointer to the parent input_dev */ -}; - struct ir_input_dev { struct device dev; /* device */ char *driver_name; /* Name of the driver module */ @@ -92,22 +77,16 @@ struct ir_input_dev { u8 last_toggle; /* toggle of last command */ }; -struct ir_raw_handler { - struct list_head list; - - int (*decode)(struct input_dev *input_dev, s64 duration); - int (*raw_register)(struct input_dev *input_dev); - int (*raw_unregister)(struct input_dev *input_dev); +enum raw_event_type { + IR_SPACE = (1 << 0), + IR_PULSE = (1 << 1), + IR_START_EVENT = (1 << 2), + IR_STOP_EVENT = (1 << 3), }; #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) -/* Routines from ir-keytable.c */ - -u32 ir_g_keycode_from_table(struct input_dev *input_dev, - u32 scancode); -void ir_repeat(struct input_dev *dev); -void ir_keydown(struct input_dev *dev, int scancode, u8 toggle); +/* From ir-keytable.c */ int __ir_input_register(struct input_dev *dev, const struct ir_scancode_table *ir_codes, const struct ir_dev_props *props, @@ -143,60 +122,14 @@ static inline int ir_input_register(struct input_dev *dev, void ir_input_unregister(struct input_dev *input_dev); -/* Routines from ir-sysfs.c */ +void ir_repeat(struct input_dev *dev); +void ir_keydown(struct input_dev *dev, int scancode, u8 toggle); -int ir_register_class(struct input_dev *input_dev); -void ir_unregister_class(struct input_dev *input_dev); +/* From ir-raw-event.c */ -/* Routines from ir-raw-event.c */ -int ir_raw_event_register(struct input_dev *input_dev); -void ir_raw_event_unregister(struct input_dev *input_dev); void ir_raw_event_handle(struct input_dev *input_dev); int ir_raw_event_store(struct input_dev *input_dev, s64 duration); int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); -static inline void ir_raw_event_reset(struct input_dev *input_dev) -{ - ir_raw_event_store(input_dev, 0); - ir_raw_event_handle(input_dev); -} -int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler); -void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler); -void ir_raw_init(void); - -/* from ir-nec-decoder.c */ -#ifdef CONFIG_IR_NEC_DECODER_MODULE -#define load_nec_decode() request_module("ir-nec-decoder") -#else -#define load_nec_decode() 0 -#endif - -/* from ir-rc5-decoder.c */ -#ifdef CONFIG_IR_RC5_DECODER_MODULE -#define load_rc5_decode() request_module("ir-rc5-decoder") -#else -#define load_rc5_decode() 0 -#endif - -/* macros for ir decoders */ -#define PULSE(units) ((units)) -#define SPACE(units) (-(units)) -#define IS_RESET(duration) ((duration) == 0) -#define IS_PULSE(duration) ((duration) > 0) -#define IS_SPACE(duration) ((duration) < 0) -#define DURATION(duration) (abs((duration))) -#define IS_TRANSITION(x, y) ((x) * (y) < 0) -#define DECREASE_DURATION(duration, amount) \ - do { \ - if (IS_SPACE(duration)) \ - duration += (amount); \ - else if (IS_PULSE(duration)) \ - duration -= (amount); \ - } while (0) - -#define TO_UNITS(duration, unit_len) \ - ((int)((duration) > 0 ? \ - DIV_ROUND_CLOSEST(abs((duration)), (unit_len)) :\ - -DIV_ROUND_CLOSEST(abs((duration)), (unit_len)))) -#define TO_US(duration) ((int)TO_UNITS(duration, 1000)) + #endif /* _IR_CORE */ -- GitLab From 2b080c5df00e431baec09222aa8d623f0cd77314 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 7 Apr 2010 06:21:05 -0300 Subject: [PATCH 315/534] V4L/DVB: davinci: don't return under lock on error path If the kmalloc() failed for "ccdc_cfg = kmalloc(...);" then we would exit with the lock held. I moved the mutex_lock() below the allocation because it isn't protecting anything in that block and allocations are allocations are sometimes slow. Signed-off-by: Dan Carpenter Acked-by: Vaibhav Hiremath Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/davinci/vpfe_capture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index d4676ad41f39..f6648f6ba2fc 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c @@ -1861,7 +1861,6 @@ static __init int vpfe_probe(struct platform_device *pdev) goto probe_free_dev_mem; } - mutex_lock(&ccdc_lock); /* Allocate memory for ccdc configuration */ ccdc_cfg = kmalloc(sizeof(struct ccdc_config), GFP_KERNEL); if (NULL == ccdc_cfg) { @@ -1870,6 +1869,8 @@ static __init int vpfe_probe(struct platform_device *pdev) goto probe_free_lock; } + mutex_lock(&ccdc_lock); + strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32); /* Get VINT0 irq resource */ res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); -- GitLab From 860553023bfed0179b3fe5d01838635f54a314a3 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 6 Apr 2010 06:41:28 -0300 Subject: [PATCH 316/534] V4L/DVB: V4L2 Spec: fix V4L2_CTRL_TYPE_CTRL_CLASS documentation The spec says that the control ID for these types of controls is the same as that of the control class. But it should read: 'control class + 1'. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/v4l/vidioc-queryctrl.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/DocBook/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/v4l/vidioc-queryctrl.xml index 4876ff1a1a04..8e0e055ac934 100644 --- a/Documentation/DocBook/v4l/vidioc-queryctrl.xml +++ b/Documentation/DocBook/v4l/vidioc-queryctrl.xml @@ -325,7 +325,7 @@ should be part of the control documentation. n/a This is not a control. When VIDIOC_QUERYCTRL is called with a control ID -equal to a control class code (see ), the +equal to a control class code (see ) + 1, the ioctl returns the name of the control class and this control type. Older drivers which do not support this feature return an &EINVAL;. -- GitLab From ea64f8c2204cd8b9a95072c7ef85cc9a120a2693 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 6 Apr 2010 06:53:57 -0300 Subject: [PATCH 317/534] V4L/DVB: videodev2.h: move definition of enum v4l2_ctrl_type to the other control types For some reason the definition of enum v4l2_ctrl_type is far from the place where it is actually needed. This makes it hard to work with this header. Move it to just before struct v4l2_queryctrl, which is the one that actually uses it. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/linux/videodev2.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 2559b182b8c4..65d13ec13c1f 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -160,16 +160,6 @@ enum v4l2_buf_type { V4L2_BUF_TYPE_PRIVATE = 0x80, }; -enum v4l2_ctrl_type { - V4L2_CTRL_TYPE_INTEGER = 1, - V4L2_CTRL_TYPE_BOOLEAN = 2, - V4L2_CTRL_TYPE_MENU = 3, - V4L2_CTRL_TYPE_BUTTON = 4, - V4L2_CTRL_TYPE_INTEGER64 = 5, - V4L2_CTRL_TYPE_CTRL_CLASS = 6, - V4L2_CTRL_TYPE_STRING = 7, -}; - enum v4l2_tuner_type { V4L2_TUNER_RADIO = 1, V4L2_TUNER_ANALOG_TV = 2, @@ -942,6 +932,16 @@ struct v4l2_ext_controls { #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) +enum v4l2_ctrl_type { + V4L2_CTRL_TYPE_INTEGER = 1, + V4L2_CTRL_TYPE_BOOLEAN = 2, + V4L2_CTRL_TYPE_MENU = 3, + V4L2_CTRL_TYPE_BUTTON = 4, + V4L2_CTRL_TYPE_INTEGER64 = 5, + V4L2_CTRL_TYPE_CTRL_CLASS = 6, + V4L2_CTRL_TYPE_STRING = 7, +}; + /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ struct v4l2_queryctrl { __u32 id; -- GitLab From 1d94aa369da073acff26fa98ad6b2168cb028ab1 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 6 Apr 2010 08:12:21 -0300 Subject: [PATCH 318/534] V4L/DVB: video_ioctl2: do not replace arg with NULL for _IO() ioctls If the ioctl was defined without direction (e.g. _IO('o', 25)), then the arg as passed to vidioc_default was NULL instead of the original argument. Several ioctls in e.g. include/linux/dvb/video.h and audio.h use this type of ioctl to pass simple numerical values to the driver. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 7d59c107f13b..d6975f9c3722 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -2006,7 +2006,7 @@ long video_ioctl2(struct file *file, { char sbuf[128]; void *mbuf = NULL; - void *parg = NULL; + void *parg = (void *)arg; long err = -EINVAL; int is_ext_ctrl; size_t ctrls_size = 0; -- GitLab From 3f5e18249ce0d71a900bfdb8df327269483e730d Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 6 Apr 2010 08:14:11 -0300 Subject: [PATCH 319/534] V4L/DVB: video_ioctl2: don't return, use break You want to be able to reach the debug code at the end of this function, so don't use return, use break. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index d6975f9c3722..571f0c6e7c83 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -1072,7 +1072,7 @@ static long __video_do_ioctl(struct file *file, id &= ~curr_id; } if (i <= index) - return -EINVAL; + break; v4l2_video_std_construct(p, curr_id, descr); @@ -1597,7 +1597,7 @@ static long __video_do_ioctl(struct file *file, v4l2_std_id std = vfd->current_norm; if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; + break; ret = 0; if (ops->vidioc_g_std) -- GitLab From fa0290eaee03c3205cb6d344db25580fb3e5e53e Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 6 Apr 2010 08:20:56 -0300 Subject: [PATCH 320/534] V4L/DVB: usbvision: remove non-working vbi device The usbvision driver created vbi device nodes but the actual implementation was just stubs and only returned errors to userspace. In addition it used video_usercopy() and we want to remove that eventually. So remove all the vbi code except for the vbi flag in the card definition should someone ever be mad enough to work on a proper implementation for this driver. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/video/usbvision/usbvision-video.c | 77 ------------------- drivers/media/video/usbvision/usbvision.h | 1 - 2 files changed, 78 deletions(-) diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 7c17ec63c5da..d91f01668074 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c @@ -137,8 +137,6 @@ static int PowerOnAtOpen = 1; static int video_nr = -1; /* Sequential Number of Radio Device */ static int radio_nr = -1; -/* Sequential Number of VBI Device */ -static int vbi_nr = -1; /* Grab parameters for the device driver */ @@ -148,14 +146,12 @@ module_param(video_debug, int, 0444); module_param(PowerOnAtOpen, int, 0444); module_param(video_nr, int, 0444); module_param(radio_nr, int, 0444); -module_param(vbi_nr, int, 0444); MODULE_PARM_DESC(isocMode, " Set the default format for ISOC endpoint. Default: 0x60 (Compression On)"); MODULE_PARM_DESC(video_debug, " Set the default Debug Mode of the device driver. Default: 0 (Off)"); MODULE_PARM_DESC(PowerOnAtOpen, " Set the default device to power on when device is opened. Default: 1 (On)"); MODULE_PARM_DESC(video_nr, "Set video device number (/dev/videoX). Default: -1 (autodetect)"); MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)"); -MODULE_PARM_DESC(vbi_nr, "Set vbi device number (/dev/vbiX). Default: -1 (autodetect)"); // Misc stuff @@ -1244,36 +1240,6 @@ static int usbvision_radio_close(struct file *file) return errCode; } -/* - * Here comes the stuff for vbi on usbvision based devices - * - */ -static int usbvision_vbi_open(struct file *file) -{ - /* TODO */ - return -ENODEV; -} - -static int usbvision_vbi_close(struct file *file) -{ - /* TODO */ - return -ENODEV; -} - -static long usbvision_do_vbi_ioctl(struct file *file, - unsigned int cmd, void *arg) -{ - /* TODO */ - return -ENOIOCTLCMD; -} - -static long usbvision_vbi_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -{ - return video_usercopy(file, cmd, arg, usbvision_do_vbi_ioctl); -} - - // // Video registration stuff // @@ -1367,21 +1333,6 @@ static struct video_device usbvision_radio_template = { .current_norm = V4L2_STD_PAL }; -// vbi template -static const struct v4l2_file_operations usbvision_vbi_fops = { - .owner = THIS_MODULE, - .open = usbvision_vbi_open, - .release = usbvision_vbi_close, - .ioctl = usbvision_vbi_ioctl, -}; - -static struct video_device usbvision_vbi_template= -{ - .fops = &usbvision_vbi_fops, - .release = video_device_release, - .name = "usbvision-vbi", -}; - static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision, struct video_device *vdev_template, @@ -1410,18 +1361,6 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision, // unregister video4linux devices static void usbvision_unregister_video(struct usb_usbvision *usbvision) { - // vbi Device: - if (usbvision->vbi) { - PDEBUG(DBG_PROBE, "unregister %s [v4l2]", - video_device_node_name(usbvision->vbi)); - if (video_is_registered(usbvision->vbi)) { - video_unregister_device(usbvision->vbi); - } else { - video_device_release(usbvision->vbi); - } - usbvision->vbi = NULL; - } - // Radio Device: if (usbvision->rdev) { PDEBUG(DBG_PROBE, "unregister %s [v4l2]", @@ -1482,22 +1421,6 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device %s [v4l2]\n", usbvision->nr, video_device_node_name(usbvision->rdev)); } - // vbi Device: - if (usbvision_device_data[usbvision->DevModel].vbi) { - usbvision->vbi = usbvision_vdev_init(usbvision, - &usbvision_vbi_template, - "USBVision VBI"); - if (usbvision->vbi == NULL) { - goto err_exit; - } - if (video_register_device(usbvision->vbi, - VFL_TYPE_VBI, - vbi_nr)<0) { - goto err_exit; - } - printk(KERN_INFO "USBVision[%d]: registered USBVision VBI device %s [v4l2] (Not Working Yet!)\n", - usbvision->nr, video_device_node_name(usbvision->vbi)); - } // all done return 0; diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h index f8d7458daf3e..5ab936e252fe 100644 --- a/drivers/media/video/usbvision/usbvision.h +++ b/drivers/media/video/usbvision/usbvision.h @@ -360,7 +360,6 @@ struct usb_usbvision { struct v4l2_device v4l2_dev; struct video_device *vdev; /* Video Device */ struct video_device *rdev; /* Radio Device */ - struct video_device *vbi; /* VBI Device */ /* i2c Declaration Section*/ struct i2c_adapter i2c_adap; -- GitLab From e426e8663f028272b99f91e57bbbab6fda603bf1 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 6 Apr 2010 10:32:19 -0300 Subject: [PATCH 321/534] V4L/DVB: DocBook/v4l/compat.xml: add missing
The indentation of the sections had gone wrong, causing a mistake with section nesting. Fixed. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/v4l/compat.xml | 115 ++++++++++++++------------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/Documentation/DocBook/v4l/compat.xml b/Documentation/DocBook/v4l/compat.xml index 854235b5208e..b42b935913cd 100644 --- a/Documentation/DocBook/v4l/compat.xml +++ b/Documentation/DocBook/v4l/compat.xml @@ -2343,15 +2343,15 @@ more information. - + -
- Relation of V4L2 to other Linux multimedia APIs +
+ Relation of V4L2 to other Linux multimedia APIs -
- X Video Extension +
+ X Video Extension - The X Video Extension (abbreviated XVideo or just Xv) is + The X Video Extension (abbreviated XVideo or just Xv) is an extension of the X Window system, implemented for example by the XFree86 project. Its scope is similar to V4L2, an API to video capture and output devices for X clients. Xv allows applications to display @@ -2362,7 +2362,7 @@ capture or output still images in XPixmaps extension available across many operating systems and architectures. - Because the driver is embedded into the X server Xv has a + Because the driver is embedded into the X server Xv has a number of advantages over the V4L2 video overlay interface. The driver can easily determine the overlay target, &ie; visible graphics memory or off-screen buffers for a @@ -2371,16 +2371,16 @@ overlay, scaling or color-keying, or the clipping functions of the video capture hardware, always in sync with drawing operations or windows moving or changing their stacking order. - To combine the advantages of Xv and V4L a special Xv + To combine the advantages of Xv and V4L a special Xv driver exists in XFree86 and XOrg, just programming any overlay capable Video4Linux device it finds. To enable it /etc/X11/XF86Config must contain these lines: - + Section "Module" Load "v4l" EndSection - As of XFree86 4.2 this driver still supports only V4L + As of XFree86 4.2 this driver still supports only V4L ioctls, however it should work just fine with all V4L2 devices through the V4L2 backward-compatibility layer. Since V4L2 permits multiple opens it is possible (if supported by the V4L2 driver) to capture @@ -2388,83 +2388,84 @@ video while an X client requested video overlay. Restrictions of simultaneous capturing and overlay are discussed in apply. - Only marginally related to V4L2, XFree86 extended Xv to + Only marginally related to V4L2, XFree86 extended Xv to support hardware YUV to RGB conversion and scaling for faster video playback, and added an interface to MPEG-2 decoding hardware. This API is useful to display images captured with V4L2 devices. -
+
-
- Digital Video +
+ Digital Video - V4L2 does not support digital terrestrial, cable or + V4L2 does not support digital terrestrial, cable or satellite broadcast. A separate project aiming at digital receivers exists. You can find its homepage at http://linuxtv.org. The Linux DVB API has no connection to the V4L2 API except that drivers for hybrid hardware may support both. -
+
-
- Audio Interfaces +
+ Audio Interfaces - [to do - OSS/ALSA] + [to do - OSS/ALSA] +
-
-
- Experimental API Elements +
+ Experimental API Elements - The following V4L2 API elements are currently experimental + The following V4L2 API elements are currently experimental and may change in the future. - - - Video Output Overlay (OSD) Interface, + + Video Output Overlay (OSD) Interface, . - + - V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, + V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, &v4l2-buf-type;, . - - - V4L2_CAP_VIDEO_OUTPUT_OVERLAY, + + + V4L2_CAP_VIDEO_OUTPUT_OVERLAY, &VIDIOC-QUERYCAP; ioctl, . - - - &VIDIOC-ENUM-FRAMESIZES; and + + + &VIDIOC-ENUM-FRAMESIZES; and &VIDIOC-ENUM-FRAMEINTERVALS; ioctls. - - - &VIDIOC-G-ENC-INDEX; ioctl. - - - &VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; + + + &VIDIOC-G-ENC-INDEX; ioctl. + + + &VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; ioctls. - - - &VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER; + + + &VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER; ioctls. - - - &VIDIOC-DBG-G-CHIP-IDENT; ioctl. - - -
+ + + &VIDIOC-DBG-G-CHIP-IDENT; ioctl. + + +
-
- Obsolete API Elements +
+ Obsolete API Elements - The following V4L2 API elements were superseded by new + The following V4L2 API elements were superseded by new interfaces and should not be implemented in new drivers. - - - VIDIOC_G_MPEGCOMP and + + + VIDIOC_G_MPEGCOMP and VIDIOC_S_MPEGCOMP ioctls. Use Extended Controls, . - - + + +
diff --git a/Documentation/DocBook/v4l/v4l2.xml b/Documentation/DocBook/v4l/v4l2.xml index 060105af49e5..9737243377a3 100644 --- a/Documentation/DocBook/v4l/v4l2.xml +++ b/Documentation/DocBook/v4l/v4l2.xml @@ -401,6 +401,7 @@ and discussions on the V4L mailing list.
&sub-dev-teletext;
&sub-dev-radio;
&sub-dev-rds;
+
&sub-dev-event;
@@ -426,6 +427,7 @@ and discussions on the V4L mailing list. &sub-cropcap; &sub-dbg-g-chip-ident; &sub-dbg-g-register; + &sub-dqevent; &sub-encoder-cmd; &sub-enumaudio; &sub-enumaudioout; @@ -467,6 +469,7 @@ and discussions on the V4L mailing list. &sub-reqbufs; &sub-s-hw-freq-seek; &sub-streamon; + &sub-subscribe-event; &sub-mmap; &sub-munmap; diff --git a/Documentation/DocBook/v4l/vidioc-dqevent.xml b/Documentation/DocBook/v4l/vidioc-dqevent.xml new file mode 100644 index 000000000000..eb45c1695d8c --- /dev/null +++ b/Documentation/DocBook/v4l/vidioc-dqevent.xml @@ -0,0 +1,124 @@ + + + ioctl VIDIOC_DQEVENT + &manvol; + + + + VIDIOC_DQEVENT + Dequeue event + + + + + + int ioctl + int fd + int request + struct v4l2_event +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_DQEVENT + + + + argp + + + + + + + + + Description + + Dequeue an event from a video device. No input is required + for this ioctl. All the fields of the &v4l2-event; structure are + filled by the driver. The file handle will also receive exceptions + which the application may get by e.g. using the select system + call. + + + struct <structname>v4l2_event</structname> + + &cs-str; + + + __u32 + type + + Type of the event. + + + union + u + + + + + + __u8 + data[64] + Event data. Defined by the event type. The union + should be used to define easily accessible type for + events. + + + __u32 + pending + + Number of pending events excluding this one. + + + __u32 + sequence + + Event sequence number. The sequence number is + incremented for every subscribed event that takes place. + If sequence numbers are not contiguous it means that + events have been lost. + + + + struct timeval + timestamp + + Event timestamp. + + + __u32 + reserved[9] + + Reserved for future extensions. Drivers must set + the array to zero. + + + +
+ +
+
+ diff --git a/Documentation/DocBook/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/v4l/vidioc-subscribe-event.xml new file mode 100644 index 000000000000..71ab88cb76b3 --- /dev/null +++ b/Documentation/DocBook/v4l/vidioc-subscribe-event.xml @@ -0,0 +1,104 @@ + + + ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT + &manvol; + + + + VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT + Subscribe or unsubscribe event + + + + + + int ioctl + int fd + int request + struct v4l2_event_subscription +*argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT + + + + argp + + + + + + + + + Description + + Subscribe or unsubscribe V4L2 event. Subscribed events are + dequeued by using the &VIDIOC-DQEVENT; ioctl. + + + struct <structname>v4l2_event_subscription</structname> + + &cs-str; + + + __u32 + type + Type of the event. + + + __u32 + reserved[7] + Reserved for future extensions. Drivers and applications + must set the array to zero. + + + +
+ + + Event Types + + &cs-def; + + + V4L2_EVENT_ALL + 0 + All events. V4L2_EVENT_ALL is valid only for + VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once. + + + + V4L2_EVENT_PRIVATE_START + 0x08000000 + Base event number for driver-private events. + + + +
+ +
+
+ diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index 48f0adfbc984..e831aaca66f8 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt @@ -680,3 +680,63 @@ int my_release(struct file *file) ... } + +V4L2 events +----------- + +The V4L2 events provide a generic way to pass events to user space. +The driver must use v4l2_fh to be able to support V4L2 events. + +Useful functions: + +- v4l2_event_alloc() + + To use events, the driver must allocate events for the file handle. By + calling the function more than once, the driver may assure that at least n + events in total have been allocated. The function may not be called in + atomic context. + +- v4l2_event_queue() + + Queue events to video device. The driver's only responsibility is to fill + in the type and the data fields. The other fields will be filled in by + V4L2. + +- v4l2_event_subscribe() + + The video_device->ioctl_ops->vidioc_subscribe_event must check the driver + is able to produce events with specified event id. Then it calls + v4l2_event_subscribe() to subscribe the event. + +- v4l2_event_unsubscribe() + + vidioc_unsubscribe_event in struct v4l2_ioctl_ops. A driver may use + v4l2_event_unsubscribe() directly unless it wants to be involved in + unsubscription process. + + The special type V4L2_EVENT_ALL may be used to unsubscribe all events. The + drivers may want to handle this in a special way. + +- v4l2_event_pending() + + Returns the number of pending events. Useful when implementing poll. + +Drivers do not initialise events directly. The events are initialised +through v4l2_fh_init() if video_device->ioctl_ops->vidioc_subscribe_event is +non-NULL. This *MUST* be performed in the driver's +v4l2_file_operations->open() handler. + +Events are delivered to user space through the poll system call. The driver +can use v4l2_fh->events->wait wait_queue_head_t as the argument for +poll_wait(). + +There are standard and private events. New standard events must use the +smallest available event type. The drivers must allocate their events from +their own class starting from class base. Class base is +V4L2_EVENT_PRIVATE_START + n * 1000 where n is the lowest available number. +The first event type in the class is reserved for future use, so the first +available event type is 'class base + 1'. + +An example on how the V4L2 events may be used can be found in the OMAP +3 ISP driver available at as of +writing this. -- GitLab From 1bcaf4bd53872e70c4fceec6bbb76044325f337f Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 27 Mar 2010 14:09:52 -0300 Subject: [PATCH 417/534] V4L/DVB: v4l: add VSYNC and EOS events for use with ivtv Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/linux/videodev2.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 0f627c5b986b..b5121bec1bd9 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -1640,9 +1640,21 @@ struct v4l2_streamparm { * E V E N T S */ +#define V4L2_EVENT_ALL 0 +#define V4L2_EVENT_VSYNC 1 +#define V4L2_EVENT_EOS 2 +#define V4L2_EVENT_PRIVATE_START 0x08000000 + +/* Payload for V4L2_EVENT_VSYNC */ +struct v4l2_event_vsync { + /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */ + __u8 field; +} __attribute__ ((packed)); + struct v4l2_event { __u32 type; union { + struct v4l2_event_vsync vsync; __u8 data[64]; } u; __u32 pending; @@ -1656,9 +1668,6 @@ struct v4l2_event_subscription { __u32 reserved[7]; }; -#define V4L2_EVENT_ALL 0 -#define V4L2_EVENT_PRIVATE_START 0x08000000 - /* * A D V A N C E D D E B U G G I N G * -- GitLab From 092501936fc128992456a086193746cf34642815 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 27 Mar 2010 14:10:13 -0300 Subject: [PATCH 418/534] V4L/DVB: ivtv: support the new events API Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/ivtv/ivtv-driver.h | 7 ++++ drivers/media/video/ivtv/ivtv-fileops.c | 53 +++++++++++++++++++------ drivers/media/video/ivtv/ivtv-ioctl.c | 24 +++++++++-- drivers/media/video/ivtv/ivtv-irq.c | 15 ++++++- drivers/media/video/ivtv/ivtv-streams.c | 5 +++ 5 files changed, 87 insertions(+), 17 deletions(-) diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 851f07de5296..5b45fd2b2645 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -375,6 +376,7 @@ struct ivtv_stream { }; struct ivtv_open_id { + struct v4l2_fh fh; u32 open_id; /* unique ID for this file descriptor */ int type; /* stream type */ int yuv_frames; /* 1: started OUT_UDMA_YUV output mode */ @@ -382,6 +384,11 @@ struct ivtv_open_id { struct ivtv *itv; }; +static inline struct ivtv_open_id *fh2id(struct v4l2_fh *fh) +{ + return container_of(fh, struct ivtv_open_id, fh); +} + struct yuv_frame_info { u32 update; diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c index babcabd73c08..bee9605bd273 100644 --- a/drivers/media/video/ivtv/ivtv-fileops.c +++ b/drivers/media/video/ivtv/ivtv-fileops.c @@ -32,6 +32,7 @@ #include "ivtv-yuv.h" #include "ivtv-ioctl.h" #include "ivtv-cards.h" +#include #include /* This function tries to claim the stream for a specific file descriptor. @@ -506,7 +507,7 @@ int ivtv_start_capture(struct ivtv_open_id *id) ssize_t ivtv_v4l2_read(struct file * filp, char __user *buf, size_t count, loff_t * pos) { - struct ivtv_open_id *id = filp->private_data; + struct ivtv_open_id *id = fh2id(filp->private_data); struct ivtv *itv = id->itv; struct ivtv_stream *s = &itv->streams[id->type]; int rc; @@ -541,7 +542,7 @@ int ivtv_start_decoding(struct ivtv_open_id *id, int speed) ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t count, loff_t *pos) { - struct ivtv_open_id *id = filp->private_data; + struct ivtv_open_id *id = fh2id(filp->private_data); struct ivtv *itv = id->itv; struct ivtv_stream *s = &itv->streams[id->type]; struct yuv_playback_info *yi = &itv->yuv_info; @@ -711,19 +712,31 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t c unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table *wait) { - struct ivtv_open_id *id = filp->private_data; + struct ivtv_open_id *id = fh2id(filp->private_data); struct ivtv *itv = id->itv; struct ivtv_stream *s = &itv->streams[id->type]; int res = 0; /* add stream's waitq to the poll list */ IVTV_DEBUG_HI_FILE("Decoder poll\n"); - poll_wait(filp, &s->waitq, wait); - set_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags); - if (test_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags) || - test_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags)) - res = POLLPRI; + /* If there are subscribed events, then only use the new event + API instead of the old video.h based API. */ + if (!list_empty(&id->fh.events->subscribed)) { + poll_wait(filp, &id->fh.events->wait, wait); + /* Turn off the old-style vsync events */ + clear_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags); + if (v4l2_event_pending(&id->fh)) + res = POLLPRI; + } else { + /* This is the old-style API which is here only for backwards + compatibility. */ + poll_wait(filp, &s->waitq, wait); + set_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags); + if (test_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags) || + test_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags)) + res = POLLPRI; + } /* Allow write if buffers are available for writing */ if (s->q_free.buffers) @@ -733,7 +746,7 @@ unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table *wait) unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait) { - struct ivtv_open_id *id = filp->private_data; + struct ivtv_open_id *id = fh2id(filp->private_data); struct ivtv *itv = id->itv; struct ivtv_stream *s = &itv->streams[id->type]; int eof = test_bit(IVTV_F_S_STREAMOFF, &s->s_flags); @@ -833,13 +846,16 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts) int ivtv_v4l2_close(struct file *filp) { - struct ivtv_open_id *id = filp->private_data; + struct v4l2_fh *fh = filp->private_data; + struct ivtv_open_id *id = fh2id(fh); struct ivtv *itv = id->itv; struct ivtv_stream *s = &itv->streams[id->type]; IVTV_DEBUG_FILE("close %s\n", s->name); v4l2_prio_close(&itv->prio, &id->prio); + v4l2_fh_del(fh); + v4l2_fh_exit(fh); /* Easy case first: this stream was never claimed by us */ if (s->id != id->open_id) { @@ -895,6 +911,7 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp) { struct ivtv *itv = s->itv; struct ivtv_open_id *item; + int res = 0; IVTV_DEBUG_FILE("open %s\n", s->name); @@ -915,17 +932,27 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp) } /* Allocate memory */ - item = kmalloc(sizeof(struct ivtv_open_id), GFP_KERNEL); + item = kzalloc(sizeof(struct ivtv_open_id), GFP_KERNEL); if (NULL == item) { IVTV_DEBUG_WARN("nomem on v4l2 open\n"); return -ENOMEM; } + v4l2_fh_init(&item->fh, s->vdev); + if (s->type == IVTV_DEC_STREAM_TYPE_YUV || + s->type == IVTV_DEC_STREAM_TYPE_MPG) { + res = v4l2_event_alloc(&item->fh, 60); + } + if (res < 0) { + v4l2_fh_exit(&item->fh); + kfree(item); + return res; + } item->itv = itv; item->type = s->type; v4l2_prio_open(&itv->prio, &item->prio); item->open_id = itv->open_id++; - filp->private_data = item; + filp->private_data = &item->fh; if (item->type == IVTV_ENC_STREAM_TYPE_RAD) { /* Try to claim this stream */ @@ -940,6 +967,7 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp) /* switching to radio while capture is in progress is not polite */ ivtv_release_stream(s); + v4l2_fh_exit(&item->fh); kfree(item); return -EBUSY; } @@ -970,6 +998,7 @@ static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp) 1080 * ((itv->yuv_info.v4l2_src_h + 31) & ~31); itv->yuv_info.stream_size = 0; } + v4l2_fh_add(&item->fh); return 0; } diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 6422cf8f189d..e95ebdeaa72f 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -1452,6 +1453,18 @@ static int ivtv_overlay(struct file *file, void *fh, unsigned int on) return 0; } +static int ivtv_subscribe_event(struct v4l2_fh *fh, struct v4l2_event_subscription *sub) +{ + switch (sub->type) { + case V4L2_EVENT_VSYNC: + case V4L2_EVENT_EOS: + break; + default: + return -EINVAL; + } + return v4l2_event_subscribe(fh, sub); +} + static int ivtv_log_status(struct file *file, void *fh) { struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; @@ -1560,7 +1573,7 @@ static int ivtv_log_status(struct file *file, void *fh) static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) { - struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; + struct ivtv_open_id *id = fh2id(filp->private_data); struct ivtv *itv = id->itv; int nonblocking = filp->f_flags & O_NONBLOCK; struct ivtv_stream *s = &itv->streams[id->type]; @@ -1820,7 +1833,7 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, unsigned int cmd, unsigned long arg) { struct video_device *vfd = video_devdata(filp); - struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; + struct ivtv_open_id *id = fh2id(filp->private_data); long ret; /* check priority */ @@ -1852,10 +1865,13 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; + struct ivtv_open_id *id = fh2id(filp->private_data); struct ivtv *itv = id->itv; long res; + /* DQEVENT can block, so this should not run with the serialize lock */ + if (cmd == VIDIOC_DQEVENT) + return ivtv_serialized_ioctl(itv, filp, cmd, arg); mutex_lock(&itv->serialize_lock); res = ivtv_serialized_ioctl(itv, filp, cmd, arg); mutex_unlock(&itv->serialize_lock); @@ -1926,6 +1942,8 @@ static const struct v4l2_ioctl_ops ivtv_ioctl_ops = { .vidioc_g_ext_ctrls = ivtv_g_ext_ctrls, .vidioc_s_ext_ctrls = ivtv_s_ext_ctrls, .vidioc_try_ext_ctrls = ivtv_try_ext_ctrls, + .vidioc_subscribe_event = ivtv_subscribe_event, + .vidioc_unsubscribe_event = v4l2_event_unsubscribe, }; void ivtv_set_funcs(struct video_device *vdev) diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index dbd46c5d6975..fea1ec33b0df 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c @@ -25,6 +25,7 @@ #include "ivtv-mailbox.h" #include "ivtv-vbi.h" #include "ivtv-yuv.h" +#include #define DMA_MAGIC_COOKIE 0x000001fe @@ -778,6 +779,14 @@ static void ivtv_irq_vsync(struct ivtv *itv) } } if (frame != (itv->last_vsync_field & 1)) { + static const struct v4l2_event evtop = { + .type = V4L2_EVENT_VSYNC, + .u.vsync.field = V4L2_FIELD_TOP, + }; + static const struct v4l2_event evbottom = { + .type = V4L2_EVENT_VSYNC, + .u.vsync.field = V4L2_FIELD_BOTTOM, + }; struct ivtv_stream *s = ivtv_get_output_stream(itv); itv->last_vsync_field += 1; @@ -791,10 +800,12 @@ static void ivtv_irq_vsync(struct ivtv *itv) if (test_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags)) { set_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags); wake_up(&itv->event_waitq); + if (s) + wake_up(&s->waitq); } + if (s && s->vdev) + v4l2_event_queue(s->vdev, frame ? &evtop : &evbottom); wake_up(&itv->vsync_waitq); - if (s) - wake_up(&s->waitq); /* Send VBI to saa7127 */ if (frame && (itv->output_mode == OUT_PASSTHROUGH || diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index 6917c497fb7e..def507ee106a 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -42,6 +42,7 @@ #include "ivtv-yuv.h" #include "ivtv-cards.h" #include "ivtv-streams.h" +#include static const struct v4l2_file_operations ivtv_v4l2_enc_fops = { .owner = THIS_MODULE, @@ -840,6 +841,9 @@ int ivtv_stop_v4l2_encode_stream(struct ivtv_stream *s, int gop_end) int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts) { + static const struct v4l2_event ev = { + .type = V4L2_EVENT_EOS, + }; struct ivtv *itv = s->itv; if (s->vdev == NULL) @@ -891,6 +895,7 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts) set_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags); wake_up(&itv->event_waitq); + v4l2_event_queue(s->vdev, &ev); /* wake up wait queues */ wake_up(&s->waitq); -- GitLab From 37089368c1b1bea3c71217163e6d5d3b01ef1f19 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 27 Mar 2010 14:10:37 -0300 Subject: [PATCH 419/534] V4L/DVB: v4l spec: document what odd and even fields are Document that odd == top and even == bottom. I can never remember this, so it is probably worth documenting. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/v4l/io.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/DocBook/v4l/io.xml b/Documentation/DocBook/v4l/io.xml index e870330cbf77..bb685ed6fe7b 100644 --- a/Documentation/DocBook/v4l/io.xml +++ b/Documentation/DocBook/v4l/io.xml @@ -918,8 +918,8 @@ order. When the driver provides or accepts images field by field rather than interleaved, it is also important applications understand -how the fields combine to frames. We distinguish between top and -bottom fields, the spatial order: The first line +how the fields combine to frames. We distinguish between top (aka odd) and +bottom (aka even) fields, the spatial order: The first line of the top field is the first line of an interlaced frame, the first line of the bottom field is the second line of that frame. @@ -972,12 +972,12 @@ between V4L2_FIELD_TOP and V4L2_FIELD_TOP 2 - Images consist of the top field only. + Images consist of the top (aka odd) field only. V4L2_FIELD_BOTTOM 3 - Images consist of the bottom field only. + Images consist of the bottom (aka even) field only. Applications may wish to prevent a device from capturing interlaced images because they will have "comb" or "feathering" artefacts around moving objects. -- GitLab From 0e1de38db83606d802cf2b3e00cf95fc693b8ca2 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 27 Mar 2010 14:10:57 -0300 Subject: [PATCH 420/534] V4L/DVB: v4l spec: document new events Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media-entities.tmpl | 2 ++ Documentation/DocBook/v4l/vidioc-dqevent.xml | 9 +++++- .../DocBook/v4l/vidioc-subscribe-event.xml | 29 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl index 770be3c3ba75..5d4d40f429a5 100644 --- a/Documentation/DocBook/media-entities.tmpl +++ b/Documentation/DocBook/media-entities.tmpl @@ -85,6 +85,7 @@ VIDIOC_TRY_ENCODER_CMD"> VIDIOC_TRY_EXT_CTRLS"> VIDIOC_TRY_FMT"> +VIDIOC_UNSUBSCRIBE_EVENT"> v4l2_std_id"> @@ -145,6 +146,7 @@ v4l2_encoder_cmd"> v4l2_event"> v4l2_event_subscription"> +v4l2_event_vsync"> v4l2_ext_control"> v4l2_ext_controls"> v4l2_fmtdesc"> diff --git a/Documentation/DocBook/v4l/vidioc-dqevent.xml b/Documentation/DocBook/v4l/vidioc-dqevent.xml index eb45c1695d8c..4e0a7cc30812 100644 --- a/Documentation/DocBook/v4l/vidioc-dqevent.xml +++ b/Documentation/DocBook/v4l/vidioc-dqevent.xml @@ -72,6 +72,13 @@ + + + &v4l2-event-vsync; + vsync + Event data for event V4L2_EVENT_VSYNC. + + __u8 @@ -97,7 +104,7 @@ - struct timeval + struct timespec timestamp Event timestamp. diff --git a/Documentation/DocBook/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/v4l/vidioc-subscribe-event.xml index 71ab88cb76b3..8b501791aa68 100644 --- a/Documentation/DocBook/v4l/vidioc-subscribe-event.xml +++ b/Documentation/DocBook/v4l/vidioc-subscribe-event.xml @@ -84,6 +84,21 @@ VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once. + + V4L2_EVENT_VSYNC + 1 + This event is triggered on the vertical sync. + This event has &v4l2-event-vsync; associated with it. + + + + V4L2_EVENT_EOS + 2 + This event is triggered when the end of a stream is reached. + This is typically used with MPEG decoders to report to the application + when the last of the MPEG stream has been decoded. + + V4L2_EVENT_PRIVATE_START 0x08000000 @@ -93,6 +108,20 @@ + + struct <structname>v4l2_event_vsync</structname> + + &cs-str; + + + __u8 + field + The upcoming field. See &v4l2-field;. + + + +
+