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

Commit 3ed62916 authored by Michael Adisumarta's avatar Michael Adisumarta
Browse files

ipa: msm: printing rp wp values if channel stop fails



Dumping rp and wp of the channel, if it fails to reset/stop.

Change-Id: Ie0ebec5ec2cc6be987fdbb0548a911d530da75fd
Acked-by: default avatarSuhas Mallesh <smallesh@qti.qualcomm.com>
Signed-off-by: default avatarMichael Adisumarta <madisuma@codeaurora.org>
parent d267b6d1
Loading
Loading
Loading
Loading
+45 −2
Original line number Diff line number Diff line
@@ -113,6 +113,39 @@ static void __gsi_config_gen_irq(int ee, uint32_t mask, uint32_t val)
			GSI_EE_n_CNTXT_GSI_IRQ_EN_OFFS(ee));
}

static void gsi_get_rp_wp(unsigned long chan_hdl,
	uint32_t *rp, uint32_t *wp)
{
	struct gsi_chan_ctx *ctx;
	int ee;

	if (!gsi_ctx) {
		pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__);
		return;
	}

	if (chan_hdl >= gsi_ctx->max_ch) {
		GSIERR("bad params, can't read rp and wp");
		return;
	}

	ctx = &gsi_ctx->chan[chan_hdl];
	ee = gsi_ctx->per.ee;
	if (ctx->props.prot == GSI_CHAN_PROT_WDI3) {
		*rp = gsi_readl(gsi_ctx->base +
			GSI_EE_n_GSI_CH_k_RE_FETCH_READ_PTR_OFFS(chan_hdl,
				gsi_ctx->per.ee));
		*wp = gsi_readl(gsi_ctx->base +
			GSI_EE_n_GSI_CH_k_RE_FETCH_WRITE_PTR_OFFS(chan_hdl,
				gsi_ctx->per.ee));
	} else {
		*rp = gsi_readl(gsi_ctx->base +
			GSI_EE_n_GSI_CH_k_CNTXT_4_OFFS(ctx->props.ch_id, ee));
		*wp = gsi_readl(gsi_ctx->base +
			GSI_EE_n_GSI_CH_k_CNTXT_6_OFFS(ctx->props.ch_id, ee));
	}
}

static void gsi_channel_state_change_wait(unsigned long chan_hdl,
	struct gsi_chan_ctx *ctx,
	uint32_t tm, enum gsi_ch_cmd_opcode op)
@@ -126,6 +159,7 @@ static void gsi_channel_state_change_wait(unsigned long chan_hdl,
	enum gsi_chan_state curr_state = GSI_CHAN_STATE_NOT_ALLOCATED;
	int stop_in_proc_retry = 0;
	int stop_retry = 0;
	uint32_t rp, wp;

	/*
	 * Start polling the GSI channel for
@@ -207,15 +241,24 @@ static void gsi_channel_state_change_wait(unsigned long chan_hdl,
			return;
		}

		gsi_get_rp_wp(chan_hdl, &rp, &wp);
		GSIDBG("GSI wait on chan_hld=%lu irqtyp=%u state=%u intr=%u\n",
			chan_hdl,
			type,
			ctx->state,
			gsi_pending_intr);
		GSIDBG("rp=%u wp=%u\n", rp, wp);
	}

	GSIDBG("invalidating the channel state when timeout happens\n");
	ctx->state = curr_state;
	val = gsi_readl(gsi_ctx->base +
			GSI_EE_n_GSI_CH_k_CNTXT_0_OFFS(chan_hdl,
				gsi_ctx->per.ee));
	ctx->state = (val &
		GSI_EE_n_GSI_CH_k_CNTXT_0_CHSTATE_BMSK) >>
		GSI_EE_n_GSI_CH_k_CNTXT_0_CHSTATE_SHFT;
	GSIDBG("Channel state change timeout, curr ch_state=%d\n",
		ctx->state);
	GSI_ASSERT();
}

static void gsi_handle_ch_ctrl(int ee)