Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 76626
b: refs/heads/master
c: 9fad368
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jan 25, 2008
1 parent 8ccb9d1 commit 0f95f67
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 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: d52c7385ec8d4d2081b0db47e309723ce3eae816
refs/heads/master: 9fad368b6dff95b8b009a6b8eed42a549a05b263
61 changes: 32 additions & 29 deletions trunk/drivers/media/video/saa7127.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
#include <media/v4l2-i2c-drv.h>
#include <media/saa7127.h>

static int debug = 0;
static int test_image = 0;
static int debug;
static int test_image;

MODULE_DESCRIPTION("Philips SAA7127/9 video encoder driver");
MODULE_AUTHOR("Kevin Thayer, Chris Kennedy, Hans Verkuil");
Expand Down Expand Up @@ -357,9 +357,10 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
if (enable && (data->field != 0 || data->line != 21))
return -EINVAL;
if (state->cc_enable != enable) {
v4l_dbg(1, debug, client, "Turn CC %s\n", enable ? "on" : "off");
v4l_dbg(1, debug, client,
"Turn CC %s\n", enable ? "on" : "off");
saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
(state->xds_enable << 7) | (enable << 6) | 0x11);
(state->xds_enable << 7) | (enable << 6) | 0x11);
state->cc_enable = enable;
}
if (!enable)
Expand Down Expand Up @@ -417,7 +418,8 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat

saa7127_write(client, 0x26, data->data[0]);
saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f));
v4l_dbg(1, debug, client, "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]);
v4l_dbg(1, debug, client,
"WSS mode: %s\n", wss_strs[data->data[0] & 0xf]);
state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0];
return 0;
}
Expand Down Expand Up @@ -504,7 +506,8 @@ static int saa7127_set_output_type(struct i2c_client *client, int output)
default:
return -EINVAL;
}
v4l_dbg(1, debug, client, "Selecting %s output type\n", output_strs[output]);
v4l_dbg(1, debug, client,
"Selecting %s output type\n", output_strs[output]);

/* Configure Encoder */
saa7127_write(client, 0x2d, state->reg_2d);
Expand Down Expand Up @@ -566,12 +569,10 @@ static int saa7127_command(struct i2c_client *client,
{
int rc = 0;

if (state->input_type != route->input) {
if (state->input_type != route->input)
rc = saa7127_set_input_type(client, route->input);
}
if (rc == 0 && state->output_type != route->output) {
if (rc == 0 && state->output_type != route->output)
rc = saa7127_set_output_type(client, route->output);
}
return rc;
}

Expand Down Expand Up @@ -617,7 +618,8 @@ static int saa7127_command(struct i2c_client *client,
{
struct v4l2_register *reg = arg;

if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip))
if (!v4l2_chip_match_i2c_client(client,
reg->match_type, reg->match_chip))
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
Expand All @@ -634,16 +636,16 @@ static int saa7127_command(struct i2c_client *client,
struct v4l2_sliced_vbi_data *data = arg;

switch (data->id) {
case V4L2_SLICED_WSS_625:
return saa7127_set_wss(client, data);
case V4L2_SLICED_VPS:
return saa7127_set_vps(client, data);
case V4L2_SLICED_CAPTION_525:
if (data->field == 0)
return saa7127_set_cc(client, data);
return saa7127_set_xds(client, data);
default:
return -EINVAL;
case V4L2_SLICED_WSS_625:
return saa7127_set_wss(client, data);
case V4L2_SLICED_VPS:
return saa7127_set_vps(client, data);
case V4L2_SLICED_CAPTION_525:
if (data->field == 0)
return saa7127_set_cc(client, data);
return saa7127_set_xds(client, data);
default:
return -EINVAL;
}
break;
}
Expand Down Expand Up @@ -671,7 +673,8 @@ static int saa7127_probe(struct i2c_client *client)

snprintf(client->name, sizeof(client->name) - 1, "saa7127");

v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", client->addr << 1);
v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n",
client->addr << 1);

/* First test register 0: Bits 5-7 are a version ID (should be 0),
and bit 2 should also be 0.
Expand All @@ -685,9 +688,8 @@ static int saa7127_probe(struct i2c_client *client)
}
state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL);

if (state == NULL) {
if (state == NULL)
return -ENOMEM;
}

i2c_set_clientdata(client, state);

Expand All @@ -701,25 +703,26 @@ static int saa7127_probe(struct i2c_client *client)
saa7127_set_wss(client, &vbi);
saa7127_set_cc(client, &vbi);
saa7127_set_xds(client, &vbi);
if (test_image == 1) {
if (test_image == 1)
/* The Encoder has an internal Colorbar generator */
/* This can be used for debugging */
saa7127_set_input_type(client, SAA7127_INPUT_TYPE_TEST_IMAGE);
} else {
else
saa7127_set_input_type(client, SAA7127_INPUT_TYPE_NORMAL);
}
saa7127_set_video_enable(client, 1);

/* Detect if it's an saa7129 */
read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2);
saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa);
if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) {
v4l_info(client, "saa7129 found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
v4l_info(client, "saa7129 found @ 0x%x (%s)\n",
client->addr << 1, client->adapter->name);
saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result);
saa7127_write_inittab(client, saa7129_init_config_extra);
state->ident = V4L2_IDENT_SAA7129;
} else {
v4l_info(client, "saa7127 found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name);
v4l_info(client, "saa7127 found @ 0x%x (%s)\n",
client->addr << 1, client->adapter->name);
state->ident = V4L2_IDENT_SAA7127;
}
return 0;
Expand Down

0 comments on commit 0f95f67

Please sign in to comment.