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>
This commit is contained in:
parent
0e065c79e6
commit
783babf33f
@ -733,6 +733,10 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
|
|||||||
var->lower_margin = timings.vfp;
|
var->lower_margin = timings.vfp;
|
||||||
var->hsync_len = timings.hsw;
|
var->hsync_len = timings.hsw;
|
||||||
var->vsync_len = timings.vsw;
|
var->vsync_len = timings.vsw;
|
||||||
|
var->sync |= timings.hsync_level == OMAPDSS_SIG_ACTIVE_HIGH ?
|
||||||
|
FB_SYNC_HOR_HIGH_ACT : 0;
|
||||||
|
var->sync |= timings.vsync_level == OMAPDSS_SIG_ACTIVE_HIGH ?
|
||||||
|
FB_SYNC_VERT_HIGH_ACT : 0;
|
||||||
} else {
|
} else {
|
||||||
var->pixclock = 0;
|
var->pixclock = 0;
|
||||||
var->left_margin = 0;
|
var->left_margin = 0;
|
||||||
@ -741,11 +745,11 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
|
|||||||
var->lower_margin = 0;
|
var->lower_margin = 0;
|
||||||
var->hsync_len = 0;
|
var->hsync_len = 0;
|
||||||
var->vsync_len = 0;
|
var->vsync_len = 0;
|
||||||
|
var->sync = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: get these from panel->config */
|
/* TODO: get these from panel->config */
|
||||||
var->vmode = FB_VMODE_NONINTERLACED;
|
var->vmode = FB_VMODE_NONINTERLACED;
|
||||||
var->sync = 0;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1993,6 +1997,7 @@ static int omapfb_create_framebuffers(struct omapfb2_device *fbdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int omapfb_mode_to_timings(const char *mode_str,
|
static int omapfb_mode_to_timings(const char *mode_str,
|
||||||
|
struct omap_dss_device *display,
|
||||||
struct omap_video_timings *timings, u8 *bpp)
|
struct omap_video_timings *timings, u8 *bpp)
|
||||||
{
|
{
|
||||||
struct fb_info *fbi;
|
struct fb_info *fbi;
|
||||||
@ -2046,6 +2051,14 @@ static int omapfb_mode_to_timings(const char *mode_str,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (display->driver->get_timings) {
|
||||||
|
display->driver->get_timings(display, timings);
|
||||||
|
} else {
|
||||||
|
timings->data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE;
|
||||||
|
timings->de_level = OMAPDSS_SIG_ACTIVE_HIGH;
|
||||||
|
timings->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
|
||||||
|
}
|
||||||
|
|
||||||
timings->pixel_clock = PICOS2KHZ(var->pixclock);
|
timings->pixel_clock = PICOS2KHZ(var->pixclock);
|
||||||
timings->hbp = var->left_margin;
|
timings->hbp = var->left_margin;
|
||||||
timings->hfp = var->right_margin;
|
timings->hfp = var->right_margin;
|
||||||
@ -2055,6 +2068,12 @@ static int omapfb_mode_to_timings(const char *mode_str,
|
|||||||
timings->vsw = var->vsync_len;
|
timings->vsw = var->vsync_len;
|
||||||
timings->x_res = var->xres;
|
timings->x_res = var->xres;
|
||||||
timings->y_res = var->yres;
|
timings->y_res = var->yres;
|
||||||
|
timings->hsync_level = var->sync & FB_SYNC_HOR_HIGH_ACT ?
|
||||||
|
OMAPDSS_SIG_ACTIVE_HIGH :
|
||||||
|
OMAPDSS_SIG_ACTIVE_LOW;
|
||||||
|
timings->vsync_level = var->sync & FB_SYNC_VERT_HIGH_ACT ?
|
||||||
|
OMAPDSS_SIG_ACTIVE_HIGH :
|
||||||
|
OMAPDSS_SIG_ACTIVE_LOW;
|
||||||
|
|
||||||
switch (var->bits_per_pixel) {
|
switch (var->bits_per_pixel) {
|
||||||
case 16:
|
case 16:
|
||||||
@ -2085,7 +2104,7 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
|
|||||||
struct omap_video_timings timings, temp_timings;
|
struct omap_video_timings timings, temp_timings;
|
||||||
struct omapfb_display_data *d;
|
struct omapfb_display_data *d;
|
||||||
|
|
||||||
r = omapfb_mode_to_timings(mode_str, &timings, &bpp);
|
r = omapfb_mode_to_timings(mode_str, display, &timings, &bpp);
|
||||||
if (r)
|
if (r)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -2178,8 +2197,17 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void fb_videomode_to_omap_timings(struct fb_videomode *m,
|
static void fb_videomode_to_omap_timings(struct fb_videomode *m,
|
||||||
|
struct omap_dss_device *display,
|
||||||
struct omap_video_timings *t)
|
struct omap_video_timings *t)
|
||||||
{
|
{
|
||||||
|
if (display->driver->get_timings) {
|
||||||
|
display->driver->get_timings(display, t);
|
||||||
|
} else {
|
||||||
|
t->data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE;
|
||||||
|
t->de_level = OMAPDSS_SIG_ACTIVE_HIGH;
|
||||||
|
t->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
|
||||||
|
}
|
||||||
|
|
||||||
t->x_res = m->xres;
|
t->x_res = m->xres;
|
||||||
t->y_res = m->yres;
|
t->y_res = m->yres;
|
||||||
t->pixel_clock = PICOS2KHZ(m->pixclock);
|
t->pixel_clock = PICOS2KHZ(m->pixclock);
|
||||||
@ -2189,6 +2217,12 @@ static void fb_videomode_to_omap_timings(struct fb_videomode *m,
|
|||||||
t->vsw = m->vsync_len;
|
t->vsw = m->vsync_len;
|
||||||
t->vfp = m->lower_margin;
|
t->vfp = m->lower_margin;
|
||||||
t->vbp = m->upper_margin;
|
t->vbp = m->upper_margin;
|
||||||
|
t->hsync_level = m->sync & FB_SYNC_HOR_HIGH_ACT ?
|
||||||
|
OMAPDSS_SIG_ACTIVE_HIGH :
|
||||||
|
OMAPDSS_SIG_ACTIVE_LOW;
|
||||||
|
t->vsync_level = m->sync & FB_SYNC_VERT_HIGH_ACT ?
|
||||||
|
OMAPDSS_SIG_ACTIVE_HIGH :
|
||||||
|
OMAPDSS_SIG_ACTIVE_LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int omapfb_find_best_mode(struct omap_dss_device *display,
|
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,
|
|||||||
if (m->xres == 2880 || m->xres == 1440)
|
if (m->xres == 2880 || m->xres == 1440)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fb_videomode_to_omap_timings(m, &t);
|
fb_videomode_to_omap_timings(m, display, &t);
|
||||||
|
|
||||||
r = display->driver->check_timings(display, &t);
|
r = display->driver->check_timings(display, &t);
|
||||||
if (r == 0 && best_xres < m->xres) {
|
if (r == 0 && best_xres < m->xres) {
|
||||||
@ -2245,7 +2279,8 @@ static int omapfb_find_best_mode(struct omap_dss_device *display,
|
|||||||
goto err2;
|
goto err2;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_videomode_to_omap_timings(&specs->modedb[best_idx], timings);
|
fb_videomode_to_omap_timings(&specs->modedb[best_idx], display,
|
||||||
|
timings);
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user