summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorGerd Knorr <devnull@localhost>2004-05-07 09:00:34 +0000
committerGerd Knorr <devnull@localhost>2004-05-07 09:00:34 +0000
commit133924f0d0b13244d42187e76661f07965383078 (patch)
tree83bc0047f919eaf03a86fc435beac8eea4cb1648 /linux/drivers/media
parentf42bc240e3f18da6d9814d1673ab8c3302666b08 (diff)
downloadmediapointer-dvb-s2-133924f0d0b13244d42187e76661f07965383078.tar.gz
mediapointer-dvb-s2-133924f0d0b13244d42187e76661f07965383078.tar.bz2
- fix and enable single field capture in cx88.
- mt2050 antenna selection, based on patch by Matthias Reichl. - msp3400 cleanups by Perry Gilfillan.
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/cx88/cx88-vbi.c13
-rw-r--r--linux/drivers/media/video/cx88/cx88-video.c20
-rw-r--r--linux/drivers/media/video/msp3400-driver.c61
-rw-r--r--linux/drivers/media/video/msp3400.c61
4 files changed, 72 insertions, 83 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-vbi.c b/linux/drivers/media/video/cx88/cx88-vbi.c
index 3b066a1fd..068955ec8 100644
--- a/linux/drivers/media/video/cx88/cx88-vbi.c
+++ b/linux/drivers/media/video/cx88/cx88-vbi.c
@@ -28,17 +28,14 @@ void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f)
f->fmt.vbi.count[0] = VBI_LINE_COUNT;
f->fmt.vbi.count[1] = VBI_LINE_COUNT;
- switch (dev->tvnorm->id) {
- case V4L2_STD_NTSC_M:
- case V4L2_STD_NTSC_M_JP:
+ if (dev->tvnorm->id & V4L2_STD_525_60) {
+ /* ntsc */
f->fmt.vbi.sampling_rate = 28636363;
f->fmt.vbi.start[0] = 10 -1;
f->fmt.vbi.start[1] = 273 -1;
- break;
- case V4L2_STD_PAL_BG:
- case V4L2_STD_PAL_DK:
- case V4L2_STD_PAL_I:
- case V4L2_STD_SECAM:
+
+ } else if (V4L2_STD_625_50) {
+ /* pal */
f->fmt.vbi.sampling_rate = 35468950;
f->fmt.vbi.start[0] = 7 -1;
f->fmt.vbi.start[1] = 319 -1;
diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c
index 8da65fbcd..d3303a422 100644
--- a/linux/drivers/media/video/cx88/cx88-video.c
+++ b/linux/drivers/media/video/cx88/cx88-video.c
@@ -2,7 +2,7 @@
* device driver for Conexant 2388x based TV cards
* video4linux video interface
*
- * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
+ * (c) 2003-04 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
@@ -612,13 +612,18 @@ static int set_tvnorm(struct cx8800_dev *dev, struct cx8800_tvnorm *norm)
}
static int set_scale(struct cx8800_dev *dev, unsigned int width, unsigned int height,
- int interlaced)
+ enum v4l2_field field)
{
unsigned int swidth = norm_swidth(dev->tvnorm);
unsigned int sheight = norm_maxh(dev->tvnorm);
u32 value;
- dprintk(1,"set_scale: %dx%d [%s]\n", width, height, dev->tvnorm->name);
+ dprintk(1,"set_scale: %dx%d [%s%s,%s]\n", width, height,
+ V4L2_FIELD_HAS_TOP(field) ? "T" : "",
+ V4L2_FIELD_HAS_BOTTOM(field) ? "B" : "",
+ dev->tvnorm->name);
+ if (!V4L2_FIELD_HAS_BOTH(field))
+ height *= 2;
// recalc H delay and scale registers
value = (width * norm_hdelay(dev->tvnorm)) / swidth;
@@ -653,7 +658,7 @@ static int set_scale(struct cx8800_dev *dev, unsigned int width, unsigned int he
// setup filters
value = 0;
value |= (1 << 19); // CFILT (default)
- if (interlaced)
+ if (V4L2_FIELD_INTERLACED == field)
value |= (1 << 3); // VINT (interlaced vertical scaling)
if (width < 385)
value |= (1 << 0); // 3-tap interpolation
@@ -702,7 +707,7 @@ static int start_video_dma(struct cx8800_dev *dev,
/* setup fifo + format */
cx88_sram_channel_setup(dev, &cx88_sram_channels[SRAM_CH21],
buf->bpl, buf->risc.dma);
- set_scale(dev, buf->vb.width, buf->vb.height, 1);
+ set_scale(dev, buf->vb.width, buf->vb.height, buf->vb.field);
cx_write(MO_COLOR_CTRL, buf->fmt->cxformat | ColorFormatGamma);
/* reset counter */
@@ -1474,15 +1479,12 @@ static int cx8800_try_fmt(struct cx8800_dev *dev, struct cx8800_fh *fh,
maxw = norm_maxw(dev->tvnorm);
maxh = norm_maxh(dev->tvnorm);
-#if 0
if (V4L2_FIELD_ANY == field) {
field = (f->fmt.pix.height > maxh/2)
? V4L2_FIELD_INTERLACED
: V4L2_FIELD_BOTTOM;
}
-#else
- field = V4L2_FIELD_INTERLACED;
-#endif
+
switch (field) {
case V4L2_FIELD_TOP:
case V4L2_FIELD_BOTTOM:
diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c
index f7db546d2..fc02f588c 100644
--- a/linux/drivers/media/video/msp3400-driver.c
+++ b/linux/drivers/media/video/msp3400-driver.c
@@ -85,7 +85,7 @@ struct msp3400c {
int input;
int muted;
- int left, right; /* volume */
+ int volume, balance;
int bass, treble;
/* shadow register set */
@@ -383,26 +383,24 @@ static void msp3400c_setcarrier(struct i2c_client *client, int cdo1, int cdo2)
}
static void msp3400c_setvolume(struct i2c_client *client,
- int muted, int left, int right)
+ int muted, int volume, int balance)
{
- int vol = 0,val = 0,balance = 0;
+ int val = 0, bal = 0;
if (!muted) {
- vol = (left > right) ? left : right;
- val = (vol * 0x73 / 65535) << 8;
+ val = (volume * 0x73 / 65535) << 8;
}
- if (vol > 0) {
- balance = ((right-left) * 127) / vol;
+ if (val) {
+ bal = (balance / 256) - 128;
}
-
dprintk(KERN_DEBUG
"msp34xx: setvolume: mute=%s %d:%d v=0x%02x b=0x%02x\n",
- muted ? "on" : "off", left, right, val>>8, balance);
+ muted ? "on" : "off", volume, balance, val>>8, bal);
msp3400c_write(client,I2C_MSP3400C_DFP, 0x0000, val); /* loudspeaker */
msp3400c_write(client,I2C_MSP3400C_DFP, 0x0006, val); /* headphones */
/* scart - on/off only */
msp3400c_write(client,I2C_MSP3400C_DFP, 0x0007, val ? 0x4000 : 0);
- msp3400c_write(client,I2C_MSP3400C_DFP, 0x0001, balance << 8);
+ msp3400c_write(client,I2C_MSP3400C_DFP, 0x0001, bal << 8);
}
static void msp3400c_setbass(struct i2c_client *client, int bass)
@@ -828,7 +826,7 @@ static int msp3400c_thread(void *data)
/* no carrier scan, just unmute */
printk("msp3400: thread: no carrier scan\n");
msp3400c_setvolume(client, msp->muted,
- msp->left, msp->right);
+ msp->volume, msp->balance);
continue;
}
msp->restart = 0;
@@ -973,7 +971,8 @@ static int msp3400c_thread(void *data)
}
/* unmute + restore dfp registers */
- msp3400c_setvolume(client, msp->muted, msp->left, msp->right);
+ msp3400c_setvolume(client, msp->muted,
+ msp->volume, msp->balance);
msp3400c_restore_dfp(client);
if (msp->watch_stereo)
@@ -1063,7 +1062,7 @@ static int msp3410d_thread(void *data)
/* no carrier scan needed, just unmute */
dprintk(KERN_DEBUG "msp3410: thread: no carrier scan\n");
msp3400c_setvolume(client, msp->muted,
- msp->left, msp->right);
+ msp->volume, msp->balance);
continue;
}
msp->restart = 0;
@@ -1215,7 +1214,8 @@ static int msp3410d_thread(void *data)
/* unmute + restore dfp registers */
msp3400c_setbass(client, msp->bass);
msp3400c_settreble(client, msp->treble);
- msp3400c_setvolume(client, msp->muted, msp->left, msp->right);
+ msp3400c_setvolume(client, msp->muted,
+ msp->volume, msp->balance);
msp3400c_restore_dfp(client);
if (msp->watch_stereo)
@@ -1290,8 +1290,8 @@ static int msp_attach(struct i2c_adapter *adap, int addr,
}
memset(msp,0,sizeof(struct msp3400c));
- msp->left = 65535;
- msp->right = 65535;
+ msp->volume = 65535;
+ msp->balance = 32768;
msp->bass = 32768;
msp->treble = 32768;
msp->input = -1;
@@ -1323,7 +1323,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr,
/* this will turn on a 1kHz beep - might be useful for debugging... */
msp3400c_write(c,I2C_MSP3400C_DFP, 0x0014, 0x1040);
#endif
- msp3400c_setvolume(c,msp->muted,msp->left,msp->right);
+ msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance);
snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d",
(msp->rev2>>8)&0xff, (msp->rev1&0xff)+'@',
@@ -1479,8 +1479,10 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
} else {
/* set msp3400 to FM radio mode */
msp3400c_setmode(client,MSP_MODE_FM_RADIO);
- msp3400c_setcarrier(client, MSP_CARRIER(10.7),MSP_CARRIER(10.7));
- msp3400c_setvolume(client,msp->muted,msp->left,msp->right);
+ msp3400c_setcarrier(client, MSP_CARRIER(10.7),
+ MSP_CARRIER(10.7));
+ msp3400c_setvolume(client, msp->muted,
+ msp->volume, msp->balance);
}
if (msp->active)
msp->restart = 1;
@@ -1527,16 +1529,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
VIDEO_AUDIO_MUTABLE;
if (msp->muted)
va->flags |= VIDEO_AUDIO_MUTE;
- va->volume=max(msp->left,msp->right);
- if (0 == va->volume) {
- va->balance = 32768;
- } else {
- va->balance = (32768 * min(msp->left,msp->right))
- / va->volume;
- va->balance = (msp->left<msp->right) ?
- (65535 - va->balance) : va->balance;
- }
+ va->volume = msp->volume;
+ va->balance = (va->volume) ? msp->balance : 32768;
va->bass = msp->bass;
va->treble = msp->treble;
@@ -1552,13 +1547,13 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
dprintk(KERN_DEBUG "msp34xx: VIDIOCSAUDIO\n");
msp->muted = (va->flags & VIDEO_AUDIO_MUTE);
- msp->left = (min(65536 - va->balance,32768) *
- va->volume) / 32768;
- msp->right = (min(va->balance,(__u16)32768) *
- va->volume) / 32768;
+ msp->volume = va->volume;
+ msp->balance = va->balance;
msp->bass = va->bass;
msp->treble = va->treble;
- msp3400c_setvolume(client,msp->muted,msp->left,msp->right);
+
+ msp3400c_setvolume(client, msp->muted,
+ msp->volume, msp->balance);
msp3400c_setbass(client,msp->bass);
msp3400c_settreble(client,msp->treble);
diff --git a/linux/drivers/media/video/msp3400.c b/linux/drivers/media/video/msp3400.c
index f7db546d2..fc02f588c 100644
--- a/linux/drivers/media/video/msp3400.c
+++ b/linux/drivers/media/video/msp3400.c
@@ -85,7 +85,7 @@ struct msp3400c {
int input;
int muted;
- int left, right; /* volume */
+ int volume, balance;
int bass, treble;
/* shadow register set */
@@ -383,26 +383,24 @@ static void msp3400c_setcarrier(struct i2c_client *client, int cdo1, int cdo2)
}
static void msp3400c_setvolume(struct i2c_client *client,
- int muted, int left, int right)
+ int muted, int volume, int balance)
{
- int vol = 0,val = 0,balance = 0;
+ int val = 0, bal = 0;
if (!muted) {
- vol = (left > right) ? left : right;
- val = (vol * 0x73 / 65535) << 8;
+ val = (volume * 0x73 / 65535) << 8;
}
- if (vol > 0) {
- balance = ((right-left) * 127) / vol;
+ if (val) {
+ bal = (balance / 256) - 128;
}
-
dprintk(KERN_DEBUG
"msp34xx: setvolume: mute=%s %d:%d v=0x%02x b=0x%02x\n",
- muted ? "on" : "off", left, right, val>>8, balance);
+ muted ? "on" : "off", volume, balance, val>>8, bal);
msp3400c_write(client,I2C_MSP3400C_DFP, 0x0000, val); /* loudspeaker */
msp3400c_write(client,I2C_MSP3400C_DFP, 0x0006, val); /* headphones */
/* scart - on/off only */
msp3400c_write(client,I2C_MSP3400C_DFP, 0x0007, val ? 0x4000 : 0);
- msp3400c_write(client,I2C_MSP3400C_DFP, 0x0001, balance << 8);
+ msp3400c_write(client,I2C_MSP3400C_DFP, 0x0001, bal << 8);
}
static void msp3400c_setbass(struct i2c_client *client, int bass)
@@ -828,7 +826,7 @@ static int msp3400c_thread(void *data)
/* no carrier scan, just unmute */
printk("msp3400: thread: no carrier scan\n");
msp3400c_setvolume(client, msp->muted,
- msp->left, msp->right);
+ msp->volume, msp->balance);
continue;
}
msp->restart = 0;
@@ -973,7 +971,8 @@ static int msp3400c_thread(void *data)
}
/* unmute + restore dfp registers */
- msp3400c_setvolume(client, msp->muted, msp->left, msp->right);
+ msp3400c_setvolume(client, msp->muted,
+ msp->volume, msp->balance);
msp3400c_restore_dfp(client);
if (msp->watch_stereo)
@@ -1063,7 +1062,7 @@ static int msp3410d_thread(void *data)
/* no carrier scan needed, just unmute */
dprintk(KERN_DEBUG "msp3410: thread: no carrier scan\n");
msp3400c_setvolume(client, msp->muted,
- msp->left, msp->right);
+ msp->volume, msp->balance);
continue;
}
msp->restart = 0;
@@ -1215,7 +1214,8 @@ static int msp3410d_thread(void *data)
/* unmute + restore dfp registers */
msp3400c_setbass(client, msp->bass);
msp3400c_settreble(client, msp->treble);
- msp3400c_setvolume(client, msp->muted, msp->left, msp->right);
+ msp3400c_setvolume(client, msp->muted,
+ msp->volume, msp->balance);
msp3400c_restore_dfp(client);
if (msp->watch_stereo)
@@ -1290,8 +1290,8 @@ static int msp_attach(struct i2c_adapter *adap, int addr,
}
memset(msp,0,sizeof(struct msp3400c));
- msp->left = 65535;
- msp->right = 65535;
+ msp->volume = 65535;
+ msp->balance = 32768;
msp->bass = 32768;
msp->treble = 32768;
msp->input = -1;
@@ -1323,7 +1323,7 @@ static int msp_attach(struct i2c_adapter *adap, int addr,
/* this will turn on a 1kHz beep - might be useful for debugging... */
msp3400c_write(c,I2C_MSP3400C_DFP, 0x0014, 0x1040);
#endif
- msp3400c_setvolume(c,msp->muted,msp->left,msp->right);
+ msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance);
snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d",
(msp->rev2>>8)&0xff, (msp->rev1&0xff)+'@',
@@ -1479,8 +1479,10 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
} else {
/* set msp3400 to FM radio mode */
msp3400c_setmode(client,MSP_MODE_FM_RADIO);
- msp3400c_setcarrier(client, MSP_CARRIER(10.7),MSP_CARRIER(10.7));
- msp3400c_setvolume(client,msp->muted,msp->left,msp->right);
+ msp3400c_setcarrier(client, MSP_CARRIER(10.7),
+ MSP_CARRIER(10.7));
+ msp3400c_setvolume(client, msp->muted,
+ msp->volume, msp->balance);
}
if (msp->active)
msp->restart = 1;
@@ -1527,16 +1529,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
VIDEO_AUDIO_MUTABLE;
if (msp->muted)
va->flags |= VIDEO_AUDIO_MUTE;
- va->volume=max(msp->left,msp->right);
- if (0 == va->volume) {
- va->balance = 32768;
- } else {
- va->balance = (32768 * min(msp->left,msp->right))
- / va->volume;
- va->balance = (msp->left<msp->right) ?
- (65535 - va->balance) : va->balance;
- }
+ va->volume = msp->volume;
+ va->balance = (va->volume) ? msp->balance : 32768;
va->bass = msp->bass;
va->treble = msp->treble;
@@ -1552,13 +1547,13 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
dprintk(KERN_DEBUG "msp34xx: VIDIOCSAUDIO\n");
msp->muted = (va->flags & VIDEO_AUDIO_MUTE);
- msp->left = (min(65536 - va->balance,32768) *
- va->volume) / 32768;
- msp->right = (min(va->balance,(__u16)32768) *
- va->volume) / 32768;
+ msp->volume = va->volume;
+ msp->balance = va->balance;
msp->bass = va->bass;
msp->treble = va->treble;
- msp3400c_setvolume(client,msp->muted,msp->left,msp->right);
+
+ msp3400c_setvolume(client, msp->muted,
+ msp->volume, msp->balance);
msp3400c_setbass(client,msp->bass);
msp3400c_settreble(client,msp->treble);