linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] OMAPFB: Adding a check for timings in set_def_mode
@ 2011-02-22 13:07 Mayuresh Janorkar
  2011-02-23  9:47 ` Tomi Valkeinen
  0 siblings, 1 reply; 2+ messages in thread
From: Mayuresh Janorkar @ 2011-02-22 13:07 UTC (permalink / raw)
  To: linux-fbdev, linux-omap, lethal, tomi.valkeinen; +Cc: Mayuresh Janorkar

When omapfb.mode is passed through bootargs, when omapfb is setting mode,
it would check if timings passed are fine for panel attached to it.
It makes use of check_timing API provided by the panel.

In current code if check_timing API is not available for attached panel,
OMAPFB would return -EINVAL and BPP sent via bootargs will not have any effect.

In case of panels like TAAL panel, omapfb or any other driver should not be allowed to
change the timings. So bpps sent via bootargs will not have an effect.

In such case we can check only the x_res and y_res with the panels resolution
and if they match go ahead and set the bpps.
The bpp value sent via bootarg would have an effect.

Signed-off-by: Mayuresh Janorkar <mayur@ti.com>
---
BASE: git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git
	HEAD: dss2

 drivers/video/omap2/omapfb/omapfb-main.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 4fdab8e..505ec66 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -2090,7 +2090,7 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
 {
 	int r;
 	u8 bpp;
-	struct omap_video_timings timings;
+	struct omap_video_timings timings, temp_timings;
 
 	r = omapfb_mode_to_timings(mode_str, &timings, &bpp);
 	if (r)
@@ -2100,14 +2100,23 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
 	fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp;
 	++fbdev->num_bpp_overrides;
 
-	if (!display->driver->check_timings || !display->driver->set_timings)
-		return -EINVAL;
+	if (display->driver->check_timings) {
+		r = display->driver->check_timings(display, &timings);
+		if (r)
+			return r;
+	} else {
+		/* If check_timings is not present compare xres and yres */
+		if (display->driver->get_timings) {
+			display->driver->get_timings(display, &temp_timings);
 
-	r = display->driver->check_timings(display, &timings);
-	if (r)
-		return r;
+			if (temp_timings.x_res != timings.x_res ||
+				temp_timings.y_res != timings.y_res)
+				return -EINVAL;
+		}
+	}
 
-	display->driver->set_timings(display, &timings);
+	if (display->driver->set_timings)
+			display->driver->set_timings(display, &timings);
 
 	return 0;
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-23  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-22 13:07 [PATCH] OMAPFB: Adding a check for timings in set_def_mode Mayuresh Janorkar
2011-02-23  9:47 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).