aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-29 05:14:30 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2011-08-29 05:14:30 -0400
commitd4a7dbfdf180a656de3eb9e64614e2b991ffaa53 (patch)
treef7d0d548004751aea77f63e6fd695faf0785bde0 /arch/powerpc
parentb5480ed72e4f299c53d1857faaf4f492650ccc43 (diff)
parentfa514fbc57419505d0e9423dbb8742f2775f882e (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-3.x into fbdev-next
Conflicts: drivers/video/atmel_lcdfb.c
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c22
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c47
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c55
-rw-r--r--arch/powerpc/sysdev/fsl_soc.h25
4 files changed, 73 insertions, 76 deletions
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index e41ebbdb3e12..3dc62f907a1e 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -66,8 +66,8 @@ struct fsl_diu_shared_fb {
66 bool in_use; 66 bool in_use;
67}; 67};
68 68
69unsigned int mpc512x_get_pixel_format(unsigned int bits_per_pixel, 69u32 mpc512x_get_pixel_format(enum fsl_diu_monitor_port port,
70 int monitor_port) 70 unsigned int bits_per_pixel)
71{ 71{
72 switch (bits_per_pixel) { 72 switch (bits_per_pixel) {
73 case 32: 73 case 32:
@@ -80,11 +80,12 @@ unsigned int mpc512x_get_pixel_format(unsigned int bits_per_pixel,
80 return 0x00000400; 80 return 0x00000400;
81} 81}
82 82
83void mpc512x_set_gamma_table(int monitor_port, char *gamma_table_base) 83void mpc512x_set_gamma_table(enum fsl_diu_monitor_port port,
84 char *gamma_table_base)
84{ 85{
85} 86}
86 87
87void mpc512x_set_monitor_port(int monitor_port) 88void mpc512x_set_monitor_port(enum fsl_diu_monitor_port port)
88{ 89{
89} 90}
90 91
@@ -182,14 +183,10 @@ void mpc512x_set_pixel_clock(unsigned int pixclock)
182 iounmap(ccm); 183 iounmap(ccm);
183} 184}
184 185
185ssize_t mpc512x_show_monitor_port(int monitor_port, char *buf) 186enum fsl_diu_monitor_port
187mpc512x_valid_monitor_port(enum fsl_diu_monitor_port port)
186{ 188{
187 return sprintf(buf, "0 - 5121 LCD\n"); 189 return FSL_DIU_PORT_DVI;
188}
189
190int mpc512x_set_sysfs_monitor_port(int val)
191{
192 return 0;
193} 190}
194 191
195static struct fsl_diu_shared_fb __attribute__ ((__aligned__(8))) diu_shared_fb; 192static struct fsl_diu_shared_fb __attribute__ ((__aligned__(8))) diu_shared_fb;
@@ -332,8 +329,7 @@ void __init mpc512x_setup_diu(void)
332 diu_ops.set_gamma_table = mpc512x_set_gamma_table; 329 diu_ops.set_gamma_table = mpc512x_set_gamma_table;
333 diu_ops.set_monitor_port = mpc512x_set_monitor_port; 330 diu_ops.set_monitor_port = mpc512x_set_monitor_port;
334 diu_ops.set_pixel_clock = mpc512x_set_pixel_clock; 331 diu_ops.set_pixel_clock = mpc512x_set_pixel_clock;
335 diu_ops.show_monitor_port = mpc512x_show_monitor_port; 332 diu_ops.valid_monitor_port = mpc512x_valid_monitor_port;
336 diu_ops.set_sysfs_monitor_port = mpc512x_set_sysfs_monitor_port;
337 diu_ops.release_bootmem = mpc512x_release_bootmem; 333 diu_ops.release_bootmem = mpc512x_release_bootmem;
338#endif 334#endif
339} 335}
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index 266b3aadfe5e..c01c7277888c 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -93,8 +93,8 @@
93 * The Area Descriptor is a 32-bit value that determine which bits in each 93 * The Area Descriptor is a 32-bit value that determine which bits in each
94 * pixel are to be used for each color. 94 * pixel are to be used for each color.
95 */ 95 */
96static unsigned int p1022ds_get_pixel_format(unsigned int bits_per_pixel, 96static u32 p1022ds_get_pixel_format(enum fsl_diu_monitor_port port,
97 int monitor_port) 97 unsigned int bits_per_pixel)
98{ 98{
99 switch (bits_per_pixel) { 99 switch (bits_per_pixel) {
100 case 32: 100 case 32:
@@ -118,7 +118,8 @@ static unsigned int p1022ds_get_pixel_format(unsigned int bits_per_pixel,
118 * On some boards, the gamma table for some ports may need to be modified. 118 * On some boards, the gamma table for some ports may need to be modified.
119 * This is not the case on the P1022DS, so we do nothing. 119 * This is not the case on the P1022DS, so we do nothing.
120*/ 120*/
121static void p1022ds_set_gamma_table(int monitor_port, char *gamma_table_base) 121static void p1022ds_set_gamma_table(enum fsl_diu_monitor_port port,
122 char *gamma_table_base)
122{ 123{
123} 124}
124 125
@@ -126,7 +127,7 @@ static void p1022ds_set_gamma_table(int monitor_port, char *gamma_table_base)
126 * p1022ds_set_monitor_port: switch the output to a different monitor port 127 * p1022ds_set_monitor_port: switch the output to a different monitor port
127 * 128 *
128 */ 129 */
129static void p1022ds_set_monitor_port(int monitor_port) 130static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
130{ 131{
131 struct device_node *pixis_node; 132 struct device_node *pixis_node;
132 void __iomem *pixis; 133 void __iomem *pixis;
@@ -145,19 +146,21 @@ static void p1022ds_set_monitor_port(int monitor_port)
145 } 146 }
146 brdcfg1 = pixis + 9; /* BRDCFG1 is at offset 9 in the ngPIXIS */ 147 brdcfg1 = pixis + 9; /* BRDCFG1 is at offset 9 in the ngPIXIS */
147 148
148 switch (monitor_port) { 149 switch (port) {
149 case 0: /* DVI */ 150 case FSL_DIU_PORT_DVI:
151 printk(KERN_INFO "%s:%u\n", __func__, __LINE__);
150 /* Enable the DVI port, disable the DFP and the backlight */ 152 /* Enable the DVI port, disable the DFP and the backlight */
151 clrsetbits_8(brdcfg1, PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT, 153 clrsetbits_8(brdcfg1, PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT,
152 PX_BRDCFG1_DVIEN); 154 PX_BRDCFG1_DVIEN);
153 break; 155 break;
154 case 1: /* Single link LVDS */ 156 case FSL_DIU_PORT_LVDS:
157 printk(KERN_INFO "%s:%u\n", __func__, __LINE__);
155 /* Enable the DFP port, disable the DVI and the backlight */ 158 /* Enable the DFP port, disable the DVI and the backlight */
156 clrsetbits_8(brdcfg1, PX_BRDCFG1_DVIEN | PX_BRDCFG1_BACKLIGHT, 159 clrsetbits_8(brdcfg1, PX_BRDCFG1_DVIEN | PX_BRDCFG1_BACKLIGHT,
157 PX_BRDCFG1_DFPEN); 160 PX_BRDCFG1_DFPEN);
158 break; 161 break;
159 default: 162 default:
160 pr_err("p1022ds: unsupported monitor port %i\n", monitor_port); 163 pr_err("p1022ds: unsupported monitor port %i\n", port);
161 } 164 }
162 165
163 iounmap(pixis); 166 iounmap(pixis);
@@ -214,23 +217,18 @@ void p1022ds_set_pixel_clock(unsigned int pixclock)
214} 217}
215 218
216/** 219/**
217 * p1022ds_show_monitor_port: show the current monitor 220 * p1022ds_valid_monitor_port: set the monitor port for sysfs
218 *
219 * This function returns a string indicating whether the current monitor is
220 * set to DVI or LVDS.
221 */
222ssize_t p1022ds_show_monitor_port(int monitor_port, char *buf)
223{
224 return sprintf(buf, "%c0 - DVI\n%c1 - Single link LVDS\n",
225 monitor_port == 0 ? '*' : ' ', monitor_port == 1 ? '*' : ' ');
226}
227
228/**
229 * p1022ds_set_sysfs_monitor_port: set the monitor port for sysfs
230 */ 221 */
231int p1022ds_set_sysfs_monitor_port(int val) 222enum fsl_diu_monitor_port
223p1022ds_valid_monitor_port(enum fsl_diu_monitor_port port)
232{ 224{
233 return val < 2 ? val : 0; 225 switch (port) {
226 case FSL_DIU_PORT_DVI:
227 case FSL_DIU_PORT_LVDS:
228 return port;
229 default:
230 return FSL_DIU_PORT_DVI; /* Dual-link LVDS is not supported */
231 }
234} 232}
235 233
236#endif 234#endif
@@ -305,8 +303,7 @@ static void __init p1022_ds_setup_arch(void)
305 diu_ops.set_gamma_table = p1022ds_set_gamma_table; 303 diu_ops.set_gamma_table = p1022ds_set_gamma_table;
306 diu_ops.set_monitor_port = p1022ds_set_monitor_port; 304 diu_ops.set_monitor_port = p1022ds_set_monitor_port;
307 diu_ops.set_pixel_clock = p1022ds_set_pixel_clock; 305 diu_ops.set_pixel_clock = p1022ds_set_pixel_clock;
308 diu_ops.show_monitor_port = p1022ds_show_monitor_port; 306 diu_ops.valid_monitor_port = p1022ds_valid_monitor_port;
309 diu_ops.set_sysfs_monitor_port = p1022ds_set_sysfs_monitor_port;
310#endif 307#endif
311 308
312#ifdef CONFIG_SMP 309#ifdef CONFIG_SMP
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 74e018ef724b..13fa9a6403e6 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -152,10 +152,10 @@ machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices);
152 (c2 << AD_COMP_2_SHIFT) | (c1 << AD_COMP_1_SHIFT) | \ 152 (c2 << AD_COMP_2_SHIFT) | (c1 << AD_COMP_1_SHIFT) | \
153 (c0 << AD_COMP_0_SHIFT) | (size << AD_PIXEL_S_SHIFT)) 153 (c0 << AD_COMP_0_SHIFT) | (size << AD_PIXEL_S_SHIFT))
154 154
155unsigned int mpc8610hpcd_get_pixel_format(unsigned int bits_per_pixel, 155u32 mpc8610hpcd_get_pixel_format(enum fsl_diu_monitor_port port,
156 int monitor_port) 156 unsigned int bits_per_pixel)
157{ 157{
158 static const unsigned long pixelformat[][3] = { 158 static const u32 pixelformat[][3] = {
159 { 159 {
160 MAKE_AD(3, 0, 2, 1, 3, 8, 8, 8, 8), 160 MAKE_AD(3, 0, 2, 1, 3, 8, 8, 8, 8),
161 MAKE_AD(4, 2, 0, 1, 2, 8, 8, 8, 0), 161 MAKE_AD(4, 2, 0, 1, 2, 8, 8, 8, 0),
@@ -170,7 +170,8 @@ unsigned int mpc8610hpcd_get_pixel_format(unsigned int bits_per_pixel,
170 unsigned int arch_monitor; 170 unsigned int arch_monitor;
171 171
172 /* The DVI port is mis-wired on revision 1 of this board. */ 172 /* The DVI port is mis-wired on revision 1 of this board. */
173 arch_monitor = ((*pixis_arch == 0x01) && (monitor_port == 0))? 0 : 1; 173 arch_monitor =
174 ((*pixis_arch == 0x01) && (port == FSL_DIU_PORT_DVI)) ? 0 : 1;
174 175
175 switch (bits_per_pixel) { 176 switch (bits_per_pixel) {
176 case 32: 177 case 32:
@@ -185,10 +186,11 @@ unsigned int mpc8610hpcd_get_pixel_format(unsigned int bits_per_pixel,
185 } 186 }
186} 187}
187 188
188void mpc8610hpcd_set_gamma_table(int monitor_port, char *gamma_table_base) 189void mpc8610hpcd_set_gamma_table(enum fsl_diu_monitor_port port,
190 char *gamma_table_base)
189{ 191{
190 int i; 192 int i;
191 if (monitor_port == 2) { /* dual link LVDS */ 193 if (port == FSL_DIU_PORT_DLVDS) {
192 for (i = 0; i < 256*3; i++) 194 for (i = 0; i < 256*3; i++)
193 gamma_table_base[i] = (gamma_table_base[i] << 2) | 195 gamma_table_base[i] = (gamma_table_base[i] << 2) |
194 ((gamma_table_base[i] >> 6) & 0x03); 196 ((gamma_table_base[i] >> 6) & 0x03);
@@ -199,17 +201,21 @@ void mpc8610hpcd_set_gamma_table(int monitor_port, char *gamma_table_base)
199#define PX_BRDCFG0_DLINK (1 << 4) 201#define PX_BRDCFG0_DLINK (1 << 4)
200#define PX_BRDCFG0_DIU_MASK (PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK) 202#define PX_BRDCFG0_DIU_MASK (PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK)
201 203
202void mpc8610hpcd_set_monitor_port(int monitor_port) 204void mpc8610hpcd_set_monitor_port(enum fsl_diu_monitor_port port)
203{ 205{
204 static const u8 bdcfg[] = { 206 switch (port) {
205 PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK, 207 case FSL_DIU_PORT_DVI:
206 PX_BRDCFG0_DLINK,
207 0,
208 };
209
210 if (monitor_port < 3)
211 clrsetbits_8(pixis_bdcfg0, PX_BRDCFG0_DIU_MASK, 208 clrsetbits_8(pixis_bdcfg0, PX_BRDCFG0_DIU_MASK,
212 bdcfg[monitor_port]); 209 PX_BRDCFG0_DVISEL | PX_BRDCFG0_DLINK);
210 break;
211 case FSL_DIU_PORT_LVDS:
212 clrsetbits_8(pixis_bdcfg0, PX_BRDCFG0_DIU_MASK,
213 PX_BRDCFG0_DLINK);
214 break;
215 case FSL_DIU_PORT_DLVDS:
216 clrbits8(pixis_bdcfg0, PX_BRDCFG0_DIU_MASK);
217 break;
218 }
213} 219}
214 220
215/** 221/**
@@ -262,20 +268,10 @@ void mpc8610hpcd_set_pixel_clock(unsigned int pixclock)
262 iounmap(guts); 268 iounmap(guts);
263} 269}
264 270
265ssize_t mpc8610hpcd_show_monitor_port(int monitor_port, char *buf) 271enum fsl_diu_monitor_port
266{ 272mpc8610hpcd_valid_monitor_port(enum fsl_diu_monitor_port port)
267 return snprintf(buf, PAGE_SIZE,
268 "%c0 - DVI\n"
269 "%c1 - Single link LVDS\n"
270 "%c2 - Dual link LVDS\n",
271 monitor_port == 0 ? '*' : ' ',
272 monitor_port == 1 ? '*' : ' ',
273 monitor_port == 2 ? '*' : ' ');
274}
275
276int mpc8610hpcd_set_sysfs_monitor_port(int val)
277{ 273{
278 return val < 3 ? val : 0; 274 return port;
279} 275}
280 276
281#endif 277#endif
@@ -307,8 +303,7 @@ static void __init mpc86xx_hpcd_setup_arch(void)
307 diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table; 303 diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table;
308 diu_ops.set_monitor_port = mpc8610hpcd_set_monitor_port; 304 diu_ops.set_monitor_port = mpc8610hpcd_set_monitor_port;
309 diu_ops.set_pixel_clock = mpc8610hpcd_set_pixel_clock; 305 diu_ops.set_pixel_clock = mpc8610hpcd_set_pixel_clock;
310 diu_ops.show_monitor_port = mpc8610hpcd_show_monitor_port; 306 diu_ops.valid_monitor_port = mpc8610hpcd_valid_monitor_port;
311 diu_ops.set_sysfs_monitor_port = mpc8610hpcd_set_sysfs_monitor_port;
312#endif 307#endif
313 308
314 pixis_node = of_find_compatible_node(NULL, NULL, "fsl,fpga-pixis"); 309 pixis_node = of_find_compatible_node(NULL, NULL, "fsl,fpga-pixis");
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 2ece02beb8ff..c6d00736f07f 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -22,15 +22,24 @@ struct device_node;
22extern void fsl_rstcr_restart(char *cmd); 22extern void fsl_rstcr_restart(char *cmd);
23 23
24#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 24#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
25
26/* The different ports that the DIU can be connected to */
27enum fsl_diu_monitor_port {
28 FSL_DIU_PORT_DVI, /* DVI */
29 FSL_DIU_PORT_LVDS, /* Single-link LVDS */
30 FSL_DIU_PORT_DLVDS /* Dual-link LVDS */
31};
32
25struct platform_diu_data_ops { 33struct platform_diu_data_ops {
26 unsigned int (*get_pixel_format) (unsigned int bits_per_pixel, 34 u32 (*get_pixel_format)(enum fsl_diu_monitor_port port,
27 int monitor_port); 35 unsigned int bpp);
28 void (*set_gamma_table) (int monitor_port, char *gamma_table_base); 36 void (*set_gamma_table)(enum fsl_diu_monitor_port port,
29 void (*set_monitor_port) (int monitor_port); 37 char *gamma_table_base);
30 void (*set_pixel_clock) (unsigned int pixclock); 38 void (*set_monitor_port)(enum fsl_diu_monitor_port port);
31 ssize_t (*show_monitor_port) (int monitor_port, char *buf); 39 void (*set_pixel_clock)(unsigned int pixclock);
32 int (*set_sysfs_monitor_port) (int val); 40 enum fsl_diu_monitor_port (*valid_monitor_port)
33 void (*release_bootmem) (void); 41 (enum fsl_diu_monitor_port port);
42 void (*release_bootmem)(void);
34}; 43};
35 44
36extern struct platform_diu_data_ops diu_ops; 45extern struct platform_diu_data_ops diu_ops;