Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 137971
b: refs/heads/master
c: 107063c
h: refs/heads/master
i:
  137969: bd9e047
  137967: a0c5c91
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent acfb911 commit 7f5f8e9
Show file tree
Hide file tree
Showing 19 changed files with 637 additions and 2,563 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 84c1b09495ea366276726b0df2dcd7898cda9d0f
refs/heads/master: 107063c6156a0cbf055e771baafc28a3e3c0fb9b
28 changes: 4 additions & 24 deletions trunk/drivers/media/video/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -307,38 +307,18 @@ config VIDEO_TCM825X

config VIDEO_SAA7110
tristate "Philips SAA7110 video decoder"
depends on VIDEO_V4L1 && I2C
depends on VIDEO_V4L2 && I2C
---help---
Support for the Philips SAA7110 video decoders.

To compile this driver as a module, choose M here: the
module will be called saa7110.

config VIDEO_SAA7111
tristate "Philips SAA7111 video decoder"
depends on VIDEO_V4L1 && I2C
---help---
Support for the Philips SAA711 video decoder.

To compile this driver as a module, choose M here: the
module will be called saa7111.

config VIDEO_SAA7114
tristate "Philips SAA7114 video decoder"
depends on VIDEO_V4L1 && I2C
---help---
Support for the Philips SAA7114 video decoder. This driver
is used only on Zoran driver and should be moved soon to
SAA711x module.

To compile this driver as a module, choose M here: the
module will be called saa7114.

config VIDEO_SAA711X
tristate "Philips SAA7113/4/5 video decoders"
tristate "Philips SAA7111/3/4/5 video decoders"
depends on VIDEO_V4L2 && I2C
---help---
Support for the Philips SAA7113/4/5 video decoders.
Support for the Philips SAA7111/3/4/5 video decoders.

To compile this driver as a module, choose M here: the
module will be called saa7115.
Expand Down Expand Up @@ -639,7 +619,7 @@ config VIDEO_MXB
depends on PCI && VIDEO_V4L1 && I2C
select VIDEO_SAA7146_VV
select VIDEO_TUNER
select VIDEO_SAA7115 if VIDEO_HELPER_CHIPS_AUTO
select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO
select VIDEO_TDA9840 if VIDEO_HELPER_CHIPS_AUTO
select VIDEO_TEA6415C if VIDEO_HELPER_CHIPS_AUTO
select VIDEO_TEA6420 if VIDEO_HELPER_CHIPS_AUTO
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/media/video/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o
obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o
obj-$(CONFIG_VIDEO_TEA6420) += tea6420.o
obj-$(CONFIG_VIDEO_SAA7110) += saa7110.o
obj-$(CONFIG_VIDEO_SAA7111) += saa7111.o
obj-$(CONFIG_VIDEO_SAA7114) += saa7114.o
obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o
obj-$(CONFIG_VIDEO_SAA717X) += saa717x.o
obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o
Expand Down
74 changes: 18 additions & 56 deletions trunk/drivers/media/video/adv7170.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,15 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
struct adv7170 {
unsigned char reg[128];

int norm;
v4l2_std_id norm;
int input;
int enable;
int bright;
int contrast;
int hue;
int sat;
};

static char *inputs[] = { "pass_through", "play_back" };
static char *norms[] = { "PAL", "NTSC" };

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

Expand Down Expand Up @@ -191,7 +189,7 @@ static int adv7170_command(struct i2c_client *client, unsigned cmd, void *arg)
struct adv7170 *encoder = i2c_get_clientdata(client);

switch (cmd) {
case 0:
case VIDIOC_INT_INIT:
#if 0
/* This is just for testing!!! */
adv7170_write_block(client, init_common,
Expand All @@ -201,63 +199,47 @@ static int adv7170_command(struct i2c_client *client, unsigned cmd, void *arg)
#endif
break;

case ENCODER_GET_CAPABILITIES:
case VIDIOC_INT_S_STD_OUTPUT:
{
struct video_encoder_capability *cap = arg;
v4l2_std_id iarg = *(v4l2_std_id *) arg;

cap->flags = VIDEO_ENCODER_PAL |
VIDEO_ENCODER_NTSC;
cap->inputs = 2;
cap->outputs = 1;
break;
}

case ENCODER_SET_NORM:
{
int iarg = *(int *) arg;

v4l_dbg(1, debug, client, "set norm %d\n", iarg);
v4l_dbg(1, debug, client, "set norm %llx\n", iarg);

switch (iarg) {
case VIDEO_MODE_NTSC:
if (iarg & V4L2_STD_NTSC) {
adv7170_write_block(client, init_NTSC,
sizeof(init_NTSC));
if (encoder->input == 0)
adv7170_write(client, 0x02, 0x0e); // Enable genlock
adv7170_write(client, 0x07, TR0MODE | TR0RST);
adv7170_write(client, 0x07, TR0MODE);
break;

case VIDEO_MODE_PAL:
} else if (iarg & V4L2_STD_PAL) {
adv7170_write_block(client, init_PAL,
sizeof(init_PAL));
if (encoder->input == 0)
adv7170_write(client, 0x02, 0x0e); // Enable genlock
adv7170_write(client, 0x07, TR0MODE | TR0RST);
adv7170_write(client, 0x07, TR0MODE);
break;

default:
v4l_dbg(1, debug, client, "illegal norm: %d\n", iarg);
} else {
v4l_dbg(1, debug, client, "illegal norm: %llx\n", iarg);
return -EINVAL;
}
v4l_dbg(1, debug, client, "switched to %s\n", norms[iarg]);
v4l_dbg(1, debug, client, "switched to %llx\n", iarg);
encoder->norm = iarg;
break;
}

case ENCODER_SET_INPUT:
case VIDIOC_INT_S_VIDEO_ROUTING:
{
int iarg = *(int *) arg;
struct v4l2_routing *route = arg;

/* RJ: *iarg = 0: input is from decoder
*iarg = 1: input is from ZR36060
*iarg = 2: color bar */

v4l_dbg(1, debug, client, "set input from %s\n",
iarg == 0 ? "decoder" : "ZR36060");
route->input == 0 ? "decoder" : "ZR36060");

switch (iarg) {
switch (route->input) {
case 0:
adv7170_write(client, 0x01, 0x20);
adv7170_write(client, 0x08, TR1CAPT); /* TR1 */
Expand All @@ -277,30 +259,11 @@ static int adv7170_command(struct i2c_client *client, unsigned cmd, void *arg)
break;

default:
v4l_dbg(1, debug, client, "illegal input: %d\n", iarg);
return -EINVAL;
}
v4l_dbg(1, debug, client, "switched to %s\n", inputs[iarg]);
encoder->input = iarg;
break;
}

case ENCODER_SET_OUTPUT:
{
int *iarg = arg;

/* not much choice of outputs */
if (*iarg != 0) {
v4l_dbg(1, debug, client, "illegal input: %d\n", route->input);
return -EINVAL;
}
break;
}

case ENCODER_ENABLE_OUTPUT:
{
int *iarg = arg;

encoder->enable = !!*iarg;
v4l_dbg(1, debug, client, "switched to %s\n", inputs[route->input]);
encoder->input = route->input;
break;
}

Expand Down Expand Up @@ -337,9 +300,8 @@ static int adv7170_probe(struct i2c_client *client,
encoder = kzalloc(sizeof(struct adv7170), GFP_KERNEL);
if (encoder == NULL)
return -ENOMEM;
encoder->norm = VIDEO_MODE_NTSC;
encoder->norm = V4L2_STD_NTSC;
encoder->input = 0;
encoder->enable = 1;
i2c_set_clientdata(client, encoder);

i = adv7170_write_block(client, init_NTSC, sizeof(init_NTSC));
Expand Down
81 changes: 21 additions & 60 deletions trunk/drivers/media/video/adv7175.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
/* ----------------------------------------------------------------------- */

struct adv7175 {
int norm;
v4l2_std_id norm;
int input;
int enable;
int bright;
int contrast;
int hue;
Expand All @@ -59,7 +58,6 @@ struct adv7175 {
#define I2C_ADV7176 0x54

static char *inputs[] = { "pass_through", "play_back", "color_bar" };
static char *norms[] = { "PAL", "NTSC", "SECAM->PAL (may not work!)" };

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

Expand Down Expand Up @@ -189,50 +187,33 @@ static int adv7175_command(struct i2c_client *client, unsigned cmd, void *arg)
struct adv7175 *encoder = i2c_get_clientdata(client);

switch (cmd) {
case 0:
case VIDIOC_INT_INIT:
/* This is just for testing!!! */
adv7175_write_block(client, init_common,
sizeof(init_common));
adv7175_write(client, 0x07, TR0MODE | TR0RST);
adv7175_write(client, 0x07, TR0MODE);
break;

case ENCODER_GET_CAPABILITIES:
case VIDIOC_INT_S_STD_OUTPUT:
{
struct video_encoder_capability *cap = arg;
v4l2_std_id iarg = *(v4l2_std_id *) arg;

cap->flags = VIDEO_ENCODER_PAL |
VIDEO_ENCODER_NTSC |
VIDEO_ENCODER_SECAM; /* well, hacky */
cap->inputs = 2;
cap->outputs = 1;
break;
}

case ENCODER_SET_NORM:
{
int iarg = *(int *) arg;

switch (iarg) {
case VIDEO_MODE_NTSC:
if (iarg & V4L2_STD_NTSC) {
adv7175_write_block(client, init_ntsc,
sizeof(init_ntsc));
if (encoder->input == 0)
adv7175_write(client, 0x0d, 0x4f); // Enable genlock
adv7175_write(client, 0x07, TR0MODE | TR0RST);
adv7175_write(client, 0x07, TR0MODE);
break;

case VIDEO_MODE_PAL:
} else if (iarg & V4L2_STD_PAL) {
adv7175_write_block(client, init_pal,
sizeof(init_pal));
if (encoder->input == 0)
adv7175_write(client, 0x0d, 0x4f); // Enable genlock
adv7175_write(client, 0x07, TR0MODE | TR0RST);
adv7175_write(client, 0x07, TR0MODE);
break;

case VIDEO_MODE_SECAM: // WARNING! ADV7176 does not support SECAM.
} else if (iarg & V4L2_STD_SECAM) {
/* This is an attempt to convert
* SECAM->PAL (typically it does not work
* due to genlock: when decoder is in SECAM
Expand All @@ -245,33 +226,32 @@ static int adv7175_command(struct i2c_client *client, unsigned cmd, void *arg)
adv7175_write(client, 0x0d, 0x49); // Disable genlock
adv7175_write(client, 0x07, TR0MODE | TR0RST);
adv7175_write(client, 0x07, TR0MODE);
break;
default:
v4l_dbg(1, debug, client, "illegal norm: %d\n", iarg);
} else {
v4l_dbg(1, debug, client, "illegal norm: %llx\n", iarg);
return -EINVAL;
}
v4l_dbg(1, debug, client, "switched to %s\n", norms[iarg]);
v4l_dbg(1, debug, client, "switched to %llx\n", iarg);
encoder->norm = iarg;
break;
}

case ENCODER_SET_INPUT:
case VIDIOC_INT_S_VIDEO_ROUTING:
{
int iarg = *(int *) arg;
struct v4l2_routing *route = arg;

/* RJ: *iarg = 0: input is from SAA7110
*iarg = 1: input is from ZR36060
*iarg = 2: color bar */

switch (iarg) {
switch (route->input) {
case 0:
adv7175_write(client, 0x01, 0x00);

if (encoder->norm == VIDEO_MODE_NTSC)
if (encoder->norm & V4L2_STD_NTSC)
set_subcarrier_freq(client, 1);

adv7175_write(client, 0x0c, TR1CAPT); /* TR1 */
if (encoder->norm == VIDEO_MODE_SECAM)
if (encoder->norm & V4L2_STD_SECAM)
adv7175_write(client, 0x0d, 0x49); // Disable genlock
else
adv7175_write(client, 0x0d, 0x4f); // Enable genlock
Expand All @@ -283,7 +263,7 @@ static int adv7175_command(struct i2c_client *client, unsigned cmd, void *arg)
case 1:
adv7175_write(client, 0x01, 0x00);

if (encoder->norm == VIDEO_MODE_NTSC)
if (encoder->norm & V4L2_STD_NTSC)
set_subcarrier_freq(client, 0);

adv7175_write(client, 0x0c, TR1PLAY); /* TR1 */
Expand All @@ -296,7 +276,7 @@ static int adv7175_command(struct i2c_client *client, unsigned cmd, void *arg)
case 2:
adv7175_write(client, 0x01, 0x80);

if (encoder->norm == VIDEO_MODE_NTSC)
if (encoder->norm & V4L2_STD_NTSC)
set_subcarrier_freq(client, 0);

adv7175_write(client, 0x0d, 0x49);
Expand All @@ -306,29 +286,11 @@ static int adv7175_command(struct i2c_client *client, unsigned cmd, void *arg)
break;

default:
v4l_dbg(1, debug, client, "illegal input: %d\n", iarg);
v4l_dbg(1, debug, client, "illegal input: %d\n", route->input);
return -EINVAL;
}
v4l_dbg(1, debug, client, "switched to %s\n", inputs[iarg]);
encoder->input = iarg;
break;
}

case ENCODER_SET_OUTPUT:
{
int *iarg = arg;

/* not much choice of outputs */
if (*iarg != 0)
return -EINVAL;
break;
}

case ENCODER_ENABLE_OUTPUT:
{
int *iarg = arg;

encoder->enable = !!*iarg;
v4l_dbg(1, debug, client, "switched to %s\n", inputs[route->input]);
encoder->input = route->input;
break;
}

Expand Down Expand Up @@ -369,9 +331,8 @@ static int adv7175_probe(struct i2c_client *client,
encoder = kzalloc(sizeof(struct adv7175), GFP_KERNEL);
if (encoder == NULL)
return -ENOMEM;
encoder->norm = VIDEO_MODE_PAL;
encoder->norm = V4L2_STD_NTSC;
encoder->input = 0;
encoder->enable = 1;
i2c_set_clientdata(client, encoder);

i = adv7175_write_block(client, init_common, sizeof(init_common));
Expand Down
Loading

0 comments on commit 7f5f8e9

Please sign in to comment.