aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7115.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-09-06 14:26:44 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 07:37:00 -0400
commit6bd6dff6318397b1127dd256b65dde007306b8ea (patch)
treeab42df43b2e22a527fb12bc1bf0e18771ecb29ce /drivers/media/video/saa7115.c
parent2796073a3d9cc4f610f1e68b3f62c197d86577ab (diff)
V4L/DVB (8940): saa7115: fix saa7111(a) support
The saa7111 support in saa7115.c was missing some features and did not properly take some of the differences into account. With this patch saa7115 can be used in the mxb driver instead of saa7111.c. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7115.c')
-rw-r--r--drivers/media/video/saa7115.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index ad733caec72..4ed7d65dd63 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1309,10 +1309,13 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1309 case VIDIOC_INT_S_VIDEO_ROUTING: 1309 case VIDIOC_INT_S_VIDEO_ROUTING:
1310 { 1310 {
1311 struct v4l2_routing *route = arg; 1311 struct v4l2_routing *route = arg;
1312 u32 input = route->input;
1313 u8 mask = (state->ident == V4L2_IDENT_SAA7111) ? 0xf8 : 0xf0;
1312 1314
1313 v4l_dbg(1, debug, client, "decoder set input %d output %d\n", route->input, route->output); 1315 v4l_dbg(1, debug, client, "decoder set input %d output %d\n", route->input, route->output);
1314 /* saa7113 does not have these inputs */ 1316 /* saa7111/3 does not have these inputs */
1315 if (state->ident == V4L2_IDENT_SAA7113 && 1317 if ((state->ident == V4L2_IDENT_SAA7113 ||
1318 state->ident == V4L2_IDENT_SAA7111) &&
1316 (route->input == SAA7115_COMPOSITE4 || 1319 (route->input == SAA7115_COMPOSITE4 ||
1317 route->input == SAA7115_COMPOSITE5)) { 1320 route->input == SAA7115_COMPOSITE5)) {
1318 return -EINVAL; 1321 return -EINVAL;
@@ -1327,10 +1330,23 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1327 (route->input >= SAA7115_SVIDEO0) ? "S-Video" : "Composite", (route->output == SAA7115_IPORT_ON) ? "iport on" : "iport off"); 1330 (route->input >= SAA7115_SVIDEO0) ? "S-Video" : "Composite", (route->output == SAA7115_IPORT_ON) ? "iport on" : "iport off");
1328 state->input = route->input; 1331 state->input = route->input;
1329 1332
1333 /* saa7111 has slightly different input numbering */
1334 if (state->ident == V4L2_IDENT_SAA7111) {
1335 if (input >= SAA7115_COMPOSITE4)
1336 input -= 2;
1337 /* saa7111 specific */
1338 saa711x_write(client, R_10_CHROMA_CNTL_2,
1339 (saa711x_read(client, R_10_CHROMA_CNTL_2) & 0x3f) |
1340 ((route->output & 0xc0) ^ 0x40));
1341 saa711x_write(client, R_13_RT_X_PORT_OUT_CNTL,
1342 (saa711x_read(client, R_13_RT_X_PORT_OUT_CNTL) & 0xf0) |
1343 ((route->output & 2) ? 0x0a : 0));
1344 }
1345
1330 /* select mode */ 1346 /* select mode */
1331 saa711x_write(client, R_02_INPUT_CNTL_1, 1347 saa711x_write(client, R_02_INPUT_CNTL_1,
1332 (saa711x_read(client, R_02_INPUT_CNTL_1) & 0xf0) | 1348 (saa711x_read(client, R_02_INPUT_CNTL_1) & mask) |
1333 state->input); 1349 input);
1334 1350
1335 /* bypass chrominance trap for S-Video modes */ 1351 /* bypass chrominance trap for S-Video modes */
1336 saa711x_write(client, R_09_LUMA_CNTL, 1352 saa711x_write(client, R_09_LUMA_CNTL,
@@ -1384,6 +1400,13 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1384 saa711x_writeregs(client, saa7115_cfg_reset_scaler); 1400 saa711x_writeregs(client, saa7115_cfg_reset_scaler);
1385 break; 1401 break;
1386 1402
1403 case VIDIOC_INT_S_GPIO:
1404 if (state->ident != V4L2_IDENT_SAA7111)
1405 return -EINVAL;
1406 saa711x_write(client, 0x11, (saa711x_read(client, 0x11) & 0x7f) |
1407 (*(u32 *)arg ? 0x80 : 0));
1408 break;
1409
1387 case VIDIOC_INT_G_VBI_DATA: 1410 case VIDIOC_INT_G_VBI_DATA:
1388 { 1411 {
1389 struct v4l2_sliced_vbi_data *data = arg; 1412 struct v4l2_sliced_vbi_data *data = arg;
@@ -1539,7 +1562,8 @@ static int saa7115_probe(struct i2c_client *client,
1539 state->crystal_freq = SAA7115_FREQ_32_11_MHZ; 1562 state->crystal_freq = SAA7115_FREQ_32_11_MHZ;
1540 saa711x_writeregs(client, saa7115_init_auto_input); 1563 saa711x_writeregs(client, saa7115_init_auto_input);
1541 } 1564 }
1542 saa711x_writeregs(client, saa7115_init_misc); 1565 if (state->ident != V4L2_IDENT_SAA7111)
1566 saa711x_writeregs(client, saa7115_init_misc);
1543 saa711x_set_v4lstd(client, V4L2_STD_NTSC); 1567 saa711x_set_v4lstd(client, V4L2_STD_NTSC);
1544 1568
1545 v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n", 1569 v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n",