diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-04-30 05:13:14 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2011-07-01 05:01:14 -0400 |
commit | 065a40bd461d3709a2c36adf0ec383581cc692a7 (patch) | |
tree | 731e1547a4136ee5130823ae81b0060d736c892f /drivers | |
parent | 4a9a5e390cb57f12de77b94b07dccf14752157ad (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 29 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb.h | 26 |
2 files changed, 34 insertions, 21 deletions
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 505bc12a3031..44eb666536cc 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -1858,10 +1858,11 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev) | |||
1858 | } | 1858 | } |
1859 | 1859 | ||
1860 | for (i = 0; i < fbdev->num_displays; i++) { | 1860 | for (i = 0; i < fbdev->num_displays; i++) { |
1861 | if (fbdev->displays[i]->state != OMAP_DSS_DISPLAY_DISABLED) | 1861 | struct omap_dss_device *dssdev = fbdev->displays[i].dssdev; |
1862 | fbdev->displays[i]->driver->disable(fbdev->displays[i]); | 1862 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) |
1863 | dssdev->driver->disable(dssdev); | ||
1863 | 1864 | ||
1864 | omap_dss_put_device(fbdev->displays[i]); | 1865 | omap_dss_put_device(dssdev); |
1865 | } | 1866 | } |
1866 | 1867 | ||
1867 | dev_set_drvdata(fbdev->dev, NULL); | 1868 | dev_set_drvdata(fbdev->dev, NULL); |
@@ -2084,14 +2085,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev, | |||
2084 | int r; | 2085 | int r; |
2085 | u8 bpp; | 2086 | u8 bpp; |
2086 | struct omap_video_timings timings, temp_timings; | 2087 | struct omap_video_timings timings, temp_timings; |
2088 | struct omapfb_display_data *d; | ||
2087 | 2089 | ||
2088 | r = omapfb_mode_to_timings(mode_str, &timings, &bpp); | 2090 | r = omapfb_mode_to_timings(mode_str, &timings, &bpp); |
2089 | if (r) | 2091 | if (r) |
2090 | return r; | 2092 | return r; |
2091 | 2093 | ||
2092 | fbdev->bpp_overrides[fbdev->num_bpp_overrides].dssdev = display; | 2094 | d = get_display_data(fbdev, display); |
2093 | fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp; | 2095 | d->bpp_override = bpp; |
2094 | ++fbdev->num_bpp_overrides; | ||
2095 | 2096 | ||
2096 | if (display->driver->check_timings) { | 2097 | if (display->driver->check_timings) { |
2097 | r = display->driver->check_timings(display, &timings); | 2098 | r = display->driver->check_timings(display, &timings); |
@@ -2117,14 +2118,14 @@ static int omapfb_set_def_mode(struct omapfb2_device *fbdev, | |||
2117 | static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev, | 2118 | static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev, |
2118 | struct omap_dss_device *dssdev) | 2119 | struct omap_dss_device *dssdev) |
2119 | { | 2120 | { |
2120 | int i; | 2121 | struct omapfb_display_data *d; |
2121 | 2122 | ||
2122 | BUG_ON(dssdev->driver->get_recommended_bpp == NULL); | 2123 | BUG_ON(dssdev->driver->get_recommended_bpp == NULL); |
2123 | 2124 | ||
2124 | for (i = 0; i < fbdev->num_bpp_overrides; ++i) { | 2125 | d = get_display_data(fbdev, dssdev); |
2125 | if (dssdev == fbdev->bpp_overrides[i].dssdev) | 2126 | |
2126 | return fbdev->bpp_overrides[i].bpp; | 2127 | if (d->bpp_override != 0) |
2127 | } | 2128 | return d->bpp_override; |
2128 | 2129 | ||
2129 | return dssdev->driver->get_recommended_bpp(dssdev); | 2130 | return dssdev->driver->get_recommended_bpp(dssdev); |
2130 | } | 2131 | } |
@@ -2156,9 +2157,9 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) | |||
2156 | 2157 | ||
2157 | display = NULL; | 2158 | display = NULL; |
2158 | for (i = 0; i < fbdev->num_displays; ++i) { | 2159 | for (i = 0; i < fbdev->num_displays; ++i) { |
2159 | if (strcmp(fbdev->displays[i]->name, | 2160 | if (strcmp(fbdev->displays[i].dssdev->name, |
2160 | display_str) == 0) { | 2161 | display_str) == 0) { |
2161 | display = fbdev->displays[i]; | 2162 | display = fbdev->displays[i].dssdev; |
2162 | break; | 2163 | break; |
2163 | } | 2164 | } |
2164 | } | 2165 | } |
@@ -2282,7 +2283,7 @@ static int omapfb_probe(struct platform_device *pdev) | |||
2282 | r = -ENODEV; | 2283 | r = -ENODEV; |
2283 | } | 2284 | } |
2284 | 2285 | ||
2285 | fbdev->displays[fbdev->num_displays++] = dssdev; | 2286 | fbdev->displays[fbdev->num_displays++].dssdev = dssdev; |
2286 | } | 2287 | } |
2287 | 2288 | ||
2288 | if (r) | 2289 | if (r) |
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h index aa1b1d974276..f07dbbb08db1 100644 --- a/drivers/video/omap2/omapfb/omapfb.h +++ b/drivers/video/omap2/omapfb/omapfb.h | |||
@@ -73,6 +73,11 @@ struct omapfb_info { | |||
73 | bool mirror; | 73 | bool mirror; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | struct omapfb_display_data { | ||
77 | struct omap_dss_device *dssdev; | ||
78 | u8 bpp_override; | ||
79 | }; | ||
80 | |||
76 | struct omapfb2_device { | 81 | struct omapfb2_device { |
77 | struct device *dev; | 82 | struct device *dev; |
78 | struct mutex mtx; | 83 | struct mutex mtx; |
@@ -86,17 +91,11 @@ struct omapfb2_device { | |||
86 | struct omapfb2_mem_region regions[10]; | 91 | struct omapfb2_mem_region regions[10]; |
87 | 92 | ||
88 | unsigned num_displays; | 93 | unsigned num_displays; |
89 | struct omap_dss_device *displays[10]; | 94 | struct omapfb_display_data displays[10]; |
90 | unsigned num_overlays; | 95 | unsigned num_overlays; |
91 | struct omap_overlay *overlays[10]; | 96 | struct omap_overlay *overlays[10]; |
92 | unsigned num_managers; | 97 | unsigned num_managers; |
93 | struct omap_overlay_manager *managers[10]; | 98 | struct omap_overlay_manager *managers[10]; |
94 | |||
95 | unsigned num_bpp_overrides; | ||
96 | struct { | ||
97 | struct omap_dss_device *dssdev; | ||
98 | u8 bpp; | ||
99 | } bpp_overrides[10]; | ||
100 | }; | 99 | }; |
101 | 100 | ||
102 | struct omapfb_colormode { | 101 | struct omapfb_colormode { |
@@ -143,6 +142,19 @@ static inline struct omap_dss_device *fb2display(struct fb_info *fbi) | |||
143 | return NULL; | 142 | return NULL; |
144 | } | 143 | } |
145 | 144 | ||
145 | static inline struct omapfb_display_data *get_display_data( | ||
146 | struct omapfb2_device *fbdev, struct omap_dss_device *dssdev) | ||
147 | { | ||
148 | int i; | ||
149 | |||
150 | for (i = 0; i < fbdev->num_displays; ++i) | ||
151 | if (fbdev->displays[i].dssdev == dssdev) | ||
152 | return &fbdev->displays[i]; | ||
153 | |||
154 | /* This should never happen */ | ||
155 | BUG(); | ||
156 | } | ||
157 | |||
146 | static inline void omapfb_lock(struct omapfb2_device *fbdev) | 158 | static inline void omapfb_lock(struct omapfb2_device *fbdev) |
147 | { | 159 | { |
148 | mutex_lock(&fbdev->mtx); | 160 | mutex_lock(&fbdev->mtx); |