Re: Flyvideo 2000s hardware descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



I have one of these.  Are you sure there are TDA9874H chips?  I have one
on the daughter card.  Where is the other one?

Anyway, you need something to initialise the TAD9874.  I hacked on the
TDA9875 driver, removing most of it.  All I have is an init function
which sets the chip up into NICAM B/G for me.  You probably need to
alter this for your needs.  Get the data sheet from the Philips site
here:

  http://www-us6.semiconductors.com/acrobat/datasheets/TDA9874H_2.pdf

Most of the setup should be right, just look at the ESP register setting
and page 42 of the datasheet.

I'll put the code down the bottom.

I load the following modules:

modprobe i2c-core
modprobe tuner
modprobe tda9874
modprobe bttv

in the bttv-cards.c file I have:

	name:		"FlyVideo 2000S",
	video_inputs:	3,
	audio_inputs:	1,
	tuner:		0,
	svhs:		2,
	gpiomask:	0x18e0,
	muxsel:		{2, 3, 0, 1},
	audiomux:	{ 0x1000, 0x080, 0, 0, 0, 0 },
	pll:            PLL_28,
	tuner_type:	TUNER_PHILIPS_PAL,

I haven't actually had time to really test this (had the parameters in
the modules.conf file and transferred them to here).

This still needs a lot more work.  tda9874.c needs to have parameters
for video standard etc.

Let me know whether this works for you.  

Alistair

> Gyalókay Szabolcs wrote:
> 
> Hi there,
> 
> I have one of these awful Flyvideo 2000s cards, and I try to get it
> going under Linux. I ended up with this:
> 
>  /* DeeJay <deejay@xxxxxxxxxxxxx */
>  name:           "Lifeview FlyVideo 2000S",
>  video_inputs:   3,
>  audio_inputs:   3,
>  tuner:          0,
>  svhs:           2,
>  gpiomask: 0x18e0,
>  muxsel:  { 2, 3, 0, 1},
>  audiomux: { 0x000000,0x0018e0,0x001000,0x001000,0x001080,0x001080 },
>  needs_tvaudio:  1,
>  pll:            PLL_28,
>  tuner_type:     5,
> 
> This is working with mono sound and with vertical bars in some of the
> channels. Stereo sound and recording with xawtv isn't working. Radio
> is working, but sounds disgusting. I tried out this btInspector
> program, which gave this results:
> 
> Data1: "Flyvideo 2000s",
> Data2: 0x0000007b, {2, 3, 0, 1}, 2, 0x00000002, 0x00000000,
> Data3: 0x0018e0, 0x000000, 0x001000, 0x000000, 0x001000, 0x000800,
> 0x001080, 0x001080
> Info1: 878,11, b0 c2
> Info2: [Studio - Video]
> My question is, how can I make stereo and recording to work with the
> help of this data? And can those vertical bars be avoided? On this
> card there are LG tuners which work like the ones of Philipps, but
> there are less channels with bars under Windows. There are two
> TDA9874h chips on the board, I think those are in charge for stereo.
> 
> Thanks.
> Bye
> 
>                             DeeJay

-------------------drivers/media/video/tda9874.c-----------------
/*
 * For the TDA9874 chip
 * This driver will not complain if used with any 
 * other i2c device with the same address.
 *
 * Copyright (c) 2001 Alistair Lambie (alambie@xxxxxxx)
 * This code is placed under the terms of the GNU General Public License
 * Based on tda9875.c by Guillaume Delvit, Gerd Knorr and Eric Sandeen
 * Which was based on tda9855.c by Steve VanDeBogart
(vandebo@xxxxxxxxxxxxxxxxxxx)
 * Which was based on tda8425.c by Greg Alexander (c) 1998
 *
 * OPTIONS:
 * debug   - set to 1 if you'd like to see debug messages
 * 
 *  Revision: 0.1 - original version
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/malloc.h>
#include <linux/videodev.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>

#include "bttv.h"
#include "audiochip.h"
#include "id.h"

MODULE_PARM(debug,"i");

static int debug = 0;	/* insmod parameter */

/* Addresses to scan */
static unsigned short normal_i2c[] =  {
    I2C_TDA9874 >> 1,
    I2C_CLIENT_END};
static unsigned short normal_i2c_range[] = {I2C_CLIENT_END};
static unsigned short probe[2]        = { I2C_CLIENT_END, I2C_CLIENT_END
};
static unsigned short probe_range[2]  = { I2C_CLIENT_END, I2C_CLIENT_END
};
static unsigned short ignore[2]       = { I2C_CLIENT_END, I2C_CLIENT_END
};
static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END
};
static unsigned short force[2]        = { I2C_CLIENT_END, I2C_CLIENT_END
};
static struct i2c_client_address_data addr_data = {
	normal_i2c, normal_i2c_range, 
	probe, probe_range, 
	ignore, ignore_range, 
	force
};

/* This is a superset of the TDA9874 */
struct tda9874 {
	int mode;
	int rvol, lvol;
	int bass, treble;
	struct i2c_client c;
};


static struct i2c_driver driver;
static struct i2c_client client_template;

#define dprintk  if (debug) printk

/* The TDA9874 is made by Philips Semiconductor
 * http://www.semiconductors.philips.com
 * TDA9874: I2C-bus controlled DSP audio processor, FM demodulator
 *
 */ 

		/* subaddresses for TDA9874 */
#define TDA9874_AGCGR       0x00
#define TDA9874_GCONR       0x01
#define TDA9874_MSR         0x02

#define TDA9874_C1FRA       0x03
#define TDA9874_C1FRB       0x04
#define TDA9874_C1FRC       0x05

#define TDA9874_C2FRA       0x06
#define TDA9874_C2FRB       0x07
#define TDA9874_C2FRC       0x08

#define TDA9874_DCR         0x09
#define TDA9874_FMER        0x0a
#define TDA9874_FMMR        0x0b

#define TDA9874_C1OLAR      0x0c
#define TDA9874_C2OLAR      0x0d

#define TDA9874_NCONR       0x0e
#define TDA9874_NOLAR       0x0f
#define TDA9874_NLELR       0x10
#define TDA9874_NUELR       0x11

#define TDA9874_AMCONR      0x12
#define TDA9874_SDACOSR     0x13
#define TDA9874_AOSR        0x14
#define TDA9874_DAICONR     0x15

#define TDA9874_I2SOSR      0x16
#define TDA9874_I2SOLAR     0x17
#define TDA9874_MDACOSR     0x18
#define TDA9874_ESP         0xFF

/* values */
#define TDA9874_MUTE_ON	    0xff /* general mute */
#define TDA9874_MUTE_OFF    0xf9 /* general no mute */



/* Begin code */

static int tda9874_write(struct i2c_client *client, int subaddr,
unsigned char val)
{
	unsigned char buffer[2];
	dprintk("In tda9874_write\n");
	dprintk("Writing %d 0x%x\n", subaddr, val);
	buffer[0] = subaddr;
	buffer[1] = val;
	if (2 != i2c_master_send(client,buffer,2)) {
		printk(KERN_WARNING "tda9874: I/O error, trying (write %d 0x%x)\n",
		       subaddr, val);
		return -1;
	}
	return 0;
}

#if 0
static int tda9874_read(struct i2c_client *client)
{
	unsigned char buffer;
	dprintk("In tda9874_read\n");
	if (1 != i2c_master_recv(client,&buffer,1)) {
		printk(KERN_WARNING "tda9874: I/O error, trying (read)\n");
		return -1;
	}
	dprintk("Read 0x%02x\n", buffer); 
	return buffer;
}
#endif

static void do_tda9874_init(struct i2c_client *client)
{
	struct tda9874 *t = client->data;
	dprintk("In tda9874_init\n"); 
	tda9874_write(client, TDA9874_AGCGR, 0x00 );
	tda9874_write(client, TDA9874_GCONR, 0xc1 );
	tda9874_write(client, TDA9874_MSR, 0x00 );
	tda9874_write(client, TDA9874_FMMR, 0x80 );
	tda9874_write(client, TDA9874_NCONR, 0x04 );
    	tda9874_write(client, TDA9874_AMCONR, 0xf9 );
	tda9874_write(client, TDA9874_SDACOSR, 0x81 );
	tda9874_write(client, TDA9874_AOSR, 0x80 );
	tda9874_write(client, TDA9874_MDACOSR, 0x82 );
	tda9874_write(client, TDA9874_ESP, 0x06 );

}


/* *********************** *
 * i2c interface functions *
 * *********************** */

static int tda9874_attach(struct i2c_adapter *adap, int addr,
			  unsigned short flags, int kind)
{
	struct tda9874 *t;
	struct i2c_client *client;
	dprintk("In tda9874_attach\n");

	t = kmalloc(sizeof *t,GFP_KERNEL);
	if (!t)
		return -ENOMEM;
	memset(t,0,sizeof *t);

	client = &t->c;
        memcpy(client,&client_template,sizeof(struct i2c_client));
        client->adapter = adap;
        client->addr = addr;
	client->data = t;
	
	do_tda9874_init(client);
	MOD_INC_USE_COUNT;
	strcpy(client->name,"TDA9874");
	printk(KERN_INFO "tda9874: init\n");

	i2c_attach_client(client);
	return 0;
}

static int tda9874_probe(struct i2c_adapter *adap)
{
	if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848))
		return i2c_probe(adap, &addr_data, tda9874_attach);
	return 0;
}

static int tda9874_detach(struct i2c_client *client)
{
	struct tda9874 *t  = client->data;

	do_tda9874_init(client);
	i2c_detach_client(client);
	
	kfree(t);
	MOD_DEC_USE_COUNT;
	return 0;
}

static int tda9874_command(struct i2c_client *client,
                                unsigned int cmd, void *arg)
{
        struct tda9874 *t = client->data;

        dprintk("In tda9874_command...\n");

        return 0;
}


static struct i2c_driver driver = {
        "i2c tda9874 driver",
        I2C_DRIVERID_TDA9874, /* Get new one for TDA9874 */
        I2C_DF_NOTIFY,
	tda9874_probe,
        tda9874_detach,
        tda9874_command,
};

static struct i2c_client client_template =
{
        "(unset)",		/* name */
        -1,
        0,
        0,
        NULL,
        &driver
};

#ifdef MODULE
int init_module(void)
#else
int tda9874_init(void)
#endif
{
	i2c_add_driver(&driver);
	return 0;
}

#ifdef MODULE
void cleanup_module(void)
{
	i2c_del_driver(&driver);
}
#endif

/*
 * Local variables:
 * c-basic-offset: 8
 * End:
 */





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux