diff options
author | Archit Taneja <archit@ti.com> | 2014-05-30 06:56:22 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2014-11-12 06:39:48 -0500 |
commit | 630d2d0de6b113748ce08d5f69e094eeed24accc (patch) | |
tree | 16b2423cd91d161609aa4fd89ee29302967bef19 | |
parent | 0df1f2487d2f0d04703f142813d53615d62a1da4 (diff) |
OMAPDSS: DPI: Use DPI driver data
DPI related data is currently a static global struct parameter. It is accessed
directly by functions in the driver.
This method won't work if we want the driver to support multiple DPI instances.
Create struct dpi_data, and pass its pointer to functions which need to use it.
We still have a static instance defined for dpi_data, which is accessed by top
level DPI ops. This will be removed when the driver dynamically allocates
dpi_data for each DPI instance.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r-- | drivers/video/fbdev/omap2/dss/dpi.c | 187 |
1 files changed, 107 insertions, 80 deletions
diff --git a/drivers/video/fbdev/omap2/dss/dpi.c b/drivers/video/fbdev/omap2/dss/dpi.c index 4a3363dae74a..35285d8395b5 100644 --- a/drivers/video/fbdev/omap2/dss/dpi.c +++ b/drivers/video/fbdev/omap2/dss/dpi.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include "dss.h" | 37 | #include "dss.h" |
38 | #include "dss_features.h" | 38 | #include "dss_features.h" |
39 | 39 | ||
40 | static struct { | 40 | struct dpi_data { |
41 | struct platform_device *pdev; | 41 | struct platform_device *pdev; |
42 | 42 | ||
43 | struct regulator *vdds_dsi_reg; | 43 | struct regulator *vdds_dsi_reg; |
@@ -52,7 +52,9 @@ static struct { | |||
52 | struct omap_dss_device output; | 52 | struct omap_dss_device output; |
53 | 53 | ||
54 | bool port_initialized; | 54 | bool port_initialized; |
55 | } dpi; | 55 | }; |
56 | |||
57 | static struct dpi_data dpi_data; | ||
56 | 58 | ||
57 | static struct platform_device *dpi_get_dsidev(enum omap_channel channel) | 59 | static struct platform_device *dpi_get_dsidev(enum omap_channel channel) |
58 | { | 60 | { |
@@ -200,15 +202,16 @@ static bool dpi_calc_dss_cb(unsigned long fck, void *data) | |||
200 | dpi_calc_dispc_cb, ctx); | 202 | dpi_calc_dispc_cb, ctx); |
201 | } | 203 | } |
202 | 204 | ||
203 | static bool dpi_dsi_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx) | 205 | static bool dpi_dsi_clk_calc(struct dpi_data *dpi, unsigned long pck, |
206 | struct dpi_clk_calc_ctx *ctx) | ||
204 | { | 207 | { |
205 | unsigned long clkin; | 208 | unsigned long clkin; |
206 | unsigned long pll_min, pll_max; | 209 | unsigned long pll_min, pll_max; |
207 | 210 | ||
208 | clkin = dsi_get_pll_clkin(dpi.dsidev); | 211 | clkin = dsi_get_pll_clkin(dpi->dsidev); |
209 | 212 | ||
210 | memset(ctx, 0, sizeof(*ctx)); | 213 | memset(ctx, 0, sizeof(*ctx)); |
211 | ctx->dsidev = dpi.dsidev; | 214 | ctx->dsidev = dpi->dsidev; |
212 | ctx->pck_min = pck - 1000; | 215 | ctx->pck_min = pck - 1000; |
213 | ctx->pck_max = pck + 1000; | 216 | ctx->pck_max = pck + 1000; |
214 | ctx->dsi_cinfo.clkin = clkin; | 217 | ctx->dsi_cinfo.clkin = clkin; |
@@ -216,7 +219,7 @@ static bool dpi_dsi_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx) | |||
216 | pll_min = 0; | 219 | pll_min = 0; |
217 | pll_max = 0; | 220 | pll_max = 0; |
218 | 221 | ||
219 | return dsi_pll_calc(dpi.dsidev, clkin, | 222 | return dsi_pll_calc(dpi->dsidev, clkin, |
220 | pll_min, pll_max, | 223 | pll_min, pll_max, |
221 | dpi_calc_pll_cb, ctx); | 224 | dpi_calc_pll_cb, ctx); |
222 | } | 225 | } |
@@ -252,7 +255,7 @@ static bool dpi_dss_clk_calc(unsigned long pck, struct dpi_clk_calc_ctx *ctx) | |||
252 | 255 | ||
253 | 256 | ||
254 | 257 | ||
255 | static int dpi_set_dsi_clk(enum omap_channel channel, | 258 | static int dpi_set_dsi_clk(struct dpi_data *dpi, enum omap_channel channel, |
256 | unsigned long pck_req, unsigned long *fck, int *lck_div, | 259 | unsigned long pck_req, unsigned long *fck, int *lck_div, |
257 | int *pck_div) | 260 | int *pck_div) |
258 | { | 261 | { |
@@ -260,18 +263,18 @@ static int dpi_set_dsi_clk(enum omap_channel channel, | |||
260 | int r; | 263 | int r; |
261 | bool ok; | 264 | bool ok; |
262 | 265 | ||
263 | ok = dpi_dsi_clk_calc(pck_req, &ctx); | 266 | ok = dpi_dsi_clk_calc(dpi, pck_req, &ctx); |
264 | if (!ok) | 267 | if (!ok) |
265 | return -EINVAL; | 268 | return -EINVAL; |
266 | 269 | ||
267 | r = dsi_pll_set_clock_div(dpi.dsidev, &ctx.dsi_cinfo); | 270 | r = dsi_pll_set_clock_div(dpi->dsidev, &ctx.dsi_cinfo); |
268 | if (r) | 271 | if (r) |
269 | return r; | 272 | return r; |
270 | 273 | ||
271 | dss_select_lcd_clk_source(channel, | 274 | dss_select_lcd_clk_source(channel, |
272 | dpi_get_alt_clk_src(channel)); | 275 | dpi_get_alt_clk_src(channel)); |
273 | 276 | ||
274 | dpi.mgr_config.clock_info = ctx.dispc_cinfo; | 277 | dpi->mgr_config.clock_info = ctx.dispc_cinfo; |
275 | 278 | ||
276 | *fck = ctx.dsi_cinfo.dsi_pll_hsdiv_dispc_clk; | 279 | *fck = ctx.dsi_cinfo.dsi_pll_hsdiv_dispc_clk; |
277 | *lck_div = ctx.dispc_cinfo.lck_div; | 280 | *lck_div = ctx.dispc_cinfo.lck_div; |
@@ -280,8 +283,8 @@ static int dpi_set_dsi_clk(enum omap_channel channel, | |||
280 | return 0; | 283 | return 0; |
281 | } | 284 | } |
282 | 285 | ||
283 | static int dpi_set_dispc_clk(unsigned long pck_req, unsigned long *fck, | 286 | static int dpi_set_dispc_clk(struct dpi_data *dpi, unsigned long pck_req, |
284 | int *lck_div, int *pck_div) | 287 | unsigned long *fck, int *lck_div, int *pck_div) |
285 | { | 288 | { |
286 | struct dpi_clk_calc_ctx ctx; | 289 | struct dpi_clk_calc_ctx ctx; |
287 | int r; | 290 | int r; |
@@ -295,7 +298,7 @@ static int dpi_set_dispc_clk(unsigned long pck_req, unsigned long *fck, | |||
295 | if (r) | 298 | if (r) |
296 | return r; | 299 | return r; |
297 | 300 | ||
298 | dpi.mgr_config.clock_info = ctx.dispc_cinfo; | 301 | dpi->mgr_config.clock_info = ctx.dispc_cinfo; |
299 | 302 | ||
300 | *fck = ctx.fck; | 303 | *fck = ctx.fck; |
301 | *lck_div = ctx.dispc_cinfo.lck_div; | 304 | *lck_div = ctx.dispc_cinfo.lck_div; |
@@ -304,19 +307,21 @@ static int dpi_set_dispc_clk(unsigned long pck_req, unsigned long *fck, | |||
304 | return 0; | 307 | return 0; |
305 | } | 308 | } |
306 | 309 | ||
307 | static int dpi_set_mode(struct omap_overlay_manager *mgr) | 310 | static int dpi_set_mode(struct dpi_data *dpi) |
308 | { | 311 | { |
309 | struct omap_video_timings *t = &dpi.timings; | 312 | struct omap_dss_device *out = &dpi->output; |
313 | struct omap_overlay_manager *mgr = out->manager; | ||
314 | struct omap_video_timings *t = &dpi->timings; | ||
310 | int lck_div = 0, pck_div = 0; | 315 | int lck_div = 0, pck_div = 0; |
311 | unsigned long fck = 0; | 316 | unsigned long fck = 0; |
312 | unsigned long pck; | 317 | unsigned long pck; |
313 | int r = 0; | 318 | int r = 0; |
314 | 319 | ||
315 | if (dpi.dsidev) | 320 | if (dpi->dsidev) |
316 | r = dpi_set_dsi_clk(mgr->id, t->pixelclock, &fck, | 321 | r = dpi_set_dsi_clk(dpi, mgr->id, t->pixelclock, &fck, |
317 | &lck_div, &pck_div); | 322 | &lck_div, &pck_div); |
318 | else | 323 | else |
319 | r = dpi_set_dispc_clk(t->pixelclock, &fck, | 324 | r = dpi_set_dispc_clk(dpi, t->pixelclock, &fck, |
320 | &lck_div, &pck_div); | 325 | &lck_div, &pck_div); |
321 | if (r) | 326 | if (r) |
322 | return r; | 327 | return r; |
@@ -335,28 +340,32 @@ static int dpi_set_mode(struct omap_overlay_manager *mgr) | |||
335 | return 0; | 340 | return 0; |
336 | } | 341 | } |
337 | 342 | ||
338 | static void dpi_config_lcd_manager(struct omap_overlay_manager *mgr) | 343 | static void dpi_config_lcd_manager(struct dpi_data *dpi) |
339 | { | 344 | { |
340 | dpi.mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS; | 345 | struct omap_dss_device *out = &dpi->output; |
346 | struct omap_overlay_manager *mgr = out->manager; | ||
347 | |||
348 | dpi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS; | ||
341 | 349 | ||
342 | dpi.mgr_config.stallmode = false; | 350 | dpi->mgr_config.stallmode = false; |
343 | dpi.mgr_config.fifohandcheck = false; | 351 | dpi->mgr_config.fifohandcheck = false; |
344 | 352 | ||
345 | dpi.mgr_config.video_port_width = dpi.data_lines; | 353 | dpi->mgr_config.video_port_width = dpi->data_lines; |
346 | 354 | ||
347 | dpi.mgr_config.lcden_sig_polarity = 0; | 355 | dpi->mgr_config.lcden_sig_polarity = 0; |
348 | 356 | ||
349 | dss_mgr_set_lcd_config(mgr, &dpi.mgr_config); | 357 | dss_mgr_set_lcd_config(mgr, &dpi->mgr_config); |
350 | } | 358 | } |
351 | 359 | ||
352 | static int dpi_display_enable(struct omap_dss_device *dssdev) | 360 | static int dpi_display_enable(struct omap_dss_device *dssdev) |
353 | { | 361 | { |
354 | struct omap_dss_device *out = &dpi.output; | 362 | struct dpi_data *dpi = &dpi_data; |
363 | struct omap_dss_device *out = &dpi->output; | ||
355 | int r; | 364 | int r; |
356 | 365 | ||
357 | mutex_lock(&dpi.lock); | 366 | mutex_lock(&dpi->lock); |
358 | 367 | ||
359 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI) && !dpi.vdds_dsi_reg) { | 368 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI) && !dpi->vdds_dsi_reg) { |
360 | DSSERR("no VDSS_DSI regulator\n"); | 369 | DSSERR("no VDSS_DSI regulator\n"); |
361 | r = -ENODEV; | 370 | r = -ENODEV; |
362 | goto err_no_reg; | 371 | goto err_no_reg; |
@@ -369,7 +378,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) | |||
369 | } | 378 | } |
370 | 379 | ||
371 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) { | 380 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) { |
372 | r = regulator_enable(dpi.vdds_dsi_reg); | 381 | r = regulator_enable(dpi->vdds_dsi_reg); |
373 | if (r) | 382 | if (r) |
374 | goto err_reg_enable; | 383 | goto err_reg_enable; |
375 | } | 384 | } |
@@ -382,21 +391,21 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) | |||
382 | if (r) | 391 | if (r) |
383 | goto err_src_sel; | 392 | goto err_src_sel; |
384 | 393 | ||
385 | if (dpi.dsidev) { | 394 | if (dpi->dsidev) { |
386 | r = dsi_runtime_get(dpi.dsidev); | 395 | r = dsi_runtime_get(dpi->dsidev); |
387 | if (r) | 396 | if (r) |
388 | goto err_get_dsi; | 397 | goto err_get_dsi; |
389 | 398 | ||
390 | r = dsi_pll_init(dpi.dsidev, 0, 1); | 399 | r = dsi_pll_init(dpi->dsidev, 0, 1); |
391 | if (r) | 400 | if (r) |
392 | goto err_dsi_pll_init; | 401 | goto err_dsi_pll_init; |
393 | } | 402 | } |
394 | 403 | ||
395 | r = dpi_set_mode(out->manager); | 404 | r = dpi_set_mode(dpi); |
396 | if (r) | 405 | if (r) |
397 | goto err_set_mode; | 406 | goto err_set_mode; |
398 | 407 | ||
399 | dpi_config_lcd_manager(out->manager); | 408 | dpi_config_lcd_manager(dpi); |
400 | 409 | ||
401 | mdelay(2); | 410 | mdelay(2); |
402 | 411 | ||
@@ -404,78 +413,84 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) | |||
404 | if (r) | 413 | if (r) |
405 | goto err_mgr_enable; | 414 | goto err_mgr_enable; |
406 | 415 | ||
407 | mutex_unlock(&dpi.lock); | 416 | mutex_unlock(&dpi->lock); |
408 | 417 | ||
409 | return 0; | 418 | return 0; |
410 | 419 | ||
411 | err_mgr_enable: | 420 | err_mgr_enable: |
412 | err_set_mode: | 421 | err_set_mode: |
413 | if (dpi.dsidev) | 422 | if (dpi->dsidev) |
414 | dsi_pll_uninit(dpi.dsidev, true); | 423 | dsi_pll_uninit(dpi->dsidev, true); |
415 | err_dsi_pll_init: | 424 | err_dsi_pll_init: |
416 | if (dpi.dsidev) | 425 | if (dpi->dsidev) |
417 | dsi_runtime_put(dpi.dsidev); | 426 | dsi_runtime_put(dpi->dsidev); |
418 | err_get_dsi: | 427 | err_get_dsi: |
419 | err_src_sel: | 428 | err_src_sel: |
420 | dispc_runtime_put(); | 429 | dispc_runtime_put(); |
421 | err_get_dispc: | 430 | err_get_dispc: |
422 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) | 431 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) |
423 | regulator_disable(dpi.vdds_dsi_reg); | 432 | regulator_disable(dpi->vdds_dsi_reg); |
424 | err_reg_enable: | 433 | err_reg_enable: |
425 | err_no_out_mgr: | 434 | err_no_out_mgr: |
426 | err_no_reg: | 435 | err_no_reg: |
427 | mutex_unlock(&dpi.lock); | 436 | mutex_unlock(&dpi->lock); |
428 | return r; | 437 | return r; |
429 | } | 438 | } |
430 | 439 | ||
431 | static void dpi_display_disable(struct omap_dss_device *dssdev) | 440 | static void dpi_display_disable(struct omap_dss_device *dssdev) |
432 | { | 441 | { |
433 | struct omap_overlay_manager *mgr = dpi.output.manager; | 442 | struct dpi_data *dpi = &dpi_data; |
443 | struct omap_overlay_manager *mgr = dpi->output.manager; | ||
434 | 444 | ||
435 | mutex_lock(&dpi.lock); | 445 | mutex_lock(&dpi->lock); |
436 | 446 | ||
437 | dss_mgr_disable(mgr); | 447 | dss_mgr_disable(mgr); |
438 | 448 | ||
439 | if (dpi.dsidev) { | 449 | if (dpi->dsidev) { |
440 | dss_select_lcd_clk_source(mgr->id, OMAP_DSS_CLK_SRC_FCK); | 450 | dss_select_lcd_clk_source(mgr->id, OMAP_DSS_CLK_SRC_FCK); |
441 | dsi_pll_uninit(dpi.dsidev, true); | 451 | dsi_pll_uninit(dpi->dsidev, true); |
442 | dsi_runtime_put(dpi.dsidev); | 452 | dsi_runtime_put(dpi->dsidev); |
443 | } | 453 | } |
444 | 454 | ||
445 | dispc_runtime_put(); | 455 | dispc_runtime_put(); |
446 | 456 | ||
447 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) | 457 | if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) |
448 | regulator_disable(dpi.vdds_dsi_reg); | 458 | regulator_disable(dpi->vdds_dsi_reg); |
449 | 459 | ||
450 | mutex_unlock(&dpi.lock); | 460 | mutex_unlock(&dpi->lock); |
451 | } | 461 | } |
452 | 462 | ||
453 | static void dpi_set_timings(struct omap_dss_device *dssdev, | 463 | static void dpi_set_timings(struct omap_dss_device *dssdev, |
454 | struct omap_video_timings *timings) | 464 | struct omap_video_timings *timings) |
455 | { | 465 | { |
466 | struct dpi_data *dpi = &dpi_data; | ||
467 | |||
456 | DSSDBG("dpi_set_timings\n"); | 468 | DSSDBG("dpi_set_timings\n"); |
457 | 469 | ||
458 | mutex_lock(&dpi.lock); | 470 | mutex_lock(&dpi->lock); |
459 | 471 | ||
460 | dpi.timings = *timings; | 472 | dpi->timings = *timings; |
461 | 473 | ||
462 | mutex_unlock(&dpi.lock); | 474 | mutex_unlock(&dpi->lock); |
463 | } | 475 | } |
464 | 476 | ||
465 | static void dpi_get_timings(struct omap_dss_device *dssdev, | 477 | static void dpi_get_timings(struct omap_dss_device *dssdev, |
466 | struct omap_video_timings *timings) | 478 | struct omap_video_timings *timings) |
467 | { | 479 | { |
468 | mutex_lock(&dpi.lock); | 480 | struct dpi_data *dpi = &dpi_data; |
481 | |||
482 | mutex_lock(&dpi->lock); | ||
469 | 483 | ||
470 | *timings = dpi.timings; | 484 | *timings = dpi->timings; |
471 | 485 | ||
472 | mutex_unlock(&dpi.lock); | 486 | mutex_unlock(&dpi->lock); |
473 | } | 487 | } |
474 | 488 | ||
475 | static int dpi_check_timings(struct omap_dss_device *dssdev, | 489 | static int dpi_check_timings(struct omap_dss_device *dssdev, |
476 | struct omap_video_timings *timings) | 490 | struct omap_video_timings *timings) |
477 | { | 491 | { |
478 | struct omap_overlay_manager *mgr = dpi.output.manager; | 492 | struct dpi_data *dpi = &dpi_data; |
493 | struct omap_overlay_manager *mgr = dpi->output.manager; | ||
479 | int lck_div, pck_div; | 494 | int lck_div, pck_div; |
480 | unsigned long fck; | 495 | unsigned long fck; |
481 | unsigned long pck; | 496 | unsigned long pck; |
@@ -488,8 +503,8 @@ static int dpi_check_timings(struct omap_dss_device *dssdev, | |||
488 | if (timings->pixelclock == 0) | 503 | if (timings->pixelclock == 0) |
489 | return -EINVAL; | 504 | return -EINVAL; |
490 | 505 | ||
491 | if (dpi.dsidev) { | 506 | if (dpi->dsidev) { |
492 | ok = dpi_dsi_clk_calc(timings->pixelclock, &ctx); | 507 | ok = dpi_dsi_clk_calc(dpi, timings->pixelclock, &ctx); |
493 | if (!ok) | 508 | if (!ok) |
494 | return -EINVAL; | 509 | return -EINVAL; |
495 | 510 | ||
@@ -514,11 +529,13 @@ static int dpi_check_timings(struct omap_dss_device *dssdev, | |||
514 | 529 | ||
515 | static void dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines) | 530 | static void dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines) |
516 | { | 531 | { |
517 | mutex_lock(&dpi.lock); | 532 | struct dpi_data *dpi = &dpi_data; |
518 | 533 | ||
519 | dpi.data_lines = data_lines; | 534 | mutex_lock(&dpi->lock); |
520 | 535 | ||
521 | mutex_unlock(&dpi.lock); | 536 | dpi->data_lines = data_lines; |
537 | |||
538 | mutex_unlock(&dpi->lock); | ||
522 | } | 539 | } |
523 | 540 | ||
524 | static int dpi_verify_dsi_pll(struct platform_device *dsidev) | 541 | static int dpi_verify_dsi_pll(struct platform_device *dsidev) |
@@ -543,36 +560,36 @@ static int dpi_verify_dsi_pll(struct platform_device *dsidev) | |||
543 | return 0; | 560 | return 0; |
544 | } | 561 | } |
545 | 562 | ||
546 | static int dpi_init_regulator(void) | 563 | static int dpi_init_regulator(struct dpi_data *dpi) |
547 | { | 564 | { |
548 | struct regulator *vdds_dsi; | 565 | struct regulator *vdds_dsi; |
549 | 566 | ||
550 | if (!dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) | 567 | if (!dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) |
551 | return 0; | 568 | return 0; |
552 | 569 | ||
553 | if (dpi.vdds_dsi_reg) | 570 | if (dpi->vdds_dsi_reg) |
554 | return 0; | 571 | return 0; |
555 | 572 | ||
556 | vdds_dsi = devm_regulator_get(&dpi.pdev->dev, "vdds_dsi"); | 573 | vdds_dsi = devm_regulator_get(&dpi->pdev->dev, "vdds_dsi"); |
557 | if (IS_ERR(vdds_dsi)) { | 574 | if (IS_ERR(vdds_dsi)) { |
558 | if (PTR_ERR(vdds_dsi) != -EPROBE_DEFER) | 575 | if (PTR_ERR(vdds_dsi) != -EPROBE_DEFER) |
559 | DSSERR("can't get VDDS_DSI regulator\n"); | 576 | DSSERR("can't get VDDS_DSI regulator\n"); |
560 | return PTR_ERR(vdds_dsi); | 577 | return PTR_ERR(vdds_dsi); |
561 | } | 578 | } |
562 | 579 | ||
563 | dpi.vdds_dsi_reg = vdds_dsi; | 580 | dpi->vdds_dsi_reg = vdds_dsi; |
564 | 581 | ||
565 | return 0; | 582 | return 0; |
566 | } | 583 | } |
567 | 584 | ||
568 | static void dpi_init_pll(void) | 585 | static void dpi_init_pll(struct dpi_data *dpi) |
569 | { | 586 | { |
570 | struct platform_device *dsidev; | 587 | struct platform_device *dsidev; |
571 | 588 | ||
572 | if (dpi.dsidev) | 589 | if (dpi->dsidev) |
573 | return; | 590 | return; |
574 | 591 | ||
575 | dsidev = dpi_get_dsidev(dpi.output.dispc_channel); | 592 | dsidev = dpi_get_dsidev(dpi->output.dispc_channel); |
576 | if (!dsidev) | 593 | if (!dsidev) |
577 | return; | 594 | return; |
578 | 595 | ||
@@ -581,7 +598,7 @@ static void dpi_init_pll(void) | |||
581 | return; | 598 | return; |
582 | } | 599 | } |
583 | 600 | ||
584 | dpi.dsidev = dsidev; | 601 | dpi->dsidev = dsidev; |
585 | } | 602 | } |
586 | 603 | ||
587 | /* | 604 | /* |
@@ -618,14 +635,15 @@ static enum omap_channel dpi_get_channel(void) | |||
618 | static int dpi_connect(struct omap_dss_device *dssdev, | 635 | static int dpi_connect(struct omap_dss_device *dssdev, |
619 | struct omap_dss_device *dst) | 636 | struct omap_dss_device *dst) |
620 | { | 637 | { |
638 | struct dpi_data *dpi = &dpi_data; | ||
621 | struct omap_overlay_manager *mgr; | 639 | struct omap_overlay_manager *mgr; |
622 | int r; | 640 | int r; |
623 | 641 | ||
624 | r = dpi_init_regulator(); | 642 | r = dpi_init_regulator(dpi); |
625 | if (r) | 643 | if (r) |
626 | return r; | 644 | return r; |
627 | 645 | ||
628 | dpi_init_pll(); | 646 | dpi_init_pll(dpi); |
629 | 647 | ||
630 | mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel); | 648 | mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel); |
631 | if (!mgr) | 649 | if (!mgr) |
@@ -676,7 +694,8 @@ static const struct omapdss_dpi_ops dpi_ops = { | |||
676 | 694 | ||
677 | static void dpi_init_output(struct platform_device *pdev) | 695 | static void dpi_init_output(struct platform_device *pdev) |
678 | { | 696 | { |
679 | struct omap_dss_device *out = &dpi.output; | 697 | struct dpi_data *dpi = &dpi_data; |
698 | struct omap_dss_device *out = &dpi->output; | ||
680 | 699 | ||
681 | out->dev = &pdev->dev; | 700 | out->dev = &pdev->dev; |
682 | out->id = OMAP_DSS_OUTPUT_DPI; | 701 | out->id = OMAP_DSS_OUTPUT_DPI; |
@@ -691,16 +710,21 @@ static void dpi_init_output(struct platform_device *pdev) | |||
691 | 710 | ||
692 | static void __exit dpi_uninit_output(struct platform_device *pdev) | 711 | static void __exit dpi_uninit_output(struct platform_device *pdev) |
693 | { | 712 | { |
694 | struct omap_dss_device *out = &dpi.output; | 713 | struct dpi_data *dpi = &dpi_data; |
714 | struct omap_dss_device *out = &dpi->output; | ||
695 | 715 | ||
696 | omapdss_unregister_output(out); | 716 | omapdss_unregister_output(out); |
697 | } | 717 | } |
698 | 718 | ||
699 | static int omap_dpi_probe(struct platform_device *pdev) | 719 | static int omap_dpi_probe(struct platform_device *pdev) |
700 | { | 720 | { |
701 | dpi.pdev = pdev; | 721 | struct dpi_data *dpi = &dpi_data; |
722 | |||
723 | dpi->pdev = pdev; | ||
702 | 724 | ||
703 | mutex_init(&dpi.lock); | 725 | dev_set_drvdata(&pdev->dev, dpi); |
726 | |||
727 | mutex_init(&dpi->lock); | ||
704 | 728 | ||
705 | dpi_init_output(pdev); | 729 | dpi_init_output(pdev); |
706 | 730 | ||
@@ -736,6 +760,7 @@ void __exit dpi_uninit_platform_driver(void) | |||
736 | 760 | ||
737 | int __init dpi_init_port(struct platform_device *pdev, struct device_node *port) | 761 | int __init dpi_init_port(struct platform_device *pdev, struct device_node *port) |
738 | { | 762 | { |
763 | struct dpi_data *dpi = &dpi_data; | ||
739 | struct device_node *ep; | 764 | struct device_node *ep; |
740 | u32 datalines; | 765 | u32 datalines; |
741 | int r; | 766 | int r; |
@@ -750,17 +775,17 @@ int __init dpi_init_port(struct platform_device *pdev, struct device_node *port) | |||
750 | goto err_datalines; | 775 | goto err_datalines; |
751 | } | 776 | } |
752 | 777 | ||
753 | dpi.data_lines = datalines; | 778 | dpi->data_lines = datalines; |
754 | 779 | ||
755 | of_node_put(ep); | 780 | of_node_put(ep); |
756 | 781 | ||
757 | dpi.pdev = pdev; | 782 | dpi->pdev = pdev; |
758 | 783 | ||
759 | mutex_init(&dpi.lock); | 784 | mutex_init(&dpi->lock); |
760 | 785 | ||
761 | dpi_init_output(pdev); | 786 | dpi_init_output(pdev); |
762 | 787 | ||
763 | dpi.port_initialized = true; | 788 | dpi->port_initialized = true; |
764 | 789 | ||
765 | return 0; | 790 | return 0; |
766 | 791 | ||
@@ -772,8 +797,10 @@ err_datalines: | |||
772 | 797 | ||
773 | void __exit dpi_uninit_port(void) | 798 | void __exit dpi_uninit_port(void) |
774 | { | 799 | { |
775 | if (!dpi.port_initialized) | 800 | struct dpi_data *dpi = &dpi_data; |
801 | |||
802 | if (!dpi->port_initialized) | ||
776 | return; | 803 | return; |
777 | 804 | ||
778 | dpi_uninit_output(dpi.pdev); | 805 | dpi_uninit_output(dpi->pdev); |
779 | } | 806 | } |