diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-08-14 06:21:17 -0400 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-11-21 09:50:00 -0500 |
commit | 8e2b2033db37ff4cec8caca3d0ef815e9aa84153 (patch) | |
tree | 6cf84d0093af8d6630ac9e555b6fa8be22587285 /drivers/video/sh_mipi_dsi.c | |
parent | 86c82c43365b0c06002aa69a8185219be9437317 (diff) |
fbdev: sh_mipi_dsi: Use the LCDC entity default mode
Configure the MIPI-DSI transmitter using the LCDC entity default mode
instead of accessing the mode through the LCDC platform data.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/video/sh_mipi_dsi.c')
-rw-r--r-- | drivers/video/sh_mipi_dsi.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c index 7f6ce6515b6d..f88b2040eb5d 100644 --- a/drivers/video/sh_mipi_dsi.c +++ b/drivers/video/sh_mipi_dsi.c | |||
@@ -127,9 +127,10 @@ static void sh_mipi_shutdown(struct platform_device *pdev) | |||
127 | sh_mipi_dsi_enable(mipi, false); | 127 | sh_mipi_dsi_enable(mipi, false); |
128 | } | 128 | } |
129 | 129 | ||
130 | static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata) | 130 | static int sh_mipi_setup(struct sh_mipi *mipi, const struct fb_videomode *mode) |
131 | { | 131 | { |
132 | void __iomem *base = mipi->base; | 132 | void __iomem *base = mipi->base; |
133 | struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data; | ||
133 | struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan; | 134 | struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan; |
134 | u32 pctype, datatype, pixfmt, linelength, vmctr2; | 135 | u32 pctype, datatype, pixfmt, linelength, vmctr2; |
135 | u32 tmp, top, bottom, delay, div; | 136 | u32 tmp, top, bottom, delay, div; |
@@ -146,77 +147,77 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata) | |||
146 | pctype = 0; | 147 | pctype = 0; |
147 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; | 148 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; |
148 | pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; | 149 | pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; |
149 | linelength = ch->lcd_modes[0].xres * 3; | 150 | linelength = mode->xres * 3; |
150 | yuv = false; | 151 | yuv = false; |
151 | break; | 152 | break; |
152 | case MIPI_RGB565: | 153 | case MIPI_RGB565: |
153 | pctype = 1; | 154 | pctype = 1; |
154 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; | 155 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; |
155 | pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; | 156 | pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; |
156 | linelength = ch->lcd_modes[0].xres * 2; | 157 | linelength = mode->xres * 2; |
157 | yuv = false; | 158 | yuv = false; |
158 | break; | 159 | break; |
159 | case MIPI_RGB666_LP: | 160 | case MIPI_RGB666_LP: |
160 | pctype = 2; | 161 | pctype = 2; |
161 | datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; | 162 | datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; |
162 | pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; | 163 | pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; |
163 | linelength = ch->lcd_modes[0].xres * 3; | 164 | linelength = mode->xres * 3; |
164 | yuv = false; | 165 | yuv = false; |
165 | break; | 166 | break; |
166 | case MIPI_RGB666: | 167 | case MIPI_RGB666: |
167 | pctype = 3; | 168 | pctype = 3; |
168 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; | 169 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; |
169 | pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; | 170 | pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; |
170 | linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8; | 171 | linelength = (mode->xres * 18 + 7) / 8; |
171 | yuv = false; | 172 | yuv = false; |
172 | break; | 173 | break; |
173 | case MIPI_BGR888: | 174 | case MIPI_BGR888: |
174 | pctype = 8; | 175 | pctype = 8; |
175 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; | 176 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; |
176 | pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; | 177 | pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; |
177 | linelength = ch->lcd_modes[0].xres * 3; | 178 | linelength = mode->xres * 3; |
178 | yuv = false; | 179 | yuv = false; |
179 | break; | 180 | break; |
180 | case MIPI_BGR565: | 181 | case MIPI_BGR565: |
181 | pctype = 9; | 182 | pctype = 9; |
182 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; | 183 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; |
183 | pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; | 184 | pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; |
184 | linelength = ch->lcd_modes[0].xres * 2; | 185 | linelength = mode->xres * 2; |
185 | yuv = false; | 186 | yuv = false; |
186 | break; | 187 | break; |
187 | case MIPI_BGR666_LP: | 188 | case MIPI_BGR666_LP: |
188 | pctype = 0xa; | 189 | pctype = 0xa; |
189 | datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; | 190 | datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; |
190 | pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; | 191 | pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; |
191 | linelength = ch->lcd_modes[0].xres * 3; | 192 | linelength = mode->xres * 3; |
192 | yuv = false; | 193 | yuv = false; |
193 | break; | 194 | break; |
194 | case MIPI_BGR666: | 195 | case MIPI_BGR666: |
195 | pctype = 0xb; | 196 | pctype = 0xb; |
196 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; | 197 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; |
197 | pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; | 198 | pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; |
198 | linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8; | 199 | linelength = (mode->xres * 18 + 7) / 8; |
199 | yuv = false; | 200 | yuv = false; |
200 | break; | 201 | break; |
201 | case MIPI_YUYV: | 202 | case MIPI_YUYV: |
202 | pctype = 4; | 203 | pctype = 4; |
203 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; | 204 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; |
204 | pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; | 205 | pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; |
205 | linelength = ch->lcd_modes[0].xres * 2; | 206 | linelength = mode->xres * 2; |
206 | yuv = true; | 207 | yuv = true; |
207 | break; | 208 | break; |
208 | case MIPI_UYVY: | 209 | case MIPI_UYVY: |
209 | pctype = 5; | 210 | pctype = 5; |
210 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; | 211 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; |
211 | pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; | 212 | pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; |
212 | linelength = ch->lcd_modes[0].xres * 2; | 213 | linelength = mode->xres * 2; |
213 | yuv = true; | 214 | yuv = true; |
214 | break; | 215 | break; |
215 | case MIPI_YUV420_L: | 216 | case MIPI_YUV420_L: |
216 | pctype = 6; | 217 | pctype = 6; |
217 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; | 218 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; |
218 | pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; | 219 | pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; |
219 | linelength = (ch->lcd_modes[0].xres * 12 + 7) / 8; | 220 | linelength = (mode->xres * 12 + 7) / 8; |
220 | yuv = true; | 221 | yuv = true; |
221 | break; | 222 | break; |
222 | case MIPI_YUV420: | 223 | case MIPI_YUV420: |
@@ -224,7 +225,7 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata) | |||
224 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; | 225 | datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; |
225 | pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; | 226 | pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; |
226 | /* Length of U/V line */ | 227 | /* Length of U/V line */ |
227 | linelength = (ch->lcd_modes[0].xres + 1) / 2; | 228 | linelength = (mode->xres + 1) / 2; |
228 | yuv = true; | 229 | yuv = true; |
229 | break; | 230 | break; |
230 | default: | 231 | default: |
@@ -293,7 +294,7 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata) | |||
293 | */ | 294 | */ |
294 | iowrite32(0x00000006, mipi->linkbase + DTCTR); | 295 | iowrite32(0x00000006, mipi->linkbase + DTCTR); |
295 | /* VSYNC width = 2 (<< 17) */ | 296 | /* VSYNC width = 2 (<< 17) */ |
296 | iowrite32((ch->lcd_modes[0].vsync_len << pdata->vsynw_offset) | | 297 | iowrite32((mode->vsync_len << pdata->vsynw_offset) | |
297 | (pdata->clksrc << 16) | (pctype << 12) | datatype, | 298 | (pdata->clksrc << 16) | (pctype << 12) | datatype, |
298 | mipi->linkbase + VMCTR1); | 299 | mipi->linkbase + VMCTR1); |
299 | 300 | ||
@@ -327,7 +328,7 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata) | |||
327 | top = linelength << 16; /* RGBLEN */ | 328 | top = linelength << 16; /* RGBLEN */ |
328 | bottom = 0x00000001; | 329 | bottom = 0x00000001; |
329 | if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */ | 330 | if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */ |
330 | bottom = (pdata->lane * ch->lcd_modes[0].hsync_len) - 10; | 331 | bottom = (pdata->lane * mode->hsync_len) - 10; |
331 | iowrite32(top | bottom , mipi->linkbase + VMLEN1); | 332 | iowrite32(top | bottom , mipi->linkbase + VMLEN1); |
332 | 333 | ||
333 | /* | 334 | /* |
@@ -347,18 +348,18 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata) | |||
347 | div = 2; | 348 | div = 2; |
348 | 349 | ||
349 | if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */ | 350 | if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */ |
350 | top = ch->lcd_modes[0].hsync_len + ch->lcd_modes[0].left_margin; | 351 | top = mode->hsync_len + mode->left_margin; |
351 | top = ((pdata->lane * top / div) - 10) << 16; | 352 | top = ((pdata->lane * top / div) - 10) << 16; |
352 | } | 353 | } |
353 | if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */ | 354 | if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */ |
354 | bottom = ch->lcd_modes[0].right_margin; | 355 | bottom = mode->right_margin; |
355 | bottom = (pdata->lane * bottom / div) - 12; | 356 | bottom = (pdata->lane * bottom / div) - 12; |
356 | } | 357 | } |
357 | 358 | ||
358 | bpp = linelength / ch->lcd_modes[0].xres; /* byte / pixel */ | 359 | bpp = linelength / mode->xres; /* byte / pixel */ |
359 | if ((pdata->lane / div) > bpp) { | 360 | if ((pdata->lane / div) > bpp) { |
360 | tmp = ch->lcd_modes[0].xres / bpp; /* output cycle */ | 361 | tmp = mode->xres / bpp; /* output cycle */ |
361 | tmp = ch->lcd_modes[0].xres - tmp; /* (input - output) cycle */ | 362 | tmp = mode->xres - tmp; /* (input - output) cycle */ |
362 | delay = (pdata->lane * tmp); | 363 | delay = (pdata->lane * tmp); |
363 | } | 364 | } |
364 | 365 | ||
@@ -405,7 +406,7 @@ static int mipi_display_on(struct sh_mobile_lcdc_entity *entity) | |||
405 | if (ret < 0) | 406 | if (ret < 0) |
406 | goto mipi_display_on_fail1; | 407 | goto mipi_display_on_fail1; |
407 | 408 | ||
408 | ret = sh_mipi_setup(mipi, pdata); | 409 | ret = sh_mipi_setup(mipi, &entity->def_mode); |
409 | if (ret < 0) | 410 | if (ret < 0) |
410 | goto mipi_display_on_fail2; | 411 | goto mipi_display_on_fail2; |
411 | 412 | ||