Commit de9c9143 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] v4l: missing bits

Missing parts of the v4l update

Cc: Gerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4896f66e
...@@ -168,13 +168,11 @@ static int saa6752hs_chip_command(struct i2c_client* client, ...@@ -168,13 +168,11 @@ static int saa6752hs_chip_command(struct i2c_client* client,
} }
// wait a bit // wait a bit
set_current_state(TASK_INTERRUPTIBLE); msleep(10);
schedule_timeout(HZ/100);
} }
// delay a bit to let encoder settle // delay a bit to let encoder settle
set_current_state(TASK_INTERRUPTIBLE); msleep(50);
schedule_timeout(HZ/20);
// done // done
return status; return status;
......
/* /*
* $Id: saa7134-cards.c,v 1.27 2004/09/30 14:17:12 kraxel Exp $
*
* device driver for philips saa7134 based TV cards * device driver for philips saa7134 based TV cards
* card-specific stuff. * card-specific stuff.
* *
...@@ -404,6 +406,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -404,6 +406,7 @@ struct saa7134_board saa7134_boards[] = {
.name = "Terratec Cinergy 600 TV", .name = "Terratec Cinergy 600 TV",
.audio_clock = 0x00200000, .audio_clock = 0x00200000,
.tuner_type = TUNER_PHILIPS_PAL, .tuner_type = TUNER_PHILIPS_PAL,
.tda9887_conf = TDA9887_PRESENT,
.inputs = {{ .inputs = {{
.name = name_tv, .name = name_tv,
.vmux = 1, .vmux = 1,
...@@ -647,6 +650,29 @@ struct saa7134_board saa7134_boards[] = { ...@@ -647,6 +650,29 @@ struct saa7134_board saa7134_boards[] = {
.tv = 1, .tv = 1,
}}, }},
}, },
[SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = {
.name = "Compro VideoMate TV Gold+",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_NTSC_M,
.gpiomask = 0x800c0000,
.inputs = {{
.name = name_svideo,
.vmux = 8,
.amux = LINE1,
.gpio = 0x06c00012,
},{
.name = name_comp1,
.vmux = 3,
.amux = LINE1,
.gpio = 0x0ac20012,
},{
.name = name_tv,
.vmux = 1,
.amux = LINE2,
.gpio = 0x08c20012,
.tv = 1,
}},
},
[SAA7134_BOARD_CRONOS_PLUS] = { [SAA7134_BOARD_CRONOS_PLUS] = {
/* gpio pins: /* gpio pins:
0 .. 3 BASE_ID 0 .. 3 BASE_ID
...@@ -1051,6 +1077,18 @@ struct saa7134_board saa7134_boards[] = { ...@@ -1051,6 +1077,18 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE2, .amux = LINE2,
.gpio = 0x0000, .gpio = 0x0000,
.tv = 1, .tv = 1,
},{
.name = name_comp1,
.vmux = 4,
.amux = LINE1,
},{
.name = name_svideo,
.vmux = 8,
.amux = LINE1,
},{
.name = name_comp2, // CVideo over SVideo Connector
.vmux = 0,
.amux = LINE1,
}}, }},
.mute = { .mute = {
.name = name_mute, .name = name_mute,
...@@ -1091,6 +1129,85 @@ struct saa7134_board saa7134_boards[] = { ...@@ -1091,6 +1129,85 @@ struct saa7134_board saa7134_boards[] = {
.gpio = 0x40000, .gpio = 0x40000,
}, },
}, },
[SAA7134_BOARD_SABRENT_SBTTVFM] = {
/* Michael Rodriguez-Torrent */
.name = "Sabrent SBT-TVFM (saa7130)",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_NTSC_M,
.tda9887_conf = TDA9887_PRESENT,
.inputs = {{
.name = name_tv,
.vmux = 3,
.amux = LINE2,
.tv = 1,
},{
.name = name_comp1,
.vmux = 1,
.amux = LINE2,
},{
.name = name_svideo,
.vmux = 8,
.amux = LINE2,
}},
.radio = {
.name = name_radio,
.amux = LINE2,
},
},
[SAA7134_BOARD_ZOLID_XPERT_TV7134] = {
/* Helge Jensen <helge.jensen@slog.dk> */
.name = ":Zolid Xpert TV7134",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_NTSC,
.inputs = {{
.name = name_svideo,
.vmux = 8,
.amux = LINE1,
},{
.name = name_comp1,
.vmux = 3,
.amux = LINE1,
},{
.name = name_tv,
.vmux = 1,
.amux = LINE2,
.tv = 1,
}},
},
[SAA7134_EMPIRE_PCI_TV_RADIO_LE] = {
/* "Matteo Az" <matte.az@nospam.libero.it> ;-) */
.name = "Empire PCI TV-Radio LE",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_PAL,
.gpiomask = 0x4000,
.inputs = {{
.name = name_tv_mono,
.vmux = 1,
.amux = LINE2,
.gpio = 0x8000,
.tv = 1,
},{
.name = name_comp1,
.vmux = 3,
.amux = LINE1,
.gpio = 0x8000,
},{
.name = name_svideo,
.vmux = 6,
.amux = LINE1,
.gpio = 0x8000,
}},
.radio = {
.name = name_radio,
.amux = LINE1,
.gpio = 0x8000,
},
.mute = {
.name = name_mute,
.amux = TV,
.gpio =0x8000,
}
},
}; };
const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
...@@ -1236,6 +1353,12 @@ struct pci_device_id saa7134_pci_tbl[] = { ...@@ -1236,6 +1353,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subvendor = 0x185b, .subvendor = 0x185b,
.subdevice = 0xc100, .subdevice = 0xc100,
.driver_data = SAA7134_BOARD_VIDEOMATE_TV, .driver_data = SAA7134_BOARD_VIDEOMATE_TV,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7133,
.subvendor = 0x185b,
.subdevice = 0xc100,
.driver_data = SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS,
},{ },{
.vendor = PCI_VENDOR_ID_PHILIPS, .vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7130, .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
...@@ -1401,7 +1524,7 @@ static void board_flyvideo(struct saa7134_dev *dev) ...@@ -1401,7 +1524,7 @@ static void board_flyvideo(struct saa7134_dev *dev)
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
int saa7134_board_init(struct saa7134_dev *dev) int saa7134_board_init1(struct saa7134_dev *dev)
{ {
// Always print gpio, often manufacturers encode tuner type and other info. // Always print gpio, often manufacturers encode tuner type and other info.
saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0); saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0);
...@@ -1420,6 +1543,7 @@ int saa7134_board_init(struct saa7134_dev *dev) ...@@ -1420,6 +1543,7 @@ int saa7134_board_init(struct saa7134_dev *dev)
case SAA7134_BOARD_CINERGY600: case SAA7134_BOARD_CINERGY600:
case SAA7134_BOARD_ECS_TVP3XP: case SAA7134_BOARD_ECS_TVP3XP:
case SAA7134_BOARD_ECS_TVP3XP_4CB5: case SAA7134_BOARD_ECS_TVP3XP_4CB5:
case SAA7134_BOARD_MD2819:
dev->has_remote = 1; dev->has_remote = 1;
break; break;
case SAA7134_BOARD_AVACSSMARTTV: case SAA7134_BOARD_AVACSSMARTTV:
...@@ -1435,6 +1559,31 @@ int saa7134_board_init(struct saa7134_dev *dev) ...@@ -1435,6 +1559,31 @@ int saa7134_board_init(struct saa7134_dev *dev)
return 0; return 0;
} }
/* stuff which needs working i2c */
int saa7134_board_init2(struct saa7134_dev *dev)
{
unsigned char buf;
int board;
switch (dev->board) {
case SAA7134_BOARD_BMK_MPEX_NOTUNER:
case SAA7134_BOARD_BMK_MPEX_TUNER:
dev->i2c_client.addr = 0x60;
board = (i2c_master_recv(&dev->i2c_client,&buf,0) < 0)
? SAA7134_BOARD_BMK_MPEX_NOTUNER
: SAA7134_BOARD_BMK_MPEX_TUNER;
if (board == dev->board)
break;
printk("%s: board type fixup: %s\n", dev->name,
saa7134_boards[dev->board].name);
dev->tuner_type = saa7134_boards[dev->board].tuner_type;
if (TUNER_ABSENT != dev->tuner_type)
saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&dev->tuner_type);
break;
}
return 0;
}
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* /*
* Local variables: * Local variables:
......
/* /*
* $Id: saa7134-core.c,v 1.10 2004/09/15 16:15:24 kraxel Exp $
*
* device driver for philips saa7134 based TV cards * device driver for philips saa7134 based TV cards
* driver core * driver core
* *
...@@ -27,6 +29,7 @@ ...@@ -27,6 +29,7 @@
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/sound.h> #include <linux/sound.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h>
#include "saa7134-reg.h" #include "saa7134-reg.h"
#include "saa7134.h" #include "saa7134.h"
...@@ -897,7 +900,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -897,7 +900,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
} }
/* initialize hardware #1 */ /* initialize hardware #1 */
saa7134_board_init(dev); saa7134_board_init1(dev);
saa7134_hwinit1(dev); saa7134_hwinit1(dev);
/* get irq */ /* get irq */
...@@ -910,11 +913,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, ...@@ -910,11 +913,11 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
} }
/* wait a bit, register i2c bus */ /* wait a bit, register i2c bus */
set_current_state(TASK_INTERRUPTIBLE); msleep(100);
schedule_timeout(HZ/10);
saa7134_i2c_register(dev); saa7134_i2c_register(dev);
/* initialize hardware #2 */ /* initialize hardware #2 */
saa7134_board_init2(dev);
saa7134_hwinit2(dev); saa7134_hwinit2(dev);
/* load i2c helpers */ /* load i2c helpers */
......
/* /*
* $Id: saa7134-i2c.c,v 1.5 2004/10/06 17:30:51 kraxel Exp $
*
* device driver for philips saa7134 based TV cards * device driver for philips saa7134 based TV cards
* i2c interface support * i2c interface support
* *
...@@ -381,21 +383,26 @@ saa7134_i2c_eeprom(struct saa7134_dev *dev, unsigned char *eedata, int len) ...@@ -381,21 +383,26 @@ saa7134_i2c_eeprom(struct saa7134_dev *dev, unsigned char *eedata, int len)
return 0; return 0;
} }
static int static char *i2c_devs[128] = {
saa7134_i2c_scan(struct saa7134_dev *dev) [ 0x20 ] = "mpeg encoder (saa6752hs)",
[ 0xa0 >> 1 ] = "eeprom",
[ 0xc0 >> 1 ] = "tuner (analog)",
[ 0x86 >> 1 ] = "tda9887",
};
static void do_i2c_scan(char *name, struct i2c_client *c)
{ {
unsigned char buf; unsigned char buf;
int i,rc; int i,rc;
for (i = 0; i < 256; i+= 2) { for (i = 0; i < 128; i++) {
dev->i2c_client.addr = i >> 1; c->addr = i;
rc = i2c_master_recv(&dev->i2c_client,&buf,0); rc = i2c_master_recv(c,&buf,0);
if (rc < 0) if (rc < 0)
continue; continue;
printk("%s: i2c scan: found device @ %x%s\n", printk("%s: i2c scan: found device @ 0x%x [%s]\n",
dev->name, i, (i == 0xa0) ? " [eeprom]" : ""); name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???");
} }
return 0;
} }
void saa7134_i2c_call_clients(struct saa7134_dev *dev, void saa7134_i2c_call_clients(struct saa7134_dev *dev,
...@@ -418,7 +425,7 @@ int saa7134_i2c_register(struct saa7134_dev *dev) ...@@ -418,7 +425,7 @@ int saa7134_i2c_register(struct saa7134_dev *dev)
saa7134_i2c_eeprom(dev,dev->eedata,sizeof(dev->eedata)); saa7134_i2c_eeprom(dev,dev->eedata,sizeof(dev->eedata));
if (i2c_scan) if (i2c_scan)
saa7134_i2c_scan(dev); do_i2c_scan(dev->name,&dev->i2c_client);
return 0; return 0;
} }
......
/* /*
* $Id: saa7134-input.c,v 1.9 2004/09/15 16:15:24 kraxel Exp $
*
* handle saa7134 IR remotes via linux kernel input layer. * handle saa7134 IR remotes via linux kernel input layer.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -209,6 +211,53 @@ static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = { ...@@ -209,6 +211,53 @@ static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = {
[ 15 ] = KEY_F22, // min [ 15 ] = KEY_F22, // min
[ 26 ] = KEY_F23, // freeze [ 26 ] = KEY_F23, // freeze
}; };
/* Alex Hermann <gaaf@gmx.net> */
static IR_KEYTAB_TYPE md2819_codes[IR_KEYTAB_SIZE] = {
[ 40 ] = KEY_KP1,
[ 24 ] = KEY_KP2,
[ 56 ] = KEY_KP3,
[ 36 ] = KEY_KP4,
[ 20 ] = KEY_KP5,
[ 52 ] = KEY_KP6,
[ 44 ] = KEY_KP7,
[ 28 ] = KEY_KP8,
[ 60 ] = KEY_KP9,
[ 34 ] = KEY_KP0,
[ 32 ] = KEY_TV, // TV/FM
[ 16 ] = KEY_CD, // CD
[ 48 ] = KEY_TEXT, // TELETEXT
[ 0 ] = KEY_POWER, // POWER
[ 8 ] = KEY_VIDEO, // VIDEO
[ 4 ] = KEY_AUDIO, // AUDIO
[ 12 ] = KEY_ZOOM, // FULL SCREEN
[ 18 ] = KEY_SUBTITLE, // DISPLAY - ???
[ 50 ] = KEY_REWIND, // LOOP - ???
[ 2 ] = KEY_PRINT, // PREVIEW - ???
[ 42 ] = KEY_SEARCH, // AUTOSCAN
[ 26 ] = KEY_SLEEP, // FREEZE - ???
[ 58 ] = KEY_SHUFFLE, // SNAPSHOT - ???
[ 10 ] = KEY_MUTE, // MUTE
[ 38 ] = KEY_RECORD, // RECORD
[ 22 ] = KEY_PAUSE, // PAUSE
[ 54 ] = KEY_STOP, // STOP
[ 6 ] = KEY_PLAY, // PLAY
[ 46 ] = KEY_RED, // <RED>
[ 33 ] = KEY_GREEN, // <GREEN>
[ 14 ] = KEY_YELLOW, // <YELLOW>
[ 1 ] = KEY_BLUE, // <BLUE>
[ 30 ] = KEY_VOLUMEDOWN, // VOLUME-
[ 62 ] = KEY_VOLUMEUP, // VOLUME+
[ 17 ] = KEY_CHANNELDOWN, // CHANNEL/PAGE-
[ 49 ] = KEY_CHANNELUP // CHANNEL/PAGE+
};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static int build_key(struct saa7134_dev *dev) static int build_key(struct saa7134_dev *dev)
...@@ -303,6 +352,15 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -303,6 +352,15 @@ int saa7134_input_init1(struct saa7134_dev *dev)
mask_keyup = 0x000020; mask_keyup = 0x000020;
polling = 50; // ms polling = 50; // ms
break; break;
case SAA7134_BOARD_MD2819:
ir_codes = md2819_codes;
mask_keycode = 0x0007C8;
mask_keydown = 0x000010;
polling = 50; // ms
/* Set GPIO pin2 to high to enable the IR controller */
saa_setb(SAA7134_GPIO_GPMODE0, 0x4);
saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4);
break;
} }
if (NULL == ir_codes) { if (NULL == ir_codes) {
printk("%s: Oops: IR config error [card=%d]\n", printk("%s: Oops: IR config error [card=%d]\n",
......
/* /*
* $Id: saa7134-oss.c,v 1.9 2004/09/15 16:15:24 kraxel Exp $
*
* device driver for philips saa7134 based TV cards * device driver for philips saa7134 based TV cards
* oss dsp interface * oss dsp interface
* *
......
/* /*
* $Id: saa7134-reg.h,v 1.2 2004/09/15 16:15:24 kraxel Exp $
*
* philips saa7134 registers * philips saa7134 registers
*/ */
......
/* /*
* $Id: saa7134-ts.c,v 1.9 2004/10/11 14:53:13 kraxel Exp $
*
* device driver for philips saa7134 based TV cards * device driver for philips saa7134 based TV cards
* video4linux video interface * video4linux video interface
* *
...@@ -88,10 +90,10 @@ static int buffer_activate(struct saa7134_dev *dev, ...@@ -88,10 +90,10 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0; return 0;
} }
static int buffer_prepare(struct file *file, struct videobuf_buffer *vb, static int buffer_prepare(void *priv, struct videobuf_buffer *vb,
enum v4l2_field field) enum v4l2_field field)
{ {
struct saa7134_dev *dev = file->private_data; struct saa7134_dev *dev = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
unsigned int lines, llength, size; unsigned int lines, llength, size;
int err; int err;
...@@ -136,7 +138,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb, ...@@ -136,7 +138,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
} }
static int static int
buffer_setup(struct file *file, unsigned int *count, unsigned int *size) buffer_setup(void *priv, unsigned int *count, unsigned int *size)
{ {
*size = TS_PACKET_SIZE * ts_nr_packets; *size = TS_PACKET_SIZE * ts_nr_packets;
if (0 == *count) if (0 == *count)
...@@ -145,17 +147,17 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size) ...@@ -145,17 +147,17 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
return 0; return 0;
} }
static void buffer_queue(struct file *file, struct videobuf_buffer *vb) static void buffer_queue(void *priv, struct videobuf_buffer *vb)
{ {
struct saa7134_dev *dev = file->private_data; struct saa7134_dev *dev = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_buffer_queue(dev,&dev->ts_q,buf); saa7134_buffer_queue(dev,&dev->ts_q,buf);
} }
static void buffer_release(struct file *file, struct videobuf_buffer *vb) static void buffer_release(void *priv, struct videobuf_buffer *vb)
{ {
struct saa7134_dev *dev = file->private_data; struct saa7134_dev *dev = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_dma_free(dev,buf); saa7134_dma_free(dev,buf);
...@@ -174,10 +176,9 @@ static struct videobuf_queue_ops ts_qops = { ...@@ -174,10 +176,9 @@ static struct videobuf_queue_ops ts_qops = {
static void ts_reset_encoder(struct saa7134_dev* dev) static void ts_reset_encoder(struct saa7134_dev* dev)
{ {
saa_writeb(SAA7134_SPECIAL_MODE, 0x00); saa_writeb(SAA7134_SPECIAL_MODE, 0x00);
mdelay(10); msleep(10);
saa_writeb(SAA7134_SPECIAL_MODE, 0x01); saa_writeb(SAA7134_SPECIAL_MODE, 0x01);
set_current_state(TASK_INTERRUPTIBLE); msleep(100);
schedule_timeout(HZ/10);
} }
static int ts_init_encoder(struct saa7134_dev* dev, void* arg) static int ts_init_encoder(struct saa7134_dev* dev, void* arg)
...@@ -226,10 +227,10 @@ static int ts_release(struct inode *inode, struct file *file) ...@@ -226,10 +227,10 @@ static int ts_release(struct inode *inode, struct file *file)
struct saa7134_dev *dev = file->private_data; struct saa7134_dev *dev = file->private_data;
if (dev->ts.ts.streaming) if (dev->ts.ts.streaming)
videobuf_streamoff(file,&dev->ts.ts); videobuf_streamoff(file->private_data,&dev->ts.ts);
down(&dev->ts.ts.lock); down(&dev->ts.ts.lock);
if (dev->ts.ts.reading) if (dev->ts.ts.reading)
videobuf_read_stop(file,&dev->ts.ts); videobuf_read_stop(file->private_data,&dev->ts.ts);
dev->ts.users--; dev->ts.users--;
/* stop the encoder */ /* stop the encoder */
...@@ -250,7 +251,9 @@ ts_read(struct file *file, char __user *data, size_t count, loff_t *ppos) ...@@ -250,7 +251,9 @@ ts_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
dev->ts.started = 1; dev->ts.started = 1;
} }
return videobuf_read_stream(file, &dev->ts.ts, data, count, ppos, 0); return videobuf_read_stream(file->private_data,
&dev->ts.ts, data, count, ppos, 0,
file->f_flags & O_NONBLOCK);
} }
static unsigned int static unsigned int
...@@ -258,7 +261,8 @@ ts_poll(struct file *file, struct poll_table_struct *wait) ...@@ -258,7 +261,8 @@ ts_poll(struct file *file, struct poll_table_struct *wait)
{ {
struct saa7134_dev *dev = file->private_data; struct saa7134_dev *dev = file->private_data;
return videobuf_poll_stream(file, &dev->ts.ts, wait); return videobuf_poll_stream(file, file->private_data,
&dev->ts.ts, wait);
} }
...@@ -387,22 +391,23 @@ static int ts_do_ioctl(struct inode *inode, struct file *file, ...@@ -387,22 +391,23 @@ static int ts_do_ioctl(struct inode *inode, struct file *file,
} }
case VIDIOC_REQBUFS: case VIDIOC_REQBUFS:
return videobuf_reqbufs(file,&dev->ts.ts,arg); return videobuf_reqbufs(file->private_data,&dev->ts.ts,arg);
case VIDIOC_QUERYBUF: case VIDIOC_QUERYBUF:
return videobuf_querybuf(&dev->ts.ts,arg); return videobuf_querybuf(&dev->ts.ts,arg);
case VIDIOC_QBUF: case VIDIOC_QBUF:
return videobuf_qbuf(file,&dev->ts.ts,arg); return videobuf_qbuf(file->private_data,&dev->ts.ts,arg);
case VIDIOC_DQBUF: case VIDIOC_DQBUF:
return videobuf_dqbuf(file,&dev->ts.ts,arg); return videobuf_dqbuf(file->private_data,&dev->ts.ts,arg,
file->f_flags & O_NONBLOCK);
case VIDIOC_STREAMON: case VIDIOC_STREAMON:
return videobuf_streamon(file,&dev->ts.ts); return videobuf_streamon(file->private_data,&dev->ts.ts);
case VIDIOC_STREAMOFF: case VIDIOC_STREAMOFF:
return videobuf_streamoff(file,&dev->ts.ts); return videobuf_streamoff(file->private_data,&dev->ts.ts);
case VIDIOC_QUERYCTRL: case VIDIOC_QUERYCTRL:
case VIDIOC_G_CTRL: case VIDIOC_G_CTRL:
......
/* /*
* $Id: saa7134-tvaudio.c,v 1.13 2004/09/22 11:47:11 kraxel Exp $
*
* device driver for philips saa7134 based TV cards * device driver for philips saa7134 based TV cards
* tv audio decoder (fm stereo, nicam, ...) * tv audio decoder (fm stereo, nicam, ...)
* *
...@@ -56,9 +58,10 @@ MODULE_PARM_DESC(audio_clock_tweak, "Audio clock tick fine tuning for cards with ...@@ -56,9 +58,10 @@ MODULE_PARM_DESC(audio_clock_tweak, "Audio clock tick fine tuning for cards with
#define print_regb(reg) printk("%s: reg 0x%03x [%-16s]: 0x%02x\n", \ #define print_regb(reg) printk("%s: reg 0x%03x [%-16s]: 0x%02x\n", \
dev->name,(SAA7134_##reg),(#reg),saa_readb((SAA7134_##reg))) dev->name,(SAA7134_##reg),(#reg),saa_readb((SAA7134_##reg)))
#define SCAN_INITIAL_DELAY (HZ) /* msecs */
#define SCAN_SAMPLE_DELAY (HZ/5) #define SCAN_INITIAL_DELAY 1000
#define SCAN_SUBCARRIER_DELAY (HZ*2) #define SCAN_SAMPLE_DELAY 200
#define SCAN_SUBCARRIER_DELAY 2000
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
/* saa7134 code */ /* saa7134 code */
...@@ -324,11 +327,11 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) ...@@ -324,11 +327,11 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout)
add_wait_queue(&dev->thread.wq, &wait); add_wait_queue(&dev->thread.wq, &wait);
if (dev->thread.scan1 == dev->thread.scan2 && !dev->thread.shutdown) { if (dev->thread.scan1 == dev->thread.scan2 && !dev->thread.shutdown) {
set_current_state(TASK_INTERRUPTIBLE); if (timeout < 0) {
if (timeout < 0) set_current_state(TASK_INTERRUPTIBLE);
schedule(); schedule();
else } else
schedule_timeout(timeout); msleep_interruptible(timeout);
} }
remove_wait_queue(&dev->thread.wq, &wait); remove_wait_queue(&dev->thread.wq, &wait);
return dev->thread.scan1 != dev->thread.scan2; return dev->thread.scan1 != dev->thread.scan2;
...@@ -602,7 +605,7 @@ static int tvaudio_thread(void *data) ...@@ -602,7 +605,7 @@ static int tvaudio_thread(void *data)
lastmode = 42; lastmode = 42;
for (;;) { for (;;) {
if (tvaudio_sleep(dev,5*HZ)) if (tvaudio_sleep(dev,5000))
goto restart; goto restart;
if (dev->thread.shutdown || signal_pending(current)) if (dev->thread.shutdown || signal_pending(current))
break; break;
...@@ -735,6 +738,7 @@ static int getstereo_7133(struct saa7134_dev *dev) ...@@ -735,6 +738,7 @@ static int getstereo_7133(struct saa7134_dev *dev)
static int mute_input_7133(struct saa7134_dev *dev) static int mute_input_7133(struct saa7134_dev *dev)
{ {
u32 reg = 0; u32 reg = 0;
int mask;
switch (dev->input->amux) { switch (dev->input->amux) {
case TV: reg = 0x02; break; case TV: reg = 0x02; break;
...@@ -744,6 +748,14 @@ static int mute_input_7133(struct saa7134_dev *dev) ...@@ -744,6 +748,14 @@ static int mute_input_7133(struct saa7134_dev *dev)
if (dev->ctl_mute) if (dev->ctl_mute)
reg = 0x07; reg = 0x07;
saa_writel(0x594 >> 2, reg); saa_writel(0x594 >> 2, reg);
/* switch gpio-connected external audio mux */
if (0 != card(dev).gpiomask) {
mask = card(dev).gpiomask;
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, dev->input->gpio);
saa7134_track_gpio(dev,dev->input->name);
}
return 0; return 0;
} }
...@@ -777,7 +789,10 @@ static int tvaudio_thread_ddep(void *data) ...@@ -777,7 +789,10 @@ static int tvaudio_thread_ddep(void *data)
/* insmod option override */ /* insmod option override */
norms = (audio_ddep << 2) | 0x01; norms = (audio_ddep << 2) | 0x01;
dprintk("ddep override: %s\n",stdres[audio_ddep]); dprintk("ddep override: %s\n",stdres[audio_ddep]);
} else{ } else if (&card(dev).radio == dev->input) {
dprintk("FM Radio\n");
norms = (0x0f << 2) | 0x01;
} else {
/* (let chip) scan for sound carrier */ /* (let chip) scan for sound carrier */
norms = 0; norms = 0;
if (dev->tvnorm->id & V4L2_STD_PAL) { if (dev->tvnorm->id & V4L2_STD_PAL) {
...@@ -810,7 +825,7 @@ static int tvaudio_thread_ddep(void *data) ...@@ -810,7 +825,7 @@ static int tvaudio_thread_ddep(void *data)
saa_dsp_writel(dev, 0x464 >> 2, 0x000000); saa_dsp_writel(dev, 0x464 >> 2, 0x000000);
saa_dsp_writel(dev, 0x470 >> 2, 0x101010); saa_dsp_writel(dev, 0x470 >> 2, 0x101010);
if (tvaudio_sleep(dev,3*HZ)) if (tvaudio_sleep(dev,3000))
goto restart; goto restart;
value = saa_readl(0x528 >> 2) & 0xffffff; value = saa_readl(0x528 >> 2) & 0xffffff;
......
/* /*
* $Id: saa7134-vbi.c,v 1.3 2004/09/23 13:58:19 kraxel Exp $
*
* device driver for philips saa7134 based TV cards * device driver for philips saa7134 based TV cards
* video4linux video interface * video4linux video interface
* *
...@@ -113,10 +115,10 @@ static int buffer_activate(struct saa7134_dev *dev, ...@@ -113,10 +115,10 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0; return 0;
} }
static int buffer_prepare(struct file *file, struct videobuf_buffer *vb, static int buffer_prepare(void *priv, struct videobuf_buffer *vb,
enum v4l2_field field) enum v4l2_field field)
{ {
struct saa7134_fh *fh = file->private_data; struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev; struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
struct saa7134_tvnorm *norm = dev->tvnorm; struct saa7134_tvnorm *norm = dev->tvnorm;
...@@ -167,9 +169,9 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb, ...@@ -167,9 +169,9 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
} }
static int static int
buffer_setup(struct file *file, unsigned int *count, unsigned int *size) buffer_setup(void *priv, unsigned int *count, unsigned int *size)
{ {
struct saa7134_fh *fh = file->private_data; struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev; struct saa7134_dev *dev = fh->dev;
int llength,lines; int llength,lines;
...@@ -188,18 +190,18 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size) ...@@ -188,18 +190,18 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
return 0; return 0;
} }
static void buffer_queue(struct file *file, struct videobuf_buffer *vb) static void buffer_queue(void *priv, struct videobuf_buffer *vb)
{ {
struct saa7134_fh *fh = file->private_data; struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev; struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_buffer_queue(dev,&dev->vbi_q,buf); saa7134_buffer_queue(dev,&dev->vbi_q,buf);
} }
static void buffer_release(struct file *file, struct videobuf_buffer *vb) static void buffer_release(void *priv, struct videobuf_buffer *vb)
{ {
struct saa7134_fh *fh = file->private_data; struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev; struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
......
/* /*
* $Id: saa7134-video.c,v 1.15 2004/10/11 14:53:13 kraxel Exp $
*
* device driver for philips saa7134 based TV cards * device driver for philips saa7134 based TV cards
* video4linux video interface * video4linux video interface
* *
...@@ -916,10 +918,10 @@ static int buffer_activate(struct saa7134_dev *dev, ...@@ -916,10 +918,10 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0; return 0;
} }
static int buffer_prepare(struct file *file, struct videobuf_buffer *vb, static int buffer_prepare(void *priv, struct videobuf_buffer *vb,
enum v4l2_field field) enum v4l2_field field)
{ {
struct saa7134_fh *fh = file->private_data; struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh->dev; struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
unsigned int size; unsigned int size;
...@@ -978,9 +980,9 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb, ...@@ -978,9 +980,9 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,
} }
static int static int
buffer_setup(struct file *file, unsigned int *count, unsigned int *size) buffer_setup(void *priv, unsigned int *count, unsigned int *size)
{ {
struct saa7134_fh *fh = file->private_data; struct saa7134_fh *fh = priv;
*size = fh->fmt->depth * fh->width * fh->height >> 3; *size = fh->fmt->depth * fh->width * fh->height >> 3;
if (0 == *count) if (0 == *count)
...@@ -989,17 +991,17 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size) ...@@ -989,17 +991,17 @@ buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
return 0; return 0;
} }
static void buffer_queue(struct file *file, struct videobuf_buffer *vb) static void buffer_queue(void *priv, struct videobuf_buffer *vb)
{ {
struct saa7134_fh *fh = file->private_data; struct saa7134_fh *fh = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_buffer_queue(fh->dev,&fh->dev->video_q,buf); saa7134_buffer_queue(fh->dev,&fh->dev->video_q,buf);
} }
static void buffer_release(struct file *file, struct videobuf_buffer *vb) static void buffer_release(void *priv, struct videobuf_buffer *vb)
{ {
struct saa7134_fh *fh = file->private_data; struct saa7134_fh *fh = priv;
struct saa7134_buf *buf = (struct saa7134_buf *)vb; struct saa7134_buf *buf = (struct saa7134_buf *)vb;
saa7134_dma_free(fh->dev,buf); saa7134_dma_free(fh->dev,buf);
...@@ -1269,13 +1271,15 @@ video_read(struct file *file, char __user *data, size_t count, loff_t *ppos) ...@@ -1269,13 +1271,15 @@ video_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE:
if (res_locked(fh->dev,RESOURCE_VIDEO)) if (res_locked(fh->dev,RESOURCE_VIDEO))
return -EBUSY; return -EBUSY;
return videobuf_read_one(file, saa7134_queue(fh), return videobuf_read_one(file->private_data, saa7134_queue(fh),
data, count, ppos); data, count, ppos,
file->f_flags & O_NONBLOCK);
case V4L2_BUF_TYPE_VBI_CAPTURE: case V4L2_BUF_TYPE_VBI_CAPTURE:
if (!res_get(fh->dev,fh,RESOURCE_VBI)) if (!res_get(fh->dev,fh,RESOURCE_VBI))
return -EBUSY; return -EBUSY;
return videobuf_read_stream(file, saa7134_queue(fh), return videobuf_read_stream(file->private_data, saa7134_queue(fh),
data, count, ppos, 1); data, count, ppos, 1,
file->f_flags & O_NONBLOCK);
break; break;
default: default:
BUG(); BUG();
...@@ -1290,7 +1294,8 @@ video_poll(struct file *file, struct poll_table_struct *wait) ...@@ -1290,7 +1294,8 @@ video_poll(struct file *file, struct poll_table_struct *wait)
struct videobuf_buffer *buf = NULL; struct videobuf_buffer *buf = NULL;
if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type)
return videobuf_poll_stream(file, &fh->vbi, wait); return videobuf_poll_stream(file, file->private_data,
&fh->vbi, wait);
if (res_check(fh,RESOURCE_VIDEO)) { if (res_check(fh,RESOURCE_VIDEO)) {
if (!list_empty(&fh->cap.stream)) if (!list_empty(&fh->cap.stream))
...@@ -1303,11 +1308,11 @@ video_poll(struct file *file, struct poll_table_struct *wait) ...@@ -1303,11 +1308,11 @@ video_poll(struct file *file, struct poll_table_struct *wait)
up(&fh->cap.lock); up(&fh->cap.lock);
return POLLERR; return POLLERR;
} }
if (0 != fh->cap.ops->buf_prepare(file,fh->cap.read_buf,fh->cap.field)) { if (0 != fh->cap.ops->buf_prepare(file->private_data,fh->cap.read_buf,fh->cap.field)) {
up(&fh->cap.lock); up(&fh->cap.lock);
return POLLERR; return POLLERR;
} }
fh->cap.ops->buf_queue(file,fh->cap.read_buf); fh->cap.ops->buf_queue(file->private_data,fh->cap.read_buf);
fh->cap.read_off = 0; fh->cap.read_off = 0;
} }
up(&fh->cap.lock); up(&fh->cap.lock);
...@@ -1340,20 +1345,20 @@ static int video_release(struct inode *inode, struct file *file) ...@@ -1340,20 +1345,20 @@ static int video_release(struct inode *inode, struct file *file)
/* stop video capture */ /* stop video capture */
if (res_check(fh, RESOURCE_VIDEO)) { if (res_check(fh, RESOURCE_VIDEO)) {
videobuf_streamoff(file,&fh->cap); videobuf_streamoff(file->private_data,&fh->cap);
res_free(dev,fh,RESOURCE_VIDEO); res_free(dev,fh,RESOURCE_VIDEO);
} }
if (fh->cap.read_buf) { if (fh->cap.read_buf) {
buffer_release(file,fh->cap.read_buf); buffer_release(file->private_data,fh->cap.read_buf);
kfree(fh->cap.read_buf); kfree(fh->cap.read_buf);
} }
/* stop vbi capture */ /* stop vbi capture */
if (res_check(fh, RESOURCE_VBI)) { if (res_check(fh, RESOURCE_VBI)) {
if (fh->vbi.streaming) if (fh->vbi.streaming)
videobuf_streamoff(file,&fh->vbi); videobuf_streamoff(file->private_data,&fh->vbi);
if (fh->vbi.reading) if (fh->vbi.reading)
videobuf_read_stop(file,&fh->vbi); videobuf_read_stop(file->private_data,&fh->vbi);
res_free(dev,fh,RESOURCE_VBI); res_free(dev,fh,RESOURCE_VBI);
} }
...@@ -2029,7 +2034,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -2029,7 +2034,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
req.type = q->type; req.type = q->type;
req.count = gbuffers; req.count = gbuffers;
req.memory = V4L2_MEMORY_MMAP; req.memory = V4L2_MEMORY_MMAP;
err = videobuf_reqbufs(file,q,&req); err = videobuf_reqbufs(file->private_data,q,&req);
if (err < 0) if (err < 0)
return err; return err;
memset(mbuf,0,sizeof(*mbuf)); memset(mbuf,0,sizeof(*mbuf));
...@@ -2042,16 +2047,17 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -2042,16 +2047,17 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
} }
case VIDIOC_REQBUFS: case VIDIOC_REQBUFS:
return videobuf_reqbufs(file,saa7134_queue(fh),arg); return videobuf_reqbufs(file->private_data,saa7134_queue(fh),arg);
case VIDIOC_QUERYBUF: case VIDIOC_QUERYBUF:
return videobuf_querybuf(saa7134_queue(fh),arg); return videobuf_querybuf(saa7134_queue(fh),arg);
case VIDIOC_QBUF: case VIDIOC_QBUF:
return videobuf_qbuf(file,saa7134_queue(fh),arg); return videobuf_qbuf(file->private_data,saa7134_queue(fh),arg);
case VIDIOC_DQBUF: case VIDIOC_DQBUF:
return videobuf_dqbuf(file,saa7134_queue(fh),arg); return videobuf_dqbuf(file->private_data,saa7134_queue(fh),arg,
file->f_flags & O_NONBLOCK);
case VIDIOC_STREAMON: case VIDIOC_STREAMON:
{ {
...@@ -2059,13 +2065,13 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -2059,13 +2065,13 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
if (!res_get(dev,fh,res)) if (!res_get(dev,fh,res))
return -EBUSY; return -EBUSY;
return videobuf_streamon(file,saa7134_queue(fh)); return videobuf_streamon(file->private_data,saa7134_queue(fh));
} }
case VIDIOC_STREAMOFF: case VIDIOC_STREAMOFF:
{ {
int res = saa7134_resource(fh); int res = saa7134_resource(fh);
err = videobuf_streamoff(file,saa7134_queue(fh)); err = videobuf_streamoff(file->private_data,saa7134_queue(fh));
if (err < 0) if (err < 0)
return err; return err;
res_free(dev,fh,res); res_free(dev,fh,res);
......
/* /*
* $Id: saa7134.h,v 1.20 2004/09/30 12:21:15 kraxel Exp $
*
* v4l2 device driver for philips saa7134 based TV cards * v4l2 device driver for philips saa7134 based TV cards
* *
* (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org>
...@@ -159,6 +161,10 @@ struct saa7134_format { ...@@ -159,6 +161,10 @@ struct saa7134_format {
#define SAA7134_BOARD_CINERGY200 38 #define SAA7134_BOARD_CINERGY200 38
#define SAA7134_BOARD_FLYTVPLATINUM 39 #define SAA7134_BOARD_FLYTVPLATINUM 39
#define SAA7134_BOARD_VIDEOMATE_TV_PVR 40 #define SAA7134_BOARD_VIDEOMATE_TV_PVR 40
#define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS 41
#define SAA7134_BOARD_SABRENT_SBTTVFM 42
#define SAA7134_BOARD_ZOLID_XPERT_TV7134 43
#define SAA7134_EMPIRE_PCI_TV_RADIO_LE 44
#define SAA7134_INPUT_MAX 8 #define SAA7134_INPUT_MAX 8
...@@ -434,7 +440,7 @@ struct saa7134_dev { ...@@ -434,7 +440,7 @@ struct saa7134_dev {
#define saa_setb(reg,bit) saa_andorb((reg),(bit),(bit)) #define saa_setb(reg,bit) saa_andorb((reg),(bit),(bit))
#define saa_clearb(reg,bit) saa_andorb((reg),(bit),0) #define saa_clearb(reg,bit) saa_andorb((reg),(bit),0)
#define saa_wait(d) { udelay(d); } #define saa_wait(us) { udelay(us); }
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* saa7134-core.c */ /* saa7134-core.c */
...@@ -474,7 +480,8 @@ extern struct saa7134_board saa7134_boards[]; ...@@ -474,7 +480,8 @@ extern struct saa7134_board saa7134_boards[];
extern const unsigned int saa7134_bcount; extern const unsigned int saa7134_bcount;
extern struct pci_device_id __devinitdata saa7134_pci_tbl[]; extern struct pci_device_id __devinitdata saa7134_pci_tbl[];
extern int saa7134_board_init(struct saa7134_dev *dev); extern int saa7134_board_init1(struct saa7134_dev *dev);
extern int saa7134_board_init2(struct saa7134_dev *dev);
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment