Commit 065a40bd authored by Tomi Valkeinen's avatar Tomi Valkeinen

OMAP: DSS2: OMAPFB: Add struct to store per-display data

Create a new struct omapfb_display_data to contain omapfb's private
per-display data. Move the bpp override there.

This struct will be used to hold auto/manual update state of a display
in the following patches.
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 4a9a5e39
...@@ -1858,10 +1858,11 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev) ...@@ -1858,10 +1858,11 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev)
} }
for (i = 0; i < fbdev->num_displays; i++) { for (i = 0; i < fbdev->num_displays; i++) {
if (fbdev->displays[i]->state != OMAP_DSS_DISPLAY_DISABLED) struct omap_dss_device *dssdev = fbdev->displays[i].dssdev;
fbdev->displays[i]->driver->disable(fbdev->displays[i]); if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)
dssdev->driver->disable(dssdev);
omap_dss_put_device(fbdev->displays[i]); omap_dss_put_device(dssdev);
} }
dev_set_drvdata(fbdev->dev, NULL); dev_set_drvdata(fbdev->dev, NULL);
...@@ -2084,14 +2085,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev, ...@@ -2084,14 +2085,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
int r; int r;
u8 bpp; u8 bpp;
struct omap_video_timings timings, temp_timings; struct omap_video_timings timings, temp_timings;
struct omapfb_display_data *d;
r = omapfb_mode_to_timings(mode_str, &timings, &bpp); r = omapfb_mode_to_timings(mode_str, &timings, &bpp);
if (r) if (r)
return r; return r;
fbdev->bpp_overrides[fbdev->num_bpp_overrides].dssdev = display; d = get_display_data(fbdev, display);
fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp; d->bpp_override = bpp;
++fbdev->num_bpp_overrides;
if (display->driver->check_timings) { if (display->driver->check_timings) {
r = display->driver->check_timings(display, &timings); r = display->driver->check_timings(display, &timings);
...@@ -2117,14 +2118,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev, ...@@ -2117,14 +2118,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev, static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev,
struct omap_dss_device *dssdev) struct omap_dss_device *dssdev)
{ {
int i; struct omapfb_display_data *d;
BUG_ON(dssdev->driver->get_recommended_bpp == NULL); BUG_ON(dssdev->driver->get_recommended_bpp == NULL);
for (i = 0; i < fbdev->num_bpp_overrides; ++i) { d = get_display_data(fbdev, dssdev);
if (dssdev == fbdev->bpp_overrides[i].dssdev)
return fbdev->bpp_overrides[i].bpp; if (d->bpp_override != 0)
} return d->bpp_override;
return dssdev->driver->get_recommended_bpp(dssdev); return dssdev->driver->get_recommended_bpp(dssdev);
} }
...@@ -2156,9 +2157,9 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) ...@@ -2156,9 +2157,9 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
display = NULL; display = NULL;
for (i = 0; i < fbdev->num_displays; ++i) { for (i = 0; i < fbdev->num_displays; ++i) {
if (strcmp(fbdev->displays[i]->name, if (strcmp(fbdev->displays[i].dssdev->name,
display_str) == 0) { display_str) == 0) {
display = fbdev->displays[i]; display = fbdev->displays[i].dssdev;
break; break;
} }
} }
...@@ -2282,7 +2283,7 @@ static int omapfb_probe(struct platform_device *pdev) ...@@ -2282,7 +2283,7 @@ static int omapfb_probe(struct platform_device *pdev)
r = -ENODEV; r = -ENODEV;
} }
fbdev->displays[fbdev->num_displays++] = dssdev; fbdev->displays[fbdev->num_displays++].dssdev = dssdev;
} }
if (r) if (r)
......
...@@ -73,6 +73,11 @@ struct omapfb_info { ...@@ -73,6 +73,11 @@ struct omapfb_info {
bool mirror; bool mirror;
}; };
struct omapfb_display_data {
struct omap_dss_device *dssdev;
u8 bpp_override;
};
struct omapfb2_device { struct omapfb2_device {
struct device *dev; struct device *dev;
struct mutex mtx; struct mutex mtx;
...@@ -86,17 +91,11 @@ struct omapfb2_device { ...@@ -86,17 +91,11 @@ struct omapfb2_device {
struct omapfb2_mem_region regions[10]; struct omapfb2_mem_region regions[10];
unsigned num_displays; unsigned num_displays;
struct omap_dss_device *displays[10]; struct omapfb_display_data displays[10];
unsigned num_overlays; unsigned num_overlays;
struct omap_overlay *overlays[10]; struct omap_overlay *overlays[10];
unsigned num_managers; unsigned num_managers;
struct omap_overlay_manager *managers[10]; struct omap_overlay_manager *managers[10];
unsigned num_bpp_overrides;
struct {
struct omap_dss_device *dssdev;
u8 bpp;
} bpp_overrides[10];
}; };
struct omapfb_colormode { struct omapfb_colormode {
...@@ -143,6 +142,19 @@ static inline struct omap_dss_device *fb2display(struct fb_info *fbi) ...@@ -143,6 +142,19 @@ static inline struct omap_dss_device *fb2display(struct fb_info *fbi)
return NULL; return NULL;
} }
static inline struct omapfb_display_data *get_display_data(
struct omapfb2_device *fbdev, struct omap_dss_device *dssdev)
{
int i;
for (i = 0; i < fbdev->num_displays; ++i)
if (fbdev->displays[i].dssdev == dssdev)
return &fbdev->displays[i];
/* This should never happen */
BUG();
}
static inline void omapfb_lock(struct omapfb2_device *fbdev) static inline void omapfb_lock(struct omapfb2_device *fbdev)
{ {
mutex_lock(&fbdev->mtx); mutex_lock(&fbdev->mtx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment