Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: omapdrm: dispc: Pass DISPC pointer to dispc_ops operations

This removes the need to access the global DISPC private data in those
functions (both for the current accesses and the future ones that will
be introduced when allocating the DISPC private data dynamically).

In order to allow the omapdrm side to call the dispc_ops with a DISPC
pointer, we also introduce a new function dss_get_dispc() to retrieve
the DISPC corresponding to the DSS.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

authored by

Laurent Pinchart and committed by
Tomi Valkeinen
50638ae5 d3541ca8

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