aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt8xx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/bt8xx')
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c27
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c66
-rw-r--r--drivers/media/video/bt8xx/bttv-input.c62
-rw-r--r--drivers/media/video/bt8xx/bttv.h2
4 files changed, 124 insertions, 33 deletions
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index 6081edc362df..13742b0bbe3e 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -305,7 +305,7 @@ static struct CARD {
305 { 0x00261822, BTTV_BOARD_TWINHAN_DST, "DNTV Live! Mini "}, 305 { 0x00261822, BTTV_BOARD_TWINHAN_DST, "DNTV Live! Mini "},
306 { 0xd200dbc0, BTTV_BOARD_DVICO_FUSIONHDTV_2, "DViCO FusionHDTV 2" }, 306 { 0xd200dbc0, BTTV_BOARD_DVICO_FUSIONHDTV_2, "DViCO FusionHDTV 2" },
307 { 0x763c008a, BTTV_BOARD_GEOVISION_GV600, "GeoVision GV-600" }, 307 { 0x763c008a, BTTV_BOARD_GEOVISION_GV600, "GeoVision GV-600" },
308 308 { 0x18011000, BTTV_BOARD_ENLTV_FM_2, "Encore ENL TV-FM-2" },
309 { 0, -1, NULL } 309 { 0, -1, NULL }
310}; 310};
311 311
@@ -3037,6 +3037,31 @@ struct tvcard bttv_tvcards[] = {
3037 .has_radio = 1, 3037 .has_radio = 1,
3038 .has_remote = 1, 3038 .has_remote = 1,
3039 }, 3039 },
3040 [BTTV_BOARD_ENLTV_FM_2] = {
3041 /* Encore TV Tuner Pro ENL TV-FM-2
3042 Mauro Carvalho Chehab <mchehab@infradead.org */
3043 .name = "Encore ENL TV-FM-2",
3044 .video_inputs = 3,
3045 .audio_inputs = 1,
3046 .tuner = 0,
3047 .svhs = 2,
3048 /* bit 6 -> IR disabled
3049 bit 18/17 = 00 -> mute
3050 01 -> enable external audio input
3051 10 -> internal audio input (mono?)
3052 11 -> internal audio input
3053 */
3054 .gpiomask = 0x060040,
3055 .muxsel = { 2, 3, 3 },
3056 .gpiomux = { 0x60000, 0x60000, 0x20000, 0x20000 },
3057 .gpiomute = 0,
3058 .tuner_type = TUNER_TCL_MF02GIP_5N,
3059 .tuner_addr = ADDR_UNSET,
3060 .radio_addr = ADDR_UNSET,
3061 .pll = PLL_28,
3062 .has_radio = 1,
3063 .has_remote = 1,
3064 }
3040}; 3065};
3041 3066
3042static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); 3067static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 933eaef41ead..5858bf5ff41c 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -76,9 +76,9 @@ static unsigned int gbuffers = 8;
76static unsigned int gbufsize = 0x208000; 76static unsigned int gbufsize = 0x208000;
77static unsigned int reset_crop = 1; 77static unsigned int reset_crop = 1;
78 78
79static int video_nr = -1; 79static int video_nr[BTTV_MAX] = { [0 ... (BTTV_MAX-1)] = -1 };
80static int radio_nr = -1; 80static int radio_nr[BTTV_MAX] = { [0 ... (BTTV_MAX-1)] = -1 };
81static int vbi_nr = -1; 81static int vbi_nr[BTTV_MAX] = { [0 ... (BTTV_MAX-1)] = -1 };
82static int debug_latency; 82static int debug_latency;
83 83
84static unsigned int fdsr; 84static unsigned int fdsr;
@@ -108,9 +108,6 @@ module_param(irq_debug, int, 0644);
108module_param(debug_latency, int, 0644); 108module_param(debug_latency, int, 0644);
109 109
110module_param(fdsr, int, 0444); 110module_param(fdsr, int, 0444);
111module_param(video_nr, int, 0444);
112module_param(radio_nr, int, 0444);
113module_param(vbi_nr, int, 0444);
114module_param(gbuffers, int, 0444); 111module_param(gbuffers, int, 0444);
115module_param(gbufsize, int, 0444); 112module_param(gbufsize, int, 0444);
116module_param(reset_crop, int, 0444); 113module_param(reset_crop, int, 0444);
@@ -130,7 +127,10 @@ module_param(uv_ratio, int, 0444);
130module_param(full_luma_range, int, 0444); 127module_param(full_luma_range, int, 0444);
131module_param(coring, int, 0444); 128module_param(coring, int, 0444);
132 129
133module_param_array(radio, int, NULL, 0444); 130module_param_array(radio, int, NULL, 0444);
131module_param_array(video_nr, int, NULL, 0444);
132module_param_array(radio_nr, int, NULL, 0444);
133module_param_array(vbi_nr, int, NULL, 0444);
134 134
135MODULE_PARM_DESC(radio,"The TV card supports radio, default is 0 (no)"); 135MODULE_PARM_DESC(radio,"The TV card supports radio, default is 0 (no)");
136MODULE_PARM_DESC(bigendian,"byte order of the framebuffer, default is native endian"); 136MODULE_PARM_DESC(bigendian,"byte order of the framebuffer, default is native endian");
@@ -152,6 +152,9 @@ MODULE_PARM_DESC(irq_iswitch,"switch inputs in irq handler");
152MODULE_PARM_DESC(uv_ratio,"ratio between u and v gains, default is 50"); 152MODULE_PARM_DESC(uv_ratio,"ratio between u and v gains, default is 50");
153MODULE_PARM_DESC(full_luma_range,"use the full luma range, default is 0 (no)"); 153MODULE_PARM_DESC(full_luma_range,"use the full luma range, default is 0 (no)");
154MODULE_PARM_DESC(coring,"set the luma coring level, default is 0 (no)"); 154MODULE_PARM_DESC(coring,"set the luma coring level, default is 0 (no)");
155MODULE_PARM_DESC(video_nr, "video device numbers");
156MODULE_PARM_DESC(vbi_nr, "vbi device numbers");
157MODULE_PARM_DESC(radio_nr, "radio device numbers");
155 158
156MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards"); 159MODULE_DESCRIPTION("bttv - v4l/v4l2 driver module for bt848/878 based cards");
157MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr"); 160MODULE_AUTHOR("Ralph Metzler & Marcus Metzler & Gerd Knorr");
@@ -1367,7 +1370,7 @@ static void init_irqreg(struct bttv *btv)
1367 (btv->gpioirq ? BT848_INT_GPINT : 0) | 1370 (btv->gpioirq ? BT848_INT_GPINT : 0) |
1368 BT848_INT_SCERR | 1371 BT848_INT_SCERR |
1369 (fdsr ? BT848_INT_FDSR : 0) | 1372 (fdsr ? BT848_INT_FDSR : 0) |
1370 BT848_INT_RISCI|BT848_INT_OCERR|BT848_INT_VPRES| 1373 BT848_INT_RISCI | BT848_INT_OCERR |
1371 BT848_INT_FMTCHG|BT848_INT_HLOCK| 1374 BT848_INT_FMTCHG|BT848_INT_HLOCK|
1372 BT848_INT_I2CDONE, 1375 BT848_INT_I2CDONE,
1373 BT848_INT_MASK); 1376 BT848_INT_MASK);
@@ -2661,18 +2664,6 @@ static int bttv_querycap(struct file *file, void *priv,
2661 return 0; 2664 return 0;
2662} 2665}
2663 2666
2664static int bttv_enum_fmt_vbi_cap(struct file *file, void *priv,
2665 struct v4l2_fmtdesc *f)
2666{
2667 if (0 != f->index)
2668 return -EINVAL;
2669
2670 f->pixelformat = V4L2_PIX_FMT_GREY;
2671 strcpy(f->description, "vbi data");
2672
2673 return 0;
2674}
2675
2676static int bttv_enum_fmt_cap_ovr(struct v4l2_fmtdesc *f) 2667static int bttv_enum_fmt_cap_ovr(struct v4l2_fmtdesc *f)
2677{ 2668{
2678 int index = -1, i; 2669 int index = -1, i;
@@ -3227,6 +3218,7 @@ static int bttv_open(struct inode *inode, struct file *file)
3227 3218
3228 dprintk(KERN_DEBUG "bttv: open minor=%d\n",minor); 3219 dprintk(KERN_DEBUG "bttv: open minor=%d\n",minor);
3229 3220
3221 lock_kernel();
3230 for (i = 0; i < bttv_num; i++) { 3222 for (i = 0; i < bttv_num; i++) {
3231 if (bttvs[i].video_dev && 3223 if (bttvs[i].video_dev &&
3232 bttvs[i].video_dev->minor == minor) { 3224 bttvs[i].video_dev->minor == minor) {
@@ -3241,16 +3233,20 @@ static int bttv_open(struct inode *inode, struct file *file)
3241 break; 3233 break;
3242 } 3234 }
3243 } 3235 }
3244 if (NULL == btv) 3236 if (NULL == btv) {
3237 unlock_kernel();
3245 return -ENODEV; 3238 return -ENODEV;
3239 }
3246 3240
3247 dprintk(KERN_DEBUG "bttv%d: open called (type=%s)\n", 3241 dprintk(KERN_DEBUG "bttv%d: open called (type=%s)\n",
3248 btv->c.nr,v4l2_type_names[type]); 3242 btv->c.nr,v4l2_type_names[type]);
3249 3243
3250 /* allocate per filehandle data */ 3244 /* allocate per filehandle data */
3251 fh = kmalloc(sizeof(*fh),GFP_KERNEL); 3245 fh = kmalloc(sizeof(*fh),GFP_KERNEL);
3252 if (NULL == fh) 3246 if (NULL == fh) {
3247 unlock_kernel();
3253 return -ENOMEM; 3248 return -ENOMEM;
3249 }
3254 file->private_data = fh; 3250 file->private_data = fh;
3255 *fh = btv->init; 3251 *fh = btv->init;
3256 fh->type = type; 3252 fh->type = type;
@@ -3270,6 +3266,7 @@ static int bttv_open(struct inode *inode, struct file *file)
3270 sizeof(struct bttv_buffer), 3266 sizeof(struct bttv_buffer),
3271 fh); 3267 fh);
3272 set_tvnorm(btv,btv->tvnorm); 3268 set_tvnorm(btv,btv->tvnorm);
3269 set_input(btv, btv->input, btv->tvnorm);
3273 3270
3274 btv->users++; 3271 btv->users++;
3275 3272
@@ -3290,6 +3287,7 @@ static int bttv_open(struct inode *inode, struct file *file)
3290 bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); 3287 bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm);
3291 3288
3292 bttv_field_count(btv); 3289 bttv_field_count(btv);
3290 unlock_kernel();
3293 return 0; 3291 return 0;
3294} 3292}
3295 3293
@@ -3330,6 +3328,10 @@ static int bttv_release(struct inode *inode, struct file *file)
3330 3328
3331 btv->users--; 3329 btv->users--;
3332 bttv_field_count(btv); 3330 bttv_field_count(btv);
3331
3332 if (!btv->users)
3333 audio_mute(btv, 1);
3334
3333 return 0; 3335 return 0;
3334} 3336}
3335 3337
@@ -3367,7 +3369,6 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = {
3367 .vidioc_g_fmt_vid_overlay = bttv_g_fmt_vid_overlay, 3369 .vidioc_g_fmt_vid_overlay = bttv_g_fmt_vid_overlay,
3368 .vidioc_try_fmt_vid_overlay = bttv_try_fmt_vid_overlay, 3370 .vidioc_try_fmt_vid_overlay = bttv_try_fmt_vid_overlay,
3369 .vidioc_s_fmt_vid_overlay = bttv_s_fmt_vid_overlay, 3371 .vidioc_s_fmt_vid_overlay = bttv_s_fmt_vid_overlay,
3370 .vidioc_enum_fmt_vbi_cap = bttv_enum_fmt_vbi_cap,
3371 .vidioc_g_fmt_vbi_cap = bttv_g_fmt_vbi_cap, 3372 .vidioc_g_fmt_vbi_cap = bttv_g_fmt_vbi_cap,
3372 .vidioc_try_fmt_vbi_cap = bttv_try_fmt_vbi_cap, 3373 .vidioc_try_fmt_vbi_cap = bttv_try_fmt_vbi_cap,
3373 .vidioc_s_fmt_vbi_cap = bttv_s_fmt_vbi_cap, 3374 .vidioc_s_fmt_vbi_cap = bttv_s_fmt_vbi_cap,
@@ -3430,21 +3431,26 @@ static int radio_open(struct inode *inode, struct file *file)
3430 3431
3431 dprintk("bttv: open minor=%d\n",minor); 3432 dprintk("bttv: open minor=%d\n",minor);
3432 3433
3434 lock_kernel();
3433 for (i = 0; i < bttv_num; i++) { 3435 for (i = 0; i < bttv_num; i++) {
3434 if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) { 3436 if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) {
3435 btv = &bttvs[i]; 3437 btv = &bttvs[i];
3436 break; 3438 break;
3437 } 3439 }
3438 } 3440 }
3439 if (NULL == btv) 3441 if (NULL == btv) {
3442 unlock_kernel();
3440 return -ENODEV; 3443 return -ENODEV;
3444 }
3441 3445
3442 dprintk("bttv%d: open called (radio)\n",btv->c.nr); 3446 dprintk("bttv%d: open called (radio)\n",btv->c.nr);
3443 3447
3444 /* allocate per filehandle data */ 3448 /* allocate per filehandle data */
3445 fh = kmalloc(sizeof(*fh), GFP_KERNEL); 3449 fh = kmalloc(sizeof(*fh), GFP_KERNEL);
3446 if (NULL == fh) 3450 if (NULL == fh) {
3451 unlock_kernel();
3447 return -ENOMEM; 3452 return -ENOMEM;
3453 }
3448 file->private_data = fh; 3454 file->private_data = fh;
3449 *fh = btv->init; 3455 *fh = btv->init;
3450 v4l2_prio_open(&btv->prio, &fh->prio); 3456 v4l2_prio_open(&btv->prio, &fh->prio);
@@ -3457,6 +3463,7 @@ static int radio_open(struct inode *inode, struct file *file)
3457 audio_input(btv,TVAUDIO_INPUT_RADIO); 3463 audio_input(btv,TVAUDIO_INPUT_RADIO);
3458 3464
3459 mutex_unlock(&btv->lock); 3465 mutex_unlock(&btv->lock);
3466 unlock_kernel();
3460 return 0; 3467 return 0;
3461} 3468}
3462 3469
@@ -4235,7 +4242,8 @@ static int __devinit bttv_register_video(struct bttv *btv)
4235 4242
4236 if (NULL == btv->video_dev) 4243 if (NULL == btv->video_dev)
4237 goto err; 4244 goto err;
4238 if (video_register_device(btv->video_dev,VFL_TYPE_GRABBER,video_nr)<0) 4245 if (video_register_device(btv->video_dev, VFL_TYPE_GRABBER,
4246 video_nr[btv->c.nr]) < 0)
4239 goto err; 4247 goto err;
4240 printk(KERN_INFO "bttv%d: registered device video%d\n", 4248 printk(KERN_INFO "bttv%d: registered device video%d\n",
4241 btv->c.nr,btv->video_dev->minor & 0x1f); 4249 btv->c.nr,btv->video_dev->minor & 0x1f);
@@ -4251,7 +4259,8 @@ static int __devinit bttv_register_video(struct bttv *btv)
4251 4259
4252 if (NULL == btv->vbi_dev) 4260 if (NULL == btv->vbi_dev)
4253 goto err; 4261 goto err;
4254 if (video_register_device(btv->vbi_dev,VFL_TYPE_VBI,vbi_nr)<0) 4262 if (video_register_device(btv->vbi_dev, VFL_TYPE_VBI,
4263 vbi_nr[btv->c.nr]) < 0)
4255 goto err; 4264 goto err;
4256 printk(KERN_INFO "bttv%d: registered device vbi%d\n", 4265 printk(KERN_INFO "bttv%d: registered device vbi%d\n",
4257 btv->c.nr,btv->vbi_dev->minor & 0x1f); 4266 btv->c.nr,btv->vbi_dev->minor & 0x1f);
@@ -4262,7 +4271,8 @@ static int __devinit bttv_register_video(struct bttv *btv)
4262 btv->radio_dev = vdev_init(btv, &radio_template, "radio"); 4271 btv->radio_dev = vdev_init(btv, &radio_template, "radio");
4263 if (NULL == btv->radio_dev) 4272 if (NULL == btv->radio_dev)
4264 goto err; 4273 goto err;
4265 if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,radio_nr)<0) 4274 if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,
4275 radio_nr[btv->c.nr]) < 0)
4266 goto err; 4276 goto err;
4267 printk(KERN_INFO "bttv%d: registered device radio%d\n", 4277 printk(KERN_INFO "bttv%d: registered device radio%d\n",
4268 btv->c.nr,btv->radio_dev->minor & 0x1f); 4278 btv->c.nr,btv->radio_dev->minor & 0x1f);
diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c
index a38af98f4cae..2f289d981fe6 100644
--- a/drivers/media/video/bt8xx/bttv-input.c
+++ b/drivers/media/video/bt8xx/bttv-input.c
@@ -28,8 +28,8 @@
28#include "bttvp.h" 28#include "bttvp.h"
29 29
30 30
31static int debug; 31static int ir_debug;
32module_param(debug, int, 0644); /* debug level (0,1,2) */ 32module_param(ir_debug, int, 0644);
33static int repeat_delay = 500; 33static int repeat_delay = 500;
34module_param(repeat_delay, int, 0644); 34module_param(repeat_delay, int, 0644);
35static int repeat_period = 33; 35static int repeat_period = 33;
@@ -40,6 +40,12 @@ module_param(ir_rc5_remote_gap, int, 0644);
40static int ir_rc5_key_timeout = 200; 40static int ir_rc5_key_timeout = 200;
41module_param(ir_rc5_key_timeout, int, 0644); 41module_param(ir_rc5_key_timeout, int, 0644);
42 42
43#undef dprintk
44#define dprintk(arg...) do { \
45 if (ir_debug >= 1) \
46 printk(arg); \
47} while (0)
48
43#define DEVNAME "bttv-input" 49#define DEVNAME "bttv-input"
44 50
45/* ---------------------------------------------------------------------- */ 51/* ---------------------------------------------------------------------- */
@@ -79,6 +85,45 @@ static void ir_handle_key(struct bttv *btv)
79 85
80} 86}
81 87
88static void ir_enltv_handle_key(struct bttv *btv)
89{
90 struct card_ir *ir = btv->remote;
91 u32 gpio, data, keyup;
92
93 /* read gpio value */
94 gpio = bttv_gpio_read(&btv->c);
95
96 /* extract data */
97 data = ir_extract_bits(gpio, ir->mask_keycode);
98
99 /* Check if it is keyup */
100 keyup = (gpio & ir->mask_keyup) ? 1 << 31 : 0;
101
102 if ((ir->last_gpio & 0x7f) != data) {
103 dprintk(KERN_INFO DEVNAME ": gpio=0x%x code=%d | %s\n",
104 gpio, data,
105 (gpio & ir->mask_keyup) ? " up" : "up/down");
106
107 ir_input_keydown(ir->dev, &ir->ir, data, data);
108 if (keyup)
109 ir_input_nokey(ir->dev, &ir->ir);
110 } else {
111 if ((ir->last_gpio & 1 << 31) == keyup)
112 return;
113
114 dprintk(KERN_INFO DEVNAME ":(cnt) gpio=0x%x code=%d | %s\n",
115 gpio, data,
116 (gpio & ir->mask_keyup) ? " up" : "down");
117
118 if (keyup)
119 ir_input_nokey(ir->dev, &ir->ir);
120 else
121 ir_input_keydown(ir->dev, &ir->ir, data, data);
122 }
123
124 ir->last_gpio = data | keyup;
125}
126
82void bttv_input_irq(struct bttv *btv) 127void bttv_input_irq(struct bttv *btv)
83{ 128{
84 struct card_ir *ir = btv->remote; 129 struct card_ir *ir = btv->remote;
@@ -92,7 +137,10 @@ static void bttv_input_timer(unsigned long data)
92 struct bttv *btv = (struct bttv*)data; 137 struct bttv *btv = (struct bttv*)data;
93 struct card_ir *ir = btv->remote; 138 struct card_ir *ir = btv->remote;
94 139
95 ir_handle_key(btv); 140 if (btv->c.type == BTTV_BOARD_ENLTV_FM_2)
141 ir_enltv_handle_key(btv);
142 else
143 ir_handle_key(btv);
96 mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling)); 144 mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling));
97} 145}
98 146
@@ -284,6 +332,14 @@ int bttv_input_init(struct bttv *btv)
284 ir->mask_keyup = 0x006000; 332 ir->mask_keyup = 0x006000;
285 ir->polling = 50; /* ms */ 333 ir->polling = 50; /* ms */
286 break; 334 break;
335 case BTTV_BOARD_ENLTV_FM_2:
336 ir_codes = ir_codes_encore_enltv2;
337 ir->mask_keycode = 0x00fd00;
338 ir->mask_keyup = 0x000080;
339 ir->polling = 1; /* ms */
340 ir->last_gpio = ir_extract_bits(bttv_gpio_read(&btv->c),
341 ir->mask_keycode);
342 break;
287 } 343 }
288 if (NULL == ir_codes) { 344 if (NULL == ir_codes) {
289 dprintk(KERN_INFO "Ooops: IR config error [card=%d]\n", btv->c.type); 345 dprintk(KERN_INFO "Ooops: IR config error [card=%d]\n", btv->c.type);
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index 6d93d16c96e4..46cb90e0985b 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -176,7 +176,7 @@
176#define BTTV_BOARD_TYPHOON_TVTUNERPCI 0x95 176#define BTTV_BOARD_TYPHOON_TVTUNERPCI 0x95
177#define BTTV_BOARD_GEOVISION_GV600 0x96 177#define BTTV_BOARD_GEOVISION_GV600 0x96
178#define BTTV_BOARD_KOZUMI_KTV_01C 0x97 178#define BTTV_BOARD_KOZUMI_KTV_01C 0x97
179 179#define BTTV_BOARD_ENLTV_FM_2 0x98
180 180
181/* more card-specific defines */ 181/* more card-specific defines */
182#define PT2254_L_CHANNEL 0x10 182#define PT2254_L_CHANNEL 0x10