aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c198
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c4
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c6
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c6
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c6
-rw-r--r--arch/sh/boards/mach-kfr2r09/lcd_wqvga.c16
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c7
-rw-r--r--arch/sh/include/mach-kfr2r09/mach/kfr2r09.h6
-rw-r--r--drivers/video/sh_mipi_dsi.c69
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c74
-rw-r--r--drivers/video/sh_mobile_lcdcfb.h1
-rw-r--r--include/video/sh_mipi_dsi.h4
-rw-r--r--include/video/sh_mobile_lcdc.h1
13 files changed, 192 insertions, 206 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 25eb88a923e6..032d10817e79 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -213,95 +213,6 @@ static struct platform_device irda_device = {
213 .num_resources = ARRAY_SIZE(irda_resources), 213 .num_resources = ARRAY_SIZE(irda_resources),
214}; 214};
215 215
216static unsigned char lcd_backlight_seq[3][2] = {
217 { 0x04, 0x07 },
218 { 0x23, 0x80 },
219 { 0x03, 0x01 },
220};
221
222static void lcd_backlight_on(void)
223{
224 struct i2c_adapter *a;
225 struct i2c_msg msg;
226 int k;
227
228 a = i2c_get_adapter(1);
229 for (k = 0; a && k < 3; k++) {
230 msg.addr = 0x6d;
231 msg.buf = &lcd_backlight_seq[k][0];
232 msg.len = 2;
233 msg.flags = 0;
234 if (i2c_transfer(a, &msg, 1) != 1)
235 break;
236 }
237}
238
239static void lcd_backlight_reset(void)
240{
241 gpio_set_value(GPIO_PORT235, 0);
242 mdelay(24);
243 gpio_set_value(GPIO_PORT235, 1);
244}
245
246/* LCDC0 */
247static const struct fb_videomode lcdc0_modes[] = {
248 {
249 .name = "R63302(QHD)",
250 .xres = 544,
251 .yres = 961,
252 .left_margin = 72,
253 .right_margin = 600,
254 .hsync_len = 16,
255 .upper_margin = 8,
256 .lower_margin = 8,
257 .vsync_len = 2,
258 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
259 },
260};
261
262static struct sh_mobile_lcdc_info lcdc0_info = {
263 .clock_source = LCDC_CLK_PERIPHERAL,
264 .ch[0] = {
265 .chan = LCDC_CHAN_MAINLCD,
266 .interface_type = RGB24,
267 .clock_divider = 1,
268 .flags = LCDC_FLAGS_DWPOL,
269 .fourcc = V4L2_PIX_FMT_RGB565,
270 .lcd_modes = lcdc0_modes,
271 .num_modes = ARRAY_SIZE(lcdc0_modes),
272 .panel_cfg = {
273 .width = 44,
274 .height = 79,
275 .display_on = lcd_backlight_on,
276 .display_off = lcd_backlight_reset,
277 },
278 }
279};
280
281static struct resource lcdc0_resources[] = {
282 [0] = {
283 .name = "LCDC0",
284 .start = 0xfe940000, /* P4-only space */
285 .end = 0xfe943fff,
286 .flags = IORESOURCE_MEM,
287 },
288 [1] = {
289 .start = intcs_evt2irq(0x580),
290 .flags = IORESOURCE_IRQ,
291 },
292};
293
294static struct platform_device lcdc0_device = {
295 .name = "sh_mobile_lcdc_fb",
296 .num_resources = ARRAY_SIZE(lcdc0_resources),
297 .resource = lcdc0_resources,
298 .id = 0,
299 .dev = {
300 .platform_data = &lcdc0_info,
301 .coherent_dma_mask = ~0,
302 },
303};
304
305/* MIPI-DSI */ 216/* MIPI-DSI */
306static struct resource mipidsi0_resources[] = { 217static struct resource mipidsi0_resources[] = {
307 [0] = { 218 [0] = {
@@ -358,7 +269,7 @@ sh_mipi_set_dot_clock_pck_err:
358 269
359static struct sh_mipi_dsi_info mipidsi0_info = { 270static struct sh_mipi_dsi_info mipidsi0_info = {
360 .data_format = MIPI_RGB888, 271 .data_format = MIPI_RGB888,
361 .lcd_chan = &lcdc0_info.ch[0], 272 .channel = LCDC_CHAN_MAINLCD,
362 .lane = 2, 273 .lane = 2,
363 .vsynw_offset = 20, 274 .vsynw_offset = 20,
364 .clksrc = 1, 275 .clksrc = 1,
@@ -378,6 +289,109 @@ static struct platform_device mipidsi0_device = {
378 }, 289 },
379}; 290};
380 291
292static unsigned char lcd_backlight_seq[3][2] = {
293 { 0x04, 0x07 },
294 { 0x23, 0x80 },
295 { 0x03, 0x01 },
296};
297
298static int lcd_backlight_set_brightness(int brightness)
299{
300 struct i2c_adapter *adap;
301 struct i2c_msg msg;
302 unsigned int i;
303 int ret;
304
305 if (brightness == 0) {
306 /* Reset the chip */
307 gpio_set_value(GPIO_PORT235, 0);
308 mdelay(24);
309 gpio_set_value(GPIO_PORT235, 1);
310 return 0;
311 }
312
313 adap = i2c_get_adapter(1);
314 if (adap == NULL)
315 return -ENODEV;
316
317 for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) {
318 msg.addr = 0x6d;
319 msg.buf = &lcd_backlight_seq[i][0];
320 msg.len = 2;
321 msg.flags = 0;
322
323 ret = i2c_transfer(adap, &msg, 1);
324 if (ret < 0)
325 break;
326 }
327
328 i2c_put_adapter(adap);
329 return ret < 0 ? ret : 0;
330}
331
332/* LCDC0 */
333static const struct fb_videomode lcdc0_modes[] = {
334 {
335 .name = "R63302(QHD)",
336 .xres = 544,
337 .yres = 961,
338 .left_margin = 72,
339 .right_margin = 600,
340 .hsync_len = 16,
341 .upper_margin = 8,
342 .lower_margin = 8,
343 .vsync_len = 2,
344 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
345 },
346};
347
348static struct sh_mobile_lcdc_info lcdc0_info = {
349 .clock_source = LCDC_CLK_PERIPHERAL,
350 .ch[0] = {
351 .chan = LCDC_CHAN_MAINLCD,
352 .interface_type = RGB24,
353 .clock_divider = 1,
354 .flags = LCDC_FLAGS_DWPOL,
355 .fourcc = V4L2_PIX_FMT_RGB565,
356 .lcd_modes = lcdc0_modes,
357 .num_modes = ARRAY_SIZE(lcdc0_modes),
358 .panel_cfg = {
359 .width = 44,
360 .height = 79,
361 },
362 .bl_info = {
363 .name = "sh_mobile_lcdc_bl",
364 .max_brightness = 1,
365 .set_brightness = lcd_backlight_set_brightness,
366 },
367 .tx_dev = &mipidsi0_device,
368 }
369};
370
371static struct resource lcdc0_resources[] = {
372 [0] = {
373 .name = "LCDC0",
374 .start = 0xfe940000, /* P4-only space */
375 .end = 0xfe943fff,
376 .flags = IORESOURCE_MEM,
377 },
378 [1] = {
379 .start = intcs_evt2irq(0x580),
380 .flags = IORESOURCE_IRQ,
381 },
382};
383
384static struct platform_device lcdc0_device = {
385 .name = "sh_mobile_lcdc_fb",
386 .num_resources = ARRAY_SIZE(lcdc0_resources),
387 .resource = lcdc0_resources,
388 .id = 0,
389 .dev = {
390 .platform_data = &lcdc0_info,
391 .coherent_dma_mask = ~0,
392 },
393};
394
381/* Fixed 2.8V regulators to be used by SDHI0 */ 395/* Fixed 2.8V regulators to be used by SDHI0 */
382static struct regulator_consumer_supply fixed2v8_power_consumers[] = 396static struct regulator_consumer_supply fixed2v8_power_consumers[] =
383{ 397{
@@ -531,8 +545,8 @@ static struct platform_device *ag5evm_devices[] __initdata = {
531 &fsi_device, 545 &fsi_device,
532 &mmc_device, 546 &mmc_device,
533 &irda_device, 547 &irda_device,
534 &lcdc0_device,
535 &mipidsi0_device, 548 &mipidsi0_device,
549 &lcdc0_device,
536 &sdhi0_device, 550 &sdhi0_device,
537 &sdhi1_device, 551 &sdhi1_device,
538}; 552};
@@ -621,7 +635,7 @@ static void __init ag5evm_init(void)
621 /* LCD backlight controller */ 635 /* LCD backlight controller */
622 gpio_request(GPIO_PORT235, NULL); /* RESET */ 636 gpio_request(GPIO_PORT235, NULL); /* RESET */
623 gpio_direction_output(GPIO_PORT235, 0); 637 gpio_direction_output(GPIO_PORT235, 0);
624 lcd_backlight_reset(); 638 lcd_backlight_set_brightness(0);
625 639
626 /* enable SDHI0 on CN15 [SD I/F] */ 640 /* enable SDHI0 on CN15 [SD I/F] */
627 gpio_request(GPIO_FN_SDHIWP0, NULL); 641 gpio_request(GPIO_FN_SDHIWP0, NULL);
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 790dc68c4312..728ed4d026c7 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -552,11 +552,9 @@ static struct resource mipidsi0_resources[] = {
552 }, 552 },
553}; 553};
554 554
555static struct sh_mobile_lcdc_info lcdc_info;
556
557static struct sh_mipi_dsi_info mipidsi0_info = { 555static struct sh_mipi_dsi_info mipidsi0_info = {
558 .data_format = MIPI_RGB888, 556 .data_format = MIPI_RGB888,
559 .lcd_chan = &lcdc_info.ch[0], 557 .channel = LCDC_CHAN_MAINLCD,
560 .lane = 2, 558 .lane = 2,
561 .vsynw_offset = 17, 559 .vsynw_offset = 17,
562 .phyctrl = 0x6 << 8, 560 .phyctrl = 0x6 << 8,
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 0c27c810cf99..bfd2dc83d995 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -370,11 +370,6 @@ static int mackerel_set_brightness(int brightness)
370 return 0; 370 return 0;
371} 371}
372 372
373static int mackerel_get_brightness(void)
374{
375 return gpio_get_value(GPIO_PORT31);
376}
377
378static const struct sh_mobile_meram_cfg lcd_meram_cfg = { 373static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
379 .icb[0] = { 374 .icb[0] = {
380 .meram_size = 0x40, 375 .meram_size = 0x40,
@@ -403,7 +398,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
403 .name = "sh_mobile_lcdc_bl", 398 .name = "sh_mobile_lcdc_bl",
404 .max_brightness = 1, 399 .max_brightness = 1,
405 .set_brightness = mackerel_set_brightness, 400 .set_brightness = mackerel_set_brightness,
406 .get_brightness = mackerel_get_brightness,
407 }, 401 },
408 .meram_cfg = &lcd_meram_cfg, 402 .meram_cfg = &lcd_meram_cfg,
409 } 403 }
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 9e963c1d1447..5620e33c18a0 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -179,11 +179,6 @@ static int ap320_wvga_set_brightness(int brightness)
179 return 0; 179 return 0;
180} 180}
181 181
182static int ap320_wvga_get_brightness(void)
183{
184 return gpio_get_value(GPIO_PTS3);
185}
186
187static void ap320_wvga_power_on(void) 182static void ap320_wvga_power_on(void)
188{ 183{
189 msleep(100); 184 msleep(100);
@@ -232,7 +227,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
232 .name = "sh_mobile_lcdc_bl", 227 .name = "sh_mobile_lcdc_bl",
233 .max_brightness = 1, 228 .max_brightness = 1,
234 .set_brightness = ap320_wvga_set_brightness, 229 .set_brightness = ap320_wvga_set_brightness,
235 .get_brightness = ap320_wvga_get_brightness,
236 }, 230 },
237 } 231 }
238}; 232};
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 64559e8af14b..3fede4556c91 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -329,11 +329,6 @@ static int ecovec24_set_brightness(int brightness)
329 return 0; 329 return 0;
330} 330}
331 331
332static int ecovec24_get_brightness(void)
333{
334 return gpio_get_value(GPIO_PTR1);
335}
336
337static struct sh_mobile_lcdc_info lcdc_info = { 332static struct sh_mobile_lcdc_info lcdc_info = {
338 .ch[0] = { 333 .ch[0] = {
339 .interface_type = RGB18, 334 .interface_type = RGB18,
@@ -347,7 +342,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
347 .name = "sh_mobile_lcdc_bl", 342 .name = "sh_mobile_lcdc_bl",
348 .max_brightness = 1, 343 .max_brightness = 1,
349 .set_brightness = ecovec24_set_brightness, 344 .set_brightness = ecovec24_set_brightness,
350 .get_brightness = ecovec24_get_brightness,
351 }, 345 },
352 } 346 }
353}; 347};
diff --git a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
index c148b36ecb65..c62050332629 100644
--- a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
+++ b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
@@ -283,7 +283,7 @@ void kfr2r09_lcd_start(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
283#define MAIN_MLED4 0x40 283#define MAIN_MLED4 0x40
284#define MAIN_MSW 0x80 284#define MAIN_MSW 0x80
285 285
286static int kfr2r09_lcd_backlight(int on) 286int kfr2r09_lcd_set_brightness(int brightness)
287{ 287{
288 struct i2c_adapter *a; 288 struct i2c_adapter *a;
289 struct i2c_msg msg; 289 struct i2c_msg msg;
@@ -295,7 +295,7 @@ static int kfr2r09_lcd_backlight(int on)
295 return -ENODEV; 295 return -ENODEV;
296 296
297 buf[0] = 0x00; 297 buf[0] = 0x00;
298 if (on) 298 if (brightness)
299 buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW; 299 buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW;
300 else 300 else
301 buf[1] = 0; 301 buf[1] = 0;
@@ -309,7 +309,7 @@ static int kfr2r09_lcd_backlight(int on)
309 return -ENODEV; 309 return -ENODEV;
310 310
311 buf[0] = 0x01; 311 buf[0] = 0x01;
312 if (on) 312 if (brightness)
313 buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c; 313 buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c;
314 else 314 else
315 buf[1] = 0; 315 buf[1] = 0;
@@ -324,13 +324,3 @@ static int kfr2r09_lcd_backlight(int on)
324 324
325 return 0; 325 return 0;
326} 326}
327
328void kfr2r09_lcd_on(void)
329{
330 kfr2r09_lcd_backlight(1);
331}
332
333void kfr2r09_lcd_off(void)
334{
335 kfr2r09_lcd_backlight(0);
336}
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index f2a4304fbe23..ab502f12ef57 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -158,8 +158,11 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
158 .height = 58, 158 .height = 58,
159 .setup_sys = kfr2r09_lcd_setup, 159 .setup_sys = kfr2r09_lcd_setup,
160 .start_transfer = kfr2r09_lcd_start, 160 .start_transfer = kfr2r09_lcd_start,
161 .display_on = kfr2r09_lcd_on, 161 },
162 .display_off = kfr2r09_lcd_off, 162 .bl_info = {
163 .name = "sh_mobile_lcdc_bl",
164 .max_brightness = 1,
165 .set_brightness = kfr2r09_lcd_set_brightness,
163 }, 166 },
164 .sys_bus_cfg = { 167 .sys_bus_cfg = {
165 .ldmt2r = 0x07010904, 168 .ldmt2r = 0x07010904,
diff --git a/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
index ba3d93d333f8..c20c9e5f5eab 100644
--- a/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
+++ b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
@@ -4,15 +4,13 @@
4#include <video/sh_mobile_lcdc.h> 4#include <video/sh_mobile_lcdc.h>
5 5
6#if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE) 6#if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE)
7void kfr2r09_lcd_on(void); 7int kfr2r09_lcd_set_brightness(int brightness);
8void kfr2r09_lcd_off(void);
9int kfr2r09_lcd_setup(void *sys_ops_handle, 8int kfr2r09_lcd_setup(void *sys_ops_handle,
10 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 9 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
11void kfr2r09_lcd_start(void *sys_ops_handle, 10void kfr2r09_lcd_start(void *sys_ops_handle,
12 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 11 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
13#else 12#else
14static void kfr2r09_lcd_on(void) {} 13static int kfr2r09_lcd_set_brightness(int brightness) {}
15static void kfr2r09_lcd_off(void) {}
16static int kfr2r09_lcd_setup(void *sys_ops_handle, 14static int kfr2r09_lcd_setup(void *sys_ops_handle,
17 struct sh_mobile_lcdc_sys_bus_ops *sys_ops) 15 struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
18{ 16{
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index 3951fdae5f68..f4962292792c 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -127,13 +127,12 @@ 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
130static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata) 130static 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_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan; 133 struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
134 u32 pctype, datatype, pixfmt, linelength, vmctr2; 134 u32 pctype, datatype, pixfmt, linelength, vmctr2;
135 u32 tmp, top, bottom, delay, div; 135 u32 tmp, top, bottom, delay, div;
136 bool yuv;
137 int bpp; 136 int bpp;
138 137
139 /* 138 /*
@@ -146,95 +145,79 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
146 pctype = 0; 145 pctype = 0;
147 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; 146 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24;
148 pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; 147 pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
149 linelength = ch->lcd_modes[0].xres * 3; 148 linelength = mode->xres * 3;
150 yuv = false;
151 break; 149 break;
152 case MIPI_RGB565: 150 case MIPI_RGB565:
153 pctype = 1; 151 pctype = 1;
154 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; 152 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16;
155 pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; 153 pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
156 linelength = ch->lcd_modes[0].xres * 2; 154 linelength = mode->xres * 2;
157 yuv = false;
158 break; 155 break;
159 case MIPI_RGB666_LP: 156 case MIPI_RGB666_LP:
160 pctype = 2; 157 pctype = 2;
161 datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; 158 datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
162 pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; 159 pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
163 linelength = ch->lcd_modes[0].xres * 3; 160 linelength = mode->xres * 3;
164 yuv = false;
165 break; 161 break;
166 case MIPI_RGB666: 162 case MIPI_RGB666:
167 pctype = 3; 163 pctype = 3;
168 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; 164 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18;
169 pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; 165 pixfmt = MIPI_DCS_PIXEL_FMT_18BIT;
170 linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8; 166 linelength = (mode->xres * 18 + 7) / 8;
171 yuv = false;
172 break; 167 break;
173 case MIPI_BGR888: 168 case MIPI_BGR888:
174 pctype = 8; 169 pctype = 8;
175 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24; 170 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24;
176 pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; 171 pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
177 linelength = ch->lcd_modes[0].xres * 3; 172 linelength = mode->xres * 3;
178 yuv = false;
179 break; 173 break;
180 case MIPI_BGR565: 174 case MIPI_BGR565:
181 pctype = 9; 175 pctype = 9;
182 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16; 176 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16;
183 pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; 177 pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
184 linelength = ch->lcd_modes[0].xres * 2; 178 linelength = mode->xres * 2;
185 yuv = false;
186 break; 179 break;
187 case MIPI_BGR666_LP: 180 case MIPI_BGR666_LP:
188 pctype = 0xa; 181 pctype = 0xa;
189 datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18; 182 datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
190 pixfmt = MIPI_DCS_PIXEL_FMT_24BIT; 183 pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
191 linelength = ch->lcd_modes[0].xres * 3; 184 linelength = mode->xres * 3;
192 yuv = false;
193 break; 185 break;
194 case MIPI_BGR666: 186 case MIPI_BGR666:
195 pctype = 0xb; 187 pctype = 0xb;
196 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18; 188 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18;
197 pixfmt = MIPI_DCS_PIXEL_FMT_18BIT; 189 pixfmt = MIPI_DCS_PIXEL_FMT_18BIT;
198 linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8; 190 linelength = (mode->xres * 18 + 7) / 8;
199 yuv = false;
200 break; 191 break;
201 case MIPI_YUYV: 192 case MIPI_YUYV:
202 pctype = 4; 193 pctype = 4;
203 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; 194 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16;
204 pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; 195 pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
205 linelength = ch->lcd_modes[0].xres * 2; 196 linelength = mode->xres * 2;
206 yuv = true;
207 break; 197 break;
208 case MIPI_UYVY: 198 case MIPI_UYVY:
209 pctype = 5; 199 pctype = 5;
210 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16; 200 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16;
211 pixfmt = MIPI_DCS_PIXEL_FMT_16BIT; 201 pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
212 linelength = ch->lcd_modes[0].xres * 2; 202 linelength = mode->xres * 2;
213 yuv = true;
214 break; 203 break;
215 case MIPI_YUV420_L: 204 case MIPI_YUV420_L:
216 pctype = 6; 205 pctype = 6;
217 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; 206 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12;
218 pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; 207 pixfmt = MIPI_DCS_PIXEL_FMT_12BIT;
219 linelength = (ch->lcd_modes[0].xres * 12 + 7) / 8; 208 linelength = (mode->xres * 12 + 7) / 8;
220 yuv = true;
221 break; 209 break;
222 case MIPI_YUV420: 210 case MIPI_YUV420:
223 pctype = 7; 211 pctype = 7;
224 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12; 212 datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12;
225 pixfmt = MIPI_DCS_PIXEL_FMT_12BIT; 213 pixfmt = MIPI_DCS_PIXEL_FMT_12BIT;
226 /* Length of U/V line */ 214 /* Length of U/V line */
227 linelength = (ch->lcd_modes[0].xres + 1) / 2; 215 linelength = (mode->xres + 1) / 2;
228 yuv = true;
229 break; 216 break;
230 default: 217 default:
231 return -EINVAL; 218 return -EINVAL;
232 } 219 }
233 220
234 if ((yuv && ch->interface_type != YUV422) ||
235 (!yuv && ch->interface_type != RGB24))
236 return -EINVAL;
237
238 if (!pdata->lane) 221 if (!pdata->lane)
239 return -EINVAL; 222 return -EINVAL;
240 223
@@ -293,7 +276,7 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
293 */ 276 */
294 iowrite32(0x00000006, mipi->linkbase + DTCTR); 277 iowrite32(0x00000006, mipi->linkbase + DTCTR);
295 /* VSYNC width = 2 (<< 17) */ 278 /* VSYNC width = 2 (<< 17) */
296 iowrite32((ch->lcd_modes[0].vsync_len << pdata->vsynw_offset) | 279 iowrite32((mode->vsync_len << pdata->vsynw_offset) |
297 (pdata->clksrc << 16) | (pctype << 12) | datatype, 280 (pdata->clksrc << 16) | (pctype << 12) | datatype,
298 mipi->linkbase + VMCTR1); 281 mipi->linkbase + VMCTR1);
299 282
@@ -327,7 +310,7 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
327 top = linelength << 16; /* RGBLEN */ 310 top = linelength << 16; /* RGBLEN */
328 bottom = 0x00000001; 311 bottom = 0x00000001;
329 if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */ 312 if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */
330 bottom = (pdata->lane * ch->lcd_modes[0].hsync_len) - 10; 313 bottom = (pdata->lane * mode->hsync_len) - 10;
331 iowrite32(top | bottom , mipi->linkbase + VMLEN1); 314 iowrite32(top | bottom , mipi->linkbase + VMLEN1);
332 315
333 /* 316 /*
@@ -347,18 +330,18 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
347 div = 2; 330 div = 2;
348 331
349 if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */ 332 if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */
350 top = ch->lcd_modes[0].hsync_len + ch->lcd_modes[0].left_margin; 333 top = mode->hsync_len + mode->left_margin;
351 top = ((pdata->lane * top / div) - 10) << 16; 334 top = ((pdata->lane * top / div) - 10) << 16;
352 } 335 }
353 if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */ 336 if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */
354 bottom = ch->lcd_modes[0].right_margin; 337 bottom = mode->right_margin;
355 bottom = (pdata->lane * bottom / div) - 12; 338 bottom = (pdata->lane * bottom / div) - 12;
356 } 339 }
357 340
358 bpp = linelength / ch->lcd_modes[0].xres; /* byte / pixel */ 341 bpp = linelength / mode->xres; /* byte / pixel */
359 if ((pdata->lane / div) > bpp) { 342 if ((pdata->lane / div) > bpp) {
360 tmp = ch->lcd_modes[0].xres / bpp; /* output cycle */ 343 tmp = mode->xres / bpp; /* output cycle */
361 tmp = ch->lcd_modes[0].xres - tmp; /* (input - output) cycle */ 344 tmp = mode->xres - tmp; /* (input - output) cycle */
362 delay = (pdata->lane * tmp); 345 delay = (pdata->lane * tmp);
363 } 346 }
364 347
@@ -369,7 +352,7 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
369 /* setup LCD panel */ 352 /* setup LCD panel */
370 353
371 /* cf. drivers/video/omap/lcd_mipid.c */ 354 /* cf. drivers/video/omap/lcd_mipid.c */
372 sh_mipi_dcs(ch->chan, MIPI_DCS_EXIT_SLEEP_MODE); 355 sh_mipi_dcs(pdata->channel, MIPI_DCS_EXIT_SLEEP_MODE);
373 msleep(120); 356 msleep(120);
374 /* 357 /*
375 * [7] - Page Address Mode 358 * [7] - Page Address Mode
@@ -381,11 +364,11 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
381 * [1] - Flip Horizontal 364 * [1] - Flip Horizontal
382 * [0] - Flip Vertical 365 * [0] - Flip Vertical
383 */ 366 */
384 sh_mipi_dcs_param(ch->chan, MIPI_DCS_SET_ADDRESS_MODE, 0x00); 367 sh_mipi_dcs_param(pdata->channel, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
385 /* cf. set_data_lines() */ 368 /* cf. set_data_lines() */
386 sh_mipi_dcs_param(ch->chan, MIPI_DCS_SET_PIXEL_FORMAT, 369 sh_mipi_dcs_param(pdata->channel, MIPI_DCS_SET_PIXEL_FORMAT,
387 pixfmt << 4); 370 pixfmt << 4);
388 sh_mipi_dcs(ch->chan, MIPI_DCS_SET_DISPLAY_ON); 371 sh_mipi_dcs(pdata->channel, MIPI_DCS_SET_DISPLAY_ON);
389 372
390 /* Enable timeout counters */ 373 /* Enable timeout counters */
391 iowrite32(0x00000f00, base + DSICTRL); 374 iowrite32(0x00000f00, base + DSICTRL);
@@ -405,7 +388,7 @@ static int mipi_display_on(struct sh_mobile_lcdc_entity *entity)
405 if (ret < 0) 388 if (ret < 0)
406 goto mipi_display_on_fail1; 389 goto mipi_display_on_fail1;
407 390
408 ret = sh_mipi_setup(mipi, pdata); 391 ret = sh_mipi_setup(mipi, &entity->def_mode);
409 if (ret < 0) 392 if (ret < 0)
410 goto mipi_display_on_fail2; 393 goto mipi_display_on_fail2;
411 394
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 699487c287b2..e78fe4bc1524 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -438,7 +438,7 @@ static unsigned long lcdc_sys_read_data(void *handle)
438 return lcdc_read(ch->lcdc, _LDDRDR) & LDDRDR_DRD_MASK; 438 return lcdc_read(ch->lcdc, _LDDRDR) & LDDRDR_DRD_MASK;
439} 439}
440 440
441struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = { 441static struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
442 lcdc_sys_write_index, 442 lcdc_sys_write_index,
443 lcdc_sys_write_data, 443 lcdc_sys_write_data,
444 lcdc_sys_read_data, 444 lcdc_sys_read_data,
@@ -586,8 +586,8 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
586 * Just turn on, if we run a resume here, the 586 * Just turn on, if we run a resume here, the
587 * logo disappears. 587 * logo disappears.
588 */ 588 */
589 info->var.width = monspec->max_x * 10; 589 info->var.width = ch->display.width;
590 info->var.height = monspec->max_y * 10; 590 info->var.height = ch->display.height;
591 sh_mobile_lcdc_display_on(ch); 591 sh_mobile_lcdc_display_on(ch);
592 } else { 592 } else {
593 /* New monitor or have to wake up */ 593 /* New monitor or have to wake up */
@@ -1614,6 +1614,15 @@ static int sh_mobile_lcdc_overlay_blank(int blank, struct fb_info *info)
1614 return 1; 1614 return 1;
1615} 1615}
1616 1616
1617static int
1618sh_mobile_lcdc_overlay_mmap(struct fb_info *info, struct vm_area_struct *vma)
1619{
1620 struct sh_mobile_lcdc_overlay *ovl = info->par;
1621
1622 return dma_mmap_coherent(ovl->channel->lcdc->dev, vma, ovl->fb_mem,
1623 ovl->dma_handle, ovl->fb_size);
1624}
1625
1617static struct fb_ops sh_mobile_lcdc_overlay_ops = { 1626static struct fb_ops sh_mobile_lcdc_overlay_ops = {
1618 .owner = THIS_MODULE, 1627 .owner = THIS_MODULE,
1619 .fb_read = fb_sys_read, 1628 .fb_read = fb_sys_read,
@@ -1626,6 +1635,7 @@ static struct fb_ops sh_mobile_lcdc_overlay_ops = {
1626 .fb_ioctl = sh_mobile_lcdc_overlay_ioctl, 1635 .fb_ioctl = sh_mobile_lcdc_overlay_ioctl,
1627 .fb_check_var = sh_mobile_lcdc_overlay_check_var, 1636 .fb_check_var = sh_mobile_lcdc_overlay_check_var,
1628 .fb_set_par = sh_mobile_lcdc_overlay_set_par, 1637 .fb_set_par = sh_mobile_lcdc_overlay_set_par,
1638 .fb_mmap = sh_mobile_lcdc_overlay_mmap,
1629}; 1639};
1630 1640
1631static void 1641static void
@@ -2093,6 +2103,15 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
2093 return 0; 2103 return 0;
2094} 2104}
2095 2105
2106static int
2107sh_mobile_lcdc_mmap(struct fb_info *info, struct vm_area_struct *vma)
2108{
2109 struct sh_mobile_lcdc_chan *ch = info->par;
2110
2111 return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
2112 ch->dma_handle, ch->fb_size);
2113}
2114
2096static struct fb_ops sh_mobile_lcdc_ops = { 2115static struct fb_ops sh_mobile_lcdc_ops = {
2097 .owner = THIS_MODULE, 2116 .owner = THIS_MODULE,
2098 .fb_setcolreg = sh_mobile_lcdc_setcolreg, 2117 .fb_setcolreg = sh_mobile_lcdc_setcolreg,
@@ -2108,6 +2127,7 @@ static struct fb_ops sh_mobile_lcdc_ops = {
2108 .fb_release = sh_mobile_lcdc_release, 2127 .fb_release = sh_mobile_lcdc_release,
2109 .fb_check_var = sh_mobile_lcdc_check_var, 2128 .fb_check_var = sh_mobile_lcdc_check_var,
2110 .fb_set_par = sh_mobile_lcdc_set_par, 2129 .fb_set_par = sh_mobile_lcdc_set_par,
2130 .fb_mmap = sh_mobile_lcdc_mmap,
2111}; 2131};
2112 2132
2113static void 2133static void
@@ -2167,7 +2187,7 @@ sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch)
2167 2187
2168static int __devinit 2188static int __devinit
2169sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch, 2189sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
2170 const struct fb_videomode *mode, 2190 const struct fb_videomode *modes,
2171 unsigned int num_modes) 2191 unsigned int num_modes)
2172{ 2192{
2173 struct sh_mobile_lcdc_priv *priv = ch->lcdc; 2193 struct sh_mobile_lcdc_priv *priv = ch->lcdc;
@@ -2193,7 +2213,7 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
2193 info->pseudo_palette = &ch->pseudo_palette; 2213 info->pseudo_palette = &ch->pseudo_palette;
2194 info->par = ch; 2214 info->par = ch;
2195 2215
2196 fb_videomode_to_modelist(mode, num_modes, &info->modelist); 2216 fb_videomode_to_modelist(modes, num_modes, &info->modelist);
2197 2217
2198 ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0); 2218 ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
2199 if (ret < 0) { 2219 if (ret < 0) {
@@ -2227,9 +2247,9 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
2227 * default. 2247 * default.
2228 */ 2248 */
2229 var = &info->var; 2249 var = &info->var;
2230 fb_videomode_to_var(var, mode); 2250 fb_videomode_to_var(var, modes);
2231 var->width = ch->cfg->panel_cfg.width; 2251 var->width = ch->display.width;
2232 var->height = ch->cfg->panel_cfg.height; 2252 var->height = ch->display.height;
2233 var->xres_virtual = ch->xres_virtual; 2253 var->xres_virtual = ch->xres_virtual;
2234 var->yres_virtual = ch->yres_virtual; 2254 var->yres_virtual = ch->yres_virtual;
2235 var->activate = FB_ACTIVATE_NOW; 2255 var->activate = FB_ACTIVATE_NOW;
@@ -2262,6 +2282,7 @@ static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
2262 bdev->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) 2282 bdev->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
2263 brightness = 0; 2283 brightness = 0;
2264 2284
2285 ch->bl_brightness = brightness;
2265 return ch->cfg->bl_info.set_brightness(brightness); 2286 return ch->cfg->bl_info.set_brightness(brightness);
2266} 2287}
2267 2288
@@ -2269,7 +2290,7 @@ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
2269{ 2290{
2270 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev); 2291 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
2271 2292
2272 return ch->cfg->bl_info.get_brightness(); 2293 return ch->bl_brightness;
2273} 2294}
2274 2295
2275static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev, 2296static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev,
@@ -2516,10 +2537,10 @@ static int __devinit sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *
2516} 2537}
2517 2538
2518static int __devinit 2539static int __devinit
2519sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv, 2540sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl)
2520 struct sh_mobile_lcdc_overlay *ovl)
2521{ 2541{
2522 const struct sh_mobile_lcdc_format_info *format; 2542 const struct sh_mobile_lcdc_format_info *format;
2543 struct device *dev = ovl->channel->lcdc->dev;
2523 int ret; 2544 int ret;
2524 2545
2525 if (ovl->cfg->fourcc == 0) 2546 if (ovl->cfg->fourcc == 0)
@@ -2528,7 +2549,7 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
2528 /* Validate the format. */ 2549 /* Validate the format. */
2529 format = sh_mobile_format_info(ovl->cfg->fourcc); 2550 format = sh_mobile_format_info(ovl->cfg->fourcc);
2530 if (format == NULL) { 2551 if (format == NULL) {
2531 dev_err(priv->dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc); 2552 dev_err(dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc);
2532 return -EINVAL; 2553 return -EINVAL;
2533 } 2554 }
2534 2555
@@ -2556,10 +2577,10 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
2556 /* Allocate frame buffer memory. */ 2577 /* Allocate frame buffer memory. */
2557 ovl->fb_size = ovl->cfg->max_xres * ovl->cfg->max_yres 2578 ovl->fb_size = ovl->cfg->max_xres * ovl->cfg->max_yres
2558 * format->bpp / 8 * 2; 2579 * format->bpp / 8 * 2;
2559 ovl->fb_mem = dma_alloc_coherent(priv->dev, ovl->fb_size, 2580 ovl->fb_mem = dma_alloc_coherent(dev, ovl->fb_size, &ovl->dma_handle,
2560 &ovl->dma_handle, GFP_KERNEL); 2581 GFP_KERNEL);
2561 if (!ovl->fb_mem) { 2582 if (!ovl->fb_mem) {
2562 dev_err(priv->dev, "unable to allocate buffer\n"); 2583 dev_err(dev, "unable to allocate buffer\n");
2563 return -ENOMEM; 2584 return -ENOMEM;
2564 } 2585 }
2565 2586
@@ -2571,11 +2592,11 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
2571} 2592}
2572 2593
2573static int __devinit 2594static int __devinit
2574sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, 2595sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch)
2575 struct sh_mobile_lcdc_chan *ch)
2576{ 2596{
2577 const struct sh_mobile_lcdc_format_info *format; 2597 const struct sh_mobile_lcdc_format_info *format;
2578 const struct sh_mobile_lcdc_chan_cfg *cfg = ch->cfg; 2598 const struct sh_mobile_lcdc_chan_cfg *cfg = ch->cfg;
2599 struct device *dev = ch->lcdc->dev;
2579 const struct fb_videomode *max_mode; 2600 const struct fb_videomode *max_mode;
2580 const struct fb_videomode *mode; 2601 const struct fb_videomode *mode;
2581 unsigned int num_modes; 2602 unsigned int num_modes;
@@ -2588,7 +2609,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
2588 /* Validate the format. */ 2609 /* Validate the format. */
2589 format = sh_mobile_format_info(cfg->fourcc); 2610 format = sh_mobile_format_info(cfg->fourcc);
2590 if (format == NULL) { 2611 if (format == NULL) {
2591 dev_err(priv->dev, "Invalid FOURCC %08x.\n", cfg->fourcc); 2612 dev_err(dev, "Invalid FOURCC %08x.\n", cfg->fourcc);
2592 return -EINVAL; 2613 return -EINVAL;
2593 } 2614 }
2594 2615
@@ -2604,7 +2625,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
2604 /* NV12/NV21 buffers must have even number of lines */ 2625 /* NV12/NV21 buffers must have even number of lines */
2605 if ((cfg->fourcc == V4L2_PIX_FMT_NV12 || 2626 if ((cfg->fourcc == V4L2_PIX_FMT_NV12 ||
2606 cfg->fourcc == V4L2_PIX_FMT_NV21) && (mode->yres & 0x1)) { 2627 cfg->fourcc == V4L2_PIX_FMT_NV21) && (mode->yres & 0x1)) {
2607 dev_err(priv->dev, "yres must be multiple of 2 for " 2628 dev_err(dev, "yres must be multiple of 2 for "
2608 "YCbCr420 mode.\n"); 2629 "YCbCr420 mode.\n");
2609 return -EINVAL; 2630 return -EINVAL;
2610 } 2631 }
@@ -2618,7 +2639,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
2618 if (!max_size) 2639 if (!max_size)
2619 max_size = MAX_XRES * MAX_YRES; 2640 max_size = MAX_XRES * MAX_YRES;
2620 else 2641 else
2621 dev_dbg(priv->dev, "Found largest videomode %ux%u\n", 2642 dev_dbg(dev, "Found largest videomode %ux%u\n",
2622 max_mode->xres, max_mode->yres); 2643 max_mode->xres, max_mode->yres);
2623 2644
2624 if (cfg->lcd_modes == NULL) { 2645 if (cfg->lcd_modes == NULL) {
@@ -2652,10 +2673,10 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
2652 2673
2653 /* Allocate frame buffer memory. */ 2674 /* Allocate frame buffer memory. */
2654 ch->fb_size = max_size * format->bpp / 8 * 2; 2675 ch->fb_size = max_size * format->bpp / 8 * 2;
2655 ch->fb_mem = dma_alloc_coherent(priv->dev, ch->fb_size, &ch->dma_handle, 2676 ch->fb_mem = dma_alloc_coherent(dev, ch->fb_size, &ch->dma_handle,
2656 GFP_KERNEL); 2677 GFP_KERNEL);
2657 if (ch->fb_mem == NULL) { 2678 if (ch->fb_mem == NULL) {
2658 dev_err(priv->dev, "unable to allocate buffer\n"); 2679 dev_err(dev, "unable to allocate buffer\n");
2659 return -ENOMEM; 2680 return -ENOMEM;
2660 } 2681 }
2661 2682
@@ -2663,8 +2684,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
2663 if (cfg->tx_dev) { 2684 if (cfg->tx_dev) {
2664 if (!cfg->tx_dev->dev.driver || 2685 if (!cfg->tx_dev->dev.driver ||
2665 !try_module_get(cfg->tx_dev->dev.driver->owner)) { 2686 !try_module_get(cfg->tx_dev->dev.driver->owner)) {
2666 dev_warn(priv->dev, 2687 dev_warn(dev, "unable to get transmitter device\n");
2667 "unable to get transmitter device\n");
2668 return -EINVAL; 2688 return -EINVAL;
2669 } 2689 }
2670 ch->tx_dev = platform_get_drvdata(cfg->tx_dev); 2690 ch->tx_dev = platform_get_drvdata(cfg->tx_dev);
@@ -2772,9 +2792,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
2772 pm_runtime_enable(&pdev->dev); 2792 pm_runtime_enable(&pdev->dev);
2773 2793
2774 for (i = 0; i < num_channels; i++) { 2794 for (i = 0; i < num_channels; i++) {
2775 struct sh_mobile_lcdc_chan *ch = priv->ch + i; 2795 struct sh_mobile_lcdc_chan *ch = &priv->ch[i];
2776 2796
2777 error = sh_mobile_lcdc_channel_init(priv, ch); 2797 error = sh_mobile_lcdc_channel_init(ch);
2778 if (error) 2798 if (error)
2779 goto err1; 2799 goto err1;
2780 } 2800 }
@@ -2785,7 +2805,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
2785 ovl->cfg = &pdata->overlays[i]; 2805 ovl->cfg = &pdata->overlays[i];
2786 ovl->channel = &priv->ch[0]; 2806 ovl->channel = &priv->ch[0];
2787 2807
2788 error = sh_mobile_lcdc_overlay_init(priv, ovl); 2808 error = sh_mobile_lcdc_overlay_init(ovl);
2789 if (error) 2809 if (error)
2790 goto err1; 2810 goto err1;
2791 } 2811 }
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h
index 0f92f6544b94..f839adef1d90 100644
--- a/drivers/video/sh_mobile_lcdcfb.h
+++ b/drivers/video/sh_mobile_lcdcfb.h
@@ -94,6 +94,7 @@ struct sh_mobile_lcdc_chan {
94 94
95 /* Backlight */ 95 /* Backlight */
96 struct backlight_device *bl; 96 struct backlight_device *bl;
97 unsigned int bl_brightness;
97 98
98 /* FB */ 99 /* FB */
99 struct fb_info *info; 100 struct fb_info *info;
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
index 06c67fbc4eee..a01f197e6ac1 100644
--- a/include/video/sh_mipi_dsi.h
+++ b/include/video/sh_mipi_dsi.h
@@ -25,8 +25,6 @@ enum sh_mipi_dsi_data_fmt {
25 MIPI_YUV420, 25 MIPI_YUV420,
26}; 26};
27 27
28struct sh_mobile_lcdc_chan_cfg;
29
30#define SH_MIPI_DSI_HSABM (1 << 0) 28#define SH_MIPI_DSI_HSABM (1 << 0)
31#define SH_MIPI_DSI_HBPBM (1 << 1) 29#define SH_MIPI_DSI_HBPBM (1 << 1)
32#define SH_MIPI_DSI_HFPBM (1 << 2) 30#define SH_MIPI_DSI_HFPBM (1 << 2)
@@ -47,7 +45,7 @@ struct sh_mobile_lcdc_chan_cfg;
47 45
48struct sh_mipi_dsi_info { 46struct sh_mipi_dsi_info {
49 enum sh_mipi_dsi_data_fmt data_format; 47 enum sh_mipi_dsi_data_fmt data_format;
50 struct sh_mobile_lcdc_chan_cfg *lcd_chan; 48 int channel;
51 int lane; 49 int lane;
52 unsigned long flags; 50 unsigned long flags;
53 u32 clksrc; 51 u32 clksrc;
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index ff43ffc1aab2..2605fa8adb9c 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -163,7 +163,6 @@ struct sh_mobile_lcdc_bl_info {
163 const char *name; 163 const char *name;
164 int max_brightness; 164 int max_brightness;
165 int (*set_brightness)(int brightness); 165 int (*set_brightness)(int brightness);
166 int (*get_brightness)(void);
167}; 166};
168 167
169struct sh_mobile_lcdc_overlay_cfg { 168struct sh_mobile_lcdc_overlay_cfg {