Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e82b090b authored by Tomi Valkeinen's avatar Tomi Valkeinen
Browse files

OMAP: DSS2: DISPC: improve dispc_mgr_enable_digit_out()



dispc_mgr_enable_digit_out() didn't handle HDMI case very well.

Improve the function to use FRAMEDONETV interrupt to see when HDMI has
been disabled.

Cc: Mythri P K <mythripk@ti.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 4a61e267
Loading
Loading
Loading
Loading
+29 −20
Original line number Original line Diff line number Diff line
@@ -1924,11 +1924,16 @@ static void _enable_digit_out(bool enable)
static void dispc_mgr_enable_digit_out(bool enable)
static void dispc_mgr_enable_digit_out(bool enable)
{
{
	struct completion frame_done_completion;
	struct completion frame_done_completion;
	int r;
	enum dss_hdmi_venc_clk_source_select src;
	int r, i;
	u32 irq_mask;
	int num_irqs;


	if (REG_GET(DISPC_CONTROL, 1, 1) == enable)
	if (REG_GET(DISPC_CONTROL, 1, 1) == enable)
		return;
		return;


	src = dss_get_hdmi_venc_clk_source();

	if (enable) {
	if (enable) {
		unsigned long flags;
		unsigned long flags;
		/* When we enable digit output, we'll get an extra digit
		/* When we enable digit output, we'll get an extra digit
@@ -1945,36 +1950,40 @@ static void dispc_mgr_enable_digit_out(bool enable)
	 * wait for the extra sync losts */
	 * wait for the extra sync losts */
	init_completion(&frame_done_completion);
	init_completion(&frame_done_completion);


	if (src == DSS_HDMI_M_PCLK && enable == false) {
		irq_mask = DISPC_IRQ_FRAMEDONETV;
		num_irqs = 1;
	} else {
		irq_mask = DISPC_IRQ_EVSYNC_EVEN | DISPC_IRQ_EVSYNC_ODD;
		/* XXX I understand from TRM that we should only wait for the
		 * current field to complete. But it seems we have to wait for
		 * both fields */
		num_irqs = 2;
	}

	r = omap_dispc_register_isr(dispc_disable_isr, &frame_done_completion,
	r = omap_dispc_register_isr(dispc_disable_isr, &frame_done_completion,
			DISPC_IRQ_EVSYNC_EVEN | DISPC_IRQ_EVSYNC_ODD);
			irq_mask);
	if (r)
	if (r)
		DSSERR("failed to register EVSYNC isr\n");
		DSSERR("failed to register %x isr\n", irq_mask);


	_enable_digit_out(enable);
	_enable_digit_out(enable);


	/* XXX I understand from TRM that we should only wait for the
	for (i = 0; i < num_irqs; ++i) {
	 * current field to complete. But it seems we have to wait
	 * for both fields */
		if (!wait_for_completion_timeout(&frame_done_completion,
		if (!wait_for_completion_timeout(&frame_done_completion,
					msecs_to_jiffies(100)))
					msecs_to_jiffies(100)))
		DSSERR("timeout waiting for EVSYNC\n");
			DSSERR("timeout waiting for digit out to %s\n",

					enable ? "start" : "stop");
	if (!wait_for_completion_timeout(&frame_done_completion,
	}
				msecs_to_jiffies(100)))
		DSSERR("timeout waiting for EVSYNC\n");


	r = omap_dispc_unregister_isr(dispc_disable_isr,
	r = omap_dispc_unregister_isr(dispc_disable_isr, &frame_done_completion,
			&frame_done_completion,
			irq_mask);
			DISPC_IRQ_EVSYNC_EVEN | DISPC_IRQ_EVSYNC_ODD);
	if (r)
	if (r)
		DSSERR("failed to unregister EVSYNC isr\n");
		DSSERR("failed to unregister %x isr\n", irq_mask);


	if (enable) {
	if (enable) {
		unsigned long flags;
		unsigned long flags;
		spin_lock_irqsave(&dispc.irq_lock, flags);
		spin_lock_irqsave(&dispc.irq_lock, flags);
		dispc.irq_error_mask = DISPC_IRQ_MASK_ERROR;
		dispc.irq_error_mask |= DISPC_IRQ_SYNC_LOST_DIGIT;
		if (dss_has_feature(FEAT_MGR_LCD2))
			dispc.irq_error_mask |= DISPC_IRQ_SYNC_LOST2;
		dispc_write_reg(DISPC_IRQSTATUS, DISPC_IRQ_SYNC_LOST_DIGIT);
		dispc_write_reg(DISPC_IRQSTATUS, DISPC_IRQ_SYNC_LOST_DIGIT);
		_omap_dispc_set_irqs();
		_omap_dispc_set_irqs();
		spin_unlock_irqrestore(&dispc.irq_lock, flags);
		spin_unlock_irqrestore(&dispc.irq_lock, flags);