dce110_tg_set_overscan_color(tg, overscan_color);
}
+/* Gets first line of blank region of the display timing for CRTC
+ * and programms is as a trigger to fire vertical interrupt
+ */
+bool dce110_arm_vert_intr(struct timing_generator *tg, uint8_t width)
+{
+ struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
+ uint32_t vbl = 0;
+ uint32_t val = 0;
+ uint32_t position, vbl_start;
+
+ tg->funcs->get_scanoutpos(
+ tg,
+ &vbl,
+ &position);
+
+ if (vbl == 0)
+ return false;
+
+ vbl_start =
+ get_reg_field_value(
+ vbl,
+ CRTC_V_BLANK_START_END,
+ CRTC_V_BLANK_START);
+
+ set_reg_field_value(
+ val,
+ vbl_start,
+ CRTC_VERTICAL_INTERRUPT0_POSITION,
+ CRTC_VERTICAL_INTERRUPT0_LINE_START);
+
+ /* Set interaval width for interrupt to fire to 1 scanline */
+ set_reg_field_value(
+ val,
+ vbl_start + width,
+ CRTC_VERTICAL_INTERRUPT0_POSITION,
+ CRTC_VERTICAL_INTERRUPT0_LINE_END);
+
+ dm_write_reg(tg->ctx, CRTC_REG(mmCRTC_VERTICAL_INTERRUPT0_POSITION), val);
+
+ return true;
+}
+
static const struct timing_generator_funcs dce110_tg_funcs = {
.validate_timing = dce110_tg_validate_timing,
.program_timing = dce110_tg_program_timing,
dce110_timing_generator_set_drr,
.set_static_screen_control =
dce110_timing_generator_set_static_screen_control,
- .set_test_pattern = dce110_timing_generator_set_test_pattern
-
+ .set_test_pattern = dce110_timing_generator_set_test_pattern,
+ .arm_vert_intr = dce110_arm_vert_intr,
};
bool dce110_timing_generator_construct(
const struct tg_color *blank_color,
const struct tg_color *overscan_color);
+bool dce110_arm_vert_intr(
+ struct timing_generator *tg, uint8_t width);
+
#endif /* __DC_TIMING_GENERATOR_DCE110_H__ */
}
}
+static bool dce120_arm_vert_intr(
+ struct timing_generator *tg,
+ uint8_t width)
+{
+ struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
+ uint32_t vbl, position, vbl_start;
+
+ tg->funcs->get_scanoutpos(
+ tg,
+ &vbl,
+ &position);
+
+ if (vbl == 0)
+ return false;
+
+ vbl_start =
+ get_reg_field_value(
+ vbl,
+ CRTC0_CRTC_V_BLANK_START_END,
+ CRTC_V_BLANK_START);
+
+ CRTC_REG_SET_2(
+ CRTC0_CRTC_VERTICAL_INTERRUPT0_POSITION,
+ CRTC_VERTICAL_INTERRUPT0_LINE_START, vbl_start,
+ CRTC_VERTICAL_INTERRUPT0_LINE_END, vbl_start + width);
+
+ return true;
+}
+
static struct timing_generator_funcs dce120_tg_funcs = {
.validate_timing = dce120_tg_validate_timing,
.program_timing = dce120_tg_program_timing,
.enable_advanced_request = dce120_timing_generator_enable_advanced_request,
.set_drr = dce120_timing_generator_set_drr,
.set_static_screen_control = dce120_timing_generator_set_static_screen_control,
- .set_test_pattern = dce120_timing_generator_set_test_pattern
+ .set_test_pattern = dce120_timing_generator_set_test_pattern,
+ .arm_vert_intr = dce120_arm_vert_intr,
};
.set_static_screen_control =
dce110_timing_generator_set_static_screen_control,
.set_test_pattern = dce110_timing_generator_set_test_pattern,
+ .arm_vert_intr = dce110_arm_vert_intr,
/* DCE8.0 overrides */
.enable_advanced_request =
enum controller_dp_test_pattern test_pattern,
enum dc_color_depth color_depth);
+ bool (*arm_vert_intr)(struct timing_generator *tg, uint8_t width);
+
};
#endif
#include "dce/dce_11_0_d.h"
#include "dce/dce_11_0_sh_mask.h"
+
#include "ivsrcid/ivsrcid_vislands30.h"
-#define VISLANDS30_IV_SRCID_D1_VBLANK 1
-#define VISLANDS30_IV_SRCID_D2_VBLANK 2
-#define VISLANDS30_IV_SRCID_D3_VBLANK 3
-#define VISLANDS30_IV_SRCID_D4_VBLANK 4
-#define VISLANDS30_IV_SRCID_D5_VBLANK 5
-#define VISLANDS30_IV_SRCID_D6_VBLANK 6
+#include "core_dc.h"
static bool hpd_ack(
struct irq_service *irq_service,
};
static const struct irq_source_info_funcs vblank_irq_info_funcs = {
- .set = NULL,
+ .set = dce110_vblank_set,
.ack = NULL
};
#define vblank_int_entry(reg_num)\
[DC_IRQ_SOURCE_VBLANK1 + reg_num] = {\
- .enable_reg = mmLB ## reg_num ## _LB_INTERRUPT_MASK,\
+ .enable_reg = mmCRTC ## reg_num ## _CRTC_VERTICAL_INTERRUPT0_CONTROL,\
.enable_mask =\
- LB_INTERRUPT_MASK__VBLANK_INTERRUPT_MASK_MASK,\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_INT_ENABLE_MASK,\
.enable_value = {\
- LB_INTERRUPT_MASK__VBLANK_INTERRUPT_MASK_MASK,\
- ~LB_INTERRUPT_MASK__VBLANK_INTERRUPT_MASK_MASK},\
- .ack_reg = mmLB ## reg_num ## _LB_VBLANK_STATUS,\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_INT_ENABLE_MASK,\
+ ~CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_INT_ENABLE_MASK},\
+ .ack_reg = mmCRTC ## reg_num ## _CRTC_VERTICAL_INTERRUPT0_CONTROL,\
.ack_mask =\
- LB_VBLANK_STATUS__VBLANK_ACK_MASK,\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_CLEAR_MASK,\
.ack_value =\
- LB_VBLANK_STATUS__VBLANK_ACK_MASK,\
- .funcs = &vblank_irq_info_funcs\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_CLEAR_MASK,\
+ .funcs = &vblank_irq_info_funcs,\
+ .src_id = VISLANDS30_IV_SRCID_D1_VERTICAL_INTERRUPT0 + reg_num\
}
#define dummy_irq_entry() \
return false;
}
+
+bool dce110_vblank_set(
+ struct irq_service *irq_service,
+ const struct irq_source_info *info,
+ bool enable)
+{
+ struct dc_context *dc_ctx = irq_service->ctx;
+ struct core_dc *core_dc = DC_TO_CORE(irq_service->ctx->dc);
+ enum dc_irq_source dal_irq_src = dc_interrupt_to_irq_source(
+ irq_service->ctx->dc,
+ info->src_id,
+ info->ext_id);
+ uint8_t pipe_offset = dal_irq_src - IRQ_TYPE_VBLANK;
+
+ struct timing_generator *tg =
+ core_dc->current_context->res_ctx.pipe_ctx[pipe_offset].tg;
+
+ if (enable) {
+ if (!tg->funcs->arm_vert_intr(tg, 2)) {
+ DC_ERROR("Failed to get VBLANK!\n");
+ return false;
+ }
+ }
+
+ dal_irq_service_set_generic(irq_service, info, enable);
+ return true;
+
+}
+
static const struct irq_source_info_funcs dummy_irq_info_funcs = {
.set = dal_irq_service_dummy_set,
.ack = dal_irq_service_dummy_ack
uint32_t ext_id)
{
switch (src_id) {
- case VISLANDS30_IV_SRCID_D1_VBLANK:
+ case VISLANDS30_IV_SRCID_D1_VERTICAL_INTERRUPT0:
return DC_IRQ_SOURCE_VBLANK1;
- case VISLANDS30_IV_SRCID_D2_VBLANK:
+ case VISLANDS30_IV_SRCID_D2_VERTICAL_INTERRUPT0:
return DC_IRQ_SOURCE_VBLANK2;
- case VISLANDS30_IV_SRCID_D3_VBLANK:
+ case VISLANDS30_IV_SRCID_D3_VERTICAL_INTERRUPT0:
return DC_IRQ_SOURCE_VBLANK3;
- case VISLANDS30_IV_SRCID_D4_VBLANK:
+ case VISLANDS30_IV_SRCID_D4_VERTICAL_INTERRUPT0:
return DC_IRQ_SOURCE_VBLANK4;
- case VISLANDS30_IV_SRCID_D5_VBLANK:
+ case VISLANDS30_IV_SRCID_D5_VERTICAL_INTERRUPT0:
return DC_IRQ_SOURCE_VBLANK5;
- case VISLANDS30_IV_SRCID_D6_VBLANK:
+ case VISLANDS30_IV_SRCID_D6_VERTICAL_INTERRUPT0:
return DC_IRQ_SOURCE_VBLANK6;
case VISLANDS30_IV_SRCID_D1_V_UPDATE_INT:
return DC_IRQ_SOURCE_VUPDATE1;
struct irq_service *irq_service,
const struct irq_source_info *info);
+bool dce110_vblank_set(
+ struct irq_service *irq_service,
+ const struct irq_source_info *info,
+ bool enable);
+
#endif
};
static const struct irq_source_info_funcs vblank_irq_info_funcs = {
- .set = NULL,
+ .set = dce110_vblank_set,
.ack = NULL
};
#define vblank_int_entry(reg_num)\
[DC_IRQ_SOURCE_VBLANK1 + reg_num] = {\
- IRQ_REG_ENTRY(LB, reg_num,\
- LB_INTERRUPT_MASK, VBLANK_INTERRUPT_MASK,\
- LB_VBLANK_STATUS, VBLANK_ACK),\
- .funcs = &vblank_irq_info_funcs\
+ IRQ_REG_ENTRY(CRTC, reg_num,\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL, CRTC_VERTICAL_INTERRUPT0_INT_ENABLE,\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL, CRTC_VERTICAL_INTERRUPT0_CLEAR),\
+ .funcs = &vblank_irq_info_funcs,\
+ .src_id = VISLANDS30_IV_SRCID_D1_VERTICAL_INTERRUPT0 + reg_num\
}
#define dummy_irq_entry() \
#include "ivsrcid/ivsrcid_vislands30.h"
+#include "dc_types.h"
+#include "inc/core_dc.h"
+
static bool hpd_ack(
struct irq_service *irq_service,
const struct irq_source_info *info)
};
static const struct irq_source_info_funcs vblank_irq_info_funcs = {
- .set = NULL,
+ .set = dce110_vblank_set,
.ack = NULL
};
#define vblank_int_entry(reg_num)\
[DC_IRQ_SOURCE_VBLANK1 + reg_num] = {\
- .enable_reg = mmLB ## reg_num ## _LB_INTERRUPT_MASK,\
+ .enable_reg = mmCRTC ## reg_num ## _CRTC_VERTICAL_INTERRUPT0_CONTROL,\
.enable_mask =\
- LB_INTERRUPT_MASK__VBLANK_INTERRUPT_MASK_MASK,\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_INT_ENABLE_MASK,\
.enable_value = {\
- LB_INTERRUPT_MASK__VBLANK_INTERRUPT_MASK_MASK,\
- ~LB_INTERRUPT_MASK__VBLANK_INTERRUPT_MASK_MASK},\
- .ack_reg = mmLB ## reg_num ## _LB_VBLANK_STATUS,\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_INT_ENABLE_MASK,\
+ ~CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_INT_ENABLE_MASK},\
+ .ack_reg = mmCRTC ## reg_num ## _CRTC_VERTICAL_INTERRUPT0_CONTROL,\
.ack_mask =\
- LB_VBLANK_STATUS__VBLANK_ACK_MASK,\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_CLEAR_MASK,\
.ack_value =\
- LB_VBLANK_STATUS__VBLANK_ACK_MASK,\
- .funcs = &vblank_irq_info_funcs\
+ CRTC_VERTICAL_INTERRUPT0_CONTROL__CRTC_VERTICAL_INTERRUPT0_CLEAR_MASK,\
+ .funcs = &vblank_irq_info_funcs,\
+ .src_id = VISLANDS30_IV_SRCID_D1_VERTICAL_INTERRUPT0 + reg_num\
}
#define dummy_irq_entry() \