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 ...@@ -245,6 +245,13 @@ config VIDEO_SAA7134
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called saa7134. 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 config VIDEO_MXB
tristate "Siemens-Nixdorf 'Multimedia eXtension Board'" tristate "Siemens-Nixdorf 'Multimedia eXtension Board'"
depends on VIDEO_DEV && PCI depends on VIDEO_DEV && PCI
......
...@@ -3,6 +3,8 @@ saa7134-objs := saa7134-cards.o saa7134-core.o saa7134-i2c.o \ ...@@ -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-oss.o saa7134-ts.o saa7134-tvaudio.o \
saa7134-vbi.o saa7134-video.o saa7134-input.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 { ...@@ -36,7 +36,7 @@ enum saa6752hs_command {
SAA6752HS_COMMAND_RECONFIGURE = 4, SAA6752HS_COMMAND_RECONFIGURE = 4,
SAA6752HS_COMMAND_SLEEP = 5, SAA6752HS_COMMAND_SLEEP = 5,
SAA6752HS_COMMAND_RECONFIGURE_FORCE = 6, SAA6752HS_COMMAND_RECONFIGURE_FORCE = 6,
SAA6752HS_COMMAND_MAX SAA6752HS_COMMAND_MAX
}; };
...@@ -46,24 +46,24 @@ enum saa6752hs_command { ...@@ -46,24 +46,24 @@ enum saa6752hs_command {
static u8 PAT[] = { static u8 PAT[] = {
0xc2, // i2c register 0xc2, // i2c register
0x00, // table number for encoder 0x00, // table number for encoder
0x47, // sync 0x47, // sync
0x40, 0x00, // transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0) 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) 0x10, // transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0)
0x00, // PSI pointer to start of table 0x00, // PSI pointer to start of table
0x00, // tid(0) 0x00, // tid(0)
0xb0, 0x0d, // section_syntax_indicator(1), section_length(13) 0xb0, 0x0d, // section_syntax_indicator(1), section_length(13)
0x00, 0x01, // transport_stream_id(1) 0x00, 0x01, // transport_stream_id(1)
0xc1, // version_number(0), current_next_indicator(1) 0xc1, // version_number(0), current_next_indicator(1)
0x00, 0x00, // section_number(0), last_section_number(0) 0x00, 0x00, // section_number(0), last_section_number(0)
0x00, 0x01, // program_number(1) 0x00, 0x01, // program_number(1)
0xe0, 0x10, // PMT PID(0x10) 0xe0, 0x10, // PMT PID(0x10)
0x76, 0xf1, 0x44, 0xd1 // CRC32 0x76, 0xf1, 0x44, 0xd1 // CRC32
...@@ -72,29 +72,29 @@ static u8 PAT[] = { ...@@ -72,29 +72,29 @@ static u8 PAT[] = {
static u8 PMT[] = { static u8 PMT[] = {
0xc2, // i2c register 0xc2, // i2c register
0x01, // table number for encoder 0x01, // table number for encoder
0x47, // sync 0x47, // sync
0x40, 0x10, // transport_error_indicator(0), payload_unit_start(1), transport_priority(0), pid(0x10) 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) 0x10, // transport_scrambling_control(00), adaptation_field_control(01), continuity_counter(0)
0x00, // PSI pointer to start of table 0x00, // PSI pointer to start of table
0x02, // tid(2) 0x02, // tid(2)
0xb0, 0x17, // section_syntax_indicator(1), section_length(23) 0xb0, 0x17, // section_syntax_indicator(1), section_length(23)
0x00, 0x01, // program_number(1) 0x00, 0x01, // program_number(1)
0xc1, // version_number(0), current_next_indicator(1) 0xc1, // version_number(0), current_next_indicator(1)
0x00, 0x00, // section_number(0), last_section_number(0) 0x00, 0x00, // section_number(0), last_section_number(0)
0xe1, 0x04, // PCR_PID (0x104) 0xe1, 0x04, // PCR_PID (0x104)
0xf0, 0x00, // program_info_length(0) 0xf0, 0x00, // program_info_length(0)
0x02, 0xe1, 0x00, 0xf0, 0x00, // video stream type(2), pid(0x100) 0x02, 0xe1, 0x00, 0xf0, 0x00, // video stream type(2), pid(0x100)
0x04, 0xe1, 0x03, 0xf0, 0x00, // audio stream type(4), pid(0x103) 0x04, 0xe1, 0x03, 0xf0, 0x00, // audio stream type(4), pid(0x103)
0xa1, 0xca, 0x0f, 0x82 // CRC32 0xa1, 0xca, 0x0f, 0x82 // CRC32
}; };
...@@ -106,7 +106,7 @@ static struct mpeg_params mpeg_params_template = ...@@ -106,7 +106,7 @@ static struct mpeg_params mpeg_params_template =
.total_bitrate = 6000, .total_bitrate = 6000,
}; };
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
...@@ -122,11 +122,11 @@ static int saa6752hs_chip_command(struct i2c_client* client, ...@@ -122,11 +122,11 @@ static int saa6752hs_chip_command(struct i2c_client* client,
case SAA6752HS_COMMAND_RESET: case SAA6752HS_COMMAND_RESET:
buf[0] = 0x00; buf[0] = 0x00;
break; break;
case SAA6752HS_COMMAND_STOP: case SAA6752HS_COMMAND_STOP:
buf[0] = 0x03; buf[0] = 0x03;
break; break;
case SAA6752HS_COMMAND_START: case SAA6752HS_COMMAND_START:
buf[0] = 0x02; buf[0] = 0x02;
break; break;
...@@ -134,11 +134,11 @@ static int saa6752hs_chip_command(struct i2c_client* client, ...@@ -134,11 +134,11 @@ static int saa6752hs_chip_command(struct i2c_client* client,
case SAA6752HS_COMMAND_PAUSE: case SAA6752HS_COMMAND_PAUSE:
buf[0] = 0x04; buf[0] = 0x04;
break; break;
case SAA6752HS_COMMAND_RECONFIGURE: case SAA6752HS_COMMAND_RECONFIGURE:
buf[0] = 0x05; buf[0] = 0x05;
break; break;
case SAA6752HS_COMMAND_SLEEP: case SAA6752HS_COMMAND_SLEEP:
buf[0] = 0x06; buf[0] = 0x06;
break; break;
...@@ -146,11 +146,11 @@ static int saa6752hs_chip_command(struct i2c_client* client, ...@@ -146,11 +146,11 @@ static int saa6752hs_chip_command(struct i2c_client* client,
case SAA6752HS_COMMAND_RECONFIGURE_FORCE: case SAA6752HS_COMMAND_RECONFIGURE_FORCE:
buf[0] = 0x07; buf[0] = 0x07;
break; break;
default: default:
return -EINVAL; return -EINVAL;
} }
// set it and wait for it to be so // set it and wait for it to be so
i2c_master_send(client, buf, 1); i2c_master_send(client, buf, 1);
timeout = jiffies + HZ * 3; timeout = jiffies + HZ * 3;
...@@ -166,14 +166,14 @@ static int saa6752hs_chip_command(struct i2c_client* client, ...@@ -166,14 +166,14 @@ static int saa6752hs_chip_command(struct i2c_client* client,
status = -ETIMEDOUT; status = -ETIMEDOUT;
break; break;
} }
// wait a bit // wait a bit
msleep(10); msleep(10);
} }
// delay a bit to let encoder settle // delay a bit to let encoder settle
msleep(50); msleep(50);
// done // done
return status; return status;
} }
...@@ -183,12 +183,12 @@ static int saa6752hs_set_bitrate(struct i2c_client* client, ...@@ -183,12 +183,12 @@ static int saa6752hs_set_bitrate(struct i2c_client* client,
struct mpeg_params* params) struct mpeg_params* params)
{ {
u8 buf[3]; u8 buf[3];
// set the bitrate mode // set the bitrate mode
buf[0] = 0x71; buf[0] = 0x71;
buf[1] = params->bitrate_mode; buf[1] = params->bitrate_mode;
i2c_master_send(client, buf, 2); i2c_master_send(client, buf, 2);
// set the video bitrate // set the video bitrate
if (params->bitrate_mode == MPEG_BITRATE_MODE_VBR) { if (params->bitrate_mode == MPEG_BITRATE_MODE_VBR) {
// set the target bitrate // set the target bitrate
...@@ -209,24 +209,24 @@ static int saa6752hs_set_bitrate(struct i2c_client* client, ...@@ -209,24 +209,24 @@ static int saa6752hs_set_bitrate(struct i2c_client* client,
buf[2] = params->video_target_bitrate & 0xff; buf[2] = params->video_target_bitrate & 0xff;
i2c_master_send(client, buf, 3); i2c_master_send(client, buf, 3);
} }
// set the audio bitrate // set the audio bitrate
buf[0] = 0x94; buf[0] = 0x94;
buf[1] = params->audio_bitrate; buf[1] = params->audio_bitrate;
i2c_master_send(client, buf, 2); i2c_master_send(client, buf, 2);
// set the total bitrate // set the total bitrate
buf[0] = 0xb1; buf[0] = 0xb1;
buf[1] = params->total_bitrate >> 8; buf[1] = params->total_bitrate >> 8;
buf[2] = params->total_bitrate & 0xff; buf[2] = params->total_bitrate & 0xff;
i2c_master_send(client, buf, 3); i2c_master_send(client, buf, 3);
return 0; return 0;
} }
static int saa6752hs_init(struct i2c_client* client, struct mpeg_params* params) static int saa6752hs_init(struct i2c_client* client, struct mpeg_params* params)
{ {
unsigned char buf[3]; unsigned char buf[3];
void *data; void *data;
...@@ -244,41 +244,41 @@ static int saa6752hs_init(struct i2c_client* client, struct mpeg_params* params) ...@@ -244,41 +244,41 @@ static int saa6752hs_init(struct i2c_client* client, struct mpeg_params* params)
return -EINVAL; return -EINVAL;
if (params->bitrate_mode == MPEG_BITRATE_MODE_MAX && if (params->bitrate_mode == MPEG_BITRATE_MODE_MAX &&
params->video_target_bitrate <= params->video_max_bitrate) params->video_target_bitrate <= params->video_max_bitrate)
return -EINVAL; return -EINVAL;
} }
// Set GOP structure {3, 13} // Set GOP structure {3, 13}
buf[0] = 0x72; buf[0] = 0x72;
buf[1] = 0x03; buf[1] = 0x03;
buf[2] = 0x0D; buf[2] = 0x0D;
i2c_master_send(client,buf,3); i2c_master_send(client,buf,3);
// Set minimum Q-scale {4} // Set minimum Q-scale {4}
buf[0] = 0x82; buf[0] = 0x82;
buf[1] = 0x04; buf[1] = 0x04;
i2c_master_send(client,buf,2); i2c_master_send(client,buf,2);
// Set maximum Q-scale {12} // Set maximum Q-scale {12}
buf[0] = 0x83; buf[0] = 0x83;
buf[1] = 0x0C; buf[1] = 0x0C;
i2c_master_send(client,buf,2); i2c_master_send(client,buf,2);
// Set Output Protocol // Set Output Protocol
buf[0] = 0xD0; buf[0] = 0xD0;
buf[1] = 0x01; buf[1] = 0x01;
i2c_master_send(client,buf,2); i2c_master_send(client,buf,2);
// Set video output stream format {TS} // Set video output stream format {TS}
buf[0] = 0xB0; buf[0] = 0xB0;
buf[1] = 0x05; buf[1] = 0x05;
i2c_master_send(client,buf,2); i2c_master_send(client,buf,2);
// Set Audio PID {0x103} // Set Audio PID {0x103}
buf[0] = 0xC1; buf[0] = 0xC1;
buf[1] = 0x01; buf[1] = 0x01;
buf[2] = 0x03; buf[2] = 0x03;
i2c_master_send(client,buf,3); i2c_master_send(client,buf,3);
// setup bitrate settings // setup bitrate settings
data = i2c_get_clientdata(client); data = i2c_get_clientdata(client);
if (params) { if (params) {
...@@ -288,18 +288,18 @@ static int saa6752hs_init(struct i2c_client* client, struct mpeg_params* 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 // parameters were not supplied. use the previous set
saa6752hs_set_bitrate(client, (struct mpeg_params*) data); saa6752hs_set_bitrate(client, (struct mpeg_params*) data);
} }
// Send SI tables // Send SI tables
i2c_master_send(client,PAT,sizeof(PAT)); i2c_master_send(client,PAT,sizeof(PAT));
i2c_master_send(client,PMT,sizeof(PMT)); i2c_master_send(client,PMT,sizeof(PMT));
// mute then unmute audio. This removes buzzing artefacts // mute then unmute audio. This removes buzzing artefacts
buf[0] = 0xa4; buf[0] = 0xa4;
buf[1] = 1; buf[1] = 1;
i2c_master_send(client, buf, 2); i2c_master_send(client, buf, 2);
buf[1] = 0; buf[1] = 0;
i2c_master_send(client, buf, 2); i2c_master_send(client, buf, 2);
// start it going // start it going
saa6752hs_chip_command(client, SAA6752HS_COMMAND_START); saa6752hs_chip_command(client, SAA6752HS_COMMAND_START);
...@@ -320,14 +320,14 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -320,14 +320,14 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind)
return -ENOMEM; return -ENOMEM;
memcpy(client,&client_template,sizeof(struct i2c_client)); memcpy(client,&client_template,sizeof(struct i2c_client));
strlcpy(client->name, "saa6752hs", sizeof(client->name)); strlcpy(client->name, "saa6752hs", sizeof(client->name));
if (NULL == (params = kmalloc(sizeof(struct mpeg_params), GFP_KERNEL))) if (NULL == (params = kmalloc(sizeof(struct mpeg_params), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
memcpy(params,&mpeg_params_template,sizeof(struct mpeg_params)); memcpy(params,&mpeg_params_template,sizeof(struct mpeg_params));
i2c_set_clientdata(client, params); i2c_set_clientdata(client, params);
i2c_attach_client(client); i2c_attach_client(client);
return 0; return 0;
} }
...@@ -362,7 +362,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -362,7 +362,7 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* nothing */ /* nothing */
break; break;
} }
return 0; 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 * device driver for philips saa7134 based TV cards
* card-specific stuff. * card-specific stuff.
...@@ -199,7 +199,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -199,7 +199,7 @@ struct saa7134_board saa7134_boards[] = {
.name = name_radio, .name = name_radio,
.amux = LINE2, .amux = LINE2,
}, },
.has_ts = 1, .mpeg = SAA7134_MPEG_EMPRESS,
.video_out = CCIR656, .video_out = CCIR656,
}, },
[SAA7134_BOARD_MONSTERTV] = { [SAA7134_BOARD_MONSTERTV] = {
...@@ -323,7 +323,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -323,7 +323,7 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE2, .amux = LINE2,
.gpio = 0x20000, .gpio = 0x20000,
}, },
.has_ts = 1, .mpeg = SAA7134_MPEG_EMPRESS,
.video_out = CCIR656, .video_out = CCIR656,
}, },
[SAA7134_BOARD_CINERGY400] = { [SAA7134_BOARD_CINERGY400] = {
...@@ -628,7 +628,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -628,7 +628,7 @@ struct saa7134_board saa7134_boards[] = {
.vmux = 8, .vmux = 8,
.amux = LINE1, .amux = LINE1,
}}, }},
.has_ts = 1, .mpeg = SAA7134_MPEG_EMPRESS,
.video_out = CCIR656, .video_out = CCIR656,
}, },
[SAA7134_BOARD_VIDEOMATE_TV] = { [SAA7134_BOARD_VIDEOMATE_TV] = {
...@@ -752,7 +752,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -752,7 +752,7 @@ struct saa7134_board saa7134_boards[] = {
.amux = LINE2, .amux = LINE2,
.tv = 1, .tv = 1,
}}, }},
.has_ts = 1, .mpeg = SAA7134_MPEG_EMPRESS,
.video_out = CCIR656, .video_out = CCIR656,
}, },
[SAA7134_BOARD_ASUSTEK_TVFM7133] = { [SAA7134_BOARD_ASUSTEK_TVFM7133] = {
...@@ -785,7 +785,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -785,7 +785,7 @@ struct saa7134_board saa7134_boards[] = {
.name = "Pinnacle PCTV Stereo (saa7134)", .name = "Pinnacle PCTV Stereo (saa7134)",
.audio_clock = 0x00187de7, .audio_clock = 0x00187de7,
.tuner_type = TUNER_MT2032, .tuner_type = TUNER_MT2032,
.tda9887_conf = TDA9887_PRESENT, .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER,
.inputs = {{ .inputs = {{
.name = name_tv, .name = name_tv,
.vmux = 3, .vmux = 3,
...@@ -838,7 +838,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -838,7 +838,7 @@ struct saa7134_board saa7134_boards[] = {
.name = name_svideo, .name = name_svideo,
.vmux = 8, .vmux = 8,
.amux = LINE1, .amux = LINE1,
},{ },{
.name = name_comp1, .name = name_comp1,
.vmux = 1, .vmux = 1,
.amux = LINE1, .amux = LINE1,
...@@ -1075,7 +1075,6 @@ struct saa7134_board saa7134_boards[] = { ...@@ -1075,7 +1075,6 @@ struct saa7134_board saa7134_boards[] = {
.name = name_tv, .name = name_tv,
.vmux = 1, .vmux = 1,
.amux = LINE2, .amux = LINE2,
.gpio = 0x0000,
.tv = 1, .tv = 1,
},{ },{
.name = name_comp1, .name = name_comp1,
...@@ -1174,7 +1173,7 @@ struct saa7134_board saa7134_boards[] = { ...@@ -1174,7 +1173,7 @@ struct saa7134_board saa7134_boards[] = {
.tv = 1, .tv = 1,
}}, }},
}, },
[SAA7134_EMPIRE_PCI_TV_RADIO_LE] = { [SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE] = {
/* "Matteo Az" <matte.az@nospam.libero.it> ;-) */ /* "Matteo Az" <matte.az@nospam.libero.it> ;-) */
.name = "Empire PCI TV-Radio LE", .name = "Empire PCI TV-Radio LE",
.audio_clock = 0x00187de7, .audio_clock = 0x00187de7,
...@@ -1208,6 +1207,77 @@ struct saa7134_board saa7134_boards[] = { ...@@ -1208,6 +1207,77 @@ struct saa7134_board saa7134_boards[] = {
.gpio =0x8000, .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); const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
...@@ -1251,6 +1321,12 @@ struct pci_device_id saa7134_pci_tbl[] = { ...@@ -1251,6 +1321,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subvendor = 0x153B, .subvendor = 0x153B,
.subdevice = 0x1143, .subdevice = 0x1143,
.driver_data = SAA7134_BOARD_CINERGY600, .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, .vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134, .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
...@@ -1384,6 +1460,13 @@ struct pci_device_id saa7134_pci_tbl[] = { ...@@ -1384,6 +1460,13 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subdevice = 0x10ff, .subdevice = 0x10ff,
.driver_data = SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER, .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 */ /* TransGear 3000TV */
.vendor = PCI_VENDOR_ID_PHILIPS, .vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7130, .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
...@@ -1396,6 +1479,12 @@ struct pci_device_id saa7134_pci_tbl[] = { ...@@ -1396,6 +1479,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subvendor = 0x11bd, .subvendor = 0x11bd,
.subdevice = 0x002b, .subdevice = 0x002b,
.driver_data = SAA7134_BOARD_PINNACLE_PCTV_STEREO, .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, .vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7134, .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
...@@ -1427,7 +1516,14 @@ struct pci_device_id saa7134_pci_tbl[] = { ...@@ -1427,7 +1516,14 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subvendor = 0x185b, .subvendor = 0x185b,
.subdevice = 0xc100, .subdevice = 0xc100,
.driver_data = SAA7134_BOARD_VIDEOMATE_TV_PVR, .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 --- */ /* --- boards without eeprom + subsystem ID --- */
.vendor = PCI_VENDOR_ID_PHILIPS, .vendor = PCI_VENDOR_ID_PHILIPS,
...@@ -1442,7 +1538,7 @@ struct pci_device_id saa7134_pci_tbl[] = { ...@@ -1442,7 +1538,7 @@ struct pci_device_id saa7134_pci_tbl[] = {
.subdevice = 0, .subdevice = 0,
.driver_data = SAA7134_BOARD_NOAUTO, .driver_data = SAA7134_BOARD_NOAUTO,
},{ },{
/* --- default catch --- */ /* --- default catch --- */
.vendor = PCI_VENDOR_ID_PHILIPS, .vendor = PCI_VENDOR_ID_PHILIPS,
.device = PCI_DEVICE_ID_PHILIPS_SAA7130, .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
...@@ -1544,6 +1640,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) ...@@ -1544,6 +1640,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
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: case SAA7134_BOARD_MD2819:
case SAA7134_BOARD_AVERMEDIA_307:
dev->has_remote = 1; dev->has_remote = 1;
break; break;
case SAA7134_BOARD_AVACSSMARTTV: case SAA7134_BOARD_AVACSSMARTTV:
...@@ -1555,6 +1652,11 @@ int saa7134_board_init1(struct saa7134_dev *dev) ...@@ -1555,6 +1652,11 @@ int saa7134_board_init1(struct saa7134_dev *dev)
"%s: you try the audio_clock_override=0x200000 insmod option.\n", "%s: you try the audio_clock_override=0x200000 insmod option.\n",
dev->name,dev->name,dev->name); dev->name,dev->name,dev->name);
break; 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; 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 * device driver for philips saa7134 based TV cards
* i2c interface support * i2c interface support
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
static unsigned int i2c_debug = 0; 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]"); MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]");
static unsigned int i2c_scan = 0; 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"); MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
#define d1printk if (1 == i2c_debug) printk #define d1printk if (1 == i2c_debug) printk
...@@ -88,7 +88,7 @@ enum i2c_attr { ...@@ -88,7 +88,7 @@ enum i2c_attr {
static inline enum i2c_status i2c_get_status(struct saa7134_dev *dev) static inline enum i2c_status i2c_get_status(struct saa7134_dev *dev)
{ {
enum i2c_status status; enum i2c_status status;
status = saa_readb(SAA7134_I2C_ATTR_STATUS) & 0x0f; status = saa_readb(SAA7134_I2C_ATTR_STATUS) & 0x0f;
d2printk(KERN_DEBUG "%s: i2c stat <= %s\n",dev->name, d2printk(KERN_DEBUG "%s: i2c stat <= %s\n",dev->name,
str_i2c_status[status]); str_i2c_status[status]);
...@@ -184,7 +184,7 @@ static int i2c_reset(struct saa7134_dev *dev) ...@@ -184,7 +184,7 @@ static int i2c_reset(struct saa7134_dev *dev)
if (!i2c_is_idle(status)) if (!i2c_is_idle(status))
return FALSE; return FALSE;
i2c_set_attr(dev,NOP); i2c_set_attr(dev,NOP);
return TRUE; return TRUE;
} }
...@@ -210,7 +210,7 @@ static inline int i2c_send_byte(struct saa7134_dev *dev, ...@@ -210,7 +210,7 @@ static inline int i2c_send_byte(struct saa7134_dev *dev,
saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword); saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword);
#endif #endif
d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data); d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data);
if (!i2c_is_busy_wait(dev)) if (!i2c_is_busy_wait(dev))
return -EIO; return -EIO;
status = i2c_get_status(dev); status = i2c_get_status(dev);
...@@ -223,7 +223,7 @@ static inline int i2c_recv_byte(struct saa7134_dev *dev) ...@@ -223,7 +223,7 @@ static inline int i2c_recv_byte(struct saa7134_dev *dev)
{ {
enum i2c_status status; enum i2c_status status;
unsigned char data; unsigned char data;
i2c_set_attr(dev,CONTINUE); i2c_set_attr(dev,CONTINUE);
if (!i2c_is_busy_wait(dev)) if (!i2c_is_busy_wait(dev))
return -EIO; return -EIO;
...@@ -302,7 +302,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, ...@@ -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) unsigned int cmd, unsigned long arg)
{ {
return 0; return 0;
...@@ -313,6 +313,18 @@ static u32 functionality(struct i2c_adapter *adap) ...@@ -313,6 +313,18 @@ static u32 functionality(struct i2c_adapter *adap)
return I2C_FUNC_SMBUS_EMUL; 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) static int attach_inform(struct i2c_client *client)
{ {
struct saa7134_dev *dev = client->adapter->algo_data; struct saa7134_dev *dev = client->adapter->algo_data;
...@@ -419,10 +431,10 @@ int saa7134_i2c_register(struct saa7134_dev *dev) ...@@ -419,10 +431,10 @@ int saa7134_i2c_register(struct saa7134_dev *dev)
strcpy(dev->i2c_adap.name,dev->name); strcpy(dev->i2c_adap.name,dev->name);
dev->i2c_adap.algo_data = dev; dev->i2c_adap.algo_data = dev;
i2c_add_adapter(&dev->i2c_adap); i2c_add_adapter(&dev->i2c_adap);
dev->i2c_client = saa7134_client_template; dev->i2c_client = saa7134_client_template;
dev->i2c_client.adapter = &dev->i2c_adap; dev->i2c_client.adapter = &dev->i2c_adap;
saa7134_i2c_eeprom(dev,dev->eedata,sizeof(dev->eedata)); saa7134_i2c_eeprom(dev,dev->eedata,sizeof(dev->eedata));
if (i2c_scan) if (i2c_scan)
do_i2c_scan(dev->name,&dev->i2c_client); 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. * handle saa7134 IR remotes via linux kernel input layer.
* *
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
#include "saa7134.h" #include "saa7134.h"
static unsigned int disable_ir = 0; 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"); MODULE_PARM_DESC(disable_ir,"disable infrared remote support");
static unsigned int ir_debug = 0; 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]"); MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
#define dprintk(fmt, arg...) if (ir_debug) \ #define dprintk(fmt, arg...) if (ir_debug) \
...@@ -63,7 +63,7 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = { ...@@ -63,7 +63,7 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = {
[ 20 ] = KEY_VOLUMEUP, [ 20 ] = KEY_VOLUMEUP,
[ 23 ] = KEY_VOLUMEDOWN, [ 23 ] = KEY_VOLUMEDOWN,
[ 18 ] = KEY_CHANNELUP, // Channel + [ 18 ] = KEY_CHANNELUP, // Channel +
[ 19 ] = KEY_CHANNELDOWN, // Channel - [ 19 ] = KEY_CHANNELDOWN, // Channel -
[ 6 ] = KEY_AGAIN, // Recal [ 6 ] = KEY_AGAIN, // Recal
[ 16 ] = KEY_KPENTER, // Enter [ 16 ] = KEY_KPENTER, // Enter
...@@ -353,6 +353,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -353,6 +353,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
polling = 50; // ms polling = 50; // ms
break; break;
case SAA7134_BOARD_MD2819: case SAA7134_BOARD_MD2819:
case SAA7134_BOARD_AVERMEDIA_307:
ir_codes = md2819_codes; ir_codes = md2819_codes;
mask_keycode = 0x0007C8; mask_keycode = 0x0007C8;
mask_keydown = 0x000010; mask_keydown = 0x000010;
...@@ -378,7 +379,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) ...@@ -378,7 +379,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
ir->mask_keydown = mask_keydown; ir->mask_keydown = mask_keydown;
ir->mask_keyup = mask_keyup; ir->mask_keyup = mask_keyup;
ir->polling = polling; ir->polling = polling;
/* init input device */ /* init input device */
snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)", snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)",
saa7134_boards[dev->board].name); saa7134_boards[dev->board].name);
...@@ -417,7 +418,7 @@ void saa7134_input_fini(struct saa7134_dev *dev) ...@@ -417,7 +418,7 @@ void saa7134_input_fini(struct saa7134_dev *dev)
{ {
if (NULL == dev->remote) if (NULL == dev->remote)
return; return;
input_unregister_device(&dev->remote->dev); input_unregister_device(&dev->remote->dev);
if (dev->remote->polling) if (dev->remote->polling)
del_timer_sync(&dev->remote->timer); 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 * device driver for philips saa7134 based TV cards
* oss dsp interface * oss dsp interface
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static unsigned int oss_debug = 0; 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]"); MODULE_PARM_DESC(oss_debug,"enable debug messages [oss]");
static unsigned int oss_rate = 0; 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)"); MODULE_PARM_DESC(oss_rate,"sample rate (valid are: 32000,48000)");
#define dprintk(fmt, arg...) if (oss_debug) \ #define dprintk(fmt, arg...) if (oss_debug) \
...@@ -140,7 +140,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) ...@@ -140,7 +140,7 @@ static int dsp_rec_start(struct saa7134_dev *dev)
} }
switch (dev->oss.afmt) { switch (dev->oss.afmt) {
case AFMT_S8: case AFMT_S8:
case AFMT_S16_LE: case AFMT_S16_LE:
case AFMT_S16_BE: sign = 1; break; case AFMT_S16_BE: sign = 1; break;
default: sign = 0; break; default: sign = 0; break;
...@@ -161,7 +161,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) ...@@ -161,7 +161,7 @@ static int dsp_rec_start(struct saa7134_dev *dev)
if (sign) if (sign)
fmt |= 0x04; fmt |= 0x04;
fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80; fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80;
saa_writeb(SAA7134_NUM_SAMPLES0, (dev->oss.blksize & 0x0000ff)); saa_writeb(SAA7134_NUM_SAMPLES0, (dev->oss.blksize & 0x0000ff));
saa_writeb(SAA7134_NUM_SAMPLES1, (dev->oss.blksize & 0x00ff00) >> 8); saa_writeb(SAA7134_NUM_SAMPLES1, (dev->oss.blksize & 0x00ff00) >> 8);
saa_writeb(SAA7134_NUM_SAMPLES2, (dev->oss.blksize & 0xff0000) >> 16); saa_writeb(SAA7134_NUM_SAMPLES2, (dev->oss.blksize & 0xff0000) >> 16);
...@@ -193,7 +193,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) ...@@ -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_BA2(6),dev->oss.blksize);
saa_writel(SAA7134_RS_PITCH(6),0); saa_writel(SAA7134_RS_PITCH(6),0);
saa_writel(SAA7134_RS_CONTROL(6),control); saa_writel(SAA7134_RS_CONTROL(6),control);
/* start dma */ /* start dma */
dev->oss.recording_on = 1; dev->oss.recording_on = 1;
spin_lock_irqsave(&dev->slock,flags); spin_lock_irqsave(&dev->slock,flags);
...@@ -369,7 +369,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, ...@@ -369,7 +369,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
void __user *argp = (void __user *) arg; void __user *argp = (void __user *) arg;
int __user *p = argp; int __user *p = argp;
int val = 0; int val = 0;
if (oss_debug > 1) if (oss_debug > 1)
saa7134_print_ioctl(dev->name,cmd); saa7134_print_ioctl(dev->name,cmd);
switch (cmd) { switch (cmd) {
...@@ -412,7 +412,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file, ...@@ -412,7 +412,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
/* fall through */ /* fall through */
case SOUND_PCM_READ_CHANNELS: case SOUND_PCM_READ_CHANNELS:
return put_user(dev->oss.channels, p); return put_user(dev->oss.channels, p);
case SNDCTL_DSP_GETFMTS: /* Returns a mask */ case SNDCTL_DSP_GETFMTS: /* Returns a mask */
return put_user(AFMT_U8 | AFMT_S8 | return put_user(AFMT_U8 | AFMT_S8 |
AFMT_U16_LE | AFMT_U16_BE | AFMT_U16_LE | AFMT_U16_BE |
...@@ -535,7 +535,7 @@ static int ...@@ -535,7 +535,7 @@ static int
mixer_recsrc_7134(struct saa7134_dev *dev) mixer_recsrc_7134(struct saa7134_dev *dev)
{ {
int analog_io,rate; int analog_io,rate;
switch (dev->oss.input) { switch (dev->oss.input) {
case TV: case TV:
saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0xc0); saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, 0xc0);
...@@ -557,7 +557,7 @@ static int ...@@ -557,7 +557,7 @@ static int
mixer_recsrc_7133(struct saa7134_dev *dev) mixer_recsrc_7133(struct saa7134_dev *dev)
{ {
u32 value = 0xbbbbbb; u32 value = 0xbbbbbb;
switch (dev->oss.input) { switch (dev->oss.input) {
case TV: case TV:
value = 0xbbbb10; /* MAIN */ value = 0xbbbb10; /* MAIN */
...@@ -655,7 +655,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file, ...@@ -655,7 +655,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file,
int val,ret; int val,ret;
void __user *argp = (void __user *) arg; void __user *argp = (void __user *) arg;
int __user *p = argp; int __user *p = argp;
if (oss_debug > 1) if (oss_debug > 1)
saa7134_print_ioctl(dev->name,cmd); saa7134_print_ioctl(dev->name,cmd);
switch (cmd) { switch (cmd) {
...@@ -786,7 +786,7 @@ int saa7134_oss_init1(struct saa7134_dev *dev) ...@@ -786,7 +786,7 @@ int saa7134_oss_init1(struct saa7134_dev *dev)
mixer_level(dev,LINE1,dev->oss.line1); mixer_level(dev,LINE1,dev->oss.line1);
mixer_level(dev,LINE2,dev->oss.line2); mixer_level(dev,LINE2,dev->oss.line2);
mixer_recsrc(dev, (dev->oss.rate == 32000) ? TV : LINE2); mixer_recsrc(dev, (dev->oss.rate == 32000) ? TV : LINE2);
return 0; return 0;
} }
...@@ -840,7 +840,7 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status) ...@@ -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.dma_blk = (dev->oss.dma_blk + 1) % dev->oss.blocks;
dev->oss.read_count += dev->oss.blksize; dev->oss.read_count += dev->oss.blksize;
wake_up(&dev->oss.wq); wake_up(&dev->oss.wq);
done: done:
spin_unlock(&dev->slock); 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 * device driver for philips saa7134 based TV cards
* tv audio decoder (fm stereo, nicam, ...) * tv audio decoder (fm stereo, nicam, ...)
...@@ -36,18 +36,18 @@ ...@@ -36,18 +36,18 @@
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static unsigned int audio_debug = 0; 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]"); MODULE_PARM_DESC(audio_debug,"enable debug messages [tv audio]");
static unsigned int audio_ddep = 0; 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"); MODULE_PARM_DESC(audio_ddep,"audio ddep overwrite");
static int audio_clock_override = UNSET; 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; 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])"); 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) \ #define dprintk(fmt, arg...) if (audio_debug) \
...@@ -284,7 +284,7 @@ static void tvaudio_setmode(struct saa7134_dev *dev, ...@@ -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_FIELD1, (acpf & 0x00ff00) >> 8);
saa_writeb(SAA7134_AUDIO_CLOCKS_PER_FIELD2, (acpf & 0x030000) >> 16); saa_writeb(SAA7134_AUDIO_CLOCKS_PER_FIELD2, (acpf & 0x030000) >> 16);
tvaudio_setcarrier(dev,audio->carr1,audio->carr2); tvaudio_setcarrier(dev,audio->carr1,audio->carr2);
switch (audio->mode) { switch (audio->mode) {
case TVAUDIO_FM_MONO: case TVAUDIO_FM_MONO:
case TVAUDIO_FM_BG_STEREO: case TVAUDIO_FM_BG_STEREO:
...@@ -324,14 +324,21 @@ static void tvaudio_setmode(struct saa7134_dev *dev, ...@@ -324,14 +324,21 @@ static void tvaudio_setmode(struct saa7134_dev *dev,
static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) static int tvaudio_sleep(struct saa7134_dev *dev, int timeout)
{ {
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
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) {
if (timeout < 0) { if (timeout < 0) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule(); schedule();
} else } else {
#if 0
/* hmm, that one doesn't return on wakeup ... */
msleep_interruptible(timeout); msleep_interruptible(timeout);
#else
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(timeout));
#endif
}
} }
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;
...@@ -407,7 +414,7 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au ...@@ -407,7 +414,7 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
{ {
__u32 idp,nicam; __u32 idp,nicam;
int retval = -1; int retval = -1;
switch (audio->mode) { switch (audio->mode) {
case TVAUDIO_FM_MONO: case TVAUDIO_FM_MONO:
return V4L2_TUNER_SUB_MONO; return V4L2_TUNER_SUB_MONO;
...@@ -644,7 +651,7 @@ static char *stdres[0x20] = { ...@@ -644,7 +651,7 @@ static char *stdres[0x20] = {
[0x09] = "D/K NICAM", [0x09] = "D/K NICAM",
[0x0a] = "L NICAM", [0x0a] = "L NICAM",
[0x0b] = "I NICAM", [0x0b] = "I NICAM",
[0x0c] = "M Korea", [0x0c] = "M Korea",
[0x0d] = "M BTSC ", [0x0d] = "M BTSC ",
[0x0e] = "M EIAJ", [0x0e] = "M EIAJ",
...@@ -739,7 +746,7 @@ static int mute_input_7133(struct saa7134_dev *dev) ...@@ -739,7 +746,7 @@ static int mute_input_7133(struct saa7134_dev *dev)
{ {
u32 reg = 0; u32 reg = 0;
int mask; int mask;
switch (dev->input->amux) { switch (dev->input->amux) {
case TV: reg = 0x02; break; case TV: reg = 0x02; break;
case LINE1: reg = 0x00; break; case LINE1: reg = 0x00; break;
...@@ -845,12 +852,12 @@ static int tvaudio_thread_ddep(void *data) ...@@ -845,12 +852,12 @@ static int tvaudio_thread_ddep(void *data)
(value & 0x002000) ? " BTSC stereo noise mute " : "", (value & 0x002000) ? " BTSC stereo noise mute " : "",
(value & 0x004000) ? " SAP noise mute " : "", (value & 0x004000) ? " SAP noise mute " : "",
(value & 0x008000) ? " VDSP " : "", (value & 0x008000) ? " VDSP " : "",
(value & 0x010000) ? " NICST " : "", (value & 0x010000) ? " NICST " : "",
(value & 0x020000) ? " NICDU " : "", (value & 0x020000) ? " NICDU " : "",
(value & 0x040000) ? " NICAM muted " : "", (value & 0x040000) ? " NICAM muted " : "",
(value & 0x080000) ? " NICAM reserve sound " : "", (value & 0x080000) ? " NICAM reserve sound " : "",
(value & 0x100000) ? " init done " : ""); (value & 0x100000) ? " init done " : "");
} }
...@@ -865,7 +872,7 @@ static int tvaudio_thread_ddep(void *data) ...@@ -865,7 +872,7 @@ static int tvaudio_thread_ddep(void *data)
int saa7134_tvaudio_rx2mode(u32 rx) int saa7134_tvaudio_rx2mode(u32 rx)
{ {
u32 mode; u32 mode;
mode = V4L2_TUNER_MODE_MONO; mode = V4L2_TUNER_MODE_MONO;
if (rx & V4L2_TUNER_SUB_STEREO) if (rx & V4L2_TUNER_SUB_STEREO)
mode = V4L2_TUNER_MODE_STEREO; mode = V4L2_TUNER_MODE_STEREO;
...@@ -875,7 +882,7 @@ int saa7134_tvaudio_rx2mode(u32 rx) ...@@ -875,7 +882,7 @@ int saa7134_tvaudio_rx2mode(u32 rx)
mode = V4L2_TUNER_MODE_LANG2; mode = V4L2_TUNER_MODE_LANG2;
return mode; return mode;
} }
void saa7134_tvaudio_setmute(struct saa7134_dev *dev) void saa7134_tvaudio_setmute(struct saa7134_dev *dev)
{ {
switch (dev->pci->device) { switch (dev->pci->device) {
...@@ -940,14 +947,14 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) ...@@ -940,14 +947,14 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev)
int (*my_thread)(void *data) = NULL; int (*my_thread)(void *data) = NULL;
/* enable I2S audio output */ /* enable I2S audio output */
if (saa7134_boards[dev->board].has_ts) { if (card_is_empress(dev)) {
int i2sform = (48000 == dev->oss.rate) int i2sform = (48000 == dev->oss.rate)
? 0x01 : 0x00; ? 0x01 : 0x00;
/* enable I2S output */ /* enable I2S output */
saa_writeb(SAA7134_I2S_OUTPUT_SELECT, 0x80); saa_writeb(SAA7134_I2S_OUTPUT_SELECT, 0x80);
saa_writeb(SAA7134_I2S_OUTPUT_FORMAT, i2sform); saa_writeb(SAA7134_I2S_OUTPUT_FORMAT, i2sform);
saa_writeb(SAA7134_I2S_OUTPUT_LEVEL, 0x0F); saa_writeb(SAA7134_I2S_OUTPUT_LEVEL, 0x0F);
saa_writeb(SAA7134_I2S_AUDIO_OUTPUT, 0x01); 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 * device driver for philips saa7134 based TV cards
* video4linux video interface * video4linux video interface
...@@ -33,11 +33,11 @@ ...@@ -33,11 +33,11 @@
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static unsigned int vbi_debug = 0; 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]"); MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]");
static unsigned int vbibufs = 4; 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"); MODULE_PARM_DESC(vbibufs,"number of vbi buffers, range 2-32");
#define dprintk(fmt, arg...) if (vbi_debug) \ #define dprintk(fmt, arg...) if (vbi_debug) \
...@@ -53,7 +53,7 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf, ...@@ -53,7 +53,7 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf,
int task) int task)
{ {
struct saa7134_tvnorm *norm = dev->tvnorm; struct saa7134_tvnorm *norm = dev->tvnorm;
/* setup video scaler */ /* setup video scaler */
saa_writeb(SAA7134_VBI_H_START1(task), norm->h_start & 0xff); saa_writeb(SAA7134_VBI_H_START1(task), norm->h_start & 0xff);
saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8); saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8);
...@@ -115,12 +115,13 @@ static int buffer_activate(struct saa7134_dev *dev, ...@@ -115,12 +115,13 @@ static int buffer_activate(struct saa7134_dev *dev,
return 0; 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) enum v4l2_field field)
{ {
struct saa7134_fh *fh = priv; struct saa7134_fh *fh = q->priv_data;
struct saa7134_dev *dev = fh->dev; 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; struct saa7134_tvnorm *norm = dev->tvnorm;
unsigned int lines, llength, size; unsigned int lines, llength, size;
int err; int err;
...@@ -169,12 +170,12 @@ static int buffer_prepare(void *priv, struct videobuf_buffer *vb, ...@@ -169,12 +170,12 @@ static int buffer_prepare(void *priv, struct videobuf_buffer *vb,
} }
static int 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; struct saa7134_dev *dev = fh->dev;
int llength,lines; int llength,lines;
lines = dev->tvnorm->vbi_v_stop - dev->tvnorm->vbi_v_start +1; lines = dev->tvnorm->vbi_v_stop - dev->tvnorm->vbi_v_start +1;
#if 1 #if 1
llength = VBI_LINE_LENGTH; llength = VBI_LINE_LENGTH;
...@@ -190,21 +191,21 @@ buffer_setup(void *priv, unsigned int *count, unsigned int *size) ...@@ -190,21 +191,21 @@ buffer_setup(void *priv, unsigned int *count, unsigned int *size)
return 0; 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_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); 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_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); 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 * v4l2 device driver for philips saa7134 based TV cards
* *
...@@ -31,11 +31,12 @@ ...@@ -31,11 +31,12 @@
#include <asm/io.h> #include <asm/io.h>
#include <media/video-buf.h>
#include <media/tuner.h> #include <media/tuner.h>
#include <media/audiochip.h> #include <media/audiochip.h>
#include <media/id.h> #include <media/id.h>
#include <media/ir-common.h> #include <media/ir-common.h>
#include <media/video-buf.h>
#include <media/video-buf-dvb.h>
#ifndef TRUE #ifndef TRUE
# define TRUE (1==1) # define TRUE (1==1)
...@@ -164,8 +165,12 @@ struct saa7134_format { ...@@ -164,8 +165,12 @@ struct saa7134_format {
#define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS 41 #define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS 41
#define SAA7134_BOARD_SABRENT_SBTTVFM 42 #define SAA7134_BOARD_SABRENT_SBTTVFM 42
#define SAA7134_BOARD_ZOLID_XPERT_TV7134 43 #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 #define SAA7134_INPUT_MAX 8
struct saa7134_input { struct saa7134_input {
...@@ -176,6 +181,12 @@ struct saa7134_input { ...@@ -176,6 +181,12 @@ struct saa7134_input {
unsigned int tv:1; unsigned int tv:1;
}; };
enum saa7134_mpeg_type {
SAA7134_MPEG_UNUSED,
SAA7134_MPEG_EMPRESS,
SAA7134_MPEG_DVB,
};
struct saa7134_board { struct saa7134_board {
char *name; char *name;
unsigned int audio_clock; unsigned int audio_clock;
...@@ -185,18 +196,20 @@ struct saa7134_board { ...@@ -185,18 +196,20 @@ struct saa7134_board {
struct saa7134_input inputs[SAA7134_INPUT_MAX]; struct saa7134_input inputs[SAA7134_INPUT_MAX];
struct saa7134_input radio; struct saa7134_input radio;
struct saa7134_input mute; struct saa7134_input mute;
/* peripheral I/O */
unsigned int has_ts;
enum saa7134_video_out video_out;
/* i2c chip info */ /* i2c chip info */
unsigned int tuner_type; unsigned int tuner_type;
unsigned int tda9887_conf; 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_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(dev) (saa7134_boards[dev->board])
#define card_in(dev,n) (saa7134_boards[dev->board].inputs[n]) #define card_in(dev,n) (saa7134_boards[dev->board].inputs[n])
...@@ -264,7 +277,7 @@ struct saa7134_fh { ...@@ -264,7 +277,7 @@ struct saa7134_fh {
unsigned int radio; unsigned int radio;
enum v4l2_buf_type type; enum v4l2_buf_type type;
unsigned int resources; unsigned int resources;
#ifdef VIDIOC_G_PRIORITY #ifdef VIDIOC_G_PRIORITY
enum v4l2_priority prio; enum v4l2_priority prio;
#endif #endif
...@@ -284,16 +297,6 @@ struct saa7134_fh { ...@@ -284,16 +297,6 @@ struct saa7134_fh {
struct saa7134_pgtable pt_vbi; 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 */ /* oss dsp status */
struct saa7134_oss { struct saa7134_oss {
struct semaphore lock; struct semaphore lock;
...@@ -338,23 +341,37 @@ struct saa7134_ir { ...@@ -338,23 +341,37 @@ struct saa7134_ir {
struct timer_list timer; 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 */ /* global device status */
struct saa7134_dev { struct saa7134_dev {
struct list_head devlist; struct list_head devlist;
struct semaphore lock; struct semaphore lock;
spinlock_t slock; spinlock_t slock;
#ifdef VIDIOC_G_PRIORITY #ifdef VIDIOC_G_PRIORITY
struct v4l2_prio_state prio; struct v4l2_prio_state prio;
#endif #endif
/* various device info */ /* various device info */
unsigned int resources; unsigned int resources;
struct video_device *video_dev; struct video_device *video_dev;
struct video_device *ts_dev;
struct video_device *radio_dev; struct video_device *radio_dev;
struct video_device *vbi_dev; struct video_device *vbi_dev;
struct saa7134_oss oss; struct saa7134_oss oss;
struct saa7134_ts ts;
/* infrared remote */ /* infrared remote */
int has_remote; int has_remote;
...@@ -362,6 +379,7 @@ struct saa7134_dev { ...@@ -362,6 +379,7 @@ struct saa7134_dev {
/* pci i/o */ /* pci i/o */
char name[32]; char name[32];
int nr;
struct pci_dev *pci; struct pci_dev *pci;
unsigned char pci_rev,pci_lat; unsigned char pci_rev,pci_lat;
__u32 *lmmio; __u32 *lmmio;
...@@ -386,7 +404,6 @@ struct saa7134_dev { ...@@ -386,7 +404,6 @@ struct saa7134_dev {
/* video+ts+vbi capture */ /* video+ts+vbi capture */
struct saa7134_dmaqueue video_q; struct saa7134_dmaqueue video_q;
struct saa7134_dmaqueue ts_q;
struct saa7134_dmaqueue vbi_q; struct saa7134_dmaqueue vbi_q;
unsigned int video_fieldcount; unsigned int video_fieldcount;
unsigned int vbi_fieldcount; unsigned int vbi_fieldcount;
...@@ -420,6 +437,19 @@ struct saa7134_dev { ...@@ -420,6 +437,19 @@ struct saa7134_dev {
struct saa7134_input *hw_input; struct saa7134_input *hw_input;
unsigned int hw_mute; unsigned int hw_mute;
int last_carrier; 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); ...@@ -512,11 +542,16 @@ void saa7134_irq_video_done(struct saa7134_dev *dev, unsigned long status);
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* saa7134-ts.c */ /* 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_init1(struct saa7134_dev *dev);
int saa7134_ts_fini(struct saa7134_dev *dev); int saa7134_ts_fini(struct saa7134_dev *dev);
void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status); 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 */ /* saa7134-vbi.c */
......
/* /*
saa6752hs.h - definition for saa6752hs MPEG encoder saa6752hs.h - definition for saa6752hs MPEG encoder
Copyright (C) 2003 Andrew de Quincey <adq@lidskialf.net> Copyright (C) 2003 Andrew de Quincey <adq@lidskialf.net>
...@@ -31,14 +31,14 @@ enum mpeg_bitrate_mode { ...@@ -31,14 +31,14 @@ enum mpeg_bitrate_mode {
enum mpeg_audio_bitrate { enum mpeg_audio_bitrate {
MPEG_AUDIO_BITRATE_256 = 0, /* 256 kBit/sec */ MPEG_AUDIO_BITRATE_256 = 0, /* 256 kBit/sec */
MPEG_AUDIO_BITRATE_384 = 1, /* 384 kBit/sec */ MPEG_AUDIO_BITRATE_384 = 1, /* 384 kBit/sec */
MPEG_AUDIO_BITRATE_MAX MPEG_AUDIO_BITRATE_MAX
}; };
#define MPEG_VIDEO_TARGET_BITRATE_MAX 27000 #define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
#define MPEG_VIDEO_MAX_BITRATE_MAX 27000 #define MPEG_VIDEO_MAX_BITRATE_MAX 27000
#define MPEG_TOTAL_BITRATE_MAX 27000 #define MPEG_TOTAL_BITRATE_MAX 27000
struct mpeg_params { struct mpeg_params {
enum mpeg_bitrate_mode bitrate_mode; enum mpeg_bitrate_mode bitrate_mode;
unsigned int video_target_bitrate; 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