aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-11 15:57:16 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-11 15:57:16 -0400
commit57a44415beee38d1afcd8e1b5fad66f3414d2dac (patch)
tree365eada15165e37e153b6d304142db16f251438b /drivers/media/video/pvrusb2
parent2a383c63ff933a496f19d6559ab54ac14871b7f3 (diff)
parentbbe2486fe3bd6c7cffaf4123b7e86a55c209ed44 (diff)
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (44 commits) V4L/DVB (5571): V4l1-compat: Make VIDIOCSPICT return errors in a useful way V4L/DVB (5624): Radio-maestro.c cleanup V4L/DVB (5623): Dsbr100.c Replace usb_dsbr100_do_ioctl to use video_ioctl2 V4L/DVB (5622): Radio-zoltrix.c cleanup V4L/DVB (5621): Radio-cadet.c Replace cadet_do_ioctl to use video_ioctl2 V4L/DVB (5619): Dvb-usb: fix typo V4L/DVB (5618): Cx88: Drop the generic i2c client from cx88-vp3054-i2c V4L/DVB (5617): V4L2: videodev, allow debugging V4L/DVB (5614): M920x: Disable second adapter on LifeView TV Walker Twin V4L/DVB (5613): M920x: loosen up 80-col limit V4L/DVB (5612): M920x: rename function prefixes from m9206_foo to m920x_foo V4L/DVB (5611): M920x: replace deb_rc with deb V4L/DVB (5610): M920x: remove duplicated code V4L/DVB (5609): M920x: group like functions together V4L/DVB (5608): M920x: various whitespace cleanups V4L/DVB (5607): M920x: Initial support for devices likely manufactured by Dposh V4L/DVB (5606): M920x: add "c-basic-offset: 8" to help emacs to enforce tabbing V4L/DVB (5605): M920x: Add support for LifeView TV Walker Twin V4L/DVB (5603): V4L: Prevent queueing queued buffers. V4L/DVB (5602): Enable DiSEqC in Starbox II (vp7021a) ...
Diffstat (limited to 'drivers/media/video/pvrusb2')
-rw-r--r--drivers/media/video/pvrusb2/Kconfig2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-encoder.c13
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c10
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c23
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c14
5 files changed, 38 insertions, 24 deletions
diff --git a/drivers/media/video/pvrusb2/Kconfig b/drivers/media/video/pvrusb2/Kconfig
index 5645c9318890..d0c2cd785430 100644
--- a/drivers/media/video/pvrusb2/Kconfig
+++ b/drivers/media/video/pvrusb2/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_PVRUSB2 1config VIDEO_PVRUSB2
2 tristate "Hauppauge WinTV-PVR USB2 support" 2 tristate "Hauppauge WinTV-PVR USB2 support"
3 depends on VIDEO_V4L2 && USB && I2C && EXPERIMENTAL 3 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
4 select FW_LOADER 4 select FW_LOADER
5 select VIDEO_TUNER 5 select VIDEO_TUNER
6 select VIDEO_TVEEPROM 6 select VIDEO_TVEEPROM
diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c
index 5669c8ca9ca3..20b614436d2c 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c
@@ -391,22 +391,29 @@ static int pvr2_encoder_prep_config(struct pvr2_hdw *hdw)
391int pvr2_encoder_configure(struct pvr2_hdw *hdw) 391int pvr2_encoder_configure(struct pvr2_hdw *hdw)
392{ 392{
393 int ret; 393 int ret;
394 int val;
394 pvr2_trace(PVR2_TRACE_ENCODER,"pvr2_encoder_configure" 395 pvr2_trace(PVR2_TRACE_ENCODER,"pvr2_encoder_configure"
395 " (cx2341x module)"); 396 " (cx2341x module)");
396 hdw->enc_ctl_state.port = CX2341X_PORT_STREAMING; 397 hdw->enc_ctl_state.port = CX2341X_PORT_STREAMING;
397 hdw->enc_ctl_state.width = hdw->res_hor_val; 398 hdw->enc_ctl_state.width = hdw->res_hor_val;
398 hdw->enc_ctl_state.height = hdw->res_ver_val; 399 hdw->enc_ctl_state.height = hdw->res_ver_val;
399 hdw->enc_ctl_state.is_50hz = ((hdw->std_mask_cur & 400 hdw->enc_ctl_state.is_50hz = ((hdw->std_mask_cur & V4L2_STD_525_60) ?
400 (V4L2_STD_NTSC|V4L2_STD_PAL_M)) ?
401 0 : 1); 401 0 : 1);
402 402
403 ret = 0; 403 ret = 0;
404 404
405 ret |= pvr2_encoder_prep_config(hdw); 405 ret |= pvr2_encoder_prep_config(hdw);
406 406
407 /* saa7115: 0xf0 */
408 val = 0xf0;
409 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) {
410 /* ivtv cx25840: 0x140 */
411 val = 0x140;
412 }
413
407 if (!ret) ret = pvr2_encoder_vcmd( 414 if (!ret) ret = pvr2_encoder_vcmd(
408 hdw,CX2341X_ENC_SET_NUM_VSYNC_LINES, 2, 415 hdw,CX2341X_ENC_SET_NUM_VSYNC_LINES, 2,
409 0xf0, 0xf0); 416 val, val);
410 417
411 /* setup firmware to notify us about some events (don't know why...) */ 418 /* setup firmware to notify us about some events (don't know why...) */
412 if (!ret) ret = pvr2_encoder_vcmd( 419 if (!ret) ret = pvr2_encoder_vcmd(
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index acf651e01f94..1311891e7ee3 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -83,7 +83,7 @@ static struct pvr2_string_table pvr2_client_lists[] = {
83}; 83};
84 84
85static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; 85static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL};
86static DECLARE_MUTEX(pvr2_unit_sem); 86static DEFINE_MUTEX(pvr2_unit_mtx);
87 87
88static int ctlchg = 0; 88static int ctlchg = 0;
89static int initusbreset = 1; 89static int initusbreset = 1;
@@ -2076,14 +2076,14 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
2076 hdw->ctl_read_urb = usb_alloc_urb(0,GFP_KERNEL); 2076 hdw->ctl_read_urb = usb_alloc_urb(0,GFP_KERNEL);
2077 if (!hdw->ctl_read_urb) goto fail; 2077 if (!hdw->ctl_read_urb) goto fail;
2078 2078
2079 down(&pvr2_unit_sem); do { 2079 mutex_lock(&pvr2_unit_mtx); do {
2080 for (idx = 0; idx < PVR_NUM; idx++) { 2080 for (idx = 0; idx < PVR_NUM; idx++) {
2081 if (unit_pointers[idx]) continue; 2081 if (unit_pointers[idx]) continue;
2082 hdw->unit_number = idx; 2082 hdw->unit_number = idx;
2083 unit_pointers[idx] = hdw; 2083 unit_pointers[idx] = hdw;
2084 break; 2084 break;
2085 } 2085 }
2086 } while (0); up(&pvr2_unit_sem); 2086 } while (0); mutex_unlock(&pvr2_unit_mtx);
2087 2087
2088 cnt1 = 0; 2088 cnt1 = 0;
2089 cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2"); 2089 cnt2 = scnprintf(hdw->name+cnt1,sizeof(hdw->name)-cnt1,"pvrusb2");
@@ -2186,13 +2186,13 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)
2186 } 2186 }
2187 pvr2_i2c_core_done(hdw); 2187 pvr2_i2c_core_done(hdw);
2188 pvr2_hdw_remove_usb_stuff(hdw); 2188 pvr2_hdw_remove_usb_stuff(hdw);
2189 down(&pvr2_unit_sem); do { 2189 mutex_lock(&pvr2_unit_mtx); do {
2190 if ((hdw->unit_number >= 0) && 2190 if ((hdw->unit_number >= 0) &&
2191 (hdw->unit_number < PVR_NUM) && 2191 (hdw->unit_number < PVR_NUM) &&
2192 (unit_pointers[hdw->unit_number] == hdw)) { 2192 (unit_pointers[hdw->unit_number] == hdw)) {
2193 unit_pointers[hdw->unit_number] = NULL; 2193 unit_pointers[hdw->unit_number] = NULL;
2194 } 2194 }
2195 } while (0); up(&pvr2_unit_sem); 2195 } while (0); mutex_unlock(&pvr2_unit_mtx);
2196 kfree(hdw->controls); 2196 kfree(hdw->controls);
2197 kfree(hdw->mpeg_ctrl_info); 2197 kfree(hdw->mpeg_ctrl_info);
2198 kfree(hdw->std_defs); 2198 kfree(hdw->std_defs);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 58fc3c730fe1..6786d3c0c98b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -23,6 +23,7 @@
23#include "pvrusb2-hdw-internal.h" 23#include "pvrusb2-hdw-internal.h"
24#include "pvrusb2-debug.h" 24#include "pvrusb2-debug.h"
25#include "pvrusb2-fx2-cmd.h" 25#include "pvrusb2-fx2-cmd.h"
26#include "pvrusb2.h"
26 27
27#define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__) 28#define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__)
28 29
@@ -38,6 +39,10 @@ static unsigned int i2c_scan = 0;
38module_param(i2c_scan, int, S_IRUGO|S_IWUSR); 39module_param(i2c_scan, int, S_IRUGO|S_IWUSR);
39MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); 40MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
40 41
42static int ir_mode[PVR_NUM] = { [0 ... PVR_NUM-1] = 1 };
43module_param_array(ir_mode, int, NULL, 0444);
44MODULE_PARM_DESC(ir_mode,"specify: 0=disable IR reception, 1=normal IR");
45
41static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp, 46static unsigned int pvr2_i2c_client_describe(struct pvr2_i2c_client *cp,
42 unsigned int detail, 47 unsigned int detail,
43 char *buf,unsigned int maxlen); 48 char *buf,unsigned int maxlen);
@@ -273,6 +278,15 @@ static int i2c_hack_wm8775(struct pvr2_hdw *hdw,
273 return pvr2_i2c_basic_op(hdw,i2c_addr,wdata,wlen,rdata,rlen); 278 return pvr2_i2c_basic_op(hdw,i2c_addr,wdata,wlen,rdata,rlen);
274} 279}
275 280
281/* This is an entry point designed to always fail any attempt to perform a
282 transfer. We use this to cause certain I2C addresses to not be
283 probed. */
284static int i2c_black_hole(struct pvr2_hdw *hdw,
285 u8 i2c_addr,u8 *wdata,u16 wlen,u8 *rdata,u16 rlen)
286{
287 return -EIO;
288}
289
276/* This is a special entry point that is entered if an I2C operation is 290/* This is a special entry point that is entered if an I2C operation is
277 attempted to a cx25840 chip on model 24xxx hardware. This chip can 291 attempted to a cx25840 chip on model 24xxx hardware. This chip can
278 sometimes wedge itself. Worse still, when this happens msp3400 can 292 sometimes wedge itself. Worse still, when this happens msp3400 can
@@ -994,10 +1008,17 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
994 } 1008 }
995 1009
996 /* However, deal with various special cases for 24xxx hardware. */ 1010 /* However, deal with various special cases for 24xxx hardware. */
1011 if (ir_mode[hdw->unit_number] == 0) {
1012 printk(KERN_INFO "%s: IR disabled\n",hdw->name);
1013 hdw->i2c_func[0x18] = i2c_black_hole;
1014 } else if (ir_mode[hdw->unit_number] == 1) {
1015 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) {
1016 hdw->i2c_func[0x18] = i2c_24xxx_ir;
1017 }
1018 }
997 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { 1019 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) {
998 hdw->i2c_func[0x1b] = i2c_hack_wm8775; 1020 hdw->i2c_func[0x1b] = i2c_hack_wm8775;
999 hdw->i2c_func[0x44] = i2c_hack_cx25840; 1021 hdw->i2c_func[0x44] = i2c_hack_cx25840;
1000 hdw->i2c_func[0x18] = i2c_24xxx_ir;
1001 } 1022 }
1002 1023
1003 // Configure the adapter and set up everything else related to it. 1024 // Configure the adapter and set up everything else related to it.
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index a741c556a39a..7ab79baa1c8c 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -518,40 +518,32 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id)
518 } 518 }
519 sfp->item_last = cip; 519 sfp->item_last = cip;
520 520
521 cip->attr_name.attr.owner = THIS_MODULE;
522 cip->attr_name.attr.name = "name"; 521 cip->attr_name.attr.name = "name";
523 cip->attr_name.attr.mode = S_IRUGO; 522 cip->attr_name.attr.mode = S_IRUGO;
524 cip->attr_name.show = fp->show_name; 523 cip->attr_name.show = fp->show_name;
525 524
526 cip->attr_type.attr.owner = THIS_MODULE;
527 cip->attr_type.attr.name = "type"; 525 cip->attr_type.attr.name = "type";
528 cip->attr_type.attr.mode = S_IRUGO; 526 cip->attr_type.attr.mode = S_IRUGO;
529 cip->attr_type.show = fp->show_type; 527 cip->attr_type.show = fp->show_type;
530 528
531 cip->attr_min.attr.owner = THIS_MODULE;
532 cip->attr_min.attr.name = "min_val"; 529 cip->attr_min.attr.name = "min_val";
533 cip->attr_min.attr.mode = S_IRUGO; 530 cip->attr_min.attr.mode = S_IRUGO;
534 cip->attr_min.show = fp->show_min; 531 cip->attr_min.show = fp->show_min;
535 532
536 cip->attr_max.attr.owner = THIS_MODULE;
537 cip->attr_max.attr.name = "max_val"; 533 cip->attr_max.attr.name = "max_val";
538 cip->attr_max.attr.mode = S_IRUGO; 534 cip->attr_max.attr.mode = S_IRUGO;
539 cip->attr_max.show = fp->show_max; 535 cip->attr_max.show = fp->show_max;
540 536
541 cip->attr_val.attr.owner = THIS_MODULE;
542 cip->attr_val.attr.name = "cur_val"; 537 cip->attr_val.attr.name = "cur_val";
543 cip->attr_val.attr.mode = S_IRUGO; 538 cip->attr_val.attr.mode = S_IRUGO;
544 539
545 cip->attr_custom.attr.owner = THIS_MODULE;
546 cip->attr_custom.attr.name = "custom_val"; 540 cip->attr_custom.attr.name = "custom_val";
547 cip->attr_custom.attr.mode = S_IRUGO; 541 cip->attr_custom.attr.mode = S_IRUGO;
548 542
549 cip->attr_enum.attr.owner = THIS_MODULE;
550 cip->attr_enum.attr.name = "enum_val"; 543 cip->attr_enum.attr.name = "enum_val";
551 cip->attr_enum.attr.mode = S_IRUGO; 544 cip->attr_enum.attr.mode = S_IRUGO;
552 cip->attr_enum.show = fp->show_enum; 545 cip->attr_enum.show = fp->show_enum;
553 546
554 cip->attr_bits.attr.owner = THIS_MODULE;
555 cip->attr_bits.attr.name = "bit_val"; 547 cip->attr_bits.attr.name = "bit_val";
556 cip->attr_bits.attr.mode = S_IRUGO; 548 cip->attr_bits.attr.mode = S_IRUGO;
557 cip->attr_bits.show = fp->show_bits; 549 cip->attr_bits.show = fp->show_bits;
@@ -616,12 +608,10 @@ static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp)
616 608
617 dip = kzalloc(sizeof(*dip),GFP_KERNEL); 609 dip = kzalloc(sizeof(*dip),GFP_KERNEL);
618 if (!dip) return; 610 if (!dip) return;
619 dip->attr_debugcmd.attr.owner = THIS_MODULE;
620 dip->attr_debugcmd.attr.name = "debugcmd"; 611 dip->attr_debugcmd.attr.name = "debugcmd";
621 dip->attr_debugcmd.attr.mode = S_IRUGO|S_IWUSR|S_IWGRP; 612 dip->attr_debugcmd.attr.mode = S_IRUGO|S_IWUSR|S_IWGRP;
622 dip->attr_debugcmd.show = debugcmd_show; 613 dip->attr_debugcmd.show = debugcmd_show;
623 dip->attr_debugcmd.store = debugcmd_store; 614 dip->attr_debugcmd.store = debugcmd_store;
624 dip->attr_debuginfo.attr.owner = THIS_MODULE;
625 dip->attr_debuginfo.attr.name = "debuginfo"; 615 dip->attr_debuginfo.attr.name = "debuginfo";
626 dip->attr_debuginfo.attr.mode = S_IRUGO; 616 dip->attr_debuginfo.attr.mode = S_IRUGO;
627 dip->attr_debuginfo.show = debuginfo_show; 617 dip->attr_debuginfo.show = debuginfo_show;
@@ -811,7 +801,6 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
811 return; 801 return;
812 } 802 }
813 803
814 sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE;
815 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; 804 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number";
816 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; 805 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO;
817 sfp->attr_v4l_minor_number.show = v4l_minor_number_show; 806 sfp->attr_v4l_minor_number.show = v4l_minor_number_show;
@@ -825,7 +814,6 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
825 sfp->v4l_minor_number_created_ok = !0; 814 sfp->v4l_minor_number_created_ok = !0;
826 } 815 }
827 816
828 sfp->attr_v4l_radio_minor_number.attr.owner = THIS_MODULE;
829 sfp->attr_v4l_radio_minor_number.attr.name = "v4l_radio_minor_number"; 817 sfp->attr_v4l_radio_minor_number.attr.name = "v4l_radio_minor_number";
830 sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO; 818 sfp->attr_v4l_radio_minor_number.attr.mode = S_IRUGO;
831 sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show; 819 sfp->attr_v4l_radio_minor_number.show = v4l_radio_minor_number_show;
@@ -839,7 +827,6 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
839 sfp->v4l_radio_minor_number_created_ok = !0; 827 sfp->v4l_radio_minor_number_created_ok = !0;
840 } 828 }
841 829
842 sfp->attr_unit_number.attr.owner = THIS_MODULE;
843 sfp->attr_unit_number.attr.name = "unit_number"; 830 sfp->attr_unit_number.attr.name = "unit_number";
844 sfp->attr_unit_number.attr.mode = S_IRUGO; 831 sfp->attr_unit_number.attr.mode = S_IRUGO;
845 sfp->attr_unit_number.show = unit_number_show; 832 sfp->attr_unit_number.show = unit_number_show;
@@ -852,7 +839,6 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
852 sfp->unit_number_created_ok = !0; 839 sfp->unit_number_created_ok = !0;
853 } 840 }
854 841
855 sfp->attr_bus_info.attr.owner = THIS_MODULE;
856 sfp->attr_bus_info.attr.name = "bus_info_str"; 842 sfp->attr_bus_info.attr.name = "bus_info_str";
857 sfp->attr_bus_info.attr.mode = S_IRUGO; 843 sfp->attr_bus_info.attr.mode = S_IRUGO;
858 sfp->attr_bus_info.show = bus_info_show; 844 sfp->attr_bus_info.show = bus_info_show;