1 #include <linux/device.h>
2 #include <linux/dma-mapping.h>
3 #include <linux/amba/bus.h>
4 #include <linux/amba/clcd.h>
5 #include <linux/platform_data/video-clcd-versatile.h>
7 static struct clcd_panel vga
= {
21 .vmode
= FB_VMODE_NONINTERLACED
,
25 .tim2
= TIM2_BCD
| TIM2_IPC
,
26 .cntl
= CNTL_LCDTFT
| CNTL_BGR
| CNTL_LCDVCOMP(1),
27 .caps
= CLCD_CAP_5551
| CLCD_CAP_565
| CLCD_CAP_888
,
31 static struct clcd_panel xvga
= {
45 .vmode
= FB_VMODE_NONINTERLACED
,
49 .tim2
= TIM2_BCD
| TIM2_IPC
,
50 .cntl
= CNTL_LCDTFT
| CNTL_BGR
| CNTL_LCDVCOMP(1),
51 .caps
= CLCD_CAP_5551
| CLCD_CAP_565
| CLCD_CAP_888
,
55 /* Sanyo TM38QV67A02A - 3.8 inch QVGA (320x240) Color TFT */
56 static struct clcd_panel sanyo_tm38qv67a02a
= {
58 .name
= "Sanyo TM38QV67A02A",
70 .vmode
= FB_VMODE_NONINTERLACED
,
75 .cntl
= CNTL_LCDTFT
| CNTL_BGR
| CNTL_LCDVCOMP(1),
76 .caps
= CLCD_CAP_5551
,
80 static struct clcd_panel sanyo_2_5_in
= {
82 .name
= "Sanyo QVGA Portrait",
93 .sync
= FB_SYNC_HOR_HIGH_ACT
| FB_SYNC_VERT_HIGH_ACT
,
94 .vmode
= FB_VMODE_NONINTERLACED
,
98 .tim2
= TIM2_IVS
| TIM2_IHS
| TIM2_IPC
,
99 .cntl
= CNTL_LCDTFT
| CNTL_BGR
| CNTL_LCDVCOMP(1),
100 .caps
= CLCD_CAP_5551
,
104 /* Epson L2F50113T00 - 2.2 inch 176x220 Color TFT */
105 static struct clcd_panel epson_l2f50113t00
= {
107 .name
= "Epson L2F50113T00",
119 .vmode
= FB_VMODE_NONINTERLACED
,
123 .tim2
= TIM2_BCD
| TIM2_IPC
,
124 .cntl
= CNTL_LCDTFT
| CNTL_BGR
| CNTL_LCDVCOMP(1),
125 .caps
= CLCD_CAP_5551
,
129 static struct clcd_panel
*panels
[] = {
137 struct clcd_panel
*versatile_clcd_get_panel(const char *name
)
141 for (i
= 0; i
< ARRAY_SIZE(panels
); i
++)
142 if (strcmp(panels
[i
]->mode
.name
, name
) == 0)
145 if (i
< ARRAY_SIZE(panels
))
148 pr_err("CLCD: couldn't get parameters for panel %s\n", name
);
153 int versatile_clcd_setup_dma(struct clcd_fb
*fb
, unsigned long framesize
)
157 fb
->fb
.screen_base
= dma_alloc_wc(&fb
->dev
->dev
, framesize
, &dma
,
159 if (!fb
->fb
.screen_base
) {
160 pr_err("CLCD: unable to map framebuffer\n");
164 fb
->fb
.fix
.smem_start
= dma
;
165 fb
->fb
.fix
.smem_len
= framesize
;
170 int versatile_clcd_mmap_dma(struct clcd_fb
*fb
, struct vm_area_struct
*vma
)
172 return dma_mmap_wc(&fb
->dev
->dev
, vma
, fb
->fb
.screen_base
,
173 fb
->fb
.fix
.smem_start
, fb
->fb
.fix
.smem_len
);
176 void versatile_clcd_remove_dma(struct clcd_fb
*fb
)
178 dma_free_wc(&fb
->dev
->dev
, fb
->fb
.fix
.smem_len
, fb
->fb
.screen_base
,
179 fb
->fb
.fix
.smem_start
);