Commit 330a115a authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Linus Torvalds

[PATCH] v4l: SAA7134 Update

- Corrected all cards marked as 7135 cards to 7133.
- Add new card support for Compro VideoMate TV Gold+II.
- Add new card support for Kworld Xpert TV PVR7134
- Add new card support for Typhoon DVB-T Cardbus.
- Changes to comply with CodingStyle: // comments converted to /* */
- Remove irq2_mask field from saa7134_dev structure.
- Collect all the bits needed in saa7134_hwinit2() instead.
- Distinguish the different variants of the Medion MD7134 modules via eeprom
- moved Philips FMD1216 radio specific setup to saa7134-core.c
- Fix kernel compile error with CONFIG_MODULES=n
- Cleanup tuner private calls.
- Some Indent fixes.
Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
Signed-off-by: default avatarMichael Krufky <mkrufky@m1k.net>
Signed-off-by: default avatarHannibal <hannibal@megapolis.pl>
Signed-off-by: default avatarElshin Roman <roxmail@list.ru>
Signed-off-by: default avatarHermann Pitton <hermann.pitton@onlinehome.de>
Signed-off-by: default avatarJuergen Orschiedt <jorschiedt@web.de>
Signed-off-by: default avatarHartmut Hackmann <hartmut.hackmann@t-online.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 85369df3
This diff is collapsed.
/*
* $Id: saa7134-core.c,v 1.30 2005/05/22 19:23:39 nsh Exp $
* $Id: saa7134-core.c,v 1.39 2005/07/05 17:37:35 nsh Exp $
*
* device driver for philips saa7134 based TV cards
* driver core
......@@ -183,46 +183,6 @@ void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)
/* ------------------------------------------------------------------ */
#if 0
static char *dec1_bits[8] = {
"DCSTD0", "DCSCT1", "WIPA", "GLIMB",
"GLIMT", "SLTCA", "HLCK"
};
static char *dec2_bits[8] = {
"RDCAP", "COPRO", "COLSTR", "TYPE3",
NULL, "FIDT", "HLVLN", "INTL"
};
static char *scale1_bits[8] = {
"VID_A", "VBI_A", NULL, NULL, "VID_B", "VBI_B"
};
static char *scale2_bits[8] = {
"TRERR", "CFERR", "LDERR", "WASRST",
"FIDSCI", "FIDSCO", "D6^D5", "TASK"
};
static void dump_statusreg(struct saa7134_dev *dev, int reg,
char *regname, char **bits)
{
int value,i;
value = saa_readb(reg);
printk(KERN_DEBUG "%s: %s:", dev->name, regname);
for (i = 7; i >= 0; i--) {
if (NULL == bits[i])
continue;
printk(" %s=%d", bits[i], (value & (1 << i)) ? 1 : 0);
}
printk("\n");
}
static void dump_statusregs(struct saa7134_dev *dev)
{
dump_statusreg(dev,SAA7134_STATUS_VIDEO1,"dec1",dec1_bits);
dump_statusreg(dev,SAA7134_STATUS_VIDEO2,"dec2",dec2_bits);
dump_statusreg(dev,SAA7134_SCALER_STATUS0,"scale0",scale1_bits);
dump_statusreg(dev,SAA7134_SCALER_STATUS1,"scale1",scale2_bits);
}
#endif
/* ----------------------------------------------------------- */
/* delayed request_module */
......@@ -616,10 +576,6 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
if (irq_debug)
print_irqstatus(dev,loop,report,status);
#if 0
if (report & SAA7134_IRQ_REPORT_CONF_ERR)
dump_statusregs(dev);
#endif
if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */)
saa7134_irq_video_intl(dev);
......@@ -711,7 +667,6 @@ static int saa7134_hwinit1(struct saa7134_dev *dev)
SAA7134_MAIN_CTRL_EVFE1 |
SAA7134_MAIN_CTRL_EVFE2 |
SAA7134_MAIN_CTRL_ESFE |
SAA7134_MAIN_CTRL_EBADC |
SAA7134_MAIN_CTRL_EBDAC);
/* enable peripheral devices */
......@@ -726,14 +681,28 @@ static int saa7134_hwinit1(struct saa7134_dev *dev)
/* late init (with i2c + irq) */
static int saa7134_hwinit2(struct saa7134_dev *dev)
{
unsigned int irq2_mask;
dprintk("hwinit2\n");
saa7134_video_init2(dev);
saa7134_tvaudio_init2(dev);
/* enable IRQ's */
irq2_mask =
SAA7134_IRQ2_INTE_DEC3 |
SAA7134_IRQ2_INTE_DEC2 |
SAA7134_IRQ2_INTE_DEC1 |
SAA7134_IRQ2_INTE_DEC0 |
SAA7134_IRQ2_INTE_PE |
SAA7134_IRQ2_INTE_AR;
if (dev->has_remote)
irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 |
SAA7134_IRQ2_INTE_GPIO18A |
SAA7134_IRQ2_INTE_GPIO16 );
saa_writel(SAA7134_IRQ1, 0);
saa_writel(SAA7134_IRQ2, dev->irq2_mask);
saa_writel(SAA7134_IRQ2, irq2_mask);
return 0;
}
......@@ -954,13 +923,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
}
/* initialize hardware #1 */
dev->irq2_mask =
SAA7134_IRQ2_INTE_DEC3 |
SAA7134_IRQ2_INTE_DEC2 |
SAA7134_IRQ2_INTE_DEC1 |
SAA7134_IRQ2_INTE_DEC0 |
SAA7134_IRQ2_INTE_PE |
SAA7134_IRQ2_INTE_AR;
saa7134_board_init1(dev);
saa7134_hwinit1(dev);
......@@ -990,6 +952,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
request_module("saa6752hs");
request_module_depend("saa7134-empress",&need_empress);
}
if (card_is_dvb(dev))
request_module_depend("saa7134-dvb",&need_dvb);
......@@ -1144,9 +1107,6 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
release_mem_region(pci_resource_start(pci_dev,0),
pci_resource_len(pci_dev,0));
#if 0 /* causes some trouble when reinserting the driver ... */
pci_disable_device(pci_dev);
#endif
pci_set_drvdata(pci_dev, NULL);
/* free memory */
......
/*
* $Id: saa7134-i2c.c,v 1.11 2005/06/12 01:36:14 mchehab Exp $
* $Id: saa7134-i2c.c,v 1.19 2005/07/07 01:49:30 mkrufky Exp $
*
* device driver for philips saa7134 based TV cards
* i2c interface support
......@@ -197,10 +197,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev,
enum i2c_status status;
__u32 dword;
#if 0
i2c_set_attr(dev,attr);
saa_writeb(SAA7134_I2C_DATA, data);
#else
/* have to write both attr + data in one 32bit word */
dword = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2);
dword &= 0x0f;
......@@ -210,7 +206,6 @@ static inline int i2c_send_byte(struct saa7134_dev *dev,
// dword |= 0x40 << 16; /* 400 kHz */
dword |= 0xf0 << 24;
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))
......@@ -331,12 +326,44 @@ static u32 functionality(struct i2c_adapter *adap)
static int attach_inform(struct i2c_client *client)
{
struct saa7134_dev *dev = client->adapter->algo_data;
struct saa7134_dev *dev = client->adapter->algo_data;
int tuner = dev->tuner_type;
int conf = dev->tda9887_conf;
struct tuner_setup tun_setup;
d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
client->driver->name,client->addr,i2c_clientname(client));
if (!client->driver->command)
return 0;
if (saa7134_boards[dev->board].radio_type != UNSET) {
tun_setup.type = saa7134_boards[dev->board].radio_type;
tun_setup.addr = saa7134_boards[dev->board].radio_addr;
if ((tun_setup.addr == ADDR_UNSET) || (tun_setup.addr == client->addr)) {
tun_setup.mode_mask = T_RADIO;
client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup);
}
}
if (tuner != UNSET) {
tun_setup.type = tuner;
tun_setup.addr = saa7134_boards[dev->board].tuner_addr;
if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) {
tun_setup.mode_mask = T_ANALOG_TV;
client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup);
}
}
client->driver->command(client, TDA9887_SET_CONFIG, &conf);
saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&tuner);
saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&conf);
return 0;
}
......
/*
* $Id: saa7134-input.c,v 1.19 2005/06/07 18:02:26 nsh Exp $
* $Id: saa7134-input.c,v 1.21 2005/06/22 23:37:34 nsh Exp $
*
* handle saa7134 IR remotes via linux kernel input layer.
*
......@@ -68,10 +68,8 @@ static IR_KEYTAB_TYPE flyvideo_codes[IR_KEYTAB_SIZE] = {
[ 6 ] = KEY_AGAIN, // Recal
[ 16 ] = KEY_KPENTER, // Enter
#if 1 /* FIXME */
[ 26 ] = KEY_F22, // Stereo
[ 24 ] = KEY_EDIT, // AV Source
#endif
};
static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = {
......@@ -172,45 +170,45 @@ static IR_KEYTAB_TYPE eztv_codes[IR_KEYTAB_SIZE] = {
};
static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = {
[ 30 ] = KEY_POWER, // power
[ 30 ] = KEY_POWER, // power
[ 28 ] = KEY_SEARCH, // scan
[ 7 ] = KEY_SELECT, // source
[ 7 ] = KEY_SELECT, // source
[ 22 ] = KEY_VOLUMEUP,
[ 20 ] = KEY_VOLUMEDOWN,
[ 31 ] = KEY_CHANNELUP,
[ 31 ] = KEY_CHANNELUP,
[ 23 ] = KEY_CHANNELDOWN,
[ 24 ] = KEY_MUTE,
[ 2 ] = KEY_KP0,
[ 1 ] = KEY_KP1,
[ 11 ] = KEY_KP2,
[ 27 ] = KEY_KP3,
[ 5 ] = KEY_KP4,
[ 9 ] = KEY_KP5,
[ 21 ] = KEY_KP6,
[ 1 ] = KEY_KP1,
[ 11 ] = KEY_KP2,
[ 27 ] = KEY_KP3,
[ 5 ] = KEY_KP4,
[ 9 ] = KEY_KP5,
[ 21 ] = KEY_KP6,
[ 6 ] = KEY_KP7,
[ 10 ] = KEY_KP8,
[ 10 ] = KEY_KP8,
[ 18 ] = KEY_KP9,
[ 16 ] = KEY_KPDOT,
[ 3 ] = KEY_TUNER, // tv/fm
[ 4 ] = KEY_REWIND, // fm tuning left or function left
[ 12 ] = KEY_FORWARD, // fm tuning right or function right
[ 4 ] = KEY_REWIND, // fm tuning left or function left
[ 12 ] = KEY_FORWARD, // fm tuning right or function right
[ 0 ] = KEY_RECORD,
[ 8 ] = KEY_STOP,
[ 17 ] = KEY_PLAY,
[ 8 ] = KEY_STOP,
[ 17 ] = KEY_PLAY,
[ 25 ] = KEY_ZOOM,
[ 14 ] = KEY_MENU, // function
[ 19 ] = KEY_AGAIN, // recall
[ 29 ] = KEY_RESTART, // reset
[ 26 ] = KEY_SHUFFLE, // snapshot/shuffle
// FIXME
[ 13 ] = KEY_F21, // mts
[ 15 ] = KEY_F22, // min
[ 26 ] = KEY_F23, // freeze
[ 15 ] = KEY_F22, // min
};
/* Alex Hermann <gaaf@gmx.net> */
......@@ -489,13 +487,14 @@ int saa7134_input_init1(struct saa7134_dev *dev)
break;
case SAA7134_BOARD_ECS_TVP3XP:
case SAA7134_BOARD_ECS_TVP3XP_4CB5:
ir_codes = eztv_codes;
mask_keycode = 0x00017c;
mask_keyup = 0x000002;
ir_codes = eztv_codes;
mask_keycode = 0x00017c;
mask_keyup = 0x000002;
polling = 50; // ms
break;
break;
case SAA7134_BOARD_KWORLD_XPERT:
case SAA7134_BOARD_AVACSSMARTTV:
ir_codes = avacssmart_codes;
ir_codes = avacssmart_codes;
mask_keycode = 0x00001F;
mask_keyup = 0x000020;
polling = 50; // ms
......@@ -524,6 +523,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
polling = 50; // ms
break;
case SAA7134_BOARD_VIDEOMATE_TV_PVR:
case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII:
ir_codes = videomate_tv_pvr_codes;
mask_keycode = 0x00003F;
mask_keyup = 0x400000;
......
/*
* $Id: saa7134-oss.c,v 1.14 2005/05/18 22:45:16 hhackmann Exp $
* $Id: saa7134-oss.c,v 1.17 2005/06/28 23:41:47 mkrufky Exp $
*
* device driver for philips saa7134 based TV cards
* oss dsp interface
......@@ -556,21 +556,28 @@ mixer_recsrc_7134(struct saa7134_dev *dev)
static int
mixer_recsrc_7133(struct saa7134_dev *dev)
{
u32 value = 0xbbbbbb;
u32 anabar, xbarin;
xbarin = 0x03; // adc
anabar = 0;
switch (dev->oss.input) {
case TV:
value = 0xbbbb10; /* MAIN */
xbarin = 0; // Demodulator
anabar = 2; // DACs
break;
case LINE1:
value = 0xbbbb32; /* AUX1 */
anabar = 0; // aux1, aux1
break;
case LINE2:
case LINE2_LEFT:
value = 0xbbbb54; /* AUX2 */
anabar = 9; // aux2, aux2
break;
}
saa_dsp_writel(dev, 0x46c >> 2, value);
/* output xbar always main channel */
saa_dsp_writel(dev, 0x46c >> 2, 0xbbbb10);
saa_dsp_writel(dev, 0x464 >> 2, xbarin);
saa_writel(0x594 >> 2, anabar);
return 0;
}
......
/*
* $Id: saa7134-ts.c,v 1.14 2005/02/03 10:24:33 kraxel Exp $
* $Id: saa7134-ts.c,v 1.15 2005/06/14 22:48:18 hhackmann Exp $
*
* device driver for philips saa7134 based TV cards
* video4linux video interface
......@@ -221,10 +221,10 @@ void saa7134_irq_ts_done(struct saa7134_dev *dev, unsigned long status)
if (dev->ts_q.curr) {
field = dev->ts_q.curr->vb.field;
if (field == V4L2_FIELD_TOP) {
if ((status & 0x100000) != 0x000000)
if ((status & 0x100000) != 0x100000)
goto done;
} else {
if ((status & 0x100000) != 0x100000)
if ((status & 0x100000) != 0x000000)
goto done;
}
saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE);
......
/*
* $Id: saa7134-tvaudio.c,v 1.25 2005/06/07 19:00:38 nsh Exp $
* $Id: saa7134-tvaudio.c,v 1.30 2005/06/28 23:41:47 mkrufky Exp $
*
* device driver for philips saa7134 based TV cards
* tv audio decoder (fm stereo, nicam, ...)
......@@ -169,7 +169,7 @@ static void tvaudio_init(struct saa7134_dev *dev)
int clock = saa7134_boards[dev->board].audio_clock;
if (UNSET != audio_clock_override)
clock = audio_clock_override;
clock = audio_clock_override;
/* init all audio registers */
saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x00);
......@@ -219,14 +219,17 @@ static void mute_input_7134(struct saa7134_dev *dev)
in = dev->input;
mute = (dev->ctl_mute ||
(dev->automute && (&card(dev).radio) != in));
if (PCI_DEVICE_ID_PHILIPS_SAA7130 == dev->pci->device &&
card(dev).mute.name) {
/* 7130 - we'll mute using some unconnected audio input */
if (card(dev).mute.name) {
/*
* 7130 - we'll mute using some unconnected audio input
* 7134 - we'll probably should switch external mux with gpio
*/
if (mute)
in = &card(dev).mute;
}
if (dev->hw_mute == mute &&
dev->hw_input == in) {
dev->hw_input == in) {
dprintk("mute/input: nothing to do [mute=%d,input=%s]\n",
mute,in->name);
return;
......@@ -260,6 +263,7 @@ static void mute_input_7134(struct saa7134_dev *dev)
/* switch gpio-connected external audio mux */
if (0 == card(dev).gpiomask)
return;
mask = card(dev).gpiomask;
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio);
......@@ -339,13 +343,8 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout)
set_current_state(TASK_INTERRUPTIBLE);
schedule();
} 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);
......@@ -400,27 +399,10 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan)
return value;
}
#if 0
static void sifdebug_dump_regs(struct saa7134_dev *dev)
{
print_regb(AUDIO_STATUS);
print_regb(IDENT_SIF);
print_regb(LEVEL_READOUT1);
print_regb(LEVEL_READOUT2);
print_regb(DCXO_IDENT_CTRL);
print_regb(DEMODULATOR);
print_regb(AGC_GAIN_SELECT);
print_regb(MONITOR_SELECT);
print_regb(FM_DEEMPHASIS);
print_regb(FM_DEMATRIX);
print_regb(SIF_SAMPLE_FREQ);
print_regb(ANALOG_IO_SELECT);
}
#endif
static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *audio)
{
__u32 idp,nicam;
__u32 idp, nicam, nicam_status;
int retval = -1;
switch (audio->mode) {
......@@ -442,18 +424,24 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
break;
case TVAUDIO_NICAM_FM:
case TVAUDIO_NICAM_AM:
nicam = saa_readb(SAA7134_NICAM_STATUS);
nicam = saa_readb(SAA7134_AUDIO_STATUS);
dprintk("getstereo: nicam=0x%x\n",nicam);
switch (nicam & 0x0b) {
case 0x08:
retval = V4L2_TUNER_SUB_MONO;
break;
case 0x09:
retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
break;
case 0x0a:
retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
break;
if (nicam & 0x1) {
nicam_status = saa_readb(SAA7134_NICAM_STATUS);
dprintk("getstereo: nicam_status=0x%x\n", nicam_status);
switch (nicam_status & 0x03) {
case 0x01:
retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
break;
case 0x02:
retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
break;
default:
retval = V4L2_TUNER_SUB_MONO;
}
} else {
/* No nicam detected */
}
break;
}
......@@ -489,15 +477,15 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
break;
case TVAUDIO_FM_K_STEREO:
case TVAUDIO_FM_BG_STEREO:
case TVAUDIO_NICAM_AM:
case TVAUDIO_NICAM_FM:
dprintk("setstereo [fm] => %s\n",
name[ mode % ARRAY_SIZE(name) ]);
reg = fm[ mode % ARRAY_SIZE(fm) ];
saa_writeb(SAA7134_FM_DEMATRIX, reg);
break;
case TVAUDIO_FM_SAT_STEREO:
case TVAUDIO_NICAM_AM:
case TVAUDIO_NICAM_FM:
/* FIXME */
/* Not implemented */
break;
}
return 0;
......@@ -596,7 +584,7 @@ static int tvaudio_thread(void *data)
/* find the exact tv audio norm */
for (audio = UNSET, i = 0; i < TVAUDIO; i++) {
if (dev->tvnorm->id != UNSET &&
!(dev->tvnorm->id & tvaudio[i].std))
!(dev->tvnorm->id & tvaudio[i].std))
continue;
if (tvaudio[i].carr1 != carrier)
continue;
......@@ -703,24 +691,6 @@ static inline int saa_dsp_wait_bit(struct saa7134_dev *dev, int bit)
return 0;
}
#if 0
static int saa_dsp_readl(struct saa7134_dev *dev, int reg, u32 *value)
{
int err;
d2printk("dsp read reg 0x%x\n", reg<<2);
saa_readl(reg);
err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_RDB);
if (err < 0)
return err;
*value = saa_readl(reg);
d2printk("dsp read => 0x%06x\n", *value & 0xffffff);
err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_IDA);
if (err < 0)
return err;
return 0;
}
#endif
int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value)
{
......@@ -753,31 +723,50 @@ static int getstereo_7133(struct saa7134_dev *dev)
static int mute_input_7133(struct saa7134_dev *dev)
{
u32 reg = 0;
u32 xbarin, xbarout;
int mask;
struct saa7134_input *in;
/* Hac 0506 route OSS sound simultanously */
xbarin = 0x03;
switch (dev->input->amux) {
case TV:
reg = 0x02;
xbarin = 0;
break;
case LINE1:
reg = 0x00;
break;
case LINE2:
case LINE2_LEFT:
reg = 0x01;
reg = 0x09;
break;
}
if (dev->ctl_mute)
saa_dsp_writel(dev, 0x464 >> 2, xbarin);
if (dev->ctl_mute) {
reg = 0x07;
xbarout = 0xbbbbbb;
} else
xbarout = 0xbbbb10;
saa_dsp_writel(dev, 0x46c >> 2, xbarout);
saa_writel(0x594 >> 2, reg);
/* switch gpio-connected external audio mux */
if (0 != card(dev).gpiomask) {
mask = card(dev).gpiomask;
if (card(dev).mute.name && dev->ctl_mute)
in = &card(dev).mute;
else
in = dev->input;
saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, mask, mask);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, dev->input->gpio);
saa7134_track_gpio(dev,dev->input->name);
saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio);
saa7134_track_gpio(dev,in->name);
}
return 0;
}
......
......@@ -130,13 +130,7 @@ static int buffer_prepare(struct videobuf_queue *q,
lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1;
if (lines > VBI_LINE_COUNT)
lines = VBI_LINE_COUNT;
#if 1
llength = VBI_LINE_LENGTH;
#else
llength = (norm->h_stop - norm->h_start +1) * 2;
if (llength > VBI_LINE_LENGTH)
llength = VBI_LINE_LENGTH;
#endif
size = lines * llength * 2;
if (0 != buf->vb.baddr && buf->vb.bsize < size)
return -EINVAL;
......@@ -178,13 +172,7 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
int llength,lines;
lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1;
#if 1
llength = VBI_LINE_LENGTH;
#else
llength = (norm->h_stop - norm->h_start +1) * 2;
if (llength > VBI_LINE_LENGTH)
llength = VBI_LINE_LENGTH;
#endif
*size = lines * llength * 2;
if (0 == *count)
*count = vbibufs;
......
/*
* $Id: saa7134-video.c,v 1.30 2005/06/07 19:00:38 nsh Exp $
* $Id: saa7134-video.c,v 1.36 2005/06/28 23:41:47 mkrufky Exp $
*
* device driver for philips saa7134 based TV cards
* video4linux video interface
......@@ -274,7 +274,7 @@ static struct saa7134_tvnorm tvnorms[] = {
.h_start = 0,
.h_stop = 719,
.video_v_start = 23,
.video_v_start = 23,
.video_v_stop = 262,
.vbi_v_start_0 = 10,
.vbi_v_stop_0 = 21,
......@@ -1204,7 +1204,6 @@ static int video_open(struct inode *inode, struct file *file)
struct list_head *list;
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
int radio = 0;
list_for_each(list,&saa7134_devlist) {
h = list_entry(list, struct saa7134_dev, devlist);
if (h->video_dev && (h->video_dev->minor == minor))
......@@ -1256,12 +1255,12 @@ static int video_open(struct inode *inode, struct file *file)
if (fh->radio) {
/* switch to radio mode */
saa7134_tvaudio_setinput(dev,&card(dev).radio);
saa7134_i2c_call_clients(dev,AUDC_SET_RADIO,NULL);
saa7134_i2c_call_clients(dev,AUDC_SET_RADIO, NULL);
} else {
/* switch to video/vbi mode */
video_mux(dev,dev->ctl_input);
}
return 0;
return 0;
}
static ssize_t
......@@ -1304,10 +1303,10 @@ video_poll(struct file *file, struct poll_table_struct *wait)
} else {
down(&fh->cap.lock);
if (UNSET == fh->cap.read_off) {
/* need to capture a new frame */
/* need to capture a new frame */
if (res_locked(fh->dev,RESOURCE_VIDEO)) {
up(&fh->cap.lock);
return POLLERR;
up(&fh->cap.lock);
return POLLERR;
}
if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) {
up(&fh->cap.lock);
......@@ -1363,6 +1362,36 @@ static int video_release(struct inode *inode, struct file *file)
res_free(dev,fh,RESOURCE_VBI);
}
/* ts-capture will not work in planar mode, so turn it off Hac: 04.05*/
saa_andorb(SAA7134_OFMT_VIDEO_A, 0x1f, 0);
saa_andorb(SAA7134_OFMT_VIDEO_B, 0x1f, 0);
saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0);
saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0);
if (dev->tuner_type == TUNER_PHILIPS_TDA8290) {
u8 data[2];
int ret;
struct i2c_msg msg = {.addr=I2C_ADDR_TDA8290, .flags=0, .buf=data, .len = 2};
data[0] = 0x21;
data[1] = 0xc0;
ret = i2c_transfer(&dev->i2c_adap, &msg, 1);
if (ret != 1)
printk(KERN_ERR "TDA8290 access failure\n");
msg.addr = I2C_ADDR_TDA8275;
data[0] = 0x30;
data[1] = 0xd0;
ret = i2c_transfer(&dev->i2c_adap, &msg, 1);
if (ret != 1)
printk(KERN_ERR "TDA8275 access failure\n");
msg.addr = I2C_ADDR_TDA8290;
data[0] = 0x21;
data[1] = 0x80;
i2c_transfer(&dev->i2c_adap, &msg, 1);
data[0] = 0x00;
data[1] = 0x02;
i2c_transfer(&dev->i2c_adap, &msg, 1);
}
/* free stuff */
videobuf_mmap_free(&fh->cap);
videobuf_mmap_free(&fh->vbi);
......@@ -1399,13 +1428,6 @@ static void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f)
f->fmt.vbi.count[1] = f->fmt.vbi.count[0];
f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */
#if 0
if (V4L2_STD_PAL == norm->id) {
/* FIXME */
f->fmt.vbi.start[0] += 3;
f->fmt.vbi.start[1] += 3*2;
}
#endif
}
static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
......@@ -2120,8 +2142,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
memset(t,0,sizeof(*t));
strcpy(t->name, "Radio");
t->rangelow = (int)(65*16);
t->rangehigh = (int)(108*16);
saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t);
......
/*
* $Id: saa7134.h,v 1.41 2005/06/07 18:02:26 nsh Exp $
* $Id: saa7134.h,v 1.48 2005/07/01 08:22:24 nsh Exp $
*
* v4l2 device driver for philips saa7134 based TV cards
*
......@@ -46,8 +46,6 @@
#endif
#define UNSET (-1U)
/* 2.4 / 2.5 driver compatibility stuff */
/* ----------------------------------------------------------- */
/* enums */
......@@ -159,7 +157,7 @@ struct saa7134_format {
#define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33
#define SAA7134_BOARD_NOVAC_PRIMETV7133 34
#define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35
#define SAA7133_BOARD_UPMOST_PURPLE_TV 36
#define SAA7134_BOARD_UPMOST_PURPLE_TV 36
#define SAA7134_BOARD_ITEMS_MTV005 37
#define SAA7134_BOARD_CINERGY200 38
#define SAA7134_BOARD_FLYTVPLATINUM_MINI 39
......@@ -176,13 +174,17 @@ struct saa7134_format {
#define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50
#define SAA7134_BOARD_PROVIDEO_PV952 51
#define SAA7134_BOARD_AVERMEDIA_305 52
#define SAA7135_BOARD_ASUSTeK_TVFM7135 53
#define SAA7134_BOARD_ASUSTeK_TVFM7135 53
#define SAA7134_BOARD_FLYTVPLATINUM_FM 54
#define SAA7134_BOARD_FLYDVBTDUO 55
#define SAA7134_BOARD_AVERMEDIA_307 56
#define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57
#define SAA7134_BOARD_ADS_INSTANT_TV 58
#define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59
#define SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS 60
#define SAA7134_BOARD_PHILIPS_TOUGH 61
#define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62
#define SAA7134_BOARD_KWORLD_XPERT 63
#define SAA7134_MAXBOARDS 8
#define SAA7134_INPUT_MAX 8
......@@ -213,6 +215,10 @@ struct saa7134_board {
/* i2c chip info */
unsigned int tuner_type;
unsigned int radio_type;
unsigned char tuner_addr;
unsigned char radio_addr;
unsigned int tda9887_conf;
/* peripheral I/O */
......@@ -403,9 +409,12 @@ struct saa7134_dev {
/* config info */
unsigned int board;
unsigned int tuner_type;
unsigned int radio_type;
unsigned char tuner_addr;
unsigned char radio_addr;
unsigned int tda9887_conf;
unsigned int gpio_value;
unsigned int irq2_mask;
/* i2c i/o */
struct i2c_adapter i2c_adap;
......
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