summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-09-13 10:49:39 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-13 10:49:39 -0300
commit3d8bb4537fe9a985d386b7a51ee0c1f11d25a095 (patch)
treeaff679c0dffa6a6365ee183b3a21b8e46c90f689 /linux/drivers
parent856378592a1b9be61e28092caf5e87446bae4694 (diff)
parent0f8f6ec6e6b142a0398c9a0d9925432326d0b595 (diff)
downloadmediapointer-dvb-s2-3d8bb4537fe9a985d386b7a51ee0c1f11d25a095.tar.gz
mediapointer-dvb-s2-3d8bb4537fe9a985d386b7a51ee0c1f11d25a095.tar.bz2
merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-core
From: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvbdev.c14
-rw-r--r--linux/drivers/media/dvb/dvb-usb/af9015.c2
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c8
-rw-r--r--linux/drivers/media/dvb/siano/Kconfig1
-rw-r--r--linux/drivers/media/video/dabusb.c10
-rw-r--r--linux/drivers/media/video/davinci/vpif_display.c2
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-cards.c39
-rw-r--r--linux/drivers/media/video/em28xx/em28xx.h3
-rw-r--r--linux/drivers/media/video/saa7134/saa7134.h2
-rw-r--r--linux/drivers/media/video/videobuf-dma-contig.c94
10 files changed, 143 insertions, 32 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c
index f6084e19d..2028be23d 100644
--- a/linux/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c
@@ -472,6 +472,17 @@ static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env)
}
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
+static char *dvb_nodename(struct device *dev)
+{
+ struct dvb_device *dvbdev = dev_get_drvdata(dev);
+
+ return kasprintf(GFP_KERNEL, "dvb/adapter%d/%s%d",
+ dvbdev->adapter->num, dnames[dvbdev->type], dvbdev->id);
+}
+
+
+#endif
static int __init init_dvbdev(void)
{
int retval;
@@ -501,6 +512,9 @@ static int __init init_dvbdev(void)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
dvb_class->dev_uevent = dvb_uevent;
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
+ dvb_class->nodename = dvb_nodename;
+#endif
return 0;
error:
diff --git a/linux/drivers/media/dvb/dvb-usb/af9015.c b/linux/drivers/media/dvb/dvb-usb/af9015.c
index aeb10db0b..69a00d610 100644
--- a/linux/drivers/media/dvb/dvb-usb/af9015.c
+++ b/linux/drivers/media/dvb/dvb-usb/af9015.c
@@ -108,7 +108,7 @@ static int af9015_rw_udev(struct usb_device *udev, struct req_t *req)
}
/* write requested */
- if (write && req->data_len) {
+ if (write) {
memcpy(&buf[8], req->data, req->data_len);
msg_len += req->data_len;
}
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index df72c8637..76c281b9d 100644
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -12,6 +12,7 @@
#include <linux/usb_input.h>
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
static int dvb_usb_getkeycode(struct input_dev *dev,
int scancode, int *keycode)
{
@@ -76,6 +77,7 @@ static int dvb_usb_setkeycode(struct input_dev *dev,
return -EINVAL;
}
+#endif
/* Remote-control poll function - called every dib->rc_query_interval ms to see
* whether the remote control has received anything.
@@ -189,11 +191,11 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
usb_to_input_id(d->udev, &input_dev->id);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
input_dev->dev.parent = &d->udev->dev;
+ input_dev->getkeycode = dvb_usb_getkeycode;
+ input_dev->setkeycode = dvb_usb_setkeycode;
#else
input_dev->cdev.dev = &d->udev->dev;
#endif
- input_dev->getkeycode = dvb_usb_getkeycode;
- input_dev->setkeycode = dvb_usb_setkeycode;
/* set the bits for the keys */
deb_rc("key map size: %d\n", d->props.rc_key_map_size);
@@ -211,7 +213,9 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
input_dev->rep[REP_PERIOD] = d->props.rc_interval;
input_dev->rep[REP_DELAY] = d->props.rc_interval + 150;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
input_set_drvdata(input_dev, d);
+#endif
err = input_register_device(input_dev);
if (err) {
diff --git a/linux/drivers/media/dvb/siano/Kconfig b/linux/drivers/media/dvb/siano/Kconfig
index ff297ceaf..8c1aed77e 100644
--- a/linux/drivers/media/dvb/siano/Kconfig
+++ b/linux/drivers/media/dvb/siano/Kconfig
@@ -28,7 +28,6 @@ config SMS_USB_DRV
config SMS_SDIO_DRV
tristate "SDIO interface support"
depends on DVB_CORE && MMC
- default m
---help---
Choose if you would like to have Siano's support for SDIO interface
endmenu
diff --git a/linux/drivers/media/video/dabusb.c b/linux/drivers/media/video/dabusb.c
index cb0a41c45..a0812ce91 100644
--- a/linux/drivers/media/video/dabusb.c
+++ b/linux/drivers/media/video/dabusb.c
@@ -813,8 +813,18 @@ static struct file_operations dabusb_fops =
.release = dabusb_release,
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
+static char *dabusb_nodename(struct device *dev)
+{
+ return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev));
+}
+
+#endif
static struct usb_class_driver dabusb_class = {
.name = "dabusb%d",
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
+ .nodename = dabusb_nodename,
+#endif
.fops = &dabusb_fops,
.minor_base = DABUSB_MINOR,
};
diff --git a/linux/drivers/media/video/davinci/vpif_display.c b/linux/drivers/media/video/davinci/vpif_display.c
index 0f0ec8dc6..a125a452d 100644
--- a/linux/drivers/media/video/davinci/vpif_display.c
+++ b/linux/drivers/media/video/davinci/vpif_display.c
@@ -1422,7 +1422,7 @@ vpif_init_free_channel_objects:
*/
static __init int vpif_probe(struct platform_device *pdev)
{
- const struct subdev_info *subdevdata;
+ const struct vpif_subdev_info *subdevdata;
int i, j = 0, k, q, m, err = 0;
struct i2c_adapter *i2c_adap;
struct vpif_config *config;
diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c
index d12c8c890..9712f9bd3 100644
--- a/linux/drivers/media/video/em28xx/em28xx-cards.c
+++ b/linux/drivers/media/video/em28xx/em28xx-cards.c
@@ -314,6 +314,7 @@ struct em28xx_board em28xx_boards[] = {
[EM2820_BOARD_TERRATEC_CINERGY_250] = {
.name = "Terratec Cinergy 250 USB",
.tuner_type = TUNER_LG_PAL_NEW_TAPC,
+ .has_ir_i2c = 1,
.tda9887_conf = TDA9887_PRESENT,
.decoder = EM28XX_SAA711X,
.input = { {
@@ -333,6 +334,7 @@ struct em28xx_board em28xx_boards[] = {
[EM2820_BOARD_PINNACLE_USB_2] = {
.name = "Pinnacle PCTV USB 2",
.tuner_type = TUNER_LG_PAL_NEW_TAPC,
+ .has_ir_i2c = 1,
.tda9887_conf = TDA9887_PRESENT,
.decoder = EM28XX_SAA711X,
.input = { {
@@ -357,6 +359,7 @@ struct em28xx_board em28xx_boards[] = {
TDA9887_PORT2_ACTIVE,
.decoder = EM28XX_TVP5150,
.has_msp34xx = 1,
+ .has_ir_i2c = 1,
.input = { {
.type = EM28XX_VMUX_TELEVISION,
.vmux = TVP5150_COMPOSITE0,
@@ -1004,6 +1007,7 @@ struct em28xx_board em28xx_boards[] = {
[EM2800_BOARD_TERRATEC_CINERGY_200] = {
.name = "Terratec Cinergy 200 USB",
.is_em2800 = 1,
+ .has_ir_i2c = 1,
.tuner_type = TUNER_LG_PAL_NEW_TAPC,
.tda9887_conf = TDA9887_PRESENT,
.decoder = EM28XX_SAA711X,
@@ -1077,7 +1081,8 @@ struct em28xx_board em28xx_boards[] = {
} },
},
[EM2820_BOARD_PINNACLE_DVC_90] = {
- .name = "Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker",
+ .name = "Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker "
+ "/ Kworld DVD Maker 2",
.tuner_type = TUNER_ABSENT, /* capture only board */
.decoder = EM28XX_SAA711X,
.input = { {
@@ -1682,6 +1687,8 @@ struct usb_device_id em28xx_id_table[] = {
.driver_info = EM2870_BOARD_KWORLD_355U },
{ USB_DEVICE(0x1b80, 0xe302),
.driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kaiser Baas Video to DVD maker */
+ { USB_DEVICE(0x1b80, 0xe304),
+ .driver_info = EM2820_BOARD_PINNACLE_DVC_90 }, /* Kworld DVD Maker 2 */
{ USB_DEVICE(0x0ccd, 0x0036),
.driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
{ USB_DEVICE(0x0ccd, 0x004c),
@@ -2292,12 +2299,8 @@ void em28xx_register_i2c_ir(struct em28xx *dev)
/* detect & configure */
switch (dev->model) {
- case (EM2800_BOARD_UNKNOWN):
- break;
- case (EM2820_BOARD_UNKNOWN):
- break;
- case (EM2800_BOARD_TERRATEC_CINERGY_200):
- case (EM2820_BOARD_TERRATEC_CINERGY_250):
+ case EM2800_BOARD_TERRATEC_CINERGY_200:
+ case EM2820_BOARD_TERRATEC_CINERGY_250:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
ir->ir_codes = &ir_codes_em_terratec_table;
ir->get_key = em28xx_get_key_terratec;
@@ -2309,7 +2312,7 @@ void em28xx_register_i2c_ir(struct em28xx *dev)
dev->init_data.name = "i2c IR (EM28XX Terratec)";
#endif
break;
- case (EM2820_BOARD_PINNACLE_USB_2):
+ case EM2820_BOARD_PINNACLE_USB_2:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
ir->ir_codes = &ir_codes_pinnacle_grey_table;
ir->get_key = em28xx_get_key_pinnacle_usb_grey;
@@ -2321,7 +2324,7 @@ void em28xx_register_i2c_ir(struct em28xx *dev)
dev->init_data.name = "i2c IR (EM28XX Pinnacle PCTV)";
#endif
break;
- case (EM2820_BOARD_HAUPPAUGE_WINTV_USB_2):
+ case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
ir->ir_codes = &ir_codes_hauppauge_new_table;
ir->get_key = em28xx_get_key_em_haup;
@@ -2333,14 +2336,6 @@ void em28xx_register_i2c_ir(struct em28xx *dev)
dev->init_data.name = "i2c IR (EM2840 Hauppauge)";
#endif
break;
- case (EM2820_BOARD_MSI_VOX_USB_2):
- break;
- case (EM2800_BOARD_LEADTEK_WINFAST_USBII):
- break;
- case (EM2800_BOARD_KWORLD_USB2800):
- break;
- case (EM2800_BOARD_GRABBEEX_USB2800):
- break;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
@@ -2383,7 +2378,7 @@ void em28xx_card_setup(struct em28xx *dev)
case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
{
struct tveeprom tv;
-#ifdef CONFIG_MODULES
+#if defined(CONFIG_MODULES) && defined(MODULE)
request_module("tveeprom");
#endif
/* Call first TVeeprom */
@@ -2397,10 +2392,6 @@ void em28xx_card_setup(struct em28xx *dev)
dev->i2s_speed = 2048000;
dev->board.has_msp34xx = 1;
}
-#ifdef CONFIG_MODULES
- if (tv.has_ir)
- request_module("ir-kbd-i2c");
-#endif
break;
}
case EM2882_BOARD_KWORLD_ATSC_315U:
@@ -2441,6 +2432,10 @@ void em28xx_card_setup(struct em28xx *dev)
break;
}
+#if defined(CONFIG_MODULES) && defined(MODULE)
+ if (dev->board.has_ir_i2c && !disable_ir)
+ request_module("ir-kbd-i2c");
+#endif
if (dev->board.has_snapshot_button)
em28xx_register_snapshot_button(dev);
diff --git a/linux/drivers/media/video/em28xx/em28xx.h b/linux/drivers/media/video/em28xx/em28xx.h
index e5d6b0695..3614402da 100644
--- a/linux/drivers/media/video/em28xx/em28xx.h
+++ b/linux/drivers/media/video/em28xx/em28xx.h
@@ -401,6 +401,7 @@ struct em28xx_board {
unsigned int is_webcam:1;
unsigned int no_audio:1;
unsigned int valid:1;
+ unsigned int has_ir_i2c:1;
unsigned char xclk, i2c_speed;
unsigned char radio_addr;
@@ -607,9 +608,11 @@ struct em28xx {
struct em28xx_dvb *dvb;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
/* I2C keyboard data */
struct i2c_board_info info;
struct IR_i2c_init_data init_data;
+#endif
};
struct em28xx_ops {
diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h
index d01281d1e..1bf2837b4 100644
--- a/linux/drivers/media/video/saa7134/saa7134.h
+++ b/linux/drivers/media/video/saa7134/saa7134.h
@@ -595,8 +595,10 @@ struct saa7134_dev {
unsigned int insuspend;
/* I2C keyboard data */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
struct i2c_board_info info;
struct IR_i2c_init_data init_data;
+#endif
/* SAA7134_MPEG_* */
struct saa7134_ts ts;
diff --git a/linux/drivers/media/video/videobuf-dma-contig.c b/linux/drivers/media/video/videobuf-dma-contig.c
index 633a124cf..bd1b13e93 100644
--- a/linux/drivers/media/video/videobuf-dma-contig.c
+++ b/linux/drivers/media/video/videobuf-dma-contig.c
@@ -17,6 +17,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
+#include <linux/pagemap.h>
#include <linux/dma-mapping.h>
#include <media/videobuf-dma-contig.h>
#include "compat.h"
@@ -26,6 +27,7 @@ struct videobuf_dma_contig_memory {
void *vaddr;
dma_addr_t dma_handle;
unsigned long size;
+ int is_userptr;
};
#define MAGIC_DC_MEM 0x0733ac61
@@ -109,6 +111,82 @@ static struct vm_operations_struct videobuf_vm_ops = {
.close = videobuf_vm_close,
};
+/**
+ * videobuf_dma_contig_user_put() - reset pointer to user space buffer
+ * @mem: per-buffer private videobuf-dma-contig data
+ *
+ * This function resets the user space pointer
+ */
+static void videobuf_dma_contig_user_put(struct videobuf_dma_contig_memory *mem)
+{
+ mem->is_userptr = 0;
+ mem->dma_handle = 0;
+ mem->size = 0;
+}
+
+/**
+ * videobuf_dma_contig_user_get() - setup user space memory pointer
+ * @mem: per-buffer private videobuf-dma-contig data
+ * @vb: video buffer to map
+ *
+ * This function validates and sets up a pointer to user space memory.
+ * Only physically contiguous pfn-mapped memory is accepted.
+ *
+ * Returns 0 if successful.
+ */
+static int videobuf_dma_contig_user_get(struct videobuf_dma_contig_memory *mem,
+ struct videobuf_buffer *vb)
+{
+ struct mm_struct *mm = current->mm;
+ struct vm_area_struct *vma;
+ unsigned long prev_pfn, this_pfn;
+ unsigned long pages_done, user_address;
+ int ret;
+
+ mem->size = PAGE_ALIGN(vb->size);
+ mem->is_userptr = 0;
+ ret = -EINVAL;
+
+ down_read(&mm->mmap_sem);
+
+ vma = find_vma(mm, vb->baddr);
+ if (!vma)
+ goto out_up;
+
+ if ((vb->baddr + mem->size) > vma->vm_end)
+ goto out_up;
+
+ pages_done = 0;
+ prev_pfn = 0; /* kill warning */
+ user_address = vb->baddr;
+
+ while (pages_done < (mem->size >> PAGE_SHIFT)) {
+ ret = follow_pfn(vma, user_address, &this_pfn);
+ if (ret)
+ break;
+
+ if (pages_done == 0)
+ mem->dma_handle = this_pfn << PAGE_SHIFT;
+ else if (this_pfn != (prev_pfn + 1))
+ ret = -EFAULT;
+
+ if (ret)
+ break;
+
+ prev_pfn = this_pfn;
+ user_address += PAGE_SIZE;
+ pages_done++;
+ }
+
+ if (!ret)
+ mem->is_userptr = 1;
+
+ out_up:
+ up_read(&current->mm->mmap_sem);
+
+ return ret;
+}
+
static void *__videobuf_alloc(size_t size)
{
struct videobuf_dma_contig_memory *mem;
@@ -155,12 +233,11 @@ static int __videobuf_iolock(struct videobuf_queue *q,
case V4L2_MEMORY_USERPTR:
dev_dbg(q->dev, "%s memory method USERPTR\n", __func__);
- /* The only USERPTR currently supported is the one needed for
- read() method.
- */
+ /* handle pointer from user space */
if (vb->baddr)
- return -EINVAL;
+ return videobuf_dma_contig_user_get(mem, vb);
+ /* allocate memory for the read() method */
mem->size = PAGE_ALIGN(vb->size);
mem->vaddr = dma_alloc_coherent(q->dev, mem->size,
&mem->dma_handle, GFP_KERNEL);
@@ -387,7 +464,7 @@ void videobuf_dma_contig_free(struct videobuf_queue *q,
So, it should free memory only if the memory were allocated for
read() operation.
*/
- if ((buf->memory != V4L2_MEMORY_USERPTR) || buf->baddr)
+ if (buf->memory != V4L2_MEMORY_USERPTR)
return;
if (!mem)
@@ -395,6 +472,13 @@ void videobuf_dma_contig_free(struct videobuf_queue *q,
MAGIC_CHECK(mem->magic, MAGIC_DC_MEM);
+ /* handle user space pointer case */
+ if (buf->baddr) {
+ videobuf_dma_contig_user_put(mem);
+ return;
+ }
+
+ /* read() method */
dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle);
mem->vaddr = NULL;
}