aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/85xx/p1022_ds.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/85xx/p1022_ds.c')
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index 266b3aadfe5..c01c7277888 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