Commit eba51e01 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: saa7134 update

This is a update for the saa7134 driver, changes:

 * adapt to the video-buf changes.
 * add new cards.
 * split mpeg encoder card support to separare module
   (saa7134-empress), as preparation for the dvb support
   which also uses the MPEG capabilities of the card.
 * started working on dvb support (not functional yet, also
   marked 'BROKEN').
 * convert insmod options to new-style.

The patch also removes all trailing whitespaces.  I've a script to remove
them from my sources now, that should kill those no-op whitespace changes
in my patches after merging this initial cleanup.
Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c94f751f
......@@ -245,6 +245,13 @@ config VIDEO_SAA7134
To compile this driver as a module, choose M here: the
module will be called saa7134.
config VIDEO_SAA7134_DVB
tristate "DVB Support for saa7134 based TV cards"
depends on VIDEO_SAA7134 && DVB_CORE && BROKEN
---help---
This adds support for DVB cards based on the
Philips saa7134 chip.
config VIDEO_MXB
tristate "Siemens-Nixdorf 'Multimedia eXtension Board'"
depends on VIDEO_DEV && PCI
......
......@@ -3,6 +3,8 @@ saa7134-objs := saa7134-cards.o saa7134-core.o saa7134-i2c.o \
saa7134-oss.o saa7134-ts.o saa7134-tvaudio.o \
saa7134-vbi.o saa7134-video.o saa7134-input.o
obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa6752hs.o
obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o saa6752hs.o
obj-$(CONFIG_VIDEO_SAA7134_DVB) += saa7134-dvb.o
EXTRA_CFLAGS = -I$(src)/..
EXTRA_CFLAGS += -I$(src)/..
EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core
......@@ -36,7 +36,7 @@ enum saa6752hs_command {
SAA6752HS_COMMAND_RECONFIGURE = 4,
SAA6752HS_COMMAND_SLEEP = 5,
SAA6752HS_COMMAND_RECONFIGURE_FORCE = 6,
SAA6752HS_COMMAND_MAX
};
......@@ -46,24 +46,24 @@ enum saa6752hs_command {
static u8 PAT[] = {
0xc2, // i2c register
0x00, // table number for encoder
0x47, // sync
0x40, 0x00, // transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0)
0x10, // transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0)
0x00, // PSI pointer to start of table
0x00, // tid(0)
0xb0, 0x0d, // section_syntax_indicator(1), section_length(13)
0x00, 0x01, // transport_stream_id(1)
0xc1, // version_number(0), current_next_indicator(1)
0x00, 0x00, // section_number(0), last_section_number(0)
0x00, 0x01, // program_number(1)
0xe0, 0x10, // PMT PID(0x10)
0x76, 0xf1, 0x44, 0xd1 // CRC32
......@@ -72,29 +72,29 @@ static u8 PAT[] = {
static u8 PMT[] = {
0xc2, // i2c register
0x01, // table number for encoder
0x47, // sync
0x40, 0x10, // transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0x10)
0x10, // transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0)
0x00, // PSI pointer to start of table
0x02, // tid(2)
0xb0, 0x17, // section_syntax_indicator(1), section_length(23)
0x00, 0x01, // program_number(1)
0xc1, // version_number(0), current_next_indicator(1)
0x00, 0x00, // section_number(0), last_section_number(0)
0xe1, 0x04, // PCR_PID (0x104)
0xf0, 0x00, // program_info_length(0)
0x02, 0xe1, 0x00, 0xf0, 0x00, // video stream type(2), pid(0x100)
0x04, 0xe1, 0x03, 0xf0, 0x00, // audio stream type(4), pid(0x103)
0xa1, 0xca, 0x0f, 0x82 // CRC32
};
......@@ -106,7 +106,7 @@ static struct mpeg_params mpeg_params_template =
.total_bitrate = 6000,
};
/* ---------------------------------------------------------------------- */
......@@ -122,11 +122,11 @@ static int saa6752hs_chip_command(struct i2c_client* client,
case SAA6752HS_COMMAND_RESET:
buf[0] = 0x00;
break;
case SAA6752HS_COMMAND_STOP:
buf[0] = 0x03;
break;
case SAA6752HS_COMMAND_START:
buf[0] = 0x02;
break;
......@@ -134,11 +134,11 @@ static int saa6752hs_chip_command(struct i2c_client* client,
case SAA6752HS_COMMAND_PAUSE:
buf[0] = 0x04;
break;
case SAA6752HS_COMMAND_RECONFIGURE:
buf[0] = 0x05;
break;
case SAA6752HS_COMMAND_SLEEP:
buf[0] = 0x06;
break;
......@@ -146,11 +146,11 @@ static int saa6752hs_chip_command(struct i2c_client* client,
case SAA6752HS_COMMAND_RECONFIGURE_FORCE:
buf[0] = 0x07;
break;
default:
return -EINVAL;
return -EINVAL;
}
// set it and wait for it to be so
i2c_master_send(client, buf, 1);
timeout = jiffies + HZ * 3;
......@@ -166,14 +166,14 @@ static int saa6752hs_chip_command(struct i2c_client* client,
status = -ETIMEDOUT;
break;
}
// wait a bit
msleep(10);
}
// delay a bit to let encoder settle
msleep(50);
// done
return status;
}
......@@ -183,12 +183,12 @@ static int saa6752hs_set_bitrate(struct i2c_client* client,
struct mpeg_params* params)
{
u8 buf[3];
// set the bitrate mode
buf[0] = 0x71;
buf[1] = params->bitrate_mode;
i2c_master_send(client, buf, 2);
// set the video bitrate
if (params->bitrate_mode == MPEG_BITRATE_MODE_VBR) {
// set the target bitrate
......@@ -209,24 +209,24 @@ static int saa6752hs_set_bitrate(struct i2c_client* client,
buf[2] = params->video_target_bitrate & 0xff;
i2c_master_send(client, buf, 3);
}
// set the audio bitrate
buf[0] = 0x94;
buf[1] = params->audio_bitrate;
i2c_master_send(client, buf, 2);
// set the total bitrate
buf[0] = 0xb1;
buf[1] = params->total_bitrate >> 8;
buf[2] = params->total_bitrate & 0xff;
i2c_master_send(client, buf, 3);
return 0;
}
static int saa6752hs_init(struct i2c_client* client, struct mpeg_params* params)
{
{
unsigned char buf[3];
void *data;
......@@ -244,41 +244,41 @@ static int saa6752hs_init(struct i2c_client* client, struct mpeg_params* params)
return -EINVAL;
if (params->bitrate_mode == MPEG_BITRATE_MODE_MAX &&
params->video_target_bitrate <= params->video_max_bitrate)
return -EINVAL;
return -EINVAL;
}
// Set GOP structure {3, 13}
buf[0] = 0x72;
buf[1] = 0x03;
buf[2] = 0x0D;
i2c_master_send(client,buf,3);
// Set minimum Q-scale {4}
buf[0] = 0x82;
buf[1] = 0x04;
i2c_master_send(client,buf,2);
// Set maximum Q-scale {12}
buf[0] = 0x83;
buf[1] = 0x0C;
i2c_master_send(client,buf,2);
// Set Output Protocol
buf[0] = 0xD0;
buf[1] = 0x01;
i2c_master_send(client,buf,2);
// Set video output stream format {TS}
buf[0] = 0xB0;
buf[1] = 0x05;
i2c_master_send(client,buf,2);
// Set Audio PID {0x103}
buf[0] = 0xC1;
buf[1] = 0x01;
buf[2] = 0x03;
i2c_master_send(client,buf,3);
// setup bitrate settings
data = i2c_get_clientdata(client);
if (params) {
......@@ -288,18 +288,18 @@ static int saa6752hs_init(struct i2c_client* client, struct mpeg_params* params)
// parameters were not supplied. use the previous set
saa6752hs_set_bitrate(client, (struct mpeg_params*) data);
}
// Send SI tables
i2c_master_send(client,PAT,sizeof(PAT));
i2c_master_send(client,PMT,sizeof(PMT));
// mute then unmute audio. This removes buzzing artefacts
buf[0] = 0xa4;
buf[1] = 1;
i2c_master_send(client, buf, 2);
buf[1] = 0;
i2c_master_send(client, buf, 2);
// start it going
saa6752hs_chip_command(client, SAA6752HS_COMMAND_START);
......@@ -320,14 +320,14 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind)
return -ENOMEM;
memcpy(client,&client_template,sizeof(struct i2c_client));
strlcpy(client->name, "saa6752hs", sizeof(client->name));
if (NULL == (params = kmalloc(sizeof(struct mpeg_params), GFP_KERNEL)))
return -ENOMEM;
memcpy(params,&mpeg_params_template,sizeof(struct mpeg_params));
i2c_set_clientdata(client, params);
i2c_attach_client(client);
return 0;
}
......@@ -362,7 +362,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* nothing */
break;
}
return 0;
}
......
/*
* $Id: saa7134-cards.c,v 1.27 2004/09/30 14:17:12 kraxel Exp $
* $Id: saa7134-cards.c,v 1.35 2004/11/07 14:44:59 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* card-specific stuff.
......@@ -199,7 +199,7 @@ struct saa7134_board saa7134_boards[] = {
.name = name_radio,
.amux = LINE2,
},
.has_ts = 1,
.mpeg = SAA7134_MPEG_EMPRESS,
.video_out = CCIR656,
},
[SAA7134_BOARD_MONSTERTV] = {
......@@ -323,7 +323,7 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE2,
.gpio = 0x20000,
},
.has_ts = 1,
.mpeg = SAA7134_MPEG_EMPRESS,
.video_out = CCIR656,
},
[SAA7134_BOARD_CINERGY400] = {
......@@ -628,7 +628,7 @@ struct saa7134_board saa7134_boards[] = {
.vmux = 8,
.amux = LINE1,
}},
.has_ts = 1,
.mpeg = SAA7134_MPEG_EMPRESS,
.video_out = CCIR656,
},
[SAA7134_BOARD_VIDEOMATE_TV] = {
......@@ -752,7 +752,7 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE2,
.tv = 1,
}},
.has_ts = 1,
.mpeg = SAA7134_MPEG_EMPRESS,
.video_out = CCIR656,
},
[SAA7134_BOARD_ASUSTEK_TVFM7133] = {
......@@ -785,7 +785,7 @@ struct saa7134_board saa7134_boards[] = {
.name = "Pinnacle PCTV Stereo (saa7134)",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_MT2032,
.tda9887_conf = TDA9887_PRESENT,
.tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER,
.inputs = {{
.name = name_tv,
.vmux = 3,
......@@ -838,7 +838,7 @@ struct saa7134_board saa7134_boards[] = {
.name = name_svideo,
.vmux = 8,
.amux = LINE1,
},{
},{
.name = name_comp1,
.vmux = 1,
.amux = LINE1,
......@@ -1075,7 +1075,6 @@ struct saa7134_board saa7134_boards[] = {
.name = name_tv,
.vmux = 1,
.amux = LINE2,
.gpio = 0x0000,
.tv = 1,
},{
.name = name_comp1,
......@@ -1174,7 +1173,7 @@ struct saa7134_board saa7134_boards[] = {
.tv = 1,
}},
},
[SAA7134_EMPIRE_PCI_TV_RADIO_LE] = {
[SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE] = {
/* "Matteo Az" <matte.az@nospam.libero.it> ;-) */
.name = "Empire PCI TV-Radio LE",
.audio_clock = 0x00187de7,
......@@ -1208,6 +1207,77 @@ struct saa7134_board saa7134_boards[] = {
.gpio =0x8000,
}
},
[SAA7134_BOARD_AVERMEDIA_307] = {
/* Nickolay V. Shmyrev <nshmyrev@yandex.ru> */
.name = "Avermedia AVerTV Studio 307",
.audio_clock = 0x00187de7,
.tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
.tda9887_conf = TDA9887_PRESENT,
.inputs = {{
.name = name_tv,
.vmux = 1,
.amux = TV,
.tv = 1,
},{
.name = name_comp1,
.vmux = 0,
.amux = LINE2,
},{
.name = name_comp2,
.vmux = 3,
.amux = LINE2,
},{
.name = name_svideo,
.vmux = 8,
.amux = LINE2,
}},
.radio = {
.name = name_radio,
.amux = TV,
},
},
[SAA7134_BOARD_AVERMEDIA_CARDBUS] = {
/* Jon Westgate <oryn@oryn.fsck.tv> */
.name = "AVerMedia Cardbus TV/Radio",
.audio_clock = 0x00200000,
.tuner_type = TUNER_PHILIPS_PAL,
.inputs = {{
.name = name_tv,
.vmux = 1,
.amux = LINE2,
.tv = 1,
},{
.name = name_comp1,
.vmux = 3,
.amux = LINE2,
},{
.name = name_svideo,
.vmux = 8,
.amux = LINE2,
}},
.radio = {
.name = name_radio,
.amux = LINE1,
},
},
[SAA7134_BOARD_CINERGY400_CARDBUS] = {
.name = "Terratec Cinergy 400 mobile",
.audio_clock = 0x187de7,
.tuner_type = UNSET /* not supported yet :/ */,
.inputs = {{
.name = name_tv,
.vmux = 5,
.tv = 1,
},{
.name = name_comp1,
.vmux = 3,
.amux = LINE1,
},{
.name = name_svideo,
.vmux = 4,
.amux = LINE1,
}},
},
};
const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
......@@ -1251,6 +1321,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subvendor = 0x153B,
.subdevice = 0x1143,
.driver_data = SAA7134_BOARD_CINERGY600,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7133,
.subvendor = 0x153b,
.subdevice = 0x1162,
.driver_data = SAA7134_BOARD_CINERGY400_CARDBUS,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
......@@ -1384,6 +1460,13 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subdevice = 0x10ff,
.driver_data = SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER,
},{
/* AVerMedia CardBus */
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
.subvendor = 0x1461, /* Avermedia Technologies Inc */
.subdevice = 0xd6ee,
.driver_data = SAA7134_BOARD_AVERMEDIA_CARDBUS,
},{
/* TransGear 3000TV */
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7130,
......@@ -1396,6 +1479,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subvendor = 0x11bd,
.subdevice = 0x002b,
.driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
.subvendor = 0x11bd,
.subdevice = 0x002d, /* 300i DVB-T + PAL */
.driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
......@@ -1427,7 +1516,14 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subvendor = 0x185b,
.subdevice = 0xc100,
.driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR,
},{
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134,
.subvendor = 0x1461, /* Avermedia Technologies Inc */
.subdevice = 0x9715,
.driver_data = SAA7134_BOARD_AVERMEDIA_307,
},{
/* --- boards without eeprom + subsystem ID --- */
.vendor = PCI_VENDOR_ID_PHILIPS,
......@@ -1442,7 +1538,7 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subdevice = 0,
.driver_data = SAA7134_BOARD_NOAUTO,
},{
/* --- default catch --- */
.vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7130,
......@@ -1544,6 +1640,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
case SAA7134_BOARD_ECS_TVP3XP:
case SAA7134_BOARD_ECS_TVP3XP_4CB5:
case SAA7134_BOARD_MD2819:
case SAA7134_BOARD_AVERMEDIA_307:
dev->has_remote = 1;
break;
case SAA7134_BOARD_AVACSSMARTTV:
......@@ -1555,6 +1652,11 @@ int saa7134_board_init1(struct saa7134_dev *dev)
"%s: you try the audio_clock_override=0x200000 insmod option.\n",
dev->name,dev->name,dev->name);
break;
case SAA7134_BOARD_CINERGY400_CARDBUS:
/* power-up tuner chip */
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x00040000, 0x00040000);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000);
break;
}
return 0;
}
......
This diff is collapsed.
/*
* $Id: saa7134-dvb.c,v 1.4 2004/11/07 14:44:59 kraxel Exp $
*
* (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/kthread.h>
#include <linux/suspend.h>
#include "saa7134-reg.h"
#include "saa7134.h"
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL");
/* ------------------------------------------------------------------ */
static int dvb_init(struct saa7134_dev *dev)
{
printk("%s: %s\n",dev->name,__FUNCTION__);
/* init struct videobuf_dvb */
dev->dvb.name = dev->name;
videobuf_queue_init(&dev->dvb.dvbq, &saa7134_ts_qops,
dev->pci, &dev->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_TOP,
sizeof(struct saa7134_buf),
dev);
/* TODO: init frontend */
if (NULL == dev->dvb.frontend)
return -1;
/* register everything else */
return videobuf_dvb_register(&dev->dvb);
}
static int dvb_fini(struct saa7134_dev *dev)
{
printk("%s: %s\n",dev->name,__FUNCTION__);
videobuf_dvb_unregister(&dev->dvb);
return 0;
}
static struct saa7134_mpeg_ops dvb_ops = {
.type = SAA7134_MPEG_DVB,
.init = dvb_init,
.fini = dvb_fini,
};
static int __init dvb_register(void)
{
return saa7134_ts_register(&dvb_ops);
}
static void __exit dvb_unregister(void)
{
saa7134_ts_unregister(&dvb_ops);
}
module_init(dvb_register);
module_exit(dvb_unregister);
/* ------------------------------------------------------------------ */
/*
* Local variables:
* c-basic-offset: 8
* compile-command: "make DVB=1"
* End:
*/
/*
* $Id: saa7134-empress.c,v 1.3 2004/11/07 13:17:15 kraxel Exp $
*
* (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/init.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include "saa7134-reg.h"
#include "saa7134.h"
#include <media/saa6752hs.h>
/* ------------------------------------------------------------------ */
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL");
static unsigned int empress_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET };
module_param_array(empress_nr, int, NULL, 0444);
MODULE_PARM_DESC(empress_nr,"ts device number");
static unsigned int debug = 0;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug,"enable debug messages");
#define dprintk(fmt, arg...) if (debug) \
printk(KERN_DEBUG "%s/empress: " fmt, dev->name , ## arg)
/* ------------------------------------------------------------------ */
static void ts_reset_encoder(struct saa7134_dev* dev)
{
saa_writeb(SAA7134_SPECIAL_MODE, 0x00);
msleep(10);
saa_writeb(SAA7134_SPECIAL_MODE, 0x01);
msleep(100);
}
static int ts_init_encoder(struct saa7134_dev* dev, void* arg)
{
ts_reset_encoder(dev);
saa7134_i2c_call_clients(dev, MPEG_SETPARAMS, arg);
return 0;
}
/* ------------------------------------------------------------------ */
static int ts_open(struct inode *inode, struct file *file)
{
int minor = iminor(inode);
struct saa7134_dev *h,*dev = NULL;
struct list_head *list;
int err;
list_for_each(list,&saa7134_devlist) {
h = list_entry(list, struct saa7134_dev, devlist);
if (h->empress_dev && h->empress_dev->minor == minor)
dev = h;
}
if (NULL == dev)
return -ENODEV;
dprintk("open minor=%d\n",minor);
down(&dev->empress_tsq.lock);
err = -EBUSY;
if (dev->empress_users)
goto done;
dev->empress_users++;
file->private_data = dev;
ts_init_encoder(dev, NULL);
err = 0;
done:
up(&dev->empress_tsq.lock);
return err;
}
static int ts_release(struct inode *inode, struct file *file)
{
struct saa7134_dev *dev = file->private_data;
if (dev->empress_tsq.streaming)
videobuf_streamoff(&dev->empress_tsq);
down(&dev->empress_tsq.lock);
if (dev->empress_tsq.reading)
videobuf_read_stop(&dev->empress_tsq);
dev->empress_users--;
/* stop the encoder */
ts_reset_encoder(dev);
up(&dev->empress_tsq.lock);
return 0;
}
static ssize_t
ts_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
{
struct saa7134_dev *dev = file->private_data;
return videobuf_read_stream(&dev->empress_tsq,
data, count, ppos, 0,
file->f_flags & O_NONBLOCK);
}
static unsigned int
ts_poll(struct file *file, struct poll_table_struct *wait)
{
struct saa7134_dev *dev = file->private_data;
return videobuf_poll_stream(file, &dev->empress_tsq, wait);
}
static int
ts_mmap(struct file *file, struct vm_area_struct * vma)
{
struct saa7134_dev *dev = file->private_data;
return videobuf_mmap_mapper(&dev->empress_tsq, vma);
}
/*
* This function is _not_ called directly, but from
* video_generic_ioctl (and maybe others). userspace
* copying is done already, arg is a kernel pointer.
*/
static int ts_do_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *arg)
{
struct saa7134_dev *dev = file->private_data;
if (debug > 1)
saa7134_print_ioctl(dev->name,cmd);
switch (cmd) {
case VIDIOC_QUERYCAP:
{
struct v4l2_capability *cap = arg;
memset(cap,0,sizeof(*cap));
strcpy(cap->driver, "saa7134");
strlcpy(cap->card, saa7134_boards[dev->board].name,
sizeof(cap->card));
sprintf(cap->bus_info,"PCI:%s",pci_name(dev->pci));
cap->version = SAA7134_VERSION_CODE;
cap->capabilities =
V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING;
return 0;
}
/* --- input switching --------------------------------------- */
case VIDIOC_ENUMINPUT:
{
struct v4l2_input *i = arg;
if (i->index != 0)
return -EINVAL;
i->type = V4L2_INPUT_TYPE_CAMERA;
strcpy(i->name,"CCIR656");
return 0;
}
case VIDIOC_G_INPUT:
{
int *i = arg;
*i = 0;
return 0;
}
case VIDIOC_S_INPUT:
{
int *i = arg;
if (*i != 0)
return -EINVAL;
return 0;
}
/* --- capture ioctls ---------------------------------------- */
case VIDIOC_ENUM_FMT:
{
struct v4l2_fmtdesc *f = arg;
int index;
index = f->index;
if (index != 0)
return -EINVAL;
memset(f,0,sizeof(*f));
f->index = index;
strlcpy(f->description, "MPEG TS", sizeof(f->description));
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
f->pixelformat = V4L2_PIX_FMT_MPEG;
return 0;
}
case VIDIOC_G_FMT:
{
struct v4l2_format *f = arg;
memset(f,0,sizeof(*f));
f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
/* FIXME: translate subsampling type EMPRESS into
* width/height: */
f->fmt.pix.width = 720; /* D1 */
f->fmt.pix.height = 576;
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
f->fmt.pix.sizeimage = TS_PACKET_SIZE * dev->ts.nr_packets;
return 0;
}
case VIDIOC_S_FMT:
{
struct v4l2_format *f = arg;
if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
/*
FIXME: translate and round width/height into EMPRESS
subsample type:
type | PAL | NTSC
---------------------------
SIF | 352x288 | 352x240
1/2 D1 | 352x576 | 352x480
2/3 D1 | 480x576 | 480x480
D1 | 720x576 | 720x480
*/
f->fmt.pix.width = 720; /* D1 */
f->fmt.pix.height = 576;
f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
f->fmt.pix.sizeimage = TS_PACKET_SIZE* dev->ts.nr_packets;
return 0;
}
case VIDIOC_REQBUFS:
return videobuf_reqbufs(&dev->empress_tsq,arg);
case VIDIOC_QUERYBUF:
return videobuf_querybuf(&dev->empress_tsq,arg);
case VIDIOC_QBUF:
return videobuf_qbuf(&dev->empress_tsq,arg);
case VIDIOC_DQBUF:
return videobuf_dqbuf(&dev->empress_tsq,arg,
file->f_flags & O_NONBLOCK);
case VIDIOC_STREAMON:
return videobuf_streamon(&dev->empress_tsq);
case VIDIOC_STREAMOFF:
return videobuf_streamoff(&dev->empress_tsq);
case VIDIOC_QUERYCTRL:
case VIDIOC_G_CTRL:
case VIDIOC_S_CTRL:
return saa7134_common_ioctl(dev, cmd, arg);
case MPEG_SETPARAMS:
return ts_init_encoder(dev, arg);
default:
return -ENOIOCTLCMD;
}
return 0;
}
static int ts_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
return video_usercopy(inode, file, cmd, arg, ts_do_ioctl);
}
static struct file_operations ts_fops =
{
.owner = THIS_MODULE,
.open = ts_open,
.release = ts_release,
.read = ts_read,
.poll = ts_poll,
.mmap = ts_mmap,
.ioctl = ts_ioctl,
.llseek = no_llseek,
};
/* ----------------------------------------------------------- */
static struct video_device saa7134_empress_template =
{
.name = "saa7134-empress",
.type = 0 /* FIXME */,
.type2 = 0 /* FIXME */,
.hardware = 0,
.fops = &ts_fops,
.minor = -1,
};
static int empress_init(struct saa7134_dev *dev)
{
int err;
dprintk("%s: %s\n",dev->name,__FUNCTION__);
dev->empress_dev = video_device_alloc();
if (NULL == dev->empress_dev)
return -ENOMEM;
*(dev->empress_dev) = saa7134_empress_template;
dev->empress_dev->dev = &dev->pci->dev;
dev->empress_dev->release = video_device_release;
snprintf(dev->empress_dev->name, sizeof(dev->empress_dev->name),
"%s empress (%s)", dev->name,
saa7134_boards[dev->board].name);
err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER,
empress_nr[dev->nr]);
if (err < 0) {
printk(KERN_INFO "%s: can't register video device\n",
dev->name);
video_device_release(dev->empress_dev);
dev->empress_dev = NULL;
return err;
}
printk(KERN_INFO "%s: registered device video%d [mpeg]\n",
dev->name,dev->empress_dev->minor & 0x1f);
videobuf_queue_init(&dev->empress_tsq, &saa7134_ts_qops,
dev->pci, &dev->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_ALTERNATE,
sizeof(struct saa7134_buf),
dev);
return 0;
}
static int empress_fini(struct saa7134_dev *dev)
{
dprintk("%s: %s\n",dev->name,__FUNCTION__);
if (NULL == dev->empress_dev)
return 0;
video_unregister_device(dev->empress_dev);
dev->empress_dev = NULL;
return 0;
}
static struct saa7134_mpeg_ops empress_ops = {
.type = SAA7134_MPEG_EMPRESS,
.init = empress_init,
.fini = empress_fini,
};
static int __init empress_register(void)
{
return saa7134_ts_register(&empress_ops);
}
static void __exit empress_unregister(void)
{
saa7134_ts_unregister(&empress_ops);
}
module_init(empress_register);
module_exit(empress_unregister);
/* ----------------------------------------------------------- */
/*
* Local variables:
* c-basic-offset: 8
* End:
*/
/*
* $Id: saa7134-i2c.c,v 1.5 2004/10/06 17:30:51 kraxel Exp $
* $Id: saa7134-i2c.c,v 1.7 2004/11/07 13:17:15 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* i2c interface support
......@@ -34,11 +34,11 @@
/* ----------------------------------------------------------- */
static unsigned int i2c_debug = 0;
MODULE_PARM(i2c_debug,"i");
module_param(i2c_debug, int, 0644);
MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]");
static unsigned int i2c_scan = 0;
MODULE_PARM(i2c_scan,"i");
module_param(i2c_scan, int, 0444);
MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
#define d1printk if (1 == i2c_debug) printk
......@@ -88,7 +88,7 @@ enum i2c_attr {
static inline enum i2c_status i2c_get_status(struct saa7134_dev *dev)
{
enum i2c_status status;
status = saa_readb(SAA7134_I2C_ATTR_STATUS) & 0x0f;
d2printk(KERN_DEBUG "%s: i2c stat <= %s\n",dev->name,
str_i2c_status[status]);
......@@ -184,7 +184,7 @@ static int i2c_reset(struct saa7134_dev *dev)
if (!i2c_is_idle(status))
return FALSE;
i2c_set_attr(dev,NOP);
return TRUE;
}
......@@ -210,7 +210,7 @@ static inline int i2c_send_byte(struct saa7134_dev *dev,
saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword);
#endif
d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data);
if (!i2c_is_busy_wait(dev))
return -EIO;
status = i2c_get_status(dev);
......@@ -223,7 +223,7 @@ static inline int i2c_recv_byte(struct saa7134_dev *dev)
{
enum i2c_status status;
unsigned char data;
i2c_set_attr(dev,CONTINUE);
if (!i2c_is_busy_wait(dev))
return -EIO;
......@@ -302,7 +302,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
/* ----------------------------------------------------------- */
static int algo_control(struct i2c_adapter *adapter,
static int algo_control(struct i2c_adapter *adapter,
unsigned int cmd, unsigned long arg)
{
return 0;
......@@ -313,6 +313,18 @@ static u32 functionality(struct i2c_adapter *adap)
return I2C_FUNC_SMBUS_EMUL;
}
#ifndef I2C_PEC
static void inc_use(struct i2c_adapter *adap)
{
MOD_INC_USE_COUNT;
}
static void dec_use(struct i2c_adapter *adap)
{
MOD_DEC_USE_COUNT;
}
#endif
static int attach_inform(struct i2c_client *client)
{
struct saa7134_dev *dev = client->adapter->algo_data;
......@@ -419,10 +431,10 @@ int saa7134_i2c_register(struct saa7134_dev *dev)
strcpy(dev->i2c_adap.name,dev->name);
dev->i2c_adap.algo_data = dev;
i2c_add_adapter(&dev->i2c_adap);
dev->i2c_client = saa7134_client_template;
dev->i2c_client.adapter = &dev->i2c_adap;
saa7134_i2c_eeprom(dev,dev->eedata,sizeof(dev->eedata));
if (i2c_scan)
do_i2c_scan(dev->name,&dev->i2c_client);
......
/*
* $Id: saa7134-input.c,v 1.9 2004/09/15 16:15:24 kraxel Exp $
* $Id: saa7134-input.c,v 1.12 2004/11/07 13:17:15 kraxel Exp $
*
* handle saa7134 IR remotes via linux kernel input layer.
*
......@@ -30,11 +30,11 @@
#include "saa7134.h"
static unsigned int disable_ir = 0;
MODULE_PARM(disable_ir,"i");
module_param(disable_ir, int, 0444);
MODULE_PARM_DESC(disable_ir,"disable infrared remote support");
static unsigned int ir_debug = 0;
MODULE_PARM(ir_debug,"i");
module_param(ir_debug, int, 0644);
MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
#define dprintk(fmt, arg...) if (ir_debug) \
......@@ -63,7 +63,7 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = {
[ 20 ] = KEY_VOLUMEUP,
[ 23 ] = KEY_VOLUMEDOWN,
[ 18 ] = KEY_CHANNELUP, // Channel +
[ 19 ] = KEY_CHANNELDOWN, // Channel -
[ 19 ] = KEY_CHANNELDOWN, // Channel -
[ 6 ] = KEY_AGAIN, // Recal
[ 16 ] = KEY_KPENTER, // Enter
......@@ -353,6 +353,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
polling = 50; // ms
break;
case SAA7134_BOARD_MD2819:
case SAA7134_BOARD_AVERMEDIA_307:
ir_codes = md2819_codes;
mask_keycode = 0x0007C8;
mask_keydown = 0x000010;
......@@ -378,7 +379,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
ir->mask_keydown = mask_keydown;
ir->mask_keyup = mask_keyup;
ir->polling = polling;
/* init input device */
snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)",
saa7134_boards[dev->board].name);
......@@ -417,7 +418,7 @@ void saa7134_input_fini(struct saa7134_dev *dev)
{
if (NULL == dev->remote)
return;
input_unregister_device(&dev->remote->dev);
if (dev->remote->polling)
del_timer_sync(&dev->remote->timer);
......
/*
* $Id: saa7134-oss.c,v 1.9 2004/09/15 16:15:24 kraxel Exp $
* $Id: saa7134-oss.c,v 1.11 2004/11/07 13:17:15 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* oss dsp interface
......@@ -34,11 +34,11 @@
/* ------------------------------------------------------------------ */
static unsigned int oss_debug = 0;
MODULE_PARM(oss_debug,"i");
module_param(oss_debug, int, 0644);
MODULE_PARM_DESC(oss_debug,"enable debug messages [oss]");
static unsigned int oss_rate = 0;
MODULE_PARM(oss_rate,"i");
module_param(oss_rate, int, 0444);
MODULE_PARM_DESC(oss_rate,"sample rate (valid are: 32000,48000)");
#define dprintk(fmt, arg...) if (oss_debug) \
......@@ -140,7 +140,7 @@ static int dsp_rec_start(struct saa7134_dev *dev)
}
switch (dev->oss.afmt) {
case AFMT_S8:
case AFMT_S8:
case AFMT_S16_LE:
case AFMT_S16_BE: sign = 1; break;
default: sign = 0; break;
......@@ -161,7 +161,7 @@ static int dsp_rec_start(struct saa7134_dev *dev)
if (sign)
fmt |= 0x04;
fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80;
saa_writeb(SAA7134_NUM_SAMPLES0, (dev->oss.blksize & 0x0000ff));
saa_writeb(SAA7134_NUM_SAMPLES1, (dev->oss.blksize & 0x00ff00) >> 8);
saa_writeb(SAA7134_NUM_SAMPLES2, (dev->oss.blksize & 0xff0000) >> 16);
......@@ -193,7 +193,7 @@ static int dsp_rec_start(struct saa7134_dev *dev)
saa_writel(SAA7134_RS_BA2(6),dev->oss.blksize);
saa_writel(SAA7134_RS_PITCH(6),0);
saa_writel(SAA7134_RS_CONTROL(6),control);
/* start dma */
dev->oss.recording_on = 1;
spin_lock_irqsave(&dev->slock,flags);
......@@ -369,7 +369,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
void __user *argp = (void __user *) arg;
int __user *p = argp;
int val = 0;
if (oss_debug > 1)
saa7134_print_ioctl(dev->name,cmd);
switch (cmd) {
......@@ -412,7 +412,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
/* fall through */
case SOUND_PCM_READ_CHANNELS:
return put_user(dev->oss.channels, p);
case SNDCTL_DSP_GETFMTS: /* Returns a mask */
return put_user(AFMT_U8 | AFMT_S8 |
AFMT_U16_LE | AFMT_U16_BE |
......@@ -535,7 +535,7 @@ static int
mixer_recsrc_7134(struct saa7134_dev *dev)
{
int analog_io,rate;
switch (dev->oss.input) {
case TV:
saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0xc0);
......@@ -557,7 +557,7 @@ static int
mixer_recsrc_7133(struct saa7134_dev *dev)
{
u32 value = 0xbbbbbb;
switch (dev->oss.input) {
case TV:
value = 0xbbbb10; /* MAIN */
......@@ -655,7 +655,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file,
int val,ret;
void __user *argp = (void __user *) arg;
int __user *p = argp;
if (oss_debug > 1)
saa7134_print_ioctl(dev->name,cmd);
switch (cmd) {
......@@ -786,7 +786,7 @@ int saa7134_oss_init1(struct saa7134_dev *dev)
mixer_level(dev,LINE1,dev->oss.line1);
mixer_level(dev,LINE2,dev->oss.line2);
mixer_recsrc(dev, (dev->oss.rate == 32000) ? TV : LINE2);
return 0;
}
......@@ -840,7 +840,7 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status)
dev->oss.dma_blk = (dev->oss.dma_blk + 1) % dev->oss.blocks;
dev->oss.read_count += dev->oss.blksize;
wake_up(&dev->oss.wq);
done:
spin_unlock(&dev->slock);
}
......
This diff is collapsed.
/*
* $Id: saa7134-tvaudio.c,v 1.13 2004/09/22 11:47:11 kraxel Exp $
* $Id: saa7134-tvaudio.c,v 1.17 2004/11/07 13:17:15 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* tv audio decoder (fm stereo, nicam, ...)
......@@ -36,18 +36,18 @@
/* ------------------------------------------------------------------ */
static unsigned int audio_debug = 0;
MODULE_PARM(audio_debug,"i");
module_param(audio_debug, int, 0644);
MODULE_PARM_DESC(audio_debug,"enable debug messages [tv audio]");
static unsigned int audio_ddep = 0;
MODULE_PARM(audio_ddep,"i");
module_param(audio_ddep, int, 0644);
MODULE_PARM_DESC(audio_ddep,"audio ddep overwrite");
static int audio_clock_override = UNSET;
MODULE_PARM(audio_clock_override, "i");
module_param(audio_clock_override, int, 0644);
static int audio_clock_tweak = 0;
MODULE_PARM(audio_clock_tweak, "i");
module_param(audio_clock_tweak, int, 0644);
MODULE_PARM_DESC(audio_clock_tweak, "Audio clock tick fine tuning for cards with audio crystal that's slightly off (range [-1024 .. 1024])");
#define dprintk(fmt, arg...) if (audio_debug) \
......@@ -284,7 +284,7 @@ static void tvaudio_setmode(struct saa7134_dev *dev,
saa_writeb(SAA7134_AUDIO_CLOCKS_PER_FIELD1, (acpf & 0x00ff00) >> 8);
saa_writeb(SAA7134_AUDIO_CLOCKS_PER_FIELD2, (acpf & 0x030000) >> 16);
tvaudio_setcarrier(dev,audio->carr1,audio->carr2);
switch (audio->mode) {
case TVAUDIO_FM_MONO:
case TVAUDIO_FM_BG_STEREO:
......@@ -324,14 +324,21 @@ static void tvaudio_setmode(struct saa7134_dev *dev,
static int tvaudio_sleep(struct saa7134_dev *dev, int timeout)
{
DECLARE_WAITQUEUE(wait, current);
add_wait_queue(&dev->thread.wq, &wait);
if (dev->thread.scan1 == dev->thread.scan2 && !dev->thread.shutdown) {
if (timeout < 0) {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
} else
} else {
#if 0
/* hmm, that one doesn't return on wakeup ... */
msleep_interruptible(timeout);
#else
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(timeout));
#endif
}
}
remove_wait_queue(&dev->thread.wq, &wait);
return dev->thread.scan1 != dev->thread.scan2;
......@@ -407,7 +414,7 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
{
__u32 idp,nicam;
int retval = -1;
switch (audio->mode) {
case TVAUDIO_FM_MONO:
return V4L2_TUNER_SUB_MONO;
......@@ -644,7 +651,7 @@ static char *stdres[0x20] = {
[0x09] = "D/K NICAM",
[0x0a] = "L NICAM",
[0x0b] = "I NICAM",
[0x0c] = "M Korea",
[0x0d] = "M BTSC ",
[0x0e] = "M EIAJ",
......@@ -739,7 +746,7 @@ static int mute_input_7133(struct saa7134_dev *dev)
{
u32 reg = 0;
int mask;
switch (dev->input->amux) {
case TV: reg = 0x02; break;
case LINE1: reg = 0x00; break;
......@@ -845,12 +852,12 @@ static int tvaudio_thread_ddep(void *data)
(value & 0x002000) ? " BTSC stereo noise mute " : "",
(value & 0x004000) ? " SAP noise mute " : "",
(value & 0x008000) ? " VDSP " : "",
(value & 0x010000) ? " NICST " : "",
(value & 0x020000) ? " NICDU " : "",
(value & 0x040000) ? " NICAM muted " : "",
(value & 0x080000) ? " NICAM reserve sound " : "",
(value & 0x100000) ? " init done " : "");
}
......@@ -865,7 +872,7 @@ static int tvaudio_thread_ddep(void *data)
int saa7134_tvaudio_rx2mode(u32 rx)
{
u32 mode;
mode = V4L2_TUNER_MODE_MONO;
if (rx & V4L2_TUNER_SUB_STEREO)
mode = V4L2_TUNER_MODE_STEREO;
......@@ -875,7 +882,7 @@ int saa7134_tvaudio_rx2mode(u32 rx)
mode = V4L2_TUNER_MODE_LANG2;
return mode;
}
void saa7134_tvaudio_setmute(struct saa7134_dev *dev)
{
switch (dev->pci->device) {
......@@ -940,14 +947,14 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev)
int (*my_thread)(void *data) = NULL;
/* enable I2S audio output */
if (saa7134_boards[dev->board].has_ts) {
if (card_is_empress(dev)) {
int i2sform = (48000 == dev->oss.rate)
? 0x01 : 0x00;
/* enable I2S output */
saa_writeb(SAA7134_I2S_OUTPUT_SELECT, 0x80);
saa_writeb(SAA7134_I2S_OUTPUT_FORMAT, i2sform);
saa_writeb(SAA7134_I2S_OUTPUT_LEVEL, 0x0F);
saa_writeb(SAA7134_I2S_OUTPUT_SELECT, 0x80);
saa_writeb(SAA7134_I2S_OUTPUT_FORMAT, i2sform);
saa_writeb(SAA7134_I2S_OUTPUT_LEVEL, 0x0F);
saa_writeb(SAA7134_I2S_AUDIO_OUTPUT, 0x01);
}
......
/*
* $Id: saa7134-vbi.c,v 1.3 2004/09/23 13:58:19 kraxel Exp $
* $Id: saa7134-vbi.c,v 1.5 2004/11/07 13:17:15 kraxel Exp $
*
* device driver for philips saa7134 based TV cards
* video4linux video interface
......@@ -33,11 +33,11 @@
/* ------------------------------------------------------------------ */
static unsigned int vbi_debug = 0;
MODULE_PARM(vbi_debug,"i");
module_param(vbi_debug, int, 0644);
MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]");
static unsigned int vbibufs = 4;
MODULE_PARM(vbibufs,"i");
module_param(vbibufs, int, 0444);
MODULE_PARM_DESC(vbibufs,"number of vbi buffers, range 2-32");
#define dprintk(fmt, arg...) if (vbi_debug) \
......@@ -53,7 +53,7 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf,
int task)
{
struct saa7134_tvnorm *norm = dev->tvnorm;
/* setup video scaler */
saa_writeb(SAA7134_VBI_H_START1(task), norm->h_start & 0xff);
saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8);
......@@ -115,12 +115,13 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0;
}
static int buffer_prepare(void *priv, struct videobuf_buffer *vb,
static int buffer_prepare(struct videobuf_queue *q,
struct videobuf_buffer *vb,
enum v4l2_field field)
{
struct saa7134_fh *fh = priv;
struct saa7134_fh *fh = q->priv_data;
struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
struct saa7134_tvnorm *norm = dev->tvnorm;
unsigned int lines, llength, size;
int err;
......@@ -169,12 +170,12 @@ static int buffer_prepare(void *priv, struct videobuf_buffer *vb,
}
static int
buffer_setup(void *priv, unsigned int *count, unsigned int *size)
buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{
struct saa7134_fh *fh = priv;
struct saa7134_fh *fh = q->priv_data;
struct saa7134_dev *dev = fh->dev;
int llength,lines;
lines = dev->tvnorm->vbi_v_stop - dev->tvnorm->vbi_v_start +1;
#if 1
llength = VBI_LINE_LENGTH;
......@@ -190,21 +191,21 @@ buffer_setup(void *priv, unsigned int *count, unsigned int *size)
return 0;
}
static void buffer_queue(void *priv, struct videobuf_buffer *vb)
static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
{
struct saa7134_fh *fh = priv;
struct saa7134_fh *fh = q->priv_data;
struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
saa7134_buffer_queue(dev,&dev->vbi_q,buf);
}
static void buffer_release(void *priv, struct videobuf_buffer *vb)
static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
{
struct saa7134_fh *fh = priv;
struct saa7134_fh *fh = q->priv_data;
struct saa7134_dev *dev = fh->dev;
struct saa7134_buf *buf = (struct saa7134_buf *)vb;
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
saa7134_dma_free(dev,buf);
}
......
This diff is collapsed.
/*
* $Id: saa7134.h,v 1.20 2004/09/30 12:21:15 kraxel Exp $
* $Id: saa7134.h,v 1.27 2004/11/04 11:03:52 kraxel Exp $
*
* v4l2 device driver for philips saa7134 based TV cards
*
......@@ -31,11 +31,12 @@
#include <asm/io.h>
#include <media/video-buf.h>
#include <media/tuner.h>
#include <media/audiochip.h>
#include <media/id.h>
#include <media/ir-common.h>
#include <media/video-buf.h>
#include <media/video-buf-dvb.h>
#ifndef TRUE
# define TRUE (1==1)
......@@ -164,8 +165,12 @@ struct saa7134_format {
#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_BOARD_EMPIRE_PCI_TV_RADIO_LE 44
#define SAA7134_BOARD_AVERMEDIA_307 45
#define SAA7134_BOARD_AVERMEDIA_CARDBUS 46
#define SAA7134_BOARD_CINERGY400_CARDBUS 47
#define SAA7134_MAXBOARDS 8
#define SAA7134_INPUT_MAX 8
struct saa7134_input {
......@@ -176,6 +181,12 @@ struct saa7134_input {
unsigned int tv:1;
};
enum saa7134_mpeg_type {
SAA7134_MPEG_UNUSED,
SAA7134_MPEG_EMPRESS,
SAA7134_MPEG_DVB,
};
struct saa7134_board {
char *name;
unsigned int audio_clock;
......@@ -185,18 +196,20 @@ struct saa7134_board {
struct saa7134_input inputs[SAA7134_INPUT_MAX];
struct saa7134_input radio;
struct saa7134_input mute;
/* peripheral I/O */
unsigned int has_ts;
enum saa7134_video_out video_out;
/* i2c chip info */
unsigned int tuner_type;
unsigned int tda9887_conf;
/* peripheral I/O */
enum saa7134_video_out video_out;
enum saa7134_mpeg_type mpeg;
};
#define card_has_radio(dev) (NULL != saa7134_boards[dev->board].radio.name)
#define card_has_ts(dev) (saa7134_boards[dev->board].has_ts)
#define card_is_empress(dev) (SAA7134_MPEG_EMPRESS == saa7134_boards[dev->board].mpeg)
#define card_is_dvb(dev) (SAA7134_MPEG_DVB == saa7134_boards[dev->board].mpeg)
#define card_has_mpeg(dev) (SAA7134_MPEG_UNUSED != saa7134_boards[dev->board].mpeg)
#define card(dev) (saa7134_boards[dev->board])
#define card_in(dev,n) (saa7134_boards[dev->board].inputs[n])
......@@ -264,7 +277,7 @@ struct saa7134_fh {
unsigned int radio;
enum v4l2_buf_type type;
unsigned int resources;
#ifdef VIDIOC_G_PRIORITY
#ifdef VIDIOC_G_PRIORITY
enum v4l2_priority prio;
#endif
......@@ -284,16 +297,6 @@ struct saa7134_fh {
struct saa7134_pgtable pt_vbi;
};
/* TS status */
struct saa7134_ts {
unsigned int users;
/* TS capture */
struct videobuf_queue ts;
struct saa7134_pgtable pt_ts;
int started;
};
/* oss dsp status */
struct saa7134_oss {
struct semaphore lock;
......@@ -338,23 +341,37 @@ struct saa7134_ir {
struct timer_list timer;
};
/* ts/mpeg status */
struct saa7134_ts {
/* TS capture */
struct saa7134_pgtable pt_ts;
int nr_packets;
int nr_bufs;
};
/* ts/mpeg ops */
struct saa7134_mpeg_ops {
enum saa7134_mpeg_type type;
struct list_head next;
int (*init)(struct saa7134_dev *dev);
int (*fini)(struct saa7134_dev *dev);
};
/* global device status */
struct saa7134_dev {
struct list_head devlist;
struct semaphore lock;
spinlock_t slock;
#ifdef VIDIOC_G_PRIORITY
#ifdef VIDIOC_G_PRIORITY
struct v4l2_prio_state prio;
#endif
/* various device info */
unsigned int resources;
struct video_device *video_dev;
struct video_device *ts_dev;
struct video_device *radio_dev;
struct video_device *vbi_dev;
struct saa7134_oss oss;
struct saa7134_ts ts;
/* infrared remote */
int has_remote;
......@@ -362,6 +379,7 @@ struct saa7134_dev {
/* pci i/o */
char name[32];
int nr;
struct pci_dev *pci;
unsigned char pci_rev,pci_lat;
__u32 *lmmio;
......@@ -386,7 +404,6 @@ struct saa7134_dev {
/* video+ts+vbi capture */
struct saa7134_dmaqueue video_q;
struct saa7134_dmaqueue ts_q;
struct saa7134_dmaqueue vbi_q;
unsigned int video_fieldcount;
unsigned int vbi_fieldcount;
......@@ -420,6 +437,19 @@ struct saa7134_dev {
struct saa7134_input *hw_input;
unsigned int hw_mute;
int last_carrier;
/* SAA7134_MPEG_* */
struct saa7134_ts ts;
struct saa7134_dmaqueue ts_q;
struct saa7134_mpeg_ops *mops;
/* SAA7134_MPEG_EMPRESS only */
struct video_device *empress_dev;
struct videobuf_queue empress_tsq;
unsigned int empress_users;
/* SAA7134_MPEG_DVB only */
struct videobuf_dvb dvb;
};
/* ----------------------------------------------------------- */
......@@ -512,11 +542,16 @@ void saa7134_irq_video_done(struct saa7134_dev *dev, unsigned long status);
/* ----------------------------------------------------------- */
/* saa7134-ts.c */
extern struct video_device saa7134_ts_template;
#define TS_PACKET_SIZE 188 /* TS packets 188 bytes */
extern struct videobuf_queue_ops saa7134_ts_qops;
int saa7134_ts_init1(struct saa7134_dev *dev);
int saa7134_ts_fini(struct saa7134_dev *dev);
void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status);
int saa7134_ts_register(struct saa7134_mpeg_ops *ops);
void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops);
/* ----------------------------------------------------------- */
/* saa7134-vbi.c */
......
/*
/*
saa6752hs.h - definition for saa6752hs MPEG encoder
Copyright (C) 2003 Andrew de Quincey <adq@lidskialf.net>
......@@ -31,14 +31,14 @@ enum mpeg_bitrate_mode {
enum mpeg_audio_bitrate {
MPEG_AUDIO_BITRATE_256 = 0, /* 256 kBit/sec */
MPEG_AUDIO_BITRATE_384 = 1, /* 384 kBit/sec */
MPEG_AUDIO_BITRATE_MAX
};
#define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
#define MPEG_VIDEO_MAX_BITRATE_MAX 27000
#define MPEG_TOTAL_BITRATE_MAX 27000
struct mpeg_params {
enum mpeg_bitrate_mode bitrate_mode;
unsigned int video_target_bitrate;
......
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