diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-01-29 08:09:41 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-05-25 11:58:27 -0400 |
commit | afec55992e228fa3b553d5b4c9e1ead9fb5780bd (patch) | |
tree | 18f8e1da2a1ef3c69e3ebef04c879da5fe944e85 /drivers/media/i2c | |
parent | 539b33b05913f1de34c7e0ef3376347ffd273e8f (diff) |
[media] adv7604: Add pad-level DV timings support
The video enum_dv_timings and dv_timings_cap operations are deprecated.
Implement the pad-level version of those operations to prepare for the
removal of the video version.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/adv7604.c | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 59f7bf0723fe..684b91234d5d 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
@@ -1514,24 +1514,42 @@ static int read_stdi(struct v4l2_subdev *sd, struct stdi_readback *stdi) | |||
1514 | static int adv7604_enum_dv_timings(struct v4l2_subdev *sd, | 1514 | static int adv7604_enum_dv_timings(struct v4l2_subdev *sd, |
1515 | struct v4l2_enum_dv_timings *timings) | 1515 | struct v4l2_enum_dv_timings *timings) |
1516 | { | 1516 | { |
1517 | struct adv7604_state *state = to_state(sd); | ||
1518 | |||
1517 | if (timings->index >= ARRAY_SIZE(adv7604_timings) - 1) | 1519 | if (timings->index >= ARRAY_SIZE(adv7604_timings) - 1) |
1518 | return -EINVAL; | 1520 | return -EINVAL; |
1521 | |||
1522 | if (timings->pad >= state->source_pad) | ||
1523 | return -EINVAL; | ||
1524 | |||
1519 | memset(timings->reserved, 0, sizeof(timings->reserved)); | 1525 | memset(timings->reserved, 0, sizeof(timings->reserved)); |
1520 | timings->timings = adv7604_timings[timings->index]; | 1526 | timings->timings = adv7604_timings[timings->index]; |
1521 | return 0; | 1527 | return 0; |
1522 | } | 1528 | } |
1523 | 1529 | ||
1524 | static int adv7604_dv_timings_cap(struct v4l2_subdev *sd, | 1530 | static int __adv7604_dv_timings_cap(struct v4l2_subdev *sd, |
1525 | struct v4l2_dv_timings_cap *cap) | 1531 | struct v4l2_dv_timings_cap *cap, |
1532 | unsigned int pad) | ||
1526 | { | 1533 | { |
1527 | cap->type = V4L2_DV_BT_656_1120; | 1534 | cap->type = V4L2_DV_BT_656_1120; |
1528 | cap->bt.max_width = 1920; | 1535 | cap->bt.max_width = 1920; |
1529 | cap->bt.max_height = 1200; | 1536 | cap->bt.max_height = 1200; |
1530 | cap->bt.min_pixelclock = 25000000; | 1537 | cap->bt.min_pixelclock = 25000000; |
1531 | if (is_digital_input(sd)) | 1538 | |
1539 | switch (pad) { | ||
1540 | case ADV7604_PAD_HDMI_PORT_A: | ||
1541 | case ADV7604_PAD_HDMI_PORT_B: | ||
1542 | case ADV7604_PAD_HDMI_PORT_C: | ||
1543 | case ADV7604_PAD_HDMI_PORT_D: | ||
1532 | cap->bt.max_pixelclock = 225000000; | 1544 | cap->bt.max_pixelclock = 225000000; |
1533 | else | 1545 | break; |
1546 | case ADV7604_PAD_VGA_RGB: | ||
1547 | case ADV7604_PAD_VGA_COMP: | ||
1548 | default: | ||
1534 | cap->bt.max_pixelclock = 170000000; | 1549 | cap->bt.max_pixelclock = 170000000; |
1550 | break; | ||
1551 | } | ||
1552 | |||
1535 | cap->bt.standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | | 1553 | cap->bt.standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | |
1536 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT; | 1554 | V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT; |
1537 | cap->bt.capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | | 1555 | cap->bt.capabilities = V4L2_DV_BT_CAP_PROGRESSIVE | |
@@ -1539,6 +1557,25 @@ static int adv7604_dv_timings_cap(struct v4l2_subdev *sd, | |||
1539 | return 0; | 1557 | return 0; |
1540 | } | 1558 | } |
1541 | 1559 | ||
1560 | static int adv7604_dv_timings_cap(struct v4l2_subdev *sd, | ||
1561 | struct v4l2_dv_timings_cap *cap) | ||
1562 | { | ||
1563 | struct adv7604_state *state = to_state(sd); | ||
1564 | |||
1565 | return __adv7604_dv_timings_cap(sd, cap, state->selected_input); | ||
1566 | } | ||
1567 | |||
1568 | static int adv7604_pad_dv_timings_cap(struct v4l2_subdev *sd, | ||
1569 | struct v4l2_dv_timings_cap *cap) | ||
1570 | { | ||
1571 | struct adv7604_state *state = to_state(sd); | ||
1572 | |||
1573 | if (cap->pad >= state->source_pad) | ||
1574 | return -EINVAL; | ||
1575 | |||
1576 | return __adv7604_dv_timings_cap(sd, cap, cap->pad); | ||
1577 | } | ||
1578 | |||
1542 | /* Fill the optional fields .standards and .flags in struct v4l2_dv_timings | 1579 | /* Fill the optional fields .standards and .flags in struct v4l2_dv_timings |
1543 | if the format is listed in adv7604_timings[] */ | 1580 | if the format is listed in adv7604_timings[] */ |
1544 | static void adv7604_fill_optional_dv_timings_fields(struct v4l2_subdev *sd, | 1581 | static void adv7604_fill_optional_dv_timings_fields(struct v4l2_subdev *sd, |
@@ -2426,6 +2463,8 @@ static const struct v4l2_subdev_pad_ops adv7604_pad_ops = { | |||
2426 | .set_fmt = adv7604_set_format, | 2463 | .set_fmt = adv7604_set_format, |
2427 | .get_edid = adv7604_get_edid, | 2464 | .get_edid = adv7604_get_edid, |
2428 | .set_edid = adv7604_set_edid, | 2465 | .set_edid = adv7604_set_edid, |
2466 | .dv_timings_cap = adv7604_pad_dv_timings_cap, | ||
2467 | .enum_dv_timings = adv7604_enum_dv_timings, | ||
2429 | }; | 2468 | }; |
2430 | 2469 | ||
2431 | static const struct v4l2_subdev_ops adv7604_ops = { | 2470 | static const struct v4l2_subdev_ops adv7604_ops = { |