aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/video4linux/v4l2-pci-skeleton.c2
-rw-r--r--drivers/media/i2c/adv7604.c6
-rw-r--r--drivers/media/i2c/adv7842.c6
-rw-r--r--drivers/media/i2c/tc358743.c4
-rw-r--r--drivers/media/pci/cobalt/cobalt-v4l2.c2
-rw-r--r--drivers/media/platform/s5p-tv/hdmi_drv.c2
-rw-r--r--drivers/media/platform/vivid/vivid-vid-cap.c2
-rw-r--r--drivers/media/platform/vivid/vivid-vid-out.c2
-rw-r--r--drivers/media/usb/hdpvr/hdpvr-video.c2
-rw-r--r--drivers/media/v4l2-core/v4l2-dv-timings.c9
-rw-r--r--include/media/v4l2-dv-timings.h4
11 files changed, 24 insertions, 17 deletions
diff --git a/Documentation/video4linux/v4l2-pci-skeleton.c b/Documentation/video4linux/v4l2-pci-skeleton.c
index 95ae82860092..1c8b102a6529 100644
--- a/Documentation/video4linux/v4l2-pci-skeleton.c
+++ b/Documentation/video4linux/v4l2-pci-skeleton.c
@@ -509,7 +509,7 @@ static int skeleton_s_dv_timings(struct file *file, void *_fh,
509 return -EINVAL; 509 return -EINVAL;
510 510
511 /* Return 0 if the new timings are the same as the current timings. */ 511 /* Return 0 if the new timings are the same as the current timings. */
512 if (v4l2_match_dv_timings(timings, &skel->timings, 0)) 512 if (v4l2_match_dv_timings(timings, &skel->timings, 0, false))
513 return 0; 513 return 0;
514 514
515 /* 515 /*
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 2c3c37c3c2dc..745286225655 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -905,7 +905,7 @@ static int find_and_set_predefined_video_timings(struct v4l2_subdev *sd,
905 905
906 for (i = 0; predef_vid_timings[i].timings.bt.width; i++) { 906 for (i = 0; predef_vid_timings[i].timings.bt.width; i++) {
907 if (!v4l2_match_dv_timings(timings, &predef_vid_timings[i].timings, 907 if (!v4l2_match_dv_timings(timings, &predef_vid_timings[i].timings,
908 is_digital_input(sd) ? 250000 : 1000000)) 908 is_digital_input(sd) ? 250000 : 1000000, false))
909 continue; 909 continue;
910 io_write(sd, 0x00, predef_vid_timings[i].vid_std); /* video std */ 910 io_write(sd, 0x00, predef_vid_timings[i].vid_std); /* video std */
911 io_write(sd, 0x01, (predef_vid_timings[i].v_freq << 4) + 911 io_write(sd, 0x01, (predef_vid_timings[i].v_freq << 4) +
@@ -1479,7 +1479,7 @@ static void adv76xx_fill_optional_dv_timings_fields(struct v4l2_subdev *sd,
1479 1479
1480 for (i = 0; adv76xx_timings[i].bt.width; i++) { 1480 for (i = 0; adv76xx_timings[i].bt.width; i++) {
1481 if (v4l2_match_dv_timings(timings, &adv76xx_timings[i], 1481 if (v4l2_match_dv_timings(timings, &adv76xx_timings[i],
1482 is_digital_input(sd) ? 250000 : 1000000)) { 1482 is_digital_input(sd) ? 250000 : 1000000, false)) {
1483 *timings = adv76xx_timings[i]; 1483 *timings = adv76xx_timings[i];
1484 break; 1484 break;
1485 } 1485 }
@@ -1644,7 +1644,7 @@ static int adv76xx_s_dv_timings(struct v4l2_subdev *sd,
1644 if (!timings) 1644 if (!timings)
1645 return -EINVAL; 1645 return -EINVAL;
1646 1646
1647 if (v4l2_match_dv_timings(&state->timings, timings, 0)) { 1647 if (v4l2_match_dv_timings(&state->timings, timings, 0, false)) {
1648 v4l2_dbg(1, debug, sd, "%s: no change\n", __func__); 1648 v4l2_dbg(1, debug, sd, "%s: no change\n", __func__);
1649 return 0; 1649 return 0;
1650 } 1650 }
diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index ded871e361e4..69378e4914b6 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -155,7 +155,7 @@ static bool adv7842_check_dv_timings(const struct v4l2_dv_timings *t, void *hdl)
155 int i; 155 int i;
156 156
157 for (i = 0; adv7842_timings_exceptions[i].bt.width; i++) 157 for (i = 0; adv7842_timings_exceptions[i].bt.width; i++)
158 if (v4l2_match_dv_timings(t, adv7842_timings_exceptions + i, 0)) 158 if (v4l2_match_dv_timings(t, adv7842_timings_exceptions + i, 0, false))
159 return false; 159 return false;
160 return true; 160 return true;
161} 161}
@@ -1008,7 +1008,7 @@ static int find_and_set_predefined_video_timings(struct v4l2_subdev *sd,
1008 1008
1009 for (i = 0; predef_vid_timings[i].timings.bt.width; i++) { 1009 for (i = 0; predef_vid_timings[i].timings.bt.width; i++) {
1010 if (!v4l2_match_dv_timings(timings, &predef_vid_timings[i].timings, 1010 if (!v4l2_match_dv_timings(timings, &predef_vid_timings[i].timings,
1011 is_digital_input(sd) ? 250000 : 1000000)) 1011 is_digital_input(sd) ? 250000 : 1000000, false))
1012 continue; 1012 continue;
1013 /* video std */ 1013 /* video std */
1014 io_write(sd, 0x00, predef_vid_timings[i].vid_std); 1014 io_write(sd, 0x00, predef_vid_timings[i].vid_std);
@@ -1659,7 +1659,7 @@ static int adv7842_s_dv_timings(struct v4l2_subdev *sd,
1659 if (state->mode == ADV7842_MODE_SDP) 1659 if (state->mode == ADV7842_MODE_SDP)
1660 return -ENODATA; 1660 return -ENODATA;
1661 1661
1662 if (v4l2_match_dv_timings(&state->timings, timings, 0)) { 1662 if (v4l2_match_dv_timings(&state->timings, timings, 0, false)) {
1663 v4l2_dbg(1, debug, sd, "%s: no change\n", __func__); 1663 v4l2_dbg(1, debug, sd, "%s: no change\n", __func__);
1664 return 0; 1664 return 0;
1665 } 1665 }
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 06856b8bb696..77b801152ea5 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -862,7 +862,7 @@ static void tc358743_format_change(struct v4l2_subdev *sd)
862 v4l2_dbg(1, debug, sd, "%s: Format changed. No signal\n", 862 v4l2_dbg(1, debug, sd, "%s: Format changed. No signal\n",
863 __func__); 863 __func__);
864 } else { 864 } else {
865 if (!v4l2_match_dv_timings(&state->timings, &timings, 0)) 865 if (!v4l2_match_dv_timings(&state->timings, &timings, 0, false))
866 enable_stream(sd, false); 866 enable_stream(sd, false);
867 867
868 v4l2_print_dv_timings(sd->name, 868 v4l2_print_dv_timings(sd->name,
@@ -1366,7 +1366,7 @@ static int tc358743_s_dv_timings(struct v4l2_subdev *sd,
1366 v4l2_print_dv_timings(sd->name, "tc358743_s_dv_timings: ", 1366 v4l2_print_dv_timings(sd->name, "tc358743_s_dv_timings: ",
1367 timings, false); 1367 timings, false);
1368 1368
1369 if (v4l2_match_dv_timings(&state->timings, timings, 0)) { 1369 if (v4l2_match_dv_timings(&state->timings, timings, 0, false)) {
1370 v4l2_dbg(1, debug, sd, "%s: no change\n", __func__); 1370 v4l2_dbg(1, debug, sd, "%s: no change\n", __func__);
1371 return 0; 1371 return 0;
1372 } 1372 }
diff --git a/drivers/media/pci/cobalt/cobalt-v4l2.c b/drivers/media/pci/cobalt/cobalt-v4l2.c
index b1cb061be68d..8cc78c522ac9 100644
--- a/drivers/media/pci/cobalt/cobalt-v4l2.c
+++ b/drivers/media/pci/cobalt/cobalt-v4l2.c
@@ -649,7 +649,7 @@ static int cobalt_s_dv_timings(struct file *file, void *priv_fh,
649 return 0; 649 return 0;
650 } 650 }
651 651
652 if (v4l2_match_dv_timings(timings, &s->timings, 0)) 652 if (v4l2_match_dv_timings(timings, &s->timings, 0, false))
653 return 0; 653 return 0;
654 654
655 if (vb2_is_busy(&s->q)) 655 if (vb2_is_busy(&s->q))
diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c
index a03ea98c4a2e..e71b13e40f59 100644
--- a/drivers/media/platform/s5p-tv/hdmi_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
@@ -627,7 +627,7 @@ static int hdmi_s_dv_timings(struct v4l2_subdev *sd,
627 627
628 for (i = 0; i < ARRAY_SIZE(hdmi_timings); i++) 628 for (i = 0; i < ARRAY_SIZE(hdmi_timings); i++)
629 if (v4l2_match_dv_timings(&hdmi_timings[i].dv_timings, 629 if (v4l2_match_dv_timings(&hdmi_timings[i].dv_timings,
630 timings, 0)) 630 timings, 0, false))
631 break; 631 break;
632 if (i == ARRAY_SIZE(hdmi_timings)) { 632 if (i == ARRAY_SIZE(hdmi_timings)) {
633 dev_err(dev, "timings not supported\n"); 633 dev_err(dev, "timings not supported\n");
diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c
index 45a2ed85ad83..9cc07c65a564 100644
--- a/drivers/media/platform/vivid/vivid-vid-cap.c
+++ b/drivers/media/platform/vivid/vivid-vid-cap.c
@@ -1670,7 +1670,7 @@ int vivid_vid_cap_s_dv_timings(struct file *file, void *_fh,
1670 !valid_cvt_gtf_timings(timings)) 1670 !valid_cvt_gtf_timings(timings))
1671 return -EINVAL; 1671 return -EINVAL;
1672 1672
1673 if (v4l2_match_dv_timings(timings, &dev->dv_timings_cap, 0)) 1673 if (v4l2_match_dv_timings(timings, &dev->dv_timings_cap, 0, false))
1674 return 0; 1674 return 0;
1675 if (vb2_is_busy(&dev->vb_vid_cap_q)) 1675 if (vb2_is_busy(&dev->vb_vid_cap_q))
1676 return -EBUSY; 1676 return -EBUSY;
diff --git a/drivers/media/platform/vivid/vivid-vid-out.c b/drivers/media/platform/vivid/vivid-vid-out.c
index db645abd4967..1f3b08166e74 100644
--- a/drivers/media/platform/vivid/vivid-vid-out.c
+++ b/drivers/media/platform/vivid/vivid-vid-out.c
@@ -1156,7 +1156,7 @@ int vivid_vid_out_s_dv_timings(struct file *file, void *_fh,
1156 0, NULL, NULL) && 1156 0, NULL, NULL) &&
1157 !valid_cvt_gtf_timings(timings)) 1157 !valid_cvt_gtf_timings(timings))
1158 return -EINVAL; 1158 return -EINVAL;
1159 if (v4l2_match_dv_timings(timings, &dev->dv_timings_out, 0)) 1159 if (v4l2_match_dv_timings(timings, &dev->dv_timings_out, 0, true))
1160 return 0; 1160 return 0;
1161 if (vb2_is_busy(&dev->vb_vid_out_q)) 1161 if (vb2_is_busy(&dev->vb_vid_out_q))
1162 return -EBUSY; 1162 return -EBUSY;
diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c
index d8d8c0f519fc..7dee22deebf3 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -642,7 +642,7 @@ static int vidioc_s_dv_timings(struct file *file, void *_fh,
642 if (dev->status != STATUS_IDLE) 642 if (dev->status != STATUS_IDLE)
643 return -EBUSY; 643 return -EBUSY;
644 for (i = 0; i < ARRAY_SIZE(hdpvr_dv_timings); i++) 644 for (i = 0; i < ARRAY_SIZE(hdpvr_dv_timings); i++)
645 if (v4l2_match_dv_timings(timings, hdpvr_dv_timings + i, 0)) 645 if (v4l2_match_dv_timings(timings, hdpvr_dv_timings + i, 0, false))
646 break; 646 break;
647 if (i == ARRAY_SIZE(hdpvr_dv_timings)) 647 if (i == ARRAY_SIZE(hdpvr_dv_timings))
648 return -EINVAL; 648 return -EINVAL;
diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 9926d521ea88..ec258b73001a 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -209,7 +209,7 @@ bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t,
209 if (v4l2_valid_dv_timings(v4l2_dv_timings_presets + i, cap, 209 if (v4l2_valid_dv_timings(v4l2_dv_timings_presets + i, cap,
210 fnc, fnc_handle) && 210 fnc, fnc_handle) &&
211 v4l2_match_dv_timings(t, v4l2_dv_timings_presets + i, 211 v4l2_match_dv_timings(t, v4l2_dv_timings_presets + i,
212 pclock_delta)) { 212 pclock_delta, false)) {
213 u32 flags = t->bt.flags & V4L2_DV_FL_REDUCED_FPS; 213 u32 flags = t->bt.flags & V4L2_DV_FL_REDUCED_FPS;
214 214
215 *t = v4l2_dv_timings_presets[i]; 215 *t = v4l2_dv_timings_presets[i];
@@ -228,12 +228,14 @@ EXPORT_SYMBOL_GPL(v4l2_find_dv_timings_cap);
228 * @t1 - compare this v4l2_dv_timings struct... 228 * @t1 - compare this v4l2_dv_timings struct...
229 * @t2 - with this struct. 229 * @t2 - with this struct.
230 * @pclock_delta - the allowed pixelclock deviation. 230 * @pclock_delta - the allowed pixelclock deviation.
231 * @match_reduced_fps - if true, then fail if V4L2_DV_FL_REDUCED_FPS does not
232 * match.
231 * 233 *
232 * Compare t1 with t2 with a given margin of error for the pixelclock. 234 * Compare t1 with t2 with a given margin of error for the pixelclock.
233 */ 235 */
234bool v4l2_match_dv_timings(const struct v4l2_dv_timings *t1, 236bool v4l2_match_dv_timings(const struct v4l2_dv_timings *t1,
235 const struct v4l2_dv_timings *t2, 237 const struct v4l2_dv_timings *t2,
236 unsigned pclock_delta) 238 unsigned pclock_delta, bool match_reduced_fps)
237{ 239{
238 if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120) 240 if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
239 return false; 241 return false;
@@ -249,6 +251,9 @@ bool v4l2_match_dv_timings(const struct v4l2_dv_timings *t1,
249 t1->bt.vfrontporch == t2->bt.vfrontporch && 251 t1->bt.vfrontporch == t2->bt.vfrontporch &&
250 t1->bt.vsync == t2->bt.vsync && 252 t1->bt.vsync == t2->bt.vsync &&
251 t1->bt.vbackporch == t2->bt.vbackporch && 253 t1->bt.vbackporch == t2->bt.vbackporch &&
254 (!match_reduced_fps ||
255 (t1->bt.flags & V4L2_DV_FL_REDUCED_FPS) ==
256 (t2->bt.flags & V4L2_DV_FL_REDUCED_FPS)) &&
252 (!t1->bt.interlaced || 257 (!t1->bt.interlaced ||
253 (t1->bt.il_vfrontporch == t2->bt.il_vfrontporch && 258 (t1->bt.il_vfrontporch == t2->bt.il_vfrontporch &&
254 t1->bt.il_vsync == t2->bt.il_vsync && 259 t1->bt.il_vsync == t2->bt.il_vsync &&
diff --git a/include/media/v4l2-dv-timings.h b/include/media/v4l2-dv-timings.h
index 69829a5a1368..1113c8874c26 100644
--- a/include/media/v4l2-dv-timings.h
+++ b/include/media/v4l2-dv-timings.h
@@ -107,12 +107,14 @@ bool v4l2_find_dv_timings_cap(struct v4l2_dv_timings *t,
107 * @standard: the timings according to the standard. 107 * @standard: the timings according to the standard.
108 * @pclock_delta: maximum delta in Hz between standard->pixelclock and 108 * @pclock_delta: maximum delta in Hz between standard->pixelclock and
109 * the measured timings. 109 * the measured timings.
110 * @match_reduced_fps: if true, then fail if V4L2_DV_FL_REDUCED_FPS does not
111 * match.
110 * 112 *
111 * Returns true if the two timings match, returns false otherwise. 113 * Returns true if the two timings match, returns false otherwise.
112 */ 114 */
113bool v4l2_match_dv_timings(const struct v4l2_dv_timings *measured, 115bool v4l2_match_dv_timings(const struct v4l2_dv_timings *measured,
114 const struct v4l2_dv_timings *standard, 116 const struct v4l2_dv_timings *standard,
115 unsigned pclock_delta); 117 unsigned pclock_delta, bool match_reduced_fps);
116 118
117/** 119/**
118 * v4l2_print_dv_timings() - log the contents of a dv_timings struct 120 * v4l2_print_dv_timings() - log the contents of a dv_timings struct