1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
|
/*
* Copyright (C) ST-Ericsson AB 2010
*
* Author: Marcus Lorentzon <marcus.xm.lorentzon@stericsson.com>
* for ST-Ericsson.
*
* License terms: GNU General Public License (GPL), version 2.
*/
#include <linux/platform_device.h>
#include <linux/kernel.h>
#include <linux/gpio.h>
#include <linux/mfd/ab8500/denc.h>
#include <linux/workqueue.h>
#include <linux/dispdev.h>
#include <asm/mach-types.h>
#include <video/av8100.h>
#include <video/mcde_display.h>
#include <video/mcde_display-generic_dsi.h>
#include <video/mcde_display-vuib500-dpi.h>
#include <video/mcde_display-av8100.h>
#include <video/mcde_display-ab8500.h>
#include <video/mcde_fb.h>
#include <video/mcde_dss.h>
#include <plat/pincfg.h>
#include "pins-db8500.h"
#include "pins.h"
#include "board-mop500.h"
#define DSI_UNIT_INTERVAL_0 0x9
#define DSI_UNIT_INTERVAL_1 0x9
#define DSI_UNIT_INTERVAL_2 0x5
#ifdef CONFIG_FB_MCDE
/* The initialization of hdmi disp driver must be delayed in order to
* ensure that inputclk will be available (needed by hdmi hw) */
#ifdef CONFIG_DISPLAY_AV8100_TERTIARY
static struct delayed_work work_dispreg_hdmi;
#define DISPREG_HDMI_DELAY 6000
#endif
enum {
#ifdef CONFIG_DISPLAY_GENERIC_DSI_PRIMARY
PRIMARY_DISPLAY_ID,
#endif
#ifdef CONFIG_DISPLAY_GENERIC_DSI_SECONDARY
SECONDARY_DISPLAY_ID,
#endif
#ifdef CONFIG_DISPLAY_FICTIVE
FICTIVE_DISPLAY_ID,
#endif
#ifdef CONFIG_DISPLAY_AV8100_TERTIARY
AV8100_DISPLAY_ID,
#endif
#ifdef CONFIG_DISPLAY_AB8500_TERTIARY
AB8500_DISPLAY_ID,
#endif
MCDE_NR_OF_DISPLAYS
};
static int display_initialized_during_boot;
static int __init startup_graphics_setup(char *str)
{
if (get_option(&str, &display_initialized_during_boot) != 1)
display_initialized_during_boot = 0;
switch (display_initialized_during_boot) {
case 1:
pr_info("Startup graphics support\n");
break;
case 0:
default:
pr_info("No startup graphics supported\n");
break;
};
return 1;
}
__setup("startup_graphics=", startup_graphics_setup);
#if defined(CONFIG_DISPLAY_AB8500_TERTIARY) ||\
defined(CONFIG_DISPLAY_AV8100_TERTIARY)
static struct mcde_col_transform rgb_2_yCbCr_transform = {
.matrix = {
{0x0042, 0x0081, 0x0019},
{0xffda, 0xffb6, 0x0070},
{0x0070, 0xffa2, 0xffee},
},
.offset = {0x10, 0x80, 0x80},
};
#endif
#ifdef CONFIG_DISPLAY_FICTIVE
static struct mcde_display_device fictive_display = {
.name = "mcde_disp_fictive",
.id = FICTIVE_DISPLAY_ID,
.fictive = true,
.default_pixel_format = MCDE_OVLYPIXFMT_RGB565,
.native_x_res = 1280,
.native_y_res = 720,
};
#endif /* CONFIG_DISPLAY_FICTIVE */
#ifdef CONFIG_DISPLAY_GENERIC_DSI_PRIMARY
static struct mcde_port port0 = {
.type = MCDE_PORTTYPE_DSI,
.mode = MCDE_PORTMODE_CMD,
.pixel_format = MCDE_PORTPIXFMT_DSI_24BPP,
.ifc = 1,
.link = 0,
#ifdef CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_AUTO_SYNC
.sync_src = MCDE_SYNCSRC_OFF,
.update_auto_trig = true,
#else
.sync_src = MCDE_SYNCSRC_BTA,
.update_auto_trig = false,
#endif
.phy = {
.dsi = {
.virt_id = 0,
.num_data_lanes = 2,
.ui = DSI_UNIT_INTERVAL_0,
.clk_cont = false,
.data_lanes_swap = false,
},
},
};
static struct mcde_display_generic_platform_data generic_display0_pdata = {
.reset_delay = 1,
#ifdef CONFIG_REGULATOR
.regulator_id = "v-display",
.min_supply_voltage = 2500000, /* 2.5V */
.max_supply_voltage = 2800000 /* 2.8V */
#endif
};
static struct mcde_display_device generic_display0 = {
.name = "mcde_disp_generic",
.id = PRIMARY_DISPLAY_ID,
.port = &port0,
.chnl_id = MCDE_CHNL_A,
/*
* A large fifo is needed when ddr is clocked down to 25% to not get
* latency problems.
*/
.fifo = MCDE_FIFO_A,
#ifdef CONFIG_MCDE_DISPLAY_PRIMARY_16BPP
.default_pixel_format = MCDE_OVLYPIXFMT_RGB565,
#else
.default_pixel_format = MCDE_OVLYPIXFMT_RGBA8888,
#endif
.native_x_res = 864,
.native_y_res = 480,
.synchronized_update = false,
/* TODO: Remove rotation buffers once ESRAM driver is completed */
.rotbuf1 = U8500_ESRAM_BASE + 0x20000 * 4,
.rotbuf2 = U8500_ESRAM_BASE + 0x20000 * 4 + 0x10000,
.dev = {
.platform_data = &generic_display0_pdata,
},
};
#endif /* CONFIG_DISPLAY_GENERIC_DSI_PRIMARY */
#ifdef CONFIG_DISPLAY_GENERIC_DSI_SECONDARY
static struct mcde_port subdisplay_port = {
.type = MCDE_PORTTYPE_DSI,
.mode = MCDE_PORTMODE_CMD,
.pixel_format = MCDE_PORTPIXFMT_DSI_24BPP,
.ifc = 1,
.link = 1,
#ifdef CONFIG_DISPLAY_GENERIC_DSI_SECONDARY_AUTO_SYNC
.sync_src = MCDE_SYNCSRC_OFF,
.update_auto_trig = true,
#else
.sync_src = MCDE_SYNCSRC_BTA,
.update_auto_trig = false,
#endif
.phy = {
.dsi = {
.virt_id = 0,
.num_data_lanes = 2,
.ui = DSI_UNIT_INTERVAL_1,
.clk_cont = false,
.data_lanes_swap = false,
},
},
};
static struct mcde_display_generic_platform_data generic_subdisplay_pdata = {
.reset_delay = 1,
#ifdef CONFIG_REGULATOR
.regulator_id = "v-display",
.min_supply_voltage = 2500000, /* 2.5V */
.max_supply_voltage = 2800000 /* 2.8V */
#endif
};
static struct mcde_display_device generic_subdisplay = {
.name = "mcde_disp_generic_subdisplay",
.id = SECONDARY_DISPLAY_ID,
.port = &subdisplay_port,
.chnl_id = MCDE_CHNL_C1,
.fifo = MCDE_FIFO_C1,
.default_pixel_format = MCDE_OVLYPIXFMT_RGB565,
.native_x_res = 864,
.native_y_res = 480,
#ifdef CONFIG_DISPLAY_GENERIC_DSI_SECONDARY_VSYNC
.synchronized_update = true,
#else
.synchronized_update = false,
#endif
.dev = {
.platform_data = &generic_subdisplay_pdata,
},
};
#endif /* CONFIG_DISPLAY_GENERIC_DSI_SECONDARY */
#ifdef CONFIG_MCDE_DISPLAY_DPI_PRIMARY
static struct mcde_port port0 = {
.type = MCDE_PORTTYPE_DPI,
.pixel_format = MCDE_PORTPIXFMT_DPI_24BPP,
.ifc = 0,
.link = 1, /* DPI channel B can only be on link 1 */
.sync_src = MCDE_SYNCSRC_OFF, /* sync from output formatter */
.update_auto_trig = true,
.phy = {
.dpi = {
.tv_mode = false,
.clock_div = 2,
.polarity = DPI_ACT_LOW_VSYNC | DPI_ACT_LOW_HSYNC,
},
},
};
static struct mcde_display_dpi_platform_data generic_display0_pdata = {0};
static struct ux500_pins *dpi_pins;
static int dpi_display_platform_enable(struct mcde_display_device *ddev)
{
int res;
if (!dpi_pins) {
dpi_pins = ux500_pins_get("mcde-dpi");
if (!dpi_pins)
return -EINVAL;
}
dev_info(&ddev->dev, "%s\n", __func__);
res = ux500_pins_enable(dpi_pins);
if (res)
dev_warn(&ddev->dev, "Failure during %s\n", __func__);
return res;
}
static int dpi_display_platform_disable(struct mcde_display_device *ddev)
{
int res;
dev_info(&ddev->dev, "%s\n", __func__);
res = ux500_pins_disable(dpi_pins);
if (res)
dev_warn(&ddev->dev, "Failure during %s\n", __func__);
return res;
}
static struct mcde_display_device generic_display0 = {
.name = "mcde_display_dpi",
.id = 0,
.port = &port0,
.chnl_id = MCDE_CHNL_B,
.fifo = MCDE_FIFO_B,
#ifdef CONFIG_MCDE_DISPLAY_PRIMARY_16BPP
.default_pixel_format = MCDE_OVLYPIXFMT_RGB565,
#else
.default_pixel_format = MCDE_OVLYPIXFMT_RGBA8888,
#endif
.native_x_res = 640,
.native_y_res = 480,
/* .synchronized_update: Don't care: port is set to update_auto_trig */
.dev = {
.platform_data = &generic_display0_pdata,
},
.platform_enable = dpi_display_platform_enable,
.platform_disable = dpi_display_platform_disable,
};
#endif /* CONFIG_MCDE_DISPLAY_DPI_PRIMARY */
#ifdef CONFIG_DISPLAY_AB8500_TERTIARY
static struct mcde_port port_tvout1 = {
.type = MCDE_PORTTYPE_DPI,
.pixel_format = MCDE_PORTPIXFMT_DPI_24BPP,
.ifc = 0,
.link = 1, /* channel B */
.sync_src = MCDE_SYNCSRC_OFF,
.update_auto_trig = true,
.phy = {
.dpi = {
.bus_width = 4, /* DDR mode */
.tv_mode = true,
.clock_div = MCDE_PORT_DPI_NO_CLOCK_DIV,
},
},
};
static struct ab8500_display_platform_data ab8500_display_pdata = {
.nr_regulators = 2,
.regulator_id = {"v-tvout", "v-ab8500-AV-switch"},
.rgb_2_yCbCr_transform = &rgb_2_yCbCr_transform,
};
static struct ux500_pins *tvout_pins;
static int ab8500_platform_enable(struct mcde_display_device *ddev)
{
int res = 0;
if (!tvout_pins) {
tvout_pins = ux500_pins_get("mcde-tvout");
if (!tvout_pins)
return -EINVAL;
}
dev_dbg(&ddev->dev, "%s\n", __func__);
res = ux500_pins_enable(tvout_pins);
if (res != 0)
goto failed;
return res;
failed:
dev_warn(&ddev->dev, "Failure during %s\n", __func__);
return res;
}
static int ab8500_platform_disable(struct mcde_display_device *ddev)
{
int res;
dev_dbg(&ddev->dev, "%s\n", __func__);
res = ux500_pins_disable(tvout_pins);
if (res != 0)
goto failed;
return res;
failed:
dev_warn(&ddev->dev, "Failure during %s\n", __func__);
return res;
}
struct mcde_display_device tvout_ab8500_display = {
.name = "mcde_tv_ab8500",
.id = AB8500_DISPLAY_ID,
.port = &port_tvout1,
.chnl_id = MCDE_CHNL_B,
.fifo = MCDE_FIFO_B,
.default_pixel_format = MCDE_OVLYPIXFMT_RGB565,
.native_x_res = 720,
.native_y_res = 576,
/* .synchronized_update: Don't care: port is set to update_auto_trig */
.dev = {
.platform_data = &ab8500_display_pdata,
},
/*
* We might need to describe the std here:
* - there are different PAL / NTSC formats (do they require MCDE
* settings?)
*/
.platform_enable = ab8500_platform_enable,
.platform_disable = ab8500_platform_disable,
};
#endif /* CONFIG_DISPLAY_AB8500_TERTIARY */
#ifdef CONFIG_DISPLAY_AV8100_TERTIARY
static struct mcde_port port2 = {
.type = MCDE_PORTTYPE_DSI,
.mode = MCDE_PORTMODE_CMD,
.pixel_format = MCDE_PORTPIXFMT_DSI_24BPP,
.ifc = 1,
.link = 2,
#ifdef CONFIG_AV8100_HWTRIG_INT
.sync_src = MCDE_SYNCSRC_TE0,
#endif
#ifdef CONFIG_AV8100_HWTRIG_I2SDAT3
.sync_src = MCDE_SYNCSRC_TE1,
#endif
#ifdef CONFIG_AV8100_HWTRIG_DSI_TE
.sync_src = MCDE_SYNCSRC_TE_POLLING,
#endif
#ifdef CONFIG_AV8100_HWTRIG_NONE
.sync_src = MCDE_SYNCSRC_OFF,
#endif
.update_auto_trig = true,
.phy = {
.dsi = {
.virt_id = 0,
.num_data_lanes = 2,
.ui = DSI_UNIT_INTERVAL_2,
.clk_cont = false,
.data_lanes_swap = false,
},
},
.hdmi_sdtv_switch = HDMI_SWITCH,
};
static struct mcde_display_hdmi_platform_data av8100_hdmi_pdata = {
.reset_gpio = 0,
.reset_delay = 1,
.regulator_id = NULL, /* TODO: "display_main" */
.cvbs_regulator_id = "v-av8100-AV-switch",
.ddb_id = 1,
.rgb_2_yCbCr_transform = &rgb_2_yCbCr_transform,
};
static struct ux500_pins *av8100_pins;
static int av8100_platform_enable(struct mcde_display_device *ddev)
{
int res;
dev_dbg(&ddev->dev, "%s\n", __func__);
if (!av8100_pins) {
av8100_pins = ux500_pins_get("av8100-hdmi");
if (!av8100_pins) {
res = -EINVAL;
goto failed;
}
}
res = ux500_pins_enable(av8100_pins);
if (res != 0)
goto failed;
return res;
failed:
dev_warn(&ddev->dev, "Failure during %s\n", __func__);
return res;
}
static int av8100_platform_disable(struct mcde_display_device *ddev)
{
int res;
dev_dbg(&ddev->dev, "%s\n", __func__);
res = ux500_pins_disable(av8100_pins);
if (res != 0)
goto failed;
return res;
failed:
dev_warn(&ddev->dev, "Failure during %s\n", __func__);
return res;
}
struct mcde_display_device av8100_hdmi = {
.name = "av8100_hdmi",
.id = AV8100_DISPLAY_ID,
.port = &port2,
.chnl_id = MCDE_CHNL_B,
.fifo = MCDE_FIFO_B,
.default_pixel_format = MCDE_OVLYPIXFMT_RGB888,
.native_x_res = 1280,
.native_y_res = 720,
.dev = {
.platform_data = &av8100_hdmi_pdata,
},
.platform_enable = av8100_platform_enable,
.platform_disable = av8100_platform_disable,
};
static void delayed_work_dispreg_hdmi(struct work_struct *ptr)
{
if (mcde_display_device_register(&av8100_hdmi))
pr_warning("Failed to register av8100_hdmi\n");
}
#endif /* CONFIG_DISPLAY_AV8100_TERTIARY */
/*
* This function will create the framebuffer for the display that is registered.
*/
static int display_postregistered_callback(struct notifier_block *nb,
unsigned long event, void *dev)
{
struct mcde_display_device *ddev = dev;
u16 width, height;
u16 virtual_width, virtual_height;
u32 rotate = FB_ROTATE_UR;
struct fb_info *fbi;
#ifdef CONFIG_DISPDEV
struct mcde_fb *mfb;
#endif
if (event != MCDE_DSS_EVENT_DISPLAY_REGISTERED)
return 0;
if (ddev->id < 0 || ddev->id >= MCDE_NR_OF_DISPLAYS)
return 0;
mcde_dss_get_native_resolution(ddev, &width, &height);
#ifdef CONFIG_DISPLAY_GENERIC_DSI_PRIMARY
if (ddev->id == PRIMARY_DISPLAY_ID) {
switch (CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_ROTATION_ANGLE) {
case 0:
rotate = FB_ROTATE_UR;
break;
case 90:
rotate = FB_ROTATE_CW;
swap(width, height);
break;
case 180:
rotate = FB_ROTATE_UD;
break;
case 270:
rotate = FB_ROTATE_CCW;
swap(width, height);
break;
}
}
#endif
virtual_width = width;
virtual_height = height * 2;
#if defined(CONFIG_DISPLAY_GENERIC_DSI_PRIMARY) && \
defined(CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_AUTO_SYNC)
if (ddev->id == PRIMARY_DISPLAY_ID)
virtual_height = height;
#endif
#if defined(CONFIG_DISPLAY_GENERIC_DSI_SECONDARY) && \
defined(CONFIG_DISPLAY_GENERIC_DSI_SECONDARY_AUTO_SYNC)
if (ddev->id == SECONDARY_DISPLAY_ID)
virtual_height = height;
#endif
#ifdef CONFIG_DISPLAY_AV8100_TERTIARY
if (ddev->id == AV8100_DISPLAY_ID) {
#ifdef CONFIG_MCDE_DISPLAY_HDMI_FB_AUTO_CREATE
hdmi_fb_onoff(ddev, 1, 0, 0);
#endif
goto display_postregistered_callback_end;
}
#endif /* CONFIG_DISPLAY_AV8100_TERTIARY */
/* Create frame buffer */
fbi = mcde_fb_create(ddev,
width, height,
virtual_width, virtual_height,
ddev->default_pixel_format,
rotate);
if (IS_ERR(fbi)) {
dev_warn(&ddev->dev,
"Failed to create fb for display %s\n",
ddev->name);
goto display_postregistered_callback_err;
} else {
dev_info(&ddev->dev, "Framebuffer created (%s)\n",
ddev->name);
}
#ifdef CONFIG_DISPDEV
mfb = to_mcde_fb(fbi);
/* Create a dispdev overlay for this display */
if (dispdev_create(ddev, true, mfb->ovlys[0]) < 0) {
dev_warn(&ddev->dev,
"Failed to create disp for display %s\n",
ddev->name);
goto display_postregistered_callback_err;
} else {
dev_info(&ddev->dev, "Disp dev created for (%s)\n",
ddev->name);
}
#endif
#ifdef CONFIG_DISPLAY_AV8100_TERTIARY
display_postregistered_callback_end:
#endif
return 0;
display_postregistered_callback_err:
return -1;
}
static struct notifier_block display_nb = {
.notifier_call = display_postregistered_callback,
};
/*
* This function is used to refresh the display (lcd, hdmi, tvout) with black
* when the framebuffer is registered.
* The main display will not be updated if startup graphics is displayed
* from u-boot.
*/
#if defined(CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_AUTO_SYNC) || \
defined(CONFIG_DISPLAY_GENERIC_DSI_SECONDARY_AUTO_SYNC)
static int framebuffer_postregistered_callback(struct notifier_block *nb,
unsigned long event, void *data)
{
int ret = 0;
struct fb_event *event_data = data;
struct fb_info *info;
struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;
struct mcde_fb *mfb;
int i;
if (event != FB_EVENT_FB_REGISTERED)
return 0;
if (!event_data)
return 0;
info = event_data->info;
mfb = to_mcde_fb(info);
var = info->var;
fix = info->fix;
/* Apply overlay info */
for (i = 0; i < mfb->num_ovlys; i++) {
struct mcde_overlay *ovly = mfb->ovlys[i];
struct mcde_overlay_info ovly_info;
struct mcde_fb *mfb = to_mcde_fb(info);
int num_buffers;
memset(&ovly_info, 0, sizeof(ovly_info));
ovly_info.paddr = fix.smem_start +
fix.line_length * var.yoffset;
if (ovly_info.paddr + fix.line_length * var.yres
> fix.smem_start + fix.smem_len)
ovly_info.paddr = fix.smem_start;
ovly_info.fmt = mfb->pix_fmt;
ovly_info.stride = fix.line_length;
ovly_info.w = var.xres;
ovly_info.h = var.yres;
ovly_info.dirty.w = var.xres;
ovly_info.dirty.h = var.yres;
(void) mcde_dss_apply_overlay(ovly, &ovly_info);
num_buffers = var.yres_virtual / var.yres;
ret = mcde_dss_update_overlay(ovly, num_buffers == 3);
if (ret)
break;
}
return ret;
}
#else
static int framebuffer_postregistered_callback(struct notifier_block *nb,
unsigned long event, void *data)
{
int ret = 0;
struct fb_event *event_data = data;
struct fb_info *info;
struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;
struct mcde_fb *mfb;
if (event != FB_EVENT_FB_REGISTERED)
return 0;
if (!event_data)
return 0;
info = event_data->info;
mfb = to_mcde_fb(info);
if (mfb->id == 0 && display_initialized_during_boot)
goto out;
var = info->var;
fix = info->fix;
var.yoffset = var.yoffset ? 0 : var.yres;
if (info->fbops->fb_pan_display)
ret = info->fbops->fb_pan_display(&var, info);
out:
return ret;
}
#endif
static struct notifier_block framebuffer_nb = {
.notifier_call = framebuffer_postregistered_callback,
};
int __init init_display_devices(void)
{
int ret = 0;
#ifdef CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_VSYNC
struct i2c_adapter *i2c0;
#endif
if (!cpu_is_u8500())
return ret;
ret = fb_register_client(&framebuffer_nb);
if (ret)
pr_warning("Failed to register framebuffer notifier\n");
ret = mcde_dss_register_notifier(&display_nb);
if (ret)
pr_warning("Failed to register dss notifier\n");
#ifdef CONFIG_DISPLAY_FICTIVE
ret = mcde_display_device_register(&fictive_display);
if (ret)
pr_warning("Failed to register fictive display device\n");
#endif
#ifdef CONFIG_DISPLAY_GENERIC_PRIMARY
if (machine_is_hrefv60())
generic_display0_pdata.reset_gpio = HREFV60_DISP1_RST_GPIO;
else
generic_display0_pdata.reset_gpio = MOP500_DISP1_RST_GPIO;
#ifdef CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_VSYNC
i2c0 = i2c_get_adapter(0);
if (i2c0) {
/*
* U8500-UIB has the TC35893 at 0x44 on I2C0, the
* ST-UIB has not.
*/
ret = i2c_smbus_xfer(i2c0, 0x44, 0, I2C_SMBUS_WRITE, 0,
I2C_SMBUS_QUICK, NULL);
i2c_put_adapter(i2c0);
/* ret == 0 => U8500 UIB connected */
generic_display0.synchronized_update = (ret == 0);
}
#endif
if (display_initialized_during_boot)
generic_display0.power_mode = MCDE_DISPLAY_PM_STANDBY;
ret = mcde_display_device_register(&generic_display0);
if (ret)
pr_warning("Failed to register generic display device 0\n");
#endif
#ifdef CONFIG_DISPLAY_GENERIC_DSI_SECONDARY
if (machine_is_hrefv60())
generic_subdisplay_pdata.reset_gpio = HREFV60_DISP2_RST_GPIO;
else
generic_subdisplay_pdata.reset_gpio = MOP500_DISP2_RST_GPIO;
ret = mcde_display_device_register(&generic_subdisplay);
if (ret)
pr_warning("Failed to register generic sub display device\n");
#endif
#ifdef CONFIG_DISPLAY_AV8100_TERTIARY
INIT_DELAYED_WORK_DEFERRABLE(&work_dispreg_hdmi,
delayed_work_dispreg_hdmi);
schedule_delayed_work(&work_dispreg_hdmi,
msecs_to_jiffies(DISPREG_HDMI_DELAY));
#endif
#ifdef CONFIG_DISPLAY_AB8500_TERTIARY
ret = mcde_display_device_register(&tvout_ab8500_display);
if (ret)
pr_warning("Failed to register ab8500 tvout device\n");
#endif
return ret;
}
struct mcde_display_device *mcde_get_main_display(void)
{
#if defined(CONFIG_DISPLAY_GENERIC_DSI_PRIMARY)
return &generic_display0;
#elif defined(CONFIG_DISPLAY_GENERIC_DSI_SECONDARY)
return &generic_subdisplay;
#elif defined(CONFIG_DISPLAY_AV8100_TERTIARY)
return &av8100_hdmi;
#elif defined(CONFIG_DISPLAY_AB8500_TERTIARY)
return &tvout_ab8500_display;
#else
return NULL;
#endif
}
EXPORT_SYMBOL(mcde_get_main_display);
module_init(init_display_devices);
#endif
|