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

Commit 0e691a61 authored by Vipin Deep Kaur's avatar Vipin Deep Kaur
Browse files

dma: gpi: Correct the return code in dmaengine_pause api



Correct the return code in dmaengine_pause api.
Enhance debug infra in GSI driver.

Change-Id: Ic05d45c028d38ae756bce01402bb6b0413b08702
Signed-off-by: default avatarVipin Deep Kaur <vkaur@codeaurora.org>
parent 5efe1606
Loading
Loading
Loading
Loading
+41 −2
Original line number Diff line number Diff line
@@ -2306,7 +2306,11 @@ static void gpi_noop_tre(struct gpii_chan *gpii_chan)
	noop_tre = NOOP_TRE;

	while (local_rp != local_wp) {
		/* dump the channel ring at the time of error */
		tre = (struct msm_gpi_tre *)cntxt_rp;
		GPII_ERR(gpii, gpii_chan->chid, "local_rp:0x%011x TRE: %08x %08x %08x %08x\n",
			local_rp, tre->dword[0], tre->dword[1],
			 tre->dword[2], tre->dword[3]);
		tre->dword[3] &= noop_mask;
		tre->dword[3] |= noop_tre;
		local_rp += ch_ring->el_size;
@@ -2327,11 +2331,46 @@ static int gpi_pause(struct dma_chan *chan)
{
	struct gpii_chan *gpii_chan = to_gpii_chan(chan);
	struct gpii *gpii = gpii_chan->gpii;
	int i, ret;
	int i, ret, idx = 0;
	u32 offset1, offset2, type1, type2;
	struct gpi_ring *ev_ring = &gpii->ev_ring;
	phys_addr_t cntxt_rp, local_rp;
	void *rp, *rp1;
	union gpi_event *gpi_event;
	u32 chid, type;

	GPII_INFO(gpii, gpii_chan->chid, "Enter\n");
	mutex_lock(&gpii->ctrl_lock);

	/* dump the GPII IRQ register at the time of error */
	offset1 = GPI_GPII_n_CNTXT_TYPE_IRQ_OFFS(gpii->gpii_id);
	offset2 = GPI_GPII_n_CNTXT_SRC_IEOB_IRQ_MSK_OFFS(gpii->gpii_id);
	while (idx++ < 3) {
		type1 = gpi_read_reg(gpii, gpii->regs + offset1);
		type2 = gpi_read_reg(gpii, gpii->regs + offset2);
		GPII_ERR(gpii, GPI_DBG_COMMON, "CNTXT_TYPE_IRQ:0x%08x IEOB_MASK_OFF:0x%08x\n",
		  type1, type2);
	}

	cntxt_rp = gpi_read_reg(gpii, gpii->ev_ring_rp_lsb_reg);
	rp = to_virtual(ev_ring, cntxt_rp);
	local_rp = to_physical(ev_ring, ev_ring->rp);
	rp1 = ev_ring->rp;

	/* dump the event ring at the time of error */
	GPII_ERR(gpii, GPI_DBG_COMMON, "cntxt_rp:%pa local_rp:%pa\n",
		  &cntxt_rp, &local_rp);
	while (rp != rp1) {
		gpi_event = rp1;
		chid = gpi_event->xfer_compl_event.chid;
		type = gpi_event->xfer_compl_event.type;
		GPII_ERR(gpii, GPI_DBG_COMMON,
		  "chid:%u type:0x%x %08x %08x %08x %08x\n", chid, type,
		gpi_event->gpi_ere.dword[0], gpi_event->gpi_ere.dword[1],
		gpi_event->gpi_ere.dword[2], gpi_event->gpi_ere.dword[3]);
		rp1 += ev_ring->el_size;
	}

	/* send stop command to stop the channels */
	for (i = 0; i < MAX_CHANNELS_PER_GPII; i++) {
		gpii_chan = &gpii->gpii_chan[i];
@@ -2362,7 +2401,7 @@ static int gpi_pause(struct dma_chan *chan)
			GPII_ERR(gpii, gpii_chan->chid,
				 "Error Starting Channel ret:%d\n", ret);
			mutex_unlock(&gpii->ctrl_lock);
			return ret;
			return -ECONNRESET;
		}
	}