Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199939
b: refs/heads/master
c: 6c69db9
h: refs/heads/master
i:
  199937: a8b99fa
  199935: 69a1d15
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jun 1, 2010
1 parent a021e8c commit 3117382
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 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: 96fd004fe40b8e3beff2a6e27ae0411a4d315f1e
refs/heads/master: 6c69db9de7a8934bdeb690663fab6fe046203ac4
47 changes: 31 additions & 16 deletions trunk/drivers/media/video/saa717x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1199,28 +1199,32 @@ static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
}
#endif

static int saa717x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
static int saa717x_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt)
{
struct v4l2_pix_format *pix;
int prescale, h_scale, v_scale;

pix = &fmt->fmt.pix;
v4l2_dbg(1, debug, sd, "decoder set size\n");

if (fmt->code != V4L2_MBUS_FMT_FIXED)
return -EINVAL;

/* FIXME need better bounds checking here */
if (pix->width < 1 || pix->width > 1440)
if (fmt->width < 1 || fmt->width > 1440)
return -EINVAL;
if (pix->height < 1 || pix->height > 960)
if (fmt->height < 1 || fmt->height > 960)
return -EINVAL;

fmt->field = V4L2_FIELD_INTERLACED;
fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;

/* scaling setting */
/* NTSC and interlace only */
prescale = SAA717X_NTSC_WIDTH / pix->width;
prescale = SAA717X_NTSC_WIDTH / fmt->width;
if (prescale == 0)
prescale = 1;
h_scale = 1024 * SAA717X_NTSC_WIDTH / prescale / pix->width;
h_scale = 1024 * SAA717X_NTSC_WIDTH / prescale / fmt->width;
/* interlace */
v_scale = 512 * 2 * SAA717X_NTSC_HEIGHT / pix->height;
v_scale = 512 * 2 * SAA717X_NTSC_HEIGHT / fmt->height;

/* Horizontal prescaling etc */
set_h_prescale(sd, 0, prescale);
Expand All @@ -1241,22 +1245,32 @@ static int saa717x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
/* set video output size */
/* video number of pixels at output */
/* TASK A */
saa717x_write(sd, 0x5C, (u8)(pix->width & 0xFF));
saa717x_write(sd, 0x5D, (u8)((pix->width >> 8) & 0xFF));
saa717x_write(sd, 0x5C, (u8)(fmt->width & 0xFF));
saa717x_write(sd, 0x5D, (u8)((fmt->width >> 8) & 0xFF));
/* TASK B */
saa717x_write(sd, 0x9C, (u8)(pix->width & 0xFF));
saa717x_write(sd, 0x9D, (u8)((pix->width >> 8) & 0xFF));
saa717x_write(sd, 0x9C, (u8)(fmt->width & 0xFF));
saa717x_write(sd, 0x9D, (u8)((fmt->width >> 8) & 0xFF));

/* video number of lines at output */
/* TASK A */
saa717x_write(sd, 0x5E, (u8)(pix->height & 0xFF));
saa717x_write(sd, 0x5F, (u8)((pix->height >> 8) & 0xFF));
saa717x_write(sd, 0x5E, (u8)(fmt->height & 0xFF));
saa717x_write(sd, 0x5F, (u8)((fmt->height >> 8) & 0xFF));
/* TASK B */
saa717x_write(sd, 0x9E, (u8)(pix->height & 0xFF));
saa717x_write(sd, 0x9F, (u8)((pix->height >> 8) & 0xFF));
saa717x_write(sd, 0x9E, (u8)(fmt->height & 0xFF));
saa717x_write(sd, 0x9F, (u8)((fmt->height >> 8) & 0xFF));
return 0;
}

static int saa717x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
{
struct v4l2_mbus_framefmt mbus_fmt;

mbus_fmt.width = fmt->fmt.pix.width;
mbus_fmt.height = fmt->fmt.pix.height;
mbus_fmt.code = V4L2_MBUS_FMT_FIXED;
return saa717x_s_mbus_fmt(sd, &mbus_fmt);
}

static int saa717x_s_radio(struct v4l2_subdev *sd)
{
struct saa717x_state *decoder = to_state(sd);
Expand Down Expand Up @@ -1404,6 +1418,7 @@ static const struct v4l2_subdev_tuner_ops saa717x_tuner_ops = {
static const struct v4l2_subdev_video_ops saa717x_video_ops = {
.s_routing = saa717x_s_video_routing,
.s_fmt = saa717x_s_fmt,
.s_mbus_fmt = saa717x_s_mbus_fmt,
.s_stream = saa717x_s_stream,
};

Expand Down

0 comments on commit 3117382

Please sign in to comment.