18 #define DSS_SUBSYS_NAME "APPLY"
20 #include <linux/kernel.h>
21 #include <linux/slab.h>
123 static void dss_register_vsync_isr(
void);
127 return &dss_data.ovl_priv_data_array[ovl->
id];
132 return &dss_data.mgr_priv_data_array[mgr->
id];
143 for (i = 0; i < num_ovls; ++
i) {
146 op = &dss_data.ovl_priv_data_array[
i];
148 op->
info.global_alpha = 255;
211 mp = get_mgr_priv(mgr);
223 op = get_ovl_priv(ovl);
243 return dss_check_settings_low(mgr,
false);
252 return dss_check_settings_low(mgr,
true);
255 static bool need_isr(
void)
260 for (i = 0; i < num_mgrs; ++
i) {
266 mp = get_mgr_priv(mgr);
271 if (mgr_manual_update(mgr)) {
305 op = get_ovl_priv(ovl);
344 mp = get_mgr_priv(mgr);
350 op = get_ovl_priv(ovl);
359 static bool extra_info_update_ongoing(
void)
364 for (i = 0; i < num_mgrs; ++
i) {
370 mp = get_mgr_priv(mgr);
393 static void wait_pending_extra_info_updates(
void)
402 updating = extra_info_update_ongoing();
405 spin_unlock_irqrestore(&data_lock, flags);
409 init_completion(&extra_updated_completion);
411 spin_unlock_irqrestore(&data_lock, flags);
416 DSSWARN(
"timeout in wait_pending_extra_info_updates\n");
418 DSSERR(
"wait_pending_extra_info_updates failed: %d\n", r);
432 if (mgr_manual_update(mgr)) {
433 spin_unlock_irqrestore(&data_lock, flags);
438 spin_unlock_irqrestore(&data_lock, flags);
442 spin_unlock_irqrestore(&data_lock, flags);
452 bool shadow_dirty,
dirty;
457 spin_unlock_irqrestore(&data_lock, flags);
459 if (!dirty && !shadow_dirty) {
470 DSSERR(
"mgr(%d)->wait_for_go() not finishing\n",
481 DSSERR(
"mgr(%d)->wait_for_go() timeout\n", mgr->
id);
504 mp = get_mgr_priv(ovl->
manager);
508 if (ovl_manual_update(ovl)) {
509 spin_unlock_irqrestore(&data_lock, flags);
514 spin_unlock_irqrestore(&data_lock, flags);
518 spin_unlock_irqrestore(&data_lock, flags);
526 op = get_ovl_priv(ovl);
529 bool shadow_dirty,
dirty;
534 spin_unlock_irqrestore(&data_lock, flags);
536 if (!dirty && !shadow_dirty) {
547 DSSERR(
"ovl(%d)->wait_for_go() not finishing\n",
558 DSSERR(
"ovl(%d)->wait_for_go() timeout\n", ovl->
id);
568 static void dss_ovl_write_regs(
struct omap_overlay *ovl)
583 mp = get_mgr_priv(ovl->
manager);
593 DSSERR(
"dispc_ovl_setup failed for ovl %d\n", ovl->
id);
606 static void dss_ovl_write_regs_extra(
struct omap_overlay *ovl)
623 mp = get_mgr_priv(ovl->
manager);
644 dss_ovl_write_regs(ovl);
645 dss_ovl_write_regs_extra(ovl);
669 if (dss_mgr_is_lcd(mgr->
id)) {
691 static void dss_write_regs(
void)
696 for (i = 0; i < num_mgrs; ++
i) {
702 mp = get_mgr_priv(mgr);
704 if (!mp->
enabled || mgr_manual_update(mgr) || mp->
busy)
707 r = dss_check_settings(mgr);
709 DSSERR(
"cannot write registers for manager %s: "
710 "illegal configuration\n", mgr->
name);
714 dss_mgr_write_regs(mgr);
715 dss_mgr_write_regs_extra(mgr);
719 static void dss_set_go_bits(
void)
724 for (i = 0; i < num_mgrs; ++
i) {
729 mp = get_mgr_priv(mgr);
731 if (!mp->
enabled || mgr_manual_update(mgr) || mp->
busy)
739 if (!dss_data.irq_enabled && need_isr())
740 dss_register_vsync_isr();
753 mp = get_mgr_priv(mgr);
758 op = get_ovl_priv(ovl);
774 r = dss_check_settings(mgr);
776 DSSERR(
"cannot start manual update: illegal configuration\n");
777 spin_unlock_irqrestore(&data_lock, flags);
781 dss_mgr_write_regs(mgr);
782 dss_mgr_write_regs_extra(mgr);
786 if (!dss_data.irq_enabled && need_isr())
787 dss_register_vsync_isr();
791 mgr_clear_shadow_dirty(mgr);
793 spin_unlock_irqrestore(&data_lock, flags);
796 static void dss_apply_irq_handler(
void *
data,
u32 mask);
798 static void dss_register_vsync_isr(
void)
805 for (i = 0; i < num_mgrs; ++
i)
808 for (i = 0; i < num_mgrs; ++
i)
814 dss_data.irq_enabled =
true;
817 static void dss_unregister_vsync_isr(
void)
824 for (i = 0; i < num_mgrs; ++
i)
827 for (i = 0; i < num_mgrs; ++
i)
833 dss_data.irq_enabled =
false;
836 static void dss_apply_irq_handler(
void *
data,
u32 mask)
842 spin_lock(&data_lock);
845 for (i = 0; i < num_mgrs; i++) {
851 mp = get_mgr_priv(mgr);
859 if (!mgr_manual_update(mgr)) {
860 bool was_busy = mp->
busy;
863 if (was_busy && !mp->
busy)
864 mgr_clear_shadow_dirty(mgr);
871 extra_updating = extra_info_update_ongoing();
876 dss_unregister_vsync_isr();
878 spin_unlock(&data_lock);
881 static void omap_dss_mgr_apply_ovl(
struct omap_overlay *ovl)
885 op = get_ovl_priv(ovl);
899 mp = get_mgr_priv(mgr);
915 DSSDBG(
"omap_dss_mgr_apply(%s)\n", mgr->
name);
919 r = dss_check_settings_apply(mgr);
921 spin_unlock_irqrestore(&data_lock, flags);
922 DSSERR(
"failed to apply settings: illegal configuration.\n");
928 omap_dss_mgr_apply_ovl(ovl);
931 omap_dss_mgr_apply_mgr(mgr);
936 spin_unlock_irqrestore(&data_lock, flags);
945 op = get_ovl_priv(ovl);
954 static void dss_apply_ovl_fifo_thresholds(
struct omap_overlay *ovl,
967 static void dss_ovl_setup_fifo(
struct omap_overlay *ovl)
971 bool use_fifo_merge =
false;
977 use_fifo_merge, ovl_manual_update(ovl));
979 dss_apply_ovl_fifo_thresholds(ovl, fifo_low, fifo_high);
987 mp = get_mgr_priv(mgr);
993 dss_ovl_setup_fifo(ovl);
996 static
void dss_setup_fifos(
void)
1002 for (i = 0; i < num_mgrs; ++
i) {
1004 dss_mgr_setup_fifos(mgr);
1011 unsigned long flags;
1023 r = dss_check_settings(mgr);
1025 DSSERR(
"failed to enable manager %d: check_settings failed\n",
1035 if (!mgr_manual_update(mgr))
1038 spin_unlock_irqrestore(&data_lock, flags);
1040 if (!mgr_manual_update(mgr))
1050 spin_unlock_irqrestore(&data_lock, flags);
1058 unsigned long flags;
1065 if (!mgr_manual_update(mgr))
1073 spin_unlock_irqrestore(&data_lock, flags);
1083 unsigned long flags;
1095 spin_unlock_irqrestore(&data_lock, flags);
1104 unsigned long flags;
1110 spin_unlock_irqrestore(&data_lock, flags);
1121 DSSERR(
"manager %s is already connected to an output\n",
1128 DSSERR(
"output does not support manager %s\n",
1149 unsigned long flags;
1154 DSSERR(
"failed to unset output, output not set\n");
1162 DSSERR(
"output can't be unset when manager is enabled\n");
1167 spin_unlock_irqrestore(&data_lock, flags);
1176 spin_unlock_irqrestore(&data_lock, flags);
1195 unsigned long flags;
1201 DSSERR(
"cannot set timings for %s: manager needs to be disabled\n",
1206 dss_apply_mgr_timings(mgr, timings);
1208 spin_unlock_irqrestore(&data_lock, flags);
1223 unsigned long flags;
1229 DSSERR(
"cannot apply lcd config for %s: manager needs to be disabled\n",
1234 dss_apply_mgr_lcd_config(mgr, config);
1236 spin_unlock_irqrestore(&data_lock, flags);
1243 unsigned long flags;
1255 spin_unlock_irqrestore(&data_lock, flags);
1264 unsigned long flags;
1270 spin_unlock_irqrestore(&data_lock, flags);
1277 unsigned long flags;
1286 DSSERR(
"overlay '%s' already has a manager '%s'\n",
1295 spin_unlock_irqrestore(&data_lock, flags);
1296 DSSERR(
"overlay has to be disabled to change the manager\n");
1307 spin_unlock_irqrestore(&data_lock, flags);
1333 unsigned long flags;
1339 DSSERR(
"failed to detach overlay: manager not set\n");
1347 spin_unlock_irqrestore(&data_lock, flags);
1348 DSSERR(
"overlay has to be disabled to unset the manager\n");
1353 spin_unlock_irqrestore(&data_lock, flags);
1356 wait_pending_extra_info_updates();
1365 spin_unlock_irqrestore(&data_lock, flags);
1378 unsigned long flags;
1385 spin_unlock_irqrestore(&data_lock, flags);
1393 unsigned long flags;
1412 r = dss_check_settings(ovl->
manager);
1414 DSSERR(
"failed to enable overlay %d: check_settings failed\n",
1422 dss_apply_ovl_enable(ovl,
true);
1427 spin_unlock_irqrestore(&data_lock, flags);
1434 spin_unlock_irqrestore(&data_lock, flags);
1443 unsigned long flags;
1460 dss_apply_ovl_enable(ovl,
false);
1464 spin_unlock_irqrestore(&data_lock, flags);