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

V4L/DVB (3513): Remove saa711x driver

Now, em28xx uses saa7115 instead of saa711x.
saa7115 driver is capable of handling saa 7113, 7114 and 7115.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent c04e89b1
......@@ -44,7 +44,7 @@ obj-$(CONFIG_VIDEO_MEYE) += meye.o
obj-$(CONFIG_VIDEO_SAA7134) += ir-kbd-i2c.o saa7134/
obj-$(CONFIG_VIDEO_CX88) += cx88/
obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
obj-$(CONFIG_VIDEO_EM28XX) += saa711x.o tvp5150.o
obj-$(CONFIG_VIDEO_EM28XX) += saa7115.o tvp5150.o
obj-$(CONFIG_VIDEO_AUDIO_DECODER) += wm8775.o cs53l32a.o
obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/
obj-$(CONFIG_VIDEO_CPIA2) += cpia2/
......
......@@ -101,23 +101,6 @@ static struct em28xx_tvnorm tvnorms[] = {
}
};
static const unsigned char saa7114_i2c_init[] = {
0x00,0x00,0x01,0x08,0x02,0xc4,0x03,0x30,0x04,0x90,0x05,0x90,0x06,0xeb,0x07,0xe0,
0x08,0x88,0x09,0x40,0x0a,0x80,0x0b,0x44,0x0c,0x40,0x0d,0x00,0x0e,0x81,0x0f,0x2a,
0x10,0x06,0x11,0x00,0x12,0xc8,0x13,0x80,0x14,0x00,0x15,0x11,0x16,0x01,0x17,0x42,
0x18,0x40,0x19,0x80,0x40,0x00,0x41,0xff,0x42,0xff,0x43,0xff,0x44,0xff,0x45,0xff,
0x46,0xff,0x47,0xff,0x48,0xff,0x49,0xff,0x4a,0xff,0x4b,0xff,0x4c,0xff,0x4d,0xff,
0x4e,0xff,0x4f,0xff,0x50,0xff,0x51,0xff,0x52,0xff,0x53,0xff,0x54,0x5f,0x55,0xff,
0x56,0xff,0x57,0xff,0x58,0x00,0x59,0x47,0x5a,0x03,0x5b,0x03,0x5d,0x3e,0x5e,0x00,
0x80,0x1c,0x83,0x01,0x84,0xa5,0x85,0x10,0x86,0x45,0x87,0x41,0x88,0xf0,0x88,0x00,
0x88,0xf0,0x90,0x00,0x91,0x08,0x92,0x00,0x93,0x80,0x94,0x08,0x95,0x00,0x96,0xc0,
0x97,0x02,0x98,0x13,0x99,0x00,0x9a,0x38,0x9b,0x01,0x9c,0x80,0x9d,0x02,0x9e,0x06,
0x9f,0x01,0xa0,0x01,0xa1,0x00,0xa2,0x00,0xa4,0x80,0xa5,0x36,0xa6,0x36,0xa8,0x67,
0xa9,0x04,0xaa,0x00,0xac,0x33,0xad,0x02,0xae,0x00,0xb0,0xcd,0xb1,0x04,0xb2,0xcd,
0xb3,0x04,0xb4,0x01,0xb8,0x00,0xb9,0x00,0xba,0x00,0xbb,0x00,0xbc,0x00,0xbd,0x00,
0xbe,0x00,0xbf,0x00
};
#define TVNORMS ARRAY_SIZE(tvnorms)
/* supported controls */
......@@ -144,65 +127,6 @@ static struct v4l2_queryctrl em28xx_qctrl[] = {
}
};
/* FIXME: These are specific to saa711x - should be moved to its code */
static struct v4l2_queryctrl saa711x_qctrl[] = {
{
.id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Brightness",
.minimum = -128,
.maximum = 127,
.step = 1,
.default_value = 0,
.flags = 0,
},{
.id = V4L2_CID_CONTRAST,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Contrast",
.minimum = 0x0,
.maximum = 0x1f,
.step = 0x1,
.default_value = 0x10,
.flags = 0,
},{
.id = V4L2_CID_SATURATION,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Saturation",
.minimum = 0x0,
.maximum = 0x1f,
.step = 0x1,
.default_value = 0x10,
.flags = 0,
},{
.id = V4L2_CID_RED_BALANCE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Red chroma balance",
.minimum = -128,
.maximum = 127,
.step = 1,
.default_value = 0,
.flags = 0,
},{
.id = V4L2_CID_BLUE_BALANCE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Blue chroma balance",
.minimum = -128,
.maximum = 127,
.step = 1,
.default_value = 0,
.flags = 0,
},{
.id = V4L2_CID_GAMMA,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Gamma",
.minimum = 0x0,
.maximum = 0x3f,
.step = 0x1,
.default_value = 0x20,
.flags = 0,
}
};
static struct usb_driver em28xx_usb_driver;
static DEFINE_MUTEX(em28xx_sysfs_lock);
......@@ -245,22 +169,9 @@ static int em28xx_config(struct em28xx *dev)
static void em28xx_config_i2c(struct em28xx *dev)
{
struct v4l2_frequency f;
struct video_decoder_init em28xx_vdi = {.data = NULL };
/* configure decoder */
if(dev->model == EM2820_BOARD_MSI_VOX_USB_2){
em28xx_vdi.data=saa7114_i2c_init;
em28xx_vdi.len=sizeof(saa7114_i2c_init);
}
em28xx_i2c_call_clients(dev, DECODER_INIT, &em28xx_vdi);
em28xx_i2c_call_clients(dev, DECODER_SET_INPUT, &dev->ctl_input);
/* em28xx_i2c_call_clients(dev,DECODER_SET_PICTURE, &dev->vpic); */
/* em28xx_i2c_call_clients(dev,DECODER_SET_NORM,&dev->tvnorm->id); */
/* em28xx_i2c_call_clients(dev,DECODER_ENABLE_OUTPUT,&output); */
/* em28xx_i2c_call_clients(dev,DECODER_DUMP, NULL); */
em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, NULL);
em28xx_i2c_call_clients(dev, VIDIOC_S_INPUT, &dev->ctl_input);
em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL);
/* configure tuner */
f.tuner = 0;
......@@ -300,8 +211,7 @@ static void video_mux(struct em28xx *dev, int index)
dev->ctl_input = index;
dev->ctl_ainput = INPUT(index)->amux;
em28xx_i2c_call_clients(dev, DECODER_SET_INPUT, &input);
em28xx_i2c_call_clients(dev, VIDIOC_S_INPUT, &input);
em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput);
......@@ -747,43 +657,6 @@ static int em28xx_get_ctrl(struct em28xx *dev, struct v4l2_control *ctrl)
}
}
/*FIXME: should be moved to saa711x */
static int saa711x_get_ctrl(struct em28xx *dev, struct v4l2_control *ctrl)
{
s32 tmp;
switch (ctrl->id) {
case V4L2_CID_BRIGHTNESS:
if ((tmp = em28xx_brightness_get(dev)) < 0)
return -EIO;
ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */
return 0;
case V4L2_CID_CONTRAST:
if ((ctrl->value = em28xx_contrast_get(dev)) < 0)
return -EIO;
return 0;
case V4L2_CID_SATURATION:
if ((ctrl->value = em28xx_saturation_get(dev)) < 0)
return -EIO;
return 0;
case V4L2_CID_RED_BALANCE:
if ((tmp = em28xx_v_balance_get(dev)) < 0)
return -EIO;
ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */
return 0;
case V4L2_CID_BLUE_BALANCE:
if ((tmp = em28xx_u_balance_get(dev)) < 0)
return -EIO;
ctrl->value = (s32) ((s8) tmp); /* FIXME: clenaer way to extend sign? */
return 0;
case V4L2_CID_GAMMA:
if ((ctrl->value = em28xx_gamma_get(dev)) < 0)
return -EIO;
return 0;
default:
return -EINVAL;
}
}
/*
* em28xx_set_ctrl()
* mute or set new saturation, brightness or contrast
......@@ -806,27 +679,6 @@ static int em28xx_set_ctrl(struct em28xx *dev, const struct v4l2_control *ctrl)
}
}
/*FIXME: should be moved to saa711x */
static int saa711x_set_ctrl(struct em28xx *dev, const struct v4l2_control *ctrl)
{
switch (ctrl->id) {
case V4L2_CID_BRIGHTNESS:
return em28xx_brightness_set(dev, ctrl->value);
case V4L2_CID_CONTRAST:
return em28xx_contrast_set(dev, ctrl->value);
case V4L2_CID_SATURATION:
return em28xx_saturation_set(dev, ctrl->value);
case V4L2_CID_RED_BALANCE:
return em28xx_v_balance_set(dev, ctrl->value);
case V4L2_CID_BLUE_BALANCE:
return em28xx_u_balance_set(dev, ctrl->value);
case V4L2_CID_GAMMA:
return em28xx_gamma_set(dev, ctrl->value);
default:
return -EINVAL;
}
}
/*
* em28xx_stream_interrupt()
* stops streaming
......@@ -1130,8 +982,6 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
em28xx_set_norm(dev, dev->width, dev->height);
em28xx_i2c_call_clients(dev, DECODER_SET_NORM,
&tvnorms[i].mode);
em28xx_i2c_call_clients(dev, VIDIOC_S_STD,
&dev->tvnorm->id);
......@@ -1242,22 +1092,11 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
}
}
}
if (dev->decoder == EM28XX_TVP5150) {
em28xx_i2c_call_clients(dev,cmd,qc);
if (qc->type)
return 0;
else
return -EINVAL;
}
for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) {
if (qc->id && qc->id == saa711x_qctrl[i].id) {
memcpy(qc, &(saa711x_qctrl[i]),
sizeof(*qc));
return 0;
}
}
return -EINVAL;
em28xx_i2c_call_clients(dev,cmd,qc);
if (qc->type)
return 0;
else
return -EINVAL;
}
case VIDIOC_G_CTRL:
{
......@@ -1267,12 +1106,8 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
if (!dev->has_msp34xx)
retval=em28xx_get_ctrl(dev, ctrl);
if (retval==-EINVAL) {
if (dev->decoder == EM28XX_TVP5150) {
em28xx_i2c_call_clients(dev,cmd,arg);
return 0;
}
return saa711x_get_ctrl(dev, ctrl);
em28xx_i2c_call_clients(dev,cmd,arg);
return 0;
} else return retval;
}
case VIDIOC_S_CTRL:
......@@ -1293,33 +1128,8 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
}
}
if (dev->decoder == EM28XX_TVP5150) {
em28xx_i2c_call_clients(dev,cmd,arg);
return 0;
} else if (!dev->has_msp34xx) {
for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) {
if (ctrl->id == em28xx_qctrl[i].id) {
if (ctrl->value <
em28xx_qctrl[i].minimum
|| ctrl->value >
em28xx_qctrl[i].maximum)
return -ERANGE;
return em28xx_set_ctrl(dev, ctrl);
}
}
for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) {
if (ctrl->id == saa711x_qctrl[i].id) {
if (ctrl->value <
saa711x_qctrl[i].minimum
|| ctrl->value >
saa711x_qctrl[i].maximum)
return -ERANGE;
return saa711x_set_ctrl(dev, ctrl);
}
}
}
return -EINVAL;
em28xx_i2c_call_clients(dev,cmd,arg);
return 0;
}
/* --- tuner ioctls ------------------------------------------ */
case VIDIOC_G_TUNER:
......@@ -1772,7 +1582,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
#ifdef CONFIG_MODULES
/* request some modules */
if (dev->decoder == EM28XX_SAA7113 || dev->decoder == EM28XX_SAA7114)
request_module("saa711x");
request_module("saa7115");
if (dev->decoder == EM28XX_TVP5150)
request_module("tvp5150");
if (dev->has_tuner)
......
/* saa7115 - Philips SAA7114/SAA7115 video decoder driver
/* saa7115 - Philips SAA7113/SAA7114/SAA7115 video decoder driver
*
* Based on saa7114 driver by Maxim Yevtyushkin, which is based on
* the saa7111 driver by Dave Perks.
......@@ -16,6 +16,7 @@
* (2/17/2003)
*
* VBI support (2004) and cleanups (2005) by Hans Verkuil <hverkuil@xs4all.nl>
* SAA7113 support by Mauro Carvalho Chehab <mchehab@infradead.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -42,8 +43,9 @@
#include <media/audiochip.h>
#include <asm/div64.h>
MODULE_DESCRIPTION("Philips SAA7114/SAA7115 video decoder driver");
MODULE_AUTHOR("Maxim Yevtyushkin, Kevin Thayer, Chris Kennedy, Hans Verkuil");
MODULE_DESCRIPTION("Philips SAA7113/SAA7114/SAA7115 video decoder driver");
MODULE_AUTHOR( "Maxim Yevtyushkin, Kevin Thayer, Chris Kennedy, "
"Hans Verkuil, Mauro Carvalho Chehab");
MODULE_LICENSE("GPL");
static int debug = 0;
......@@ -51,7 +53,10 @@ module_param(debug, bool, 0644);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
static unsigned short normal_i2c[] = { 0x42 >> 1, 0x40 >> 1, I2C_CLIENT_END };
static unsigned short normal_i2c[] = {
0x4a >>1, 0x48 >>1, /* SAA7113 */
0x42 >> 1, 0x40 >> 1, /* SAA7114 and SAA7115 */
I2C_CLIENT_END };
I2C_CLIENT_INSMOD;
......@@ -101,10 +106,12 @@ static inline int saa7115_read(struct i2c_client *client, u8 reg)
Hauppauge driver sets. */
static const unsigned char saa7115_init_auto_input[] = {
/* Front-End Part */
0x01, 0x48, /* white peak control disabled */
0x03, 0x20, /* was 0x30. 0x20: long vertical blanking */
0x04, 0x90, /* analog gain set to 0 */
0x05, 0x90, /* analog gain set to 0 */
/* Decoder Part */
0x06, 0xeb, /* horiz sync begin = -21 */
0x07, 0xe0, /* horiz sync stop = -17 */
0x0a, 0x80, /* was 0x88. decoder brightness, 0x80 is itu standard */
......@@ -123,6 +130,8 @@ static const unsigned char saa7115_init_auto_input[] = {
0x1b, 0x42, /* misc chroma control 0x42 = recommended */
0x1c, 0xa9, /* combfilter control 0xA9 = recommended */
0x1d, 0x01, /* combfilter control 0x01 = recommended */
/* Power Device Control */
0x88, 0xd0, /* reset device */
0x88, 0xf0, /* set device programmed, all in operational mode */
0x00, 0x00
......@@ -338,6 +347,33 @@ static const unsigned char saa7115_cfg_vbi_off[] = {
0x00, 0x00
};
static const unsigned char saa7113_init_auto_input[] = {
0x01, 0x08, /* PH7113_INCREMENT_DELAY - (1) (1) (1) (1) IDEL3 IDEL2 IDELL1 IDEL0 */
0x02, 0xc2, /* PH7113_ANALOG_INPUT_CONTR_1 - FUSE1 FUSE0 GUDL1 GUDL0 MODE3 MODE2 MODE1 MODE0 */
0x03, 0x30, /* PH7113_ANALOG_INPUT_CONTR_2 - (1) HLNRS VBSL WPOFF HOLDG GAFIX GAI28 GAI18 */
0x04, 0x00, /* PH7113_ANALOG_INPUT_CONTR_3 - GAI17 GAI16 GAI15 GAI14 GAI13 GAI12 GAI11 GAI10 */
0x05, 0x00, /* PH7113_ANALOG_INPUT_CONTR_4 - GAI27 GAI26 GAI25 GAI24 GAI23 GAI22 GAI21 GAI20 */
0x06, 0x89, /* PH7113_HORIZONTAL_SYNC_START - HSB7 HSB6 HSB5 HSB4 HSB3 HSB2 HSB1 HSB0 */
0x07, 0x0d, /* PH7113_HORIZONTAL_SYNC_STOP - HSS7 HSS6 HSS5 HSS4 HSS3 HSS2 HSS1 HSS0 */
0x08, 0x88, /* PH7113_SYNC_CONTROL - AUFD FSEL FOET HTC1 HTC0 HPLL VNOI1 VNOI0 */
0x09, 0x01, /* PH7113_LUMINANCE_CONTROL - BYPS PREF BPSS1 BPSS0 VBLB UPTCV APER1 APER0 */
0x0a, 0x80, /* PH7113_LUMINANCE_BRIGHTNESS - BRIG7 BRIG6 BRIG5 BRIG4 BRIG3 BRIG2 BRIG1 BRIG0 */
0x0b, 0x47, /* PH7113_LUMINANCE_CONTRAST - CONT7 CONT6 CONT5 CONT4 CONT3 CONT2 CONT1 CONT0 */
0x0c, 0x40, /* PH7113_CHROMA_SATURATION - SATN7 SATN6 SATN5 SATN4 SATN3 SATN2 SATN1 SATN0 */
0x0d, 0x00, /* PH7113_CHROMA_HUE_CONTROL - HUEC7 HUEC6 HUEC5 HUEC4 HUEC3 HUEC2 HUEC1 HUEC0 */
0x0e, 0x01, /* PH7113_CHROMA_CONTROL - CDTO CSTD2 CSTD1 CSTD0 DCCF FCTC CHBW1 CHBW0 */
0x0f, 0x2a, /* PH7113_CHROMA_GAIN_CONTROL - ACGC CGAIN6 CGAIN5 CGAIN4 CGAIN3 CGAIN2 CGAIN1 CGAIN0 */
0x10, 0x08, /* PH7113_FORMAT_DELAY_CONTROL - OFTS1 OFTS0 HDEL1 HDEL0 VRLN YDEL2 YDEL1 YDEL0 */
0x11, 0x0c, /* PH7113_OUTPUT_CONTROL_1 - GPSW1 CM99 GPSW0 HLSEL OEYC OERT VIPB COLO */
0x12, 0x07, /* PH7113_OUTPUT_CONTROL_2 - RTSE13 RTSE12 RTSE11 RTSE10 RTSE03 RTSE02 RTSE01 RTSE00 */
0x13, 0x00, /* PH7113_OUTPUT_CONTROL_3 - ADLSB (1) (1) OLDSB FIDP (1) AOSL1 AOSL0 */
0x14, 0x00, /* RESERVED 14 - (1) (1) (1) (1) (1) (1) (1) (1) */
0x15, 0x00, /* PH7113_V_GATE1_START - VSTA7 VSTA6 VSTA5 VSTA4 VSTA3 VSTA2 VSTA1 VSTA0 */
0x16, 0x00, /* PH7113_V_GATE1_STOP - VSTO7 VSTO6 VSTO5 VSTO4 VSTO3 VSTO2 VSTO1 VSTO0 */
0x17, 0x00, /* PH7113_V_GATE1_MSB - (1) (1) (1) (1) (1) (1) VSTO8 VSTA8 */
0x00, 0x00
};
static const unsigned char saa7115_init_misc[] = {
0x38, 0x03, /* audio stuff */
0x39, 0x10,
......@@ -680,7 +716,7 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
state->std = std;
/* restart task B if needed */
if (taskb && state->ident == V4L2_IDENT_SAA7114) {
if (taskb && state->ident != V4L2_IDENT_SAA7115) {
saa7115_writeregs(client, saa7115_cfg_vbi_on);
}
......@@ -703,7 +739,7 @@ static void saa7115_log_status(struct i2c_client *client)
int vcr;
v4l_info(client, "Audio frequency: %d Hz\n", state->audclk_freq);
if (client->name[6] == '4') {
if (state->ident != V4L2_IDENT_SAA7115) {
/* status for the saa7114 */
reg1f = saa7115_read(client, 0x1f);
signalOk = (reg1f & 0xc1) == 0x81;
......@@ -751,8 +787,8 @@ static void saa7115_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_fo
u8 lcr[24];
int i, x;
/* saa7114 doesn't yet support VBI */
if (state->ident == V4L2_IDENT_SAA7114)
/* saa7113/71144 doesn't yet support VBI */
if (state->ident != V4L2_IDENT_SAA7115)
return;
for (i = 0; i <= 23; i++)
......@@ -1261,14 +1297,12 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
saa7115_write(client, 0, 5);
chip_id = saa7115_read(client, 0) & 0x0f;
if (chip_id != 4 && chip_id != 5) {
if (chip_id <3 && chip_id > 5) {
v4l_dbg(1, debug, client, "saa7115 not found\n");
kfree(client);
return 0;
}
if (chip_id == 4) {
snprintf(client->name, sizeof(client->name) - 1, "saa7114");
}
snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id);
v4l_info(client, "saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name);
state = kzalloc(sizeof(struct saa7115_state), GFP_KERNEL);
......@@ -1285,13 +1319,27 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
state->contrast = 64;
state->hue = 0;
state->sat = 64;
state->ident = (chip_id == 4) ? V4L2_IDENT_SAA7114 : V4L2_IDENT_SAA7115;
switch (chip_id) {
case 3:
state->ident = V4L2_IDENT_SAA7113;
break;
case 4:
state->ident = V4L2_IDENT_SAA7114;
break;
default:
state->ident = V4L2_IDENT_SAA7115;
break;
}
state->audclk_freq = 48000;
v4l_dbg(1, debug, client, "writing init values\n");
/* init to 60hz/48khz */
saa7115_writeregs(client, saa7115_init_auto_input);
if (state->ident==V4L2_IDENT_SAA7113)
saa7115_writeregs(client, saa7113_init_auto_input);
else
saa7115_writeregs(client, saa7115_init_auto_input);
saa7115_writeregs(client, saa7115_init_misc);
saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x);
saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y);
......
......@@ -103,6 +103,7 @@ enum v4l2_chip_ident {
V4L2_IDENT_UNKNOWN = 0,
/* module saa7115: reserved range 100-149 */
V4L2_IDENT_SAA7113 = 103,
V4L2_IDENT_SAA7114 = 104,
V4L2_IDENT_SAA7115 = 105,
......
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