Skip to content

Commit

Permalink
[PATCH] v4l: CX88 Update
Browse files Browse the repository at this point in the history
- Removed unused structures.
- Removed BTTV version check.
- Some debug structs moved to their own .c file and converted to static
- Comment changed to express better when attach_inform is running
- set_freq removed from set_mode at tuner-core.c.
- I2C cleanups and converged to a basic reference structure.
- Rename tuner structures fields.
- It calls VIDIOC_G_FREQUENCY to get tuner freq from tuner.
- added missing contrast offset value, set to 0.
- Let Kconfig decide whether to include frontend-specific code.

Signed-Off-By: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Mauro Carvalho Chehab authored and Linus Torvalds committed Jul 12, 2005
1 parent fa9846a commit 41ef7c1
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 700 deletions.
5 changes: 0 additions & 5 deletions drivers/media/video/cx88/cx88-blackbird.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,11 +690,9 @@ static void blackbird_codec_settings(struct cx8802_dev *dev)
int bitrate_mode = 1;
int bitrate = 7500000;
int bitrate_peak = 7500000;
#if 1
bitrate_mode = BLACKBIRD_VIDEO_CBR;
bitrate = 4000*1024;
bitrate_peak = 4000*1024;
#endif

/* assign stream type */
blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM);
Expand Down Expand Up @@ -810,9 +808,6 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev)
cx_write(MO_VBOS_CONTROL, 0x84A00); /* no 656 mode, 8-bit pixels, disable VBI */
cx_clear(MO_OUTPUT_FORMAT, 0x0008); /* Normal Y-limits to let the mpeg encoder sync */

#if 0 /* FIXME */
set_scale(dev, 720, 480, V4L2_FIELD_INTERLACED);
#endif
blackbird_codec_settings(dev);
msleep(1);

Expand Down
48 changes: 1 addition & 47 deletions drivers/media/video/cx88/cx88-core.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: cx88-core.c,v 1.31 2005/06/22 22:58:04 mchehab Exp $
* $Id: cx88-core.c,v 1.33 2005/07/07 14:17:47 mchehab Exp $
*
* device driver for Conexant 2388x based TV cards
* driver core
Expand Down Expand Up @@ -470,25 +470,6 @@ int cx88_risc_decode(u32 risc)
return incr[risc >> 28] ? incr[risc >> 28] : 1;
}

#if 0 /* currently unused, but useful for debugging */
void cx88_risc_disasm(struct cx88_core *core,
struct btcx_riscmem *risc)
{
unsigned int i,j,n;

printk("%s: risc disasm: %p [dma=0x%08lx]\n",
core->name, risc->cpu, (unsigned long)risc->dma);
for (i = 0; i < (risc->size >> 2); i += n) {
printk("%s: %04d: ", core->name, i);
n = cx88_risc_decode(risc->cpu[i]);
for (j = 1; j < n; j++)
printk("%s: %04d: 0x%08x [ arg #%d ]\n",
core->name, i+j, risc->cpu[i+j], j);
if (risc->cpu[i] == RISC_JUMP)
break;
}
}
#endif

void cx88_sram_channel_dump(struct cx88_core *core,
struct sram_channel *ch)
Expand Down Expand Up @@ -545,30 +526,12 @@ void cx88_sram_channel_dump(struct cx88_core *core,
core->name,cx_read(ch->cnt2_reg));
}

/* Used only on cx88-core */
static char *cx88_pci_irqs[32] = {
"vid", "aud", "ts", "vip", "hst", "5", "6", "tm1",
"src_dma", "dst_dma", "risc_rd_err", "risc_wr_err",
"brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err",
"i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
};
/* Used only on cx88-video */
char *cx88_vid_irqs[32] = {
"y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
"y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
"y_oflow", "u_oflow", "v_oflow", "vbi_oflow",
"y_sync", "u_sync", "v_sync", "vbi_sync",
"opc_err", "par_err", "rip_err", "pci_abort",
};
/* Used only on cx88-mpeg */
char *cx88_mpeg_irqs[32] = {
"ts_risci1", NULL, NULL, NULL,
"ts_risci2", NULL, NULL, NULL,
"ts_oflow", NULL, NULL, NULL,
"ts_sync", NULL, NULL, NULL,
"opc_err", "par_err", "rip_err", "pci_abort",
"ts_err?",
};

void cx88_print_irqbits(char *name, char *tag, char **strings,
u32 bits, u32 mask)
Expand Down Expand Up @@ -618,16 +581,11 @@ void cx88_wakeup(struct cx88_core *core,
break;
buf = list_entry(q->active.next,
struct cx88_buffer, vb.queue);
#if 0
if (buf->count > count)
break;
#else
/* count comes from the hw and is is 16bit wide --
* this trick handles wrap-arounds correctly for
* up to 32767 buffers in flight... */
if ((s16) (count - buf->count) < 0)
break;
#endif
do_gettimeofday(&buf->vb.ts);
dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i,
count, buf->count);
Expand Down Expand Up @@ -955,12 +913,10 @@ int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm)
norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f);
cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat);

#if 1
// FIXME: as-is from DScaler
dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",
norm->cxoformat, cx_read(MO_OUTPUT_FORMAT));
cx_write(MO_OUTPUT_FORMAT, norm->cxoformat);
#endif

// MO_SCONV_REG = adc clock / video dec clock * 2^17
tmp64 = adc_clock * (u64)(1 << 17);
Expand Down Expand Up @@ -1219,8 +1175,6 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
/* ------------------------------------------------------------------ */

EXPORT_SYMBOL(cx88_print_ioctl);
EXPORT_SYMBOL(cx88_vid_irqs);
EXPORT_SYMBOL(cx88_mpeg_irqs);
EXPORT_SYMBOL(cx88_print_irqbits);

EXPORT_SYMBOL(cx88_core_irq);
Expand Down
36 changes: 19 additions & 17 deletions drivers/media/video/cx88/cx88-dvb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: cx88-dvb.c,v 1.39 2005/07/02 20:00:46 mkrufky Exp $
* $Id: cx88-dvb.c,v 1.41 2005/07/04 19:35:05 mkrufky Exp $
*
* device driver for Conexant 2388x based TV cards
* MPEG Transport Stream (DVB) routines
Expand Down Expand Up @@ -30,22 +30,20 @@
#include <linux/file.h>
#include <linux/suspend.h>

/* these three frontends need merging via linuxtv cvs ... */
#define HAVE_CX22702 1
#define HAVE_OR51132 1
#define HAVE_LGDT3302 1

#include "cx88.h"
#include "dvb-pll.h"
#include "mt352.h"
#include "mt352_priv.h"
#if HAVE_CX22702

#if CONFIG_DVB_MT352
# include "mt352.h"
# include "mt352_priv.h"
#endif
#if CONFIG_DVB_CX22702
# include "cx22702.h"
#endif
#if HAVE_OR51132
#if CONFIG_DVB_OR51132
# include "or51132.h"
#endif
#if HAVE_LGDT3302
#if CONFIG_DVB_LGDT3302
# include "lgdt3302.h"
#endif

Expand Down Expand Up @@ -104,6 +102,7 @@ static struct videobuf_queue_ops dvb_qops = {

/* ------------------------------------------------------------------ */

#if CONFIG_DVB_MT352
static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
{
static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
Expand Down Expand Up @@ -171,8 +170,9 @@ static struct mt352_config dntv_live_dvbt_config = {
.demod_init = dntv_live_dvbt_demod_init,
.pll_set = mt352_pll_set,
};
#endif

#if HAVE_CX22702
#if CONFIG_DVB_CX22702
static struct cx22702_config connexant_refboard_config = {
.demod_address = 0x43,
.pll_address = 0x60,
Expand All @@ -186,7 +186,7 @@ static struct cx22702_config hauppauge_novat_config = {
};
#endif

#if HAVE_OR51132
#if CONFIG_DVB_OR51132
static int or51132_set_ts_param(struct dvb_frontend* fe,
int is_punctured)
{
Expand All @@ -203,7 +203,7 @@ static struct or51132_config pchdtv_hd3000 = {
};
#endif

#if HAVE_LGDT3302
#if CONFIG_DVB_LGDT3302
static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured)
{
struct cx8802_dev *dev= fe->dvb->priv;
Expand Down Expand Up @@ -237,7 +237,7 @@ static int dvb_register(struct cx8802_dev *dev)

/* init frontend */
switch (dev->core->board) {
#if HAVE_CX22702
#if CONFIG_DVB_CX22702
case CX88_BOARD_HAUPPAUGE_DVB_T1:
dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config,
&dev->core->i2c_adap);
Expand All @@ -248,6 +248,7 @@ static int dvb_register(struct cx8802_dev *dev)
&dev->core->i2c_adap);
break;
#endif
#if CONFIG_DVB_MT352
case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
dev->core->pll_addr = 0x61;
dev->core->pll_desc = &dvb_pll_lg_z201;
Expand All @@ -268,13 +269,14 @@ static int dvb_register(struct cx8802_dev *dev)
dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config,
&dev->core->i2c_adap);
break;
#if HAVE_OR51132
#endif
#if CONFIG_DVB_OR51132
case CX88_BOARD_PCHDTV_HD3000:
dev->dvb.frontend = or51132_attach(&pchdtv_hd3000,
&dev->core->i2c_adap);
break;
#endif
#if HAVE_LGDT3302
#if CONFIG_DVB_LGDT3302
case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
dev->ts_gen_cntrl = 0x08;
{
Expand Down
31 changes: 19 additions & 12 deletions drivers/media/video/cx88/cx88-i2c.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
$Id: cx88-i2c.c,v 1.24 2005/06/17 18:46:23 mkrufky Exp $
$Id: cx88-i2c.c,v 1.28 2005/07/05 17:37:35 nsh Exp $
cx88-i2c.c -- all the i2c code is here
Expand Down Expand Up @@ -91,25 +91,32 @@ static int cx8800_bit_getsda(void *data)

static int attach_inform(struct i2c_client *client)
{
struct tuner_addr tun_addr;
struct tuner_setup tun_setup;
struct cx88_core *core = i2c_get_adapdata(client->adapter);

dprintk(1, "i2c attach [addr=0x%x,client=%s]\n",
client->addr, i2c_clientname(client));
dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
client->driver->name,client->addr,i2c_clientname(client));
if (!client->driver->command)
return 0;

if (core->radio_type != UNSET) {
tun_addr.v4l2_tuner = V4L2_TUNER_RADIO;
tun_addr.type = core->radio_type;
tun_addr.addr = core->radio_addr;
client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) {
tun_setup.mode_mask = T_RADIO;
tun_setup.type = core->radio_type;
tun_setup.addr = core->radio_addr;

client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
}
}
if (core->tuner_type != UNSET) {
tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV;
tun_addr.type = core->tuner_type;
tun_addr.addr = core->tuner_addr;
client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) {

tun_setup.mode_mask = T_ANALOG_TV;
tun_setup.type = core->tuner_type;
tun_setup.addr = core->tuner_addr;

client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup);
}
}

if (core->tda9887_conf)
Expand Down
Loading

0 comments on commit 41ef7c1

Please sign in to comment.