aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhou Zhu <zzhu3@marvell.com>2013-02-21 19:42:12 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 20:22:17 -0500
commitd2e8bae6d72fa139fe7da7739c30b81c4122866f (patch)
treeae19e0df48fc55cfd4a80226104735172b55c775
parent59393bb94c103fca48c29348d2415cc67d772045 (diff)
video: mmp fb support
Add fb support for Marvell mmp display subsystem. This driver is configured using "buffer driver mach info". With configured name of path, this driver get path using using exported interface of mmp display driver. Then this driver get overlay using configured id and operates on this overlay to show buffers on display devices. Signed-off-by: Zhou Zhu <zzhu3@marvell.com> Signed-off-by: Lisa Du <cldu@marvell.com> Cc: Guoqing Li <ligq@marvell.com> Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/mmp/Kconfig4
-rw-r--r--drivers/video/mmp/Makefile2
-rw-r--r--drivers/video/mmp/fb/Kconfig13
-rw-r--r--drivers/video/mmp/fb/Makefile1
-rw-r--r--drivers/video/mmp/fb/mmpfb.c684
-rw-r--r--drivers/video/mmp/fb/mmpfb.h54
6 files changed, 757 insertions, 1 deletions
diff --git a/drivers/video/mmp/Kconfig b/drivers/video/mmp/Kconfig
index 055433624526..6a0b0566ed32 100644
--- a/drivers/video/mmp/Kconfig
+++ b/drivers/video/mmp/Kconfig
@@ -3,3 +3,7 @@ menuconfig MMP_DISP
3 depends on CPU_PXA910 || CPU_MMP2 || CPU_MMP3 || CPU_PXA988 3 depends on CPU_PXA910 || CPU_MMP2 || CPU_MMP3 || CPU_PXA988
4 help 4 help
5 Marvell Display Subsystem support. 5 Marvell Display Subsystem support.
6
7if MMP_DISP
8source "drivers/video/mmp/fb/Kconfig"
9endif
diff --git a/drivers/video/mmp/Makefile b/drivers/video/mmp/Makefile
index 820eb10ac2dd..fdcd833150bd 100644
--- a/drivers/video/mmp/Makefile
+++ b/drivers/video/mmp/Makefile
@@ -1 +1 @@
obj-y += core.o obj-y += core.o fb/
diff --git a/drivers/video/mmp/fb/Kconfig b/drivers/video/mmp/fb/Kconfig
new file mode 100644
index 000000000000..9b0141f105f5
--- /dev/null
+++ b/drivers/video/mmp/fb/Kconfig
@@ -0,0 +1,13 @@
1if MMP_DISP
2
3config MMP_FB
4 bool "fb driver for Marvell MMP Display Subsystem"
5 depends on FB
6 select FB_CFB_FILLRECT
7 select FB_CFB_COPYAREA
8 select FB_CFB_IMAGEBLIT
9 default y
10 help
11 fb driver for Marvell MMP Display Subsystem
12
13endif
diff --git a/drivers/video/mmp/fb/Makefile b/drivers/video/mmp/fb/Makefile
new file mode 100644
index 000000000000..709fd1f76abe
--- /dev/null
+++ b/drivers/video/mmp/fb/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_MMP_FB) += mmpfb.o
diff --git a/drivers/video/mmp/fb/mmpfb.c b/drivers/video/mmp/fb/mmpfb.c
new file mode 100644
index 000000000000..f34a3a907f1b
--- /dev/null
+++ b/drivers/video/mmp/fb/mmpfb.c
@@ -0,0 +1,684 @@
1/*
2 * linux/drivers/video/mmp/fb/mmpfb.c
3 * Framebuffer driver for Marvell Display controller.
4 *
5 * Copyright (C) 2012 Marvell Technology Group Ltd.
6 * Authors: Zhou Zhu <zzhu3@marvell.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22#include <linux/module.h>
23#include <linux/dma-mapping.h>
24#include "mmpfb.h"
25
26static int var_to_pixfmt(struct fb_var_screeninfo *var)
27{
28 /*
29 * Pseudocolor mode?
30 */
31 if (var->bits_per_pixel == 8)
32 return PIXFMT_PSEUDOCOLOR;
33
34 /*
35 * Check for YUV422PLANAR.
36 */
37 if (var->bits_per_pixel == 16 && var->red.length == 8 &&
38 var->green.length == 4 && var->blue.length == 4) {
39 if (var->green.offset >= var->blue.offset)
40 return PIXFMT_YUV422P;
41 else
42 return PIXFMT_YVU422P;
43 }
44
45 /*
46 * Check for YUV420PLANAR.
47 */
48 if (var->bits_per_pixel == 12 && var->red.length == 8 &&
49 var->green.length == 2 && var->blue.length == 2) {
50 if (var->green.offset >= var->blue.offset)
51 return PIXFMT_YUV420P;
52 else
53 return PIXFMT_YVU420P;
54 }
55
56 /*
57 * Check for YUV422PACK.
58 */
59 if (var->bits_per_pixel == 16 && var->red.length == 16 &&
60 var->green.length == 16 && var->blue.length == 16) {
61 if (var->red.offset == 0)
62 return PIXFMT_YUYV;
63 else if (var->green.offset >= var->blue.offset)
64 return PIXFMT_UYVY;
65 else
66 return PIXFMT_VYUY;
67 }
68
69 /*
70 * Check for 565/1555.
71 */
72 if (var->bits_per_pixel == 16 && var->red.length <= 5 &&
73 var->green.length <= 6 && var->blue.length <= 5) {
74 if (var->transp.length == 0) {
75 if (var->red.offset >= var->blue.offset)
76 return PIXFMT_RGB565;
77 else
78 return PIXFMT_BGR565;
79 }
80 }
81
82 /*
83 * Check for 888/A888.
84 */
85 if (var->bits_per_pixel <= 32 && var->red.length <= 8 &&
86 var->green.length <= 8 && var->blue.length <= 8) {
87 if (var->bits_per_pixel == 24 && var->transp.length == 0) {
88 if (var->red.offset >= var->blue.offset)
89 return PIXFMT_RGB888PACK;
90 else
91 return PIXFMT_BGR888PACK;
92 }
93
94 if (var->bits_per_pixel == 32 && var->transp.offset == 24) {
95 if (var->red.offset >= var->blue.offset)
96 return PIXFMT_RGBA888;
97 else
98 return PIXFMT_BGRA888;
99 } else {
100 if (var->red.offset >= var->blue.offset)
101 return PIXFMT_RGB888UNPACK;
102 else
103 return PIXFMT_BGR888UNPACK;
104 }
105
106 /* fall through */
107 }
108
109 return -EINVAL;
110}
111
112static void pixfmt_to_var(struct fb_var_screeninfo *var, int pix_fmt)
113{
114 switch (pix_fmt) {
115 case PIXFMT_RGB565:
116 var->bits_per_pixel = 16;
117 var->red.offset = 11; var->red.length = 5;
118 var->green.offset = 5; var->green.length = 6;
119 var->blue.offset = 0; var->blue.length = 5;
120 var->transp.offset = 0; var->transp.length = 0;
121 break;
122 case PIXFMT_BGR565:
123 var->bits_per_pixel = 16;
124 var->red.offset = 0; var->red.length = 5;
125 var->green.offset = 5; var->green.length = 6;
126 var->blue.offset = 11; var->blue.length = 5;
127 var->transp.offset = 0; var->transp.length = 0;
128 break;
129 case PIXFMT_RGB888UNPACK:
130 var->bits_per_pixel = 32;
131 var->red.offset = 16; var->red.length = 8;
132 var->green.offset = 8; var->green.length = 8;
133 var->blue.offset = 0; var->blue.length = 8;
134 var->transp.offset = 0; var->transp.length = 0;
135 break;
136 case PIXFMT_BGR888UNPACK:
137 var->bits_per_pixel = 32;
138 var->red.offset = 0; var->red.length = 8;
139 var->green.offset = 8; var->green.length = 8;
140 var->blue.offset = 16; var->blue.length = 8;
141 var->transp.offset = 0; var->transp.length = 0;
142 break;
143 case PIXFMT_RGBA888:
144 var->bits_per_pixel = 32;
145 var->red.offset = 16; var->red.length = 8;
146 var->green.offset = 8; var->green.length = 8;
147 var->blue.offset = 0; var->blue.length = 8;
148 var->transp.offset = 24; var->transp.length = 8;
149 break;
150 case PIXFMT_BGRA888:
151 var->bits_per_pixel = 32;
152 var->red.offset = 0; var->red.length = 8;