Commit a7d9a66e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] v4l: add conexant 2388x driver.

From: Gerd Knorr <kraxel@bytesex.org>

This patch adds a experimental driver for Conexant 2388x based TV cards.

DESC
cx88-video compile fixes for older gcc
EDESC

Fix some gcc-3.xisms.
parent 151335ea
......@@ -34,19 +34,20 @@ source "drivers/media/common/Kconfig"
config VIDEO_TUNER
tristate
default y if VIDEO_BT848=y || VIDEO_SAA7134=y || VIDEO_MXB=y
default m if VIDEO_BT848=m || VIDEO_SAA7134=m || VIDEO_MXB=m
default y if VIDEO_BT848=y || VIDEO_SAA7134=y || VIDEO_MXB=y || VIDEO_CX88=y
default m if VIDEO_BT848=m || VIDEO_SAA7134=m || VIDEO_MXB=m || VIDEO_CX88=m
depends on VIDEO_DEV
config VIDEO_BUF
tristate
default y if VIDEO_BT848=y || VIDEO_SAA7134=y || VIDEO_SAA7146=y
default m if VIDEO_BT848=m || VIDEO_SAA7134=m || VIDEO_SAA7146=m
default y if VIDEO_BT848=y || VIDEO_SAA7134=y || VIDEO_SAA7146=y || VIDEO_CX88=y
default m if VIDEO_BT848=m || VIDEO_SAA7134=m || VIDEO_SAA7146=m || VIDEO_CX88=m
depends on VIDEO_DEV
config VIDEO_BTCX
tristate
default VIDEO_BT848
default y if VIDEO_BT848=y || VIDEO_CX88=y
default m if VIDEO_BT848=m || VIDEO_CX88=m
depends on VIDEO_DEV
config VIDEO_IR
......
......@@ -274,5 +274,15 @@ config VIDEO_HEXIUM_GEMINI
To compile this driver as a module, choose M here: the
module will be called hexium_gemini.
config VIDEO_CX88
tristate "Conexant 2388x (bt878 successor) support"
depends on VIDEO_DEV && PCI && I2C_ALGOBIT && EXPERIMENTAL
---help---
This is a video4linux driver for Conexant 2388x based
TV cards.
To compile this driver as a module, choose M here: the
module will be called cx8800
endmenu
......@@ -35,6 +35,7 @@ obj-$(CONFIG_VIDEO_CPIA_PP) += cpia_pp.o
obj-$(CONFIG_VIDEO_CPIA_USB) += cpia_usb.o
obj-$(CONFIG_VIDEO_MEYE) += meye.o
obj-$(CONFIG_VIDEO_SAA7134) += saa7134/
obj-$(CONFIG_VIDEO_CX88) += cx88/
obj-$(CONFIG_VIDEO_MXB) += saa7111.o tuner.o tda9840.o tea6415c.o tea6420.o mxb.o
obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o
obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o
......
cx88xx-objs := cx88-cards.o cx88-core.o
cx8800-objs := cx88-video.o cx88-tvaudio.o cx88-i2c.o
obj-$(CONFIG_VIDEO_CX88) += cx88xx.o cx8800.o
EXTRA_CFLAGS = -I$(src)/..
This diff is collapsed.
This diff is collapsed.
/*
cx88-i2c.c -- all the i2c code is here
Copyright (C) 1996,97,98 Ralph Metzler (rjkm@thp.uni-koeln.de)
& Marcus Metzler (mocm@thp.uni-koeln.de)
(c) 2002 Yurij Sysoev <yurij@naturesoft.net>
(c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
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.
*/
#define __NO_VERSION__ 1
#include <linux/module.h>
#include <linux/init.h>
#include <asm/io.h>
#include "cx88.h"
/* ----------------------------------------------------------------------- */
void cx8800_bit_setscl(void *data, int state)
{
struct cx8800_dev *dev = data;
if (state)
dev->i2c_state |= 0x02;
else
dev->i2c_state &= ~0x02;
cx_write(MO_I2C, dev->i2c_state);
cx_read(MO_I2C);
}
void cx8800_bit_setsda(void *data, int state)
{
struct cx8800_dev *dev = data;
if (state)
dev->i2c_state |= 0x01;
else
dev->i2c_state &= ~0x01;
cx_write(MO_I2C, dev->i2c_state);
cx_read(MO_I2C);
}
static int cx8800_bit_getscl(void *data)
{
struct cx8800_dev *dev = data;
u32 state;
state = cx_read(MO_I2C);
return state & 0x02 ? 1 : 0;
}
static int cx8800_bit_getsda(void *data)
{
struct cx8800_dev *dev = data;
u32 state;
state = cx_read(MO_I2C);
return state & 0x01;
}
/* ----------------------------------------------------------------------- */
#ifndef I2C_PEC
static void cx8800_inc_use(struct i2c_adapter *adap)
{
MOD_INC_USE_COUNT;
}
static void cx8800_dec_use(struct i2c_adapter *adap)
{
MOD_DEC_USE_COUNT;
}
#endif
static int attach_inform(struct i2c_client *client)
{
struct cx8800_dev *dev = i2c_get_adapdata(client->adapter);
if (dev->tuner_type != UNSET)
cx8800_call_i2c_clients(dev,TUNER_SET_TYPE,&dev->tuner_type);
if (1 /* fixme: debug */)
printk("%s: i2c attach [client=%s]\n",
dev->name, i2c_clientname(client));
return 0;
}
void cx8800_call_i2c_clients(struct cx8800_dev *dev, unsigned int cmd, void *arg)
{
if (0 != dev->i2c_rc)
return;
i2c_clients_command(&dev->i2c_adap, cmd, arg);
}
static struct i2c_algo_bit_data cx8800_i2c_algo_template = {
.setsda = cx8800_bit_setsda,
.setscl = cx8800_bit_setscl,
.getsda = cx8800_bit_getsda,
.getscl = cx8800_bit_getscl,
.udelay = 16,
.mdelay = 10,
.timeout = 200,
};
/* ----------------------------------------------------------------------- */
static struct i2c_adapter cx8800_i2c_adap_template = {
#ifdef I2C_PEC
.owner = THIS_MODULE,
#else
.inc_use = cx8800_inc_use,
.dec_use = cx8800_dec_use,
#endif
#ifdef I2C_ADAP_CLASS_TV_ANALOG
.class = I2C_ADAP_CLASS_TV_ANALOG,
#endif
I2C_DEVNAME("cx2388x"),
.id = I2C_HW_B_BT848,
.client_register = attach_inform,
};
static struct i2c_client cx8800_i2c_client_template = {
I2C_DEVNAME("cx88xx internal"),
.id = -1,
};
/* init + register i2c algo-bit adapter */
int __devinit cx8800_i2c_init(struct cx8800_dev *dev)
{
memcpy(&dev->i2c_adap, &cx8800_i2c_adap_template,
sizeof(dev->i2c_adap));
memcpy(&dev->i2c_algo, &cx8800_i2c_algo_template,
sizeof(dev->i2c_algo));
memcpy(&dev->i2c_client, &cx8800_i2c_client_template,
sizeof(dev->i2c_client));
dev->i2c_adap.dev.parent = &dev->pci->dev;
strcpy(dev->i2c_adap.name,dev->name);
dev->i2c_algo.data = dev;
i2c_set_adapdata(&dev->i2c_adap,dev);
dev->i2c_adap.algo_data = &dev->i2c_algo;
dev->i2c_client.adapter = &dev->i2c_adap;
cx8800_bit_setscl(dev,1);
cx8800_bit_setsda(dev,1);
dev->i2c_rc = i2c_bit_add_bus(&dev->i2c_adap);
return dev->i2c_rc;
}
/*
* Local variables:
* c-basic-offset: 8
* End:
*/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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