diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-03-10 08:59:37 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-24 11:05:48 -0400 |
commit | c875dee536ee2a95a353f5ef991717383baf8d60 (patch) | |
tree | 19c149f2876046f2ccb875fe2340d3f91bedf53e /drivers/media/i2c/saa7115.c | |
parent | a0fc58868bbf34d0935947cdf1bc8c0ea32c68c4 (diff) |
[media] saa7115: improve querystd handling for the saa7115
The saa7115 has better PAL/NTSC detection, so it can detect PAL even
though the chip is currently set up for NTSC.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/saa7115.c')
-rw-r--r-- | drivers/media/i2c/saa7115.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c index c3e7e12e006a..cdff1f6e8546 100644 --- a/drivers/media/i2c/saa7115.c +++ b/drivers/media/i2c/saa7115.c | |||
@@ -1360,6 +1360,34 @@ static int saa711x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) | |||
1360 | */ | 1360 | */ |
1361 | 1361 | ||
1362 | reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC); | 1362 | reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC); |
1363 | |||
1364 | if (state->ident == V4L2_IDENT_SAA7115) { | ||
1365 | reg1e = saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC); | ||
1366 | |||
1367 | v4l2_dbg(1, debug, sd, "Status byte 1 (0x1e)=0x%02x\n", reg1e); | ||
1368 | |||
1369 | switch (reg1e & 0x03) { | ||
1370 | case 1: | ||
1371 | *std &= V4L2_STD_NTSC; | ||
1372 | break; | ||
1373 | case 2: | ||
1374 | /* | ||
1375 | * V4L2_STD_PAL just cover the european PAL standards. | ||
1376 | * This is wrong, as the device could also be using an | ||
1377 | * other PAL standard. | ||
1378 | */ | ||
1379 | *std &= V4L2_STD_PAL | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | | ||
1380 | V4L2_STD_PAL_M | V4L2_STD_PAL_60; | ||
1381 | break; | ||
1382 | case 3: | ||
1383 | *std &= V4L2_STD_SECAM; | ||
1384 | break; | ||
1385 | default: | ||
1386 | /* Can't detect anything */ | ||
1387 | break; | ||
1388 | } | ||
1389 | } | ||
1390 | |||
1363 | v4l2_dbg(1, debug, sd, "Status byte 2 (0x1f)=0x%02x\n", reg1f); | 1391 | v4l2_dbg(1, debug, sd, "Status byte 2 (0x1f)=0x%02x\n", reg1f); |
1364 | 1392 | ||
1365 | /* horizontal/vertical not locked */ | 1393 | /* horizontal/vertical not locked */ |
@@ -1371,34 +1399,6 @@ static int saa711x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) | |||
1371 | else | 1399 | else |
1372 | *std &= V4L2_STD_625_50; | 1400 | *std &= V4L2_STD_625_50; |
1373 | 1401 | ||
1374 | if (state->ident != V4L2_IDENT_SAA7115) | ||
1375 | goto ret; | ||
1376 | |||
1377 | reg1e = saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC); | ||
1378 | |||
1379 | switch (reg1e & 0x03) { | ||
1380 | case 1: | ||
1381 | *std &= V4L2_STD_NTSC; | ||
1382 | break; | ||
1383 | case 2: | ||
1384 | /* | ||
1385 | * V4L2_STD_PAL just cover the european PAL standards. | ||
1386 | * This is wrong, as the device could also be using an | ||
1387 | * other PAL standard. | ||
1388 | */ | ||
1389 | *std &= V4L2_STD_PAL | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | | ||
1390 | V4L2_STD_PAL_M | V4L2_STD_PAL_60; | ||
1391 | break; | ||
1392 | case 3: | ||
1393 | *std &= V4L2_STD_SECAM; | ||
1394 | break; | ||
1395 | default: | ||
1396 | /* Can't detect anything */ | ||
1397 | break; | ||
1398 | } | ||
1399 | |||
1400 | v4l2_dbg(1, debug, sd, "Status byte 1 (0x1e)=0x%02x\n", reg1e); | ||
1401 | |||
1402 | ret: | 1402 | ret: |
1403 | v4l2_dbg(1, debug, sd, "detected std mask = %08Lx\n", *std); | 1403 | v4l2_dbg(1, debug, sd, "detected std mask = %08Lx\n", *std); |
1404 | 1404 | ||