aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7115.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/saa7115.c')
-rw-r--r--drivers/media/video/saa7115.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index ad733caec720..c8e9cb3db30a 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1057,7 +1057,7 @@ static void saa711x_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_fo
1057 for (i = 0; i <= 23; i++) 1057 for (i = 0; i <= 23; i++)
1058 lcr[i] = 0xff; 1058 lcr[i] = 0xff;
1059 1059
1060 if (fmt->service_set == 0) { 1060 if (fmt == NULL) {
1061 /* raw VBI */ 1061 /* raw VBI */
1062 if (is_50hz) 1062 if (is_50hz)
1063 for (i = 6; i <= 23; i++) 1063 for (i = 6; i <= 23; i++)
@@ -1113,7 +1113,7 @@ static void saa711x_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_fo
1113 } 1113 }
1114 1114
1115 /* enable/disable raw VBI capturing */ 1115 /* enable/disable raw VBI capturing */
1116 saa711x_writeregs(client, fmt->service_set == 0 ? 1116 saa711x_writeregs(client, fmt == NULL ?
1117 saa7115_cfg_vbi_on : 1117 saa7115_cfg_vbi_on :
1118 saa7115_cfg_vbi_off); 1118 saa7115_cfg_vbi_off);
1119} 1119}
@@ -1153,6 +1153,10 @@ static int saa711x_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
1153 saa711x_set_lcr(client, &fmt->fmt.sliced); 1153 saa711x_set_lcr(client, &fmt->fmt.sliced);
1154 return 0; 1154 return 0;
1155 } 1155 }
1156 if (fmt->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
1157 saa711x_set_lcr(client, NULL);
1158 return 0;
1159 }
1156 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1160 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1157 return -EINVAL; 1161 return -EINVAL;
1158 1162
@@ -1309,10 +1313,13 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1309 case VIDIOC_INT_S_VIDEO_ROUTING: 1313 case VIDIOC_INT_S_VIDEO_ROUTING:
1310 { 1314 {
1311 struct v4l2_routing *route = arg; 1315 struct v4l2_routing *route = arg;
1316 u32 input = route->input;
1317 u8 mask = (state->ident == V4L2_IDENT_SAA7111) ? 0xf8 : 0xf0;
1312 1318
1313 v4l_dbg(1, debug, client, "decoder set input %d output %d\n", route->input, route->output); 1319 v4l_dbg(1, debug, client, "decoder set input %d output %d\n", route->input, route->output);
1314 /* saa7113 does not have these inputs */ 1320 /* saa7111/3 does not have these inputs */
1315 if (state->ident == V4L2_IDENT_SAA7113 && 1321 if ((state->ident == V4L2_IDENT_SAA7113 ||
1322 state->ident == V4L2_IDENT_SAA7111) &&
1316 (route->input == SAA7115_COMPOSITE4 || 1323 (route->input == SAA7115_COMPOSITE4 ||
1317 route->input == SAA7115_COMPOSITE5)) { 1324 route->input == SAA7115_COMPOSITE5)) {
1318 return -EINVAL; 1325 return -EINVAL;
@@ -1327,10 +1334,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"); 1334 (route->input >= SAA7115_SVIDEO0) ? "S-Video" : "Composite", (route->output == SAA7115_IPORT_ON) ? "iport on" : "iport off");
1328 state->input = route->input; 1335 state->input = route->input;
1329 1336
1337 /* saa7111 has slightly different input numbering */
1338 if (state->ident == V4L2_IDENT_SAA7111) {
1339 if (input >= SAA7115_COMPOSITE4)
1340 input -= 2;
1341 /* saa7111 specific */
1342 saa711x_write(client, R_10_CHROMA_CNTL_2,
1343 (saa711x_read(client, R_10_CHROMA_CNTL_2) & 0x3f) |
1344 ((route->output & 0xc0) ^ 0x40));
1345 saa711x_write(client, R_13_RT_X_PORT_OUT_CNTL,
1346 (saa711x_read(client, R_13_RT_X_PORT_OUT_CNTL) & 0xf0) |
1347 ((route->output & 2) ? 0x0a : 0));
1348 }
1349
1330 /* select mode */ 1350 /* select mode */
1331 saa711x_write(client, R_02_INPUT_CNTL_1, 1351 saa711x_write(client, R_02_INPUT_CNTL_1,
1332 (saa711x_read(client, R_02_INPUT_CNTL_1) & 0xf0) | 1352 (saa711x_read(client, R_02_INPUT_CNTL_1) & mask) |
1333 state->input); 1353 input);
1334 1354
1335 /* bypass chrominance trap for S-Video modes */ 1355 /* bypass chrominance trap for S-Video modes */
1336 saa711x_write(client, R_09_LUMA_CNTL, 1356 saa711x_write(client, R_09_LUMA_CNTL,
@@ -1384,6 +1404,13 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1384 saa711x_writeregs(client, saa7115_cfg_reset_scaler); 1404 saa711x_writeregs(client, saa7115_cfg_reset_scaler);
1385 break; 1405 break;
1386 1406
1407 case VIDIOC_INT_S_GPIO:
1408 if (state->ident != V4L2_IDENT_SAA7111)
1409 return -EINVAL;
1410 saa711x_write(client, 0x11, (saa711x_read(client, 0x11) & 0x7f) |
1411 (*(u32 *)arg ? 0x80 : 0));
1412 break;
1413
1387 case VIDIOC_INT_G_VBI_DATA: 1414 case VIDIOC_INT_G_VBI_DATA:
1388 { 1415 {
1389 struct v4l2_sliced_vbi_data *data = arg; 1416 struct v4l2_sliced_vbi_data *data = arg;
@@ -1539,7 +1566,8 @@ static int saa7115_probe(struct i2c_client *client,
1539 state->crystal_freq = SAA7115_FREQ_32_11_MHZ; 1566 state->crystal_freq = SAA7115_FREQ_32_11_MHZ;
1540 saa711x_writeregs(client, saa7115_init_auto_input); 1567 saa711x_writeregs(client, saa7115_init_auto_input);
1541 } 1568 }
1542 saa711x_writeregs(client, saa7115_init_misc); 1569 if (state->ident != V4L2_IDENT_SAA7111)
1570 saa711x_writeregs(client, saa7115_init_misc);
1543 saa711x_set_v4lstd(client, V4L2_STD_NTSC); 1571 saa711x_set_v4lstd(client, V4L2_STD_NTSC);
1544 1572
1545 v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n", 1573 v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n",