Skip to content

Commit

Permalink
[media] saa7115: Trust that V4L2 core will fill the mask
Browse files Browse the repository at this point in the history
Instead of using V4L2_STD_ALL when no standard is detected,
trust that the maximum allowed standards are already filled by
the V4L2 core. It is better this way, as the bridge and/or the audio
decoder may have some extra restrictions to some video standards.

This also allow other devices like audio and tuners to contribute to
standards detection, when they support such feature.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Mauro Carvalho Chehab committed Oct 8, 2011
1 parent 8715e6c commit e41567a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions drivers/media/video/saa7115.c
Original file line number Diff line number Diff line change
Expand Up @@ -1346,17 +1346,23 @@ static int saa711x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
struct saa711x_state *state = to_state(sd);
int reg1f, reg1e;

/*
* The V4L2 core already initializes std with all supported
* Standards. All driver needs to do is to mask it, to remove
* standards that don't apply from the mask
*/

reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC);
v4l2_dbg(1, debug, sd, "Status byte 2 (0x1f)=0x%02x\n", reg1f);
if (reg1f & 0x40) {
/* horizontal/vertical not locked */
*std = V4L2_STD_ALL;

/* horizontal/vertical not locked */
if (reg1f & 0x40)
goto ret;
}

if (reg1f & 0x20)
*std = V4L2_STD_525_60;
*std &= V4L2_STD_525_60;
else
*std = V4L2_STD_625_50;
*std &= V4L2_STD_625_50;

if (state->ident != V4L2_IDENT_SAA7115)
goto ret;
Expand All @@ -1381,7 +1387,6 @@ static int saa711x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
break;
default:
/* Can't detect anything */
*std = V4L2_STD_ALL;
break;
}

Expand Down

0 comments on commit e41567a

Please sign in to comment.