diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-05-11 08:10:10 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-05-11 08:10:10 -0400 |
commit | 38137c8f0ce8dfaea467884cb2eb45de8df1bdfc (patch) | |
tree | 4985e69beb92a6f9ed9e280dc1e6d5d6c3efb645 | |
parent | 3a028bb99d1f1e5c444060a176cbd4bf93530df3 (diff) | |
parent | af461d64e11f81db4a7619dd574fe779ae3a0884 (diff) |
Merge branch 'dss-devtree-cleanup'
Merge OMAP DSS cleanups that restructure the omapdss driver to facilitate
implementing device tree support in the future.
-rw-r--r-- | arch/arm/mach-omap2/display.c | 192 | ||||
-rw-r--r-- | drivers/video/omap2/displays/panel-tfp410.c | 76 | ||||
-rw-r--r-- | drivers/video/omap2/dss/core.c | 243 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 50 | ||||
-rw-r--r-- | drivers/video/omap2/dss/display.c | 40 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dpi.c | 68 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 148 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.c | 44 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 113 | ||||
-rw-r--r-- | drivers/video/omap2/dss/hdmi.c | 85 | ||||
-rw-r--r-- | drivers/video/omap2/dss/rfbi.c | 60 | ||||
-rw-r--r-- | drivers/video/omap2/dss/sdi.c | 61 | ||||
-rw-r--r-- | drivers/video/omap2/dss/venc.c | 62 | ||||
-rw-r--r-- | drivers/video/omap2/omapfb/omapfb-main.c | 9 | ||||
-rw-r--r-- | include/video/omapdss.h | 5 |
15 files changed, 688 insertions, 568 deletions
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 60cded4738a0..54d49ddb9b81 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -185,16 +185,128 @@ static int omap_dss_set_min_bus_tput(struct device *dev, unsigned long tput) | |||
185 | return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput); | 185 | return omap_pm_set_min_bus_tput(dev, OCP_INITIATOR_AGENT, tput); |
186 | } | 186 | } |
187 | 187 | ||
188 | static struct platform_device *create_dss_pdev(const char *pdev_name, | ||
189 | int pdev_id, const char *oh_name, void *pdata, int pdata_len, | ||
190 | struct platform_device *parent) | ||
191 | { | ||
192 | struct platform_device *pdev; | ||
193 | struct omap_device *od; | ||
194 | struct omap_hwmod *ohs[1]; | ||
195 | struct omap_hwmod *oh; | ||
196 | int r; | ||
197 | |||
198 | oh = omap_hwmod_lookup(oh_name); | ||
199 | if (!oh) { | ||
200 | pr_err("Could not look up %s\n", oh_name); | ||
201 | r = -ENODEV; | ||
202 | goto err; | ||
203 | } | ||
204 | |||
205 | pdev = platform_device_alloc(pdev_name, pdev_id); | ||
206 | if (!pdev) { | ||
207 | pr_err("Could not create pdev for %s\n", pdev_name); | ||
208 | r = -ENOMEM; | ||
209 | goto err; | ||
210 | } | ||
211 | |||
212 | if (parent != NULL) | ||
213 | pdev->dev.parent = &parent->dev; | ||
214 | |||
215 | if (pdev->id != -1) | ||
216 | dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); | ||
217 | else | ||
218 | dev_set_name(&pdev->dev, "%s", pdev->name); | ||
219 | |||
220 | ohs[0] = oh; | ||
221 | od = omap_device_alloc(pdev, ohs, 1, NULL, 0); | ||
222 | if (!od) { | ||
223 | pr_err("Could not alloc omap_device for %s\n", pdev_name); | ||
224 | r = -ENOMEM; | ||
225 | goto err; | ||
226 | } | ||
227 | |||
228 | r = platform_device_add_data(pdev, pdata, pdata_len); | ||
229 | if (r) { | ||
230 | pr_err("Could not set pdata for %s\n", pdev_name); | ||
231 | goto err; | ||
232 | } | ||
233 | |||
234 | r = omap_device_register(pdev); | ||
235 | if (r) { | ||
236 | pr_err("Could not register omap_device for %s\n", pdev_name); | ||
237 | goto err; | ||
238 | } | ||
239 | |||
240 | return pdev; | ||
241 | |||
242 | err: | ||
243 | return ERR_PTR(r); | ||
244 | } | ||
245 | |||
246 | static struct platform_device *create_simple_dss_pdev(const char *pdev_name, | ||
247 | int pdev_id, void *pdata, int pdata_len, | ||
248 | struct platform_device *parent) | ||
249 | { | ||
250 | struct platform_device *pdev; | ||
251 | int r; | ||
252 | |||
253 | pdev = platform_device_alloc(pdev_name, pdev_id); | ||
254 | if (!pdev) { | ||
255 | pr_err("Could not create pdev for %s\n", pdev_name); | ||
256 | r = -ENOMEM; | ||
257 | goto err; | ||
258 | } | ||
259 | |||
260 | if (parent != NULL) | ||
261 | pdev->dev.parent = &parent->dev; | ||
262 | |||
263 | if (pdev->id != -1) | ||
264 | dev_set_name(&pdev->dev, "%s.%d", pdev->name, pdev->id); | ||
265 | else | ||
266 | dev_set_name(&pdev->dev, "%s", pdev->name); | ||
267 | |||
268 | r = platform_device_add_data(pdev, pdata, pdata_len); | ||
269 | if (r) { | ||
270 | pr_err("Could not set pdata for %s\n", pdev_name); | ||
271 | goto err; | ||
272 | } | ||
273 | |||
274 | r = omap_device_register(pdev); | ||
275 | if (r) { | ||
276 | pr_err("Could not register omap_device for %s\n", pdev_name); | ||
277 | goto err; | ||
278 | } | ||
279 | |||
280 | return pdev; | ||
281 | |||
282 | err: | ||
283 | return ERR_PTR(r); | ||
284 | } | ||
285 | |||
188 | int __init omap_display_init(struct omap_dss_board_info *board_data) | 286 | int __init omap_display_init(struct omap_dss_board_info *board_data) |
189 | { | 287 | { |
190 | int r = 0; | 288 | int r = 0; |
191 | struct omap_hwmod *oh; | ||
192 | struct platform_device *pdev; | 289 | struct platform_device *pdev; |
193 | int i, oh_count; | 290 | int i, oh_count; |
194 | struct omap_display_platform_data pdata; | ||
195 | const struct omap_dss_hwmod_data *curr_dss_hwmod; | 291 | const struct omap_dss_hwmod_data *curr_dss_hwmod; |
292 | struct platform_device *dss_pdev; | ||
293 | |||
294 | /* create omapdss device */ | ||
196 | 295 | ||
197 | memset(&pdata, 0, sizeof(pdata)); | 296 | board_data->dsi_enable_pads = omap_dsi_enable_pads; |
297 | board_data->dsi_disable_pads = omap_dsi_disable_pads; | ||
298 | board_data->get_context_loss_count = omap_pm_get_dev_context_loss_count; | ||
299 | board_data->set_min_bus_tput = omap_dss_set_min_bus_tput; | ||
300 | |||
301 | omap_display_device.dev.platform_data = board_data; | ||
302 | |||
303 | r = platform_device_register(&omap_display_device); | ||
304 | if (r < 0) { | ||
305 | pr_err("Unable to register omapdss device\n"); | ||
306 | return r; | ||
307 | } | ||
308 | |||
309 | /* create devices for dss hwmods */ | ||
198 | 310 | ||
199 | if (cpu_is_omap24xx()) { | 311 | if (cpu_is_omap24xx()) { |
200 | curr_dss_hwmod = omap2_dss_hwmod_data; | 312 | curr_dss_hwmod = omap2_dss_hwmod_data; |
@@ -207,40 +319,58 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) | |||
207 | oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); | 319 | oh_count = ARRAY_SIZE(omap4_dss_hwmod_data); |
208 | } | 320 | } |
209 | 321 | ||
210 | if (board_data->dsi_enable_pads == NULL) | 322 | /* |
211 | board_data->dsi_enable_pads = omap_dsi_enable_pads; | 323 | * First create the pdev for dss_core, which is used as a parent device |
212 | if (board_data->dsi_disable_pads == NULL) | 324 | * by the other dss pdevs. Note: dss_core has to be the first item in |
213 | board_data->dsi_disable_pads = omap_dsi_disable_pads; | 325 | * the hwmod list. |
214 | 326 | */ | |
215 | pdata.board_data = board_data; | 327 | dss_pdev = create_dss_pdev(curr_dss_hwmod[0].dev_name, |
216 | pdata.board_data->get_context_loss_count = | 328 | curr_dss_hwmod[0].id, |
217 | omap_pm_get_dev_context_loss_count; | 329 | curr_dss_hwmod[0].oh_name, |
218 | pdata.board_data->set_min_bus_tput = omap_dss_set_min_bus_tput; | 330 | board_data, sizeof(*board_data), |
219 | 331 | NULL); | |
220 | for (i = 0; i < oh_count; i++) { | 332 | |
221 | oh = omap_hwmod_lookup(curr_dss_hwmod[i].oh_name); | 333 | if (IS_ERR(dss_pdev)) { |
222 | if (!oh) { | 334 | pr_err("Could not build omap_device for %s\n", |
223 | pr_err("Could not look up %s\n", | 335 | curr_dss_hwmod[0].oh_name); |
224 | curr_dss_hwmod[i].oh_name); | 336 | |
225 | return -ENODEV; | 337 | return PTR_ERR(dss_pdev); |
338 | } | ||
339 | |||
340 | for (i = 1; i < oh_count; i++) { | ||
341 | pdev = create_dss_pdev(curr_dss_hwmod[i].dev_name, | ||
342 | curr_dss_hwmod[i].id, | ||
343 | curr_dss_hwmod[i].oh_name, | ||
344 | board_data, sizeof(*board_data), | ||
345 | dss_pdev); | ||
346 | |||
347 | if (IS_ERR(pdev)) { | ||
348 | pr_err("Could not build omap_device for %s\n", | ||
349 | curr_dss_hwmod[i].oh_name); | ||
350 | |||
351 | return PTR_ERR(pdev); | ||
226 | } | 352 | } |
353 | } | ||
227 | 354 | ||
228 | pdev = omap_device_build(curr_dss_hwmod[i].dev_name, | 355 | /* Create devices for DPI and SDI */ |
229 | curr_dss_hwmod[i].id, oh, &pdata, | ||
230 | sizeof(struct omap_display_platform_data), | ||
231 | NULL, 0, 0); | ||
232 | 356 | ||
233 | if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n", | 357 | pdev = create_simple_dss_pdev("omapdss_dpi", -1, |
234 | curr_dss_hwmod[i].oh_name)) | 358 | board_data, sizeof(*board_data), dss_pdev); |
235 | return -ENODEV; | 359 | if (IS_ERR(pdev)) { |
360 | pr_err("Could not build platform_device for omapdss_dpi\n"); | ||
361 | return PTR_ERR(pdev); | ||
236 | } | 362 | } |
237 | omap_display_device.dev.platform_data = board_data; | ||
238 | 363 | ||
239 | r = platform_device_register(&omap_display_device); | 364 | if (cpu_is_omap34xx()) { |
240 | if (r < 0) | 365 | pdev = create_simple_dss_pdev("omapdss_sdi", -1, |
241 | printk(KERN_ERR "Unable to register OMAP-Display device\n"); | 366 | board_data, sizeof(*board_data), dss_pdev); |
367 | if (IS_ERR(pdev)) { | ||
368 | pr_err("Could not build platform_device for omapdss_sdi\n"); | ||
369 | return PTR_ERR(pdev); | ||
370 | } | ||
371 | } | ||
242 | 372 | ||
243 | return r; | 373 | return 0; |
244 | } | 374 | } |
245 | 375 | ||
246 | static void dispc_disable_outputs(void) | 376 | static void dispc_disable_outputs(void) |
diff --git a/drivers/video/omap2/displays/panel-tfp410.c b/drivers/video/omap2/displays/panel-tfp410.c index 52637fa8fda8..bff306e041ca 100644 --- a/drivers/video/omap2/displays/panel-tfp410.c +++ b/drivers/video/omap2/displays/panel-tfp410.c | |||
@@ -47,13 +47,9 @@ struct panel_drv_data { | |||
47 | struct mutex lock; | 47 | struct mutex lock; |
48 | 48 | ||
49 | int pd_gpio; | 49 | int pd_gpio; |
50 | }; | ||
51 | 50 | ||
52 | static inline struct tfp410_platform_data | 51 | struct i2c_adapter *i2c_adapter; |
53 | *get_pdata(const struct omap_dss_device *dssdev) | 52 | }; |
54 | { | ||
55 | return dssdev->data; | ||
56 | } | ||
57 | 53 | ||
58 | static int tfp410_power_on(struct omap_dss_device *dssdev) | 54 | static int tfp410_power_on(struct omap_dss_device *dssdev) |
59 | { | 55 | { |
@@ -68,7 +64,7 @@ static int tfp410_power_on(struct omap_dss_device *dssdev) | |||
68 | goto err0; | 64 | goto err0; |
69 | 65 | ||
70 | if (gpio_is_valid(ddata->pd_gpio)) | 66 | if (gpio_is_valid(ddata->pd_gpio)) |
71 | gpio_set_value(ddata->pd_gpio, 1); | 67 | gpio_set_value_cansleep(ddata->pd_gpio, 1); |
72 | 68 | ||
73 | return 0; | 69 | return 0; |
74 | err0: | 70 | err0: |
@@ -83,18 +79,18 @@ static void tfp410_power_off(struct omap_dss_device *dssdev) | |||
83 | return; | 79 | return; |
84 | 80 | ||
85 | if (gpio_is_valid(ddata->pd_gpio)) | 81 | if (gpio_is_valid(ddata->pd_gpio)) |
86 | gpio_set_value(ddata->pd_gpio, 0); | 82 | gpio_set_value_cansleep(ddata->pd_gpio, 0); |
87 | 83 | ||
88 | omapdss_dpi_display_disable(dssdev); | 84 | omapdss_dpi_display_disable(dssdev); |
89 | } | 85 | } |
90 | 86 | ||
91 | static int tfp410_probe(struct omap_dss_device *dssdev) | 87 | static int tfp410_probe(struct omap_dss_device *dssdev) |
92 | { | 88 | { |
93 | struct tfp410_platform_data *pdata = get_pdata(dssdev); | ||
94 | struct panel_drv_data *ddata; | 89 | struct panel_drv_data *ddata; |
95 | int r; | 90 | int r; |
91 | int i2c_bus_num; | ||
96 | 92 | ||
97 | ddata = kzalloc(sizeof(*ddata), GFP_KERNEL); | 93 | ddata = devm_kzalloc(&dssdev->dev, sizeof(*ddata), GFP_KERNEL); |
98 | if (!ddata) | 94 | if (!ddata) |
99 | return -ENOMEM; | 95 | return -ENOMEM; |
100 | 96 | ||
@@ -104,10 +100,15 @@ static int tfp410_probe(struct omap_dss_device *dssdev) | |||
104 | ddata->dssdev = dssdev; | 100 | ddata->dssdev = dssdev; |
105 | mutex_init(&ddata->lock); | 101 | mutex_init(&ddata->lock); |
106 | 102 | ||
107 | if (pdata) | 103 | if (dssdev->data) { |
104 | struct tfp410_platform_data *pdata = dssdev->data; | ||
105 | |||
108 | ddata->pd_gpio = pdata->power_down_gpio; | 106 | ddata->pd_gpio = pdata->power_down_gpio; |
109 | else | 107 | i2c_bus_num = pdata->i2c_bus_num; |
108 | } else { | ||
110 | ddata->pd_gpio = -1; | 109 | ddata->pd_gpio = -1; |
110 | i2c_bus_num = -1; | ||
111 | } | ||
111 | 112 | ||
112 | if (gpio_is_valid(ddata->pd_gpio)) { | 113 | if (gpio_is_valid(ddata->pd_gpio)) { |
113 | r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW, | 114 | r = gpio_request_one(ddata->pd_gpio, GPIOF_OUT_INIT_LOW, |
@@ -115,13 +116,31 @@ static int tfp410_probe(struct omap_dss_device *dssdev) | |||
115 | if (r) { | 116 | if (r) { |
116 | dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n", | 117 | dev_err(&dssdev->dev, "Failed to request PD GPIO %d\n", |
117 | ddata->pd_gpio); | 118 | ddata->pd_gpio); |
118 | ddata->pd_gpio = -1; | 119 | return r; |
119 | } | 120 | } |
120 | } | 121 | } |
121 | 122 | ||
123 | if (i2c_bus_num != -1) { | ||
124 | struct i2c_adapter *adapter; | ||
125 | |||
126 | adapter = i2c_get_adapter(i2c_bus_num); | ||
127 | if (!adapter) { | ||
128 | dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n", | ||
129 | i2c_bus_num); | ||
130 | r = -EINVAL; | ||
131 | goto err_i2c; | ||
132 | } | ||
133 | |||
134 | ddata->i2c_adapter = adapter; | ||
135 | } | ||
136 | |||
122 | dev_set_drvdata(&dssdev->dev, ddata); | 137 | dev_set_drvdata(&dssdev->dev, ddata); |
123 | 138 | ||
124 | return 0; | 139 | return 0; |
140 | err_i2c: | ||
141 | if (gpio_is_valid(ddata->pd_gpio)) | ||
142 | gpio_free(ddata->pd_gpio); | ||
143 | return r; | ||
125 | } | 144 | } |
126 | 145 | ||
127 | static void __exit tfp410_remove(struct omap_dss_device *dssdev) | 146 | static void __exit tfp410_remove(struct omap_dss_device *dssdev) |
@@ -130,14 +149,15 @@ static void __exit tfp410_remove(struct omap_dss_device *dssdev) | |||
130 | 149 | ||
131 | mutex_lock(&ddata->lock); | 150 | mutex_lock(&ddata->lock); |
132 | 151 | ||
152 | if (ddata->i2c_adapter) | ||
153 | i2c_put_adapter(ddata->i2c_adapter); | ||
154 | |||
133 | if (gpio_is_valid(ddata->pd_gpio)) | 155 | if (gpio_is_valid(ddata->pd_gpio)) |
134 | gpio_free(ddata->pd_gpio); | 156 | gpio_free(ddata->pd_gpio); |
135 | 157 | ||
136 | dev_set_drvdata(&dssdev->dev, NULL); | 158 | dev_set_drvdata(&dssdev->dev, NULL); |
137 | 159 | ||
138 | mutex_unlock(&ddata->lock); | 160 | mutex_unlock(&ddata->lock); |
139 | |||
140 | kfree(ddata); | ||
141 | } | 161 | } |
142 | 162 | ||
143 | static int tfp410_enable(struct omap_dss_device *dssdev) | 163 | static int tfp410_enable(struct omap_dss_device *dssdev) |
@@ -269,27 +289,17 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev, | |||
269 | u8 *edid, int len) | 289 | u8 *edid, int len) |
270 | { | 290 | { |
271 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 291 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
272 | struct tfp410_platform_data *pdata = get_pdata(dssdev); | ||
273 | struct i2c_adapter *adapter; | ||
274 | int r, l, bytes_read; | 292 | int r, l, bytes_read; |
275 | 293 | ||
276 | mutex_lock(&ddata->lock); | 294 | mutex_lock(&ddata->lock); |
277 | 295 | ||
278 | if (pdata->i2c_bus_num == 0) { | 296 | if (!ddata->i2c_adapter) { |
279 | r = -ENODEV; | 297 | r = -ENODEV; |
280 | goto err; | 298 | goto err; |
281 | } | 299 | } |
282 | 300 | ||
283 | adapter = i2c_get_adapter(pdata->i2c_bus_num); | ||
284 | if (!adapter) { | ||
285 | dev_err(&dssdev->dev, "Failed to get I2C adapter, bus %d\n", | ||
286 | pdata->i2c_bus_num); | ||
287 | r = -EINVAL; | ||
288 | goto err; | ||
289 | } | ||
290 | |||
291 | l = min(EDID_LENGTH, len); | 301 | l = min(EDID_LENGTH, len); |
292 | r = tfp410_ddc_read(adapter, edid, l, 0); | 302 | r = tfp410_ddc_read(ddata->i2c_adapter, edid, l, 0); |
293 | if (r) | 303 | if (r) |
294 | goto err; | 304 | goto err; |
295 | 305 | ||
@@ -299,7 +309,7 @@ static int tfp410_read_edid(struct omap_dss_device *dssdev, | |||
299 | if (len > EDID_LENGTH && edid[0x7e] > 0) { | 309 | if (len > EDID_LENGTH && edid[0x7e] > 0) { |
300 | l = min(EDID_LENGTH, len - EDID_LENGTH); | 310 | l = min(EDID_LENGTH, len - EDID_LENGTH); |
301 | 311 | ||
302 | r = tfp410_ddc_read(adapter, edid + EDID_LENGTH, | 312 | r = tfp410_ddc_read(ddata->i2c_adapter, edid + EDID_LENGTH, |
303 | l, EDID_LENGTH); | 313 | l, EDID_LENGTH); |
304 | if (r) | 314 | if (r) |
305 | goto err; | 315 | goto err; |
@@ -319,21 +329,15 @@ err: | |||
319 | static bool tfp410_detect(struct omap_dss_device *dssdev) | 329 | static bool tfp410_detect(struct omap_dss_device *dssdev) |
320 | { | 330 | { |
321 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); | 331 | struct panel_drv_data *ddata = dev_get_drvdata(&dssdev->dev); |
322 | struct tfp410_platform_data *pdata = get_pdata(dssdev); | ||
323 | struct i2c_adapter *adapter; | ||
324 | unsigned char out; | 332 | unsigned char out; |
325 | int r; | 333 | int r; |
326 | 334 | ||
327 | mutex_lock(&ddata->lock); | 335 | mutex_lock(&ddata->lock); |
328 | 336 | ||
329 | if (pdata->i2c_bus_num == 0) | 337 | if (!ddata->i2c_adapter) |
330 | goto out; | ||
331 | |||
332 | adapter = i2c_get_adapter(pdata->i2c_bus_num); | ||
333 | if (!adapter) | ||
334 | goto out; | 338 | goto out; |
335 | 339 | ||
336 | r = tfp410_ddc_read(adapter, &out, 1, 0); | 340 | r = tfp410_ddc_read(ddata->i2c_adapter, &out, 1, 0); |
337 | 341 | ||
338 | mutex_unlock(&ddata->lock); | 342 | mutex_unlock(&ddata->lock); |
339 | 343 | ||
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 64cb8aa49b26..72ded9cd2cb0 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
@@ -43,6 +43,8 @@ static struct { | |||
43 | 43 | ||
44 | struct regulator *vdds_dsi_reg; | 44 | struct regulator *vdds_dsi_reg; |
45 | struct regulator *vdds_sdi_reg; | 45 | struct regulator *vdds_sdi_reg; |
46 | |||
47 | const char *default_display_name; | ||
46 | } core; | 48 | } core; |
47 | 49 | ||
48 | static char *def_disp_name; | 50 | static char *def_disp_name; |
@@ -54,9 +56,6 @@ bool dss_debug; | |||
54 | module_param_named(debug, dss_debug, bool, 0644); | 56 | module_param_named(debug, dss_debug, bool, 0644); |
55 | #endif | 57 | #endif |
56 | 58 | ||
57 | static int omap_dss_register_device(struct omap_dss_device *); | ||
58 | static void omap_dss_unregister_device(struct omap_dss_device *); | ||
59 | |||
60 | /* REGULATORS */ | 59 | /* REGULATORS */ |
61 | 60 | ||
62 | struct regulator *dss_get_vdds_dsi(void) | 61 | struct regulator *dss_get_vdds_dsi(void) |
@@ -87,6 +86,41 @@ struct regulator *dss_get_vdds_sdi(void) | |||
87 | return reg; | 86 | return reg; |
88 | } | 87 | } |
89 | 88 | ||
89 | int dss_get_ctx_loss_count(struct device *dev) | ||
90 | { | ||
91 | struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; | ||
92 | int cnt; | ||
93 | |||
94 | if (!board_data->get_context_loss_count) | ||
95 | return -ENOENT; | ||
96 | |||
97 | cnt = board_data->get_context_loss_count(dev); | ||
98 | |||
99 | WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); | ||
100 | |||
101 | return cnt; | ||
102 | } | ||
103 | |||
104 | int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask) | ||
105 | { | ||
106 | struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; | ||
107 | |||
108 | if (!board_data->dsi_enable_pads) | ||
109 | return -ENOENT; | ||
110 | |||
111 | return board_data->dsi_enable_pads(dsi_id, lane_mask); | ||
112 | } | ||
113 | |||
114 | void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask) | ||
115 | { | ||
116 | struct omap_dss_board_info *board_data = core.pdev->dev.platform_data; | ||
117 | |||
118 | if (!board_data->dsi_enable_pads) | ||
119 | return; | ||
120 | |||
121 | return board_data->dsi_disable_pads(dsi_id, lane_mask); | ||
122 | } | ||
123 | |||
90 | int dss_set_min_bus_tput(struct device *dev, unsigned long tput) | 124 | int dss_set_min_bus_tput(struct device *dev, unsigned long tput) |
91 | { | 125 | { |
92 | struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; | 126 | struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; |
@@ -131,34 +165,6 @@ static int dss_initialize_debugfs(void) | |||
131 | debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, | 165 | debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, |
132 | &dss_debug_dump_clocks, &dss_debug_fops); | 166 | &dss_debug_dump_clocks, &dss_debug_fops); |
133 | 167 | ||
134 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | ||
135 | debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir, | ||
136 | &dispc_dump_irqs, &dss_debug_fops); | ||
137 | #endif | ||
138 | |||
139 | #if defined(CONFIG_OMAP2_DSS_DSI) && defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS) | ||
140 | dsi_create_debugfs_files_irq(dss_debugfs_dir, &dss_debug_fops); | ||
141 | #endif | ||
142 | |||
143 | debugfs_create_file("dss", S_IRUGO, dss_debugfs_dir, | ||
144 | &dss_dump_regs, &dss_debug_fops); | ||
145 | debugfs_create_file("dispc", S_IRUGO, dss_debugfs_dir, | ||
146 | &dispc_dump_regs, &dss_debug_fops); | ||
147 | #ifdef CONFIG_OMAP2_DSS_RFBI | ||
148 | debugfs_create_file("rfbi", S_IRUGO, dss_debugfs_dir, | ||
149 | &rfbi_dump_regs, &dss_debug_fops); | ||
150 | #endif | ||
151 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
152 | dsi_create_debugfs_files_reg(dss_debugfs_dir, &dss_debug_fops); | ||
153 | #endif | ||
154 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
155 | debugfs_create_file("venc", S_IRUGO, dss_debugfs_dir, | ||
156 | &venc_dump_regs, &dss_debug_fops); | ||
157 | #endif | ||
158 | #ifdef CONFIG_OMAP4_DSS_HDMI | ||
159 | debugfs_create_file("hdmi", S_IRUGO, dss_debugfs_dir, | ||
160 | &hdmi_dump_regs, &dss_debug_fops); | ||
161 | #endif | ||
162 | return 0; | 168 | return 0; |
163 | } | 169 | } |
164 | 170 | ||
@@ -167,6 +173,19 @@ static void dss_uninitialize_debugfs(void) | |||
167 | if (dss_debugfs_dir) | 173 | if (dss_debugfs_dir) |
168 | debugfs_remove_recursive(dss_debugfs_dir); | 174 | debugfs_remove_recursive(dss_debugfs_dir); |
169 | } | 175 | } |
176 | |||
177 | int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) | ||
178 | { | ||
179 | struct dentry *d; | ||
180 | |||
181 | d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, | ||
182 | write, &dss_debug_fops); | ||
183 | |||
184 | if (IS_ERR(d)) | ||
185 | return PTR_ERR(d); | ||
186 | |||
187 | return 0; | ||
188 | } | ||
170 | #else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ | 189 | #else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ |
171 | static inline int dss_initialize_debugfs(void) | 190 | static inline int dss_initialize_debugfs(void) |
172 | { | 191 | { |
@@ -175,14 +194,18 @@ static inline int dss_initialize_debugfs(void) | |||
175 | static inline void dss_uninitialize_debugfs(void) | 194 | static inline void dss_uninitialize_debugfs(void) |
176 | { | 195 | { |
177 | } | 196 | } |
197 | static inline int dss_debugfs_create_file(const char *name, | ||
198 | void (*write)(struct seq_file *)) | ||
199 | { | ||
200 | return 0; | ||
201 | } | ||
178 | #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ | 202 | #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ |
179 | 203 | ||
180 | /* PLATFORM DEVICE */ | 204 | /* PLATFORM DEVICE */ |
181 | static int omap_dss_probe(struct platform_device *pdev) | 205 | static int __init omap_dss_probe(struct platform_device *pdev) |
182 | { | 206 | { |
183 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | 207 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; |
184 | int r; | 208 | int r; |
185 | int i; | ||
186 | 209 | ||
187 | core.pdev = pdev; | 210 | core.pdev = pdev; |
188 | 211 | ||
@@ -197,28 +220,13 @@ static int omap_dss_probe(struct platform_device *pdev) | |||
197 | if (r) | 220 | if (r) |
198 | goto err_debugfs; | 221 | goto err_debugfs; |
199 | 222 | ||
200 | for (i = 0; i < pdata->num_devices; ++i) { | 223 | if (def_disp_name) |
201 | struct omap_dss_device *dssdev = pdata->devices[i]; | 224 | core.default_display_name = def_disp_name; |
202 | 225 | else if (pdata->default_device) | |
203 | r = omap_dss_register_device(dssdev); | 226 | core.default_display_name = pdata->default_device->name; |
204 | if (r) { | ||
205 | DSSERR("device %d %s register failed %d\n", i, | ||
206 | dssdev->name ?: "unnamed", r); | ||
207 | |||
208 | while (--i >= 0) | ||
209 | omap_dss_unregister_device(pdata->devices[i]); | ||
210 | |||
211 | goto err_register; | ||
212 | } | ||
213 | |||
214 | if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0) | ||
215 | pdata->default_device = dssdev; | ||
216 | } | ||
217 | 227 | ||
218 | return 0; | 228 | return 0; |
219 | 229 | ||
220 | err_register: | ||
221 | dss_uninitialize_debugfs(); | ||
222 | err_debugfs: | 230 | err_debugfs: |
223 | 231 | ||
224 | return r; | 232 | return r; |
@@ -226,17 +234,11 @@ err_debugfs: | |||
226 | 234 | ||
227 | static int omap_dss_remove(struct platform_device *pdev) | 235 | static int omap_dss_remove(struct platform_device *pdev) |
228 | { | 236 | { |
229 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
230 | int i; | ||
231 | |||
232 | dss_uninitialize_debugfs(); | 237 | dss_uninitialize_debugfs(); |
233 | 238 | ||
234 | dss_uninit_overlays(pdev); | 239 | dss_uninit_overlays(pdev); |
235 | dss_uninit_overlay_managers(pdev); | 240 | dss_uninit_overlay_managers(pdev); |
236 | 241 | ||
237 | for (i = 0; i < pdata->num_devices; ++i) | ||
238 | omap_dss_unregister_device(pdata->devices[i]); | ||
239 | |||
240 | return 0; | 242 | return 0; |
241 | } | 243 | } |
242 | 244 | ||
@@ -261,7 +263,6 @@ static int omap_dss_resume(struct platform_device *pdev) | |||
261 | } | 263 | } |
262 | 264 | ||
263 | static struct platform_driver omap_dss_driver = { | 265 | static struct platform_driver omap_dss_driver = { |
264 | .probe = omap_dss_probe, | ||
265 | .remove = omap_dss_remove, | 266 | .remove = omap_dss_remove, |
266 | .shutdown = omap_dss_shutdown, | 267 | .shutdown = omap_dss_shutdown, |
267 | .suspend = omap_dss_suspend, | 268 | .suspend = omap_dss_suspend, |
@@ -336,7 +337,6 @@ static int dss_driver_probe(struct device *dev) | |||
336 | int r; | 337 | int r; |
337 | struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver); | 338 | struct omap_dss_driver *dssdrv = to_dss_driver(dev->driver); |
338 | struct omap_dss_device *dssdev = to_dss_device(dev); | 339 | struct omap_dss_device *dssdev = to_dss_device(dev); |
339 | struct omap_dss_board_info *pdata = core.pdev->dev.platform_data; | ||
340 | bool force; | 340 | bool force; |
341 | 341 | ||
342 | DSSDBG("driver_probe: dev %s/%s, drv %s\n", | 342 | DSSDBG("driver_probe: dev %s/%s, drv %s\n", |
@@ -345,7 +345,8 @@ static int dss_driver_probe(struct device *dev) | |||
345 | 345 | ||
346 | dss_init_device(core.pdev, dssdev); | 346 | dss_init_device(core.pdev, dssdev); |
347 | 347 | ||
348 | force = pdata->default_device == dssdev; | 348 | force = core.default_display_name && |
349 | strcmp(core.default_display_name, dssdev->name) == 0; | ||
349 | dss_recheck_connections(dssdev, force); | 350 | dss_recheck_connections(dssdev, force); |
350 | 351 | ||
351 | r = dssdrv->probe(dssdev); | 352 | r = dssdrv->probe(dssdev); |
@@ -439,27 +440,38 @@ static void omap_dss_dev_release(struct device *dev) | |||
439 | reset_device(dev, 0); | 440 | reset_device(dev, 0); |
440 | } | 441 | } |
441 | 442 | ||
442 | static int omap_dss_register_device(struct omap_dss_device *dssdev) | 443 | int omap_dss_register_device(struct omap_dss_device *dssdev, |
444 | struct device *parent, int disp_num) | ||
443 | { | 445 | { |
444 | static int dev_num; | ||
445 | |||
446 | WARN_ON(!dssdev->driver_name); | 446 | WARN_ON(!dssdev->driver_name); |
447 | 447 | ||
448 | reset_device(&dssdev->dev, 1); | 448 | reset_device(&dssdev->dev, 1); |
449 | dssdev->dev.bus = &dss_bus_type; | 449 | dssdev->dev.bus = &dss_bus_type; |
450 | dssdev->dev.parent = &dss_bus; | 450 | dssdev->dev.parent = parent; |
451 | dssdev->dev.release = omap_dss_dev_release; | 451 | dssdev->dev.release = omap_dss_dev_release; |
452 | dev_set_name(&dssdev->dev, "display%d", dev_num++); | 452 | dev_set_name(&dssdev->dev, "display%d", disp_num); |
453 | return device_register(&dssdev->dev); | 453 | return device_register(&dssdev->dev); |
454 | } | 454 | } |
455 | 455 | ||
456 | static void omap_dss_unregister_device(struct omap_dss_device *dssdev) | 456 | void omap_dss_unregister_device(struct omap_dss_device *dssdev) |
457 | { | 457 | { |
458 | device_unregister(&dssdev->dev); | 458 | device_unregister(&dssdev->dev); |
459 | } | 459 | } |
460 | 460 | ||
461 | static int dss_unregister_dss_dev(struct device *dev, void *data) | ||
462 | { | ||
463 | struct omap_dss_device *dssdev = to_dss_device(dev); | ||
464 | omap_dss_unregister_device(dssdev); | ||
465 | return 0; | ||
466 | } | ||
467 | |||
468 | void omap_dss_unregister_child_devices(struct device *parent) | ||
469 | { | ||
470 | device_for_each_child(parent, NULL, dss_unregister_dss_dev); | ||
471 | } | ||
472 | |||
461 | /* BUS */ | 473 | /* BUS */ |
462 | static int omap_dss_bus_register(void) | 474 | static int __init omap_dss_bus_register(void) |
463 | { | 475 | { |
464 | int r; | 476 | int r; |
465 | 477 | ||
@@ -481,12 +493,56 @@ static int omap_dss_bus_register(void) | |||
481 | } | 493 | } |
482 | 494 | ||
483 | /* INIT */ | 495 | /* INIT */ |
496 | static int (*dss_output_drv_reg_funcs[])(void) __initdata = { | ||
497 | #ifdef CONFIG_OMAP2_DSS_DPI | ||
498 | dpi_init_platform_driver, | ||
499 | #endif | ||
500 | #ifdef CONFIG_OMAP2_DSS_SDI | ||
501 | sdi_init_platform_driver, | ||
502 | #endif | ||
503 | #ifdef CONFIG_OMAP2_DSS_RFBI | ||
504 | rfbi_init_platform_driver, | ||
505 | #endif | ||
506 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
507 | venc_init_platform_driver, | ||
508 | #endif | ||
509 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
510 | dsi_init_platform_driver, | ||
511 | #endif | ||
512 | #ifdef CONFIG_OMAP4_DSS_HDMI | ||
513 | hdmi_init_platform_driver, | ||
514 | #endif | ||
515 | }; | ||
516 | |||
517 | static void (*dss_output_drv_unreg_funcs[])(void) __exitdata = { | ||
518 | #ifdef CONFIG_OMAP2_DSS_DPI | ||
519 | dpi_uninit_platform_driver, | ||
520 | #endif | ||
521 | #ifdef CONFIG_OMAP2_DSS_SDI | ||
522 | sdi_uninit_platform_driver, | ||
523 | #endif | ||
524 | #ifdef CONFIG_OMAP2_DSS_RFBI | ||
525 | rfbi_uninit_platform_driver, | ||
526 | #endif | ||
527 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
528 | venc_uninit_platform_driver, | ||
529 | #endif | ||
530 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
531 | dsi_uninit_platform_driver, | ||
532 | #endif | ||
533 | #ifdef CONFIG_OMAP4_DSS_HDMI | ||
534 | hdmi_uninit_platform_driver, | ||
535 | #endif | ||
536 | }; | ||
537 | |||
538 | static bool dss_output_drv_loaded[ARRAY_SIZE(dss_output_drv_reg_funcs)]; | ||
484 | 539 | ||
485 | static int __init omap_dss_register_drivers(void) | 540 | static int __init omap_dss_register_drivers(void) |
486 | { | 541 | { |
487 | int r; | 542 | int r; |
543 | int i; | ||
488 | 544 | ||
489 | r = platform_driver_register(&omap_dss_driver); | 545 | r = platform_driver_probe(&omap_dss_driver, omap_dss_probe); |
490 | if (r) | 546 | if (r) |
491 | return r; | 547 | return r; |
492 | 548 | ||
@@ -502,40 +558,18 @@ static int __init omap_dss_register_drivers(void) | |||
502 | goto err_dispc; | 558 | goto err_dispc; |
503 | } | 559 | } |
504 | 560 | ||
505 | r = rfbi_init_platform_driver(); | 561 | /* |
506 | if (r) { | 562 | * It's ok if the output-driver register fails. It happens, for example, |
507 | DSSERR("Failed to initialize rfbi platform driver\n"); | 563 | * when there is no output-device (e.g. SDI for OMAP4). |
508 | goto err_rfbi; | 564 | */ |
509 | } | 565 | for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) { |
510 | 566 | r = dss_output_drv_reg_funcs[i](); | |
511 | r = venc_init_platform_driver(); | 567 | if (r == 0) |
512 | if (r) { | 568 | dss_output_drv_loaded[i] = true; |
513 | DSSERR("Failed to initialize venc platform driver\n"); | ||
514 | goto err_venc; | ||
515 | } | ||
516 | |||
517 | r = dsi_init_platform_driver(); | ||
518 | if (r) { | ||
519 | DSSERR("Failed to initialize DSI platform driver\n"); | ||
520 | goto err_dsi; | ||
521 | } | ||
522 | |||
523 | r = hdmi_init_platform_driver(); | ||
524 | if (r) { | ||
525 | DSSERR("Failed to initialize hdmi\n"); | ||
526 | goto err_hdmi; | ||
527 | } | 569 | } |
528 | 570 | ||
529 | return 0; | 571 | return 0; |
530 | 572 | ||
531 | err_hdmi: | ||
532 | dsi_uninit_platform_driver(); | ||
533 | err_dsi: | ||
534 | venc_uninit_platform_driver(); | ||
535 | err_venc: | ||
536 | rfbi_uninit_platform_driver(); | ||
537 | err_rfbi: | ||
538 | dispc_uninit_platform_driver(); | ||
539 | err_dispc: | 573 | err_dispc: |
540 | dss_uninit_platform_driver(); | 574 | dss_uninit_platform_driver(); |
541 | err_dss: | 575 | err_dss: |
@@ -546,10 +580,13 @@ err_dss: | |||
546 | 580 | ||
547 | static void __exit omap_dss_unregister_drivers(void) | 581 | static void __exit omap_dss_unregister_drivers(void) |
548 | { | 582 | { |
549 | hdmi_uninit_platform_driver(); | 583 | int i; |
550 | dsi_uninit_platform_driver(); | 584 | |
551 | venc_uninit_platform_driver(); | 585 | for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i) { |
552 | rfbi_uninit_platform_driver(); | 586 | if (dss_output_drv_loaded[i]) |
587 | dss_output_drv_unreg_funcs[i](); | ||
588 | } | ||
589 | |||
553 | dispc_uninit_platform_driver(); | 590 | dispc_uninit_platform_driver(); |
554 | dss_uninit_platform_driver(); | 591 | dss_uninit_platform_driver(); |
555 | 592 | ||
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 727e15b29a14..b509ca661e35 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -131,23 +131,6 @@ static inline u32 dispc_read_reg(const u16 idx) | |||
131 | return __raw_readl(dispc.base + idx); | 131 | return __raw_readl(dispc.base + idx); |
132 | } | 132 | } |
133 | 133 | ||
134 | static int dispc_get_ctx_loss_count(void) | ||
135 | { | ||
136 | struct device *dev = &dispc.pdev->dev; | ||
137 | struct omap_display_platform_data *pdata = dev->platform_data; | ||
138 | struct omap_dss_board_info *board_data = pdata->board_data; | ||
139 | int cnt; | ||
140 | |||
141 | if (!board_data->get_context_loss_count) | ||
142 | return -ENOENT; | ||
143 | |||
144 | cnt = board_data->get_context_loss_count(dev); | ||
145 | |||
146 | WARN_ONCE(cnt < 0, "get_context_loss_count failed: %d\n", cnt); | ||
147 | |||
148 | return cnt; | ||
149 | } | ||
150 | |||
151 | #define SR(reg) \ | 134 | #define SR(reg) \ |
152 | dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg) | 135 | dispc.ctx[DISPC_##reg / sizeof(u32)] = dispc_read_reg(DISPC_##reg) |
153 | #define RR(reg) \ | 136 | #define RR(reg) \ |
@@ -251,7 +234,7 @@ static void dispc_save_context(void) | |||
251 | if (dss_has_feature(FEAT_CORE_CLK_DIV)) | 234 | if (dss_has_feature(FEAT_CORE_CLK_DIV)) |
252 | SR(DIVISOR); | 235 | SR(DIVISOR); |
253 | 236 | ||
254 | dispc.ctx_loss_cnt = dispc_get_ctx_loss_count(); | 237 | dispc.ctx_loss_cnt = dss_get_ctx_loss_count(&dispc.pdev->dev); |
255 | dispc.ctx_valid = true; | 238 | dispc.ctx_valid = true; |
256 | 239 | ||
257 | DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); | 240 | DSSDBG("context saved, ctx_loss_count %d\n", dispc.ctx_loss_cnt); |
@@ -266,7 +249,7 @@ static void dispc_restore_context(void) | |||
266 | if (!dispc.ctx_valid) | 249 | if (!dispc.ctx_valid) |
267 | return; | 250 | return; |
268 | 251 | ||
269 | ctx = dispc_get_ctx_loss_count(); | 252 | ctx = dss_get_ctx_loss_count(&dispc.pdev->dev); |
270 | 253 | ||
271 | if (ctx >= 0 && ctx == dispc.ctx_loss_cnt) | 254 | if (ctx >= 0 && ctx == dispc.ctx_loss_cnt) |
272 | return; | 255 | return; |
@@ -2778,7 +2761,7 @@ void dispc_dump_irqs(struct seq_file *s) | |||
2778 | } | 2761 | } |
2779 | #endif | 2762 | #endif |
2780 | 2763 | ||
2781 | void dispc_dump_regs(struct seq_file *s) | 2764 | static void dispc_dump_regs(struct seq_file *s) |
2782 | { | 2765 | { |
2783 | int i, j; | 2766 | int i, j; |
2784 | const char *mgr_names[] = { | 2767 | const char *mgr_names[] = { |
@@ -3499,7 +3482,7 @@ static void _omap_dispc_initial_config(void) | |||
3499 | } | 3482 | } |
3500 | 3483 | ||
3501 | /* DISPC HW IP initialisation */ | 3484 | /* DISPC HW IP initialisation */ |
3502 | static int omap_dispchw_probe(struct platform_device *pdev) | 3485 | static int __init omap_dispchw_probe(struct platform_device *pdev) |
3503 | { | 3486 | { |
3504 | u32 rev; | 3487 | u32 rev; |
3505 | int r = 0; | 3488 | int r = 0; |
@@ -3568,6 +3551,11 @@ static int omap_dispchw_probe(struct platform_device *pdev) | |||
3568 | 3551 | ||
3569 | dispc_runtime_put(); | 3552 | dispc_runtime_put(); |
3570 | 3553 | ||
3554 | dss_debugfs_create_file("dispc", dispc_dump_regs); | ||
3555 | |||
3556 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | ||
3557 | dss_debugfs_create_file("dispc_irq", dispc_dump_irqs); | ||
3558 | #endif | ||
3571 | return 0; | 3559 | return 0; |
3572 | 3560 | ||
3573 | err_runtime_get: | 3561 | err_runtime_get: |
@@ -3576,7 +3564,7 @@ err_runtime_get: | |||
3576 | return r; | 3564 | return r; |
3577 | } | 3565 | } |
3578 | 3566 | ||
3579 | static int omap_dispchw_remove(struct platform_device *pdev) | 3567 | static int __exit omap_dispchw_remove(struct platform_device *pdev) |
3580 | { | 3568 | { |
3581 | pm_runtime_disable(&pdev->dev); | 3569 | pm_runtime_disable(&pdev->dev); |
3582 | 3570 | ||
@@ -3588,19 +3576,12 @@ static int omap_dispchw_remove(struct platform_device *pdev) | |||
3588 | static int dispc_runtime_suspend(struct device *dev) | 3576 | static int dispc_runtime_suspend(struct device *dev) |
3589 | { | 3577 | { |
3590 | dispc_save_context(); | 3578 | dispc_save_context(); |
3591 | dss_runtime_put(); | ||
3592 | 3579 | ||
3593 | return 0; | 3580 | return 0; |
3594 | } | 3581 | } |
3595 | 3582 | ||
3596 | static int dispc_runtime_resume(struct device *dev) | 3583 | static int dispc_runtime_resume(struct device *dev) |
3597 | { | 3584 | { |
3598 | int r; | ||
3599 | |||
3600 | r = dss_runtime_get(); | ||
3601 | if (r < 0) | ||
3602 | return r; | ||
3603 | |||
3604 | dispc_restore_context(); | 3585 | dispc_restore_context(); |
3605 | 3586 | ||
3606 | return 0; | 3587 | return 0; |
@@ -3612,8 +3593,7 @@ static const struct dev_pm_ops dispc_pm_ops = { | |||
3612 | }; | 3593 | }; |
3613 | 3594 | ||
3614 | static struct platform_driver omap_dispchw_driver = { | 3595 | static struct platform_driver omap_dispchw_driver = { |
3615 | .probe = omap_dispchw_probe, | 3596 | .remove = __exit_p(omap_dispchw_remove), |
3616 | .remove = omap_dispchw_remove, | ||
3617 | .driver = { | 3597 | .driver = { |
3618 | .name = "omapdss_dispc", | 3598 | .name = "omapdss_dispc", |
3619 | .owner = THIS_MODULE, | 3599 | .owner = THIS_MODULE, |
@@ -3621,12 +3601,12 @@ static struct platform_driver omap_dispchw_driver = { | |||
3621 | }, | 3601 | }, |
3622 | }; | 3602 | }; |
3623 | 3603 | ||
3624 | int dispc_init_platform_driver(void) | 3604 | int __init dispc_init_platform_driver(void) |
3625 | { | 3605 | { |
3626 | return platform_driver_register(&omap_dispchw_driver); | 3606 | return platform_driver_probe(&omap_dispchw_driver, omap_dispchw_probe); |
3627 | } | 3607 | } |
3628 | 3608 | ||
3629 | void dispc_uninit_platform_driver(void) | 3609 | void __exit dispc_uninit_platform_driver(void) |
3630 | { | 3610 | { |
3631 | return platform_driver_unregister(&omap_dispchw_driver); | 3611 | platform_driver_unregister(&omap_dispchw_driver); |
3632 | } | 3612 | } |
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index e688d10f061a..faf7d91c4a84 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c | |||
@@ -359,46 +359,6 @@ void dss_init_device(struct platform_device *pdev, | |||
359 | int i; | 359 | int i; |
360 | int r; | 360 | int r; |
361 | 361 | ||
362 | switch (dssdev->type) { | ||
363 | #ifdef CONFIG_OMAP2_DSS_DPI | ||
364 | case OMAP_DISPLAY_TYPE_DPI: | ||
365 | r = dpi_init_display(dssdev); | ||
366 | break; | ||
367 | #endif | ||
368 | #ifdef CONFIG_OMAP2_DSS_RFBI | ||
369 | case OMAP_DISPLAY_TYPE_DBI: | ||
370 | r = rfbi_init_display(dssdev); | ||
371 | break; | ||
372 | #endif | ||
373 | #ifdef CONFIG_OMAP2_DSS_VENC | ||
374 | case OMAP_DISPLAY_TYPE_VENC: | ||
375 | r = venc_init_display(dssdev); | ||
376 | break; | ||
377 | #endif | ||
378 | #ifdef CONFIG_OMAP2_DSS_SDI | ||
379 | case OMAP_DISPLAY_TYPE_SDI: | ||
380 | r = sdi_init_display(dssdev); | ||
381 | break; | ||
382 | #endif | ||
383 | #ifdef CONFIG_OMAP2_DSS_DSI | ||
384 | case OMAP_DISPLAY_TYPE_DSI: | ||
385 | r = dsi_init_display(dssdev); | ||
386 | break; | ||
387 | #endif | ||
388 | case OMAP_DISPLAY_TYPE_HDMI: | ||
389 | r = hdmi_init_display(dssdev); | ||
390 | break; | ||
391 | default: | ||
392 | DSSERR("Support for display '%s' not compiled in.\n", | ||
393 | dssdev->name); | ||
394 | return; | ||
395 | } | ||
396 | |||
397 | if (r) { | ||
398 | DSSERR("failed to init display %s\n", dssdev->name); | ||
399 | return; | ||
400 | } | ||
401 | |||
402 | /* create device sysfs files */ | 362 | /* create device sysfs files */ |
403 | i = 0; | 363 | i = 0; |
404 | while ((attr = display_sysfs_attrs[i++]) != NULL) { | 364 | while ((attr = display_sysfs_attrs[i++]) != NULL) { |
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index d6e8fe776152..8c2056c9537b 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c | |||
@@ -202,10 +202,6 @@ int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) | |||
202 | goto err_reg_enable; | 202 | goto err_reg_enable; |
203 | } | 203 | } |
204 | 204 | ||
205 | r = dss_runtime_get(); | ||
206 | if (r) | ||
207 | goto err_get_dss; | ||
208 | |||
209 | r = dispc_runtime_get(); | 205 | r = dispc_runtime_get(); |
210 | if (r) | 206 | if (r) |
211 | goto err_get_dispc; | 207 | goto err_get_dispc; |
@@ -244,8 +240,6 @@ err_dsi_pll_init: | |||
244 | err_get_dsi: | 240 | err_get_dsi: |
245 | dispc_runtime_put(); | 241 | dispc_runtime_put(); |
246 | err_get_dispc: | 242 | err_get_dispc: |
247 | dss_runtime_put(); | ||
248 | err_get_dss: | ||
249 | if (cpu_is_omap34xx()) | 243 | if (cpu_is_omap34xx()) |
250 | regulator_disable(dpi.vdds_dsi_reg); | 244 | regulator_disable(dpi.vdds_dsi_reg); |
251 | err_reg_enable: | 245 | err_reg_enable: |
@@ -266,7 +260,6 @@ void omapdss_dpi_display_disable(struct omap_dss_device *dssdev) | |||
266 | } | 260 | } |
267 | 261 | ||
268 | dispc_runtime_put(); | 262 | dispc_runtime_put(); |
269 | dss_runtime_put(); | ||
270 | 263 | ||
271 | if (cpu_is_omap34xx()) | 264 | if (cpu_is_omap34xx()) |
272 | regulator_disable(dpi.vdds_dsi_reg); | 265 | regulator_disable(dpi.vdds_dsi_reg); |
@@ -283,20 +276,13 @@ void dpi_set_timings(struct omap_dss_device *dssdev, | |||
283 | DSSDBG("dpi_set_timings\n"); | 276 | DSSDBG("dpi_set_timings\n"); |
284 | dssdev->panel.timings = *timings; | 277 | dssdev->panel.timings = *timings; |
285 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { | 278 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { |
286 | r = dss_runtime_get(); | ||
287 | if (r) | ||
288 | return; | ||
289 | |||
290 | r = dispc_runtime_get(); | 279 | r = dispc_runtime_get(); |
291 | if (r) { | 280 | if (r) |
292 | dss_runtime_put(); | ||
293 | return; | 281 | return; |
294 | } | ||
295 | 282 | ||
296 | dpi_set_mode(dssdev); | 283 | dpi_set_mode(dssdev); |
297 | 284 | ||
298 | dispc_runtime_put(); | 285 | dispc_runtime_put(); |
299 | dss_runtime_put(); | ||
300 | } else { | 286 | } else { |
301 | dss_mgr_set_timings(dssdev->manager, timings); | 287 | dss_mgr_set_timings(dssdev->manager, timings); |
302 | } | 288 | } |
@@ -353,7 +339,7 @@ int dpi_check_timings(struct omap_dss_device *dssdev, | |||
353 | } | 339 | } |
354 | EXPORT_SYMBOL(dpi_check_timings); | 340 | EXPORT_SYMBOL(dpi_check_timings); |
355 | 341 | ||
356 | int dpi_init_display(struct omap_dss_device *dssdev) | 342 | static int __init dpi_init_display(struct omap_dss_device *dssdev) |
357 | { | 343 | { |
358 | DSSDBG("init_display\n"); | 344 | DSSDBG("init_display\n"); |
359 | 345 | ||
@@ -379,12 +365,58 @@ int dpi_init_display(struct omap_dss_device *dssdev) | |||
379 | return 0; | 365 | return 0; |
380 | } | 366 | } |
381 | 367 | ||
382 | int dpi_init(void) | 368 | static void __init dpi_probe_pdata(struct platform_device *pdev) |
369 | { | ||
370 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
371 | int i, r; | ||
372 | |||
373 | for (i = 0; i < pdata->num_devices; ++i) { | ||
374 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
375 | |||
376 | if (dssdev->type != OMAP_DISPLAY_TYPE_DPI) | ||
377 | continue; | ||
378 | |||
379 | r = dpi_init_display(dssdev); | ||
380 | if (r) { | ||
381 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
382 | continue; | ||
383 | } | ||
384 | |||
385 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
386 | if (r) | ||
387 | DSSERR("device %s register failed: %d\n", | ||
388 | dssdev->name, r); | ||
389 | } | ||
390 | } | ||
391 | |||
392 | static int __init omap_dpi_probe(struct platform_device *pdev) | ||
393 | { | ||
394 | dpi_probe_pdata(pdev); | ||
395 | |||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | static int __exit omap_dpi_remove(struct platform_device *pdev) | ||
383 | { | 400 | { |
401 | omap_dss_unregister_child_devices(&pdev->dev); | ||
402 | |||
384 | return 0; | 403 | return 0; |
385 | } | 404 | } |
386 | 405 | ||
387 | void dpi_exit(void) | 406 | static struct platform_driver omap_dpi_driver = { |
407 | .remove = __exit_p(omap_dpi_remove), | ||
408 | .driver = { | ||
409 | .name = "omapdss_dpi", | ||
410 | .owner = THIS_MODULE, | ||
411 | }, | ||
412 | }; | ||
413 | |||
414 | int __init dpi_init_platform_driver(void) | ||
388 | { | 415 | { |
416 | return platform_driver_probe(&omap_dpi_driver, omap_dpi_probe); | ||
389 | } | 417 | } |
390 | 418 | ||
419 | void __exit dpi_uninit_platform_driver(void) | ||
420 | { | ||
421 | platform_driver_unregister(&omap_dpi_driver); | ||
422 | } | ||
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 446e13667471..e2aaf5a167fa 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -256,14 +256,13 @@ struct dsi_data { | |||
256 | struct platform_device *pdev; | 256 | struct platform_device *pdev; |
257 | void __iomem *base; | 257 | void __iomem *base; |
258 | 258 | ||
259 | int module_id; | ||
260 | |||
259 | int irq; | 261 | int irq; |
260 | 262 | ||
261 | struct clk *dss_clk; | 263 | struct clk *dss_clk; |
262 | struct clk *sys_clk; | 264 | struct clk *sys_clk; |
263 | 265 | ||
264 | int (*enable_pads)(int dsi_id, unsigned lane_mask); | ||
265 | void (*disable_pads)(int dsi_id, unsigned lane_mask); | ||
266 | |||
267 | struct dsi_clock_info current_cinfo; | 266 | struct dsi_clock_info current_cinfo; |
268 | 267 | ||
269 | bool vdds_dsi_enabled; | 268 | bool vdds_dsi_enabled; |
@@ -361,11 +360,6 @@ struct platform_device *dsi_get_dsidev_from_id(int module) | |||
361 | return dsi_pdev_map[module]; | 360 | return dsi_pdev_map[module]; |
362 | } | 361 | } |
363 | 362 | ||
364 | static inline int dsi_get_dsidev_id(struct platform_device *dsidev) | ||
365 | { | ||
366 | return dsidev->id; | ||
367 | } | ||
368 | |||
369 | static inline void dsi_write_reg(struct platform_device *dsidev, | 363 | static inline void dsi_write_reg(struct platform_device *dsidev, |
370 | const struct dsi_reg idx, u32 val) | 364 | const struct dsi_reg idx, u32 val) |
371 | { | 365 | { |
@@ -1184,10 +1178,9 @@ static unsigned long dsi_get_txbyteclkhs(struct platform_device *dsidev) | |||
1184 | static unsigned long dsi_fclk_rate(struct platform_device *dsidev) | 1178 | static unsigned long dsi_fclk_rate(struct platform_device *dsidev) |
1185 | { | 1179 | { |
1186 | unsigned long r; | 1180 | unsigned long r; |
1187 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
1188 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1181 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1189 | 1182 | ||
1190 | if (dss_get_dsi_clk_source(dsi_module) == OMAP_DSS_CLK_SRC_FCK) { | 1183 | if (dss_get_dsi_clk_source(dsi->module_id) == OMAP_DSS_CLK_SRC_FCK) { |
1191 | /* DSI FCLK source is DSS_CLK_FCK */ | 1184 | /* DSI FCLK source is DSS_CLK_FCK */ |
1192 | r = clk_get_rate(dsi->dss_clk); | 1185 | r = clk_get_rate(dsi->dss_clk); |
1193 | } else { | 1186 | } else { |
@@ -1686,7 +1679,7 @@ static void dsi_dump_dsidev_clocks(struct platform_device *dsidev, | |||
1686 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1679 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1687 | struct dsi_clock_info *cinfo = &dsi->current_cinfo; | 1680 | struct dsi_clock_info *cinfo = &dsi->current_cinfo; |
1688 | enum omap_dss_clk_source dispc_clk_src, dsi_clk_src; | 1681 | enum omap_dss_clk_source dispc_clk_src, dsi_clk_src; |
1689 | int dsi_module = dsi_get_dsidev_id(dsidev); | 1682 | int dsi_module = dsi->module_id; |
1690 | 1683 | ||
1691 | dispc_clk_src = dss_get_dispc_clk_source(); | 1684 | dispc_clk_src = dss_get_dispc_clk_source(); |
1692 | dsi_clk_src = dss_get_dsi_clk_source(dsi_module); | 1685 | dsi_clk_src = dss_get_dsi_clk_source(dsi_module); |
@@ -1758,7 +1751,6 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, | |||
1758 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 1751 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
1759 | unsigned long flags; | 1752 | unsigned long flags; |
1760 | struct dsi_irq_stats stats; | 1753 | struct dsi_irq_stats stats; |
1761 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
1762 | 1754 | ||
1763 | spin_lock_irqsave(&dsi->irq_stats_lock, flags); | 1755 | spin_lock_irqsave(&dsi->irq_stats_lock, flags); |
1764 | 1756 | ||
@@ -1775,7 +1767,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, | |||
1775 | #define PIS(x) \ | 1767 | #define PIS(x) \ |
1776 | seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]); | 1768 | seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]); |
1777 | 1769 | ||
1778 | seq_printf(s, "-- DSI%d interrupts --\n", dsi_module + 1); | 1770 | seq_printf(s, "-- DSI%d interrupts --\n", dsi->module_id + 1); |
1779 | PIS(VC0); | 1771 | PIS(VC0); |
1780 | PIS(VC1); | 1772 | PIS(VC1); |
1781 | PIS(VC2); | 1773 | PIS(VC2); |
@@ -1855,22 +1847,6 @@ static void dsi2_dump_irqs(struct seq_file *s) | |||
1855 | 1847 | ||
1856 | dsi_dump_dsidev_irqs(dsidev, s); | 1848 | dsi_dump_dsidev_irqs(dsidev, s); |
1857 | } | 1849 | } |
1858 | |||
1859 | void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir, | ||
1860 | const struct file_operations *debug_fops) | ||
1861 | { | ||
1862 | struct platform_device *dsidev; | ||
1863 | |||
1864 | dsidev = dsi_get_dsidev_from_id(0); | ||
1865 | if (dsidev) | ||
1866 | debugfs_create_file("dsi1_irqs", S_IRUGO, debugfs_dir, | ||
1867 | &dsi1_dump_irqs, debug_fops); | ||
1868 | |||
1869 | dsidev = dsi_get_dsidev_from_id(1); | ||
1870 | if (dsidev) | ||
1871 | debugfs_create_file("dsi2_irqs", S_IRUGO, debugfs_dir, | ||
1872 | &dsi2_dump_irqs, debug_fops); | ||
1873 | } | ||
1874 | #endif | 1850 | #endif |
1875 | 1851 | ||
1876 | static void dsi_dump_dsidev_regs(struct platform_device *dsidev, | 1852 | static void dsi_dump_dsidev_regs(struct platform_device *dsidev, |
@@ -1971,21 +1947,6 @@ static void dsi2_dump_regs(struct seq_file *s) | |||
1971 | dsi_dump_dsidev_regs(dsidev, s); | 1947 | dsi_dump_dsidev_regs(dsidev, s); |
1972 | } | 1948 | } |
1973 | 1949 | ||
1974 | void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir, | ||
1975 | const struct file_operations *debug_fops) | ||
1976 | { | ||
1977 | struct platform_device *dsidev; | ||
1978 | |||
1979 | dsidev = dsi_get_dsidev_from_id(0); | ||
1980 | if (dsidev) | ||
1981 | debugfs_create_file("dsi1_regs", S_IRUGO, debugfs_dir, | ||
1982 | &dsi1_dump_regs, debug_fops); | ||
1983 | |||
1984 | dsidev = dsi_get_dsidev_from_id(1); | ||
1985 | if (dsidev) | ||
1986 | debugfs_create_file("dsi2_regs", S_IRUGO, debugfs_dir, | ||
1987 | &dsi2_dump_regs, debug_fops); | ||
1988 | } | ||
1989 | enum dsi_cio_power_state { | 1950 | enum dsi_cio_power_state { |
1990 | DSI_COMPLEXIO_POWER_OFF = 0x0, | 1951 | DSI_COMPLEXIO_POWER_OFF = 0x0, |
1991 | DSI_COMPLEXIO_POWER_ON = 0x1, | 1952 | DSI_COMPLEXIO_POWER_ON = 0x1, |
@@ -2306,7 +2267,7 @@ static int dsi_cio_init(struct omap_dss_device *dssdev) | |||
2306 | 2267 | ||
2307 | DSSDBGF(); | 2268 | DSSDBGF(); |
2308 | 2269 | ||
2309 | r = dsi->enable_pads(dsidev->id, dsi_get_lane_mask(dssdev)); | 2270 | r = dss_dsi_enable_pads(dsi->module_id, dsi_get_lane_mask(dssdev)); |
2310 | if (r) | 2271 | if (r) |
2311 | return r; | 2272 | return r; |
2312 | 2273 | ||
@@ -2416,7 +2377,7 @@ err_cio_pwr: | |||
2416 | dsi_cio_disable_lane_override(dsidev); | 2377 | dsi_cio_disable_lane_override(dsidev); |
2417 | err_scp_clk_dom: | 2378 | err_scp_clk_dom: |
2418 | dsi_disable_scp_clk(dsidev); | 2379 | dsi_disable_scp_clk(dsidev); |
2419 | dsi->disable_pads(dsidev->id, dsi_get_lane_mask(dssdev)); | 2380 | dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dssdev)); |
2420 | return r; | 2381 | return r; |
2421 | } | 2382 | } |
2422 | 2383 | ||
@@ -2430,7 +2391,7 @@ static void dsi_cio_uninit(struct omap_dss_device *dssdev) | |||
2430 | 2391 | ||
2431 | dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); | 2392 | dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); |
2432 | dsi_disable_scp_clk(dsidev); | 2393 | dsi_disable_scp_clk(dsidev); |
2433 | dsi->disable_pads(dsidev->id, dsi_get_lane_mask(dssdev)); | 2394 | dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dssdev)); |
2434 | } | 2395 | } |
2435 | 2396 | ||
2436 | static void dsi_config_tx_fifo(struct platform_device *dsidev, | 2397 | static void dsi_config_tx_fifo(struct platform_device *dsidev, |
@@ -4307,7 +4268,7 @@ static int dsi_configure_dispc_clocks(struct omap_dss_device *dssdev) | |||
4307 | static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | 4268 | static int dsi_display_init_dsi(struct omap_dss_device *dssdev) |
4308 | { | 4269 | { |
4309 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4270 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4310 | int dsi_module = dsi_get_dsidev_id(dsidev); | 4271 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
4311 | int r; | 4272 | int r; |
4312 | 4273 | ||
4313 | r = dsi_pll_init(dsidev, true, true); | 4274 | r = dsi_pll_init(dsidev, true, true); |
@@ -4319,7 +4280,7 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | |||
4319 | goto err1; | 4280 | goto err1; |
4320 | 4281 | ||
4321 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); | 4282 | dss_select_dispc_clk_source(dssdev->clocks.dispc.dispc_fclk_src); |
4322 | dss_select_dsi_clk_source(dsi_module, dssdev->clocks.dsi.dsi_fclk_src); | 4283 | dss_select_dsi_clk_source(dsi->module_id, dssdev->clocks.dsi.dsi_fclk_src); |
4323 | dss_select_lcd_clk_source(dssdev->manager->id, | 4284 | dss_select_lcd_clk_source(dssdev->manager->id, |
4324 | dssdev->clocks.dispc.channel.lcd_clk_src); | 4285 | dssdev->clocks.dispc.channel.lcd_clk_src); |
4325 | 4286 | ||
@@ -4358,7 +4319,7 @@ err3: | |||
4358 | dsi_cio_uninit(dssdev); | 4319 | dsi_cio_uninit(dssdev); |
4359 | err2: | 4320 | err2: |
4360 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4321 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); |
4361 | dss_select_dsi_clk_source(dsi_module, OMAP_DSS_CLK_SRC_FCK); | 4322 | dss_select_dsi_clk_source(dsi->module_id, OMAP_DSS_CLK_SRC_FCK); |
4362 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); | 4323 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); |
4363 | 4324 | ||
4364 | err1: | 4325 | err1: |
@@ -4372,7 +4333,6 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev, | |||
4372 | { | 4333 | { |
4373 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4334 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4374 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 4335 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
4375 | int dsi_module = dsi_get_dsidev_id(dsidev); | ||
4376 | 4336 | ||
4377 | if (enter_ulps && !dsi->ulps_enabled) | 4337 | if (enter_ulps && !dsi->ulps_enabled) |
4378 | dsi_enter_ulps(dsidev); | 4338 | dsi_enter_ulps(dsidev); |
@@ -4385,7 +4345,7 @@ static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev, | |||
4385 | dsi_vc_enable(dsidev, 3, 0); | 4345 | dsi_vc_enable(dsidev, 3, 0); |
4386 | 4346 | ||
4387 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); | 4347 | dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK); |
4388 | dss_select_dsi_clk_source(dsi_module, OMAP_DSS_CLK_SRC_FCK); | 4348 | dss_select_dsi_clk_source(dsi->module_id, OMAP_DSS_CLK_SRC_FCK); |
4389 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); | 4349 | dss_select_lcd_clk_source(dssdev->manager->id, OMAP_DSS_CLK_SRC_FCK); |
4390 | dsi_cio_uninit(dssdev); | 4350 | dsi_cio_uninit(dssdev); |
4391 | dsi_pll_uninit(dsidev, disconnect_lanes); | 4351 | dsi_pll_uninit(dsidev, disconnect_lanes); |
@@ -4489,7 +4449,7 @@ int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) | |||
4489 | } | 4449 | } |
4490 | EXPORT_SYMBOL(omapdss_dsi_enable_te); | 4450 | EXPORT_SYMBOL(omapdss_dsi_enable_te); |
4491 | 4451 | ||
4492 | int dsi_init_display(struct omap_dss_device *dssdev) | 4452 | static int __init dsi_init_display(struct omap_dss_device *dssdev) |
4493 | { | 4453 | { |
4494 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); | 4454 | struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); |
4495 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 4455 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
@@ -4642,13 +4602,39 @@ static void dsi_put_clocks(struct platform_device *dsidev) | |||
4642 | clk_put(dsi->sys_clk); | 4602 | clk_put(dsi->sys_clk); |
4643 | } | 4603 | } |
4644 | 4604 | ||
4605 | static void __init dsi_probe_pdata(struct platform_device *dsidev) | ||
4606 | { | ||
4607 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | ||
4608 | struct omap_dss_board_info *pdata = dsidev->dev.platform_data; | ||
4609 | int i, r; | ||
4610 | |||
4611 | for (i = 0; i < pdata->num_devices; ++i) { | ||
4612 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
4613 | |||
4614 | if (dssdev->type != OMAP_DISPLAY_TYPE_DSI) | ||
4615 | continue; | ||
4616 | |||
4617 | if (dssdev->phy.dsi.module != dsi->module_id) | ||
4618 | continue; | ||
4619 | |||
4620 | r = dsi_init_display(dssdev); | ||
4621 | if (r) { | ||
4622 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
4623 | continue; | ||
4624 | } | ||
4625 | |||
4626 | r = omap_dss_register_device(dssdev, &dsidev->dev, i); | ||
4627 | if (r) | ||
4628 | DSSERR("device %s register failed: %d\n", | ||
4629 | dssdev->name, r); | ||
4630 | } | ||
4631 | } | ||
4632 | |||
4645 | /* DSI1 HW IP initialisation */ | 4633 | /* DSI1 HW IP initialisation */ |
4646 | static int omap_dsihw_probe(struct platform_device *dsidev) | 4634 | static int __init omap_dsihw_probe(struct platform_device *dsidev) |
4647 | { | 4635 | { |
4648 | struct omap_display_platform_data *dss_plat_data; | ||
4649 | struct omap_dss_board_info *board_info; | ||
4650 | u32 rev; | 4636 | u32 rev; |
4651 | int r, i, dsi_module = dsi_get_dsidev_id(dsidev); | 4637 | int r, i; |
4652 | struct resource *dsi_mem; | 4638 | struct resource *dsi_mem; |
4653 | struct dsi_data *dsi; | 4639 | struct dsi_data *dsi; |
4654 | 4640 | ||
@@ -4656,15 +4642,11 @@ static int omap_dsihw_probe(struct platform_device *dsidev) | |||
4656 | if (!dsi) | 4642 | if (!dsi) |
4657 | return -ENOMEM; | 4643 | return -ENOMEM; |
4658 | 4644 | ||
4645 | dsi->module_id = dsidev->id; | ||
4659 | dsi->pdev = dsidev; | 4646 | dsi->pdev = dsidev; |
4660 | dsi_pdev_map[dsi_module] = dsidev; | 4647 | dsi_pdev_map[dsi->module_id] = dsidev; |
4661 | dev_set_drvdata(&dsidev->dev, dsi); | 4648 | dev_set_drvdata(&dsidev->dev, dsi); |
4662 | 4649 | ||
4663 | dss_plat_data = dsidev->dev.platform_data; | ||
4664 | board_info = dss_plat_data->board_data; | ||
4665 | dsi->enable_pads = board_info->dsi_enable_pads; | ||
4666 | dsi->disable_pads = board_info->dsi_disable_pads; | ||
4667 | |||
4668 | spin_lock_init(&dsi->irq_lock); | 4650 | spin_lock_init(&dsi->irq_lock); |
4669 | spin_lock_init(&dsi->errors_lock); | 4651 | spin_lock_init(&dsi->errors_lock); |
4670 | dsi->errors = 0; | 4652 | dsi->errors = 0; |
@@ -4742,8 +4724,21 @@ static int omap_dsihw_probe(struct platform_device *dsidev) | |||
4742 | else | 4724 | else |
4743 | dsi->num_lanes_supported = 3; | 4725 | dsi->num_lanes_supported = 3; |
4744 | 4726 | ||
4727 | dsi_probe_pdata(dsidev); | ||
4728 | |||
4745 | dsi_runtime_put(dsidev); | 4729 | dsi_runtime_put(dsidev); |
4746 | 4730 | ||
4731 | if (dsi->module_id == 0) | ||
4732 | dss_debugfs_create_file("dsi1_regs", dsi1_dump_regs); | ||
4733 | else if (dsi->module_id == 1) | ||
4734 | dss_debugfs_create_file("dsi2_regs", dsi2_dump_regs); | ||
4735 | |||
4736 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | ||
4737 | if (dsi->module_id == 0) | ||
4738 | dss_debugfs_create_file("dsi1_irqs", dsi1_dump_irqs); | ||
4739 | else if (dsi->module_id == 1) | ||
4740 | dss_debugfs_create_file("dsi2_irqs", dsi2_dump_irqs); | ||
4741 | #endif | ||
4747 | return 0; | 4742 | return 0; |
4748 | 4743 | ||
4749 | err_runtime_get: | 4744 | err_runtime_get: |
@@ -4752,12 +4747,14 @@ err_runtime_get: | |||
4752 | return r; | 4747 | return r; |
4753 | } | 4748 | } |
4754 | 4749 | ||
4755 | static int omap_dsihw_remove(struct platform_device *dsidev) | 4750 | static int __exit omap_dsihw_remove(struct platform_device *dsidev) |
4756 | { | 4751 | { |
4757 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); | 4752 | struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); |
4758 | 4753 | ||
4759 | WARN_ON(dsi->scp_clk_refcount > 0); | 4754 | WARN_ON(dsi->scp_clk_refcount > 0); |
4760 | 4755 | ||
4756 | omap_dss_unregister_child_devices(&dsidev->dev); | ||
4757 | |||
4761 | pm_runtime_disable(&dsidev->dev); | 4758 | pm_runtime_disable(&dsidev->dev); |
4762 | 4759 | ||
4763 | dsi_put_clocks(dsidev); | 4760 | dsi_put_clocks(dsidev); |
@@ -4778,7 +4775,6 @@ static int omap_dsihw_remove(struct platform_device *dsidev) | |||
4778 | static int dsi_runtime_suspend(struct device *dev) | 4775 | static int dsi_runtime_suspend(struct device *dev) |
4779 | { | 4776 | { |
4780 | dispc_runtime_put(); | 4777 | dispc_runtime_put(); |
4781 | dss_runtime_put(); | ||
4782 | 4778 | ||
4783 | return 0; | 4779 | return 0; |
4784 | } | 4780 | } |
@@ -4787,20 +4783,11 @@ static int dsi_runtime_resume(struct device *dev) | |||
4787 | { | 4783 | { |
4788 | int r; | 4784 | int r; |
4789 | 4785 | ||
4790 | r = dss_runtime_get(); | ||
4791 | if (r) | ||
4792 | goto err_get_dss; | ||
4793 | |||
4794 | r = dispc_runtime_get(); | 4786 | r = dispc_runtime_get(); |
4795 | if (r) | 4787 | if (r) |
4796 | goto err_get_dispc; | 4788 | return r; |
4797 | 4789 | ||
4798 | return 0; | 4790 | return 0; |
4799 | |||
4800 | err_get_dispc: | ||
4801 | dss_runtime_put(); | ||
4802 | err_get_dss: | ||
4803 | return r; | ||
4804 | } | 4791 | } |
4805 | 4792 | ||
4806 | static const struct dev_pm_ops dsi_pm_ops = { | 4793 | static const struct dev_pm_ops dsi_pm_ops = { |
@@ -4809,8 +4796,7 @@ static const struct dev_pm_ops dsi_pm_ops = { | |||
4809 | }; | 4796 | }; |
4810 | 4797 | ||
4811 | static struct platform_driver omap_dsihw_driver = { | 4798 | static struct platform_driver omap_dsihw_driver = { |
4812 | .probe = omap_dsihw_probe, | 4799 | .remove = __exit_p(omap_dsihw_remove), |
4813 | .remove = omap_dsihw_remove, | ||
4814 | .driver = { | 4800 | .driver = { |
4815 | .name = "omapdss_dsi", | 4801 | .name = "omapdss_dsi", |
4816 | .owner = THIS_MODULE, | 4802 | .owner = THIS_MODULE, |
@@ -4818,12 +4804,12 @@ static struct platform_driver omap_dsihw_driver = { | |||
4818 | }, | 4804 | }, |
4819 | }; | 4805 | }; |
4820 | 4806 | ||
4821 | int dsi_init_platform_driver(void) | 4807 | int __init dsi_init_platform_driver(void) |
4822 | { | 4808 | { |
4823 | return platform_driver_register(&omap_dsihw_driver); | 4809 | return platform_driver_probe(&omap_dsihw_driver, omap_dsihw_probe); |
4824 | } | 4810 | } |
4825 | 4811 | ||
4826 | void dsi_uninit_platform_driver(void) | 4812 | void __exit dsi_uninit_platform_driver(void) |
4827 | { | 4813 | { |
4828 | return platform_driver_unregister(&omap_dsihw_driver); | 4814 | platform_driver_unregister(&omap_dsihw_driver); |
4829 | } | 4815 | } |
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index e212acb1e7d5..2183f840a7ac 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -62,6 +62,9 @@ struct dss_reg { | |||
62 | #define REG_FLD_MOD(idx, val, start, end) \ | 62 | #define REG_FLD_MOD(idx, val, start, end) \ |
63 | dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end)) | 63 | dss_write_reg(idx, FLD_MOD(dss_read_reg(idx), val, start, end)) |
64 | 64 | ||
65 | static int dss_runtime_get(void); | ||
66 | static void dss_runtime_put(void); | ||
67 | |||
65 | static struct { | 68 | static struct { |
66 | struct platform_device *pdev; | 69 | struct platform_device *pdev; |
67 | void __iomem *base; | 70 | void __iomem *base; |
@@ -277,7 +280,7 @@ void dss_dump_clocks(struct seq_file *s) | |||
277 | dss_runtime_put(); | 280 | dss_runtime_put(); |
278 | } | 281 | } |
279 | 282 | ||
280 | void dss_dump_regs(struct seq_file *s) | 283 | static void dss_dump_regs(struct seq_file *s) |
281 | { | 284 | { |
282 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r)) | 285 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dss_read_reg(r)) |
283 | 286 | ||
@@ -707,7 +710,7 @@ static void dss_put_clocks(void) | |||
707 | clk_put(dss.dss_clk); | 710 | clk_put(dss.dss_clk); |
708 | } | 711 | } |
709 | 712 | ||
710 | int dss_runtime_get(void) | 713 | static int dss_runtime_get(void) |
711 | { | 714 | { |
712 | int r; | 715 | int r; |
713 | 716 | ||
@@ -718,7 +721,7 @@ int dss_runtime_get(void) | |||
718 | return r < 0 ? r : 0; | 721 | return r < 0 ? r : 0; |
719 | } | 722 | } |
720 | 723 | ||
721 | void dss_runtime_put(void) | 724 | static void dss_runtime_put(void) |
722 | { | 725 | { |
723 | int r; | 726 | int r; |
724 | 727 | ||
@@ -741,7 +744,7 @@ void dss_debug_dump_clocks(struct seq_file *s) | |||
741 | #endif | 744 | #endif |
742 | 745 | ||
743 | /* DSS HW IP initialisation */ | 746 | /* DSS HW IP initialisation */ |
744 | static int omap_dsshw_probe(struct platform_device *pdev) | 747 | static int __init omap_dsshw_probe(struct platform_device *pdev) |
745 | { | 748 | { |
746 | struct resource *dss_mem; | 749 | struct resource *dss_mem; |
747 | u32 rev; | 750 | u32 rev; |
@@ -786,40 +789,24 @@ static int omap_dsshw_probe(struct platform_device *pdev) | |||
786 | dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK; | 789 | dss.lcd_clk_source[0] = OMAP_DSS_CLK_SRC_FCK; |
787 | dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK; | 790 | dss.lcd_clk_source[1] = OMAP_DSS_CLK_SRC_FCK; |
788 | 791 | ||
789 | r = dpi_init(); | ||
790 | if (r) { | ||
791 | DSSERR("Failed to initialize DPI\n"); | ||
792 | goto err_dpi; | ||
793 | } | ||
794 | |||
795 | r = sdi_init(); | ||
796 | if (r) { | ||
797 | DSSERR("Failed to initialize SDI\n"); | ||
798 | goto err_sdi; | ||
799 | } | ||
800 | |||
801 | rev = dss_read_reg(DSS_REVISION); | 792 | rev = dss_read_reg(DSS_REVISION); |
802 | printk(KERN_INFO "OMAP DSS rev %d.%d\n", | 793 | printk(KERN_INFO "OMAP DSS rev %d.%d\n", |
803 | FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); | 794 | FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); |
804 | 795 | ||
805 | dss_runtime_put(); | 796 | dss_runtime_put(); |
806 | 797 | ||
798 | dss_debugfs_create_file("dss", dss_dump_regs); | ||
799 | |||
807 | return 0; | 800 | return 0; |
808 | err_sdi: | 801 | |
809 | dpi_exit(); | ||
810 | err_dpi: | ||
811 | dss_runtime_put(); | ||
812 | err_runtime_get: | 802 | err_runtime_get: |
813 | pm_runtime_disable(&pdev->dev); | 803 | pm_runtime_disable(&pdev->dev); |
814 | dss_put_clocks(); | 804 | dss_put_clocks(); |
815 | return r; | 805 | return r; |
816 | } | 806 | } |
817 | 807 | ||
818 | static int omap_dsshw_remove(struct platform_device *pdev) | 808 | static int __exit omap_dsshw_remove(struct platform_device *pdev) |
819 | { | 809 | { |
820 | dpi_exit(); | ||
821 | sdi_exit(); | ||
822 | |||
823 | pm_runtime_disable(&pdev->dev); | 810 | pm_runtime_disable(&pdev->dev); |
824 | 811 | ||
825 | dss_put_clocks(); | 812 | dss_put_clocks(); |
@@ -858,8 +845,7 @@ static const struct dev_pm_ops dss_pm_ops = { | |||
858 | }; | 845 | }; |
859 | 846 | ||
860 | static struct platform_driver omap_dsshw_driver = { | 847 | static struct platform_driver omap_dsshw_driver = { |
861 | .probe = omap_dsshw_probe, | 848 | .remove = __exit_p(omap_dsshw_remove), |
862 | .remove = omap_dsshw_remove, | ||
863 | .driver = { | 849 | .driver = { |
864 | .name = "omapdss_dss", | 850 | .name = "omapdss_dss", |
865 | .owner = THIS_MODULE, | 851 | .owner = THIS_MODULE, |
@@ -867,12 +853,12 @@ static struct platform_driver omap_dsshw_driver = { | |||
867 | }, | 853 | }, |
868 | }; | 854 | }; |
869 | 855 | ||
870 | int dss_init_platform_driver(void) | 856 | int __init dss_init_platform_driver(void) |
871 | { | 857 | { |
872 | return platform_driver_register(&omap_dsshw_driver); | 858 | return platform_driver_probe(&omap_dsshw_driver, omap_dsshw_probe); |
873 | } | 859 | } |
874 | 860 | ||
875 | void dss_uninit_platform_driver(void) | 861 | void dss_uninit_platform_driver(void) |
876 | { | 862 | { |
877 | return platform_driver_unregister(&omap_dsshw_driver); | 863 | platform_driver_unregister(&omap_dsshw_driver); |
878 | } | 864 | } |
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 8e9e9a5765fa..d5cb19fe7e8b 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -159,7 +159,16 @@ struct platform_device; | |||
159 | struct bus_type *dss_get_bus(void); | 159 | struct bus_type *dss_get_bus(void); |
160 | struct regulator *dss_get_vdds_dsi(void); | 160 | struct regulator *dss_get_vdds_dsi(void); |
161 | struct regulator *dss_get_vdds_sdi(void); | 161 | struct regulator *dss_get_vdds_sdi(void); |
162 | int dss_get_ctx_loss_count(struct device *dev); | ||
163 | int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask); | ||
164 | void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask); | ||
162 | int dss_set_min_bus_tput(struct device *dev, unsigned long tput); | 165 | int dss_set_min_bus_tput(struct device *dev, unsigned long tput); |
166 | int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)); | ||
167 | |||
168 | int omap_dss_register_device(struct omap_dss_device *dssdev, | ||
169 | struct device *parent, int disp_num); | ||
170 | void omap_dss_unregister_device(struct omap_dss_device *dssdev); | ||
171 | void omap_dss_unregister_child_devices(struct device *parent); | ||
163 | 172 | ||
164 | /* apply */ | 173 | /* apply */ |
165 | void dss_apply_init(void); | 174 | void dss_apply_init(void); |
@@ -227,18 +236,14 @@ int dss_ovl_check(struct omap_overlay *ovl, struct omap_overlay_info *info, | |||
227 | const struct omap_video_timings *mgr_timings); | 236 | const struct omap_video_timings *mgr_timings); |
228 | 237 | ||
229 | /* DSS */ | 238 | /* DSS */ |
230 | int dss_init_platform_driver(void); | 239 | int dss_init_platform_driver(void) __init; |
231 | void dss_uninit_platform_driver(void); | 240 | void dss_uninit_platform_driver(void); |
232 | 241 | ||
233 | int dss_runtime_get(void); | ||
234 | void dss_runtime_put(void); | ||
235 | |||
236 | void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); | 242 | void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); |
237 | enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); | 243 | enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); |
238 | const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); | 244 | const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src); |
239 | void dss_dump_clocks(struct seq_file *s); | 245 | void dss_dump_clocks(struct seq_file *s); |
240 | 246 | ||
241 | void dss_dump_regs(struct seq_file *s); | ||
242 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) | 247 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) |
243 | void dss_debug_dump_clocks(struct seq_file *s); | 248 | void dss_debug_dump_clocks(struct seq_file *s); |
244 | #endif | 249 | #endif |
@@ -268,19 +273,8 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck, | |||
268 | struct dispc_clock_info *dispc_cinfo); | 273 | struct dispc_clock_info *dispc_cinfo); |
269 | 274 | ||
270 | /* SDI */ | 275 | /* SDI */ |
271 | #ifdef CONFIG_OMAP2_DSS_SDI | 276 | int sdi_init_platform_driver(void) __init; |
272 | int sdi_init(void); | 277 | void sdi_uninit_platform_driver(void) __exit; |
273 | void sdi_exit(void); | ||
274 | int sdi_init_display(struct omap_dss_device *display); | ||
275 | #else | ||
276 | static inline int sdi_init(void) | ||
277 | { | ||
278 | return 0; | ||
279 | } | ||
280 | static inline void sdi_exit(void) | ||
281 | { | ||
282 | } | ||
283 | #endif | ||
284 | 278 | ||
285 | /* DSI */ | 279 | /* DSI */ |
286 | #ifdef CONFIG_OMAP2_DSS_DSI | 280 | #ifdef CONFIG_OMAP2_DSS_DSI |
@@ -288,19 +282,14 @@ static inline void sdi_exit(void) | |||
288 | struct dentry; | 282 | struct dentry; |
289 | struct file_operations; | 283 | struct file_operations; |
290 | 284 | ||
291 | int dsi_init_platform_driver(void); | 285 | int dsi_init_platform_driver(void) __init; |
292 | void dsi_uninit_platform_driver(void); | 286 | void dsi_uninit_platform_driver(void) __exit; |
293 | 287 | ||
294 | int dsi_runtime_get(struct platform_device *dsidev); | 288 | int dsi_runtime_get(struct platform_device *dsidev); |
295 | void dsi_runtime_put(struct platform_device *dsidev); | 289 | void dsi_runtime_put(struct platform_device *dsidev); |
296 | 290 | ||
297 | void dsi_dump_clocks(struct seq_file *s); | 291 | void dsi_dump_clocks(struct seq_file *s); |
298 | void dsi_create_debugfs_files_irq(struct dentry *debugfs_dir, | ||
299 | const struct file_operations *debug_fops); | ||
300 | void dsi_create_debugfs_files_reg(struct dentry *debugfs_dir, | ||
301 | const struct file_operations *debug_fops); | ||
302 | 292 | ||
303 | int dsi_init_display(struct omap_dss_device *display); | ||
304 | void dsi_irq_handler(void); | 293 | void dsi_irq_handler(void); |
305 | u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt); | 294 | u8 dsi_get_pixel_size(enum omap_dss_dsi_pixel_format fmt); |
306 | 295 | ||
@@ -317,13 +306,6 @@ void dsi_wait_pll_hsdiv_dispc_active(struct platform_device *dsidev); | |||
317 | void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev); | 306 | void dsi_wait_pll_hsdiv_dsi_active(struct platform_device *dsidev); |
318 | struct platform_device *dsi_get_dsidev_from_id(int module); | 307 | struct platform_device *dsi_get_dsidev_from_id(int module); |
319 | #else | 308 | #else |
320 | static inline int dsi_init_platform_driver(void) | ||
321 | { | ||
322 | return 0; | ||
323 | } | ||
324 | static inline void dsi_uninit_platform_driver(void) | ||
325 | { | ||
326 | } | ||
327 | static inline int dsi_runtime_get(struct platform_device *dsidev) | 309 | static inline int dsi_runtime_get(struct platform_device *dsidev) |
328 | { | 310 | { |
329 | return 0; | 311 | return 0; |
@@ -380,26 +362,13 @@ static inline struct platform_device *dsi_get_dsidev_from_id(int module) | |||
380 | #endif | 362 | #endif |
381 | 363 | ||
382 | /* DPI */ | 364 | /* DPI */ |
383 | #ifdef CONFIG_OMAP2_DSS_DPI | 365 | int dpi_init_platform_driver(void) __init; |
384 | int dpi_init(void); | 366 | void dpi_uninit_platform_driver(void) __exit; |
385 | void dpi_exit(void); | ||
386 | int dpi_init_display(struct omap_dss_device *dssdev); | ||
387 | #else | ||
388 | static inline int dpi_init(void) | ||
389 | { | ||
390 | return 0; | ||
391 | } | ||
392 | static inline void dpi_exit(void) | ||
393 | { | ||
394 | } | ||
395 | #endif | ||
396 | 367 | ||
397 | /* DISPC */ | 368 | /* DISPC */ |
398 | int dispc_init_platform_driver(void); | 369 | int dispc_init_platform_driver(void) __init; |
399 | void dispc_uninit_platform_driver(void); | 370 | void dispc_uninit_platform_driver(void) __exit; |
400 | void dispc_dump_clocks(struct seq_file *s); | 371 | void dispc_dump_clocks(struct seq_file *s); |
401 | void dispc_dump_irqs(struct seq_file *s); | ||
402 | void dispc_dump_regs(struct seq_file *s); | ||
403 | void dispc_irq_handler(void); | 372 | void dispc_irq_handler(void); |
404 | 373 | ||
405 | int dispc_runtime_get(void); | 374 | int dispc_runtime_get(void); |
@@ -463,19 +432,10 @@ void dispc_mgr_setup(enum omap_channel channel, | |||
463 | 432 | ||
464 | /* VENC */ | 433 | /* VENC */ |
465 | #ifdef CONFIG_OMAP2_DSS_VENC | 434 | #ifdef CONFIG_OMAP2_DSS_VENC |
466 | int venc_init_platform_driver(void); | 435 | int venc_init_platform_driver(void) __init; |
467 | void venc_uninit_platform_driver(void); | 436 | void venc_uninit_platform_driver(void) __exit; |
468 | void venc_dump_regs(struct seq_file *s); | ||
469 | int venc_init_display(struct omap_dss_device *display); | ||
470 | unsigned long venc_get_pixel_clock(void); | 437 | unsigned long venc_get_pixel_clock(void); |
471 | #else | 438 | #else |
472 | static inline int venc_init_platform_driver(void) | ||
473 | { | ||
474 | return 0; | ||
475 | } | ||
476 | static inline void venc_uninit_platform_driver(void) | ||
477 | { | ||
478 | } | ||
479 | static inline unsigned long venc_get_pixel_clock(void) | 439 | static inline unsigned long venc_get_pixel_clock(void) |
480 | { | 440 | { |
481 | WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__); | 441 | WARN("%s: VENC not compiled in, returning pclk as 0\n", __func__); |
@@ -485,23 +445,10 @@ static inline unsigned long venc_get_pixel_clock(void) | |||
485 | 445 | ||
486 | /* HDMI */ | 446 | /* HDMI */ |
487 | #ifdef CONFIG_OMAP4_DSS_HDMI | 447 | #ifdef CONFIG_OMAP4_DSS_HDMI |
488 | int hdmi_init_platform_driver(void); | 448 | int hdmi_init_platform_driver(void) __init; |
489 | void hdmi_uninit_platform_driver(void); | 449 | void hdmi_uninit_platform_driver(void) __exit; |
490 | int hdmi_init_display(struct omap_dss_device *dssdev); | ||
491 | unsigned long hdmi_get_pixel_clock(void); | 450 | unsigned long hdmi_get_pixel_clock(void); |
492 | void hdmi_dump_regs(struct seq_file *s); | ||
493 | #else | 451 | #else |
494 | static inline int hdmi_init_display(struct omap_dss_device *dssdev) | ||
495 | { | ||
496 | return 0; | ||
497 | } | ||
498 | static inline int hdmi_init_platform_driver(void) | ||
499 | { | ||
500 | return 0; | ||
501 | } | ||
502 | static inline void hdmi_uninit_platform_driver(void) | ||
503 | { | ||
504 | } | ||
505 | static inline unsigned long hdmi_get_pixel_clock(void) | 452 | static inline unsigned long hdmi_get_pixel_clock(void) |
506 | { | 453 | { |
507 | WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__); | 454 | WARN("%s: HDMI not compiled in, returning pclk as 0\n", __func__); |
@@ -519,20 +466,8 @@ int hdmi_panel_init(void); | |||
519 | void hdmi_panel_exit(void); | 466 | void hdmi_panel_exit(void); |
520 | 467 | ||
521 | /* RFBI */ | 468 | /* RFBI */ |
522 | #ifdef CONFIG_OMAP2_DSS_RFBI | 469 | int rfbi_init_platform_driver(void) __init; |
523 | int rfbi_init_platform_driver(void); | 470 | void rfbi_uninit_platform_driver(void) __exit; |
524 | void rfbi_uninit_platform_driver(void); | ||
525 | void rfbi_dump_regs(struct seq_file *s); | ||
526 | int rfbi_init_display(struct omap_dss_device *display); | ||
527 | #else | ||
528 | static inline int rfbi_init_platform_driver(void) | ||
529 | { | ||
530 | return 0; | ||
531 | } | ||
532 | static inline void rfbi_uninit_platform_driver(void) | ||
533 | { | ||
534 | } | ||
535 | #endif | ||
536 | 471 | ||
537 | 472 | ||
538 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | 473 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 32ad7124a952..5f2e2f677bef 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
@@ -63,7 +63,6 @@ | |||
63 | 63 | ||
64 | static struct { | 64 | static struct { |
65 | struct mutex lock; | 65 | struct mutex lock; |
66 | struct omap_display_platform_data *pdata; | ||
67 | struct platform_device *pdev; | 66 | struct platform_device *pdev; |
68 | struct hdmi_ip_data ip_data; | 67 | struct hdmi_ip_data ip_data; |
69 | 68 | ||
@@ -130,25 +129,12 @@ static int hdmi_runtime_get(void) | |||
130 | 129 | ||
131 | DSSDBG("hdmi_runtime_get\n"); | 130 | DSSDBG("hdmi_runtime_get\n"); |
132 | 131 | ||
133 | /* | ||
134 | * HACK: Add dss_runtime_get() to ensure DSS clock domain is enabled. | ||
135 | * This should be removed later. | ||
136 | */ | ||
137 | r = dss_runtime_get(); | ||
138 | if (r < 0) | ||
139 | goto err_get_dss; | ||
140 | |||
141 | r = pm_runtime_get_sync(&hdmi.pdev->dev); | 132 | r = pm_runtime_get_sync(&hdmi.pdev->dev); |
142 | WARN_ON(r < 0); | 133 | WARN_ON(r < 0); |
143 | if (r < 0) | 134 | if (r < 0) |
144 | goto err_get_hdmi; | 135 | return r; |
145 | 136 | ||
146 | return 0; | 137 | return 0; |
147 | |||
148 | err_get_hdmi: | ||
149 | dss_runtime_put(); | ||
150 | err_get_dss: | ||
151 | return r; | ||
152 | } | 138 | } |
153 | 139 | ||
154 | static void hdmi_runtime_put(void) | 140 | static void hdmi_runtime_put(void) |
@@ -159,15 +145,9 @@ static void hdmi_runtime_put(void) | |||
159 | 145 | ||
160 | r = pm_runtime_put_sync(&hdmi.pdev->dev); | 146 | r = pm_runtime_put_sync(&hdmi.pdev->dev); |
161 | WARN_ON(r < 0); | 147 | WARN_ON(r < 0); |
162 | |||
163 | /* | ||
164 | * HACK: This is added to complement the dss_runtime_get() call in | ||
165 | * hdmi_runtime_get(). This should be removed later. | ||
166 | */ | ||
167 | dss_runtime_put(); | ||
168 | } | 148 | } |
169 | 149 | ||
170 | int hdmi_init_display(struct omap_dss_device *dssdev) | 150 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) |
171 | { | 151 | { |
172 | DSSDBG("init_display\n"); | 152 | DSSDBG("init_display\n"); |
173 | 153 | ||
@@ -440,7 +420,7 @@ void omapdss_hdmi_display_set_timing(struct omap_dss_device *dssdev) | |||
440 | } | 420 | } |
441 | } | 421 | } |
442 | 422 | ||
443 | void hdmi_dump_regs(struct seq_file *s) | 423 | static void hdmi_dump_regs(struct seq_file *s) |
444 | { | 424 | { |
445 | mutex_lock(&hdmi.lock); | 425 | mutex_lock(&hdmi.lock); |
446 | 426 | ||
@@ -791,13 +771,36 @@ static void hdmi_put_clocks(void) | |||
791 | clk_put(hdmi.sys_clk); | 771 | clk_put(hdmi.sys_clk); |
792 | } | 772 | } |
793 | 773 | ||
774 | static void __init hdmi_probe_pdata(struct platform_device *pdev) | ||
775 | { | ||
776 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
777 | int r, i; | ||
778 | |||
779 | for (i = 0; i < pdata->num_devices; ++i) { | ||
780 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
781 | |||
782 | if (dssdev->type != OMAP_DISPLAY_TYPE_HDMI) | ||
783 | continue; | ||
784 | |||
785 | r = hdmi_init_display(dssdev); | ||
786 | if (r) { | ||
787 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
788 | continue; | ||
789 | } | ||
790 | |||
791 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
792 | if (r) | ||
793 | DSSERR("device %s register failed: %d\n", | ||
794 | dssdev->name, r); | ||
795 | } | ||
796 | } | ||
797 | |||
794 | /* HDMI HW IP initialisation */ | 798 | /* HDMI HW IP initialisation */ |
795 | static int omapdss_hdmihw_probe(struct platform_device *pdev) | 799 | static int __init omapdss_hdmihw_probe(struct platform_device *pdev) |
796 | { | 800 | { |
797 | struct resource *hdmi_mem; | 801 | struct resource *hdmi_mem; |
798 | int r; | 802 | int r; |
799 | 803 | ||
800 | hdmi.pdata = pdev->dev.platform_data; | ||
801 | hdmi.pdev = pdev; | 804 | hdmi.pdev = pdev; |
802 | 805 | ||
803 | mutex_init(&hdmi.lock); | 806 | mutex_init(&hdmi.lock); |
@@ -831,6 +834,10 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) | |||
831 | 834 | ||
832 | hdmi_panel_init(); | 835 | hdmi_panel_init(); |
833 | 836 | ||
837 | dss_debugfs_create_file("hdmi", hdmi_dump_regs); | ||
838 | |||
839 | hdmi_probe_pdata(pdev); | ||
840 | |||
834 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 841 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ |
835 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) | 842 | defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI_MODULE) |
836 | 843 | ||
@@ -845,8 +852,10 @@ static int omapdss_hdmihw_probe(struct platform_device *pdev) | |||
845 | return 0; | 852 | return 0; |
846 | } | 853 | } |
847 | 854 | ||
848 | static int omapdss_hdmihw_remove(struct platform_device *pdev) | 855 | static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) |
849 | { | 856 | { |
857 | omap_dss_unregister_child_devices(&pdev->dev); | ||
858 | |||
850 | hdmi_panel_exit(); | 859 | hdmi_panel_exit(); |
851 | 860 | ||
852 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ | 861 | #if defined(CONFIG_SND_OMAP_SOC_OMAP4_HDMI) || \ |
@@ -868,7 +877,6 @@ static int hdmi_runtime_suspend(struct device *dev) | |||
868 | clk_disable(hdmi.sys_clk); | 877 | clk_disable(hdmi.sys_clk); |
869 | 878 | ||
870 | dispc_runtime_put(); | 879 | dispc_runtime_put(); |
871 | dss_runtime_put(); | ||
872 | 880 | ||
873 | return 0; | 881 | return 0; |
874 | } | 882 | } |
@@ -877,23 +885,13 @@ static int hdmi_runtime_resume(struct device *dev) | |||
877 | { | 885 | { |
878 | int r; | 886 | int r; |
879 | 887 | ||
880 | r = dss_runtime_get(); | ||
881 | if (r < 0) | ||
882 | goto err_get_dss; | ||
883 | |||
884 | r = dispc_runtime_get(); | 888 | r = dispc_runtime_get(); |
885 | if (r < 0) | 889 | if (r < 0) |
886 | goto err_get_dispc; | 890 | return r; |
887 | |||
888 | 891 | ||
889 | clk_enable(hdmi.sys_clk); | 892 | clk_enable(hdmi.sys_clk); |
890 | 893 | ||
891 | return 0; | 894 | return 0; |
892 | |||
893 | err_get_dispc: | ||
894 | dss_runtime_put(); | ||
895 | err_get_dss: | ||
896 | return r; | ||
897 | } | 895 | } |
898 | 896 | ||
899 | static const struct dev_pm_ops hdmi_pm_ops = { | 897 | static const struct dev_pm_ops hdmi_pm_ops = { |
@@ -902,8 +900,7 @@ static const struct dev_pm_ops hdmi_pm_ops = { | |||
902 | }; | 900 | }; |
903 | 901 | ||
904 | static struct platform_driver omapdss_hdmihw_driver = { | 902 | static struct platform_driver omapdss_hdmihw_driver = { |
905 | .probe = omapdss_hdmihw_probe, | 903 | .remove = __exit_p(omapdss_hdmihw_remove), |
906 | .remove = omapdss_hdmihw_remove, | ||
907 | .driver = { | 904 | .driver = { |
908 | .name = "omapdss_hdmi", | 905 | .name = "omapdss_hdmi", |
909 | .owner = THIS_MODULE, | 906 | .owner = THIS_MODULE, |
@@ -911,12 +908,12 @@ static struct platform_driver omapdss_hdmihw_driver = { | |||
911 | }, | 908 | }, |
912 | }; | 909 | }; |
913 | 910 | ||
914 | int hdmi_init_platform_driver(void) | 911 | int __init hdmi_init_platform_driver(void) |
915 | { | 912 | { |
916 | return platform_driver_register(&omapdss_hdmihw_driver); | 913 | return platform_driver_probe(&omapdss_hdmihw_driver, omapdss_hdmihw_probe); |
917 | } | 914 | } |
918 | 915 | ||
919 | void hdmi_uninit_platform_driver(void) | 916 | void __exit hdmi_uninit_platform_driver(void) |
920 | { | 917 | { |
921 | return platform_driver_unregister(&omapdss_hdmihw_driver); | 918 | platform_driver_unregister(&omapdss_hdmihw_driver); |
922 | } | 919 | } |
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index feadfab27ec2..3d8c206e90e5 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c | |||
@@ -819,7 +819,7 @@ int omap_rfbi_update(struct omap_dss_device *dssdev, | |||
819 | } | 819 | } |
820 | EXPORT_SYMBOL(omap_rfbi_update); | 820 | EXPORT_SYMBOL(omap_rfbi_update); |
821 | 821 | ||
822 | void rfbi_dump_regs(struct seq_file *s) | 822 | static void rfbi_dump_regs(struct seq_file *s) |
823 | { | 823 | { |
824 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r)) | 824 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r)) |
825 | 825 | ||
@@ -920,15 +920,39 @@ void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) | |||
920 | } | 920 | } |
921 | EXPORT_SYMBOL(omapdss_rfbi_display_disable); | 921 | EXPORT_SYMBOL(omapdss_rfbi_display_disable); |
922 | 922 | ||
923 | int rfbi_init_display(struct omap_dss_device *dssdev) | 923 | static int __init rfbi_init_display(struct omap_dss_device *dssdev) |
924 | { | 924 | { |
925 | rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; | 925 | rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; |
926 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; | 926 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; |
927 | return 0; | 927 | return 0; |
928 | } | 928 | } |
929 | 929 | ||
930 | static void __init rfbi_probe_pdata(struct platform_device *pdev) | ||
931 | { | ||
932 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
933 | int i, r; | ||
934 | |||
935 | for (i = 0; i < pdata->num_devices; ++i) { | ||
936 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
937 | |||
938 | if (dssdev->type != OMAP_DISPLAY_TYPE_DBI) | ||
939 | continue; | ||
940 | |||
941 | r = rfbi_init_display(dssdev); | ||
942 | if (r) { | ||
943 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
944 | continue; | ||
945 | } | ||
946 | |||
947 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
948 | if (r) | ||
949 | DSSERR("device %s register failed: %d\n", | ||
950 | dssdev->name, r); | ||
951 | } | ||
952 | } | ||
953 | |||
930 | /* RFBI HW IP initialisation */ | 954 | /* RFBI HW IP initialisation */ |
931 | static int omap_rfbihw_probe(struct platform_device *pdev) | 955 | static int __init omap_rfbihw_probe(struct platform_device *pdev) |
932 | { | 956 | { |
933 | u32 rev; | 957 | u32 rev; |
934 | struct resource *rfbi_mem; | 958 | struct resource *rfbi_mem; |
@@ -976,6 +1000,10 @@ static int omap_rfbihw_probe(struct platform_device *pdev) | |||
976 | 1000 | ||
977 | rfbi_runtime_put(); | 1001 | rfbi_runtime_put(); |
978 | 1002 | ||
1003 | dss_debugfs_create_file("rfbi", rfbi_dump_regs); | ||
1004 | |||
1005 | rfbi_probe_pdata(pdev); | ||
1006 | |||
979 | return 0; | 1007 | return 0; |
980 | 1008 | ||
981 | err_runtime_get: | 1009 | err_runtime_get: |
@@ -983,8 +1011,9 @@ err_runtime_get: | |||
983 | return r; | 1011 | return r; |
984 | } | 1012 | } |
985 | 1013 | ||
986 | static int omap_rfbihw_remove(struct platform_device *pdev) | 1014 | static int __exit omap_rfbihw_remove(struct platform_device *pdev) |
987 | { | 1015 | { |
1016 | omap_dss_unregister_child_devices(&pdev->dev); | ||
988 | pm_runtime_disable(&pdev->dev); | 1017 | pm_runtime_disable(&pdev->dev); |
989 | return 0; | 1018 | return 0; |
990 | } | 1019 | } |
@@ -992,7 +1021,6 @@ static int omap_rfbihw_remove(struct platform_device *pdev) | |||
992 | static int rfbi_runtime_suspend(struct device *dev) | 1021 | static int rfbi_runtime_suspend(struct device *dev) |
993 | { | 1022 | { |
994 | dispc_runtime_put(); | 1023 | dispc_runtime_put(); |
995 | dss_runtime_put(); | ||
996 | 1024 | ||
997 | return 0; | 1025 | return 0; |
998 | } | 1026 | } |
@@ -1001,20 +1029,11 @@ static int rfbi_runtime_resume(struct device *dev) | |||
1001 | { | 1029 | { |
1002 | int r; | 1030 | int r; |
1003 | 1031 | ||
1004 | r = dss_runtime_get(); | ||
1005 | if (r < 0) | ||
1006 | goto err_get_dss; | ||
1007 | |||
1008 | r = dispc_runtime_get(); | 1032 | r = dispc_runtime_get(); |
1009 | if (r < 0) | 1033 | if (r < 0) |
1010 | goto err_get_dispc; | 1034 | return r; |
1011 | 1035 | ||
1012 | return 0; | 1036 | return 0; |
1013 | |||
1014 | err_get_dispc: | ||
1015 | dss_runtime_put(); | ||
1016 | err_get_dss: | ||
1017 | return r; | ||
1018 | } | 1037 | } |
1019 | 1038 | ||
1020 | static const struct dev_pm_ops rfbi_pm_ops = { | 1039 | static const struct dev_pm_ops rfbi_pm_ops = { |
@@ -1023,8 +1042,7 @@ static const struct dev_pm_ops rfbi_pm_ops = { | |||
1023 | }; | 1042 | }; |
1024 | 1043 | ||
1025 | static struct platform_driver omap_rfbihw_driver = { | 1044 | static struct platform_driver omap_rfbihw_driver = { |
1026 | .probe = omap_rfbihw_probe, | 1045 | .remove = __exit_p(omap_rfbihw_remove), |
1027 | .remove = omap_rfbihw_remove, | ||
1028 | .driver = { | 1046 | .driver = { |
1029 | .name = "omapdss_rfbi", | 1047 | .name = "omapdss_rfbi", |
1030 | .owner = THIS_MODULE, | 1048 | .owner = THIS_MODULE, |
@@ -1032,12 +1050,12 @@ static struct platform_driver omap_rfbihw_driver = { | |||
1032 | }, | 1050 | }, |
1033 | }; | 1051 | }; |
1034 | 1052 | ||
1035 | int rfbi_init_platform_driver(void) | 1053 | int __init rfbi_init_platform_driver(void) |
1036 | { | 1054 | { |
1037 | return platform_driver_register(&omap_rfbihw_driver); | 1055 | return platform_driver_probe(&omap_rfbihw_driver, omap_rfbihw_probe); |
1038 | } | 1056 | } |
1039 | 1057 | ||
1040 | void rfbi_uninit_platform_driver(void) | 1058 | void __exit rfbi_uninit_platform_driver(void) |
1041 | { | 1059 | { |
1042 | return platform_driver_unregister(&omap_rfbihw_driver); | 1060 | platform_driver_unregister(&omap_rfbihw_driver); |
1043 | } | 1061 | } |
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 67fbe7cee412..3a43dc2a9b46 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/regulator/consumer.h> | 25 | #include <linux/regulator/consumer.h> |
26 | #include <linux/export.h> | 26 | #include <linux/export.h> |
27 | #include <linux/platform_device.h> | ||
27 | 28 | ||
28 | #include <video/omapdss.h> | 29 | #include <video/omapdss.h> |
29 | #include "dss.h" | 30 | #include "dss.h" |
@@ -71,10 +72,6 @@ int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) | |||
71 | if (r) | 72 | if (r) |
72 | goto err_reg_enable; | 73 | goto err_reg_enable; |
73 | 74 | ||
74 | r = dss_runtime_get(); | ||
75 | if (r) | ||
76 | goto err_get_dss; | ||
77 | |||
78 | r = dispc_runtime_get(); | 75 | r = dispc_runtime_get(); |
79 | if (r) | 76 | if (r) |
80 | goto err_get_dispc; | 77 | goto err_get_dispc; |
@@ -137,8 +134,6 @@ err_set_dss_clock_div: | |||
137 | err_calc_clock_div: | 134 | err_calc_clock_div: |
138 | dispc_runtime_put(); | 135 | dispc_runtime_put(); |
139 | err_get_dispc: | 136 | err_get_dispc: |
140 | dss_runtime_put(); | ||
141 | err_get_dss: | ||
142 | regulator_disable(sdi.vdds_sdi_reg); | 137 | regulator_disable(sdi.vdds_sdi_reg); |
143 | err_reg_enable: | 138 | err_reg_enable: |
144 | omap_dss_stop_device(dssdev); | 139 | omap_dss_stop_device(dssdev); |
@@ -154,7 +149,6 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) | |||
154 | dss_sdi_disable(); | 149 | dss_sdi_disable(); |
155 | 150 | ||
156 | dispc_runtime_put(); | 151 | dispc_runtime_put(); |
157 | dss_runtime_put(); | ||
158 | 152 | ||
159 | regulator_disable(sdi.vdds_sdi_reg); | 153 | regulator_disable(sdi.vdds_sdi_reg); |
160 | 154 | ||
@@ -162,7 +156,7 @@ void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) | |||
162 | } | 156 | } |
163 | EXPORT_SYMBOL(omapdss_sdi_display_disable); | 157 | EXPORT_SYMBOL(omapdss_sdi_display_disable); |
164 | 158 | ||
165 | int sdi_init_display(struct omap_dss_device *dssdev) | 159 | static int __init sdi_init_display(struct omap_dss_device *dssdev) |
166 | { | 160 | { |
167 | DSSDBG("SDI init\n"); | 161 | DSSDBG("SDI init\n"); |
168 | 162 | ||
@@ -182,11 +176,58 @@ int sdi_init_display(struct omap_dss_device *dssdev) | |||
182 | return 0; | 176 | return 0; |
183 | } | 177 | } |
184 | 178 | ||
185 | int sdi_init(void) | 179 | static void __init sdi_probe_pdata(struct platform_device *pdev) |
180 | { | ||
181 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
182 | int i, r; | ||
183 | |||
184 | for (i = 0; i < pdata->num_devices; ++i) { | ||
185 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
186 | |||
187 | if (dssdev->type != OMAP_DISPLAY_TYPE_SDI) | ||
188 | continue; | ||
189 | |||
190 | r = sdi_init_display(dssdev); | ||
191 | if (r) { | ||
192 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
193 | continue; | ||
194 | } | ||
195 | |||
196 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
197 | if (r) | ||
198 | DSSERR("device %s register failed: %d\n", | ||
199 | dssdev->name, r); | ||
200 | } | ||
201 | } | ||
202 | |||
203 | static int __init omap_sdi_probe(struct platform_device *pdev) | ||
186 | { | 204 | { |
205 | sdi_probe_pdata(pdev); | ||
206 | |||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static int __exit omap_sdi_remove(struct platform_device *pdev) | ||
211 | { | ||
212 | omap_dss_unregister_child_devices(&pdev->dev); | ||
213 | |||
187 | return 0; | 214 | return 0; |
188 | } | 215 | } |
189 | 216 | ||
190 | void sdi_exit(void) | 217 | static struct platform_driver omap_sdi_driver = { |
218 | .remove = __exit_p(omap_sdi_remove), | ||
219 | .driver = { | ||
220 | .name = "omapdss_sdi", | ||
221 | .owner = THIS_MODULE, | ||
222 | }, | ||
223 | }; | ||
224 | |||
225 | int __init sdi_init_platform_driver(void) | ||
226 | { | ||
227 | return platform_driver_probe(&omap_sdi_driver, omap_sdi_probe); | ||
228 | } | ||
229 | |||
230 | void __exit sdi_uninit_platform_driver(void) | ||
191 | { | 231 | { |
232 | platform_driver_unregister(&omap_sdi_driver); | ||
192 | } | 233 | } |
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 9475e6edce68..178c40d3312e 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -725,7 +725,7 @@ static struct omap_dss_driver venc_driver = { | |||
725 | }; | 725 | }; |
726 | /* driver end */ | 726 | /* driver end */ |
727 | 727 | ||
728 | int venc_init_display(struct omap_dss_device *dssdev) | 728 | static int __init venc_init_display(struct omap_dss_device *dssdev) |
729 | { | 729 | { |
730 | DSSDBG("init_display\n"); | 730 | DSSDBG("init_display\n"); |
731 | 731 | ||
@@ -745,7 +745,7 @@ int venc_init_display(struct omap_dss_device *dssdev) | |||
745 | return 0; | 745 | return 0; |
746 | } | 746 | } |
747 | 747 | ||
748 | void venc_dump_regs(struct seq_file *s) | 748 | static void venc_dump_regs(struct seq_file *s) |
749 | { | 749 | { |
750 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r)) | 750 | #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, venc_read_reg(r)) |
751 | 751 | ||
@@ -829,8 +829,32 @@ static void venc_put_clocks(void) | |||
829 | clk_put(venc.tv_dac_clk); | 829 | clk_put(venc.tv_dac_clk); |
830 | } | 830 | } |
831 | 831 | ||
832 | static void __init venc_probe_pdata(struct platform_device *pdev) | ||
833 | { | ||
834 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | ||
835 | int r, i; | ||
836 | |||
837 | for (i = 0; i < pdata->num_devices; ++i) { | ||
838 | struct omap_dss_device *dssdev = pdata->devices[i]; | ||
839 | |||
840 | if (dssdev->type != OMAP_DISPLAY_TYPE_VENC) | ||
841 | continue; | ||
842 | |||
843 | r = venc_init_display(dssdev); | ||
844 | if (r) { | ||
845 | DSSERR("device %s init failed: %d\n", dssdev->name, r); | ||
846 | continue; | ||
847 | } | ||
848 | |||
849 | r = omap_dss_register_device(dssdev, &pdev->dev, i); | ||
850 | if (r) | ||
851 | DSSERR("device %s register failed: %d\n", | ||
852 | dssdev->name, r); | ||
853 | } | ||
854 | } | ||
855 | |||
832 | /* VENC HW IP initialisation */ | 856 | /* VENC HW IP initialisation */ |
833 | static int omap_venchw_probe(struct platform_device *pdev) | 857 | static int __init omap_venchw_probe(struct platform_device *pdev) |
834 | { | 858 | { |
835 | u8 rev_id; | 859 | u8 rev_id; |
836 | struct resource *venc_mem; | 860 | struct resource *venc_mem; |
@@ -874,6 +898,10 @@ static int omap_venchw_probe(struct platform_device *pdev) | |||
874 | if (r) | 898 | if (r) |
875 | goto err_reg_panel_driver; | 899 | goto err_reg_panel_driver; |
876 | 900 | ||
901 | dss_debugfs_create_file("venc", venc_dump_regs); | ||
902 | |||
903 | venc_probe_pdata(pdev); | ||
904 | |||
877 | return 0; | 905 | return 0; |
878 | 906 | ||
879 | err_reg_panel_driver: | 907 | err_reg_panel_driver: |
@@ -883,12 +911,15 @@ err_runtime_get: | |||
883 | return r; | 911 | return r; |
884 | } | 912 | } |
885 | 913 | ||
886 | static int omap_venchw_remove(struct platform_device *pdev) | 914 | static int __exit omap_venchw_remove(struct platform_device *pdev) |
887 | { | 915 | { |
916 | omap_dss_unregister_child_devices(&pdev->dev); | ||
917 | |||
888 | if (venc.vdda_dac_reg != NULL) { | 918 | if (venc.vdda_dac_reg != NULL) { |
889 | regulator_put(venc.vdda_dac_reg); | 919 | regulator_put(venc.vdda_dac_reg); |
890 | venc.vdda_dac_reg = NULL; | 920 | venc.vdda_dac_reg = NULL; |
891 | } | 921 | } |
922 | |||
892 | omap_dss_unregister_driver(&venc_driver); | 923 | omap_dss_unregister_driver(&venc_driver); |
893 | 924 | ||
894 | pm_runtime_disable(&pdev->dev); | 925 | pm_runtime_disable(&pdev->dev); |
@@ -903,7 +934,6 @@ static int venc_runtime_suspend(struct device *dev) | |||
903 | clk_disable(venc.tv_dac_clk); | 934 | clk_disable(venc.tv_dac_clk); |
904 | 935 | ||
905 | dispc_runtime_put(); | 936 | dispc_runtime_put(); |
906 | dss_runtime_put(); | ||
907 | 937 | ||
908 | return 0; | 938 | return 0; |
909 | } | 939 | } |
@@ -912,23 +942,14 @@ static int venc_runtime_resume(struct device *dev) | |||
912 | { | 942 | { |
913 | int r; | 943 | int r; |
914 | 944 | ||
915 | r = dss_runtime_get(); | ||
916 | if (r < 0) | ||
917 | goto err_get_dss; | ||
918 | |||
919 | r = dispc_runtime_get(); | 945 | r = dispc_runtime_get(); |
920 | if (r < 0) | 946 | if (r < 0) |
921 | goto err_get_dispc; | 947 | return r; |
922 | 948 | ||
923 | if (venc.tv_dac_clk) | 949 | if (venc.tv_dac_clk) |
924 | clk_enable(venc.tv_dac_clk); | 950 | clk_enable(venc.tv_dac_clk); |
925 | 951 | ||
926 | return 0; | 952 | return 0; |
927 | |||
928 | err_get_dispc: | ||
929 | dss_runtime_put(); | ||
930 | err_get_dss: | ||
931 | return r; | ||
932 | } | 953 | } |
933 | 954 | ||
934 | static const struct dev_pm_ops venc_pm_ops = { | 955 | static const struct dev_pm_ops venc_pm_ops = { |
@@ -937,8 +958,7 @@ static const struct dev_pm_ops venc_pm_ops = { | |||
937 | }; | 958 | }; |
938 | 959 | ||
939 | static struct platform_driver omap_venchw_driver = { | 960 | static struct platform_driver omap_venchw_driver = { |
940 | .probe = omap_venchw_probe, | 961 | .remove = __exit_p(omap_venchw_remove), |
941 | .remove = omap_venchw_remove, | ||
942 | .driver = { | 962 | .driver = { |
943 | .name = "omapdss_venc", | 963 | .name = "omapdss_venc", |
944 | .owner = THIS_MODULE, | 964 | .owner = THIS_MODULE, |
@@ -946,18 +966,18 @@ static struct platform_driver omap_venchw_driver = { | |||
946 | }, | 966 | }, |
947 | }; | 967 | }; |
948 | 968 | ||
949 | int venc_init_platform_driver(void) | 969 | int __init venc_init_platform_driver(void) |
950 | { | 970 | { |
951 | if (cpu_is_omap44xx()) | 971 | if (cpu_is_omap44xx()) |
952 | return 0; | 972 | return 0; |
953 | 973 | ||
954 | return platform_driver_register(&omap_venchw_driver); | 974 | return platform_driver_probe(&omap_venchw_driver, omap_venchw_probe); |
955 | } | 975 | } |
956 | 976 | ||
957 | void venc_uninit_platform_driver(void) | 977 | void __exit venc_uninit_platform_driver(void) |
958 | { | 978 | { |
959 | if (cpu_is_omap44xx()) | 979 | if (cpu_is_omap44xx()) |
960 | return; | 980 | return; |
961 | 981 | ||
962 | return platform_driver_unregister(&omap_venchw_driver); | 982 | platform_driver_unregister(&omap_venchw_driver); |
963 | } | 983 | } |
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 7f02e7f90d63..165a4be95025 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -2307,7 +2307,7 @@ static int omapfb_init_display(struct omapfb2_device *fbdev, | |||
2307 | return 0; | 2307 | return 0; |
2308 | } | 2308 | } |
2309 | 2309 | ||
2310 | static int omapfb_probe(struct platform_device *pdev) | 2310 | static int __init omapfb_probe(struct platform_device *pdev) |
2311 | { | 2311 | { |
2312 | struct omapfb2_device *fbdev = NULL; | 2312 | struct omapfb2_device *fbdev = NULL; |
2313 | int r = 0; | 2313 | int r = 0; |
@@ -2448,7 +2448,7 @@ err0: | |||
2448 | return r; | 2448 | return r; |
2449 | } | 2449 | } |
2450 | 2450 | ||
2451 | static int omapfb_remove(struct platform_device *pdev) | 2451 | static int __exit omapfb_remove(struct platform_device *pdev) |
2452 | { | 2452 | { |
2453 | struct omapfb2_device *fbdev = platform_get_drvdata(pdev); | 2453 | struct omapfb2_device *fbdev = platform_get_drvdata(pdev); |
2454 | 2454 | ||
@@ -2462,8 +2462,7 @@ static int omapfb_remove(struct platform_device *pdev) | |||
2462 | } | 2462 | } |
2463 | 2463 | ||
2464 | static struct platform_driver omapfb_driver = { | 2464 | static struct platform_driver omapfb_driver = { |
2465 | .probe = omapfb_probe, | 2465 | .remove = __exit_p(omapfb_remove), |
2466 | .remove = omapfb_remove, | ||
2467 | .driver = { | 2466 | .driver = { |
2468 | .name = "omapfb", | 2467 | .name = "omapfb", |
2469 | .owner = THIS_MODULE, | 2468 | .owner = THIS_MODULE, |
@@ -2474,7 +2473,7 @@ static int __init omapfb_init(void) | |||
2474 | { | 2473 | { |
2475 | DBG("omapfb_init\n"); | 2474 | DBG("omapfb_init\n"); |
2476 | 2475 | ||
2477 | if (platform_driver_register(&omapfb_driver)) { | 2476 | if (platform_driver_probe(&omapfb_driver, omapfb_probe)) { |
2478 | printk(KERN_ERR "failed to register omapfb driver\n"); | 2477 | printk(KERN_ERR "failed to register omapfb driver\n"); |
2479 | return -ENODEV; | 2478 | return -ENODEV; |
2480 | } | 2479 | } |
diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 1cbb2dd5fbba..1217df40cb7e 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h | |||
@@ -317,11 +317,6 @@ extern int omap_display_init(struct omap_dss_board_info *board_data); | |||
317 | /* HDMI mux init*/ | 317 | /* HDMI mux init*/ |
318 | extern int omap_hdmi_init(enum omap_hdmi_flags flags); | 318 | extern int omap_hdmi_init(enum omap_hdmi_flags flags); |
319 | 319 | ||
320 | struct omap_display_platform_data { | ||
321 | struct omap_dss_board_info *board_data; | ||
322 | /* TODO: Additional members to be added when PM is considered */ | ||
323 | }; | ||
324 | |||
325 | struct omap_video_timings { | 320 | struct omap_video_timings { |
326 | /* Unit: pixels */ | 321 | /* Unit: pixels */ |
327 | u16 x_res; | 322 | u16 x_res; |