aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-05 12:44:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-05 12:44:03 -0400
commiteced5a0a5a8f7a3b07320e3b7d1d432e0f044735 (patch)
tree043192035e9d9fb77f052ae4dc6fa21ea257efc0
parent7c049d086941a74c1babac6dc6901b88e1ce5b7e (diff)
parent9560dc1059222d059d494a64e5da4c54d23838da (diff)
Merge tag 'fbdev-3.12-omap-legacy-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux
Pull OMAP specific fbdev changes from Tomi Valkeinen: "I've got this pull request separate from the main fbdev pull request, as this contains a bunch of OMAP board file changes and thus could possibly be rejected in case of bad conflicts. The removal of the old display drivers depend on the board file changes, so Tony Lindgren suggested taking them together via fbdev tree. These are in linux-next, and also Tony didn't see any conflicts with any of the branches he had, so they should go in clean. - Change the OMAP board files to use the new OMAP display drivers - Remove all the old drivers, and the related auxiliary code" * tag 'fbdev-3.12-omap-legacy-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (35 commits) OMAPDSS: rename omap_dss_device's 'device' field to 'dst' OMAPDSS: rename omap_dss_device's 'output' to 'src' OMAPDSS: DSS: remove legacy dss bus support OMAPDSS: RFBI: remove code related to old panel model OMAPDSS: VENC: remove code related to old panel model OMAPDSS: SDI: remove code related to old panel model OMAPDSS: DSI: remove code related to old panel model OMAPDSS: HDMI: remove code related to old panel model OMAPDSS: DPI: remove code related to old panel model OMAPDSS: remove all old panel drivers OMAPDSS: DPI: change regulator handling OMAPDSS: SDI: change regulator handling OMAPDSS: fix DPI and SDI device ids OMAPDSS: remove omap_dss_device->channel field OMAPDSS: RFBI: Mark RFBI as broken ARM: OMAP2+: Remove old display drivers from omap2plus_defconfig ARM: OMAP: AM3517EVM: use new display drivers ARM: OMAP: Zoom: use new display drivers ARM: OMAP: Pandora: use new display drivers ARM: OMAP: OMAP3EVM: use new display drivers ...
-rw-r--r--arch/arm/configs/omap2plus_defconfig12
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c57
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c83
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c113
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c100
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c96
-rw-r--r--arch/arm/mach-omap2/board-h4.c48
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c36
-rw-r--r--arch/arm/mach-omap2/board-ldp.c68
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c56
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c87
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c48
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c61
-rw-r--r--arch/arm/mach-omap2/board-overo.c160
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c12
-rw-r--r--arch/arm/mach-omap2/board-rx51-video.c35
-rw-r--r--arch/arm/mach-omap2/board-zoom-display.c30
-rw-r--r--arch/arm/mach-omap2/display.c4
-rw-r--r--arch/arm/mach-omap2/dss-common.c244
-rw-r--r--arch/arm/mach-omap2/dss-common.h2
-rw-r--r--drivers/gpu/drm/omapdrm/omap_encoder.c2
-rw-r--r--drivers/video/omap2/Kconfig1
-rw-r--r--drivers/video/omap2/Makefile1
-rw-r--r--drivers/video/omap2/displays-new/encoder-tfp410.c14
-rw-r--r--drivers/video/omap2/displays-new/encoder-tpd12s015.c14
-rw-r--r--drivers/video/omap2/displays/Kconfig75
-rw-r--r--drivers/video/omap2/displays/Makefile11
-rw-r--r--drivers/video/omap2/displays/panel-acx565akm.c798
-rw-r--r--drivers/video/omap2/displays/panel-generic-dpi.c744
-rw-r--r--drivers/video/omap2/displays/panel-lgphilips-lb035q02.c262
-rw-r--r--drivers/video/omap2/displays/panel-n8x0.c616
-rw-r--r--drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c290
-rw-r--r--drivers/video/omap2/displays/panel-picodlp.c559
-rw-r--r--drivers/video/omap2/displays/panel-picodlp.h288
-rw-r--r--drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c198
-rw-r--r--drivers/video/omap2/displays/panel-taal.c1551
-rw-r--r--drivers/video/omap2/displays/panel-tfp410.c353
-rw-r--r--drivers/video/omap2/displays/panel-tpo-td043mtea1.c596
-rw-r--r--drivers/video/omap2/dss/Kconfig1
-rw-r--r--drivers/video/omap2/dss/Makefile5
-rw-r--r--drivers/video/omap2/dss/apply.c4
-rw-r--r--drivers/video/omap2/dss/core.c324
-rw-r--r--drivers/video/omap2/dss/dpi.c121
-rw-r--r--drivers/video/omap2/dss/dsi.c275
-rw-r--r--drivers/video/omap2/dss/dss.h45
-rw-r--r--drivers/video/omap2/dss/hdmi.c307
-rw-r--r--drivers/video/omap2/dss/hdmi_panel.c414
-rw-r--r--drivers/video/omap2/dss/output.c22
-rw-r--r--drivers/video/omap2/dss/rfbi.c135
-rw-r--r--drivers/video/omap2/dss/sdi.c119
-rw-r--r--drivers/video/omap2/dss/venc.c122
-rw-r--r--include/video/omap-panel-data.h118
-rw-r--r--include/video/omapdss.h106
53 files changed, 973 insertions, 8870 deletions
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 5465f564fdf3..056b27aafbe6 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -186,13 +186,11 @@ CONFIG_OMAP2_DSS_RFBI=y
186CONFIG_OMAP2_DSS_SDI=y 186CONFIG_OMAP2_DSS_SDI=y
187CONFIG_OMAP2_DSS_DSI=y 187CONFIG_OMAP2_DSS_DSI=y
188CONFIG_FB_OMAP2=m 188CONFIG_FB_OMAP2=m
189CONFIG_PANEL_GENERIC_DPI=m 189CONFIG_DISPLAY_ENCODER_TFP410=m
190CONFIG_PANEL_TFP410=m 190CONFIG_DISPLAY_ENCODER_TPD12S015=m
191CONFIG_PANEL_SHARP_LS037V7DW01=m 191CONFIG_DISPLAY_CONNECTOR_DVI=m
192CONFIG_PANEL_NEC_NL8048HL11_01B=m 192CONFIG_DISPLAY_CONNECTOR_HDMI=m
193CONFIG_PANEL_TAAL=m 193CONFIG_DISPLAY_PANEL_DPI=m
194CONFIG_PANEL_TPO_TD043MTEA1=m
195CONFIG_PANEL_ACX565AKM=m
196CONFIG_BACKLIGHT_LCD_SUPPORT=y 194CONFIG_BACKLIGHT_LCD_SUPPORT=y
197CONFIG_LCD_CLASS_DEVICE=y 195CONFIG_LCD_CLASS_DEVICE=y
198CONFIG_LCD_PLATFORM=y 196CONFIG_LCD_PLATFORM=y
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 244d8a5aa54b..c711ad6ac067 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -100,39 +100,52 @@ static struct platform_device sdp2430_flash_device = {
100 .resource = &sdp2430_flash_resource, 100 .resource = &sdp2430_flash_resource,
101}; 101};
102 102
103static struct platform_device *sdp2430_devices[] __initdata = {
104 &sdp2430_flash_device,
105};
106
107/* LCD */ 103/* LCD */
108#define SDP2430_LCD_PANEL_BACKLIGHT_GPIO 91 104#define SDP2430_LCD_PANEL_BACKLIGHT_GPIO 91
109#define SDP2430_LCD_PANEL_ENABLE_GPIO 154 105#define SDP2430_LCD_PANEL_ENABLE_GPIO 154
110 106
111static struct panel_generic_dpi_data sdp2430_panel_data = { 107static const struct display_timing sdp2430_lcd_videomode = {
112 .name = "nec_nl2432dr22-11b", 108 .pixelclock = { 0, 5400000, 0 },
113 .num_gpios = 2, 109
114 .gpios = { 110 .hactive = { 0, 240, 0 },
115 SDP2430_LCD_PANEL_ENABLE_GPIO, 111 .hfront_porch = { 0, 3, 0 },
116 SDP2430_LCD_PANEL_BACKLIGHT_GPIO, 112 .hback_porch = { 0, 39, 0 },
117 }, 113 .hsync_len = { 0, 3, 0 },
114
115 .vactive = { 0, 320, 0 },
116 .vfront_porch = { 0, 2, 0 },
117 .vback_porch = { 0, 7, 0 },
118 .vsync_len = { 0, 1, 0 },
119
120 .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
121 DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
118}; 122};
119 123
120static struct omap_dss_device sdp2430_lcd_device = { 124static struct panel_dpi_platform_data sdp2430_lcd_pdata = {
121 .name = "lcd", 125 .name = "lcd",
122 .driver_name = "generic_dpi_panel", 126 .source = "dpi.0",
123 .type = OMAP_DISPLAY_TYPE_DPI, 127
124 .phy.dpi.data_lines = 16, 128 .data_lines = 16,
125 .data = &sdp2430_panel_data, 129
130 .display_timing = &sdp2430_lcd_videomode,
131
132 .enable_gpio = SDP2430_LCD_PANEL_ENABLE_GPIO,
133 .backlight_gpio = SDP2430_LCD_PANEL_BACKLIGHT_GPIO,
126}; 134};
127 135
128static struct omap_dss_device *sdp2430_dss_devices[] = { 136static struct platform_device sdp2430_lcd_device = {
129 &sdp2430_lcd_device, 137 .name = "panel-dpi",
138 .id = 0,
139 .dev.platform_data = &sdp2430_lcd_pdata,
130}; 140};
131 141
132static struct omap_dss_board_info sdp2430_dss_data = { 142static struct omap_dss_board_info sdp2430_dss_data = {
133 .num_devices = ARRAY_SIZE(sdp2430_dss_devices), 143 .default_display_name = "lcd",
134 .devices = sdp2430_dss_devices, 144};
135 .default_device = &sdp2430_lcd_device, 145
146static struct platform_device *sdp2430_devices[] __initdata = {
147 &sdp2430_flash_device,
148 &sdp2430_lcd_device,
136}; 149};
137 150
138#if IS_ENABLED(CONFIG_SMC91X) 151#if IS_ENABLED(CONFIG_SMC91X)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 23b004afa3f8..d95d0ef1354a 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -126,53 +126,65 @@ static void __init sdp3430_display_init(void)
126 126
127} 127}
128 128
129static struct panel_sharp_ls037v7dw01_data sdp3430_lcd_data = { 129static struct panel_sharp_ls037v7dw01_platform_data sdp3430_lcd_pdata = {
130 .resb_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO, 130 .name = "lcd",
131 .ini_gpio = -1, 131 .source = "dpi.0",
132 .mo_gpio = -1, 132
133 .lr_gpio = -1, 133 .data_lines = 16,
134 .ud_gpio = -1, 134
135 .resb_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO,
136 .ini_gpio = -1,
137 .mo_gpio = -1,
138 .lr_gpio = -1,
139 .ud_gpio = -1,
140};
141
142static struct platform_device sdp3430_lcd_device = {
143 .name = "panel-sharp-ls037v7dw01",
144 .id = 0,
145 .dev.platform_data = &sdp3430_lcd_pdata,
135}; 146};
136 147
137static struct omap_dss_device sdp3430_lcd_device = { 148static struct connector_dvi_platform_data sdp3430_dvi_connector_pdata = {
138 .name = "lcd", 149 .name = "dvi",
139 .driver_name = "sharp_ls_panel", 150 .source = "tfp410.0",
140 .type = OMAP_DISPLAY_TYPE_DPI, 151 .i2c_bus_num = -1,
141 .phy.dpi.data_lines = 16,
142 .data = &sdp3430_lcd_data,
143}; 152};
144 153
145static struct tfp410_platform_data dvi_panel = { 154static struct platform_device sdp3430_dvi_connector_device = {
146 .power_down_gpio = -1, 155 .name = "connector-dvi",
147 .i2c_bus_num = -1, 156 .id = 0,
157 .dev.platform_data = &sdp3430_dvi_connector_pdata,
148}; 158};
149 159
150static struct omap_dss_device sdp3430_dvi_device = { 160static struct encoder_tfp410_platform_data sdp3430_tfp410_pdata = {
151 .name = "dvi", 161 .name = "tfp410.0",
152 .type = OMAP_DISPLAY_TYPE_DPI, 162 .source = "dpi.0",
153 .driver_name = "tfp410", 163 .data_lines = 24,
154 .data = &dvi_panel, 164 .power_down_gpio = -1,
155 .phy.dpi.data_lines = 24,
156}; 165};
157 166
158static struct omap_dss_device sdp3430_tv_device = { 167static struct platform_device sdp3430_tfp410_device = {
159 .name = "tv", 168 .name = "tfp410",
160 .driver_name = "venc", 169 .id = 0,
161 .type = OMAP_DISPLAY_TYPE_VENC, 170 .dev.platform_data = &sdp3430_tfp410_pdata,
162 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
163}; 171};
164 172
173static struct connector_atv_platform_data sdp3430_tv_pdata = {
174 .name = "tv",
175 .source = "venc.0",
176 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
177 .invert_polarity = false,
178};
165 179
166static struct omap_dss_device *sdp3430_dss_devices[] = { 180static struct platform_device sdp3430_tv_connector_device = {
167 &sdp3430_lcd_device, 181 .name = "connector-analog-tv",
168 &sdp3430_dvi_device, 182 .id = 0,
169 &sdp3430_tv_device, 183 .dev.platform_data = &sdp3430_tv_pdata,
170}; 184};
171 185
172static struct omap_dss_board_info sdp3430_dss_data = { 186static struct omap_dss_board_info sdp3430_dss_data = {
173 .num_devices = ARRAY_SIZE(sdp3430_dss_devices), 187 .default_display_name = "lcd",
174 .devices = sdp3430_dss_devices,
175 .default_device = &sdp3430_lcd_device,
176}; 188};
177 189
178static struct omap2_hsmmc_info mmc[] = { 190static struct omap2_hsmmc_info mmc[] = {
@@ -583,6 +595,11 @@ static void __init omap_3430sdp_init(void)
583 omap_hsmmc_init(mmc); 595 omap_hsmmc_init(mmc);
584 omap3430_i2c_init(); 596 omap3430_i2c_init();
585 omap_display_init(&sdp3430_dss_data); 597 omap_display_init(&sdp3430_dss_data);
598 platform_device_register(&sdp3430_lcd_device);
599 platform_device_register(&sdp3430_tfp410_device);
600 platform_device_register(&sdp3430_dvi_connector_device);
601 platform_device_register(&sdp3430_tv_connector_device);
602
586 if (omap_rev() > OMAP3430_REV_ES1_0) 603 if (omap_rev() > OMAP3430_REV_ES1_0)
587 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2; 604 gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2;
588 else 605 else
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index d63f14b534b5..8cc2c9e9fb03 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -120,56 +120,95 @@ static int __init am3517_evm_i2c_init(void)
120 return 0; 120 return 0;
121} 121}
122 122
123static struct panel_generic_dpi_data lcd_panel = { 123static const struct display_timing am3517_evm_lcd_videomode = {
124 .name = "sharp_lq", 124 .pixelclock = { 0, 9000000, 0 },
125 .num_gpios = 3, 125
126 .gpios = { 126 .hactive = { 0, 480, 0 },
127 LCD_PANEL_PWR, 127 .hfront_porch = { 0, 3, 0 },
128 LCD_PANEL_BKLIGHT_PWR, 128 .hback_porch = { 0, 2, 0 },
129 LCD_PANEL_PWM, 129 .hsync_len = { 0, 42, 0 },
130 }, 130
131 .vactive = { 0, 272, 0 },
132 .vfront_porch = { 0, 3, 0 },
133 .vback_porch = { 0, 2, 0 },
134 .vsync_len = { 0, 11, 0 },
135
136 .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
137 DISPLAY_FLAGS_DE_LOW | DISPLAY_FLAGS_PIXDATA_POSEDGE,
138};
139
140static struct panel_dpi_platform_data am3517_evm_lcd_pdata = {
141 .name = "lcd",
142 .source = "dpi.0",
143
144 .data_lines = 16,
145
146 .display_timing = &am3517_evm_lcd_videomode,
147
148 .enable_gpio = LCD_PANEL_PWR,
149 .backlight_gpio = LCD_PANEL_BKLIGHT_PWR,
150};
151
152static struct platform_device am3517_evm_lcd_device = {
153 .name = "panel-dpi",
154 .id = 0,
155 .dev.platform_data = &am3517_evm_lcd_pdata,
131}; 156};
132 157
133static struct omap_dss_device am3517_evm_lcd_device = { 158static struct connector_dvi_platform_data am3517_evm_dvi_connector_pdata = {
134 .type = OMAP_DISPLAY_TYPE_DPI, 159 .name = "dvi",
135 .name = "lcd", 160 .source = "tfp410.0",
136 .driver_name = "generic_dpi_panel", 161 .i2c_bus_num = -1,
137 .data = &lcd_panel,
138 .phy.dpi.data_lines = 16,
139}; 162};
140 163
141static struct omap_dss_device am3517_evm_tv_device = { 164static struct platform_device am3517_evm_dvi_connector_device = {
142 .type = OMAP_DISPLAY_TYPE_VENC, 165 .name = "connector-dvi",
143 .name = "tv", 166 .id = 0,
144 .driver_name = "venc", 167 .dev.platform_data = &am3517_evm_dvi_connector_pdata,
145 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
146}; 168};
147 169
148static struct tfp410_platform_data dvi_panel = { 170static struct encoder_tfp410_platform_data am3517_evm_tfp410_pdata = {
149 .power_down_gpio = -1, 171 .name = "tfp410.0",
150 .i2c_bus_num = -1, 172 .source = "dpi.0",
173 .data_lines = 24,
174 .power_down_gpio = -1,
151}; 175};
152 176
153static struct omap_dss_device am3517_evm_dvi_device = { 177static struct platform_device am3517_evm_tfp410_device = {
154 .type = OMAP_DISPLAY_TYPE_DPI, 178 .name = "tfp410",
155 .name = "dvi", 179 .id = 0,
156 .driver_name = "tfp410", 180 .dev.platform_data = &am3517_evm_tfp410_pdata,
157 .data = &dvi_panel,
158 .phy.dpi.data_lines = 24,
159}; 181};
160 182
161static struct omap_dss_device *am3517_evm_dss_devices[] = { 183static struct connector_atv_platform_data am3517_evm_tv_pdata = {
162 &am3517_evm_lcd_device, 184 .name = "tv",
163 &am3517_evm_tv_device, 185 .source = "venc.0",
164 &am3517_evm_dvi_device, 186 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
187 .invert_polarity = false,
188};
189
190static struct platform_device am3517_evm_tv_connector_device = {
191 .name = "connector-analog-tv",
192 .id = 0,
193 .dev.platform_data = &am3517_evm_tv_pdata,
165}; 194};
166 195
167static struct omap_dss_board_info am3517_evm_dss_data = { 196static struct omap_dss_board_info am3517_evm_dss_data = {
168 .num_devices = ARRAY_SIZE(am3517_evm_dss_devices), 197 .default_display_name = "lcd",
169 .devices = am3517_evm_dss_devices,
170 .default_device = &am3517_evm_lcd_device,
171}; 198};
172 199
200static void __init am3517_evm_display_init(void)
201{
202 gpio_request_one(LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd panel pwm");
203
204 omap_display_init(&am3517_evm_dss_data);
205
206 platform_device_register(&am3517_evm_tfp410_device);
207 platform_device_register(&am3517_evm_dvi_connector_device);
208 platform_device_register(&am3517_evm_lcd_device);
209 platform_device_register(&am3517_evm_tv_connector_device);
210}
211
173/* 212/*
174 * Board initialization 213 * Board initialization
175 */ 214 */
@@ -295,7 +334,9 @@ static void __init am3517_evm_init(void)
295 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 334 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
296 335
297 am3517_evm_i2c_init(); 336 am3517_evm_i2c_init();
298 omap_display_init(&am3517_evm_dss_data); 337
338 am3517_evm_display_init();
339
299 omap_serial_init(); 340 omap_serial_init();
300 omap_sdrc_init(NULL, NULL); 341 omap_sdrc_init(NULL, NULL);
301 342
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index d4622ed26252..33d159e2386e 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -190,52 +190,81 @@ static inline void cm_t35_init_nand(void) {}
190#define CM_T35_LCD_BL_GPIO 58 190#define CM_T35_LCD_BL_GPIO 58
191#define CM_T35_DVI_EN_GPIO 54 191#define CM_T35_DVI_EN_GPIO 54
192 192
193static struct panel_generic_dpi_data lcd_panel = { 193static const struct display_timing cm_t35_lcd_videomode = {
194 .name = "toppoly_tdo35s", 194 .pixelclock = { 0, 26000000, 0 },
195 .num_gpios = 1, 195
196 .gpios = { 196 .hactive = { 0, 480, 0 },
197 CM_T35_LCD_BL_GPIO, 197 .hfront_porch = { 0, 104, 0 },
198 }, 198 .hback_porch = { 0, 8, 0 },
199 .hsync_len = { 0, 8, 0 },
200
201 .vactive = { 0, 640, 0 },
202 .vfront_porch = { 0, 4, 0 },
203 .vback_porch = { 0, 2, 0 },
204 .vsync_len = { 0, 2, 0 },
205
206 .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
207 DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_NEGEDGE,
208};
209
210static struct panel_dpi_platform_data cm_t35_lcd_pdata = {
211 .name = "lcd",
212 .source = "dpi.0",
213
214 .data_lines = 18,
215
216 .display_timing = &cm_t35_lcd_videomode,
217
218 .enable_gpio = -1,
219 .backlight_gpio = CM_T35_LCD_BL_GPIO,
220};
221
222static struct platform_device cm_t35_lcd_device = {
223 .name = "panel-dpi",
224 .id = 0,
225 .dev.platform_data = &cm_t35_lcd_pdata,
199}; 226};
200 227
201static struct omap_dss_device cm_t35_lcd_device = { 228static struct connector_dvi_platform_data cm_t35_dvi_connector_pdata = {
202 .name = "lcd", 229 .name = "dvi",
203 .type = OMAP_DISPLAY_TYPE_DPI, 230 .source = "tfp410.0",
204 .driver_name = "generic_dpi_panel", 231 .i2c_bus_num = -1,
205 .data = &lcd_panel,
206 .phy.dpi.data_lines = 18,
207}; 232};
208 233
209static struct tfp410_platform_data dvi_panel = { 234static struct platform_device cm_t35_dvi_connector_device = {
210 .power_down_gpio = CM_T35_DVI_EN_GPIO, 235 .name = "connector-dvi",
211 .i2c_bus_num = -1, 236 .id = 0,
237 .dev.platform_data = &cm_t35_dvi_connector_pdata,
212}; 238};
213 239
214static struct omap_dss_device cm_t35_dvi_device = { 240static struct encoder_tfp410_platform_data cm_t35_tfp410_pdata = {
215 .name = "dvi", 241 .name = "tfp410.0",
216 .type = OMAP_DISPLAY_TYPE_DPI, 242 .source = "dpi.0",
217 .driver_name = "tfp410", 243 .data_lines = 24,
218 .data = &dvi_panel, 244 .power_down_gpio = CM_T35_DVI_EN_GPIO,
219 .phy.dpi.data_lines = 24,
220}; 245};
221 246
222static struct omap_dss_device cm_t35_tv_device = { 247static struct platform_device cm_t35_tfp410_device = {
223 .name = "tv", 248 .name = "tfp410",
224 .driver_name = "venc", 249 .id = 0,
225 .type = OMAP_DISPLAY_TYPE_VENC, 250 .dev.platform_data = &cm_t35_tfp410_pdata,
226 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
227}; 251};
228 252
229static struct omap_dss_device *cm_t35_dss_devices[] = { 253static struct connector_atv_platform_data cm_t35_tv_pdata = {
230 &cm_t35_lcd_device, 254 .name = "tv",
231 &cm_t35_dvi_device, 255 .source = "venc.0",
232 &cm_t35_tv_device, 256 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
257 .invert_polarity = false,
258};
259
260static struct platform_device cm_t35_tv_connector_device = {
261 .name = "connector-analog-tv",
262 .id = 0,
263 .dev.platform_data = &cm_t35_tv_pdata,
233}; 264};
234 265
235static struct omap_dss_board_info cm_t35_dss_data = { 266static struct omap_dss_board_info cm_t35_dss_data = {
236 .num_devices = ARRAY_SIZE(cm_t35_dss_devices), 267 .default_display_name = "dvi",
237 .devices = cm_t35_dss_devices,
238 .default_device = &cm_t35_dvi_device,
239}; 268};
240 269
241static struct omap2_mcspi_device_config tdo24m_mcspi_config = { 270static struct omap2_mcspi_device_config tdo24m_mcspi_config = {
@@ -280,6 +309,11 @@ static void __init cm_t35_init_display(void)
280 pr_err("CM-T35: failed to register DSS device\n"); 309 pr_err("CM-T35: failed to register DSS device\n");
281 gpio_free(CM_T35_LCD_EN_GPIO); 310 gpio_free(CM_T35_LCD_EN_GPIO);
282 } 311 }
312
313 platform_device_register(&cm_t35_tfp410_device);
314 platform_device_register(&cm_t35_dvi_connector_device);
315 platform_device_register(&cm_t35_lcd_device);
316 platform_device_register(&cm_t35_tv_connector_device);
283} 317}
284 318
285static struct regulator_consumer_supply cm_t35_vmmc1_supply[] = { 319static struct regulator_consumer_supply cm_t35_vmmc1_supply[] = {
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index f1d91ba5d1ac..cdc4fb9960a9 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -112,50 +112,81 @@ static struct regulator_consumer_supply devkit8000_vio_supply[] = {
112 REGULATOR_SUPPLY("vcc", "spi2.0"), 112 REGULATOR_SUPPLY("vcc", "spi2.0"),
113}; 113};
114 114
115static struct panel_generic_dpi_data lcd_panel = { 115static const struct display_timing devkit8000_lcd_videomode = {
116 .name = "innolux_at070tn83", 116 .pixelclock = { 0, 40000000, 0 },
117 /* gpios filled in code */ 117
118 .hactive = { 0, 800, 0 },
119 .hfront_porch = { 0, 1, 0 },
120 .hback_porch = { 0, 1, 0 },
121 .hsync_len = { 0, 48, 0 },
122
123 .vactive = { 0, 480, 0 },
124 .vfront_porch = { 0, 12, 0 },
125 .vback_porch = { 0, 25, 0 },
126 .vsync_len = { 0, 3, 0 },
127
128 .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
129 DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
118}; 130};
119 131
120static struct omap_dss_device devkit8000_lcd_device = { 132static struct panel_dpi_platform_data devkit8000_lcd_pdata = {
121 .name = "lcd", 133 .name = "lcd",
122 .type = OMAP_DISPLAY_TYPE_DPI, 134 .source = "dpi.0",
123 .driver_name = "generic_dpi_panel", 135
124 .data = &lcd_panel, 136 .data_lines = 24,
125 .phy.dpi.data_lines = 24, 137
138 .display_timing = &devkit8000_lcd_videomode,
139
140 .enable_gpio = -1, /* filled in code */
141 .backlight_gpio = -1,
126}; 142};
127 143
128static struct tfp410_platform_data dvi_panel = { 144static struct platform_device devkit8000_lcd_device = {
129 .power_down_gpio = -1, 145 .name = "panel-dpi",
130 .i2c_bus_num = 1, 146 .id = 0,
147 .dev.platform_data = &devkit8000_lcd_pdata,
131}; 148};
132 149
133static struct omap_dss_device devkit8000_dvi_device = { 150static struct connector_dvi_platform_data devkit8000_dvi_connector_pdata = {
134 .name = "dvi", 151 .name = "dvi",
135 .type = OMAP_DISPLAY_TYPE_DPI, 152 .source = "tfp410.0",
136 .driver_name = "tfp410", 153 .i2c_bus_num = 1,
137 .data = &dvi_panel,
138 .phy.dpi.data_lines = 24,
139}; 154};
140 155
141static struct omap_dss_device devkit8000_tv_device = { 156static struct platform_device devkit8000_dvi_connector_device = {
142 .name = "tv", 157 .name = "connector-dvi",
143 .driver_name = "venc", 158 .id = 0,
144 .type = OMAP_DISPLAY_TYPE_VENC, 159 .dev.platform_data = &devkit8000_dvi_connector_pdata,
145 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
146}; 160};
147 161
162static struct encoder_tfp410_platform_data devkit8000_tfp410_pdata = {
163 .name = "tfp410.0",
164 .source = "dpi.0",
165 .data_lines = 24,
166 .power_down_gpio = -1, /* filled in code */
167};
148 168
149static struct omap_dss_device *devkit8000_dss_devices[] = { 169static struct platform_device devkit8000_tfp410_device = {
150 &devkit8000_lcd_device, 170 .name = "tfp410",
151 &devkit8000_dvi_device, 171 .id = 0,
152 &devkit8000_tv_device, 172 .dev.platform_data = &devkit8000_tfp410_pdata,
173};
174
175static struct connector_atv_platform_data devkit8000_tv_pdata = {
176 .name = "tv",
177 .source = "venc.0",
178 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
179 .invert_polarity = false,
180};
181
182static struct platform_device devkit8000_tv_connector_device = {
183 .name = "connector-analog-tv",
184 .id = 0,
185 .dev.platform_data = &devkit8000_tv_pdata,
153}; 186};
154 187
155static struct omap_dss_board_info devkit8000_dss_data = { 188static struct omap_dss_board_info devkit8000_dss_data = {
156 .num_devices = ARRAY_SIZE(devkit8000_dss_devices), 189 .default_display_name = "lcd",
157 .devices = devkit8000_dss_devices,
158 .default_device = &devkit8000_lcd_device,
159}; 190};
160 191
161static uint32_t board_keymap[] = { 192static uint32_t board_keymap[] = {
@@ -204,11 +235,10 @@ static int devkit8000_twl_gpio_setup(struct device *dev,
204 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 235 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
205 236
206 /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ 237 /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */
207 lcd_panel.num_gpios = 1; 238 devkit8000_lcd_pdata.enable_gpio = gpio + TWL4030_GPIO_MAX + 0;
208 lcd_panel.gpios[0] = gpio + TWL4030_GPIO_MAX + 0;
209 239
210 /* gpio + 7 is "DVI_PD" (out, active low) */ 240 /* gpio + 7 is "DVI_PD" (out, active low) */
211 dvi_panel.power_down_gpio = gpio + 7; 241 devkit8000_tfp410_pdata.power_down_gpio = gpio + 7;
212 242
213 return 0; 243 return 0;
214} 244}
@@ -413,6 +443,10 @@ static struct platform_device *devkit8000_devices[] __initdata = {
413 &leds_gpio, 443 &leds_gpio,
414 &keys_gpio, 444 &keys_gpio,
415 &omap_dm9000_dev, 445 &omap_dm9000_dev,
446 &devkit8000_lcd_device,
447 &devkit8000_tfp410_device,
448 &devkit8000_dvi_connector_device,
449 &devkit8000_tv_connector_device,
416}; 450};
417 451
418static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 452static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 69c0acf5aa63..87e41a8b8d46 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -194,30 +194,48 @@ static struct platform_device h4_flash_device = {
194 .resource = &h4_flash_resource, 194 .resource = &h4_flash_resource,
195}; 195};
196 196
197static struct platform_device *h4_devices[] __initdata = { 197static const struct display_timing cm_t35_lcd_videomode = {
198 &h4_flash_device, 198 .pixelclock = { 0, 6250000, 0 },
199
200 .hactive = { 0, 240, 0 },
201 .hfront_porch = { 0, 15, 0 },
202 .hback_porch = { 0, 60, 0 },
203 .hsync_len = { 0, 15, 0 },
204
205 .vactive = { 0, 320, 0 },
206 .vfront_porch = { 0, 1, 0 },
207 .vback_porch = { 0, 1, 0 },
208 .vsync_len = { 0, 1, 0 },
209
210 .flags = DISPLAY_FLAGS_HSYNC_HIGH | DISPLAY_FLAGS_VSYNC_HIGH |
211 DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
199}; 212};
200 213
201static struct panel_generic_dpi_data h4_panel_data = { 214static struct panel_dpi_platform_data cm_t35_lcd_pdata = {
202 .name = "h4", 215 .name = "lcd",
216 .source = "dpi.0",
217
218 .data_lines = 16,
219
220 .display_timing = &cm_t35_lcd_videomode,
221
222 .enable_gpio = -1,
223 .backlight_gpio = -1,
203}; 224};
204 225
205static struct omap_dss_device h4_lcd_device = { 226static struct platform_device cm_t35_lcd_device = {
206 .name = "lcd", 227 .name = "panel-dpi",
207 .driver_name = "generic_dpi_panel", 228 .id = 0,
208 .type = OMAP_DISPLAY_TYPE_DPI, 229 .dev.platform_data = &cm_t35_lcd_pdata,
209 .phy.dpi.data_lines = 16,
210 .data = &h4_panel_data,
211}; 230};
212 231
213static struct omap_dss_device *h4_dss_devices[] = { 232static struct platform_device *h4_devices[] __initdata = {
214 &h4_lcd_device, 233 &h4_flash_device,
234 &cm_t35_lcd_device,
215}; 235};
216 236
217static struct omap_dss_board_info h4_dss_data = { 237static struct omap_dss_board_info h4_dss_data = {
218 .num_devices = ARRAY_SIZE(h4_dss_devices), 238 .default_display_name = "lcd",
219 .devices = h4_dss_devices,
220 .default_device = &h4_lcd_device,
221}; 239};
222 240
223/* 2420 Sysboot setup (2430 is different) */ 241/* 2420 Sysboot setup (2430 is different) */
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 87e65dde8e13..06dbb2d3d38b 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -429,31 +429,39 @@ static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
429 .setup = igep_twl_gpio_setup, 429 .setup = igep_twl_gpio_setup,
430}; 430};
431 431
432static struct tfp410_platform_data dvi_panel = { 432static struct connector_dvi_platform_data omap3stalker_dvi_connector_pdata = {
433 .i2c_bus_num = 3, 433 .name = "dvi",
434 .power_down_gpio = IGEP2_GPIO_DVI_PUP, 434 .source = "tfp410.0",
435 .i2c_bus_num = 3,
435}; 436};
436 437
437static struct omap_dss_device igep2_dvi_device = { 438static struct platform_device omap3stalker_dvi_connector_device = {
438 .type = OMAP_DISPLAY_TYPE_DPI, 439 .name = "connector-dvi",
439 .name = "dvi", 440 .id = 0,
440 .driver_name = "tfp410", 441 .dev.platform_data = &omap3stalker_dvi_connector_pdata,
441 .data = &dvi_panel,
442 .phy.dpi.data_lines = 24,
443}; 442};
444 443
445static struct omap_dss_device *igep2_dss_devices[] = { 444static struct encoder_tfp410_platform_data omap3stalker_tfp410_pdata = {
446 &igep2_dvi_device 445 .name = "tfp410.0",
446 .source = "dpi.0",
447 .data_lines = 24,
448 .power_down_gpio = IGEP2_GPIO_DVI_PUP,
449};
450
451static struct platform_device omap3stalker_tfp410_device = {
452 .name = "tfp410",
453 .id = 0,
454 .dev.platform_data = &omap3stalker_tfp410_pdata,
447}; 455};
448 456
449static struct omap_dss_board_info igep2_dss_data = { 457static struct omap_dss_board_info igep2_dss_data = {
450 .num_devices = ARRAY_SIZE(igep2_dss_devices), 458 .default_display_name = "dvi",
451 .devices = igep2_dss_devices,
452 .default_device = &igep2_dvi_device,
453}; 459};
454 460
455static struct platform_device *igep_devices[] __initdata = { 461static struct platform_device *igep_devices[] __initdata = {
456 &igep_vwlan_device, 462 &igep_vwlan_device,
463 &omap3stalker_tfp410_device,
464 &omap3stalker_dvi_connector_device,
457}; 465};
458 466
459static int igep2_keymap[] = { 467static int igep2_keymap[] = {
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 62e4f701b63b..dd8da2c5399f 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -184,45 +184,70 @@ static inline void __init ldp_init_smsc911x(void)
184#define LCD_PANEL_RESET_GPIO 55 184#define LCD_PANEL_RESET_GPIO 55
185#define LCD_PANEL_QVGA_GPIO 56 185#define LCD_PANEL_QVGA_GPIO 56
186 186
187static struct panel_generic_dpi_data ldp_panel_data = { 187static const struct display_timing ldp_lcd_videomode = {
188 .name = "nec_nl2432dr22-11b", 188 .pixelclock = { 0, 5400000, 0 },
189 .num_gpios = 4, 189
190 /* gpios filled in code */ 190 .hactive = { 0, 240, 0 },
191 .hfront_porch = { 0, 3, 0 },
192 .hback_porch = { 0, 39, 0 },
193 .hsync_len = { 0, 3, 0 },
194
195 .vactive = { 0, 320, 0 },
196 .vfront_porch = { 0, 2, 0 },
197 .vback_porch = { 0, 7, 0 },
198 .vsync_len = { 0, 1, 0 },
199
200 .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
201 DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
191}; 202};
192 203
193static struct omap_dss_device ldp_lcd_device = { 204static struct panel_dpi_platform_data ldp_lcd_pdata = {
194 .name = "lcd", 205 .name = "lcd",
195 .driver_name = "generic_dpi_panel", 206 .source = "dpi.0",
196 .type = OMAP_DISPLAY_TYPE_DPI, 207
197 .phy.dpi.data_lines = 18, 208 .data_lines = 18,
198 .data = &ldp_panel_data, 209
210 .display_timing = &ldp_lcd_videomode,
211
212 .enable_gpio = -1, /* filled in code */
213 .backlight_gpio = -1, /* filled in code */
199}; 214};
200 215
201static struct omap_dss_device *ldp_dss_devices[] = { 216static struct platform_device ldp_lcd_device = {
202 &ldp_lcd_device, 217 .name = "panel-dpi",
218 .id = 0,
219 .dev.platform_data = &ldp_lcd_pdata,
203}; 220};
204 221
205static struct omap_dss_board_info ldp_dss_data = { 222static struct omap_dss_board_info ldp_dss_data = {
206 .num_devices = ARRAY_SIZE(ldp_dss_devices), 223 .default_display_name = "lcd",
207 .devices = ldp_dss_devices,
208 .default_device = &ldp_lcd_device,
209}; 224};
210 225
211static void __init ldp_display_init(void) 226static void __init ldp_display_init(void)
212{ 227{
213 ldp_panel_data.gpios[2] = LCD_PANEL_RESET_GPIO; 228 int r;
214 ldp_panel_data.gpios[3] = LCD_PANEL_QVGA_GPIO; 229
230 static struct gpio gpios[] __initdata = {
231 {LCD_PANEL_RESET_GPIO, GPIOF_OUT_INIT_HIGH, "LCD RESET"},
232 {LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "LCD QVGA"},
233 };
234
235 r = gpio_request_array(gpios, ARRAY_SIZE(gpios));
236 if (r) {
237 pr_err("Cannot request LCD GPIOs, error %d\n", r);
238 return;
239 }
215 240
216 omap_display_init(&ldp_dss_data); 241 omap_display_init(&ldp_dss_data);
217} 242}
218 243
219static int ldp_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio) 244static int ldp_twl_gpio_setup(struct device *dev, unsigned gpio, unsigned ngpio)
220{ 245{
221 ldp_panel_data.gpios[0] = gpio + 7; 246 /* LCD enable GPIO */
222 ldp_panel_data.gpio_invert[0] = true; 247 ldp_lcd_pdata.enable_gpio = gpio + 7;
223 248
224 ldp_panel_data.gpios[1] = gpio + 15; 249 /* Backlight enable GPIO */
225 ldp_panel_data.gpio_invert[1] = true; 250 ldp_lcd_pdata.backlight_gpio = gpio + 15;
226 251
227 return 0; 252 return 0;
228} 253}
@@ -322,6 +347,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
322 347
323static struct platform_device *ldp_devices[] __initdata = { 348static struct platform_device *ldp_devices[] __initdata = {
324 &ldp_gpio_keys_device, 349 &ldp_gpio_keys_device,
350 &ldp_lcd_device,
325}; 351};
326 352
327#ifdef CONFIG_OMAP_MUX 353#ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 1c6ae5f5bae7..f26918467efc 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -225,35 +225,46 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
225 225
226/* DSS */ 226/* DSS */
227 227
228static struct tfp410_platform_data dvi_panel = { 228static struct connector_dvi_platform_data beagle_dvi_connector_pdata = {
229 .i2c_bus_num = 3, 229 .name = "dvi",
230 .power_down_gpio = -1, 230 .source = "tfp410.0",
231 .i2c_bus_num = 3,
231}; 232};
232 233
233static struct omap_dss_device beagle_dvi_device = { 234static struct platform_device beagle_dvi_connector_device = {
234 .type = OMAP_DISPLAY_TYPE_DPI, 235 .name = "connector-dvi",
235 .name = "dvi", 236 .id = 0,
236 .driver_name = "tfp410", 237 .dev.platform_data = &beagle_dvi_connector_pdata,
237 .data = &dvi_panel,
238 .phy.dpi.data_lines = 24,
239}; 238};
240 239
241static struct omap_dss_device beagle_tv_device = { 240static struct encoder_tfp410_platform_data beagle_tfp410_pdata = {
241 .name = "tfp410.0",
242 .source = "dpi.0",
243 .data_lines = 24,
244 .power_down_gpio = -1,
245};
246
247static struct platform_device beagle_tfp410_device = {
248 .name = "tfp410",
249 .id = 0,
250 .dev.platform_data = &beagle_tfp410_pdata,
251};
252
253static struct connector_atv_platform_data beagle_tv_pdata = {
242 .name = "tv", 254 .name = "tv",
243 .driver_name = "venc", 255 .source = "venc.0",
244 .type = OMAP_DISPLAY_TYPE_VENC, 256 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
245 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, 257 .invert_polarity = false,
246}; 258};
247 259
248static struct omap_dss_device *beagle_dss_devices[] = { 260static struct platform_device beagle_tv_connector_device = {
249 &beagle_dvi_device, 261 .name = "connector-analog-tv",
250 &beagle_tv_device, 262 .id = 0,
263 .dev.platform_data = &beagle_tv_pdata,
251}; 264};
252 265
253static struct omap_dss_board_info beagle_dss_data = { 266static struct omap_dss_board_info beagle_dss_data = {
254 .num_devices = ARRAY_SIZE(beagle_dss_devices), 267 .default_display_name = "dvi",
255 .devices = beagle_dss_devices,
256 .default_device = &beagle_dvi_device,
257}; 268};
258 269
259#include "sdram-micron-mt46h32m32lf-6.h" 270#include "sdram-micron-mt46h32m32lf-6.h"
@@ -332,7 +343,11 @@ static int beagle_twl_gpio_setup(struct device *dev,
332 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) 343 if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
333 pr_err("%s: unable to configure EHCI_nOC\n", __func__); 344 pr_err("%s: unable to configure EHCI_nOC\n", __func__);
334 } 345 }
335 dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio; 346 beagle_tfp410_pdata.power_down_gpio = beagle_config.dvi_pd_gpio;
347
348 platform_device_register(&beagle_tfp410_device);
349 platform_device_register(&beagle_dvi_connector_device);
350 platform_device_register(&beagle_tv_connector_device);
336 351
337 /* TWL4030_GPIO_MAX i.e. LED_GPO controls HS USB Port 2 power */ 352 /* TWL4030_GPIO_MAX i.e. LED_GPO controls HS USB Port 2 power */
338 phy_data[0].vcc_gpio = gpio + TWL4030_GPIO_MAX; 353 phy_data[0].vcc_gpio = gpio + TWL4030_GPIO_MAX;
@@ -547,6 +562,7 @@ static void __init omap3_beagle_init(void)
547 if (gpio_is_valid(beagle_config.dvi_pd_gpio)) 562 if (gpio_is_valid(beagle_config.dvi_pd_gpio))
548 omap_mux_init_gpio(beagle_config.dvi_pd_gpio, OMAP_PIN_OUTPUT); 563 omap_mux_init_gpio(beagle_config.dvi_pd_gpio, OMAP_PIN_OUTPUT);
549 omap_display_init(&beagle_dss_data); 564 omap_display_init(&beagle_dss_data);
565
550 omap_serial_init(); 566 omap_serial_init();
551 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 567 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
552 mt46h32m32lf6_sdrc_params); 568 mt46h32m32lf6_sdrc_params);
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 52bdddd41e0e..18143873346c 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -166,14 +166,6 @@ static inline void __init omap3evm_init_smsc911x(void) { return; }
166 */ 166 */
167#define OMAP3EVM_DVI_PANEL_EN_GPIO 199 167#define OMAP3EVM_DVI_PANEL_EN_GPIO 199
168 168
169static struct panel_sharp_ls037v7dw01_data omap3_evm_lcd_data = {
170 .resb_gpio = OMAP3EVM_LCD_PANEL_RESB,
171 .ini_gpio = OMAP3EVM_LCD_PANEL_INI,
172 .mo_gpio = OMAP3EVM_LCD_PANEL_QVGA,
173 .lr_gpio = OMAP3EVM_LCD_PANEL_LR,
174 .ud_gpio = OMAP3EVM_LCD_PANEL_UD,
175};
176
177#ifdef CONFIG_BROKEN 169#ifdef CONFIG_BROKEN
178static void __init omap3_evm_display_init(void) 170static void __init omap3_evm_display_init(void)
179{ 171{
@@ -196,44 +188,65 @@ static void __init omap3_evm_display_init(void)
196} 188}
197#endif 189#endif
198 190
199static struct omap_dss_device omap3_evm_lcd_device = { 191static struct panel_sharp_ls037v7dw01_platform_data omap3_evm_lcd_pdata = {
200 .name = "lcd", 192 .name = "lcd",
201 .driver_name = "sharp_ls_panel", 193 .source = "dpi.0",
202 .type = OMAP_DISPLAY_TYPE_DPI, 194
203 .phy.dpi.data_lines = 18, 195 .data_lines = 18,
204 .data = &omap3_evm_lcd_data, 196
197 .resb_gpio = OMAP3EVM_LCD_PANEL_RESB,
198 .ini_gpio = OMAP3EVM_LCD_PANEL_INI,
199 .mo_gpio = OMAP3EVM_LCD_PANEL_QVGA,
200 .lr_gpio = OMAP3EVM_LCD_PANEL_LR,
201 .ud_gpio = OMAP3EVM_LCD_PANEL_UD,
202};
203
204static struct platform_device omap3_evm_lcd_device = {
205 .name = "panel-sharp-ls037v7dw01",
206 .id = 0,
207 .dev.platform_data = &omap3_evm_lcd_pdata,
208};
209
210static struct connector_dvi_platform_data omap3_evm_dvi_connector_pdata = {
211 .name = "dvi",
212 .source = "tfp410.0",
213 .i2c_bus_num = -1,
214};
215
216static struct platform_device omap3_evm_dvi_connector_device = {
217 .name = "connector-dvi",
218 .id = 0,
219 .dev.platform_data = &omap3_evm_dvi_connector_pdata,
205}; 220};
206 221
207static struct omap_dss_device omap3_evm_tv_device = { 222static struct encoder_tfp410_platform_data omap3_evm_tfp410_pdata = {
208 .name = "tv", 223 .name = "tfp410.0",
209 .driver_name = "venc", 224 .source = "dpi.0",
210 .type = OMAP_DISPLAY_TYPE_VENC, 225 .data_lines = 24,
211 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, 226 .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO,
212}; 227};
213 228
214static struct tfp410_platform_data dvi_panel = { 229static struct platform_device omap3_evm_tfp410_device = {
215 .power_down_gpio = OMAP3EVM_DVI_PANEL_EN_GPIO, 230 .name = "tfp410",
216 .i2c_bus_num = -1, 231 .id = 0,
232 .dev.platform_data = &omap3_evm_tfp410_pdata,
217}; 233};
218 234
219static struct omap_dss_device omap3_evm_dvi_device = { 235static struct connector_atv_platform_data omap3_evm_tv_pdata = {
220 .name = "dvi", 236 .name = "tv",
221 .type = OMAP_DISPLAY_TYPE_DPI, 237 .source = "venc.0",
222 .driver_name = "tfp410", 238 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
223 .data = &dvi_panel, 239 .invert_polarity = false,
224 .phy.dpi.data_lines = 24,
225}; 240};
226 241
227static struct omap_dss_device *omap3_evm_dss_devices[] = { 242static struct platform_device omap3_evm_tv_connector_device = {
228 &omap3_evm_lcd_device, 243 .name = "connector-analog-tv",
229 &omap3_evm_tv_device, 244 .id = 0,
230 &omap3_evm_dvi_device, 245 .dev.platform_data = &omap3_evm_tv_pdata,
231}; 246};
232 247
233static struct omap_dss_board_info omap3_evm_dss_data = { 248static struct omap_dss_board_info omap3_evm_dss_data = {
234 .num_devices = ARRAY_SIZE(omap3_evm_dss_devices), 249 .default_display_name = "lcd",
235 .devices = omap3_evm_dss_devices,
236 .default_device = &omap3_evm_lcd_device,
237}; 250};
238 251
239static struct regulator_consumer_supply omap3evm_vmmc1_supply[] = { 252static struct regulator_consumer_supply omap3evm_vmmc1_supply[] = {
@@ -678,6 +691,10 @@ static void __init omap3_evm_init(void)
678 omap3_evm_i2c_init(); 691 omap3_evm_i2c_init();
679 692
680 omap_display_init(&omap3_evm_dss_data); 693 omap_display_init(&omap3_evm_dss_data);
694 platform_device_register(&omap3_evm_lcd_device);
695 platform_device_register(&omap3_evm_tfp410_device);
696 platform_device_register(&omap3_evm_dvi_connector_device);
697 platform_device_register(&omap3_evm_tv_connector_device);
681 698
682 omap_serial_init(); 699 omap_serial_init();
683 omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL); 700 omap_sdrc_init(mt46h32m32lf6_sdrc_params, NULL);
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index d2b455e70486..de1bc6bbe585 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -231,34 +231,21 @@ static struct twl4030_keypad_data pandora_kp_data = {
231 .rep = 1, 231 .rep = 1,
232}; 232};
233 233
234static struct panel_tpo_td043_data lcd_data = { 234static struct connector_atv_platform_data pandora_tv_pdata = {
235 .nreset_gpio = 157, 235 .name = "tv",
236}; 236 .source = "venc.0",
237 237 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
238static struct omap_dss_device pandora_lcd_device = { 238 .invert_polarity = false,
239 .name = "lcd",
240 .driver_name = "tpo_td043mtea1_panel",
241 .type = OMAP_DISPLAY_TYPE_DPI,
242 .phy.dpi.data_lines = 24,
243 .data = &lcd_data,
244};
245
246static struct omap_dss_device pandora_tv_device = {
247 .name = "tv",
248 .driver_name = "venc",
249 .type = OMAP_DISPLAY_TYPE_VENC,
250 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
251}; 239};
252 240
253static struct omap_dss_device *pandora_dss_devices[] = { 241static struct platform_device pandora_tv_connector_device = {
254 &pandora_lcd_device, 242 .name = "connector-analog-tv",
255 &pandora_tv_device, 243 .id = 0,
244 .dev.platform_data = &pandora_tv_pdata,
256}; 245};
257 246
258static struct omap_dss_board_info pandora_dss_data = { 247static struct omap_dss_board_info pandora_dss_data = {
259 .num_devices = ARRAY_SIZE(pandora_dss_devices), 248 .default_display_name = "lcd",
260 .devices = pandora_dss_devices,
261 .default_device = &pandora_lcd_device,
262}; 249};
263 250
264static void pandora_wl1251_init_card(struct mmc_card *card) 251static void pandora_wl1251_init_card(struct mmc_card *card)
@@ -348,7 +335,7 @@ static struct regulator_consumer_supply pandora_vdds_supplies[] = {
348}; 335};
349 336
350static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = { 337static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = {
351 REGULATOR_SUPPLY("vcc", "display0"), 338 REGULATOR_SUPPLY("vcc", "spi1.1"),
352}; 339};
353 340
354static struct regulator_consumer_supply pandora_usb_phy_supply[] = { 341static struct regulator_consumer_supply pandora_usb_phy_supply[] = {
@@ -529,13 +516,21 @@ static int __init omap3pandora_i2c_init(void)
529 return 0; 516 return 0;
530} 517}
531 518
519static struct panel_tpo_td043mtea1_platform_data pandora_lcd_pdata = {
520 .name = "lcd",
521 .source = "dpi.0",
522
523 .data_lines = 24,
524 .nreset_gpio = 157,
525};
526
532static struct spi_board_info omap3pandora_spi_board_info[] __initdata = { 527static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
533 { 528 {
534 .modalias = "tpo_td043mtea1_panel_spi", 529 .modalias = "panel-tpo-td043mtea1",
535 .bus_num = 1, 530 .bus_num = 1,
536 .chip_select = 1, 531 .chip_select = 1,
537 .max_speed_hz = 375000, 532 .max_speed_hz = 375000,
538 .platform_data = &pandora_lcd_device, 533 .platform_data = &pandora_lcd_pdata,
539 } 534 }
540}; 535};
541 536
@@ -580,6 +575,7 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
580 &pandora_keys_gpio, 575 &pandora_keys_gpio,
581 &pandora_vwlan_device, 576 &pandora_vwlan_device,
582 &pandora_backlight, 577 &pandora_backlight,
578 &pandora_tv_connector_device,
583}; 579};
584 580
585static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 581static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index d37e6b187ae4..ba8342fef799 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -93,40 +93,50 @@ static void __init omap3_stalker_display_init(void)
93{ 93{
94 return; 94 return;
95} 95}
96static struct connector_dvi_platform_data omap3stalker_dvi_connector_pdata = {
97 .name = "dvi",
98 .source = "tfp410.0",
99 .i2c_bus_num = -1,
100};
96 101
97static struct omap_dss_device omap3_stalker_tv_device = { 102static struct platform_device omap3stalker_dvi_connector_device = {
98 .name = "tv", 103 .name = "connector-dvi",
99 .driver_name = "venc", 104 .id = 0,
100 .type = OMAP_DISPLAY_TYPE_VENC, 105 .dev.platform_data = &omap3stalker_dvi_connector_pdata,
101#if defined(CONFIG_OMAP2_VENC_OUT_TYPE_SVIDEO)
102 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
103#elif defined(CONFIG_OMAP2_VENC_OUT_TYPE_COMPOSITE)
104 .u.venc.type = OMAP_DSS_VENC_TYPE_COMPOSITE,
105#endif
106}; 106};
107 107
108static struct tfp410_platform_data dvi_panel = { 108static struct encoder_tfp410_platform_data omap3stalker_tfp410_pdata = {
109 .power_down_gpio = DSS_ENABLE_GPIO, 109 .name = "tfp410.0",
110 .i2c_bus_num = -1, 110 .source = "dpi.0",
111 .data_lines = 24,
112 .power_down_gpio = DSS_ENABLE_GPIO,
111}; 113};
112 114
113static struct omap_dss_device omap3_stalker_dvi_device = { 115static struct platform_device omap3stalker_tfp410_device = {
114 .name = "dvi", 116 .name = "tfp410",
115 .type = OMAP_DISPLAY_TYPE_DPI, 117 .id = 0,
116 .driver_name = "tfp410", 118 .dev.platform_data = &omap3stalker_tfp410_pdata,
117 .data = &dvi_panel, 119};
118 .phy.dpi.data_lines = 24, 120
121static struct connector_atv_platform_data omap3stalker_tv_pdata = {
122 .name = "tv",
123 .source = "venc.0",
124#if defined(CONFIG_OMAP2_VENC_OUT_TYPE_SVIDEO)
125 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
126#elif defined(CONFIG_OMAP2_VENC_OUT_TYPE_COMPOSITE)
127 .connector_type = OMAP_DSS_VENC_TYPE_COMPOSITE,
128#endif
129 .invert_polarity = false,
119}; 130};
120 131
121static struct omap_dss_device *omap3_stalker_dss_devices[] = { 132static struct platform_device omap3stalker_tv_connector_device = {
122 &omap3_stalker_tv_device, 133 .name = "connector-analog-tv",
123 &omap3_stalker_dvi_device, 134 .id = 0,
135 .dev.platform_data = &omap3stalker_tv_pdata,
124}; 136};
125 137
126static struct omap_dss_board_info omap3_stalker_dss_data = { 138static struct omap_dss_board_info omap3_stalker_dss_data = {
127 .num_devices = ARRAY_SIZE(omap3_stalker_dss_devices), 139 .default_display_name = "dvi",
128 .devices = omap3_stalker_dss_devices,
129 .default_device = &omap3_stalker_dvi_device,
130}; 140};
131 141
132static struct regulator_consumer_supply omap3stalker_vmmc1_supply[] = { 142static struct regulator_consumer_supply omap3stalker_vmmc1_supply[] = {
@@ -356,6 +366,9 @@ static struct usbhs_phy_data phy_data[] __initdata = {
356 366
357static struct platform_device *omap3_stalker_devices[] __initdata = { 367static struct platform_device *omap3_stalker_devices[] __initdata = {
358 &keys_gpio, 368 &keys_gpio,
369 &omap3stalker_tfp410_device,
370 &omap3stalker_dvi_connector_device,
371 &omap3stalker_tv_connector_device,
359}; 372};
360 373
361static struct usbhs_omap_platform_data usbhs_bdata __initdata = { 374static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 5748b5d06c23..f6d384111911 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -72,6 +72,9 @@
72#define OVERO_SMSC911X2_CS 4 72#define OVERO_SMSC911X2_CS 4
73#define OVERO_SMSC911X2_GPIO 65 73#define OVERO_SMSC911X2_GPIO 65
74 74
75/* whether to register LCD35 instead of LCD43 */
76static bool overo_use_lcd35;
77
75#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 78#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
76 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 79 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
77 80
@@ -149,78 +152,94 @@ static inline void __init overo_init_smsc911x(void) { return; }
149#define OVERO_GPIO_LCD_EN 144 152#define OVERO_GPIO_LCD_EN 144
150#define OVERO_GPIO_LCD_BL 145 153#define OVERO_GPIO_LCD_BL 145
151 154
152static struct tfp410_platform_data dvi_panel = { 155static struct connector_atv_platform_data overo_tv_pdata = {
153 .i2c_bus_num = 3, 156 .name = "tv",
154 .power_down_gpio = -1, 157 .source = "venc.0",
158 .connector_type = OMAP_DSS_VENC_TYPE_SVIDEO,
159 .invert_polarity = false,
155}; 160};
156 161
157static struct omap_dss_device overo_dvi_device = { 162static struct platform_device overo_tv_connector_device = {
158 .name = "dvi", 163 .name = "connector-analog-tv",
159 .type = OMAP_DISPLAY_TYPE_DPI, 164 .id = 0,
160 .driver_name = "tfp410", 165 .dev.platform_data = &overo_tv_pdata,
161 .data = &dvi_panel,
162 .phy.dpi.data_lines = 24,
163}; 166};
164 167
165static struct omap_dss_device overo_tv_device = { 168static const struct display_timing overo_lcd43_videomode = {
166 .name = "tv", 169 .pixelclock = { 0, 9200000, 0 },
167 .driver_name = "venc", 170
168 .type = OMAP_DISPLAY_TYPE_VENC, 171 .hactive = { 0, 480, 0 },
169 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, 172 .hfront_porch = { 0, 8, 0 },
173 .hback_porch = { 0, 4, 0 },
174 .hsync_len = { 0, 41, 0 },
175
176 .vactive = { 0, 272, 0 },
177 .vfront_porch = { 0, 4, 0 },
178 .vback_porch = { 0, 2, 0 },
179 .vsync_len = { 0, 10, 0 },
180
181 .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
182 DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
170}; 183};
171 184
172static struct panel_generic_dpi_data lcd43_panel = { 185static struct panel_dpi_platform_data overo_lcd43_pdata = {
173 .name = "samsung_lte430wq_f0c", 186 .name = "lcd43",
174 .num_gpios = 2, 187 .source = "dpi.0",
175 .gpios = { 188
176 OVERO_GPIO_LCD_EN, 189 .data_lines = 24,
177 OVERO_GPIO_LCD_BL 190
178 }, 191 .display_timing = &overo_lcd43_videomode,
192
193 .enable_gpio = OVERO_GPIO_LCD_EN,
194 .backlight_gpio = OVERO_GPIO_LCD_BL,
179}; 195};
180 196
181static struct omap_dss_device overo_lcd43_device = { 197static struct platform_device overo_lcd43_device = {
182 .name = "lcd43", 198 .name = "panel-dpi",
183 .type = OMAP_DISPLAY_TYPE_DPI, 199 .id = 0,
184 .driver_name = "generic_dpi_panel", 200 .dev.platform_data = &overo_lcd43_pdata,
185 .data = &lcd43_panel,
186 .phy.dpi.data_lines = 24,
187}; 201};
188 202
189#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ 203static struct connector_dvi_platform_data overo_dvi_connector_pdata = {
190 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) 204 .name = "dvi",
191static struct panel_generic_dpi_data lcd35_panel = { 205 .source = "tfp410.0",
192 .num_gpios = 2, 206 .i2c_bus_num = 3,
193 .gpios = {
194 OVERO_GPIO_LCD_EN,
195 OVERO_GPIO_LCD_BL
196 },
197}; 207};
198 208
199static struct omap_dss_device overo_lcd35_device = { 209static struct platform_device overo_dvi_connector_device = {
200 .type = OMAP_DISPLAY_TYPE_DPI, 210 .name = "connector-dvi",
201 .name = "lcd35", 211 .id = 0,
202 .driver_name = "lgphilips_lb035q02_panel", 212 .dev.platform_data = &overo_dvi_connector_pdata,
203 .phy.dpi.data_lines = 24,
204 .data = &lcd35_panel,
205}; 213};
206#endif
207 214
208static struct omap_dss_device *overo_dss_devices[] = { 215static struct encoder_tfp410_platform_data overo_tfp410_pdata = {
209 &overo_dvi_device, 216 .name = "tfp410.0",
210 &overo_tv_device, 217 .source = "dpi.0",
211#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ 218 .data_lines = 24,
212 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) 219 .power_down_gpio = -1,
213 &overo_lcd35_device, 220};
214#endif 221
215 &overo_lcd43_device, 222static struct platform_device overo_tfp410_device = {
223 .name = "tfp410",
224 .id = 0,
225 .dev.platform_data = &overo_tfp410_pdata,
216}; 226};
217 227
218static struct omap_dss_board_info overo_dss_data = { 228static struct omap_dss_board_info overo_dss_data = {
219 .num_devices = ARRAY_SIZE(overo_dss_devices), 229 .default_display_name = "lcd43",
220 .devices = overo_dss_devices,
221 .default_device = &overo_dvi_device,
222}; 230};
223 231
232static void __init overo_display_init(void)
233{
234 omap_display_init(&overo_dss_data);
235
236 if (!overo_use_lcd35)
237 platform_device_register(&overo_lcd43_device);
238 platform_device_register(&overo_tfp410_device);
239 platform_device_register(&overo_dvi_connector_device);
240 platform_device_register(&overo_tv_connector_device);
241}
242
224static struct mtd_partition overo_nand_partitions[] = { 243static struct mtd_partition overo_nand_partitions[] = {
225 { 244 {
226 .name = "xloader", 245 .name = "xloader",
@@ -408,24 +427,41 @@ static int __init overo_i2c_init(void)
408 return 0; 427 return 0;
409} 428}
410 429
430static struct panel_lb035q02_platform_data overo_lcd35_pdata = {
431 .name = "lcd35",
432 .source = "dpi.0",
433
434 .data_lines = 24,
435
436 .enable_gpio = OVERO_GPIO_LCD_EN,
437 .backlight_gpio = OVERO_GPIO_LCD_BL,
438};
439
440/*
441 * NOTE: We need to add either the lgphilips panel, or the lcd43 panel. The
442 * selection is done based on the overo_use_lcd35 field. If new SPI
443 * devices are added here, extra work is needed to make only the lgphilips panel
444 * affected by the overo_use_lcd35 field.
445 */
411static struct spi_board_info overo_spi_board_info[] __initdata = { 446static struct spi_board_info overo_spi_board_info[] __initdata = {
412#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
413 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
414 { 447 {
415 .modalias = "lgphilips_lb035q02_panel-spi", 448 .modalias = "panel_lgphilips_lb035q02",
416 .bus_num = 1, 449 .bus_num = 1,
417 .chip_select = 1, 450 .chip_select = 1,
418 .max_speed_hz = 500000, 451 .max_speed_hz = 500000,
419 .mode = SPI_MODE_3, 452 .mode = SPI_MODE_3,
453 .platform_data = &overo_lcd35_pdata,
420 }, 454 },
421#endif
422}; 455};
423 456
424static int __init overo_spi_init(void) 457static int __init overo_spi_init(void)
425{ 458{
426 overo_ads7846_init(); 459 overo_ads7846_init();
427 spi_register_board_info(overo_spi_board_info, 460
428 ARRAY_SIZE(overo_spi_board_info)); 461 if (overo_use_lcd35) {
462 spi_register_board_info(overo_spi_board_info,
463 ARRAY_SIZE(overo_spi_board_info));
464 }
429 return 0; 465 return 0;
430} 466}
431 467
@@ -463,11 +499,13 @@ static void __init overo_init(void)
463{ 499{
464 int ret; 500 int ret;
465 501
502 if (strstr(boot_command_line, "omapdss.def_disp=lcd35"))
503 overo_use_lcd35 = true;
504
466 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); 505 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
467 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 506 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
468 overo_i2c_init(); 507 overo_i2c_init();
469 omap_hsmmc_init(mmc); 508 omap_hsmmc_init(mmc);
470 omap_display_init(&overo_dss_data);
471 omap_serial_init(); 509 omap_serial_init();
472 omap_sdrc_init(mt46h32m32lf6_sdrc_params, 510 omap_sdrc_init(mt46h32m32lf6_sdrc_params,
473 mt46h32m32lf6_sdrc_params); 511 mt46h32m32lf6_sdrc_params);
@@ -484,6 +522,8 @@ static void __init overo_init(void)
484 overo_init_keys(); 522 overo_init_keys();
485 omap_twl4030_audio_init("overo", NULL); 523 omap_twl4030_audio_init("overo", NULL);
486 524
525 overo_display_init();
526
487 /* Ensure SDRC pins are mux'd for self-refresh */ 527 /* Ensure SDRC pins are mux'd for self-refresh */
488 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 528 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
489 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); 529 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 9c2dd102fbbb..c3270c0f1fce 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -45,6 +45,8 @@
45#include <linux/platform_data/tsl2563.h> 45#include <linux/platform_data/tsl2563.h>
46#include <linux/lis3lv02d.h> 46#include <linux/lis3lv02d.h>
47 47
48#include <video/omap-panel-data.h>
49
48#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE) 50#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
49#include <media/ir-rx51.h> 51#include <media/ir-rx51.h>
50#endif 52#endif
@@ -226,6 +228,15 @@ static struct lp55xx_platform_data rx51_lp5523_platform_data = {
226}; 228};
227#endif 229#endif
228 230
231#define RX51_LCD_RESET_GPIO 90
232
233static struct panel_acx565akm_platform_data acx_pdata = {
234 .name = "lcd",
235 .source = "sdi.0",
236 .reset_gpio = RX51_LCD_RESET_GPIO,
237 .datapairs = 2,
238};
239
229static struct omap2_mcspi_device_config wl1251_mcspi_config = { 240static struct omap2_mcspi_device_config wl1251_mcspi_config = {
230 .turbo_mode = 0, 241 .turbo_mode = 0,
231}; 242};
@@ -254,6 +265,7 @@ static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
254 .chip_select = 2, 265 .chip_select = 2,
255 .max_speed_hz = 6000000, 266 .max_speed_hz = 6000000,
256 .controller_data = &mipid_mcspi_config, 267 .controller_data = &mipid_mcspi_config,
268 .platform_data = &acx_pdata,
257 }, 269 },
258 [RX51_SPI_TSC2005] = { 270 [RX51_SPI_TSC2005] = {
259 .modalias = "tsc2005", 271 .modalias = "tsc2005",
diff --git a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c
index bdd1e3a179e1..43a90c8d6837 100644
--- a/arch/arm/mach-omap2/board-rx51-video.c
+++ b/arch/arm/mach-omap2/board-rx51-video.c
@@ -29,34 +29,21 @@
29 29
30#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) 30#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
31 31
32static struct panel_acx565akm_data lcd_data = { 32static struct connector_atv_platform_data rx51_tv_pdata = {
33 .reset_gpio = RX51_LCD_RESET_GPIO, 33 .name = "tv",
34 .source = "venc.0",
35 .connector_type = OMAP_DSS_VENC_TYPE_COMPOSITE,
36 .invert_polarity = false,
34}; 37};
35 38
36static struct omap_dss_device rx51_lcd_device = { 39static struct platform_device rx51_tv_connector_device = {
37 .name = "lcd", 40 .name = "connector-analog-tv",
38 .driver_name = "panel-acx565akm", 41 .id = 0,
39 .type = OMAP_DISPLAY_TYPE_SDI, 42 .dev.platform_data = &rx51_tv_pdata,
40 .phy.sdi.datapairs = 2,
41 .data = &lcd_data,
42};
43
44static struct omap_dss_device rx51_tv_device = {
45 .name = "tv",
46 .type = OMAP_DISPLAY_TYPE_VENC,
47 .driver_name = "venc",
48 .phy.venc.type = OMAP_DSS_VENC_TYPE_COMPOSITE,
49};
50
51static struct omap_dss_device *rx51_dss_devices[] = {
52 &rx51_lcd_device,
53 &rx51_tv_device,
54}; 43};
55 44
56static struct omap_dss_board_info rx51_dss_board_info = { 45static struct omap_dss_board_info rx51_dss_board_info = {
57 .num_devices = ARRAY_SIZE(rx51_dss_devices), 46 .default_display_name = "lcd",
58 .devices = rx51_dss_devices,
59 .default_device = &rx51_lcd_device,
60}; 47};
61 48
62static int __init rx51_video_init(void) 49static int __init rx51_video_init(void)
@@ -71,6 +58,8 @@ static int __init rx51_video_init(void)
71 58
72 omap_display_init(&rx51_dss_board_info); 59 omap_display_init(&rx51_dss_board_info);
73 60
61 platform_device_register(&rx51_tv_connector_device);
62
74 return 0; 63 return 0;
75} 64}
76 65
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
index c2a079cb76fc..3d8ecc1e05bd 100644
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ b/arch/arm/mach-omap2/board-zoom-display.c
@@ -25,32 +25,23 @@
25#define LCD_PANEL_RESET_GPIO_PILOT 55 25#define LCD_PANEL_RESET_GPIO_PILOT 55
26#define LCD_PANEL_QVGA_GPIO 56 26#define LCD_PANEL_QVGA_GPIO 56
27 27
28static struct panel_nec_nl8048_data zoom_lcd_data = { 28static struct panel_nec_nl8048hl11_platform_data zoom_lcd_pdata = {
29 /* res_gpio filled in code */ 29 .name = "lcd",
30 .qvga_gpio = LCD_PANEL_QVGA_GPIO, 30 .source = "dpi.0",
31};
32 31
33static struct omap_dss_device zoom_lcd_device = { 32 .data_lines = 24,
34 .name = "lcd",
35 .driver_name = "NEC_8048_panel",
36 .type = OMAP_DISPLAY_TYPE_DPI,
37 .phy.dpi.data_lines = 24,
38 .data = &zoom_lcd_data,
39};
40 33
41static struct omap_dss_device *zoom_dss_devices[] = { 34 .res_gpio = -1, /* filled in code */
42 &zoom_lcd_device, 35 .qvga_gpio = LCD_PANEL_QVGA_GPIO,
43}; 36};
44 37
45static struct omap_dss_board_info zoom_dss_data = { 38static struct omap_dss_board_info zoom_dss_data = {
46 .num_devices = ARRAY_SIZE(zoom_dss_devices), 39 .default_display_name = "lcd",
47 .devices = zoom_dss_devices,
48 .default_device = &zoom_lcd_device,
49}; 40};
50 41
51static void __init zoom_lcd_panel_init(void) 42static void __init zoom_lcd_panel_init(void)
52{ 43{
53 zoom_lcd_data.res_gpio = (omap_rev() > OMAP3430_REV_ES3_0) ? 44 zoom_lcd_pdata.res_gpio = (omap_rev() > OMAP3430_REV_ES3_0) ?
54 LCD_PANEL_RESET_GPIO_PROD : 45 LCD_PANEL_RESET_GPIO_PROD :
55 LCD_PANEL_RESET_GPIO_PILOT; 46 LCD_PANEL_RESET_GPIO_PILOT;
56} 47}
@@ -61,19 +52,20 @@ static struct omap2_mcspi_device_config dss_lcd_mcspi_config = {
61 52
62static struct spi_board_info nec_8048_spi_board_info[] __initdata = { 53static struct spi_board_info nec_8048_spi_board_info[] __initdata = {
63 [0] = { 54 [0] = {
64 .modalias = "nec_8048_spi", 55 .modalias = "panel-nec-nl8048hl11",
65 .bus_num = 1, 56 .bus_num = 1,
66 .chip_select = 2, 57 .chip_select = 2,
67 .max_speed_hz = 375000, 58 .max_speed_hz = 375000,
68 .controller_data = &dss_lcd_mcspi_config, 59 .controller_data = &dss_lcd_mcspi_config,
60 .platform_data = &zoom_lcd_pdata,
69 }, 61 },
70}; 62};
71 63
72void __init zoom_display_init(void) 64void __init zoom_display_init(void)
73{ 65{
74 omap_display_init(&zoom_dss_data); 66 omap_display_init(&zoom_dss_data);
67 zoom_lcd_panel_init();
75 spi_register_board_info(nec_8048_spi_board_info, 68 spi_register_board_info(nec_8048_spi_board_info,
76 ARRAY_SIZE(nec_8048_spi_board_info)); 69 ARRAY_SIZE(nec_8048_spi_board_info));
77 zoom_lcd_panel_init();
78} 70}
79 71
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index ff37be1f6f93..03a0516c7f67 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -400,7 +400,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
400 400
401 /* Create devices for DPI and SDI */ 401 /* Create devices for DPI and SDI */
402 402
403 pdev = create_simple_dss_pdev("omapdss_dpi", -1, 403 pdev = create_simple_dss_pdev("omapdss_dpi", 0,
404 board_data, sizeof(*board_data), dss_pdev); 404 board_data, sizeof(*board_data), dss_pdev);
405 if (IS_ERR(pdev)) { 405 if (IS_ERR(pdev)) {
406 pr_err("Could not build platform_device for omapdss_dpi\n"); 406 pr_err("Could not build platform_device for omapdss_dpi\n");
@@ -408,7 +408,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
408 } 408 }
409 409
410 if (cpu_is_omap34xx()) { 410 if (cpu_is_omap34xx()) {
411 pdev = create_simple_dss_pdev("omapdss_sdi", -1, 411 pdev = create_simple_dss_pdev("omapdss_sdi", 0,
412 board_data, sizeof(*board_data), dss_pdev); 412 board_data, sizeof(*board_data), dss_pdev);
413 if (IS_ERR(pdev)) { 413 if (IS_ERR(pdev)) {
414 pr_err("Could not build platform_device for omapdss_sdi\n"); 414 pr_err("Could not build platform_device for omapdss_sdi\n");
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
index 043e5705f2a6..bf89effa4c99 100644
--- a/arch/arm/mach-omap2/dss-common.c
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -25,6 +25,7 @@
25 25
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/platform_device.h>
28 29
29#include <video/omapdss.h> 30#include <video/omapdss.h>
30#include <video/omap-panel-data.h> 31#include <video/omap-panel-data.h>
@@ -37,70 +38,76 @@
37#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ 38#define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
38#define HDMI_GPIO_HPD 63 /* Hotplug detect */ 39#define HDMI_GPIO_HPD 63 /* Hotplug detect */
39 40
40/* Display DVI */
41#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0 41#define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
42 42
43/* Using generic display panel */ 43/* DVI Connector */
44static struct tfp410_platform_data omap4_dvi_panel = { 44static struct connector_dvi_platform_data omap4_panda_dvi_connector_pdata = {
45 .i2c_bus_num = 2, 45 .name = "dvi",
46 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO, 46 .source = "tfp410.0",
47 .i2c_bus_num = 2,
47}; 48};
48 49
49static struct omap_dss_device omap4_panda_dvi_device = { 50static struct platform_device omap4_panda_dvi_connector_device = {
50 .type = OMAP_DISPLAY_TYPE_DPI, 51 .name = "connector-dvi",
51 .name = "dvi", 52 .id = 0,
52 .driver_name = "tfp410", 53 .dev.platform_data = &omap4_panda_dvi_connector_pdata,
53 .data = &omap4_dvi_panel,
54 .phy.dpi.data_lines = 24,
55 .channel = OMAP_DSS_CHANNEL_LCD2,
56}; 54};
57 55
58static struct omap_dss_hdmi_data omap4_panda_hdmi_data = { 56/* TFP410 DPI-to-DVI chip */
57static struct encoder_tfp410_platform_data omap4_panda_tfp410_pdata = {
58 .name = "tfp410.0",
59 .source = "dpi.0",
60 .data_lines = 24,
61 .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
62};
63
64static struct platform_device omap4_panda_tfp410_device = {
65 .name = "tfp410",
66 .id = 0,
67 .dev.platform_data = &omap4_panda_tfp410_pdata,
68};
69
70/* HDMI Connector */
71static struct connector_hdmi_platform_data omap4_panda_hdmi_connector_pdata = {
72 .name = "hdmi",
73 .source = "tpd12s015.0",
74};
75
76static struct platform_device omap4_panda_hdmi_connector_device = {
77 .name = "connector-hdmi",
78 .id = 0,
79 .dev.platform_data = &omap4_panda_hdmi_connector_pdata,
80};
81
82/* TPD12S015 HDMI ESD protection & level shifter chip */
83static struct encoder_tpd12s015_platform_data omap4_panda_tpd_pdata = {
84 .name = "tpd12s015.0",
85 .source = "hdmi.0",
86
59 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD, 87 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
60 .ls_oe_gpio = HDMI_GPIO_LS_OE, 88 .ls_oe_gpio = HDMI_GPIO_LS_OE,
61 .hpd_gpio = HDMI_GPIO_HPD, 89 .hpd_gpio = HDMI_GPIO_HPD,
62}; 90};
63 91
64static struct omap_dss_device omap4_panda_hdmi_device = { 92static struct platform_device omap4_panda_tpd_device = {
65 .name = "hdmi", 93 .name = "tpd12s015",
66 .driver_name = "hdmi_panel", 94 .id = 0,
67 .type = OMAP_DISPLAY_TYPE_HDMI, 95 .dev.platform_data = &omap4_panda_tpd_pdata,
68 .channel = OMAP_DSS_CHANNEL_DIGIT,
69 .data = &omap4_panda_hdmi_data,
70};
71
72static struct omap_dss_device *omap4_panda_dss_devices[] = {
73 &omap4_panda_dvi_device,
74 &omap4_panda_hdmi_device,
75}; 96};
76 97
77static struct omap_dss_board_info omap4_panda_dss_data = { 98static struct omap_dss_board_info omap4_panda_dss_data = {
78 .num_devices = ARRAY_SIZE(omap4_panda_dss_devices), 99 .default_display_name = "dvi",
79 .devices = omap4_panda_dss_devices,
80 .default_device = &omap4_panda_dvi_device,
81}; 100};
82 101
83void __init omap4_panda_display_init(void) 102void __init omap4_panda_display_init_of(void)
84{ 103{
85 omap_display_init(&omap4_panda_dss_data); 104 omap_display_init(&omap4_panda_dss_data);
86 105
87 /* 106 platform_device_register(&omap4_panda_tfp410_device);
88 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and 107 platform_device_register(&omap4_panda_dvi_connector_device);
89 * later have external pull up on the HDMI I2C lines
90 */
91 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
92 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
93 else
94 omap_hdmi_init(0);
95
96 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
97 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
98 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
99}
100 108
101void __init omap4_panda_display_init_of(void) 109 platform_device_register(&omap4_panda_tpd_device);
102{ 110 platform_device_register(&omap4_panda_hdmi_connector_device);
103 omap_display_init(&omap4_panda_dss_data);
104} 111}
105 112
106 113
@@ -109,93 +116,73 @@ void __init omap4_panda_display_init_of(void)
109#define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */ 116#define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */
110#define DLP_POWER_ON_GPIO 40 117#define DLP_POWER_ON_GPIO 40
111 118
112static struct nokia_dsi_panel_data dsi1_panel = { 119static struct panel_dsicm_platform_data dsi1_panel = {
113 .name = "taal", 120 .name = "lcd",
114 .reset_gpio = 102, 121 .source = "dsi.0",
115 .use_ext_te = false, 122 .reset_gpio = 102,
116 .ext_te_gpio = 101, 123 .use_ext_te = false,
117 .esd_interval = 0, 124 .ext_te_gpio = 101,
118 .pin_config = { 125 .pin_config = {
119 .num_pins = 6, 126 .num_pins = 6,
120 .pins = { 0, 1, 2, 3, 4, 5 }, 127 .pins = { 0, 1, 2, 3, 4, 5 },
121 },
122};
123
124static struct omap_dss_device sdp4430_lcd_device = {
125 .name = "lcd",
126 .driver_name = "taal",
127 .type = OMAP_DISPLAY_TYPE_DSI,
128 .data = &dsi1_panel,
129 .phy.dsi = {
130 .module = 0,
131 }, 128 },
132 .channel = OMAP_DSS_CHANNEL_LCD,
133}; 129};
134 130
135static struct nokia_dsi_panel_data dsi2_panel = { 131static struct platform_device sdp4430_lcd_device = {
136 .name = "taal", 132 .name = "panel-dsi-cm",
137 .reset_gpio = 104, 133 .id = 0,
138 .use_ext_te = false, 134 .dev.platform_data = &dsi1_panel,
139 .ext_te_gpio = 103,
140 .esd_interval = 0,
141 .pin_config = {
142 .num_pins = 6,
143 .pins = { 0, 1, 2, 3, 4, 5 },
144 },
145}; 135};
146 136
147static struct omap_dss_device sdp4430_lcd2_device = { 137static struct panel_dsicm_platform_data dsi2_panel = {
148 .name = "lcd2", 138 .name = "lcd2",
149 .driver_name = "taal", 139 .source = "dsi.1",
150 .type = OMAP_DISPLAY_TYPE_DSI, 140 .reset_gpio = 104,
151 .data = &dsi2_panel, 141 .use_ext_te = false,
152 .phy.dsi = { 142 .ext_te_gpio = 103,
153 143 .pin_config = {
154 .module = 1, 144 .num_pins = 6,
145 .pins = { 0, 1, 2, 3, 4, 5 },
155 }, 146 },
156 .channel = OMAP_DSS_CHANNEL_LCD2,
157}; 147};
158 148
159static struct omap_dss_hdmi_data sdp4430_hdmi_data = { 149static struct platform_device sdp4430_lcd2_device = {
160 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD, 150 .name = "panel-dsi-cm",
161 .ls_oe_gpio = HDMI_GPIO_LS_OE, 151 .id = 1,
162 .hpd_gpio = HDMI_GPIO_HPD, 152 .dev.platform_data = &dsi2_panel,
163}; 153};
164 154
165static struct omap_dss_device sdp4430_hdmi_device = { 155/* HDMI Connector */
166 .name = "hdmi", 156static struct connector_hdmi_platform_data sdp4430_hdmi_connector_pdata = {
167 .driver_name = "hdmi_panel", 157 .name = "hdmi",
168 .type = OMAP_DISPLAY_TYPE_HDMI, 158 .source = "tpd12s015.0",
169 .channel = OMAP_DSS_CHANNEL_DIGIT,
170 .data = &sdp4430_hdmi_data,
171}; 159};
172 160
173static struct picodlp_panel_data sdp4430_picodlp_pdata = { 161static struct platform_device sdp4430_hdmi_connector_device = {
174 .picodlp_adapter_id = 2, 162 .name = "connector-hdmi",
175 .emu_done_gpio = 44, 163 .id = 0,
176 .pwrgood_gpio = 45, 164 .dev.platform_data = &sdp4430_hdmi_connector_pdata,
177}; 165};
178 166
179static struct omap_dss_device sdp4430_picodlp_device = { 167/* TPD12S015 HDMI ESD protection & level shifter chip */
180 .name = "picodlp", 168static struct encoder_tpd12s015_platform_data sdp4430_tpd_pdata = {
181 .driver_name = "picodlp_panel", 169 .name = "tpd12s015.0",
182 .type = OMAP_DISPLAY_TYPE_DPI, 170 .source = "hdmi.0",
183 .phy.dpi.data_lines = 24, 171
184 .channel = OMAP_DSS_CHANNEL_LCD2, 172 .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
185 .data = &sdp4430_picodlp_pdata, 173 .ls_oe_gpio = HDMI_GPIO_LS_OE,
174 .hpd_gpio = HDMI_GPIO_HPD,
186}; 175};
187 176
188static struct omap_dss_device *sdp4430_dss_devices[] = { 177static struct platform_device sdp4430_tpd_device = {
189 &sdp4430_lcd_device, 178 .name = "tpd12s015",
190 &sdp4430_lcd2_device, 179 .id = 0,
191 &sdp4430_hdmi_device, 180 .dev.platform_data = &sdp4430_tpd_pdata,
192 &sdp4430_picodlp_device,
193}; 181};
194 182
183
195static struct omap_dss_board_info sdp4430_dss_data = { 184static struct omap_dss_board_info sdp4430_dss_data = {
196 .num_devices = ARRAY_SIZE(sdp4430_dss_devices), 185 .default_display_name = "lcd",
197 .devices = sdp4430_dss_devices,
198 .default_device = &sdp4430_lcd_device,
199}; 186};
200 187
201/* 188/*
@@ -204,7 +191,7 @@ static struct omap_dss_board_info sdp4430_dss_data = {
204 * used by picodlp on the 4430sdp platform. Keep this gpio disabled as LCD2 is 191 * used by picodlp on the 4430sdp platform. Keep this gpio disabled as LCD2 is
205 * selected by default 192 * selected by default
206 */ 193 */
207void __init omap_4430sdp_display_init(void) 194void __init omap_4430sdp_display_init_of(void)
208{ 195{
209 int r; 196 int r;
210 197
@@ -219,33 +206,10 @@ void __init omap_4430sdp_display_init(void)
219 pr_err("%s: Could not get DLP POWER ON GPIO\n", __func__); 206 pr_err("%s: Could not get DLP POWER ON GPIO\n", __func__);
220 207
221 omap_display_init(&sdp4430_dss_data); 208 omap_display_init(&sdp4430_dss_data);
222 /*
223 * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
224 * later have external pull up on the HDMI I2C lines
225 */
226 if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
227 omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
228 else
229 omap_hdmi_init(0);
230
231 omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
232 omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
233 omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
234}
235
236void __init omap_4430sdp_display_init_of(void)
237{
238 int r;
239 209
240 r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH, 210 platform_device_register(&sdp4430_lcd_device);
241 "display_sel"); 211 platform_device_register(&sdp4430_lcd2_device);
242 if (r)
243 pr_err("%s: Could not get display_sel GPIO\n", __func__);
244
245 r = gpio_request_one(DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
246 "DLP POWER ON");
247 if (r)
248 pr_err("%s: Could not get DLP POWER ON GPIO\n", __func__);
249 212
250 omap_display_init(&sdp4430_dss_data); 213 platform_device_register(&sdp4430_tpd_device);
214 platform_device_register(&sdp4430_hdmi_connector_device);
251} 215}
diff --git a/arch/arm/mach-omap2/dss-common.h b/arch/arm/mach-omap2/dss-common.h
index 915f6fff5106..c28fe3c03588 100644
--- a/arch/arm/mach-omap2/dss-common.h
+++ b/arch/arm/mach-omap2/dss-common.h
@@ -6,9 +6,7 @@
6 * This file will be removed when DSS supports DT. 6 * This file will be removed when DSS supports DT.
7 */ 7 */
8 8
9void __init omap4_panda_display_init(void);
10void __init omap4_panda_display_init_of(void); 9void __init omap4_panda_display_init_of(void);
11void __init omap_4430sdp_display_init(void);
12void __init omap_4430sdp_display_init_of(void); 10void __init omap_4430sdp_display_init_of(void);
13 11
14#endif 12#endif
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index c29451ba65da..6a12e899235b 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -133,7 +133,7 @@ int omap_encoder_update(struct drm_encoder *encoder,
133 struct omap_dss_driver *dssdrv = dssdev->driver; 133 struct omap_dss_driver *dssdrv = dssdev->driver;
134 int ret; 134 int ret;
135 135
136 dssdev->output->manager = mgr; 136 dssdev->src->manager = mgr;
137 137
138 if (dssdrv->check_timings) { 138 if (dssdrv->check_timings) {
139 ret = dssdrv->check_timings(dssdev, timings); 139 ret = dssdrv->check_timings(dssdev, timings);
diff --git a/drivers/video/omap2/Kconfig b/drivers/video/omap2/Kconfig
index 56cad0f5386c..63b23f87081d 100644
--- a/drivers/video/omap2/Kconfig
+++ b/drivers/video/omap2/Kconfig
@@ -5,7 +5,6 @@ if ARCH_OMAP2PLUS
5 5
6source "drivers/video/omap2/dss/Kconfig" 6source "drivers/video/omap2/dss/Kconfig"
7source "drivers/video/omap2/omapfb/Kconfig" 7source "drivers/video/omap2/omapfb/Kconfig"
8source "drivers/video/omap2/displays/Kconfig"
9source "drivers/video/omap2/displays-new/Kconfig" 8source "drivers/video/omap2/displays-new/Kconfig"
10 9
11endif 10endif
diff --git a/drivers/video/omap2/Makefile b/drivers/video/omap2/Makefile
index 86873c2fbb27..bf8127df8c71 100644
--- a/drivers/video/omap2/Makefile
+++ b/drivers/video/omap2/Makefile
@@ -1,6 +1,5 @@
1obj-$(CONFIG_OMAP2_VRFB) += vrfb.o 1obj-$(CONFIG_OMAP2_VRFB) += vrfb.o
2 2
3obj-$(CONFIG_OMAP2_DSS) += dss/ 3obj-$(CONFIG_OMAP2_DSS) += dss/
4obj-y += displays/
5obj-y += displays-new/ 4obj-y += displays-new/
6obj-$(CONFIG_FB_OMAP2) += omapfb/ 5obj-$(CONFIG_FB_OMAP2) += omapfb/
diff --git a/drivers/video/omap2/displays-new/encoder-tfp410.c b/drivers/video/omap2/displays-new/encoder-tfp410.c
index a04f65856d6b..4a291e756be9 100644
--- a/drivers/video/omap2/displays-new/encoder-tfp410.c
+++ b/drivers/video/omap2/displays-new/encoder-tfp410.c
@@ -43,8 +43,8 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
43 if (r) 43 if (r)
44 return r; 44 return r;
45 45
46 dst->output = dssdev; 46 dst->src = dssdev;
47 dssdev->device = dst; 47 dssdev->dst = dst;
48 48
49 return 0; 49 return 0;
50} 50}
@@ -59,12 +59,12 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev,
59 if (!omapdss_device_is_connected(dssdev)) 59 if (!omapdss_device_is_connected(dssdev))
60 return; 60 return;
61 61
62 WARN_ON(dst != dssdev->device); 62 WARN_ON(dst != dssdev->dst);
63 if (dst != dssdev->device) 63 if (dst != dssdev->dst)
64 return; 64 return;
65 65
66 dst->output = NULL; 66 dst->src = NULL;
67 dssdev->device = NULL; 67 dssdev->dst = NULL;
68 68
69 in->ops.dpi->disconnect(in, &ddata->dssdev); 69 in->ops.dpi->disconnect(in, &ddata->dssdev);
70} 70}
@@ -244,7 +244,7 @@ static int __exit tfp410_remove(struct platform_device *pdev)
244 244
245 WARN_ON(omapdss_device_is_connected(dssdev)); 245 WARN_ON(omapdss_device_is_connected(dssdev));
246 if (omapdss_device_is_connected(dssdev)) 246 if (omapdss_device_is_connected(dssdev))
247 tfp410_disconnect(dssdev, dssdev->device); 247 tfp410_disconnect(dssdev, dssdev->dst);
248 248
249 omap_dss_put_device(in); 249 omap_dss_put_device(in);
250 250
diff --git a/drivers/video/omap2/displays-new/encoder-tpd12s015.c b/drivers/video/omap2/displays-new/encoder-tpd12s015.c
index ce0e010026cb..798ef200b055 100644
--- a/drivers/video/omap2/displays-new/encoder-tpd12s015.c
+++ b/drivers/video/omap2/displays-new/encoder-tpd12s015.c
@@ -66,8 +66,8 @@ static int tpd_connect(struct omap_dss_device *dssdev,
66 if (r) 66 if (r)
67 return r; 67 return r;
68 68
69 dst->output = dssdev; 69 dst->src = dssdev;
70 dssdev->device = dst; 70 dssdev->dst = dst;
71 71
72 INIT_COMPLETION(ddata->hpd_completion); 72 INIT_COMPLETION(ddata->hpd_completion);
73 73
@@ -95,15 +95,15 @@ static void tpd_disconnect(struct omap_dss_device *dssdev,
95 struct panel_drv_data *ddata = to_panel_data(dssdev); 95 struct panel_drv_data *ddata = to_panel_data(dssdev);
96 struct omap_dss_device *in = ddata->in; 96 struct omap_dss_device *in = ddata->in;
97 97
98 WARN_ON(dst != dssdev->device); 98 WARN_ON(dst != dssdev->dst);
99 99
100 if (dst != dssdev->device) 100 if (dst != dssdev->dst)
101 return; 101 return;
102 102
103 gpio_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0); 103 gpio_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0);
104 104
105 dst->output = NULL; 105 dst->src = NULL;
106 dssdev->device = NULL; 106 dssdev->dst = NULL;
107 107
108 in->ops.hdmi->disconnect(in, &ddata->dssdev); 108 in->ops.hdmi->disconnect(in, &ddata->dssdev);
109} 109}
@@ -372,7 +372,7 @@ static int __exit tpd_remove(struct platform_device *pdev)
372 372
373 WARN_ON(omapdss_device_is_connected(dssdev)); 373 WARN_ON(omapdss_device_is_connected(dssdev));
374 if (omapdss_device_is_connected(dssdev)) 374 if (omapdss_device_is_connected(dssdev))
375 tpd_disconnect(dssdev, dssdev->device); 375 tpd_disconnect(dssdev, dssdev->dst);
376 376
377 omap_dss_put_device(in); 377 omap_dss_put_device(in);
378 378
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
deleted file mode 100644
index e80ac1c79561..000000000000
--- a/drivers/video/omap2/displays/Kconfig
+++ /dev/null
@@ -1,75 +0,0 @@
1menu "OMAP2/3 Display Device Drivers (old device model)"
2 depends on OMAP2_DSS
3
4config PANEL_GENERIC_DPI
5 tristate "Generic DPI Panel"
6 depends on OMAP2_DSS_DPI
7 help
8 Generic DPI panel driver.
9 Supports DVI output for Beagle and OMAP3 SDP.
10 Supports LCD Panel used in TI SDP3430 and EVM boards,
11 OMAP3517 EVM boards and CM-T35.
12
13config PANEL_TFP410
14 tristate "TFP410 DPI-to-DVI chip"
15 depends on OMAP2_DSS_DPI && I2C
16 help
17 Driver for TFP410 DPI-to-DVI chip. The driver uses i2c to read EDID
18 information from the monitor.
19
20config PANEL_LGPHILIPS_LB035Q02
21 tristate "LG.Philips LB035Q02 LCD Panel"
22 depends on OMAP2_DSS_DPI && SPI
23 help
24 LCD Panel used on the Gumstix Overo Palo35
25
26config PANEL_SHARP_LS037V7DW01
27 tristate "Sharp LS037V7DW01 LCD Panel"
28 depends on OMAP2_DSS_DPI
29 depends on BACKLIGHT_CLASS_DEVICE
30 help
31 LCD Panel used in TI's SDP3430 and EVM boards
32
33config PANEL_NEC_NL8048HL11_01B
34 tristate "NEC NL8048HL11-01B Panel"
35 depends on OMAP2_DSS_DPI
36 depends on SPI
37 depends on BACKLIGHT_CLASS_DEVICE
38 help
39 This NEC NL8048HL11-01B panel is TFT LCD
40 used in the Zoom2/3/3630 sdp boards.
41
42config PANEL_PICODLP
43 tristate "TI PICO DLP mini-projector"
44 depends on OMAP2_DSS_DPI && I2C
45 help
46 A mini-projector used in TI's SDP4430 and EVM boards
47 For more info please visit http://www.dlp.com/projector/
48
49config PANEL_TAAL
50 tristate "Taal DSI Panel"
51 depends on OMAP2_DSS_DSI
52 depends on BACKLIGHT_CLASS_DEVICE
53 help
54 Taal DSI command mode panel from TPO.
55
56config PANEL_TPO_TD043MTEA1
57 tristate "TPO TD043MTEA1 LCD Panel"
58 depends on OMAP2_DSS_DPI && SPI
59 help
60 LCD Panel used in OMAP3 Pandora
61
62config PANEL_ACX565AKM
63 tristate "ACX565AKM Panel"
64 depends on OMAP2_DSS_SDI && SPI
65 depends on BACKLIGHT_CLASS_DEVICE
66 help
67 This is the LCD panel used on Nokia N900
68
69config PANEL_N8X0
70 tristate "N8X0 Panel"
71 depends on OMAP2_DSS_RFBI && SPI
72 depends on BACKLIGHT_CLASS_DEVICE
73 help
74 This is the LCD panel used on Nokia N8x0
75endmenu
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile
deleted file mode 100644
index 58a5176b07b0..000000000000
--- a/drivers/video/omap2/displays/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
1obj-$(CONFIG_PANEL_GENERIC_DPI) += panel-generic-dpi.o
2obj-$(CONFIG_PANEL_TFP410) += panel-tfp410.o
3obj-$(CONFIG_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o
4obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o
5obj-$(CONFIG_PANEL_NEC_NL8048HL11_01B) += panel-nec-nl8048hl11-01b.o
6
7obj-$(CONFIG_PANEL_TAAL) += panel-taal.o
8obj-$(CONFIG_PANEL_PICODLP) += panel-picodlp.o
9obj-$(CONFIG_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o
10obj-$(CONFIG_PANEL_ACX565AKM) += panel-acx565akm.o
11obj-$(CONFIG_PANEL_N8X0) += panel-n8x0.o
diff --git a/drivers/video/omap2/displays/panel-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c
deleted file mode 100644
index 3fd100fc853e..000000000000
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ /dev/null
@@ -1,798 +0,0 @@
1/*
2 * Support for ACX565AKM LCD Panel used on Nokia N900
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Original Driver Author: Imre Deak <imre.deak@nokia.com>
7 * Based on panel-generic.c by Tomi Valkeinen <tomi.valkeinen@nokia.com>
8 * Adapted to new DSS2 framework: Roger Quadros <roger.quadros@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published by
12 * the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/platform_device.h>
26#include <linux/delay.h>
27#include <linux/spi/spi.h>
28#include <linux/jiffies.h>
29#include <linux/sched.h>
30#include <linux/backlight.h>
31#include <linux/fb.h>
32#include <linux/gpio.h>
33
34#include <video/omapdss.h>
35#include <video/omap-panel-data.h>
36
37#define MIPID_CMD_READ_DISP_ID 0x04
38#define MIPID_CMD_READ_RED 0x06
39#define MIPID_CMD_READ_GREEN 0x07
40#define MIPID_CMD_READ_BLUE 0x08
41#define MIPID_CMD_READ_DISP_STATUS 0x09
42#define MIPID_CMD_RDDSDR 0x0F
43#define MIPID_CMD_SLEEP_IN 0x10
44#define MIPID_CMD_SLEEP_OUT 0x11
45#define MIPID_CMD_DISP_OFF 0x28
46#define MIPID_CMD_DISP_ON 0x29
47#define MIPID_CMD_WRITE_DISP_BRIGHTNESS 0x51
48#define MIPID_CMD_READ_DISP_BRIGHTNESS 0x52
49#define MIPID_CMD_WRITE_CTRL_DISP 0x53
50
51#define CTRL_DISP_BRIGHTNESS_CTRL_ON (1 << 5)
52#define CTRL_DISP_AMBIENT_LIGHT_CTRL_ON (1 << 4)
53#define CTRL_DISP_BACKLIGHT_ON (1 << 2)
54#define CTRL_DISP_AUTO_BRIGHTNESS_ON (1 << 1)
55
56#define MIPID_CMD_READ_CTRL_DISP 0x54
57#define MIPID_CMD_WRITE_CABC 0x55
58#define MIPID_CMD_READ_CABC 0x56
59
60#define MIPID_VER_LPH8923 3
61#define MIPID_VER_LS041Y3 4
62#define MIPID_VER_L4F00311 8
63#define MIPID_VER_ACX565AKM 9
64
65struct acx565akm_device {
66 char *name;
67 int enabled;
68 int model;
69 int revision;
70 u8 display_id[3];
71 unsigned has_bc:1;
72 unsigned has_cabc:1;
73 unsigned cabc_mode;
74 unsigned long hw_guard_end; /* next value of jiffies
75 when we can issue the
76 next sleep in/out command */
77 unsigned long hw_guard_wait; /* max guard time in jiffies */
78
79 struct spi_device *spi;
80 struct mutex mutex;
81
82 struct omap_dss_device *dssdev;
83 struct backlight_device *bl_dev;
84};
85
86static struct acx565akm_device acx_dev;
87static int acx565akm_bl_update_status(struct backlight_device *dev);
88
89/*--------------------MIPID interface-----------------------------*/
90
91static void acx565akm_transfer(struct acx565akm_device *md, int cmd,
92 const u8 *wbuf, int wlen, u8 *rbuf, int rlen)
93{
94 struct spi_message m;
95 struct spi_transfer *x, xfer[5];
96 int r;
97
98 BUG_ON(md->spi == NULL);
99
100 spi_message_init(&m);
101
102 memset(xfer, 0, sizeof(xfer));
103 x = &xfer[0];
104
105 cmd &= 0xff;
106 x->tx_buf = &cmd;
107 x->bits_per_word = 9;
108 x->len = 2;
109
110 if (rlen > 1 && wlen == 0) {
111 /*
112 * Between the command and the response data there is a
113 * dummy clock cycle. Add an extra bit after the command
114 * word to account for this.
115 */
116 x->bits_per_word = 10;
117 cmd <<= 1;
118 }
119 spi_message_add_tail(x, &m);
120
121 if (wlen) {
122 x++;
123 x->tx_buf = wbuf;
124 x->len = wlen;
125 x->bits_per_word = 9;
126 spi_message_add_tail(x, &m);
127 }
128
129 if (rlen) {
130 x++;
131 x->rx_buf = rbuf;
132 x->len = rlen;
133 spi_message_add_tail(x, &m);
134 }
135
136 r = spi_sync(md->spi, &m);
137 if (r < 0)
138 dev_dbg(&md->spi->dev, "spi_sync %d\n", r);
139}
140
141static inline void acx565akm_cmd(struct acx565akm_device *md, int cmd)
142{
143 acx565akm_transfer(md, cmd, NULL, 0, NULL, 0);
144}
145
146static inline void acx565akm_write(struct acx565akm_device *md,
147 int reg, const u8 *buf, int len)
148{
149 acx565akm_transfer(md, reg, buf, len, NULL, 0);
150}
151
152static inline void acx565akm_read(struct acx565akm_device *md,
153 int reg, u8 *buf, int len)
154{
155 acx565akm_transfer(md, reg, NULL, 0, buf, len);
156}
157
158static void hw_guard_start(struct acx565akm_device *md, int guard_msec)
159{
160 md->hw_guard_wait = msecs_to_jiffies(guard_msec);
161 md->hw_guard_end = jiffies + md->hw_guard_wait;
162}
163
164static void hw_guard_wait(struct acx565akm_device *md)
165{
166 unsigned long wait = md->hw_guard_end - jiffies;
167
168 if ((long)wait > 0 && wait <= md->hw_guard_wait) {
169 set_current_state(TASK_UNINTERRUPTIBLE);
170 schedule_timeout(wait);
171 }
172}
173
174/*----------------------MIPID wrappers----------------------------*/
175
176static void set_sleep_mode(struct acx565akm_device *md, int on)
177{
178 int cmd;
179
180 if (on)
181 cmd = MIPID_CMD_SLEEP_IN;
182 else
183 cmd = MIPID_CMD_SLEEP_OUT;
184 /*
185 * We have to keep 120msec between sleep in/out commands.
186 * (8.2.15, 8.2.16).
187 */
188 hw_guard_wait(md);
189 acx565akm_cmd(md, cmd);
190 hw_guard_start(md, 120);
191}
192
193static void set_display_state(struct acx565akm_device *md, int enabled)
194{
195 int cmd = enabled ? MIPID_CMD_DISP_ON : MIPID_CMD_DISP_OFF;
196
197 acx565akm_cmd(md, cmd);
198}
199
200static int panel_enabled(struct acx565akm_device *md)
201{
202 u32 disp_status;
203 int enabled;
204
205 acx565akm_read(md, MIPID_CMD_READ_DISP_STATUS, (u8 *)&disp_status, 4);
206 disp_status = __be32_to_cpu(disp_status);
207 enabled = (disp_status & (1 << 17)) && (disp_status & (1 << 10));
208 dev_dbg(&md->spi->dev,
209 "LCD panel %senabled by bootloader (status 0x%04x)\n",
210 enabled ? "" : "not ", disp_status);
211 return enabled;
212}
213
214static int panel_detect(struct acx565akm_device *md)
215{
216 acx565akm_read(md, MIPID_CMD_READ_DISP_ID, md->display_id, 3);
217 dev_dbg(&md->spi->dev, "MIPI display ID: %02x%02x%02x\n",
218 md->display_id[0], md->display_id[1], md->display_id[2]);
219
220 switch (md->display_id[0]) {
221 case 0x10:
222 md->model = MIPID_VER_ACX565AKM;
223 md->name = "acx565akm";
224 md->has_bc = 1;
225 md->has_cabc = 1;
226 break;
227 case 0x29:
228 md->model = MIPID_VER_L4F00311;
229 md->name = "l4f00311";
230 break;
231 case 0x45:
232 md->model = MIPID_VER_LPH8923;
233 md->name = "lph8923";
234 break;
235 case 0x83:
236 md->model = MIPID_VER_LS041Y3;
237 md->name = "ls041y3";
238 break;
239 default:
240 md->name = "unknown";
241 dev_err(&md->spi->dev, "invalid display ID\n");
242 return -ENODEV;
243 }
244
245 md->revision = md->display_id[1];
246
247 dev_info(&md->spi->dev, "omapfb: %s rev %02x LCD detected\n",
248 md->name, md->revision);
249
250 return 0;
251}
252
253/*----------------------Backlight Control-------------------------*/
254
255static void enable_backlight_ctrl(struct acx565akm_device *md, int enable)
256{
257 u16 ctrl;
258
259 acx565akm_read(md, MIPID_CMD_READ_CTRL_DISP, (u8 *)&ctrl, 1);
260 if (enable) {
261 ctrl |= CTRL_DISP_BRIGHTNESS_CTRL_ON |
262 CTRL_DISP_BACKLIGHT_ON;
263 } else {
264 ctrl &= ~(CTRL_DISP_BRIGHTNESS_CTRL_ON |
265 CTRL_DISP_BACKLIGHT_ON);
266 }
267
268 ctrl |= 1 << 8;
269 acx565akm_write(md, MIPID_CMD_WRITE_CTRL_DISP, (u8 *)&ctrl, 2);
270}
271
272static void set_cabc_mode(struct acx565akm_device *md, unsigned mode)
273{
274 u16 cabc_ctrl;
275
276 md->cabc_mode = mode;
277 if (!md->enabled)
278 return;
279 cabc_ctrl = 0;
280 acx565akm_read(md, MIPID_CMD_READ_CABC, (u8 *)&cabc_ctrl, 1);
281 cabc_ctrl &= ~3;
282 cabc_ctrl |= (1 << 8) | (mode & 3);
283 acx565akm_write(md, MIPID_CMD_WRITE_CABC, (u8 *)&cabc_ctrl, 2);
284}
285
286static unsigned get_cabc_mode(struct acx565akm_device *md)
287{
288 return md->cabc_mode;
289}
290
291static unsigned get_hw_cabc_mode(struct acx565akm_device *md)
292{
293 u8 cabc_ctrl;
294
295 acx565akm_read(md, MIPID_CMD_READ_CABC, &cabc_ctrl, 1);
296 return cabc_ctrl & 3;
297}
298
299static void acx565akm_set_brightness(struct acx565akm_device *md, int level)
300{
301 int bv;
302
303 bv = level | (1 << 8);
304 acx565akm_write(md, MIPID_CMD_WRITE_DISP_BRIGHTNESS, (u8 *)&bv, 2);
305
306 if (level)
307 enable_backlight_ctrl(md, 1);
308 else
309 enable_backlight_ctrl(md, 0);
310}
311
312static int acx565akm_get_actual_brightness(struct acx565akm_device *md)
313{
314 u8 bv;
315
316 acx565akm_read(md, MIPID_CMD_READ_DISP_BRIGHTNESS, &bv, 1);
317
318 return bv;
319}
320
321
322static int acx565akm_bl_update_status(struct backlight_device *dev)
323{
324 struct acx565akm_device *md = dev_get_drvdata(&dev->dev);
325 int r;
326 int level;
327
328 dev_dbg(&md->spi->dev, "%s\n", __func__);
329
330 mutex_lock(&md->mutex);
331
332 if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
333 dev->props.power == FB_BLANK_UNBLANK)
334 level = dev->props.brightness;
335 else
336 level = 0;
337
338 r = 0;
339 if (md->has_bc)
340 acx565akm_set_brightness(md, level);
341 else
342 r = -ENODEV;
343
344 mutex_unlock(&md->mutex);
345
346 return r;
347}
348
349static int acx565akm_bl_get_intensity(struct backlight_device *dev)
350{
351 struct acx565akm_device *md = dev_get_drvdata(&dev->dev);
352
353 dev_dbg(&dev->dev, "%s\n", __func__);
354
355 if (!md->has_bc)
356 return -ENODEV;
357
358 if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
359 dev->props.power == FB_BLANK_UNBLANK) {
360 if (md->has_bc)
361 return acx565akm_get_actual_brightness(md);
362 else
363 return dev->props.brightness;
364 }
365
366 return 0;
367}
368
369static const struct backlight_ops acx565akm_bl_ops = {
370 .get_brightness = acx565akm_bl_get_intensity,
371 .update_status = acx565akm_bl_update_status,
372};
373
374/*--------------------Auto Brightness control via Sysfs---------------------*/
375
376static const char *cabc_modes[] = {
377 "off", /* always used when CABC is not supported */
378 "ui",
379 "still-image",
380 "moving-image",
381};
382
383static ssize_t show_cabc_mode(struct device *dev,
384 struct device_attribute *attr,
385 char *buf)
386{
387 struct acx565akm_device *md = dev_get_drvdata(dev);
388 const char *mode_str;
389 int mode;
390 int len;
391
392 if (!md->has_cabc)
393 mode = 0;
394 else
395 mode = get_cabc_mode(md);
396 mode_str = "unknown";
397 if (mode >= 0 && mode < ARRAY_SIZE(cabc_modes))
398 mode_str = cabc_modes[mode];
399 len = snprintf(buf, PAGE_SIZE, "%s\n", mode_str);
400
401 return len < PAGE_SIZE - 1 ? len : PAGE_SIZE - 1;
402}
403
404static ssize_t store_cabc_mode(struct device *dev,
405 struct device_attribute *attr,
406 const char *buf, size_t count)
407{
408 struct acx565akm_device *md = dev_get_drvdata(dev);
409 int i;
410
411 for (i = 0; i < ARRAY_SIZE(cabc_modes); i++) {
412 const char *mode_str = cabc_modes[i];
413 int cmp_len = strlen(mode_str);
414
415 if (count > 0 && buf[count - 1] == '\n')
416 count--;
417 if (count != cmp_len)
418 continue;
419
420 if (strncmp(buf, mode_str, cmp_len) == 0)
421 break;
422 }
423
424 if (i == ARRAY_SIZE(cabc_modes))
425 return -EINVAL;
426
427 if (!md->has_cabc && i != 0)
428 return -EINVAL;
429
430 mutex_lock(&md->mutex);
431 set_cabc_mode(md, i);
432 mutex_unlock(&md->mutex);
433
434 return count;
435}
436
437static ssize_t show_cabc_available_modes(struct device *dev,
438 struct device_attribute *attr,
439 char *buf)
440{
441 struct acx565akm_device *md = dev_get_drvdata(dev);
442 int len;
443 int i;
444
445 if (!md->has_cabc)
446 return snprintf(buf, PAGE_SIZE, "%s\n", cabc_modes[0]);
447
448 for (i = 0, len = 0;
449 len < PAGE_SIZE && i < ARRAY_SIZE(cabc_modes); i++)
450 len += snprintf(&buf[len], PAGE_SIZE - len, "%s%s%s",
451 i ? " " : "", cabc_modes[i],
452 i == ARRAY_SIZE(cabc_modes) - 1 ? "\n" : "");
453
454 return len < PAGE_SIZE ? len : PAGE_SIZE - 1;
455}
456
457static DEVICE_ATTR(cabc_mode, S_IRUGO | S_IWUSR,
458 show_cabc_mode, store_cabc_mode);
459static DEVICE_ATTR(cabc_available_modes, S_IRUGO,
460 show_cabc_available_modes, NULL);
461
462static struct attribute *bldev_attrs[] = {
463 &dev_attr_cabc_mode.attr,
464 &dev_attr_cabc_available_modes.attr,
465 NULL,
466};
467
468static struct attribute_group bldev_attr_group = {
469 .attrs = bldev_attrs,
470};
471
472
473/*---------------------------ACX Panel----------------------------*/
474
475static int acx_get_recommended_bpp(struct omap_dss_device *dssdev)
476{
477 return 16;
478}
479
480static struct omap_video_timings acx_panel_timings = {
481 .x_res = 800,
482 .y_res = 480,
483 .pixel_clock = 24000,
484 .hfp = 28,
485 .hsw = 4,
486 .hbp = 24,
487 .vfp = 3,
488 .vsw = 3,
489 .vbp = 4,
490
491 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
492 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
493
494 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
495 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
496 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
497};
498
499static struct panel_acx565akm_data *get_panel_data(struct omap_dss_device *dssdev)
500{
501 return (struct panel_acx565akm_data *) dssdev->data;
502}
503
504static int acx_panel_probe(struct omap_dss_device *dssdev)
505{
506 int r;
507 struct acx565akm_device *md = &acx_dev;
508 struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
509 struct backlight_device *bldev;
510 int max_brightness, brightness;
511 struct backlight_properties props;
512
513 dev_dbg(dssdev->dev, "%s\n", __func__);
514
515 if (!panel_data)
516 return -EINVAL;
517
518 /* FIXME AC bias ? */
519 dssdev->panel.timings = acx_panel_timings;
520
521 if (gpio_is_valid(panel_data->reset_gpio)) {
522 r = devm_gpio_request_one(dssdev->dev, panel_data->reset_gpio,
523 GPIOF_OUT_INIT_LOW, "lcd reset");
524 if (r)
525 return r;
526 }
527
528 if (gpio_is_valid(panel_data->reset_gpio))
529 gpio_set_value(panel_data->reset_gpio, 1);
530
531 /*
532 * After reset we have to wait 5 msec before the first
533 * command can be sent.
534 */
535 msleep(5);
536
537 md->enabled = panel_enabled(md);
538
539 r = panel_detect(md);
540 if (r) {
541 dev_err(dssdev->dev, "%s panel detect error\n", __func__);
542 if (!md->enabled && gpio_is_valid(panel_data->reset_gpio))
543 gpio_set_value(panel_data->reset_gpio, 0);
544
545 return r;
546 }
547
548 mutex_lock(&acx_dev.mutex);
549 acx_dev.dssdev = dssdev;
550 mutex_unlock(&acx_dev.mutex);
551
552 if (!md->enabled) {
553 if (gpio_is_valid(panel_data->reset_gpio))
554 gpio_set_value(panel_data->reset_gpio, 0);
555 }
556
557 /*------- Backlight control --------*/
558
559 memset(&props, 0, sizeof(props));
560 props.fb_blank = FB_BLANK_UNBLANK;
561 props.power = FB_BLANK_UNBLANK;
562 props.type = BACKLIGHT_RAW;
563
564 bldev = backlight_device_register("acx565akm", &md->spi->dev,
565 md, &acx565akm_bl_ops, &props);
566 md->bl_dev = bldev;
567 if (md->has_cabc) {
568 r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group);
569 if (r) {
570 dev_err(&bldev->dev,
571 "%s failed to create sysfs files\n", __func__);
572 backlight_device_unregister(bldev);
573 return r;
574 }
575 md->cabc_mode = get_hw_cabc_mode(md);
576 }
577
578 max_brightness = 255;
579
580 if (md->has_bc)
581 brightness = acx565akm_get_actual_brightness(md);
582 else
583 brightness = 0;
584
585 bldev->props.max_brightness = max_brightness;
586 bldev->props.brightness = brightness;
587
588 acx565akm_bl_update_status(bldev);
589 return 0;
590}
591
592static void acx_panel_remove(struct omap_dss_device *dssdev)
593{
594 struct acx565akm_device *md = &acx_dev;
595
596 dev_dbg(dssdev->dev, "%s\n", __func__);
597 sysfs_remove_group(&md->bl_dev->dev.kobj, &bldev_attr_group);
598 backlight_device_unregister(md->bl_dev);
599 mutex_lock(&acx_dev.mutex);
600 acx_dev.dssdev = NULL;
601 mutex_unlock(&acx_dev.mutex);
602}
603
604static int acx_panel_power_on(struct omap_dss_device *dssdev)
605{
606 struct acx565akm_device *md = &acx_dev;
607 struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
608 int r;
609
610 dev_dbg(dssdev->dev, "%s\n", __func__);
611
612 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
613 return 0;
614
615 mutex_lock(&md->mutex);
616
617 omapdss_sdi_set_timings(dssdev, &dssdev->panel.timings);
618 omapdss_sdi_set_datapairs(dssdev, dssdev->phy.sdi.datapairs);
619
620 r = omapdss_sdi_display_enable(dssdev);
621 if (r) {
622 pr_err("%s sdi enable failed\n", __func__);
623 goto fail_unlock;
624 }
625
626 /*FIXME tweak me */
627 msleep(50);
628
629 if (gpio_is_valid(panel_data->reset_gpio))
630 gpio_set_value(panel_data->reset_gpio, 1);
631
632 if (md->enabled) {
633 dev_dbg(&md->spi->dev, "panel already enabled\n");
634 mutex_unlock(&md->mutex);
635 return 0;
636 }
637
638 /*
639 * We have to meet all the following delay requirements:
640 * 1. tRW: reset pulse width 10usec (7.12.1)
641 * 2. tRT: reset cancel time 5msec (7.12.1)
642 * 3. Providing PCLK,HS,VS signals for 2 frames = ~50msec worst
643 * case (7.6.2)
644 * 4. 120msec before the sleep out command (7.12.1)
645 */
646 msleep(120);
647
648 set_sleep_mode(md, 0);
649 md->enabled = 1;
650
651 /* 5msec between sleep out and the next command. (8.2.16) */
652 msleep(5);
653 set_display_state(md, 1);
654 set_cabc_mode(md, md->cabc_mode);
655
656 mutex_unlock(&md->mutex);
657
658 return acx565akm_bl_update_status(md->bl_dev);
659
660fail_unlock:
661 mutex_unlock(&md->mutex);
662 return r;
663}
664
665static void acx_panel_power_off(struct omap_dss_device *dssdev)
666{
667 struct acx565akm_device *md = &acx_dev;
668 struct panel_acx565akm_data *panel_data = get_panel_data(dssdev);
669
670 dev_dbg(dssdev->dev, "%s\n", __func__);
671
672 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
673 return;
674
675 mutex_lock(&md->mutex);
676
677 if (!md->enabled) {
678 mutex_unlock(&md->mutex);
679 return;
680 }
681 set_display_state(md, 0);
682 set_sleep_mode(md, 1);
683 md->enabled = 0;
684 /*
685 * We have to provide PCLK,HS,VS signals for 2 frames (worst case
686 * ~50msec) after sending the sleep in command and asserting the
687 * reset signal. We probably could assert the reset w/o the delay
688 * but we still delay to avoid possible artifacts. (7.6.1)
689 */
690 msleep(50);
691
692 if (gpio_is_valid(panel_data->reset_gpio))
693 gpio_set_value(panel_data->reset_gpio, 0);
694
695 /* FIXME need to tweak this delay */
696 msleep(100);
697
698 omapdss_sdi_display_disable(dssdev);
699
700 mutex_unlock(&md->mutex);
701}
702
703static int acx_panel_enable(struct omap_dss_device *dssdev)
704{
705 int r;
706
707 dev_dbg(dssdev->dev, "%s\n", __func__);
708 r = acx_panel_power_on(dssdev);
709
710 if (r)
711 return r;
712
713 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
714 return 0;
715}
716
717static void acx_panel_disable(struct omap_dss_device *dssdev)
718{
719 dev_dbg(dssdev->dev, "%s\n", __func__);
720 acx_panel_power_off(dssdev);
721 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
722}
723
724static void acx_panel_set_timings(struct omap_dss_device *dssdev,
725 struct omap_video_timings *timings)
726{
727 omapdss_sdi_set_timings(dssdev, timings);
728
729 dssdev->panel.timings = *timings;
730}
731
732static int acx_panel_check_timings(struct omap_dss_device *dssdev,
733 struct omap_video_timings *timings)
734{
735 return 0;
736}
737
738
739static struct omap_dss_driver acx_panel_driver = {
740 .probe = acx_panel_probe,
741 .remove = acx_panel_remove,
742
743 .enable = acx_panel_enable,
744 .disable = acx_panel_disable,
745
746 .set_timings = acx_panel_set_timings,
747 .check_timings = acx_panel_check_timings,
748
749 .get_recommended_bpp = acx_get_recommended_bpp,
750
751 .driver = {
752 .name = "panel-acx565akm",
753 .owner = THIS_MODULE,
754 },
755};
756
757/*--------------------SPI probe-------------------------*/
758
759static int acx565akm_spi_probe(struct spi_device *spi)
760{
761 struct acx565akm_device *md = &acx_dev;
762
763 dev_dbg(&spi->dev, "%s\n", __func__);
764
765 spi->mode = SPI_MODE_3;
766 md->spi = spi;
767 mutex_init(&md->mutex);
768 dev_set_drvdata(&spi->dev, md);
769
770 omap_dss_register_driver(&acx_panel_driver);
771
772 return 0;
773}
774
775static int acx565akm_spi_remove(struct spi_device *spi)
776{
777 struct acx565akm_device *md = dev_get_drvdata(&spi->dev);
778
779 dev_dbg(&md->spi->dev, "%s\n", __func__);
780 omap_dss_unregister_driver(&acx_panel_driver);
781
782 return 0;
783}
784
785static struct spi_driver acx565akm_spi_driver = {
786 .driver = {
787 .name = "acx565akm",
788 .owner = THIS_MODULE,
789 },
790 .probe = acx565akm_spi_probe,
791 .remove = acx565akm_spi_remove,
792};
793
794module_spi_driver(acx565akm_spi_driver);
795
796MODULE_AUTHOR("Nokia Corporation");
797MODULE_DESCRIPTION("acx565akm LCD Driver");
798MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
deleted file mode 100644
index bebebd45847f..000000000000
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ /dev/null
@@ -1,744 +0,0 @@
1/*
2 * Generic DPI Panels support
3 *
4 * Copyright (C) 2010 Canonical Ltd.
5 * Author: Bryan Wu <bryan.wu@canonical.com>
6 *
7 * LCD panel driver for Sharp LQ043T1DG01
8 *
9 * Copyright (C) 2009 Texas Instruments Inc
10 * Author: Vaibhav Hiremath <hvaibhav@ti.com>
11 *
12 * LCD panel driver for Toppoly TDO35S
13 *
14 * Copyright (C) 2009 CompuLab, Ltd.
15 * Author: Mike Rapoport <mike@compulab.co.il>
16 *
17 * Copyright (C) 2008 Nokia Corporation
18 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
19 *
20 * This program is free software; you can redistribute it and/or modify it
21 * under the terms of the GNU General Public License version 2 as published by
22 * the Free Software Foundation.
23 *
24 * This program is distributed in the hope that it will be useful, but WITHOUT
25 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
27 * more details.
28 *
29 * You should have received a copy of the GNU General Public License along with
30 * this program. If not, see <http://www.gnu.org/licenses/>.
31 */
32
33#include <linux/module.h>
34#include <linux/delay.h>
35#include <linux/slab.h>
36#include <linux/gpio.h>
37#include <video/omapdss.h>
38
39#include <video/omap-panel-data.h>
40
41struct panel_config {
42 struct omap_video_timings timings;
43
44 int power_on_delay;
45 int power_off_delay;
46
47 /*
48 * Used to match device to panel configuration
49 * when use generic panel driver
50 */
51 const char *name;
52};
53
54/* Panel configurations */
55static struct panel_config generic_dpi_panels[] = {
56 /* Sharp LQ043T1DG01 */
57 {
58 {
59 .x_res = 480,
60 .y_res = 272,
61
62 .pixel_clock = 9000,
63
64 .hsw = 42,
65 .hfp = 3,
66 .hbp = 2,
67
68 .vsw = 11,
69 .vfp = 3,
70 .vbp = 2,
71
72 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
73 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
74 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
75 .de_level = OMAPDSS_SIG_ACTIVE_LOW,
76 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
77 },
78 .power_on_delay = 50,
79 .power_off_delay = 100,
80 .name = "sharp_lq",
81 },
82
83 /* Sharp LS037V7DW01 */
84 {
85 {
86 .x_res = 480,
87 .y_res = 640,
88
89 .pixel_clock = 19200,
90
91 .hsw = 2,
92 .hfp = 1,
93 .hbp = 28,
94
95 .vsw = 1,
96 .vfp = 1,
97 .vbp = 1,
98
99 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
100 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
101 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
102 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
103 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
104 },
105 .power_on_delay = 50,
106 .power_off_delay = 100,
107 .name = "sharp_ls",
108 },
109
110 /* Toppoly TDO35S */
111 {
112 {
113 .x_res = 480,
114 .y_res = 640,
115
116 .pixel_clock = 26000,
117
118 .hfp = 104,
119 .hsw = 8,
120 .hbp = 8,
121
122 .vfp = 4,
123 .vsw = 2,
124 .vbp = 2,
125
126 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
127 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
128 .data_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
129 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
130 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
131 },
132 .power_on_delay = 0,
133 .power_off_delay = 0,
134 .name = "toppoly_tdo35s",
135 },
136
137 /* Samsung LTE430WQ-F0C */
138 {
139 {
140 .x_res = 480,
141 .y_res = 272,
142
143 .pixel_clock = 9200,
144
145 .hfp = 8,
146 .hsw = 41,
147 .hbp = 45 - 41,
148
149 .vfp = 4,
150 .vsw = 10,
151 .vbp = 12 - 10,
152
153 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
154 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
155 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
156 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
157 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
158 },
159 .power_on_delay = 0,
160 .power_off_delay = 0,
161 .name = "samsung_lte430wq_f0c",
162 },
163
164 /* Seiko 70WVW1TZ3Z3 */
165 {
166 {
167 .x_res = 800,
168 .y_res = 480,
169
170 .pixel_clock = 33000,
171
172 .hsw = 128,
173 .hfp = 10,
174 .hbp = 10,
175
176 .vsw = 2,
177 .vfp = 4,
178 .vbp = 11,
179
180 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
181 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
182 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
183 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
184 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
185 },
186 .power_on_delay = 0,
187 .power_off_delay = 0,
188 .name = "seiko_70wvw1tz3",
189 },
190
191 /* Powertip PH480272T */
192 {
193 {
194 .x_res = 480,
195 .y_res = 272,
196
197 .pixel_clock = 9000,
198
199 .hsw = 40,
200 .hfp = 2,
201 .hbp = 2,
202
203 .vsw = 10,
204 .vfp = 2,
205 .vbp = 2,
206
207 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
208 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
209 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
210 .de_level = OMAPDSS_SIG_ACTIVE_LOW,
211 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
212 },
213 .power_on_delay = 0,
214 .power_off_delay = 0,
215 .name = "powertip_ph480272t",
216 },
217
218 /* Innolux AT070TN83 */
219 {
220 {
221 .x_res = 800,
222 .y_res = 480,
223
224 .pixel_clock = 40000,
225
226 .hsw = 48,
227 .hfp = 1,
228 .hbp = 1,
229
230 .vsw = 3,
231 .vfp = 12,
232 .vbp = 25,
233
234 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
235 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
236 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
237 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
238 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
239 },
240 .power_on_delay = 0,
241 .power_off_delay = 0,
242 .name = "innolux_at070tn83",
243 },
244
245 /* NEC NL2432DR22-11B */
246 {
247 {
248 .x_res = 240,
249 .y_res = 320,
250
251 .pixel_clock = 5400,
252
253 .hsw = 3,
254 .hfp = 3,
255 .hbp = 39,
256
257 .vsw = 1,
258 .vfp = 2,
259 .vbp = 7,
260
261 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
262 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
263 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
264 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
265 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
266 },
267 .name = "nec_nl2432dr22-11b",
268 },
269
270 /* Unknown panel used in OMAP H4 */
271 {
272 {
273 .x_res = 240,
274 .y_res = 320,
275
276 .pixel_clock = 6250,
277
278 .hsw = 15,
279 .hfp = 15,
280 .hbp = 60,
281
282 .vsw = 1,
283 .vfp = 1,
284 .vbp = 1,
285
286 .vsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
287 .hsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
288 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
289 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
290 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
291 },
292 .name = "h4",
293 },
294
295 /* FocalTech ETM070003DH6 */
296 {
297 {
298 .x_res = 800,
299 .y_res = 480,
300
301 .pixel_clock = 28000,
302
303 .hsw = 48,
304 .hfp = 40,
305 .hbp = 40,
306
307 .vsw = 3,
308 .vfp = 13,
309 .vbp = 29,
310
311 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
312 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
313 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
314 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
315 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
316 },
317 .name = "focaltech_etm070003dh6",
318 },
319
320 /* Microtips Technologies - UMSH-8173MD */
321 {
322 {
323 .x_res = 800,
324 .y_res = 480,
325
326 .pixel_clock = 34560,
327
328 .hsw = 13,
329 .hfp = 101,
330 .hbp = 101,
331
332 .vsw = 23,
333 .vfp = 1,
334 .vbp = 1,
335
336 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
337 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
338 .data_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
339 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
340 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
341 },
342 .power_on_delay = 0,
343 .power_off_delay = 0,
344 .name = "microtips_umsh_8173md",
345 },
346
347 /* OrtusTech COM43H4M10XTC */
348 {
349 {
350 .x_res = 480,
351 .y_res = 272,
352
353 .pixel_clock = 8000,
354
355 .hsw = 41,
356 .hfp = 8,
357 .hbp = 4,
358
359 .vsw = 10,
360 .vfp = 4,
361 .vbp = 2,
362
363 .vsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
364 .hsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
365 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
366 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
367 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
368 },
369 .name = "ortustech_com43h4m10xtc",
370 },
371
372 /* Innolux AT080TN52 */
373 {
374 {
375 .x_res = 800,
376 .y_res = 600,
377
378 .pixel_clock = 41142,
379
380 .hsw = 20,
381 .hfp = 210,
382 .hbp = 46,
383
384 .vsw = 10,
385 .vfp = 12,
386 .vbp = 23,
387
388 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
389 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
390 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
391 .de_level = OMAPDSS_SIG_ACTIVE_LOW,
392 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
393 },
394 .name = "innolux_at080tn52",
395 },
396
397 /* Mitsubishi AA084SB01 */
398 {
399 {
400 .x_res = 800,
401 .y_res = 600,
402 .pixel_clock = 40000,
403
404 .hsw = 1,
405 .hfp = 254,
406 .hbp = 1,
407
408 .vsw = 1,
409 .vfp = 26,
410 .vbp = 1,
411
412 .vsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
413 .hsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
414 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
415 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
416 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
417 },
418 .name = "mitsubishi_aa084sb01",
419 },
420 /* EDT ET0500G0DH6 */
421 {
422 {
423 .x_res = 800,
424 .y_res = 480,
425 .pixel_clock = 33260,
426
427 .hsw = 128,
428 .hfp = 216,
429 .hbp = 40,
430
431 .vsw = 2,
432 .vfp = 35,
433 .vbp = 10,
434
435 .vsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
436 .hsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
437 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
438 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
439 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
440 },
441 .name = "edt_et0500g0dh6",
442 },
443
444 /* Prime-View PD050VL1 */
445 {
446 {
447 .x_res = 640,
448 .y_res = 480,
449
450 .pixel_clock = 25000,
451
452 .hsw = 96,
453 .hfp = 18,
454 .hbp = 46,
455
456 .vsw = 2,
457 .vfp = 10,
458 .vbp = 33,
459
460 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
461 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
462 .data_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
463 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
464 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
465 },
466 .name = "primeview_pd050vl1",
467 },
468
469 /* Prime-View PM070WL4 */
470 {
471 {
472 .x_res = 800,
473 .y_res = 480,
474
475 .pixel_clock = 32000,
476
477 .hsw = 128,
478 .hfp = 42,
479 .hbp = 86,
480
481 .vsw = 2,
482 .vfp = 10,
483 .vbp = 33,
484
485 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
486 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
487 .data_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
488 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
489 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
490 },
491 .name = "primeview_pm070wl4",
492 },
493
494 /* Prime-View PD104SLF */
495 {
496 {
497 .x_res = 800,
498 .y_res = 600,
499
500 .pixel_clock = 40000,
501
502 .hsw = 128,
503 .hfp = 42,
504 .hbp = 86,
505
506 .vsw = 4,
507 .vfp = 1,
508 .vbp = 23,
509
510 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
511 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
512 .data_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
513 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
514 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
515 },
516 .name = "primeview_pd104slf",
517 },
518};
519
520struct panel_drv_data {
521
522 struct omap_dss_device *dssdev;
523
524 struct panel_config *panel_config;
525
526 struct mutex lock;
527};
528
529static inline struct panel_generic_dpi_data
530*get_panel_data(const struct omap_dss_device *dssdev)
531{
532 return (struct panel_generic_dpi_data *) dssdev->data;
533}
534
535static int generic_dpi_panel_power_on(struct omap_dss_device *dssdev)
536{
537 int r, i;
538 struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
539 struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
540 struct panel_config *panel_config = drv_data->panel_config;
541
542 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
543 return 0;
544
545 omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
546 omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
547
548 r = omapdss_dpi_display_enable(dssdev);
549 if (r)
550 goto err0;
551
552 /* wait couple of vsyncs until enabling the LCD */
553 if (panel_config->power_on_delay)
554 msleep(panel_config->power_on_delay);
555
556 for (i = 0; i < panel_data->num_gpios; ++i) {
557 gpio_set_value_cansleep(panel_data->gpios[i],
558 panel_data->gpio_invert[i] ? 0 : 1);
559 }
560
561 return 0;
562
563err0:
564 return r;
565}
566
567static void generic_dpi_panel_power_off(struct omap_dss_device *dssdev)
568{
569 struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
570 struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
571 struct panel_config *panel_config = drv_data->panel_config;
572 int i;
573
574 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
575 return;
576
577 for (i = panel_data->num_gpios - 1; i >= 0; --i) {
578 gpio_set_value_cansleep(panel_data->gpios[i],
579 panel_data->gpio_invert[i] ? 1 : 0);
580 }
581
582 /* wait couple of vsyncs after disabling the LCD */
583 if (panel_config->power_off_delay)
584 msleep(panel_config->power_off_delay);
585
586 omapdss_dpi_display_disable(dssdev);
587}
588
589static int generic_dpi_panel_probe(struct omap_dss_device *dssdev)
590{
591 struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
592 struct panel_config *panel_config = NULL;
593 struct panel_drv_data *drv_data = NULL;
594 int i, r;
595
596 dev_dbg(dssdev->dev, "probe\n");
597
598 if (!panel_data || !panel_data->name)
599 return -EINVAL;
600
601 for (i = 0; i < ARRAY_SIZE(generic_dpi_panels); i++) {
602 if (strcmp(panel_data->name, generic_dpi_panels[i].name) == 0) {
603 panel_config = &generic_dpi_panels[i];
604 break;
605 }
606 }
607
608 if (!panel_config)
609 return -EINVAL;
610
611 for (i = 0; i < panel_data->num_gpios; ++i) {
612 r = devm_gpio_request_one(dssdev->dev, panel_data->gpios[i],
613 panel_data->gpio_invert[i] ?
614 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
615 "panel gpio");
616 if (r)
617 return r;
618 }
619
620 dssdev->panel.timings = panel_config->timings;
621
622 drv_data = devm_kzalloc(dssdev->dev, sizeof(*drv_data), GFP_KERNEL);
623 if (!drv_data)
624 return -ENOMEM;
625
626 drv_data->dssdev = dssdev;
627 drv_data->panel_config = panel_config;
628
629 mutex_init(&drv_data->lock);
630
631 dev_set_drvdata(dssdev->dev, drv_data);
632
633 return 0;
634}
635
636static void __exit generic_dpi_panel_remove(struct omap_dss_device *dssdev)
637{
638 dev_dbg(dssdev->dev, "remove\n");
639
640 dev_set_drvdata(dssdev->dev, NULL);
641}
642
643static int generic_dpi_panel_enable(struct omap_dss_device *dssdev)
644{
645 struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
646 int r;
647
648 mutex_lock(&drv_data->lock);
649
650 r = generic_dpi_panel_power_on(dssdev);
651 if (r)
652 goto err;
653
654 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
655err:
656 mutex_unlock(&drv_data->lock);
657
658 return r;
659}
660
661static void generic_dpi_panel_disable(struct omap_dss_device *dssdev)
662{
663 struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
664
665 mutex_lock(&drv_data->lock);
666
667 generic_dpi_panel_power_off(dssdev);
668
669 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
670
671 mutex_unlock(&drv_data->lock);
672}
673
674static void generic_dpi_panel_set_timings(struct omap_dss_device *dssdev,
675 struct omap_video_timings *timings)
676{
677 struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
678
679 mutex_lock(&drv_data->lock);
680
681 omapdss_dpi_set_timings(dssdev, timings);
682
683 dssdev->panel.timings = *timings;
684
685 mutex_unlock(&drv_data->lock);
686}
687
688static void generic_dpi_panel_get_timings(struct omap_dss_device *dssdev,
689 struct omap_video_timings *timings)
690{
691 struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
692
693 mutex_lock(&drv_data->lock);
694
695 *timings = dssdev->panel.timings;
696
697 mutex_unlock(&drv_data->lock);
698}
699
700static int generic_dpi_panel_check_timings(struct omap_dss_device *dssdev,
701 struct omap_video_timings *timings)
702{
703 struct panel_drv_data *drv_data = dev_get_drvdata(dssdev->dev);
704 int r;
705
706 mutex_lock(&drv_data->lock);
707
708 r = dpi_check_timings(dssdev, timings);
709
710 mutex_unlock(&drv_data->lock);
711
712 return r;
713}
714
715static struct omap_dss_driver dpi_driver = {
716 .probe = generic_dpi_panel_probe,
717 .remove = __exit_p(generic_dpi_panel_remove),
718
719 .enable = generic_dpi_panel_enable,
720 .disable = generic_dpi_panel_disable,
721
722 .set_timings = generic_dpi_panel_set_timings,
723 .get_timings = generic_dpi_panel_get_timings,
724 .check_timings = generic_dpi_panel_check_timings,
725
726 .driver = {
727 .name = "generic_dpi_panel",
728 .owner = THIS_MODULE,
729 },
730};
731
732static int __init generic_dpi_panel_drv_init(void)
733{
734 return omap_dss_register_driver(&dpi_driver);
735}
736
737static void __exit generic_dpi_panel_drv_exit(void)
738{
739 omap_dss_unregister_driver(&dpi_driver);
740}
741
742module_init(generic_dpi_panel_drv_init);
743module_exit(generic_dpi_panel_drv_exit);
744MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
deleted file mode 100644
index 6c51430ddb37..000000000000
--- a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
+++ /dev/null
@@ -1,262 +0,0 @@
1/*
2 * LCD panel driver for LG.Philips LB035Q02
3 *
4 * Author: Steve Sakoman <steve@sakoman.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/module.h>
20#include <linux/delay.h>
21#include <linux/spi/spi.h>
22#include <linux/mutex.h>
23#include <linux/gpio.h>
24
25#include <video/omapdss.h>
26#include <video/omap-panel-data.h>
27
28struct lb035q02_data {
29 struct mutex lock;
30};
31
32static struct omap_video_timings lb035q02_timings = {
33 .x_res = 320,
34 .y_res = 240,
35
36 .pixel_clock = 6500,
37
38 .hsw = 2,
39 .hfp = 20,
40 .hbp = 68,
41
42 .vsw = 2,
43 .vfp = 4,
44 .vbp = 18,
45
46 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
47 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
48 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
49 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
50 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
51};
52
53static inline struct panel_generic_dpi_data
54*get_panel_data(const struct omap_dss_device *dssdev)
55{
56 return (struct panel_generic_dpi_data *) dssdev->data;
57}
58
59static int lb035q02_panel_power_on(struct omap_dss_device *dssdev)
60{
61 struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
62 int r, i;
63
64 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
65 return 0;
66
67 omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
68 omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
69
70 r = omapdss_dpi_display_enable(dssdev);
71 if (r)
72 goto err0;
73
74 for (i = 0; i < panel_data->num_gpios; ++i) {
75 gpio_set_value_cansleep(panel_data->gpios[i],
76 panel_data->gpio_invert[i] ? 0 : 1);
77 }
78
79 return 0;
80
81err0:
82 return r;
83}
84
85static void lb035q02_panel_power_off(struct omap_dss_device *dssdev)
86{
87 struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
88 int i;
89
90 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
91 return;
92
93 for (i = panel_data->num_gpios - 1; i >= 0; --i) {
94 gpio_set_value_cansleep(panel_data->gpios[i],
95 panel_data->gpio_invert[i] ? 1 : 0);
96 }
97
98 omapdss_dpi_display_disable(dssdev);
99}
100
101static int lb035q02_panel_probe(struct omap_dss_device *dssdev)
102{
103 struct panel_generic_dpi_data *panel_data = get_panel_data(dssdev);
104 struct lb035q02_data *ld;
105 int r, i;
106
107 if (!panel_data)
108 return -EINVAL;
109
110 dssdev->panel.timings = lb035q02_timings;
111
112 ld = devm_kzalloc(dssdev->dev, sizeof(*ld), GFP_KERNEL);
113 if (!ld)
114 return -ENOMEM;
115
116 for (i = 0; i < panel_data->num_gpios; ++i) {
117 r = devm_gpio_request_one(dssdev->dev, panel_data->gpios[i],
118 panel_data->gpio_invert[i] ?
119 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
120 "panel gpio");
121 if (r)
122 return r;
123 }
124
125 mutex_init(&ld->lock);
126 dev_set_drvdata(dssdev->dev, ld);
127
128 return 0;
129}
130
131static void lb035q02_panel_remove(struct omap_dss_device *dssdev)
132{
133}
134
135static int lb035q02_panel_enable(struct omap_dss_device *dssdev)
136{
137 struct lb035q02_data *ld = dev_get_drvdata(dssdev->dev);
138 int r;
139
140 mutex_lock(&ld->lock);
141
142 r = lb035q02_panel_power_on(dssdev);
143 if (r)
144 goto err;
145 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
146
147 mutex_unlock(&ld->lock);
148 return 0;
149err:
150 mutex_unlock(&ld->lock);
151 return r;
152}
153
154static void lb035q02_panel_disable(struct omap_dss_device *dssdev)
155{
156 struct lb035q02_data *ld = dev_get_drvdata(dssdev->dev);
157
158 mutex_lock(&ld->lock);
159
160 lb035q02_panel_power_off(dssdev);
161 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
162
163 mutex_unlock(&ld->lock);
164}
165
166static struct omap_dss_driver lb035q02_driver = {
167 .probe = lb035q02_panel_probe,
168 .remove = lb035q02_panel_remove,
169
170 .enable = lb035q02_panel_enable,
171 .disable = lb035q02_panel_disable,
172
173 .driver = {
174 .name = "lgphilips_lb035q02_panel",
175 .owner = THIS_MODULE,
176 },
177};
178
179static int lb035q02_write_reg(struct spi_device *spi, u8 reg, u16 val)
180{
181 struct spi_message msg;
182 struct spi_transfer index_xfer = {
183 .len = 3,
184 .cs_change = 1,
185 };
186 struct spi_transfer value_xfer = {
187 .len = 3,
188 };
189 u8 buffer[16];
190
191 spi_message_init(&msg);
192
193 /* register index */
194 buffer[0] = 0x70;
195 buffer[1] = 0x00;
196 buffer[2] = reg & 0x7f;
197 index_xfer.tx_buf = buffer;
198 spi_message_add_tail(&index_xfer, &msg);
199
200 /* register value */
201 buffer[4] = 0x72;
202 buffer[5] = val >> 8;
203 buffer[6] = val;
204 value_xfer.tx_buf = buffer + 4;
205 spi_message_add_tail(&value_xfer, &msg);
206
207 return spi_sync(spi, &msg);
208}
209
210static void init_lb035q02_panel(struct spi_device *spi)
211{
212 /* Init sequence from page 28 of the lb035q02 spec */
213 lb035q02_write_reg(spi, 0x01, 0x6300);
214 lb035q02_write_reg(spi, 0x02, 0x0200);
215 lb035q02_write_reg(spi, 0x03, 0x0177);
216 lb035q02_write_reg(spi, 0x04, 0x04c7);
217 lb035q02_write_reg(spi, 0x05, 0xffc0);
218 lb035q02_write_reg(spi, 0x06, 0xe806);
219 lb035q02_write_reg(spi, 0x0a, 0x4008);
220 lb035q02_write_reg(spi, 0x0b, 0x0000);
221 lb035q02_write_reg(spi, 0x0d, 0x0030);
222 lb035q02_write_reg(spi, 0x0e, 0x2800);
223 lb035q02_write_reg(spi, 0x0f, 0x0000);
224 lb035q02_write_reg(spi, 0x16, 0x9f80);
225 lb035q02_write_reg(spi, 0x17, 0x0a0f);
226 lb035q02_write_reg(spi, 0x1e, 0x00c1);
227 lb035q02_write_reg(spi, 0x30, 0x0300);
228 lb035q02_write_reg(spi, 0x31, 0x0007);
229 lb035q02_write_reg(spi, 0x32, 0x0000);
230 lb035q02_write_reg(spi, 0x33, 0x0000);
231 lb035q02_write_reg(spi, 0x34, 0x0707);
232 lb035q02_write_reg(spi, 0x35, 0x0004);
233 lb035q02_write_reg(spi, 0x36, 0x0302);
234 lb035q02_write_reg(spi, 0x37, 0x0202);
235 lb035q02_write_reg(spi, 0x3a, 0x0a0d);
236 lb035q02_write_reg(spi, 0x3b, 0x0806);
237}
238
239static int lb035q02_panel_spi_probe(struct spi_device *spi)
240{
241 init_lb035q02_panel(spi);
242 return omap_dss_register_driver(&lb035q02_driver);
243}
244
245static int lb035q02_panel_spi_remove(struct spi_device *spi)
246{
247 omap_dss_unregister_driver(&lb035q02_driver);
248 return 0;
249}
250
251static struct spi_driver lb035q02_spi_driver = {
252 .driver = {
253 .name = "lgphilips_lb035q02_panel-spi",
254 .owner = THIS_MODULE,
255 },
256 .probe = lb035q02_panel_spi_probe,
257 .remove = lb035q02_panel_spi_remove,
258};
259
260module_spi_driver(lb035q02_spi_driver);
261
262MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/displays/panel-n8x0.c b/drivers/video/omap2/displays/panel-n8x0.c
deleted file mode 100644
index 1d525fc84db9..000000000000
--- a/drivers/video/omap2/displays/panel-n8x0.c
+++ /dev/null
@@ -1,616 +0,0 @@
1/* #define DEBUG */
2
3#include <linux/module.h>
4#include <linux/delay.h>
5#include <linux/slab.h>
6#include <linux/gpio.h>
7#include <linux/spi/spi.h>
8#include <linux/fb.h>
9
10#include <video/omapdss.h>
11#include <video/omap-panel-data.h>
12
13#define BLIZZARD_REV_CODE 0x00
14#define BLIZZARD_CONFIG 0x02
15#define BLIZZARD_PLL_DIV 0x04
16#define BLIZZARD_PLL_LOCK_RANGE 0x06
17#define BLIZZARD_PLL_CLOCK_SYNTH_0 0x08
18#define BLIZZARD_PLL_CLOCK_SYNTH_1 0x0a
19#define BLIZZARD_PLL_MODE 0x0c
20#define BLIZZARD_CLK_SRC 0x0e
21#define BLIZZARD_MEM_BANK0_ACTIVATE 0x10
22#define BLIZZARD_MEM_BANK0_STATUS 0x14
23#define BLIZZARD_PANEL_CONFIGURATION 0x28
24#define BLIZZARD_HDISP 0x2a
25#define BLIZZARD_HNDP 0x2c
26#define BLIZZARD_VDISP0 0x2e
27#define BLIZZARD_VDISP1 0x30
28#define BLIZZARD_VNDP 0x32
29#define BLIZZARD_HSW 0x34
30#define BLIZZARD_VSW 0x38
31#define BLIZZARD_DISPLAY_MODE 0x68
32#define BLIZZARD_INPUT_WIN_X_START_0 0x6c
33#define BLIZZARD_DATA_SOURCE_SELECT 0x8e
34#define BLIZZARD_DISP_MEM_DATA_PORT 0x90
35#define BLIZZARD_DISP_MEM_READ_ADDR0 0x92
36#define BLIZZARD_POWER_SAVE 0xE6
37#define BLIZZARD_NDISP_CTRL_STATUS 0xE8
38
39/* Data source select */
40/* For S1D13745 */
41#define BLIZZARD_SRC_WRITE_LCD_BACKGROUND 0x00
42#define BLIZZARD_SRC_WRITE_LCD_DESTRUCTIVE 0x01
43#define BLIZZARD_SRC_WRITE_OVERLAY_ENABLE 0x04
44#define BLIZZARD_SRC_DISABLE_OVERLAY 0x05
45/* For S1D13744 */
46#define BLIZZARD_SRC_WRITE_LCD 0x00
47#define BLIZZARD_SRC_BLT_LCD 0x06
48
49#define BLIZZARD_COLOR_RGB565 0x01
50#define BLIZZARD_COLOR_YUV420 0x09
51
52#define BLIZZARD_VERSION_S1D13745 0x01 /* Hailstorm */
53#define BLIZZARD_VERSION_S1D13744 0x02 /* Blizzard */
54
55#define MIPID_CMD_READ_DISP_ID 0x04
56#define MIPID_CMD_READ_RED 0x06
57#define MIPID_CMD_READ_GREEN 0x07
58#define MIPID_CMD_READ_BLUE 0x08
59#define MIPID_CMD_READ_DISP_STATUS 0x09
60#define MIPID_CMD_RDDSDR 0x0F
61#define MIPID_CMD_SLEEP_IN 0x10
62#define MIPID_CMD_SLEEP_OUT 0x11
63#define MIPID_CMD_DISP_OFF 0x28
64#define MIPID_CMD_DISP_ON 0x29
65
66static struct panel_drv_data {
67 struct mutex lock;
68
69 struct omap_dss_device *dssdev;
70 struct spi_device *spidev;
71
72 int blizzard_ver;
73} s_drv_data;
74
75
76static inline
77struct panel_n8x0_data *get_board_data(const struct omap_dss_device *dssdev)
78{
79 return dssdev->data;
80}
81
82static inline
83struct panel_drv_data *get_drv_data(const struct omap_dss_device *dssdev)
84{
85 return &s_drv_data;
86}
87
88
89static inline void blizzard_cmd(u8 cmd)
90{
91 omap_rfbi_write_command(&cmd, 1);
92}
93
94static inline void blizzard_write(u8 cmd, const u8 *buf, int len)
95{
96 omap_rfbi_write_command(&cmd, 1);
97 omap_rfbi_write_data(buf, len);
98}
99
100static inline void blizzard_read(u8 cmd, u8 *buf, int len)
101{
102 omap_rfbi_write_command(&cmd, 1);
103 omap_rfbi_read_data(buf, len);
104}
105
106static u8 blizzard_read_reg(u8 cmd)
107{
108 u8 data;
109 blizzard_read(cmd, &data, 1);
110 return data;
111}
112
113static void blizzard_ctrl_setup_update(struct omap_dss_device *dssdev,
114 int x, int y, int w, int h)
115{
116 struct panel_drv_data *ddata = get_drv_data(dssdev);
117 u8 tmp[18];
118 int x_end, y_end;
119
120 x_end = x + w - 1;
121 y_end = y + h - 1;
122
123 tmp[0] = x;
124 tmp[1] = x >> 8;
125 tmp[2] = y;
126 tmp[3] = y >> 8;
127 tmp[4] = x_end;
128 tmp[5] = x_end >> 8;
129 tmp[6] = y_end;
130 tmp[7] = y_end >> 8;
131
132 /* scaling? */
133 tmp[8] = x;
134 tmp[9] = x >> 8;
135 tmp[10] = y;
136 tmp[11] = y >> 8;
137 tmp[12] = x_end;
138 tmp[13] = x_end >> 8;
139 tmp[14] = y_end;
140 tmp[15] = y_end >> 8;
141
142 tmp[16] = BLIZZARD_COLOR_RGB565;
143
144 if (ddata->blizzard_ver == BLIZZARD_VERSION_S1D13745)
145 tmp[17] = BLIZZARD_SRC_WRITE_LCD_BACKGROUND;
146 else
147 tmp[17] = ddata->blizzard_ver == BLIZZARD_VERSION_S1D13744 ?
148 BLIZZARD_SRC_WRITE_LCD :
149 BLIZZARD_SRC_WRITE_LCD_DESTRUCTIVE;
150
151 omapdss_rfbi_set_pixel_size(dssdev, 16);
152 omapdss_rfbi_set_data_lines(dssdev, 8);
153
154 omap_rfbi_configure(dssdev);
155
156 blizzard_write(BLIZZARD_INPUT_WIN_X_START_0, tmp, 18);
157
158 omapdss_rfbi_set_pixel_size(dssdev, 16);
159 omapdss_rfbi_set_data_lines(dssdev, 16);
160
161 omap_rfbi_configure(dssdev);
162}
163
164static void mipid_transfer(struct spi_device *spi, int cmd, const u8 *wbuf,
165 int wlen, u8 *rbuf, int rlen)
166{
167 struct spi_message m;
168 struct spi_transfer *x, xfer[4];
169 u16 w;
170 int r;
171
172 spi_message_init(&m);
173
174 memset(xfer, 0, sizeof(xfer));
175 x = &xfer[0];
176
177 cmd &= 0xff;
178 x->tx_buf = &cmd;
179 x->bits_per_word = 9;
180 x->len = 2;
181 spi_message_add_tail(x, &m);
182
183 if (wlen) {
184 x++;
185 x->tx_buf = wbuf;
186 x->len = wlen;
187 x->bits_per_word = 9;
188 spi_message_add_tail(x, &m);
189 }
190
191 if (rlen) {
192 x++;
193 x->rx_buf = &w;
194 x->len = 1;
195 spi_message_add_tail(x, &m);
196
197 if (rlen > 1) {
198 /* Arrange for the extra clock before the first
199 * data bit.
200 */
201 x->bits_per_word = 9;
202 x->len = 2;
203
204 x++;
205 x->rx_buf = &rbuf[1];
206 x->len = rlen - 1;
207 spi_message_add_tail(x, &m);
208 }
209 }
210
211 r = spi_sync(spi, &m);
212 if (r < 0)
213 dev_dbg(&spi->dev, "spi_sync %d\n", r);
214
215 if (rlen)
216 rbuf[0] = w & 0xff;
217}
218
219static inline void mipid_cmd(struct spi_device *spi, int cmd)
220{
221 mipid_transfer(spi, cmd, NULL, 0, NULL, 0);
222}
223
224static inline void mipid_write(struct spi_device *spi,
225 int reg, const u8 *buf, int len)
226{
227 mipid_transfer(spi, reg, buf, len, NULL, 0);
228}
229
230static inline void mipid_read(struct spi_device *spi,
231 int reg, u8 *buf, int len)
232{
233 mipid_transfer(spi, reg, NULL, 0, buf, len);
234}
235
236static void set_data_lines(struct spi_device *spi, int data_lines)
237{
238 u16 par;
239
240 switch (data_lines) {
241 case 16:
242 par = 0x150;
243 break;
244 case 18:
245 par = 0x160;
246 break;
247 case 24:
248 par = 0x170;
249 break;
250 }
251
252 mipid_write(spi, 0x3a, (u8 *)&par, 2);
253}
254
255static void send_init_string(struct spi_device *spi)
256{
257 u16 initpar[] = { 0x0102, 0x0100, 0x0100 };
258 mipid_write(spi, 0xc2, (u8 *)initpar, sizeof(initpar));
259}
260
261static void send_display_on(struct spi_device *spi)
262{
263 mipid_cmd(spi, MIPID_CMD_DISP_ON);
264}
265
266static void send_display_off(struct spi_device *spi)
267{
268 mipid_cmd(spi, MIPID_CMD_DISP_OFF);
269}
270
271static void send_sleep_out(struct spi_device *spi)
272{
273 mipid_cmd(spi, MIPID_CMD_SLEEP_OUT);
274 msleep(120);
275}
276
277static void send_sleep_in(struct spi_device *spi)
278{
279 mipid_cmd(spi, MIPID_CMD_SLEEP_IN);
280 msleep(50);
281}
282
283static int n8x0_panel_power_on(struct omap_dss_device *dssdev)
284{
285 int r;
286 struct panel_n8x0_data *bdata = get_board_data(dssdev);
287 struct panel_drv_data *ddata = get_drv_data(dssdev);
288 struct spi_device *spi = ddata->spidev;
289 u8 rev, conf;
290 u8 display_id[3];
291 const char *panel_name;
292
293 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
294 return 0;
295
296 gpio_direction_output(bdata->ctrl_pwrdown, 1);
297
298 omapdss_rfbi_set_size(dssdev, dssdev->panel.timings.x_res,
299 dssdev->panel.timings.y_res);
300 omapdss_rfbi_set_pixel_size(dssdev, dssdev->ctrl.pixel_size);
301 omapdss_rfbi_set_data_lines(dssdev, dssdev->phy.rfbi.data_lines);
302 omapdss_rfbi_set_interface_timings(dssdev, &dssdev->ctrl.rfbi_timings);
303
304 r = omapdss_rfbi_display_enable(dssdev);
305 if (r)
306 goto err_rfbi_en;
307
308 rev = blizzard_read_reg(BLIZZARD_REV_CODE);
309 conf = blizzard_read_reg(BLIZZARD_CONFIG);
310
311 switch (rev & 0xfc) {
312 case 0x9c:
313 ddata->blizzard_ver = BLIZZARD_VERSION_S1D13744;
314 dev_info(dssdev->dev, "s1d13744 LCD controller rev %d "
315 "initialized (CNF pins %x)\n", rev & 0x03, conf & 0x07);
316 break;
317 case 0xa4:
318 ddata->blizzard_ver = BLIZZARD_VERSION_S1D13745;
319 dev_info(dssdev->dev, "s1d13745 LCD controller rev %d "
320 "initialized (CNF pins %x)\n", rev & 0x03, conf & 0x07);
321 break;
322 default:
323 dev_err(dssdev->dev, "invalid s1d1374x revision %02x\n", rev);
324 r = -ENODEV;
325 goto err_inv_chip;
326 }
327
328 /* panel */
329
330 gpio_direction_output(bdata->panel_reset, 1);
331
332 mipid_read(spi, MIPID_CMD_READ_DISP_ID, display_id, 3);
333 dev_dbg(&spi->dev, "MIPI display ID: %02x%02x%02x\n",
334 display_id[0], display_id[1], display_id[2]);
335
336 switch (display_id[0]) {
337 case 0x45:
338 panel_name = "lph8923";
339 break;
340 case 0x83:
341 panel_name = "ls041y3";
342 break;
343 default:
344 dev_err(dssdev->dev, "invalid display ID 0x%x\n",
345 display_id[0]);
346 r = -ENODEV;
347 goto err_inv_panel;
348 }
349
350 dev_info(dssdev->dev, "%s rev %02x LCD detected\n",
351 panel_name, display_id[1]);
352
353 send_sleep_out(spi);
354 send_init_string(spi);
355 set_data_lines(spi, 24);
356 send_display_on(spi);
357
358 return 0;
359
360err_inv_panel:
361 /*
362 * HACK: we should turn off the panel here, but there is some problem
363 * with the initialization sequence, and we fail to init the panel if we
364 * have turned it off
365 */
366 /* gpio_direction_output(bdata->panel_reset, 0); */
367err_inv_chip:
368 omapdss_rfbi_display_disable(dssdev);
369err_rfbi_en:
370 gpio_direction_output(bdata->ctrl_pwrdown, 0);
371 return r;
372}
373
374static void n8x0_panel_power_off(struct omap_dss_device *dssdev)
375{
376 struct panel_n8x0_data *bdata = get_board_data(dssdev);
377 struct panel_drv_data *ddata = get_drv_data(dssdev);
378 struct spi_device *spi = ddata->spidev;
379
380 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
381 return;
382
383 send_display_off(spi);
384 send_sleep_in(spi);
385
386 /*
387 * HACK: we should turn off the panel here, but there is some problem
388 * with the initialization sequence, and we fail to init the panel if we
389 * have turned it off
390 */
391 /* gpio_direction_output(bdata->panel_reset, 0); */
392 gpio_direction_output(bdata->ctrl_pwrdown, 0);
393 omapdss_rfbi_display_disable(dssdev);
394}
395
396static const struct rfbi_timings n8x0_panel_timings = {
397 .cs_on_time = 0,
398
399 .we_on_time = 9000,
400 .we_off_time = 18000,
401 .we_cycle_time = 36000,
402
403 .re_on_time = 9000,
404 .re_off_time = 27000,
405 .re_cycle_time = 36000,
406
407 .access_time = 27000,
408 .cs_off_time = 36000,
409
410 .cs_pulse_width = 0,
411};
412
413static int n8x0_panel_probe(struct omap_dss_device *dssdev)
414{
415 struct panel_n8x0_data *bdata = get_board_data(dssdev);
416 struct panel_drv_data *ddata;
417 int r;
418
419 dev_dbg(dssdev->dev, "probe\n");
420
421 if (!bdata)
422 return -EINVAL;
423
424 s_drv_data.dssdev = dssdev;
425
426 ddata = &s_drv_data;
427
428 mutex_init(&ddata->lock);
429
430 dssdev->panel.timings.x_res = 800;
431 dssdev->panel.timings.y_res = 480;
432 dssdev->ctrl.pixel_size = 16;
433 dssdev->ctrl.rfbi_timings = n8x0_panel_timings;
434 dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
435
436 if (gpio_is_valid(bdata->panel_reset)) {
437 r = devm_gpio_request_one(dssdev->dev, bdata->panel_reset,
438 GPIOF_OUT_INIT_LOW, "PANEL RESET");
439 if (r)
440 return r;
441 }
442
443 if (gpio_is_valid(bdata->ctrl_pwrdown)) {
444 r = devm_gpio_request_one(dssdev->dev, bdata->ctrl_pwrdown,
445 GPIOF_OUT_INIT_LOW, "PANEL PWRDOWN");
446 if (r)
447 return r;
448 }
449
450 return 0;
451}
452
453static void n8x0_panel_remove(struct omap_dss_device *dssdev)
454{
455 dev_dbg(dssdev->dev, "remove\n");
456
457 dev_set_drvdata(dssdev->dev, NULL);
458}
459
460static int n8x0_panel_enable(struct omap_dss_device *dssdev)
461{
462 struct panel_drv_data *ddata = get_drv_data(dssdev);
463 int r;
464
465 dev_dbg(dssdev->dev, "enable\n");
466
467 mutex_lock(&ddata->lock);
468
469 rfbi_bus_lock();
470
471 r = n8x0_panel_power_on(dssdev);
472
473 rfbi_bus_unlock();
474
475 if (r) {
476 mutex_unlock(&ddata->lock);
477 return r;
478 }
479
480 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
481
482 mutex_unlock(&ddata->lock);
483
484 return 0;
485}
486
487static void n8x0_panel_disable(struct omap_dss_device *dssdev)
488{
489 struct panel_drv_data *ddata = get_drv_data(dssdev);
490
491 dev_dbg(dssdev->dev, "disable\n");
492
493 mutex_lock(&ddata->lock);
494
495 rfbi_bus_lock();
496
497 n8x0_panel_power_off(dssdev);
498
499 rfbi_bus_unlock();
500
501 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
502
503 mutex_unlock(&ddata->lock);
504}
505
506static void n8x0_panel_get_resolution(struct omap_dss_device *dssdev,
507 u16 *xres, u16 *yres)
508{
509 *xres = dssdev->panel.timings.x_res;
510 *yres = dssdev->panel.timings.y_res;
511}
512
513static void update_done(void *data)
514{
515 rfbi_bus_unlock();
516}
517
518static int n8x0_panel_update(struct omap_dss_device *dssdev,
519 u16 x, u16 y, u16 w, u16 h)
520{
521 struct panel_drv_data *ddata = get_drv_data(dssdev);
522 u16 dw, dh;
523
524 dev_dbg(dssdev->dev, "update\n");
525
526 dw = dssdev->panel.timings.x_res;
527 dh = dssdev->panel.timings.y_res;
528
529 if (x != 0 || y != 0 || w != dw || h != dh) {
530 dev_err(dssdev->dev, "invalid update region %d, %d, %d, %d\n",
531 x, y, w, h);
532 return -EINVAL;
533 }
534
535 mutex_lock(&ddata->lock);
536 rfbi_bus_lock();
537
538 blizzard_ctrl_setup_update(dssdev, x, y, w, h);
539
540 omap_rfbi_update(dssdev, update_done, NULL);
541
542 mutex_unlock(&ddata->lock);
543
544 return 0;
545}
546
547static int n8x0_panel_sync(struct omap_dss_device *dssdev)
548{
549 struct panel_drv_data *ddata = get_drv_data(dssdev);
550
551 dev_dbg(dssdev->dev, "sync\n");
552
553 mutex_lock(&ddata->lock);
554 rfbi_bus_lock();
555 rfbi_bus_unlock();
556 mutex_unlock(&ddata->lock);
557
558 return 0;
559}
560
561static struct omap_dss_driver n8x0_panel_driver = {
562 .probe = n8x0_panel_probe,
563 .remove = n8x0_panel_remove,
564
565 .enable = n8x0_panel_enable,
566 .disable = n8x0_panel_disable,
567
568 .update = n8x0_panel_update,
569 .sync = n8x0_panel_sync,
570
571 .get_resolution = n8x0_panel_get_resolution,
572 .get_recommended_bpp = omapdss_default_get_recommended_bpp,
573
574 .driver = {
575 .name = "n8x0_panel",
576 .owner = THIS_MODULE,
577 },
578};
579
580/* PANEL */
581
582static int mipid_spi_probe(struct spi_device *spi)
583{
584 int r;
585
586 dev_dbg(&spi->dev, "mipid_spi_probe\n");
587
588 spi->mode = SPI_MODE_0;
589
590 s_drv_data.spidev = spi;
591
592 r = omap_dss_register_driver(&n8x0_panel_driver);
593 if (r)
594 pr_err("n8x0_panel: dss driver registration failed\n");
595
596 return r;
597}
598
599static int mipid_spi_remove(struct spi_device *spi)
600{
601 dev_dbg(&spi->dev, "mipid_spi_remove\n");
602 omap_dss_unregister_driver(&n8x0_panel_driver);
603 return 0;
604}
605
606static struct spi_driver mipid_spi_driver = {
607 .driver = {
608 .name = "lcd_mipid",
609 .owner = THIS_MODULE,
610 },
611 .probe = mipid_spi_probe,
612 .remove = mipid_spi_remove,
613};
614module_spi_driver(mipid_spi_driver);
615
616MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
deleted file mode 100644
index 6b9f7925e918..000000000000
--- a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
+++ /dev/null
@@ -1,290 +0,0 @@
1/*
2 * Support for NEC-nl8048hl11-01b panel driver
3 *
4 * Copyright (C) 2010 Texas Instruments Inc.
5 * Author: Erik Gilling <konkers@android.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <linux/module.h>
20#include <linux/delay.h>
21#include <linux/spi/spi.h>
22#include <linux/fb.h>
23#include <linux/gpio.h>
24
25#include <video/omapdss.h>
26#include <video/omap-panel-data.h>
27
28#define LCD_XRES 800
29#define LCD_YRES 480
30/*
31 * NEC PIX Clock Ratings
32 * MIN:21.8MHz TYP:23.8MHz MAX:25.7MHz
33 */
34#define LCD_PIXEL_CLOCK 23800
35
36static const struct {
37 unsigned char addr;
38 unsigned char dat;
39} nec_8048_init_seq[] = {
40 { 3, 0x01 }, { 0, 0x00 }, { 1, 0x01 }, { 4, 0x00 }, { 5, 0x14 },
41 { 6, 0x24 }, { 16, 0xD7 }, { 17, 0x00 }, { 18, 0x00 }, { 19, 0x55 },
42 { 20, 0x01 }, { 21, 0x70 }, { 22, 0x1E }, { 23, 0x25 }, { 24, 0x25 },
43 { 25, 0x02 }, { 26, 0x02 }, { 27, 0xA0 }, { 32, 0x2F }, { 33, 0x0F },
44 { 34, 0x0F }, { 35, 0x0F }, { 36, 0x0F }, { 37, 0x0F }, { 38, 0x0F },
45 { 39, 0x00 }, { 40, 0x02 }, { 41, 0x02 }, { 42, 0x02 }, { 43, 0x0F },
46 { 44, 0x0F }, { 45, 0x0F }, { 46, 0x0F }, { 47, 0x0F }, { 48, 0x0F },
47 { 49, 0x0F }, { 50, 0x00 }, { 51, 0x02 }, { 52, 0x02 }, { 53, 0x02 },
48 { 80, 0x0C }, { 83, 0x42 }, { 84, 0x42 }, { 85, 0x41 }, { 86, 0x14 },
49 { 89, 0x88 }, { 90, 0x01 }, { 91, 0x00 }, { 92, 0x02 }, { 93, 0x0C },
50 { 94, 0x1C }, { 95, 0x27 }, { 98, 0x49 }, { 99, 0x27 }, { 102, 0x76 },
51 { 103, 0x27 }, { 112, 0x01 }, { 113, 0x0E }, { 114, 0x02 },
52 { 115, 0x0C }, { 118, 0x0C }, { 121, 0x30 }, { 130, 0x00 },
53 { 131, 0x00 }, { 132, 0xFC }, { 134, 0x00 }, { 136, 0x00 },
54 { 138, 0x00 }, { 139, 0x00 }, { 140, 0x00 }, { 141, 0xFC },
55 { 143, 0x00 }, { 145, 0x00 }, { 147, 0x00 }, { 148, 0x00 },
56 { 149, 0x00 }, { 150, 0xFC }, { 152, 0x00 }, { 154, 0x00 },
57 { 156, 0x00 }, { 157, 0x00 }, { 2, 0x00 },
58};
59
60/*
61 * NEC NL8048HL11-01B Manual
62 * defines HFB, HSW, HBP, VFP, VSW, VBP as shown below
63 */
64
65static struct omap_video_timings nec_8048_panel_timings = {
66 /* 800 x 480 @ 60 Hz Reduced blanking VESA CVT 0.31M3-R */
67 .x_res = LCD_XRES,
68 .y_res = LCD_YRES,
69 .pixel_clock = LCD_PIXEL_CLOCK,
70 .hfp = 6,
71 .hsw = 1,
72 .hbp = 4,
73 .vfp = 3,
74 .vsw = 1,
75 .vbp = 4,
76
77 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
78 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
79 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
80 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
81 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
82};
83
84static inline struct panel_nec_nl8048_data
85*get_panel_data(const struct omap_dss_device *dssdev)
86{
87 return (struct panel_nec_nl8048_data *) dssdev->data;
88}
89
90static int nec_8048_panel_probe(struct omap_dss_device *dssdev)
91{
92 struct panel_nec_nl8048_data *pd = get_panel_data(dssdev);
93 int r;
94
95 if (!pd)
96 return -EINVAL;
97
98 dssdev->panel.timings = nec_8048_panel_timings;
99
100 if (gpio_is_valid(pd->qvga_gpio)) {
101 r = devm_gpio_request_one(dssdev->dev, pd->qvga_gpio,
102 GPIOF_OUT_INIT_HIGH, "lcd QVGA");
103 if (r)
104 return r;
105 }
106
107 if (gpio_is_valid(pd->res_gpio)) {
108 r = devm_gpio_request_one(dssdev->dev, pd->res_gpio,
109 GPIOF_OUT_INIT_LOW, "lcd RES");
110 if (r)
111 return r;
112 }
113
114 return 0;
115}
116
117static void nec_8048_panel_remove(struct omap_dss_device *dssdev)
118{
119}
120
121static int nec_8048_panel_power_on(struct omap_dss_device *dssdev)
122{
123 struct panel_nec_nl8048_data *pd = get_panel_data(dssdev);
124 int r;
125
126 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
127 return 0;
128
129 omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
130 omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
131
132 r = omapdss_dpi_display_enable(dssdev);
133 if (r)
134 goto err0;
135
136 if (gpio_is_valid(pd->res_gpio))
137 gpio_set_value_cansleep(pd->res_gpio, 1);
138
139 return 0;
140
141err0:
142 return r;
143}
144
145static void nec_8048_panel_power_off(struct omap_dss_device *dssdev)
146{
147 struct panel_nec_nl8048_data *pd = get_panel_data(dssdev);
148
149 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
150 return;
151
152 if (gpio_is_valid(pd->res_gpio))
153 gpio_set_value_cansleep(pd->res_gpio, 0);
154
155 omapdss_dpi_display_disable(dssdev);
156}
157
158static int nec_8048_panel_enable(struct omap_dss_device *dssdev)
159{
160 int r;
161
162 r = nec_8048_panel_power_on(dssdev);
163 if (r)
164 return r;
165
166 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
167
168 return 0;
169}
170
171static void nec_8048_panel_disable(struct omap_dss_device *dssdev)
172{
173 nec_8048_panel_power_off(dssdev);
174
175 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
176}
177
178static int nec_8048_recommended_bpp(struct omap_dss_device *dssdev)
179{
180 return 16;
181}
182
183static struct omap_dss_driver nec_8048_driver = {
184 .probe = nec_8048_panel_probe,
185 .remove = nec_8048_panel_remove,
186 .enable = nec_8048_panel_enable,
187 .disable = nec_8048_panel_disable,
188 .get_recommended_bpp = nec_8048_recommended_bpp,
189
190 .driver = {
191 .name = "NEC_8048_panel",
192 .owner = THIS_MODULE,
193 },
194};
195
196static int nec_8048_spi_send(struct spi_device *spi, unsigned char reg_addr,
197 unsigned char reg_data)
198{
199 int ret = 0;
200 unsigned int cmd = 0, data = 0;
201
202 cmd = 0x0000 | reg_addr; /* register address write */
203 data = 0x0100 | reg_data ; /* register data write */
204 data = (cmd << 16) | data;
205
206 ret = spi_write(spi, (unsigned char *)&data, 4);
207 if (ret)
208 pr_err("error in spi_write %x\n", data);
209
210 return ret;
211}
212
213static int init_nec_8048_wvga_lcd(struct spi_device *spi)
214{
215 unsigned int i;
216 /* Initialization Sequence */
217 /* nec_8048_spi_send(spi, REG, VAL) */
218 for (i = 0; i < (ARRAY_SIZE(nec_8048_init_seq) - 1); i++)
219 nec_8048_spi_send(spi, nec_8048_init_seq[i].addr,
220 nec_8048_init_seq[i].dat);
221 udelay(20);
222 nec_8048_spi_send(spi, nec_8048_init_seq[i].addr,
223 nec_8048_init_seq[i].dat);
224 return 0;
225}
226
227static int nec_8048_spi_probe(struct spi_device *spi)
228{
229 spi->mode = SPI_MODE_0;
230 spi->bits_per_word = 32;
231 spi_setup(spi);
232
233 init_nec_8048_wvga_lcd(spi);
234
235 return omap_dss_register_driver(&nec_8048_driver);
236}
237
238static int nec_8048_spi_remove(struct spi_device *spi)
239{
240 omap_dss_unregister_driver(&nec_8048_driver);
241
242 return 0;
243}
244
245#ifdef CONFIG_PM_SLEEP
246
247static int nec_8048_spi_suspend(struct device *dev)
248{
249 struct spi_device *spi = to_spi_device(dev);
250
251 nec_8048_spi_send(spi, 2, 0x01);
252 mdelay(40);
253
254 return 0;
255}
256
257static int nec_8048_spi_resume(struct device *dev)
258{
259 struct spi_device *spi = to_spi_device(dev);
260
261 /* reinitialize the panel */
262 spi_setup(spi);
263 nec_8048_spi_send(spi, 2, 0x00);
264 init_nec_8048_wvga_lcd(spi);
265
266 return 0;
267}
268
269static SIMPLE_DEV_PM_OPS(nec_8048_spi_pm_ops, nec_8048_spi_suspend,
270 nec_8048_spi_resume);
271#define NEC_8048_SPI_PM_OPS (&nec_8048_spi_pm_ops)
272#else
273#define NEC_8048_SPI_PM_OPS NULL
274#endif
275
276static struct spi_driver nec_8048_spi_driver = {
277 .probe = nec_8048_spi_probe,
278 .remove = nec_8048_spi_remove,
279 .driver = {
280 .name = "nec_8048_spi",
281 .owner = THIS_MODULE,
282 .pm = NEC_8048_SPI_PM_OPS,
283 },
284};
285
286module_spi_driver(nec_8048_spi_driver);
287
288MODULE_AUTHOR("Erik Gilling <konkers@android.com>");
289MODULE_DESCRIPTION("NEC-nl8048hl11-01b Driver");
290MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/displays/panel-picodlp.c b/drivers/video/omap2/displays/panel-picodlp.c
deleted file mode 100644
index 153e9bea0f6e..000000000000
--- a/drivers/video/omap2/displays/panel-picodlp.c
+++ /dev/null
@@ -1,559 +0,0 @@
1/*
2 * picodlp panel driver
3 * picodlp_i2c_driver: i2c_client driver
4 *
5 * Copyright (C) 2009-2011 Texas Instruments
6 * Author: Mythri P K <mythripk@ti.com>
7 * Mayuresh Janorkar <mayur@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
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/input.h>
24#include <linux/platform_device.h>
25#include <linux/interrupt.h>
26#include <linux/firmware.h>
27#include <linux/slab.h>
28#include <linux/mutex.h>
29#include <linux/i2c.h>
30#include <linux/delay.h>
31#include <linux/gpio.h>
32
33#include <video/omapdss.h>
34#include <video/omap-panel-data.h>
35
36#include "panel-picodlp.h"
37
38struct picodlp_data {
39 struct mutex lock;
40 struct i2c_client *picodlp_i2c_client;
41};
42
43static struct i2c_board_info picodlp_i2c_board_info = {
44 I2C_BOARD_INFO("picodlp_i2c_driver", 0x1b),
45};
46
47struct picodlp_i2c_data {
48 struct mutex xfer_lock;
49};
50
51static struct i2c_device_id picodlp_i2c_id[] = {
52 { "picodlp_i2c_driver", 0 },
53 { }
54};
55
56struct picodlp_i2c_command {
57 u8 reg;
58 u32 value;
59};
60
61static struct omap_video_timings pico_ls_timings = {
62 .x_res = 864,
63 .y_res = 480,
64 .hsw = 7,
65 .hfp = 11,
66 .hbp = 7,
67
68 .pixel_clock = 19200,
69
70 .vsw = 2,
71 .vfp = 3,
72 .vbp = 14,
73
74 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
75 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
76 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
77 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
78 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
79};
80
81static inline struct picodlp_panel_data
82 *get_panel_data(const struct omap_dss_device *dssdev)
83{
84 return (struct picodlp_panel_data *) dssdev->data;
85}
86
87static u32 picodlp_i2c_read(struct i2c_client *client, u8 reg)
88{
89 u8 read_cmd[] = {READ_REG_SELECT, reg}, data[4];
90 struct picodlp_i2c_data *picodlp_i2c_data = i2c_get_clientdata(client);
91 struct i2c_msg msg[2];
92
93 mutex_lock(&picodlp_i2c_data->xfer_lock);
94
95 msg[0].addr = client->addr;
96 msg[0].flags = 0;
97 msg[0].len = 2;
98 msg[0].buf = read_cmd;
99
100 msg[1].addr = client->addr;
101 msg[1].flags = I2C_M_RD;
102 msg[1].len = 4;
103 msg[1].buf = data;
104
105 i2c_transfer(client->adapter, msg, 2);
106 mutex_unlock(&picodlp_i2c_data->xfer_lock);
107 return (data[3] | (data[2] << 8) | (data[1] << 16) | (data[0] << 24));
108}
109
110static int picodlp_i2c_write_block(struct i2c_client *client,
111 u8 *data, int len)
112{
113 struct i2c_msg msg;
114 int i, r, msg_count = 1;
115
116 struct picodlp_i2c_data *picodlp_i2c_data = i2c_get_clientdata(client);
117
118 if (len < 1 || len > 32) {
119 dev_err(&client->dev,
120 "too long syn_write_block len %d\n", len);
121 return -EIO;
122 }
123 mutex_lock(&picodlp_i2c_data->xfer_lock);
124
125 msg.addr = client->addr;
126 msg.flags = 0;
127 msg.len = len;
128 msg.buf = data;
129 r = i2c_transfer(client->adapter, &msg, msg_count);
130 mutex_unlock(&picodlp_i2c_data->xfer_lock);
131
132 /*
133 * i2c_transfer returns:
134 * number of messages sent in case of success
135 * a negative error number in case of failure
136 */
137 if (r != msg_count)
138 goto err;
139
140 /* In case of success */
141 for (i = 0; i < len; i++)
142 dev_dbg(&client->dev,
143 "addr %x bw 0x%02x[%d]: 0x%02x\n",
144 client->addr, data[0] + i, i, data[i]);
145
146 return 0;
147err:
148 dev_err(&client->dev, "picodlp_i2c_write error\n");
149 return r;
150}
151
152static int picodlp_i2c_write(struct i2c_client *client, u8 reg, u32 value)
153{
154 u8 data[5];
155 int i;
156
157 data[0] = reg;
158 for (i = 1; i < 5; i++)
159 data[i] = (value >> (32 - (i) * 8)) & 0xFF;
160
161 return picodlp_i2c_write_block(client, data, 5);
162}
163
164static int picodlp_i2c_write_array(struct i2c_client *client,
165 const struct picodlp_i2c_command commands[],
166 int count)
167{
168 int i, r = 0;
169 for (i = 0; i < count; i++) {
170 r = picodlp_i2c_write(client, commands[i].reg,
171 commands[i].value);
172 if (r)
173 return r;
174 }
175 return r;
176}
177
178static int picodlp_wait_for_dma_done(struct i2c_client *client)
179{
180 u8 trial = 100;
181
182 do {
183 msleep(1);
184 if (!trial--)
185 return -ETIMEDOUT;
186 } while (picodlp_i2c_read(client, MAIN_STATUS) & DMA_STATUS);
187
188 return 0;
189}
190
191/**
192 * picodlp_i2c_init: i2c_initialization routine
193 * client: i2c_client for communication
194 *
195 * return
196 * 0 : Success, no error
197 * error code : Failure
198 */
199static int picodlp_i2c_init(struct i2c_client *client)
200{
201 int r;
202 static const struct picodlp_i2c_command init_cmd_set1[] = {
203 {SOFT_RESET, 1},
204 {DMD_PARK_TRIGGER, 1},
205 {MISC_REG, 5},
206 {SEQ_CONTROL, 0},
207 {SEQ_VECTOR, 0x100},
208 {DMD_BLOCK_COUNT, 7},
209 {DMD_VCC_CONTROL, 0x109},
210 {DMD_PARK_PULSE_COUNT, 0xA},
211 {DMD_PARK_PULSE_WIDTH, 0xB},
212 {DMD_PARK_DELAY, 0x2ED},
213 {DMD_SHADOW_ENABLE, 0},
214 {FLASH_OPCODE, 0xB},
215 {FLASH_DUMMY_BYTES, 1},
216 {FLASH_ADDR_BYTES, 3},
217 {PBC_CONTROL, 0},
218 {FLASH_START_ADDR, CMT_LUT_0_START_ADDR},
219 {FLASH_READ_BYTES, CMT_LUT_0_SIZE},
220 {CMT_SPLASH_LUT_START_ADDR, 0},
221 {CMT_SPLASH_LUT_DEST_SELECT, CMT_LUT_ALL},
222 {PBC_CONTROL, 1},
223 };
224
225 static const struct picodlp_i2c_command init_cmd_set2[] = {
226 {PBC_CONTROL, 0},
227 {CMT_SPLASH_LUT_DEST_SELECT, 0},
228 {PBC_CONTROL, 0},
229 {FLASH_START_ADDR, SEQUENCE_0_START_ADDR},
230 {FLASH_READ_BYTES, SEQUENCE_0_SIZE},
231 {SEQ_RESET_LUT_START_ADDR, 0},
232 {SEQ_RESET_LUT_DEST_SELECT, SEQ_SEQ_LUT},
233 {PBC_CONTROL, 1},
234 };
235
236 static const struct picodlp_i2c_command init_cmd_set3[] = {
237 {PBC_CONTROL, 0},
238 {SEQ_RESET_LUT_DEST_SELECT, 0},
239 {PBC_CONTROL, 0},
240 {FLASH_START_ADDR, DRC_TABLE_0_START_ADDR},
241 {FLASH_READ_BYTES, DRC_TABLE_0_SIZE},
242 {SEQ_RESET_LUT_START_ADDR, 0},
243 {SEQ_RESET_LUT_DEST_SELECT, SEQ_DRC_LUT_ALL},
244 {PBC_CONTROL, 1},
245 };
246
247 static const struct picodlp_i2c_command init_cmd_set4[] = {
248 {PBC_CONTROL, 0},
249 {SEQ_RESET_LUT_DEST_SELECT, 0},
250 {SDC_ENABLE, 1},
251 {AGC_CTRL, 7},
252 {CCA_C1A, 0x100},
253 {CCA_C1B, 0x0},
254 {CCA_C1C, 0x0},
255 {CCA_C2A, 0x0},
256 {CCA_C2B, 0x100},
257 {CCA_C2C, 0x0},
258 {CCA_C3A, 0x0},
259 {CCA_C3B, 0x0},
260 {CCA_C3C, 0x100},
261 {CCA_C7A, 0x100},
262 {CCA_C7B, 0x100},
263 {CCA_C7C, 0x100},
264 {CCA_ENABLE, 1},
265 {CPU_IF_MODE, 1},
266 {SHORT_FLIP, 1},
267 {CURTAIN_CONTROL, 0},
268 {DMD_PARK_TRIGGER, 0},
269 {R_DRIVE_CURRENT, 0x298},
270 {G_DRIVE_CURRENT, 0x298},
271 {B_DRIVE_CURRENT, 0x298},
272 {RGB_DRIVER_ENABLE, 7},
273 {SEQ_CONTROL, 0},
274 {ACTGEN_CONTROL, 0x10},
275 {SEQUENCE_MODE, SEQ_LOCK},
276 {DATA_FORMAT, RGB888},
277 {INPUT_RESOLUTION, WVGA_864_LANDSCAPE},
278 {INPUT_SOURCE, PARALLEL_RGB},
279 {CPU_IF_SYNC_METHOD, 1},
280 {SEQ_CONTROL, 1}
281 };
282
283 r = picodlp_i2c_write_array(client, init_cmd_set1,
284 ARRAY_SIZE(init_cmd_set1));
285 if (r)
286 return r;
287
288 r = picodlp_wait_for_dma_done(client);
289 if (r)
290 return r;
291
292 r = picodlp_i2c_write_array(client, init_cmd_set2,
293 ARRAY_SIZE(init_cmd_set2));
294 if (r)
295 return r;
296
297 r = picodlp_wait_for_dma_done(client);
298 if (r)
299 return r;
300
301 r = picodlp_i2c_write_array(client, init_cmd_set3,
302 ARRAY_SIZE(init_cmd_set3));
303 if (r)
304 return r;
305
306 r = picodlp_wait_for_dma_done(client);
307 if (r)
308 return r;
309
310 r = picodlp_i2c_write_array(client, init_cmd_set4,
311 ARRAY_SIZE(init_cmd_set4));
312 if (r)
313 return r;
314
315 return 0;
316}
317
318static int picodlp_i2c_probe(struct i2c_client *client,
319 const struct i2c_device_id *id)
320{
321 struct picodlp_i2c_data *picodlp_i2c_data;
322
323 picodlp_i2c_data = kzalloc(sizeof(struct picodlp_i2c_data), GFP_KERNEL);
324
325 if (!picodlp_i2c_data)
326 return -ENOMEM;
327
328 mutex_init(&picodlp_i2c_data->xfer_lock);
329 i2c_set_clientdata(client, picodlp_i2c_data);
330
331 return 0;
332}
333
334static int picodlp_i2c_remove(struct i2c_client *client)
335{
336 struct picodlp_i2c_data *picodlp_i2c_data =
337 i2c_get_clientdata(client);
338 kfree(picodlp_i2c_data);
339 return 0;
340}
341
342static struct i2c_driver picodlp_i2c_driver = {
343 .driver = {
344 .name = "picodlp_i2c_driver",
345 },
346 .probe = picodlp_i2c_probe,
347 .remove = picodlp_i2c_remove,
348 .id_table = picodlp_i2c_id,
349};
350
351static int picodlp_panel_power_on(struct omap_dss_device *dssdev)
352{
353 int r, trial = 100;
354 struct picodlp_data *picod = dev_get_drvdata(dssdev->dev);
355 struct picodlp_panel_data *picodlp_pdata = get_panel_data(dssdev);
356
357 gpio_set_value(picodlp_pdata->pwrgood_gpio, 0);
358 msleep(1);
359 gpio_set_value(picodlp_pdata->pwrgood_gpio, 1);
360
361 while (!gpio_get_value(picodlp_pdata->emu_done_gpio)) {
362 if (!trial--) {
363 dev_err(dssdev->dev, "emu_done signal not"
364 " going high\n");
365 return -ETIMEDOUT;
366 }
367 msleep(5);
368 }
369 /*
370 * As per dpp2600 programming guide,
371 * it is required to sleep for 1000ms after emu_done signal goes high
372 * then only i2c commands can be successfully sent to dpp2600
373 */
374 msleep(1000);
375
376 omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
377 omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
378
379 r = omapdss_dpi_display_enable(dssdev);
380 if (r) {
381 dev_err(dssdev->dev, "failed to enable DPI\n");
382 goto err1;
383 }
384
385 r = picodlp_i2c_init(picod->picodlp_i2c_client);
386 if (r)
387 goto err;
388
389 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
390
391 return r;
392err:
393 omapdss_dpi_display_disable(dssdev);
394err1:
395 return r;
396}
397
398static void picodlp_panel_power_off(struct omap_dss_device *dssdev)
399{
400 struct picodlp_panel_data *picodlp_pdata = get_panel_data(dssdev);
401
402 omapdss_dpi_display_disable(dssdev);
403
404 gpio_set_value(picodlp_pdata->emu_done_gpio, 0);
405 gpio_set_value(picodlp_pdata->pwrgood_gpio, 0);
406}
407
408static int picodlp_panel_probe(struct omap_dss_device *dssdev)
409{
410 struct picodlp_data *picod;
411 struct picodlp_panel_data *picodlp_pdata = get_panel_data(dssdev);
412 struct i2c_adapter *adapter;
413 struct i2c_client *picodlp_i2c_client;
414 int r, picodlp_adapter_id;
415
416 dssdev->panel.timings = pico_ls_timings;
417
418 if (!picodlp_pdata)
419 return -EINVAL;
420
421 picod = devm_kzalloc(dssdev->dev, sizeof(*picod), GFP_KERNEL);
422 if (!picod)
423 return -ENOMEM;
424
425 mutex_init(&picod->lock);
426
427 picodlp_adapter_id = picodlp_pdata->picodlp_adapter_id;
428
429 adapter = i2c_get_adapter(picodlp_adapter_id);
430 if (!adapter) {
431 dev_err(dssdev->dev, "can't get i2c adapter\n");
432 return -ENODEV;
433 }
434
435 picodlp_i2c_client = i2c_new_device(adapter, &picodlp_i2c_board_info);
436 if (!picodlp_i2c_client) {
437 dev_err(dssdev->dev, "can't add i2c device::"
438 " picodlp_i2c_client is NULL\n");
439 return -ENODEV;
440 }
441
442 picod->picodlp_i2c_client = picodlp_i2c_client;
443
444 dev_set_drvdata(dssdev->dev, picod);
445
446 if (gpio_is_valid(picodlp_pdata->emu_done_gpio)) {
447 r = devm_gpio_request_one(dssdev->dev,
448 picodlp_pdata->emu_done_gpio,
449 GPIOF_IN, "DLP EMU DONE");
450 if (r)
451 return r;
452 }
453
454 if (gpio_is_valid(picodlp_pdata->pwrgood_gpio)) {
455 r = devm_gpio_request_one(dssdev->dev,
456 picodlp_pdata->pwrgood_gpio,
457 GPIOF_OUT_INIT_LOW, "DLP PWRGOOD");
458 if (r)
459 return r;
460 }
461
462 return 0;
463}
464
465static void picodlp_panel_remove(struct omap_dss_device *dssdev)
466{
467 struct picodlp_data *picod = dev_get_drvdata(dssdev->dev);
468
469 i2c_unregister_device(picod->picodlp_i2c_client);
470 dev_set_drvdata(dssdev->dev, NULL);
471 dev_dbg(dssdev->dev, "removing picodlp panel\n");
472}
473
474static int picodlp_panel_enable(struct omap_dss_device *dssdev)
475{
476 struct picodlp_data *picod = dev_get_drvdata(dssdev->dev);
477 int r;
478
479 dev_dbg(dssdev->dev, "enabling picodlp panel\n");
480
481 mutex_lock(&picod->lock);
482 if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
483 mutex_unlock(&picod->lock);
484 return -EINVAL;
485 }
486
487 r = picodlp_panel_power_on(dssdev);
488 mutex_unlock(&picod->lock);
489
490 return r;
491}
492
493static void picodlp_panel_disable(struct omap_dss_device *dssdev)
494{
495 struct picodlp_data *picod = dev_get_drvdata(dssdev->dev);
496
497 mutex_lock(&picod->lock);
498 /* Turn off DLP Power */
499 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
500 picodlp_panel_power_off(dssdev);
501
502 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
503 mutex_unlock(&picod->lock);
504
505 dev_dbg(dssdev->dev, "disabling picodlp panel\n");
506}
507
508static void picodlp_get_resolution(struct omap_dss_device *dssdev,
509 u16 *xres, u16 *yres)
510{
511 *xres = dssdev->panel.timings.x_res;
512 *yres = dssdev->panel.timings.y_res;
513}
514
515static struct omap_dss_driver picodlp_driver = {
516 .probe = picodlp_panel_probe,
517 .remove = picodlp_panel_remove,
518
519 .enable = picodlp_panel_enable,
520 .disable = picodlp_panel_disable,
521
522 .get_resolution = picodlp_get_resolution,
523
524 .driver = {
525 .name = "picodlp_panel",
526 .owner = THIS_MODULE,
527 },
528};
529
530static int __init picodlp_init(void)
531{
532 int r = 0;
533
534 r = i2c_add_driver(&picodlp_i2c_driver);
535 if (r) {
536 printk(KERN_WARNING "picodlp_i2c_driver" \
537 " registration failed\n");
538 return r;
539 }
540
541 r = omap_dss_register_driver(&picodlp_driver);
542 if (r)
543 i2c_del_driver(&picodlp_i2c_driver);
544
545 return r;
546}
547
548static void __exit picodlp_exit(void)
549{
550 i2c_del_driver(&picodlp_i2c_driver);
551 omap_dss_unregister_driver(&picodlp_driver);
552}
553
554module_init(picodlp_init);
555module_exit(picodlp_exit);
556
557MODULE_AUTHOR("Mythri P K <mythripk@ti.com>");
558MODULE_DESCRIPTION("picodlp driver");
559MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/displays/panel-picodlp.h b/drivers/video/omap2/displays/panel-picodlp.h
deleted file mode 100644
index a34b431a7267..000000000000
--- a/drivers/video/omap2/displays/panel-picodlp.h
+++ /dev/null
@@ -1,288 +0,0 @@
1/*
2 * Header file required by picodlp panel driver
3 *
4 * Copyright (C) 2009-2011 Texas Instruments
5 * Author: Mythri P K <mythripk@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef __OMAP2_DISPLAY_PANEL_PICODLP_H
21#define __OMAP2_DISPLAY_PANEL_PICODLP_H
22
23/* Commands used for configuring picodlp panel */
24
25#define MAIN_STATUS 0x03
26#define PBC_CONTROL 0x08
27#define INPUT_SOURCE 0x0B
28#define INPUT_RESOLUTION 0x0C
29#define DATA_FORMAT 0x0D
30#define IMG_ROTATION 0x0E
31#define LONG_FLIP 0x0F
32#define SHORT_FLIP 0x10
33#define TEST_PAT_SELECT 0x11
34#define R_DRIVE_CURRENT 0x12
35#define G_DRIVE_CURRENT 0x13
36#define B_DRIVE_CURRENT 0x14
37#define READ_REG_SELECT 0x15
38#define RGB_DRIVER_ENABLE 0x16
39
40#define CPU_IF_MODE 0x18
41#define FRAME_RATE 0x19
42#define CPU_IF_SYNC_METHOD 0x1A
43#define CPU_IF_SOF 0x1B
44#define CPU_IF_EOF 0x1C
45#define CPU_IF_SLEEP 0x1D
46
47#define SEQUENCE_MODE 0x1E
48#define SOFT_RESET 0x1F
49#define FRONT_END_RESET 0x21
50#define AUTO_PWR_ENABLE 0x22
51
52#define VSYNC_LINE_DELAY 0x23
53#define CPU_PI_HORIZ_START 0x24
54#define CPU_PI_VERT_START 0x25
55#define CPU_PI_HORIZ_WIDTH 0x26
56#define CPU_PI_VERT_HEIGHT 0x27
57
58#define PIXEL_MASK_CROP 0x28
59#define CROP_FIRST_LINE 0x29
60#define CROP_LAST_LINE 0x2A
61#define CROP_FIRST_PIXEL 0x2B
62#define CROP_LAST_PIXEL 0x2C
63#define DMD_PARK_TRIGGER 0x2D
64
65#define MISC_REG 0x30
66
67/* AGC registers */
68#define AGC_CTRL 0x50
69#define AGC_CLIPPED_PIXS 0x55
70#define AGC_BRIGHT_PIXS 0x56
71#define AGC_BG_PIXS 0x57
72#define AGC_SAFETY_MARGIN 0x17
73
74/* Color Coordinate Adjustment registers */
75#define CCA_ENABLE 0x5E
76#define CCA_C1A 0x5F
77#define CCA_C1B 0x60
78#define CCA_C1C 0x61
79#define CCA_C2A 0x62
80#define CCA_C2B 0x63
81#define CCA_C2C 0x64
82#define CCA_C3A 0x65
83#define CCA_C3B 0x66
84#define CCA_C3C 0x67
85#define CCA_C7A 0x71
86#define CCA_C7B 0x72
87#define CCA_C7C 0x73
88
89/**
90 * DLP Pico Processor 2600 comes with flash
91 * We can do DMA operations from flash for accessing Look Up Tables
92 */
93#define DMA_STATUS 0x100
94#define FLASH_ADDR_BYTES 0x74
95#define FLASH_DUMMY_BYTES 0x75
96#define FLASH_WRITE_BYTES 0x76
97#define FLASH_READ_BYTES 0x77
98#define FLASH_OPCODE 0x78
99#define FLASH_START_ADDR 0x79
100#define FLASH_DUMMY2 0x7A
101#define FLASH_WRITE_DATA 0x7B
102
103#define TEMPORAL_DITH_DISABLE 0x7E
104#define SEQ_CONTROL 0x82
105#define SEQ_VECTOR 0x83
106
107/* DMD is Digital Micromirror Device */
108#define DMD_BLOCK_COUNT 0x84
109#define DMD_VCC_CONTROL 0x86
110#define DMD_PARK_PULSE_COUNT 0x87
111#define DMD_PARK_PULSE_WIDTH 0x88
112#define DMD_PARK_DELAY 0x89
113#define DMD_SHADOW_ENABLE 0x8E
114#define SEQ_STATUS 0x8F
115#define FLASH_CLOCK_CONTROL 0x98
116#define DMD_PARK 0x2D
117
118#define SDRAM_BIST_ENABLE 0x46
119#define DDR_DRIVER_STRENGTH 0x9A
120#define SDC_ENABLE 0x9D
121#define SDC_BUFF_SWAP_DISABLE 0xA3
122#define CURTAIN_CONTROL 0xA6
123#define DDR_BUS_SWAP_ENABLE 0xA7
124#define DMD_TRC_ENABLE 0xA8
125#define DMD_BUS_SWAP_ENABLE 0xA9
126
127#define ACTGEN_ENABLE 0xAE
128#define ACTGEN_CONTROL 0xAF
129#define ACTGEN_HORIZ_BP 0xB0
130#define ACTGEN_VERT_BP 0xB1
131
132/* Look Up Table access */
133#define CMT_SPLASH_LUT_START_ADDR 0xFA
134#define CMT_SPLASH_LUT_DEST_SELECT 0xFB
135#define CMT_SPLASH_LUT_DATA 0xFC
136#define SEQ_RESET_LUT_START_ADDR 0xFD
137#define SEQ_RESET_LUT_DEST_SELECT 0xFE
138#define SEQ_RESET_LUT_DATA 0xFF
139
140/* Input source definitions */
141#define PARALLEL_RGB 0
142#define INT_TEST_PATTERN 1
143#define SPLASH_SCREEN 2
144#define CPU_INTF 3
145#define BT656 4
146
147/* Standard input resolution definitions */
148#define QWVGA_LANDSCAPE 3 /* (427h*240v) */
149#define WVGA_864_LANDSCAPE 21 /* (864h*480v) */
150#define WVGA_DMD_OPTICAL_TEST 35 /* (608h*684v) */
151
152/* Standard data format definitions */
153#define RGB565 0
154#define RGB666 1
155#define RGB888 2
156
157/* Test Pattern definitions */
158#define TPG_CHECKERBOARD 0
159#define TPG_BLACK 1
160#define TPG_WHITE 2
161#define TPG_RED 3
162#define TPG_BLUE 4
163#define TPG_GREEN 5
164#define TPG_VLINES_BLACK 6
165#define TPG_HLINES_BLACK 7
166#define TPG_VLINES_ALT 8
167#define TPG_HLINES_ALT 9
168#define TPG_DIAG_LINES 10
169#define TPG_GREYRAMP_VERT 11
170#define TPG_GREYRAMP_HORIZ 12
171#define TPG_ANSI_CHECKERBOARD 13
172
173/* sequence mode definitions */
174#define SEQ_FREE_RUN 0
175#define SEQ_LOCK 1
176
177/* curtain color definitions */
178#define CURTAIN_BLACK 0
179#define CURTAIN_RED 1
180#define CURTAIN_GREEN 2
181#define CURTAIN_BLUE 3
182#define CURTAIN_YELLOW 4
183#define CURTAIN_MAGENTA 5
184#define CURTAIN_CYAN 6
185#define CURTAIN_WHITE 7
186
187/* LUT definitions */
188#define CMT_LUT_NONE 0
189#define CMT_LUT_GREEN 1
190#define CMT_LUT_RED 2
191#define CMT_LUT_BLUE 3
192#define CMT_LUT_ALL 4
193#define SPLASH_LUT 5
194
195#define SEQ_LUT_NONE 0
196#define SEQ_DRC_LUT_0 1
197#define SEQ_DRC_LUT_1 2
198#define SEQ_DRC_LUT_2 3
199#define SEQ_DRC_LUT_3 4
200#define SEQ_SEQ_LUT 5
201#define SEQ_DRC_LUT_ALL 6
202#define WPC_PROGRAM_LUT 7
203
204#define BITSTREAM_START_ADDR 0x00000000
205#define BITSTREAM_SIZE 0x00040000
206
207#define WPC_FW_0_START_ADDR 0x00040000
208#define WPC_FW_0_SIZE 0x00000ce8
209
210#define SEQUENCE_0_START_ADDR 0x00044000
211#define SEQUENCE_0_SIZE 0x00001000
212
213#define SEQUENCE_1_START_ADDR 0x00045000
214#define SEQUENCE_1_SIZE 0x00000d10
215
216#define SEQUENCE_2_START_ADDR 0x00046000
217#define SEQUENCE_2_SIZE 0x00000d10
218
219#define SEQUENCE_3_START_ADDR 0x00047000
220#define SEQUENCE_3_SIZE 0x00000d10
221
222#define SEQUENCE_4_START_ADDR 0x00048000
223#define SEQUENCE_4_SIZE 0x00000d10
224
225#define SEQUENCE_5_START_ADDR 0x00049000
226#define SEQUENCE_5_SIZE 0x00000d10
227
228#define SEQUENCE_6_START_ADDR 0x0004a000
229#define SEQUENCE_6_SIZE 0x00000d10
230
231#define CMT_LUT_0_START_ADDR 0x0004b200
232#define CMT_LUT_0_SIZE 0x00000600
233
234#define CMT_LUT_1_START_ADDR 0x0004b800
235#define CMT_LUT_1_SIZE 0x00000600
236
237#define CMT_LUT_2_START_ADDR 0x0004be00
238#define CMT_LUT_2_SIZE 0x00000600
239
240#define CMT_LUT_3_START_ADDR 0x0004c400
241#define CMT_LUT_3_SIZE 0x00000600
242
243#define CMT_LUT_4_START_ADDR 0x0004ca00
244#define CMT_LUT_4_SIZE 0x00000600
245
246#define CMT_LUT_5_START_ADDR 0x0004d000
247#define CMT_LUT_5_SIZE 0x00000600
248
249#define CMT_LUT_6_START_ADDR 0x0004d600
250#define CMT_LUT_6_SIZE 0x00000600
251
252#define DRC_TABLE_0_START_ADDR 0x0004dc00
253#define DRC_TABLE_0_SIZE 0x00000100
254
255#define SPLASH_0_START_ADDR 0x0004dd00
256#define SPLASH_0_SIZE 0x00032280
257
258#define SEQUENCE_7_START_ADDR 0x00080000
259#define SEQUENCE_7_SIZE 0x00000d10
260
261#define SEQUENCE_8_START_ADDR 0x00081800
262#define SEQUENCE_8_SIZE 0x00000d10
263
264#define SEQUENCE_9_START_ADDR 0x00083000
265#define SEQUENCE_9_SIZE 0x00000d10
266
267#define CMT_LUT_7_START_ADDR 0x0008e000
268#define CMT_LUT_7_SIZE 0x00000600
269
270#define CMT_LUT_8_START_ADDR 0x0008e800
271#define CMT_LUT_8_SIZE 0x00000600
272
273#define CMT_LUT_9_START_ADDR 0x0008f000
274#define CMT_LUT_9_SIZE 0x00000600
275
276#define SPLASH_1_START_ADDR 0x0009a000
277#define SPLASH_1_SIZE 0x00032280
278
279#define SPLASH_2_START_ADDR 0x000cd000
280#define SPLASH_2_SIZE 0x00032280
281
282#define SPLASH_3_START_ADDR 0x00100000
283#define SPLASH_3_SIZE 0x00032280
284
285#define OPT_SPLASH_0_START_ADDR 0x00134000
286#define OPT_SPLASH_0_SIZE 0x000cb100
287
288#endif
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
deleted file mode 100644
index 78f0a6779756..000000000000
--- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
+++ /dev/null
@@ -1,198 +0,0 @@
1/*
2 * LCD panel driver for Sharp LS037V7DW01
3 *
4 * Copyright (C) 2008 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/module.h>
21#include <linux/delay.h>
22#include <linux/device.h>
23#include <linux/fb.h>
24#include <linux/err.h>
25#include <linux/slab.h>
26#include <linux/gpio.h>
27
28#include <video/omapdss.h>
29#include <video/omap-panel-data.h>
30
31static struct omap_video_timings sharp_ls_timings = {
32 .x_res = 480,
33 .y_res = 640,
34
35 .pixel_clock = 19200,
36
37 .hsw = 2,
38 .hfp = 1,
39 .hbp = 28,
40
41 .vsw = 1,
42 .vfp = 1,
43 .vbp = 1,
44
45 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
46 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
47 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
48 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
49 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
50};
51
52static inline struct panel_sharp_ls037v7dw01_data
53*get_panel_data(const struct omap_dss_device *dssdev)
54{
55 return (struct panel_sharp_ls037v7dw01_data *) dssdev->data;
56}
57
58static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
59{
60 struct panel_sharp_ls037v7dw01_data *pd = get_panel_data(dssdev);
61 int r;
62
63 if (!pd)
64 return -EINVAL;
65
66 dssdev->panel.timings = sharp_ls_timings;
67
68 if (gpio_is_valid(pd->mo_gpio)) {
69 r = devm_gpio_request_one(dssdev->dev, pd->mo_gpio,
70 GPIOF_OUT_INIT_LOW, "lcd MO");
71 if (r)
72 return r;
73 }
74
75 if (gpio_is_valid(pd->lr_gpio)) {
76 r = devm_gpio_request_one(dssdev->dev, pd->lr_gpio,
77 GPIOF_OUT_INIT_HIGH, "lcd LR");
78 if (r)
79 return r;
80 }
81
82 if (gpio_is_valid(pd->ud_gpio)) {
83 r = devm_gpio_request_one(dssdev->dev, pd->ud_gpio,
84 GPIOF_OUT_INIT_HIGH, "lcd UD");
85 if (r)
86 return r;
87 }
88
89 if (gpio_is_valid(pd->resb_gpio)) {
90 r = devm_gpio_request_one(dssdev->dev, pd->resb_gpio,
91 GPIOF_OUT_INIT_LOW, "lcd RESB");
92 if (r)
93 return r;
94 }
95
96 if (gpio_is_valid(pd->ini_gpio)) {
97 r = devm_gpio_request_one(dssdev->dev, pd->ini_gpio,
98 GPIOF_OUT_INIT_LOW, "lcd INI");
99 if (r)
100 return r;
101 }
102
103 return 0;
104}
105
106static void __exit sharp_ls_panel_remove(struct omap_dss_device *dssdev)
107{
108}
109
110static int sharp_ls_power_on(struct omap_dss_device *dssdev)
111{
112 struct panel_sharp_ls037v7dw01_data *pd = get_panel_data(dssdev);
113 int r = 0;
114
115 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
116 return 0;
117
118 omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
119 omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
120
121 r = omapdss_dpi_display_enable(dssdev);
122 if (r)
123 goto err0;
124
125 /* wait couple of vsyncs until enabling the LCD */
126 msleep(50);
127
128 if (gpio_is_valid(pd->resb_gpio))
129 gpio_set_value_cansleep(pd->resb_gpio, 1);
130
131 if (gpio_is_valid(pd->ini_gpio))
132 gpio_set_value_cansleep(pd->ini_gpio, 1);
133
134 return 0;
135err0:
136 return r;
137}
138
139static void sharp_ls_power_off(struct omap_dss_device *dssdev)
140{
141 struct panel_sharp_ls037v7dw01_data *pd = get_panel_data(dssdev);
142
143 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
144 return;
145
146 if (gpio_is_valid(pd->ini_gpio))
147 gpio_set_value_cansleep(pd->ini_gpio, 0);
148
149 if (gpio_is_valid(pd->resb_gpio))
150 gpio_set_value_cansleep(pd->resb_gpio, 0);
151
152 /* wait at least 5 vsyncs after disabling the LCD */
153
154 msleep(100);
155
156 omapdss_dpi_display_disable(dssdev);
157}
158
159static int sharp_ls_panel_enable(struct omap_dss_device *dssdev)
160{
161 int r;
162 r = sharp_ls_power_on(dssdev);
163 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
164 return r;
165}
166
167static void sharp_ls_panel_disable(struct omap_dss_device *dssdev)
168{
169 sharp_ls_power_off(dssdev);
170 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
171}
172
173static struct omap_dss_driver sharp_ls_driver = {
174 .probe = sharp_ls_panel_probe,
175 .remove = __exit_p(sharp_ls_panel_remove),
176
177 .enable = sharp_ls_panel_enable,
178 .disable = sharp_ls_panel_disable,
179
180 .driver = {
181 .name = "sharp_ls_panel",
182 .owner = THIS_MODULE,
183 },
184};
185
186static int __init sharp_ls_panel_drv_init(void)
187{
188 return omap_dss_register_driver(&sharp_ls_driver);
189}
190
191static void __exit sharp_ls_panel_drv_exit(void)
192{
193 omap_dss_unregister_driver(&sharp_ls_driver);
194}
195
196module_init(sharp_ls_panel_drv_init);
197module_exit(sharp_ls_panel_drv_exit);
198MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
deleted file mode 100644
index 54a07da8587a..000000000000
--- a/drivers/video/omap2/displays/panel-taal.c
+++ /dev/null
@@ -1,1551 +0,0 @@
1/*
2 * Taal DSI command mode panel
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20/*#define DEBUG*/
21
22#include <linux/module.h>
23#include <linux/delay.h>
24#include <linux/err.h>
25#include <linux/jiffies.h>
26#include <linux/sched.h>
27#include <linux/backlight.h>
28#include <linux/fb.h>
29#include <linux/interrupt.h>
30#include <linux/gpio.h>
31#include <linux/workqueue.h>
32#include <linux/slab.h>
33#include <linux/mutex.h>
34
35#include <video/omapdss.h>
36#include <video/omap-panel-data.h>
37#include <video/mipi_display.h>
38
39/* DSI Virtual channel. Hardcoded for now. */
40#define TCH 0
41
42#define DCS_READ_NUM_ERRORS 0x05
43#define DCS_BRIGHTNESS 0x51
44#define DCS_CTRL_DISPLAY 0x53
45#define DCS_WRITE_CABC 0x55
46#define DCS_READ_CABC 0x56
47#define DCS_GET_ID1 0xda
48#define DCS_GET_ID2 0xdb
49#define DCS_GET_ID3 0xdc
50
51static irqreturn_t taal_te_isr(int irq, void *data);
52static void taal_te_timeout_work_callback(struct work_struct *work);
53static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable);
54
55static int taal_panel_reset(struct omap_dss_device *dssdev);
56
57struct taal_data {
58 struct mutex lock;
59
60 struct backlight_device *bldev;
61
62 unsigned long hw_guard_end; /* next value of jiffies when we can
63 * issue the next sleep in/out command
64 */
65 unsigned long hw_guard_wait; /* max guard time in jiffies */
66
67 struct omap_dss_device *dssdev;
68
69 /* panel HW configuration from DT or platform data */
70 int reset_gpio;
71 int ext_te_gpio;
72
73 bool use_dsi_backlight;
74
75 struct omap_dsi_pin_config pin_config;
76
77 /* runtime variables */
78 bool enabled;
79
80 bool te_enabled;
81
82 atomic_t do_update;
83 int channel;
84
85 struct delayed_work te_timeout_work;
86
87 bool cabc_broken;
88 unsigned cabc_mode;
89
90 bool intro_printed;
91
92 struct workqueue_struct *workqueue;
93
94 struct delayed_work esd_work;
95 unsigned esd_interval;
96
97 bool ulps_enabled;
98 unsigned ulps_timeout;
99 struct delayed_work ulps_work;
100};
101
102static void taal_esd_work(struct work_struct *work);
103static void taal_ulps_work(struct work_struct *work);
104
105static void hw_guard_start(struct taal_data *td, int guard_msec)
106{
107 td->hw_guard_wait = msecs_to_jiffies(guard_msec);
108 td->hw_guard_end = jiffies + td->hw_guard_wait;
109}
110
111static void hw_guard_wait(struct taal_data *td)
112{
113 unsigned long wait = td->hw_guard_end - jiffies;
114
115 if ((long)wait > 0 && wait <= td->hw_guard_wait) {
116 set_current_state(TASK_UNINTERRUPTIBLE);
117 schedule_timeout(wait);
118 }
119}
120
121static int taal_dcs_read_1(struct taal_data *td, u8 dcs_cmd, u8 *data)
122{
123 int r;
124 u8 buf[1];
125
126 r = dsi_vc_dcs_read(td->dssdev, td->channel, dcs_cmd, buf, 1);
127
128 if (r < 0)
129 return r;
130
131 *data = buf[0];
132
133 return 0;
134}
135
136static int taal_dcs_write_0(struct taal_data *td, u8 dcs_cmd)
137{
138 return dsi_vc_dcs_write(td->dssdev, td->channel, &dcs_cmd, 1);
139}
140
141static int taal_dcs_write_1(struct taal_data *td, u8 dcs_cmd, u8 param)
142{
143 u8 buf[2];
144 buf[0] = dcs_cmd;
145 buf[1] = param;
146 return dsi_vc_dcs_write(td->dssdev, td->channel, buf, 2);
147}
148
149static int taal_sleep_in(struct taal_data *td)
150
151{
152 u8 cmd;
153 int r;
154
155 hw_guard_wait(td);
156
157 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
158 r = dsi_vc_dcs_write_nosync(td->dssdev, td->channel, &cmd, 1);
159 if (r)
160 return r;
161
162 hw_guard_start(td, 120);
163
164 msleep(5);
165
166 return 0;
167}
168
169static int taal_sleep_out(struct taal_data *td)
170{
171 int r;
172
173 hw_guard_wait(td);
174
175 r = taal_dcs_write_0(td, MIPI_DCS_EXIT_SLEEP_MODE);
176 if (r)
177 return r;
178
179 hw_guard_start(td, 120);
180
181 msleep(5);
182
183 return 0;
184}
185
186static int taal_get_id(struct taal_data *td, u8 *id1, u8 *id2, u8 *id3)
187{
188 int r;
189
190 r = taal_dcs_read_1(td, DCS_GET_ID1, id1);
191 if (r)
192 return r;
193 r = taal_dcs_read_1(td, DCS_GET_ID2, id2);
194 if (r)
195 return r;
196 r = taal_dcs_read_1(td, DCS_GET_ID3, id3);
197 if (r)
198 return r;
199
200 return 0;
201}
202
203static int taal_set_update_window(struct taal_data *td,
204 u16 x, u16 y, u16 w, u16 h)
205{
206 int r;
207 u16 x1 = x;
208 u16 x2 = x + w - 1;
209 u16 y1 = y;
210 u16 y2 = y + h - 1;
211
212 u8 buf[5];
213 buf[0] = MIPI_DCS_SET_COLUMN_ADDRESS;
214 buf[1] = (x1 >> 8) & 0xff;
215 buf[2] = (x1 >> 0) & 0xff;
216 buf[3] = (x2 >> 8) & 0xff;
217 buf[4] = (x2 >> 0) & 0xff;
218
219 r = dsi_vc_dcs_write_nosync(td->dssdev, td->channel, buf, sizeof(buf));
220 if (r)
221 return r;
222
223 buf[0] = MIPI_DCS_SET_PAGE_ADDRESS;
224 buf[1] = (y1 >> 8) & 0xff;
225 buf[2] = (y1 >> 0) & 0xff;
226 buf[3] = (y2 >> 8) & 0xff;
227 buf[4] = (y2 >> 0) & 0xff;
228
229 r = dsi_vc_dcs_write_nosync(td->dssdev, td->channel, buf, sizeof(buf));
230 if (r)
231 return r;
232
233 dsi_vc_send_bta_sync(td->dssdev, td->channel);
234
235 return r;
236}
237
238static void taal_queue_esd_work(struct omap_dss_device *dssdev)
239{
240 struct taal_data *td = dev_get_drvdata(dssdev->dev);
241
242 if (td->esd_interval > 0)
243 queue_delayed_work(td->workqueue, &td->esd_work,
244 msecs_to_jiffies(td->esd_interval));
245}
246
247static void taal_cancel_esd_work(struct omap_dss_device *dssdev)
248{
249 struct taal_data *td = dev_get_drvdata(dssdev->dev);
250
251 cancel_delayed_work(&td->esd_work);
252}
253
254static void taal_queue_ulps_work(struct omap_dss_device *dssdev)
255{
256 struct taal_data *td = dev_get_drvdata(dssdev->dev);
257
258 if (td->ulps_timeout > 0)
259 queue_delayed_work(td->workqueue, &td->ulps_work,
260 msecs_to_jiffies(td->ulps_timeout));
261}
262
263static void taal_cancel_ulps_work(struct omap_dss_device *dssdev)
264{
265 struct taal_data *td = dev_get_drvdata(dssdev->dev);
266
267 cancel_delayed_work(&td->ulps_work);
268}
269
270static int taal_enter_ulps(struct omap_dss_device *dssdev)
271{
272 struct taal_data *td = dev_get_drvdata(dssdev->dev);
273 int r;
274
275 if (td->ulps_enabled)
276 return 0;
277
278 taal_cancel_ulps_work(dssdev);
279
280 r = _taal_enable_te(dssdev, false);
281 if (r)
282 goto err;
283
284 if (gpio_is_valid(td->ext_te_gpio))
285 disable_irq(gpio_to_irq(td->ext_te_gpio));
286
287 omapdss_dsi_display_disable(dssdev, false, true);
288
289 td->ulps_enabled = true;
290
291 return 0;
292
293err:
294 dev_err(dssdev->dev, "enter ULPS failed");
295 taal_panel_reset(dssdev);
296
297 td->ulps_enabled = false;
298
299 taal_queue_ulps_work(dssdev);
300
301 return r;
302}
303
304static int taal_exit_ulps(struct omap_dss_device *dssdev)
305{
306 struct taal_data *td = dev_get_drvdata(dssdev->dev);
307 int r;
308
309 if (!td->ulps_enabled)
310 return 0;
311
312 r = omapdss_dsi_display_enable(dssdev);
313 if (r) {
314 dev_err(dssdev->dev, "failed to enable DSI\n");
315 goto err1;
316 }
317
318 omapdss_dsi_vc_enable_hs(dssdev, td->channel, true);
319
320 r = _taal_enable_te(dssdev, true);
321 if (r) {
322 dev_err(dssdev->dev, "failed to re-enable TE");
323 goto err2;
324 }
325
326 if (gpio_is_valid(td->ext_te_gpio))
327 enable_irq(gpio_to_irq(td->ext_te_gpio));
328
329 taal_queue_ulps_work(dssdev);
330
331 td->ulps_enabled = false;
332
333 return 0;
334
335err2:
336 dev_err(dssdev->dev, "failed to exit ULPS");
337
338 r = taal_panel_reset(dssdev);
339 if (!r) {
340 if (gpio_is_valid(td->ext_te_gpio))
341 enable_irq(gpio_to_irq(td->ext_te_gpio));
342 td->ulps_enabled = false;
343 }
344err1:
345 taal_queue_ulps_work(dssdev);
346
347 return r;
348}
349
350static int taal_wake_up(struct omap_dss_device *dssdev)
351{
352 struct taal_data *td = dev_get_drvdata(dssdev->dev);
353
354 if (td->ulps_enabled)
355 return taal_exit_ulps(dssdev);
356
357 taal_cancel_ulps_work(dssdev);
358 taal_queue_ulps_work(dssdev);
359 return 0;
360}
361
362static int taal_bl_update_status(struct backlight_device *dev)
363{
364 struct omap_dss_device *dssdev = dev_get_drvdata(&dev->dev);
365 struct taal_data *td = dev_get_drvdata(dssdev->dev);
366 int r;
367 int level;
368
369 if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
370 dev->props.power == FB_BLANK_UNBLANK)
371 level = dev->props.brightness;
372 else
373 level = 0;
374
375 dev_dbg(dssdev->dev, "update brightness to %d\n", level);
376
377 mutex_lock(&td->lock);
378
379 if (td->enabled) {
380 dsi_bus_lock(dssdev);
381
382 r = taal_wake_up(dssdev);
383 if (!r)
384 r = taal_dcs_write_1(td, DCS_BRIGHTNESS, level);
385
386 dsi_bus_unlock(dssdev);
387 } else {
388 r = 0;
389 }
390
391 mutex_unlock(&td->lock);
392
393 return r;
394}
395
396static int taal_bl_get_intensity(struct backlight_device *dev)
397{
398 if (dev->props.fb_blank == FB_BLANK_UNBLANK &&
399 dev->props.power == FB_BLANK_UNBLANK)
400 return dev->props.brightness;
401
402 return 0;
403}
404
405static const struct backlight_ops taal_bl_ops = {
406 .get_brightness = taal_bl_get_intensity,
407 .update_status = taal_bl_update_status,
408};
409
410static void taal_get_resolution(struct omap_dss_device *dssdev,
411 u16 *xres, u16 *yres)
412{
413 *xres = dssdev->panel.timings.x_res;
414 *yres = dssdev->panel.timings.y_res;
415}
416
417static ssize_t taal_num_errors_show(struct device *dev,
418 struct device_attribute *attr, char *buf)
419{
420 struct omap_dss_device *dssdev = to_dss_device(dev);
421 struct taal_data *td = dev_get_drvdata(dssdev->dev);
422 u8 errors = 0;
423 int r;
424
425 mutex_lock(&td->lock);
426
427 if (td->enabled) {
428 dsi_bus_lock(dssdev);
429
430 r = taal_wake_up(dssdev);
431 if (!r)
432 r = taal_dcs_read_1(td, DCS_READ_NUM_ERRORS, &errors);
433
434 dsi_bus_unlock(dssdev);
435 } else {
436 r = -ENODEV;
437 }
438
439 mutex_unlock(&td->lock);
440
441 if (r)
442 return r;
443
444 return snprintf(buf, PAGE_SIZE, "%d\n", errors);
445}
446
447static ssize_t taal_hw_revision_show(struct device *dev,
448 struct device_attribute *attr, char *buf)
449{
450 struct omap_dss_device *dssdev = to_dss_device(dev);
451 struct taal_data *td = dev_get_drvdata(dssdev->dev);
452 u8 id1, id2, id3;
453 int r;
454
455 mutex_lock(&td->lock);
456
457 if (td->enabled) {
458 dsi_bus_lock(dssdev);
459
460 r = taal_wake_up(dssdev);
461 if (!r)
462 r = taal_get_id(td, &id1, &id2, &id3);
463
464 dsi_bus_unlock(dssdev);
465 } else {
466 r = -ENODEV;
467 }
468
469 mutex_unlock(&td->lock);
470
471 if (r)
472 return r;
473
474 return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
475}
476
477static const char *cabc_modes[] = {
478 "off", /* used also always when CABC is not supported */
479 "ui",
480 "still-image",
481 "moving-image",
482};
483
484static ssize_t show_cabc_mode(struct device *dev,
485 struct device_attribute *attr,
486 char *buf)
487{
488 struct omap_dss_device *dssdev = to_dss_device(dev);
489 struct taal_data *td = dev_get_drvdata(dssdev->dev);
490 const char *mode_str;
491 int mode;
492 int len;
493
494 mode = td->cabc_mode;
495
496 mode_str = "unknown";
497 if (mode >= 0 && mode < ARRAY_SIZE(cabc_modes))
498 mode_str = cabc_modes[mode];
499 len = snprintf(buf, PAGE_SIZE, "%s\n", mode_str);
500
501 return len < PAGE_SIZE - 1 ? len : PAGE_SIZE - 1;
502}
503
504static ssize_t store_cabc_mode(struct device *dev,
505 struct device_attribute *attr,
506 const char *buf, size_t count)
507{
508 struct omap_dss_device *dssdev = to_dss_device(dev);
509 struct taal_data *td = dev_get_drvdata(dssdev->dev);
510 int i;
511 int r;
512
513 for (i = 0; i < ARRAY_SIZE(cabc_modes); i++) {
514 if (sysfs_streq(cabc_modes[i], buf))
515 break;
516 }
517
518 if (i == ARRAY_SIZE(cabc_modes))
519 return -EINVAL;
520
521 mutex_lock(&td->lock);
522
523 if (td->enabled) {
524 dsi_bus_lock(dssdev);
525
526 if (!td->cabc_broken) {
527 r = taal_wake_up(dssdev);
528 if (r)
529 goto err;
530
531 r = taal_dcs_write_1(td, DCS_WRITE_CABC, i);
532 if (r)
533 goto err;
534 }
535
536 dsi_bus_unlock(dssdev);
537 }
538
539 td->cabc_mode = i;
540
541 mutex_unlock(&td->lock);
542
543 return count;
544err:
545 dsi_bus_unlock(dssdev);
546 mutex_unlock(&td->lock);
547 return r;
548}
549
550static ssize_t show_cabc_available_modes(struct device *dev,
551 struct device_attribute *attr,
552 char *buf)
553{
554 int len;
555 int i;
556
557 for (i = 0, len = 0;
558 len < PAGE_SIZE && i < ARRAY_SIZE(cabc_modes); i++)
559 len += snprintf(&buf[len], PAGE_SIZE - len, "%s%s%s",
560 i ? " " : "", cabc_modes[i],
561 i == ARRAY_SIZE(cabc_modes) - 1 ? "\n" : "");
562
563 return len < PAGE_SIZE ? len : PAGE_SIZE - 1;
564}
565
566static ssize_t taal_store_esd_interval(struct device *dev,
567 struct device_attribute *attr,
568 const char *buf, size_t count)
569{
570 struct omap_dss_device *dssdev = to_dss_device(dev);
571 struct taal_data *td = dev_get_drvdata(dssdev->dev);
572
573 unsigned long t;
574 int r;
575
576 r = kstrtoul(buf, 10, &t);
577 if (r)
578 return r;
579
580 mutex_lock(&td->lock);
581 taal_cancel_esd_work(dssdev);
582 td->esd_interval = t;
583 if (td->enabled)
584 taal_queue_esd_work(dssdev);
585 mutex_unlock(&td->lock);
586
587 return count;
588}
589
590static ssize_t taal_show_esd_interval(struct device *dev,
591 struct device_attribute *attr,
592 char *buf)
593{
594 struct omap_dss_device *dssdev = to_dss_device(dev);
595 struct taal_data *td = dev_get_drvdata(dssdev->dev);
596 unsigned t;
597
598 mutex_lock(&td->lock);
599 t = td->esd_interval;
600 mutex_unlock(&td->lock);
601
602 return snprintf(buf, PAGE_SIZE, "%u\n", t);
603}
604
605static ssize_t taal_store_ulps(struct device *dev,
606 struct device_attribute *attr,
607 const char *buf, size_t count)
608{
609 struct omap_dss_device *dssdev = to_dss_device(dev);
610 struct taal_data *td = dev_get_drvdata(dssdev->dev);
611 unsigned long t;
612 int r;
613
614 r = kstrtoul(buf, 10, &t);
615 if (r)
616 return r;
617
618 mutex_lock(&td->lock);
619
620 if (td->enabled) {
621 dsi_bus_lock(dssdev);
622
623 if (t)
624 r = taal_enter_ulps(dssdev);
625 else
626 r = taal_wake_up(dssdev);
627
628 dsi_bus_unlock(dssdev);
629 }
630
631 mutex_unlock(&td->lock);
632
633 if (r)
634 return r;
635
636 return count;
637}
638
639static ssize_t taal_show_ulps(struct device *dev,
640 struct device_attribute *attr,
641 char *buf)
642{
643 struct omap_dss_device *dssdev = to_dss_device(dev);
644 struct taal_data *td = dev_get_drvdata(dssdev->dev);
645 unsigned t;
646
647 mutex_lock(&td->lock);
648 t = td->ulps_enabled;
649 mutex_unlock(&td->lock);
650
651 return snprintf(buf, PAGE_SIZE, "%u\n", t);
652}
653
654static ssize_t taal_store_ulps_timeout(struct device *dev,
655 struct device_attribute *attr,
656 const char *buf, size_t count)
657{
658 struct omap_dss_device *dssdev = to_dss_device(dev);
659 struct taal_data *td = dev_get_drvdata(dssdev->dev);
660 unsigned long t;
661 int r;
662
663 r = kstrtoul(buf, 10, &t);
664 if (r)
665 return r;
666
667 mutex_lock(&td->lock);
668 td->ulps_timeout = t;
669
670 if (td->enabled) {
671 /* taal_wake_up will restart the timer */
672 dsi_bus_lock(dssdev);
673 r = taal_wake_up(dssdev);
674 dsi_bus_unlock(dssdev);
675 }
676
677 mutex_unlock(&td->lock);
678
679 if (r)
680 return r;
681
682 return count;
683}
684
685static ssize_t taal_show_ulps_timeout(struct device *dev,
686 struct device_attribute *attr,
687 char *buf)
688{
689 struct omap_dss_device *dssdev = to_dss_device(dev);
690 struct taal_data *td = dev_get_drvdata(dssdev->dev);
691 unsigned t;
692
693 mutex_lock(&td->lock);
694 t = td->ulps_timeout;
695 mutex_unlock(&td->lock);
696
697 return snprintf(buf, PAGE_SIZE, "%u\n", t);
698}
699
700static DEVICE_ATTR(num_dsi_errors, S_IRUGO, taal_num_errors_show, NULL);
701static DEVICE_ATTR(hw_revision, S_IRUGO, taal_hw_revision_show, NULL);
702static DEVICE_ATTR(cabc_mode, S_IRUGO | S_IWUSR,
703 show_cabc_mode, store_cabc_mode);
704static DEVICE_ATTR(cabc_available_modes, S_IRUGO,
705 show_cabc_available_modes, NULL);
706static DEVICE_ATTR(esd_interval, S_IRUGO | S_IWUSR,
707 taal_show_esd_interval, taal_store_esd_interval);
708static DEVICE_ATTR(ulps, S_IRUGO | S_IWUSR,
709 taal_show_ulps, taal_store_ulps);
710static DEVICE_ATTR(ulps_timeout, S_IRUGO | S_IWUSR,
711 taal_show_ulps_timeout, taal_store_ulps_timeout);
712
713static struct attribute *taal_attrs[] = {
714 &dev_attr_num_dsi_errors.attr,
715 &dev_attr_hw_revision.attr,
716 &dev_attr_cabc_mode.attr,
717 &dev_attr_cabc_available_modes.attr,
718 &dev_attr_esd_interval.attr,
719 &dev_attr_ulps.attr,
720 &dev_attr_ulps_timeout.attr,
721 NULL,
722};
723
724static struct attribute_group taal_attr_group = {
725 .attrs = taal_attrs,
726};
727
728static void taal_hw_reset(struct omap_dss_device *dssdev)
729{
730 struct taal_data *td = dev_get_drvdata(dssdev->dev);
731
732 if (!gpio_is_valid(td->reset_gpio))
733 return;
734
735 gpio_set_value(td->reset_gpio, 1);
736 udelay(10);
737 /* reset the panel */
738 gpio_set_value(td->reset_gpio, 0);
739 /* assert reset */
740 udelay(10);
741 gpio_set_value(td->reset_gpio, 1);
742 /* wait after releasing reset */
743 msleep(5);
744}
745
746static void taal_probe_pdata(struct taal_data *td,
747 const struct nokia_dsi_panel_data *pdata)
748{
749 td->reset_gpio = pdata->reset_gpio;
750
751 if (pdata->use_ext_te)
752 td->ext_te_gpio = pdata->ext_te_gpio;
753 else
754 td->ext_te_gpio = -1;
755
756 td->esd_interval = pdata->esd_interval;
757 td->ulps_timeout = pdata->ulps_timeout;
758
759 td->use_dsi_backlight = pdata->use_dsi_backlight;
760
761 td->pin_config = pdata->pin_config;
762}
763
764static int taal_probe(struct omap_dss_device *dssdev)
765{
766 struct backlight_properties props;
767 struct taal_data *td;
768 struct backlight_device *bldev = NULL;
769 int r;
770
771 dev_dbg(dssdev->dev, "probe\n");
772
773 td = devm_kzalloc(dssdev->dev, sizeof(*td), GFP_KERNEL);
774 if (!td)
775 return -ENOMEM;
776
777 dev_set_drvdata(dssdev->dev, td);
778 td->dssdev = dssdev;
779
780 if (dssdev->data) {
781 const struct nokia_dsi_panel_data *pdata = dssdev->data;
782
783 taal_probe_pdata(td, pdata);
784 } else {
785 return -ENODEV;
786 }
787
788 dssdev->panel.timings.x_res = 864;
789 dssdev->panel.timings.y_res = 480;
790 dssdev->panel.timings.pixel_clock = DIV_ROUND_UP(864 * 480 * 60, 1000);
791 dssdev->panel.dsi_pix_fmt = OMAP_DSS_DSI_FMT_RGB888;
792 dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
793 OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
794
795 mutex_init(&td->lock);
796
797 atomic_set(&td->do_update, 0);
798
799 if (gpio_is_valid(td->reset_gpio)) {
800 r = devm_gpio_request_one(dssdev->dev, td->reset_gpio,
801 GPIOF_OUT_INIT_LOW, "taal rst");
802 if (r) {
803 dev_err(dssdev->dev, "failed to request reset gpio\n");
804 return r;
805 }
806 }
807
808 if (gpio_is_valid(td->ext_te_gpio)) {
809 r = devm_gpio_request_one(dssdev->dev, td->ext_te_gpio,
810 GPIOF_IN, "taal irq");
811 if (r) {
812 dev_err(dssdev->dev, "GPIO request failed\n");
813 return r;
814 }
815
816 r = devm_request_irq(dssdev->dev, gpio_to_irq(td->ext_te_gpio),
817 taal_te_isr,
818 IRQF_TRIGGER_RISING,
819 "taal vsync", dssdev);
820
821 if (r) {
822 dev_err(dssdev->dev, "IRQ request failed\n");
823 return r;
824 }
825
826 INIT_DEFERRABLE_WORK(&td->te_timeout_work,
827 taal_te_timeout_work_callback);
828
829 dev_dbg(dssdev->dev, "Using GPIO TE\n");
830 }
831
832 td->workqueue = create_singlethread_workqueue("taal_esd");
833 if (td->workqueue == NULL) {
834 dev_err(dssdev->dev, "can't create ESD workqueue\n");
835 return -ENOMEM;
836 }
837 INIT_DEFERRABLE_WORK(&td->esd_work, taal_esd_work);
838 INIT_DELAYED_WORK(&td->ulps_work, taal_ulps_work);
839
840 taal_hw_reset(dssdev);
841
842 if (td->use_dsi_backlight) {
843 memset(&props, 0, sizeof(struct backlight_properties));
844 props.max_brightness = 255;
845
846 props.type = BACKLIGHT_RAW;
847 bldev = backlight_device_register(dev_name(dssdev->dev),
848 dssdev->dev, dssdev, &taal_bl_ops, &props);
849 if (IS_ERR(bldev)) {
850 r = PTR_ERR(bldev);
851 goto err_bl;
852 }
853
854 td->bldev = bldev;
855
856 bldev->props.fb_blank = FB_BLANK_UNBLANK;
857 bldev->props.power = FB_BLANK_UNBLANK;
858 bldev->props.brightness = 255;
859
860 taal_bl_update_status(bldev);
861 }
862
863 r = omap_dsi_request_vc(dssdev, &td->channel);
864 if (r) {
865 dev_err(dssdev->dev, "failed to get virtual channel\n");
866 goto err_req_vc;
867 }
868
869 r = omap_dsi_set_vc_id(dssdev, td->channel, TCH);
870 if (r) {
871 dev_err(dssdev->dev, "failed to set VC_ID\n");
872 goto err_vc_id;
873 }
874
875 r = sysfs_create_group(&dssdev->dev->kobj, &taal_attr_group);
876 if (r) {
877 dev_err(dssdev->dev, "failed to create sysfs files\n");
878 goto err_vc_id;
879 }
880
881 return 0;
882
883err_vc_id:
884 omap_dsi_release_vc(dssdev, td->channel);
885err_req_vc:
886 if (bldev != NULL)
887 backlight_device_unregister(bldev);
888err_bl:
889 destroy_workqueue(td->workqueue);
890 return r;
891}
892
893static void __exit taal_remove(struct omap_dss_device *dssdev)
894{
895 struct taal_data *td = dev_get_drvdata(dssdev->dev);
896 struct backlight_device *bldev;
897
898 dev_dbg(dssdev->dev, "remove\n");
899
900 sysfs_remove_group(&dssdev->dev->kobj, &taal_attr_group);
901 omap_dsi_release_vc(dssdev, td->channel);
902
903 bldev = td->bldev;
904 if (bldev != NULL) {
905 bldev->props.power = FB_BLANK_POWERDOWN;
906 taal_bl_update_status(bldev);
907 backlight_device_unregister(bldev);
908 }
909
910 taal_cancel_ulps_work(dssdev);
911 taal_cancel_esd_work(dssdev);
912 destroy_workqueue(td->workqueue);
913
914 /* reset, to be sure that the panel is in a valid state */
915 taal_hw_reset(dssdev);
916}
917
918static int taal_power_on(struct omap_dss_device *dssdev)
919{
920 struct taal_data *td = dev_get_drvdata(dssdev->dev);
921 u8 id1, id2, id3;
922 int r;
923 struct omap_dss_dsi_config dsi_config = {
924 .mode = OMAP_DSS_DSI_CMD_MODE,
925 .pixel_format = OMAP_DSS_DSI_FMT_RGB888,
926 .timings = &dssdev->panel.timings,
927 .hs_clk_min = 150000000,
928 .hs_clk_max = 300000000,
929 .lp_clk_min = 7000000,
930 .lp_clk_max = 10000000,
931 };
932
933 r = omapdss_dsi_configure_pins(dssdev, &td->pin_config);
934 if (r) {
935 dev_err(dssdev->dev, "failed to configure DSI pins\n");
936 goto err0;
937 };
938
939 r = omapdss_dsi_set_config(dssdev, &dsi_config);
940 if (r) {
941 dev_err(dssdev->dev, "failed to configure DSI\n");
942 goto err0;
943 }
944
945 r = omapdss_dsi_display_enable(dssdev);
946 if (r) {
947 dev_err(dssdev->dev, "failed to enable DSI\n");
948 goto err0;
949 }
950
951 taal_hw_reset(dssdev);
952
953 omapdss_dsi_vc_enable_hs(dssdev, td->channel, false);
954
955 r = taal_sleep_out(td);
956 if (r)
957 goto err;
958
959 r = taal_get_id(td, &id1, &id2, &id3);
960 if (r)
961 goto err;
962
963 /* on early Taal revisions CABC is broken */
964 if (id2 == 0x00 || id2 == 0xff || id2 == 0x81)
965 td->cabc_broken = true;
966
967 r = taal_dcs_write_1(td, DCS_BRIGHTNESS, 0xff);
968 if (r)
969 goto err;
970
971 r = taal_dcs_write_1(td, DCS_CTRL_DISPLAY,
972 (1<<2) | (1<<5)); /* BL | BCTRL */
973 if (r)
974 goto err;
975
976 r = taal_dcs_write_1(td, MIPI_DCS_SET_PIXEL_FORMAT,
977 MIPI_DCS_PIXEL_FMT_24BIT);
978 if (r)
979 goto err;
980
981 if (!td->cabc_broken) {
982 r = taal_dcs_write_1(td, DCS_WRITE_CABC, td->cabc_mode);
983 if (r)
984 goto err;
985 }
986
987 r = taal_dcs_write_0(td, MIPI_DCS_SET_DISPLAY_ON);
988 if (r)
989 goto err;
990
991 r = _taal_enable_te(dssdev, td->te_enabled);
992 if (r)
993 goto err;
994
995 r = dsi_enable_video_output(dssdev, td->channel);
996 if (r)
997 goto err;
998
999 td->enabled = 1;
1000
1001 if (!td->intro_printed) {
1002 dev_info(dssdev->dev, "panel revision %02x.%02x.%02x\n",
1003 id1, id2, id3);
1004 if (td->cabc_broken)
1005 dev_info(dssdev->dev,
1006 "old Taal version, CABC disabled\n");
1007 td->intro_printed = true;
1008 }
1009
1010 omapdss_dsi_vc_enable_hs(dssdev, td->channel, true);
1011
1012 return 0;
1013err:
1014 dev_err(dssdev->dev, "error while enabling panel, issuing HW reset\n");
1015
1016 taal_hw_reset(dssdev);
1017
1018 omapdss_dsi_display_disable(dssdev, true, false);
1019err0:
1020 return r;
1021}
1022
1023static void taal_power_off(struct omap_dss_device *dssdev)
1024{
1025 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1026 int r;
1027
1028 dsi_disable_video_output(dssdev, td->channel);
1029
1030 r = taal_dcs_write_0(td, MIPI_DCS_SET_DISPLAY_OFF);
1031 if (!r)
1032 r = taal_sleep_in(td);
1033
1034 if (r) {
1035 dev_err(dssdev->dev,
1036 "error disabling panel, issuing HW reset\n");
1037 taal_hw_reset(dssdev);
1038 }
1039
1040 omapdss_dsi_display_disable(dssdev, true, false);
1041
1042 td->enabled = 0;
1043}
1044
1045static int taal_panel_reset(struct omap_dss_device *dssdev)
1046{
1047 dev_err(dssdev->dev, "performing LCD reset\n");
1048
1049 taal_power_off(dssdev);
1050 taal_hw_reset(dssdev);
1051 return taal_power_on(dssdev);
1052}
1053
1054static int taal_enable(struct omap_dss_device *dssdev)
1055{
1056 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1057 int r;
1058
1059 dev_dbg(dssdev->dev, "enable\n");
1060
1061 mutex_lock(&td->lock);
1062
1063 if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
1064 r = -EINVAL;
1065 goto err;
1066 }
1067
1068 dsi_bus_lock(dssdev);
1069
1070 r = taal_power_on(dssdev);
1071
1072 dsi_bus_unlock(dssdev);
1073
1074 if (r)
1075 goto err;
1076
1077 taal_queue_esd_work(dssdev);
1078
1079 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
1080
1081 mutex_unlock(&td->lock);
1082
1083 return 0;
1084err:
1085 dev_dbg(dssdev->dev, "enable failed\n");
1086 mutex_unlock(&td->lock);
1087 return r;
1088}
1089
1090static void taal_disable(struct omap_dss_device *dssdev)
1091{
1092 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1093
1094 dev_dbg(dssdev->dev, "disable\n");
1095
1096 mutex_lock(&td->lock);
1097
1098 taal_cancel_ulps_work(dssdev);
1099 taal_cancel_esd_work(dssdev);
1100
1101 dsi_bus_lock(dssdev);
1102
1103 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
1104 int r;
1105
1106 r = taal_wake_up(dssdev);
1107 if (!r)
1108 taal_power_off(dssdev);
1109 }
1110
1111 dsi_bus_unlock(dssdev);
1112
1113 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
1114
1115 mutex_unlock(&td->lock);
1116}
1117
1118static void taal_framedone_cb(int err, void *data)
1119{
1120 struct omap_dss_device *dssdev = data;
1121 dev_dbg(dssdev->dev, "framedone, err %d\n", err);
1122 dsi_bus_unlock(dssdev);
1123}
1124
1125static irqreturn_t taal_te_isr(int irq, void *data)
1126{
1127 struct omap_dss_device *dssdev = data;
1128 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1129 int old;
1130 int r;
1131
1132 old = atomic_cmpxchg(&td->do_update, 1, 0);
1133
1134 if (old) {
1135 cancel_delayed_work(&td->te_timeout_work);
1136
1137 r = omap_dsi_update(dssdev, td->channel, taal_framedone_cb,
1138 dssdev);
1139 if (r)
1140 goto err;
1141 }
1142
1143 return IRQ_HANDLED;
1144err:
1145 dev_err(dssdev->dev, "start update failed\n");
1146 dsi_bus_unlock(dssdev);
1147 return IRQ_HANDLED;
1148}
1149
1150static void taal_te_timeout_work_callback(struct work_struct *work)
1151{
1152 struct taal_data *td = container_of(work, struct taal_data,
1153 te_timeout_work.work);
1154 struct omap_dss_device *dssdev = td->dssdev;
1155
1156 dev_err(dssdev->dev, "TE not received for 250ms!\n");
1157
1158 atomic_set(&td->do_update, 0);
1159 dsi_bus_unlock(dssdev);
1160}
1161
1162static int taal_update(struct omap_dss_device *dssdev,
1163 u16 x, u16 y, u16 w, u16 h)
1164{
1165 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1166 int r;
1167
1168 dev_dbg(dssdev->dev, "update %d, %d, %d x %d\n", x, y, w, h);
1169
1170 mutex_lock(&td->lock);
1171 dsi_bus_lock(dssdev);
1172
1173 r = taal_wake_up(dssdev);
1174 if (r)
1175 goto err;
1176
1177 if (!td->enabled) {
1178 r = 0;
1179 goto err;
1180 }
1181
1182 /* XXX no need to send this every frame, but dsi break if not done */
1183 r = taal_set_update_window(td, 0, 0,
1184 dssdev->panel.timings.x_res,
1185 dssdev->panel.timings.y_res);
1186 if (r)
1187 goto err;
1188
1189 if (td->te_enabled && gpio_is_valid(td->ext_te_gpio)) {
1190 schedule_delayed_work(&td->te_timeout_work,
1191 msecs_to_jiffies(250));
1192 atomic_set(&td->do_update, 1);
1193 } else {
1194 r = omap_dsi_update(dssdev, td->channel, taal_framedone_cb,
1195 dssdev);
1196 if (r)
1197 goto err;
1198 }
1199
1200 /* note: no bus_unlock here. unlock is in framedone_cb */
1201 mutex_unlock(&td->lock);
1202 return 0;
1203err:
1204 dsi_bus_unlock(dssdev);
1205 mutex_unlock(&td->lock);
1206 return r;
1207}
1208
1209static int taal_sync(struct omap_dss_device *dssdev)
1210{
1211 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1212
1213 dev_dbg(dssdev->dev, "sync\n");
1214
1215 mutex_lock(&td->lock);
1216 dsi_bus_lock(dssdev);
1217 dsi_bus_unlock(dssdev);
1218 mutex_unlock(&td->lock);
1219
1220 dev_dbg(dssdev->dev, "sync done\n");
1221
1222 return 0;
1223}
1224
1225static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable)
1226{
1227 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1228 int r;
1229
1230 if (enable)
1231 r = taal_dcs_write_1(td, MIPI_DCS_SET_TEAR_ON, 0);
1232 else
1233 r = taal_dcs_write_0(td, MIPI_DCS_SET_TEAR_OFF);
1234
1235 if (!gpio_is_valid(td->ext_te_gpio))
1236 omapdss_dsi_enable_te(dssdev, enable);
1237
1238 /* possible panel bug */
1239 msleep(100);
1240
1241 return r;
1242}
1243
1244static int taal_enable_te(struct omap_dss_device *dssdev, bool enable)
1245{
1246 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1247 int r;
1248
1249 mutex_lock(&td->lock);
1250
1251 if (td->te_enabled == enable)
1252 goto end;
1253
1254 dsi_bus_lock(dssdev);
1255
1256 if (td->enabled) {
1257 r = taal_wake_up(dssdev);
1258 if (r)
1259 goto err;
1260
1261 r = _taal_enable_te(dssdev, enable);
1262 if (r)
1263 goto err;
1264 }
1265
1266 td->te_enabled = enable;
1267
1268 dsi_bus_unlock(dssdev);
1269end:
1270 mutex_unlock(&td->lock);
1271
1272 return 0;
1273err:
1274 dsi_bus_unlock(dssdev);
1275 mutex_unlock(&td->lock);
1276
1277 return r;
1278}
1279
1280static int taal_get_te(struct omap_dss_device *dssdev)
1281{
1282 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1283 int r;
1284
1285 mutex_lock(&td->lock);
1286 r = td->te_enabled;
1287 mutex_unlock(&td->lock);
1288
1289 return r;
1290}
1291
1292static int taal_run_test(struct omap_dss_device *dssdev, int test_num)
1293{
1294 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1295 u8 id1, id2, id3;
1296 int r;
1297
1298 mutex_lock(&td->lock);
1299
1300 if (!td->enabled) {
1301 r = -ENODEV;
1302 goto err1;
1303 }
1304
1305 dsi_bus_lock(dssdev);
1306
1307 r = taal_wake_up(dssdev);
1308 if (r)
1309 goto err2;
1310
1311 r = taal_dcs_read_1(td, DCS_GET_ID1, &id1);
1312 if (r)
1313 goto err2;
1314 r = taal_dcs_read_1(td, DCS_GET_ID2, &id2);
1315 if (r)
1316 goto err2;
1317 r = taal_dcs_read_1(td, DCS_GET_ID3, &id3);
1318 if (r)
1319 goto err2;
1320
1321 dsi_bus_unlock(dssdev);
1322 mutex_unlock(&td->lock);
1323 return 0;
1324err2:
1325 dsi_bus_unlock(dssdev);
1326err1:
1327 mutex_unlock(&td->lock);
1328 return r;
1329}
1330
1331static int taal_memory_read(struct omap_dss_device *dssdev,
1332 void *buf, size_t size,
1333 u16 x, u16 y, u16 w, u16 h)
1334{
1335 int r;
1336 int first = 1;
1337 int plen;
1338 unsigned buf_used = 0;
1339 struct taal_data *td = dev_get_drvdata(dssdev->dev);
1340
1341 if (size < w * h * 3)
1342 return -ENOMEM;
1343
1344 mutex_lock(&td->lock);
1345
1346 if (!td->enabled) {
1347 r = -ENODEV;
1348 goto err1;
1349 }
1350
1351 size = min(w * h * 3,
1352 dssdev->panel.timings.x_res *
1353 dssdev->panel.timings.y_res * 3);
1354
1355 dsi_bus_lock(dssdev);
1356
1357 r = taal_wake_up(dssdev);
1358 if (r)
1359 goto err2;
1360
1361 /* plen 1 or 2 goes into short packet. until checksum error is fixed,
1362 * use short packets. plen 32 works, but bigger packets seem to cause
1363 * an error. */
1364 if (size % 2)
1365 plen = 1;
1366 else
1367 plen = 2;
1368
1369 taal_set_update_window(td, x, y, w, h);
1370
1371 r = dsi_vc_set_max_rx_packet_size(dssdev, td->channel, plen);
1372 if (r)
1373 goto err2;
1374
1375 while (buf_used < size) {
1376 u8 dcs_cmd = first ? 0x2e : 0x3e;
1377 first = 0;
1378
1379 r = dsi_vc_dcs_read(dssdev, td->channel, dcs_cmd,
1380 buf + buf_used, size - buf_used);
1381
1382 if (r < 0) {
1383 dev_err(dssdev->dev, "read error\n");
1384 goto err3;
1385 }
1386
1387 buf_used += r;
1388
1389 if (r < plen) {
1390 dev_err(dssdev->dev, "short read\n");
1391 break;
1392 }
1393
1394 if (signal_pending(current)) {
1395 dev_err(dssdev->dev, "signal pending, "
1396 "aborting memory read\n");
1397 r = -ERESTARTSYS;
1398 goto err3;
1399 }
1400 }
1401
1402 r = buf_used;
1403
1404err3:
1405 dsi_vc_set_max_rx_packet_size(dssdev, td->channel, 1);
1406err2:
1407 dsi_bus_unlock(dssdev);
1408err1:
1409 mutex_unlock(&td->lock);
1410 return r;
1411}
1412
1413static void taal_ulps_work(struct work_struct *work)
1414{
1415 struct taal_data *td = container_of(work, struct taal_data,
1416 ulps_work.work);
1417 struct omap_dss_device *dssdev = td->dssdev;
1418
1419 mutex_lock(&td->lock);
1420
1421 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE || !td->enabled) {
1422 mutex_unlock(&td->lock);
1423 return;
1424 }
1425
1426 dsi_bus_lock(dssdev);
1427
1428 taal_enter_ulps(dssdev);
1429
1430 dsi_bus_unlock(dssdev);
1431 mutex_unlock(&td->lock);
1432}
1433
1434static void taal_esd_work(struct work_struct *work)
1435{
1436 struct taal_data *td = container_of(work, struct taal_data,
1437 esd_work.work);
1438 struct omap_dss_device *dssdev = td->dssdev;
1439 u8 state1, state2;
1440 int r;
1441
1442 mutex_lock(&td->lock);
1443
1444 if (!td->enabled) {
1445 mutex_unlock(&td->lock);
1446 return;
1447 }
1448
1449 dsi_bus_lock(dssdev);
1450
1451 r = taal_wake_up(dssdev);
1452 if (r) {
1453 dev_err(dssdev->dev, "failed to exit ULPS\n");
1454 goto err;
1455 }
1456
1457 r = taal_dcs_read_1(td, MIPI_DCS_GET_DIAGNOSTIC_RESULT, &state1);
1458 if (r) {
1459 dev_err(dssdev->dev, "failed to read Taal status\n");
1460 goto err;
1461 }
1462
1463 /* Run self diagnostics */
1464 r = taal_sleep_out(td);
1465 if (r) {
1466 dev_err(dssdev->dev, "failed to run Taal self-diagnostics\n");
1467 goto err;
1468 }
1469
1470 r = taal_dcs_read_1(td, MIPI_DCS_GET_DIAGNOSTIC_RESULT, &state2);
1471 if (r) {
1472 dev_err(dssdev->dev, "failed to read Taal status\n");
1473 goto err;
1474 }
1475
1476 /* Each sleep out command will trigger a self diagnostic and flip
1477 * Bit6 if the test passes.
1478 */
1479 if (!((state1 ^ state2) & (1 << 6))) {
1480 dev_err(dssdev->dev, "LCD self diagnostics failed\n");
1481 goto err;
1482 }
1483 /* Self-diagnostics result is also shown on TE GPIO line. We need
1484 * to re-enable TE after self diagnostics */
1485 if (td->te_enabled && gpio_is_valid(td->ext_te_gpio)) {
1486 r = taal_dcs_write_1(td, MIPI_DCS_SET_TEAR_ON, 0);
1487 if (r)
1488 goto err;
1489 }
1490
1491 dsi_bus_unlock(dssdev);
1492
1493 taal_queue_esd_work(dssdev);
1494
1495 mutex_unlock(&td->lock);
1496 return;
1497err:
1498 dev_err(dssdev->dev, "performing LCD reset\n");
1499
1500 taal_panel_reset(dssdev);
1501
1502 dsi_bus_unlock(dssdev);
1503
1504 taal_queue_esd_work(dssdev);
1505
1506 mutex_unlock(&td->lock);
1507}
1508
1509static struct omap_dss_driver taal_driver = {
1510 .probe = taal_probe,
1511 .remove = __exit_p(taal_remove),
1512
1513 .enable = taal_enable,
1514 .disable = taal_disable,
1515
1516 .update = taal_update,
1517 .sync = taal_sync,
1518
1519 .get_resolution = taal_get_resolution,
1520 .get_recommended_bpp = omapdss_default_get_recommended_bpp,
1521
1522 .enable_te = taal_enable_te,
1523 .get_te = taal_get_te,
1524
1525 .run_test = taal_run_test,
1526 .memory_read = taal_memory_read,
1527
1528 .driver = {
1529 .name = "taal",
1530 .owner = THIS_MODULE,
1531 },
1532};
1533
1534static int __init taal_init(void)
1535{
1536 omap_dss_register_driver(&taal_driver);
1537
1538 return 0;
1539}
1540
1541static void __exit taal_exit(void)
1542{
1543 omap_dss_unregister_driver(&taal_driver);
1544}
1545
1546module_init(taal_init);
1547module_exit(taal_exit);
1548
1549MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>");
1550MODULE_DESCRIPTION("Taal Driver");
1551MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/displays/panel-tfp410.c b/drivers/video/omap2/displays/panel-tfp410.c
deleted file mode 100644
index 1fdfb158a2a9..000000000000
--- a/drivers/video/omap2/displays/panel-tfp410.c
+++ /dev/null
@@ -1,353 +0,0 @@
1/*
2 * TFP410 DPI-to-DVI chip
3 *
4 * Copyright (C) 2011 Texas Instruments Inc
5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/module.h>
21#include <linux/slab.h>
22#include <video/omapdss.h>
23#include <linux/i2c.h>
24#include <linux/gpio.h>
25#include <drm/drm_edid.h>
26
27#include <video/omap-panel-data.h>
28
29static const struct omap_video_timings tfp410_default_timings = {
30 .x_res = 640,
31 .y_res = 480,
32
33 .pixel_clock = 23500,
34
35 .hfp = 48,
36 .hsw = 32,
37 .hbp = 80,
38
39 .vfp = 3,
40 .vsw = 4,
41 .vbp = 7,
42
43 .vsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
44 .hsync_level = OMAPDSS_SIG_ACTIVE_HIGH,
45 .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
46 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
47 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
48};
49
50struct panel_drv_data {
51 struct omap_dss_device *dssdev;
52
53 struct mutex lock;
54
55 int pd_gpio;
56
57 struct i2c_adapter *i2c_adapter;
58};
59
60static int tfp410_power_on(struct omap_dss_device *dssdev)
61{
62 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
63 int r;
64
65 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
66 return 0;
67
68 omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
69 omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
70
71 r = omapdss_dpi_display_enable(dssdev);
72 if (r)
73 goto err0;
74
75 if (gpio_is_valid(ddata->pd_gpio))
76 gpio_set_value_cansleep(ddata->pd_gpio, 1);
77
78 return 0;
79err0:
80 return r;
81}
82
83static void tfp410_power_off(struct omap_dss_device *dssdev)
84{
85 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
86
87 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
88 return;
89
90 if (gpio_is_valid(ddata->pd_gpio))
91 gpio_set_value_cansleep(ddata->pd_gpio, 0);
92
93 omapdss_dpi_display_disable(dssdev);
94}
95
96static int tfp410_probe(struct omap_dss_device *dssdev)
97{
98 struct panel_drv_data *ddata;
99 int r;
100 int i2c_bus_num;
101
102 ddata = devm_kzalloc(dssdev->dev, sizeof(*ddata), GFP_KERNEL);
103 if (!ddata)
104 return -ENOMEM;
105
106 dssdev->panel.timings = tfp410_default_timings;
107
108 ddata->dssdev = dssdev;
109 mutex_init(&ddata->lock);
110
111 if (dssdev->data) {
112 struct tfp410_platform_data *pdata = dssdev->data;
113
114 ddata->pd_gpio = pdata->power_down_gpio;
115 i2c_bus_num = pdata->i2c_bus_num;
116 } else {
117 ddata->pd_gpio = -1;
118 i2c_bus_num = -1;
119 }
120
121 if (gpio_is_valid(ddata->pd_gpio)) {
122 r = devm_gpio_request_one(dssdev->dev, ddata->pd_gpio,
123 GPIOF_OUT_INIT_LOW, "tfp410 pd");
124 if (r) {
125 dev_err(dssdev->dev, "Failed to request PD GPIO %d\n",
126 ddata->pd_gpio);
127 return r;
128 }
129 }
130
131 if (i2c_bus_num != -1) {
132 struct i2c_adapter *adapter;
133
134 adapter = i2c_get_adapter(i2c_bus_num);
135 if (!adapter) {
136 dev_err(dssdev->dev, "Failed to get I2C adapter, bus %d\n",
137 i2c_bus_num);
138 return -EPROBE_DEFER;
139 }
140
141 ddata->i2c_adapter = adapter;
142 }
143
144 dev_set_drvdata(dssdev->dev, ddata);
145
146 return 0;
147}
148
149static void __exit tfp410_remove(struct omap_dss_device *dssdev)
150{
151 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
152
153 mutex_lock(&ddata->lock);
154
155 if (ddata->i2c_adapter)
156 i2c_put_adapter(ddata->i2c_adapter);
157
158 dev_set_drvdata(dssdev->dev, NULL);
159
160 mutex_unlock(&ddata->lock);
161}
162
163static int tfp410_enable(struct omap_dss_device *dssdev)
164{
165 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
166 int r;
167
168 mutex_lock(&ddata->lock);
169
170 r = tfp410_power_on(dssdev);
171 if (r == 0)
172 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
173
174 mutex_unlock(&ddata->lock);
175
176 return r;
177}
178
179static void tfp410_disable(struct omap_dss_device *dssdev)
180{
181 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
182
183 mutex_lock(&ddata->lock);
184
185 tfp410_power_off(dssdev);
186
187 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
188
189 mutex_unlock(&ddata->lock);
190}
191
192static void tfp410_set_timings(struct omap_dss_device *dssdev,
193 struct omap_video_timings *timings)
194{
195 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
196
197 mutex_lock(&ddata->lock);
198 omapdss_dpi_set_timings(dssdev, timings);
199 dssdev->panel.timings = *timings;
200 mutex_unlock(&ddata->lock);
201}
202
203static void tfp410_get_timings(struct omap_dss_device *dssdev,
204 struct omap_video_timings *timings)
205{
206 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
207
208 mutex_lock(&ddata->lock);
209 *timings = dssdev->panel.timings;
210 mutex_unlock(&ddata->lock);
211}
212
213static int tfp410_check_timings(struct omap_dss_device *dssdev,
214 struct omap_video_timings *timings)
215{
216 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
217 int r;
218
219 mutex_lock(&ddata->lock);
220 r = dpi_check_timings(dssdev, timings);
221 mutex_unlock(&ddata->lock);
222
223 return r;
224}
225
226
227static int tfp410_ddc_read(struct i2c_adapter *adapter,
228 unsigned char *buf, u16 count, u8 offset)
229{
230 int r, retries;
231
232 for (retries = 3; retries > 0; retries--) {
233 struct i2c_msg msgs[] = {
234 {
235 .addr = DDC_ADDR,
236 .flags = 0,
237 .len = 1,
238 .buf = &offset,
239 }, {
240 .addr = DDC_ADDR,
241 .flags = I2C_M_RD,
242 .len = count,
243 .buf = buf,
244 }
245 };
246
247 r = i2c_transfer(adapter, msgs, 2);
248 if (r == 2)
249 return 0;
250
251 if (r != -EAGAIN)
252 break;
253 }
254
255 return r < 0 ? r : -EIO;
256}
257
258static int tfp410_read_edid(struct omap_dss_device *dssdev,
259 u8 *edid, int len)
260{
261 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
262 int r, l, bytes_read;
263
264 mutex_lock(&ddata->lock);
265
266 if (!ddata->i2c_adapter) {
267 r = -ENODEV;
268 goto err;
269 }
270
271 l = min(EDID_LENGTH, len);
272 r = tfp410_ddc_read(ddata->i2c_adapter, edid, l, 0);
273 if (r)
274 goto err;
275
276 bytes_read = l;
277
278 /* if there are extensions, read second block */
279 if (len > EDID_LENGTH && edid[0x7e] > 0) {
280 l = min(EDID_LENGTH, len - EDID_LENGTH);
281
282 r = tfp410_ddc_read(ddata->i2c_adapter, edid + EDID_LENGTH,
283 l, EDID_LENGTH);
284 if (r)
285 goto err;
286
287 bytes_read += l;
288 }
289
290 mutex_unlock(&ddata->lock);
291
292 return bytes_read;
293
294err:
295 mutex_unlock(&ddata->lock);
296 return r;
297}
298
299static bool tfp410_detect(struct omap_dss_device *dssdev)
300{
301 struct panel_drv_data *ddata = dev_get_drvdata(dssdev->dev);
302 unsigned char out;
303 int r;
304
305 mutex_lock(&ddata->lock);
306
307 if (!ddata->i2c_adapter)
308 goto out;
309
310 r = tfp410_ddc_read(ddata->i2c_adapter, &out, 1, 0);
311
312 mutex_unlock(&ddata->lock);
313
314 return r == 0;
315
316out:
317 mutex_unlock(&ddata->lock);
318 return true;
319}
320
321static struct omap_dss_driver tfp410_driver = {
322 .probe = tfp410_probe,
323 .remove = __exit_p(tfp410_remove),
324
325 .enable = tfp410_enable,
326 .disable = tfp410_disable,
327
328 .set_timings = tfp410_set_timings,
329 .get_timings = tfp410_get_timings,
330 .check_timings = tfp410_check_timings,
331
332 .read_edid = tfp410_read_edid,
333 .detect = tfp410_detect,
334
335 .driver = {
336 .name = "tfp410",
337 .owner = THIS_MODULE,
338 },
339};
340
341static int __init tfp410_init(void)
342{
343 return omap_dss_register_driver(&tfp410_driver);
344}
345
346static void __exit tfp410_exit(void)
347{
348 omap_dss_unregister_driver(&tfp410_driver);
349}
350
351module_init(tfp410_init);
352module_exit(tfp410_exit);
353MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
deleted file mode 100644
index 7729b6fa6f97..000000000000
--- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
+++ /dev/null
@@ -1,596 +0,0 @@
1/*
2 * LCD panel driver for TPO TD043MTEA1
3 *
4 * Author: Gražvydas Ignotas <notasas@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/module.h>
13#include <linux/delay.h>
14#include <linux/spi/spi.h>
15#include <linux/regulator/consumer.h>
16#include <linux/gpio.h>
17#include <linux/err.h>
18#include <linux/slab.h>
19
20#include <video/omapdss.h>
21#include <video/omap-panel-data.h>
22
23#define TPO_R02_MODE(x) ((x) & 7)
24#define TPO_R02_MODE_800x480 7
25#define TPO_R02_NCLK_RISING BIT(3)
26#define TPO_R02_HSYNC_HIGH BIT(4)
27#define TPO_R02_VSYNC_HIGH BIT(5)
28
29#define TPO_R03_NSTANDBY BIT(0)
30#define TPO_R03_EN_CP_CLK BIT(1)
31#define TPO_R03_EN_VGL_PUMP BIT(2)
32#define TPO_R03_EN_PWM BIT(3)
33#define TPO_R03_DRIVING_CAP_100 BIT(4)
34#define TPO_R03_EN_PRE_CHARGE BIT(6)
35#define TPO_R03_SOFTWARE_CTL BIT(7)
36
37#define TPO_R04_NFLIP_H BIT(0)
38#define TPO_R04_NFLIP_V BIT(1)
39#define TPO_R04_CP_CLK_FREQ_1H BIT(2)
40#define TPO_R04_VGL_FREQ_1H BIT(4)
41
42#define TPO_R03_VAL_NORMAL (TPO_R03_NSTANDBY | TPO_R03_EN_CP_CLK | \
43 TPO_R03_EN_VGL_PUMP | TPO_R03_EN_PWM | \
44 TPO_R03_DRIVING_CAP_100 | TPO_R03_EN_PRE_CHARGE | \
45 TPO_R03_SOFTWARE_CTL)
46
47#define TPO_R03_VAL_STANDBY (TPO_R03_DRIVING_CAP_100 | \
48 TPO_R03_EN_PRE_CHARGE | TPO_R03_SOFTWARE_CTL)
49
50static const u16 tpo_td043_def_gamma[12] = {
51 105, 315, 381, 431, 490, 537, 579, 686, 780, 837, 880, 1023
52};
53
54struct tpo_td043_device {
55 struct spi_device *spi;
56 struct regulator *vcc_reg;
57 int nreset_gpio;
58 u16 gamma[12];
59 u32 mode;
60 u32 hmirror:1;
61 u32 vmirror:1;
62 u32 powered_on:1;
63 u32 spi_suspended:1;
64 u32 power_on_resume:1;
65};
66
67/* used to pass spi_device from SPI to DSS portion of the driver */
68static struct tpo_td043_device *g_tpo_td043;
69
70static int tpo_td043_write(struct spi_device *spi, u8 addr, u8 data)
71{
72 struct spi_message m;
73 struct spi_transfer xfer;
74 u16 w;
75 int r;
76
77 spi_message_init(&m);
78
79 memset(&xfer, 0, sizeof(xfer));
80
81 w = ((u16)addr << 10) | (1 << 8) | data;
82 xfer.tx_buf = &w;
83 xfer.bits_per_word = 16;
84 xfer.len = 2;
85 spi_message_add_tail(&xfer, &m);
86
87 r = spi_sync(spi, &m);
88 if (r < 0)
89 dev_warn(&spi->dev, "failed to write to LCD reg (%d)\n", r);
90 return r;
91}
92
93static void tpo_td043_write_gamma(struct spi_device *spi, u16 gamma[12])
94{
95 u8 i, val;
96
97 /* gamma bits [9:8] */
98 for (val = i = 0; i < 4; i++)
99 val |= (gamma[i] & 0x300) >> ((i + 1) * 2);
100 tpo_td043_write(spi, 0x11, val);
101
102 for (val = i = 0; i < 4; i++)
103 val |= (gamma[i+4] & 0x300) >> ((i + 1) * 2);
104 tpo_td043_write(spi, 0x12, val);
105
106 for (val = i = 0; i < 4; i++)
107 val |= (gamma[i+8] & 0x300) >> ((i + 1) * 2);
108 tpo_td043_write(spi, 0x13, val);
109
110 /* gamma bits [7:0] */
111 for (val = i = 0; i < 12; i++)
112 tpo_td043_write(spi, 0x14 + i, gamma[i] & 0xff);
113}
114
115static int tpo_td043_write_mirror(struct spi_device *spi, bool h, bool v)
116{
117 u8 reg4 = TPO_R04_NFLIP_H | TPO_R04_NFLIP_V | \
118 TPO_R04_CP_CLK_FREQ_1H | TPO_R04_VGL_FREQ_1H;
119 if (h)
120 reg4 &= ~TPO_R04_NFLIP_H;
121 if (v)
122 reg4 &= ~TPO_R04_NFLIP_V;
123
124 return tpo_td043_write(spi, 4, reg4);
125}
126
127static int tpo_td043_set_hmirror(struct omap_dss_device *dssdev, bool enable)
128{
129 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dssdev->dev);
130
131 tpo_td043->hmirror = enable;
132 return tpo_td043_write_mirror(tpo_td043->spi, tpo_td043->hmirror,
133 tpo_td043->vmirror);
134}
135
136static bool tpo_td043_get_hmirror(struct omap_dss_device *dssdev)
137{
138 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dssdev->dev);
139
140 return tpo_td043->hmirror;
141}
142
143static ssize_t tpo_td043_vmirror_show(struct device *dev,
144 struct device_attribute *attr, char *buf)
145{
146 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
147
148 return snprintf(buf, PAGE_SIZE, "%d\n", tpo_td043->vmirror);
149}
150
151static ssize_t tpo_td043_vmirror_store(struct device *dev,
152 struct device_attribute *attr, const char *buf, size_t count)
153{
154 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
155 int val;
156 int ret;
157
158 ret = kstrtoint(buf, 0, &val);
159 if (ret < 0)
160 return ret;
161
162 val = !!val;
163
164 ret = tpo_td043_write_mirror(tpo_td043->spi, tpo_td043->hmirror, val);
165 if (ret < 0)
166 return ret;
167
168 tpo_td043->vmirror = val;
169
170 return count;
171}
172
173static ssize_t tpo_td043_mode_show(struct device *dev,
174 struct device_attribute *attr, char *buf)
175{
176 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
177
178 return snprintf(buf, PAGE_SIZE, "%d\n", tpo_td043->mode);
179}
180
181static ssize_t tpo_td043_mode_store(struct device *dev,
182 struct device_attribute *attr, const char *buf, size_t count)
183{
184 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
185 long val;
186 int ret;
187
188 ret = kstrtol(buf, 0, &val);
189 if (ret != 0 || val & ~7)
190 return -EINVAL;
191
192 tpo_td043->mode = val;
193
194 val |= TPO_R02_NCLK_RISING;
195 tpo_td043_write(tpo_td043->spi, 2, val);
196
197 return count;
198}
199
200static ssize_t tpo_td043_gamma_show(struct device *dev,
201 struct device_attribute *attr, char *buf)
202{
203 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
204 ssize_t len = 0;
205 int ret;
206 int i;
207
208 for (i = 0; i < ARRAY_SIZE(tpo_td043->gamma); i++) {
209 ret = snprintf(buf + len, PAGE_SIZE - len, "%u ",
210 tpo_td043->gamma[i]);
211 if (ret < 0)
212 return ret;
213 len += ret;
214 }
215 buf[len - 1] = '\n';
216
217 return len;
218}
219
220static ssize_t tpo_td043_gamma_store(struct device *dev,
221 struct device_attribute *attr, const char *buf, size_t count)
222{
223 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
224 unsigned int g[12];
225 int ret;
226 int i;
227
228 ret = sscanf(buf, "%u %u %u %u %u %u %u %u %u %u %u %u",
229 &g[0], &g[1], &g[2], &g[3], &g[4], &g[5],
230 &g[6], &g[7], &g[8], &g[9], &g[10], &g[11]);
231
232 if (ret != 12)
233 return -EINVAL;
234
235 for (i = 0; i < 12; i++)
236 tpo_td043->gamma[i] = g[i];
237
238 tpo_td043_write_gamma(tpo_td043->spi, tpo_td043->gamma);
239
240 return count;
241}
242
243static DEVICE_ATTR(vmirror, S_IRUGO | S_IWUSR,
244 tpo_td043_vmirror_show, tpo_td043_vmirror_store);
245static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR,
246 tpo_td043_mode_show, tpo_td043_mode_store);
247static DEVICE_ATTR(gamma, S_IRUGO | S_IWUSR,
248 tpo_td043_gamma_show, tpo_td043_gamma_store);
249
250static struct attribute *tpo_td043_attrs[] = {
251 &dev_attr_vmirror.attr,
252 &dev_attr_mode.attr,
253 &dev_attr_gamma.attr,
254 NULL,
255};
256
257static struct attribute_group tpo_td043_attr_group = {
258 .attrs = tpo_td043_attrs,
259};
260
261static const struct omap_video_timings tpo_td043_timings = {
262 .x_res = 800,
263 .y_res = 480,
264
265 .pixel_clock = 36000,
266
267 .hsw = 1,
268 .hfp = 68,
269 .hbp = 214,
270
271 .vsw = 1,
272 .vfp = 39,
273 .vbp = 34,
274
275 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
276 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
277 .data_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE,
278 .de_level = OMAPDSS_SIG_ACTIVE_HIGH,
279 .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
280};
281
282static inline struct panel_tpo_td043_data
283*get_panel_data(const struct omap_dss_device *dssdev)
284{
285 return (struct panel_tpo_td043_data *) dssdev->data;
286}
287
288static int tpo_td043_power_on(struct tpo_td043_device *tpo_td043)
289{
290 int r;
291
292 if (tpo_td043->powered_on)
293 return 0;
294
295 r = regulator_enable(tpo_td043->vcc_reg);
296 if (r != 0)
297 return r;
298
299 /* wait for panel to stabilize */
300 msleep(160);
301
302 if (gpio_is_valid(tpo_td043->nreset_gpio))
303 gpio_set_value(tpo_td043->nreset_gpio, 1);
304
305 tpo_td043_write(tpo_td043->spi, 2,
306 TPO_R02_MODE(tpo_td043->mode) | TPO_R02_NCLK_RISING);
307 tpo_td043_write(tpo_td043->spi, 3, TPO_R03_VAL_NORMAL);
308 tpo_td043_write(tpo_td043->spi, 0x20, 0xf0);
309 tpo_td043_write(tpo_td043->spi, 0x21, 0xf0);
310 tpo_td043_write_mirror(tpo_td043->spi, tpo_td043->hmirror,
311 tpo_td043->vmirror);
312 tpo_td043_write_gamma(tpo_td043->spi, tpo_td043->gamma);
313
314 tpo_td043->powered_on = 1;
315 return 0;
316}
317
318static void tpo_td043_power_off(struct tpo_td043_device *tpo_td043)
319{
320 if (!tpo_td043->powered_on)
321 return;
322
323 tpo_td043_write(tpo_td043->spi, 3,
324 TPO_R03_VAL_STANDBY | TPO_R03_EN_PWM);
325
326 if (gpio_is_valid(tpo_td043->nreset_gpio))
327 gpio_set_value(tpo_td043->nreset_gpio, 0);
328
329 /* wait for at least 2 vsyncs before cutting off power */
330 msleep(50);
331
332 tpo_td043_write(tpo_td043->spi, 3, TPO_R03_VAL_STANDBY);
333
334 regulator_disable(tpo_td043->vcc_reg);
335
336 tpo_td043->powered_on = 0;
337}
338
339static int tpo_td043_enable_dss(struct omap_dss_device *dssdev)
340{
341 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dssdev->dev);
342 int r;
343
344 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
345 return 0;
346
347 omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
348 omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
349
350 r = omapdss_dpi_display_enable(dssdev);
351 if (r)
352 goto err0;
353
354 /*
355 * If we are resuming from system suspend, SPI clocks might not be
356 * enabled yet, so we'll program the LCD from SPI PM resume callback.
357 */
358 if (!tpo_td043->spi_suspended) {
359 r = tpo_td043_power_on(tpo_td043);
360 if (r)
361 goto err1;
362 }
363
364 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
365
366 return 0;
367err1:
368 omapdss_dpi_display_disable(dssdev);
369err0:
370 return r;
371}
372
373static void tpo_td043_disable_dss(struct omap_dss_device *dssdev)
374{
375 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dssdev->dev);
376
377 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
378 return;
379
380 omapdss_dpi_display_disable(dssdev);
381
382 if (!tpo_td043->spi_suspended)
383 tpo_td043_power_off(tpo_td043);
384}
385
386static int tpo_td043_enable(struct omap_dss_device *dssdev)
387{
388 dev_dbg(dssdev->dev, "enable\n");
389
390 return tpo_td043_enable_dss(dssdev);
391}
392
393static void tpo_td043_disable(struct omap_dss_device *dssdev)
394{
395 dev_dbg(dssdev->dev, "disable\n");
396
397 tpo_td043_disable_dss(dssdev);
398
399 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
400}
401
402static int tpo_td043_probe(struct omap_dss_device *dssdev)
403{
404 struct tpo_td043_device *tpo_td043 = g_tpo_td043;
405 struct panel_tpo_td043_data *pdata = get_panel_data(dssdev);
406 int ret = 0;
407
408 dev_dbg(dssdev->dev, "probe\n");
409
410 if (tpo_td043 == NULL) {
411 dev_err(dssdev->dev, "missing tpo_td043_device\n");
412 return -ENODEV;
413 }
414
415 if (!pdata)
416 return -EINVAL;
417
418 tpo_td043->nreset_gpio = pdata->nreset_gpio;
419
420 dssdev->panel.timings = tpo_td043_timings;
421 dssdev->ctrl.pixel_size = 24;
422
423 tpo_td043->mode = TPO_R02_MODE_800x480;
424 memcpy(tpo_td043->gamma, tpo_td043_def_gamma, sizeof(tpo_td043->gamma));
425
426 tpo_td043->vcc_reg = regulator_get(dssdev->dev, "vcc");
427 if (IS_ERR(tpo_td043->vcc_reg)) {
428 dev_err(dssdev->dev, "failed to get LCD VCC regulator\n");
429 ret = PTR_ERR(tpo_td043->vcc_reg);
430 goto fail_regulator;
431 }
432
433 if (gpio_is_valid(tpo_td043->nreset_gpio)) {
434 ret = devm_gpio_request_one(dssdev->dev,
435 tpo_td043->nreset_gpio, GPIOF_OUT_INIT_LOW,
436 "lcd reset");
437 if (ret < 0) {
438 dev_err(dssdev->dev, "couldn't request reset GPIO\n");
439 goto fail_gpio_req;
440 }
441 }
442
443 ret = sysfs_create_group(&dssdev->dev->kobj, &tpo_td043_attr_group);
444 if (ret)
445 dev_warn(dssdev->dev, "failed to create sysfs files\n");
446
447 dev_set_drvdata(dssdev->dev, tpo_td043);
448
449 return 0;
450
451fail_gpio_req:
452 regulator_put(tpo_td043->vcc_reg);
453fail_regulator:
454 kfree(tpo_td043);
455 return ret;
456}
457
458static void tpo_td043_remove(struct omap_dss_device *dssdev)
459{
460 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dssdev->dev);
461
462 dev_dbg(dssdev->dev, "remove\n");
463
464 sysfs_remove_group(&dssdev->dev->kobj, &tpo_td043_attr_group);
465 regulator_put(tpo_td043->vcc_reg);
466}
467
468static void tpo_td043_set_timings(struct omap_dss_device *dssdev,
469 struct omap_video_timings *timings)
470{
471 omapdss_dpi_set_timings(dssdev, timings);
472
473 dssdev->panel.timings = *timings;
474}
475
476static int tpo_td043_check_timings(struct omap_dss_device *dssdev,
477 struct omap_video_timings *timings)
478{
479 return dpi_check_timings(dssdev, timings);
480}
481
482static struct omap_dss_driver tpo_td043_driver = {
483 .probe = tpo_td043_probe,
484 .remove = tpo_td043_remove,
485
486 .enable = tpo_td043_enable,
487 .disable = tpo_td043_disable,
488 .set_mirror = tpo_td043_set_hmirror,
489 .get_mirror = tpo_td043_get_hmirror,
490
491 .set_timings = tpo_td043_set_timings,
492 .check_timings = tpo_td043_check_timings,
493
494 .driver = {
495 .name = "tpo_td043mtea1_panel",
496 .owner = THIS_MODULE,
497 },
498};
499
500static int tpo_td043_spi_probe(struct spi_device *spi)
501{
502 struct omap_dss_device *dssdev = spi->dev.platform_data;
503 struct tpo_td043_device *tpo_td043;
504 int ret;
505
506 if (dssdev == NULL) {
507 dev_err(&spi->dev, "missing dssdev\n");
508 return -ENODEV;
509 }
510
511 if (g_tpo_td043 != NULL)
512 return -EBUSY;
513
514 spi->bits_per_word = 16;
515 spi->mode = SPI_MODE_0;
516
517 ret = spi_setup(spi);
518 if (ret < 0) {
519 dev_err(&spi->dev, "spi_setup failed: %d\n", ret);
520 return ret;
521 }
522
523 tpo_td043 = kzalloc(sizeof(*tpo_td043), GFP_KERNEL);
524 if (tpo_td043 == NULL)
525 return -ENOMEM;
526
527 tpo_td043->spi = spi;
528 dev_set_drvdata(&spi->dev, tpo_td043);
529 g_tpo_td043 = tpo_td043;
530
531 omap_dss_register_driver(&tpo_td043_driver);
532
533 return 0;
534}
535
536static int tpo_td043_spi_remove(struct spi_device *spi)
537{
538 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&spi->dev);
539
540 omap_dss_unregister_driver(&tpo_td043_driver);
541 kfree(tpo_td043);
542 g_tpo_td043 = NULL;
543
544 return 0;
545}
546
547#ifdef CONFIG_PM_SLEEP
548static int tpo_td043_spi_suspend(struct device *dev)
549{
550 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
551
552 dev_dbg(dev, "tpo_td043_spi_suspend, tpo %p\n", tpo_td043);
553
554 tpo_td043->power_on_resume = tpo_td043->powered_on;
555 tpo_td043_power_off(tpo_td043);
556 tpo_td043->spi_suspended = 1;
557
558 return 0;
559}
560
561static int tpo_td043_spi_resume(struct device *dev)
562{
563 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev);
564 int ret;
565
566 dev_dbg(dev, "tpo_td043_spi_resume\n");
567
568 if (tpo_td043->power_on_resume) {
569 ret = tpo_td043_power_on(tpo_td043);
570 if (ret)
571 return ret;
572 }
573 tpo_td043->spi_suspended = 0;
574
575 return 0;
576}
577#endif
578
579static SIMPLE_DEV_PM_OPS(tpo_td043_spi_pm,
580 tpo_td043_spi_suspend, tpo_td043_spi_resume);
581
582static struct spi_driver tpo_td043_spi_driver = {
583 .driver = {
584 .name = "tpo_td043mtea1_panel_spi",
585 .owner = THIS_MODULE,
586 .pm = &tpo_td043_spi_pm,
587 },
588 .probe = tpo_td043_spi_probe,
589 .remove = tpo_td043_spi_remove,
590};
591
592module_spi_driver(tpo_td043_spi_driver);
593
594MODULE_AUTHOR("Gražvydas Ignotas <notasas@gmail.com>");
595MODULE_DESCRIPTION("TPO TD043MTEA1 LCD Driver");
596MODULE_LICENSE("GPL");
diff --git a/drivers/video/omap2/dss/Kconfig b/drivers/video/omap2/dss/Kconfig
index 8f70a8300b84..dde4281663b1 100644
--- a/drivers/video/omap2/dss/Kconfig
+++ b/drivers/video/omap2/dss/Kconfig
@@ -42,6 +42,7 @@ config OMAP2_DSS_DPI
42 42
43config OMAP2_DSS_RFBI 43config OMAP2_DSS_RFBI
44 bool "RFBI support" 44 bool "RFBI support"
45 depends on BROKEN
45 default n 46 default n
46 help 47 help
47 MIPI DBI support (RFBI, Remote Framebuffer Interface, in Texas 48 MIPI DBI support (RFBI, Remote Framebuffer Interface, in Texas
diff --git a/drivers/video/omap2/dss/Makefile b/drivers/video/omap2/dss/Makefile
index 61949ff7940c..94832eb06a3d 100644
--- a/drivers/video/omap2/dss/Makefile
+++ b/drivers/video/omap2/dss/Makefile
@@ -7,9 +7,8 @@ omapdss-y += manager.o manager-sysfs.o overlay.o overlay-sysfs.o apply.o \
7 dispc-compat.o display-sysfs.o 7 dispc-compat.o display-sysfs.o
8omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o 8omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
9omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o 9omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o
10omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o venc_panel.o 10omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
11omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o 11omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
12omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o 12omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
13omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi.o \ 13omapdss-$(CONFIG_OMAP4_DSS_HDMI) += hdmi.o ti_hdmi_4xxx_ip.o
14 hdmi_panel.o ti_hdmi_4xxx_ip.o
15ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG 14ccflags-$(CONFIG_OMAP2_DSS_DEBUG) += -DDEBUG
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index d6212d63cfb2..60758dbefd79 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -428,8 +428,8 @@ static struct omap_dss_device *dss_mgr_get_device(struct omap_overlay_manager *m
428 if (dssdev == NULL) 428 if (dssdev == NULL)
429 return NULL; 429 return NULL;
430 430
431 while (dssdev->device) 431 while (dssdev->dst)
432 dssdev = dssdev->device; 432 dssdev = dssdev->dst;
433 433
434 if (dssdev->driver) 434 if (dssdev->driver)
435 return dssdev; 435 return dssdev;
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index a7ce26c090dd..60d3958d04f7 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -43,9 +43,6 @@
43static struct { 43static struct {
44 struct platform_device *pdev; 44 struct platform_device *pdev;
45 45
46 struct regulator *vdds_dsi_reg;
47 struct regulator *vdds_sdi_reg;
48
49 const char *default_display_name; 46 const char *default_display_name;
50} core; 47} core;
51 48
@@ -79,36 +76,6 @@ struct platform_device *dss_get_core_pdev(void)
79 return core.pdev; 76 return core.pdev;
80} 77}
81 78
82/* REGULATORS */
83
84struct regulator *dss_get_vdds_dsi(void)
85{
86 struct regulator *reg;
87
88 if (core.vdds_dsi_reg != NULL)
89 return core.vdds_dsi_reg;
90
91 reg = devm_regulator_get(&core.pdev->dev, "vdds_dsi");
92 if (!IS_ERR(reg))
93 core.vdds_dsi_reg = reg;
94
95 return reg;
96}
97
98struct regulator *dss_get_vdds_sdi(void)
99{
100 struct regulator *reg;
101
102 if (core.vdds_sdi_reg != NULL)
103 return core.vdds_sdi_reg;
104
105 reg = devm_regulator_get(&core.pdev->dev, "vdds_sdi");
106 if (!IS_ERR(reg))
107 core.vdds_sdi_reg = reg;
108
109 return reg;
110}
111
112int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask) 79int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask)
113{ 80{
114 struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; 81 struct omap_dss_board_info *board_data = core.pdev->dev.platform_data;
@@ -281,235 +248,6 @@ static struct platform_driver omap_dss_driver = {
281 }, 248 },
282}; 249};
283 250
284/* BUS */
285static int dss_bus_match(struct device *dev, struct device_driver *driver)
286{
287 struct omap_dss_device *dssdev = to_dss_device(dev);
288
289 DSSDBG("bus_match. dev %s/%s, drv %s\n",
290 dev_name(dev), dssdev->driver_name, driver->name);
291
292 return strcmp(dssdev->driver_name, driver->name) == 0;
293}
294
295static struct bus_type dss_bus_type = {
296 .name = "omapdss",
297 .match = dss_bus_match,
298};
299
300static void dss_bus_release(struct device *dev)
301{
302 DSSDBG("bus_release\n");
303}
304
305static struct device dss_bus = {
306 .release = dss_bus_release,
307};
308
309struct bus_type *dss_get_bus(void)
310{
311 return &dss_bus_type;
312}
313
314/* DRIVER */
315static int dss_driver_probe(struct device *dev)
316{
317 int r;
318 struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver);
319 struct omap_dss_device *dssdev = to_dss_device(dev);
320
321 DSSDBG("driver_probe: dev %s/%s, drv %s\n",
322 dev_name(dev), dssdev->driver_name,
323 dssdrv->driver.name);
324
325 r = dssdrv->probe(dssdev);
326
327 if (r) {
328 DSSERR("driver probe failed: %d\n", r);
329 return r;
330 }
331
332 DSSDBG("probe done for device %s\n", dev_name(dev));
333
334 dssdev->driver = dssdrv;
335
336 return 0;
337}
338
339static int dss_driver_remove(struct device *dev)
340{
341 struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver);
342 struct omap_dss_device *dssdev = to_dss_device(dev);
343
344 DSSDBG("driver_remove: dev %s/%s\n", dev_name(dev),
345 dssdev->driver_name);
346
347 dssdrv->remove(dssdev);
348
349 dssdev->driver = NULL;
350
351 return 0;
352}
353
354static int omapdss_default_connect(struct omap_dss_device *dssdev)
355{
356 struct omap_dss_device *out;
357 struct omap_overlay_manager *mgr;
358 int r;
359
360 out = dssdev->output;
361
362 if (out == NULL)
363 return -ENODEV;
364
365 mgr = omap_dss_get_overlay_manager(out->dispc_channel);
366 if (!mgr)
367 return -ENODEV;
368
369 r = dss_mgr_connect(mgr, out);
370 if (r)
371 return r;
372
373 return 0;
374}
375
376static void omapdss_default_disconnect(struct omap_dss_device *dssdev)
377{
378 struct omap_dss_device *out;
379 struct omap_overlay_manager *mgr;
380
381 out = dssdev->output;
382
383 if (out == NULL)
384 return;
385
386 mgr = out->manager;
387
388 if (mgr == NULL)
389 return;
390
391 dss_mgr_disconnect(mgr, out);
392}
393
394int omap_dss_register_driver(struct omap_dss_driver *dssdriver)
395{
396 dssdriver->driver.bus = &dss_bus_type;
397 dssdriver->driver.probe = dss_driver_probe;
398 dssdriver->driver.remove = dss_driver_remove;
399
400 if (dssdriver->get_resolution == NULL)
401 dssdriver->get_resolution = omapdss_default_get_resolution;
402 if (dssdriver->get_recommended_bpp == NULL)
403 dssdriver->get_recommended_bpp =
404 omapdss_default_get_recommended_bpp;
405 if (dssdriver->get_timings == NULL)
406 dssdriver->get_timings = omapdss_default_get_timings;
407 if (dssdriver->connect == NULL)
408 dssdriver->connect = omapdss_default_connect;
409 if (dssdriver->disconnect == NULL)
410 dssdriver->disconnect = omapdss_default_disconnect;
411
412 return driver_register(&dssdriver->driver);
413}
414EXPORT_SYMBOL(omap_dss_register_driver);
415
416void omap_dss_unregister_driver(struct omap_dss_driver *dssdriver)
417{
418 driver_unregister(&dssdriver->driver);
419}
420EXPORT_SYMBOL(omap_dss_unregister_driver);
421
422/* DEVICE */
423
424static void omap_dss_dev_release(struct device *dev)
425{
426 struct omap_dss_device *dssdev = to_dss_device(dev);
427 kfree(dssdev);
428}
429
430static int disp_num_counter;
431
432struct omap_dss_device *dss_alloc_and_init_device(struct device *parent)
433{
434 struct omap_dss_device *dssdev;
435
436 dssdev = kzalloc(sizeof(*dssdev), GFP_KERNEL);
437 if (!dssdev)
438 return NULL;
439
440 dssdev->old_dev.bus = &dss_bus_type;
441 dssdev->old_dev.parent = parent;
442 dssdev->old_dev.release = omap_dss_dev_release;
443 dev_set_name(&dssdev->old_dev, "display%d", disp_num_counter++);
444
445 device_initialize(&dssdev->old_dev);
446
447 return dssdev;
448}
449
450int dss_add_device(struct omap_dss_device *dssdev)
451{
452 dssdev->dev = &dssdev->old_dev;
453
454 omapdss_register_display(dssdev);
455 return device_add(&dssdev->old_dev);
456}
457
458void dss_put_device(struct omap_dss_device *dssdev)
459{
460 put_device(&dssdev->old_dev);
461}
462
463void dss_unregister_device(struct omap_dss_device *dssdev)
464{
465 device_unregister(&dssdev->old_dev);
466 omapdss_unregister_display(dssdev);
467}
468
469static int dss_unregister_dss_dev(struct device *dev, void *data)
470{
471 struct omap_dss_device *dssdev = to_dss_device(dev);
472 dss_unregister_device(dssdev);
473 return 0;
474}
475
476void dss_unregister_child_devices(struct device *parent)
477{
478 device_for_each_child(parent, NULL, dss_unregister_dss_dev);
479}
480
481void dss_copy_device_pdata(struct omap_dss_device *dst,
482 const struct omap_dss_device *src)
483{
484 u8 *d = (u8 *)dst;
485 u8 *s = (u8 *)src;
486 size_t dsize = sizeof(struct device);
487
488 memcpy(d + dsize, s + dsize, sizeof(struct omap_dss_device) - dsize);
489}
490
491/* BUS */
492static int __init omap_dss_bus_register(void)
493{
494 int r;
495
496 r = bus_register(&dss_bus_type);
497 if (r) {
498 DSSERR("bus register failed\n");
499 return r;
500 }
501
502 dev_set_name(&dss_bus, "omapdss");
503 r = device_register(&dss_bus);
504 if (r) {
505 DSSERR("bus driver register failed\n");
506 bus_unregister(&dss_bus_type);
507 return r;
508 }
509
510 return 0;
511}
512
513/* INIT */ 251/* INIT */
514static int (*dss_output_drv_reg_funcs[])(void) __initdata = { 252static int (*dss_output_drv_reg_funcs[])(void) __initdata = {
515#ifdef CONFIG_OMAP2_DSS_DSI 253#ifdef CONFIG_OMAP2_DSS_DSI
@@ -555,7 +293,7 @@ static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = {
555 293
556static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)]; 294static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)];
557 295
558static int __init omap_dss_register_drivers(void) 296static int __init omap_dss_init(void)
559{ 297{
560 int r; 298 int r;
561 int i; 299 int i;
@@ -586,6 +324,8 @@ static int __init omap_dss_register_drivers(void)
586 dss_output_drv_loaded[i] = true; 324 dss_output_drv_loaded[i] = true;
587 } 325 }
588 326
327 dss_initialized = true;
328
589 return 0; 329 return 0;
590 330
591err_dispc: 331err_dispc:
@@ -596,7 +336,7 @@ err_dss:
596 return r; 336 return r;
597} 337}
598 338
599static void __exit omap_dss_unregister_drivers(void) 339static void __exit omap_dss_exit(void)
600{ 340{
601 int i; 341 int i;
602 342
@@ -611,64 +351,8 @@ static void __exit omap_dss_unregister_drivers(void)
611 platform_driver_unregister(&omap_dss_driver); 351 platform_driver_unregister(&omap_dss_driver);
612} 352}
613 353
614#ifdef CONFIG_OMAP2_DSS_MODULE
615static void omap_dss_bus_unregister(void)
616{
617 device_unregister(&dss_bus);
618
619 bus_unregister(&dss_bus_type);
620}
621
622static int __init omap_dss_init(void)
623{
624 int r;
625
626 r = omap_dss_bus_register();
627 if (r)
628 return r;
629
630 r = omap_dss_register_drivers();
631 if (r) {
632 omap_dss_bus_unregister();
633 return r;
634 }
635
636 dss_initialized = true;
637
638 return 0;
639}
640
641static void __exit omap_dss_exit(void)
642{
643 omap_dss_unregister_drivers();
644
645 omap_dss_bus_unregister();
646}
647
648module_init(omap_dss_init); 354module_init(omap_dss_init);
649module_exit(omap_dss_exit); 355module_exit(omap_dss_exit);
650#else
651static int __init omap_dss_init(void)
652{
653 return omap_dss_bus_register();
654}
655
656static int __init omap_dss_init2(void)
657{
658 int r;
659
660 r = omap_dss_register_drivers();
661 if (r)
662 return r;
663
664 dss_initialized = true;
665
666 return 0;
667}
668
669core_initcall(omap_dss_init);
670device_initcall(omap_dss_init2);
671#endif
672 356
673MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>"); 357MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>");
674MODULE_DESCRIPTION("OMAP2/3 Display Subsystem"); 358MODULE_DESCRIPTION("OMAP2/3 Display Subsystem");
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index a6b331ef7763..bd48cde53561 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -345,7 +345,7 @@ static void dpi_config_lcd_manager(struct omap_overlay_manager *mgr)
345 dss_mgr_set_lcd_config(mgr, &dpi.mgr_config); 345 dss_mgr_set_lcd_config(mgr, &dpi.mgr_config);
346} 346}
347 347
348int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) 348static int dpi_display_enable(struct omap_dss_device *dssdev)
349{ 349{
350 struct omap_dss_device *out = &dpi.output; 350 struct omap_dss_device *out = &dpi.output;
351 int r; 351 int r;
@@ -423,9 +423,8 @@ err_no_reg:
423 mutex_unlock(&dpi.lock); 423 mutex_unlock(&dpi.lock);
424 return r; 424 return r;
425} 425}
426EXPORT_SYMBOL(omapdss_dpi_display_enable);
427 426
428void omapdss_dpi_display_disable(struct omap_dss_device *dssdev) 427static void dpi_display_disable(struct omap_dss_device *dssdev)
429{ 428{
430 struct omap_overlay_manager *mgr = dpi.output.manager; 429 struct omap_overlay_manager *mgr = dpi.output.manager;
431 430
@@ -446,9 +445,8 @@ void omapdss_dpi_display_disable(struct omap_dss_device *dssdev)
446 445
447 mutex_unlock(&dpi.lock); 446 mutex_unlock(&dpi.lock);
448} 447}
449EXPORT_SYMBOL(omapdss_dpi_display_disable);
450 448
451void omapdss_dpi_set_timings(struct omap_dss_device *dssdev, 449static void dpi_set_timings(struct omap_dss_device *dssdev,
452 struct omap_video_timings *timings) 450 struct omap_video_timings *timings)
453{ 451{
454 DSSDBG("dpi_set_timings\n"); 452 DSSDBG("dpi_set_timings\n");
@@ -459,7 +457,6 @@ void omapdss_dpi_set_timings(struct omap_dss_device *dssdev,
459 457
460 mutex_unlock(&dpi.lock); 458 mutex_unlock(&dpi.lock);
461} 459}
462EXPORT_SYMBOL(omapdss_dpi_set_timings);
463 460
464static void dpi_get_timings(struct omap_dss_device *dssdev, 461static void dpi_get_timings(struct omap_dss_device *dssdev,
465 struct omap_video_timings *timings) 462 struct omap_video_timings *timings)
@@ -471,7 +468,7 @@ static void dpi_get_timings(struct omap_dss_device *dssdev,
471 mutex_unlock(&dpi.lock); 468 mutex_unlock(&dpi.lock);
472} 469}
473 470
474int dpi_check_timings(struct omap_dss_device *dssdev, 471static int dpi_check_timings(struct omap_dss_device *dssdev,
475 struct omap_video_timings *timings) 472 struct omap_video_timings *timings)
476{ 473{
477 struct omap_overlay_manager *mgr = dpi.output.manager; 474 struct omap_overlay_manager *mgr = dpi.output.manager;
@@ -510,9 +507,8 @@ int dpi_check_timings(struct omap_dss_device *dssdev,
510 507
511 return 0; 508 return 0;
512} 509}
513EXPORT_SYMBOL(dpi_check_timings);
514 510
515void omapdss_dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines) 511static void dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines)
516{ 512{
517 mutex_lock(&dpi.lock); 513 mutex_lock(&dpi.lock);
518 514
@@ -520,7 +516,6 @@ void omapdss_dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines)
520 516
521 mutex_unlock(&dpi.lock); 517 mutex_unlock(&dpi.lock);
522} 518}
523EXPORT_SYMBOL(omapdss_dpi_set_data_lines);
524 519
525static int dpi_verify_dsi_pll(struct platform_device *dsidev) 520static int dpi_verify_dsi_pll(struct platform_device *dsidev)
526{ 521{
@@ -554,14 +549,10 @@ static int dpi_init_regulator(void)
554 if (dpi.vdds_dsi_reg) 549 if (dpi.vdds_dsi_reg)
555 return 0; 550 return 0;
556 551
557 vdds_dsi = dss_get_vdds_dsi(); 552 vdds_dsi = devm_regulator_get(&dpi.pdev->dev, "vdds_dsi");
558
559 if (IS_ERR(vdds_dsi)) { 553 if (IS_ERR(vdds_dsi)) {
560 vdds_dsi = devm_regulator_get(&dpi.pdev->dev, "vdds_dsi"); 554 DSSERR("can't get VDDS_DSI regulator\n");
561 if (IS_ERR(vdds_dsi)) { 555 return PTR_ERR(vdds_dsi);
562 DSSERR("can't get VDDS_DSI regulator\n");
563 return PTR_ERR(vdds_dsi);
564 }
565 } 556 }
566 557
567 dpi.vdds_dsi_reg = vdds_dsi; 558 dpi.vdds_dsi_reg = vdds_dsi;
@@ -618,76 +609,6 @@ static enum omap_channel dpi_get_channel(void)
618 } 609 }
619} 610}
620 611
621static struct omap_dss_device *dpi_find_dssdev(struct platform_device *pdev)
622{
623 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
624 const char *def_disp_name = omapdss_get_default_display_name();
625 struct omap_dss_device *def_dssdev;
626 int i;
627
628 def_dssdev = NULL;
629
630 for (i = 0; i < pdata->num_devices; ++i) {
631 struct omap_dss_device *dssdev = pdata->devices[i];
632
633 if (dssdev->type != OMAP_DISPLAY_TYPE_DPI)
634 continue;
635
636 if (def_dssdev == NULL)
637 def_dssdev = dssdev;
638
639 if (def_disp_name != NULL &&
640 strcmp(dssdev->name, def_disp_name) == 0) {
641 def_dssdev = dssdev;
642 break;
643 }
644 }
645
646 return def_dssdev;
647}
648
649static int dpi_probe_pdata(struct platform_device *dpidev)
650{
651 struct omap_dss_device *plat_dssdev;
652 struct omap_dss_device *dssdev;
653 int r;
654
655 plat_dssdev = dpi_find_dssdev(dpidev);
656
657 if (!plat_dssdev)
658 return 0;
659
660 r = dpi_init_regulator();
661 if (r)
662 return r;
663
664 dpi_init_pll();
665
666 dssdev = dss_alloc_and_init_device(&dpidev->dev);
667 if (!dssdev)
668 return -ENOMEM;
669
670 dss_copy_device_pdata(dssdev, plat_dssdev);
671
672 r = omapdss_output_set_device(&dpi.output, dssdev);
673 if (r) {
674 DSSERR("failed to connect output to new device: %s\n",
675 dssdev->name);
676 dss_put_device(dssdev);
677 return r;
678 }
679
680 r = dss_add_device(dssdev);
681 if (r) {
682 DSSERR("device %s register failed: %d\n", dssdev->name, r);
683 omapdss_output_unset_device(&dpi.output);
684 dss_put_device(dssdev);
685 return r;
686 }
687
688 return 0;
689}
690
691static int dpi_connect(struct omap_dss_device *dssdev, 612static int dpi_connect(struct omap_dss_device *dssdev,
692 struct omap_dss_device *dst) 613 struct omap_dss_device *dst)
693{ 614{
@@ -722,9 +643,9 @@ static int dpi_connect(struct omap_dss_device *dssdev,
722static void dpi_disconnect(struct omap_dss_device *dssdev, 643static void dpi_disconnect(struct omap_dss_device *dssdev,
723 struct omap_dss_device *dst) 644 struct omap_dss_device *dst)
724{ 645{
725 WARN_ON(dst != dssdev->device); 646 WARN_ON(dst != dssdev->dst);
726 647
727 if (dst != dssdev->device) 648 if (dst != dssdev->dst)
728 return; 649 return;
729 650
730 omapdss_output_unset_device(dssdev); 651 omapdss_output_unset_device(dssdev);
@@ -737,14 +658,14 @@ static const struct omapdss_dpi_ops dpi_ops = {
737 .connect = dpi_connect, 658 .connect = dpi_connect,
738 .disconnect = dpi_disconnect, 659 .disconnect = dpi_disconnect,
739 660
740 .enable = omapdss_dpi_display_enable, 661 .enable = dpi_display_enable,
741 .disable = omapdss_dpi_display_disable, 662 .disable = dpi_display_disable,
742 663
743 .check_timings = dpi_check_timings, 664 .check_timings = dpi_check_timings,
744 .set_timings = omapdss_dpi_set_timings, 665 .set_timings = dpi_set_timings,
745 .get_timings = dpi_get_timings, 666 .get_timings = dpi_get_timings,
746 667
747 .set_data_lines = omapdss_dpi_set_data_lines, 668 .set_data_lines = dpi_set_data_lines,
748}; 669};
749 670
750static void dpi_init_output(struct platform_device *pdev) 671static void dpi_init_output(struct platform_device *pdev)
@@ -771,31 +692,17 @@ static void __exit dpi_uninit_output(struct platform_device *pdev)
771 692
772static int omap_dpi_probe(struct platform_device *pdev) 693static int omap_dpi_probe(struct platform_device *pdev)
773{ 694{
774 int r;
775
776 dpi.pdev = pdev; 695 dpi.pdev = pdev;
777 696
778 mutex_init(&dpi.lock); 697 mutex_init(&dpi.lock);
779 698
780 dpi_init_output(pdev); 699 dpi_init_output(pdev);
781 700
782 if (pdev->dev.platform_data) {
783 r = dpi_probe_pdata(pdev);
784 if (r)
785 goto err_probe;
786 }
787
788 return 0; 701 return 0;
789
790err_probe:
791 dpi_uninit_output(pdev);
792 return r;
793} 702}
794 703
795static int __exit omap_dpi_remove(struct platform_device *pdev) 704static int __exit omap_dpi_remove(struct platform_device *pdev)
796{ 705{
797 dss_unregister_child_devices(&pdev->dev);
798
799 dpi_uninit_output(pdev); 706 dpi_uninit_output(pdev);
800 707
801 return 0; 708 return 0;
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 99a043b08f0d..a598b5812285 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -205,6 +205,8 @@ static int dsi_display_init_dispc(struct platform_device *dsidev,
205static void dsi_display_uninit_dispc(struct platform_device *dsidev, 205static void dsi_display_uninit_dispc(struct platform_device *dsidev,
206 struct omap_overlay_manager *mgr); 206 struct omap_overlay_manager *mgr);
207 207
208static int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel);
209
208#define DSI_MAX_NR_ISRS 2 210#define DSI_MAX_NR_ISRS 2
209#define DSI_MAX_NR_LANES 5 211#define DSI_MAX_NR_LANES 5
210 212
@@ -383,16 +385,7 @@ static inline struct dsi_data *dsi_get_dsidrv_data(struct platform_device *dside
383 385
384static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dss_device *dssdev) 386static inline struct platform_device *dsi_get_dsidev_from_dssdev(struct omap_dss_device *dssdev)
385{ 387{
386 /* HACK: dssdev can be either the panel device, when using old API, or 388 return to_platform_device(dssdev->dev);
387 * the dsi device itself, when using the new API. So we solve this for
388 * now by checking the dssdev->id. This will be removed when the old API
389 * is removed.
390 */
391 if (dssdev->id == OMAP_DSS_OUTPUT_DSI1 ||
392 dssdev->id == OMAP_DSS_OUTPUT_DSI2)
393 return to_platform_device(dssdev->dev);
394
395 return to_platform_device(dssdev->output->dev);
396} 389}
397 390
398struct platform_device *dsi_get_dsidev_from_id(int module) 391struct platform_device *dsi_get_dsidev_from_id(int module)
@@ -432,23 +425,21 @@ static inline u32 dsi_read_reg(struct platform_device *dsidev,
432 return __raw_readl(dsi->base + idx.idx); 425 return __raw_readl(dsi->base + idx.idx);
433} 426}
434 427
435void dsi_bus_lock(struct omap_dss_device *dssdev) 428static void dsi_bus_lock(struct omap_dss_device *dssdev)
436{ 429{
437 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 430 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
438 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 431 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
439 432
440 down(&dsi->bus_lock); 433 down(&dsi->bus_lock);
441} 434}
442EXPORT_SYMBOL(dsi_bus_lock);
443 435
444void dsi_bus_unlock(struct omap_dss_device *dssdev) 436static void dsi_bus_unlock(struct omap_dss_device *dssdev)
445{ 437{
446 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 438 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
447 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 439 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
448 440
449 up(&dsi->bus_lock); 441 up(&dsi->bus_lock);
450} 442}
451EXPORT_SYMBOL(dsi_bus_unlock);
452 443
453static bool dsi_bus_is_locked(struct platform_device *dsidev) 444static bool dsi_bus_is_locked(struct platform_device *dsidev)
454{ 445{
@@ -2713,7 +2704,7 @@ static int dsi_vc_config_source(struct platform_device *dsidev, int channel,
2713 return 0; 2704 return 0;
2714} 2705}
2715 2706
2716void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, 2707static void dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
2717 bool enable) 2708 bool enable)
2718{ 2709{
2719 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 2710 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -2737,7 +2728,6 @@ void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
2737 if (dsi->vm_timings.ddr_clk_always_on && enable) 2728 if (dsi->vm_timings.ddr_clk_always_on && enable)
2738 dsi_vc_send_null(dssdev, channel); 2729 dsi_vc_send_null(dssdev, channel);
2739} 2730}
2740EXPORT_SYMBOL(omapdss_dsi_vc_enable_hs);
2741 2731
2742static void dsi_vc_flush_long_data(struct platform_device *dsidev, int channel) 2732static void dsi_vc_flush_long_data(struct platform_device *dsidev, int channel)
2743{ 2733{
@@ -2842,7 +2832,7 @@ static int dsi_vc_send_bta(struct platform_device *dsidev, int channel)
2842 return 0; 2832 return 0;
2843} 2833}
2844 2834
2845int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel) 2835static int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel)
2846{ 2836{
2847 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 2837 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
2848 DECLARE_COMPLETION_ONSTACK(completion); 2838 DECLARE_COMPLETION_ONSTACK(completion);
@@ -2885,7 +2875,6 @@ err1:
2885err0: 2875err0:
2886 return r; 2876 return r;
2887} 2877}
2888EXPORT_SYMBOL(dsi_vc_send_bta_sync);
2889 2878
2890static inline void dsi_vc_write_long_header(struct platform_device *dsidev, 2879static inline void dsi_vc_write_long_header(struct platform_device *dsidev,
2891 int channel, u8 data_type, u16 len, u8 ecc) 2880 int channel, u8 data_type, u16 len, u8 ecc)
@@ -3011,14 +3000,13 @@ static int dsi_vc_send_short(struct platform_device *dsidev, int channel,
3011 return 0; 3000 return 0;
3012} 3001}
3013 3002
3014int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel) 3003static int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel)
3015{ 3004{
3016 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 3005 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
3017 3006
3018 return dsi_vc_send_long(dsidev, channel, MIPI_DSI_NULL_PACKET, NULL, 3007 return dsi_vc_send_long(dsidev, channel, MIPI_DSI_NULL_PACKET, NULL,
3019 0, 0); 3008 0, 0);
3020} 3009}
3021EXPORT_SYMBOL(dsi_vc_send_null);
3022 3010
3023static int dsi_vc_write_nosync_common(struct platform_device *dsidev, 3011static int dsi_vc_write_nosync_common(struct platform_device *dsidev,
3024 int channel, u8 *data, int len, enum dss_dsi_content_type type) 3012 int channel, u8 *data, int len, enum dss_dsi_content_type type)
@@ -3050,7 +3038,7 @@ static int dsi_vc_write_nosync_common(struct platform_device *dsidev,
3050 return r; 3038 return r;
3051} 3039}
3052 3040
3053int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel, 3041static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
3054 u8 *data, int len) 3042 u8 *data, int len)
3055{ 3043{
3056 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 3044 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -3058,9 +3046,8 @@ int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
3058 return dsi_vc_write_nosync_common(dsidev, channel, data, len, 3046 return dsi_vc_write_nosync_common(dsidev, channel, data, len,
3059 DSS_DSI_CONTENT_DCS); 3047 DSS_DSI_CONTENT_DCS);
3060} 3048}
3061EXPORT_SYMBOL(dsi_vc_dcs_write_nosync);
3062 3049
3063int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel, 3050static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
3064 u8 *data, int len) 3051 u8 *data, int len)
3065{ 3052{
3066 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 3053 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -3068,7 +3055,6 @@ int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
3068 return dsi_vc_write_nosync_common(dsidev, channel, data, len, 3055 return dsi_vc_write_nosync_common(dsidev, channel, data, len,
3069 DSS_DSI_CONTENT_GENERIC); 3056 DSS_DSI_CONTENT_GENERIC);
3070} 3057}
3071EXPORT_SYMBOL(dsi_vc_generic_write_nosync);
3072 3058
3073static int dsi_vc_write_common(struct omap_dss_device *dssdev, int channel, 3059static int dsi_vc_write_common(struct omap_dss_device *dssdev, int channel,
3074 u8 *data, int len, enum dss_dsi_content_type type) 3060 u8 *data, int len, enum dss_dsi_content_type type)
@@ -3099,60 +3085,19 @@ err:
3099 return r; 3085 return r;
3100} 3086}
3101 3087
3102int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data, 3088static int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
3103 int len) 3089 int len)
3104{ 3090{
3105 return dsi_vc_write_common(dssdev, channel, data, len, 3091 return dsi_vc_write_common(dssdev, channel, data, len,
3106 DSS_DSI_CONTENT_DCS); 3092 DSS_DSI_CONTENT_DCS);
3107} 3093}
3108EXPORT_SYMBOL(dsi_vc_dcs_write);
3109 3094
3110int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data, 3095static int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
3111 int len) 3096 int len)
3112{ 3097{
3113 return dsi_vc_write_common(dssdev, channel, data, len, 3098 return dsi_vc_write_common(dssdev, channel, data, len,
3114 DSS_DSI_CONTENT_GENERIC); 3099 DSS_DSI_CONTENT_GENERIC);
3115} 3100}
3116EXPORT_SYMBOL(dsi_vc_generic_write);
3117
3118int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd)
3119{
3120 return dsi_vc_dcs_write(dssdev, channel, &dcs_cmd, 1);
3121}
3122EXPORT_SYMBOL(dsi_vc_dcs_write_0);
3123
3124int dsi_vc_generic_write_0(struct omap_dss_device *dssdev, int channel)
3125{
3126 return dsi_vc_generic_write(dssdev, channel, NULL, 0);
3127}
3128EXPORT_SYMBOL(dsi_vc_generic_write_0);
3129
3130int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
3131 u8 param)
3132{
3133 u8 buf[2];
3134 buf[0] = dcs_cmd;
3135 buf[1] = param;
3136 return dsi_vc_dcs_write(dssdev, channel, buf, 2);
3137}
3138EXPORT_SYMBOL(dsi_vc_dcs_write_1);
3139
3140int dsi_vc_generic_write_1(struct omap_dss_device *dssdev, int channel,
3141 u8 param)
3142{
3143 return dsi_vc_generic_write(dssdev, channel, &param, 1);
3144}
3145EXPORT_SYMBOL(dsi_vc_generic_write_1);
3146
3147int dsi_vc_generic_write_2(struct omap_dss_device *dssdev, int channel,
3148 u8 param1, u8 param2)
3149{
3150 u8 buf[2];
3151 buf[0] = param1;
3152 buf[1] = param2;
3153 return dsi_vc_generic_write(dssdev, channel, buf, 2);
3154}
3155EXPORT_SYMBOL(dsi_vc_generic_write_2);
3156 3101
3157static int dsi_vc_dcs_send_read_request(struct platform_device *dsidev, 3102static int dsi_vc_dcs_send_read_request(struct platform_device *dsidev,
3158 int channel, u8 dcs_cmd) 3103 int channel, u8 dcs_cmd)
@@ -3319,7 +3264,7 @@ err:
3319 return r; 3264 return r;
3320} 3265}
3321 3266
3322int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd, 3267static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
3323 u8 *buf, int buflen) 3268 u8 *buf, int buflen)
3324{ 3269{
3325 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 3270 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -3348,7 +3293,6 @@ err:
3348 DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", channel, dcs_cmd); 3293 DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", channel, dcs_cmd);
3349 return r; 3294 return r;
3350} 3295}
3351EXPORT_SYMBOL(dsi_vc_dcs_read);
3352 3296
3353static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel, 3297static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
3354 u8 *reqdata, int reqlen, u8 *buf, int buflen) 3298 u8 *reqdata, int reqlen, u8 *buf, int buflen)
@@ -3377,56 +3321,7 @@ static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
3377 return 0; 3321 return 0;
3378} 3322}
3379 3323
3380int dsi_vc_generic_read_0(struct omap_dss_device *dssdev, int channel, u8 *buf, 3324static int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
3381 int buflen)
3382{
3383 int r;
3384
3385 r = dsi_vc_generic_read(dssdev, channel, NULL, 0, buf, buflen);
3386 if (r) {
3387 DSSERR("dsi_vc_generic_read_0(ch %d) failed\n", channel);
3388 return r;
3389 }
3390
3391 return 0;
3392}
3393EXPORT_SYMBOL(dsi_vc_generic_read_0);
3394
3395int dsi_vc_generic_read_1(struct omap_dss_device *dssdev, int channel, u8 param,
3396 u8 *buf, int buflen)
3397{
3398 int r;
3399
3400 r = dsi_vc_generic_read(dssdev, channel, &param, 1, buf, buflen);
3401 if (r) {
3402 DSSERR("dsi_vc_generic_read_1(ch %d) failed\n", channel);
3403 return r;
3404 }
3405
3406 return 0;
3407}
3408EXPORT_SYMBOL(dsi_vc_generic_read_1);
3409
3410int dsi_vc_generic_read_2(struct omap_dss_device *dssdev, int channel,
3411 u8 param1, u8 param2, u8 *buf, int buflen)
3412{
3413 int r;
3414 u8 reqdata[2];
3415
3416 reqdata[0] = param1;
3417 reqdata[1] = param2;
3418
3419 r = dsi_vc_generic_read(dssdev, channel, reqdata, 2, buf, buflen);
3420 if (r) {
3421 DSSERR("dsi_vc_generic_read_2(ch %d) failed\n", channel);
3422 return r;
3423 }
3424
3425 return 0;
3426}
3427EXPORT_SYMBOL(dsi_vc_generic_read_2);
3428
3429int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
3430 u16 len) 3325 u16 len)
3431{ 3326{
3432 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 3327 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -3434,7 +3329,6 @@ int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
3434 return dsi_vc_send_short(dsidev, channel, 3329 return dsi_vc_send_short(dsidev, channel,
3435 MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE, len, 0); 3330 MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE, len, 0);
3436} 3331}
3437EXPORT_SYMBOL(dsi_vc_set_max_rx_packet_size);
3438 3332
3439static int dsi_enter_ulps(struct platform_device *dsidev) 3333static int dsi_enter_ulps(struct platform_device *dsidev)
3440{ 3334{
@@ -4068,7 +3962,7 @@ static void dsi_proto_timings(struct platform_device *dsidev)
4068 } 3962 }
4069} 3963}
4070 3964
4071int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev, 3965static int dsi_configure_pins(struct omap_dss_device *dssdev,
4072 const struct omap_dsi_pin_config *pin_cfg) 3966 const struct omap_dsi_pin_config *pin_cfg)
4073{ 3967{
4074 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 3968 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -4134,9 +4028,8 @@ int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
4134 4028
4135 return 0; 4029 return 0;
4136} 4030}
4137EXPORT_SYMBOL(omapdss_dsi_configure_pins);
4138 4031
4139int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel) 4032static int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
4140{ 4033{
4141 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4034 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4142 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 4035 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -4206,9 +4099,8 @@ err_pix_fmt:
4206err_init_dispc: 4099err_init_dispc:
4207 return r; 4100 return r;
4208} 4101}
4209EXPORT_SYMBOL(dsi_enable_video_output);
4210 4102
4211void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel) 4103static void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel)
4212{ 4104{
4213 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4105 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4214 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 4106 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -4229,7 +4121,6 @@ void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel)
4229 4121
4230 dsi_display_uninit_dispc(dsidev, mgr); 4122 dsi_display_uninit_dispc(dsidev, mgr);
4231} 4123}
4232EXPORT_SYMBOL(dsi_disable_video_output);
4233 4124
4234static void dsi_update_screen_dispc(struct platform_device *dsidev) 4125static void dsi_update_screen_dispc(struct platform_device *dsidev)
4235{ 4126{
@@ -4369,7 +4260,7 @@ static void dsi_framedone_irq_callback(void *data)
4369 dsi_handle_framedone(dsidev, 0); 4260 dsi_handle_framedone(dsidev, 0);
4370} 4261}
4371 4262
4372int omap_dsi_update(struct omap_dss_device *dssdev, int channel, 4263static int dsi_update(struct omap_dss_device *dssdev, int channel,
4373 void (*callback)(int, void *), void *data) 4264 void (*callback)(int, void *), void *data)
4374{ 4265{
4375 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4266 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -4394,7 +4285,6 @@ int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
4394 4285
4395 return 0; 4286 return 0;
4396} 4287}
4397EXPORT_SYMBOL(omap_dsi_update);
4398 4288
4399/* Display funcs */ 4289/* Display funcs */
4400 4290
@@ -4589,7 +4479,7 @@ static void dsi_display_uninit_dsi(struct platform_device *dsidev,
4589 dsi_pll_uninit(dsidev, disconnect_lanes); 4479 dsi_pll_uninit(dsidev, disconnect_lanes);
4590} 4480}
4591 4481
4592int omapdss_dsi_display_enable(struct omap_dss_device *dssdev) 4482static int dsi_display_enable(struct omap_dss_device *dssdev)
4593{ 4483{
4594 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4484 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4595 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 4485 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -4625,9 +4515,8 @@ err_get_dsi:
4625 DSSDBG("dsi_display_enable FAILED\n"); 4515 DSSDBG("dsi_display_enable FAILED\n");
4626 return r; 4516 return r;
4627} 4517}
4628EXPORT_SYMBOL(omapdss_dsi_display_enable);
4629 4518
4630void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, 4519static void dsi_display_disable(struct omap_dss_device *dssdev,
4631 bool disconnect_lanes, bool enter_ulps) 4520 bool disconnect_lanes, bool enter_ulps)
4632{ 4521{
4633 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4522 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -4651,9 +4540,8 @@ void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
4651 4540
4652 mutex_unlock(&dsi->lock); 4541 mutex_unlock(&dsi->lock);
4653} 4542}
4654EXPORT_SYMBOL(omapdss_dsi_display_disable);
4655 4543
4656int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) 4544static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
4657{ 4545{
4658 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 4546 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
4659 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 4547 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -4661,7 +4549,6 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
4661 dsi->te_enabled = enable; 4549 dsi->te_enabled = enable;
4662 return 0; 4550 return 0;
4663} 4551}
4664EXPORT_SYMBOL(omapdss_dsi_enable_te);
4665 4552
4666#ifdef PRINT_VERBOSE_VM_TIMINGS 4553#ifdef PRINT_VERBOSE_VM_TIMINGS
4667static void print_dsi_vm(const char *str, 4554static void print_dsi_vm(const char *str,
@@ -5136,7 +5023,7 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
5136 dsi_vm_calc_pll_cb, ctx); 5023 dsi_vm_calc_pll_cb, ctx);
5137} 5024}
5138 5025
5139int omapdss_dsi_set_config(struct omap_dss_device *dssdev, 5026static int dsi_set_config(struct omap_dss_device *dssdev,
5140 const struct omap_dss_dsi_config *config) 5027 const struct omap_dss_dsi_config *config)
5141{ 5028{
5142 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 5029 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
@@ -5184,7 +5071,6 @@ err:
5184 5071
5185 return r; 5072 return r;
5186} 5073}
5187EXPORT_SYMBOL(omapdss_dsi_set_config);
5188 5074
5189/* 5075/*
5190 * Return a hardcoded channel for the DSI output. This should work for 5076 * Return a hardcoded channel for the DSI output. This should work for
@@ -5235,7 +5121,7 @@ static enum omap_channel dsi_get_channel(int module_id)
5235 } 5121 }
5236} 5122}
5237 5123
5238int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel) 5124static int dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
5239{ 5125{
5240 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 5126 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
5241 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 5127 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -5252,9 +5138,8 @@ int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
5252 DSSERR("cannot get VC for display %s", dssdev->name); 5138 DSSERR("cannot get VC for display %s", dssdev->name);
5253 return -ENOSPC; 5139 return -ENOSPC;
5254} 5140}
5255EXPORT_SYMBOL(omap_dsi_request_vc);
5256 5141
5257int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id) 5142static int dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id)
5258{ 5143{
5259 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 5144 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
5260 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 5145 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -5279,9 +5164,8 @@ int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id)
5279 5164
5280 return 0; 5165 return 0;
5281} 5166}
5282EXPORT_SYMBOL(omap_dsi_set_vc_id);
5283 5167
5284void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel) 5168static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
5285{ 5169{
5286 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); 5170 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
5287 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); 5171 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -5292,7 +5176,6 @@ void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel)
5292 dsi->vc[channel].vc_id = 0; 5176 dsi->vc[channel].vc_id = 0;
5293 } 5177 }
5294} 5178}
5295EXPORT_SYMBOL(omap_dsi_release_vc);
5296 5179
5297void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev) 5180void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev)
5298{ 5181{
@@ -5348,79 +5231,6 @@ static int dsi_get_clocks(struct platform_device *dsidev)
5348 return 0; 5231 return 0;
5349} 5232}
5350 5233
5351static struct omap_dss_device *dsi_find_dssdev(struct platform_device *pdev)
5352{
5353 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
5354 struct dsi_data *dsi = dsi_get_dsidrv_data(pdev);
5355 const char *def_disp_name = omapdss_get_default_display_name();
5356 struct omap_dss_device *def_dssdev;
5357 int i;
5358
5359 def_dssdev = NULL;
5360
5361 for (i = 0; i < pdata->num_devices; ++i) {
5362 struct omap_dss_device *dssdev = pdata->devices[i];
5363
5364 if (dssdev->type != OMAP_DISPLAY_TYPE_DSI)
5365 continue;
5366
5367 if (dssdev->phy.dsi.module != dsi->module_id)
5368 continue;
5369
5370 if (def_dssdev == NULL)
5371 def_dssdev = dssdev;
5372
5373 if (def_disp_name != NULL &&
5374 strcmp(dssdev->name, def_disp_name) == 0) {
5375 def_dssdev = dssdev;
5376 break;
5377 }
5378 }
5379
5380 return def_dssdev;
5381}
5382
5383static int dsi_probe_pdata(struct platform_device *dsidev)
5384{
5385 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
5386 struct omap_dss_device *plat_dssdev;
5387 struct omap_dss_device *dssdev;
5388 int r;
5389
5390 plat_dssdev = dsi_find_dssdev(dsidev);
5391
5392 if (!plat_dssdev)
5393 return 0;
5394
5395 r = dsi_regulator_init(dsidev);
5396 if (r)
5397 return r;
5398
5399 dssdev = dss_alloc_and_init_device(&dsidev->dev);
5400 if (!dssdev)
5401 return -ENOMEM;
5402
5403 dss_copy_device_pdata(dssdev, plat_dssdev);
5404
5405 r = omapdss_output_set_device(&dsi->output, dssdev);
5406 if (r) {
5407 DSSERR("failed to connect output to new device: %s\n",
5408 dssdev->name);
5409 dss_put_device(dssdev);
5410 return r;
5411 }
5412
5413 r = dss_add_device(dssdev);
5414 if (r) {
5415 DSSERR("device %s register failed: %d\n", dssdev->name, r);
5416 omapdss_output_unset_device(&dsi->output);
5417 dss_put_device(dssdev);
5418 return r;
5419 }
5420
5421 return 0;
5422}
5423
5424static int dsi_connect(struct omap_dss_device *dssdev, 5234static int dsi_connect(struct omap_dss_device *dssdev,
5425 struct omap_dss_device *dst) 5235 struct omap_dss_device *dst)
5426{ 5236{
@@ -5454,9 +5264,9 @@ static int dsi_connect(struct omap_dss_device *dssdev,
5454static void dsi_disconnect(struct omap_dss_device *dssdev, 5264static void dsi_disconnect(struct omap_dss_device *dssdev,
5455 struct omap_dss_device *dst) 5265 struct omap_dss_device *dst)
5456{ 5266{
5457 WARN_ON(dst != dssdev->device); 5267 WARN_ON(dst != dssdev->dst);
5458 5268
5459 if (dst != dssdev->device) 5269 if (dst != dssdev->dst)
5460 return; 5270 return;
5461 5271
5462 omapdss_output_unset_device(dssdev); 5272 omapdss_output_unset_device(dssdev);
@@ -5472,24 +5282,24 @@ static const struct omapdss_dsi_ops dsi_ops = {
5472 .bus_lock = dsi_bus_lock, 5282 .bus_lock = dsi_bus_lock,
5473 .bus_unlock = dsi_bus_unlock, 5283 .bus_unlock = dsi_bus_unlock,
5474 5284
5475 .enable = omapdss_dsi_display_enable, 5285 .enable = dsi_display_enable,
5476 .disable = omapdss_dsi_display_disable, 5286 .disable = dsi_display_disable,
5477 5287
5478 .enable_hs = omapdss_dsi_vc_enable_hs, 5288 .enable_hs = dsi_vc_enable_hs,
5479 5289
5480 .configure_pins = omapdss_dsi_configure_pins, 5290 .configure_pins = dsi_configure_pins,
5481 .set_config = omapdss_dsi_set_config, 5291 .set_config = dsi_set_config,
5482 5292
5483 .enable_video_output = dsi_enable_video_output, 5293 .enable_video_output = dsi_enable_video_output,
5484 .disable_video_output = dsi_disable_video_output, 5294 .disable_video_output = dsi_disable_video_output,
5485 5295
5486 .update = omap_dsi_update, 5296 .update = dsi_update,
5487 5297
5488 .enable_te = omapdss_dsi_enable_te, 5298 .enable_te = dsi_enable_te,
5489 5299
5490 .request_vc = omap_dsi_request_vc, 5300 .request_vc = dsi_request_vc,
5491 .set_vc_id = omap_dsi_set_vc_id, 5301 .set_vc_id = dsi_set_vc_id,
5492 .release_vc = omap_dsi_release_vc, 5302 .release_vc = dsi_release_vc,
5493 5303
5494 .dcs_write = dsi_vc_dcs_write, 5304 .dcs_write = dsi_vc_dcs_write,
5495 .dcs_write_nosync = dsi_vc_dcs_write_nosync, 5305 .dcs_write_nosync = dsi_vc_dcs_write_nosync,
@@ -5627,12 +5437,6 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
5627 5437
5628 dsi_init_output(dsidev); 5438 dsi_init_output(dsidev);
5629 5439
5630 if (dsidev->dev.platform_data) {
5631 r = dsi_probe_pdata(dsidev);
5632 if (r)
5633 goto err_probe;
5634 }
5635
5636 dsi_runtime_put(dsidev); 5440 dsi_runtime_put(dsidev);
5637 5441
5638 if (dsi->module_id == 0) 5442 if (dsi->module_id == 0)
@@ -5648,9 +5452,6 @@ static int omap_dsihw_probe(struct platform_device *dsidev)
5648#endif 5452#endif
5649 return 0; 5453 return 0;
5650 5454
5651err_probe:
5652 dsi_runtime_put(dsidev);
5653 dsi_uninit_output(dsidev);
5654err_runtime_get: 5455err_runtime_get:
5655 pm_runtime_disable(&dsidev->dev); 5456 pm_runtime_disable(&dsidev->dev);
5656 return r; 5457 return r;
@@ -5662,8 +5463,6 @@ static int __exit omap_dsihw_remove(struct platform_device *dsidev)
5662 5463
5663 WARN_ON(dsi->scp_clk_refcount > 0); 5464 WARN_ON(dsi->scp_clk_refcount > 0);
5664 5465
5665 dss_unregister_child_devices(&dsidev->dev);
5666
5667 dsi_uninit_output(dsidev); 5466 dsi_uninit_output(dsidev);
5668 5467
5669 pm_runtime_disable(&dsidev->dev); 5468 pm_runtime_disable(&dsidev->dev);
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 50a2362ef8f8..e172531d196b 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -163,22 +163,11 @@ struct platform_device;
163 163
164/* core */ 164/* core */
165struct platform_device *dss_get_core_pdev(void); 165struct platform_device *dss_get_core_pdev(void);
166struct bus_type *dss_get_bus(void);
167struct regulator *dss_get_vdds_dsi(void);
168struct regulator *dss_get_vdds_sdi(void);
169int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask); 166int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
170void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask); 167void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
171int dss_set_min_bus_tput(struct device *dev, unsigned long tput); 168int dss_set_min_bus_tput(struct device *dev, unsigned long tput);
172int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)); 169int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *));
173 170
174struct omap_dss_device *dss_alloc_and_init_device(struct device *parent);
175int dss_add_device(struct omap_dss_device *dssdev);
176void dss_unregister_device(struct omap_dss_device *dssdev);
177void dss_unregister_child_devices(struct device *parent);
178void dss_put_device(struct omap_dss_device *dssdev);
179void dss_copy_device_pdata(struct omap_dss_device *dst,
180 const struct omap_dss_device *src);
181
182/* display */ 171/* display */
183int dss_suspend_all_devices(void); 172int dss_suspend_all_devices(void);
184int dss_resume_all_devices(void); 173int dss_resume_all_devices(void);
@@ -436,44 +425,10 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi,
436/* VENC */ 425/* VENC */
437int venc_init_platform_driver(void) __init; 426int venc_init_platform_driver(void) __init;
438void venc_uninit_platform_driver(void) __exit; 427void venc_uninit_platform_driver(void) __exit;
439int omapdss_venc_display_enable(struct omap_dss_device *dssdev);
440void omapdss_venc_display_disable(struct omap_dss_device *dssdev);
441void omapdss_venc_set_timings(struct omap_dss_device *dssdev,
442 struct omap_video_timings *timings);
443int omapdss_venc_check_timings(struct omap_dss_device *dssdev,
444 struct omap_video_timings *timings);
445u32 omapdss_venc_get_wss(struct omap_dss_device *dssdev);
446int omapdss_venc_set_wss(struct omap_dss_device *dssdev, u32 wss);
447void omapdss_venc_set_type(struct omap_dss_device *dssdev,
448 enum omap_dss_venc_type type);
449void omapdss_venc_invert_vid_out_polarity(struct omap_dss_device *dssdev,
450 bool invert_polarity);
451int venc_panel_init(void);
452void venc_panel_exit(void);
453 428
454/* HDMI */ 429/* HDMI */
455int hdmi_init_platform_driver(void) __init; 430int hdmi_init_platform_driver(void) __init;
456void hdmi_uninit_platform_driver(void) __exit; 431void hdmi_uninit_platform_driver(void) __exit;
457int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev);
458void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev);
459int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev);
460void omapdss_hdmi_core_disable(struct omap_dss_device *dssdev);
461void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev,
462 struct omap_video_timings *timings);
463int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
464 struct omap_video_timings *timings);
465int omapdss_hdmi_read_edid(u8 *buf, int len);
466bool omapdss_hdmi_detect(void);
467int hdmi_panel_init(void);
468void hdmi_panel_exit(void);
469#ifdef CONFIG_OMAP4_DSS_HDMI_AUDIO
470int hdmi_audio_enable(void);
471void hdmi_audio_disable(void);
472int hdmi_audio_start(void);
473void hdmi_audio_stop(void);
474bool hdmi_mode_has_audio(void);
475int hdmi_audio_config(struct omap_dss_audio *audio);
476#endif
477 432
478/* RFBI */ 433/* RFBI */
479int rfbi_init_platform_driver(void) __init; 434int rfbi_init_platform_driver(void) __init;
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 44a885b92825..75f3c740ef8c 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -66,10 +66,6 @@ static struct {
66 struct clk *sys_clk; 66 struct clk *sys_clk;
67 struct regulator *vdda_hdmi_dac_reg; 67 struct regulator *vdda_hdmi_dac_reg;
68 68
69 int ct_cp_hpd_gpio;
70 int ls_oe_gpio;
71 int hpd_gpio;
72
73 bool core_enabled; 69 bool core_enabled;
74 70
75 struct omap_dss_device output; 71 struct omap_dss_device output;
@@ -353,40 +349,6 @@ static int hdmi_init_regulator(void)
353 return 0; 349 return 0;
354} 350}
355 351
356static int hdmi_init_display(struct omap_dss_device *dssdev)
357{
358 int r;
359
360 struct gpio gpios[] = {
361 { hdmi.ct_cp_hpd_gpio, GPIOF_OUT_INIT_LOW, "hdmi_ct_cp_hpd" },
362 { hdmi.ls_oe_gpio, GPIOF_OUT_INIT_LOW, "hdmi_ls_oe" },
363 { hdmi.hpd_gpio, GPIOF_DIR_IN, "hdmi_hpd" },
364 };
365
366 DSSDBG("init_display\n");
367
368 dss_init_hdmi_ip_ops(&hdmi.ip_data, omapdss_get_version());
369
370 r = hdmi_init_regulator();
371 if (r)
372 return r;
373
374 r = gpio_request_array(gpios, ARRAY_SIZE(gpios));
375 if (r)
376 return r;
377
378 return 0;
379}
380
381static void hdmi_uninit_display(struct omap_dss_device *dssdev)
382{
383 DSSDBG("uninit_display\n");
384
385 gpio_free(hdmi.ct_cp_hpd_gpio);
386 gpio_free(hdmi.ls_oe_gpio);
387 gpio_free(hdmi.hpd_gpio);
388}
389
390static const struct hdmi_config *hdmi_find_timing( 352static const struct hdmi_config *hdmi_find_timing(
391 const struct hdmi_config *timings_arr, 353 const struct hdmi_config *timings_arr,
392 int len) 354 int len)
@@ -517,17 +479,9 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev)
517{ 479{
518 int r; 480 int r;
519 481
520 if (gpio_is_valid(hdmi.ct_cp_hpd_gpio))
521 gpio_set_value(hdmi.ct_cp_hpd_gpio, 1);
522 if (gpio_is_valid(hdmi.ls_oe_gpio))
523 gpio_set_value(hdmi.ls_oe_gpio, 1);
524
525 /* wait 300us after CT_CP_HPD for the 5V power output to reach 90% */
526 udelay(300);
527
528 r = regulator_enable(hdmi.vdda_hdmi_dac_reg); 482 r = regulator_enable(hdmi.vdda_hdmi_dac_reg);
529 if (r) 483 if (r)
530 goto err_vdac_enable; 484 return r;
531 485
532 r = hdmi_runtime_get(); 486 r = hdmi_runtime_get();
533 if (r) 487 if (r)
@@ -542,11 +496,7 @@ static int hdmi_power_on_core(struct omap_dss_device *dssdev)
542 496
543err_runtime_get: 497err_runtime_get:
544 regulator_disable(hdmi.vdda_hdmi_dac_reg); 498 regulator_disable(hdmi.vdda_hdmi_dac_reg);
545err_vdac_enable: 499
546 if (gpio_is_valid(hdmi.ct_cp_hpd_gpio))
547 gpio_set_value(hdmi.ct_cp_hpd_gpio, 0);
548 if (gpio_is_valid(hdmi.ls_oe_gpio))
549 gpio_set_value(hdmi.ls_oe_gpio, 0);
550 return r; 500 return r;
551} 501}
552 502
@@ -556,10 +506,6 @@ static void hdmi_power_off_core(struct omap_dss_device *dssdev)
556 506
557 hdmi_runtime_put(); 507 hdmi_runtime_put();
558 regulator_disable(hdmi.vdda_hdmi_dac_reg); 508 regulator_disable(hdmi.vdda_hdmi_dac_reg);
559 if (gpio_is_valid(hdmi.ct_cp_hpd_gpio))
560 gpio_set_value(hdmi.ct_cp_hpd_gpio, 0);
561 if (gpio_is_valid(hdmi.ls_oe_gpio))
562 gpio_set_value(hdmi.ls_oe_gpio, 0);
563} 509}
564 510
565static int hdmi_power_on_full(struct omap_dss_device *dssdev) 511static int hdmi_power_on_full(struct omap_dss_device *dssdev)
@@ -640,7 +586,7 @@ static void hdmi_power_off_full(struct omap_dss_device *dssdev)
640 hdmi_power_off_core(dssdev); 586 hdmi_power_off_core(dssdev);
641} 587}
642 588
643int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev, 589static int hdmi_display_check_timing(struct omap_dss_device *dssdev,
644 struct omap_video_timings *timings) 590 struct omap_video_timings *timings)
645{ 591{
646 struct hdmi_cm cm; 592 struct hdmi_cm cm;
@@ -654,7 +600,7 @@ int omapdss_hdmi_display_check_timing(struct omap_dss_device *dssdev,
654 600
655} 601}
656 602
657void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev, 603static void hdmi_display_set_timing(struct omap_dss_device *dssdev,
658 struct omap_video_timings *timings) 604 struct omap_video_timings *timings)
659{ 605{
660 struct hdmi_cm cm; 606 struct hdmi_cm cm;
@@ -674,7 +620,7 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev,
674 mutex_unlock(&hdmi.lock); 620 mutex_unlock(&hdmi.lock);
675} 621}
676 622
677static void omapdss_hdmi_display_get_timings(struct omap_dss_device *dssdev, 623static void hdmi_display_get_timings(struct omap_dss_device *dssdev,
678 struct omap_video_timings *timings) 624 struct omap_video_timings *timings)
679{ 625{
680 const struct hdmi_config *cfg; 626 const struct hdmi_config *cfg;
@@ -704,7 +650,7 @@ static void hdmi_dump_regs(struct seq_file *s)
704 mutex_unlock(&hdmi.lock); 650 mutex_unlock(&hdmi.lock);
705} 651}
706 652
707int omapdss_hdmi_read_edid(u8 *buf, int len) 653static int read_edid(u8 *buf, int len)
708{ 654{
709 int r; 655 int r;
710 656
@@ -721,24 +667,7 @@ int omapdss_hdmi_read_edid(u8 *buf, int len)
721 return r; 667 return r;
722} 668}
723 669
724bool omapdss_hdmi_detect(void) 670static int hdmi_display_enable(struct omap_dss_device *dssdev)
725{
726 int r;
727
728 mutex_lock(&hdmi.lock);
729
730 r = hdmi_runtime_get();
731 BUG_ON(r);
732
733 r = gpio_get_value(hdmi.hpd_gpio);
734
735 hdmi_runtime_put();
736 mutex_unlock(&hdmi.lock);
737
738 return r == 1;
739}
740
741int omapdss_hdmi_display_enable(struct omap_dss_device *dssdev)
742{ 671{
743 struct omap_dss_device *out = &hdmi.output; 672 struct omap_dss_device *out = &hdmi.output;
744 int r = 0; 673 int r = 0;
@@ -767,7 +696,7 @@ err0:
767 return r; 696 return r;
768} 697}
769 698
770void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev) 699static void hdmi_display_disable(struct omap_dss_device *dssdev)
771{ 700{
772 DSSDBG("Enter hdmi_display_disable\n"); 701 DSSDBG("Enter hdmi_display_disable\n");
773 702
@@ -778,7 +707,7 @@ void omapdss_hdmi_display_disable(struct omap_dss_device *dssdev)
778 mutex_unlock(&hdmi.lock); 707 mutex_unlock(&hdmi.lock);
779} 708}
780 709
781int omapdss_hdmi_core_enable(struct omap_dss_device *dssdev) 710static int hdmi_core_enable(struct omap_dss_device *dssdev)
782{ 711{
783 int r = 0; 712 int r = 0;
784 713
@@ -800,7 +729,7 @@ err0:
800 return r; 729 return r;
801} 730}
802 731
803void omapdss_hdmi_core_disable(struct omap_dss_device *dssdev) 732static void hdmi_core_disable(struct omap_dss_device *dssdev)
804{ 733{
805 DSSDBG("Enter omapdss_hdmi_core_disable\n"); 734 DSSDBG("Enter omapdss_hdmi_core_disable\n");
806 735
@@ -927,35 +856,7 @@ int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts)
927 return 0; 856 return 0;
928} 857}
929 858
930int hdmi_audio_enable(void) 859static bool hdmi_mode_has_audio(void)
931{
932 DSSDBG("audio_enable\n");
933
934 return hdmi.ip_data.ops->audio_enable(&hdmi.ip_data);
935}
936
937void hdmi_audio_disable(void)
938{
939 DSSDBG("audio_disable\n");
940
941 hdmi.ip_data.ops->audio_disable(&hdmi.ip_data);
942}
943
944int hdmi_audio_start(void)
945{
946 DSSDBG("audio_start\n");
947
948 return hdmi.ip_data.ops->audio_start(&hdmi.ip_data);
949}
950
951void hdmi_audio_stop(void)
952{
953 DSSDBG("audio_stop\n");
954
955 hdmi.ip_data.ops->audio_stop(&hdmi.ip_data);
956}
957
958bool hdmi_mode_has_audio(void)
959{ 860{
960 if (hdmi.ip_data.cfg.cm.mode == HDMI_HDMI) 861 if (hdmi.ip_data.cfg.cm.mode == HDMI_HDMI)
961 return true; 862 return true;
@@ -963,92 +864,8 @@ bool hdmi_mode_has_audio(void)
963 return false; 864 return false;
964} 865}
965 866
966int hdmi_audio_config(struct omap_dss_audio *audio)
967{
968 return hdmi.ip_data.ops->audio_config(&hdmi.ip_data, audio);
969}
970
971#endif 867#endif
972 868
973static struct omap_dss_device *hdmi_find_dssdev(struct platform_device *pdev)
974{
975 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
976 const char *def_disp_name = omapdss_get_default_display_name();
977 struct omap_dss_device *def_dssdev;
978 int i;
979
980 def_dssdev = NULL;
981
982 for (i = 0; i < pdata->num_devices; ++i) {
983 struct omap_dss_device *dssdev = pdata->devices[i];
984
985 if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI)
986 continue;
987
988 if (def_dssdev == NULL)
989 def_dssdev = dssdev;
990
991 if (def_disp_name != NULL &&
992 strcmp(dssdev->name, def_disp_name) == 0) {
993 def_dssdev = dssdev;
994 break;
995 }
996 }
997
998 return def_dssdev;
999}
1000
1001static int hdmi_probe_pdata(struct platform_device *pdev)
1002{
1003 struct omap_dss_device *plat_dssdev;
1004 struct omap_dss_device *dssdev;
1005 struct omap_dss_hdmi_data *priv;
1006 int r;
1007
1008 plat_dssdev = hdmi_find_dssdev(pdev);
1009
1010 if (!plat_dssdev)
1011 return 0;
1012
1013 dssdev = dss_alloc_and_init_device(&pdev->dev);
1014 if (!dssdev)
1015 return -ENOMEM;
1016
1017 dss_copy_device_pdata(dssdev, plat_dssdev);
1018
1019 priv = dssdev->data;
1020
1021 hdmi.ct_cp_hpd_gpio = priv->ct_cp_hpd_gpio;
1022 hdmi.ls_oe_gpio = priv->ls_oe_gpio;
1023 hdmi.hpd_gpio = priv->hpd_gpio;
1024
1025 r = hdmi_init_display(dssdev);
1026 if (r) {
1027 DSSERR("device %s init failed: %d\n", dssdev->name, r);
1028 dss_put_device(dssdev);
1029 return r;
1030 }
1031
1032 r = omapdss_output_set_device(&hdmi.output, dssdev);
1033 if (r) {
1034 DSSERR("failed to connect output to new device: %s\n",
1035 dssdev->name);
1036 dss_put_device(dssdev);
1037 return r;
1038 }
1039
1040 r = dss_add_device(dssdev);
1041 if (r) {
1042 DSSERR("device %s register failed: %d\n", dssdev->name, r);
1043 omapdss_output_unset_device(&hdmi.output);
1044 hdmi_uninit_display(dssdev);
1045 dss_put_device(dssdev);
1046 return r;
1047 }
1048
1049 return 0;
1050}
1051
1052static int hdmi_connect(struct omap_dss_device *dssdev, 869static int hdmi_connect(struct omap_dss_device *dssdev,
1053 struct omap_dss_device *dst) 870 struct omap_dss_device *dst)
1054{ 871{
@@ -1083,9 +900,9 @@ static int hdmi_connect(struct omap_dss_device *dssdev,
1083static void hdmi_disconnect(struct omap_dss_device *dssdev, 900static void hdmi_disconnect(struct omap_dss_device *dssdev,
1084 struct omap_dss_device *dst) 901 struct omap_dss_device *dst)
1085{ 902{
1086 WARN_ON(dst != dssdev->device); 903 WARN_ON(dst != dssdev->dst);
1087 904
1088 if (dst != dssdev->device) 905 if (dst != dssdev->dst)
1089 return; 906 return;
1090 907
1091 omapdss_output_unset_device(dssdev); 908 omapdss_output_unset_device(dssdev);
@@ -1103,21 +920,21 @@ static int hdmi_read_edid(struct omap_dss_device *dssdev,
1103 need_enable = hdmi.core_enabled == false; 920 need_enable = hdmi.core_enabled == false;
1104 921
1105 if (need_enable) { 922 if (need_enable) {
1106 r = omapdss_hdmi_core_enable(dssdev); 923 r = hdmi_core_enable(dssdev);
1107 if (r) 924 if (r)
1108 return r; 925 return r;
1109 } 926 }
1110 927
1111 r = omapdss_hdmi_read_edid(edid, len); 928 r = read_edid(edid, len);
1112 929
1113 if (need_enable) 930 if (need_enable)
1114 omapdss_hdmi_core_disable(dssdev); 931 hdmi_core_disable(dssdev);
1115 932
1116 return r; 933 return r;
1117} 934}
1118 935
1119#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) 936#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
1120static int omapdss_hdmi_audio_enable(struct omap_dss_device *dssdev) 937static int hdmi_audio_enable(struct omap_dss_device *dssdev)
1121{ 938{
1122 int r; 939 int r;
1123 940
@@ -1128,7 +945,8 @@ static int omapdss_hdmi_audio_enable(struct omap_dss_device *dssdev)
1128 goto err; 945 goto err;
1129 } 946 }
1130 947
1131 r = hdmi_audio_enable(); 948
949 r = hdmi.ip_data.ops->audio_enable(&hdmi.ip_data);
1132 if (r) 950 if (r)
1133 goto err; 951 goto err;
1134 952
@@ -1140,22 +958,22 @@ err:
1140 return r; 958 return r;
1141} 959}
1142 960
1143static void omapdss_hdmi_audio_disable(struct omap_dss_device *dssdev) 961static void hdmi_audio_disable(struct omap_dss_device *dssdev)
1144{ 962{
1145 hdmi_audio_disable(); 963 hdmi.ip_data.ops->audio_disable(&hdmi.ip_data);
1146} 964}
1147 965
1148static int omapdss_hdmi_audio_start(struct omap_dss_device *dssdev) 966static int hdmi_audio_start(struct omap_dss_device *dssdev)
1149{ 967{
1150 return hdmi_audio_start(); 968 return hdmi.ip_data.ops->audio_start(&hdmi.ip_data);
1151} 969}
1152 970
1153static void omapdss_hdmi_audio_stop(struct omap_dss_device *dssdev) 971static void hdmi_audio_stop(struct omap_dss_device *dssdev)
1154{ 972{
1155 hdmi_audio_stop(); 973 hdmi.ip_data.ops->audio_stop(&hdmi.ip_data);
1156} 974}
1157 975
1158static bool omapdss_hdmi_audio_supported(struct omap_dss_device *dssdev) 976static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
1159{ 977{
1160 bool r; 978 bool r;
1161 979
@@ -1167,7 +985,7 @@ static bool omapdss_hdmi_audio_supported(struct omap_dss_device *dssdev)
1167 return r; 985 return r;
1168} 986}
1169 987
1170static int omapdss_hdmi_audio_config(struct omap_dss_device *dssdev, 988static int hdmi_audio_config(struct omap_dss_device *dssdev,
1171 struct omap_dss_audio *audio) 989 struct omap_dss_audio *audio)
1172{ 990{
1173 int r; 991 int r;
@@ -1179,7 +997,7 @@ static int omapdss_hdmi_audio_config(struct omap_dss_device *dssdev,
1179 goto err; 997 goto err;
1180 } 998 }
1181 999
1182 r = hdmi_audio_config(audio); 1000 r = hdmi.ip_data.ops->audio_config(&hdmi.ip_data, audio);
1183 if (r) 1001 if (r)
1184 goto err; 1002 goto err;
1185 1003
@@ -1191,30 +1009,30 @@ err:
1191 return r; 1009 return r;
1192} 1010}
1193#else 1011#else
1194static int omapdss_hdmi_audio_enable(struct omap_dss_device *dssdev) 1012static int hdmi_audio_enable(struct omap_dss_device *dssdev)
1195{ 1013{
1196 return -EPERM; 1014 return -EPERM;
1197} 1015}
1198 1016
1199static void omapdss_hdmi_audio_disable(struct omap_dss_device *dssdev) 1017static void hdmi_audio_disable(struct omap_dss_device *dssdev)
1200{ 1018{
1201} 1019}
1202 1020
1203static int omapdss_hdmi_audio_start(struct omap_dss_device *dssdev) 1021static int hdmi_audio_start(struct omap_dss_device *dssdev)
1204{ 1022{
1205 return -EPERM; 1023 return -EPERM;
1206} 1024}
1207 1025
1208static void omapdss_hdmi_audio_stop(struct omap_dss_device *dssdev) 1026static void hdmi_audio_stop(struct omap_dss_device *dssdev)
1209{ 1027{
1210} 1028}
1211 1029
1212static bool omapdss_hdmi_audio_supported(struct omap_dss_device *dssdev) 1030static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
1213{ 1031{
1214 return false; 1032 return false;
1215} 1033}
1216 1034
1217static int omapdss_hdmi_audio_config(struct omap_dss_device *dssdev, 1035static int hdmi_audio_config(struct omap_dss_device *dssdev,
1218 struct omap_dss_audio *audio) 1036 struct omap_dss_audio *audio)
1219{ 1037{
1220 return -EPERM; 1038 return -EPERM;
@@ -1225,21 +1043,21 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
1225 .connect = hdmi_connect, 1043 .connect = hdmi_connect,
1226 .disconnect = hdmi_disconnect, 1044 .disconnect = hdmi_disconnect,
1227 1045
1228 .enable = omapdss_hdmi_display_enable, 1046 .enable = hdmi_display_enable,
1229 .disable = omapdss_hdmi_display_disable, 1047 .disable = hdmi_display_disable,
1230 1048
1231 .check_timings = omapdss_hdmi_display_check_timing, 1049 .check_timings = hdmi_display_check_timing,
1232 .set_timings = omapdss_hdmi_display_set_timing, 1050 .set_timings = hdmi_display_set_timing,
1233 .get_timings = omapdss_hdmi_display_get_timings, 1051 .get_timings = hdmi_display_get_timings,
1234 1052
1235 .read_edid = hdmi_read_edid, 1053 .read_edid = hdmi_read_edid,
1236 1054
1237 .audio_enable = omapdss_hdmi_audio_enable, 1055 .audio_enable = hdmi_audio_enable,
1238 .audio_disable = omapdss_hdmi_audio_disable, 1056 .audio_disable = hdmi_audio_disable,
1239 .audio_start = omapdss_hdmi_audio_start, 1057 .audio_start = hdmi_audio_start,
1240 .audio_stop = omapdss_hdmi_audio_stop, 1058 .audio_stop = hdmi_audio_stop,
1241 .audio_supported = omapdss_hdmi_audio_supported, 1059 .audio_supported = hdmi_audio_supported,
1242 .audio_config = omapdss_hdmi_audio_config, 1060 .audio_config = hdmi_audio_config,
1243}; 1061};
1244 1062
1245static void hdmi_init_output(struct platform_device *pdev) 1063static void hdmi_init_output(struct platform_device *pdev)
@@ -1301,50 +1119,15 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev)
1301 hdmi.ip_data.pll_offset = HDMI_PLLCTRL; 1119 hdmi.ip_data.pll_offset = HDMI_PLLCTRL;
1302 hdmi.ip_data.phy_offset = HDMI_PHY; 1120 hdmi.ip_data.phy_offset = HDMI_PHY;
1303 1121
1304 hdmi.ct_cp_hpd_gpio = -1;
1305 hdmi.ls_oe_gpio = -1;
1306 hdmi.hpd_gpio = -1;
1307
1308 hdmi_init_output(pdev); 1122 hdmi_init_output(pdev);
1309 1123
1310 r = hdmi_panel_init();
1311 if (r) {
1312 DSSERR("can't init panel\n");
1313 return r;
1314 }
1315
1316 dss_debugfs_create_file("hdmi", hdmi_dump_regs); 1124 dss_debugfs_create_file("hdmi", hdmi_dump_regs);
1317 1125
1318 if (pdev->dev.platform_data) {
1319 r = hdmi_probe_pdata(pdev);
1320 if (r)
1321 goto err_probe;
1322 }
1323
1324 return 0;
1325
1326err_probe:
1327 hdmi_panel_exit();
1328 hdmi_uninit_output(pdev);
1329 pm_runtime_disable(&pdev->dev);
1330 return r;
1331}
1332
1333static int __exit hdmi_remove_child(struct device *dev, void *data)
1334{
1335 struct omap_dss_device *dssdev = to_dss_device(dev);
1336 hdmi_uninit_display(dssdev);
1337 return 0; 1126 return 0;
1338} 1127}
1339 1128
1340static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) 1129static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
1341{ 1130{
1342 device_for_each_child(&pdev->dev, NULL, hdmi_remove_child);
1343
1344 dss_unregister_child_devices(&pdev->dev);
1345
1346 hdmi_panel_exit();
1347
1348 hdmi_uninit_output(pdev); 1131 hdmi_uninit_output(pdev);
1349 1132
1350 pm_runtime_disable(&pdev->dev); 1133 pm_runtime_disable(&pdev->dev);
diff --git a/drivers/video/omap2/dss/hdmi_panel.c b/drivers/video/omap2/dss/hdmi_panel.c
deleted file mode 100644
index dfb8eda81b61..000000000000
--- a/drivers/video/omap2/dss/hdmi_panel.c
+++ /dev/null
@@ -1,414 +0,0 @@
1/*
2 * hdmi_panel.c
3 *
4 * HDMI library support functions for TI OMAP4 processors.
5 *
6 * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
7 * Authors: Mythri P k <mythripk@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
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/kernel.h>
23#include <linux/err.h>
24#include <linux/io.h>
25#include <linux/mutex.h>
26#include <linux/module.h>
27#include <video/omapdss.h>
28#include <linux/slab.h>
29
30#include "dss.h"
31
32static struct {
33 /* This protects the panel ops, mainly when accessing the HDMI IP. */
34 struct mutex lock;
35#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
36 /* This protects the audio ops, specifically. */
37 spinlock_t audio_lock;
38#endif
39} hdmi;
40
41
42static int hdmi_panel_probe(struct omap_dss_device *dssdev)
43{
44 /* Initialize default timings to VGA in DVI mode */
45 const struct omap_video_timings default_timings = {
46 .x_res = 640,
47 .y_res = 480,
48 .pixel_clock = 25175,
49 .hsw = 96,
50 .hfp = 16,
51 .hbp = 48,
52 .vsw = 2,
53 .vfp = 11,
54 .vbp = 31,
55
56 .vsync_level = OMAPDSS_SIG_ACTIVE_LOW,
57 .hsync_level = OMAPDSS_SIG_ACTIVE_LOW,
58
59 .interlace = false,
60 };
61
62 DSSDBG("ENTER hdmi_panel_probe\n");
63
64 dssdev->panel.timings = default_timings;
65
66 DSSDBG("hdmi_panel_probe x_res= %d y_res = %d\n",
67 dssdev->panel.timings.x_res,
68 dssdev->panel.timings.y_res);
69
70 omapdss_hdmi_display_set_timing(dssdev, &dssdev->panel.timings);
71
72 return 0;
73}
74
75static void hdmi_panel_remove(struct omap_dss_device *dssdev)
76{
77
78}
79
80#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
81static int hdmi_panel_audio_enable(struct omap_dss_device *dssdev)
82{
83 unsigned long flags;
84 int r;
85
86 mutex_lock(&hdmi.lock);
87 spin_lock_irqsave(&hdmi.audio_lock, flags);
88
89 /* enable audio only if the display is active and supports audio */
90 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE ||
91 !hdmi_mode_has_audio()) {
92 DSSERR("audio not supported or display is off\n");
93 r = -EPERM;
94 goto err;
95 }
96
97 r = hdmi_audio_enable();
98
99 if (!r)
100 dssdev->audio_state = OMAP_DSS_AUDIO_ENABLED;
101
102err:
103 spin_unlock_irqrestore(&hdmi.audio_lock, flags);
104 mutex_unlock(&hdmi.lock);
105 return r;
106}
107
108static void hdmi_panel_audio_disable(struct omap_dss_device *dssdev)
109{
110 unsigned long flags;
111
112 spin_lock_irqsave(&hdmi.audio_lock, flags);
113
114 hdmi_audio_disable();
115
116 dssdev->audio_state = OMAP_DSS_AUDIO_DISABLED;
117
118 spin_unlock_irqrestore(&hdmi.audio_lock, flags);
119}
120
121static int hdmi_panel_audio_start(struct omap_dss_device *dssdev)
122{
123 unsigned long flags;
124 int r;
125
126 spin_lock_irqsave(&hdmi.audio_lock, flags);
127 /*
128 * No need to check the panel state. It was checked when trasitioning
129 * to AUDIO_ENABLED.
130 */
131 if (dssdev->audio_state != OMAP_DSS_AUDIO_ENABLED) {
132 DSSERR("audio start from invalid state\n");
133 r = -EPERM;
134 goto err;
135 }
136
137 r = hdmi_audio_start();
138
139 if (!r)
140 dssdev->audio_state = OMAP_DSS_AUDIO_PLAYING;
141
142err:
143 spin_unlock_irqrestore(&hdmi.audio_lock, flags);
144 return r;
145}
146
147static void hdmi_panel_audio_stop(struct omap_dss_device *dssdev)
148{
149 unsigned long flags;
150
151 spin_lock_irqsave(&hdmi.audio_lock, flags);
152
153 hdmi_audio_stop();
154 dssdev->audio_state = OMAP_DSS_AUDIO_ENABLED;
155
156 spin_unlock_irqrestore(&hdmi.audio_lock, flags);
157}
158
159static bool hdmi_panel_audio_supported(struct omap_dss_device *dssdev)
160{
161 bool r = false;
162
163 mutex_lock(&hdmi.lock);
164
165 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
166 goto err;
167
168 if (!hdmi_mode_has_audio())
169 goto err;
170
171 r = true;
172err:
173 mutex_unlock(&hdmi.lock);
174 return r;
175}
176
177static int hdmi_panel_audio_config(struct omap_dss_device *dssdev,
178 struct omap_dss_audio *audio)
179{
180 unsigned long flags;
181 int r;
182
183 mutex_lock(&hdmi.lock);
184 spin_lock_irqsave(&hdmi.audio_lock, flags);
185
186 /* config audio only if the display is active and supports audio */
187 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE ||
188 !hdmi_mode_has_audio()) {
189 DSSERR("audio not supported or display is off\n");
190 r = -EPERM;
191 goto err;
192 }
193
194 r = hdmi_audio_config(audio);
195
196 if (!r)
197 dssdev->audio_state = OMAP_DSS_AUDIO_CONFIGURED;
198
199err:
200 spin_unlock_irqrestore(&hdmi.audio_lock, flags);
201 mutex_unlock(&hdmi.lock);
202 return r;
203}
204
205#else
206static int hdmi_panel_audio_enable(struct omap_dss_device *dssdev)
207{
208 return -EPERM;
209}
210
211static void hdmi_panel_audio_disable(struct omap_dss_device *dssdev)
212{
213}
214
215static int hdmi_panel_audio_start(struct omap_dss_device *dssdev)
216{
217 return -EPERM;
218}
219
220static void hdmi_panel_audio_stop(struct omap_dss_device *dssdev)
221{
222}
223
224static bool hdmi_panel_audio_supported(struct omap_dss_device *dssdev)
225{
226 return false;
227}
228
229static int hdmi_panel_audio_config(struct omap_dss_device *dssdev,
230 struct omap_dss_audio *audio)
231{
232 return -EPERM;
233}
234#endif
235
236static int hdmi_panel_enable(struct omap_dss_device *dssdev)
237{
238 int r = 0;
239 DSSDBG("ENTER hdmi_panel_enable\n");
240
241 mutex_lock(&hdmi.lock);
242
243 if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
244 r = -EINVAL;
245 goto err;
246 }
247
248 omapdss_hdmi_display_set_timing(dssdev, &dssdev->panel.timings);
249
250 r = omapdss_hdmi_display_enable(dssdev);
251 if (r) {
252 DSSERR("failed to power on\n");
253 goto err;
254 }
255
256 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
257
258err:
259 mutex_unlock(&hdmi.lock);
260
261 return r;
262}
263
264static void hdmi_panel_disable(struct omap_dss_device *dssdev)
265{
266 mutex_lock(&hdmi.lock);
267
268 if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) {
269 /*
270 * TODO: notify audio users that the display was disabled. For
271 * now, disable audio locally to not break our audio state
272 * machine.
273 */
274 hdmi_panel_audio_disable(dssdev);
275 omapdss_hdmi_display_disable(dssdev);
276 }
277
278 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
279
280 mutex_unlock(&hdmi.lock);
281}
282
283static void hdmi_get_timings(struct omap_dss_device *dssdev,
284 struct omap_video_timings *timings)
285{
286 mutex_lock(&hdmi.lock);
287
288 *timings = dssdev->panel.timings;
289
290 mutex_unlock(&hdmi.lock);
291}
292
293static void hdmi_set_timings(struct omap_dss_device *dssdev,
294 struct omap_video_timings *timings)
295{
296 DSSDBG("hdmi_set_timings\n");
297
298 mutex_lock(&hdmi.lock);
299
300 /*
301 * TODO: notify audio users that there was a timings change. For
302 * now, disable audio locally to not break our audio state machine.
303 */
304 hdmi_panel_audio_disable(dssdev);
305
306 omapdss_hdmi_display_set_timing(dssdev, timings);
307 dssdev->panel.timings = *timings;
308
309 mutex_unlock(&hdmi.lock);
310}
311
312static int hdmi_check_timings(struct omap_dss_device *dssdev,
313 struct omap_video_timings *timings)
314{
315 int r = 0;
316
317 DSSDBG("hdmi_check_timings\n");
318
319 mutex_lock(&hdmi.lock);
320
321 r = omapdss_hdmi_display_check_timing(dssdev, timings);
322
323 mutex_unlock(&hdmi.lock);
324 return r;
325}
326
327static int hdmi_read_edid(struct omap_dss_device *dssdev, u8 *buf, int len)
328{
329 int r;
330 bool need_enable;
331
332 mutex_lock(&hdmi.lock);
333
334 need_enable = dssdev->state == OMAP_DSS_DISPLAY_DISABLED;
335
336 if (need_enable) {
337 r = omapdss_hdmi_core_enable(dssdev);
338 if (r)
339 goto err;
340 }
341
342 r = omapdss_hdmi_read_edid(buf, len);
343
344 if (need_enable)
345 omapdss_hdmi_core_disable(dssdev);
346err:
347 mutex_unlock(&hdmi.lock);
348
349 return r;
350}
351
352static bool hdmi_detect(struct omap_dss_device *dssdev)
353{
354 int r;
355 bool need_enable;
356
357 mutex_lock(&hdmi.lock);
358
359 need_enable = dssdev->state == OMAP_DSS_DISPLAY_DISABLED;
360
361 if (need_enable) {
362 r = omapdss_hdmi_core_enable(dssdev);
363 if (r)
364 goto err;
365 }
366
367 r = omapdss_hdmi_detect();
368
369 if (need_enable)
370 omapdss_hdmi_core_disable(dssdev);
371err:
372 mutex_unlock(&hdmi.lock);
373
374 return r;
375}
376
377static struct omap_dss_driver hdmi_driver = {
378 .probe = hdmi_panel_probe,
379 .remove = hdmi_panel_remove,
380 .enable = hdmi_panel_enable,
381 .disable = hdmi_panel_disable,
382 .get_timings = hdmi_get_timings,
383 .set_timings = hdmi_set_timings,
384 .check_timings = hdmi_check_timings,
385 .read_edid = hdmi_read_edid,
386 .detect = hdmi_detect,
387 .audio_enable = hdmi_panel_audio_enable,
388 .audio_disable = hdmi_panel_audio_disable,
389 .audio_start = hdmi_panel_audio_start,
390 .audio_stop = hdmi_panel_audio_stop,
391 .audio_supported = hdmi_panel_audio_supported,
392 .audio_config = hdmi_panel_audio_config,
393 .driver = {
394 .name = "hdmi_panel",
395 .owner = THIS_MODULE,
396 },
397};
398
399int hdmi_panel_init(void)
400{
401 mutex_init(&hdmi.lock);
402
403#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
404 spin_lock_init(&hdmi.audio_lock);
405#endif
406
407 return omap_dss_register_driver(&hdmi_driver);
408}
409
410void hdmi_panel_exit(void)
411{
412 omap_dss_unregister_driver(&hdmi_driver);
413
414}
diff --git a/drivers/video/omap2/dss/output.c b/drivers/video/omap2/dss/output.c
index 3f5c0a758b32..2ab3afa615e8 100644
--- a/drivers/video/omap2/dss/output.c
+++ b/drivers/video/omap2/dss/output.c
@@ -34,9 +34,9 @@ int omapdss_output_set_device(struct omap_dss_device *out,
34 34
35 mutex_lock(&output_lock); 35 mutex_lock(&output_lock);
36 36
37 if (out->device) { 37 if (out->dst) {
38 DSSERR("output already has device %s connected to it\n", 38 DSSERR("output already has device %s connected to it\n",
39 out->device->name); 39 out->dst->name);
40 r = -EINVAL; 40 r = -EINVAL;
41 goto err; 41 goto err;
42 } 42 }
@@ -47,8 +47,8 @@ int omapdss_output_set_device(struct omap_dss_device *out,
47 goto err; 47 goto err;
48 } 48 }
49 49
50 out->device = dssdev; 50 out->dst = dssdev;
51 dssdev->output = out; 51 dssdev->src = out;
52 52
53 mutex_unlock(&output_lock); 53 mutex_unlock(&output_lock);
54 54
@@ -66,21 +66,21 @@ int omapdss_output_unset_device(struct omap_dss_device *out)
66 66
67 mutex_lock(&output_lock); 67 mutex_lock(&output_lock);
68 68
69 if (!out->device) { 69 if (!out->dst) {
70 DSSERR("output doesn't have a device connected to it\n"); 70 DSSERR("output doesn't have a device connected to it\n");
71 r = -EINVAL; 71 r = -EINVAL;
72 goto err; 72 goto err;
73 } 73 }
74 74
75 if (out->device->state != OMAP_DSS_DISPLAY_DISABLED) { 75 if (out->dst->state != OMAP_DSS_DISPLAY_DISABLED) {
76 DSSERR("device %s is not disabled, cannot unset device\n", 76 DSSERR("device %s is not disabled, cannot unset device\n",
77 out->device->name); 77 out->dst->name);
78 r = -EINVAL; 78 r = -EINVAL;
79 goto err; 79 goto err;
80 } 80 }
81 81
82 out->device->output = NULL; 82 out->dst->src = NULL;
83 out->device = NULL; 83 out->dst = NULL;
84 84
85 mutex_unlock(&output_lock); 85 mutex_unlock(&output_lock);
86 86
@@ -146,8 +146,8 @@ EXPORT_SYMBOL(omap_dss_find_output_by_node);
146 146
147struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev) 147struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev)
148{ 148{
149 while (dssdev->output) 149 while (dssdev->src)
150 dssdev = dssdev->output; 150 dssdev = dssdev->src;
151 151
152 if (dssdev->id != 0) 152 if (dssdev->id != 0)
153 return omap_dss_get_device(dssdev); 153 return omap_dss_get_device(dssdev);
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index fdfe6e6f25df..c8a81a2b879c 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -151,19 +151,17 @@ static void rfbi_runtime_put(void)
151 WARN_ON(r < 0 && r != -ENOSYS); 151 WARN_ON(r < 0 && r != -ENOSYS);
152} 152}
153 153
154void rfbi_bus_lock(void) 154static void rfbi_bus_lock(void)
155{ 155{
156 down(&rfbi.bus_lock); 156 down(&rfbi.bus_lock);
157} 157}
158EXPORT_SYMBOL(rfbi_bus_lock);
159 158
160void rfbi_bus_unlock(void) 159static void rfbi_bus_unlock(void)
161{ 160{
162 up(&rfbi.bus_lock); 161 up(&rfbi.bus_lock);
163} 162}
164EXPORT_SYMBOL(rfbi_bus_unlock);
165 163
166void omap_rfbi_write_command(const void *buf, u32 len) 164static void rfbi_write_command(const void *buf, u32 len)
167{ 165{
168 switch (rfbi.parallelmode) { 166 switch (rfbi.parallelmode) {
169 case OMAP_DSS_RFBI_PARALLELMODE_8: 167 case OMAP_DSS_RFBI_PARALLELMODE_8:
@@ -189,9 +187,8 @@ void omap_rfbi_write_command(const void *buf, u32 len)
189 BUG(); 187 BUG();
190 } 188 }
191} 189}
192EXPORT_SYMBOL(omap_rfbi_write_command);
193 190
194void omap_rfbi_read_data(void *buf, u32 len) 191static void rfbi_read_data(void *buf, u32 len)
195{ 192{
196 switch (rfbi.parallelmode) { 193 switch (rfbi.parallelmode) {
197 case OMAP_DSS_RFBI_PARALLELMODE_8: 194 case OMAP_DSS_RFBI_PARALLELMODE_8:
@@ -221,9 +218,8 @@ void omap_rfbi_read_data(void *buf, u32 len)
221 BUG(); 218 BUG();
222 } 219 }
223} 220}
224EXPORT_SYMBOL(omap_rfbi_read_data);
225 221
226void omap_rfbi_write_data(const void *buf, u32 len) 222static void rfbi_write_data(const void *buf, u32 len)
227{ 223{
228 switch (rfbi.parallelmode) { 224 switch (rfbi.parallelmode) {
229 case OMAP_DSS_RFBI_PARALLELMODE_8: 225 case OMAP_DSS_RFBI_PARALLELMODE_8:
@@ -250,9 +246,8 @@ void omap_rfbi_write_data(const void *buf, u32 len)
250 246
251 } 247 }
252} 248}
253EXPORT_SYMBOL(omap_rfbi_write_data);
254 249
255void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width, 250static void rfbi_write_pixels(const void __iomem *buf, int scr_width,
256 u16 x, u16 y, 251 u16 x, u16 y,
257 u16 w, u16 h) 252 u16 w, u16 h)
258{ 253{
@@ -305,7 +300,6 @@ void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
305 BUG(); 300 BUG();
306 } 301 }
307} 302}
308EXPORT_SYMBOL(omap_rfbi_write_pixels);
309 303
310static int rfbi_transfer_area(struct omap_dss_device *dssdev, 304static int rfbi_transfer_area(struct omap_dss_device *dssdev,
311 void (*callback)(void *data), void *data) 305 void (*callback)(void *data), void *data)
@@ -574,7 +568,7 @@ static int rfbi_convert_timings(struct rfbi_timings *t)
574} 568}
575 569
576/* xxx FIX module selection missing */ 570/* xxx FIX module selection missing */
577int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode, 571static int rfbi_setup_te(enum omap_rfbi_te_mode mode,
578 unsigned hs_pulse_time, unsigned vs_pulse_time, 572 unsigned hs_pulse_time, unsigned vs_pulse_time,
579 int hs_pol_inv, int vs_pol_inv, int extif_div) 573 int hs_pol_inv, int vs_pol_inv, int extif_div)
580{ 574{
@@ -613,10 +607,9 @@ int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
613 607
614 return 0; 608 return 0;
615} 609}
616EXPORT_SYMBOL(omap_rfbi_setup_te);
617 610
618/* xxx FIX module selection missing */ 611/* xxx FIX module selection missing */
619int omap_rfbi_enable_te(bool enable, unsigned line) 612static int rfbi_enable_te(bool enable, unsigned line)
620{ 613{
621 u32 l; 614 u32 l;
622 615
@@ -636,9 +629,8 @@ int omap_rfbi_enable_te(bool enable, unsigned line)
636 629
637 return 0; 630 return 0;
638} 631}
639EXPORT_SYMBOL(omap_rfbi_enable_te);
640 632
641static int rfbi_configure(int rfbi_module, int bpp, int lines) 633static int rfbi_configure_bus(int rfbi_module, int bpp, int lines)
642{ 634{
643 u32 l; 635 u32 l;
644 int cycle1 = 0, cycle2 = 0, cycle3 = 0; 636 int cycle1 = 0, cycle2 = 0, cycle3 = 0;
@@ -770,45 +762,39 @@ static int rfbi_configure(int rfbi_module, int bpp, int lines)
770 return 0; 762 return 0;
771} 763}
772 764
773int omap_rfbi_configure(struct omap_dss_device *dssdev) 765static int rfbi_configure(struct omap_dss_device *dssdev)
774{ 766{
775 return rfbi_configure(dssdev->phy.rfbi.channel, rfbi.pixel_size, 767 return rfbi_configure_bus(dssdev->phy.rfbi.channel, rfbi.pixel_size,
776 rfbi.data_lines); 768 rfbi.data_lines);
777} 769}
778EXPORT_SYMBOL(omap_rfbi_configure);
779 770
780int omap_rfbi_update(struct omap_dss_device *dssdev, void (*callback)(void *), 771static int rfbi_update(struct omap_dss_device *dssdev, void (*callback)(void *),
781 void *data) 772 void *data)
782{ 773{
783 return rfbi_transfer_area(dssdev, callback, data); 774 return rfbi_transfer_area(dssdev, callback, data);
784} 775}
785EXPORT_SYMBOL(omap_rfbi_update);
786 776
787void omapdss_rfbi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h) 777static void rfbi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h)
788{ 778{
789 rfbi.timings.x_res = w; 779 rfbi.timings.x_res = w;
790 rfbi.timings.y_res = h; 780 rfbi.timings.y_res = h;
791} 781}
792EXPORT_SYMBOL(omapdss_rfbi_set_size);
793 782
794void omapdss_rfbi_set_pixel_size(struct omap_dss_device *dssdev, int pixel_size) 783static void rfbi_set_pixel_size(struct omap_dss_device *dssdev, int pixel_size)
795{ 784{
796 rfbi.pixel_size = pixel_size; 785 rfbi.pixel_size = pixel_size;
797} 786}
798EXPORT_SYMBOL(omapdss_rfbi_set_pixel_size);
799 787
800void omapdss_rfbi_set_data_lines(struct omap_dss_device *dssdev, int data_lines) 788static void rfbi_set_data_lines(struct omap_dss_device *dssdev, int data_lines)
801{ 789{
802 rfbi.data_lines = data_lines; 790 rfbi.data_lines = data_lines;
803} 791}
804EXPORT_SYMBOL(omapdss_rfbi_set_data_lines);
805 792
806void omapdss_rfbi_set_interface_timings(struct omap_dss_device *dssdev, 793static void rfbi_set_interface_timings(struct omap_dss_device *dssdev,
807 struct rfbi_timings *timings) 794 struct rfbi_timings *timings)
808{ 795{
809 rfbi.intf_timings = *timings; 796 rfbi.intf_timings = *timings;
810} 797}
811EXPORT_SYMBOL(omapdss_rfbi_set_interface_timings);
812 798
813static void rfbi_dump_regs(struct seq_file *s) 799static void rfbi_dump_regs(struct seq_file *s)
814{ 800{
@@ -888,7 +874,7 @@ static void rfbi_config_lcd_manager(struct omap_dss_device *dssdev)
888 dss_mgr_set_timings(mgr, &rfbi.timings); 874 dss_mgr_set_timings(mgr, &rfbi.timings);
889} 875}
890 876
891int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) 877static int rfbi_display_enable(struct omap_dss_device *dssdev)
892{ 878{
893 struct omap_dss_device *out = &rfbi.output; 879 struct omap_dss_device *out = &rfbi.output;
894 int r; 880 int r;
@@ -911,7 +897,7 @@ int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev)
911 897
912 rfbi_config_lcd_manager(dssdev); 898 rfbi_config_lcd_manager(dssdev);
913 899
914 rfbi_configure(dssdev->phy.rfbi.channel, rfbi.pixel_size, 900 rfbi_configure_bus(dssdev->phy.rfbi.channel, rfbi.pixel_size,
915 rfbi.data_lines); 901 rfbi.data_lines);
916 902
917 rfbi_set_timings(dssdev->phy.rfbi.channel, &rfbi.intf_timings); 903 rfbi_set_timings(dssdev->phy.rfbi.channel, &rfbi.intf_timings);
@@ -921,9 +907,8 @@ err1:
921 rfbi_runtime_put(); 907 rfbi_runtime_put();
922 return r; 908 return r;
923} 909}
924EXPORT_SYMBOL(omapdss_rfbi_display_enable);
925 910
926void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) 911static void rfbi_display_disable(struct omap_dss_device *dssdev)
927{ 912{
928 struct omap_dss_device *out = &rfbi.output; 913 struct omap_dss_device *out = &rfbi.output;
929 914
@@ -932,7 +917,6 @@ void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev)
932 917
933 rfbi_runtime_put(); 918 rfbi_runtime_put();
934} 919}
935EXPORT_SYMBOL(omapdss_rfbi_display_disable);
936 920
937static int rfbi_init_display(struct omap_dss_device *dssdev) 921static int rfbi_init_display(struct omap_dss_device *dssdev)
938{ 922{
@@ -940,77 +924,6 @@ static int rfbi_init_display(struct omap_dss_device *dssdev)
940 return 0; 924 return 0;
941} 925}
942 926
943static struct omap_dss_device *rfbi_find_dssdev(struct platform_device *pdev)
944{
945 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
946 const char *def_disp_name = omapdss_get_default_display_name();
947 struct omap_dss_device *def_dssdev;
948 int i;
949
950 def_dssdev = NULL;
951
952 for (i = 0; i < pdata->num_devices; ++i) {
953 struct omap_dss_device *dssdev = pdata->devices[i];
954
955 if (dssdev->type != OMAP_DISPLAY_TYPE_DBI)
956 continue;
957
958 if (def_dssdev == NULL)
959 def_dssdev = dssdev;
960
961 if (def_disp_name != NULL &&
962 strcmp(dssdev->name, def_disp_name) == 0) {
963 def_dssdev = dssdev;
964 break;
965 }
966 }
967
968 return def_dssdev;
969}
970
971static int rfbi_probe_pdata(struct platform_device *rfbidev)
972{
973 struct omap_dss_device *plat_dssdev;
974 struct omap_dss_device *dssdev;
975 int r;
976
977 plat_dssdev = rfbi_find_dssdev(rfbidev);
978
979 if (!plat_dssdev)
980 return 0;
981
982 dssdev = dss_alloc_and_init_device(&rfbidev->dev);
983 if (!dssdev)
984 return -ENOMEM;
985
986 dss_copy_device_pdata(dssdev, plat_dssdev);
987
988 r = rfbi_init_display(dssdev);
989 if (r) {
990 DSSERR("device %s init failed: %d\n", dssdev->name, r);
991 dss_put_device(dssdev);
992 return r;
993 }
994
995 r = omapdss_output_set_device(&rfbi.output, dssdev);
996 if (r) {
997 DSSERR("failed to connect output to new device: %s\n",
998 dssdev->name);
999 dss_put_device(dssdev);
1000 return r;
1001 }
1002
1003 r = dss_add_device(dssdev);
1004 if (r) {
1005 DSSERR("device %s register failed: %d\n", dssdev->name, r);
1006 omapdss_output_unset_device(&rfbi.output);
1007 dss_put_device(dssdev);
1008 return r;
1009 }
1010
1011 return 0;
1012}
1013
1014static void rfbi_init_output(struct platform_device *pdev) 927static void rfbi_init_output(struct platform_device *pdev)
1015{ 928{
1016 struct omap_dss_device *out = &rfbi.output; 929 struct omap_dss_device *out = &rfbi.output;
@@ -1085,16 +998,8 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
1085 998
1086 rfbi_init_output(pdev); 999 rfbi_init_output(pdev);
1087 1000
1088 if (pdev->dev.platform_data) {
1089 r = rfbi_probe_pdata(pdev);
1090 if (r)
1091 goto err_probe;
1092 }
1093
1094 return 0; 1001 return 0;
1095 1002
1096err_probe:
1097 rfbi_uninit_output(pdev);
1098err_runtime_get: 1003err_runtime_get:
1099 pm_runtime_disable(&pdev->dev); 1004 pm_runtime_disable(&pdev->dev);
1100 return r; 1005 return r;
@@ -1102,8 +1007,6 @@ err_runtime_get:
1102 1007
1103static int __exit omap_rfbihw_remove(struct platform_device *pdev) 1008static int __exit omap_rfbihw_remove(struct platform_device *pdev)
1104{ 1009{
1105 dss_unregister_child_devices(&pdev->dev);
1106
1107 rfbi_uninit_output(pdev); 1010 rfbi_uninit_output(pdev);
1108 1011
1109 pm_runtime_disable(&pdev->dev); 1012 pm_runtime_disable(&pdev->dev);
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 856af2e89760..ccc569ae7cca 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -124,7 +124,7 @@ static void sdi_config_lcd_manager(struct omap_dss_device *dssdev)
124 dss_mgr_set_lcd_config(mgr, &sdi.mgr_config); 124 dss_mgr_set_lcd_config(mgr, &sdi.mgr_config);
125} 125}
126 126
127int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) 127static int sdi_display_enable(struct omap_dss_device *dssdev)
128{ 128{
129 struct omap_dss_device *out = &sdi.output; 129 struct omap_dss_device *out = &sdi.output;
130 struct omap_video_timings *t = &sdi.timings; 130 struct omap_video_timings *t = &sdi.timings;
@@ -211,9 +211,8 @@ err_get_dispc:
211err_reg_enable: 211err_reg_enable:
212 return r; 212 return r;
213} 213}
214EXPORT_SYMBOL(omapdss_sdi_display_enable);
215 214
216void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) 215static void sdi_display_disable(struct omap_dss_device *dssdev)
217{ 216{
218 struct omap_overlay_manager *mgr = sdi.output.manager; 217 struct omap_overlay_manager *mgr = sdi.output.manager;
219 218
@@ -225,14 +224,12 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev)
225 224
226 regulator_disable(sdi.vdds_sdi_reg); 225 regulator_disable(sdi.vdds_sdi_reg);
227} 226}
228EXPORT_SYMBOL(omapdss_sdi_display_disable);
229 227
230void omapdss_sdi_set_timings(struct omap_dss_device *dssdev, 228static void sdi_set_timings(struct omap_dss_device *dssdev,
231 struct omap_video_timings *timings) 229 struct omap_video_timings *timings)
232{ 230{
233 sdi.timings = *timings; 231 sdi.timings = *timings;
234} 232}
235EXPORT_SYMBOL(omapdss_sdi_set_timings);
236 233
237static void sdi_get_timings(struct omap_dss_device *dssdev, 234static void sdi_get_timings(struct omap_dss_device *dssdev,
238 struct omap_video_timings *timings) 235 struct omap_video_timings *timings)
@@ -254,11 +251,10 @@ static int sdi_check_timings(struct omap_dss_device *dssdev,
254 return 0; 251 return 0;
255} 252}
256 253
257void omapdss_sdi_set_datapairs(struct omap_dss_device *dssdev, int datapairs) 254static void sdi_set_datapairs(struct omap_dss_device *dssdev, int datapairs)
258{ 255{
259 sdi.datapairs = datapairs; 256 sdi.datapairs = datapairs;
260} 257}
261EXPORT_SYMBOL(omapdss_sdi_set_datapairs);
262 258
263static int sdi_init_regulator(void) 259static int sdi_init_regulator(void)
264{ 260{
@@ -267,14 +263,10 @@ static int sdi_init_regulator(void)
267 if (sdi.vdds_sdi_reg) 263 if (sdi.vdds_sdi_reg)
268 return 0; 264 return 0;
269 265
270 vdds_sdi = dss_get_vdds_sdi(); 266 vdds_sdi = devm_regulator_get(&sdi.pdev->dev, "vdds_sdi");
271
272 if (IS_ERR(vdds_sdi)) { 267 if (IS_ERR(vdds_sdi)) {
273 vdds_sdi = devm_regulator_get(&sdi.pdev->dev, "vdds_sdi"); 268 DSSERR("can't get VDDS_SDI regulator\n");
274 if (IS_ERR(vdds_sdi)) { 269 return PTR_ERR(vdds_sdi);
275 DSSERR("can't get VDDS_SDI regulator\n");
276 return PTR_ERR(vdds_sdi);
277 }
278 } 270 }
279 271
280 sdi.vdds_sdi_reg = vdds_sdi; 272 sdi.vdds_sdi_reg = vdds_sdi;
@@ -282,77 +274,6 @@ static int sdi_init_regulator(void)
282 return 0; 274 return 0;
283} 275}
284 276
285static struct omap_dss_device *sdi_find_dssdev(struct platform_device *pdev)
286{
287 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
288 const char *def_disp_name = omapdss_get_default_display_name();
289 struct omap_dss_device *def_dssdev;
290 int i;
291
292 def_dssdev = NULL;
293
294 for (i = 0; i < pdata->num_devices; ++i) {
295 struct omap_dss_device *dssdev = pdata->devices[i];
296
297 if (dssdev->type != OMAP_DISPLAY_TYPE_SDI)
298 continue;
299
300 if (def_dssdev == NULL)
301 def_dssdev = dssdev;
302
303 if (def_disp_name != NULL &&
304 strcmp(dssdev->name, def_disp_name) == 0) {
305 def_dssdev = dssdev;
306 break;
307 }
308 }
309
310 return def_dssdev;
311}
312
313static int sdi_probe_pdata(struct platform_device *sdidev)
314{
315 struct omap_dss_device *plat_dssdev;
316 struct omap_dss_device *dssdev;
317 int r;
318
319 plat_dssdev = sdi_find_dssdev(sdidev);
320
321 if (!plat_dssdev)
322 return 0;
323
324 dssdev = dss_alloc_and_init_device(&sdidev->dev);
325 if (!dssdev)
326 return -ENOMEM;
327
328 dss_copy_device_pdata(dssdev, plat_dssdev);
329
330 r = sdi_init_regulator();
331 if (r) {
332 DSSERR("device %s init failed: %d\n", dssdev->name, r);
333 dss_put_device(dssdev);
334 return r;
335 }
336
337 r = omapdss_output_set_device(&sdi.output, dssdev);
338 if (r) {
339 DSSERR("failed to connect output to new device: %s\n",
340 dssdev->name);
341 dss_put_device(dssdev);
342 return r;
343 }
344
345 r = dss_add_device(dssdev);
346 if (r) {
347 DSSERR("device %s register failed: %d\n", dssdev->name, r);
348 omapdss_output_unset_device(&sdi.output);
349 dss_put_device(dssdev);
350 return r;
351 }
352
353 return 0;
354}
355
356static int sdi_connect(struct omap_dss_device *dssdev, 277static int sdi_connect(struct omap_dss_device *dssdev,
357 struct omap_dss_device *dst) 278 struct omap_dss_device *dst)
358{ 279{
@@ -385,9 +306,9 @@ static int sdi_connect(struct omap_dss_device *dssdev,
385static void sdi_disconnect(struct omap_dss_device *dssdev, 306static void sdi_disconnect(struct omap_dss_device *dssdev,
386 struct omap_dss_device *dst) 307 struct omap_dss_device *dst)
387{ 308{
388 WARN_ON(dst != dssdev->device); 309 WARN_ON(dst != dssdev->dst);
389 310
390 if (dst != dssdev->device) 311 if (dst != dssdev->dst)
391 return; 312 return;
392 313
393 omapdss_output_unset_device(dssdev); 314 omapdss_output_unset_device(dssdev);
@@ -400,14 +321,14 @@ static const struct omapdss_sdi_ops sdi_ops = {
400 .connect = sdi_connect, 321 .connect = sdi_connect,
401 .disconnect = sdi_disconnect, 322 .disconnect = sdi_disconnect,
402 323
403 .enable = omapdss_sdi_display_enable, 324 .enable = sdi_display_enable,
404 .disable = omapdss_sdi_display_disable, 325 .disable = sdi_display_disable,
405 326
406 .check_timings = sdi_check_timings, 327 .check_timings = sdi_check_timings,
407 .set_timings = omapdss_sdi_set_timings, 328 .set_timings = sdi_set_timings,
408 .get_timings = sdi_get_timings, 329 .get_timings = sdi_get_timings,
409 330
410 .set_datapairs = omapdss_sdi_set_datapairs, 331 .set_datapairs = sdi_set_datapairs,
411}; 332};
412 333
413static void sdi_init_output(struct platform_device *pdev) 334static void sdi_init_output(struct platform_device *pdev)
@@ -434,29 +355,15 @@ static void __exit sdi_uninit_output(struct platform_device *pdev)
434 355
435static int omap_sdi_probe(struct platform_device *pdev) 356static int omap_sdi_probe(struct platform_device *pdev)
436{ 357{
437 int r;
438
439 sdi.pdev = pdev; 358 sdi.pdev = pdev;
440 359
441 sdi_init_output(pdev); 360 sdi_init_output(pdev);
442 361
443 if (pdev->dev.platform_data) {
444 r = sdi_probe_pdata(pdev);
445 if (r)
446 goto err_probe;
447 }
448
449 return 0; 362 return 0;
450
451err_probe:
452 sdi_uninit_output(pdev);
453 return r;
454} 363}
455 364
456static int __exit omap_sdi_remove(struct platform_device *pdev) 365static int __exit omap_sdi_remove(struct platform_device *pdev)
457{ 366{
458 dss_unregister_child_devices(&pdev->dev);
459
460 sdi_uninit_output(pdev); 367 sdi_uninit_output(pdev);
461 368
462 return 0; 369 return 0;
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 496a106fe823..5f88ac47b7fa 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -492,7 +492,7 @@ static void venc_power_off(struct omap_dss_device *dssdev)
492 venc_runtime_put(); 492 venc_runtime_put();
493} 493}
494 494
495int omapdss_venc_display_enable(struct omap_dss_device *dssdev) 495static int venc_display_enable(struct omap_dss_device *dssdev)
496{ 496{
497 struct omap_dss_device *out = &venc.output; 497 struct omap_dss_device *out = &venc.output;
498 int r; 498 int r;
@@ -521,7 +521,7 @@ err0:
521 return r; 521 return r;
522} 522}
523 523
524void omapdss_venc_display_disable(struct omap_dss_device *dssdev) 524static void venc_display_disable(struct omap_dss_device *dssdev)
525{ 525{
526 DSSDBG("venc_display_disable\n"); 526 DSSDBG("venc_display_disable\n");
527 527
@@ -532,7 +532,7 @@ void omapdss_venc_display_disable(struct omap_dss_device *dssdev)
532 mutex_unlock(&venc.venc_lock); 532 mutex_unlock(&venc.venc_lock);
533} 533}
534 534
535void omapdss_venc_set_timings(struct omap_dss_device *dssdev, 535static void venc_set_timings(struct omap_dss_device *dssdev,
536 struct omap_video_timings *timings) 536 struct omap_video_timings *timings)
537{ 537{
538 DSSDBG("venc_set_timings\n"); 538 DSSDBG("venc_set_timings\n");
@@ -550,7 +550,7 @@ void omapdss_venc_set_timings(struct omap_dss_device *dssdev,
550 mutex_unlock(&venc.venc_lock); 550 mutex_unlock(&venc.venc_lock);
551} 551}
552 552
553int omapdss_venc_check_timings(struct omap_dss_device *dssdev, 553static int venc_check_timings(struct omap_dss_device *dssdev,
554 struct omap_video_timings *timings) 554 struct omap_video_timings *timings)
555{ 555{
556 DSSDBG("venc_check_timings\n"); 556 DSSDBG("venc_check_timings\n");
@@ -574,13 +574,13 @@ static void venc_get_timings(struct omap_dss_device *dssdev,
574 mutex_unlock(&venc.venc_lock); 574 mutex_unlock(&venc.venc_lock);
575} 575}
576 576
577u32 omapdss_venc_get_wss(struct omap_dss_device *dssdev) 577static u32 venc_get_wss(struct omap_dss_device *dssdev)
578{ 578{
579 /* Invert due to VENC_L21_WC_CTL:INV=1 */ 579 /* Invert due to VENC_L21_WC_CTL:INV=1 */
580 return (venc.wss_data >> 8) ^ 0xfffff; 580 return (venc.wss_data >> 8) ^ 0xfffff;
581} 581}
582 582
583int omapdss_venc_set_wss(struct omap_dss_device *dssdev, u32 wss) 583static int venc_set_wss(struct omap_dss_device *dssdev, u32 wss)
584{ 584{
585 const struct venc_config *config; 585 const struct venc_config *config;
586 int r; 586 int r;
@@ -609,7 +609,7 @@ err:
609 return r; 609 return r;
610} 610}
611 611
612void omapdss_venc_set_type(struct omap_dss_device *dssdev, 612static void venc_set_type(struct omap_dss_device *dssdev,
613 enum omap_dss_venc_type type) 613 enum omap_dss_venc_type type)
614{ 614{
615 mutex_lock(&venc.venc_lock); 615 mutex_lock(&venc.venc_lock);
@@ -619,7 +619,7 @@ void omapdss_venc_set_type(struct omap_dss_device *dssdev,
619 mutex_unlock(&venc.venc_lock); 619 mutex_unlock(&venc.venc_lock);
620} 620}
621 621
622void omapdss_venc_invert_vid_out_polarity(struct omap_dss_device *dssdev, 622static void venc_invert_vid_out_polarity(struct omap_dss_device *dssdev,
623 bool invert_polarity) 623 bool invert_polarity)
624{ 624{
625 mutex_lock(&venc.venc_lock); 625 mutex_lock(&venc.venc_lock);
@@ -721,74 +721,6 @@ static int venc_get_clocks(struct platform_device *pdev)
721 return 0; 721 return 0;
722} 722}
723 723
724static struct omap_dss_device *venc_find_dssdev(struct platform_device *pdev)
725{
726 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
727 const char *def_disp_name = omapdss_get_default_display_name();
728 struct omap_dss_device *def_dssdev;
729 int i;
730
731 def_dssdev = NULL;
732
733 for (i = 0; i < pdata->num_devices; ++i) {
734 struct omap_dss_device *dssdev = pdata->devices[i];
735
736 if (dssdev->type != OMAP_DISPLAY_TYPE_VENC)
737 continue;
738
739 if (def_dssdev == NULL)
740 def_dssdev = dssdev;
741
742 if (def_disp_name != NULL &&
743 strcmp(dssdev->name, def_disp_name) == 0) {
744 def_dssdev = dssdev;
745 break;
746 }
747 }
748
749 return def_dssdev;
750}
751
752static int venc_probe_pdata(struct platform_device *vencdev)
753{
754 struct omap_dss_device *plat_dssdev;
755 struct omap_dss_device *dssdev;
756 int r;
757
758 plat_dssdev = venc_find_dssdev(vencdev);
759
760 if (!plat_dssdev)
761 return 0;
762
763 r = venc_init_regulator();
764 if (r)
765 return r;
766
767 dssdev = dss_alloc_and_init_device(&vencdev->dev);
768 if (!dssdev)
769 return -ENOMEM;
770
771 dss_copy_device_pdata(dssdev, plat_dssdev);
772
773 r = omapdss_output_set_device(&venc.output, dssdev);
774 if (r) {
775 DSSERR("failed to connect output to new device: %s\n",
776 dssdev->name);
777 dss_put_device(dssdev);
778 return r;
779 }
780
781 r = dss_add_device(dssdev);
782 if (r) {
783 DSSERR("device %s register failed: %d\n", dssdev->name, r);
784 omapdss_output_unset_device(&venc.output);
785 dss_put_device(dssdev);
786 return r;
787 }
788
789 return 0;
790}
791
792static int venc_connect(struct omap_dss_device *dssdev, 724static int venc_connect(struct omap_dss_device *dssdev,
793 struct omap_dss_device *dst) 725 struct omap_dss_device *dst)
794{ 726{
@@ -821,9 +753,9 @@ static int venc_connect(struct omap_dss_device *dssdev,
821static void venc_disconnect(struct omap_dss_device *dssdev, 753static void venc_disconnect(struct omap_dss_device *dssdev,
822 struct omap_dss_device *dst) 754 struct omap_dss_device *dst)
823{ 755{
824 WARN_ON(dst != dssdev->device); 756 WARN_ON(dst != dssdev->dst);
825 757
826 if (dst != dssdev->device) 758 if (dst != dssdev->dst)
827 return; 759 return;
828 760
829 omapdss_output_unset_device(dssdev); 761 omapdss_output_unset_device(dssdev);
@@ -836,18 +768,18 @@ static const struct omapdss_atv_ops venc_ops = {
836 .connect = venc_connect, 768 .connect = venc_connect,
837 .disconnect = venc_disconnect, 769 .disconnect = venc_disconnect,
838 770
839 .enable = omapdss_venc_display_enable, 771 .enable = venc_display_enable,
840 .disable = omapdss_venc_display_disable, 772 .disable = venc_display_disable,
841 773
842 .check_timings = omapdss_venc_check_timings, 774 .check_timings = venc_check_timings,
843 .set_timings = omapdss_venc_set_timings, 775 .set_timings = venc_set_timings,
844 .get_timings = venc_get_timings, 776 .get_timings = venc_get_timings,
845 777
846 .set_type = omapdss_venc_set_type, 778 .set_type = venc_set_type,
847 .invert_vid_out_polarity = omapdss_venc_invert_vid_out_polarity, 779 .invert_vid_out_polarity = venc_invert_vid_out_polarity,
848 780
849 .set_wss = omapdss_venc_set_wss, 781 .set_wss = venc_set_wss,
850 .get_wss = omapdss_venc_get_wss, 782 .get_wss = venc_get_wss,
851}; 783};
852 784
853static void venc_init_output(struct platform_device *pdev) 785static void venc_init_output(struct platform_device *pdev)
@@ -913,26 +845,12 @@ static int omap_venchw_probe(struct platform_device *pdev)
913 845
914 venc_runtime_put(); 846 venc_runtime_put();
915 847
916 r = venc_panel_init();
917 if (r)
918 goto err_panel_init;
919
920 dss_debugfs_create_file("venc", venc_dump_regs); 848 dss_debugfs_create_file("venc", venc_dump_regs);
921 849
922 venc_init_output(pdev); 850 venc_init_output(pdev);
923 851
924 if (pdev->dev.platform_data) {
925 r = venc_probe_pdata(pdev);
926 if (r)
927 goto err_probe;
928 }
929
930 return 0; 852 return 0;
931 853
932err_probe:
933 venc_panel_exit();
934 venc_uninit_output(pdev);
935err_panel_init:
936err_runtime_get: 854err_runtime_get:
937 pm_runtime_disable(&pdev->dev); 855 pm_runtime_disable(&pdev->dev);
938 return r; 856 return r;
@@ -940,10 +858,6 @@ err_runtime_get:
940 858
941static int __exit omap_venchw_remove(struct platform_device *pdev) 859static int __exit omap_venchw_remove(struct platform_device *pdev)
942{ 860{
943 dss_unregister_child_devices(&pdev->dev);
944
945 venc_panel_exit();
946
947 venc_uninit_output(pdev); 861 venc_uninit_output(pdev);
948 862
949 pm_runtime_disable(&pdev->dev); 863 pm_runtime_disable(&pdev->dev);
diff --git a/include/video/omap-panel-data.h b/include/video/omap-panel-data.h
index 6b2366fb6e53..f7ac8d972af0 100644
--- a/include/video/omap-panel-data.h
+++ b/include/video/omap-panel-data.h
@@ -33,124 +33,6 @@
33struct omap_dss_device; 33struct omap_dss_device;
34 34
35/** 35/**
36 * struct panel_generic_dpi_data - panel driver configuration data
37 * @name: panel name
38 * @platform_enable: platform specific panel enable function
39 * @platform_disable: platform specific panel disable function
40 * @num_gpios: number of gpios connected to panel
41 * @gpios: gpio numbers on the platform
42 * @gpio_invert: configure gpio as active high or low
43 */
44struct panel_generic_dpi_data {
45 const char *name;
46 int (*platform_enable)(struct omap_dss_device *dssdev);
47 void (*platform_disable)(struct omap_dss_device *dssdev);
48
49 int num_gpios;
50 int gpios[10];
51 bool gpio_invert[10];
52};
53
54/**
55 * struct panel_n8x0_data - N800 panel driver configuration data
56 */
57struct panel_n8x0_data {
58 int (*platform_enable)(struct omap_dss_device *dssdev);
59 void (*platform_disable)(struct omap_dss_device *dssdev);
60 int panel_reset;
61 int ctrl_pwrdown;
62};
63
64/**
65 * struct nokia_dsi_panel_data - Nokia DSI panel driver configuration data
66 * @name: panel name
67 * @use_ext_te: use external TE
68 * @ext_te_gpio: external TE GPIO
69 * @esd_interval: interval of ESD checks, 0 = disabled (ms)
70 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms)
71 * @use_dsi_backlight: true if panel uses DSI command to control backlight
72 * @pin_config: DSI pin configuration
73 */
74
75struct nokia_dsi_panel_data {
76 const char *name;
77
78 int reset_gpio;
79
80 bool use_ext_te;
81 int ext_te_gpio;
82
83 unsigned esd_interval;
84 unsigned ulps_timeout;
85
86 bool use_dsi_backlight;
87
88 struct omap_dsi_pin_config pin_config;
89};
90
91/**
92 * struct picodlp_panel_data - picodlp panel driver configuration data
93 * @picodlp_adapter_id: i2c_adapter number for picodlp
94 */
95struct picodlp_panel_data {
96 int picodlp_adapter_id;
97 int emu_done_gpio;
98 int pwrgood_gpio;
99};
100
101/**
102 * struct tfp410_platform_data - tfp410 panel driver configuration data
103 * @i2c_bus_num: i2c bus id for the panel
104 * @power_down_gpio: gpio number for PD pin (or -1 if not available)
105 */
106struct tfp410_platform_data {
107 int i2c_bus_num;
108 int power_down_gpio;
109};
110
111/**
112 * sharp ls panel driver configuration data
113 * @resb_gpio: reset signal
114 * @ini_gpio: power on control
115 * @mo_gpio: selection for resolution(VGA/QVGA)
116 * @lr_gpio: selection for horizontal scanning direction
117 * @ud_gpio: selection for vertical scanning direction
118 */
119struct panel_sharp_ls037v7dw01_data {
120 int resb_gpio;
121 int ini_gpio;
122 int mo_gpio;
123 int lr_gpio;
124 int ud_gpio;
125};
126
127/**
128 * acx565akm panel driver configuration data
129 * @reset_gpio: reset signal
130 */
131struct panel_acx565akm_data {
132 int reset_gpio;
133};
134
135/**
136 * nec nl8048 panel driver configuration data
137 * @res_gpio: reset signal
138 * @qvga_gpio: selection for resolution(QVGA/WVGA)
139 */
140struct panel_nec_nl8048_data {
141 int res_gpio;
142 int qvga_gpio;
143};
144
145/**
146 * tpo td043 panel driver configuration data
147 * @nreset_gpio: reset signal
148 */
149struct panel_tpo_td043_data {
150 int nreset_gpio;
151};
152
153/**
154 * encoder_tfp410 platform data 36 * encoder_tfp410 platform data
155 * @name: name for this display entity 37 * @name: name for this display entity
156 * @power_down_gpio: gpio number for PD pin (or -1 if not available) 38 * @power_down_gpio: gpio number for PD pin (or -1 if not available)
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index b39463553845..3d7c51a6f9ff 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -250,19 +250,6 @@ struct rfbi_timings {
250 int converted; 250 int converted;
251}; 251};
252 252
253void omap_rfbi_write_command(const void *buf, u32 len);
254void omap_rfbi_read_data(void *buf, u32 len);
255void omap_rfbi_write_data(const void *buf, u32 len);
256void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
257 u16 x, u16 y,
258 u16 w, u16 h);
259int omap_rfbi_enable_te(bool enable, unsigned line);
260int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
261 unsigned hs_pulse_time, unsigned vs_pulse_time,
262 int hs_pol_inv, int vs_pol_inv, int extif_div);
263void rfbi_bus_lock(void);
264void rfbi_bus_unlock(void);
265
266/* DSI */ 253/* DSI */
267 254
268enum omap_dss_dsi_trans_mode { 255enum omap_dss_dsi_trans_mode {
@@ -321,39 +308,6 @@ struct omap_dss_dsi_config {
321 enum omap_dss_dsi_trans_mode trans_mode; 308 enum omap_dss_dsi_trans_mode trans_mode;
322}; 309};
323 310
324void dsi_bus_lock(struct omap_dss_device *dssdev);
325void dsi_bus_unlock(struct omap_dss_device *dssdev);
326int dsi_vc_dcs_write(struct omap_dss_device *dssdev, int channel, u8 *data,
327 int len);
328int dsi_vc_generic_write(struct omap_dss_device *dssdev, int channel, u8 *data,
329 int len);
330int dsi_vc_dcs_write_0(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd);
331int dsi_vc_generic_write_0(struct omap_dss_device *dssdev, int channel);
332int dsi_vc_dcs_write_1(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
333 u8 param);
334int dsi_vc_generic_write_1(struct omap_dss_device *dssdev, int channel,
335 u8 param);
336int dsi_vc_generic_write_2(struct omap_dss_device *dssdev, int channel,
337 u8 param1, u8 param2);
338int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int channel,
339 u8 *data, int len);
340int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int channel,
341 u8 *data, int len);
342int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
343 u8 *buf, int buflen);
344int dsi_vc_generic_read_0(struct omap_dss_device *dssdev, int channel, u8 *buf,
345 int buflen);
346int dsi_vc_generic_read_1(struct omap_dss_device *dssdev, int channel, u8 param,
347 u8 *buf, int buflen);
348int dsi_vc_generic_read_2(struct omap_dss_device *dssdev, int channel,
349 u8 param1, u8 param2, u8 *buf, int buflen);
350int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
351 u16 len);
352int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel);
353int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
354int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel);
355void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel);
356
357enum omapdss_version { 311enum omapdss_version {
358 OMAPDSS_VER_UNKNOWN = 0, 312 OMAPDSS_VER_UNKNOWN = 0,
359 OMAPDSS_VER_OMAP24xx, 313 OMAPDSS_VER_OMAP24xx,
@@ -749,10 +703,6 @@ struct omapdss_dsi_ops {
749}; 703};
750 704
751struct omap_dss_device { 705struct omap_dss_device {
752 /* old device, to be removed */
753 struct device old_dev;
754
755 /* new device, pointer to panel device */
756 struct device *dev; 706 struct device *dev;
757 707
758 struct module *owner; 708 struct module *owner;
@@ -765,9 +715,6 @@ struct omap_dss_device {
765 enum omap_display_type type; 715 enum omap_display_type type;
766 enum omap_display_type output_type; 716 enum omap_display_type output_type;
767 717
768 /* obsolete, to be removed */
769 enum omap_channel channel;
770
771 union { 718 union {
772 struct { 719 struct {
773 u8 data_lines; 720 u8 data_lines;
@@ -827,7 +774,7 @@ struct omap_dss_device {
827 774
828 enum omap_display_caps caps; 775 enum omap_display_caps caps;
829 776
830 struct omap_dss_device *output; 777 struct omap_dss_device *src;
831 778
832 enum omap_dss_display_state state; 779 enum omap_dss_display_state state;
833 780
@@ -846,7 +793,7 @@ struct omap_dss_device {
846 /* dynamic fields */ 793 /* dynamic fields */
847 struct omap_overlay_manager *manager; 794 struct omap_overlay_manager *manager;
848 795
849 struct omap_dss_device *device; 796 struct omap_dss_device *dst;
850}; 797};
851 798
852struct omap_dss_hdmi_data 799struct omap_dss_hdmi_data
@@ -857,8 +804,6 @@ struct omap_dss_hdmi_data
857}; 804};
858 805
859struct omap_dss_driver { 806struct omap_dss_driver {
860 struct device_driver driver;
861
862 int (*probe)(struct omap_dss_device *); 807 int (*probe)(struct omap_dss_device *);
863 void (*remove)(struct omap_dss_device *); 808 void (*remove)(struct omap_dss_device *);
864 809
@@ -1023,51 +968,6 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
1023#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver) 968#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
1024#define to_dss_device(x) container_of((x), struct omap_dss_device, old_dev) 969#define to_dss_device(x) container_of((x), struct omap_dss_device, old_dev)
1025 970
1026void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
1027 bool enable);
1028int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
1029int omapdss_dsi_set_config(struct omap_dss_device *dssdev,
1030 const struct omap_dss_dsi_config *config);
1031
1032int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
1033 void (*callback)(int, void *), void *data);
1034int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
1035int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
1036void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
1037int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
1038 const struct omap_dsi_pin_config *pin_cfg);
1039
1040int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
1041void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
1042 bool disconnect_lanes, bool enter_ulps);
1043
1044int omapdss_dpi_display_enable(struct omap_dss_device *dssdev);
1045void omapdss_dpi_display_disable(struct omap_dss_device *dssdev);
1046void omapdss_dpi_set_timings(struct omap_dss_device *dssdev,
1047 struct omap_video_timings *timings);
1048int dpi_check_timings(struct omap_dss_device *dssdev,
1049 struct omap_video_timings *timings);
1050void omapdss_dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines);
1051
1052int omapdss_sdi_display_enable(struct omap_dss_device *dssdev);
1053void omapdss_sdi_display_disable(struct omap_dss_device *dssdev);
1054void omapdss_sdi_set_timings(struct omap_dss_device *dssdev,
1055 struct omap_video_timings *timings);
1056void omapdss_sdi_set_datapairs(struct omap_dss_device *dssdev, int datapairs);
1057
1058int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev);
1059void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev);
1060int omap_rfbi_update(struct omap_dss_device *dssdev, void (*callback)(void *),
1061 void *data);
1062int omap_rfbi_configure(struct omap_dss_device *dssdev);
1063void omapdss_rfbi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h);
1064void omapdss_rfbi_set_pixel_size(struct omap_dss_device *dssdev,
1065 int pixel_size);
1066void omapdss_rfbi_set_data_lines(struct omap_dss_device *dssdev,
1067 int data_lines);
1068void omapdss_rfbi_set_interface_timings(struct omap_dss_device *dssdev,
1069 struct rfbi_timings *timings);
1070
1071int omapdss_compat_init(void); 971int omapdss_compat_init(void);
1072void omapdss_compat_uninit(void); 972void omapdss_compat_uninit(void);
1073 973
@@ -1111,7 +1011,7 @@ void dss_mgr_unregister_framedone_handler(struct omap_overlay_manager *mgr,
1111 1011
1112static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev) 1012static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
1113{ 1013{
1114 return dssdev->output; 1014 return dssdev->src;
1115} 1015}
1116 1016
1117static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev) 1017static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)