diff options
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/base.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dispc.c | 223 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dpi.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dsi.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/dss.h | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/hdmi4.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/hdmi5.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/omapdss.h | 95 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/sdi.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/venc.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 31 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_irq.c | 32 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_plane.c | 12 |
15 files changed, 257 insertions, 196 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index c248c3c31904..99e8cb8dc65b 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c | |||
@@ -44,6 +44,12 @@ void omapdss_set_dss(struct dss_device *dss) | |||
44 | } | 44 | } |
45 | EXPORT_SYMBOL(omapdss_set_dss); | 45 | EXPORT_SYMBOL(omapdss_set_dss); |
46 | 46 | ||
47 | struct dispc_device *dispc_get_dispc(struct dss_device *dss) | ||
48 | { | ||
49 | return dss->dispc; | ||
50 | } | ||
51 | EXPORT_SYMBOL(dispc_get_dispc); | ||
52 | |||
47 | const struct dispc_ops *dispc_get_ops(struct dss_device *dss) | 53 | const struct dispc_ops *dispc_get_ops(struct dss_device *dss) |
48 | { | 54 | { |
49 | return dss->dispc_ops; | 55 | return dss->dispc_ops; |
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index aae6037f499f..6d8228f976f9 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c | |||
@@ -162,7 +162,7 @@ struct dispc_features { | |||
162 | #define DISPC_MAX_NR_FIFOS 5 | 162 | #define DISPC_MAX_NR_FIFOS 5 |
163 | #define DISPC_MAX_CHANNEL_GAMMA 4 | 163 | #define DISPC_MAX_CHANNEL_GAMMA 4 |
164 | 164 | ||
165 | static struct { | 165 | struct dispc_device { |
166 | struct platform_device *pdev; | 166 | struct platform_device *pdev; |
167 | void __iomem *base; | 167 | void __iomem *base; |
168 | struct dss_device *dss; | 168 | struct dss_device *dss; |
@@ -194,7 +194,9 @@ static struct { | |||
194 | 194 | ||
195 | /* DISPC_CONTROL & DISPC_CONFIG lock*/ | 195 | /* DISPC_CONTROL & DISPC_CONFIG lock*/ |
196 | spinlock_t control_lock; | 196 | spinlock_t control_lock; |
197 | } dispc; | 197 | }; |
198 | |||
199 | static struct dispc_device dispc; | ||
198 | 200 | ||
199 | enum omap_color_component { | 201 | enum omap_color_component { |
200 | /* used for all color formats for OMAP3 and earlier | 202 | /* used for all color formats for OMAP3 and earlier |
@@ -361,9 +363,7 @@ static unsigned long dispc_mgr_pclk_rate(enum omap_channel channel); | |||
361 | static unsigned long dispc_plane_pclk_rate(enum omap_plane_id plane); | 363 | static unsigned long dispc_plane_pclk_rate(enum omap_plane_id plane); |
362 | static unsigned long dispc_plane_lclk_rate(enum omap_plane_id plane); | 364 | static unsigned long dispc_plane_lclk_rate(enum omap_plane_id plane); |
363 | 365 | ||
364 | static void dispc_clear_irqstatus(u32 mask); | 366 | static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask); |
365 | static bool dispc_mgr_is_enabled(enum omap_channel channel); | ||
366 | static void dispc_clear_irqstatus(u32 mask); | ||
367 | 367 | ||
368 | static inline void dispc_write_reg(const u16 idx, u32 val) | 368 | static inline void dispc_write_reg(const u16 idx, u32 val) |
369 | { | 369 | { |
@@ -396,14 +396,14 @@ static void mgr_fld_write(enum omap_channel channel, | |||
396 | spin_unlock_irqrestore(&dispc.control_lock, flags); | 396 | spin_unlock_irqrestore(&dispc.control_lock, flags); |
397 | } | 397 | } |
398 | 398 | ||
399 | static int dispc_get_num_ovls(void) | 399 | static int dispc_get_num_ovls(struct dispc_device *dispc) |
400 | { | 400 | { |
401 | return dispc.feat->num_ovls; | 401 | return dispc->feat->num_ovls; |
402 | } | 402 | } |
403 | 403 | ||
404 | static int dispc_get_num_mgrs(void) | 404 | static int dispc_get_num_mgrs(struct dispc_device *dispc) |
405 | { | 405 | { |
406 | return dispc.feat->num_mgrs; | 406 | return dispc->feat->num_mgrs; |
407 | } | 407 | } |
408 | 408 | ||
409 | static void dispc_get_reg_field(enum dispc_feat_reg_field id, | 409 | static void dispc_get_reg_field(enum dispc_feat_reg_field id, |
@@ -455,7 +455,7 @@ static void dispc_save_context(void) | |||
455 | SR(CONFIG3); | 455 | SR(CONFIG3); |
456 | } | 456 | } |
457 | 457 | ||
458 | for (i = 0; i < dispc_get_num_mgrs(); i++) { | 458 | for (i = 0; i < dispc_get_num_mgrs(&dispc); i++) { |
459 | SR(DEFAULT_COLOR(i)); | 459 | SR(DEFAULT_COLOR(i)); |
460 | SR(TRANS_COLOR(i)); | 460 | SR(TRANS_COLOR(i)); |
461 | SR(SIZE_MGR(i)); | 461 | SR(SIZE_MGR(i)); |
@@ -477,7 +477,7 @@ static void dispc_save_context(void) | |||
477 | } | 477 | } |
478 | } | 478 | } |
479 | 479 | ||
480 | for (i = 0; i < dispc_get_num_ovls(); i++) { | 480 | for (i = 0; i < dispc_get_num_ovls(&dispc); i++) { |
481 | SR(OVL_BA0(i)); | 481 | SR(OVL_BA0(i)); |
482 | SR(OVL_BA1(i)); | 482 | SR(OVL_BA1(i)); |
483 | SR(OVL_POSITION(i)); | 483 | SR(OVL_POSITION(i)); |
@@ -561,7 +561,7 @@ static void dispc_restore_context(void) | |||
561 | if (dispc_has_feature(FEAT_MGR_LCD3)) | 561 | if (dispc_has_feature(FEAT_MGR_LCD3)) |
562 | RR(CONFIG3); | 562 | RR(CONFIG3); |
563 | 563 | ||
564 | for (i = 0; i < dispc_get_num_mgrs(); i++) { | 564 | for (i = 0; i < dispc_get_num_mgrs(&dispc); i++) { |
565 | RR(DEFAULT_COLOR(i)); | 565 | RR(DEFAULT_COLOR(i)); |
566 | RR(TRANS_COLOR(i)); | 566 | RR(TRANS_COLOR(i)); |
567 | RR(SIZE_MGR(i)); | 567 | RR(SIZE_MGR(i)); |
@@ -583,7 +583,7 @@ static void dispc_restore_context(void) | |||
583 | } | 583 | } |
584 | } | 584 | } |
585 | 585 | ||
586 | for (i = 0; i < dispc_get_num_ovls(); i++) { | 586 | for (i = 0; i < dispc_get_num_ovls(&dispc); i++) { |
587 | RR(OVL_BA0(i)); | 587 | RR(OVL_BA0(i)); |
588 | RR(OVL_BA1(i)); | 588 | RR(OVL_BA1(i)); |
589 | RR(OVL_POSITION(i)); | 589 | RR(OVL_POSITION(i)); |
@@ -648,7 +648,7 @@ static void dispc_restore_context(void) | |||
648 | if (dispc_has_feature(FEAT_MGR_LCD3)) | 648 | if (dispc_has_feature(FEAT_MGR_LCD3)) |
649 | RR(CONTROL3); | 649 | RR(CONTROL3); |
650 | /* clear spurious SYNC_LOST_DIGIT interrupts */ | 650 | /* clear spurious SYNC_LOST_DIGIT interrupts */ |
651 | dispc_clear_irqstatus(DISPC_IRQ_SYNC_LOST_DIGIT); | 651 | dispc_clear_irqstatus(&dispc, DISPC_IRQ_SYNC_LOST_DIGIT); |
652 | 652 | ||
653 | /* | 653 | /* |
654 | * enable last so IRQs won't trigger before | 654 | * enable last so IRQs won't trigger before |
@@ -662,41 +662,44 @@ static void dispc_restore_context(void) | |||
662 | #undef SR | 662 | #undef SR |
663 | #undef RR | 663 | #undef RR |
664 | 664 | ||
665 | int dispc_runtime_get(void) | 665 | int dispc_runtime_get(struct dispc_device *dispc) |
666 | { | 666 | { |
667 | int r; | 667 | int r; |
668 | 668 | ||
669 | DSSDBG("dispc_runtime_get\n"); | 669 | DSSDBG("dispc_runtime_get\n"); |
670 | 670 | ||
671 | r = pm_runtime_get_sync(&dispc.pdev->dev); | 671 | r = pm_runtime_get_sync(&dispc->pdev->dev); |
672 | WARN_ON(r < 0); | 672 | WARN_ON(r < 0); |
673 | return r < 0 ? r : 0; | 673 | return r < 0 ? r : 0; |
674 | } | 674 | } |
675 | 675 | ||
676 | void dispc_runtime_put(void) | 676 | void dispc_runtime_put(struct dispc_device *dispc) |
677 | { | 677 | { |
678 | int r; | 678 | int r; |
679 | 679 | ||
680 | DSSDBG("dispc_runtime_put\n"); | 680 | DSSDBG("dispc_runtime_put\n"); |
681 | 681 | ||
682 | r = pm_runtime_put_sync(&dispc.pdev->dev); | 682 | r = pm_runtime_put_sync(&dispc->pdev->dev); |
683 | WARN_ON(r < 0 && r != -ENOSYS); | 683 | WARN_ON(r < 0 && r != -ENOSYS); |
684 | } | 684 | } |
685 | 685 | ||
686 | static u32 dispc_mgr_get_vsync_irq(enum omap_channel channel) | 686 | static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc, |
687 | enum omap_channel channel) | ||
687 | { | 688 | { |
688 | return mgr_desc[channel].vsync_irq; | 689 | return mgr_desc[channel].vsync_irq; |
689 | } | 690 | } |
690 | 691 | ||
691 | static u32 dispc_mgr_get_framedone_irq(enum omap_channel channel) | 692 | static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc, |
693 | enum omap_channel channel) | ||
692 | { | 694 | { |
693 | if (channel == OMAP_DSS_CHANNEL_DIGIT && dispc.feat->no_framedone_tv) | 695 | if (channel == OMAP_DSS_CHANNEL_DIGIT && dispc->feat->no_framedone_tv) |
694 | return 0; | 696 | return 0; |
695 | 697 | ||
696 | return mgr_desc[channel].framedone_irq; | 698 | return mgr_desc[channel].framedone_irq; |
697 | } | 699 | } |
698 | 700 | ||
699 | static u32 dispc_mgr_get_sync_lost_irq(enum omap_channel channel) | 701 | static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc, |
702 | enum omap_channel channel) | ||
700 | { | 703 | { |
701 | return mgr_desc[channel].sync_lost_irq; | 704 | return mgr_desc[channel].sync_lost_irq; |
702 | } | 705 | } |
@@ -706,27 +709,30 @@ u32 dispc_wb_get_framedone_irq(void) | |||
706 | return DISPC_IRQ_FRAMEDONEWB; | 709 | return DISPC_IRQ_FRAMEDONEWB; |
707 | } | 710 | } |
708 | 711 | ||
709 | static void dispc_mgr_enable(enum omap_channel channel, bool enable) | 712 | static void dispc_mgr_enable(struct dispc_device *dispc, |
713 | enum omap_channel channel, bool enable) | ||
710 | { | 714 | { |
711 | mgr_fld_write(channel, DISPC_MGR_FLD_ENABLE, enable); | 715 | mgr_fld_write(channel, DISPC_MGR_FLD_ENABLE, enable); |
712 | /* flush posted write */ | 716 | /* flush posted write */ |
713 | mgr_fld_read(channel, DISPC_MGR_FLD_ENABLE); | 717 | mgr_fld_read(channel, DISPC_MGR_FLD_ENABLE); |
714 | } | 718 | } |
715 | 719 | ||
716 | static bool dispc_mgr_is_enabled(enum omap_channel channel) | 720 | static bool dispc_mgr_is_enabled(struct dispc_device *dispc, |
721 | enum omap_channel channel) | ||
717 | { | 722 | { |
718 | return !!mgr_fld_read(channel, DISPC_MGR_FLD_ENABLE); | 723 | return !!mgr_fld_read(channel, DISPC_MGR_FLD_ENABLE); |
719 | } | 724 | } |
720 | 725 | ||
721 | static bool dispc_mgr_go_busy(enum omap_channel channel) | 726 | static bool dispc_mgr_go_busy(struct dispc_device *dispc, |
727 | enum omap_channel channel) | ||
722 | { | 728 | { |
723 | return mgr_fld_read(channel, DISPC_MGR_FLD_GO) == 1; | 729 | return mgr_fld_read(channel, DISPC_MGR_FLD_GO) == 1; |
724 | } | 730 | } |
725 | 731 | ||
726 | static void dispc_mgr_go(enum omap_channel channel) | 732 | static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel) |
727 | { | 733 | { |
728 | WARN_ON(!dispc_mgr_is_enabled(channel)); | 734 | WARN_ON(!dispc_mgr_is_enabled(dispc, channel)); |
729 | WARN_ON(dispc_mgr_go_busy(channel)); | 735 | WARN_ON(dispc_mgr_go_busy(dispc, channel)); |
730 | 736 | ||
731 | DSSDBG("GO %s\n", mgr_desc[channel].name); | 737 | DSSDBG("GO %s\n", mgr_desc[channel].name); |
732 | 738 | ||
@@ -864,7 +870,7 @@ static void dispc_ovl_write_color_conv_coef(enum omap_plane_id plane, | |||
864 | static void dispc_setup_color_conv_coef(void) | 870 | static void dispc_setup_color_conv_coef(void) |
865 | { | 871 | { |
866 | int i; | 872 | int i; |
867 | int num_ovl = dispc_get_num_ovls(); | 873 | int num_ovl = dispc_get_num_ovls(&dispc); |
868 | const struct color_conv_coef ctbl_bt601_5_ovl = { | 874 | const struct color_conv_coef ctbl_bt601_5_ovl = { |
869 | /* YUV -> RGB */ | 875 | /* YUV -> RGB */ |
870 | 298, 409, 0, 298, -208, -100, 298, 0, 517, 0, | 876 | 298, 409, 0, 298, -208, -100, 298, 0, 517, 0, |
@@ -956,7 +962,7 @@ static void dispc_ovl_enable_zorder_planes(void) | |||
956 | if (!dispc_has_feature(FEAT_ALPHA_FREE_ZORDER)) | 962 | if (!dispc_has_feature(FEAT_ALPHA_FREE_ZORDER)) |
957 | return; | 963 | return; |
958 | 964 | ||
959 | for (i = 0; i < dispc_get_num_ovls(); i++) | 965 | for (i = 0; i < dispc_get_num_ovls(&dispc); i++) |
960 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(i), 1, 25, 25); | 966 | REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(i), 1, 25, 25); |
961 | } | 967 | } |
962 | 968 | ||
@@ -1213,7 +1219,7 @@ static void dispc_configure_burst_sizes(void) | |||
1213 | const int burst_size = BURST_SIZE_X8; | 1219 | const int burst_size = BURST_SIZE_X8; |
1214 | 1220 | ||
1215 | /* Configure burst size always to maximum size */ | 1221 | /* Configure burst size always to maximum size */ |
1216 | for (i = 0; i < dispc_get_num_ovls(); ++i) | 1222 | for (i = 0; i < dispc_get_num_ovls(&dispc); ++i) |
1217 | dispc_ovl_set_burst_size(i, burst_size); | 1223 | dispc_ovl_set_burst_size(i, burst_size); |
1218 | if (dispc.feat->has_writeback) | 1224 | if (dispc.feat->has_writeback) |
1219 | dispc_ovl_set_burst_size(OMAP_DSS_WB, burst_size); | 1225 | dispc_ovl_set_burst_size(OMAP_DSS_WB, burst_size); |
@@ -1240,9 +1246,10 @@ static bool dispc_ovl_color_mode_supported(enum omap_plane_id plane, u32 fourcc) | |||
1240 | return false; | 1246 | return false; |
1241 | } | 1247 | } |
1242 | 1248 | ||
1243 | static const u32 *dispc_ovl_get_color_modes(enum omap_plane_id plane) | 1249 | static const u32 *dispc_ovl_get_color_modes(struct dispc_device *dispc, |
1250 | enum omap_plane_id plane) | ||
1244 | { | 1251 | { |
1245 | return dispc.feat->supported_color_modes[plane]; | 1252 | return dispc->feat->supported_color_modes[plane]; |
1246 | } | 1253 | } |
1247 | 1254 | ||
1248 | static void dispc_mgr_enable_cpr(enum omap_channel channel, bool enable) | 1255 | static void dispc_mgr_enable_cpr(enum omap_channel channel, bool enable) |
@@ -1359,7 +1366,7 @@ static void dispc_init_fifos(void) | |||
1359 | /* | 1366 | /* |
1360 | * Setup default fifo thresholds. | 1367 | * Setup default fifo thresholds. |
1361 | */ | 1368 | */ |
1362 | for (i = 0; i < dispc_get_num_ovls(); ++i) { | 1369 | for (i = 0; i < dispc_get_num_ovls(&dispc); ++i) { |
1363 | u32 low, high; | 1370 | u32 low, high; |
1364 | const bool use_fifomerge = false; | 1371 | const bool use_fifomerge = false; |
1365 | const bool manual_update = false; | 1372 | const bool manual_update = false; |
@@ -1462,7 +1469,7 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane, | |||
1462 | 1469 | ||
1463 | if (use_fifomerge) { | 1470 | if (use_fifomerge) { |
1464 | total_fifo_size = 0; | 1471 | total_fifo_size = 0; |
1465 | for (i = 0; i < dispc_get_num_ovls(); ++i) | 1472 | for (i = 0; i < dispc_get_num_ovls(&dispc); ++i) |
1466 | total_fifo_size += dispc_ovl_get_fifo_size(i); | 1473 | total_fifo_size += dispc_ovl_get_fifo_size(i); |
1467 | } else { | 1474 | } else { |
1468 | total_fifo_size = ovl_fifo_size; | 1475 | total_fifo_size = ovl_fifo_size; |
@@ -1528,7 +1535,7 @@ static void dispc_init_mflag(void) | |||
1528 | (1 << 0) | /* MFLAG_CTRL = force always on */ | 1535 | (1 << 0) | /* MFLAG_CTRL = force always on */ |
1529 | (0 << 2)); /* MFLAG_START = disable */ | 1536 | (0 << 2)); /* MFLAG_START = disable */ |
1530 | 1537 | ||
1531 | for (i = 0; i < dispc_get_num_ovls(); ++i) { | 1538 | for (i = 0; i < dispc_get_num_ovls(&dispc); ++i) { |
1532 | u32 size = dispc_ovl_get_fifo_size(i); | 1539 | u32 size = dispc_ovl_get_fifo_size(i); |
1533 | u32 unit = dispc.feat->buffer_size_unit; | 1540 | u32 unit = dispc.feat->buffer_size_unit; |
1534 | u32 low, high; | 1541 | u32 low, high; |
@@ -2631,13 +2638,14 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane, | |||
2631 | return 0; | 2638 | return 0; |
2632 | } | 2639 | } |
2633 | 2640 | ||
2634 | static int dispc_ovl_setup(enum omap_plane_id plane, | 2641 | static int dispc_ovl_setup(struct dispc_device *dispc, |
2635 | const struct omap_overlay_info *oi, | 2642 | enum omap_plane_id plane, |
2636 | const struct videomode *vm, bool mem_to_mem, | 2643 | const struct omap_overlay_info *oi, |
2637 | enum omap_channel channel) | 2644 | const struct videomode *vm, bool mem_to_mem, |
2645 | enum omap_channel channel) | ||
2638 | { | 2646 | { |
2639 | int r; | 2647 | int r; |
2640 | enum omap_overlay_caps caps = dispc.feat->overlay_caps[plane]; | 2648 | enum omap_overlay_caps caps = dispc->feat->overlay_caps[plane]; |
2641 | const bool replication = true; | 2649 | const bool replication = true; |
2642 | 2650 | ||
2643 | DSSDBG("dispc_ovl_setup %d, pa %pad, pa_uv %pad, sw %d, %d,%d, %dx%d ->" | 2651 | DSSDBG("dispc_ovl_setup %d, pa %pad, pa_uv %pad, sw %d, %d,%d, %dx%d ->" |
@@ -2724,7 +2732,8 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, | |||
2724 | return r; | 2732 | return r; |
2725 | } | 2733 | } |
2726 | 2734 | ||
2727 | static int dispc_ovl_enable(enum omap_plane_id plane, bool enable) | 2735 | static int dispc_ovl_enable(struct dispc_device *dispc, |
2736 | enum omap_plane_id plane, bool enable) | ||
2728 | { | 2737 | { |
2729 | DSSDBG("dispc_enable_plane %d, %d\n", plane, enable); | 2738 | DSSDBG("dispc_enable_plane %d, %d\n", plane, enable); |
2730 | 2739 | ||
@@ -2733,9 +2742,11 @@ static int dispc_ovl_enable(enum omap_plane_id plane, bool enable) | |||
2733 | return 0; | 2742 | return 0; |
2734 | } | 2743 | } |
2735 | 2744 | ||
2736 | static enum omap_dss_output_id dispc_mgr_get_supported_outputs(enum omap_channel channel) | 2745 | static enum omap_dss_output_id |
2746 | dispc_mgr_get_supported_outputs(struct dispc_device *dispc, | ||
2747 | enum omap_channel channel) | ||
2737 | { | 2748 | { |
2738 | return dss_get_supported_outputs(dispc.dss, channel); | 2749 | return dss_get_supported_outputs(dispc->dss, channel); |
2739 | } | 2750 | } |
2740 | 2751 | ||
2741 | static void dispc_lcd_enable_signal_polarity(bool act_high) | 2752 | static void dispc_lcd_enable_signal_polarity(bool act_high) |
@@ -2810,8 +2821,9 @@ static void dispc_mgr_enable_alpha_fixed_zorder(enum omap_channel ch, | |||
2810 | REG_FLD_MOD(DISPC_CONFIG, enable, 19, 19); | 2821 | REG_FLD_MOD(DISPC_CONFIG, enable, 19, 19); |
2811 | } | 2822 | } |
2812 | 2823 | ||
2813 | static void dispc_mgr_setup(enum omap_channel channel, | 2824 | static void dispc_mgr_setup(struct dispc_device *dispc, |
2814 | const struct omap_overlay_manager_info *info) | 2825 | enum omap_channel channel, |
2826 | const struct omap_overlay_manager_info *info) | ||
2815 | { | 2827 | { |
2816 | dispc_mgr_set_default_color(channel, info->default_color); | 2828 | dispc_mgr_set_default_color(channel, info->default_color); |
2817 | dispc_mgr_set_trans_key(channel, info->trans_key_type, info->trans_key); | 2829 | dispc_mgr_set_trans_key(channel, info->trans_key_type, info->trans_key); |
@@ -2883,8 +2895,9 @@ static void dispc_mgr_enable_stallmode(enum omap_channel channel, bool enable) | |||
2883 | mgr_fld_write(channel, DISPC_MGR_FLD_STALLMODE, enable); | 2895 | mgr_fld_write(channel, DISPC_MGR_FLD_STALLMODE, enable); |
2884 | } | 2896 | } |
2885 | 2897 | ||
2886 | static void dispc_mgr_set_lcd_config(enum omap_channel channel, | 2898 | static void dispc_mgr_set_lcd_config(struct dispc_device *dispc, |
2887 | const struct dss_lcd_mgr_config *config) | 2899 | enum omap_channel channel, |
2900 | const struct dss_lcd_mgr_config *config) | ||
2888 | { | 2901 | { |
2889 | dispc_mgr_set_io_pad_mode(config->io_pad_mode); | 2902 | dispc_mgr_set_io_pad_mode(config->io_pad_mode); |
2890 | 2903 | ||
@@ -3039,8 +3052,9 @@ static int vm_flag_to_int(enum display_flags flags, enum display_flags high, | |||
3039 | } | 3052 | } |
3040 | 3053 | ||
3041 | /* change name to mode? */ | 3054 | /* change name to mode? */ |
3042 | static void dispc_mgr_set_timings(enum omap_channel channel, | 3055 | static void dispc_mgr_set_timings(struct dispc_device *dispc, |
3043 | const struct videomode *vm) | 3056 | enum omap_channel channel, |
3057 | const struct videomode *vm) | ||
3044 | { | 3058 | { |
3045 | unsigned int xtot, ytot; | 3059 | unsigned int xtot, ytot; |
3046 | unsigned long ht, vt; | 3060 | unsigned long ht, vt; |
@@ -3078,7 +3092,7 @@ static void dispc_mgr_set_timings(enum omap_channel channel, | |||
3078 | if (t.flags & DISPLAY_FLAGS_INTERLACED) | 3092 | if (t.flags & DISPLAY_FLAGS_INTERLACED) |
3079 | t.vactive /= 2; | 3093 | t.vactive /= 2; |
3080 | 3094 | ||
3081 | if (dispc.feat->supports_double_pixel) | 3095 | if (dispc->feat->supports_double_pixel) |
3082 | REG_FLD_MOD(DISPC_CONTROL, | 3096 | REG_FLD_MOD(DISPC_CONTROL, |
3083 | !!(t.flags & DISPLAY_FLAGS_DOUBLECLK), | 3097 | !!(t.flags & DISPLAY_FLAGS_DOUBLECLK), |
3084 | 19, 17); | 3098 | 19, 17); |
@@ -3241,7 +3255,7 @@ void dispc_dump_clocks(struct seq_file *s) | |||
3241 | u32 l; | 3255 | u32 l; |
3242 | enum dss_clk_source dispc_clk_src = dss_get_dispc_clk_source(dispc.dss); | 3256 | enum dss_clk_source dispc_clk_src = dss_get_dispc_clk_source(dispc.dss); |
3243 | 3257 | ||
3244 | if (dispc_runtime_get()) | 3258 | if (dispc_runtime_get(&dispc)) |
3245 | return; | 3259 | return; |
3246 | 3260 | ||
3247 | seq_printf(s, "- DISPC -\n"); | 3261 | seq_printf(s, "- DISPC -\n"); |
@@ -3267,7 +3281,7 @@ void dispc_dump_clocks(struct seq_file *s) | |||
3267 | if (dispc_has_feature(FEAT_MGR_LCD3)) | 3281 | if (dispc_has_feature(FEAT_MGR_LCD3)) |
3268 | dispc_dump_clocks_channel(s, OMAP_DSS_CHANNEL_LCD3); | 3282 | dispc_dump_clocks_channel(s, OMAP_DSS_CHANNEL_LCD3); |
3269 | 3283 | ||
3270 | dispc_runtime_put(); | 3284 | dispc_runtime_put(&dispc); |
3271 | } | 3285 | } |
3272 | 3286 | ||
3273 | static int dispc_dump_regs(struct seq_file *s, void *p) | 3287 | static int dispc_dump_regs(struct seq_file *s, void *p) |
@@ -3290,7 +3304,7 @@ static int dispc_dump_regs(struct seq_file *s, void *p) | |||
3290 | 3304 | ||
3291 | #define DUMPREG(r) seq_printf(s, "%-50s %08x\n", #r, dispc_read_reg(r)) | 3305 | #define DUMPREG(r) seq_printf(s, "%-50s %08x\n", #r, dispc_read_reg(r)) |
3292 | 3306 | ||
3293 | if (dispc_runtime_get()) | 3307 | if (dispc_runtime_get(&dispc)) |
3294 | return 0; | 3308 | return 0; |
3295 | 3309 | ||
3296 | /* DISPC common registers */ | 3310 | /* DISPC common registers */ |
@@ -3328,7 +3342,7 @@ static int dispc_dump_regs(struct seq_file *s, void *p) | |||
3328 | p_names = mgr_names; | 3342 | p_names = mgr_names; |
3329 | 3343 | ||
3330 | /* DISPC channel specific registers */ | 3344 | /* DISPC channel specific registers */ |
3331 | for (i = 0; i < dispc_get_num_mgrs(); i++) { | 3345 | for (i = 0; i < dispc_get_num_mgrs(&dispc); i++) { |
3332 | DUMPREG(i, DISPC_DEFAULT_COLOR); | 3346 | DUMPREG(i, DISPC_DEFAULT_COLOR); |
3333 | DUMPREG(i, DISPC_TRANS_COLOR); | 3347 | DUMPREG(i, DISPC_TRANS_COLOR); |
3334 | DUMPREG(i, DISPC_SIZE_MGR); | 3348 | DUMPREG(i, DISPC_SIZE_MGR); |
@@ -3354,7 +3368,7 @@ static int dispc_dump_regs(struct seq_file *s, void *p) | |||
3354 | 3368 | ||
3355 | p_names = ovl_names; | 3369 | p_names = ovl_names; |
3356 | 3370 | ||
3357 | for (i = 0; i < dispc_get_num_ovls(); i++) { | 3371 | for (i = 0; i < dispc_get_num_ovls(&dispc); i++) { |
3358 | DUMPREG(i, DISPC_OVL_BA0); | 3372 | DUMPREG(i, DISPC_OVL_BA0); |
3359 | DUMPREG(i, DISPC_OVL_BA1); | 3373 | DUMPREG(i, DISPC_OVL_BA1); |
3360 | DUMPREG(i, DISPC_OVL_POSITION); | 3374 | DUMPREG(i, DISPC_OVL_POSITION); |
@@ -3432,7 +3446,7 @@ static int dispc_dump_regs(struct seq_file *s, void *p) | |||
3432 | /* Video pipeline coefficient registers */ | 3446 | /* Video pipeline coefficient registers */ |
3433 | 3447 | ||
3434 | /* start from OMAP_DSS_VIDEO1 */ | 3448 | /* start from OMAP_DSS_VIDEO1 */ |
3435 | for (i = 1; i < dispc_get_num_ovls(); i++) { | 3449 | for (i = 1; i < dispc_get_num_ovls(&dispc); i++) { |
3436 | for (j = 0; j < 8; j++) | 3450 | for (j = 0; j < 8; j++) |
3437 | DUMPREG(i, DISPC_OVL_FIR_COEF_H, j); | 3451 | DUMPREG(i, DISPC_OVL_FIR_COEF_H, j); |
3438 | 3452 | ||
@@ -3459,7 +3473,7 @@ static int dispc_dump_regs(struct seq_file *s, void *p) | |||
3459 | } | 3473 | } |
3460 | } | 3474 | } |
3461 | 3475 | ||
3462 | dispc_runtime_put(); | 3476 | dispc_runtime_put(&dispc); |
3463 | 3477 | ||
3464 | #undef DISPC_REG | 3478 | #undef DISPC_REG |
3465 | #undef DUMPREG | 3479 | #undef DUMPREG |
@@ -3567,22 +3581,22 @@ int dispc_mgr_get_clock_div(enum omap_channel channel, | |||
3567 | return 0; | 3581 | return 0; |
3568 | } | 3582 | } |
3569 | 3583 | ||
3570 | static u32 dispc_read_irqstatus(void) | 3584 | static u32 dispc_read_irqstatus(struct dispc_device *dispc) |
3571 | { | 3585 | { |
3572 | return dispc_read_reg(DISPC_IRQSTATUS); | 3586 | return dispc_read_reg(DISPC_IRQSTATUS); |
3573 | } | 3587 | } |
3574 | 3588 | ||
3575 | static void dispc_clear_irqstatus(u32 mask) | 3589 | static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask) |
3576 | { | 3590 | { |
3577 | dispc_write_reg(DISPC_IRQSTATUS, mask); | 3591 | dispc_write_reg(DISPC_IRQSTATUS, mask); |
3578 | } | 3592 | } |
3579 | 3593 | ||
3580 | static void dispc_write_irqenable(u32 mask) | 3594 | static void dispc_write_irqenable(struct dispc_device *dispc, u32 mask) |
3581 | { | 3595 | { |
3582 | u32 old_mask = dispc_read_reg(DISPC_IRQENABLE); | 3596 | u32 old_mask = dispc_read_reg(DISPC_IRQENABLE); |
3583 | 3597 | ||
3584 | /* clear the irqstatus for newly enabled irqs */ | 3598 | /* clear the irqstatus for newly enabled irqs */ |
3585 | dispc_clear_irqstatus((mask ^ old_mask) & mask); | 3599 | dispc_clear_irqstatus(dispc, (mask ^ old_mask) & mask); |
3586 | 3600 | ||
3587 | dispc_write_reg(DISPC_IRQENABLE, mask); | 3601 | dispc_write_reg(DISPC_IRQENABLE, mask); |
3588 | 3602 | ||
@@ -3600,11 +3614,12 @@ void dispc_disable_sidle(void) | |||
3600 | REG_FLD_MOD(DISPC_SYSCONFIG, 1, 4, 3); /* SIDLEMODE: no idle */ | 3614 | REG_FLD_MOD(DISPC_SYSCONFIG, 1, 4, 3); /* SIDLEMODE: no idle */ |
3601 | } | 3615 | } |
3602 | 3616 | ||
3603 | static u32 dispc_mgr_gamma_size(enum omap_channel channel) | 3617 | static u32 dispc_mgr_gamma_size(struct dispc_device *dispc, |
3618 | enum omap_channel channel) | ||
3604 | { | 3619 | { |
3605 | const struct dispc_gamma_desc *gdesc = &mgr_desc[channel].gamma; | 3620 | const struct dispc_gamma_desc *gdesc = &mgr_desc[channel].gamma; |
3606 | 3621 | ||
3607 | if (!dispc.feat->has_gamma_table) | 3622 | if (!dispc->feat->has_gamma_table) |
3608 | return 0; | 3623 | return 0; |
3609 | 3624 | ||
3610 | return gdesc->len; | 3625 | return gdesc->len; |
@@ -3653,18 +3668,19 @@ static const struct drm_color_lut dispc_mgr_gamma_default_lut[] = { | |||
3653 | { .red = U16_MAX, .green = U16_MAX, .blue = U16_MAX, }, | 3668 | { .red = U16_MAX, .green = U16_MAX, .blue = U16_MAX, }, |
3654 | }; | 3669 | }; |
3655 | 3670 | ||
3656 | static void dispc_mgr_set_gamma(enum omap_channel channel, | 3671 | static void dispc_mgr_set_gamma(struct dispc_device *dispc, |
3657 | const struct drm_color_lut *lut, | 3672 | enum omap_channel channel, |
3658 | unsigned int length) | 3673 | const struct drm_color_lut *lut, |
3674 | unsigned int length) | ||
3659 | { | 3675 | { |
3660 | const struct dispc_gamma_desc *gdesc = &mgr_desc[channel].gamma; | 3676 | const struct dispc_gamma_desc *gdesc = &mgr_desc[channel].gamma; |
3661 | u32 *table = dispc.gamma_table[channel]; | 3677 | u32 *table = dispc->gamma_table[channel]; |
3662 | uint i; | 3678 | uint i; |
3663 | 3679 | ||
3664 | DSSDBG("%s: channel %d, lut len %u, hw len %u\n", __func__, | 3680 | DSSDBG("%s: channel %d, lut len %u, hw len %u\n", __func__, |
3665 | channel, length, gdesc->len); | 3681 | channel, length, gdesc->len); |
3666 | 3682 | ||
3667 | if (!dispc.feat->has_gamma_table) | 3683 | if (!dispc->feat->has_gamma_table) |
3668 | return; | 3684 | return; |
3669 | 3685 | ||
3670 | if (lut == NULL || length < 2) { | 3686 | if (lut == NULL || length < 2) { |
@@ -3696,7 +3712,7 @@ static void dispc_mgr_set_gamma(enum omap_channel channel, | |||
3696 | } | 3712 | } |
3697 | } | 3713 | } |
3698 | 3714 | ||
3699 | if (dispc.is_enabled) | 3715 | if (dispc->is_enabled) |
3700 | dispc_mgr_write_gamma_table(channel); | 3716 | dispc_mgr_write_gamma_table(channel); |
3701 | } | 3717 | } |
3702 | 3718 | ||
@@ -3726,7 +3742,7 @@ static int dispc_init_gamma_tables(void) | |||
3726 | 3742 | ||
3727 | dispc.gamma_table[channel] = gt; | 3743 | dispc.gamma_table[channel] = gt; |
3728 | 3744 | ||
3729 | dispc_mgr_set_gamma(channel, NULL, 0); | 3745 | dispc_mgr_set_gamma(&dispc, channel, NULL, 0); |
3730 | } | 3746 | } |
3731 | return 0; | 3747 | return 0; |
3732 | } | 3748 | } |
@@ -4296,43 +4312,44 @@ static irqreturn_t dispc_irq_handler(int irq, void *arg) | |||
4296 | return dispc.user_handler(irq, dispc.user_data); | 4312 | return dispc.user_handler(irq, dispc.user_data); |
4297 | } | 4313 | } |
4298 | 4314 | ||
4299 | static int dispc_request_irq(irq_handler_t handler, void *dev_id) | 4315 | static int dispc_request_irq(struct dispc_device *dispc, irq_handler_t handler, |
4316 | void *dev_id) | ||
4300 | { | 4317 | { |
4301 | int r; | 4318 | int r; |
4302 | 4319 | ||
4303 | if (dispc.user_handler != NULL) | 4320 | if (dispc->user_handler != NULL) |
4304 | return -EBUSY; | 4321 | return -EBUSY; |
4305 | 4322 | ||
4306 | dispc.user_handler = handler; | 4323 | dispc->user_handler = handler; |
4307 | dispc.user_data = dev_id; | 4324 | dispc->user_data = dev_id; |
4308 | 4325 | ||
4309 | /* ensure the dispc_irq_handler sees the values above */ | 4326 | /* ensure the dispc_irq_handler sees the values above */ |
4310 | smp_wmb(); | 4327 | smp_wmb(); |
4311 | 4328 | ||
4312 | r = devm_request_irq(&dispc.pdev->dev, dispc.irq, dispc_irq_handler, | 4329 | r = devm_request_irq(&dispc->pdev->dev, dispc->irq, dispc_irq_handler, |
4313 | IRQF_SHARED, "OMAP DISPC", &dispc); | 4330 | IRQF_SHARED, "OMAP DISPC", dispc); |
4314 | if (r) { | 4331 | if (r) { |
4315 | dispc.user_handler = NULL; | 4332 | dispc->user_handler = NULL; |
4316 | dispc.user_data = NULL; | 4333 | dispc->user_data = NULL; |
4317 | } | 4334 | } |
4318 | 4335 | ||
4319 | return r; | 4336 | return r; |
4320 | } | 4337 | } |
4321 | 4338 | ||
4322 | static void dispc_free_irq(void *dev_id) | 4339 | static void dispc_free_irq(struct dispc_device *dispc, void *dev_id) |
4323 | { | 4340 | { |
4324 | devm_free_irq(&dispc.pdev->dev, dispc.irq, &dispc); | 4341 | devm_free_irq(&dispc->pdev->dev, dispc->irq, dispc); |
4325 | 4342 | ||
4326 | dispc.user_handler = NULL; | 4343 | dispc->user_handler = NULL; |
4327 | dispc.user_data = NULL; | 4344 | dispc->user_data = NULL; |
4328 | } | 4345 | } |
4329 | 4346 | ||
4330 | static u32 dispc_get_memory_bandwidth_limit(void) | 4347 | static u32 dispc_get_memory_bandwidth_limit(struct dispc_device *dispc) |
4331 | { | 4348 | { |
4332 | u32 limit = 0; | 4349 | u32 limit = 0; |
4333 | 4350 | ||
4334 | /* Optional maximum memory bandwidth */ | 4351 | /* Optional maximum memory bandwidth */ |
4335 | of_property_read_u32(dispc.pdev->dev.of_node, "max-memory-bandwidth", | 4352 | of_property_read_u32(dispc->pdev->dev.of_node, "max-memory-bandwidth", |
4336 | &limit); | 4353 | &limit); |
4337 | 4354 | ||
4338 | return limit; | 4355 | return limit; |
@@ -4439,7 +4456,8 @@ static void dispc_errata_i734_wa_fini(void) | |||
4439 | 4456 | ||
4440 | static void dispc_errata_i734_wa(void) | 4457 | static void dispc_errata_i734_wa(void) |
4441 | { | 4458 | { |
4442 | u32 framedone_irq = dispc_mgr_get_framedone_irq(OMAP_DSS_CHANNEL_LCD); | 4459 | u32 framedone_irq = dispc_mgr_get_framedone_irq(&dispc, |
4460 | OMAP_DSS_CHANNEL_LCD); | ||
4443 | struct omap_overlay_info ovli; | 4461 | struct omap_overlay_info ovli; |
4444 | struct dss_lcd_mgr_config lcd_conf; | 4462 | struct dss_lcd_mgr_config lcd_conf; |
4445 | u32 gatestate; | 4463 | u32 gatestate; |
@@ -4458,39 +4476,39 @@ static void dispc_errata_i734_wa(void) | |||
4458 | REG_FLD_MOD(DISPC_CONFIG, 0x1f, 8, 4); | 4476 | REG_FLD_MOD(DISPC_CONFIG, 0x1f, 8, 4); |
4459 | 4477 | ||
4460 | /* Setup and enable GFX plane */ | 4478 | /* Setup and enable GFX plane */ |
4461 | dispc_ovl_setup(OMAP_DSS_GFX, &ovli, &i734.vm, false, | 4479 | dispc_ovl_setup(&dispc, OMAP_DSS_GFX, &ovli, &i734.vm, false, |
4462 | OMAP_DSS_CHANNEL_LCD); | 4480 | OMAP_DSS_CHANNEL_LCD); |
4463 | dispc_ovl_enable(OMAP_DSS_GFX, true); | 4481 | dispc_ovl_enable(&dispc, OMAP_DSS_GFX, true); |
4464 | 4482 | ||
4465 | /* Set up and enable display manager for LCD1 */ | 4483 | /* Set up and enable display manager for LCD1 */ |
4466 | dispc_mgr_setup(OMAP_DSS_CHANNEL_LCD, &i734.mgri); | 4484 | dispc_mgr_setup(&dispc, OMAP_DSS_CHANNEL_LCD, &i734.mgri); |
4467 | dispc_calc_clock_rates(dss_get_dispc_clk_rate(dispc.dss), | 4485 | dispc_calc_clock_rates(dss_get_dispc_clk_rate(dispc.dss), |
4468 | &lcd_conf.clock_info); | 4486 | &lcd_conf.clock_info); |
4469 | dispc_mgr_set_lcd_config(OMAP_DSS_CHANNEL_LCD, &lcd_conf); | 4487 | dispc_mgr_set_lcd_config(&dispc, OMAP_DSS_CHANNEL_LCD, &lcd_conf); |
4470 | dispc_mgr_set_timings(OMAP_DSS_CHANNEL_LCD, &i734.vm); | 4488 | dispc_mgr_set_timings(&dispc, OMAP_DSS_CHANNEL_LCD, &i734.vm); |
4471 | 4489 | ||
4472 | dispc_clear_irqstatus(framedone_irq); | 4490 | dispc_clear_irqstatus(&dispc, framedone_irq); |
4473 | 4491 | ||
4474 | /* Enable and shut the channel to produce just one frame */ | 4492 | /* Enable and shut the channel to produce just one frame */ |
4475 | dispc_mgr_enable(OMAP_DSS_CHANNEL_LCD, true); | 4493 | dispc_mgr_enable(&dispc, OMAP_DSS_CHANNEL_LCD, true); |
4476 | dispc_mgr_enable(OMAP_DSS_CHANNEL_LCD, false); | 4494 | dispc_mgr_enable(&dispc, OMAP_DSS_CHANNEL_LCD, false); |
4477 | 4495 | ||
4478 | /* Busy wait for framedone. We can't fiddle with irq handlers | 4496 | /* Busy wait for framedone. We can't fiddle with irq handlers |
4479 | * in PM resume. Typically the loop runs less than 5 times and | 4497 | * in PM resume. Typically the loop runs less than 5 times and |
4480 | * waits less than a micro second. | 4498 | * waits less than a micro second. |
4481 | */ | 4499 | */ |
4482 | count = 0; | 4500 | count = 0; |
4483 | while (!(dispc_read_irqstatus() & framedone_irq)) { | 4501 | while (!(dispc_read_irqstatus(&dispc) & framedone_irq)) { |
4484 | if (count++ > 10000) { | 4502 | if (count++ > 10000) { |
4485 | dev_err(&dispc.pdev->dev, "%s: framedone timeout\n", | 4503 | dev_err(&dispc.pdev->dev, "%s: framedone timeout\n", |
4486 | __func__); | 4504 | __func__); |
4487 | break; | 4505 | break; |
4488 | } | 4506 | } |
4489 | } | 4507 | } |
4490 | dispc_ovl_enable(OMAP_DSS_GFX, false); | 4508 | dispc_ovl_enable(&dispc, OMAP_DSS_GFX, false); |
4491 | 4509 | ||
4492 | /* Clear all irq bits before continuing */ | 4510 | /* Clear all irq bits before continuing */ |
4493 | dispc_clear_irqstatus(0xffffffff); | 4511 | dispc_clear_irqstatus(&dispc, 0xffffffff); |
4494 | 4512 | ||
4495 | /* Restore the original state to LCD1 output gates */ | 4513 | /* Restore the original state to LCD1 output gates */ |
4496 | REG_FLD_MOD(DISPC_CONFIG, gatestate, 8, 4); | 4514 | REG_FLD_MOD(DISPC_CONFIG, gatestate, 8, 4); |
@@ -4610,7 +4628,7 @@ static int dispc_bind(struct device *dev, struct device *master, void *data) | |||
4610 | 4628 | ||
4611 | pm_runtime_enable(&pdev->dev); | 4629 | pm_runtime_enable(&pdev->dev); |
4612 | 4630 | ||
4613 | r = dispc_runtime_get(); | 4631 | r = dispc_runtime_get(&dispc); |
4614 | if (r) | 4632 | if (r) |
4615 | goto err_runtime_get; | 4633 | goto err_runtime_get; |
4616 | 4634 | ||
@@ -4620,8 +4638,9 @@ static int dispc_bind(struct device *dev, struct device *master, void *data) | |||
4620 | dev_dbg(&pdev->dev, "OMAP DISPC rev %d.%d\n", | 4638 | dev_dbg(&pdev->dev, "OMAP DISPC rev %d.%d\n", |
4621 | FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); | 4639 | FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); |
4622 | 4640 | ||
4623 | dispc_runtime_put(); | 4641 | dispc_runtime_put(&dispc); |
4624 | 4642 | ||
4643 | dss->dispc = &dispc; | ||
4625 | dss->dispc_ops = &dispc_ops; | 4644 | dss->dispc_ops = &dispc_ops; |
4626 | 4645 | ||
4627 | dispc.debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs, | 4646 | dispc.debugfs = dss_debugfs_create_file(dss, "dispc", dispc_dump_regs, |
@@ -4634,13 +4653,13 @@ err_runtime_get: | |||
4634 | return r; | 4653 | return r; |
4635 | } | 4654 | } |
4636 | 4655 | ||
4637 | static void dispc_unbind(struct device *dev, struct device *master, | 4656 | static void dispc_unbind(struct device *dev, struct device *master, void *data) |
4638 | void *data) | ||
4639 | { | 4657 | { |
4640 | struct dss_device *dss = dispc.dss; | 4658 | struct dss_device *dss = dispc.dss; |
4641 | 4659 | ||
4642 | dss_debugfs_remove_file(dispc.debugfs); | 4660 | dss_debugfs_remove_file(dispc.debugfs); |
4643 | 4661 | ||
4662 | dss->dispc = NULL; | ||
4644 | dss->dispc_ops = NULL; | 4663 | dss->dispc_ops = NULL; |
4645 | 4664 | ||
4646 | pm_runtime_disable(dev); | 4665 | pm_runtime_disable(dev); |
diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c index e818e7836cbb..d524094b8394 100644 --- a/drivers/gpu/drm/omapdrm/dss/dpi.c +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c | |||
@@ -406,7 +406,7 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) | |||
406 | goto err_reg_enable; | 406 | goto err_reg_enable; |
407 | } | 407 | } |
408 | 408 | ||
409 | r = dispc_runtime_get(); | 409 | r = dispc_runtime_get(dpi->dss->dispc); |
410 | if (r) | 410 | if (r) |
411 | goto err_get_dispc; | 411 | goto err_get_dispc; |
412 | 412 | ||
@@ -442,7 +442,7 @@ err_set_mode: | |||
442 | dss_pll_disable(dpi->pll); | 442 | dss_pll_disable(dpi->pll); |
443 | err_pll_init: | 443 | err_pll_init: |
444 | err_src_sel: | 444 | err_src_sel: |
445 | dispc_runtime_put(); | 445 | dispc_runtime_put(dpi->dss->dispc); |
446 | err_get_dispc: | 446 | err_get_dispc: |
447 | if (dpi->vdds_dsi_reg) | 447 | if (dpi->vdds_dsi_reg) |
448 | regulator_disable(dpi->vdds_dsi_reg); | 448 | regulator_disable(dpi->vdds_dsi_reg); |
@@ -466,7 +466,7 @@ static void dpi_display_disable(struct omap_dss_device *dssdev) | |||
466 | dss_pll_disable(dpi->pll); | 466 | dss_pll_disable(dpi->pll); |
467 | } | 467 | } |
468 | 468 | ||
469 | dispc_runtime_put(); | 469 | dispc_runtime_put(dpi->dss->dispc); |
470 | 470 | ||
471 | if (dpi->vdds_dsi_reg) | 471 | if (dpi->vdds_dsi_reg) |
472 | regulator_disable(dpi->vdds_dsi_reg); | 472 | regulator_disable(dpi->vdds_dsi_reg); |
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c index 66c4d973e7eb..c07326a46c01 100644 --- a/drivers/gpu/drm/omapdrm/dss/dsi.c +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c | |||
@@ -5523,7 +5523,7 @@ static int dsi_runtime_suspend(struct device *dev) | |||
5523 | /* wait for current handler to finish before turning the DSI off */ | 5523 | /* wait for current handler to finish before turning the DSI off */ |
5524 | synchronize_irq(dsi->irq); | 5524 | synchronize_irq(dsi->irq); |
5525 | 5525 | ||
5526 | dispc_runtime_put(); | 5526 | dispc_runtime_put(dsi->dss->dispc); |
5527 | 5527 | ||
5528 | return 0; | 5528 | return 0; |
5529 | } | 5529 | } |
@@ -5533,7 +5533,7 @@ static int dsi_runtime_resume(struct device *dev) | |||
5533 | struct dsi_data *dsi = dev_get_drvdata(dev); | 5533 | struct dsi_data *dsi = dev_get_drvdata(dev); |
5534 | int r; | 5534 | int r; |
5535 | 5535 | ||
5536 | r = dispc_runtime_get(); | 5536 | r = dispc_runtime_get(dsi->dss->dispc); |
5537 | if (r) | 5537 | if (r) |
5538 | return r; | 5538 | return r; |
5539 | 5539 | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index 348378f1b5a5..f3acfd62031c 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include "omapdss.h" | 26 | #include "omapdss.h" |
27 | 27 | ||
28 | struct dispc_device; | ||
28 | struct dss_debugfs_entry; | 29 | struct dss_debugfs_entry; |
29 | struct platform_device; | 30 | struct platform_device; |
30 | struct seq_file; | 31 | struct seq_file; |
@@ -272,6 +273,7 @@ struct dss_device { | |||
272 | struct dss_pll *video1_pll; | 273 | struct dss_pll *video1_pll; |
273 | struct dss_pll *video2_pll; | 274 | struct dss_pll *video2_pll; |
274 | 275 | ||
276 | struct dispc_device *dispc; | ||
275 | const struct dispc_ops *dispc_ops; | 277 | const struct dispc_ops *dispc_ops; |
276 | }; | 278 | }; |
277 | 279 | ||
@@ -407,8 +409,8 @@ static inline void dpi_uninit_port(struct device_node *port) | |||
407 | /* DISPC */ | 409 | /* DISPC */ |
408 | void dispc_dump_clocks(struct seq_file *s); | 410 | void dispc_dump_clocks(struct seq_file *s); |
409 | 411 | ||
410 | int dispc_runtime_get(void); | 412 | int dispc_runtime_get(struct dispc_device *dispc); |
411 | void dispc_runtime_put(void); | 413 | void dispc_runtime_put(struct dispc_device *dispc); |
412 | 414 | ||
413 | void dispc_enable_sidle(void); | 415 | void dispc_enable_sidle(void); |
414 | void dispc_disable_sidle(void); | 416 | void dispc_disable_sidle(void); |
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index 096542fb75d2..5c55fa3f593a 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c | |||
@@ -819,16 +819,19 @@ static int hdmi4_remove(struct platform_device *pdev) | |||
819 | 819 | ||
820 | static int hdmi_runtime_suspend(struct device *dev) | 820 | static int hdmi_runtime_suspend(struct device *dev) |
821 | { | 821 | { |
822 | dispc_runtime_put(); | 822 | struct omap_hdmi *hdmi = dev_get_drvdata(dev); |
823 | |||
824 | dispc_runtime_put(hdmi->dss->dispc); | ||
823 | 825 | ||
824 | return 0; | 826 | return 0; |
825 | } | 827 | } |
826 | 828 | ||
827 | static int hdmi_runtime_resume(struct device *dev) | 829 | static int hdmi_runtime_resume(struct device *dev) |
828 | { | 830 | { |
831 | struct omap_hdmi *hdmi = dev_get_drvdata(dev); | ||
829 | int r; | 832 | int r; |
830 | 833 | ||
831 | r = dispc_runtime_get(); | 834 | r = dispc_runtime_get(hdmi->dss->dispc); |
832 | if (r < 0) | 835 | if (r < 0) |
833 | return r; | 836 | return r; |
834 | 837 | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index 597baebd959c..e896f63480f1 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c | |||
@@ -814,16 +814,19 @@ static int hdmi5_remove(struct platform_device *pdev) | |||
814 | 814 | ||
815 | static int hdmi_runtime_suspend(struct device *dev) | 815 | static int hdmi_runtime_suspend(struct device *dev) |
816 | { | 816 | { |
817 | dispc_runtime_put(); | 817 | struct omap_hdmi *hdmi = dev_get_drvdata(dev); |
818 | |||
819 | dispc_runtime_put(hdmi->dss->dispc); | ||
818 | 820 | ||
819 | return 0; | 821 | return 0; |
820 | } | 822 | } |
821 | 823 | ||
822 | static int hdmi_runtime_resume(struct device *dev) | 824 | static int hdmi_runtime_resume(struct device *dev) |
823 | { | 825 | { |
826 | struct omap_hdmi *hdmi = dev_get_drvdata(dev); | ||
824 | int r; | 827 | int r; |
825 | 828 | ||
826 | r = dispc_runtime_get(); | 829 | r = dispc_runtime_get(hdmi->dss->dispc); |
827 | if (r < 0) | 830 | if (r < 0) |
828 | return r; | 831 | return r; |
829 | 832 | ||
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 4bf7843b4aec..a4f71e082c1c 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h | |||
@@ -62,6 +62,8 @@ | |||
62 | struct dss_device; | 62 | struct dss_device; |
63 | struct omap_drm_private; | 63 | struct omap_drm_private; |
64 | struct omap_dss_device; | 64 | struct omap_dss_device; |
65 | struct dispc_device; | ||
66 | struct dss_device; | ||
65 | struct dss_lcd_mgr_config; | 67 | struct dss_lcd_mgr_config; |
66 | struct snd_aes_iec958; | 68 | struct snd_aes_iec958; |
67 | struct snd_cea_861_aud_if; | 69 | struct snd_cea_861_aud_if; |
@@ -690,49 +692,64 @@ void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev, | |||
690 | /* dispc ops */ | 692 | /* dispc ops */ |
691 | 693 | ||
692 | struct dispc_ops { | 694 | struct dispc_ops { |
693 | u32 (*read_irqstatus)(void); | 695 | u32 (*read_irqstatus)(struct dispc_device *dispc); |
694 | void (*clear_irqstatus)(u32 mask); | 696 | void (*clear_irqstatus)(struct dispc_device *dispc, u32 mask); |
695 | void (*write_irqenable)(u32 mask); | 697 | void (*write_irqenable)(struct dispc_device *dispc, u32 mask); |
696 | 698 | ||
697 | int (*request_irq)(irq_handler_t handler, void *dev_id); | 699 | int (*request_irq)(struct dispc_device *dispc, irq_handler_t handler, |
698 | void (*free_irq)(void *dev_id); | 700 | void *dev_id); |
699 | 701 | void (*free_irq)(struct dispc_device *dispc, void *dev_id); | |
700 | int (*runtime_get)(void); | 702 | |
701 | void (*runtime_put)(void); | 703 | int (*runtime_get)(struct dispc_device *dispc); |
702 | 704 | void (*runtime_put)(struct dispc_device *dispc); | |
703 | int (*get_num_ovls)(void); | 705 | |
704 | int (*get_num_mgrs)(void); | 706 | int (*get_num_ovls)(struct dispc_device *dispc); |
705 | 707 | int (*get_num_mgrs)(struct dispc_device *dispc); | |
706 | u32 (*get_memory_bandwidth_limit)(void); | 708 | |
707 | 709 | u32 (*get_memory_bandwidth_limit)(struct dispc_device *dispc); | |
708 | void (*mgr_enable)(enum omap_channel channel, bool enable); | 710 | |
709 | bool (*mgr_is_enabled)(enum omap_channel channel); | 711 | void (*mgr_enable)(struct dispc_device *dispc, |
710 | u32 (*mgr_get_vsync_irq)(enum omap_channel channel); | 712 | enum omap_channel channel, bool enable); |
711 | u32 (*mgr_get_framedone_irq)(enum omap_channel channel); | 713 | bool (*mgr_is_enabled)(struct dispc_device *dispc, |
712 | u32 (*mgr_get_sync_lost_irq)(enum omap_channel channel); | 714 | enum omap_channel channel); |
713 | bool (*mgr_go_busy)(enum omap_channel channel); | 715 | u32 (*mgr_get_vsync_irq)(struct dispc_device *dispc, |
714 | void (*mgr_go)(enum omap_channel channel); | 716 | enum omap_channel channel); |
715 | void (*mgr_set_lcd_config)(enum omap_channel channel, | 717 | u32 (*mgr_get_framedone_irq)(struct dispc_device *dispc, |
716 | const struct dss_lcd_mgr_config *config); | 718 | enum omap_channel channel); |
717 | void (*mgr_set_timings)(enum omap_channel channel, | 719 | u32 (*mgr_get_sync_lost_irq)(struct dispc_device *dispc, |
718 | const struct videomode *vm); | 720 | enum omap_channel channel); |
719 | void (*mgr_setup)(enum omap_channel channel, | 721 | bool (*mgr_go_busy)(struct dispc_device *dispc, |
720 | const struct omap_overlay_manager_info *info); | 722 | enum omap_channel channel); |
721 | enum omap_dss_output_id (*mgr_get_supported_outputs)(enum omap_channel channel); | 723 | void (*mgr_go)(struct dispc_device *dispc, enum omap_channel channel); |
722 | u32 (*mgr_gamma_size)(enum omap_channel channel); | 724 | void (*mgr_set_lcd_config)(struct dispc_device *dispc, |
723 | void (*mgr_set_gamma)(enum omap_channel channel, | 725 | enum omap_channel channel, |
724 | const struct drm_color_lut *lut, | 726 | const struct dss_lcd_mgr_config *config); |
725 | unsigned int length); | 727 | void (*mgr_set_timings)(struct dispc_device *dispc, |
726 | 728 | enum omap_channel channel, | |
727 | int (*ovl_enable)(enum omap_plane_id plane, bool enable); | 729 | const struct videomode *vm); |
728 | int (*ovl_setup)(enum omap_plane_id plane, | 730 | void (*mgr_setup)(struct dispc_device *dispc, enum omap_channel channel, |
731 | const struct omap_overlay_manager_info *info); | ||
732 | enum omap_dss_output_id (*mgr_get_supported_outputs)( | ||
733 | struct dispc_device *dispc, enum omap_channel channel); | ||
734 | u32 (*mgr_gamma_size)(struct dispc_device *dispc, | ||
735 | enum omap_channel channel); | ||
736 | void (*mgr_set_gamma)(struct dispc_device *dispc, | ||
737 | enum omap_channel channel, | ||
738 | const struct drm_color_lut *lut, | ||
739 | unsigned int length); | ||
740 | |||
741 | int (*ovl_enable)(struct dispc_device *dispc, enum omap_plane_id plane, | ||
742 | bool enable); | ||
743 | int (*ovl_setup)(struct dispc_device *dispc, enum omap_plane_id plane, | ||
729 | const struct omap_overlay_info *oi, | 744 | const struct omap_overlay_info *oi, |
730 | const struct videomode *vm, bool mem_to_mem, | 745 | const struct videomode *vm, bool mem_to_mem, |
731 | enum omap_channel channel); | 746 | enum omap_channel channel); |
732 | 747 | ||
733 | const u32 *(*ovl_get_color_modes)(enum omap_plane_id plane); | 748 | const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc, |
749 | enum omap_plane_id plane); | ||
734 | }; | 750 | }; |
735 | 751 | ||
752 | struct dispc_device *dispc_get_dispc(struct dss_device *dss); | ||
736 | const struct dispc_ops *dispc_get_ops(struct dss_device *dss); | 753 | const struct dispc_ops *dispc_get_ops(struct dss_device *dss); |
737 | 754 | ||
738 | bool omapdss_component_is_display(struct device_node *node); | 755 | bool omapdss_component_is_display(struct device_node *node); |
diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c index bf225ae69b06..b1d0e706a1ec 100644 --- a/drivers/gpu/drm/omapdrm/dss/sdi.c +++ b/drivers/gpu/drm/omapdrm/dss/sdi.c | |||
@@ -141,7 +141,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) | |||
141 | if (r) | 141 | if (r) |
142 | goto err_reg_enable; | 142 | goto err_reg_enable; |
143 | 143 | ||
144 | r = dispc_runtime_get(); | 144 | r = dispc_runtime_get(sdi.dss->dispc); |
145 | if (r) | 145 | if (r) |
146 | goto err_get_dispc; | 146 | goto err_get_dispc; |
147 | 147 | ||
@@ -203,7 +203,7 @@ err_mgr_enable: | |||
203 | err_sdi_enable: | 203 | err_sdi_enable: |
204 | err_set_dss_clock_div: | 204 | err_set_dss_clock_div: |
205 | err_calc_clock_div: | 205 | err_calc_clock_div: |
206 | dispc_runtime_put(); | 206 | dispc_runtime_put(sdi.dss->dispc); |
207 | err_get_dispc: | 207 | err_get_dispc: |
208 | regulator_disable(sdi.vdds_sdi_reg); | 208 | regulator_disable(sdi.vdds_sdi_reg); |
209 | err_reg_enable: | 209 | err_reg_enable: |
@@ -216,7 +216,7 @@ static void sdi_display_disable(struct omap_dss_device *dssdev) | |||
216 | 216 | ||
217 | dss_sdi_disable(sdi.dss); | 217 | dss_sdi_disable(sdi.dss); |
218 | 218 | ||
219 | dispc_runtime_put(); | 219 | dispc_runtime_put(sdi.dss->dispc); |
220 | 220 | ||
221 | regulator_disable(sdi.vdds_sdi_reg); | 221 | regulator_disable(sdi.vdds_sdi_reg); |
222 | } | 222 | } |
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c index bed3b54b70b2..546271389189 100644 --- a/drivers/gpu/drm/omapdrm/dss/venc.c +++ b/drivers/gpu/drm/omapdrm/dss/venc.c | |||
@@ -956,7 +956,7 @@ static int venc_runtime_suspend(struct device *dev) | |||
956 | if (venc.tv_dac_clk) | 956 | if (venc.tv_dac_clk) |
957 | clk_disable_unprepare(venc.tv_dac_clk); | 957 | clk_disable_unprepare(venc.tv_dac_clk); |
958 | 958 | ||
959 | dispc_runtime_put(); | 959 | dispc_runtime_put(venc.dss->dispc); |
960 | 960 | ||
961 | return 0; | 961 | return 0; |
962 | } | 962 | } |
@@ -965,7 +965,7 @@ static int venc_runtime_resume(struct device *dev) | |||
965 | { | 965 | { |
966 | int r; | 966 | int r; |
967 | 967 | ||
968 | r = dispc_runtime_get(); | 968 | r = dispc_runtime_get(venc.dss->dispc); |
969 | if (r < 0) | 969 | if (r < 0) |
970 | return r; | 970 | return r; |
971 | 971 | ||
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index ffe4f698d291..6c4d40b824e4 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c | |||
@@ -117,10 +117,13 @@ static int omap_crtc_dss_connect(struct omap_drm_private *priv, | |||
117 | enum omap_channel channel, | 117 | enum omap_channel channel, |
118 | struct omap_dss_device *dst) | 118 | struct omap_dss_device *dst) |
119 | { | 119 | { |
120 | const struct dispc_ops *dispc_ops = priv->dispc_ops; | ||
121 | struct dispc_device *dispc = priv->dispc; | ||
122 | |||
120 | if (omap_crtc_output[channel]) | 123 | if (omap_crtc_output[channel]) |
121 | return -EINVAL; | 124 | return -EINVAL; |
122 | 125 | ||
123 | if (!(priv->dispc_ops->mgr_get_supported_outputs(channel) & dst->id)) | 126 | if (!(dispc_ops->mgr_get_supported_outputs(dispc, channel) & dst->id)) |
124 | return -EINVAL; | 127 | return -EINVAL; |
125 | 128 | ||
126 | omap_crtc_output[channel] = dst; | 129 | omap_crtc_output[channel] = dst; |
@@ -157,7 +160,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) | |||
157 | return; | 160 | return; |
158 | 161 | ||
159 | if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) { | 162 | if (omap_crtc_output[channel]->output_type == OMAP_DISPLAY_TYPE_HDMI) { |
160 | priv->dispc_ops->mgr_enable(channel, enable); | 163 | priv->dispc_ops->mgr_enable(priv->dispc, channel, enable); |
161 | omap_crtc->enabled = enable; | 164 | omap_crtc->enabled = enable; |
162 | return; | 165 | return; |
163 | } | 166 | } |
@@ -170,8 +173,9 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) | |||
170 | omap_crtc->ignore_digit_sync_lost = true; | 173 | omap_crtc->ignore_digit_sync_lost = true; |
171 | } | 174 | } |
172 | 175 | ||
173 | framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(channel); | 176 | framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(priv->dispc, |
174 | vsync_irq = priv->dispc_ops->mgr_get_vsync_irq(channel); | 177 | channel); |
178 | vsync_irq = priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel); | ||
175 | 179 | ||
176 | if (enable) { | 180 | if (enable) { |
177 | wait = omap_irq_wait_init(dev, vsync_irq, 1); | 181 | wait = omap_irq_wait_init(dev, vsync_irq, 1); |
@@ -191,7 +195,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) | |||
191 | wait = omap_irq_wait_init(dev, vsync_irq, 2); | 195 | wait = omap_irq_wait_init(dev, vsync_irq, 2); |
192 | } | 196 | } |
193 | 197 | ||
194 | priv->dispc_ops->mgr_enable(channel, enable); | 198 | priv->dispc_ops->mgr_enable(priv->dispc, channel, enable); |
195 | omap_crtc->enabled = enable; | 199 | omap_crtc->enabled = enable; |
196 | 200 | ||
197 | ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); | 201 | ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); |
@@ -213,7 +217,8 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv, | |||
213 | { | 217 | { |
214 | struct omap_crtc *omap_crtc = omap_crtcs[channel]; | 218 | struct omap_crtc *omap_crtc = omap_crtcs[channel]; |
215 | 219 | ||
216 | priv->dispc_ops->mgr_set_timings(omap_crtc->channel, &omap_crtc->vm); | 220 | priv->dispc_ops->mgr_set_timings(priv->dispc, omap_crtc->channel, |
221 | &omap_crtc->vm); | ||
217 | omap_crtc_set_enabled(&omap_crtc->base, true); | 222 | omap_crtc_set_enabled(&omap_crtc->base, true); |
218 | 223 | ||
219 | return 0; | 224 | return 0; |
@@ -243,7 +248,8 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv, | |||
243 | struct omap_crtc *omap_crtc = omap_crtcs[channel]; | 248 | struct omap_crtc *omap_crtc = omap_crtcs[channel]; |
244 | 249 | ||
245 | DBG("%s", omap_crtc->name); | 250 | DBG("%s", omap_crtc->name); |
246 | priv->dispc_ops->mgr_set_lcd_config(omap_crtc->channel, config); | 251 | priv->dispc_ops->mgr_set_lcd_config(priv->dispc, omap_crtc->channel, |
252 | config); | ||
247 | } | 253 | } |
248 | 254 | ||
249 | static int omap_crtc_dss_register_framedone( | 255 | static int omap_crtc_dss_register_framedone( |
@@ -300,7 +306,7 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc) | |||
300 | * If the dispc is busy we're racing the flush operation. Try again on | 306 | * If the dispc is busy we're racing the flush operation. Try again on |
301 | * the next vblank interrupt. | 307 | * the next vblank interrupt. |
302 | */ | 308 | */ |
303 | if (priv->dispc_ops->mgr_go_busy(omap_crtc->channel)) { | 309 | if (priv->dispc_ops->mgr_go_busy(priv->dispc, omap_crtc->channel)) { |
304 | spin_unlock(&crtc->dev->event_lock); | 310 | spin_unlock(&crtc->dev->event_lock); |
305 | return; | 311 | return; |
306 | } | 312 | } |
@@ -337,7 +343,7 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) | |||
337 | info.partial_alpha_enabled = false; | 343 | info.partial_alpha_enabled = false; |
338 | info.cpr_enable = false; | 344 | info.cpr_enable = false; |
339 | 345 | ||
340 | priv->dispc_ops->mgr_setup(omap_crtc->channel, &info); | 346 | priv->dispc_ops->mgr_setup(priv->dispc, omap_crtc->channel, &info); |
341 | } | 347 | } |
342 | 348 | ||
343 | /* ----------------------------------------------------------------------------- | 349 | /* ----------------------------------------------------------------------------- |
@@ -537,7 +543,8 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, | |||
537 | length = crtc->state->gamma_lut->length / | 543 | length = crtc->state->gamma_lut->length / |
538 | sizeof(*lut); | 544 | sizeof(*lut); |
539 | } | 545 | } |
540 | priv->dispc_ops->mgr_set_gamma(omap_crtc->channel, lut, length); | 546 | priv->dispc_ops->mgr_set_gamma(priv->dispc, omap_crtc->channel, |
547 | lut, length); | ||
541 | } | 548 | } |
542 | 549 | ||
543 | omap_crtc_write_crtc_properties(crtc); | 550 | omap_crtc_write_crtc_properties(crtc); |
@@ -552,7 +559,7 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, | |||
552 | WARN_ON(ret != 0); | 559 | WARN_ON(ret != 0); |
553 | 560 | ||
554 | spin_lock_irq(&crtc->dev->event_lock); | 561 | spin_lock_irq(&crtc->dev->event_lock); |
555 | priv->dispc_ops->mgr_go(omap_crtc->channel); | 562 | priv->dispc_ops->mgr_go(priv->dispc, omap_crtc->channel); |
556 | omap_crtc_arm_event(crtc); | 563 | omap_crtc_arm_event(crtc); |
557 | spin_unlock_irq(&crtc->dev->event_lock); | 564 | spin_unlock_irq(&crtc->dev->event_lock); |
558 | } | 565 | } |
@@ -734,7 +741,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, | |||
734 | * extracted with dispc_mgr_gamma_size(). If it returns 0 | 741 | * extracted with dispc_mgr_gamma_size(). If it returns 0 |
735 | * gamma table is not supprted. | 742 | * gamma table is not supprted. |
736 | */ | 743 | */ |
737 | if (priv->dispc_ops->mgr_gamma_size(channel)) { | 744 | if (priv->dispc_ops->mgr_gamma_size(priv->dispc, channel)) { |
738 | unsigned int gamma_lut_size = 256; | 745 | unsigned int gamma_lut_size = 256; |
739 | 746 | ||
740 | drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size); | 747 | drm_crtc_enable_color_mgmt(crtc, 0, false, gamma_lut_size); |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index a93916cd0258..65a567dcf3ab 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c | |||
@@ -69,7 +69,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state) | |||
69 | struct drm_device *dev = old_state->dev; | 69 | struct drm_device *dev = old_state->dev; |
70 | struct omap_drm_private *priv = dev->dev_private; | 70 | struct omap_drm_private *priv = dev->dev_private; |
71 | 71 | ||
72 | priv->dispc_ops->runtime_get(); | 72 | priv->dispc_ops->runtime_get(priv->dispc); |
73 | 73 | ||
74 | /* Apply the atomic update. */ | 74 | /* Apply the atomic update. */ |
75 | drm_atomic_helper_commit_modeset_disables(dev, old_state); | 75 | drm_atomic_helper_commit_modeset_disables(dev, old_state); |
@@ -113,7 +113,7 @@ static void omap_atomic_commit_tail(struct drm_atomic_state *old_state) | |||
113 | 113 | ||
114 | drm_atomic_helper_cleanup_planes(dev, old_state); | 114 | drm_atomic_helper_cleanup_planes(dev, old_state); |
115 | 115 | ||
116 | priv->dispc_ops->runtime_put(); | 116 | priv->dispc_ops->runtime_put(priv->dispc); |
117 | } | 117 | } |
118 | 118 | ||
119 | static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = { | 119 | static const struct drm_mode_config_helper_funcs omap_mode_config_helper_funcs = { |
@@ -191,7 +191,7 @@ cleanup: | |||
191 | static int omap_modeset_init_properties(struct drm_device *dev) | 191 | static int omap_modeset_init_properties(struct drm_device *dev) |
192 | { | 192 | { |
193 | struct omap_drm_private *priv = dev->dev_private; | 193 | struct omap_drm_private *priv = dev->dev_private; |
194 | unsigned int num_planes = priv->dispc_ops->get_num_ovls(); | 194 | unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc); |
195 | 195 | ||
196 | priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, | 196 | priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, |
197 | num_planes - 1); | 197 | num_planes - 1); |
@@ -205,8 +205,8 @@ static int omap_modeset_init(struct drm_device *dev) | |||
205 | { | 205 | { |
206 | struct omap_drm_private *priv = dev->dev_private; | 206 | struct omap_drm_private *priv = dev->dev_private; |
207 | struct omap_dss_device *dssdev = NULL; | 207 | struct omap_dss_device *dssdev = NULL; |
208 | int num_ovls = priv->dispc_ops->get_num_ovls(); | 208 | int num_ovls = priv->dispc_ops->get_num_ovls(priv->dispc); |
209 | int num_mgrs = priv->dispc_ops->get_num_mgrs(); | 209 | int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc); |
210 | int num_crtcs, crtc_idx, plane_idx; | 210 | int num_crtcs, crtc_idx, plane_idx; |
211 | int ret; | 211 | int ret; |
212 | u32 plane_crtc_mask; | 212 | u32 plane_crtc_mask; |
@@ -521,6 +521,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) | |||
521 | 521 | ||
522 | priv->dev = dev; | 522 | priv->dev = dev; |
523 | priv->dss = omapdss_get_dss(); | 523 | priv->dss = omapdss_get_dss(); |
524 | priv->dispc = dispc_get_dispc(priv->dss); | ||
524 | priv->dispc_ops = dispc_get_ops(priv->dss); | 525 | priv->dispc_ops = dispc_get_ops(priv->dss); |
525 | 526 | ||
526 | omap_crtc_pre_init(priv); | 527 | omap_crtc_pre_init(priv); |
@@ -549,7 +550,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) | |||
549 | /* Get memory bandwidth limits */ | 550 | /* Get memory bandwidth limits */ |
550 | if (priv->dispc_ops->get_memory_bandwidth_limit) | 551 | if (priv->dispc_ops->get_memory_bandwidth_limit) |
551 | priv->max_bandwidth = | 552 | priv->max_bandwidth = |
552 | priv->dispc_ops->get_memory_bandwidth_limit(); | 553 | priv->dispc_ops->get_memory_bandwidth_limit(priv->dispc); |
553 | 554 | ||
554 | omap_gem_init(ddev); | 555 | omap_gem_init(ddev); |
555 | 556 | ||
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index a7962c14fc7c..6eaee4df4559 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h | |||
@@ -51,6 +51,7 @@ struct omap_drm_private { | |||
51 | u32 omaprev; | 51 | u32 omaprev; |
52 | 52 | ||
53 | struct dss_device *dss; | 53 | struct dss_device *dss; |
54 | struct dispc_device *dispc; | ||
54 | const struct dispc_ops *dispc_ops; | 55 | const struct dispc_ops *dispc_ops; |
55 | 56 | ||
56 | unsigned int num_crtcs; | 57 | unsigned int num_crtcs; |
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c index 976dc0e44482..c85115049f86 100644 --- a/drivers/gpu/drm/omapdrm/omap_irq.c +++ b/drivers/gpu/drm/omapdrm/omap_irq.c | |||
@@ -38,7 +38,7 @@ static void omap_irq_update(struct drm_device *dev) | |||
38 | 38 | ||
39 | DBG("irqmask=%08x", irqmask); | 39 | DBG("irqmask=%08x", irqmask); |
40 | 40 | ||
41 | priv->dispc_ops->write_irqenable(irqmask); | 41 | priv->dispc_ops->write_irqenable(priv->dispc, irqmask); |
42 | } | 42 | } |
43 | 43 | ||
44 | static void omap_irq_wait_handler(struct omap_irq_wait *wait) | 44 | static void omap_irq_wait_handler(struct omap_irq_wait *wait) |
@@ -108,7 +108,8 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc) | |||
108 | DBG("dev=%p, crtc=%u", dev, channel); | 108 | DBG("dev=%p, crtc=%u", dev, channel); |
109 | 109 | ||
110 | spin_lock_irqsave(&priv->wait_lock, flags); | 110 | spin_lock_irqsave(&priv->wait_lock, flags); |
111 | priv->irq_mask |= priv->dispc_ops->mgr_get_vsync_irq(channel); | 111 | priv->irq_mask |= priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, |
112 | channel); | ||
112 | omap_irq_update(dev); | 113 | omap_irq_update(dev); |
113 | spin_unlock_irqrestore(&priv->wait_lock, flags); | 114 | spin_unlock_irqrestore(&priv->wait_lock, flags); |
114 | 115 | ||
@@ -134,7 +135,8 @@ void omap_irq_disable_vblank(struct drm_crtc *crtc) | |||
134 | DBG("dev=%p, crtc=%u", dev, channel); | 135 | DBG("dev=%p, crtc=%u", dev, channel); |
135 | 136 | ||
136 | spin_lock_irqsave(&priv->wait_lock, flags); | 137 | spin_lock_irqsave(&priv->wait_lock, flags); |
137 | priv->irq_mask &= ~priv->dispc_ops->mgr_get_vsync_irq(channel); | 138 | priv->irq_mask &= ~priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, |
139 | channel); | ||
138 | omap_irq_update(dev); | 140 | omap_irq_update(dev); |
139 | spin_unlock_irqrestore(&priv->wait_lock, flags); | 141 | spin_unlock_irqrestore(&priv->wait_lock, flags); |
140 | } | 142 | } |
@@ -198,9 +200,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg) | |||
198 | unsigned int id; | 200 | unsigned int id; |
199 | u32 irqstatus; | 201 | u32 irqstatus; |
200 | 202 | ||
201 | irqstatus = priv->dispc_ops->read_irqstatus(); | 203 | irqstatus = priv->dispc_ops->read_irqstatus(priv->dispc); |
202 | priv->dispc_ops->clear_irqstatus(irqstatus); | 204 | priv->dispc_ops->clear_irqstatus(priv->dispc, irqstatus); |
203 | priv->dispc_ops->read_irqstatus(); /* flush posted write */ | 205 | priv->dispc_ops->read_irqstatus(priv->dispc); /* flush posted write */ |
204 | 206 | ||
205 | VERB("irqs: %08x", irqstatus); | 207 | VERB("irqs: %08x", irqstatus); |
206 | 208 | ||
@@ -208,12 +210,12 @@ static irqreturn_t omap_irq_handler(int irq, void *arg) | |||
208 | struct drm_crtc *crtc = priv->crtcs[id]; | 210 | struct drm_crtc *crtc = priv->crtcs[id]; |
209 | enum omap_channel channel = omap_crtc_channel(crtc); | 211 | enum omap_channel channel = omap_crtc_channel(crtc); |
210 | 212 | ||
211 | if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(channel)) { | 213 | if (irqstatus & priv->dispc_ops->mgr_get_vsync_irq(priv->dispc, channel)) { |
212 | drm_handle_vblank(dev, id); | 214 | drm_handle_vblank(dev, id); |
213 | omap_crtc_vblank_irq(crtc); | 215 | omap_crtc_vblank_irq(crtc); |
214 | } | 216 | } |
215 | 217 | ||
216 | if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(channel)) | 218 | if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, channel)) |
217 | omap_crtc_error_irq(crtc, irqstatus); | 219 | omap_crtc_error_irq(crtc, irqstatus); |
218 | } | 220 | } |
219 | 221 | ||
@@ -247,7 +249,7 @@ static const u32 omap_underflow_irqs[] = { | |||
247 | int omap_drm_irq_install(struct drm_device *dev) | 249 | int omap_drm_irq_install(struct drm_device *dev) |
248 | { | 250 | { |
249 | struct omap_drm_private *priv = dev->dev_private; | 251 | struct omap_drm_private *priv = dev->dev_private; |
250 | unsigned int num_mgrs = priv->dispc_ops->get_num_mgrs(); | 252 | unsigned int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc); |
251 | unsigned int max_planes; | 253 | unsigned int max_planes; |
252 | unsigned int i; | 254 | unsigned int i; |
253 | int ret; | 255 | int ret; |
@@ -265,13 +267,13 @@ int omap_drm_irq_install(struct drm_device *dev) | |||
265 | } | 267 | } |
266 | 268 | ||
267 | for (i = 0; i < num_mgrs; ++i) | 269 | for (i = 0; i < num_mgrs; ++i) |
268 | priv->irq_mask |= priv->dispc_ops->mgr_get_sync_lost_irq(i); | 270 | priv->irq_mask |= priv->dispc_ops->mgr_get_sync_lost_irq(priv->dispc, i); |
269 | 271 | ||
270 | priv->dispc_ops->runtime_get(); | 272 | priv->dispc_ops->runtime_get(priv->dispc); |
271 | priv->dispc_ops->clear_irqstatus(0xffffffff); | 273 | priv->dispc_ops->clear_irqstatus(priv->dispc, 0xffffffff); |
272 | priv->dispc_ops->runtime_put(); | 274 | priv->dispc_ops->runtime_put(priv->dispc); |
273 | 275 | ||
274 | ret = priv->dispc_ops->request_irq(omap_irq_handler, dev); | 276 | ret = priv->dispc_ops->request_irq(priv->dispc, omap_irq_handler, dev); |
275 | if (ret < 0) | 277 | if (ret < 0) |
276 | return ret; | 278 | return ret; |
277 | 279 | ||
@@ -289,5 +291,5 @@ void omap_drm_irq_uninstall(struct drm_device *dev) | |||
289 | 291 | ||
290 | dev->irq_enabled = false; | 292 | dev->irq_enabled = false; |
291 | 293 | ||
292 | priv->dispc_ops->free_irq(dev); | 294 | priv->dispc_ops->free_irq(priv->dispc, dev); |
293 | } | 295 | } |
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 0665ed9fe395..2899435cad6e 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
@@ -77,17 +77,17 @@ static void omap_plane_atomic_update(struct drm_plane *plane, | |||
77 | &info.paddr, &info.p_uv_addr); | 77 | &info.paddr, &info.p_uv_addr); |
78 | 78 | ||
79 | /* and finally, update omapdss: */ | 79 | /* and finally, update omapdss: */ |
80 | ret = priv->dispc_ops->ovl_setup(omap_plane->id, &info, | 80 | ret = priv->dispc_ops->ovl_setup(priv->dispc, omap_plane->id, &info, |
81 | omap_crtc_timings(state->crtc), false, | 81 | omap_crtc_timings(state->crtc), false, |
82 | omap_crtc_channel(state->crtc)); | 82 | omap_crtc_channel(state->crtc)); |
83 | if (ret) { | 83 | if (ret) { |
84 | dev_err(plane->dev->dev, "Failed to setup plane %s\n", | 84 | dev_err(plane->dev->dev, "Failed to setup plane %s\n", |
85 | omap_plane->name); | 85 | omap_plane->name); |
86 | priv->dispc_ops->ovl_enable(omap_plane->id, false); | 86 | priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false); |
87 | return; | 87 | return; |
88 | } | 88 | } |
89 | 89 | ||
90 | priv->dispc_ops->ovl_enable(omap_plane->id, true); | 90 | priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, true); |
91 | } | 91 | } |
92 | 92 | ||
93 | static void omap_plane_atomic_disable(struct drm_plane *plane, | 93 | static void omap_plane_atomic_disable(struct drm_plane *plane, |
@@ -100,7 +100,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane, | |||
100 | plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY | 100 | plane->state->zpos = plane->type == DRM_PLANE_TYPE_PRIMARY |
101 | ? 0 : omap_plane->id; | 101 | ? 0 : omap_plane->id; |
102 | 102 | ||
103 | priv->dispc_ops->ovl_enable(omap_plane->id, false); | 103 | priv->dispc_ops->ovl_enable(priv->dispc, omap_plane->id, false); |
104 | } | 104 | } |
105 | 105 | ||
106 | static int omap_plane_atomic_check(struct drm_plane *plane, | 106 | static int omap_plane_atomic_check(struct drm_plane *plane, |
@@ -259,7 +259,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, | |||
259 | u32 possible_crtcs) | 259 | u32 possible_crtcs) |
260 | { | 260 | { |
261 | struct omap_drm_private *priv = dev->dev_private; | 261 | struct omap_drm_private *priv = dev->dev_private; |
262 | unsigned int num_planes = priv->dispc_ops->get_num_ovls(); | 262 | unsigned int num_planes = priv->dispc_ops->get_num_ovls(priv->dispc); |
263 | struct drm_plane *plane; | 263 | struct drm_plane *plane; |
264 | struct omap_plane *omap_plane; | 264 | struct omap_plane *omap_plane; |
265 | enum omap_plane_id id; | 265 | enum omap_plane_id id; |
@@ -278,7 +278,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, | |||
278 | if (!omap_plane) | 278 | if (!omap_plane) |
279 | return ERR_PTR(-ENOMEM); | 279 | return ERR_PTR(-ENOMEM); |
280 | 280 | ||
281 | formats = priv->dispc_ops->ovl_get_color_modes(id); | 281 | formats = priv->dispc_ops->ovl_get_color_modes(priv->dispc, id); |
282 | for (nformats = 0; formats[nformats]; ++nformats) | 282 | for (nformats = 0; formats[nformats]; ++nformats) |
283 | ; | 283 | ; |
284 | omap_plane->id = id; | 284 | omap_plane->id = id; |