aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/Kconfig1
-rw-r--r--drivers/media/video/bttv-cards.c1
-rw-r--r--drivers/media/video/bttv-i2c.c17
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c89
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c20
-rw-r--r--drivers/media/video/tuner-core.c14
-rw-r--r--drivers/media/video/video-buf-dvb.c12
7 files changed, 118 insertions, 36 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index d3dd4228b72d..6c05fddb69ab 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -240,6 +240,7 @@ config VIDEO_SAA7134
240 select VIDEO_BUF 240 select VIDEO_BUF
241 select VIDEO_IR 241 select VIDEO_IR
242 select VIDEO_TUNER 242 select VIDEO_TUNER
243 select CRC32
243 ---help--- 244 ---help---
244 This is a video4linux driver for Philips SAA7130/7134 based 245 This is a video4linux driver for Philips SAA7130/7134 based
245 TV cards. 246 TV cards.
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 85224b90e394..6334122704ae 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -1946,7 +1946,6 @@ struct tvcard bttv_tvcards[] = {
1946 .no_tda9875 = 1, 1946 .no_tda9875 = 1,
1947 .no_tda7432 = 1, 1947 .no_tda7432 = 1,
1948 .tuner_type = TUNER_ABSENT, 1948 .tuner_type = TUNER_ABSENT,
1949 .no_video = 1,
1950 .pll = PLL_28, 1949 .pll = PLL_28,
1951},{ 1950},{
1952 .name = "Teppro TEV-560/InterVision IV-560", 1951 .name = "Teppro TEV-560/InterVision IV-560",
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
index e42f1ec13f3e..c2368bc832ed 100644
--- a/drivers/media/video/bttv-i2c.c
+++ b/drivers/media/video/bttv-i2c.c
@@ -29,6 +29,7 @@
29#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/jiffies.h>
32#include <asm/io.h> 33#include <asm/io.h>
33 34
34#include "bttvp.h" 35#include "bttvp.h"
@@ -130,17 +131,14 @@ static u32 functionality(struct i2c_adapter *adap)
130static int 131static int
131bttv_i2c_wait_done(struct bttv *btv) 132bttv_i2c_wait_done(struct bttv *btv)
132{ 133{
133 DECLARE_WAITQUEUE(wait, current);
134 int rc = 0; 134 int rc = 0;
135 135
136 add_wait_queue(&btv->i2c_queue, &wait); 136 /* timeout */
137 if (0 == btv->i2c_done) 137 if (wait_event_interruptible_timeout(btv->i2c_queue,
138 msleep_interruptible(20); 138 btv->i2c_done, msecs_to_jiffies(85)) == -ERESTARTSYS)
139 remove_wait_queue(&btv->i2c_queue, &wait); 139
140 rc = -EIO;
140 141
141 if (0 == btv->i2c_done)
142 /* timeout */
143 rc = -EIO;
144 if (btv->i2c_done & BT848_INT_RACK) 142 if (btv->i2c_done & BT848_INT_RACK)
145 rc = 1; 143 rc = 1;
146 btv->i2c_done = 0; 144 btv->i2c_done = 0;
@@ -365,6 +363,9 @@ int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
365/* read EEPROM content */ 363/* read EEPROM content */
366void __devinit bttv_readee(struct bttv *btv, unsigned char *eedata, int addr) 364void __devinit bttv_readee(struct bttv *btv, unsigned char *eedata, int addr)
367{ 365{
366 memset(eedata, 0, 256);
367 if (0 != btv->i2c_rc)
368 return;
368 btv->i2c_client.addr = addr >> 1; 369 btv->i2c_client.addr = addr >> 1;
369 tveeprom_read(&btv->i2c_client, eedata, 256); 370 tveeprom_read(&btv->i2c_client, eedata, 256);
370} 371}
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index cee13584c9cf..1db022682980 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -32,9 +32,32 @@ MODULE_LICENSE("GPL");
32static struct i2c_driver driver; 32static struct i2c_driver driver;
33static struct i2c_client client_template; 33static struct i2c_client client_template;
34 34
35enum saa6752hs_videoformat {
36 SAA6752HS_VF_D1 = 0, /* standard D1 video format: 720x576 */
37 SAA6752HS_VF_2_3_D1 = 1,/* 2/3D1 video format: 480x576 */
38 SAA6752HS_VF_1_2_D1 = 2,/* 1/2D1 video format: 352x576 */
39 SAA6752HS_VF_SIF = 3, /* SIF video format: 352x288 */
40 SAA6752HS_VF_UNKNOWN,
41};
42
43static const struct v4l2_format v4l2_format_table[] =
44{
45 [SAA6752HS_VF_D1] = {
46 .fmt = { .pix = { .width = 720, .height = 576 }, }, },
47 [SAA6752HS_VF_2_3_D1] = {
48 .fmt = { .pix = { .width = 480, .height = 576 }, }, },
49 [SAA6752HS_VF_1_2_D1] = {
50 .fmt = { .pix = { .width = 352, .height = 576 }, }, },
51 [SAA6752HS_VF_SIF] = {
52 .fmt = { .pix = { .width = 352, .height = 288 }, }, },
53 [SAA6752HS_VF_UNKNOWN] = {
54 .fmt = { .pix = { .width = 0, .height = 0 }, }, },
55};
56
35struct saa6752hs_state { 57struct saa6752hs_state {
36 struct i2c_client client; 58 struct i2c_client client;
37 struct v4l2_mpeg_compression params; 59 struct v4l2_mpeg_compression params;
60 enum saa6752hs_videoformat video_format;
38}; 61};
39 62
40enum saa6752hs_command { 63enum saa6752hs_command {
@@ -256,6 +279,51 @@ static int saa6752hs_set_bitrate(struct i2c_client* client,
256 return 0; 279 return 0;
257} 280}
258 281
282static void saa6752hs_set_subsampling(struct i2c_client* client,
283 struct v4l2_format* f)
284{
285 struct saa6752hs_state *h = i2c_get_clientdata(client);
286 int dist_352, dist_480, dist_720;
287
288 /*
289 FIXME: translate and round width/height into EMPRESS
290 subsample type:
291
292 type | PAL | NTSC
293 ---------------------------
294 SIF | 352x288 | 352x240
295 1/2 D1 | 352x576 | 352x480
296 2/3 D1 | 480x576 | 480x480
297 D1 | 720x576 | 720x480
298 */
299
300 dist_352 = abs(f->fmt.pix.width - 352);
301 dist_480 = abs(f->fmt.pix.width - 480);
302 dist_720 = abs(f->fmt.pix.width - 720);
303 if (dist_720 < dist_480) {
304 f->fmt.pix.width = 720;
305 f->fmt.pix.height = 576;
306 h->video_format = SAA6752HS_VF_D1;
307 }
308 else if (dist_480 < dist_352) {
309 f->fmt.pix.width = 480;
310 f->fmt.pix.height = 576;
311 h->video_format = SAA6752HS_VF_2_3_D1;
312 }
313 else {
314 f->fmt.pix.width = 352;
315 if (abs(f->fmt.pix.height - 576) <
316 abs(f->fmt.pix.height - 288)) {
317 f->fmt.pix.height = 576;
318 h->video_format = SAA6752HS_VF_1_2_D1;
319 }
320 else {
321 f->fmt.pix.height = 288;
322 h->video_format = SAA6752HS_VF_SIF;
323 }
324 }
325}
326
259 327
260static void saa6752hs_set_params(struct i2c_client* client, 328static void saa6752hs_set_params(struct i2c_client* client,
261 struct v4l2_mpeg_compression* params) 329 struct v4l2_mpeg_compression* params)
@@ -315,7 +383,7 @@ static int saa6752hs_init(struct i2c_client* client)
315 383
316 // Set video format - must be done first as it resets other settings 384 // Set video format - must be done first as it resets other settings
317 buf[0] = 0x41; 385 buf[0] = 0x41;
318 buf[1] = 0 /* MPEG_VIDEO_FORMAT_D1 */; 386 buf[1] = h->video_format;
319 i2c_master_send(client, buf, 2); 387 i2c_master_send(client, buf, 2);
320 388
321 // set bitrate 389 // set bitrate
@@ -494,6 +562,25 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
494 case VIDIOC_G_MPEGCOMP: 562 case VIDIOC_G_MPEGCOMP:
495 *params = h->params; 563 *params = h->params;
496 break; 564 break;
565 case VIDIOC_G_FMT:
566 {
567 struct v4l2_format *f = arg;
568
569 if (h->video_format == SAA6752HS_VF_UNKNOWN)
570 h->video_format = SAA6752HS_VF_D1;
571 f->fmt.pix.width =
572 v4l2_format_table[h->video_format].fmt.pix.width;
573 f->fmt.pix.height =
574 v4l2_format_table[h->video_format].fmt.pix.height;
575 break ;
576 }
577 case VIDIOC_S_FMT:
578 {
579 struct v4l2_format *f = arg;
580
581 saa6752hs_set_subsampling(client, f);
582 break;
583 }
497 default: 584 default:
498 /* nothing */ 585 /* nothing */
499 break; 586 break;
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 2021e099e35a..fa1357336907 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -233,10 +233,7 @@ static int ts_do_ioctl(struct inode *inode, struct file *file,
233 memset(f,0,sizeof(*f)); 233 memset(f,0,sizeof(*f));
234 f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 234 f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
235 235
236 /* FIXME: translate subsampling type EMPRESS into 236 saa7134_i2c_call_clients(dev, cmd, arg);
237 * width/height: */
238 f->fmt.pix.width = 720; /* D1 */
239 f->fmt.pix.height = 576;
240 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; 237 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
241 f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets; 238 f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets;
242 return 0; 239 return 0;
@@ -249,20 +246,7 @@ static int ts_do_ioctl(struct inode *inode, struct file *file,
249 if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 246 if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
250 return -EINVAL; 247 return -EINVAL;
251 248
252 /* 249 saa7134_i2c_call_clients(dev, cmd, arg);
253 FIXME: translate and round width/height into EMPRESS
254 subsample type:
255
256 type | PAL | NTSC
257 ---------------------------
258 SIF | 352x288 | 352x240
259 1/2 D1 | 352x576 | 352x480
260 2/3 D1 | 480x576 | 480x480
261 D1 | 720x576 | 720x480
262 */
263
264 f->fmt.pix.width = 720; /* D1 */
265 f->fmt.pix.height = 576;
266 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; 250 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
267 f->fmt.pix.sizeimage = TS_PACKET_SIZE* dev->ts.nr_packets; 251 f->fmt.pix.sizeimage = TS_PACKET_SIZE* dev->ts.nr_packets;
268 return 0; 252 return 0;
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 881a0539fc17..6212388edb75 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -357,8 +357,16 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
357 V4L2_TUNER_RADIO != t->mode) 357 V4L2_TUNER_RADIO != t->mode)
358 set_tv_freq(client,400*16); 358 set_tv_freq(client,400*16);
359 t->mode = f->type; 359 t->mode = f->type;
360 t->freq = f->frequency; 360 set_freq(client,f->frequency);
361 set_freq(client,t->freq); 361 break;
362 }
363 case VIDIOC_G_FREQUENCY:
364 {
365 struct v4l2_frequency *f = arg;
366
367 SWITCH_V4L2;
368 f->type = t->mode;
369 f->frequency = t->freq;
362 break; 370 break;
363 } 371 }
364 case VIDIOC_G_TUNER: 372 case VIDIOC_G_TUNER:
@@ -368,6 +376,8 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
368 SWITCH_V4L2; 376 SWITCH_V4L2;
369 if (V4L2_TUNER_RADIO == t->mode && t->has_signal) 377 if (V4L2_TUNER_RADIO == t->mode && t->has_signal)
370 tuner->signal = t->has_signal(client); 378 tuner->signal = t->has_signal(client);
379 tuner->rangelow = tv_range[0] * 16;
380 tuner->rangehigh = tv_range[1] * 16;
371 break; 381 break;
372 } 382 }
373 default: 383 default:
diff --git a/drivers/media/video/video-buf-dvb.c b/drivers/media/video/video-buf-dvb.c
index 31cc4ed9b747..5f870075b55e 100644
--- a/drivers/media/video/video-buf-dvb.c
+++ b/drivers/media/video/video-buf-dvb.c
@@ -149,10 +149,10 @@ int videobuf_dvb_register(struct videobuf_dvb *dvb,
149 dvb->name, result); 149 dvb->name, result);
150 goto fail_adapter; 150 goto fail_adapter;
151 } 151 }
152 dvb->adapter->priv = adapter_priv; 152 dvb->adapter.priv = adapter_priv;
153 153
154 /* register frontend */ 154 /* register frontend */
155 result = dvb_register_frontend(dvb->adapter, dvb->frontend); 155 result = dvb_register_frontend(&dvb->adapter, dvb->frontend);
156 if (result < 0) { 156 if (result < 0) {
157 printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n", 157 printk(KERN_WARNING "%s: dvb_register_frontend failed (errno = %d)\n",
158 dvb->name, result); 158 dvb->name, result);
@@ -178,7 +178,7 @@ int videobuf_dvb_register(struct videobuf_dvb *dvb,
178 dvb->dmxdev.filternum = 256; 178 dvb->dmxdev.filternum = 256;
179 dvb->dmxdev.demux = &dvb->demux.dmx; 179 dvb->dmxdev.demux = &dvb->demux.dmx;
180 dvb->dmxdev.capabilities = 0; 180 dvb->dmxdev.capabilities = 0;
181 result = dvb_dmxdev_init(&dvb->dmxdev, dvb->adapter); 181 result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
182 if (result < 0) { 182 if (result < 0) {
183 printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n", 183 printk(KERN_WARNING "%s: dvb_dmxdev_init failed (errno = %d)\n",
184 dvb->name, result); 184 dvb->name, result);
@@ -209,7 +209,7 @@ int videobuf_dvb_register(struct videobuf_dvb *dvb,
209 } 209 }
210 210
211 /* register network adapter */ 211 /* register network adapter */
212 dvb_net_init(dvb->adapter, &dvb->net, &dvb->demux.dmx); 212 dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
213 return 0; 213 return 0;
214 214
215fail_fe_conn: 215fail_fe_conn:
@@ -223,7 +223,7 @@ fail_dmxdev:
223fail_dmx: 223fail_dmx:
224 dvb_unregister_frontend(dvb->frontend); 224 dvb_unregister_frontend(dvb->frontend);
225fail_frontend: 225fail_frontend:
226 dvb_unregister_adapter(dvb->adapter); 226 dvb_unregister_adapter(&dvb->adapter);
227fail_adapter: 227fail_adapter:
228 return result; 228 return result;
229} 229}
@@ -236,7 +236,7 @@ void videobuf_dvb_unregister(struct videobuf_dvb *dvb)
236 dvb_dmxdev_release(&dvb->dmxdev); 236 dvb_dmxdev_release(&dvb->dmxdev);
237 dvb_dmx_release(&dvb->demux); 237 dvb_dmx_release(&dvb->demux);
238 dvb_unregister_frontend(dvb->frontend); 238 dvb_unregister_frontend(dvb->frontend);
239 dvb_unregister_adapter(dvb->adapter); 239 dvb_unregister_adapter(&dvb->adapter);
240} 240}
241 241
242EXPORT_SYMBOL(videobuf_dvb_register); 242EXPORT_SYMBOL(videobuf_dvb_register);