diff options
author | Archit Taneja <archit@ti.com> | 2012-06-14 22:09:47 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-06-29 03:15:51 -0400 |
commit | 783babf33f47c8d42e73900575dd9beea98fca40 (patch) | |
tree | e1951440a19f2d65c50ebc7960ba8d1b4f592a81 /drivers/video | |
parent | 0e065c79e6ceb8d267b1a4ff05b547feeb507986 (diff) |
OMAPFB: Map the newly added omap_video_timings fields with fb sync flags
Use the newly added fields in omap_video_timings(hsync, vsync and data_enable
logic levels and data, hsync and vsync latching related info) to
configure/retrieve corresponding sync flags in fb_var_screeninfo and
fb_videomode.
Out of the new fields, hsync_level and vsync_level can be mapped to the fb sync
flags FB_SYNC_HOR_HIGH_ACT and FB_SYNC_VERT_HIGH_ACT.
When converting fb mode to omap_video_timings, the fields which don't have an
equivalent parameter in fb are kept as the original values if the panel driver
has a get_timings op, else they are set to default values.
Signed-off-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 3450ea0966c9..5491817ef979 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -733,6 +733,10 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var) | |||
733 | var->lower_margin = timings.vfp; | 733 | var->lower_margin = timings.vfp; |
734 | var->hsync_len = timings.hsw; | 734 | var->hsync_len = timings.hsw; |
735 | var->vsync_len = timings.vsw; | 735 | var->vsync_len = timings.vsw; |
736 | var->sync |= timings.hsync_level == OMAPDSS_SIG_ACTIVE_HIGH ? | ||
737 | FB_SYNC_HOR_HIGH_ACT : 0; | ||
738 | var->sync |= timings.vsync_level == OMAPDSS_SIG_ACTIVE_HIGH ? | ||
739 | FB_SYNC_VERT_HIGH_ACT : 0; | ||
736 | } else { | 740 | } else { |
737 | var->pixclock = 0; | 741 | var->pixclock = 0; |
738 | var->left_margin = 0; | 742 | var->left_margin = 0; |
@@ -741,11 +745,11 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var) | |||
741 | var->lower_margin = 0; | 745 | var->lower_margin = 0; |
742 | var->hsync_len = 0; | 746 | var->hsync_len = 0; |
743 | var->vsync_len = 0; | 747 | var->vsync_len = 0; |
748 | var->sync = 0; | ||
744 | } | 749 | } |
745 | 750 | ||
746 | /* TODO: get these from panel->config */ | 751 | /* TODO: get these from panel->config */ |
747 | var->vmode = FB_VMODE_NONINTERLACED; | 752 | var->vmode = FB_VMODE_NONINTERLACED; |
748 | var->sync = 0; | ||
749 | 753 | ||
750 | return 0; | 754 | return 0; |
751 | } | 755 | } |
@@ -1993,6 +1997,7 @@ static int omapfb_create_framebuffers(struct omapfb2_device *fbdev) | |||
1993 | } | 1997 | } |
1994 | 1998 | ||
1995 | static int omapfb_mode_to_timings(const char *mode_str, | 1999 | static int omapfb_mode_to_timings(const char *mode_str, |
2000 | struct omap_dss_device *display, | ||
1996 | struct omap_video_timings *timings, u8 *bpp) | 2001 | struct omap_video_timings *timings, u8 *bpp) |
1997 | { | 2002 | { |
1998 | struct fb_info *fbi; | 2003 | struct fb_info *fbi; |
@@ -2046,6 +2051,14 @@ static int omapfb_mode_to_timings(const char *mode_str, | |||
2046 | goto err; | 2051 | goto err; |
2047 | } | 2052 | } |
2048 | 2053 | ||
2054 | if (display->driver->get_timings) { | ||
2055 | display->driver->get_timings(display, timings); | ||
2056 | } else { | ||
2057 | timings->data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE; | ||
2058 | timings->de_level = OMAPDSS_SIG_ACTIVE_HIGH; | ||
2059 | timings->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES; | ||
2060 | } | ||
2061 | |||
2049 | timings->pixel_clock = PICOS2KHZ(var->pixclock); | 2062 | timings->pixel_clock = PICOS2KHZ(var->pixclock); |
2050 | timings->hbp = var->left_margin; | 2063 | timings->hbp = var->left_margin; |
2051 | timings->hfp = var->right_margin; | 2064 | timings->hfp = var->right_margin; |
@@ -2055,6 +2068,12 @@ static int omapfb_mode_to_timings(const char *mode_str, | |||
2055 | timings->vsw = var->vsync_len; | 2068 | timings->vsw = var->vsync_len; |
2056 | timings->x_res = var->xres; | 2069 | timings->x_res = var->xres; |
2057 | timings->y_res = var->yres; | 2070 | timings->y_res = var->yres; |
2071 | timings->hsync_level = var->sync & FB_SYNC_HOR_HIGH_ACT ? | ||
2072 | OMAPDSS_SIG_ACTIVE_HIGH : | ||
2073 | OMAPDSS_SIG_ACTIVE_LOW; | ||
2074 | timings->vsync_level = var->sync & FB_SYNC_VERT_HIGH_ACT ? | ||
2075 | OMAPDSS_SIG_ACTIVE_HIGH : | ||
2076 | OMAPDSS_SIG_ACTIVE_LOW; | ||
2058 | 2077 | ||
2059 | switch (var->bits_per_pixel) { | 2078 | switch (var->bits_per_pixel) { |
2060 | case 16: | 2079 | case 16: |
@@ -2085,7 +2104,7 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev, | |||
2085 | struct omap_video_timings timings, temp_timings; | 2104 | struct omap_video_timings timings, temp_timings; |
2086 | struct omapfb_display_data *d; | 2105 | struct omapfb_display_data *d; |
2087 | 2106 | ||
2088 | r = omapfb_mode_to_timings(mode_str, &timings, &bpp); | 2107 | r = omapfb_mode_to_timings(mode_str, display, &timings, &bpp); |
2089 | if (r) | 2108 | if (r) |
2090 | return r; | 2109 | return r; |
2091 | 2110 | ||
@@ -2178,8 +2197,17 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) | |||
2178 | } | 2197 | } |
2179 | 2198 | ||
2180 | static void fb_videomode_to_omap_timings(struct fb_videomode *m, | 2199 | static void fb_videomode_to_omap_timings(struct fb_videomode *m, |
2200 | struct omap_dss_device *display, | ||
2181 | struct omap_video_timings *t) | 2201 | struct omap_video_timings *t) |
2182 | { | 2202 | { |
2203 | if (display->driver->get_timings) { | ||
2204 | display->driver->get_timings(display, t); | ||
2205 | } else { | ||
2206 | t->data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE; | ||
2207 | t->de_level = OMAPDSS_SIG_ACTIVE_HIGH; | ||
2208 | t->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES; | ||
2209 | } | ||
2210 | |||
2183 | t->x_res = m->xres; | 2211 | t->x_res = m->xres; |
2184 | t->y_res = m->yres; | 2212 | t->y_res = m->yres; |
2185 | t->pixel_clock = PICOS2KHZ(m->pixclock); | 2213 | t->pixel_clock = PICOS2KHZ(m->pixclock); |
@@ -2189,6 +2217,12 @@ static void fb_videomode_to_omap_timings(struct fb_videomode *m, | |||
2189 | t->vsw = m->vsync_len; | 2217 | t->vsw = m->vsync_len; |
2190 | t->vfp = m->lower_margin; | 2218 | t->vfp = m->lower_margin; |
2191 | t->vbp = m->upper_margin; | 2219 | t->vbp = m->upper_margin; |
2220 | t->hsync_level = m->sync & FB_SYNC_HOR_HIGH_ACT ? | ||
2221 | OMAPDSS_SIG_ACTIVE_HIGH : | ||
2222 | OMAPDSS_SIG_ACTIVE_LOW; | ||
2223 | t->vsync_level = m->sync & FB_SYNC_VERT_HIGH_ACT ? | ||
2224 | OMAPDSS_SIG_ACTIVE_HIGH : | ||
2225 | OMAPDSS_SIG_ACTIVE_LOW; | ||
2192 | } | 2226 | } |
2193 | 2227 | ||
2194 | static int omapfb_find_best_mode(struct omap_dss_device *display, | 2228 | static int omapfb_find_best_mode(struct omap_dss_device *display, |
@@ -2231,7 +2265,7 @@ static int omapfb_find_best_mode(struct omap_dss_device *display, | |||
2231 | if (m->xres == 2880 || m->xres == 1440) | 2265 | if (m->xres == 2880 || m->xres == 1440) |
2232 | continue; | 2266 | continue; |
2233 | 2267 | ||
2234 | fb_videomode_to_omap_timings(m, &t); | 2268 | fb_videomode_to_omap_timings(m, display, &t); |
2235 | 2269 | ||
2236 | r = display->driver->check_timings(display, &t); | 2270 | r = display->driver->check_timings(display, &t); |
2237 | if (r == 0 && best_xres < m->xres) { | 2271 | if (r == 0 && best_xres < m->xres) { |
@@ -2245,7 +2279,8 @@ static int omapfb_find_best_mode(struct omap_dss_device *display, | |||
2245 | goto err2; | 2279 | goto err2; |
2246 | } | 2280 | } |
2247 | 2281 | ||
2248 | fb_videomode_to_omap_timings(&specs->modedb[best_idx], timings); | 2282 | fb_videomode_to_omap_timings(&specs->modedb[best_idx], display, |
2283 | timings); | ||
2249 | 2284 | ||
2250 | r = 0; | 2285 | r = 0; |
2251 | 2286 | ||