summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjay Singh Rawat <srawat@nvidia.com>2011-09-22 20:00:47 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-09-29 18:14:17 -0700
commitb8cd0a4bc63f8e8f3f44dfb82fc16f5eca858616 (patch)
treeeee04f416174e93a5cfc47e3bcb80fe2eed6a321
parentbb047c7138544c3a94bc8a83ece2ea802149e69e (diff)
video: tegra: Do correct pixel clock validation of HDMI sink
Resolution wise the pixel clock of the peripheral and supported resolution mode if found different was checked whether in permissible range or not. PICOS2KHZ macro argument is taken as denominator in division, in multiple argument case care should be taken. Bug 878912 Similar Bug 872389 Signed-off-by: Sanjay Singh Rawat <srawat@nvidia.com> Reviewed-on: http://git-master/r/54050 (cherry picked from commit 927b647e437133a9d28336ed697447e41b09b9c7) Change-Id: I6056cbb01d6eea9c1f01168e55d78356ed00108a Reviewed-on: http://git-master/r/55142 Tested-by: Sanjay Singh Rawat <srawat@nvidia.com> Reviewed-by: Donghan Ryu <dryu@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r--drivers/video/tegra/dc/hdmi.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c
index a636ae8945f6..c43a6abe10b2 100644
--- a/drivers/video/tegra/dc/hdmi.c
+++ b/drivers/video/tegra/dc/hdmi.c
@@ -669,12 +669,18 @@ static bool tegra_dc_hdmi_mode_equal(const struct fb_videomode *mode1,
int clock_per_frame = tegra_dc_calc_clock_per_frame(mode1);
/* allows up to 1Hz of pixclock difference */
- return mode1->xres == mode2->xres &&
- mode1->yres == mode2->yres &&
- (mode1->pixclock == mode2->pixclock ||
- (abs(PICOS2KHZ(mode1->pixclock - mode2->pixclock)) *
- 1000 / clock_per_frame <= 1)) &&
- mode1->vmode == mode2->vmode;
+ if (mode1->pixclock != mode2->pixclock) {
+ return (mode1->xres == mode2->xres &&
+ mode1->yres == mode2->yres &&
+ mode1->vmode == mode2->vmode &&
+ (abs(PICOS2KHZ(mode1->pixclock) -
+ PICOS2KHZ(mode2->pixclock)) *
+ 1000 / clock_per_frame <= 1));
+ } else {
+ return (mode1->xres == mode2->xres &&
+ mode1->yres == mode2->yres &&
+ mode1->vmode == mode2->vmode);
+ }
}
static bool tegra_dc_hdmi_valid_pixclock(const struct tegra_dc *dc,