2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-11-20 00:26:39 +08:00

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: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
Tomi Valkeinen 2011-04-30 12:13:14 +03:00
parent 4a9a5e390c
commit 065a40bd46
2 changed files with 34 additions and 21 deletions

View File

@ -1858,10 +1858,11 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev)
}
for (i = 0; i < fbdev->num_displays; i++) {
if (fbdev->displays[i]->state != OMAP_DSS_DISPLAY_DISABLED)
fbdev->displays[i]->driver->disable(fbdev->displays[i]);
struct omap_dss_device *dssdev = fbdev->displays[i].dssdev;
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);
@ -2084,14 +2085,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
int r;
u8 bpp;
struct omap_video_timings timings, temp_timings;
struct omapfb_display_data *d;
r = omapfb_mode_to_timings(mode_str, &timings, &bpp);
if (r)
return r;
fbdev->bpp_overrides[fbdev->num_bpp_overrides].dssdev = display;
fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp;
++fbdev->num_bpp_overrides;
d = get_display_data(fbdev, display);
d->bpp_override = bpp;
if (display->driver->check_timings) {
r = display->driver->check_timings(display, &timings);
@ -2117,14 +2118,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev,
struct omap_dss_device *dssdev)
{
int i;
struct omapfb_display_data *d;
BUG_ON(dssdev->driver->get_recommended_bpp == NULL);
for (i = 0; i < fbdev->num_bpp_overrides; ++i) {
if (dssdev == fbdev->bpp_overrides[i].dssdev)
return fbdev->bpp_overrides[i].bpp;
}
d = get_display_data(fbdev, dssdev);
if (d->bpp_override != 0)
return d->bpp_override;
return dssdev->driver->get_recommended_bpp(dssdev);
}
@ -2156,9 +2157,9 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev)
display = NULL;
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 = fbdev->displays[i];
display = fbdev->displays[i].dssdev;
break;
}
}
@ -2282,7 +2283,7 @@ static int omapfb_probe(struct platform_device *pdev)
r = -ENODEV;
}
fbdev->displays[fbdev->num_displays++] = dssdev;
fbdev->displays[fbdev->num_displays++].dssdev = dssdev;
}
if (r)

View File

@ -73,6 +73,11 @@ struct omapfb_info {
bool mirror;
};
struct omapfb_display_data {
struct omap_dss_device *dssdev;
u8 bpp_override;
};
struct omapfb2_device {
struct device *dev;
struct mutex mtx;
@ -86,17 +91,11 @@ struct omapfb2_device {
struct omapfb2_mem_region regions[10];
unsigned num_displays;
struct omap_dss_device *displays[10];
struct omapfb_display_data displays[10];
unsigned num_overlays;
struct omap_overlay *overlays[10];
unsigned num_managers;
struct omap_overlay_manager *managers[10];
unsigned num_bpp_overrides;
struct {
struct omap_dss_device *dssdev;
u8 bpp;
} bpp_overrides[10];
};
struct omapfb_colormode {
@ -143,6 +142,19 @@ static inline struct omap_dss_device *fb2display(struct fb_info *fbi)
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)
{
mutex_lock(&fbdev->mtx);